diff --git a/reactos/dll/mesa32/Makefile.ReactOS b/reactos/dll/mesa32/Makefile.ReactOS new file mode 100644 index 00000000000..cf4646748d3 --- /dev/null +++ b/reactos/dll/mesa32/Makefile.ReactOS @@ -0,0 +1,82 @@ +# Makefile to import Mesa3D into ReactOS +# +# Place this into Mesa/src/mesa and run make -f Makefile.ReactOS to create +# a mesa32 output directory which contains the source code and a mesa32.xml +# rbuild file. + +.PHONY: import_mesa3d +doonly: import_mesa3d + +# Output directory +OUTPUT = mesa32 + +# Enable the OpenGL ICD interface +ICD=1 + +# Enable x86 optimizations +X86=1 + +include Makefile.mgw + +# rbuild XML creation + +RBUILD_OUTPUT = + +RBUILD_HEADER = '\n' +RBUILD_HEADER += '\n' +RBUILD_HEADER += '\t\n' +RBUILD_HEADER += '\t-Wl,--enable-stdcall-fixup\n' +RBUILD_HEADER += '\tntdll\n' +RBUILD_HEADER += '\tkernel32\n' +RBUILD_HEADER += '\t\n' +RBUILD_HEADER += '\t\n' +RBUILD_HEADER += '\t\n' + +RBUILD_FOOTER += '\n' + +define rbuild_xml_include + INC = $(1:-I$(TOP)/src/mesa%=src%) + INC2 = $(INC:-I$(TOP)/%=%) + ifneq ($(INC2),) + RBUILD_OUTPUT += '\t$(INC2)\n' + endif +endef + +define rbuild_xml_library + RBUILD_OUTPUT += '\t$(1:-l%=%)\n' +endef + +define rbuild_xml_define + RBUILD_OUTPUT += '\t\n' +endef + +define rbuild_xml_file + RBUILD_OUTPUT += '\tsrc/$(1)\n' +endef + +rbuild_makefile: + $(foreach library,$(filter -l%,$(LDLIBS)),$(eval $(call rbuild_xml_library,$(library)))) + $(foreach define,$(filter -D%,$(CFLAGS)),$(eval $(call rbuild_xml_define,$(define)))) + $(foreach include,$(filter -I%,$(INCLUDE_DIRS)),$(eval $(call rbuild_xml_include,$(include)))) + $(foreach file,$(SOURCES),$(eval $(call rbuild_xml_file,$(file)))) + @echo -ne $(RBUILD_HEADER)$(RBUILD_OUTPUT)$(RBUILD_FOOTER) > $(OUTPUT)/mesa32.xml + +# Main import target + +SOURCE_DIRS = + +define import_add_dir + DIR = $(firstword $(subst /, ,$(dir $(1)))) + ifeq ($(filter $(DIR),$(SOURCE_DIRS)),) + SOURCE_DIRS += $(DIR) + endif +endef + +$(OUTPUT): + test -d $(OUTPUT) || mkdir -p $(OUTPUT) + +import_mesa3d: $(OUTPUT) rbuild_makefile + $(foreach file,$(SOURCES),$(eval $(call import_add_dir,$(file)))) + cp -r $(TOP)/include $(OUTPUT) + test -d $(OUTPUT)/src || mkdir -p $(OUTPUT)/src + cp -r $(SOURCE_DIRS) $(OUTPUT)/src diff --git a/reactos/dll/mesa32/README.ReactOS b/reactos/dll/mesa32/README.ReactOS new file mode 100644 index 00000000000..13ad07b5228 --- /dev/null +++ b/reactos/dll/mesa32/README.ReactOS @@ -0,0 +1,8 @@ +This is Mesa-6.4 (http://www.mesa3d.org/) with an ICD interface. + +The ICD functions are in src/drivers/windows/icd/icd.c +I have created a Makefile.ReactOS which will generate a mesa32 output directory +containing the needed sources and a mesa32.xml rbuild file. + + --blight + diff --git a/reactos/dll/mesa32/include/GL/amesa.h b/reactos/dll/mesa32/include/GL/amesa.h new file mode 100644 index 00000000000..852d34cf4f5 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/amesa.h @@ -0,0 +1,65 @@ +/* + * Mesa 3-D graphics library + * Version: 3.3 + * + * Copyright (C) 1999-2000 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. + */ + + +/* Allegro (DJGPP) driver by Bernhard Tschirren (bernie-t@geocities.com) */ + + +#ifndef AMESA_H +#define AMESA_H + + +#define AMESA_MAJOR_VERSION 3 +#define AMESA_MINOR_VERSION 3 + + +typedef struct amesa_visual *AMesaVisual; +typedef struct amesa_buffer *AMesaBuffer; +typedef struct amesa_context *AMesaContext; + + +extern AMesaVisual AMesaCreateVisual(GLboolean dbFlag, GLint depth, + GLint depthSize, + GLint stencilSize, + GLint accumSize); + +extern void AMesaDestroyVisual(AMesaVisual visual); + +extern AMesaBuffer AMesaCreateBuffer(AMesaVisual visual, + GLint width, GLint height); + +extern void AMesaDestroyBuffer(AMesaBuffer buffer); + + +extern AMesaContext AMesaCreateContext(AMesaVisual visual, + AMesaContext sharelist); + +extern void AMesaDestroyContext(AMesaContext context); + +extern GLboolean AMesaMakeCurrent(AMesaContext context, AMesaBuffer buffer); + +extern void AMesaSwapBuffers(AMesaBuffer buffer); + + +#endif /* AMESA_H */ diff --git a/reactos/dll/mesa32/include/GL/directfbgl.h b/reactos/dll/mesa32/include/GL/directfbgl.h new file mode 100644 index 00000000000..984c4b14279 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/directfbgl.h @@ -0,0 +1,89 @@ +/* + (c) Copyright 2001 convergence integrated media GmbH. + All rights reserved. + + Written by Denis Oliver Kropp and + Andreas Hundt . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __DIRECTFBGL_H__ +#define __DIRECTFBGL_H__ + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + + +typedef struct { + int buffer_size; + int depth_size; + int stencil_size; + int aux_buffers; + + int red_size; + int green_size; + int blue_size; + int alpha_size; + + int accum_red_size; + int accum_green_size; + int accum_blue_size; + int accum_alpha_size; + + DFBBoolean double_buffer; + DFBBoolean stereo; +} DFBGLAttributes; + + +DEFINE_INTERFACE( IDirectFBGL, + + /** Context handling **/ + + /* + * Acquire the hardware lock. + */ + DFBResult (*Lock) ( + IDirectFBGL *thiz + ); + + /* + * Release the lock. + */ + DFBResult (*Unlock) ( + IDirectFBGL *thiz + ); + + /* + * Query the OpenGL attributes. + */ + DFBResult (*GetAttributes) ( + IDirectFBGL *thiz, + DFBGLAttributes *attributes + ); +) + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/reactos/dll/mesa32/include/GL/dmesa.h b/reactos/dll/mesa32/include/GL/dmesa.h new file mode 100644 index 00000000000..e67b3426f93 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/dmesa.h @@ -0,0 +1,160 @@ +/* + * 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. + */ + +/* + * DOS/DJGPP device driver v1.7 for Mesa + * + * Copyright (C) 2002 - Daniel Borca + * Email : dborca@users.sourceforge.net + * Web : http://www.geocities.com/dborca + */ + + +#ifndef DMESA_H_included +#define DMESA_H_included + +#define DMESA_MAJOR_VERSION 6 +#define DMESA_MINOR_VERSION 3 + +/* Sample Usage: + * + * 1. Call DMesaCreateVisual() to initialize graphics. + * 2. Call DMesaCreateContext() to create a DMesa rendering context. + * 3. Call DMesaCreateBuffer() to define the window. + * 4. Call DMesaMakeCurrent() to bind the DMesaBuffer to a DMesaContext. + * 5. Make gl* calls to render your graphics. + * 6. Use DMesaSwapBuffers() when double buffering to swap front/back buffers. + * 7. Before exiting, destroy DMesaBuffer, DMesaContext and DMesaVisual. + */ + +typedef struct dmesa_context *DMesaContext; +typedef struct dmesa_visual *DMesaVisual; +typedef struct dmesa_buffer *DMesaBuffer; + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create a new Visual and set graphics mode. + */ +DMesaVisual DMesaCreateVisual (GLint width, /* X res */ + GLint height, /* Y res */ + GLint colDepth, /* BPP */ + GLint refresh, /* refresh rate: 0=default */ + GLboolean dbFlag, /* double-buffered */ + GLboolean rgbFlag, /* RGB mode */ + GLint alphaSize, /* requested bits/alpha */ + GLint depthSize, /* requested bits/depth */ + GLint stencilSize, /* requested bits/stencil */ + GLint accumSize); /* requested bits/accum */ + +/* + * Destroy Visual and restore screen. + */ +void DMesaDestroyVisual (DMesaVisual v); + + + +/* + * Create a new Context for rendering. + */ +DMesaContext DMesaCreateContext (DMesaVisual visual, DMesaContext share); + +/* + * Destroy Context. + */ +void DMesaDestroyContext (DMesaContext c); + +/* + * Return a handle to the current context. + */ +DMesaContext DMesaGetCurrentContext (void); + + + +/* + * Create a new Buffer (window). + */ +DMesaBuffer DMesaCreateBuffer (DMesaVisual visual, + GLint xpos, GLint ypos, + GLint width, GLint height); + +/* + * Destroy Buffer. + */ +void DMesaDestroyBuffer (DMesaBuffer b); + +/* + * Return a handle to the current buffer. + */ +DMesaBuffer DMesaGetCurrentBuffer (void); + +/* + * Swap the front and back buffers for the given Buffer. + * No action is taken if the buffer is not double buffered. + */ +void DMesaSwapBuffers (DMesaBuffer b); + +/* + * Bind Buffer to Context and make the Context the current one. + */ +GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b); + + + +/* + * Move/Resize current Buffer. + */ +GLboolean DMesaMoveBuffer (GLint xpos, GLint ypos); +GLboolean DMesaResizeBuffer (GLint width, GLint height); + +/* + * Set palette index, using normalized values. + */ +void DMesaSetCI (int ndx, GLfloat red, GLfloat green, GLfloat blue); + +/* + * DMesa functions + */ +typedef void (*DMesaProc) (void); +DMesaProc DMesaGetProcAddress (const char *name); + +/* + * DMesa state retrieval. + */ +#define DMESA_GET_SCREEN_SIZE 0x0100 +#define DMESA_GET_DRIVER_CAPS 0x0200 +#define DMESA_GET_VIDEO_MODES 0x0300 +#define DMESA_GET_BUFFER_ADDR 0x0400 + +#define DMESA_DRIVER_SWDB_BIT 0x1 /* software double-buffered */ +#define DMESA_DRIVER_LLWO_BIT 0x2 /* lower-left window origin */ +int DMesaGetIntegerv (GLenum pname, GLint *params); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/dll/mesa32/include/GL/fxmesa.h b/reactos/dll/mesa32/include/GL/fxmesa.h new file mode 100644 index 00000000000..f8e9661f9cc --- /dev/null +++ b/reactos/dll/mesa32/include/GL/fxmesa.h @@ -0,0 +1,103 @@ +/* + * Mesa 3-D graphics library + * Version: 4.0 + * Copyright (C) 1995-2001 Brian Paul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* + * FXMesa - 3Dfx Glide driver for Mesa. Contributed by David Bucciarelli + * + * NOTE: This version requires Glide3 (http://sourceforge.net/projects/glide) + */ + + +#ifndef FXMESA_H +#define FXMESA_H + + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + + +#define FXMESA_MAJOR_VERSION 6 +#define FXMESA_MINOR_VERSION 3 + + +/* + * Values for attribList parameter to fxMesaCreateContext(): + */ +#define FXMESA_NONE 0 /* to terminate attribList */ +#define FXMESA_DOUBLEBUFFER 10 +#define FXMESA_ALPHA_SIZE 11 /* followed by an integer */ +#define FXMESA_DEPTH_SIZE 12 /* followed by an integer */ +#define FXMESA_STENCIL_SIZE 13 /* followed by an integer */ +#define FXMESA_ACCUM_SIZE 14 /* followed by an integer */ +#define FXMESA_COLORDEPTH 20 /* followed by an integer */ +#define FXMESA_SHARE_CONTEXT 990099 /* keep in sync with xmesa1.c! */ + + + +typedef struct tfxMesaContext *fxMesaContext; + + +#if defined (__BEOS__) +#pragma export on +#endif + + +GLAPI fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, GrScreenResolution_t, + GrScreenRefresh_t, + const GLint attribList[]); + +GLAPI fxMesaContext GLAPIENTRY fxMesaCreateBestContext(GLuint win, + GLint width, GLint height, + const GLint attribList[]); +GLAPI void GLAPIENTRY fxMesaDestroyContext(fxMesaContext ctx); + +GLAPI GLint GLAPIENTRY fxMesaSelectCurrentBoard(int n); + +GLAPI void GLAPIENTRY fxMesaMakeCurrent(fxMesaContext ctx); + +GLAPI fxMesaContext GLAPIENTRY fxMesaGetCurrentContext(void); + +GLAPI void GLAPIENTRY fxMesaSwapBuffers(void); + +GLAPI void GLAPIENTRY fxMesaSetNearFar(GLfloat nearVal, GLfloat farVal); + +GLAPI void GLAPIENTRY fxMesaUpdateScreenSize(fxMesaContext ctx); + +GLAPI void GLAPIENTRY fxCloseHardware(void); + +GLAPI void GLAPIENTRY fxGetScreenGeometry (GLint *w, GLint *h); + + +#if defined (__BEOS__) +#pragma export off +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/reactos/dll/mesa32/include/GL/ggimesa.h b/reactos/dll/mesa32/include/GL/ggimesa.h new file mode 100644 index 00000000000..90e0b422225 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/ggimesa.h @@ -0,0 +1,85 @@ +/* + * Mesa 3-D graphics library GGI bindings (GGIGL [giggle]) + * Version: 4.0 + * Copyright (C) 1995-2000 Brian Paul + * Copyright (C) 1998 Uwe Maurer + * Copyrigth (C) 2001 Filip Spacek + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef GGIMESA_H +#define GGIMESA_H + +#define GGIMESA_MAJOR_VERSION 4 +#define GGIMESA_MINOR_VERSION 0 + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "GL/gl.h" + +typedef struct ggi_mesa_context *ggi_mesa_context_t; + +/* + * Initialize Mesa GGI extension + */ +int ggiMesaInit(void); +/* + * Clean up Mesa GGI exension + */ +int ggiMesaExit(void); + +/* + * Attach Mesa GGI extension to the visual 'vis' + */ +int ggiMesaAttach(ggi_visual_t vis); +/* + * Detach Mesa GGI extension from the visual 'vis' + */ +int ggiMesaDetach(ggi_visual_t vis); + +int ggiMesaExtendVisual(ggi_visual_t vis, GLboolean alpha_flag, + GLboolean stereo_flag, GLint depth_size, + GLint stencil_size, GLint accum_red_size, + GLint accum_green_size, GLint accum_blue_size, + GLint accum_alpha_size, GLint num_samples); + +/* + * Create a new context capable of displaying on the visual vis. + */ +ggi_mesa_context_t ggiMesaCreateContext(ggi_visual_t vis); +/* + * Destroy the context 'ctx' + */ +void ggiMesaDestroyContext(ggi_mesa_context_t ctx); + +/* + * Make context 'ctx' the current context and bind it to visual 'vis'. + * Note that the context must have been created with respect to that visual. + */ +void ggiMesaMakeCurrent(ggi_mesa_context_t ctx, ggi_visual_t vis); + +void ggiMesaSwapBuffers(void); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/dll/mesa32/include/GL/gl.h b/reactos/dll/mesa32/include/GL/gl.h new file mode 100644 index 00000000000..1ea97f39078 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/gl.h @@ -0,0 +1,2261 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 __gl_h_ +#define __gl_h_ + +#if defined(USE_MGL_NAMESPACE) +#include "gl_mangle.h" +#endif + + +/********************************************************************** + * Begin system-specific stuff. Do not do any of this when building + * for SciTech SNAP, as this is all done before this header file is + * included. + */ +#if !defined(__SCITECH_SNAP__) + +#if defined(__BEOS__) +#include /* to get some BeOS-isms */ +#endif + +#if !defined(OPENSTEP) && (defined(NeXT) || defined(NeXT_PDO)) +#define OPENSTEP +#endif + +#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) +#define __WIN32__ +#endif + +#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) +# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ +# define GLAPI __declspec(dllexport) +# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ +# define GLAPI __declspec(dllimport) +# else /* for use with static link lib build of Win32 edition only */ +# define GLAPI extern +# endif /* _STATIC_MESA support */ +# define GLAPIENTRY __stdcall +#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */ +# define GLAPI extern +# define GLAPIENTRY __stdcall +#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 +# define GLAPI __attribute__((visibility("default"))) +# define GLAPIENTRY +#endif /* WIN32 && !CYGWIN */ + +#if (defined(__BEOS__) && defined(__POWERPC__)) || defined(__QUICKDRAW__) +# define PRAGMA_EXPORT_SUPPORTED 1 +#endif + +/* + * WINDOWS: Include windows.h here to define APIENTRY. + * It is also useful when applications include this file by + * including only glut.h, since glut.h depends on windows.h. + * Applications needing to include windows.h with parms other + * than "WIN32_LEAN_AND_MEAN" may include windows.h before + * glut.h or gl.h. + */ +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__) +#include +#endif + +#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +#ifndef GLAPI +#define GLAPI extern +#endif + +#ifndef GLAPIENTRY +#define GLAPIENTRY +#endif + +#ifndef APIENTRY +#define APIENTRY GLAPIENTRY +#endif + +/* "P" suffix to be used for a pointer to a function */ +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif + +#ifndef GLAPIENTRYP +#define GLAPIENTRYP GLAPIENTRY * +#endif + +#ifdef CENTERLINE_CLPP +#define signed +#endif + +#if defined(PRAGMA_EXPORT_SUPPORTED) +#pragma export on +#endif + +#endif /* !__SCITECH_SNAP__ */ +/* + * End system-specific stuff. + **********************************************************************/ + + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define GL_VERSION_1_1 1 +#define GL_VERSION_1_2 1 +#define GL_VERSION_1_3 1 +#define GL_ARB_imaging 1 + + +/* + * Datatypes + */ +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef void GLvoid; +typedef signed char GLbyte; /* 1-byte signed */ +typedef short GLshort; /* 2-byte signed */ +typedef int GLint; /* 4-byte signed */ +typedef unsigned char GLubyte; /* 1-byte unsigned */ +typedef unsigned short GLushort; /* 2-byte unsigned */ +typedef unsigned int GLuint; /* 4-byte unsigned */ +typedef int GLsizei; /* 4-byte signed */ +typedef float GLfloat; /* single precision float */ +typedef float GLclampf; /* single precision float in [0,1] */ +typedef double GLdouble; /* double precision float */ +typedef double GLclampd; /* double precision float in [0,1] */ + + + +/* + * Constants + */ + +/* Boolean values */ +#define GL_FALSE 0x0 +#define GL_TRUE 0x1 + +/* Data types */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 +#define GL_DOUBLE 0x140A + +/* Primitives */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON 0x0009 + +/* Vertex Arrays */ +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D + +/* Matrix Mode */ +#define GL_MATRIX_MODE 0x0BA0 +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 + +/* Points */ +#define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_POINT_SIZE_RANGE 0x0B12 + +/* Lines */ +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_LINE_WIDTH_RANGE 0x0B22 + +/* Polygons */ +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 + +/* Display Lists */ +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_LIST_MODE 0x0B30 + +/* Depth buffer */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_BITS 0x0D56 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_COMPONENT 0x1902 + +/* Lighting */ +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_SHININESS 0x1601 +#define GL_EMISSION 0x1600 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_SHADE_MODEL 0x0B54 +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_NORMALIZE 0x0BA1 + +/* User clipping planes */ +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 + +/* Accumulation buffer */ +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_ACCUM 0x0100 +#define GL_ADD 0x0104 +#define GL_LOAD 0x0101 +#define GL_MULT 0x0103 +#define GL_RETURN 0x0102 + +/* Alpha testing */ +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_ALPHA_TEST_FUNC 0x0BC1 + +/* Blending */ +#define GL_BLEND 0x0BE2 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND_DST 0x0BE0 +#define GL_ZERO 0x0 +#define GL_ONE 0x1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 + +/* Render Mode */ +#define GL_FEEDBACK 0x1C01 +#define GL_RENDER 0x1C00 +#define GL_SELECT 0x1C02 + +/* Feedback */ +#define GL_2D 0x0600 +#define GL_3D 0x0601 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_4D_COLOR_TEXTURE 0x0604 +#define GL_POINT_TOKEN 0x0701 +#define GL_LINE_TOKEN 0x0702 +#define GL_LINE_RESET_TOKEN 0x0707 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 + +/* Selection */ +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 + +/* Fog */ +#define GL_FOG 0x0B60 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_COLOR 0x0B66 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_LINEAR 0x2601 +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* Logic Ops */ +#define GL_LOGIC_OP 0x0BF1 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_CLEAR 0x1500 +#define GL_SET 0x150F +#define GL_COPY 0x1503 +#define GL_COPY_INVERTED 0x150C +#define GL_NOOP 0x1505 +#define GL_INVERT 0x150A +#define GL_AND 0x1501 +#define GL_NAND 0x150E +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_XOR 0x1506 +#define GL_EQUIV 0x1509 +#define GL_AND_REVERSE 0x1502 +#define GL_AND_INVERTED 0x1504 +#define GL_OR_REVERSE 0x150B +#define GL_OR_INVERTED 0x150D + +/* Stencil */ +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BITS 0x0D57 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_INDEX 0x1901 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 + +/* Buffers, Pixel Drawing/Reading */ +#define GL_NONE 0x0 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +/*GL_FRONT 0x0404 */ +/*GL_BACK 0x0405 */ +/*GL_FRONT_AND_BACK 0x0408 */ +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#define GL_COLOR_INDEX 0x1900 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_ALPHA_BITS 0x0D55 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_INDEX_BITS 0x0D51 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_READ_BUFFER 0x0C02 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_BITMAP 0x1A00 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_DITHER 0x0BD0 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 + +/* Implementation limits */ +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B + +/* Gets */ +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_MODE 0x0C30 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_RENDER_MODE 0x0C40 +#define GL_RGBA_MODE 0x0C31 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_VIEWPORT 0x0BA2 + +/* Evaluators */ +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_COEFF 0x0A00 +#define GL_DOMAIN 0x0A02 +#define GL_ORDER 0x0A01 + +/* Hints */ +#define GL_FOG_HINT 0x0C54 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* Scissor box */ +#define GL_SCISSOR_TEST 0x0C11 +#define GL_SCISSOR_BOX 0x0C10 + +/* Pixel Mode / Transfer */ +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_STENCIL 0x0D11 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_BIAS 0x0D15 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GREEN_BIAS 0x0D19 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BLUE_BIAS 0x0D1B +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_BIAS 0x0D1D +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_BIAS 0x0D1F +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 + +/* Texture mapping */ +#define GL_TEXTURE_ENV 0x2300 +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_ENV_COLOR 0x2201 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_TEXTURE_COMPONENTS 0x1003 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_LINEAR 0x2400 +#define GL_EYE_PLANE 0x2502 +#define GL_SPHERE_MAP 0x2402 +#define GL_DECAL 0x2101 +#define GL_MODULATE 0x2100 +#define GL_NEAREST 0x2600 +#define GL_REPEAT 0x2901 +#define GL_CLAMP 0x2900 +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 + +/* Utility */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* Errors */ +#define GL_NO_ERROR 0x0 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 + +/* glPush/PopAttrib bits */ +#define GL_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000002 +#define GL_LINE_BIT 0x00000004 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_HINT_BIT 0x00008000 +#define GL_EVAL_BIT 0x00010000 +#define GL_LIST_BIT 0x00020000 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_SCISSOR_BIT 0x00080000 +#define GL_ALL_ATTRIB_BITS 0x000FFFFF + + +/* OpenGL 1.1 */ +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF +#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF + + + +/* + * Miscellaneous + */ + +GLAPI void GLAPIENTRY glClearIndex( GLfloat c ); + +GLAPI void GLAPIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); + +GLAPI void GLAPIENTRY glClear( GLbitfield mask ); + +GLAPI void GLAPIENTRY glIndexMask( GLuint mask ); + +GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ); + +GLAPI void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref ); + +GLAPI void GLAPIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor ); + +GLAPI void GLAPIENTRY glLogicOp( GLenum opcode ); + +GLAPI void GLAPIENTRY glCullFace( GLenum mode ); + +GLAPI void GLAPIENTRY glFrontFace( GLenum mode ); + +GLAPI void GLAPIENTRY glPointSize( GLfloat size ); + +GLAPI void GLAPIENTRY glLineWidth( GLfloat width ); + +GLAPI void GLAPIENTRY glLineStipple( GLint factor, GLushort pattern ); + +GLAPI void GLAPIENTRY glPolygonMode( GLenum face, GLenum mode ); + +GLAPI void GLAPIENTRY glPolygonOffset( GLfloat factor, GLfloat units ); + +GLAPI void GLAPIENTRY glPolygonStipple( const GLubyte *mask ); + +GLAPI void GLAPIENTRY glGetPolygonStipple( GLubyte *mask ); + +GLAPI void GLAPIENTRY glEdgeFlag( GLboolean flag ); + +GLAPI void GLAPIENTRY glEdgeFlagv( const GLboolean *flag ); + +GLAPI void GLAPIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height); + +GLAPI void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation ); + +GLAPI void GLAPIENTRY glGetClipPlane( GLenum plane, GLdouble *equation ); + +GLAPI void GLAPIENTRY glDrawBuffer( GLenum mode ); + +GLAPI void GLAPIENTRY glReadBuffer( GLenum mode ); + +GLAPI void GLAPIENTRY glEnable( GLenum cap ); + +GLAPI void GLAPIENTRY glDisable( GLenum cap ); + +GLAPI GLboolean GLAPIENTRY glIsEnabled( GLenum cap ); + + +GLAPI void GLAPIENTRY glEnableClientState( GLenum cap ); /* 1.1 */ + +GLAPI void GLAPIENTRY glDisableClientState( GLenum cap ); /* 1.1 */ + + +GLAPI void GLAPIENTRY glGetBooleanv( GLenum pname, GLboolean *params ); + +GLAPI void GLAPIENTRY glGetDoublev( GLenum pname, GLdouble *params ); + +GLAPI void GLAPIENTRY glGetFloatv( GLenum pname, GLfloat *params ); + +GLAPI void GLAPIENTRY glGetIntegerv( GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glPushAttrib( GLbitfield mask ); + +GLAPI void GLAPIENTRY glPopAttrib( void ); + + +GLAPI void GLAPIENTRY glPushClientAttrib( GLbitfield mask ); /* 1.1 */ + +GLAPI void GLAPIENTRY glPopClientAttrib( void ); /* 1.1 */ + + +GLAPI GLint GLAPIENTRY glRenderMode( GLenum mode ); + +GLAPI GLenum GLAPIENTRY glGetError( void ); + +GLAPI const GLubyte * GLAPIENTRY glGetString( GLenum name ); + +GLAPI void GLAPIENTRY glFinish( void ); + +GLAPI void GLAPIENTRY glFlush( void ); + +GLAPI void GLAPIENTRY glHint( GLenum target, GLenum mode ); + + +/* + * Depth Buffer + */ + +GLAPI void GLAPIENTRY glClearDepth( GLclampd depth ); + +GLAPI void GLAPIENTRY glDepthFunc( GLenum func ); + +GLAPI void GLAPIENTRY glDepthMask( GLboolean flag ); + +GLAPI void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val ); + + +/* + * Accumulation Buffer + */ + +GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); + +GLAPI void GLAPIENTRY glAccum( GLenum op, GLfloat value ); + + +/* + * Transformation + */ + +GLAPI void GLAPIENTRY glMatrixMode( GLenum mode ); + +GLAPI void GLAPIENTRY glOrtho( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val ); + +GLAPI void GLAPIENTRY glFrustum( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val ); + +GLAPI void GLAPIENTRY glViewport( GLint x, GLint y, + GLsizei width, GLsizei height ); + +GLAPI void GLAPIENTRY glPushMatrix( void ); + +GLAPI void GLAPIENTRY glPopMatrix( void ); + +GLAPI void GLAPIENTRY glLoadIdentity( void ); + +GLAPI void GLAPIENTRY glLoadMatrixd( const GLdouble *m ); +GLAPI void GLAPIENTRY glLoadMatrixf( const GLfloat *m ); + +GLAPI void GLAPIENTRY glMultMatrixd( const GLdouble *m ); +GLAPI void GLAPIENTRY glMultMatrixf( const GLfloat *m ); + +GLAPI void GLAPIENTRY glRotated( GLdouble angle, + GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glRotatef( GLfloat angle, + GLfloat x, GLfloat y, GLfloat z ); + +GLAPI void GLAPIENTRY glScaled( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z ); + +GLAPI void GLAPIENTRY glTranslated( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z ); + + +/* + * Display Lists + */ + +GLAPI GLboolean GLAPIENTRY glIsList( GLuint list ); + +GLAPI void GLAPIENTRY glDeleteLists( GLuint list, GLsizei range ); + +GLAPI GLuint GLAPIENTRY glGenLists( GLsizei range ); + +GLAPI void GLAPIENTRY glNewList( GLuint list, GLenum mode ); + +GLAPI void GLAPIENTRY glEndList( void ); + +GLAPI void GLAPIENTRY glCallList( GLuint list ); + +GLAPI void GLAPIENTRY glCallLists( GLsizei n, GLenum type, + const GLvoid *lists ); + +GLAPI void GLAPIENTRY glListBase( GLuint base ); + + +/* + * Drawing Functions + */ + +GLAPI void GLAPIENTRY glBegin( GLenum mode ); + +GLAPI void GLAPIENTRY glEnd( void ); + + +GLAPI void GLAPIENTRY glVertex2d( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY glVertex2f( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY glVertex2i( GLint x, GLint y ); +GLAPI void GLAPIENTRY glVertex2s( GLshort x, GLshort y ); + +GLAPI void GLAPIENTRY glVertex3d( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glVertex3f( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY glVertex3i( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY glVertex3s( GLshort x, GLshort y, GLshort z ); + +GLAPI void GLAPIENTRY glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +GLAPI void GLAPIENTRY glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY glVertex4i( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w ); + +GLAPI void GLAPIENTRY glVertex2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex2iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glVertex3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex3iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glVertex4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex4iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz ); +GLAPI void GLAPIENTRY glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ); +GLAPI void GLAPIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz ); +GLAPI void GLAPIENTRY glNormal3i( GLint nx, GLint ny, GLint nz ); +GLAPI void GLAPIENTRY glNormal3s( GLshort nx, GLshort ny, GLshort nz ); + +GLAPI void GLAPIENTRY glNormal3bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glNormal3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glNormal3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glNormal3iv( const GLint *v ); +GLAPI void GLAPIENTRY glNormal3sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glIndexd( GLdouble c ); +GLAPI void GLAPIENTRY glIndexf( GLfloat c ); +GLAPI void GLAPIENTRY glIndexi( GLint c ); +GLAPI void GLAPIENTRY glIndexs( GLshort c ); +GLAPI void GLAPIENTRY glIndexub( GLubyte c ); /* 1.1 */ + +GLAPI void GLAPIENTRY glIndexdv( const GLdouble *c ); +GLAPI void GLAPIENTRY glIndexfv( const GLfloat *c ); +GLAPI void GLAPIENTRY glIndexiv( const GLint *c ); +GLAPI void GLAPIENTRY glIndexsv( const GLshort *c ); +GLAPI void GLAPIENTRY glIndexubv( const GLubyte *c ); /* 1.1 */ + +GLAPI void GLAPIENTRY glColor3b( GLbyte red, GLbyte green, GLbyte blue ); +GLAPI void GLAPIENTRY glColor3d( GLdouble red, GLdouble green, GLdouble blue ); +GLAPI void GLAPIENTRY glColor3f( GLfloat red, GLfloat green, GLfloat blue ); +GLAPI void GLAPIENTRY glColor3i( GLint red, GLint green, GLint blue ); +GLAPI void GLAPIENTRY glColor3s( GLshort red, GLshort green, GLshort blue ); +GLAPI void GLAPIENTRY glColor3ub( GLubyte red, GLubyte green, GLubyte blue ); +GLAPI void GLAPIENTRY glColor3ui( GLuint red, GLuint green, GLuint blue ); +GLAPI void GLAPIENTRY glColor3us( GLushort red, GLushort green, GLushort blue ); + +GLAPI void GLAPIENTRY glColor4b( GLbyte red, GLbyte green, + GLbyte blue, GLbyte alpha ); +GLAPI void GLAPIENTRY glColor4d( GLdouble red, GLdouble green, + GLdouble blue, GLdouble alpha ); +GLAPI void GLAPIENTRY glColor4f( GLfloat red, GLfloat green, + GLfloat blue, GLfloat alpha ); +GLAPI void GLAPIENTRY glColor4i( GLint red, GLint green, + GLint blue, GLint alpha ); +GLAPI void GLAPIENTRY glColor4s( GLshort red, GLshort green, + GLshort blue, GLshort alpha ); +GLAPI void GLAPIENTRY glColor4ub( GLubyte red, GLubyte green, + GLubyte blue, GLubyte alpha ); +GLAPI void GLAPIENTRY glColor4ui( GLuint red, GLuint green, + GLuint blue, GLuint alpha ); +GLAPI void GLAPIENTRY glColor4us( GLushort red, GLushort green, + GLushort blue, GLushort alpha ); + + +GLAPI void GLAPIENTRY glColor3bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glColor3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glColor3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glColor3iv( const GLint *v ); +GLAPI void GLAPIENTRY glColor3sv( const GLshort *v ); +GLAPI void GLAPIENTRY glColor3ubv( const GLubyte *v ); +GLAPI void GLAPIENTRY glColor3uiv( const GLuint *v ); +GLAPI void GLAPIENTRY glColor3usv( const GLushort *v ); + +GLAPI void GLAPIENTRY glColor4bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glColor4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glColor4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glColor4iv( const GLint *v ); +GLAPI void GLAPIENTRY glColor4sv( const GLshort *v ); +GLAPI void GLAPIENTRY glColor4ubv( const GLubyte *v ); +GLAPI void GLAPIENTRY glColor4uiv( const GLuint *v ); +GLAPI void GLAPIENTRY glColor4usv( const GLushort *v ); + + +GLAPI void GLAPIENTRY glTexCoord1d( GLdouble s ); +GLAPI void GLAPIENTRY glTexCoord1f( GLfloat s ); +GLAPI void GLAPIENTRY glTexCoord1i( GLint s ); +GLAPI void GLAPIENTRY glTexCoord1s( GLshort s ); + +GLAPI void GLAPIENTRY glTexCoord2d( GLdouble s, GLdouble t ); +GLAPI void GLAPIENTRY glTexCoord2f( GLfloat s, GLfloat t ); +GLAPI void GLAPIENTRY glTexCoord2i( GLint s, GLint t ); +GLAPI void GLAPIENTRY glTexCoord2s( GLshort s, GLshort t ); + +GLAPI void GLAPIENTRY glTexCoord3d( GLdouble s, GLdouble t, GLdouble r ); +GLAPI void GLAPIENTRY glTexCoord3f( GLfloat s, GLfloat t, GLfloat r ); +GLAPI void GLAPIENTRY glTexCoord3i( GLint s, GLint t, GLint r ); +GLAPI void GLAPIENTRY glTexCoord3s( GLshort s, GLshort t, GLshort r ); + +GLAPI void GLAPIENTRY glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ); +GLAPI void GLAPIENTRY glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ); +GLAPI void GLAPIENTRY glTexCoord4i( GLint s, GLint t, GLint r, GLint q ); +GLAPI void GLAPIENTRY glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ); + +GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord1iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord1sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord2iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord3iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord4iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glRasterPos2d( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY glRasterPos2f( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY glRasterPos2i( GLint x, GLint y ); +GLAPI void GLAPIENTRY glRasterPos2s( GLshort x, GLshort y ); + +GLAPI void GLAPIENTRY glRasterPos3d( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glRasterPos3f( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY glRasterPos3i( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY glRasterPos3s( GLshort x, GLshort y, GLshort z ); + +GLAPI void GLAPIENTRY glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +GLAPI void GLAPIENTRY glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY glRasterPos4i( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w ); + +GLAPI void GLAPIENTRY glRasterPos2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos2iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glRasterPos3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos3iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glRasterPos4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos4iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ); +GLAPI void GLAPIENTRY glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); +GLAPI void GLAPIENTRY glRecti( GLint x1, GLint y1, GLint x2, GLint y2 ); +GLAPI void GLAPIENTRY glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ); + + +GLAPI void GLAPIENTRY glRectdv( const GLdouble *v1, const GLdouble *v2 ); +GLAPI void GLAPIENTRY glRectfv( const GLfloat *v1, const GLfloat *v2 ); +GLAPI void GLAPIENTRY glRectiv( const GLint *v1, const GLint *v2 ); +GLAPI void GLAPIENTRY glRectsv( const GLshort *v1, const GLshort *v2 ); + + +/* + * Vertex Arrays (1.1) + */ + +GLAPI void GLAPIENTRY glVertexPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride, + const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glColorPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride, + const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glGetPointerv( GLenum pname, GLvoid **params ); + +GLAPI void GLAPIENTRY glArrayElement( GLint i ); + +GLAPI void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count ); + +GLAPI void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count, + GLenum type, const GLvoid *indices ); + +GLAPI void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride, + const GLvoid *pointer ); + +/* + * Lighting + */ + +GLAPI void GLAPIENTRY glShadeModel( GLenum mode ); + +GLAPI void GLAPIENTRY glLightf( GLenum light, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glLighti( GLenum light, GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glLightfv( GLenum light, GLenum pname, + const GLfloat *params ); +GLAPI void GLAPIENTRY glLightiv( GLenum light, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glGetLightfv( GLenum light, GLenum pname, + GLfloat *params ); +GLAPI void GLAPIENTRY glGetLightiv( GLenum light, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glLightModelf( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glLightModeli( GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glLightModelfv( GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glLightModeliv( GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glMateriali( GLenum face, GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glMaterialiv( GLenum face, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetMaterialiv( GLenum face, GLenum pname, GLint *params ); + +GLAPI void GLAPIENTRY glColorMaterial( GLenum face, GLenum mode ); + + +/* + * Raster functions + */ + +GLAPI void GLAPIENTRY glPixelZoom( GLfloat xfactor, GLfloat yfactor ); + +GLAPI void GLAPIENTRY glPixelStoref( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glPixelStorei( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glPixelTransferf( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glPixelTransferi( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glPixelMapfv( GLenum map, GLsizei mapsize, + const GLfloat *values ); +GLAPI void GLAPIENTRY glPixelMapuiv( GLenum map, GLsizei mapsize, + const GLuint *values ); +GLAPI void GLAPIENTRY glPixelMapusv( GLenum map, GLsizei mapsize, + const GLushort *values ); + +GLAPI void GLAPIENTRY glGetPixelMapfv( GLenum map, GLfloat *values ); +GLAPI void GLAPIENTRY glGetPixelMapuiv( GLenum map, GLuint *values ); +GLAPI void GLAPIENTRY glGetPixelMapusv( GLenum map, GLushort *values ); + +GLAPI void GLAPIENTRY glBitmap( GLsizei width, GLsizei height, + GLfloat xorig, GLfloat yorig, + GLfloat xmove, GLfloat ymove, + const GLubyte *bitmap ); + +GLAPI void GLAPIENTRY glReadPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLvoid *pixels ); + +GLAPI void GLAPIENTRY glDrawPixels( GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glCopyPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum type ); + +/* + * Stenciling + */ + +GLAPI void GLAPIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask ); + +GLAPI void GLAPIENTRY glStencilMask( GLuint mask ); + +GLAPI void GLAPIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass ); + +GLAPI void GLAPIENTRY glClearStencil( GLint s ); + + + +/* + * Texture mapping + */ + +GLAPI void GLAPIENTRY glTexGend( GLenum coord, GLenum pname, GLdouble param ); +GLAPI void GLAPIENTRY glTexGenf( GLenum coord, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexGeni( GLenum coord, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexGendv( GLenum coord, GLenum pname, const GLdouble *params ); +GLAPI void GLAPIENTRY glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glTexGeniv( GLenum coord, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); +GLAPI void GLAPIENTRY glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexGeniv( GLenum coord, GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexEnviv( GLenum target, GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexParameterfv( GLenum target, GLenum pname, + const GLfloat *params ); +GLAPI void GLAPIENTRY glTexParameteriv( GLenum target, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexParameterfv( GLenum target, + GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetTexParameteriv( GLenum target, + GLenum pname, GLint *params ); + +GLAPI void GLAPIENTRY glGetTexLevelParameterfv( GLenum target, GLint level, + GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexLevelParameteriv( GLenum target, GLint level, + GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexImage1D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glTexImage2D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glGetTexImage( GLenum target, GLint level, + GLenum format, GLenum type, + GLvoid *pixels ); + + +/* 1.1 functions */ + +GLAPI void GLAPIENTRY glGenTextures( GLsizei n, GLuint *textures ); + +GLAPI void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures); + +GLAPI void GLAPIENTRY glBindTexture( GLenum target, GLuint texture ); + +GLAPI void GLAPIENTRY glPrioritizeTextures( GLsizei n, + const GLuint *textures, + const GLclampf *priorities ); + +GLAPI GLboolean GLAPIENTRY glAreTexturesResident( GLsizei n, + const GLuint *textures, + GLboolean *residences ); + +GLAPI GLboolean GLAPIENTRY glIsTexture( GLuint texture ); + + +GLAPI void GLAPIENTRY glTexSubImage1D( GLenum target, GLint level, + GLint xoffset, + GLsizei width, GLenum format, + GLenum type, const GLvoid *pixels ); + + +GLAPI void GLAPIENTRY glTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); + + +GLAPI void GLAPIENTRY glCopyTexImage1D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLint border ); + + +GLAPI void GLAPIENTRY glCopyTexImage2D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLint border ); + + +GLAPI void GLAPIENTRY glCopyTexSubImage1D( GLenum target, GLint level, + GLint xoffset, GLint x, GLint y, + GLsizei width ); + + +GLAPI void GLAPIENTRY glCopyTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + + +/* + * Evaluators + */ + +GLAPI void GLAPIENTRY glMap1d( GLenum target, GLdouble u1, GLdouble u2, + GLint stride, + GLint order, const GLdouble *points ); +GLAPI void GLAPIENTRY glMap1f( GLenum target, GLfloat u1, GLfloat u2, + GLint stride, + GLint order, const GLfloat *points ); + +GLAPI void GLAPIENTRY glMap2d( GLenum target, + GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, + GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, + const GLdouble *points ); +GLAPI void GLAPIENTRY glMap2f( GLenum target, + GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, + GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, + const GLfloat *points ); + +GLAPI void GLAPIENTRY glGetMapdv( GLenum target, GLenum query, GLdouble *v ); +GLAPI void GLAPIENTRY glGetMapfv( GLenum target, GLenum query, GLfloat *v ); +GLAPI void GLAPIENTRY glGetMapiv( GLenum target, GLenum query, GLint *v ); + +GLAPI void GLAPIENTRY glEvalCoord1d( GLdouble u ); +GLAPI void GLAPIENTRY glEvalCoord1f( GLfloat u ); + +GLAPI void GLAPIENTRY glEvalCoord1dv( const GLdouble *u ); +GLAPI void GLAPIENTRY glEvalCoord1fv( const GLfloat *u ); + +GLAPI void GLAPIENTRY glEvalCoord2d( GLdouble u, GLdouble v ); +GLAPI void GLAPIENTRY glEvalCoord2f( GLfloat u, GLfloat v ); + +GLAPI void GLAPIENTRY glEvalCoord2dv( const GLdouble *u ); +GLAPI void GLAPIENTRY glEvalCoord2fv( const GLfloat *u ); + +GLAPI void GLAPIENTRY glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); +GLAPI void GLAPIENTRY glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); + +GLAPI void GLAPIENTRY glMapGrid2d( GLint un, GLdouble u1, GLdouble u2, + GLint vn, GLdouble v1, GLdouble v2 ); +GLAPI void GLAPIENTRY glMapGrid2f( GLint un, GLfloat u1, GLfloat u2, + GLint vn, GLfloat v1, GLfloat v2 ); + +GLAPI void GLAPIENTRY glEvalPoint1( GLint i ); + +GLAPI void GLAPIENTRY glEvalPoint2( GLint i, GLint j ); + +GLAPI void GLAPIENTRY glEvalMesh1( GLenum mode, GLint i1, GLint i2 ); + +GLAPI void GLAPIENTRY glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); + + +/* + * Fog + */ + +GLAPI void GLAPIENTRY glFogf( GLenum pname, GLfloat param ); + +GLAPI void GLAPIENTRY glFogi( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glFogfv( GLenum pname, const GLfloat *params ); + +GLAPI void GLAPIENTRY glFogiv( GLenum pname, const GLint *params ); + + +/* + * Selection and Feedback + */ + +GLAPI void GLAPIENTRY glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ); + +GLAPI void GLAPIENTRY glPassThrough( GLfloat token ); + +GLAPI void GLAPIENTRY glSelectBuffer( GLsizei size, GLuint *buffer ); + +GLAPI void GLAPIENTRY glInitNames( void ); + +GLAPI void GLAPIENTRY glLoadName( GLuint name ); + +GLAPI void GLAPIENTRY glPushName( GLuint name ); + +GLAPI void GLAPIENTRY glPopName( void ); + + + +/* + * OpenGL 1.2 + */ + +#define GL_RESCALE_NORMAL 0x803A +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_TEXTURE_BINDING_3D 0x806A + +GLAPI void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start, + GLuint end, GLsizei count, GLenum type, const GLvoid *indices ); + +GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, + GLenum format, + GLenum type, const GLvoid *pixels); + +GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLint x, + GLint y, GLsizei width, + GLsizei height ); + +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); + + +/* + * GL_ARB_imaging + */ + +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_BLEND_EQUATION 0x8009 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_BLEND_COLOR 0x8005 + + +GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat, + GLsizei width, GLenum format, + GLenum type, const GLvoid *table ); + +GLAPI void GLAPIENTRY glColorSubTable( GLenum target, + GLsizei start, GLsizei count, + GLenum format, GLenum type, + const GLvoid *data ); + +GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname, + const GLint *params); + +GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname, + const GLfloat *params); + +GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format, + GLenum type, GLvoid *table ); + +GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glBlendEquation( GLenum mode ); + +GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green, + GLclampf blue, GLclampf alpha ); + +GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width, + GLenum internalformat, GLboolean sink ); + +GLAPI void GLAPIENTRY glResetHistogram( GLenum target ); + +GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset, + GLenum format, GLenum type, + GLvoid *values ); + +GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat, + GLboolean sink ); + +GLAPI void GLAPIENTRY glResetMinmax( GLenum target ); + +GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset, + GLenum format, GLenum types, + GLvoid *values ); + +GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target, + GLenum internalformat, GLsizei width, GLenum format, GLenum type, + const GLvoid *image ); + +GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *image ); + +GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname, + GLfloat params ); + +GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname, + const GLfloat *params ); + +GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname, + GLint params ); + +GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width, + GLsizei height); + +GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format, + GLenum type, GLvoid *image ); + +GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *row, const GLvoid *column ); + +GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, + GLenum type, GLvoid *row, GLvoid *column, GLvoid *span ); + +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); + + + +/* + * OpenGL 1.3 + */ + +/* multitexture */ +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +/* texture_cube_map */ +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +/* texture_compression */ +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +/* multisample */ +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_MULTISAMPLE_BIT 0x20000000 +/* transpose_matrix */ +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +/* texture_env_combine */ +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +/* texture_env_dot3 */ +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +/* texture_border_clamp */ +#define GL_CLAMP_TO_BORDER 0x812D + +GLAPI void GLAPIENTRY glActiveTexture( GLenum texture ); + +GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture ); + +GLAPI void GLAPIENTRY glCompressedTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img ); + +GLAPI void GLAPIENTRY glMultiTexCoord1d( GLenum target, GLdouble s ); + +GLAPI void GLAPIENTRY glMultiTexCoord1dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord1f( GLenum target, GLfloat s ); + +GLAPI void GLAPIENTRY glMultiTexCoord1fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord1i( GLenum target, GLint s ); + +GLAPI void GLAPIENTRY glMultiTexCoord1iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord1s( GLenum target, GLshort s ); + +GLAPI void GLAPIENTRY glMultiTexCoord1sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord2d( GLenum target, GLdouble s, GLdouble t ); + +GLAPI void GLAPIENTRY glMultiTexCoord2dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord2f( GLenum target, GLfloat s, GLfloat t ); + +GLAPI void GLAPIENTRY glMultiTexCoord2fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord2i( GLenum target, GLint s, GLint t ); + +GLAPI void GLAPIENTRY glMultiTexCoord2iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord2s( GLenum target, GLshort s, GLshort t ); + +GLAPI void GLAPIENTRY glMultiTexCoord2sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord3d( GLenum target, GLdouble s, GLdouble t, GLdouble r ); + +GLAPI void GLAPIENTRY glMultiTexCoord3dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t, GLfloat r ); + +GLAPI void GLAPIENTRY glMultiTexCoord3fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord3i( GLenum target, GLint s, GLint t, GLint r ); + +GLAPI void GLAPIENTRY glMultiTexCoord3iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord3s( GLenum target, GLshort s, GLshort t, GLshort r ); + +GLAPI void GLAPIENTRY glMultiTexCoord3sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord4d( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q ); + +GLAPI void GLAPIENTRY glMultiTexCoord4dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ); + +GLAPI void GLAPIENTRY glMultiTexCoord4fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord4i( GLenum target, GLint s, GLint t, GLint r, GLint q ); + +GLAPI void GLAPIENTRY glMultiTexCoord4iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord4s( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q ); + +GLAPI void GLAPIENTRY glMultiTexCoord4sv( GLenum target, const GLshort *v ); + + +GLAPI void GLAPIENTRY glLoadTransposeMatrixd( const GLdouble m[16] ); + +GLAPI void GLAPIENTRY glLoadTransposeMatrixf( const GLfloat m[16] ); + +GLAPI void GLAPIENTRY glMultTransposeMatrixd( const GLdouble m[16] ); + +GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] ); + +GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert ); + +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img); + + +/* + * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1) + */ +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 + +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 + +GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s); +GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s); +GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s); +GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s); +GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); +GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); +GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); +GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); +GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); +GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v); + +typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); + +#endif /* GL_ARB_multitexture */ + + + +/* + * Define this token if you want "old-style" header file behaviour (extensions + * defined in gl.h). Otherwise, extensions will be included from glext.h. + */ +#if defined(GL_GLEXT_LEGACY) + +/* All extensions that used to be here are now found in glext.h */ + +#else /* GL_GLEXT_LEGACY */ + +#include + +#endif /* GL_GLEXT_LEGACY */ + + + +/* + * ???. GL_MESA_trace + * XXX obsolete + */ +#ifndef GL_MESA_trace +#define GL_MESA_trace 1 + +#define GL_TRACE_ALL_BITS_MESA 0xFFFF +#define GL_TRACE_OPERATIONS_BIT_MESA 0x0001 +#define GL_TRACE_PRIMITIVES_BIT_MESA 0x0002 +#define GL_TRACE_ARRAYS_BIT_MESA 0x0004 +#define GL_TRACE_TEXTURES_BIT_MESA 0x0008 +#define GL_TRACE_PIXELS_BIT_MESA 0x0010 +#define GL_TRACE_ERRORS_BIT_MESA 0x0020 +#define GL_TRACE_MASK_MESA 0x8755 +#define GL_TRACE_NAME_MESA 0x8756 + +GLAPI void GLAPIENTRY glEnableTraceMESA( GLbitfield mask ); +GLAPI void GLAPIENTRY glDisableTraceMESA( GLbitfield mask ); +GLAPI void GLAPIENTRY glNewTraceMESA( GLbitfield mask, const GLubyte * traceName ); +GLAPI void GLAPIENTRY glEndTraceMESA( void ); +GLAPI void GLAPIENTRY glTraceAssertAttribMESA( GLbitfield attribMask ); +GLAPI void GLAPIENTRY glTraceCommentMESA( const GLubyte * comment ); +GLAPI void GLAPIENTRY glTraceTextureMESA( GLuint name, const GLubyte* comment ); +GLAPI void GLAPIENTRY glTraceListMESA( GLuint name, const GLubyte* comment ); +GLAPI void GLAPIENTRY glTracePointerMESA( GLvoid* pointer, const GLubyte* comment ); +GLAPI void GLAPIENTRY glTracePointerRangeMESA( const GLvoid* first, const GLvoid* last, const GLubyte* comment ); + +#endif /* GL_MESA_trace */ + + +/* + * ???. GL_MESA_packed_depth_stencil + * XXX obsolete + */ +#ifndef GL_MESA_packed_depth_stencil +#define GL_MESA_packed_depth_stencil 1 + +#define GL_DEPTH_STENCIL_MESA 0x8750 +#define GL_UNSIGNED_INT_24_8_MESA 0x8751 +#define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752 +#define GL_UNSIGNED_SHORT_15_1_MESA 0x8753 +#define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754 + +#endif /* GL_MESA_packed_depth_stencil */ + + +#ifndef GL_MESA_program_debug +#define GL_MESA_program_debug 1 + +#define GL_FRAGMENT_PROGRAM_POSITION_MESA 0x8bb0 +#define GL_FRAGMENT_PROGRAM_CALLBACK_MESA 0x8bb1 +#define GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA 0x8bb2 +#define GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA 0x8bb3 +#define GL_VERTEX_PROGRAM_POSITION_MESA 0x8bb4 +#define GL_VERTEX_PROGRAM_CALLBACK_MESA 0x8bb5 +#define GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA 0x8bb6 +#define GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA 0x8bb7 + +typedef void (*GLprogramcallbackMESA)(GLenum target, GLvoid *data); + +GLAPI void GLAPIENTRY glProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, GLvoid *data); + +GLAPI void GLAPIENTRY glGetProgramRegisterfvMESA(GLenum target, GLsizei len, const GLubyte *name, GLfloat *v); + +#endif /* GL_MESA_program_debug */ + + +#ifndef GL_ATI_blend_equation_separate +#define GL_ATI_blend_equation_separate 1 + +#define GL_ALPHA_BLEND_EQUATION_ATI 0x883D + +GLAPI void GLAPIENTRY glBlendEquationSeparateATI( GLenum modeRGB, GLenum modeA ); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLenum modeA); + +#endif /* GL_ATI_blend_equation_separate */ + + +/** + ** NOTE!!!!! If you add new functions to this file, or update + ** glext.h be sure to regenerate the gl_mangle.h file. See comments + ** in that file for details. + **/ + + + +/********************************************************************** + * Begin system-specific stuff + */ +#if defined(PRAGMA_EXPORT_SUPPORTED) +#pragma export off +#endif + +#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED +#pragma import off +#endif +/* + * End system-specific stuff + **********************************************************************/ + + +#ifdef __cplusplus +} +#endif + +#endif /* __gl_h_ */ diff --git a/reactos/dll/mesa32/include/GL/gl_mangle.h b/reactos/dll/mesa32/include/GL/gl_mangle.h new file mode 100644 index 00000000000..c1b443c6b0a --- /dev/null +++ b/reactos/dll/mesa32/include/GL/gl_mangle.h @@ -0,0 +1,1472 @@ +#if 0 +#define GL_MANGLE_C1 "DO NOT EDIT!!! - TO REGENERATE from gl.h, EXECUTE THIS FILE IN SHELL (/bin/sh) and save the output" +#define GL_MANGLE_C2 "This file is used to create GL function protypes and aliases for the function names" + files="gl.h glext.h" +#define GL_MANGLE_C3 "get regeneration header - copy everything in this file above the 'REGENERATE_TO_END' line" + awk '!done; /^\/\*REGENERATE_TO_END/ {done=1}' $0 + echo "" +#define GL_MANGLE_C4 get aliases + grep '^GLAPI' $files | sed -e 's/.*ENTRY gl\([^( ]*\).*$/#define gl\1 MANGLE(\1)/' | sort | uniq + echo "" + echo "#endif /* GL_MANGLE_H */" + exit +#endif /* REGENERATION */ + +/* + * If you compile Mesa with USE_MGL_NAMESPACE defined then you can link + * your application both with OpenGL and Mesa. The Mesa functions will + * be redefined so they are prefixed with "mgl" instead of "gl". + * Mgl contributed by Randy Frank (rfrank@rsinc.com) + * Regneration code contributed by Ray Tice (rayt@ma.ultra.net) + */ + +#ifndef GL_MANGLE_H +#define GL_MANGLE_H + +#ifndef MANGLE +#define MANGLE(x) mgl##x +#endif /*MANGLE*/ + +/* Internal symbols which may collide with other OpenGL implementations. */ +#define __glCoreCreateContext __mglCoreCreateContext +#define __glCoreNopDispatch __mglCoreNopDispatch + +/*REGENERATE_TO_END-----------ALL LINES BELOW HERE GET REPLACED ON REGENERATION */ + +#define glAccum MANGLE(Accum) +#define glActiveStencilFaceEXT MANGLE(ActiveStencilFaceEXT) +#define glActiveTextureARB MANGLE(ActiveTextureARB) +#define glActiveTexture MANGLE(ActiveTexture) +#define glAlphaFragmentOp1ATI MANGLE(AlphaFragmentOp1ATI) +#define glAlphaFragmentOp2ATI MANGLE(AlphaFragmentOp2ATI) +#define glAlphaFragmentOp3ATI MANGLE(AlphaFragmentOp3ATI) +#define glAlphaFunc MANGLE(AlphaFunc) +#define glApplyTextureEXT MANGLE(ApplyTextureEXT) +#define glAreProgramsResidentNV MANGLE(AreProgramsResidentNV) +#define glAreTexturesResidentEXT MANGLE(AreTexturesResidentEXT) +#define glAreTexturesResident MANGLE(AreTexturesResident) +#define glArrayElementEXT MANGLE(ArrayElementEXT) +#define glArrayElement MANGLE(ArrayElement) +#define glArrayObjectATI MANGLE(ArrayObjectATI) +#define glAsyncMarkerSGIX MANGLE(AsyncMarkerSGIX) +#define glAttachObjectARB MANGLE(AttachObjectARB) +#define glAttachShader MANGLE(AttachShader) +#define glBeginFragmentShaderATI MANGLE(BeginFragmentShaderATI) +#define glBegin MANGLE(Begin) +#define glBeginOcclusionQueryNV MANGLE(BeginOcclusionQueryNV) +#define glBeginQueryARB MANGLE(BeginQueryARB) +#define glBeginQuery MANGLE(BeginQuery) +#define glBeginVertexShaderEXT MANGLE(BeginVertexShaderEXT) +#define glBindAttribLocationARB MANGLE(BindAttribLocationARB) +#define glBindAttribLocation MANGLE(BindAttribLocation) +#define glBindBufferARB MANGLE(BindBufferARB) +#define glBindBuffer MANGLE(BindBuffer) +#define glBindFragmentShaderATI MANGLE(BindFragmentShaderATI) +#define glBindFramebufferEXT MANGLE(BindFramebufferEXT) +#define glBindLightParameterEXT MANGLE(BindLightParameterEXT) +#define glBindMaterialParameterEXT MANGLE(BindMaterialParameterEXT) +#define glBindParameterEXT MANGLE(BindParameterEXT) +#define glBindProgramARB MANGLE(BindProgramARB) +#define glBindProgramNV MANGLE(BindProgramNV) +#define glBindRenderbufferEXT MANGLE(BindRenderbufferEXT) +#define glBindTexGenParameterEXT MANGLE(BindTexGenParameterEXT) +#define glBindTextureEXT MANGLE(BindTextureEXT) +#define glBindTexture MANGLE(BindTexture) +#define glBindTextureUnitParameterEXT MANGLE(BindTextureUnitParameterEXT) +#define glBindVertexArrayAPPLE MANGLE(BindVertexArrayAPPLE) +#define glBindVertexShaderEXT MANGLE(BindVertexShaderEXT) +#define glBinormal3bEXT MANGLE(Binormal3bEXT) +#define glBinormal3bvEXT MANGLE(Binormal3bvEXT) +#define glBinormal3dEXT MANGLE(Binormal3dEXT) +#define glBinormal3dvEXT MANGLE(Binormal3dvEXT) +#define glBinormal3fEXT MANGLE(Binormal3fEXT) +#define glBinormal3fvEXT MANGLE(Binormal3fvEXT) +#define glBinormal3iEXT MANGLE(Binormal3iEXT) +#define glBinormal3ivEXT MANGLE(Binormal3ivEXT) +#define glBinormal3sEXT MANGLE(Binormal3sEXT) +#define glBinormal3svEXT MANGLE(Binormal3svEXT) +#define glBinormalPointerEXT MANGLE(BinormalPointerEXT) +#define glBitmap MANGLE(Bitmap) +#define glBlendColorEXT MANGLE(BlendColorEXT) +#define glBlendColor MANGLE(BlendColor) +#define glBlendEquationEXT MANGLE(BlendEquationEXT) +#define glBlendEquation MANGLE(BlendEquation) +#define glBlendEquationSeparateATI MANGLE(BlendEquationSeparateATI) +#define glBlendEquationSeparateEXT MANGLE(BlendEquationSeparateEXT) +#define glBlendEquationSeparate MANGLE(BlendEquationSeparate) +#define glBlendFunc MANGLE(BlendFunc) +#define glBlendFuncSeparateEXT MANGLE(BlendFuncSeparateEXT) +#define glBlendFuncSeparateINGR MANGLE(BlendFuncSeparateINGR) +#define glBlendFuncSeparate MANGLE(BlendFuncSeparate) +#define glBufferDataARB MANGLE(BufferDataARB) +#define glBufferData MANGLE(BufferData) +#define glBufferSubDataARB MANGLE(BufferSubDataARB) +#define glBufferSubData MANGLE(BufferSubData) +#define glCallList MANGLE(CallList) +#define glCallLists MANGLE(CallLists) +#define glCheckFramebufferStatusEXT MANGLE(CheckFramebufferStatusEXT) +#define glClampColorARB MANGLE(ClampColorARB) +#define glClearAccum MANGLE(ClearAccum) +#define glClearColor MANGLE(ClearColor) +#define glClearDepth MANGLE(ClearDepth) +#define glClearIndex MANGLE(ClearIndex) +#define glClear MANGLE(Clear) +#define glClearStencil MANGLE(ClearStencil) +#define glClientActiveTextureARB MANGLE(ClientActiveTextureARB) +#define glClientActiveTexture MANGLE(ClientActiveTexture) +#define glClientActiveVertexStreamATI MANGLE(ClientActiveVertexStreamATI) +#define glClipPlane MANGLE(ClipPlane) +#define glColor3b MANGLE(Color3b) +#define glColor3bv MANGLE(Color3bv) +#define glColor3d MANGLE(Color3d) +#define glColor3dv MANGLE(Color3dv) +#define glColor3f MANGLE(Color3f) +#define glColor3fVertex3fSUN MANGLE(Color3fVertex3fSUN) +#define glColor3fVertex3fvSUN MANGLE(Color3fVertex3fvSUN) +#define glColor3fv MANGLE(Color3fv) +#define glColor3hNV MANGLE(Color3hNV) +#define glColor3hvNV MANGLE(Color3hvNV) +#define glColor3i MANGLE(Color3i) +#define glColor3iv MANGLE(Color3iv) +#define glColor3s MANGLE(Color3s) +#define glColor3sv MANGLE(Color3sv) +#define glColor3ub MANGLE(Color3ub) +#define glColor3ubv MANGLE(Color3ubv) +#define glColor3ui MANGLE(Color3ui) +#define glColor3uiv MANGLE(Color3uiv) +#define glColor3us MANGLE(Color3us) +#define glColor3usv MANGLE(Color3usv) +#define glColor4b MANGLE(Color4b) +#define glColor4bv MANGLE(Color4bv) +#define glColor4d MANGLE(Color4d) +#define glColor4dv MANGLE(Color4dv) +#define glColor4f MANGLE(Color4f) +#define glColor4fNormal3fVertex3fSUN MANGLE(Color4fNormal3fVertex3fSUN) +#define glColor4fNormal3fVertex3fvSUN MANGLE(Color4fNormal3fVertex3fvSUN) +#define glColor4fv MANGLE(Color4fv) +#define glColor4hNV MANGLE(Color4hNV) +#define glColor4hvNV MANGLE(Color4hvNV) +#define glColor4i MANGLE(Color4i) +#define glColor4iv MANGLE(Color4iv) +#define glColor4s MANGLE(Color4s) +#define glColor4sv MANGLE(Color4sv) +#define glColor4ub MANGLE(Color4ub) +#define glColor4ubVertex2fSUN MANGLE(Color4ubVertex2fSUN) +#define glColor4ubVertex2fvSUN MANGLE(Color4ubVertex2fvSUN) +#define glColor4ubVertex3fSUN MANGLE(Color4ubVertex3fSUN) +#define glColor4ubVertex3fvSUN MANGLE(Color4ubVertex3fvSUN) +#define glColor4ubv MANGLE(Color4ubv) +#define glColor4ui MANGLE(Color4ui) +#define glColor4uiv MANGLE(Color4uiv) +#define glColor4us MANGLE(Color4us) +#define glColor4usv MANGLE(Color4usv) +#define glColorFragmentOp1ATI MANGLE(ColorFragmentOp1ATI) +#define glColorFragmentOp2ATI MANGLE(ColorFragmentOp2ATI) +#define glColorFragmentOp3ATI MANGLE(ColorFragmentOp3ATI) +#define glColorMask MANGLE(ColorMask) +#define glColorMaterial MANGLE(ColorMaterial) +#define glColorPointerEXT MANGLE(ColorPointerEXT) +#define glColorPointerListIBM MANGLE(ColorPointerListIBM) +#define glColorPointer MANGLE(ColorPointer) +#define glColorPointervINTEL MANGLE(ColorPointervINTEL) +#define glColorSubTableEXT MANGLE(ColorSubTableEXT) +#define glColorSubTable MANGLE(ColorSubTable) +#define glColorTableEXT MANGLE(ColorTableEXT) +#define glColorTable MANGLE(ColorTable) +#define glColorTableParameterfv MANGLE(ColorTableParameterfv) +#define glColorTableParameterfvSGI MANGLE(ColorTableParameterfvSGI) +#define glColorTableParameteriv MANGLE(ColorTableParameteriv) +#define glColorTableParameterivSGI MANGLE(ColorTableParameterivSGI) +#define glColorTableSGI MANGLE(ColorTableSGI) +#define glCombinerInputNV MANGLE(CombinerInputNV) +#define glCombinerOutputNV MANGLE(CombinerOutputNV) +#define glCombinerParameterfNV MANGLE(CombinerParameterfNV) +#define glCombinerParameterfvNV MANGLE(CombinerParameterfvNV) +#define glCombinerParameteriNV MANGLE(CombinerParameteriNV) +#define glCombinerParameterivNV MANGLE(CombinerParameterivNV) +#define glCombinerStageParameterfvNV MANGLE(CombinerStageParameterfvNV) +#define glCompileShaderARB MANGLE(CompileShaderARB) +#define glCompileShader MANGLE(CompileShader) +#define glCompressedTexImage1DARB MANGLE(CompressedTexImage1DARB) +#define glCompressedTexImage1D MANGLE(CompressedTexImage1D) +#define glCompressedTexImage2DARB MANGLE(CompressedTexImage2DARB) +#define glCompressedTexImage2D MANGLE(CompressedTexImage2D) +#define glCompressedTexImage3DARB MANGLE(CompressedTexImage3DARB) +#define glCompressedTexImage3D MANGLE(CompressedTexImage3D) +#define glCompressedTexSubImage1DARB MANGLE(CompressedTexSubImage1DARB) +#define glCompressedTexSubImage1D MANGLE(CompressedTexSubImage1D) +#define glCompressedTexSubImage2DARB MANGLE(CompressedTexSubImage2DARB) +#define glCompressedTexSubImage2D MANGLE(CompressedTexSubImage2D) +#define glCompressedTexSubImage3DARB MANGLE(CompressedTexSubImage3DARB) +#define glCompressedTexSubImage3D MANGLE(CompressedTexSubImage3D) +#define glConvolutionFilter1DEXT MANGLE(ConvolutionFilter1DEXT) +#define glConvolutionFilter1D MANGLE(ConvolutionFilter1D) +#define glConvolutionFilter2DEXT MANGLE(ConvolutionFilter2DEXT) +#define glConvolutionFilter2D MANGLE(ConvolutionFilter2D) +#define glConvolutionParameterfEXT MANGLE(ConvolutionParameterfEXT) +#define glConvolutionParameterf MANGLE(ConvolutionParameterf) +#define glConvolutionParameterfvEXT MANGLE(ConvolutionParameterfvEXT) +#define glConvolutionParameterfv MANGLE(ConvolutionParameterfv) +#define glConvolutionParameteriEXT MANGLE(ConvolutionParameteriEXT) +#define glConvolutionParameteri MANGLE(ConvolutionParameteri) +#define glConvolutionParameterivEXT MANGLE(ConvolutionParameterivEXT) +#define glConvolutionParameteriv MANGLE(ConvolutionParameteriv) +#define glCopyColorSubTableEXT MANGLE(CopyColorSubTableEXT) +#define glCopyColorSubTable MANGLE(CopyColorSubTable) +#define glCopyColorTable MANGLE(CopyColorTable) +#define glCopyColorTableSGI MANGLE(CopyColorTableSGI) +#define glCopyConvolutionFilter1DEXT MANGLE(CopyConvolutionFilter1DEXT) +#define glCopyConvolutionFilter1D MANGLE(CopyConvolutionFilter1D) +#define glCopyConvolutionFilter2DEXT MANGLE(CopyConvolutionFilter2DEXT) +#define glCopyConvolutionFilter2D MANGLE(CopyConvolutionFilter2D) +#define glCopyPixels MANGLE(CopyPixels) +#define glCopyTexImage1DEXT MANGLE(CopyTexImage1DEXT) +#define glCopyTexImage1D MANGLE(CopyTexImage1D) +#define glCopyTexImage2DEXT MANGLE(CopyTexImage2DEXT) +#define glCopyTexImage2D MANGLE(CopyTexImage2D) +#define glCopyTexSubImage1DEXT MANGLE(CopyTexSubImage1DEXT) +#define glCopyTexSubImage1D MANGLE(CopyTexSubImage1D) +#define glCopyTexSubImage2DEXT MANGLE(CopyTexSubImage2DEXT) +#define glCopyTexSubImage2D MANGLE(CopyTexSubImage2D) +#define glCopyTexSubImage3DEXT MANGLE(CopyTexSubImage3DEXT) +#define glCopyTexSubImage3D MANGLE(CopyTexSubImage3D) +#define glCreateProgram MANGLE(CreateProgram) +#define glCreateProgramObjectARB MANGLE(CreateProgramObjectARB) +#define glCreateShader MANGLE(CreateShader) +#define glCreateShaderObjectARB MANGLE(CreateShaderObjectARB) +#define glCullFace MANGLE(CullFace) +#define glCullParameterdvEXT MANGLE(CullParameterdvEXT) +#define glCullParameterfvEXT MANGLE(CullParameterfvEXT) +#define glCurrentPaletteMatrixARB MANGLE(CurrentPaletteMatrixARB) +#define glDeformationMap3dSGIX MANGLE(DeformationMap3dSGIX) +#define glDeformationMap3fSGIX MANGLE(DeformationMap3fSGIX) +#define glDeformSGIX MANGLE(DeformSGIX) +#define glDeleteAsyncMarkersSGIX MANGLE(DeleteAsyncMarkersSGIX) +#define glDeleteBuffersARB MANGLE(DeleteBuffersARB) +#define glDeleteBuffers MANGLE(DeleteBuffers) +#define glDeleteFencesAPPLE MANGLE(DeleteFencesAPPLE) +#define glDeleteFencesNV MANGLE(DeleteFencesNV) +#define glDeleteFragmentShaderATI MANGLE(DeleteFragmentShaderATI) +#define glDeleteFramebuffersEXT MANGLE(DeleteFramebuffersEXT) +#define glDeleteLists MANGLE(DeleteLists) +#define glDeleteObjectARB MANGLE(DeleteObjectARB) +#define glDeleteOcclusionQueriesNV MANGLE(DeleteOcclusionQueriesNV) +#define glDeleteProgram MANGLE(DeleteProgram) +#define glDeleteProgramsARB MANGLE(DeleteProgramsARB) +#define glDeleteProgramsNV MANGLE(DeleteProgramsNV) +#define glDeleteQueriesARB MANGLE(DeleteQueriesARB) +#define glDeleteQueries MANGLE(DeleteQueries) +#define glDeleteRenderbuffersEXT MANGLE(DeleteRenderbuffersEXT) +#define glDeleteShader MANGLE(DeleteShader) +#define glDeleteTexturesEXT MANGLE(DeleteTexturesEXT) +#define glDeleteTextures MANGLE(DeleteTextures) +#define glDeleteVertexArraysAPPLE MANGLE(DeleteVertexArraysAPPLE) +#define glDeleteVertexShaderEXT MANGLE(DeleteVertexShaderEXT) +#define glDepthBoundsEXT MANGLE(DepthBoundsEXT) +#define glDepthFunc MANGLE(DepthFunc) +#define glDepthMask MANGLE(DepthMask) +#define glDepthRange MANGLE(DepthRange) +#define glDetachObjectARB MANGLE(DetachObjectARB) +#define glDetachShader MANGLE(DetachShader) +#define glDetailTexFuncSGIS MANGLE(DetailTexFuncSGIS) +#define glDisableClientState MANGLE(DisableClientState) +#define glDisable MANGLE(Disable) +#define glDisableTraceMESA MANGLE(DisableTraceMESA) +#define glDisableVariantClientStateEXT MANGLE(DisableVariantClientStateEXT) +#define glDisableVertexAttribArrayARB MANGLE(DisableVertexAttribArrayARB) +#define glDisableVertexAttribArray MANGLE(DisableVertexAttribArray) +#define glDrawArraysEXT MANGLE(DrawArraysEXT) +#define glDrawArrays MANGLE(DrawArrays) +#define glDrawBuffer MANGLE(DrawBuffer) +#define glDrawBuffersARB MANGLE(DrawBuffersARB) +#define glDrawBuffersATI MANGLE(DrawBuffersATI) +#define glDrawBuffers MANGLE(DrawBuffers) +#define glDrawElementArrayAPPLE MANGLE(DrawElementArrayAPPLE) +#define glDrawElementArrayATI MANGLE(DrawElementArrayATI) +#define glDrawElements MANGLE(DrawElements) +#define glDrawMeshArraysSUN MANGLE(DrawMeshArraysSUN) +#define glDrawPixels MANGLE(DrawPixels) +#define glDrawRangeElementArrayAPPLE MANGLE(DrawRangeElementArrayAPPLE) +#define glDrawRangeElementArrayATI MANGLE(DrawRangeElementArrayATI) +#define glDrawRangeElementsEXT MANGLE(DrawRangeElementsEXT) +#define glDrawRangeElements MANGLE(DrawRangeElements) +#define glEdgeFlag MANGLE(EdgeFlag) +#define glEdgeFlagPointerEXT MANGLE(EdgeFlagPointerEXT) +#define glEdgeFlagPointerListIBM MANGLE(EdgeFlagPointerListIBM) +#define glEdgeFlagPointer MANGLE(EdgeFlagPointer) +#define glEdgeFlagv MANGLE(EdgeFlagv) +#define glElementPointerAPPLE MANGLE(ElementPointerAPPLE) +#define glElementPointerATI MANGLE(ElementPointerATI) +#define glEnableClientState MANGLE(EnableClientState) +#define glEnable MANGLE(Enable) +#define glEnableTraceMESA MANGLE(EnableTraceMESA) +#define glEnableVariantClientStateEXT MANGLE(EnableVariantClientStateEXT) +#define glEnableVertexAttribArrayARB MANGLE(EnableVertexAttribArrayARB) +#define glEnableVertexAttribArray MANGLE(EnableVertexAttribArray) +#define glEndFragmentShaderATI MANGLE(EndFragmentShaderATI) +#define glEndList MANGLE(EndList) +#define glEnd MANGLE(End) +#define glEndOcclusionQueryNV MANGLE(EndOcclusionQueryNV) +#define glEndQueryARB MANGLE(EndQueryARB) +#define glEndQuery MANGLE(EndQuery) +#define glEndTraceMESA MANGLE(EndTraceMESA) +#define glEndVertexShaderEXT MANGLE(EndVertexShaderEXT) +#define glEvalCoord1d MANGLE(EvalCoord1d) +#define glEvalCoord1dv MANGLE(EvalCoord1dv) +#define glEvalCoord1f MANGLE(EvalCoord1f) +#define glEvalCoord1fv MANGLE(EvalCoord1fv) +#define glEvalCoord2d MANGLE(EvalCoord2d) +#define glEvalCoord2dv MANGLE(EvalCoord2dv) +#define glEvalCoord2f MANGLE(EvalCoord2f) +#define glEvalCoord2fv MANGLE(EvalCoord2fv) +#define glEvalMapsNV MANGLE(EvalMapsNV) +#define glEvalMesh1 MANGLE(EvalMesh1) +#define glEvalMesh2 MANGLE(EvalMesh2) +#define glEvalPoint1 MANGLE(EvalPoint1) +#define glEvalPoint2 MANGLE(EvalPoint2) +#define glExecuteProgramNV MANGLE(ExecuteProgramNV) +#define glExtractComponentEXT MANGLE(ExtractComponentEXT) +#define glFeedbackBuffer MANGLE(FeedbackBuffer) +#define glFinalCombinerInputNV MANGLE(FinalCombinerInputNV) +#define glFinishAsyncSGIX MANGLE(FinishAsyncSGIX) +#define glFinishFenceAPPLE MANGLE(FinishFenceAPPLE) +#define glFinishFenceNV MANGLE(FinishFenceNV) +#define glFinish MANGLE(Finish) +#define glFinishObjectAPPLE MANGLE(FinishObjectAPPLE) +#define glFinishTextureSUNX MANGLE(FinishTextureSUNX) +#define glFlush MANGLE(Flush) +#define glFlushPixelDataRangeNV MANGLE(FlushPixelDataRangeNV) +#define glFlushRasterSGIX MANGLE(FlushRasterSGIX) +#define glFlushVertexArrayRangeAPPLE MANGLE(FlushVertexArrayRangeAPPLE) +#define glFlushVertexArrayRangeNV MANGLE(FlushVertexArrayRangeNV) +#define glFogCoorddEXT MANGLE(FogCoorddEXT) +#define glFogCoordd MANGLE(FogCoordd) +#define glFogCoorddvEXT MANGLE(FogCoorddvEXT) +#define glFogCoorddv MANGLE(FogCoorddv) +#define glFogCoordfEXT MANGLE(FogCoordfEXT) +#define glFogCoordf MANGLE(FogCoordf) +#define glFogCoordfvEXT MANGLE(FogCoordfvEXT) +#define glFogCoordfv MANGLE(FogCoordfv) +#define glFogCoordhNV MANGLE(FogCoordhNV) +#define glFogCoordhvNV MANGLE(FogCoordhvNV) +#define glFogCoordPointerEXT MANGLE(FogCoordPointerEXT) +#define glFogCoordPointerListIBM MANGLE(FogCoordPointerListIBM) +#define glFogCoordPointer MANGLE(FogCoordPointer) +#define glFogf MANGLE(Fogf) +#define glFogFuncSGIS MANGLE(FogFuncSGIS) +#define glFogfv MANGLE(Fogfv) +#define glFogi MANGLE(Fogi) +#define glFogiv MANGLE(Fogiv) +#define glFragmentColorMaterialSGIX MANGLE(FragmentColorMaterialSGIX) +#define glFragmentLightfSGIX MANGLE(FragmentLightfSGIX) +#define glFragmentLightfvSGIX MANGLE(FragmentLightfvSGIX) +#define glFragmentLightiSGIX MANGLE(FragmentLightiSGIX) +#define glFragmentLightivSGIX MANGLE(FragmentLightivSGIX) +#define glFragmentLightModelfSGIX MANGLE(FragmentLightModelfSGIX) +#define glFragmentLightModelfvSGIX MANGLE(FragmentLightModelfvSGIX) +#define glFragmentLightModeliSGIX MANGLE(FragmentLightModeliSGIX) +#define glFragmentLightModelivSGIX MANGLE(FragmentLightModelivSGIX) +#define glFragmentMaterialfSGIX MANGLE(FragmentMaterialfSGIX) +#define glFragmentMaterialfvSGIX MANGLE(FragmentMaterialfvSGIX) +#define glFragmentMaterialiSGIX MANGLE(FragmentMaterialiSGIX) +#define glFragmentMaterialivSGIX MANGLE(FragmentMaterialivSGIX) +#define glFramebufferRenderbufferEXT MANGLE(FramebufferRenderbufferEXT) +#define glFramebufferTexture1DEXT MANGLE(FramebufferTexture1DEXT) +#define glFramebufferTexture2DEXT MANGLE(FramebufferTexture2DEXT) +#define glFramebufferTexture3DEXT MANGLE(FramebufferTexture3DEXT) +#define glFrameZoomSGIX MANGLE(FrameZoomSGIX) +#define glFreeObjectBufferATI MANGLE(FreeObjectBufferATI) +#define glFrontFace MANGLE(FrontFace) +#define glFrustum MANGLE(Frustum) +#define glGenAsyncMarkersSGIX MANGLE(GenAsyncMarkersSGIX) +#define glGenBuffersARB MANGLE(GenBuffersARB) +#define glGenBuffers MANGLE(GenBuffers) +#define glGenerateMipmapEXT MANGLE(GenerateMipmapEXT) +#define glGenFencesAPPLE MANGLE(GenFencesAPPLE) +#define glGenFencesNV MANGLE(GenFencesNV) +#define glGenFragmentShadersATI MANGLE(GenFragmentShadersATI) +#define glGenFramebuffersEXT MANGLE(GenFramebuffersEXT) +#define glGenLists MANGLE(GenLists) +#define glGenOcclusionQueriesNV MANGLE(GenOcclusionQueriesNV) +#define glGenProgramsARB MANGLE(GenProgramsARB) +#define glGenProgramsNV MANGLE(GenProgramsNV) +#define glGenQueriesARB MANGLE(GenQueriesARB) +#define glGenQueries MANGLE(GenQueries) +#define glGenRenderbuffersEXT MANGLE(GenRenderbuffersEXT) +#define glGenSymbolsEXT MANGLE(GenSymbolsEXT) +#define glGenTexturesEXT MANGLE(GenTexturesEXT) +#define glGenTextures MANGLE(GenTextures) +#define glGenVertexArraysAPPLE MANGLE(GenVertexArraysAPPLE) +#define glGenVertexShadersEXT MANGLE(GenVertexShadersEXT) +#define glGetActiveAttribARB MANGLE(GetActiveAttribARB) +#define glGetActiveAttrib MANGLE(GetActiveAttrib) +#define glGetActiveUniformARB MANGLE(GetActiveUniformARB) +#define glGetActiveUniform MANGLE(GetActiveUniform) +#define glGetArrayObjectfvATI MANGLE(GetArrayObjectfvATI) +#define glGetArrayObjectivATI MANGLE(GetArrayObjectivATI) +#define glGetAttachedObjectsARB MANGLE(GetAttachedObjectsARB) +#define glGetAttachedShaders MANGLE(GetAttachedShaders) +#define glGetAttribLocationARB MANGLE(GetAttribLocationARB) +#define glGetAttribLocation MANGLE(GetAttribLocation) +#define glGetBooleanv MANGLE(GetBooleanv) +#define glGetBufferParameterivARB MANGLE(GetBufferParameterivARB) +#define glGetBufferParameteriv MANGLE(GetBufferParameteriv) +#define glGetBufferPointervARB MANGLE(GetBufferPointervARB) +#define glGetBufferPointerv MANGLE(GetBufferPointerv) +#define glGetBufferSubDataARB MANGLE(GetBufferSubDataARB) +#define glGetBufferSubData MANGLE(GetBufferSubData) +#define glGetClipPlane MANGLE(GetClipPlane) +#define glGetColorTableEXT MANGLE(GetColorTableEXT) +#define glGetColorTable MANGLE(GetColorTable) +#define glGetColorTableParameterfvEXT MANGLE(GetColorTableParameterfvEXT) +#define glGetColorTableParameterfv MANGLE(GetColorTableParameterfv) +#define glGetColorTableParameterfvSGI MANGLE(GetColorTableParameterfvSGI) +#define glGetColorTableParameterivEXT MANGLE(GetColorTableParameterivEXT) +#define glGetColorTableParameteriv MANGLE(GetColorTableParameteriv) +#define glGetColorTableParameterivSGI MANGLE(GetColorTableParameterivSGI) +#define glGetColorTableSGI MANGLE(GetColorTableSGI) +#define glGetCombinerInputParameterfvNV MANGLE(GetCombinerInputParameterfvNV) +#define glGetCombinerInputParameterivNV MANGLE(GetCombinerInputParameterivNV) +#define glGetCombinerOutputParameterfvNV MANGLE(GetCombinerOutputParameterfvNV) +#define glGetCombinerOutputParameterivNV MANGLE(GetCombinerOutputParameterivNV) +#define glGetCombinerStageParameterfvNV MANGLE(GetCombinerStageParameterfvNV) +#define glGetCompressedTexImageARB MANGLE(GetCompressedTexImageARB) +#define glGetCompressedTexImage MANGLE(GetCompressedTexImage) +#define glGetConvolutionFilterEXT MANGLE(GetConvolutionFilterEXT) +#define glGetConvolutionFilter MANGLE(GetConvolutionFilter) +#define glGetConvolutionParameterfvEXT MANGLE(GetConvolutionParameterfvEXT) +#define glGetConvolutionParameterfv MANGLE(GetConvolutionParameterfv) +#define glGetConvolutionParameterivEXT MANGLE(GetConvolutionParameterivEXT) +#define glGetConvolutionParameteriv MANGLE(GetConvolutionParameteriv) +#define glGetDetailTexFuncSGIS MANGLE(GetDetailTexFuncSGIS) +#define glGetDoublev MANGLE(GetDoublev) +#define glGetError MANGLE(GetError) +#define glGetFenceivNV MANGLE(GetFenceivNV) +#define glGetFinalCombinerInputParameterfvNV MANGLE(GetFinalCombinerInputParameterfvNV) +#define glGetFinalCombinerInputParameterivNV MANGLE(GetFinalCombinerInputParameterivNV) +#define glGetFloatv MANGLE(GetFloatv) +#define glGetFogFuncSGIS MANGLE(GetFogFuncSGIS) +#define glGetFragmentLightfvSGIX MANGLE(GetFragmentLightfvSGIX) +#define glGetFragmentLightivSGIX MANGLE(GetFragmentLightivSGIX) +#define glGetFragmentMaterialfvSGIX MANGLE(GetFragmentMaterialfvSGIX) +#define glGetFragmentMaterialivSGIX MANGLE(GetFragmentMaterialivSGIX) +#define glGetFramebufferAttachmentParameterivEXT MANGLE(GetFramebufferAttachmentParameterivEXT) +#define glGetHandleARB MANGLE(GetHandleARB) +#define glGetHistogramEXT MANGLE(GetHistogramEXT) +#define glGetHistogram MANGLE(GetHistogram) +#define glGetHistogramParameterfvEXT MANGLE(GetHistogramParameterfvEXT) +#define glGetHistogramParameterfv MANGLE(GetHistogramParameterfv) +#define glGetHistogramParameterivEXT MANGLE(GetHistogramParameterivEXT) +#define glGetHistogramParameteriv MANGLE(GetHistogramParameteriv) +#define glGetImageTransformParameterfvHP MANGLE(GetImageTransformParameterfvHP) +#define glGetImageTransformParameterivHP MANGLE(GetImageTransformParameterivHP) +#define glGetInfoLogARB MANGLE(GetInfoLogARB) +#define glGetInstrumentsSGIX MANGLE(GetInstrumentsSGIX) +#define glGetIntegerv MANGLE(GetIntegerv) +#define glGetInvariantBooleanvEXT MANGLE(GetInvariantBooleanvEXT) +#define glGetInvariantFloatvEXT MANGLE(GetInvariantFloatvEXT) +#define glGetInvariantIntegervEXT MANGLE(GetInvariantIntegervEXT) +#define glGetLightfv MANGLE(GetLightfv) +#define glGetLightiv MANGLE(GetLightiv) +#define glGetListParameterfvSGIX MANGLE(GetListParameterfvSGIX) +#define glGetListParameterivSGIX MANGLE(GetListParameterivSGIX) +#define glGetLocalConstantBooleanvEXT MANGLE(GetLocalConstantBooleanvEXT) +#define glGetLocalConstantFloatvEXT MANGLE(GetLocalConstantFloatvEXT) +#define glGetLocalConstantIntegervEXT MANGLE(GetLocalConstantIntegervEXT) +#define glGetMapAttribParameterfvNV MANGLE(GetMapAttribParameterfvNV) +#define glGetMapAttribParameterivNV MANGLE(GetMapAttribParameterivNV) +#define glGetMapControlPointsNV MANGLE(GetMapControlPointsNV) +#define glGetMapdv MANGLE(GetMapdv) +#define glGetMapfv MANGLE(GetMapfv) +#define glGetMapiv MANGLE(GetMapiv) +#define glGetMapParameterfvNV MANGLE(GetMapParameterfvNV) +#define glGetMapParameterivNV MANGLE(GetMapParameterivNV) +#define glGetMaterialfv MANGLE(GetMaterialfv) +#define glGetMaterialiv MANGLE(GetMaterialiv) +#define glGetMinmaxEXT MANGLE(GetMinmaxEXT) +#define glGetMinmax MANGLE(GetMinmax) +#define glGetMinmaxParameterfvEXT MANGLE(GetMinmaxParameterfvEXT) +#define glGetMinmaxParameterfv MANGLE(GetMinmaxParameterfv) +#define glGetMinmaxParameterivEXT MANGLE(GetMinmaxParameterivEXT) +#define glGetMinmaxParameteriv MANGLE(GetMinmaxParameteriv) +#define glGetObjectBufferfvATI MANGLE(GetObjectBufferfvATI) +#define glGetObjectBufferivATI MANGLE(GetObjectBufferivATI) +#define glGetObjectParameterfvARB MANGLE(GetObjectParameterfvARB) +#define glGetObjectParameterivARB MANGLE(GetObjectParameterivARB) +#define glGetOcclusionQueryivNV MANGLE(GetOcclusionQueryivNV) +#define glGetOcclusionQueryuivNV MANGLE(GetOcclusionQueryuivNV) +#define glGetPixelMapfv MANGLE(GetPixelMapfv) +#define glGetPixelMapuiv MANGLE(GetPixelMapuiv) +#define glGetPixelMapusv MANGLE(GetPixelMapusv) +#define glGetPixelTexGenParameterfvSGIS MANGLE(GetPixelTexGenParameterfvSGIS) +#define glGetPixelTexGenParameterivSGIS MANGLE(GetPixelTexGenParameterivSGIS) +#define glGetPointervEXT MANGLE(GetPointervEXT) +#define glGetPointerv MANGLE(GetPointerv) +#define glGetPolygonStipple MANGLE(GetPolygonStipple) +#define glGetProgramEnvParameterdvARB MANGLE(GetProgramEnvParameterdvARB) +#define glGetProgramEnvParameterfvARB MANGLE(GetProgramEnvParameterfvARB) +#define glGetProgramInfoLog MANGLE(GetProgramInfoLog) +#define glGetProgramivARB MANGLE(GetProgramivARB) +#define glGetProgramiv MANGLE(GetProgramiv) +#define glGetProgramivNV MANGLE(GetProgramivNV) +#define glGetProgramLocalParameterdvARB MANGLE(GetProgramLocalParameterdvARB) +#define glGetProgramLocalParameterfvARB MANGLE(GetProgramLocalParameterfvARB) +#define glGetProgramNamedParameterdvNV MANGLE(GetProgramNamedParameterdvNV) +#define glGetProgramNamedParameterfvNV MANGLE(GetProgramNamedParameterfvNV) +#define glGetProgramParameterdvNV MANGLE(GetProgramParameterdvNV) +#define glGetProgramParameterfvNV MANGLE(GetProgramParameterfvNV) +#define glGetProgramRegisterfvMESA MANGLE(GetProgramRegisterfvMESA) +#define glGetProgramStringARB MANGLE(GetProgramStringARB) +#define glGetProgramStringNV MANGLE(GetProgramStringNV) +#define glGetQueryivARB MANGLE(GetQueryivARB) +#define glGetQueryiv MANGLE(GetQueryiv) +#define glGetQueryObjectivARB MANGLE(GetQueryObjectivARB) +#define glGetQueryObjectiv MANGLE(GetQueryObjectiv) +#define glGetQueryObjectuivARB MANGLE(GetQueryObjectuivARB) +#define glGetQueryObjectuiv MANGLE(GetQueryObjectuiv) +#define glGetRenderbufferParameterivEXT MANGLE(GetRenderbufferParameterivEXT) +#define glGetSeparableFilterEXT MANGLE(GetSeparableFilterEXT) +#define glGetSeparableFilter MANGLE(GetSeparableFilter) +#define glGetShaderInfoLog MANGLE(GetShaderInfoLog) +#define glGetShaderiv MANGLE(GetShaderiv) +#define glGetShaderSourceARB MANGLE(GetShaderSourceARB) +#define glGetShaderSource MANGLE(GetShaderSource) +#define glGetSharpenTexFuncSGIS MANGLE(GetSharpenTexFuncSGIS) +#define glGetString MANGLE(GetString) +#define glGetTexBumpParameterfvATI MANGLE(GetTexBumpParameterfvATI) +#define glGetTexBumpParameterivATI MANGLE(GetTexBumpParameterivATI) +#define glGetTexEnvfv MANGLE(GetTexEnvfv) +#define glGetTexEnviv MANGLE(GetTexEnviv) +#define glGetTexFilterFuncSGIS MANGLE(GetTexFilterFuncSGIS) +#define glGetTexGendv MANGLE(GetTexGendv) +#define glGetTexGenfv MANGLE(GetTexGenfv) +#define glGetTexGeniv MANGLE(GetTexGeniv) +#define glGetTexImage MANGLE(GetTexImage) +#define glGetTexLevelParameterfv MANGLE(GetTexLevelParameterfv) +#define glGetTexLevelParameteriv MANGLE(GetTexLevelParameteriv) +#define glGetTexParameterfv MANGLE(GetTexParameterfv) +#define glGetTexParameteriv MANGLE(GetTexParameteriv) +#define glGetTrackMatrixivNV MANGLE(GetTrackMatrixivNV) +#define glGetUniformfvARB MANGLE(GetUniformfvARB) +#define glGetUniformfv MANGLE(GetUniformfv) +#define glGetUniformivARB MANGLE(GetUniformivARB) +#define glGetUniformiv MANGLE(GetUniformiv) +#define glGetUniformLocationARB MANGLE(GetUniformLocationARB) +#define glGetUniformLocation MANGLE(GetUniformLocation) +#define glGetVariantArrayObjectfvATI MANGLE(GetVariantArrayObjectfvATI) +#define glGetVariantArrayObjectivATI MANGLE(GetVariantArrayObjectivATI) +#define glGetVariantBooleanvEXT MANGLE(GetVariantBooleanvEXT) +#define glGetVariantFloatvEXT MANGLE(GetVariantFloatvEXT) +#define glGetVariantIntegervEXT MANGLE(GetVariantIntegervEXT) +#define glGetVariantPointervEXT MANGLE(GetVariantPointervEXT) +#define glGetVertexAttribArrayObjectfvATI MANGLE(GetVertexAttribArrayObjectfvATI) +#define glGetVertexAttribArrayObjectivATI MANGLE(GetVertexAttribArrayObjectivATI) +#define glGetVertexAttribdvARB MANGLE(GetVertexAttribdvARB) +#define glGetVertexAttribdv MANGLE(GetVertexAttribdv) +#define glGetVertexAttribdvNV MANGLE(GetVertexAttribdvNV) +#define glGetVertexAttribfvARB MANGLE(GetVertexAttribfvARB) +#define glGetVertexAttribfv MANGLE(GetVertexAttribfv) +#define glGetVertexAttribfvNV MANGLE(GetVertexAttribfvNV) +#define glGetVertexAttribivARB MANGLE(GetVertexAttribivARB) +#define glGetVertexAttribiv MANGLE(GetVertexAttribiv) +#define glGetVertexAttribivNV MANGLE(GetVertexAttribivNV) +#define glGetVertexAttribPointervARB MANGLE(GetVertexAttribPointervARB) +#define glGetVertexAttribPointerv MANGLE(GetVertexAttribPointerv) +#define glGetVertexAttribPointervNV MANGLE(GetVertexAttribPointervNV) +#define glGlobalAlphaFactorbSUN MANGLE(GlobalAlphaFactorbSUN) +#define glGlobalAlphaFactordSUN MANGLE(GlobalAlphaFactordSUN) +#define glGlobalAlphaFactorfSUN MANGLE(GlobalAlphaFactorfSUN) +#define glGlobalAlphaFactoriSUN MANGLE(GlobalAlphaFactoriSUN) +#define glGlobalAlphaFactorsSUN MANGLE(GlobalAlphaFactorsSUN) +#define glGlobalAlphaFactorubSUN MANGLE(GlobalAlphaFactorubSUN) +#define glGlobalAlphaFactoruiSUN MANGLE(GlobalAlphaFactoruiSUN) +#define glGlobalAlphaFactorusSUN MANGLE(GlobalAlphaFactorusSUN) +#define glHint MANGLE(Hint) +#define glHintPGI MANGLE(HintPGI) +#define glHistogramEXT MANGLE(HistogramEXT) +#define glHistogram MANGLE(Histogram) +#define glIglooInterfaceSGIX MANGLE(IglooInterfaceSGIX) +#define glImageTransformParameterfHP MANGLE(ImageTransformParameterfHP) +#define glImageTransformParameterfvHP MANGLE(ImageTransformParameterfvHP) +#define glImageTransformParameteriHP MANGLE(ImageTransformParameteriHP) +#define glImageTransformParameterivHP MANGLE(ImageTransformParameterivHP) +#define glIndexd MANGLE(Indexd) +#define glIndexdv MANGLE(Indexdv) +#define glIndexf MANGLE(Indexf) +#define glIndexFuncEXT MANGLE(IndexFuncEXT) +#define glIndexfv MANGLE(Indexfv) +#define glIndexi MANGLE(Indexi) +#define glIndexiv MANGLE(Indexiv) +#define glIndexMask MANGLE(IndexMask) +#define glIndexMaterialEXT MANGLE(IndexMaterialEXT) +#define glIndexPointerEXT MANGLE(IndexPointerEXT) +#define glIndexPointerListIBM MANGLE(IndexPointerListIBM) +#define glIndexPointer MANGLE(IndexPointer) +#define glIndexs MANGLE(Indexs) +#define glIndexsv MANGLE(Indexsv) +#define glIndexub MANGLE(Indexub) +#define glIndexubv MANGLE(Indexubv) +#define glInitNames MANGLE(InitNames) +#define glInsertComponentEXT MANGLE(InsertComponentEXT) +#define glInstrumentsBufferSGIX MANGLE(InstrumentsBufferSGIX) +#define glInterleavedArrays MANGLE(InterleavedArrays) +#define glIsAsyncMarkerSGIX MANGLE(IsAsyncMarkerSGIX) +#define glIsBufferARB MANGLE(IsBufferARB) +#define glIsBuffer MANGLE(IsBuffer) +#define glIsEnabled MANGLE(IsEnabled) +#define glIsFenceAPPLE MANGLE(IsFenceAPPLE) +#define glIsFenceNV MANGLE(IsFenceNV) +#define glIsFramebufferEXT MANGLE(IsFramebufferEXT) +#define glIsList MANGLE(IsList) +#define glIsObjectBufferATI MANGLE(IsObjectBufferATI) +#define glIsOcclusionQueryNV MANGLE(IsOcclusionQueryNV) +#define glIsProgramARB MANGLE(IsProgramARB) +#define glIsProgram MANGLE(IsProgram) +#define glIsProgramNV MANGLE(IsProgramNV) +#define glIsQueryARB MANGLE(IsQueryARB) +#define glIsQuery MANGLE(IsQuery) +#define glIsRenderbufferEXT MANGLE(IsRenderbufferEXT) +#define glIsShader MANGLE(IsShader) +#define glIsTextureEXT MANGLE(IsTextureEXT) +#define glIsTexture MANGLE(IsTexture) +#define glIsVariantEnabledEXT MANGLE(IsVariantEnabledEXT) +#define glIsVertexArrayAPPLE MANGLE(IsVertexArrayAPPLE) +#define glLightEnviSGIX MANGLE(LightEnviSGIX) +#define glLightf MANGLE(Lightf) +#define glLightfv MANGLE(Lightfv) +#define glLighti MANGLE(Lighti) +#define glLightiv MANGLE(Lightiv) +#define glLightModelf MANGLE(LightModelf) +#define glLightModelfv MANGLE(LightModelfv) +#define glLightModeli MANGLE(LightModeli) +#define glLightModeliv MANGLE(LightModeliv) +#define glLineStipple MANGLE(LineStipple) +#define glLineWidth MANGLE(LineWidth) +#define glLinkProgramARB MANGLE(LinkProgramARB) +#define glLinkProgram MANGLE(LinkProgram) +#define glListBase MANGLE(ListBase) +#define glListParameterfSGIX MANGLE(ListParameterfSGIX) +#define glListParameterfvSGIX MANGLE(ListParameterfvSGIX) +#define glListParameteriSGIX MANGLE(ListParameteriSGIX) +#define glListParameterivSGIX MANGLE(ListParameterivSGIX) +#define glLoadIdentityDeformationMapSGIX MANGLE(LoadIdentityDeformationMapSGIX) +#define glLoadIdentity MANGLE(LoadIdentity) +#define glLoadMatrixd MANGLE(LoadMatrixd) +#define glLoadMatrixf MANGLE(LoadMatrixf) +#define glLoadName MANGLE(LoadName) +#define glLoadProgramNV MANGLE(LoadProgramNV) +#define glLoadTransposeMatrixdARB MANGLE(LoadTransposeMatrixdARB) +#define glLoadTransposeMatrixd MANGLE(LoadTransposeMatrixd) +#define glLoadTransposeMatrixfARB MANGLE(LoadTransposeMatrixfARB) +#define glLoadTransposeMatrixf MANGLE(LoadTransposeMatrixf) +#define glLockArraysEXT MANGLE(LockArraysEXT) +#define glLogicOp MANGLE(LogicOp) +#define glMap1d MANGLE(Map1d) +#define glMap1f MANGLE(Map1f) +#define glMap2d MANGLE(Map2d) +#define glMap2f MANGLE(Map2f) +#define glMapBufferARB MANGLE(MapBufferARB) +#define glMapBuffer MANGLE(MapBuffer) +#define glMapControlPointsNV MANGLE(MapControlPointsNV) +#define glMapGrid1d MANGLE(MapGrid1d) +#define glMapGrid1f MANGLE(MapGrid1f) +#define glMapGrid2d MANGLE(MapGrid2d) +#define glMapGrid2f MANGLE(MapGrid2f) +#define glMapObjectBufferATI MANGLE(MapObjectBufferATI) +#define glMapParameterfvNV MANGLE(MapParameterfvNV) +#define glMapParameterivNV MANGLE(MapParameterivNV) +#define glMaterialf MANGLE(Materialf) +#define glMaterialfv MANGLE(Materialfv) +#define glMateriali MANGLE(Materiali) +#define glMaterialiv MANGLE(Materialiv) +#define glMatrixIndexPointerARB MANGLE(MatrixIndexPointerARB) +#define glMatrixIndexubvARB MANGLE(MatrixIndexubvARB) +#define glMatrixIndexuivARB MANGLE(MatrixIndexuivARB) +#define glMatrixIndexusvARB MANGLE(MatrixIndexusvARB) +#define glMatrixMode MANGLE(MatrixMode) +#define glMinmaxEXT MANGLE(MinmaxEXT) +#define glMinmax MANGLE(Minmax) +#define glMultiDrawArraysEXT MANGLE(MultiDrawArraysEXT) +#define glMultiDrawArrays MANGLE(MultiDrawArrays) +#define glMultiDrawElementArrayAPPLE MANGLE(MultiDrawElementArrayAPPLE) +#define glMultiDrawElementsEXT MANGLE(MultiDrawElementsEXT) +#define glMultiDrawElements MANGLE(MultiDrawElements) +#define glMultiDrawRangeElementArrayAPPLE MANGLE(MultiDrawRangeElementArrayAPPLE) +#define glMultiModeDrawArraysIBM MANGLE(MultiModeDrawArraysIBM) +#define glMultiModeDrawElementsIBM MANGLE(MultiModeDrawElementsIBM) +#define glMultiTexCoord1dARB MANGLE(MultiTexCoord1dARB) +#define glMultiTexCoord1d MANGLE(MultiTexCoord1d) +#define glMultiTexCoord1dvARB MANGLE(MultiTexCoord1dvARB) +#define glMultiTexCoord1dv MANGLE(MultiTexCoord1dv) +#define glMultiTexCoord1fARB MANGLE(MultiTexCoord1fARB) +#define glMultiTexCoord1f MANGLE(MultiTexCoord1f) +#define glMultiTexCoord1fvARB MANGLE(MultiTexCoord1fvARB) +#define glMultiTexCoord1fv MANGLE(MultiTexCoord1fv) +#define glMultiTexCoord1hNV MANGLE(MultiTexCoord1hNV) +#define glMultiTexCoord1hvNV MANGLE(MultiTexCoord1hvNV) +#define glMultiTexCoord1iARB MANGLE(MultiTexCoord1iARB) +#define glMultiTexCoord1i MANGLE(MultiTexCoord1i) +#define glMultiTexCoord1ivARB MANGLE(MultiTexCoord1ivARB) +#define glMultiTexCoord1iv MANGLE(MultiTexCoord1iv) +#define glMultiTexCoord1sARB MANGLE(MultiTexCoord1sARB) +#define glMultiTexCoord1s MANGLE(MultiTexCoord1s) +#define glMultiTexCoord1svARB MANGLE(MultiTexCoord1svARB) +#define glMultiTexCoord1sv MANGLE(MultiTexCoord1sv) +#define glMultiTexCoord2dARB MANGLE(MultiTexCoord2dARB) +#define glMultiTexCoord2d MANGLE(MultiTexCoord2d) +#define glMultiTexCoord2dvARB MANGLE(MultiTexCoord2dvARB) +#define glMultiTexCoord2dv MANGLE(MultiTexCoord2dv) +#define glMultiTexCoord2fARB MANGLE(MultiTexCoord2fARB) +#define glMultiTexCoord2f MANGLE(MultiTexCoord2f) +#define glMultiTexCoord2fvARB MANGLE(MultiTexCoord2fvARB) +#define glMultiTexCoord2fv MANGLE(MultiTexCoord2fv) +#define glMultiTexCoord2hNV MANGLE(MultiTexCoord2hNV) +#define glMultiTexCoord2hvNV MANGLE(MultiTexCoord2hvNV) +#define glMultiTexCoord2iARB MANGLE(MultiTexCoord2iARB) +#define glMultiTexCoord2i MANGLE(MultiTexCoord2i) +#define glMultiTexCoord2ivARB MANGLE(MultiTexCoord2ivARB) +#define glMultiTexCoord2iv MANGLE(MultiTexCoord2iv) +#define glMultiTexCoord2sARB MANGLE(MultiTexCoord2sARB) +#define glMultiTexCoord2s MANGLE(MultiTexCoord2s) +#define glMultiTexCoord2svARB MANGLE(MultiTexCoord2svARB) +#define glMultiTexCoord2sv MANGLE(MultiTexCoord2sv) +#define glMultiTexCoord3dARB MANGLE(MultiTexCoord3dARB) +#define glMultiTexCoord3d MANGLE(MultiTexCoord3d) +#define glMultiTexCoord3dvARB MANGLE(MultiTexCoord3dvARB) +#define glMultiTexCoord3dv MANGLE(MultiTexCoord3dv) +#define glMultiTexCoord3fARB MANGLE(MultiTexCoord3fARB) +#define glMultiTexCoord3f MANGLE(MultiTexCoord3f) +#define glMultiTexCoord3fvARB MANGLE(MultiTexCoord3fvARB) +#define glMultiTexCoord3fv MANGLE(MultiTexCoord3fv) +#define glMultiTexCoord3hNV MANGLE(MultiTexCoord3hNV) +#define glMultiTexCoord3hvNV MANGLE(MultiTexCoord3hvNV) +#define glMultiTexCoord3iARB MANGLE(MultiTexCoord3iARB) +#define glMultiTexCoord3i MANGLE(MultiTexCoord3i) +#define glMultiTexCoord3ivARB MANGLE(MultiTexCoord3ivARB) +#define glMultiTexCoord3iv MANGLE(MultiTexCoord3iv) +#define glMultiTexCoord3sARB MANGLE(MultiTexCoord3sARB) +#define glMultiTexCoord3s MANGLE(MultiTexCoord3s) +#define glMultiTexCoord3svARB MANGLE(MultiTexCoord3svARB) +#define glMultiTexCoord3sv MANGLE(MultiTexCoord3sv) +#define glMultiTexCoord4dARB MANGLE(MultiTexCoord4dARB) +#define glMultiTexCoord4d MANGLE(MultiTexCoord4d) +#define glMultiTexCoord4dvARB MANGLE(MultiTexCoord4dvARB) +#define glMultiTexCoord4dv MANGLE(MultiTexCoord4dv) +#define glMultiTexCoord4fARB MANGLE(MultiTexCoord4fARB) +#define glMultiTexCoord4f MANGLE(MultiTexCoord4f) +#define glMultiTexCoord4fvARB MANGLE(MultiTexCoord4fvARB) +#define glMultiTexCoord4fv MANGLE(MultiTexCoord4fv) +#define glMultiTexCoord4hNV MANGLE(MultiTexCoord4hNV) +#define glMultiTexCoord4hvNV MANGLE(MultiTexCoord4hvNV) +#define glMultiTexCoord4iARB MANGLE(MultiTexCoord4iARB) +#define glMultiTexCoord4i MANGLE(MultiTexCoord4i) +#define glMultiTexCoord4ivARB MANGLE(MultiTexCoord4ivARB) +#define glMultiTexCoord4iv MANGLE(MultiTexCoord4iv) +#define glMultiTexCoord4sARB MANGLE(MultiTexCoord4sARB) +#define glMultiTexCoord4s MANGLE(MultiTexCoord4s) +#define glMultiTexCoord4svARB MANGLE(MultiTexCoord4svARB) +#define glMultiTexCoord4sv MANGLE(MultiTexCoord4sv) +#define glMultMatrixd MANGLE(MultMatrixd) +#define glMultMatrixf MANGLE(MultMatrixf) +#define glMultTransposeMatrixdARB MANGLE(MultTransposeMatrixdARB) +#define glMultTransposeMatrixd MANGLE(MultTransposeMatrixd) +#define glMultTransposeMatrixfARB MANGLE(MultTransposeMatrixfARB) +#define glMultTransposeMatrixf MANGLE(MultTransposeMatrixf) +#define glNewList MANGLE(NewList) +#define glNewObjectBufferATI MANGLE(NewObjectBufferATI) +#define glNewTraceMESA MANGLE(NewTraceMESA) +#define glNormal3b MANGLE(Normal3b) +#define glNormal3bv MANGLE(Normal3bv) +#define glNormal3d MANGLE(Normal3d) +#define glNormal3dv MANGLE(Normal3dv) +#define glNormal3f MANGLE(Normal3f) +#define glNormal3fVertex3fSUN MANGLE(Normal3fVertex3fSUN) +#define glNormal3fVertex3fvSUN MANGLE(Normal3fVertex3fvSUN) +#define glNormal3fv MANGLE(Normal3fv) +#define glNormal3hNV MANGLE(Normal3hNV) +#define glNormal3hvNV MANGLE(Normal3hvNV) +#define glNormal3i MANGLE(Normal3i) +#define glNormal3iv MANGLE(Normal3iv) +#define glNormal3s MANGLE(Normal3s) +#define glNormal3sv MANGLE(Normal3sv) +#define glNormalPointerEXT MANGLE(NormalPointerEXT) +#define glNormalPointerListIBM MANGLE(NormalPointerListIBM) +#define glNormalPointer MANGLE(NormalPointer) +#define glNormalPointervINTEL MANGLE(NormalPointervINTEL) +#define glNormalStream3bATI MANGLE(NormalStream3bATI) +#define glNormalStream3bvATI MANGLE(NormalStream3bvATI) +#define glNormalStream3dATI MANGLE(NormalStream3dATI) +#define glNormalStream3dvATI MANGLE(NormalStream3dvATI) +#define glNormalStream3fATI MANGLE(NormalStream3fATI) +#define glNormalStream3fvATI MANGLE(NormalStream3fvATI) +#define glNormalStream3iATI MANGLE(NormalStream3iATI) +#define glNormalStream3ivATI MANGLE(NormalStream3ivATI) +#define glNormalStream3sATI MANGLE(NormalStream3sATI) +#define glNormalStream3svATI MANGLE(NormalStream3svATI) +#define glOrtho MANGLE(Ortho) +#define glPassTexCoordATI MANGLE(PassTexCoordATI) +#define glPassThrough MANGLE(PassThrough) +#define glPixelDataRangeNV MANGLE(PixelDataRangeNV) +#define glPixelMapfv MANGLE(PixelMapfv) +#define glPixelMapuiv MANGLE(PixelMapuiv) +#define glPixelMapusv MANGLE(PixelMapusv) +#define glPixelStoref MANGLE(PixelStoref) +#define glPixelStorei MANGLE(PixelStorei) +#define glPixelTexGenParameterfSGIS MANGLE(PixelTexGenParameterfSGIS) +#define glPixelTexGenParameterfvSGIS MANGLE(PixelTexGenParameterfvSGIS) +#define glPixelTexGenParameteriSGIS MANGLE(PixelTexGenParameteriSGIS) +#define glPixelTexGenParameterivSGIS MANGLE(PixelTexGenParameterivSGIS) +#define glPixelTexGenSGIX MANGLE(PixelTexGenSGIX) +#define glPixelTransferf MANGLE(PixelTransferf) +#define glPixelTransferi MANGLE(PixelTransferi) +#define glPixelTransformParameterfEXT MANGLE(PixelTransformParameterfEXT) +#define glPixelTransformParameterfvEXT MANGLE(PixelTransformParameterfvEXT) +#define glPixelTransformParameteriEXT MANGLE(PixelTransformParameteriEXT) +#define glPixelTransformParameterivEXT MANGLE(PixelTransformParameterivEXT) +#define glPixelZoom MANGLE(PixelZoom) +#define glPNTrianglesfATI MANGLE(PNTrianglesfATI) +#define glPNTrianglesiATI MANGLE(PNTrianglesiATI) +#define glPointParameterfARB MANGLE(PointParameterfARB) +#define glPointParameterfEXT MANGLE(PointParameterfEXT) +#define glPointParameterf MANGLE(PointParameterf) +#define glPointParameterfSGIS MANGLE(PointParameterfSGIS) +#define glPointParameterfvARB MANGLE(PointParameterfvARB) +#define glPointParameterfvEXT MANGLE(PointParameterfvEXT) +#define glPointParameterfv MANGLE(PointParameterfv) +#define glPointParameterfvSGIS MANGLE(PointParameterfvSGIS) +#define glPointParameteri MANGLE(PointParameteri) +#define glPointParameteriNV MANGLE(PointParameteriNV) +#define glPointParameteriv MANGLE(PointParameteriv) +#define glPointParameterivNV MANGLE(PointParameterivNV) +#define glPointSize MANGLE(PointSize) +#define glPollAsyncSGIX MANGLE(PollAsyncSGIX) +#define glPollInstrumentsSGIX MANGLE(PollInstrumentsSGIX) +#define glPolygonMode MANGLE(PolygonMode) +#define glPolygonOffsetEXT MANGLE(PolygonOffsetEXT) +#define glPolygonOffset MANGLE(PolygonOffset) +#define glPolygonStipple MANGLE(PolygonStipple) +#define glPopAttrib MANGLE(PopAttrib) +#define glPopClientAttrib MANGLE(PopClientAttrib) +#define glPopMatrix MANGLE(PopMatrix) +#define glPopName MANGLE(PopName) +#define glPrimitiveRestartIndexNV MANGLE(PrimitiveRestartIndexNV) +#define glPrimitiveRestartNV MANGLE(PrimitiveRestartNV) +#define glPrioritizeTexturesEXT MANGLE(PrioritizeTexturesEXT) +#define glPrioritizeTextures MANGLE(PrioritizeTextures) +#define glProgramCallbackMESA MANGLE(ProgramCallbackMESA) +#define glProgramEnvParameter4dARB MANGLE(ProgramEnvParameter4dARB) +#define glProgramEnvParameter4dvARB MANGLE(ProgramEnvParameter4dvARB) +#define glProgramEnvParameter4fARB MANGLE(ProgramEnvParameter4fARB) +#define glProgramEnvParameter4fvARB MANGLE(ProgramEnvParameter4fvARB) +#define glProgramLocalParameter4dARB MANGLE(ProgramLocalParameter4dARB) +#define glProgramLocalParameter4dvARB MANGLE(ProgramLocalParameter4dvARB) +#define glProgramLocalParameter4fARB MANGLE(ProgramLocalParameter4fARB) +#define glProgramLocalParameter4fvARB MANGLE(ProgramLocalParameter4fvARB) +#define glProgramNamedParameter4dNV MANGLE(ProgramNamedParameter4dNV) +#define glProgramNamedParameter4dvNV MANGLE(ProgramNamedParameter4dvNV) +#define glProgramNamedParameter4fNV MANGLE(ProgramNamedParameter4fNV) +#define glProgramNamedParameter4fvNV MANGLE(ProgramNamedParameter4fvNV) +#define glProgramParameter4dNV MANGLE(ProgramParameter4dNV) +#define glProgramParameter4dvNV MANGLE(ProgramParameter4dvNV) +#define glProgramParameter4fNV MANGLE(ProgramParameter4fNV) +#define glProgramParameter4fvNV MANGLE(ProgramParameter4fvNV) +#define glProgramParameters4dvNV MANGLE(ProgramParameters4dvNV) +#define glProgramParameters4fvNV MANGLE(ProgramParameters4fvNV) +#define glProgramStringARB MANGLE(ProgramStringARB) +#define glPushAttrib MANGLE(PushAttrib) +#define glPushClientAttrib MANGLE(PushClientAttrib) +#define glPushMatrix MANGLE(PushMatrix) +#define glPushName MANGLE(PushName) +#define glRasterPos2d MANGLE(RasterPos2d) +#define glRasterPos2dv MANGLE(RasterPos2dv) +#define glRasterPos2f MANGLE(RasterPos2f) +#define glRasterPos2fv MANGLE(RasterPos2fv) +#define glRasterPos2i MANGLE(RasterPos2i) +#define glRasterPos2iv MANGLE(RasterPos2iv) +#define glRasterPos2s MANGLE(RasterPos2s) +#define glRasterPos2sv MANGLE(RasterPos2sv) +#define glRasterPos3d MANGLE(RasterPos3d) +#define glRasterPos3dv MANGLE(RasterPos3dv) +#define glRasterPos3f MANGLE(RasterPos3f) +#define glRasterPos3fv MANGLE(RasterPos3fv) +#define glRasterPos3i MANGLE(RasterPos3i) +#define glRasterPos3iv MANGLE(RasterPos3iv) +#define glRasterPos3s MANGLE(RasterPos3s) +#define glRasterPos3sv MANGLE(RasterPos3sv) +#define glRasterPos4d MANGLE(RasterPos4d) +#define glRasterPos4dv MANGLE(RasterPos4dv) +#define glRasterPos4f MANGLE(RasterPos4f) +#define glRasterPos4fv MANGLE(RasterPos4fv) +#define glRasterPos4i MANGLE(RasterPos4i) +#define glRasterPos4iv MANGLE(RasterPos4iv) +#define glRasterPos4s MANGLE(RasterPos4s) +#define glRasterPos4sv MANGLE(RasterPos4sv) +#define glReadBuffer MANGLE(ReadBuffer) +#define glReadInstrumentsSGIX MANGLE(ReadInstrumentsSGIX) +#define glReadPixels MANGLE(ReadPixels) +#define glRectd MANGLE(Rectd) +#define glRectdv MANGLE(Rectdv) +#define glRectf MANGLE(Rectf) +#define glRectfv MANGLE(Rectfv) +#define glRecti MANGLE(Recti) +#define glRectiv MANGLE(Rectiv) +#define glRects MANGLE(Rects) +#define glRectsv MANGLE(Rectsv) +#define glReferencePlaneSGIX MANGLE(ReferencePlaneSGIX) +#define glRenderbufferStorageEXT MANGLE(RenderbufferStorageEXT) +#define glRenderMode MANGLE(RenderMode) +#define glReplacementCodePointerSUN MANGLE(ReplacementCodePointerSUN) +#define glReplacementCodeubSUN MANGLE(ReplacementCodeubSUN) +#define glReplacementCodeubvSUN MANGLE(ReplacementCodeubvSUN) +#define glReplacementCodeuiColor3fVertex3fSUN MANGLE(ReplacementCodeuiColor3fVertex3fSUN) +#define glReplacementCodeuiColor3fVertex3fvSUN MANGLE(ReplacementCodeuiColor3fVertex3fvSUN) +#define glReplacementCodeuiColor4fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiColor4fNormal3fVertex3fSUN) +#define glReplacementCodeuiColor4fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiColor4fNormal3fVertex3fvSUN) +#define glReplacementCodeuiColor4ubVertex3fSUN MANGLE(ReplacementCodeuiColor4ubVertex3fSUN) +#define glReplacementCodeuiColor4ubVertex3fvSUN MANGLE(ReplacementCodeuiColor4ubVertex3fvSUN) +#define glReplacementCodeuiNormal3fVertex3fSUN MANGLE(ReplacementCodeuiNormal3fVertex3fSUN) +#define glReplacementCodeuiNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiNormal3fVertex3fvSUN) +#define glReplacementCodeuiSUN MANGLE(ReplacementCodeuiSUN) +#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fVertex3fvSUN) +#define glReplacementCodeuiVertex3fSUN MANGLE(ReplacementCodeuiVertex3fSUN) +#define glReplacementCodeuiVertex3fvSUN MANGLE(ReplacementCodeuiVertex3fvSUN) +#define glReplacementCodeuivSUN MANGLE(ReplacementCodeuivSUN) +#define glReplacementCodeusSUN MANGLE(ReplacementCodeusSUN) +#define glReplacementCodeusvSUN MANGLE(ReplacementCodeusvSUN) +#define glRequestResidentProgramsNV MANGLE(RequestResidentProgramsNV) +#define glResetHistogramEXT MANGLE(ResetHistogramEXT) +#define glResetHistogram MANGLE(ResetHistogram) +#define glResetMinmaxEXT MANGLE(ResetMinmaxEXT) +#define glResetMinmax MANGLE(ResetMinmax) +#define glResizeBuffersMESA MANGLE(ResizeBuffersMESA) +#define glRotated MANGLE(Rotated) +#define glRotatef MANGLE(Rotatef) +#define glSampleCoverageARB MANGLE(SampleCoverageARB) +#define glSampleCoverage MANGLE(SampleCoverage) +#define glSampleMapATI MANGLE(SampleMapATI) +#define glSampleMaskEXT MANGLE(SampleMaskEXT) +#define glSampleMaskSGIS MANGLE(SampleMaskSGIS) +#define glSamplePatternEXT MANGLE(SamplePatternEXT) +#define glSamplePatternSGIS MANGLE(SamplePatternSGIS) +#define glScaled MANGLE(Scaled) +#define glScalef MANGLE(Scalef) +#define glScissor MANGLE(Scissor) +#define glSecondaryColor3bEXT MANGLE(SecondaryColor3bEXT) +#define glSecondaryColor3b MANGLE(SecondaryColor3b) +#define glSecondaryColor3bvEXT MANGLE(SecondaryColor3bvEXT) +#define glSecondaryColor3bv MANGLE(SecondaryColor3bv) +#define glSecondaryColor3dEXT MANGLE(SecondaryColor3dEXT) +#define glSecondaryColor3d MANGLE(SecondaryColor3d) +#define glSecondaryColor3dvEXT MANGLE(SecondaryColor3dvEXT) +#define glSecondaryColor3dv MANGLE(SecondaryColor3dv) +#define glSecondaryColor3fEXT MANGLE(SecondaryColor3fEXT) +#define glSecondaryColor3f MANGLE(SecondaryColor3f) +#define glSecondaryColor3fvEXT MANGLE(SecondaryColor3fvEXT) +#define glSecondaryColor3fv MANGLE(SecondaryColor3fv) +#define glSecondaryColor3hNV MANGLE(SecondaryColor3hNV) +#define glSecondaryColor3hvNV MANGLE(SecondaryColor3hvNV) +#define glSecondaryColor3iEXT MANGLE(SecondaryColor3iEXT) +#define glSecondaryColor3i MANGLE(SecondaryColor3i) +#define glSecondaryColor3ivEXT MANGLE(SecondaryColor3ivEXT) +#define glSecondaryColor3iv MANGLE(SecondaryColor3iv) +#define glSecondaryColor3sEXT MANGLE(SecondaryColor3sEXT) +#define glSecondaryColor3s MANGLE(SecondaryColor3s) +#define glSecondaryColor3svEXT MANGLE(SecondaryColor3svEXT) +#define glSecondaryColor3sv MANGLE(SecondaryColor3sv) +#define glSecondaryColor3ubEXT MANGLE(SecondaryColor3ubEXT) +#define glSecondaryColor3ub MANGLE(SecondaryColor3ub) +#define glSecondaryColor3ubvEXT MANGLE(SecondaryColor3ubvEXT) +#define glSecondaryColor3ubv MANGLE(SecondaryColor3ubv) +#define glSecondaryColor3uiEXT MANGLE(SecondaryColor3uiEXT) +#define glSecondaryColor3ui MANGLE(SecondaryColor3ui) +#define glSecondaryColor3uivEXT MANGLE(SecondaryColor3uivEXT) +#define glSecondaryColor3uiv MANGLE(SecondaryColor3uiv) +#define glSecondaryColor3usEXT MANGLE(SecondaryColor3usEXT) +#define glSecondaryColor3us MANGLE(SecondaryColor3us) +#define glSecondaryColor3usvEXT MANGLE(SecondaryColor3usvEXT) +#define glSecondaryColor3usv MANGLE(SecondaryColor3usv) +#define glSecondaryColorPointerEXT MANGLE(SecondaryColorPointerEXT) +#define glSecondaryColorPointerListIBM MANGLE(SecondaryColorPointerListIBM) +#define glSecondaryColorPointer MANGLE(SecondaryColorPointer) +#define glSelectBuffer MANGLE(SelectBuffer) +#define glSeparableFilter2DEXT MANGLE(SeparableFilter2DEXT) +#define glSeparableFilter2D MANGLE(SeparableFilter2D) +#define glSetFenceAPPLE MANGLE(SetFenceAPPLE) +#define glSetFenceNV MANGLE(SetFenceNV) +#define glSetFragmentShaderConstantATI MANGLE(SetFragmentShaderConstantATI) +#define glSetInvariantEXT MANGLE(SetInvariantEXT) +#define glSetLocalConstantEXT MANGLE(SetLocalConstantEXT) +#define glShadeModel MANGLE(ShadeModel) +#define glShaderOp1EXT MANGLE(ShaderOp1EXT) +#define glShaderOp2EXT MANGLE(ShaderOp2EXT) +#define glShaderOp3EXT MANGLE(ShaderOp3EXT) +#define glShaderSourceARB MANGLE(ShaderSourceARB) +#define glShaderSource MANGLE(ShaderSource) +#define glSharpenTexFuncSGIS MANGLE(SharpenTexFuncSGIS) +#define glSpriteParameterfSGIX MANGLE(SpriteParameterfSGIX) +#define glSpriteParameterfvSGIX MANGLE(SpriteParameterfvSGIX) +#define glSpriteParameteriSGIX MANGLE(SpriteParameteriSGIX) +#define glSpriteParameterivSGIX MANGLE(SpriteParameterivSGIX) +#define glStartInstrumentsSGIX MANGLE(StartInstrumentsSGIX) +#define glStencilFunc MANGLE(StencilFunc) +#define glStencilFuncSeparateATI MANGLE(StencilFuncSeparateATI) +#define glStencilFuncSeparate MANGLE(StencilFuncSeparate) +#define glStencilMask MANGLE(StencilMask) +#define glStencilMaskSeparate MANGLE(StencilMaskSeparate) +#define glStencilOp MANGLE(StencilOp) +#define glStencilOpSeparateATI MANGLE(StencilOpSeparateATI) +#define glStencilOpSeparate MANGLE(StencilOpSeparate) +#define glStopInstrumentsSGIX MANGLE(StopInstrumentsSGIX) +#define glStringMarkerGREMEDY MANGLE(StringMarkerGREMEDY) +#define glSwizzleEXT MANGLE(SwizzleEXT) +#define glTagSampleBufferSGIX MANGLE(TagSampleBufferSGIX) +#define glTangent3bEXT MANGLE(Tangent3bEXT) +#define glTangent3bvEXT MANGLE(Tangent3bvEXT) +#define glTangent3dEXT MANGLE(Tangent3dEXT) +#define glTangent3dvEXT MANGLE(Tangent3dvEXT) +#define glTangent3fEXT MANGLE(Tangent3fEXT) +#define glTangent3fvEXT MANGLE(Tangent3fvEXT) +#define glTangent3iEXT MANGLE(Tangent3iEXT) +#define glTangent3ivEXT MANGLE(Tangent3ivEXT) +#define glTangent3sEXT MANGLE(Tangent3sEXT) +#define glTangent3svEXT MANGLE(Tangent3svEXT) +#define glTangentPointerEXT MANGLE(TangentPointerEXT) +#define glTbufferMask3DFX MANGLE(TbufferMask3DFX) +#define glTestFenceAPPLE MANGLE(TestFenceAPPLE) +#define glTestFenceNV MANGLE(TestFenceNV) +#define glTestObjectAPPLE MANGLE(TestObjectAPPLE) +#define glTexBumpParameterfvATI MANGLE(TexBumpParameterfvATI) +#define glTexBumpParameterivATI MANGLE(TexBumpParameterivATI) +#define glTexCoord1d MANGLE(TexCoord1d) +#define glTexCoord1dv MANGLE(TexCoord1dv) +#define glTexCoord1f MANGLE(TexCoord1f) +#define glTexCoord1fv MANGLE(TexCoord1fv) +#define glTexCoord1hNV MANGLE(TexCoord1hNV) +#define glTexCoord1hvNV MANGLE(TexCoord1hvNV) +#define glTexCoord1i MANGLE(TexCoord1i) +#define glTexCoord1iv MANGLE(TexCoord1iv) +#define glTexCoord1s MANGLE(TexCoord1s) +#define glTexCoord1sv MANGLE(TexCoord1sv) +#define glTexCoord2d MANGLE(TexCoord2d) +#define glTexCoord2dv MANGLE(TexCoord2dv) +#define glTexCoord2fColor3fVertex3fSUN MANGLE(TexCoord2fColor3fVertex3fSUN) +#define glTexCoord2fColor3fVertex3fvSUN MANGLE(TexCoord2fColor3fVertex3fvSUN) +#define glTexCoord2fColor4fNormal3fVertex3fSUN MANGLE(TexCoord2fColor4fNormal3fVertex3fSUN) +#define glTexCoord2fColor4fNormal3fVertex3fvSUN MANGLE(TexCoord2fColor4fNormal3fVertex3fvSUN) +#define glTexCoord2fColor4ubVertex3fSUN MANGLE(TexCoord2fColor4ubVertex3fSUN) +#define glTexCoord2fColor4ubVertex3fvSUN MANGLE(TexCoord2fColor4ubVertex3fvSUN) +#define glTexCoord2f MANGLE(TexCoord2f) +#define glTexCoord2fNormal3fVertex3fSUN MANGLE(TexCoord2fNormal3fVertex3fSUN) +#define glTexCoord2fNormal3fVertex3fvSUN MANGLE(TexCoord2fNormal3fVertex3fvSUN) +#define glTexCoord2fVertex3fSUN MANGLE(TexCoord2fVertex3fSUN) +#define glTexCoord2fVertex3fvSUN MANGLE(TexCoord2fVertex3fvSUN) +#define glTexCoord2fv MANGLE(TexCoord2fv) +#define glTexCoord2hNV MANGLE(TexCoord2hNV) +#define glTexCoord2hvNV MANGLE(TexCoord2hvNV) +#define glTexCoord2i MANGLE(TexCoord2i) +#define glTexCoord2iv MANGLE(TexCoord2iv) +#define glTexCoord2s MANGLE(TexCoord2s) +#define glTexCoord2sv MANGLE(TexCoord2sv) +#define glTexCoord3d MANGLE(TexCoord3d) +#define glTexCoord3dv MANGLE(TexCoord3dv) +#define glTexCoord3f MANGLE(TexCoord3f) +#define glTexCoord3fv MANGLE(TexCoord3fv) +#define glTexCoord3hNV MANGLE(TexCoord3hNV) +#define glTexCoord3hvNV MANGLE(TexCoord3hvNV) +#define glTexCoord3i MANGLE(TexCoord3i) +#define glTexCoord3iv MANGLE(TexCoord3iv) +#define glTexCoord3s MANGLE(TexCoord3s) +#define glTexCoord3sv MANGLE(TexCoord3sv) +#define glTexCoord4d MANGLE(TexCoord4d) +#define glTexCoord4dv MANGLE(TexCoord4dv) +#define glTexCoord4fColor4fNormal3fVertex4fSUN MANGLE(TexCoord4fColor4fNormal3fVertex4fSUN) +#define glTexCoord4fColor4fNormal3fVertex4fvSUN MANGLE(TexCoord4fColor4fNormal3fVertex4fvSUN) +#define glTexCoord4f MANGLE(TexCoord4f) +#define glTexCoord4fVertex4fSUN MANGLE(TexCoord4fVertex4fSUN) +#define glTexCoord4fVertex4fvSUN MANGLE(TexCoord4fVertex4fvSUN) +#define glTexCoord4fv MANGLE(TexCoord4fv) +#define glTexCoord4hNV MANGLE(TexCoord4hNV) +#define glTexCoord4hvNV MANGLE(TexCoord4hvNV) +#define glTexCoord4i MANGLE(TexCoord4i) +#define glTexCoord4iv MANGLE(TexCoord4iv) +#define glTexCoord4s MANGLE(TexCoord4s) +#define glTexCoord4sv MANGLE(TexCoord4sv) +#define glTexCoordPointerEXT MANGLE(TexCoordPointerEXT) +#define glTexCoordPointerListIBM MANGLE(TexCoordPointerListIBM) +#define glTexCoordPointer MANGLE(TexCoordPointer) +#define glTexCoordPointervINTEL MANGLE(TexCoordPointervINTEL) +#define glTexEnvf MANGLE(TexEnvf) +#define glTexEnvfv MANGLE(TexEnvfv) +#define glTexEnvi MANGLE(TexEnvi) +#define glTexEnviv MANGLE(TexEnviv) +#define glTexFilterFuncSGIS MANGLE(TexFilterFuncSGIS) +#define glTexGend MANGLE(TexGend) +#define glTexGendv MANGLE(TexGendv) +#define glTexGenf MANGLE(TexGenf) +#define glTexGenfv MANGLE(TexGenfv) +#define glTexGeni MANGLE(TexGeni) +#define glTexGeniv MANGLE(TexGeniv) +#define glTexImage1D MANGLE(TexImage1D) +#define glTexImage2D MANGLE(TexImage2D) +#define glTexImage3DEXT MANGLE(TexImage3DEXT) +#define glTexImage3D MANGLE(TexImage3D) +#define glTexImage4DSGIS MANGLE(TexImage4DSGIS) +#define glTexParameterf MANGLE(TexParameterf) +#define glTexParameterfv MANGLE(TexParameterfv) +#define glTexParameteri MANGLE(TexParameteri) +#define glTexParameteriv MANGLE(TexParameteriv) +#define glTexSubImage1DEXT MANGLE(TexSubImage1DEXT) +#define glTexSubImage1D MANGLE(TexSubImage1D) +#define glTexSubImage2DEXT MANGLE(TexSubImage2DEXT) +#define glTexSubImage2D MANGLE(TexSubImage2D) +#define glTexSubImage3DEXT MANGLE(TexSubImage3DEXT) +#define glTexSubImage3D MANGLE(TexSubImage3D) +#define glTexSubImage4DSGIS MANGLE(TexSubImage4DSGIS) +#define glTextureColorMaskSGIS MANGLE(TextureColorMaskSGIS) +#define glTextureLightEXT MANGLE(TextureLightEXT) +#define glTextureMaterialEXT MANGLE(TextureMaterialEXT) +#define glTextureNormalEXT MANGLE(TextureNormalEXT) +#define glTraceAssertAttribMESA MANGLE(TraceAssertAttribMESA) +#define glTraceCommentMESA MANGLE(TraceCommentMESA) +#define glTraceListMESA MANGLE(TraceListMESA) +#define glTracePointerMESA MANGLE(TracePointerMESA) +#define glTracePointerRangeMESA MANGLE(TracePointerRangeMESA) +#define glTraceTextureMESA MANGLE(TraceTextureMESA) +#define glTrackMatrixNV MANGLE(TrackMatrixNV) +#define glTranslated MANGLE(Translated) +#define glTranslatef MANGLE(Translatef) +#define glUniform1fARB MANGLE(Uniform1fARB) +#define glUniform1f MANGLE(Uniform1f) +#define glUniform1fvARB MANGLE(Uniform1fvARB) +#define glUniform1fv MANGLE(Uniform1fv) +#define glUniform1iARB MANGLE(Uniform1iARB) +#define glUniform1i MANGLE(Uniform1i) +#define glUniform1ivARB MANGLE(Uniform1ivARB) +#define glUniform1iv MANGLE(Uniform1iv) +#define glUniform2fARB MANGLE(Uniform2fARB) +#define glUniform2f MANGLE(Uniform2f) +#define glUniform2fvARB MANGLE(Uniform2fvARB) +#define glUniform2fv MANGLE(Uniform2fv) +#define glUniform2iARB MANGLE(Uniform2iARB) +#define glUniform2i MANGLE(Uniform2i) +#define glUniform2ivARB MANGLE(Uniform2ivARB) +#define glUniform2iv MANGLE(Uniform2iv) +#define glUniform3fARB MANGLE(Uniform3fARB) +#define glUniform3f MANGLE(Uniform3f) +#define glUniform3fvARB MANGLE(Uniform3fvARB) +#define glUniform3fv MANGLE(Uniform3fv) +#define glUniform3iARB MANGLE(Uniform3iARB) +#define glUniform3i MANGLE(Uniform3i) +#define glUniform3ivARB MANGLE(Uniform3ivARB) +#define glUniform3iv MANGLE(Uniform3iv) +#define glUniform4fARB MANGLE(Uniform4fARB) +#define glUniform4f MANGLE(Uniform4f) +#define glUniform4fvARB MANGLE(Uniform4fvARB) +#define glUniform4fv MANGLE(Uniform4fv) +#define glUniform4iARB MANGLE(Uniform4iARB) +#define glUniform4i MANGLE(Uniform4i) +#define glUniform4ivARB MANGLE(Uniform4ivARB) +#define glUniform4iv MANGLE(Uniform4iv) +#define glUniformMatrix2fvARB MANGLE(UniformMatrix2fvARB) +#define glUniformMatrix2fv MANGLE(UniformMatrix2fv) +#define glUniformMatrix3fvARB MANGLE(UniformMatrix3fvARB) +#define glUniformMatrix3fv MANGLE(UniformMatrix3fv) +#define glUniformMatrix4fvARB MANGLE(UniformMatrix4fvARB) +#define glUniformMatrix4fv MANGLE(UniformMatrix4fv) +#define glUnlockArraysEXT MANGLE(UnlockArraysEXT) +#define glUnmapBufferARB MANGLE(UnmapBufferARB) +#define glUnmapBuffer MANGLE(UnmapBuffer) +#define glUnmapObjectBufferATI MANGLE(UnmapObjectBufferATI) +#define glUpdateObjectBufferATI MANGLE(UpdateObjectBufferATI) +#define glUseProgram MANGLE(UseProgram) +#define glUseProgramObjectARB MANGLE(UseProgramObjectARB) +#define glValidateProgramARB MANGLE(ValidateProgramARB) +#define glValidateProgram MANGLE(ValidateProgram) +#define glVariantArrayObjectATI MANGLE(VariantArrayObjectATI) +#define glVariantbvEXT MANGLE(VariantbvEXT) +#define glVariantdvEXT MANGLE(VariantdvEXT) +#define glVariantfvEXT MANGLE(VariantfvEXT) +#define glVariantivEXT MANGLE(VariantivEXT) +#define glVariantPointerEXT MANGLE(VariantPointerEXT) +#define glVariantsvEXT MANGLE(VariantsvEXT) +#define glVariantubvEXT MANGLE(VariantubvEXT) +#define glVariantuivEXT MANGLE(VariantuivEXT) +#define glVariantusvEXT MANGLE(VariantusvEXT) +#define glVertex2d MANGLE(Vertex2d) +#define glVertex2dv MANGLE(Vertex2dv) +#define glVertex2f MANGLE(Vertex2f) +#define glVertex2fv MANGLE(Vertex2fv) +#define glVertex2hNV MANGLE(Vertex2hNV) +#define glVertex2hvNV MANGLE(Vertex2hvNV) +#define glVertex2i MANGLE(Vertex2i) +#define glVertex2iv MANGLE(Vertex2iv) +#define glVertex2s MANGLE(Vertex2s) +#define glVertex2sv MANGLE(Vertex2sv) +#define glVertex3d MANGLE(Vertex3d) +#define glVertex3dv MANGLE(Vertex3dv) +#define glVertex3f MANGLE(Vertex3f) +#define glVertex3fv MANGLE(Vertex3fv) +#define glVertex3hNV MANGLE(Vertex3hNV) +#define glVertex3hvNV MANGLE(Vertex3hvNV) +#define glVertex3i MANGLE(Vertex3i) +#define glVertex3iv MANGLE(Vertex3iv) +#define glVertex3s MANGLE(Vertex3s) +#define glVertex3sv MANGLE(Vertex3sv) +#define glVertex4d MANGLE(Vertex4d) +#define glVertex4dv MANGLE(Vertex4dv) +#define glVertex4f MANGLE(Vertex4f) +#define glVertex4fv MANGLE(Vertex4fv) +#define glVertex4hNV MANGLE(Vertex4hNV) +#define glVertex4hvNV MANGLE(Vertex4hvNV) +#define glVertex4i MANGLE(Vertex4i) +#define glVertex4iv MANGLE(Vertex4iv) +#define glVertex4s MANGLE(Vertex4s) +#define glVertex4sv MANGLE(Vertex4sv) +#define glVertexArrayParameteriAPPLE MANGLE(VertexArrayParameteriAPPLE) +#define glVertexArrayRangeAPPLE MANGLE(VertexArrayRangeAPPLE) +#define glVertexArrayRangeNV MANGLE(VertexArrayRangeNV) +#define glVertexAttrib1dARB MANGLE(VertexAttrib1dARB) +#define glVertexAttrib1d MANGLE(VertexAttrib1d) +#define glVertexAttrib1dNV MANGLE(VertexAttrib1dNV) +#define glVertexAttrib1dvARB MANGLE(VertexAttrib1dvARB) +#define glVertexAttrib1dv MANGLE(VertexAttrib1dv) +#define glVertexAttrib1dvNV MANGLE(VertexAttrib1dvNV) +#define glVertexAttrib1fARB MANGLE(VertexAttrib1fARB) +#define glVertexAttrib1f MANGLE(VertexAttrib1f) +#define glVertexAttrib1fNV MANGLE(VertexAttrib1fNV) +#define glVertexAttrib1fvARB MANGLE(VertexAttrib1fvARB) +#define glVertexAttrib1fv MANGLE(VertexAttrib1fv) +#define glVertexAttrib1fvNV MANGLE(VertexAttrib1fvNV) +#define glVertexAttrib1hNV MANGLE(VertexAttrib1hNV) +#define glVertexAttrib1hvNV MANGLE(VertexAttrib1hvNV) +#define glVertexAttrib1sARB MANGLE(VertexAttrib1sARB) +#define glVertexAttrib1s MANGLE(VertexAttrib1s) +#define glVertexAttrib1sNV MANGLE(VertexAttrib1sNV) +#define glVertexAttrib1svARB MANGLE(VertexAttrib1svARB) +#define glVertexAttrib1sv MANGLE(VertexAttrib1sv) +#define glVertexAttrib1svNV MANGLE(VertexAttrib1svNV) +#define glVertexAttrib2dARB MANGLE(VertexAttrib2dARB) +#define glVertexAttrib2d MANGLE(VertexAttrib2d) +#define glVertexAttrib2dNV MANGLE(VertexAttrib2dNV) +#define glVertexAttrib2dvARB MANGLE(VertexAttrib2dvARB) +#define glVertexAttrib2dv MANGLE(VertexAttrib2dv) +#define glVertexAttrib2dvNV MANGLE(VertexAttrib2dvNV) +#define glVertexAttrib2fARB MANGLE(VertexAttrib2fARB) +#define glVertexAttrib2f MANGLE(VertexAttrib2f) +#define glVertexAttrib2fNV MANGLE(VertexAttrib2fNV) +#define glVertexAttrib2fvARB MANGLE(VertexAttrib2fvARB) +#define glVertexAttrib2fv MANGLE(VertexAttrib2fv) +#define glVertexAttrib2fvNV MANGLE(VertexAttrib2fvNV) +#define glVertexAttrib2hNV MANGLE(VertexAttrib2hNV) +#define glVertexAttrib2hvNV MANGLE(VertexAttrib2hvNV) +#define glVertexAttrib2sARB MANGLE(VertexAttrib2sARB) +#define glVertexAttrib2s MANGLE(VertexAttrib2s) +#define glVertexAttrib2sNV MANGLE(VertexAttrib2sNV) +#define glVertexAttrib2svARB MANGLE(VertexAttrib2svARB) +#define glVertexAttrib2sv MANGLE(VertexAttrib2sv) +#define glVertexAttrib2svNV MANGLE(VertexAttrib2svNV) +#define glVertexAttrib3dARB MANGLE(VertexAttrib3dARB) +#define glVertexAttrib3d MANGLE(VertexAttrib3d) +#define glVertexAttrib3dNV MANGLE(VertexAttrib3dNV) +#define glVertexAttrib3dvARB MANGLE(VertexAttrib3dvARB) +#define glVertexAttrib3dv MANGLE(VertexAttrib3dv) +#define glVertexAttrib3dvNV MANGLE(VertexAttrib3dvNV) +#define glVertexAttrib3fARB MANGLE(VertexAttrib3fARB) +#define glVertexAttrib3f MANGLE(VertexAttrib3f) +#define glVertexAttrib3fNV MANGLE(VertexAttrib3fNV) +#define glVertexAttrib3fvARB MANGLE(VertexAttrib3fvARB) +#define glVertexAttrib3fv MANGLE(VertexAttrib3fv) +#define glVertexAttrib3fvNV MANGLE(VertexAttrib3fvNV) +#define glVertexAttrib3hNV MANGLE(VertexAttrib3hNV) +#define glVertexAttrib3hvNV MANGLE(VertexAttrib3hvNV) +#define glVertexAttrib3sARB MANGLE(VertexAttrib3sARB) +#define glVertexAttrib3s MANGLE(VertexAttrib3s) +#define glVertexAttrib3sNV MANGLE(VertexAttrib3sNV) +#define glVertexAttrib3svARB MANGLE(VertexAttrib3svARB) +#define glVertexAttrib3sv MANGLE(VertexAttrib3sv) +#define glVertexAttrib3svNV MANGLE(VertexAttrib3svNV) +#define glVertexAttrib4bvARB MANGLE(VertexAttrib4bvARB) +#define glVertexAttrib4bv MANGLE(VertexAttrib4bv) +#define glVertexAttrib4dARB MANGLE(VertexAttrib4dARB) +#define glVertexAttrib4d MANGLE(VertexAttrib4d) +#define glVertexAttrib4dNV MANGLE(VertexAttrib4dNV) +#define glVertexAttrib4dvARB MANGLE(VertexAttrib4dvARB) +#define glVertexAttrib4dv MANGLE(VertexAttrib4dv) +#define glVertexAttrib4dvNV MANGLE(VertexAttrib4dvNV) +#define glVertexAttrib4fARB MANGLE(VertexAttrib4fARB) +#define glVertexAttrib4f MANGLE(VertexAttrib4f) +#define glVertexAttrib4fNV MANGLE(VertexAttrib4fNV) +#define glVertexAttrib4fvARB MANGLE(VertexAttrib4fvARB) +#define glVertexAttrib4fv MANGLE(VertexAttrib4fv) +#define glVertexAttrib4fvNV MANGLE(VertexAttrib4fvNV) +#define glVertexAttrib4hNV MANGLE(VertexAttrib4hNV) +#define glVertexAttrib4hvNV MANGLE(VertexAttrib4hvNV) +#define glVertexAttrib4ivARB MANGLE(VertexAttrib4ivARB) +#define glVertexAttrib4iv MANGLE(VertexAttrib4iv) +#define glVertexAttrib4NbvARB MANGLE(VertexAttrib4NbvARB) +#define glVertexAttrib4Nbv MANGLE(VertexAttrib4Nbv) +#define glVertexAttrib4NivARB MANGLE(VertexAttrib4NivARB) +#define glVertexAttrib4Niv MANGLE(VertexAttrib4Niv) +#define glVertexAttrib4NsvARB MANGLE(VertexAttrib4NsvARB) +#define glVertexAttrib4Nsv MANGLE(VertexAttrib4Nsv) +#define glVertexAttrib4NubARB MANGLE(VertexAttrib4NubARB) +#define glVertexAttrib4Nub MANGLE(VertexAttrib4Nub) +#define glVertexAttrib4NubvARB MANGLE(VertexAttrib4NubvARB) +#define glVertexAttrib4Nubv MANGLE(VertexAttrib4Nubv) +#define glVertexAttrib4NuivARB MANGLE(VertexAttrib4NuivARB) +#define glVertexAttrib4Nuiv MANGLE(VertexAttrib4Nuiv) +#define glVertexAttrib4NusvARB MANGLE(VertexAttrib4NusvARB) +#define glVertexAttrib4Nusv MANGLE(VertexAttrib4Nusv) +#define glVertexAttrib4sARB MANGLE(VertexAttrib4sARB) +#define glVertexAttrib4s MANGLE(VertexAttrib4s) +#define glVertexAttrib4sNV MANGLE(VertexAttrib4sNV) +#define glVertexAttrib4svARB MANGLE(VertexAttrib4svARB) +#define glVertexAttrib4sv MANGLE(VertexAttrib4sv) +#define glVertexAttrib4svNV MANGLE(VertexAttrib4svNV) +#define glVertexAttrib4ubNV MANGLE(VertexAttrib4ubNV) +#define glVertexAttrib4ubvARB MANGLE(VertexAttrib4ubvARB) +#define glVertexAttrib4ubv MANGLE(VertexAttrib4ubv) +#define glVertexAttrib4ubvNV MANGLE(VertexAttrib4ubvNV) +#define glVertexAttrib4uivARB MANGLE(VertexAttrib4uivARB) +#define glVertexAttrib4uiv MANGLE(VertexAttrib4uiv) +#define glVertexAttrib4usvARB MANGLE(VertexAttrib4usvARB) +#define glVertexAttrib4usv MANGLE(VertexAttrib4usv) +#define glVertexAttribArrayObjectATI MANGLE(VertexAttribArrayObjectATI) +#define glVertexAttribPointerARB MANGLE(VertexAttribPointerARB) +#define glVertexAttribPointer MANGLE(VertexAttribPointer) +#define glVertexAttribPointerNV MANGLE(VertexAttribPointerNV) +#define glVertexAttribs1dvNV MANGLE(VertexAttribs1dvNV) +#define glVertexAttribs1fvNV MANGLE(VertexAttribs1fvNV) +#define glVertexAttribs1hvNV MANGLE(VertexAttribs1hvNV) +#define glVertexAttribs1svNV MANGLE(VertexAttribs1svNV) +#define glVertexAttribs2dvNV MANGLE(VertexAttribs2dvNV) +#define glVertexAttribs2fvNV MANGLE(VertexAttribs2fvNV) +#define glVertexAttribs2hvNV MANGLE(VertexAttribs2hvNV) +#define glVertexAttribs2svNV MANGLE(VertexAttribs2svNV) +#define glVertexAttribs3dvNV MANGLE(VertexAttribs3dvNV) +#define glVertexAttribs3fvNV MANGLE(VertexAttribs3fvNV) +#define glVertexAttribs3hvNV MANGLE(VertexAttribs3hvNV) +#define glVertexAttribs3svNV MANGLE(VertexAttribs3svNV) +#define glVertexAttribs4dvNV MANGLE(VertexAttribs4dvNV) +#define glVertexAttribs4fvNV MANGLE(VertexAttribs4fvNV) +#define glVertexAttribs4hvNV MANGLE(VertexAttribs4hvNV) +#define glVertexAttribs4svNV MANGLE(VertexAttribs4svNV) +#define glVertexAttribs4ubvNV MANGLE(VertexAttribs4ubvNV) +#define glVertexBlendARB MANGLE(VertexBlendARB) +#define glVertexBlendEnvfATI MANGLE(VertexBlendEnvfATI) +#define glVertexBlendEnviATI MANGLE(VertexBlendEnviATI) +#define glVertexPointerEXT MANGLE(VertexPointerEXT) +#define glVertexPointerListIBM MANGLE(VertexPointerListIBM) +#define glVertexPointer MANGLE(VertexPointer) +#define glVertexPointervINTEL MANGLE(VertexPointervINTEL) +#define glVertexStream1dATI MANGLE(VertexStream1dATI) +#define glVertexStream1dvATI MANGLE(VertexStream1dvATI) +#define glVertexStream1fATI MANGLE(VertexStream1fATI) +#define glVertexStream1fvATI MANGLE(VertexStream1fvATI) +#define glVertexStream1iATI MANGLE(VertexStream1iATI) +#define glVertexStream1ivATI MANGLE(VertexStream1ivATI) +#define glVertexStream1sATI MANGLE(VertexStream1sATI) +#define glVertexStream1svATI MANGLE(VertexStream1svATI) +#define glVertexStream2dATI MANGLE(VertexStream2dATI) +#define glVertexStream2dvATI MANGLE(VertexStream2dvATI) +#define glVertexStream2fATI MANGLE(VertexStream2fATI) +#define glVertexStream2fvATI MANGLE(VertexStream2fvATI) +#define glVertexStream2iATI MANGLE(VertexStream2iATI) +#define glVertexStream2ivATI MANGLE(VertexStream2ivATI) +#define glVertexStream2sATI MANGLE(VertexStream2sATI) +#define glVertexStream2svATI MANGLE(VertexStream2svATI) +#define glVertexStream3dATI MANGLE(VertexStream3dATI) +#define glVertexStream3dvATI MANGLE(VertexStream3dvATI) +#define glVertexStream3fATI MANGLE(VertexStream3fATI) +#define glVertexStream3fvATI MANGLE(VertexStream3fvATI) +#define glVertexStream3iATI MANGLE(VertexStream3iATI) +#define glVertexStream3ivATI MANGLE(VertexStream3ivATI) +#define glVertexStream3sATI MANGLE(VertexStream3sATI) +#define glVertexStream3svATI MANGLE(VertexStream3svATI) +#define glVertexStream4dATI MANGLE(VertexStream4dATI) +#define glVertexStream4dvATI MANGLE(VertexStream4dvATI) +#define glVertexStream4fATI MANGLE(VertexStream4fATI) +#define glVertexStream4fvATI MANGLE(VertexStream4fvATI) +#define glVertexStream4iATI MANGLE(VertexStream4iATI) +#define glVertexStream4ivATI MANGLE(VertexStream4ivATI) +#define glVertexStream4sATI MANGLE(VertexStream4sATI) +#define glVertexStream4svATI MANGLE(VertexStream4svATI) +#define glVertexWeightfEXT MANGLE(VertexWeightfEXT) +#define glVertexWeightfvEXT MANGLE(VertexWeightfvEXT) +#define glVertexWeighthNV MANGLE(VertexWeighthNV) +#define glVertexWeighthvNV MANGLE(VertexWeighthvNV) +#define glVertexWeightPointerEXT MANGLE(VertexWeightPointerEXT) +#define glViewport MANGLE(Viewport) +#define glWeightbvARB MANGLE(WeightbvARB) +#define glWeightdvARB MANGLE(WeightdvARB) +#define glWeightfvARB MANGLE(WeightfvARB) +#define glWeightivARB MANGLE(WeightivARB) +#define glWeightPointerARB MANGLE(WeightPointerARB) +#define glWeightsvARB MANGLE(WeightsvARB) +#define glWeightubvARB MANGLE(WeightubvARB) +#define glWeightuivARB MANGLE(WeightuivARB) +#define glWeightusvARB MANGLE(WeightusvARB) +#define glWindowPos2dARB MANGLE(WindowPos2dARB) +#define glWindowPos2d MANGLE(WindowPos2d) +#define glWindowPos2dMESA MANGLE(WindowPos2dMESA) +#define glWindowPos2dvARB MANGLE(WindowPos2dvARB) +#define glWindowPos2dv MANGLE(WindowPos2dv) +#define glWindowPos2dvMESA MANGLE(WindowPos2dvMESA) +#define glWindowPos2fARB MANGLE(WindowPos2fARB) +#define glWindowPos2f MANGLE(WindowPos2f) +#define glWindowPos2fMESA MANGLE(WindowPos2fMESA) +#define glWindowPos2fvARB MANGLE(WindowPos2fvARB) +#define glWindowPos2fv MANGLE(WindowPos2fv) +#define glWindowPos2fvMESA MANGLE(WindowPos2fvMESA) +#define glWindowPos2iARB MANGLE(WindowPos2iARB) +#define glWindowPos2i MANGLE(WindowPos2i) +#define glWindowPos2iMESA MANGLE(WindowPos2iMESA) +#define glWindowPos2ivARB MANGLE(WindowPos2ivARB) +#define glWindowPos2iv MANGLE(WindowPos2iv) +#define glWindowPos2ivMESA MANGLE(WindowPos2ivMESA) +#define glWindowPos2sARB MANGLE(WindowPos2sARB) +#define glWindowPos2s MANGLE(WindowPos2s) +#define glWindowPos2sMESA MANGLE(WindowPos2sMESA) +#define glWindowPos2svARB MANGLE(WindowPos2svARB) +#define glWindowPos2sv MANGLE(WindowPos2sv) +#define glWindowPos2svMESA MANGLE(WindowPos2svMESA) +#define glWindowPos3dARB MANGLE(WindowPos3dARB) +#define glWindowPos3d MANGLE(WindowPos3d) +#define glWindowPos3dMESA MANGLE(WindowPos3dMESA) +#define glWindowPos3dvARB MANGLE(WindowPos3dvARB) +#define glWindowPos3dv MANGLE(WindowPos3dv) +#define glWindowPos3dvMESA MANGLE(WindowPos3dvMESA) +#define glWindowPos3fARB MANGLE(WindowPos3fARB) +#define glWindowPos3f MANGLE(WindowPos3f) +#define glWindowPos3fMESA MANGLE(WindowPos3fMESA) +#define glWindowPos3fvARB MANGLE(WindowPos3fvARB) +#define glWindowPos3fv MANGLE(WindowPos3fv) +#define glWindowPos3fvMESA MANGLE(WindowPos3fvMESA) +#define glWindowPos3iARB MANGLE(WindowPos3iARB) +#define glWindowPos3i MANGLE(WindowPos3i) +#define glWindowPos3iMESA MANGLE(WindowPos3iMESA) +#define glWindowPos3ivARB MANGLE(WindowPos3ivARB) +#define glWindowPos3iv MANGLE(WindowPos3iv) +#define glWindowPos3ivMESA MANGLE(WindowPos3ivMESA) +#define glWindowPos3sARB MANGLE(WindowPos3sARB) +#define glWindowPos3s MANGLE(WindowPos3s) +#define glWindowPos3sMESA MANGLE(WindowPos3sMESA) +#define glWindowPos3svARB MANGLE(WindowPos3svARB) +#define glWindowPos3sv MANGLE(WindowPos3sv) +#define glWindowPos3svMESA MANGLE(WindowPos3svMESA) +#define glWindowPos4dMESA MANGLE(WindowPos4dMESA) +#define glWindowPos4dvMESA MANGLE(WindowPos4dvMESA) +#define glWindowPos4fMESA MANGLE(WindowPos4fMESA) +#define glWindowPos4fvMESA MANGLE(WindowPos4fvMESA) +#define glWindowPos4iMESA MANGLE(WindowPos4iMESA) +#define glWindowPos4ivMESA MANGLE(WindowPos4ivMESA) +#define glWindowPos4sMESA MANGLE(WindowPos4sMESA) +#define glWindowPos4svMESA MANGLE(WindowPos4svMESA) +#define glWriteMaskEXT MANGLE(WriteMaskEXT) + +#endif /* GL_MANGLE_H */ diff --git a/reactos/dll/mesa32/include/GL/glext.h b/reactos/dll/mesa32/include/GL/glext.h new file mode 100644 index 00000000000..7bb8e6e7cc7 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/glext.h @@ -0,0 +1,6495 @@ +#ifndef __glext_h_ +#define __glext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number, required by OpenGL ABI for Linux */ +/* glext.h last updated 2005/06/20 */ +/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ +#define GL_GLEXT_VERSION 29 + +#ifndef GL_VERSION_1_2 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_RESCALE_NORMAL 0x803A +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#endif + +#ifndef GL_ARB_imaging +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_FUNC_ADD 0x8006 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BLEND_EQUATION 0x8009 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#endif + +#ifndef GL_VERSION_1_3 +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_MULTISAMPLE_BIT 0x20000000 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_CLAMP_TO_BORDER 0x812D +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +#endif + +#ifndef GL_VERSION_1_4 +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_COLOR_SUM 0x8458 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#endif + +#ifndef GL_VERSION_1_5 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 +#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE +#define GL_FOG_COORD GL_FOG_COORDINATE +#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE +#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE +#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE +#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER +#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING +#define GL_SRC0_RGB GL_SOURCE0_RGB +#define GL_SRC1_RGB GL_SOURCE1_RGB +#define GL_SRC2_RGB GL_SOURCE2_RGB +#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA +#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA +#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA +#endif + +#ifndef GL_VERSION_2_0 +#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_COORDS 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#endif + +#ifndef GL_ARB_multitexture +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 +#endif + +#ifndef GL_ARB_multisample +#define GL_MULTISAMPLE_ARB 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +#endif + +#ifndef GL_ARB_texture_env_add +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_NORMAL_MAP_ARB 0x8511 +#define GL_REFLECTION_MAP_ARB 0x8512 +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C +#endif + +#ifndef GL_ARB_texture_compression +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#define GL_COMPRESSED_RGB_ARB 0x84ED +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 +#endif + +#ifndef GL_ARB_texture_border_clamp +#define GL_CLAMP_TO_BORDER_ARB 0x812D +#endif + +#ifndef GL_ARB_point_parameters +#define GL_POINT_SIZE_MIN_ARB 0x8126 +#define GL_POINT_SIZE_MAX_ARB 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#define GL_VERTEX_BLEND_ARB 0x86A7 +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#define GL_MODELVIEW0_ARB 0x1700 +#define GL_MODELVIEW1_ARB 0x850A +#define GL_MODELVIEW2_ARB 0x8722 +#define GL_MODELVIEW3_ARB 0x8723 +#define GL_MODELVIEW4_ARB 0x8724 +#define GL_MODELVIEW5_ARB 0x8725 +#define GL_MODELVIEW6_ARB 0x8726 +#define GL_MODELVIEW7_ARB 0x8727 +#define GL_MODELVIEW8_ARB 0x8728 +#define GL_MODELVIEW9_ARB 0x8729 +#define GL_MODELVIEW10_ARB 0x872A +#define GL_MODELVIEW11_ARB 0x872B +#define GL_MODELVIEW12_ARB 0x872C +#define GL_MODELVIEW13_ARB 0x872D +#define GL_MODELVIEW14_ARB 0x872E +#define GL_MODELVIEW15_ARB 0x872F +#define GL_MODELVIEW16_ARB 0x8730 +#define GL_MODELVIEW17_ARB 0x8731 +#define GL_MODELVIEW18_ARB 0x8732 +#define GL_MODELVIEW19_ARB 0x8733 +#define GL_MODELVIEW20_ARB 0x8734 +#define GL_MODELVIEW21_ARB 0x8735 +#define GL_MODELVIEW22_ARB 0x8736 +#define GL_MODELVIEW23_ARB 0x8737 +#define GL_MODELVIEW24_ARB 0x8738 +#define GL_MODELVIEW25_ARB 0x8739 +#define GL_MODELVIEW26_ARB 0x873A +#define GL_MODELVIEW27_ARB 0x873B +#define GL_MODELVIEW28_ARB 0x873C +#define GL_MODELVIEW29_ARB 0x873D +#define GL_MODELVIEW30_ARB 0x873E +#define GL_MODELVIEW31_ARB 0x873F +#endif + +#ifndef GL_ARB_matrix_palette +#define GL_MATRIX_PALETTE_ARB 0x8840 +#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 +#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 +#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 +#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 +#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 +#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 +#endif + +#ifndef GL_ARB_texture_env_combine +#define GL_COMBINE_ARB 0x8570 +#define GL_COMBINE_RGB_ARB 0x8571 +#define GL_COMBINE_ALPHA_ARB 0x8572 +#define GL_SOURCE0_RGB_ARB 0x8580 +#define GL_SOURCE1_RGB_ARB 0x8581 +#define GL_SOURCE2_RGB_ARB 0x8582 +#define GL_SOURCE0_ALPHA_ARB 0x8588 +#define GL_SOURCE1_ALPHA_ARB 0x8589 +#define GL_SOURCE2_ALPHA_ARB 0x858A +#define GL_OPERAND0_RGB_ARB 0x8590 +#define GL_OPERAND1_RGB_ARB 0x8591 +#define GL_OPERAND2_RGB_ARB 0x8592 +#define GL_OPERAND0_ALPHA_ARB 0x8598 +#define GL_OPERAND1_ALPHA_ARB 0x8599 +#define GL_OPERAND2_ALPHA_ARB 0x859A +#define GL_RGB_SCALE_ARB 0x8573 +#define GL_ADD_SIGNED_ARB 0x8574 +#define GL_INTERPOLATE_ARB 0x8575 +#define GL_SUBTRACT_ARB 0x84E7 +#define GL_CONSTANT_ARB 0x8576 +#define GL_PRIMARY_COLOR_ARB 0x8577 +#define GL_PREVIOUS_ARB 0x8578 +#endif + +#ifndef GL_ARB_texture_env_crossbar +#endif + +#ifndef GL_ARB_texture_env_dot3 +#define GL_DOT3_RGB_ARB 0x86AE +#define GL_DOT3_RGBA_ARB 0x86AF +#endif + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_ARB 0x8370 +#endif + +#ifndef GL_ARB_depth_texture +#define GL_DEPTH_COMPONENT16_ARB 0x81A5 +#define GL_DEPTH_COMPONENT24_ARB 0x81A6 +#define GL_DEPTH_COMPONENT32_ARB 0x81A7 +#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A +#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B +#endif + +#ifndef GL_ARB_shadow +#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C +#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D +#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E +#endif + +#ifndef GL_ARB_shadow_ambient +#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF +#endif + +#ifndef GL_ARB_window_pos +#endif + +#ifndef GL_ARB_vertex_program +#define GL_COLOR_SUM_ARB 0x8458 +#define GL_VERTEX_PROGRAM_ARB 0x8620 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 +#define GL_PROGRAM_LENGTH_ARB 0x8627 +#define GL_PROGRAM_STRING_ARB 0x8628 +#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E +#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F +#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 +#define GL_CURRENT_MATRIX_ARB 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 +#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B +#define GL_PROGRAM_BINDING_ARB 0x8677 +#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A +#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#define GL_PROGRAM_FORMAT_ARB 0x8876 +#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 +#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 +#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 +#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 +#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 +#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 +#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 +#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 +#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 +#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 +#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA +#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB +#define GL_PROGRAM_ATTRIBS_ARB 0x88AC +#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD +#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE +#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF +#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 +#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 +#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 +#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 +#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 +#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 +#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 +#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 +#define GL_MATRIX0_ARB 0x88C0 +#define GL_MATRIX1_ARB 0x88C1 +#define GL_MATRIX2_ARB 0x88C2 +#define GL_MATRIX3_ARB 0x88C3 +#define GL_MATRIX4_ARB 0x88C4 +#define GL_MATRIX5_ARB 0x88C5 +#define GL_MATRIX6_ARB 0x88C6 +#define GL_MATRIX7_ARB 0x88C7 +#define GL_MATRIX8_ARB 0x88C8 +#define GL_MATRIX9_ARB 0x88C9 +#define GL_MATRIX10_ARB 0x88CA +#define GL_MATRIX11_ARB 0x88CB +#define GL_MATRIX12_ARB 0x88CC +#define GL_MATRIX13_ARB 0x88CD +#define GL_MATRIX14_ARB 0x88CE +#define GL_MATRIX15_ARB 0x88CF +#define GL_MATRIX16_ARB 0x88D0 +#define GL_MATRIX17_ARB 0x88D1 +#define GL_MATRIX18_ARB 0x88D2 +#define GL_MATRIX19_ARB 0x88D3 +#define GL_MATRIX20_ARB 0x88D4 +#define GL_MATRIX21_ARB 0x88D5 +#define GL_MATRIX22_ARB 0x88D6 +#define GL_MATRIX23_ARB 0x88D7 +#define GL_MATRIX24_ARB 0x88D8 +#define GL_MATRIX25_ARB 0x88D9 +#define GL_MATRIX26_ARB 0x88DA +#define GL_MATRIX27_ARB 0x88DB +#define GL_MATRIX28_ARB 0x88DC +#define GL_MATRIX29_ARB 0x88DD +#define GL_MATRIX30_ARB 0x88DE +#define GL_MATRIX31_ARB 0x88DF +#endif + +#ifndef GL_ARB_fragment_program +#define GL_FRAGMENT_PROGRAM_ARB 0x8804 +#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 +#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 +#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 +#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 +#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 +#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A +#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B +#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C +#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D +#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E +#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F +#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 +#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 +#endif + +#ifndef GL_ARB_vertex_buffer_object +#define GL_BUFFER_SIZE_ARB 0x8764 +#define GL_BUFFER_USAGE_ARB 0x8765 +#define GL_ARRAY_BUFFER_ARB 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 +#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F +#define GL_READ_ONLY_ARB 0x88B8 +#define GL_WRITE_ONLY_ARB 0x88B9 +#define GL_READ_WRITE_ARB 0x88BA +#define GL_BUFFER_ACCESS_ARB 0x88BB +#define GL_BUFFER_MAPPED_ARB 0x88BC +#define GL_BUFFER_MAP_POINTER_ARB 0x88BD +#define GL_STREAM_DRAW_ARB 0x88E0 +#define GL_STREAM_READ_ARB 0x88E1 +#define GL_STREAM_COPY_ARB 0x88E2 +#define GL_STATIC_DRAW_ARB 0x88E4 +#define GL_STATIC_READ_ARB 0x88E5 +#define GL_STATIC_COPY_ARB 0x88E6 +#define GL_DYNAMIC_DRAW_ARB 0x88E8 +#define GL_DYNAMIC_READ_ARB 0x88E9 +#define GL_DYNAMIC_COPY_ARB 0x88EA +#endif + +#ifndef GL_ARB_occlusion_query +#define GL_QUERY_COUNTER_BITS_ARB 0x8864 +#define GL_CURRENT_QUERY_ARB 0x8865 +#define GL_QUERY_RESULT_ARB 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 +#define GL_SAMPLES_PASSED_ARB 0x8914 +#endif + +#ifndef GL_ARB_shader_objects +#define GL_PROGRAM_OBJECT_ARB 0x8B40 +#define GL_SHADER_OBJECT_ARB 0x8B48 +#define GL_OBJECT_TYPE_ARB 0x8B4E +#define GL_OBJECT_SUBTYPE_ARB 0x8B4F +#define GL_FLOAT_VEC2_ARB 0x8B50 +#define GL_FLOAT_VEC3_ARB 0x8B51 +#define GL_FLOAT_VEC4_ARB 0x8B52 +#define GL_INT_VEC2_ARB 0x8B53 +#define GL_INT_VEC3_ARB 0x8B54 +#define GL_INT_VEC4_ARB 0x8B55 +#define GL_BOOL_ARB 0x8B56 +#define GL_BOOL_VEC2_ARB 0x8B57 +#define GL_BOOL_VEC3_ARB 0x8B58 +#define GL_BOOL_VEC4_ARB 0x8B59 +#define GL_FLOAT_MAT2_ARB 0x8B5A +#define GL_FLOAT_MAT3_ARB 0x8B5B +#define GL_FLOAT_MAT4_ARB 0x8B5C +#define GL_SAMPLER_1D_ARB 0x8B5D +#define GL_SAMPLER_2D_ARB 0x8B5E +#define GL_SAMPLER_3D_ARB 0x8B5F +#define GL_SAMPLER_CUBE_ARB 0x8B60 +#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 +#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 +#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 +#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 +#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 +#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 +#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 +#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 +#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 +#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 +#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 +#endif + +#ifndef GL_ARB_vertex_shader +#define GL_VERTEX_SHADER_ARB 0x8B31 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A +#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D +#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 +#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A +#endif + +#ifndef GL_ARB_fragment_shader +#define GL_FRAGMENT_SHADER_ARB 0x8B30 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B +#endif + +#ifndef GL_ARB_shading_language_100 +#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C +#endif + +#ifndef GL_ARB_texture_non_power_of_two +#endif + +#ifndef GL_ARB_point_sprite +#define GL_POINT_SPRITE_ARB 0x8861 +#define GL_COORD_REPLACE_ARB 0x8862 +#endif + +#ifndef GL_ARB_fragment_program_shadow +#endif + +#ifndef GL_ARB_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 +#define GL_DRAW_BUFFER0_ARB 0x8825 +#define GL_DRAW_BUFFER1_ARB 0x8826 +#define GL_DRAW_BUFFER2_ARB 0x8827 +#define GL_DRAW_BUFFER3_ARB 0x8828 +#define GL_DRAW_BUFFER4_ARB 0x8829 +#define GL_DRAW_BUFFER5_ARB 0x882A +#define GL_DRAW_BUFFER6_ARB 0x882B +#define GL_DRAW_BUFFER7_ARB 0x882C +#define GL_DRAW_BUFFER8_ARB 0x882D +#define GL_DRAW_BUFFER9_ARB 0x882E +#define GL_DRAW_BUFFER10_ARB 0x882F +#define GL_DRAW_BUFFER11_ARB 0x8830 +#define GL_DRAW_BUFFER12_ARB 0x8831 +#define GL_DRAW_BUFFER13_ARB 0x8832 +#define GL_DRAW_BUFFER14_ARB 0x8833 +#define GL_DRAW_BUFFER15_ARB 0x8834 +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 +#endif + +#ifndef GL_ARB_color_buffer_float +#define GL_RGBA_FLOAT_MODE_ARB 0x8820 +#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A +#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B +#define GL_CLAMP_READ_COLOR_ARB 0x891C +#define GL_FIXED_ONLY_ARB 0x891D +#endif + +#ifndef GL_ARB_half_float_pixel +#define GL_HALF_FLOAT_ARB 0x140B +#endif + +#ifndef GL_ARB_texture_float +#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 +#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 +#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 +#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 +#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 +#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 +#define GL_RGBA32F_ARB 0x8814 +#define GL_RGB32F_ARB 0x8815 +#define GL_ALPHA32F_ARB 0x8816 +#define GL_INTENSITY32F_ARB 0x8817 +#define GL_LUMINANCE32F_ARB 0x8818 +#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 +#define GL_RGBA16F_ARB 0x881A +#define GL_RGB16F_ARB 0x881B +#define GL_ALPHA16F_ARB 0x881C +#define GL_INTENSITY16F_ARB 0x881D +#define GL_LUMINANCE16F_ARB 0x881E +#define GL_LUMINANCE_ALPHA16F_ARB 0x881F +#endif + +#ifndef GL_ARB_pixel_buffer_object +#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF +#endif + +#ifndef GL_EXT_abgr +#define GL_ABGR_EXT 0x8000 +#endif + +#ifndef GL_EXT_blend_color +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 +#endif + +#ifndef GL_EXT_texture +#define GL_ALPHA4_EXT 0x803B +#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA12_EXT 0x803D +#define GL_ALPHA16_EXT 0x803E +#define GL_LUMINANCE4_EXT 0x803F +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE12_EXT 0x8041 +#define GL_LUMINANCE16_EXT 0x8042 +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#define GL_INTENSITY_EXT 0x8049 +#define GL_INTENSITY4_EXT 0x804A +#define GL_INTENSITY8_EXT 0x804B +#define GL_INTENSITY12_EXT 0x804C +#define GL_INTENSITY16_EXT 0x804D +#define GL_RGB2_EXT 0x804E +#define GL_RGB4_EXT 0x804F +#define GL_RGB5_EXT 0x8050 +#define GL_RGB8_EXT 0x8051 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB12_EXT 0x8053 +#define GL_RGB16_EXT 0x8054 +#define GL_RGBA2_EXT 0x8055 +#define GL_RGBA4_EXT 0x8056 +#define GL_RGB5_A1_EXT 0x8057 +#define GL_RGBA8_EXT 0x8058 +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGBA12_EXT 0x805A +#define GL_RGBA16_EXT 0x805B +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#define GL_REPLACE_EXT 0x8062 +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 +#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 +#endif + +#ifndef GL_EXT_texture3D +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_FILTER4_SGIS 0x8146 +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 +#endif + +#ifndef GL_EXT_subtexture +#endif + +#ifndef GL_EXT_copy_texture +#endif + +#ifndef GL_EXT_histogram +#define GL_HISTOGRAM_EXT 0x8024 +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#define GL_HISTOGRAM_SINK_EXT 0x802D +#define GL_MINMAX_EXT 0x802E +#define GL_MINMAX_FORMAT_EXT 0x802F +#define GL_MINMAX_SINK_EXT 0x8030 +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +#endif + +#ifndef GL_EXT_convolution +#define GL_CONVOLUTION_1D_EXT 0x8010 +#define GL_CONVOLUTION_2D_EXT 0x8011 +#define GL_SEPARABLE_2D_EXT 0x8012 +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#define GL_REDUCE_EXT 0x8016 +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 +#endif + +#ifndef GL_SGI_color_matrix +#define GL_COLOR_MATRIX_SGI 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB +#endif + +#ifndef GL_SGI_color_table +#define GL_COLOR_TABLE_SGI 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_PIXEL_TEXTURE_SGIS 0x8353 +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 +#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B +#endif + +#ifndef GL_SGIS_texture4D +#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 +#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 +#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 +#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 +#define GL_TEXTURE_4D_SGIS 0x8134 +#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 +#define GL_TEXTURE_4DSIZE_SGIS 0x8136 +#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 +#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 +#define GL_TEXTURE_4D_BINDING_SGIS 0x814F +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD +#endif + +#ifndef GL_EXT_cmyka +#define GL_CMYK_EXT 0x800C +#define GL_CMYKA_EXT 0x800D +#define GL_PACK_CMYK_HINT_EXT 0x800E +#define GL_UNPACK_CMYK_HINT_EXT 0x800F +#endif + +#ifndef GL_EXT_texture_object +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 +#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 +#define GL_LINEAR_DETAIL_SGIS 0x8097 +#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 +#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 +#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A +#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B +#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_LINEAR_SHARPEN_SGIS 0x80AD +#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE +#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF +#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D +#endif + +#ifndef GL_SGIS_multisample +#define GL_MULTISAMPLE_SGIS 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#define GL_1PASS_SGIS 0x80A1 +#define GL_2PASS_0_SGIS 0x80A2 +#define GL_2PASS_1_SGIS 0x80A3 +#define GL_4PASS_0_SGIS 0x80A4 +#define GL_4PASS_1_SGIS 0x80A5 +#define GL_4PASS_2_SGIS 0x80A6 +#define GL_4PASS_3_SGIS 0x80A7 +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#define GL_SAMPLES_SGIS 0x80A9 +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_RESCALE_NORMAL_EXT 0x803A +#endif + +#ifndef GL_EXT_vertex_array +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +#endif + +#ifndef GL_EXT_misc_attribute +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 +#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 +#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 +#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 +#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 +#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 +#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 +#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 +#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 +#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D +#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E +#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F +#endif + +#ifndef GL_SGIX_shadow +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_CLAMP_TO_EDGE_SGIS 0x812F +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_CLAMP_TO_BORDER_SGIS 0x812D +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#endif + +#ifndef GL_EXT_blend_logic_op +#endif + +#ifndef GL_SGIX_interlace +#define GL_INTERLACE_SGIX 0x8094 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E +#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F +#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 +#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 +#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 +#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 +#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 +#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 +#endif + +#ifndef GL_SGIS_texture_select +#define GL_DUAL_ALPHA4_SGIS 0x8110 +#define GL_DUAL_ALPHA8_SGIS 0x8111 +#define GL_DUAL_ALPHA12_SGIS 0x8112 +#define GL_DUAL_ALPHA16_SGIS 0x8113 +#define GL_DUAL_LUMINANCE4_SGIS 0x8114 +#define GL_DUAL_LUMINANCE8_SGIS 0x8115 +#define GL_DUAL_LUMINANCE12_SGIS 0x8116 +#define GL_DUAL_LUMINANCE16_SGIS 0x8117 +#define GL_DUAL_INTENSITY4_SGIS 0x8118 +#define GL_DUAL_INTENSITY8_SGIS 0x8119 +#define GL_DUAL_INTENSITY12_SGIS 0x811A +#define GL_DUAL_INTENSITY16_SGIS 0x811B +#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C +#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D +#define GL_QUAD_ALPHA4_SGIS 0x811E +#define GL_QUAD_ALPHA8_SGIS 0x811F +#define GL_QUAD_LUMINANCE4_SGIS 0x8120 +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SPRITE_SGIX 0x8148 +#define GL_SPRITE_MODE_SGIX 0x8149 +#define GL_SPRITE_AXIS_SGIX 0x814A +#define GL_SPRITE_TRANSLATION_SGIX 0x814B +#define GL_SPRITE_AXIAL_SGIX 0x814C +#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D +#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E +#endif + +#ifndef GL_EXT_point_parameters +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +#endif + +#ifndef GL_SGIX_instruments +#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 +#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C +#endif + +#ifndef GL_SGIX_framezoom +#define GL_FRAMEZOOM_SGIX 0x818B +#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C +#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#endif + +#ifndef GL_FfdMaskSGIX +#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 +#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 +#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 +#define GL_DEFORMATIONS_MASK_SGIX 0x8196 +#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_REFERENCE_PLANE_SGIX 0x817D +#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E +#endif + +#ifndef GL_SGIX_flush_raster +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_FOG_FUNC_SGIS 0x812A +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 +#endif + +#ifndef GL_HP_image_transform +#define GL_IMAGE_SCALE_X_HP 0x8155 +#define GL_IMAGE_SCALE_Y_HP 0x8156 +#define GL_IMAGE_TRANSLATE_X_HP 0x8157 +#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 +#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 +#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A +#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B +#define GL_IMAGE_MAG_FILTER_HP 0x815C +#define GL_IMAGE_MIN_FILTER_HP 0x815D +#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E +#define GL_CUBIC_HP 0x815F +#define GL_AVERAGE_HP 0x8160 +#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 +#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 +#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_IGNORE_BORDER_HP 0x8150 +#define GL_CONSTANT_BORDER_HP 0x8151 +#define GL_REPLICATE_BORDER_HP 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 +#endif + +#ifndef GL_INGR_palette_buffer +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE +#endif + +#ifndef GL_EXT_color_subtable +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_VERTEX_DATA_HINT_PGI 0x1A22A +#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B +#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C +#define GL_MAX_VERTEX_HINT_PGI 0x1A22D +#define GL_COLOR3_BIT_PGI 0x00010000 +#define GL_COLOR4_BIT_PGI 0x00020000 +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#define GL_INDEX_BIT_PGI 0x00080000 +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_NORMAL_BIT_PGI 0x08000000 +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#define GL_TEXCOORD4_BIT_PGI 0x80000000 +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 +#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD +#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 +#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C +#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E +#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F +#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 +#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 +#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 +#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 +#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 +#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 +#define GL_CLIP_NEAR_HINT_PGI 0x1A220 +#define GL_CLIP_FAR_HINT_PGI 0x1A221 +#define GL_WIDE_LINE_HINT_PGI 0x1A222 +#define GL_BACK_NORMALS_HINT_PGI 0x1A223 +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_LIST_PRIORITY_SGIX 0x8182 +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_IR_INSTRUMENT1_SGIX 0x817F +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E +#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F +#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SHADOW_AMBIENT_SGIX 0x80BF +#endif + +#ifndef GL_EXT_index_texture +#endif + +#ifndef GL_EXT_index_material +#define GL_INDEX_MATERIAL_EXT 0x81B8 +#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 +#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA +#endif + +#ifndef GL_EXT_index_func +#define GL_INDEX_TEST_EXT 0x81B5 +#define GL_INDEX_TEST_FUNC_EXT 0x81B6 +#define GL_INDEX_TEST_REF_EXT 0x81B7 +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_IUI_V2F_EXT 0x81AD +#define GL_IUI_V3F_EXT 0x81AE +#define GL_IUI_N3F_V2F_EXT 0x81AF +#define GL_IUI_N3F_V3F_EXT 0x81B0 +#define GL_T2F_IUI_V2F_EXT 0x81B1 +#define GL_T2F_IUI_V3F_EXT 0x81B2 +#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 +#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_CULL_VERTEX_EXT 0x81AA +#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB +#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_YCRCB_422_SGIX 0x81BB +#define GL_YCRCB_444_SGIX 0x81BC +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 +#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 +#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 +#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 +#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 +#define GL_LIGHT_ENV_MODE_SGIX 0x8407 +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B +#define GL_FRAGMENT_LIGHT0_SGIX 0x840C +#define GL_FRAGMENT_LIGHT1_SGIX 0x840D +#define GL_FRAGMENT_LIGHT2_SGIX 0x840E +#define GL_FRAGMENT_LIGHT3_SGIX 0x840F +#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 +#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 +#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 +#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 +#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 +#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 +#endif + +#ifndef GL_WIN_phong_shading +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB +#endif + +#ifndef GL_WIN_specular_fog +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC +#endif + +#ifndef GL_EXT_light_texture +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#define GL_FRAGMENT_COLOR_EXT 0x834C +#define GL_ATTENUATION_EXT 0x834D +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 +/* reuse GL_FRAGMENT_DEPTH_EXT */ +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_ALPHA_MIN_SGIX 0x8320 +#define GL_ALPHA_MAX_SGIX 0x8321 +#endif + +#ifndef GL_SGIX_impact_pixel_texture +#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 +#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 +#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 +#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 +#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 +#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 +#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A +#endif + +#ifndef GL_EXT_bgra +#define GL_BGR_EXT 0x80E0 +#define GL_BGRA_EXT 0x80E1 +#endif + +#ifndef GL_SGIX_async +#define GL_ASYNC_MARKER_SGIX 0x8329 +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D +#endif + +#ifndef GL_INTEL_texture_scissor +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 +#endif + +#ifndef GL_HP_occlusion_test +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#define GL_CUBIC_EXT 0x8334 +#define GL_AVERAGE_EXT 0x8335 +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#endif + +#ifndef GL_EXT_secondary_color +#define GL_COLOR_SUM_EXT 0x8458 +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_PERTURB_EXT 0x85AE +#define GL_TEXTURE_NORMAL_EXT 0x85AF +#endif + +#ifndef GL_EXT_multi_draw_arrays +#endif + +#ifndef GL_EXT_fog_coord +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#define GL_FOG_COORDINATE_EXT 0x8451 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_INVERTED_SCREEN_W_REND 0x8491 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_TANGENT_ARRAY_EXT 0x8439 +#define GL_BINORMAL_ARRAY_EXT 0x843A +#define GL_CURRENT_TANGENT_EXT 0x843B +#define GL_CURRENT_BINORMAL_EXT 0x843C +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#define GL_MAP1_TANGENT_EXT 0x8444 +#define GL_MAP2_TANGENT_EXT 0x8445 +#define GL_MAP1_BINORMAL_EXT 0x8446 +#define GL_MAP2_BINORMAL_EXT 0x8447 +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_CONSTANT_EXT 0x8576 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND2_ALPHA_EXT 0x859A +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_TRANSFORM_HINT_APPLE 0x85B1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_FOG_SCALE_SGIX 0x81FC +#define GL_FOG_SCALE_VALUE_SGIX 0x81FD +#endif + +#ifndef GL_SUNX_constant_data +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 +#endif + +#ifndef GL_SUN_global_alpha +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA +#endif + +#ifndef GL_SUN_triangle_list +#define GL_RESTART_SUN 0x0001 +#define GL_REPLACE_MIDDLE_SUN 0x0002 +#define GL_REPLACE_OLDEST_SUN 0x0003 +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#define GL_R1UI_V3F_SUN 0x85C4 +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB +#endif + +#ifndef GL_SUN_vertex +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_BLEND_DST_RGB_EXT 0x80C8 +#define GL_BLEND_SRC_RGB_EXT 0x80C9 +#define GL_BLEND_DST_ALPHA_EXT 0x80CA +#define GL_BLEND_SRC_ALPHA_EXT 0x80CB +#endif + +#ifndef GL_INGR_color_clamp +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INTERLACE_READ_INGR 0x8568 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_422_EXT 0x80CC +#define GL_422_REV_EXT 0x80CD +#define GL_422_AVERAGE_EXT 0x80CE +#define GL_422_REV_AVERAGE_EXT 0x80CF +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 +#endif + +#ifndef GL_EXT_texture_cube_map +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_WRAP_BORDER_SUN 0x81D4 +#endif + +#ifndef GL_EXT_texture_env_add +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX +#define GL_MODELVIEW1_MATRIX_EXT 0x8506 +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#define GL_MODELVIEW0_EXT GL_MODELVIEW +#define GL_MODELVIEW1_EXT 0x850A +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F +#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_MAX_SHININESS_NV 0x8504 +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 +#endif + +#ifndef GL_NV_register_combiners +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_SPARE0_NV 0x852E +#define GL_SPARE1_NV 0x852F +#define GL_DISCARD_NV 0x8530 +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 +/* reuse GL_TEXTURE0_ARB */ +/* reuse GL_TEXTURE1_ARB */ +/* reuse GL_ZERO */ +/* reuse GL_NONE */ +/* reuse GL_FOG */ +#endif + +#ifndef GL_NV_fog_distance +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C +/* reuse GL_EYE_PLANE */ +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E +#define GL_EMBOSS_MAP_NV 0x855F +#endif + +#ifndef GL_NV_blend_square +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_COMBINE4_NV 0x8503 +#define GL_SOURCE3_RGB_NV 0x8583 +#define GL_SOURCE3_ALPHA_NV 0x858B +#define GL_OPERAND3_RGB_NV 0x8593 +#define GL_OPERAND3_ALPHA_NV 0x859B +#endif + +#ifndef GL_MESA_resize_buffers +#endif + +#ifndef GL_MESA_window_pos +#endif + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_CULL_VERTEX_IBM 103050 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 +#endif + +#ifndef GL_SGIX_subsample +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_YCRCB_SGIX 0x8318 +#define GL_YCRCBA_SGIX 0x8319 +#endif + +#ifndef GL_SGI_depth_pass_instrument +#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 +#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 +#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 +#endif + +#ifndef GL_3DFX_tbuffer +#endif + +#ifndef GL_EXT_multisample +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#define GL_SAMPLE_MASK_EXT 0x80A0 +#define GL_1PASS_EXT 0x80A1 +#define GL_2PASS_0_EXT 0x80A2 +#define GL_2PASS_1_EXT 0x80A3 +#define GL_4PASS_0_EXT 0x80A4 +#define GL_4PASS_1_EXT 0x80A5 +#define GL_4PASS_2_EXT 0x80A6 +#define GL_4PASS_3_EXT 0x80A7 +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#define GL_SAMPLES_EXT 0x80A9 +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_CONVOLUTION_HINT_SGIX 0x8316 +#endif + +#ifndef GL_SGIX_resample +#define GL_PACK_RESAMPLE_SGIX 0x842C +#define GL_UNPACK_RESAMPLE_SGIX 0x842D +#define GL_RESAMPLE_REPLICATE_SGIX 0x842E +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#define GL_EYE_POINT_SGIS 0x81F4 +#define GL_OBJECT_POINT_SGIS 0x81F5 +#define GL_EYE_LINE_SGIS 0x81F6 +#define GL_OBJECT_LINE_SGIS 0x81F7 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 +#endif + +#ifndef GL_ATI_texture_mirror_once +#define GL_MIRROR_CLAMP_ATI 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 +#endif + +#ifndef GL_NV_fence +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +#endif + +#ifndef GL_IBM_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_IBM 0x8370 +#endif + +#ifndef GL_NV_evaluators +#define GL_EVAL_2D_NV 0x86C0 +#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 +#define GL_MAP_TESSELLATION_NV 0x86C2 +#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 +#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 +#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 +#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 +#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 +#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 +#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 +#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA +#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB +#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC +#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD +#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE +#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF +#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 +#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 +#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 +#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 +#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 +#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 +#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 +#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 +#endif + +#ifndef GL_NV_packed_depth_stencil +#define GL_DEPTH_STENCIL_NV 0x84F9 +#define GL_UNSIGNED_INT_24_8_NV 0x84FA +#endif + +#ifndef GL_NV_register_combiners2 +#define GL_PER_STAGE_CONSTANTS_NV 0x8535 +#endif + +#ifndef GL_NV_texture_compression_vtc +#endif + +#ifndef GL_NV_texture_rectangle +#define GL_TEXTURE_RECTANGLE_NV 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 +#endif + +#ifndef GL_NV_texture_shader +#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C +#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D +#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E +#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#define GL_SHADER_CONSISTENT_NV 0x86DD +#define GL_TEXTURE_SHADER_NV 0x86DE +#define GL_SHADER_OPERATION_NV 0x86DF +#define GL_CULL_MODES_NV 0x86E0 +#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 +#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 +#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV +#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV +#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV +#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 +#define GL_CONST_EYE_NV 0x86E5 +#define GL_PASS_THROUGH_NV 0x86E6 +#define GL_CULL_FRAGMENT_NV 0x86E7 +#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 +#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 +#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA +#define GL_DOT_PRODUCT_NV 0x86EC +#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED +#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE +#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 +#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 +#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 +#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 +#define GL_HILO_NV 0x86F4 +#define GL_DSDT_NV 0x86F5 +#define GL_DSDT_MAG_NV 0x86F6 +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#define GL_HILO16_NV 0x86F8 +#define GL_SIGNED_HILO_NV 0x86F9 +#define GL_SIGNED_HILO16_NV 0x86FA +#define GL_SIGNED_RGBA_NV 0x86FB +#define GL_SIGNED_RGBA8_NV 0x86FC +#define GL_SIGNED_RGB_NV 0x86FE +#define GL_SIGNED_RGB8_NV 0x86FF +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#define GL_SIGNED_ALPHA_NV 0x8705 +#define GL_SIGNED_ALPHA8_NV 0x8706 +#define GL_SIGNED_INTENSITY_NV 0x8707 +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#define GL_DSDT8_NV 0x8709 +#define GL_DSDT8_MAG8_NV 0x870A +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D +#define GL_HI_SCALE_NV 0x870E +#define GL_LO_SCALE_NV 0x870F +#define GL_DS_SCALE_NV 0x8710 +#define GL_DT_SCALE_NV 0x8711 +#define GL_MAGNITUDE_SCALE_NV 0x8712 +#define GL_VIBRANCE_SCALE_NV 0x8713 +#define GL_HI_BIAS_NV 0x8714 +#define GL_LO_BIAS_NV 0x8715 +#define GL_DS_BIAS_NV 0x8716 +#define GL_DT_BIAS_NV 0x8717 +#define GL_MAGNITUDE_BIAS_NV 0x8718 +#define GL_VIBRANCE_BIAS_NV 0x8719 +#define GL_TEXTURE_BORDER_VALUES_NV 0x871A +#define GL_TEXTURE_HI_SIZE_NV 0x871B +#define GL_TEXTURE_LO_SIZE_NV 0x871C +#define GL_TEXTURE_DS_SIZE_NV 0x871D +#define GL_TEXTURE_DT_SIZE_NV 0x871E +#define GL_TEXTURE_MAG_SIZE_NV 0x871F +#endif + +#ifndef GL_NV_texture_shader2 +#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF +#endif + +#ifndef GL_NV_vertex_array_range2 +#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 +#endif + +#ifndef GL_NV_vertex_program +#define GL_VERTEX_PROGRAM_NV 0x8620 +#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 +#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 +#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 +#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 +#define GL_CURRENT_ATTRIB_NV 0x8626 +#define GL_PROGRAM_LENGTH_NV 0x8627 +#define GL_PROGRAM_STRING_NV 0x8628 +#define GL_MODELVIEW_PROJECTION_NV 0x8629 +#define GL_IDENTITY_NV 0x862A +#define GL_INVERSE_NV 0x862B +#define GL_TRANSPOSE_NV 0x862C +#define GL_INVERSE_TRANSPOSE_NV 0x862D +#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E +#define GL_MAX_TRACK_MATRICES_NV 0x862F +#define GL_MATRIX0_NV 0x8630 +#define GL_MATRIX1_NV 0x8631 +#define GL_MATRIX2_NV 0x8632 +#define GL_MATRIX3_NV 0x8633 +#define GL_MATRIX4_NV 0x8634 +#define GL_MATRIX5_NV 0x8635 +#define GL_MATRIX6_NV 0x8636 +#define GL_MATRIX7_NV 0x8637 +#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 +#define GL_CURRENT_MATRIX_NV 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 +#define GL_PROGRAM_PARAMETER_NV 0x8644 +#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 +#define GL_PROGRAM_TARGET_NV 0x8646 +#define GL_PROGRAM_RESIDENT_NV 0x8647 +#define GL_TRACK_MATRIX_NV 0x8648 +#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 +#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A +#define GL_PROGRAM_ERROR_POSITION_NV 0x864B +#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 +#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 +#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 +#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 +#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 +#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 +#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 +#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 +#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 +#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 +#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A +#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B +#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C +#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D +#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E +#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F +#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 +#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 +#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 +#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 +#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 +#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 +#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 +#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 +#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 +#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 +#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A +#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B +#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C +#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D +#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E +#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F +#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 +#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 +#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 +#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 +#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 +#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 +#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 +#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 +#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 +#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 +#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A +#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B +#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C +#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D +#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E +#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F +#endif + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 +#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A +#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B +#endif + +#ifndef GL_SGIX_scalebias_hint +#define GL_SCALEBIAS_HINT_SGIX 0x8322 +#endif + +#ifndef GL_OML_interlace +#define GL_INTERLACE_OML 0x8980 +#define GL_INTERLACE_READ_OML 0x8981 +#endif + +#ifndef GL_OML_subsample +#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 +#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 +#endif + +#ifndef GL_OML_resample +#define GL_PACK_RESAMPLE_OML 0x8984 +#define GL_UNPACK_RESAMPLE_OML 0x8985 +#define GL_RESAMPLE_REPLICATE_OML 0x8986 +#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 +#define GL_RESAMPLE_AVERAGE_OML 0x8988 +#define GL_RESAMPLE_DECIMATE_OML 0x8989 +#endif + +#ifndef GL_NV_copy_depth_to_color +#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E +#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F +#endif + +#ifndef GL_ATI_envmap_bumpmap +#define GL_BUMP_ROT_MATRIX_ATI 0x8775 +#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 +#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 +#define GL_BUMP_TEX_UNITS_ATI 0x8778 +#define GL_DUDV_ATI 0x8779 +#define GL_DU8DV8_ATI 0x877A +#define GL_BUMP_ENVMAP_ATI 0x877B +#define GL_BUMP_TARGET_ATI 0x877C +#endif + +#ifndef GL_ATI_fragment_shader +#define GL_FRAGMENT_SHADER_ATI 0x8920 +#define GL_REG_0_ATI 0x8921 +#define GL_REG_1_ATI 0x8922 +#define GL_REG_2_ATI 0x8923 +#define GL_REG_3_ATI 0x8924 +#define GL_REG_4_ATI 0x8925 +#define GL_REG_5_ATI 0x8926 +#define GL_REG_6_ATI 0x8927 +#define GL_REG_7_ATI 0x8928 +#define GL_REG_8_ATI 0x8929 +#define GL_REG_9_ATI 0x892A +#define GL_REG_10_ATI 0x892B +#define GL_REG_11_ATI 0x892C +#define GL_REG_12_ATI 0x892D +#define GL_REG_13_ATI 0x892E +#define GL_REG_14_ATI 0x892F +#define GL_REG_15_ATI 0x8930 +#define GL_REG_16_ATI 0x8931 +#define GL_REG_17_ATI 0x8932 +#define GL_REG_18_ATI 0x8933 +#define GL_REG_19_ATI 0x8934 +#define GL_REG_20_ATI 0x8935 +#define GL_REG_21_ATI 0x8936 +#define GL_REG_22_ATI 0x8937 +#define GL_REG_23_ATI 0x8938 +#define GL_REG_24_ATI 0x8939 +#define GL_REG_25_ATI 0x893A +#define GL_REG_26_ATI 0x893B +#define GL_REG_27_ATI 0x893C +#define GL_REG_28_ATI 0x893D +#define GL_REG_29_ATI 0x893E +#define GL_REG_30_ATI 0x893F +#define GL_REG_31_ATI 0x8940 +#define GL_CON_0_ATI 0x8941 +#define GL_CON_1_ATI 0x8942 +#define GL_CON_2_ATI 0x8943 +#define GL_CON_3_ATI 0x8944 +#define GL_CON_4_ATI 0x8945 +#define GL_CON_5_ATI 0x8946 +#define GL_CON_6_ATI 0x8947 +#define GL_CON_7_ATI 0x8948 +#define GL_CON_8_ATI 0x8949 +#define GL_CON_9_ATI 0x894A +#define GL_CON_10_ATI 0x894B +#define GL_CON_11_ATI 0x894C +#define GL_CON_12_ATI 0x894D +#define GL_CON_13_ATI 0x894E +#define GL_CON_14_ATI 0x894F +#define GL_CON_15_ATI 0x8950 +#define GL_CON_16_ATI 0x8951 +#define GL_CON_17_ATI 0x8952 +#define GL_CON_18_ATI 0x8953 +#define GL_CON_19_ATI 0x8954 +#define GL_CON_20_ATI 0x8955 +#define GL_CON_21_ATI 0x8956 +#define GL_CON_22_ATI 0x8957 +#define GL_CON_23_ATI 0x8958 +#define GL_CON_24_ATI 0x8959 +#define GL_CON_25_ATI 0x895A +#define GL_CON_26_ATI 0x895B +#define GL_CON_27_ATI 0x895C +#define GL_CON_28_ATI 0x895D +#define GL_CON_29_ATI 0x895E +#define GL_CON_30_ATI 0x895F +#define GL_CON_31_ATI 0x8960 +#define GL_MOV_ATI 0x8961 +#define GL_ADD_ATI 0x8963 +#define GL_MUL_ATI 0x8964 +#define GL_SUB_ATI 0x8965 +#define GL_DOT3_ATI 0x8966 +#define GL_DOT4_ATI 0x8967 +#define GL_MAD_ATI 0x8968 +#define GL_LERP_ATI 0x8969 +#define GL_CND_ATI 0x896A +#define GL_CND0_ATI 0x896B +#define GL_DOT2_ADD_ATI 0x896C +#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D +#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E +#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F +#define GL_NUM_PASSES_ATI 0x8970 +#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 +#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 +#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 +#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 +#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 +#define GL_SWIZZLE_STR_ATI 0x8976 +#define GL_SWIZZLE_STQ_ATI 0x8977 +#define GL_SWIZZLE_STR_DR_ATI 0x8978 +#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 +#define GL_SWIZZLE_STRQ_ATI 0x897A +#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B +#define GL_RED_BIT_ATI 0x00000001 +#define GL_GREEN_BIT_ATI 0x00000002 +#define GL_BLUE_BIT_ATI 0x00000004 +#define GL_2X_BIT_ATI 0x00000001 +#define GL_4X_BIT_ATI 0x00000002 +#define GL_8X_BIT_ATI 0x00000004 +#define GL_HALF_BIT_ATI 0x00000008 +#define GL_QUARTER_BIT_ATI 0x00000010 +#define GL_EIGHTH_BIT_ATI 0x00000020 +#define GL_SATURATE_BIT_ATI 0x00000040 +#define GL_COMP_BIT_ATI 0x00000002 +#define GL_NEGATE_BIT_ATI 0x00000004 +#define GL_BIAS_BIT_ATI 0x00000008 +#endif + +#ifndef GL_ATI_pn_triangles +#define GL_PN_TRIANGLES_ATI 0x87F0 +#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 +#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 +#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 +#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 +#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 +#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 +#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 +#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 +#endif + +#ifndef GL_ATI_vertex_array_object +#define GL_STATIC_ATI 0x8760 +#define GL_DYNAMIC_ATI 0x8761 +#define GL_PRESERVE_ATI 0x8762 +#define GL_DISCARD_ATI 0x8763 +#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 +#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 +#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 +#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 +#endif + +#ifndef GL_EXT_vertex_shader +#define GL_VERTEX_SHADER_EXT 0x8780 +#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 +#define GL_OP_INDEX_EXT 0x8782 +#define GL_OP_NEGATE_EXT 0x8783 +#define GL_OP_DOT3_EXT 0x8784 +#define GL_OP_DOT4_EXT 0x8785 +#define GL_OP_MUL_EXT 0x8786 +#define GL_OP_ADD_EXT 0x8787 +#define GL_OP_MADD_EXT 0x8788 +#define GL_OP_FRAC_EXT 0x8789 +#define GL_OP_MAX_EXT 0x878A +#define GL_OP_MIN_EXT 0x878B +#define GL_OP_SET_GE_EXT 0x878C +#define GL_OP_SET_LT_EXT 0x878D +#define GL_OP_CLAMP_EXT 0x878E +#define GL_OP_FLOOR_EXT 0x878F +#define GL_OP_ROUND_EXT 0x8790 +#define GL_OP_EXP_BASE_2_EXT 0x8791 +#define GL_OP_LOG_BASE_2_EXT 0x8792 +#define GL_OP_POWER_EXT 0x8793 +#define GL_OP_RECIP_EXT 0x8794 +#define GL_OP_RECIP_SQRT_EXT 0x8795 +#define GL_OP_SUB_EXT 0x8796 +#define GL_OP_CROSS_PRODUCT_EXT 0x8797 +#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 +#define GL_OP_MOV_EXT 0x8799 +#define GL_OUTPUT_VERTEX_EXT 0x879A +#define GL_OUTPUT_COLOR0_EXT 0x879B +#define GL_OUTPUT_COLOR1_EXT 0x879C +#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D +#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E +#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F +#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 +#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 +#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 +#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 +#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 +#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 +#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 +#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 +#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 +#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 +#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA +#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB +#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC +#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD +#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE +#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF +#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 +#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 +#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 +#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 +#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 +#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 +#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 +#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 +#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 +#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 +#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA +#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB +#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC +#define GL_OUTPUT_FOG_EXT 0x87BD +#define GL_SCALAR_EXT 0x87BE +#define GL_VECTOR_EXT 0x87BF +#define GL_MATRIX_EXT 0x87C0 +#define GL_VARIANT_EXT 0x87C1 +#define GL_INVARIANT_EXT 0x87C2 +#define GL_LOCAL_CONSTANT_EXT 0x87C3 +#define GL_LOCAL_EXT 0x87C4 +#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 +#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 +#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 +#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 +#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE +#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF +#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 +#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 +#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 +#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 +#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 +#define GL_X_EXT 0x87D5 +#define GL_Y_EXT 0x87D6 +#define GL_Z_EXT 0x87D7 +#define GL_W_EXT 0x87D8 +#define GL_NEGATIVE_X_EXT 0x87D9 +#define GL_NEGATIVE_Y_EXT 0x87DA +#define GL_NEGATIVE_Z_EXT 0x87DB +#define GL_NEGATIVE_W_EXT 0x87DC +#define GL_ZERO_EXT 0x87DD +#define GL_ONE_EXT 0x87DE +#define GL_NEGATIVE_ONE_EXT 0x87DF +#define GL_NORMALIZED_RANGE_EXT 0x87E0 +#define GL_FULL_RANGE_EXT 0x87E1 +#define GL_CURRENT_VERTEX_EXT 0x87E2 +#define GL_MVP_MATRIX_EXT 0x87E3 +#define GL_VARIANT_VALUE_EXT 0x87E4 +#define GL_VARIANT_DATATYPE_EXT 0x87E5 +#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 +#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 +#define GL_VARIANT_ARRAY_EXT 0x87E8 +#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 +#define GL_INVARIANT_VALUE_EXT 0x87EA +#define GL_INVARIANT_DATATYPE_EXT 0x87EB +#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC +#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED +#endif + +#ifndef GL_ATI_vertex_streams +#define GL_MAX_VERTEX_STREAMS_ATI 0x876B +#define GL_VERTEX_STREAM0_ATI 0x876C +#define GL_VERTEX_STREAM1_ATI 0x876D +#define GL_VERTEX_STREAM2_ATI 0x876E +#define GL_VERTEX_STREAM3_ATI 0x876F +#define GL_VERTEX_STREAM4_ATI 0x8770 +#define GL_VERTEX_STREAM5_ATI 0x8771 +#define GL_VERTEX_STREAM6_ATI 0x8772 +#define GL_VERTEX_STREAM7_ATI 0x8773 +#define GL_VERTEX_SOURCE_ATI 0x8774 +#endif + +#ifndef GL_ATI_element_array +#define GL_ELEMENT_ARRAY_ATI 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A +#endif + +#ifndef GL_SUN_mesh_array +#define GL_QUAD_MESH_SUN 0x8614 +#define GL_TRIANGLE_MESH_SUN 0x8615 +#endif + +#ifndef GL_SUN_slice_accum +#define GL_SLICE_ACCUM_SUN 0x85CC +#endif + +#ifndef GL_NV_multisample_filter_hint +#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 +#endif + +#ifndef GL_NV_depth_clamp +#define GL_DEPTH_CLAMP_NV 0x864F +#endif + +#ifndef GL_NV_occlusion_query +#define GL_PIXEL_COUNTER_BITS_NV 0x8864 +#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 +#define GL_PIXEL_COUNT_NV 0x8866 +#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 +#endif + +#ifndef GL_NV_point_sprite +#define GL_POINT_SPRITE_NV 0x8861 +#define GL_COORD_REPLACE_NV 0x8862 +#define GL_POINT_SPRITE_R_MODE_NV 0x8863 +#endif + +#ifndef GL_NV_texture_shader3 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 +#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 +#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 +#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 +#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 +#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A +#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B +#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C +#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D +#define GL_HILO8_NV 0x885E +#define GL_SIGNED_HILO8_NV 0x885F +#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 +#endif + +#ifndef GL_NV_vertex_program1_1 +#endif + +#ifndef GL_EXT_shadow_funcs +#endif + +#ifndef GL_EXT_stencil_two_side +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 +#endif + +#ifndef GL_ATI_text_fragment_shader +#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 +#endif + +#ifndef GL_APPLE_client_storage +#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 +#endif + +#ifndef GL_APPLE_element_array +#define GL_ELEMENT_ARRAY_APPLE 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A +#endif + +#ifndef GL_APPLE_fence +#define GL_DRAW_PIXELS_APPLE 0x8A0A +#define GL_FENCE_APPLE 0x8A0B +#endif + +#ifndef GL_APPLE_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 +#endif + +#ifndef GL_APPLE_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E +#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F +#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 +#define GL_STORAGE_CACHED_APPLE 0x85BE +#define GL_STORAGE_SHARED_APPLE 0x85BF +#endif + +#ifndef GL_APPLE_ycbcr_422 +#define GL_YCBCR_422_APPLE 0x85B9 +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#endif + +#ifndef GL_S3_s3tc +#define GL_RGB_S3TC 0x83A0 +#define GL_RGB4_S3TC 0x83A1 +#define GL_RGBA_S3TC 0x83A2 +#define GL_RGBA4_S3TC 0x83A3 +#endif + +#ifndef GL_ATI_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 +#define GL_DRAW_BUFFER0_ATI 0x8825 +#define GL_DRAW_BUFFER1_ATI 0x8826 +#define GL_DRAW_BUFFER2_ATI 0x8827 +#define GL_DRAW_BUFFER3_ATI 0x8828 +#define GL_DRAW_BUFFER4_ATI 0x8829 +#define GL_DRAW_BUFFER5_ATI 0x882A +#define GL_DRAW_BUFFER6_ATI 0x882B +#define GL_DRAW_BUFFER7_ATI 0x882C +#define GL_DRAW_BUFFER8_ATI 0x882D +#define GL_DRAW_BUFFER9_ATI 0x882E +#define GL_DRAW_BUFFER10_ATI 0x882F +#define GL_DRAW_BUFFER11_ATI 0x8830 +#define GL_DRAW_BUFFER12_ATI 0x8831 +#define GL_DRAW_BUFFER13_ATI 0x8832 +#define GL_DRAW_BUFFER14_ATI 0x8833 +#define GL_DRAW_BUFFER15_ATI 0x8834 +#endif + +#ifndef GL_ATI_pixel_format_float +#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 +#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 +#endif + +#ifndef GL_ATI_texture_env_combine3 +#define GL_MODULATE_ADD_ATI 0x8744 +#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 +#define GL_MODULATE_SUBTRACT_ATI 0x8746 +#endif + +#ifndef GL_ATI_texture_float +#define GL_RGBA_FLOAT32_ATI 0x8814 +#define GL_RGB_FLOAT32_ATI 0x8815 +#define GL_ALPHA_FLOAT32_ATI 0x8816 +#define GL_INTENSITY_FLOAT32_ATI 0x8817 +#define GL_LUMINANCE_FLOAT32_ATI 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 +#define GL_RGBA_FLOAT16_ATI 0x881A +#define GL_RGB_FLOAT16_ATI 0x881B +#define GL_ALPHA_FLOAT16_ATI 0x881C +#define GL_INTENSITY_FLOAT16_ATI 0x881D +#define GL_LUMINANCE_FLOAT16_ATI 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F +#endif + +#ifndef GL_NV_float_buffer +#define GL_FLOAT_R_NV 0x8880 +#define GL_FLOAT_RG_NV 0x8881 +#define GL_FLOAT_RGB_NV 0x8882 +#define GL_FLOAT_RGBA_NV 0x8883 +#define GL_FLOAT_R16_NV 0x8884 +#define GL_FLOAT_R32_NV 0x8885 +#define GL_FLOAT_RG16_NV 0x8886 +#define GL_FLOAT_RG32_NV 0x8887 +#define GL_FLOAT_RGB16_NV 0x8888 +#define GL_FLOAT_RGB32_NV 0x8889 +#define GL_FLOAT_RGBA16_NV 0x888A +#define GL_FLOAT_RGBA32_NV 0x888B +#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C +#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D +#define GL_FLOAT_RGBA_MODE_NV 0x888E +#endif + +#ifndef GL_NV_fragment_program +#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 +#define GL_FRAGMENT_PROGRAM_NV 0x8870 +#define GL_MAX_TEXTURE_COORDS_NV 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 +#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 +#define GL_PROGRAM_ERROR_STRING_NV 0x8874 +#endif + +#ifndef GL_NV_half_float +#define GL_HALF_FLOAT_NV 0x140B +#endif + +#ifndef GL_NV_pixel_data_range +#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 +#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 +#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A +#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B +#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C +#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D +#endif + +#ifndef GL_NV_primitive_restart +#define GL_PRIMITIVE_RESTART_NV 0x8558 +#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 +#endif + +#ifndef GL_NV_texture_expand_normal +#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F +#endif + +#ifndef GL_NV_vertex_program2 +#endif + +#ifndef GL_ATI_map_object_buffer +#endif + +#ifndef GL_ATI_separate_stencil +#define GL_STENCIL_BACK_FUNC_ATI 0x8800 +#define GL_STENCIL_BACK_FAIL_ATI 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 +#endif + +#ifndef GL_ATI_vertex_attrib_array_object +#endif + +#ifndef GL_OES_read_format +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#endif + +#ifndef GL_EXT_depth_bounds_test +#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 +#define GL_DEPTH_BOUNDS_EXT 0x8891 +#endif + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_MIRROR_CLAMP_EXT 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 +#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 +#endif + +#ifndef GL_EXT_blend_equation_separate +#define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION +#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D +#endif + +#ifndef GL_MESA_pack_invert +#define GL_PACK_INVERT_MESA 0x8758 +#endif + +#ifndef GL_MESA_ycbcr_texture +#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB +#define GL_YCBCR_MESA 0x8757 +#endif + +#ifndef GL_EXT_pixel_buffer_object +#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF +#endif + +#ifndef GL_NV_fragment_program_option +#endif + +#ifndef GL_NV_fragment_program2 +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 +#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 +#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 +#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 +#endif + +#ifndef GL_NV_vertex_program2_option +/* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ +/* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */ +#endif + +#ifndef GL_NV_vertex_program3 +/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 +#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 +#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 +#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 +#define GL_FRAMEBUFFER_EXT 0x8D40 +#define GL_RENDERBUFFER_EXT 0x8D41 +#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 +#define GL_STENCIL_INDEX1_EXT 0x8D46 +#define GL_STENCIL_INDEX4_EXT 0x8D47 +#define GL_STENCIL_INDEX8_EXT 0x8D48 +#define GL_STENCIL_INDEX16_EXT 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 +#endif + +#ifndef GL_GREMEDY_string_marker +#endif + + +/*************************************************************/ + +#include +#ifndef GL_VERSION_2_0 +/* GL type for program/shader text */ +typedef char GLchar; /* native character */ +#endif + +#ifndef GL_VERSION_1_5 +/* GL types for handling large vertex buffer objects */ +typedef ptrdiff_t GLintptr; +typedef ptrdiff_t GLsizeiptr; +#endif + +#ifndef GL_ARB_vertex_buffer_object +/* GL types for handling large vertex buffer objects */ +typedef ptrdiff_t GLintptrARB; +typedef ptrdiff_t GLsizeiptrARB; +#endif + +#ifndef GL_ARB_shader_objects +/* GL types for handling shader object handles and program/shader text */ +typedef char GLcharARB; /* native character */ +typedef unsigned int GLhandleARB; /* shader object handle */ +#endif + +/* GL types for "half" precision (s10e5) float data in host memory */ +#ifndef GL_ARB_half_float_pixel +typedef unsigned short GLhalfARB; +#endif + +#ifndef GL_NV_half_float +typedef unsigned short GLhalfNV; +#endif + +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf); +GLAPI void APIENTRY glBlendEquation (GLenum); +GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei); +GLAPI void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint); +GLAPI void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +GLAPI void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +GLAPI void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean); +GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean); +GLAPI void APIENTRY glResetHistogram (GLenum); +GLAPI void APIENTRY glResetMinmax (GLenum); +GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTexture (GLenum); +GLAPI void APIENTRY glClientActiveTexture (GLenum); +GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble); +GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord1f (GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexCoord1fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord1i (GLenum, GLint); +GLAPI void APIENTRY glMultiTexCoord1iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord1s (GLenum, GLshort); +GLAPI void APIENTRY glMultiTexCoord1sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord2d (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord2dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord2f (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord2fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord2i (GLenum, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord2iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord2s (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord2sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord3d (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord3dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord3f (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord3fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord3i (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord3iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord3s (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord3sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord4d (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord4dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord4f (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord4fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord4i (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord4iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord4s (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord4sv (GLenum, const GLshort *); +GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *); +GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *); +GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *); +GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *); +GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean); +GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glFogCoordf (GLfloat); +GLAPI void APIENTRY glFogCoordfv (const GLfloat *); +GLAPI void APIENTRY glFogCoordd (GLdouble); +GLAPI void APIENTRY glFogCoorddv (const GLdouble *); +GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *); +GLAPI void APIENTRY glPointParameteri (GLenum, GLint); +GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *); +GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *); +GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *); +GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *); +GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint); +GLAPI void APIENTRY glSecondaryColor3iv (const GLint *); +GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *); +GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *); +GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *); +GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort); +GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *); +GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dv (const GLdouble *); +GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fv (const GLfloat *); +GLAPI void APIENTRY glWindowPos2i (GLint, GLint); +GLAPI void APIENTRY glWindowPos2iv (const GLint *); +GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2sv (const GLshort *); +GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dv (const GLdouble *); +GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fv (const GLfloat *); +GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3iv (const GLint *); +GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3sv (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); +#endif + +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueries (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteQueries (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsQuery (GLuint); +GLAPI void APIENTRY glBeginQuery (GLenum, GLuint); +GLAPI void APIENTRY glEndQuery (GLenum); +GLAPI void APIENTRY glGetQueryiv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectuiv (GLuint, GLenum, GLuint *); +GLAPI void APIENTRY glBindBuffer (GLenum, GLuint); +GLAPI void APIENTRY glDeleteBuffers (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenBuffers (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsBuffer (GLuint); +GLAPI void APIENTRY glBufferData (GLenum, GLsizeiptr, const GLvoid *, GLenum); +GLAPI void APIENTRY glBufferSubData (GLenum, GLintptr, GLsizeiptr, const GLvoid *); +GLAPI void APIENTRY glGetBufferSubData (GLenum, GLintptr, GLsizeiptr, GLvoid *); +GLAPI GLvoid* APIENTRY glMapBuffer (GLenum, GLenum); +GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum); +GLAPI void APIENTRY glGetBufferParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetBufferPointerv (GLenum, GLenum, GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparate (GLenum, GLenum); +GLAPI void APIENTRY glDrawBuffers (GLsizei, const GLenum *); +GLAPI void APIENTRY glStencilOpSeparate (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glStencilFuncSeparate (GLenum, GLenum, GLint, GLuint); +GLAPI void APIENTRY glStencilMaskSeparate (GLenum, GLuint); +GLAPI void APIENTRY glAttachShader (GLuint, GLuint); +GLAPI void APIENTRY glBindAttribLocation (GLuint, GLuint, const GLchar *); +GLAPI void APIENTRY glCompileShader (GLuint); +GLAPI GLuint APIENTRY glCreateProgram (void); +GLAPI GLuint APIENTRY glCreateShader (GLenum); +GLAPI void APIENTRY glDeleteProgram (GLuint); +GLAPI void APIENTRY glDeleteShader (GLuint); +GLAPI void APIENTRY glDetachShader (GLuint, GLuint); +GLAPI void APIENTRY glDisableVertexAttribArray (GLuint); +GLAPI void APIENTRY glEnableVertexAttribArray (GLuint); +GLAPI void APIENTRY glGetActiveAttrib (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); +GLAPI void APIENTRY glGetActiveUniform (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); +GLAPI void APIENTRY glGetAttachedShaders (GLuint, GLsizei, GLsizei *, GLuint *); +GLAPI GLint APIENTRY glGetAttribLocation (GLuint, const GLchar *); +GLAPI void APIENTRY glGetProgramiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glGetShaderiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetShaderInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glGetShaderSource (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI GLint APIENTRY glGetUniformLocation (GLuint, const GLchar *); +GLAPI void APIENTRY glGetUniformfv (GLuint, GLint, GLfloat *); +GLAPI void APIENTRY glGetUniformiv (GLuint, GLint, GLint *); +GLAPI void APIENTRY glGetVertexAttribdv (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfv (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgram (GLuint); +GLAPI GLboolean APIENTRY glIsShader (GLuint); +GLAPI void APIENTRY glLinkProgram (GLuint); +GLAPI void APIENTRY glShaderSource (GLuint, GLsizei, const GLchar* *, const GLint *); +GLAPI void APIENTRY glUseProgram (GLuint); +GLAPI void APIENTRY glUniform1f (GLint, GLfloat); +GLAPI void APIENTRY glUniform2f (GLint, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform3f (GLint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform4f (GLint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform1i (GLint, GLint); +GLAPI void APIENTRY glUniform2i (GLint, GLint, GLint); +GLAPI void APIENTRY glUniform3i (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform4i (GLint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform1fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform2fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform3fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform4fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform1iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform2iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform3iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform4iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniformMatrix2fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix3fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix4fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glValidateProgram (GLuint); +GLAPI void APIENTRY glVertexAttrib1d (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1f (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1s (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2d (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2f (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2s (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3d (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3f (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3s (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4Niv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4Nub (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttrib4bv (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4d (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4f (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4iv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4s (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubv (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4uiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4usv (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribPointer (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTextureARB (GLenum); +GLAPI void APIENTRY glClientActiveTextureARB (GLenum); +GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble); +GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum, GLint); +GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort); +GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_ARB_transpose_matrix 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *); +GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *); +GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *); +GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +#endif + +#ifndef GL_ARB_multisample +#define GL_ARB_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleCoverageARB (GLclampf, GLboolean); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); +#endif + +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_ARB_texture_cube_map 1 +#endif + +#ifndef GL_ARB_texture_compression +#define GL_ARB_texture_compression 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_ARB_texture_border_clamp +#define GL_ARB_texture_border_clamp 1 +#endif + +#ifndef GL_ARB_point_parameters +#define GL_ARB_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_ARB_vertex_blend 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWeightbvARB (GLint, const GLbyte *); +GLAPI void APIENTRY glWeightsvARB (GLint, const GLshort *); +GLAPI void APIENTRY glWeightivARB (GLint, const GLint *); +GLAPI void APIENTRY glWeightfvARB (GLint, const GLfloat *); +GLAPI void APIENTRY glWeightdvARB (GLint, const GLdouble *); +GLAPI void APIENTRY glWeightubvARB (GLint, const GLubyte *); +GLAPI void APIENTRY glWeightusvARB (GLint, const GLushort *); +GLAPI void APIENTRY glWeightuivARB (GLint, const GLuint *); +GLAPI void APIENTRY glWeightPointerARB (GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexBlendARB (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); +typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); +typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); +typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); +typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); +typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); +typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); +#endif + +#ifndef GL_ARB_matrix_palette +#define GL_ARB_matrix_palette 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint); +GLAPI void APIENTRY glMatrixIndexubvARB (GLint, const GLubyte *); +GLAPI void APIENTRY glMatrixIndexusvARB (GLint, const GLushort *); +GLAPI void APIENTRY glMatrixIndexuivARB (GLint, const GLuint *); +GLAPI void APIENTRY glMatrixIndexPointerARB (GLint, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); +typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_ARB_texture_env_combine +#define GL_ARB_texture_env_combine 1 +#endif + +#ifndef GL_ARB_texture_env_crossbar +#define GL_ARB_texture_env_crossbar 1 +#endif + +#ifndef GL_ARB_texture_env_dot3 +#define GL_ARB_texture_env_dot3 1 +#endif + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_ARB_texture_mirrored_repeat 1 +#endif + +#ifndef GL_ARB_depth_texture +#define GL_ARB_depth_texture 1 +#endif + +#ifndef GL_ARB_shadow +#define GL_ARB_shadow 1 +#endif + +#ifndef GL_ARB_shadow_ambient +#define GL_ARB_shadow_ambient 1 +#endif + +#ifndef GL_ARB_window_pos +#define GL_ARB_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dARB (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *); +GLAPI void APIENTRY glWindowPos2fARB (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *); +GLAPI void APIENTRY glWindowPos2iARB (GLint, GLint); +GLAPI void APIENTRY glWindowPos2ivARB (const GLint *); +GLAPI void APIENTRY glWindowPos2sARB (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2svARB (const GLshort *); +GLAPI void APIENTRY glWindowPos3dARB (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *); +GLAPI void APIENTRY glWindowPos3fARB (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *); +GLAPI void APIENTRY glWindowPos3iARB (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3ivARB (const GLint *); +GLAPI void APIENTRY glWindowPos3sARB (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3svARB (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); +#endif + +#ifndef GL_ARB_vertex_program +#define GL_ARB_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint); +GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint); +GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint); +GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *); +GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgramARB (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); +typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); +#endif + +#ifndef GL_ARB_fragment_program +#define GL_ARB_fragment_program 1 +/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */ +#endif + +#ifndef GL_ARB_vertex_buffer_object +#define GL_ARB_vertex_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindBufferARB (GLenum, GLuint); +GLAPI void APIENTRY glDeleteBuffersARB (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenBuffersARB (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsBufferARB (GLuint); +GLAPI void APIENTRY glBufferDataARB (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); +GLAPI void APIENTRY glBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *); +GLAPI void APIENTRY glGetBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *); +GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum, GLenum); +GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum); +GLAPI void APIENTRY glGetBufferParameterivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetBufferPointervARB (GLenum, GLenum, GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_ARB_occlusion_query +#define GL_ARB_occlusion_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueriesARB (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteQueriesARB (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsQueryARB (GLuint); +GLAPI void APIENTRY glBeginQueryARB (GLenum, GLuint); +GLAPI void APIENTRY glEndQueryARB (GLenum); +GLAPI void APIENTRY glGetQueryivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectivARB (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint, GLenum, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +#ifndef GL_ARB_shader_objects +#define GL_ARB_shader_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB); +GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum); +GLAPI void APIENTRY glDetachObjectARB (GLhandleARB, GLhandleARB); +GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum); +GLAPI void APIENTRY glShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); +GLAPI void APIENTRY glCompileShaderARB (GLhandleARB); +GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); +GLAPI void APIENTRY glAttachObjectARB (GLhandleARB, GLhandleARB); +GLAPI void APIENTRY glLinkProgramARB (GLhandleARB); +GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB); +GLAPI void APIENTRY glValidateProgramARB (GLhandleARB); +GLAPI void APIENTRY glUniform1fARB (GLint, GLfloat); +GLAPI void APIENTRY glUniform2fARB (GLint, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform3fARB (GLint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform1iARB (GLint, GLint); +GLAPI void APIENTRY glUniform2iARB (GLint, GLint, GLint); +GLAPI void APIENTRY glUniform3iARB (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform4iARB (GLint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform1fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform2fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform3fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform4fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform1ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform2ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform3ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform4ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *); +GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB, GLenum, GLint *); +GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); +GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); +GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB, const GLcharARB *); +GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); +GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB, GLint, GLfloat *); +GLAPI void APIENTRY glGetUniformivARB (GLhandleARB, GLint, GLint *); +GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); +typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); +typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); +typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); +typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); +typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +#endif + +#ifndef GL_ARB_vertex_shader +#define GL_ARB_vertex_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *); +GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); +GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB, const GLcharARB *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +#endif + +#ifndef GL_ARB_fragment_shader +#define GL_ARB_fragment_shader 1 +#endif + +#ifndef GL_ARB_shading_language_100 +#define GL_ARB_shading_language_100 1 +#endif + +#ifndef GL_ARB_texture_non_power_of_two +#define GL_ARB_texture_non_power_of_two 1 +#endif + +#ifndef GL_ARB_point_sprite +#define GL_ARB_point_sprite 1 +#endif + +#ifndef GL_ARB_fragment_program_shadow +#define GL_ARB_fragment_program_shadow 1 +#endif + +#ifndef GL_ARB_draw_buffers +#define GL_ARB_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersARB (GLsizei, const GLenum *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_ARB_texture_rectangle 1 +#endif + +#ifndef GL_ARB_color_buffer_float +#define GL_ARB_color_buffer_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClampColorARB (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); +#endif + +#ifndef GL_ARB_half_float_pixel +#define GL_ARB_half_float_pixel 1 +#endif + +#ifndef GL_ARB_texture_float +#define GL_ARB_texture_float 1 +#endif + +#ifndef GL_ARB_pixel_buffer_object +#define GL_ARB_pixel_buffer_object 1 +#endif + +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 +#endif + +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); +#endif + +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 +#endif + +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_SGIS_texture_filter4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); +typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); +#endif + +#ifndef GL_EXT_subtexture +#define GL_EXT_subtexture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_EXT_copy_texture +#define GL_EXT_copy_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); +GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); +GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_EXT_histogram +#define GL_EXT_histogram 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean); +GLAPI void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean); +GLAPI void APIENTRY glResetHistogramEXT (GLenum); +GLAPI void APIENTRY glResetMinmaxEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); +#endif + +#ifndef GL_EXT_convolution +#define GL_EXT_convolution 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint); +GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +#endif + +#ifndef GL_EXT_color_matrix +#define GL_EXT_color_matrix 1 +#endif + +#ifndef GL_SGI_color_table +#define GL_SGI_color_table 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_SGIX_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenSGIX (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_SGIS_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint); +GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *); +GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat); +GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *); +GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *); +GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIS_texture4D +#define GL_SGIS_texture4D 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 +#endif + +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 +#endif + +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *); +GLAPI void APIENTRY glBindTextureEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenTexturesEXT (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint); +GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); +typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_SGIS_detail_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_SGIS_sharpen_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_EXT_packed_pixels 1 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 +#endif + +#ifndef GL_SGIS_multisample +#define GL_SGIS_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean); +GLAPI void APIENTRY glSamplePatternSGIS (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 +#endif + +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glArrayElementEXT (GLint); +GLAPI void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei); +GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *); +GLAPI void APIENTRY glGetPointervEXT (GLenum, GLvoid* *); +GLAPI void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); +typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); +typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); +typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_misc_attribute +#define GL_EXT_misc_attribute 1 +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 +#endif + +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 +#endif + +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 +#endif + +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_SGIX_pixel_tiles 1 +#endif + +#ifndef GL_SGIX_texture_select +#define GL_SGIX_texture_select 1 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SGIX_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat); +GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *); +GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum, GLint); +GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_SGIX_texture_multi_buffer 1 +#endif + +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfEXT (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_SGIS_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfSGIS (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIX_instruments +#define GL_SGIX_instruments 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); +GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *); +GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *); +GLAPI void APIENTRY glReadInstrumentsSGIX (GLint); +GLAPI void APIENTRY glStartInstrumentsSGIX (void); +GLAPI void APIENTRY glStopInstrumentsSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); +typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); +typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); +typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 +#endif + +#ifndef GL_SGIX_framezoom +#define GL_SGIX_framezoom 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFrameZoomSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#define GL_SGIX_tag_sample_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTagSampleBufferSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_SGIX_polynomial_ffd 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); +GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); +GLAPI void APIENTRY glDeformSGIX (GLbitfield); +GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); +typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_SGIX_reference_plane 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); +#endif + +#ifndef GL_SGIX_flush_raster +#define GL_SGIX_flush_raster 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushRasterSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 +#endif + +#ifndef GL_HP_image_transform +#define GL_HP_image_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint); +GLAPI void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_HP_convolution_border_modes 1 +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 +#endif + +#ifndef GL_EXT_color_subtable +#define GL_EXT_color_subtable 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_PGI_vertex_hints 1 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PGI_misc_hints 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glHintPGI (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_SGIX_list_priority 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat); +GLAPI void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *); +GLAPI void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint); +GLAPI void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_SGIX_calligraphic_fragment 1 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SGIX_shadow_ambient 1 +#endif + +#ifndef GL_EXT_index_texture +#define GL_EXT_index_texture 1 +#endif + +#ifndef GL_EXT_index_material +#define GL_EXT_index_material 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_EXT_index_func +#define GL_EXT_index_func 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexFuncEXT (GLenum, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_EXT_index_array_formats 1 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLockArraysEXT (GLint, GLsizei); +GLAPI void APIENTRY glUnlockArraysEXT (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_EXT_cull_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *); +GLAPI void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_SGIX_fragment_lighting 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum); +GLAPI void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint); +GLAPI void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat); +GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint); +GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *); +GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint); +GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glLightEnviSGIX (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_IBM_rasterpos_clip 1 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_HP_texture_lighting 1 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_EXT_draw_range_elements 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +#endif + +#ifndef GL_WIN_phong_shading +#define GL_WIN_phong_shading 1 +#endif + +#ifndef GL_WIN_specular_fog +#define GL_WIN_specular_fog 1 +#endif + +#ifndef GL_EXT_light_texture +#define GL_EXT_light_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glApplyTextureEXT (GLenum); +GLAPI void APIENTRY glTextureLightEXT (GLenum); +GLAPI void APIENTRY glTextureMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 +#endif + +#ifndef GL_EXT_bgra +#define GL_EXT_bgra 1 +#endif + +#ifndef GL_SGIX_async +#define GL_SGIX_async 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint); +GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *); +GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *); +GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei); +GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei); +GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); +typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); +typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); +typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); +typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); +typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_SGIX_async_pixel 1 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_SGIX_async_histogram 1 +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_INTEL_parallel_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *); +GLAPI void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *); +GLAPI void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *); +GLAPI void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +#endif + +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_EXT_pixel_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint); +GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#define GL_EXT_pixel_transform_color_table 1 +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_EXT_separate_specular_color 1 +#endif + +#ifndef GL_EXT_secondary_color +#define GL_EXT_secondary_color 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *); +GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *); +GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *); +GLAPI void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *); +GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *); +GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *); +GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *); +GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort); +GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *); +GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_EXT_texture_perturb_normal 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureNormalEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif + +#ifndef GL_EXT_fog_coord +#define GL_EXT_fog_coord 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogCoordfEXT (GLfloat); +GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *); +GLAPI void APIENTRY glFogCoorddEXT (GLdouble); +GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *); +GLAPI void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_REND_screen_coordinates 1 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_EXT_coordinate_frame 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *); +GLAPI void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *); +GLAPI void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *); +GLAPI void APIENTRY glTangent3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glTangent3ivEXT (const GLint *); +GLAPI void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glTangent3svEXT (const GLshort *); +GLAPI void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *); +GLAPI void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *); +GLAPI void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *); +GLAPI void APIENTRY glBinormal3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glBinormal3ivEXT (const GLint *); +GLAPI void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glBinormal3svEXT (const GLshort *); +GLAPI void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); +typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); +typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); +typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); +typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); +typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); +typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); +typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); +typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); +typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); +typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_EXT_texture_env_combine 1 +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_APPLE_specular_vector 1 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_APPLE_transform_hint 1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_SGIX_fog_scale 1 +#endif + +#ifndef GL_SUNX_constant_data +#define GL_SUNX_constant_data 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFinishTextureSUNX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); +#endif + +#ifndef GL_SUN_global_alpha +#define GL_SUN_global_alpha 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte); +GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort); +GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint); +GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat); +GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble); +GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte); +GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort); +GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); +#endif + +#ifndef GL_SUN_triangle_list +#define GL_SUN_triangle_list 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint); +GLAPI void APIENTRY glReplacementCodeusSUN (GLushort); +GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte); +GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *); +GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *); +GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *); +GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); +#endif + +#ifndef GL_SUN_vertex +#define GL_SUN_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_EXT_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_blend_func_separate +#define GL_INGR_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_color_clamp +#define GL_INGR_color_clamp 1 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INGR_interlace_read 1 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_EXT_422_pixels 1 +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_SUN_convolution_border_modes 1 +#endif + +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_EXT_vertex_weighting 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexWeightfEXT (GLfloat); +GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *); +GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_NV_light_max_exponent 1 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_NV_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); +GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer); +#endif + +#ifndef GL_NV_register_combiners +#define GL_NV_register_combiners 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *); +GLAPI void APIENTRY glCombinerParameterfNV (GLenum, GLfloat); +GLAPI void APIENTRY glCombinerParameterivNV (GLenum, const GLint *); +GLAPI void APIENTRY glCombinerParameteriNV (GLenum, GLint); +GLAPI void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); +GLAPI void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); +#endif + +#ifndef GL_NV_fog_distance +#define GL_NV_fog_distance 1 +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 +#endif + +#ifndef GL_NV_blend_square +#define GL_NV_blend_square 1 +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_NV_texture_env_combine4 1 +#endif + +#ifndef GL_MESA_resize_buffers +#define GL_MESA_resize_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glResizeBuffersMESA (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); +#endif + +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos2iMESA (GLint, GLint); +GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos2sMESA (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *); +GLAPI void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *); +GLAPI void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint); +GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* const *, GLsizei, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_IBM_vertex_array_lists 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint); +GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +#endif + +#ifndef GL_SGIX_subsample +#define GL_SGIX_subsample 1 +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_SGIX_ycrcba 1 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#define GL_SGIX_ycrcb_subsample 1 +#endif + +#ifndef GL_SGIX_depth_pass_instrument +#define GL_SGIX_depth_pass_instrument 1 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_3DFX_texture_compression_FXT1 1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_3DFX_multisample 1 +#endif + +#ifndef GL_3DFX_tbuffer +#define GL_3DFX_tbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTbufferMask3DFX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); +#endif + +#ifndef GL_EXT_multisample +#define GL_EXT_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskEXT (GLclampf, GLboolean); +GLAPI void APIENTRY glSamplePatternEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_SGIX_vertex_preclip 1 +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_SGIX_convolution_accuracy 1 +#endif + +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_SGIS_point_line_texgen 1 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_SGIS_texture_color_mask 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +#endif + +#ifndef GL_SGIX_igloo_interface +#define GL_SGIX_igloo_interface 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 +#endif + +#ifndef GL_ATI_texture_mirror_once +#define GL_ATI_texture_mirror_once 1 +#endif + +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenFencesNV (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsFenceNV (GLuint); +GLAPI GLboolean APIENTRY glTestFenceNV (GLuint); +GLAPI void APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glFinishFenceNV (GLuint); +GLAPI void APIENTRY glSetFenceNV (GLuint, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#endif + +#ifndef GL_NV_evaluators +#define GL_NV_evaluators 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, const GLvoid *); +GLAPI void APIENTRY glMapParameterivNV (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glMapParameterfvNV (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, GLvoid *); +GLAPI void APIENTRY glGetMapParameterivNV (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMapParameterfvNV (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum, GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glEvalMapsNV (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); +typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); +#endif + +#ifndef GL_NV_packed_depth_stencil +#define GL_NV_packed_depth_stencil 1 +#endif + +#ifndef GL_NV_register_combiners2 +#define GL_NV_register_combiners2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_NV_texture_compression_vtc +#define GL_NV_texture_compression_vtc 1 +#endif + +#ifndef GL_NV_texture_rectangle +#define GL_NV_texture_rectangle 1 +#endif + +#ifndef GL_NV_texture_shader +#define GL_NV_texture_shader 1 +#endif + +#ifndef GL_NV_texture_shader2 +#define GL_NV_texture_shader2 1 +#endif + +#ifndef GL_NV_vertex_array_range2 +#define GL_NV_vertex_array_range2 1 +#endif + +#ifndef GL_NV_vertex_program +#define GL_NV_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei, const GLuint *, GLboolean *); +GLAPI void APIENTRY glBindProgramNV (GLenum, GLuint); +GLAPI void APIENTRY glDeleteProgramsNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glExecuteProgramNV (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glGenProgramsNV (GLsizei, GLuint *); +GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum, GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetProgramivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramStringNV (GLuint, GLenum, GLubyte *); +GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum, GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgramNV (GLuint); +GLAPI void APIENTRY glLoadProgramNV (GLenum, GLuint, GLsizei, const GLubyte *); +GLAPI void APIENTRY glProgramParameter4dNV (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramParameter4dvNV (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramParameter4fNV (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramParameter4fvNV (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glProgramParameters4dvNV (GLenum, GLuint, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramParameters4fvNV (GLenum, GLuint, GLuint, const GLfloat *); +GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glTrackMatrixNV (GLenum, GLuint, GLenum, GLenum); +GLAPI void APIENTRY glVertexAttribPointerNV (GLuint, GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexAttrib1dNV (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1fNV (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1sNV (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2dNV (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2fNV (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2sNV (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3dNV (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3fNV (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3sNV (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4dNV (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4fNV (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4sNV (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs1svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs2svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs3svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs4svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint, GLsizei, const GLubyte *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); +typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); +typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v); +typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); +#endif + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_SGIX_texture_coordinate_clamp 1 +#endif + +#ifndef GL_SGIX_scalebias_hint +#define GL_SGIX_scalebias_hint 1 +#endif + +#ifndef GL_OML_interlace +#define GL_OML_interlace 1 +#endif + +#ifndef GL_OML_subsample +#define GL_OML_subsample 1 +#endif + +#ifndef GL_OML_resample +#define GL_OML_resample 1 +#endif + +#ifndef GL_NV_copy_depth_to_color +#define GL_NV_copy_depth_to_color 1 +#endif + +#ifndef GL_ATI_envmap_bumpmap +#define GL_ATI_envmap_bumpmap 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBumpParameterivATI (GLenum, const GLint *); +GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum, GLint *); +GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); +#endif + +#ifndef GL_ATI_fragment_shader +#define GL_ATI_fragment_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint); +GLAPI void APIENTRY glBindFragmentShaderATI (GLuint); +GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint); +GLAPI void APIENTRY glBeginFragmentShaderATI (void); +GLAPI void APIENTRY glEndFragmentShaderATI (void); +GLAPI void APIENTRY glPassTexCoordATI (GLuint, GLuint, GLenum); +GLAPI void APIENTRY glSampleMapATI (GLuint, GLuint, GLenum); +GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); +typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); +typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); +#endif + +#ifndef GL_ATI_pn_triangles +#define GL_ATI_pn_triangles 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPNTrianglesiATI (GLenum, GLint); +GLAPI void APIENTRY glPNTrianglesfATI (GLenum, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); +#endif + +#ifndef GL_ATI_vertex_array_object +#define GL_ATI_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei, const GLvoid *, GLenum); +GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint); +GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint, GLuint, GLsizei, const GLvoid *, GLenum); +GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetObjectBufferivATI (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glFreeObjectBufferATI (GLuint); +GLAPI void APIENTRY glArrayObjectATI (GLenum, GLint, GLenum, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetArrayObjectivATI (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glVariantArrayObjectATI (GLuint, GLenum, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage); +typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); +#endif + +#ifndef GL_EXT_vertex_shader +#define GL_EXT_vertex_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginVertexShaderEXT (void); +GLAPI void APIENTRY glEndVertexShaderEXT (void); +GLAPI void APIENTRY glBindVertexShaderEXT (GLuint); +GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint); +GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint); +GLAPI void APIENTRY glShaderOp1EXT (GLenum, GLuint, GLuint); +GLAPI void APIENTRY glShaderOp2EXT (GLenum, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glShaderOp3EXT (GLenum, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSwizzleEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glWriteMaskEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glInsertComponentEXT (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glExtractComponentEXT (GLuint, GLuint, GLuint); +GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glSetInvariantEXT (GLuint, GLenum, const GLvoid *); +GLAPI void APIENTRY glSetLocalConstantEXT (GLuint, GLenum, const GLvoid *); +GLAPI void APIENTRY glVariantbvEXT (GLuint, const GLbyte *); +GLAPI void APIENTRY glVariantsvEXT (GLuint, const GLshort *); +GLAPI void APIENTRY glVariantivEXT (GLuint, const GLint *); +GLAPI void APIENTRY glVariantfvEXT (GLuint, const GLfloat *); +GLAPI void APIENTRY glVariantdvEXT (GLuint, const GLdouble *); +GLAPI void APIENTRY glVariantubvEXT (GLuint, const GLubyte *); +GLAPI void APIENTRY glVariantusvEXT (GLuint, const GLushort *); +GLAPI void APIENTRY glVariantuivEXT (GLuint, const GLuint *); +GLAPI void APIENTRY glVariantPointerEXT (GLuint, GLenum, GLuint, const GLvoid *); +GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint); +GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint); +GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum, GLenum, GLenum); +GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindParameterEXT (GLenum); +GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint, GLenum); +GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVariantPointervEXT (GLuint, GLenum, GLvoid* *); +GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); +typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); +typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); +typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); +typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); +typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); +typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); +typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); +typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); +typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); +typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); +typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); +typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); +typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); +typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); +typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); +typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); +typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); +typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data); +typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +#endif + +#ifndef GL_ATI_vertex_streams +#define GL_ATI_vertex_streams 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexStream1sATI (GLenum, GLshort); +GLAPI void APIENTRY glVertexStream1svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream1iATI (GLenum, GLint); +GLAPI void APIENTRY glVertexStream1ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream1fATI (GLenum, GLfloat); +GLAPI void APIENTRY glVertexStream1fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream1dATI (GLenum, GLdouble); +GLAPI void APIENTRY glVertexStream1dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream2sATI (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream2svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream2iATI (GLenum, GLint, GLint); +GLAPI void APIENTRY glVertexStream2ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream2fATI (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream2fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream2dATI (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream2dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream3sATI (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream3svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream3iATI (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexStream3ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream3fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream3dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream4sATI (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream4svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream4iATI (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexStream4ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream4fATI (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream4fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream4dATI (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream4dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glNormalStream3bATI (GLenum, GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glNormalStream3bvATI (GLenum, const GLbyte *); +GLAPI void APIENTRY glNormalStream3sATI (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glNormalStream3svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glNormalStream3iATI (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glNormalStream3ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glNormalStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glNormalStream3fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glNormalStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glNormalStream3dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum); +GLAPI void APIENTRY glVertexBlendEnviATI (GLenum, GLint); +GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); +#endif + +#ifndef GL_ATI_element_array +#define GL_ATI_element_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerATI (GLenum, const GLvoid *); +GLAPI void APIENTRY glDrawElementArrayATI (GLenum, GLsizei); +GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum, GLuint, GLuint, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); +#endif + +#ifndef GL_SUN_mesh_array +#define GL_SUN_mesh_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); +#endif + +#ifndef GL_SUN_slice_accum +#define GL_SUN_slice_accum 1 +#endif + +#ifndef GL_NV_multisample_filter_hint +#define GL_NV_multisample_filter_hint 1 +#endif + +#ifndef GL_NV_depth_clamp +#define GL_NV_depth_clamp 1 +#endif + +#ifndef GL_NV_occlusion_query +#define GL_NV_occlusion_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint); +GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint); +GLAPI void APIENTRY glEndOcclusionQueryNV (void); +GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint, GLenum, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +#ifndef GL_NV_point_sprite +#define GL_NV_point_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameteriNV (GLenum, GLint); +GLAPI void APIENTRY glPointParameterivNV (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_NV_texture_shader3 +#define GL_NV_texture_shader3 1 +#endif + +#ifndef GL_NV_vertex_program1_1 +#define GL_NV_vertex_program1_1 1 +#endif + +#ifndef GL_EXT_shadow_funcs +#define GL_EXT_shadow_funcs 1 +#endif + +#ifndef GL_EXT_stencil_two_side +#define GL_EXT_stencil_two_side 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); +#endif + +#ifndef GL_ATI_text_fragment_shader +#define GL_ATI_text_fragment_shader 1 +#endif + +#ifndef GL_APPLE_client_storage +#define GL_APPLE_client_storage 1 +#endif + +#ifndef GL_APPLE_element_array +#define GL_APPLE_element_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerAPPLE (GLenum, const GLvoid *); +GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum, GLint, GLsizei); +GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, GLint, GLsizei); +GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum, const GLint *, const GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, const GLint *, const GLsizei *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); +#endif + +#ifndef GL_APPLE_fence +#define GL_APPLE_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenFencesAPPLE (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei, const GLuint *); +GLAPI void APIENTRY glSetFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint); +GLAPI void APIENTRY glFinishFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum, GLuint); +GLAPI void APIENTRY glFinishObjectAPPLE (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); +typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); +typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); +#endif + +#ifndef GL_APPLE_vertex_array_object +#define GL_APPLE_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint); +GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); +#endif + +#ifndef GL_APPLE_vertex_array_range +#define GL_APPLE_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei, GLvoid *); +GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei, GLvoid *); +GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_APPLE_ycbcr_422 +#define GL_APPLE_ycbcr_422 1 +#endif + +#ifndef GL_S3_s3tc +#define GL_S3_s3tc 1 +#endif + +#ifndef GL_ATI_draw_buffers +#define GL_ATI_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersATI (GLsizei, const GLenum *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); +#endif + +#ifndef GL_ATI_pixel_format_float +#define GL_ATI_pixel_format_float 1 +/* This is really a WGL extension, but defines some associated GL enums. + * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string. + */ +#endif + +#ifndef GL_ATI_texture_env_combine3 +#define GL_ATI_texture_env_combine3 1 +#endif + +#ifndef GL_ATI_texture_float +#define GL_ATI_texture_float 1 +#endif + +#ifndef GL_NV_float_buffer +#define GL_NV_float_buffer 1 +#endif + +#ifndef GL_NV_fragment_program +#define GL_NV_fragment_program 1 +/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint, GLsizei, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint, GLsizei, const GLubyte *, const GLdouble *); +GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint, GLsizei, const GLubyte *, GLfloat *); +GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint, GLsizei, const GLubyte *, GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +#endif + +#ifndef GL_NV_half_float +#define GL_NV_half_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertex2hNV (GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertex3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertex4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glNormal3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glColor4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV); +GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glFogCoordhNV (GLhalfNV); +GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *); +GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV); +GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib1hNV (GLuint, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib2hNV (GLuint, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib3hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib4hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint, GLsizei, const GLhalfNV *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); +typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); +typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); +typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); +typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +#endif + +#ifndef GL_NV_pixel_data_range +#define GL_NV_pixel_data_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelDataRangeNV (GLenum, GLsizei, GLvoid *); +GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); +#endif + +#ifndef GL_NV_primitive_restart +#define GL_NV_primitive_restart 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPrimitiveRestartNV (void); +GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); +#endif + +#ifndef GL_NV_texture_expand_normal +#define GL_NV_texture_expand_normal 1 +#endif + +#ifndef GL_NV_vertex_program2 +#define GL_NV_vertex_program2 1 +#endif + +#ifndef GL_ATI_map_object_buffer +#define GL_ATI_map_object_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint); +GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); +#endif + +#ifndef GL_ATI_separate_stencil +#define GL_ATI_separate_stencil 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilOpSeparateATI (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum, GLenum, GLint, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +#endif + +#ifndef GL_ATI_vertex_attrib_array_object +#define GL_ATI_vertex_attrib_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); +#endif + +#ifndef GL_OES_read_format +#define GL_OES_read_format 1 +#endif + +#ifndef GL_EXT_depth_bounds_test +#define GL_EXT_depth_bounds_test 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthBoundsEXT (GLclampd, GLclampd); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); +#endif + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_EXT_texture_mirror_clamp 1 +#endif + +#ifndef GL_EXT_blend_equation_separate +#define GL_EXT_blend_equation_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); +#endif + +#ifndef GL_MESA_pack_invert +#define GL_MESA_pack_invert 1 +#endif + +#ifndef GL_MESA_ycbcr_texture +#define GL_MESA_ycbcr_texture 1 +#endif + +#ifndef GL_EXT_pixel_buffer_object +#define GL_EXT_pixel_buffer_object 1 +#endif + +#ifndef GL_NV_fragment_program_option +#define GL_NV_fragment_program_option 1 +#endif + +#ifndef GL_NV_fragment_program2 +#define GL_NV_fragment_program2 1 +#endif + +#ifndef GL_NV_vertex_program2_option +#define GL_NV_vertex_program2_option 1 +#endif + +#ifndef GL_NV_vertex_program3 +#define GL_NV_vertex_program3 1 +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_EXT_framebuffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint); +GLAPI void APIENTRY glBindRenderbufferEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei, GLuint *); +GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum, GLenum, GLsizei, GLsizei); +GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum, GLenum, GLint *); +GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint); +GLAPI void APIENTRY glBindFramebufferEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei, GLuint *); +GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum); +GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLint); +GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGenerateMipmapEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); +#endif + +#ifndef GL_GREMEDY_string_marker +#define GL_GREMEDY_string_marker 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string); +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/dll/mesa32/include/GL/glu.h b/reactos/dll/mesa32/include/GL/glu.h new file mode 100644 index 00000000000..c0bac75a8cc --- /dev/null +++ b/reactos/dll/mesa32/include/GL/glu.h @@ -0,0 +1,340 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#ifndef __glu_h__ +#define __glu_h__ + +#if defined(USE_MGL_NAMESPACE) +#include "glu_mangle.h" +#endif + +#include + +#ifndef GLAPIENTRY +#define GLAPIENTRY +#endif + +#ifndef GLAPIENTRYP +#define GLAPIENTRYP GLAPIENTRY * +#endif + +#ifndef GLAPI +#define GLAPI +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************/ + +/* Extensions */ +#define GLU_EXT_object_space_tess 1 +#define GLU_EXT_nurbs_tessellator 1 + +/* Boolean */ +#define GLU_FALSE 0 +#define GLU_TRUE 1 + +/* Version */ +#define GLU_VERSION_1_1 1 +#define GLU_VERSION_1_2 1 +#define GLU_VERSION_1_3 1 + +/* StringName */ +#define GLU_VERSION 100800 +#define GLU_EXTENSIONS 100801 + +/* ErrorCode */ +#define GLU_INVALID_ENUM 100900 +#define GLU_INVALID_VALUE 100901 +#define GLU_OUT_OF_MEMORY 100902 +#define GLU_INCOMPATIBLE_GL_VERSION 100903 +#define GLU_INVALID_OPERATION 100904 + +/* NurbsDisplay */ +/* GLU_FILL */ +#define GLU_OUTLINE_POLYGON 100240 +#define GLU_OUTLINE_PATCH 100241 + +/* NurbsCallback */ +#define GLU_NURBS_ERROR 100103 +#define GLU_ERROR 100103 +#define GLU_NURBS_BEGIN 100164 +#define GLU_NURBS_BEGIN_EXT 100164 +#define GLU_NURBS_VERTEX 100165 +#define GLU_NURBS_VERTEX_EXT 100165 +#define GLU_NURBS_NORMAL 100166 +#define GLU_NURBS_NORMAL_EXT 100166 +#define GLU_NURBS_COLOR 100167 +#define GLU_NURBS_COLOR_EXT 100167 +#define GLU_NURBS_TEXTURE_COORD 100168 +#define GLU_NURBS_TEX_COORD_EXT 100168 +#define GLU_NURBS_END 100169 +#define GLU_NURBS_END_EXT 100169 +#define GLU_NURBS_BEGIN_DATA 100170 +#define GLU_NURBS_BEGIN_DATA_EXT 100170 +#define GLU_NURBS_VERTEX_DATA 100171 +#define GLU_NURBS_VERTEX_DATA_EXT 100171 +#define GLU_NURBS_NORMAL_DATA 100172 +#define GLU_NURBS_NORMAL_DATA_EXT 100172 +#define GLU_NURBS_COLOR_DATA 100173 +#define GLU_NURBS_COLOR_DATA_EXT 100173 +#define GLU_NURBS_TEXTURE_COORD_DATA 100174 +#define GLU_NURBS_TEX_COORD_DATA_EXT 100174 +#define GLU_NURBS_END_DATA 100175 +#define GLU_NURBS_END_DATA_EXT 100175 + +/* NurbsError */ +#define GLU_NURBS_ERROR1 100251 +#define GLU_NURBS_ERROR2 100252 +#define GLU_NURBS_ERROR3 100253 +#define GLU_NURBS_ERROR4 100254 +#define GLU_NURBS_ERROR5 100255 +#define GLU_NURBS_ERROR6 100256 +#define GLU_NURBS_ERROR7 100257 +#define GLU_NURBS_ERROR8 100258 +#define GLU_NURBS_ERROR9 100259 +#define GLU_NURBS_ERROR10 100260 +#define GLU_NURBS_ERROR11 100261 +#define GLU_NURBS_ERROR12 100262 +#define GLU_NURBS_ERROR13 100263 +#define GLU_NURBS_ERROR14 100264 +#define GLU_NURBS_ERROR15 100265 +#define GLU_NURBS_ERROR16 100266 +#define GLU_NURBS_ERROR17 100267 +#define GLU_NURBS_ERROR18 100268 +#define GLU_NURBS_ERROR19 100269 +#define GLU_NURBS_ERROR20 100270 +#define GLU_NURBS_ERROR21 100271 +#define GLU_NURBS_ERROR22 100272 +#define GLU_NURBS_ERROR23 100273 +#define GLU_NURBS_ERROR24 100274 +#define GLU_NURBS_ERROR25 100275 +#define GLU_NURBS_ERROR26 100276 +#define GLU_NURBS_ERROR27 100277 +#define GLU_NURBS_ERROR28 100278 +#define GLU_NURBS_ERROR29 100279 +#define GLU_NURBS_ERROR30 100280 +#define GLU_NURBS_ERROR31 100281 +#define GLU_NURBS_ERROR32 100282 +#define GLU_NURBS_ERROR33 100283 +#define GLU_NURBS_ERROR34 100284 +#define GLU_NURBS_ERROR35 100285 +#define GLU_NURBS_ERROR36 100286 +#define GLU_NURBS_ERROR37 100287 + +/* NurbsProperty */ +#define GLU_AUTO_LOAD_MATRIX 100200 +#define GLU_CULLING 100201 +#define GLU_SAMPLING_TOLERANCE 100203 +#define GLU_DISPLAY_MODE 100204 +#define GLU_PARAMETRIC_TOLERANCE 100202 +#define GLU_SAMPLING_METHOD 100205 +#define GLU_U_STEP 100206 +#define GLU_V_STEP 100207 +#define GLU_NURBS_MODE 100160 +#define GLU_NURBS_MODE_EXT 100160 +#define GLU_NURBS_TESSELLATOR 100161 +#define GLU_NURBS_TESSELLATOR_EXT 100161 +#define GLU_NURBS_RENDERER 100162 +#define GLU_NURBS_RENDERER_EXT 100162 + +/* NurbsSampling */ +#define GLU_OBJECT_PARAMETRIC_ERROR 100208 +#define GLU_OBJECT_PARAMETRIC_ERROR_EXT 100208 +#define GLU_OBJECT_PATH_LENGTH 100209 +#define GLU_OBJECT_PATH_LENGTH_EXT 100209 +#define GLU_PATH_LENGTH 100215 +#define GLU_PARAMETRIC_ERROR 100216 +#define GLU_DOMAIN_DISTANCE 100217 + +/* NurbsTrim */ +#define GLU_MAP1_TRIM_2 100210 +#define GLU_MAP1_TRIM_3 100211 + +/* QuadricDrawStyle */ +#define GLU_POINT 100010 +#define GLU_LINE 100011 +#define GLU_FILL 100012 +#define GLU_SILHOUETTE 100013 + +/* QuadricCallback */ +/* GLU_ERROR */ + +/* QuadricNormal */ +#define GLU_SMOOTH 100000 +#define GLU_FLAT 100001 +#define GLU_NONE 100002 + +/* QuadricOrientation */ +#define GLU_OUTSIDE 100020 +#define GLU_INSIDE 100021 + +/* TessCallback */ +#define GLU_TESS_BEGIN 100100 +#define GLU_BEGIN 100100 +#define GLU_TESS_VERTEX 100101 +#define GLU_VERTEX 100101 +#define GLU_TESS_END 100102 +#define GLU_END 100102 +#define GLU_TESS_ERROR 100103 +#define GLU_TESS_EDGE_FLAG 100104 +#define GLU_EDGE_FLAG 100104 +#define GLU_TESS_COMBINE 100105 +#define GLU_TESS_BEGIN_DATA 100106 +#define GLU_TESS_VERTEX_DATA 100107 +#define GLU_TESS_END_DATA 100108 +#define GLU_TESS_ERROR_DATA 100109 +#define GLU_TESS_EDGE_FLAG_DATA 100110 +#define GLU_TESS_COMBINE_DATA 100111 + +/* TessContour */ +#define GLU_CW 100120 +#define GLU_CCW 100121 +#define GLU_INTERIOR 100122 +#define GLU_EXTERIOR 100123 +#define GLU_UNKNOWN 100124 + +/* TessProperty */ +#define GLU_TESS_WINDING_RULE 100140 +#define GLU_TESS_BOUNDARY_ONLY 100141 +#define GLU_TESS_TOLERANCE 100142 + +/* TessError */ +#define GLU_TESS_ERROR1 100151 +#define GLU_TESS_ERROR2 100152 +#define GLU_TESS_ERROR3 100153 +#define GLU_TESS_ERROR4 100154 +#define GLU_TESS_ERROR5 100155 +#define GLU_TESS_ERROR6 100156 +#define GLU_TESS_ERROR7 100157 +#define GLU_TESS_ERROR8 100158 +#define GLU_TESS_MISSING_BEGIN_POLYGON 100151 +#define GLU_TESS_MISSING_BEGIN_CONTOUR 100152 +#define GLU_TESS_MISSING_END_POLYGON 100153 +#define GLU_TESS_MISSING_END_CONTOUR 100154 +#define GLU_TESS_COORD_TOO_LARGE 100155 +#define GLU_TESS_NEED_COMBINE_CALLBACK 100156 + +/* TessWinding */ +#define GLU_TESS_WINDING_ODD 100130 +#define GLU_TESS_WINDING_NONZERO 100131 +#define GLU_TESS_WINDING_POSITIVE 100132 +#define GLU_TESS_WINDING_NEGATIVE 100133 +#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134 + +/*************************************************************/ + + +#ifdef __cplusplus +class GLUnurbs; +class GLUquadric; +class GLUtesselator; +#else +typedef struct GLUnurbs GLUnurbs; +typedef struct GLUquadric GLUquadric; +typedef struct GLUtesselator GLUtesselator; +#endif + +typedef GLUnurbs GLUnurbsObj; +typedef GLUquadric GLUquadricObj; +typedef GLUtesselator GLUtesselatorObj; +typedef GLUtesselator GLUtriangulatorObj; + +#define GLU_TESS_MAX_COORD 1.0e150 + +/* Internal convenience typedefs */ +typedef void (GLAPIENTRYP _GLUfuncptr)(); + +GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb); +GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess); +GLAPI void GLAPIENTRY gluBeginSurface (GLUnurbs* nurb); +GLAPI void GLAPIENTRY gluBeginTrim (GLUnurbs* nurb); +GLAPI GLint GLAPIENTRY gluBuild1DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); +GLAPI GLint GLAPIENTRY gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *data); +GLAPI GLint GLAPIENTRY gluBuild2DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); +GLAPI GLint GLAPIENTRY gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data); +GLAPI GLint GLAPIENTRY gluBuild3DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); +GLAPI GLint GLAPIENTRY gluBuild3DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +GLAPI GLboolean GLAPIENTRY gluCheckExtension (const GLubyte *extName, const GLubyte *extString); +GLAPI void GLAPIENTRY gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks); +GLAPI void GLAPIENTRY gluDeleteNurbsRenderer (GLUnurbs* nurb); +GLAPI void GLAPIENTRY gluDeleteQuadric (GLUquadric* quad); +GLAPI void GLAPIENTRY gluDeleteTess (GLUtesselator* tess); +GLAPI void GLAPIENTRY gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops); +GLAPI void GLAPIENTRY gluEndCurve (GLUnurbs* nurb); +GLAPI void GLAPIENTRY gluEndPolygon (GLUtesselator* tess); +GLAPI void GLAPIENTRY gluEndSurface (GLUnurbs* nurb); +GLAPI void GLAPIENTRY gluEndTrim (GLUnurbs* nurb); +GLAPI const GLubyte * GLAPIENTRY gluErrorString (GLenum error); +GLAPI void GLAPIENTRY gluGetNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat* data); +GLAPI const GLubyte * GLAPIENTRY gluGetString (GLenum name); +GLAPI void GLAPIENTRY gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data); +GLAPI void GLAPIENTRY gluLoadSamplingMatrices (GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view); +GLAPI void GLAPIENTRY gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ); +GLAPI GLUnurbs* GLAPIENTRY gluNewNurbsRenderer (void); +GLAPI GLUquadric* GLAPIENTRY gluNewQuadric (void); +GLAPI GLUtesselator* GLAPIENTRY gluNewTess (void); +GLAPI void GLAPIENTRY gluNextContour (GLUtesselator* tess, GLenum type); +GLAPI void GLAPIENTRY gluNurbsCallback (GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc); +GLAPI void GLAPIENTRY gluNurbsCallbackData (GLUnurbs* nurb, GLvoid* userData); +GLAPI void GLAPIENTRY gluNurbsCallbackDataEXT (GLUnurbs* nurb, GLvoid* userData); +GLAPI void GLAPIENTRY gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type); +GLAPI void GLAPIENTRY gluNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat value); +GLAPI void GLAPIENTRY gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type); +GLAPI void GLAPIENTRY gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top); +GLAPI void GLAPIENTRY gluPartialDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep); +GLAPI void GLAPIENTRY gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar); +GLAPI void GLAPIENTRY gluPickMatrix (GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport); +GLAPI GLint GLAPIENTRY gluProject (GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ); +GLAPI void GLAPIENTRY gluPwlCurve (GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type); +GLAPI void GLAPIENTRY gluQuadricCallback (GLUquadric* quad, GLenum which, _GLUfuncptr CallBackFunc); +GLAPI void GLAPIENTRY gluQuadricDrawStyle (GLUquadric* quad, GLenum draw); +GLAPI void GLAPIENTRY gluQuadricNormals (GLUquadric* quad, GLenum normal); +GLAPI void GLAPIENTRY gluQuadricOrientation (GLUquadric* quad, GLenum orientation); +GLAPI void GLAPIENTRY gluQuadricTexture (GLUquadric* quad, GLboolean texture); +GLAPI GLint GLAPIENTRY gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut); +GLAPI void GLAPIENTRY gluSphere (GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks); +GLAPI void GLAPIENTRY gluTessBeginContour (GLUtesselator* tess); +GLAPI void GLAPIENTRY gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data); +GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc); +GLAPI void GLAPIENTRY gluTessEndContour (GLUtesselator* tess); +GLAPI void GLAPIENTRY gluTessEndPolygon (GLUtesselator* tess); +GLAPI void GLAPIENTRY gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ); +GLAPI void GLAPIENTRY gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data); +GLAPI void GLAPIENTRY gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data); +GLAPI GLint GLAPIENTRY gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ); +GLAPI GLint GLAPIENTRY gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW); + +#ifdef __cplusplus +} +#endif + +#endif /* __glu_h__ */ diff --git a/reactos/dll/mesa32/include/GL/glu_mangle.h b/reactos/dll/mesa32/include/GL/glu_mangle.h new file mode 100644 index 00000000000..9c25aa864c1 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/glu_mangle.h @@ -0,0 +1,86 @@ +/* + * Mesa 3-D graphics library + * Version: 3.0 + * Copyright (C) 1995-1998 Brian Paul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef GLU_MANGLE_H +#define GLU_MANGLE_H + + +#define gluLookAt mgluLookAt +#define gluOrtho2D mgluOrtho2D +#define gluPerspective mgluPerspective +#define gluPickMatrix mgluPickMatrix +#define gluProject mgluProject +#define gluUnProject mgluUnProject +#define gluErrorString mgluErrorString +#define gluScaleImage mgluScaleImage +#define gluBuild1DMipmaps mgluBuild1DMipmaps +#define gluBuild2DMipmaps mgluBuild2DMipmaps +#define gluNewQuadric mgluNewQuadric +#define gluDeleteQuadric mgluDeleteQuadric +#define gluQuadricDrawStyle mgluQuadricDrawStyle +#define gluQuadricOrientation mgluQuadricOrientation +#define gluQuadricNormals mgluQuadricNormals +#define gluQuadricTexture mgluQuadricTexture +#define gluQuadricCallback mgluQuadricCallback +#define gluCylinder mgluCylinder +#define gluSphere mgluSphere +#define gluDisk mgluDisk +#define gluPartialDisk mgluPartialDisk +#define gluNewNurbsRenderer mgluNewNurbsRenderer +#define gluDeleteNurbsRenderer mgluDeleteNurbsRenderer +#define gluLoadSamplingMatrices mgluLoadSamplingMatrices +#define gluNurbsProperty mgluNurbsProperty +#define gluGetNurbsProperty mgluGetNurbsProperty +#define gluBeginCurve mgluBeginCurve +#define gluEndCurve mgluEndCurve +#define gluNurbsCurve mgluNurbsCurve +#define gluBeginSurface mgluBeginSurface +#define gluEndSurface mgluEndSurface +#define gluNurbsSurface mgluNurbsSurface +#define gluBeginTrim mgluBeginTrim +#define gluEndTrim mgluEndTrim +#define gluPwlCurve mgluPwlCurve +#define gluNurbsCallback mgluNurbsCallback +#define gluNewTess mgluNewTess +#define gluDeleteTess mgluDeleteTess +#define gluTessBeginPolygon mgluTessBeginPolygon +#define gluTessBeginContour mgluTessBeginContour +#define gluTessVertex mgluTessVertex +#define gluTessEndPolygon mgluTessEndPolygon +#define gluTessEndContour mgluTessEndContour +#define gluTessProperty mgluTessProperty +#define gluTessNormal mgluTessNormal +#define gluTessCallback mgluTessCallback +#define gluGetTessProperty mgluGetTessProperty +#define gluBeginPolygon mgluBeginPolygon +#define gluNextContour mgluNextContour +#define gluEndPolygon mgluEndPolygon +#define gluGetString mgluGetString +#define gluBuild1DMipmapLevels mgluBuild1DMipmapLevels +#define gluBuild2DMipmapLevels mgluBuild2DMipmapLevels +#define gluBuild3DMipmapLevels mgluBuild3DMipmapLevels +#define gluBuild3DMipmaps mgluBuild3DMipmaps +#define gluCheckExtension mgluCheckExtension +#define gluUnProject4 mgluUnProject4 +#define gluNurbsCallbackData mgluNurbsCallbackData +#define gluNurbsCallbackDataEXT mgluNurbsCallbackDataEXT + +#endif diff --git a/reactos/dll/mesa32/include/GL/glx.h b/reactos/dll/mesa32/include/GL/glx.h new file mode 100644 index 00000000000..ab0467c1886 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/glx.h @@ -0,0 +1,551 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 GLX_H +#define GLX_H + + +#ifdef __VMS +#include +# ifdef __cplusplus +/* VMS Xlib.h gives problems with C++. + * this avoids a bunch of trivial warnings */ +#pragma message disable nosimpint +#endif +#endif +#include +#include +#ifdef __VMS +# ifdef __cplusplus +#pragma message enable nosimpint +#endif +#endif +#include + + +#if defined(USE_MGL_NAMESPACE) +#include "glx_mangle.h" +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +#define GLX_VERSION_1_1 1 +#define GLX_VERSION_1_2 1 +#define GLX_VERSION_1_3 1 +#define GLX_VERSION_1_4 1 + +#define GLX_EXTENSION_NAME "GLX" + + + +/* + * Tokens for glXChooseVisual and glXGetConfig: + */ +#define GLX_USE_GL 1 +#define GLX_BUFFER_SIZE 2 +#define GLX_LEVEL 3 +#define GLX_RGBA 4 +#define GLX_DOUBLEBUFFER 5 +#define GLX_STEREO 6 +#define GLX_AUX_BUFFERS 7 +#define GLX_RED_SIZE 8 +#define GLX_GREEN_SIZE 9 +#define GLX_BLUE_SIZE 10 +#define GLX_ALPHA_SIZE 11 +#define GLX_DEPTH_SIZE 12 +#define GLX_STENCIL_SIZE 13 +#define GLX_ACCUM_RED_SIZE 14 +#define GLX_ACCUM_GREEN_SIZE 15 +#define GLX_ACCUM_BLUE_SIZE 16 +#define GLX_ACCUM_ALPHA_SIZE 17 + + +/* + * Error codes returned by glXGetConfig: + */ +#define GLX_BAD_SCREEN 1 +#define GLX_BAD_ATTRIBUTE 2 +#define GLX_NO_EXTENSION 3 +#define GLX_BAD_VISUAL 4 +#define GLX_BAD_CONTEXT 5 +#define GLX_BAD_VALUE 6 +#define GLX_BAD_ENUM 7 + + +/* + * GLX 1.1 and later: + */ +#define GLX_VENDOR 1 +#define GLX_VERSION 2 +#define GLX_EXTENSIONS 3 + + +/* + * GLX 1.3 and later: + */ +#define GLX_CONFIG_CAVEAT 0x20 +#define GLX_DONT_CARE 0xFFFFFFFF +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_VISUAL_ID 0x800B +#define GLX_SCREEN 0x800C +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_PBUFFER_HEIGHT 0x8040 +#define GLX_PBUFFER_WIDTH 0x8041 +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 + + +/* + * GLX 1.4 and later: + */ +#define GLX_SAMPLE_BUFFERS 0x186a0 /*100000*/ +#define GLX_SAMPLES 0x186a1 /*100001*/ + + + +typedef struct __GLXcontextRec *GLXContext; +typedef XID GLXPixmap; +typedef XID GLXDrawable; +/* GLX 1.3 and later */ +typedef struct __GLXFBConfigRec *GLXFBConfig; +typedef XID GLXFBConfigID; +typedef XID GLXContextID; +typedef XID GLXWindow; +typedef XID GLXPbuffer; + + + +extern XVisualInfo* glXChooseVisual( Display *dpy, int screen, + int *attribList ); + +extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis, + GLXContext shareList, Bool direct ); + +extern void glXDestroyContext( Display *dpy, GLXContext ctx ); + +extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable, + GLXContext ctx); + +extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst, + unsigned long mask ); + +extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable ); + +extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual, + Pixmap pixmap ); + +extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap ); + +extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event ); + +extern Bool glXQueryVersion( Display *dpy, int *maj, int *min ); + +extern Bool glXIsDirect( Display *dpy, GLXContext ctx ); + +extern int glXGetConfig( Display *dpy, XVisualInfo *visual, + int attrib, int *value ); + +extern GLXContext glXGetCurrentContext( void ); + +extern GLXDrawable glXGetCurrentDrawable( void ); + +extern void glXWaitGL( void ); + +extern void glXWaitX( void ); + +extern void glXUseXFont( Font font, int first, int count, int list ); + + + +/* GLX 1.1 and later */ +extern const char *glXQueryExtensionsString( Display *dpy, int screen ); + +extern const char *glXQueryServerString( Display *dpy, int screen, int name ); + +extern const char *glXGetClientString( Display *dpy, int name ); + + +/* GLX 1.2 and later */ +extern Display *glXGetCurrentDisplay( void ); + + +/* GLX 1.3 and later */ +extern GLXFBConfig *glXChooseFBConfig( Display *dpy, int screen, + const int *attribList, int *nitems ); + +extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config, + int attribute, int *value ); + +extern GLXFBConfig *glXGetFBConfigs( Display *dpy, int screen, + int *nelements ); + +extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy, + GLXFBConfig config ); + +extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config, + Window win, const int *attribList ); + +extern void glXDestroyWindow( Display *dpy, GLXWindow window ); + +extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config, + Pixmap pixmap, const int *attribList ); + +extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap ); + +extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config, + const int *attribList ); + +extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf ); + +extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute, + unsigned int *value ); + +extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config, + int renderType, GLXContext shareList, + Bool direct ); + +extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw, + GLXDrawable read, GLXContext ctx ); + +extern GLXDrawable glXGetCurrentReadDrawable( void ); + +extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute, + int *value ); + +extern void glXSelectEvent( Display *dpy, GLXDrawable drawable, + unsigned long mask ); + +extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable, + unsigned long *mask ); + + +/* GLX 1.4 and later */ +extern void (*glXGetProcAddress(const GLubyte *procname))( void ); + + +#ifndef GLX_GLXEXT_LEGACY + +#include + +#else + + +/* + * 28. GLX_EXT_visual_info extension + */ +#ifndef GLX_EXT_visual_info +#define GLX_EXT_visual_info 1 + +#define GLX_X_VISUAL_TYPE_EXT 0x22 +#define GLX_TRANSPARENT_TYPE_EXT 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 +#define GLX_NONE_EXT 0x8000 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 + +#endif /* 28. GLX_EXT_visual_info extension */ + + + +/* + * 41. GLX_SGI_video_sync + */ +#ifndef GLX_SGI_video_sync +#define GLX_SGI_video_sync 1 + +extern int glXGetVideoSyncSGI(unsigned int *count); +extern int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count); + +#endif /* GLX_SGI_video_sync */ + + + +/* + * 42. GLX_EXT_visual_rating + */ +#ifndef GLX_EXT_visual_rating +#define GLX_EXT_visual_rating 1 + +#define GLX_VISUAL_CAVEAT_EXT 0x20 +/*#define GLX_NONE_EXT 0x8000*/ +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D + +#endif /* GLX_EXT_visual_rating */ + + + +/* + * 47. GLX_EXT_import_context + */ +#ifndef GLX_EXT_import_context +#define GLX_EXT_import_context 1 + +#define GLX_SHARE_CONTEXT_EXT 0x800A +#define GLX_VISUAL_ID_EXT 0x800B +#define GLX_SCREEN_EXT 0x800C + +extern void glXFreeContextEXT(Display *dpy, GLXContext context); + +extern GLXContextID glXGetContextIDEXT(const GLXContext context); + +extern Display *glXGetCurrentDisplayEXT(void); + +extern GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID); + +extern int glXQueryContextInfoEXT(Display *dpy, GLXContext context, + int attribute,int *value); + +#endif /* GLX_EXT_import_context */ + + + +/* + * 215. GLX_MESA_copy_sub_buffer + */ +#ifndef GLX_MESA_copy_sub_buffer +#define GLX_MESA_copy_sub_buffer 1 + +extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, + int x, int y, int width, int height ); + +#endif + + + +/* + * 216. GLX_MESA_pixmap_colormap + */ +#ifndef GLX_MESA_pixmap_colormap +#define GLX_MESA_pixmap_colormap 1 + +extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, + Pixmap pixmap, Colormap cmap ); + +#endif /* GLX_MESA_pixmap_colormap */ + + + +/* + * 217. GLX_MESA_release_buffers + */ +#ifndef GLX_MESA_release_buffers +#define GLX_MESA_release_buffers 1 + +extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ); + +#endif /* GLX_MESA_release_buffers */ + + + +/* + * 218. GLX_MESA_set_3dfx_mode + */ +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_MESA_set_3dfx_mode 1 + +#define GLX_3DFX_WINDOW_MODE_MESA 0x1 +#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 + +extern Bool glXSet3DfxModeMESA( int mode ); + +#endif /* GLX_MESA_set_3dfx_mode */ + + + +/* + * ARB 2. GLX_ARB_get_proc_address + */ +#ifndef GLX_ARB_get_proc_address +#define GLX_ARB_get_proc_address 1 + +extern void (*glXGetProcAddressARB(const GLubyte *procName))(); + +#endif /* GLX_ARB_get_proc_address */ + + + +#endif /* GLX_GLXEXT_LEGACY */ + + +/** + ** The following aren't in glxext.h yet. + **/ + + +/* + * ???. GLX_NV_vertex_array_range + */ +#ifndef GLX_NV_vertex_array_range +#define GLX_NV_vertex_array_range + +extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +extern void glXFreeMemoryNV(GLvoid *pointer); +typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer); + +#endif /* GLX_NV_vertex_array_range */ + + + +/* + * ???. GLX_MESA_agp_offset + */ +#ifndef GLX_MESA_agp_offset +#define GLX_MESA_agp_offset 1 + +extern GLuint glXGetAGPOffsetMESA(const GLvoid *pointer); +typedef GLuint (* PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *pointer); + +#endif /* GLX_MESA_agp_offset */ + + +/* + * ???. GLX_MESA_allocate_memory + */ +#ifndef GLX_MESA_allocate_memory +#define GLX_MESA_allocate_memory 1 + +extern void *glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority); +extern void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer); +extern GLuint glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer); +typedef void * ( * PFNGLXALLOCATEMEMORYMESAPROC) (Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority); +typedef void ( * PFNGLXFREEMEMORYMESAPROC) (Display *dpy, int scrn, void *pointer); +typedef GLuint (* PFNGLXGETMEMORYOFFSETMESAPROC) (Display *dpy, int scrn, const void *pointer); + +#endif /* GLX_MESA_allocate_memory */ + +/* + * ARB ?. GLX_ARB_render_texture + */ +#ifndef GLX_ARB_render_texture +#define GLX_ARB_render_texture 1 + +extern Bool glXBindTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer); +extern Bool glXReleaseTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer); +extern Bool glXDrawableAttribARB(Display *dpy, GLXDrawable draw, const int *attribList); + +#endif /* GLX_ARB_render_texture */ + + +/* + * Remove this when glxext.h is updated. + */ +#ifndef GLX_NV_float_buffer +#define GLX_NV_float_buffer 1 + +#define GLX_FLOAT_COMPONENTS_NV 0x20B0 + +#endif /* GLX_NV_float_buffer */ + + +/*** Should these go here, or in another header? */ +/* +** GLX Events +*/ +typedef struct { + int event_type; /* GLX_DAMAGED or GLX_SAVED */ + int draw_type; /* GLX_WINDOW or GLX_PBUFFER */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came for SendEvent request */ + Display *display; /* display the event was read from */ + GLXDrawable drawable; /* XID of Drawable */ + unsigned int buffer_mask; /* mask indicating which buffers are affected */ + unsigned int aux_buffer; /* which aux buffer was affected */ + int x, y; + int width, height; + int count; /* if nonzero, at least this many more */ +} GLXPbufferClobberEvent; + +typedef union __GLXEvent { + GLXPbufferClobberEvent glxpbufferclobber; + long pad[24]; +} GLXEvent; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/dll/mesa32/include/GL/glx_mangle.h b/reactos/dll/mesa32/include/GL/glx_mangle.h new file mode 100644 index 00000000000..d0b47d94e73 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/glx_mangle.h @@ -0,0 +1,55 @@ +/* + * Mesa 3-D graphics library + * Version: 4.1 + * Copyright (C) 1995-1998 Brian Paul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef GLX_MANGLE_H +#define GLX_MANGLE_H + +#define glXChooseVisual mglXChooseVisual +#define glXCreateContext mglXCreateContext +#define glXDestroyContext mglXDestroyContext +#define glXMakeCurrent mglXMakeCurrent +#define glXCopyContext mglXCopyContext +#define glXSwapBuffers mglXSwapBuffers +#define glXCreateGLXPixmap mglXCreateGLXPixmap +#define glXDestroyGLXPixmap mglXDestroyGLXPixmap +#define glXQueryExtension mglXQueryExtension +#define glXQueryVersion mglXQueryVersion +#define glXIsDirect mglXIsDirect +#define glXGetConfig mglXGetConfig +#define glXGetCurrentContext mglXGetCurrentContext +#define glXGetCurrentDrawable mglXGetCurrentDrawable +#define glXWaitGL mglXWaitGL +#define glXWaitX mglXWaitX +#define glXUseXFont mglXUseXFont +#define glXQueryExtensionsString mglXQueryExtensionsString +#define glXQueryServerString mglXQueryServerString +#define glXGetClientString mglXGetClientString +#define glXCreateGLXPixmapMESA mglXCreateGLXPixmapMESA +#define glXReleaseBuffersMESA mglXReleaseBuffersMESA +#define glXCopySubBufferMESA mglXCopySubBufferMESA +#define glXGetVideoSyncSGI mglXGetVideoSyncSGI +#define glXWaitVideoSyncSGI mglXWaitVideoSyncSGI + +/* GLX 1.4 */ +#define glXGetProcAddress mglXGetProcAddress + + +#endif diff --git a/reactos/dll/mesa32/include/GL/glxext.h b/reactos/dll/mesa32/include/GL/glxext.h new file mode 100644 index 00000000000..589d1ef363e --- /dev/null +++ b/reactos/dll/mesa32/include/GL/glxext.h @@ -0,0 +1,693 @@ +#ifndef __glxext_h_ +#define __glxext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number, required by OpenGL ABI for Linux */ +/* glxext.h last updated 2004/07/26 */ +/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ +#define GLX_GLXEXT_VERSION 6 + +#ifndef GLX_VERSION_1_3 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_CONFIG_CAVEAT 0x20 +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_DONT_CARE 0xFFFFFFFF +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_VISUAL_ID 0x800B +#define GLX_SCREEN 0x800C +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_PBUFFER_HEIGHT 0x8040 +#define GLX_PBUFFER_WIDTH 0x8041 +#endif + +#ifndef GLX_VERSION_1_4 +#define GLX_SAMPLE_BUFFERS 100000 +#define GLX_SAMPLES 100001 +#endif + +#ifndef GLX_ARB_get_proc_address +#endif + +#ifndef GLX_ARB_multisample +#define GLX_SAMPLE_BUFFERS_ARB 100000 +#define GLX_SAMPLES_ARB 100001 +#endif + +#ifndef GLX_SGIS_multisample +#define GLX_SAMPLE_BUFFERS_SGIS 100000 +#define GLX_SAMPLES_SGIS 100001 +#endif + +#ifndef GLX_EXT_visual_info +#define GLX_X_VISUAL_TYPE_EXT 0x22 +#define GLX_TRANSPARENT_TYPE_EXT 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 +#define GLX_NONE_EXT 0x8000 +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 +#endif + +#ifndef GLX_SGI_swap_control +#endif + +#ifndef GLX_SGI_video_sync +#endif + +#ifndef GLX_SGI_make_current_read +#endif + +#ifndef GLX_SGIX_video_source +#endif + +#ifndef GLX_EXT_visual_rating +#define GLX_VISUAL_CAVEAT_EXT 0x20 +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D +/* reuse GLX_NONE_EXT */ +#endif + +#ifndef GLX_EXT_import_context +#define GLX_SHARE_CONTEXT_EXT 0x800A +#define GLX_VISUAL_ID_EXT 0x800B +#define GLX_SCREEN_EXT 0x800C +#endif + +#ifndef GLX_SGIX_fbconfig +#define GLX_WINDOW_BIT_SGIX 0x00000001 +#define GLX_PIXMAP_BIT_SGIX 0x00000002 +#define GLX_RGBA_BIT_SGIX 0x00000001 +#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 +#define GLX_DRAWABLE_TYPE_SGIX 0x8010 +#define GLX_RENDER_TYPE_SGIX 0x8011 +#define GLX_X_RENDERABLE_SGIX 0x8012 +#define GLX_FBCONFIG_ID_SGIX 0x8013 +#define GLX_RGBA_TYPE_SGIX 0x8014 +#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 +/* reuse GLX_SCREEN_EXT */ +#endif + +#ifndef GLX_SGIX_pbuffer +#define GLX_PBUFFER_BIT_SGIX 0x00000004 +#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 +#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 +#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 +#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 +#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 +#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 +#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 +#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 +#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 +#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 +#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A +#define GLX_PRESERVED_CONTENTS_SGIX 0x801B +#define GLX_LARGEST_PBUFFER_SGIX 0x801C +#define GLX_WIDTH_SGIX 0x801D +#define GLX_HEIGHT_SGIX 0x801E +#define GLX_EVENT_MASK_SGIX 0x801F +#define GLX_DAMAGED_SGIX 0x8020 +#define GLX_SAVED_SGIX 0x8021 +#define GLX_WINDOW_SGIX 0x8022 +#define GLX_PBUFFER_SGIX 0x8023 +#endif + +#ifndef GLX_SGI_cushion +#endif + +#ifndef GLX_SGIX_video_resize +#define GLX_SYNC_FRAME_SGIX 0x00000000 +#define GLX_SYNC_SWAP_SGIX 0x00000001 +#endif + +#ifndef GLX_SGIX_dmbuffer +#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024 +#endif + +#ifndef GLX_SGIX_swap_group +#endif + +#ifndef GLX_SGIX_swap_barrier +#endif + +#ifndef GLX_SGIS_blended_overlay +#define GLX_BLENDED_RGBA_SGIS 0x8025 +#endif + +#ifndef GLX_SGIS_shared_multisample +#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 +#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 +#endif + +#ifndef GLX_SUN_get_transparent_index +#endif + +#ifndef GLX_3DFX_multisample +#define GLX_SAMPLE_BUFFERS_3DFX 0x8050 +#define GLX_SAMPLES_3DFX 0x8051 +#endif + +#ifndef GLX_MESA_copy_sub_buffer +#endif + +#ifndef GLX_MESA_pixmap_colormap +#endif + +#ifndef GLX_MESA_release_buffers +#endif + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_3DFX_WINDOW_MODE_MESA 0x1 +#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 +#endif + +#ifndef GLX_SGIX_visual_select_group +#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 +#endif + +#ifndef GLX_OML_swap_method +#define GLX_SWAP_METHOD_OML 0x8060 +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 +#endif + +#ifndef GLX_OML_sync_control +#endif + +#ifndef GLX_SGIX_hyperpipe_group +#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80 +#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91 +#define GLX_BAD_HYPERPIPE_SGIX 92 +#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001 +#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002 +#define GLX_PIPE_RECT_SGIX 0x00000001 +#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002 +#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003 +#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004 +#define GLX_HYPERPIPE_ID_SGIX 0x8030 +#endif + +#ifndef GLX_MESA_agp_offset +#endif + + +/*************************************************************/ + +#ifndef GLX_ARB_get_proc_address +typedef void (*__GLXextFuncPtr)(void); +#endif + +#ifndef GLX_SGIX_video_source +typedef XID GLXVideoSourceSGIX; +#endif + +#ifndef GLX_SGIX_fbconfig +typedef XID GLXFBConfigIDSGIX; +typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; +#endif + +#ifndef GLX_SGIX_pbuffer +typedef XID GLXPbufferSGIX; +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came for SendEvent request */ + Display *display; /* display the event was read from */ + GLXDrawable drawable; /* i.d. of Drawable */ + int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */ + int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */ + unsigned int mask; /* mask indicating which buffers are affected*/ + int x, y; + int width, height; + int count; /* if nonzero, at least this many more */ +} GLXBufferClobberEventSGIX; +#endif + +#if defined(__sun__) +#include +#if defined(__STDC__) +#if defined(__arch64__) +typedef long int int64_t; +#else +typedef long long int int64_t; +#endif /* __arch64__ */ +#endif /* __STDC__ */ +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +#elif defined( __VMS ) +#include +#elif defined(__SCO__) || defined(__USLC__) +#include +#elif defined(WIN32) && defined(__GNUC__) +#include +#endif + +#ifndef GLX_VERSION_1_3 +#define GLX_VERSION_1_3 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXFBConfig * glXGetFBConfigs (Display *, int, int *); +extern GLXFBConfig * glXChooseFBConfig (Display *, int, const int *, int *); +extern int glXGetFBConfigAttrib (Display *, GLXFBConfig, int, int *); +extern XVisualInfo * glXGetVisualFromFBConfig (Display *, GLXFBConfig); +extern GLXWindow glXCreateWindow (Display *, GLXFBConfig, Window, const int *); +extern void glXDestroyWindow (Display *, GLXWindow); +extern GLXPixmap glXCreatePixmap (Display *, GLXFBConfig, Pixmap, const int *); +extern void glXDestroyPixmap (Display *, GLXPixmap); +extern GLXPbuffer glXCreatePbuffer (Display *, GLXFBConfig, const int *); +extern void glXDestroyPbuffer (Display *, GLXPbuffer); +extern void glXQueryDrawable (Display *, GLXDrawable, int, unsigned int *); +extern GLXContext glXCreateNewContext (Display *, GLXFBConfig, int, GLXContext, Bool); +extern Bool glXMakeContextCurrent (Display *, GLXDrawable, GLXDrawable, GLXContext); +extern GLXDrawable glXGetCurrentReadDrawable (void); +extern Display * glXGetCurrentDisplay (void); +extern int glXQueryContext (Display *, GLXContext, int, int *); +extern void glXSelectEvent (Display *, GLXDrawable, unsigned long); +extern void glXGetSelectedEvent (Display *, GLXDrawable, unsigned long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); +typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); +typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); +typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); +typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); +typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); +typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); +typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); +typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); +typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); +typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); +typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void); +typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void); +typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); +typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); +typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); +#endif + +#ifndef GLX_VERSION_1_4 +#define GLX_VERSION_1_4 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName); +#endif + +#ifndef GLX_ARB_get_proc_address +#define GLX_ARB_get_proc_address 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName); +#endif + +#ifndef GLX_ARB_multisample +#define GLX_ARB_multisample 1 +#endif + +#ifndef GLX_SGIS_multisample +#define GLX_SGIS_multisample 1 +#endif + +#ifndef GLX_EXT_visual_info +#define GLX_EXT_visual_info 1 +#endif + +#ifndef GLX_SGI_swap_control +#define GLX_SGI_swap_control 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXSwapIntervalSGI (int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval); +#endif + +#ifndef GLX_SGI_video_sync +#define GLX_SGI_video_sync 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXGetVideoSyncSGI (unsigned int *); +extern int glXWaitVideoSyncSGI (int, int, unsigned int *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count); +typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count); +#endif + +#ifndef GLX_SGI_make_current_read +#define GLX_SGI_make_current_read 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXMakeCurrentReadSGI (Display *, GLXDrawable, GLXDrawable, GLXContext); +extern GLXDrawable glXGetCurrentReadDrawableSGI (void); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void); +#endif + +#ifndef GLX_SGIX_video_source +#define GLX_SGIX_video_source 1 +#ifdef _VL_H +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *, int, VLServer, VLPath, int, VLNode); +extern void glXDestroyGLXVideoSourceSGIX (Display *, GLXVideoSourceSGIX); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXVideoSourceSGIX ( * PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); +typedef void ( * PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource); +#endif /* _VL_H */ +#endif + +#ifndef GLX_EXT_visual_rating +#define GLX_EXT_visual_rating 1 +#endif + +#ifndef GLX_EXT_import_context +#define GLX_EXT_import_context 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Display * glXGetCurrentDisplayEXT (void); +extern int glXQueryContextInfoEXT (Display *, GLXContext, int, int *); +extern GLXContextID glXGetContextIDEXT (const GLXContext); +extern GLXContext glXImportContextEXT (Display *, GLXContextID); +extern void glXFreeContextEXT (Display *, GLXContext); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void); +typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value); +typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context); +typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID); +typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context); +#endif + +#ifndef GLX_SGIX_fbconfig +#define GLX_SGIX_fbconfig 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXGetFBConfigAttribSGIX (Display *, GLXFBConfigSGIX, int, int *); +extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *, int, int *, int *); +extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *, GLXFBConfigSGIX, Pixmap); +extern GLXContext glXCreateContextWithConfigSGIX (Display *, GLXFBConfigSGIX, int, GLXContext, Bool); +extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *, GLXFBConfigSGIX); +extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *, XVisualInfo *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); +typedef GLXFBConfigSGIX * ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements); +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); +typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); +typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config); +typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis); +#endif + +#ifndef GLX_SGIX_pbuffer +#define GLX_SGIX_pbuffer 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *); +extern void glXDestroyGLXPbufferSGIX (Display *, GLXPbufferSGIX); +extern int glXQueryGLXPbufferSGIX (Display *, GLXPbufferSGIX, int, unsigned int *); +extern void glXSelectEventSGIX (Display *, GLXDrawable, unsigned long); +extern void glXGetSelectedEventSGIX (Display *, GLXDrawable, unsigned long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); +typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf); +typedef int ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); +typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask); +typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask); +#endif + +#ifndef GLX_SGI_cushion +#define GLX_SGI_cushion 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXCushionSGI (Display *, Window, float); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion); +#endif + +#ifndef GLX_SGIX_video_resize +#define GLX_SGIX_video_resize 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXBindChannelToWindowSGIX (Display *, int, int, Window); +extern int glXChannelRectSGIX (Display *, int, int, int, int, int, int); +extern int glXQueryChannelRectSGIX (Display *, int, int, int *, int *, int *, int *); +extern int glXQueryChannelDeltasSGIX (Display *, int, int, int *, int *, int *, int *); +extern int glXChannelRectSyncSGIX (Display *, int, int, GLenum); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window); +typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h); +typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); +typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h); +typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype); +#endif + +#ifndef GLX_SGIX_dmbuffer +#define GLX_SGIX_dmbuffer 1 +#ifdef _DM_BUFFER_H_ +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXAssociateDMPbufferSGIX (Display *, GLXPbufferSGIX, DMparams *, DMbuffer); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); +#endif /* _DM_BUFFER_H_ */ +#endif + +#ifndef GLX_SGIX_swap_group +#define GLX_SGIX_swap_group 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXJoinSwapGroupSGIX (Display *, GLXDrawable, GLXDrawable); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); +#endif + +#ifndef GLX_SGIX_swap_barrier +#define GLX_SGIX_swap_barrier 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXBindSwapBarrierSGIX (Display *, GLXDrawable, int); +extern Bool glXQueryMaxSwapBarriersSGIX (Display *, int, int *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); +typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); +#endif + +#ifndef GLX_SUN_get_transparent_index +#define GLX_SUN_get_transparent_index 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Status glXGetTransparentIndexSUN (Display *, Window, Window, long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); +#endif + +#ifndef GLX_MESA_copy_sub_buffer +#define GLX_MESA_copy_sub_buffer 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXCopySubBufferMESA (Display *, GLXDrawable, int, int, int, int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); +#endif + +#ifndef GLX_MESA_pixmap_colormap +#define GLX_MESA_pixmap_colormap 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXPixmap glXCreateGLXPixmapMESA (Display *, XVisualInfo *, Pixmap, Colormap); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); +#endif + +#ifndef GLX_MESA_release_buffers +#define GLX_MESA_release_buffers 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXReleaseBuffersMESA (Display *, GLXDrawable); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable); +#endif + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_MESA_set_3dfx_mode 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXSet3DfxModeMESA (int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode); +#endif + +#ifndef GLX_SGIX_visual_select_group +#define GLX_SGIX_visual_select_group 1 +#endif + +#ifndef GLX_OML_swap_method +#define GLX_OML_swap_method 1 +#endif + +#ifndef GLX_OML_sync_control +#define GLX_OML_sync_control 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXGetSyncValuesOML (Display *, GLXDrawable, int64_t *, int64_t *, int64_t *); +extern Bool glXGetMscRateOML (Display *, GLXDrawable, int32_t *, int32_t *); +extern int64_t glXSwapBuffersMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t); +extern Bool glXWaitForMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t, int64_t *, int64_t *, int64_t *); +extern Bool glXWaitForSbcOML (Display *, GLXDrawable, int64_t, int64_t *, int64_t *, int64_t *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc); +typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator); +typedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); +typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc); +typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc); +#endif + +#ifndef GLX_SGIX_hyperpipe_group +#define GLX_SGIX_hyperpipe_group 1 + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int networkId; +} GLXHyperpipeNetworkSGIX; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int channel; + unsigned int + participationType; + int timeSlice; +} GLXHyperpipeConfigSGIX; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int srcXOrigin, srcYOrigin, srcWidth, srcHeight; + int destXOrigin, destYOrigin, destWidth, destHeight; +} GLXPipeRect; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int XOrigin, YOrigin, maxHeight, maxWidth; +} GLXPipeRectLimits; + +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXHyperpipeNetworkSGIX * glXQueryHyperpipeNetworkSGIX (Display *, int *); +extern int glXHyperpipeConfigSGIX (Display *, int, int, GLXHyperpipeConfigSGIX *, int *); +extern GLXHyperpipeConfigSGIX * glXQueryHyperpipeConfigSGIX (Display *, int, int *); +extern int glXDestroyHyperpipeConfigSGIX (Display *, int); +extern int glXBindHyperpipeSGIX (Display *, int); +extern int glXQueryHyperpipeBestAttribSGIX (Display *, int, int, int, void *, void *); +extern int glXHyperpipeAttribSGIX (Display *, int, int, int, void *); +extern int glXQueryHyperpipeAttribSGIX (Display *, int, int, int, void *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes); +typedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId); +typedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes); +typedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId); +typedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId); +typedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList); +typedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList); +typedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList); +#endif + +#ifndef GLX_MESA_agp_offset +#define GLX_MESA_agp_offset 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern unsigned int glXGetAGPOffsetMESA (const void *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/dll/mesa32/include/GL/internal/dri_interface.h b/reactos/dll/mesa32/include/GL/internal/dri_interface.h new file mode 100644 index 00000000000..e63415db026 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/internal/dri_interface.h @@ -0,0 +1,478 @@ +/* + * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + * (C) Copyright IBM Corporation 2004 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * 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 + * THE COPYRIGHT HOLDERS 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. + */ + +/** + * \file dri_interface.h + * + * This file contains all the types and functions that define the interface + * between a DRI driver and driver loader. Currently, the most common driver + * loader is the XFree86 libGL.so. However, other loaders do exist, and in + * the future the server-side libglx.a will also be a loader. + * + * \author Kevin E. Martin + * \author Ian Romanick + */ + +#ifndef DRI_INTERFACE_H +#define DRI_INTERFACE_H + +#include +#include +#include + +/** + * \name DRI interface structures + * + * The following structures define the interface between the GLX client + * side library and the DRI (direct rendering infrastructure). + */ +/*@{*/ +typedef struct __DRIdisplayRec __DRIdisplay; +typedef struct __DRIscreenRec __DRIscreen; +typedef struct __DRIcontextRec __DRIcontext; +typedef struct __DRIdrawableRec __DRIdrawable; +typedef struct __DRIdriverRec __DRIdriver; +typedef struct __DRIframebufferRec __DRIframebuffer; +typedef struct __DRIversionRec __DRIversion; +typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods; +typedef unsigned long __DRIid; +typedef void __DRInativeDisplay; +/*@}*/ + + +/** + * \name Functions provided by the driver loader. + */ +/*@{*/ +/** + * Type of a pointer to \c glXGetScreenDriver, as returned by + * \c glXGetProcAddress. This function is used to get the name of the DRI + * driver for the specified screen of the specified display. The driver + * name is typically used with \c glXGetDriverConfig. + * + * \sa glXGetScreenDriver, glXGetProcAddress, glXGetDriverConfig + */ +typedef const char * (* PFNGLXGETSCREENDRIVERPROC) (__DRInativeDisplay *dpy, int scrNum); + +/** + * Type of a pointer to \c glXGetDriverConfig, as returned by + * \c glXGetProcAddress. This function is used to get the XML document + * describing the configuration options available for the specified driver. + * + * \sa glXGetDriverConfig, glXGetProcAddress, glXGetScreenDriver + */ +typedef const char * (* PFNGLXGETDRIVERCONFIGPROC) (const char *driverName); + +/** + * Type of a pointer to \c glxEnableExtension, as returned by + * \c __DRIinterfaceMethods::getProcAddress. This function is used to enable + * a GLX extension on the specified screen. + */ +typedef void (* PFNGLXSCRENABLEEXTENSIONPROC) ( void *psc, const char * name ); +/*@}*/ + + +/** + * \name Functions and data provided by the driver. + */ +/*@{*/ + +typedef void *(CREATENEWSCREENFUNC)(__DRInativeDisplay *dpy, int scrn, + __DRIscreen *psc, const __GLcontextModes * modes, + const __DRIversion * ddx_version, const __DRIversion * dri_version, + const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer, + void * pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes); +typedef CREATENEWSCREENFUNC* PFNCREATENEWSCREENFUNC; +extern CREATENEWSCREENFUNC __driCreateNewScreen_20050727; + + +/** + * XML document describing the configuration options supported by the + * driver. + */ +extern const char __driConfigOptions[]; + +/*@}*/ + + +/** + * Stored version of some component (i.e., server-side DRI module, kernel-side + * DRM, etc.). + * + * \todo + * There are several data structures that explicitly store a major version, + * minor version, and patch level. These structures should be modified to + * have a \c __DRIversionRec instead. + */ +struct __DRIversionRec { + int major; /**< Major version number. */ + int minor; /**< Minor version number. */ + int patch; /**< Patch-level. */ +}; + + +typedef void (*__DRIfuncPtr)(void); + +struct __DRIinterfaceMethodsRec { + /** + * Get pointer to named function. + */ + __DRIfuncPtr (*getProcAddress)( const char * proc_name ); + + /** + * Create a list of \c __GLcontextModes structures. + */ + __GLcontextModes * (*createContextModes)(unsigned count, + size_t minimum_bytes_per_struct); + + /** + * Destroy a list of \c __GLcontextModes structures. + * + * \todo + * Determine if the drivers actually need to call this. + */ + void (*destroyContextModes)( __GLcontextModes * modes ); + + /** + * Get the \c __DRIscreen for a given display and screen number. + */ + __DRIscreen *(*getScreen)(__DRInativeDisplay *dpy, int screenNum); + + + /** + * \name Client/server protocol functions. + * + * These functions implement the DRI client/server protocol for + * context and drawable operations. Platforms that do not implement + * the wire protocol (e.g., EGL) will implement glorified no-op functions. + */ + /*@{*/ + /** + * Determine if the specified window ID still exists. + * + * \note + * Implementations may assume that the driver will only pass an ID into + * this function that actually corresponds to a window. On + * implementations where windows can only be destroyed by the DRI driver + * (e.g., EGL), this function is allowed to always return \c GL_TRUE. + */ + GLboolean (*windowExists)(__DRInativeDisplay *dpy, __DRIid draw); + + /** + * Create the server-side portion of the GL context. + */ + GLboolean (* createContext)( __DRInativeDisplay *dpy, int screenNum, + int configID, void * contextID, drm_context_t * hw_context ); + + /** + * Destroy the server-side portion of the GL context. + */ + GLboolean (* destroyContext)( __DRInativeDisplay *dpy, int screenNum, + __DRIid context ); + + /** + * Create the server-side portion of the drawable. + */ + GLboolean (*createDrawable)( __DRInativeDisplay * ndpy, int screen, + __DRIid drawable, drm_drawable_t * hHWDrawable ); + + /** + * Destroy the server-side portion of the drawable. + */ + GLboolean (*destroyDrawable)( __DRInativeDisplay * ndpy, int screen, + __DRIid drawable ); + + /** + * This function is used to get information about the position, size, and + * clip rects of a drawable. + */ + GLboolean (* getDrawableInfo) ( __DRInativeDisplay *dpy, int scrn, + __DRIid draw, unsigned int * index, unsigned int * stamp, + int * x, int * y, int * width, int * height, + int * numClipRects, drm_clip_rect_t ** pClipRects, + int * backX, int * backY, + int * numBackClipRects, drm_clip_rect_t ** pBackClipRects ); + /*@}*/ + + + /** + * \name Timing related functions. + */ + /*@{*/ + /** + * Get the 64-bit unadjusted system time (UST). + */ + int (*getUST)(int64_t * ust); + + /** + * Get the media stream counter (MSC) rate. + * + * Matching the definition in GLX_OML_sync_control, this function returns + * the rate of the "media stream counter". In practical terms, this is + * the frame refresh rate of the display. + */ + GLboolean (*getMSCRate)(__DRInativeDisplay * dpy, __DRIid drawable, + int32_t * numerator, int32_t * denominator); + /*@}*/ +}; + + +/** + * Framebuffer information record. Used by libGL to communicate information + * about the framebuffer to the driver's \c __driCreateNewScreen function. + * + * In XFree86, most of this information is derrived from data returned by + * calling \c XF86DRIGetDeviceInfo. + * + * \sa XF86DRIGetDeviceInfo __DRIdisplayRec::createNewScreen + * __driUtilCreateNewScreen CallCreateNewScreen + * + * \bug This structure could be better named. + */ +struct __DRIframebufferRec { + unsigned char *base; /**< Framebuffer base address in the CPU's + * address space. This value is calculated by + * calling \c drmMap on the framebuffer handle + * returned by \c XF86DRIGetDeviceInfo (or a + * similar function). + */ + int size; /**< Framebuffer size, in bytes. */ + int stride; /**< Number of bytes from one line to the next. */ + int width; /**< Pixel width of the framebuffer. */ + int height; /**< Pixel height of the framebuffer. */ + int dev_priv_size; /**< Size of the driver's dev-priv structure. */ + void *dev_priv; /**< Pointer to the driver's dev-priv structure. */ +}; + + +/** + * Screen dependent methods. This structure is initialized during the + * \c __DRIdisplayRec::createScreen call. + */ +struct __DRIscreenRec { + /** + * Method to destroy the private DRI screen data. + */ + void (*destroyScreen)(__DRInativeDisplay *dpy, int scrn, void *screenPrivate); + + /** + * Method to create the private DRI drawable data and initialize the + * drawable dependent methods. + */ + void *(*createNewDrawable)(__DRInativeDisplay *dpy, const __GLcontextModes *modes, + __DRIid draw, __DRIdrawable *pdraw, + int renderType, const int *attrs); + + /** + * Method to return a pointer to the DRI drawable data. + */ + __DRIdrawable *(*getDrawable)(__DRInativeDisplay *dpy, __DRIid draw, + void *drawablePrivate); + + /** + * Opaque pointer to private per screen direct rendering data. \c NULL + * if direct rendering is not supported on this screen. Never + * dereferenced in libGL. + */ + void *private; + + /** + * Get the number of vertical refreshes since some point in time before + * this function was first called (i.e., system start up). + * + * \since Internal API version 20030317. + */ + int (*getMSC)( void *screenPrivate, int64_t *msc ); + + /** + * Opaque pointer that points back to the containing + * \c __GLXscreenConfigs. This data structure is shared with DRI drivers + * but \c __GLXscreenConfigs is not. However, they are needed by some GLX + * functions called by DRI drivers. + * + * \since Internal API version 20030813. + */ + void *screenConfigs; + + /** + * Functions associated with MESA_allocate_memory. + * + * \since Internal API version 20030815. + */ + /*@{*/ + void *(*allocateMemory)(__DRInativeDisplay *dpy, int scrn, GLsizei size, + GLfloat readfreq, GLfloat writefreq, + GLfloat priority); + + void (*freeMemory)(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer); + + GLuint (*memoryOffset)(__DRInativeDisplay *dpy, int scrn, const GLvoid *pointer); + /*@}*/ + + /** + * Method to create the private DRI context data and initialize the + * context dependent methods. + * + * \since Internal API version 20031201. + */ + void * (*createNewContext)(__DRInativeDisplay *dpy, const __GLcontextModes *modes, + int render_type, + void *sharedPrivate, __DRIcontext *pctx); +}; + +/** + * Context dependent methods. This structure is initialized during the + * \c __DRIscreenRec::createContext call. + */ +struct __DRIcontextRec { + /** + * Method to destroy the private DRI context data. + */ + void (*destroyContext)(__DRInativeDisplay *dpy, int scrn, void *contextPrivate); + + /** + * Opaque pointer to private per context direct rendering data. + * \c NULL if direct rendering is not supported on the display or + * screen used to create this context. Never dereferenced in libGL. + */ + void *private; + + /** + * Pointer to the mode used to create this context. + * + * \since Internal API version 20040317. + */ + const __GLcontextModes * mode; + + /** + * Method to bind a DRI drawable to a DRI graphics context. + * + * \since Internal API version 20050727. + */ + GLboolean (*bindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw, + __DRIid read, __DRIcontext *ctx); + + /** + * Method to unbind a DRI drawable from a DRI graphics context. + * + * \since Internal API version 20050727. + */ + GLboolean (*unbindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw, + __DRIid read, __DRIcontext *ctx); +}; + +/** + * Drawable dependent methods. This structure is initialized during the + * \c __DRIscreenRec::createDrawable call. \c createDrawable is not called + * by libGL at this time. It's currently used via the dri_util.c utility code + * instead. + */ +struct __DRIdrawableRec { + /** + * Method to destroy the private DRI drawable data. + */ + void (*destroyDrawable)(__DRInativeDisplay *dpy, void *drawablePrivate); + + /** + * Method to swap the front and back buffers. + */ + void (*swapBuffers)(__DRInativeDisplay *dpy, void *drawablePrivate); + + /** + * Opaque pointer to private per drawable direct rendering data. + * \c NULL if direct rendering is not supported on the display or + * screen used to create this drawable. Never dereferenced in libGL. + */ + void *private; + + /** + * Get the number of completed swap buffers for this drawable. + * + * \since Internal API version 20030317. + */ + int (*getSBC)(__DRInativeDisplay *dpy, void *drawablePrivate, int64_t *sbc ); + + /** + * Wait for the SBC to be greater than or equal target_sbc. + * + * \since Internal API version 20030317. + */ + int (*waitForSBC)( __DRInativeDisplay * dpy, void *drawablePriv, + int64_t target_sbc, + int64_t * msc, int64_t * sbc ); + + /** + * Wait for the MSC to equal target_msc, or, if that has already passed, + * the next time (MSC % divisor) is equal to remainder. If divisor is + * zero, the function will return as soon as MSC is greater than or equal + * to target_msc. + * + * \since Internal API version 20030317. + */ + int (*waitForMSC)( __DRInativeDisplay * dpy, void *drawablePriv, + int64_t target_msc, int64_t divisor, int64_t remainder, + int64_t * msc, int64_t * sbc ); + + /** + * Like \c swapBuffers, but does NOT have an implicit \c glFlush. Once + * rendering is complete, waits until MSC is equal to target_msc, or + * if that has already passed, waits until (MSC % divisor) is equal + * to remainder. If divisor is zero, the swap will happen as soon as + * MSC is greater than or equal to target_msc. + * + * \since Internal API version 20030317. + */ + int64_t (*swapBuffersMSC)(__DRInativeDisplay *dpy, void *drawablePrivate, + int64_t target_msc, + int64_t divisor, int64_t remainder); + + /** + * Enable or disable frame usage tracking. + * + * \since Internal API version 20030317. + */ + int (*frameTracking)(__DRInativeDisplay *dpy, void *drawablePrivate, GLboolean enable); + + /** + * Retrieve frame usage information. + * + * \since Internal API version 20030317. + */ + int (*queryFrameTracking)(__DRInativeDisplay *dpy, void *drawablePrivate, + int64_t * sbc, int64_t * missedFrames, + float * lastMissedUsage, float * usage ); + + /** + * Used by drivers that implement the GLX_SGI_swap_control or + * GLX_MESA_swap_control extension. + * + * \since Internal API version 20030317. + */ + unsigned swap_interval; +}; + +#endif diff --git a/reactos/dll/mesa32/include/GL/internal/glcore.h b/reactos/dll/mesa32/include/GL/internal/glcore.h new file mode 100644 index 00000000000..48748d91e8f --- /dev/null +++ b/reactos/dll/mesa32/include/GL/internal/glcore.h @@ -0,0 +1,498 @@ +/* $XFree86: xc/lib/GL/include/GL/internal/glcore.h,v 1.7 2001/03/25 05:32:00 tsi Exp $ */ +#ifndef __gl_core_h_ +#define __gl_core_h_ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#ifndef XFree86LOADER +#include +#endif + +#ifdef CAPI +#undef CAPI +#endif +#define CAPI + +#define GL_CORE_SGI 1 +#define GL_CORE_MESA 2 +#define GL_CORE_APPLE 4 + +typedef struct __GLcontextRec __GLcontext; +typedef struct __GLinterfaceRec __GLinterface; + +/* +** This file defines the interface between the GL core and the surrounding +** "operating system" that supports it (currently the GLX or WGL extensions). +** +** Members (data and function pointers) are documented as imported or +** exported according to how they are used by the core rendering functions. +** Imported members are initialized by the "operating system" and used by +** the core functions. Exported members are initialized by the core functions +** and used by the "operating system". +*/ + +/* +** Mode and limit information for a context. This information is +** kept around in the context so that values can be used during +** command execution, and for returning information about the +** context to the application. +*/ +typedef struct __GLcontextModesRec { + struct __GLcontextModesRec * next; + + GLboolean rgbMode; + GLboolean floatMode; + GLboolean colorIndexMode; + GLuint doubleBufferMode; + GLuint stereoMode; + + GLboolean haveAccumBuffer; + GLboolean haveDepthBuffer; + GLboolean haveStencilBuffer; + + GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ + GLuint redMask, greenMask, blueMask, alphaMask; + GLint rgbBits; /* total bits for rgb */ + GLint indexBits; /* total bits for colorindex */ + + GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; + GLint depthBits; + GLint stencilBits; + + GLint numAuxBuffers; + + GLint level; + + GLint pixmapMode; + + /* GLX */ + GLint visualID; + GLint visualType; /**< One of the GLX X visual types. (i.e., + * \c GLX_TRUE_COLOR, etc.) + */ + + /* EXT_visual_rating / GLX 1.2 */ + GLint visualRating; + + /* EXT_visual_info / GLX 1.2 */ + GLint transparentPixel; + /* colors are floats scaled to ints */ + GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha; + GLint transparentIndex; + + /* ARB_multisample / SGIS_multisample */ + GLint sampleBuffers; + GLint samples; + + /* SGIX_fbconfig / GLX 1.3 */ + GLint drawableType; + GLint renderType; + GLint xRenderable; + GLint fbconfigID; + + /* SGIX_pbuffer / GLX 1.3 */ + GLint maxPbufferWidth; + GLint maxPbufferHeight; + GLint maxPbufferPixels; + GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */ + GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */ + + /* SGIX_visual_select_group */ + GLint visualSelectGroup; + + /* OML_swap_method */ + GLint swapMethod; + + GLint screen; +} __GLcontextModes; + +/* Several fields of __GLcontextModes can take these as values. Since + * GLX header files may not be available everywhere they need to be used, + * redefine them here. + */ +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 + +#define GLX_DONT_CARE 0xFFFFFFFF + +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 + +/************************************************************************/ + +/* +** Structure used for allocating and freeing drawable private memory. +** (like software buffers, for example). +** +** The memory allocation routines are provided by the surrounding +** "operating system" code, and they are to be used for allocating +** software buffers and things which are associated with the drawable, +** and used by any context which draws to that drawable. There are +** separate memory allocation functions for drawables and contexts +** since drawables and contexts can be created and destroyed independently +** of one another, and the "operating system" may want to use separate +** allocation arenas for each. +** +** The freePrivate function is filled in by the core routines when they +** allocates software buffers, and stick them in "private". The freePrivate +** function will destroy anything allocated to this drawable (to be called +** when the drawable is destroyed). +*/ +typedef struct __GLdrawableRegionRec __GLdrawableRegion; +typedef struct __GLdrawableBufferRec __GLdrawableBuffer; +typedef struct __GLdrawablePrivateRec __GLdrawablePrivate; + +typedef struct __GLregionRectRec { + /* lower left (inside the rectangle) */ + GLint x0, y0; + /* upper right (outside the rectangle) */ + GLint x1, y1; +} __GLregionRect; + +struct __GLdrawableRegionRec { + GLint numRects; + __GLregionRect *rects; + __GLregionRect boundingRect; +}; + +/************************************************************************/ + +/* masks for the buffers */ +#define __GL_FRONT_BUFFER_MASK 0x00000001 +#define __GL_FRONT_LEFT_BUFFER_MASK 0x00000001 +#define __GL_FRONT_RIGHT_BUFFER_MASK 0x00000002 +#define __GL_BACK_BUFFER_MASK 0x00000004 +#define __GL_BACK_LEFT_BUFFER_MASK 0x00000004 +#define __GL_BACK_RIGHT_BUFFER_MASK 0x00000008 +#define __GL_ACCUM_BUFFER_MASK 0x00000010 +#define __GL_DEPTH_BUFFER_MASK 0x00000020 +#define __GL_STENCIL_BUFFER_MASK 0x00000040 +#define __GL_AUX_BUFFER_MASK(i) (0x0000080 << (i)) + +#define __GL_ALL_BUFFER_MASK 0xffffffff + +/* what Resize routines return if resize resorted to fallback case */ +#define __GL_BUFFER_FALLBACK 0x10 + +typedef void (*__GLbufFallbackInitFn)(__GLdrawableBuffer *buf, + __GLdrawablePrivate *glPriv, GLint bits); +typedef void (*__GLbufMainInitFn)(__GLdrawableBuffer *buf, + __GLdrawablePrivate *glPriv, GLint bits, + __GLbufFallbackInitFn back); + +/* +** A drawable buffer +** +** This data structure describes the context side of a drawable. +** +** According to the spec there could be multiple contexts bound to the same +** drawable at the same time (from different threads). In order to avoid +** multiple-access conflicts, locks are used to serialize access. When a +** thread needs to access (read or write) a member of the drawable, it takes +** a lock first. Some of the entries in the drawable are treated "mostly +** constant", so we take the freedom of allowing access to them without +** taking a lock (for optimization reasons). +** +** For more details regarding locking, see buffers.h in the GL core +*/ +struct __GLdrawableBufferRec { + /* + ** Buffer dimensions + */ + GLint width, height, depth; + + /* + ** Framebuffer base address + */ + void *base; + + /* + ** Framebuffer size (in bytes) + */ + GLuint size; + + /* + ** Size (in bytes) of each element in the framebuffer + */ + GLuint elementSize; + GLuint elementSizeLog2; + + /* + ** Element skip from one scanline to the next. + ** If the buffer is part of another buffer (for example, fullscreen + ** front buffer), outerWidth is the width of that buffer. + */ + GLint outerWidth; + + /* + ** outerWidth * elementSize + */ + GLint byteWidth; + + /* + ** Allocation/deallocation is done based on this handle. A handle + ** is conceptually different from the framebuffer 'base'. + */ + void *handle; + + /* imported */ + GLboolean (*resize)(__GLdrawableBuffer *buf, + GLint x, GLint y, GLuint width, GLuint height, + __GLdrawablePrivate *glPriv, GLuint bufferMask); + void (*lock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); + void (*unlock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); + void (*fill)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, + GLuint val, GLint x, GLint y, GLint w, GLint h); + void (*free)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); + + /* exported */ + void (*freePrivate)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); +#ifdef __cplusplus + void *privatePtr; +#else + void *private; +#endif + + /* private */ + void *other; /* implementation private data */ + __GLbufMainInitFn mainInit; + __GLbufFallbackInitFn fallbackInit; +}; + +/* +** The context side of the drawable private +*/ +struct __GLdrawablePrivateRec { + /* + ** Drawable Modes + */ + __GLcontextModes *modes; + + /* + ** Drawable size + */ + GLuint width, height; + + /* + ** Origin in screen coordinates of the drawable + */ + GLint xOrigin, yOrigin; +#ifdef __GL_ALIGNED_BUFFERS + /* + ** Drawable offset from screen origin + */ + GLint xOffset, yOffset; + + /* + ** Alignment restriction + */ + GLint xAlignment, yAlignment; +#endif + /* + ** Should we invert the y axis? + */ + GLint yInverted; + + /* + ** Mask specifying which buffers are renderable by the hw + */ + GLuint accelBufferMask; + + /* + ** the buffers themselves + */ + __GLdrawableBuffer frontBuffer; + __GLdrawableBuffer backBuffer; + __GLdrawableBuffer accumBuffer; + __GLdrawableBuffer depthBuffer; + __GLdrawableBuffer stencilBuffer; +#if defined(__GL_NUMBER_OF_AUX_BUFFERS) && (__GL_NUMBER_OF_AUX_BUFFERS > 0) + __GLdrawableBuffer *auxBuffer; +#endif + + __GLdrawableRegion ownershipRegion; + + /* + ** Lock for the drawable private structure + */ + void *lock; +#ifdef DEBUG + /* lock debugging info */ + int lockRefCount; + int lockLine[10]; + char *lockFile[10]; +#endif + + /* imported */ + void *(*malloc)(size_t size); + void *(*calloc)(size_t numElem, size_t elemSize); + void *(*realloc)(void *oldAddr, size_t newSize); + void (*free)(void *addr); + + GLboolean (*addSwapRect)(__GLdrawablePrivate *glPriv, + GLint x, GLint y, GLsizei width, GLsizei height); + void (*setClipRect)(__GLdrawablePrivate *glPriv, + GLint x, GLint y, GLsizei width, GLsizei height); + void (*updateClipRegion)(__GLdrawablePrivate *glPriv); + GLboolean (*resize)(__GLdrawablePrivate *glPriv); + void (*getDrawableSize)(__GLdrawablePrivate *glPriv, + GLint *x, GLint *y, GLuint *width, GLuint *height); + + void (*lockDP)(__GLdrawablePrivate *glPriv, __GLcontext *gc); + void (*unlockDP)(__GLdrawablePrivate *glPriv); + + /* exported */ +#ifdef __cplusplus + void *privatePtr; +#else + void *private; +#endif + void (*freePrivate)(__GLdrawablePrivate *); + + /* client data */ + void *other; +}; + +/* +** Macros to lock/unlock the drawable private +*/ +#if defined(DEBUG) +#define __GL_LOCK_DP(glPriv,gc) \ + (*(glPriv)->lockDP)(glPriv,gc); \ + (glPriv)->lockLine[(glPriv)->lockRefCount] = __LINE__; \ + (glPriv)->lockFile[(glPriv)->lockRefCount] = __FILE__; \ + (glPriv)->lockRefCount++ +#define __GL_UNLOCK_DP(glPriv) \ + (glPriv)->lockRefCount--; \ + (glPriv)->lockLine[(glPriv)->lockRefCount] = 0; \ + (glPriv)->lockFile[(glPriv)->lockRefCount] = NULL; \ + (*(glPriv)->unlockDP)(glPriv) +#else /* DEBUG */ +#define __GL_LOCK_DP(glPriv,gc) (*(glPriv)->lockDP)(glPriv,gc) +#define __GL_UNLOCK_DP(glPriv) (*(glPriv)->unlockDP)(glPriv) +#endif /* DEBUG */ + + +/* +** Procedures which are imported by the GL from the surrounding +** "operating system". Math functions are not considered part of the +** "operating system". +*/ +typedef struct __GLimportsRec { + /* Memory management */ + void * (*malloc)(__GLcontext *gc, size_t size); + void *(*calloc)(__GLcontext *gc, size_t numElem, size_t elemSize); + void *(*realloc)(__GLcontext *gc, void *oldAddr, size_t newSize); + void (*free)(__GLcontext *gc, void *addr); + + /* Error handling */ + void (*warning)(__GLcontext *gc, char *fmt); + void (*fatal)(__GLcontext *gc, char *fmt); + + /* other system calls */ + char *(CAPI *getenv)(__GLcontext *gc, const char *var); + int (CAPI *atoi)(__GLcontext *gc, const char *str); + int (CAPI *sprintf)(__GLcontext *gc, char *str, const char *fmt, ...); + void *(CAPI *fopen)(__GLcontext *gc, const char *path, const char *mode); + int (CAPI *fclose)(__GLcontext *gc, void *stream); + int (CAPI *fprintf)(__GLcontext *gc, void *stream, const char *fmt, ...); + + /* Drawing surface management */ + __GLdrawablePrivate *(*getDrawablePrivate)(__GLcontext *gc); + __GLdrawablePrivate *(*getReadablePrivate)(__GLcontext *gc); + + /* Operating system dependent data goes here */ + void *other; +} __GLimports; + +/************************************************************************/ + +/* +** Procedures which are exported by the GL to the surrounding "operating +** system" so that it can manage multiple GL context's. +*/ +typedef struct __GLexportsRec { + /* Context management (return GL_FALSE on failure) */ + GLboolean (*destroyContext)(__GLcontext *gc); + GLboolean (*loseCurrent)(__GLcontext *gc); + /* oldglPriv isn't used anymore, kept for backwards compatibility */ + GLboolean (*makeCurrent)(__GLcontext *gc); + GLboolean (*shareContext)(__GLcontext *gc, __GLcontext *gcShare); + GLboolean (*copyContext)(__GLcontext *dst, const __GLcontext *src, GLuint mask); + GLboolean (*forceCurrent)(__GLcontext *gc); + + /* Drawing surface notification callbacks */ + GLboolean (*notifyResize)(__GLcontext *gc); + void (*notifyDestroy)(__GLcontext *gc); + void (*notifySwapBuffers)(__GLcontext *gc); + + /* Dispatch table override control for external agents like libGLS */ + struct __GLdispatchStateRec* (*dispatchExec)(__GLcontext *gc); + void (*beginDispatchOverride)(__GLcontext *gc); + void (*endDispatchOverride)(__GLcontext *gc); +} __GLexports; + +/************************************************************************/ + +/* +** This must be the first member of a __GLcontext structure. This is the +** only part of a context that is exposed to the outside world; everything +** else is opaque. +*/ +struct __GLinterfaceRec { + __GLimports imports; + __GLexports exports; +}; + +extern __GLcontext *__glCoreCreateContext(__GLimports *, __GLcontextModes *); +extern void __glCoreNopDispatch(void); + +#endif /* __gl_core_h_ */ diff --git a/reactos/dll/mesa32/include/GL/internal/sarea.h b/reactos/dll/mesa32/include/GL/internal/sarea.h new file mode 100644 index 00000000000..77c16e0efe2 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/internal/sarea.h @@ -0,0 +1,94 @@ +/* $XFree86: xc/programs/Xserver/GL/dri/sarea.h,v 1.11 2002/10/30 12:52:03 alanh Exp $ */ +/** + * \file sarea.h + * SAREA definitions. + * + * \author Kevin E. Martin + * \author Jens Owen + * \author Rickard E. (Rik) Faith + */ + +/* + * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, 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 PRECISION INSIGHT 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. + */ + +/* $XFree86: xc/programs/Xserver/GL/dri/sarea.h,v 1.11 2002/10/30 12:52:03 alanh Exp $ */ + +#ifndef _SAREA_H_ +#define _SAREA_H_ + +#include "xf86drm.h" + +/* SAREA area needs to be at least a page */ +#if defined(__alpha__) +#define SAREA_MAX 0x2000 +#elif defined(__ia64__) +#define SAREA_MAX 0x10000 /* 64kB */ +#else +/* Intel 830M driver needs at least 8k SAREA */ +#define SAREA_MAX 0x2000 +#endif + +#define SAREA_MAX_DRAWABLES 256 + +#define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000 + +/** + * SAREA per drawable information. + * + * \sa _XF86DRISAREA. + */ +typedef struct _XF86DRISAREADrawable { + unsigned int stamp; + unsigned int flags; +} XF86DRISAREADrawableRec, *XF86DRISAREADrawablePtr; + +/** + * SAREA frame information. + * + * \sa _XF86DRISAREA. + */ +typedef struct _XF86DRISAREAFrame { + unsigned int x; + unsigned int y; + unsigned int width; + unsigned int height; + unsigned int fullscreen; +} XF86DRISAREAFrameRec, *XF86DRISAREAFramePtr; + +/** + * SAREA definition. + */ +typedef struct _XF86DRISAREA { + /** first thing is always the DRM locking structure */ + drmLock lock; + /** \todo Use readers/writer lock for drawable_lock */ + drmLock drawable_lock; + XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES]; + XF86DRISAREAFrameRec frame; + drm_context_t dummy_context; +} XF86DRISAREARec, *XF86DRISAREAPtr; + +#endif diff --git a/reactos/dll/mesa32/include/GL/mesa_wgl.h b/reactos/dll/mesa32/include/GL/mesa_wgl.h new file mode 100644 index 00000000000..21473763ed5 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/mesa_wgl.h @@ -0,0 +1,123 @@ +/* + * Mesa 3-D graphics library + * Version: 3.1 + * + * Copyright (C) 1999 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. + */ + + +/* prototypes for the Mesa WGL functions */ +/* relocated here so that I could make GLUT get them properly */ + +#define _mesa_wgl_h_ + +#ifndef _mesa_wgl_h_ +#define _mesa_wgl_h_ + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN32__)) +# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ +# define GLAPI __declspec(dllexport) +# define WGLAPI __declspec(dllexport) +# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ +# define GLAPI __declspec(dllimport) +# define WGLAPI __declspec(dllimport) +# else /* for use with static link lib build of Win32 edition only */ +# define GLAPI extern +# define WGLAPI __declspec(dllimport) +# endif /* _STATIC_MESA support */ +# define GLAPIENTRY __stdcall +#else +/* non-Windows compilation */ +# define GLAPI extern +# define GLAPIENTRY +#endif /* WIN32 / CYGWIN32 bracket */ + + +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) +#ifndef _GNU_H_WINDOWS32_FUNCTIONS +# ifdef UNICODE +# define wglUseFontBitmaps wglUseFontBitmapsW +# define wglUseFontOutlines wglUseFontOutlinesW +# else +# define wglUseFontBitmaps wglUseFontBitmapsA +# define wglUseFontOutlines wglUseFontOutlinesA +# endif /* !UNICODE */ +#endif /* _GNU_H_WINDOWS32_FUNCTIONS */ +typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; +typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; +typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR; +#endif + + +#ifdef _MSC_VER +# pragma warning( disable : 4615 ) /* pragma warning : unknown user warning type*/ +# pragma warning( push ) +# pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */ +#endif + +WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC); +WGLAPI int GLAPIENTRY wglMakeCurrent(HDC,HGLRC); +WGLAPI int GLAPIENTRY wglSetPixelFormat(HDC, int, const PIXELFORMATDESCRIPTOR *); +WGLAPI int GLAPIENTRY wglSwapBuffers(HDC hdc); +WGLAPI HDC GLAPIENTRY wglGetCurrentDC(void); +WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC); +WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int); +WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void); +WGLAPI PROC GLAPIENTRY wglGetProcAddress(const char*); +WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *); +WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int); +WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC); +WGLAPI int GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR); +WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR); +WGLAPI int GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *); +WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc); +WGLAPI int GLAPIENTRY wglMakeCurrent(HDC, HGLRC); +WGLAPI int GLAPIENTRY wglRealizeLayerPalette(HDC, int, int); +WGLAPI int GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *); +WGLAPI int GLAPIENTRY wglShareLists(HGLRC, HGLRC); +WGLAPI int GLAPIENTRY wglSwapLayerBuffers(HDC, unsigned int); +WGLAPI int GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, unsigned long); +WGLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long); +WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT); +WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT); +WGLAPI int GLAPIENTRY SwapBuffers(HDC); +WGLAPI int GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *); +WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR); +WGLAPI int GLAPIENTRY GetPixelFormat(HDC); +WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *); + +#ifdef _MSC_VER +# pragma warning( pop ) +#endif + +#ifdef __cplusplus +} +#endif + + +#endif /* _mesa_wgl_h_ */ diff --git a/reactos/dll/mesa32/include/GL/mglmesa.h b/reactos/dll/mesa32/include/GL/mglmesa.h new file mode 100644 index 00000000000..0f9f7895714 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/mglmesa.h @@ -0,0 +1,79 @@ +/**************************************************************************** +* +* Mesa bindings for SciTech MGL +* +* Copyright (C) 1996 SciTech Software. +* All rights reserved. +* +* Filename: mglmesa.h +* Version: Revision: 1.1.1.1 +* +* Language: ANSI C +* Environment: Any +* +* Description: Header file for the Mesa/OpenGL interface bindings for the +* SciTech MGL graphics library. Uses the MGL internal +* device context structures to get direct access to the +* high performance MGL rasterization functions for maximum +* performance. Utilizes the VESA VBE/AF Accelerator Functions +* via the MGL's accelerated device driver functions, as well +* as basic DirectDraw accelerated functions provided by the +* MGL. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Library General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public +* License along with this library; if not, write to the Free +* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +* +****************************************************************************/ + +#ifndef __MGLMESA_H +#define __MGLMESA_H + +#include "mgraph.h" + +/*------------------------- Function Prototypes ---------------------------*/ + +#ifdef __cplusplus +extern "C" { /* Use "C" linkage when in C++ mode */ +#endif + +#ifndef __WINDOWS__ +#define GLAPIENTRY +#endif + +#ifdef __WINDOWS__ +bool GLAPIENTRY MGLMesaInitDLL(MGLCallbacks *cb,char *version); +#endif +void GLAPIENTRY MGLMesaChooseVisual(MGLDC *dc,MGLVisual *visual); +bool GLAPIENTRY MGLMesaSetVisual(MGLDC *dc,MGLVisual *visual); +bool GLAPIENTRY MGLMesaCreateContext(MGLDC *dc,bool forceMemDC); +void GLAPIENTRY MGLMesaDestroyContext(MGLDC *dc); +void GLAPIENTRY MGLMesaMakeCurrent(MGLDC *dc); +void GLAPIENTRY MGLMesaSwapBuffers(MGLDC *dc,bool waitVRT); + +/* Palette manipulation support. The reason we provide palette manipulation + * routines is so that when rendering in double buffered modes with a + * software backbuffer, the palette for the backbuffer is kept consistent + * with the hardware front buffer. + */ + +void GLAPIENTRY MGLMesaSetPaletteEntry(MGLDC *dc,int entry,uchar red,uchar green,uchar blue); +void GLAPIENTRY MGLMesaSetPalette(MGLDC *dc,palette_t *pal,int numColors,int startIndex); +void GLAPIENTRY MGLMesaRealizePalette(MGLDC *dc,int numColors,int startIndex,int waitVRT); + +#ifdef __cplusplus +} /* End of "C" linkage for C++ */ +#endif /* __cplusplus */ + +#endif /* __MGLMESA_H */ diff --git a/reactos/dll/mesa32/include/GL/osmesa.h b/reactos/dll/mesa32/include/GL/osmesa.h new file mode 100644 index 00000000000..ef645905c4d --- /dev/null +++ b/reactos/dll/mesa32/include/GL/osmesa.h @@ -0,0 +1,280 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +/* + * Mesa Off-Screen rendering interface. + * + * This is an operating system and window system independent interface to + * Mesa which allows one to render images into a client-supplied buffer in + * main memory. Such images may manipulated or saved in whatever way the + * client wants. + * + * These are the API functions: + * OSMesaCreateContext - create a new Off-Screen Mesa rendering context + * OSMesaMakeCurrent - bind an OSMesaContext to a client's image buffer + * and make the specified context the current one. + * OSMesaDestroyContext - destroy an OSMesaContext + * OSMesaGetCurrentContext - return thread's current context ID + * OSMesaPixelStore - controls how pixels are stored in image buffer + * OSMesaGetIntegerv - return OSMesa state parameters + * + * + * The limits on the width and height of an image buffer are MAX_WIDTH and + * MAX_HEIGHT as defined in Mesa/src/config.h. Defaults are 1280 and 1024. + * You can increase them as needed but beware that many temporary arrays in + * Mesa are dimensioned by MAX_WIDTH or MAX_HEIGHT. + */ + + +#ifndef OSMESA_H +#define OSMESA_H + + +#ifdef __cplusplus +extern "C" { +#endif + + +#include + + +#define OSMESA_MAJOR_VERSION 6 +#define OSMESA_MINOR_VERSION 3 +#define OSMESA_PATCH_VERSION 0 + + + +/* + * Values for the format parameter of OSMesaCreateContext() + * New in version 2.0. + */ +#define OSMESA_COLOR_INDEX GL_COLOR_INDEX +#define OSMESA_RGBA GL_RGBA +#define OSMESA_BGRA 0x1 +#define OSMESA_ARGB 0x2 +#define OSMESA_RGB GL_RGB +#define OSMESA_BGR 0x4 +#define OSMESA_RGB_565 0x5 + + +/* + * OSMesaPixelStore() parameters: + * New in version 2.0. + */ +#define OSMESA_ROW_LENGTH 0x10 +#define OSMESA_Y_UP 0x11 + + +/* + * Accepted by OSMesaGetIntegerv: + */ +#define OSMESA_WIDTH 0x20 +#define OSMESA_HEIGHT 0x21 +#define OSMESA_FORMAT 0x22 +#define OSMESA_TYPE 0x23 +#define OSMESA_MAX_WIDTH 0x24 /* new in 4.0 */ +#define OSMESA_MAX_HEIGHT 0x25 /* new in 4.0 */ + + +typedef struct osmesa_context *OSMesaContext; + + +#if defined(__BEOS__) || defined(__QUICKDRAW__) +#pragma export on +#endif + + +/* + * Create an Off-Screen Mesa rendering context. The only attribute needed is + * an RGBA vs Color-Index mode flag. + * + * Input: format - one of OSMESA_COLOR_INDEX, OSMESA_RGBA, OSMESA_BGRA, + * OSMESA_ARGB, OSMESA_RGB, or OSMESA_BGR. + * sharelist - specifies another OSMesaContext with which to share + * display lists. NULL indicates no sharing. + * Return: an OSMesaContext or 0 if error + */ +GLAPI OSMesaContext GLAPIENTRY +OSMesaCreateContext( GLenum format, OSMesaContext sharelist ); + + + +/* + * Create an Off-Screen Mesa rendering context and specify desired + * size of depth buffer, stencil buffer and accumulation buffer. + * If you specify zero for depthBits, stencilBits, accumBits you + * can save some memory. + * + * New in Mesa 3.5 + */ +GLAPI OSMesaContext GLAPIENTRY +OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, + GLint accumBits, OSMesaContext sharelist); + + +/* + * Destroy an Off-Screen Mesa rendering context. + * + * Input: ctx - the context to destroy + */ +GLAPI void GLAPIENTRY +OSMesaDestroyContext( OSMesaContext ctx ); + + + +/* + * Bind an OSMesaContext to an image buffer. The image buffer is just a + * block of memory which the client provides. Its size must be at least + * as large as width*height*sizeof(type). Its address should be a multiple + * of 4 if using RGBA mode. + * + * Image data is stored in the order of glDrawPixels: row-major order + * with the lower-left image pixel stored in the first array position + * (ie. bottom-to-top). + * + * Since the only type initially supported is GL_UNSIGNED_BYTE, if the + * context is in RGBA mode, each pixel will be stored as a 4-byte RGBA + * value. If the context is in color indexed mode, each pixel will be + * stored as a 1-byte value. + * + * If the context's viewport hasn't been initialized yet, it will now be + * initialized to (0,0,width,height). + * + * Input: ctx - the rendering context + * buffer - the image buffer memory + * type - data type for pixel components, only GL_UNSIGNED_BYTE + * supported now + * width, height - size of image buffer in pixels, at least 1 + * Return: GL_TRUE if success, GL_FALSE if error because of invalid ctx, + * invalid buffer address, type!=GL_UNSIGNED_BYTE, width<1, height<1, + * width>internal limit or height>internal limit. + */ +GLAPI GLboolean GLAPIENTRY +OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type, + GLsizei width, GLsizei height ); + + + + +/* + * Return the current Off-Screen Mesa rendering context handle. + */ +GLAPI OSMesaContext GLAPIENTRY +OSMesaGetCurrentContext( void ); + + + +/* + * Set pixel store/packing parameters for the current context. + * This is similar to glPixelStore. + * Input: pname - OSMESA_ROW_LENGTH + * specify actual pixels per row in image buffer + * 0 = same as image width (default) + * OSMESA_Y_UP + * zero = Y coordinates increase downward + * non-zero = Y coordinates increase upward (default) + * value - the value for the parameter pname + * + * New in version 2.0. + */ +GLAPI void GLAPIENTRY +OSMesaPixelStore( GLint pname, GLint value ); + + + +/* + * Return an integer value like glGetIntegerv. + * Input: pname - + * OSMESA_WIDTH return current image width + * OSMESA_HEIGHT return current image height + * OSMESA_FORMAT return image format + * OSMESA_TYPE return color component data type + * OSMESA_ROW_LENGTH return row length in pixels + * OSMESA_Y_UP returns 1 or 0 to indicate Y axis direction + * value - pointer to integer in which to return result. + */ +GLAPI void GLAPIENTRY +OSMesaGetIntegerv( GLint pname, GLint *value ); + + + +/* + * Return the depth buffer associated with an OSMesa context. + * Input: c - the OSMesa context + * Output: width, height - size of buffer in pixels + * bytesPerValue - bytes per depth value (2 or 4) + * buffer - pointer to depth buffer values + * Return: GL_TRUE or GL_FALSE to indicate success or failure. + * + * New in Mesa 2.4. + */ +GLAPI GLboolean GLAPIENTRY +OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height, + GLint *bytesPerValue, void **buffer ); + + + +/* + * Return the color buffer associated with an OSMesa context. + * Input: c - the OSMesa context + * Output: width, height - size of buffer in pixels + * format - buffer format (OSMESA_FORMAT) + * buffer - pointer to depth buffer values + * Return: GL_TRUE or GL_FALSE to indicate success or failure. + * + * New in Mesa 3.3. + */ +GLAPI GLboolean GLAPIENTRY +OSMesaGetColorBuffer( OSMesaContext c, GLint *width, GLint *height, + GLint *format, void **buffer ); + + + +/** + * This typedef is new in Mesa 6.3. + */ +typedef void (*OSMESAproc)(); + + +/* + * Return pointer to the named function. + * New in Mesa 4.1 + * Return OSMESAproc in 6.3. + */ +GLAPI OSMESAproc GLAPIENTRY +OSMesaGetProcAddress( const char *funcName ); + + +#if defined(__BEOS__) || defined(__QUICKDRAW__) +#pragma export off +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/reactos/dll/mesa32/include/GL/svgamesa.h b/reactos/dll/mesa32/include/GL/svgamesa.h new file mode 100644 index 00000000000..67c0e4c5c65 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/svgamesa.h @@ -0,0 +1,97 @@ +/* + * Mesa 3-D graphics library + * Version: 4.0 + * Copyright (C) 1995-2001 Brian Paul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* + * SVGA/Mesa interface for Linux. + */ + + +/* + * Intro to using the VGA/Mesa interface + * + * 1. #include the file + * 2. Call vga_init() to initialize the SVGA library. + * 3. Call vga_setmode() to specify the screen size and color depth. + * 4. Call SVGAMesaCreateContext() to setup a Mesa context. If using 8-bit + * color Mesa assumes color index mode, if using 16-bit or deeper color + * Mesa assumes RGB mode. + * 5. Call SVGAMesaMakeCurrent() to activate the Mesa context. + * 6. You can now use the Mesa API functions. + * 7. Before exiting, call SVGAMesaDestroyContext() then vga_setmode(TEXT) + * to restore the original text screen. + * + * Notes + * 1. You must run your executable as root (or use the set UID-bit) because + * the SVGA library requires it. + * 2. The SVGA driver is not fully implemented yet. See svgamesa.c for what + * has to be done yet. + */ + + +#ifndef SVGAMESA_H +#define SVGAMESA_H + + +#define SVGAMESA_MAJOR_VERSION 4 +#define SVGAMESA_MINOR_VERSION 0 + + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "GL/gl.h" + + + +/* + * This is the SVGAMesa context 'handle': + */ +typedef struct svgamesa_context *SVGAMesaContext; + + + +/* + * doubleBuffer flag new in version 2.4 + */ +extern int SVGAMesaInit( int GraphMode ); + +extern int SVGAMesaClose( void ); + +extern SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer ); + +extern void SVGAMesaDestroyContext( SVGAMesaContext ctx ); + +extern void SVGAMesaMakeCurrent( SVGAMesaContext ctx ); + +extern void SVGAMesaSwapBuffers( void ); + +extern void SVGAMesaSetCI(int ndx, GLubyte red, GLubyte green, GLubyte blue); + +extern SVGAMesaContext SVGAMesaGetCurrentContext( void ); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/reactos/dll/mesa32/include/GL/uglglutshapes.h b/reactos/dll/mesa32/include/GL/uglglutshapes.h new file mode 100644 index 00000000000..28192de2d52 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/uglglutshapes.h @@ -0,0 +1,45 @@ +/* uglglutshapes.h - Public header GLUT Shapes */ + +/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */ + +/* This program is freely distributable without licensing fees and is + provided without guarantee or warrantee expressed or implied. This + program is -not- in the public domain. */ + +#ifndef GLUTSHAPES_H +#define GLUTSHAPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +void glutWireSphere (GLdouble radius, GLint slices, GLint stacks); +void glutSolidSphere (GLdouble radius, GLint slices, GLint stacks); +void glutWireCone (GLdouble base, GLdouble height, + GLint slices, GLint stacks); +void glutSolidCone (GLdouble base, GLdouble height, + GLint slices, GLint stacks); +void glutWireCube (GLdouble size); +void glutSolidCube (GLdouble size); +void glutWireTorus (GLdouble innerRadius, GLdouble outerRadius, + GLint sides, GLint rings); +void glutSolidTorus (GLdouble innerRadius, GLdouble outerRadius, + GLint sides, GLint rings); +void glutWireDodecahedron (void); +void glutSolidDodecahedron (void); +void glutWireOctahedron (void); +void glutSolidOctahedron (void); +void glutWireTetrahedron (void); +void glutSolidTetrahedron (void); +void glutWireIcosahedron (void); +void glutSolidIcosahedron (void); +void glutWireTeapot (GLdouble size); +void glutSolidTeapot (GLdouble size); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/dll/mesa32/include/GL/uglmesa.h b/reactos/dll/mesa32/include/GL/uglmesa.h new file mode 100644 index 00000000000..7ef5843504e --- /dev/null +++ b/reactos/dll/mesa32/include/GL/uglmesa.h @@ -0,0 +1,155 @@ +/* uglmesa.h - Public header UGL/Mesa */ + +/* Copyright (C) 2001 by Wind River Systems, Inc */ + +/* + * Mesa 3-D graphics library + * Version: 4.0 + * + * The MIT License + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* + * Author: + * Stephane Raimbault + */ + +#ifndef UGLMESA_H +#define UGLMESA_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define UGL_MESA_MAJOR_VERSION 4 +#define UGL_MESA_MINOR_VERSION 0 + +#include +#include + +/* + * Values for display mode of uglMesaCreateContext () + */ + +/* + * With these mask values, it's possible to test double buffer mode + * with UGL_MESA_DOUBLE mask + * + * SINGLE 0000 0001 + * DOUBLE 0000 0110 + * - SOFT 0000 0010 + * - HARD 0000 0100 + * WINDML 0001 0000 + * + * + */ +#define UGL_MESA_SINGLE 0x01 +#define UGL_MESA_DOUBLE 0x06 +#define UGL_MESA_DOUBLE_SOFTWARE 0x02 +#define UGL_MESA_DOUBLE_HARDWARE 0x04 + +#define UGL_MESA_WINDML_EXCLUSIVE 0x10 + +#define UGL_MESA_FULLSCREEN_WIDTH 0x0 +#define UGL_MESA_FULLSCREEN_HEIGHT 0x0 + +/* + * uglMesaPixelStore() parameters: + */ + +#define UGL_MESA_ROW_LENGTH 0x20 +#define UGL_MESA_Y_UP 0x21 + +/* + * Accepted by uglMesaGetIntegerv: + */ + +#define UGL_MESA_LEFT_X 0x01 +#define UGL_MESA_TOP_Y 0x02 +#define UGL_MESA_WIDTH 0x03 +#define UGL_MESA_HEIGHT 0x04 +#define UGL_MESA_DISPLAY_WIDTH 0x05 +#define UGL_MESA_DISPLAY_HEIGHT 0x06 +#define UGL_MESA_COLOR_FORMAT 0x07 +#define UGL_MESA_COLOR_MODEL 0x08 +#define UGL_MESA_PIXEL_FORMAT 0x09 +#define UGL_MESA_TYPE 0x0A +#define UGL_MESA_RGB 0x0B +#define UGL_MESA_COLOR_INDEXED 0x0C +#define UGL_MESA_SINGLE_BUFFER 0x0D +#define UGL_MESA_DOUBLE_BUFFER 0x0E +#define UGL_MESA_DOUBLE_BUFFER_SOFTWARE 0x0F +#define UGL_MESA_DOUBLE_BUFFER_HARDWARE 0x10 + +/* + * typedefs + */ + +typedef struct uglMesaContext * UGL_MESA_CONTEXT; + +UGL_MESA_CONTEXT uglMesaCreateNewContext (GLenum mode, + UGL_MESA_CONTEXT share_list); + +UGL_MESA_CONTEXT uglMesaCreateNewContextExt (GLenum mode, + GLint depth_bits, + GLint stencil_bits, + GLint accum_red_bits, + GLint accum_green_bits, + GLint accum_blue_bits, + GLint accum_alpha_bits, + UGL_MESA_CONTEXT share_list); + +GLboolean uglMesaMakeCurrentContext (UGL_MESA_CONTEXT umc, + GLsizei left, GLsizei top, + GLsizei width, GLsizei height); + +GLboolean uglMesaMoveWindow (GLsizei dx, GLsizei dy); + +GLboolean uglMesaMoveToWindow (GLsizei left, GLsizei top); + +GLboolean uglMesaResizeWindow (GLsizei dw, GLsizei dh); + +GLboolean uglMesaResizeToWindow (GLsizei width, GLsizei height); + +void uglMesaDestroyContext (void); + +UGL_MESA_CONTEXT uglMesaGetCurrentContext (void); + +void uglMesaSwapBuffers (void); + +void uglMesaPixelStore (GLint pname, GLint value); + +void uglMesaGetIntegerv (GLint pname, GLint *value); + +GLboolean uglMesaGetDepthBuffer (GLint *width, GLint *height, + GLint *bytesPerValue, void **buffer); + +GLboolean uglMesaGetColorBuffer (GLint *width, GLint *height, + GLint *format, void **buffer); + +GLboolean uglMesaSetColor (GLubyte index, GLfloat red, + GLfloat green, GLfloat blue); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/reactos/dll/mesa32/include/GL/vms_x_fix.h b/reactos/dll/mesa32/include/GL/vms_x_fix.h new file mode 100644 index 00000000000..db754f65563 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/vms_x_fix.h @@ -0,0 +1,880 @@ +/*************************************************************************** + * * + * Repair definitions of Xlib when compileing with /name=(as_is) on VMS * + * * + * Author : Jouk Jansen (joukj@hrem.stm.tudelft.nl) * + * * + * Last revision : 22 August 2000 * + * * + ***************************************************************************/ + +#ifndef VMS_X_FIX +#define VMS_X_FIX + +#define _XRegisterFilterByType _XREGISTERFILTERBYTYPE +#define XAllocClassHint XALLOCCLASSHINT +#define XAllocColor XALLOCCOLOR +#define XAllocColorCells XALLOCCOLORCELLS +#define XAllocSizeHints XALLOCSIZEHINTS +#define XAllocWMHints XALLOCWMHINTS +#define XAutoRepeatOff XAUTOREPEATOFF +#define XAutoRepeatOn XAUTOREPEATON +#define XBaseFontNameListOfFontSet XBASEFONTNAMELISTOFFONTSET +#define XBell XBELL +#define XBitmapPad XBITMAPPAD +#define XChangeActivePointerGrab XCHANGEACTIVEPOINTERGRAB +#define XChangeGC XCHANGEGC +#define XChangeProperty XCHANGEPROPERTY +#define XChangeWindowAttributes XCHANGEWINDOWATTRIBUTES +#define XCheckIfEvent XCHECKIFEVENT +#define XCheckMaskEvent XCHECKMASKEVENT +#define XCheckTypedWindowEvent XCHECKTYPEDWINDOWEVENT +#define XCheckWindowEvent XCHECKWINDOWEVENT +#define XClearArea XCLEARAREA +#define XClearWindow XCLEARWINDOW +#define XClipBox XCLIPBOX +#define XCloseDisplay XCLOSEDISPLAY +#define XCloseIM XCLOSEIM +#define XConfigureWindow XCONFIGUREWINDOW +#define XConvertSelection XCONVERTSELECTION +#define XCopyArea XCOPYAREA +#define XCopyGC XCOPYGC +#define XCopyPlane XCOPYPLANE +#define XCreateBitmapFromData XCREATEBITMAPFROMDATA +#define XCreateColormap XCREATECOLORMAP +#define XCreateFontCursor XCREATEFONTCURSOR +#define XCreateFontSet XCREATEFONTSET +#define XCreateGC XCREATEGC +#define XCreateIC XCREATEIC +#define XCreateImage XCREATEIMAGE +#define XCreatePixmap XCREATEPIXMAP +#define XCreatePixmapCursor XCREATEPIXMAPCURSOR +#define XCreatePixmapFromBitmapData XCREATEPIXMAPFROMBITMAPDATA +#define XCreateRegion XCREATEREGION +#define XCreateSimpleWindow XCREATESIMPLEWINDOW +#define XCreateWindow XCREATEWINDOW +#define XDefaultScreenOfDisplay XDEFAULTSCREENOFDISPLAY +#define XDefineCursor XDEFINECURSOR +#define XDeleteProperty XDELETEPROPERTY +#define XDestroyIC XDESTROYIC +#define XDestroyRegion XDESTROYREGION +#define XDestroyWindow XDESTROYWINDOW +#define XDisplayName XDISPLAYNAME +#define XDisplayOfScreen XDISPLAYOFSCREEN +#define XDrawArc XDRAWARC +#define XDrawImageString XDRAWIMAGESTRING +#define XDrawImageString16 XDRAWIMAGESTRING16 +#define XDrawLine XDRAWLINE +#define XDrawLines XDRAWLINES +#define XDrawPoint XDRAWPOINT +#define XDrawPoints XDRAWPOINTS +#define XDrawRectangle XDRAWRECTANGLE +#define XDrawSegments XDRAWSEGMENTS +#define XDrawString XDRAWSTRING +#define XDrawString16 XDRAWSTRING16 +#define XEmptyRegion XEMPTYREGION +#define XEqualRegion XEQUALREGION +#define XEventsQueued XEVENTSQUEUED +#define XExtentsOfFontSet XEXTENTSOFFONTSET +#define XFillArc XFILLARC +#define XFillPolygon XFILLPOLYGON +#define XFillRectangle XFILLRECTANGLE +#define XFillRectangles XFILLRECTANGLES +#define XFilterEvent XFILTEREVENT +#define XFlush XFLUSH +#define XFontsOfFontSet XFONTSOFFONTSET +#define XFree XFREE +#define XFreeColormap XFREECOLORMAP +#define XFreeColors XFREECOLORS +#define XFreeCursor XFREECURSOR +#define XFreeFont XFREEFONT +#define XFreeFontInfo XFREEFONTINFO +#define XFreeFontNames XFREEFONTNAMES +#define XFreeFontSet XFREEFONTSET +#define XFreeGC XFREEGC +#define XFreeModifiermap XFREEMODIFIERMAP +#define XFreePixmap XFREEPIXMAP +#define XFreeStringList XFREESTRINGLIST +#define XGetAtomName XGETATOMNAME +#define XGetDefault XGETDEFAULT +#define XGetErrorDatabaseText XGETERRORDATABASETEXT +#define XGetErrorText XGETERRORTEXT +#define XGetFontProperty XGETFONTPROPERTY +#define XGetGCValues XGETGCVALUES +#define XGetGeometry XGETGEOMETRY +#define XGetICValues XGETICVALUES +#define XGetIMValues XGETIMVALUES +#define XGetImage XGETIMAGE +#define XGetKeyboardControl XGETKEYBOARDCONTROL +#define XGetModifierMapping XGETMODIFIERMAPPING +#define XGetMotionEvents XGETMOTIONEVENTS +#define XGetNormalHints XGETNORMALHINTS +#define XGetSelectionOwner XGETSELECTIONOWNER +#define XGetSubImage XGETSUBIMAGE +#define XGetVisualInfo XGETVISUALINFO +#define XGetWMColormapWindows XGETWMCOLORMAPWINDOWS +#define XGetWMHints XGETWMHINTS +#define XGetWMName XGETWMNAME +#define XGetWMNormalHints XGETWMNORMALHINTS +#define XGetWindowAttributes XGETWINDOWATTRIBUTES +#define XGetWindowProperty XGETWINDOWPROPERTY +#define XGrabKeyboard XGRABKEYBOARD +#define XGrabPointer XGRABPOINTER +#define XGrabServer XGRABSERVER +#define XHeightOfScreen XHEIGHTOFSCREEN +#define XIfEvent XIFEVENT +#define XInternAtom XINTERNATOM +#define XIntersectRegion XINTERSECTREGION +#define XKeycodeToKeysym XKEYCODETOKEYSYM +#define XKeysymToKeycode XKEYSYMTOKEYCODE +#define XKeysymToString XKEYSYMTOSTRING +#define XListFonts XLISTFONTS +#define XListFontsWithInfo XLISTFONTSWITHINFO +#define XListPixmapFormats XLISTPIXMAPFORMATS +#define XListProperties XLISTPROPERTIES +#define XLoadQueryFont XLOADQUERYFONT +#define XLookupString XLOOKUPSTRING +#define XLowerWindow XLOWERWINDOW +#define XMapRaised XMAPRAISED +#define XMapWindow XMAPWINDOW +#define XMatchVisualInfo XMATCHVISUALINFO +#define XMoveResizeWindow XMOVERESIZEWINDOW +#define XMoveWindow XMOVEWINDOW +#define XNextEvent XNEXTEVENT +#define XOffsetRegion XOFFSETREGION +#define XOpenDisplay XOPENDISPLAY +#define XOpenIM XOPENIM +#define XParseColor XPARSECOLOR +#define XParseGeometry XPARSEGEOMETRY +#define XPeekEvent XPEEKEVENT +#define XPending XPENDING +#define XPointInRegion XPOINTINREGION +#define XPolygonRegion XPOLYGONREGION +#define XPutBackEvent XPUTBACKEVENT +#define XPutImage XPUTIMAGE +#define XQueryColor XQUERYCOLOR +#define XQueryColors XQUERYCOLORS +#define XQueryExtension XQUERYEXTENSION +#define XQueryPointer XQUERYPOINTER +#define XQueryTree XQUERYTREE +#define XRaiseWindow XRAISEWINDOW +#define XReconfigureWMWindow XRECONFIGUREWMWINDOW +#define XRectInRegion XRECTINREGION +#define XRefreshKeyboardMapping XREFRESHKEYBOARDMAPPING +#define XReparentWindow XREPARENTWINDOW +#define XResizeWindow XRESIZEWINDOW +#define XRestackWindows XRESTACKWINDOWS +#define XRootWindowOfScreen XROOTWINDOWOFSCREEN +#define XScreenNumberOfScreen XSCREENNUMBEROFSCREEN +#define XSelectAsyncEvent XSELECTASYNCEVENT +#define XSelectAsyncInput XSELECTASYNCINPUT +#define XSelectInput XSELECTINPUT +#define XSendEvent XSENDEVENT +#define XServerVendor XSERVERVENDOR +#define XSetBackground XSETBACKGROUND +#define XSetClassHint XSETCLASSHINT +#define XSetClipMask XSETCLIPMASK +#define XSetClipOrigin XSETCLIPORIGIN +#define XSetClipRectangles XSETCLIPRECTANGLES +#define XSetCloseDownMode XSETCLOSEDOWNMODE +#define XSetCommand XSETCOMMAND +#define XSetDashes XSETDASHES +#define XSetErrorHandler XSETERRORHANDLER +#define XSetFillStyle XSETFILLSTYLE +#define XSetFont XSETFONT +#define XSetForeground XSETFOREGROUND +#define XSetFunction XSETFUNCTION +#define XSetGraphicsExposures XSETGRAPHICSEXPOSURES +#define XSetICFocus XSETICFOCUS +#define XSetICValues XSETICVALUES +#define XSetIOErrorHandler XSETIOERRORHANDLER +#define XSetInputFocus XSETINPUTFOCUS +#define XSetLineAttributes XSETLINEATTRIBUTES +#define XSetLocaleModifiers XSETLOCALEMODIFIERS +#define XSetNormalHints XSETNORMALHINTS +#define XSetRegion XSETREGION +#define XSetSelectionOwner XSETSELECTIONOWNER +#define XSetStipple XSETSTIPPLE +#define XSetSubwindowMode XSETSUBWINDOWMODE +#define XSetTSOrigin XSETTSORIGIN +#define XSetTile XSETTILE +#define XSetTransientForHint XSETTRANSIENTFORHINT +#define XSetWMColormapWindows XSETWMCOLORMAPWINDOWS +#define XSetWMHints XSETWMHINTS +#define XSetWMIconName XSETWMICONNAME +#define XSetWMName XSETWMNAME +#define XSetWMNormalHints XSETWMNORMALHINTS +#define XSetWMProperties XSETWMPROPERTIES +#define XSetWMProtocols XSETWMPROTOCOLS +#define XSetWindowBackground XSETWINDOWBACKGROUND +#define XSetWindowBackgroundPixmap XSETWINDOWBACKGROUNDPIXMAP +#define XSetWindowColormap XSETWINDOWCOLORMAP +#define XShapeCombineMask XSHAPECOMBINEMASK +#define XShapeCombineRectangles XSHAPECOMBINERECTANGLES +#define XShapeGetRectangles XSHAPEGETRECTANGLES +#define XShrinkRegion XSHRINKREGION +#define XStoreColor XSTORECOLOR +#define XStoreColors XSTORECOLORS +#define XStoreName XSTORENAME +#define XStringToKeysym XSTRINGTOKEYSYM +#define XSubtractRegion XSUBTRACTREGION +#define XSupportsLocale XSUPPORTSLOCALE +#define XSync XSYNC +#define XSynchronize XSYNCHRONIZE +#define XTextExtents XTEXTEXTENTS +#define XTextExtents16 XTEXTEXTENTS16 +#define XTextWidth XTEXTWIDTH +#define XTextWidth16 XTEXTWIDTH16 +#define XTranslateCoordinates XTRANSLATECOORDINATES +#define XUndefineCursor XUNDEFINECURSOR +#define XUngrabKeyboard XUNGRABKEYBOARD +#define XUngrabPointer XUNGRABPOINTER +#define XUngrabServer XUNGRABSERVER +#define XUnionRectWithRegion XUNIONRECTWITHREGION +#define XUnionRegion XUNIONREGION +#define XUnmapWindow XUNMAPWINDOW +#define _XUnregisterFilter _XUNREGISTERFILTER +#define XUnsetICFocus XUNSETICFOCUS +#define XVaCreateNestedList XVACREATENESTEDLIST +#define XVisualIDFromVisual XVISUALIDFROMVISUAL +#define XWidthOfScreen XWIDTHOFSCREEN +#define XWindowEvent XWINDOWEVENT +#define XWithdrawWindow XWITHDRAWWINDOW +#define XXorRegion XXORREGION +#define XmAddProtocolCallback XMADDPROTOCOLCALLBACK +#define XmAddProtocols XMADDPROTOCOLS +#define XmChangeColor XMCHANGECOLOR +#define XmClipboardCopy XMCLIPBOARDCOPY +#define XmClipboardEndCopy XMCLIPBOARDENDCOPY +#define XmClipboardInquireLength XMCLIPBOARDINQUIRELENGTH +#define XmClipboardLock XMCLIPBOARDLOCK +#define XmClipboardRetrieve XMCLIPBOARDRETRIEVE +#define XmClipboardStartCopy XMCLIPBOARDSTARTCOPY +#define XmClipboardUnlock XMCLIPBOARDUNLOCK +#define XmCreateArrowButton XMCREATEARROWBUTTON +#define XmCreateArrowButtonGadget XMCREATEARROWBUTTONGADGET +#define XmCreateCascadeButton XMCREATECASCADEBUTTON +#define XmCreateDialogShell XMCREATEDIALOGSHELL +#define XmCreateDragIcon XMCREATEDRAGICON +#define XmCreateDrawingArea XMCREATEDRAWINGAREA +#define XmCreateDrawnButton XMCREATEDRAWNBUTTON +#define XmCreateFileSelectionBox XMCREATEFILESELECTIONBOX +#define XmCreateFileSelectionDialog XMCREATEFILESELECTIONDIALOG +#define XmCreateForm XMCREATEFORM +#define XmCreateFormDialog XMCREATEFORMDIALOG +#define XmCreateFrame XMCREATEFRAME +#define XmCreateInformationDialog XMCREATEINFORMATIONDIALOG +#define XmCreateLabelGadget XMCREATELABELGADGET +#define XmCreateMainWindow XMCREATEMAINWINDOW +#define XmCreateMenuBar XMCREATEMENUBAR +#define XmCreateMessageBox XMCREATEMESSAGEBOX +#define XmCreateMessageDialog XMCREATEMESSAGEDIALOG +#define XmCreateOptionMenu XMCREATEOPTIONMENU +#define XmCreatePanedWindow XMCREATEPANEDWINDOW +#define XmCreatePopupMenu XMCREATEPOPUPMENU +#define XmCreatePromptDialog XMCREATEPROMPTDIALOG +#define XmCreatePulldownMenu XMCREATEPULLDOWNMENU +#define XmCreatePushButton XMCREATEPUSHBUTTON +#define XmCreatePushButtonGadget XMCREATEPUSHBUTTONGADGET +#define XmCreateQuestionDialog XMCREATEQUESTIONDIALOG +#define XmCreateRadioBox XMCREATERADIOBOX +#define XmCreateRowColumn XMCREATEROWCOLUMN +#define XmCreateScale XMCREATESCALE +#define XmCreateScrollBar XMCREATESCROLLBAR +#define XmCreateScrolledList XMCREATESCROLLEDLIST +#define XmCreateScrolledText XMCREATESCROLLEDTEXT +#define XmCreateScrolledWindow XMCREATESCROLLEDWINDOW +#define XmCreateSelectionDialog XMCREATESELECTIONDIALOG +#define XmCreateSeparator XMCREATESEPARATOR +#define XmCreateSeparatorGadget XMCREATESEPARATORGADGET +#define XmCreateTemplateDialog XMCREATETEMPLATEDIALOG +#define XmCreateText XMCREATETEXT +#define XmCreateTextField XMCREATETEXTFIELD +#define XmCreateToggleButton XMCREATETOGGLEBUTTON +#define XmCreateToggleButtonGadget XMCREATETOGGLEBUTTONGADGET +#define XmDragStart XMDRAGSTART +#define XmDropSiteRegister XMDROPSITEREGISTER +#define XmDropSiteUnregister XMDROPSITEUNREGISTER +#define XmDropSiteUpdate XMDROPSITEUPDATE +#define XmDropTransferStart XMDROPTRANSFERSTART +#define XmFileSelectionBoxGetChild XMFILESELECTIONBOXGETCHILD +#define XmFileSelectionDoSearch XMFILESELECTIONDOSEARCH +#define XmFontListAppendEntry XMFONTLISTAPPENDENTRY +#define XmFontListCopy XMFONTLISTCOPY +#define XmFontListCreate XMFONTLISTCREATE +#define XmFontListEntryCreate XMFONTLISTENTRYCREATE +#define XmFontListEntryFree XMFONTLISTENTRYFREE +#define XmFontListEntryGetFont XMFONTLISTENTRYGETFONT +#define XmFontListEntryGetTag XMFONTLISTENTRYGETTAG +#define XmFontListEntryLoad XMFONTLISTENTRYLOAD +#define XmFontListFree XMFONTLISTFREE +#define XmFontListFreeFontContext XMFONTLISTFREEFONTCONTEXT +#define XmFontListGetNextFont XMFONTLISTGETNEXTFONT +#define XmFontListInitFontContext XMFONTLISTINITFONTCONTEXT +#define XmFontListNextEntry XMFONTLISTNEXTENTRY +#define XmGetColors XMGETCOLORS +#define XmGetFocusWidget XMGETFOCUSWIDGET +#define XmGetMenuCursor XMGETMENUCURSOR +#define XmGetPixmapByDepth XMGETPIXMAPBYDEPTH +#define XmGetTearOffControl XMGETTEAROFFCONTROL +#define XmGetXmDisplay XMGETXMDISPLAY +#define XmImMbLookupString XMIMMBLOOKUPSTRING +#define XmImRegister XMIMREGISTER +#define XmImSetFocusValues XMIMSETFOCUSVALUES +#define XmImSetValues XMIMSETVALUES +#define XmImUnregister XMIMUNREGISTER +#define XmImUnsetFocus XMIMUNSETFOCUS +#define XmInternAtom XMINTERNATOM +#define XmIsMotifWMRunning XMISMOTIFWMRUNNING +#define XmListAddItem XMLISTADDITEM +#define XmListAddItemUnselected XMLISTADDITEMUNSELECTED +#define XmListAddItemsUnselected XMLISTADDITEMSUNSELECTED +#define XmListDeleteAllItems XMLISTDELETEALLITEMS +#define XmListDeleteItemsPos XMLISTDELETEITEMSPOS +#define XmListDeletePos XMLISTDELETEPOS +#define XmListDeselectAllItems XMLISTDESELECTALLITEMS +#define XmListDeselectPos XMLISTDESELECTPOS +#define XmListGetKbdItemPos XMLISTGETKBDITEMPOS +#define XmListGetMatchPos XMLISTGETMATCHPOS +#define XmListGetSelectedPos XMLISTGETSELECTEDPOS +#define XmListPosSelected XMLISTPOSSELECTED +#define XmListSelectItem XMLISTSELECTITEM +#define XmListSelectPos XMLISTSELECTPOS +#define XmListSetBottomPos XMLISTSETBOTTOMPOS +#define XmListSetItem XMLISTSETITEM +#define XmListSetKbdItemPos XMLISTSETKBDITEMPOS +#define XmListSetPos XMLISTSETPOS +#define XmMainWindowSetAreas XMMAINWINDOWSETAREAS +#define XmMenuPosition XMMENUPOSITION +#define XmMessageBoxGetChild XMMESSAGEBOXGETCHILD +#define XmOptionButtonGadget XMOPTIONBUTTONGADGET +#define XmOptionLabelGadget XMOPTIONLABELGADGET +#define XmProcessTraversal XMPROCESSTRAVERSAL +#define XmQmotif XMQMOTIF +#define XmRemoveProtocolCallback XMREMOVEPROTOCOLCALLBACK +#define XmRepTypeGetId XMREPTYPEGETID +#define XmRepTypeGetRecord XMREPTYPEGETRECORD +#define XmRepTypeRegister XMREPTYPEREGISTER +#define XmRepTypeValidValue XMREPTYPEVALIDVALUE +#define XmScrollBarSetValues XMSCROLLBARSETVALUES +#define XmScrolledWindowSetAreas XMSCROLLEDWINDOWSETAREAS +#define XmSelectionBoxGetChild XMSELECTIONBOXGETCHILD +#define XmStringByteCompare XMSTRINGBYTECOMPARE +#define XmStringCompare XMSTRINGCOMPARE +#define XmStringConcat XMSTRINGCONCAT +#define XmStringCopy XMSTRINGCOPY +#define XmStringCreate XMSTRINGCREATE +#define XmStringCreateLocalized XMSTRINGCREATELOCALIZED +#define XmStringCreateLtoR XMSTRINGCREATELTOR +#define XmStringCreateSimple XMSTRINGCREATESIMPLE +#define XmStringDraw XMSTRINGDRAW +#define XmStringDrawUnderline XMSTRINGDRAWUNDERLINE +#define XmStringExtent XMSTRINGEXTENT +#define XmStringFree XMSTRINGFREE +#define XmStringFreeContext XMSTRINGFREECONTEXT +#define XmStringGetLtoR XMSTRINGGETLTOR +#define XmStringGetNextComponent XMSTRINGGETNEXTCOMPONENT +#define XmStringGetNextSegment XMSTRINGGETNEXTSEGMENT +#define XmStringInitContext XMSTRINGINITCONTEXT +#define XmStringLength XMSTRINGLENGTH +#define XmStringLtoRCreate XMSTRINGLTORCREATE +#define XmStringNConcat XMSTRINGNCONCAT +#define XmStringSegmentCreate XMSTRINGSEGMENTCREATE +#define XmStringWidth XMSTRINGWIDTH +#define XmTextClearSelection XMTEXTCLEARSELECTION +#define XmTextFieldGetEditable XMTEXTFIELDGETEDITABLE +#define XmTextFieldGetInsertionPosition XMTEXTFIELDGETINSERTIONPOSITION +#define XmTextFieldGetLastPosition XMTEXTFIELDGETLASTPOSITION +#define XmTextFieldGetSelection XMTEXTFIELDGETSELECTION +#define XmTextFieldGetString XMTEXTFIELDGETSTRING +#define XmTextFieldInsert XMTEXTFIELDINSERT +#define XmTextFieldRemove XMTEXTFIELDREMOVE +#define XmTextFieldSetSelection XMTEXTFIELDSETSELECTION +#define XmTextFieldSetString XMTEXTFIELDSETSTRING +#define XmTextGetCursorPosition XMTEXTGETCURSORPOSITION +#define XmTextGetInsertionPosition XMTEXTGETINSERTIONPOSITION +#define XmTextGetLastPosition XMTEXTGETLASTPOSITION +#define XmTextGetMaxLength XMTEXTGETMAXLENGTH +#define XmTextGetSelection XMTEXTGETSELECTION +#define XmTextGetSelectionPosition XMTEXTGETSELECTIONPOSITION +#define XmTextGetString XMTEXTGETSTRING +#define XmTextInsert XMTEXTINSERT +#define XmTextRemove XMTEXTREMOVE +#define XmTextReplace XMTEXTREPLACE +#define XmTextSetCursorPosition XMTEXTSETCURSORPOSITION +#define XmTextSetHighlight XMTEXTSETHIGHLIGHT +#define XmTextSetInsertionPosition XMTEXTSETINSERTIONPOSITION +#define XmTextSetSelection XMTEXTSETSELECTION +#define XmTextSetString XMTEXTSETSTRING +#define XmToggleButtonGadgetGetState XMTOGGLEBUTTONGADGETGETSTATE +#define XmToggleButtonGadgetSetState XMTOGGLEBUTTONGADGETSETSTATE +#define XmToggleButtonGetState XMTOGGLEBUTTONGETSTATE +#define XmToggleButtonSetState XMTOGGLEBUTTONSETSTATE +#define XmUpdateDisplay XMUPDATEDISPLAY +#define XmVaCreateSimpleRadioBox XMVACREATESIMPLERADIOBOX +#define XmbDrawString XMBDRAWSTRING +#define XmbLookupString XMBLOOKUPSTRING +#define XmbResetIC XMBRESETIC +#define XmbSetWMProperties XMBSETWMPROPERTIES +#define XmbTextEscapement XMBTEXTESCAPEMENT +#define XmbTextExtents XMBTEXTEXTENTS +#define XmbTextListToTextProperty XMBTEXTLISTTOTEXTPROPERTY +#define XmbTextPropertyToTextList XMBTEXTPROPERTYTOTEXTLIST +#define XmuClientWindow XMUCLIENTWINDOW +#define XmuPrintDefaultErrorMessage XMUPRINTDEFAULTERRORMESSAGE +#define XrmGetDatabase XRMGETDATABASE +#define XrmGetResource XRMGETRESOURCE +#define XrmPutStringResource XRMPUTSTRINGRESOURCE +#define XrmQuarkToString XRMQUARKTOSTRING +#define XrmStringToQuark XRMSTRINGTOQUARK +#define XtAddCallback XTADDCALLBACK +#define XtAddCallbacks XTADDCALLBACKS +#define XtAddEventHandler XTADDEVENTHANDLER +#define XtAddGrab XTADDGRAB +#define XtAllocateGC XTALLOCATEGC +#define XtAppAddActions XTAPPADDACTIONS +#define XtAppAddInput XTAPPADDINPUT +#define XtAppAddTimeOut XTAPPADDTIMEOUT +#define XtAppCreateShell XTAPPCREATESHELL +#define XtAppInitialize XTAPPINITIALIZE +#define XtAppNextEvent XTAPPNEXTEVENT +#define XtAppPeekEvent XTAPPPEEKEVENT +#define XtAppPending XTAPPPENDING +#define XtAppProcessEvent XTAPPPROCESSEVENT +#define XtAppSetErrorHandler XTAPPSETERRORHANDLER +#define XtAppSetFallbackResources XTAPPSETFALLBACKRESOURCES +#define XtAppSetWarningHandler XTAPPSETWARNINGHANDLER +#define XtAppSetWarningMsgHandler XTAPPSETWARNINGMSGHANDLER +#define XtAppWarning XTAPPWARNING +#define XtCallActionProc XTCALLACTIONPROC +#define XtCallCallbackList XTCALLCALLBACKLIST +#define XtCallCallbacks XTCALLCALLBACKS +#define XtConfigureWidget XTCONFIGUREWIDGET +#define XtConvertAndStore XTCONVERTANDSTORE +#define XtCreateApplicationContext XTCREATEAPPLICATIONCONTEXT +#define XtCreateManagedWidget XTCREATEMANAGEDWIDGET +#define XtCreatePopupShell XTCREATEPOPUPSHELL +#define XtCreateWidget XTCREATEWIDGET +#define XtDatabase XTDATABASE +#define XtDestroyWidget XTDESTROYWIDGET +#define XtDisownSelection XTDISOWNSELECTION +#define XtDispatchEvent XTDISPATCHEVENT +#define XtDisplayOfObject XTDISPLAYOFOBJECT +#define XtDisplayStringConvWarning XTDISPLAYSTRINGCONVWARNING +#define XtDisplayToApplicationContext XTDISPLAYTOAPPLICATIONCONTEXT +#define XtAppAddWorkProc XTAPPADDWORKPROC +#define XtRemoveWorkProc XTREMOVEWORKPROC +#define XtFree XTFREE +#define XtGetActionKeysym XTGETACTIONKEYSYM +#define XtGetActionList XTGETACTIONLIST +#define XtGetApplicationNameAndClass XTGETAPPLICATIONNAMEANDCLASS +#define XtGetApplicationResources XTGETAPPLICATIONRESOURCES +#define XtGetGC XTGETGC +#define XtGetMultiClickTime XTGETMULTICLICKTIME +#define XtGetSelectionValue XTGETSELECTIONVALUE +#define XtGetSelectionValues XTGETSELECTIONVALUES +#define XtGetSubresources XTGETSUBRESOURCES +#define XtGetValues XTGETVALUES +#define XtGrabKeyboard XTGRABKEYBOARD +#define XtGrabPointer XTGRABPOINTER +#define XtHasCallbacks XTHASCALLBACKS +#define XtInitializeWidgetClass XTINITIALIZEWIDGETCLASS +#define XtInsertEventHandler XTINSERTEVENTHANDLER +#define XtIsManaged XTISMANAGED +#define XtIsObject XTISOBJECT +#define XtIsSensitive XTISSENSITIVE +#define XtIsSubclass XTISSUBCLASS +#define XtLastTimestampProcessed XTLASTTIMESTAMPPROCESSED +#define XtMakeGeometryRequest XTMAKEGEOMETRYREQUEST +#define XtMakeResizeRequest XTMAKERESIZEREQUEST +#define XtMalloc XTMALLOC +#define XtManageChild XTMANAGECHILD +#define XtManageChildren XTMANAGECHILDREN +#define XtMergeArgLists XTMERGEARGLISTS +#define XtMoveWidget XTMOVEWIDGET +#define XtName XTNAME +#define XtNameToWidget XTNAMETOWIDGET +#define XtOpenDisplay XTOPENDISPLAY +#define XtOverrideTranslations XTOVERRIDETRANSLATIONS +#define XtOwnSelection XTOWNSELECTION +#define XtParseTranslationTable XTPARSETRANSLATIONTABLE +#define XtPopdown XTPOPDOWN +#define XtPopup XTPOPUP +#define XtQueryGeometry XTQUERYGEOMETRY +#define XtRealizeWidget XTREALIZEWIDGET +#define XtRealloc XTREALLOC +#define XtReleaseGC XTRELEASEGC +#define XtRemoveAllCallbacks XTREMOVEALLCALLBACKS +#define XtRemoveCallback XTREMOVECALLBACK +#define XtRemoveEventHandler XTREMOVEEVENTHANDLER +#define XtRemoveGrab XTREMOVEGRAB +#define XtRemoveInput XTREMOVEINPUT +#define XtRemoveTimeOut XTREMOVETIMEOUT +#define XtResizeWidget XTRESIZEWIDGET +#define XtResolvePathname XTRESOLVEPATHNAME +#define XtSetKeyboardFocus XTSETKEYBOARDFOCUS +#define XtSetMappedWhenManaged XTSETMAPPEDWHENMANAGED +#define XtSetSensitive XTSETSENSITIVE +#define XtSetTypeConverter XTSETTYPECONVERTER +#define XtSetValues XTSETVALUES +#define XtShellStrings XTSHELLSTRINGS +#define XtStrings XTSTRINGS +#define XtToolkitInitialize XTTOOLKITINITIALIZE +#define XtTranslateCoords XTTRANSLATECOORDS +#define XtTranslateKeycode XTTRANSLATEKEYCODE +#define XtUngrabKeyboard XTUNGRABKEYBOARD +#define XtUngrabPointer XTUNGRABPOINTER +#define XtUnmanageChild XTUNMANAGECHILD +#define XtUnmanageChildren XTUNMANAGECHILDREN +#define XtUnrealizeWidget XTUNREALIZEWIDGET +#define XtVaCreateManagedWidget XTVACREATEMANAGEDWIDGET +#define XtVaCreateWidget XTVACREATEWIDGET +#define XtVaGetValues XTVAGETVALUES +#define XtVaSetValues XTVASETVALUES +#define XtWarning XTWARNING +#define XtWidgetToApplicationContext XTWIDGETTOAPPLICATIONCONTEXT +#define XtWindowOfObject XTWINDOWOFOBJECT +#define XtWindowToWidget XTWINDOWTOWIDGET +#define XwcDrawString XWCDRAWSTRING +#define XwcFreeStringList XWCFREESTRINGLIST +#define XwcTextEscapement XWCTEXTESCAPEMENT +#define XwcTextExtents XWCTEXTEXTENTS +#define XwcTextListToTextProperty XWCTEXTLISTTOTEXTPROPERTY +#define XwcTextPropertyToTextList XWCTEXTPROPERTYTOTEXTLIST +#define _XmBottomShadowColorDefault _XMBOTTOMSHADOWCOLORDEFAULT +#define _XmClearBorder _XMCLEARBORDER +#define _XmConfigureObject _XMCONFIGUREOBJECT +#define _XmDestroyParentCallback _XMDESTROYPARENTCALLBACK +#define _XmDrawArrow _XMDRAWARROW +#define _XmDrawShadows _XMDRAWSHADOWS +#define _XmFontListGetDefaultFont _XMFONTLISTGETDEFAULTFONT +#define _XmFromHorizontalPixels _XMFROMHORIZONTALPIXELS +#define _XmFromVerticalPixels _XMFROMVERTICALPIXELS +#define _XmGetClassExtensionPtr _XMGETCLASSEXTENSIONPTR +#define _XmGetDefaultFontList _XMGETDEFAULTFONTLIST +#define _XmGetTextualDragIcon _XMGETTEXTUALDRAGICON +#define _XmGetWidgetExtData _XMGETWIDGETEXTDATA +#define _XmGrabKeyboard _XMGRABKEYBOARD +#define _XmGrabPointer _XMGRABPOINTER +#define _XmInheritClass _XMINHERITCLASS +#define _XmInputInGadget _XMINPUTINGADGET +#define _XmMakeGeometryRequest _XMMAKEGEOMETRYREQUEST +#define _XmMenuPopDown _XMMENUPOPDOWN +#define _XmMoveObject _XMMOVEOBJECT +#define _XmNavigChangeManaged _XMNAVIGCHANGEMANAGED +#define _XmOSBuildFileList _XMOSBUILDFILELIST +#define _XmOSFileCompare _XMOSFILECOMPARE +#define _XmOSFindPatternPart _XMOSFINDPATTERNPART +#define _XmOSQualifyFileSpec _XMOSQUALIFYFILESPEC +#define _XmPostPopupMenu _XMPOSTPOPUPMENU +#define _XmPrimitiveEnter _XMPRIMITIVEENTER +#define _XmPrimitiveLeave _XMPRIMITIVELEAVE +#define _XmRedisplayGadgets _XMREDISPLAYGADGETS +#define _XmShellIsExclusive _XMSHELLISEXCLUSIVE +#define _XmStringDraw _XMSTRINGDRAW +#define _XmStringGetTextConcat _XMSTRINGGETTEXTCONCAT +#define _XmStrings _XMSTRINGS +#define _XmToHorizontalPixels _XMTOHORIZONTALPIXELS +#define _XmToVerticalPixels _XMTOVERTICALPIXELS +#define _XmTopShadowColorDefault _XMTOPSHADOWCOLORDEFAULT +#define _Xm_fastPtr _XM_FASTPTR +#define _XtCheckSubclassFlag _XTCHECKSUBCLASSFLAG +#define _XtInherit _XTINHERIT +#define _XtInheritTranslations _XTINHERITTRANSLATIONS +#define applicationShellWidgetClass APPLICATIONSHELLWIDGETCLASS +#define compositeWidgetClass COMPOSITEWIDGETCLASS +#define overrideShellWidgetClass OVERRIDESHELLWIDGETCLASS +#define shellWidgetClass SHELLWIDGETCLASS +#define topLevelShellClassRec TOPLEVELSHELLCLASSREC +#define topLevelShellWidgetClass TOPLEVELSHELLWIDGETCLASS +#define transientShellWidgetClass TRANSIENTSHELLWIDGETCLASS +#define vendorShellClassRec VENDORSHELLCLASSREC +#define vendorShellWidgetClass VENDORSHELLWIDGETCLASS +#define wmShellWidgetClass WMSHELLWIDGETCLASS +#define xmArrowButtonWidgetClass XMARROWBUTTONWIDGETCLASS +#define xmCascadeButtonClassRec XMCASCADEBUTTONCLASSREC +#define xmCascadeButtonGadgetClass XMCASCADEBUTTONGADGETCLASS +#define xmCascadeButtonWidgetClass XMCASCADEBUTTONWIDGETCLASS +#define xmDialogShellWidgetClass XMDIALOGSHELLWIDGETCLASS +#define xmDrawingAreaWidgetClass XMDRAWINGAREAWIDGETCLASS +#define xmDrawnButtonWidgetClass XMDRAWNBUTTONWIDGETCLASS +#define xmFileSelectionBoxWidgetClass XMFILESELECTIONBOXWIDGETCLASS +#define xmFormWidgetClass XMFORMWIDGETCLASS +#define xmFrameWidgetClass XMFRAMEWIDGETCLASS +#define xmGadgetClass XMGADGETCLASS +#define xmLabelGadgetClass XMLABELGADGETCLASS +#define xmLabelWidgetClass XMLABELWIDGETCLASS +#define xmListWidgetClass XMLISTWIDGETCLASS +#define xmMainWindowWidgetClass XMMAINWINDOWWIDGETCLASS +#define xmManagerClassRec XMMANAGERCLASSREC +#define xmManagerWidgetClass XMMANAGERWIDGETCLASS +#define xmMenuShellWidgetClass XMMENUSHELLWIDGETCLASS +#define xmMessageBoxWidgetClass XMMESSAGEBOXWIDGETCLASS +#define xmPrimitiveClassRec XMPRIMITIVECLASSREC +#define xmPrimitiveWidgetClass XMPRIMITIVEWIDGETCLASS +#define xmPushButtonClassRec XMPUSHBUTTONCLASSREC +#define xmPushButtonGadgetClass XMPUSHBUTTONGADGETCLASS +#define xmPushButtonWidgetClass XMPUSHBUTTONWIDGETCLASS +#define xmRowColumnWidgetClass XMROWCOLUMNWIDGETCLASS +#define xmSashWidgetClass XMSASHWIDGETCLASS +#define xmScrollBarWidgetClass XMSCROLLBARWIDGETCLASS +#define xmScrolledWindowClassRec XMSCROLLEDWINDOWCLASSREC +#define xmScrolledWindowWidgetClass XMSCROLLEDWINDOWWIDGETCLASS +#define xmSeparatorGadgetClass XMSEPARATORGADGETCLASS +#define xmSeparatorWidgetClass XMSEPARATORWIDGETCLASS +#define xmTextFieldWidgetClass XMTEXTFIELDWIDGETCLASS +#define xmTextWidgetClass XMTEXTWIDGETCLASS +#define xmToggleButtonGadgetClass XMTOGGLEBUTTONGADGETCLASS +#define xmToggleButtonWidgetClass XMTOGGLEBUTTONWIDGETCLASS +#define XtRegisterDrawable _XTREGISTERWINDOW +#define XtUnregisterDrawable _XTUNREGISTERWINDOW +#define XQueryFont XQUERYFONT +#define XSetPlaneMask XSETPLANEMASK +#define XChangeKeyboardControl XCHANGEKEYBOARDCONTROL +#define XDestroySubwindows XDESTROYSUBWINDOWS +#define XFreeDeviceList XFREEDEVICELIST +#define XFreeDeviceState XFREEDEVICESTATE +#define XGetExtensionVersion XGETEXTENSIONVERSION +#define XGetRGBColormaps XGETRGBCOLORMAPS +#define XIconifyWindow XICONIFYWINDOW +#define XInstallColormap XINSTALLCOLORMAP +#define XListInputDevices XLISTINPUTDEVICES +#define XLookupKeysym XLOOKUPKEYSYM +#define XOpenDevice XOPENDEVICE +#define XQueryDeviceState XQUERYDEVICESTATE +#define XSelectExtensionEvent XSELECTEXTENSIONEVENT +#define XWarpPointer XWARPPOINTER +#define XmuLookupStandardColormap XMULOOKUPSTANDARDCOLORMAP +#define XAllocNamedColor XALLOCNAMEDCOLOR +#define XBlackPixelOfScreen XBLACKPIXELOFSCREEN +#define XDefaultColormap XDEFAULTCOLORMAP +#define XDefaultColormapOfScreen XDEFAULTCOLORMAPOFSCREEN +#define XDefaultDepth XDEFAULTDEPTH +#define XDefaultScreen XDEFAULTSCREEN +#define XDefaultVisual XDEFAULTVISUAL +#define XSetIconName XSETICONNAME +#define XtInitialize XTINITIALIZE +#define XtMainLoop XTMAINLOOP +#define DtSaverGetWindows DTSAVERGETWINDOWS +#define XAddHosts XADDHOSTS +#define XDisableAccessControl XDISABLEACCESSCONTROL +#define XEnableAccessControl XENABLEACCESSCONTROL +#define XFillArcs XFILLARCS +#define XForceScreenSaver XFORCESCREENSAVER +#define XGetScreenSaver XGETSCREENSAVER +#define XListHosts XLISTHOSTS +#define XReadBitmapFile XREADBITMAPFILE +#define XRemoveHosts XREMOVEHOSTS +#define XResetScreenSaver XRESETSCREENSAVER +#define XResourceManagerString XRESOURCEMANAGERSTRING +#define XSetScreenSaver XSETSCREENSAVER +#define XStringListToTextProperty XSTRINGLISTTOTEXTPROPERTY +#define XrmDestroyDatabase XRMDESTROYDATABASE +#define XrmGetFileDatabase XRMGETFILEDATABASE +#define XrmGetStringDatabase XRMGETSTRINGDATABASE +#define XrmInitialize XRMINITIALIZE +#define XrmMergeDatabases XRMMERGEDATABASES +#define XrmParseCommand XRMPARSECOMMAND +#define XrmPutLineResource XRMPUTLINERESOURCE +#define XrmQPutStringResource XRMQPUTSTRINGRESOURCE +#define XrmStringToBindingQuarkList XRMSTRINGTOBINDINGQUARKLIST +#define XrmStringToQuark XRMSTRINGTOQUARK +#define XmCreateLabel XMCREATELABEL + +#ifdef __cplusplus +extern "C" { +#endif +extern void XtFree(char*); +#ifdef __cplusplus +} +#endif + +#define pthread_attr_create PTHREAD_ATTR_CREATE +#define pthread_attr_delete PTHREAD_ATTR_DELETE +#define pthread_attr_destroy PTHREAD_ATTR_DESTROY +#define pthread_attr_getdetach_np PTHREAD_ATTR_GETDETACH_NP +#define pthread_attr_getguardsize_np PTHREAD_ATTR_GETGUARDSIZE_NP +#define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED +#define pthread_attr_getprio PTHREAD_ATTR_GETPRIO +#define pthread_attr_getsched PTHREAD_ATTR_GETSCHED +#define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM +#define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE +#define pthread_attr_init PTHREAD_ATTR_INIT +#define pthread_attr_setdetach_np PTHREAD_ATTR_SETDETACH_NP +#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE +#define pthread_attr_setguardsize_np PTHREAD_ATTR_SETGUARDSIZE_NP +#define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED +#define pthread_attr_setprio PTHREAD_ATTR_SETPRIO +#define pthread_attr_setsched PTHREAD_ATTR_SETSCHED +#define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM +#define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY +#define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE +#define pthread_cancel PTHREAD_CANCEL +#define pthread_cancel_e PTHREAD_CANCEL_E +#define pthread_cond_broadcast PTHREAD_COND_BROADCAST +#define pthread_cond_destroy PTHREAD_COND_DESTROY +#define pthread_cond_init PTHREAD_COND_INIT +#define pthread_cond_sig_preempt_int_np PTHREAD_COND_SIG_PREEMPT_INT_NP +#define pthread_cond_signal PTHREAD_COND_SIGNAL +#define pthread_cond_signal_int_np PTHREAD_COND_SIGNAL_INT_NP +#define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT +#define pthread_cond_wait PTHREAD_COND_WAIT +#define pthread_condattr_create PTHREAD_CONDATTR_CREATE +#define pthread_condattr_delete PTHREAD_CONDATTR_DELETE +#define pthread_condattr_init PTHREAD_CONDATTR_INIT +#define pthread_create PTHREAD_CREATE +#define pthread_delay_np PTHREAD_DELAY_NP +#define pthread_detach PTHREAD_DETACH +#define pthread_equal PTHREAD_EQUAL +#define pthread_exc_fetch_fp_np PTHREAD_EXC_FETCH_FP_NP +#define pthread_exc_handler_np PTHREAD_EXC_HANDLER_NP +#define pthread_exc_pop_ctx_np PTHREAD_EXC_POP_CTX_NP +#define pthread_exc_push_ctx_np PTHREAD_EXC_PUSH_CTX_NP +#define pthread_exc_savecontext_np PTHREAD_EXC_SAVECONTEXT_NP +#define pthread_exit PTHREAD_EXIT +#define pthread_get_expiration_np PTHREAD_GET_EXPIRATION_NP +#define pthread_getprio PTHREAD_GETPRIO +#define pthread_getschedparam PTHREAD_GETSCHEDPARAM +#define pthread_getscheduler PTHREAD_GETSCHEDULER +#define pthread_getspecific PTHREAD_GETSPECIFIC +#define pthread_getunique_np PTHREAD_GETUNIQUE_NP +#define pthread_join PTHREAD_JOIN +#define pthread_join32 PTHREAD_JOIN32 +#define pthread_keycreate PTHREAD_KEYCREATE +#define pthread_key_create PTHREAD_KEY_CREATE +#define pthread_kill PTHREAD_KILL +#define pthread_lock_global_np PTHREAD_LOCK_GLOBAL_NP +#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY +#define pthread_mutex_init PTHREAD_MUTEX_INIT +#define pthread_mutex_lock PTHREAD_MUTEX_LOCK +#define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK +#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK +#define pthread_mutexattr_create PTHREAD_MUTEXATTR_CREATE +#define pthread_mutexattr_delete PTHREAD_MUTEXATTR_DELETE +#define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY +#define pthread_mutexattr_getkind_np PTHREAD_MUTEXATTR_GETKIND_NP +#define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT +#define pthread_mutexattr_setkind_np PTHREAD_MUTEXATTR_SETKIND_NP +#define pthread_mutexattr_settype_np PTHREAD_MUTEXATTR_SETTYPE_NP +#define pthread_once PTHREAD_ONCE +#define pthread_resume_np PTHREAD_RESUME_NP +#define pthread_self PTHREAD_SELF +#define pthread_setasynccancel PTHREAD_SETASYNCCANCEL +#define pthread_setcancel PTHREAD_SETCANCEL +#define pthread_setcancelstate PTHREAD_SETCANCELSTATE +#define pthread_setprio PTHREAD_SETPRIO +#define pthread_setschedparam PTHREAD_SETSCHEDPARAM +#define pthread_setscheduler PTHREAD_SETSCHEDULER +#define pthread_setspecific PTHREAD_SETSPECIFIC +#define pthread_suspend_np PTHREAD_SUSPEND_NP +#define pthread_testcancel PTHREAD_TESTCANCEL +#define pthread_unlock_global_np PTHREAD_UNLOCK_GLOBAL_NP +#define pthread_yield PTHREAD_YIELD +#define pthread_yield_np PTHREAD_YIELD_NP +#define XDefaultRootWindow XDEFAULTROOTWINDOW +#define XDisplayCells XDISPLAYCELLS +#define XMaxRequestSize XMAXREQUESTSIZE +#define XScreenOfDisplay XSCREENOFDISPLAY +#define XSetFillRule XSETFILLRULE +#define XmActivateProtocol XMACTIVATEPROTOCOL +#define XmCreateBulletinBoardDialog XMCREATEBULLETINBOARDDIALOG +#define XmCreateErrorDialog XMCREATEERRORDIALOG +#define XmCreateWarningDialog XMCREATEWARNINGDIALOG +#define XmCvtCTToXmString XMCVTCTTOXMSTRING +#define XmDestroyPixmap XMDESTROYPIXMAP +#define XmGetPixmap XMGETPIXMAP +#define XmInstallImage XMINSTALLIMAGE +#define XmListAddItems XMLISTADDITEMS +#define XmListDeleteItem XMLISTDELETEITEM +#define XmListItemExists XMLISTITEMEXISTS +#define XmListItemPos XMLISTITEMPOS +#define XmListReplaceItems XMLISTREPLACEITEMS +#define XmListReplaceItemsPos XMLISTREPLACEITEMSPOS +#define XmRemoveProtocols XMREMOVEPROTOCOLS +#define XmRemoveTabGroup XMREMOVETABGROUP +#define XmSetColorCalculation XMSETCOLORCALCULATION +#define XmTextCopy XMTEXTCOPY +#define XmTextCut XMTEXTCUT +#define XmTextFieldClearSelection XMTEXTFIELDCLEARSELECTION +#define XmTextFieldCopy XMTEXTFIELDCOPY +#define XmTextFieldCut XMTEXTFIELDCUT +#define XmTextFieldGetMaxLength XMTEXTFIELDGETMAXLENGTH +#define XmTextFieldGetSelectionPosition XMTEXTFIELDGETSELECTIONPOSITION +#define XmTextFieldPaste XMTEXTFIELDPASTE +#define XmTextFieldReplace XMTEXTFIELDREPLACE +#define XmTextFieldSetAddMode XMTEXTFIELDSETADDMODE +#define XmTextFieldSetHighlight XMTEXTFIELDSETHIGHLIGHT +#define XmTextFieldSetInsertionPosition XMTEXTFIELDSETINSERTIONPOSITION +#define XmTextFieldSetMaxLength XMTEXTFIELDSETMAXLENGTH +#define XmTextFieldShowPosition XMTEXTFIELDSHOWPOSITION +#define XmTextGetEditable XMTEXTGETEDITABLE +#define XmTextPaste XMTEXTPASTE +#define XmTextPosToXY XMTEXTPOSTOXY +#define XmTextSetEditable XMTEXTSETEDITABLE +#define XmTextShowPosition XMTEXTSHOWPOSITION +#define XmUninstallImage XMUNINSTALLIMAGE +#define XmuCvtStringToBitmap XMUCVTSTRINGTOBITMAP +#define XrmPutFileDatabase XRMPUTFILEDATABASE +#define XtAddConverter XTADDCONVERTER +#define XtError XTERROR +#define XtVaCreatePopupShell XTVACREATEPOPUPSHELL +#define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY +#define pthread_key_delete PTHREAD_KEY_DELETE +#define xmBulletinBoardWidgetClass XMBULLETINBOARDWIDGETCLASS +#define xmScaleWidgetClass XMSCALEWIDGETCLASS +#define XtDisplay XTDISPLAY +#define XtScreen XTSCREEN +#define XAllocIconSize XALLOCICONSIZE +#define XAllocStandardColormap XALLOCSTANDARDCOLORMAP +#define XAllowEvents XALLOWEVENTS +#define XBlackPixel XBLACKPIXEL +#define XCopyColormapAndFree XCOPYCOLORMAPANDFREE +#define XDefaultGC XDEFAULTGC +#define XDisplayHeight XDISPLAYHEIGHT +#define XDisplayWidth XDISPLAYWIDTH +#define XGetCommand XGETCOMMAND +#define XGetIconSizes XGETICONSIZES +#define XKillClient XKILLCLIENT +#define XListInstalledColormaps XLISTINSTALLEDCOLORMAPS +#define XRootWindow XROOTWINDOW +#define XWMGeometry XWMGEOMETRY +#define XWhitePixel XWHITEPIXEL +#define XrmCombineDatabase XRMCOMBINEDATABASE +#define XrmCombineFileDatabase XRMCOMBINEFILEDATABASE +#define XSetStandardProperties XSETSTANDARDPROPERTIES +#define XSetState XSETSTATE +#define XDrawRectangles XDRAWRECTANGLES +#define XGrabButton XGRABBUTTON +#define XLookupColor XLOOKUPCOLOR +#define XMapSubwindows XMAPSUBWINDOWS +#define XRecolorCursor XRECOLORCURSOR +#define XStoreBytes XSTOREBYTES +#define XUngrabButton XUNGRABBUTTON +#define XUninstallColormap XUNINSTALLCOLORMAP +#define lib$wait LIB$WAIT +#define lib$find_file LIB$FIND_FILE +#define lib$find_file_end LIB$FIND_FILE_END +#define lib$set_symbol LIB$SET_SYMBOL +#define lib$sfree1_dd LIB$SFREE1_DD +#define lib$spawn LIB$SPAWN +#define sys$assign SYS$ASSIGN +#define sys$crembx SYS$CREMBX +#define sys$dassgn SYS$DASSGN +#define sys$dclexh SYS$DCLEXH +#define sys$getdviw SYS$GETDVIW +#define sys$getsyiw SYS$GETSYIW +#define sys$qio SYS$QIO +#define sys$qiow SYS$QIOW +#define sys$setef SYS$SETEF +#define sys$synch SYS$SYNCH +#define XDrawText XDRAWTEXT +#define XtCloseDisplay XTCLOSEDISPLAY +#define XtDestroyApplicationContext XTDESTROYAPPLICATIONCONTEXT +#define lib$ediv LIB$EDIV +#define lib$subx LIB$SUBX +#define sys$bintim SYS$BINTIM +#define sys$gettim SYS$GETTIM +#define XFetchName XFETCHNAME +#define XPeekIfEvent XPEEKIFEVENT +#define XQueryKeymap XQUERYKEYMAP +#endif diff --git a/reactos/dll/mesa32/include/GL/wmesa.h b/reactos/dll/mesa32/include/GL/wmesa.h new file mode 100644 index 00000000000..0a6e8b64246 --- /dev/null +++ b/reactos/dll/mesa32/include/GL/wmesa.h @@ -0,0 +1,142 @@ +/* + * Mesa 3-D graphics library + * Version: 3.0 + * Copyright (C) 1995-1998 Brian Paul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + +/* + * Windows driver by: Mark E. Peterson (markp@ic.mankato.mn.us) + * Updated by Li Wei (liwei@aiar.xjtu.edu.cn) + * + * + *************************************************************** + * WMesa * + * version 2.3 * + * * + * By * + * Li Wei * + * Institute of Artificial Intelligence & Robotics * + * Xi'an Jiaotong University * + * Email: liwei@aiar.xjtu.edu.cn * + * Web page: http://sun.aiar.xjtu.edu.cn * + * * + * July 7th, 1997 * + *************************************************************** + */ + + +#ifndef WMESA_H +#define WMESA_H + + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "GL/gl.h" + +#if defined(_MSV_VER) && !defined(__GNUC__) +# pragma warning (disable:4273) +# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ +# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ +# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ +# pragma warning( disable : 4013 ) /* 'function' undefined; assuming extern returning int */ +# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ +# pragma warning( disable : 4273 ) /* 'identifier' : inconsistent DLL linkage. dllexport assumed */ +# if (MESA_WARNQUIET>1) +# pragma warning( disable : 4146 ) /* unary minus operator applied to unsigned type, result still unsigned */ +# endif +#endif + +/* + * This is the WMesa context 'handle': + */ +typedef struct wmesa_context *WMesaContext; + + + +/* + * Create a new WMesaContext for rendering into a window. You must + * have already created the window of correct visual type and with an + * appropriate colormap. + * + * Input: + * hWnd - Window handle + * Pal - Palette to use + * rgb_flag - GL_TRUE = RGB mode, + * GL_FALSE = color index mode + * db_flag - GL_TRUE = double-buffered, + * GL_FALSE = single buffered + * alpha_flag - GL_TRUE = create software alpha buffer, + * GL_FALSE = no software alpha buffer + * + * Note: Indexed mode requires double buffering under Windows. + * + * Return: a WMesa_context or NULL if error. + */ +extern WMesaContext WMesaCreateContext(HWND hWnd,HPALETTE* pPal, + GLboolean rgb_flag, + GLboolean db_flag, + GLboolean alpha_flag); + + +/* + * Destroy a rendering context as returned by WMesaCreateContext() + */ +/*extern void WMesaDestroyContext( WMesaContext ctx );*/ +extern void WMesaDestroyContext( void ); + + + +/* + * Make the specified context the current one. + */ +extern void WMesaMakeCurrent( WMesaContext ctx ); + + +/* + * Return a handle to the current context. + */ +extern WMesaContext WMesaGetCurrentContext( void ); + + +/* + * Swap the front and back buffers for the current context. No action + * taken if the context is not double buffered. + */ +extern void WMesaSwapBuffers(void); + + +/* + * In indexed color mode we need to know when the palette changes. + */ +extern void WMesaPaletteChange(HPALETTE Pal); + +extern void WMesaMove(void); + + + +#ifdef __cplusplus +} +#endif + + +#endif + diff --git a/reactos/dll/mesa32/include/GL/xmesa.h b/reactos/dll/mesa32/include/GL/xmesa.h new file mode 100644 index 00000000000..ab813b23baa --- /dev/null +++ b/reactos/dll/mesa32/include/GL/xmesa.h @@ -0,0 +1,390 @@ +/* + * 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. + */ + + +/* + * Mesa/X11 interface. This header file serves as the documentation for + * the Mesa/X11 interface functions. + * + * Note: this interface isn't intended for user programs. It's primarily + * just for implementing the pseudo-GLX interface. + */ + + +/* Sample Usage: + +In addition to the usual X calls to select a visual, create a colormap +and create a window, you must do the following to use the X/Mesa interface: + +1. Call XMesaCreateVisual() to make an XMesaVisual from an XVisualInfo. + +2. Call XMesaCreateContext() to create an X/Mesa rendering context, given + the XMesaVisual. + +3. Call XMesaCreateWindowBuffer() to create an XMesaBuffer from an X window + and XMesaVisual. + +4. Call XMesaMakeCurrent() to bind the XMesaBuffer to an XMesaContext and + to make the context the current one. + +5. Make gl* calls to render your graphics. + +6. Use XMesaSwapBuffers() when double buffering to swap front/back buffers. + +7. Before the X window is destroyed, call XMesaDestroyBuffer(). + +8. Before exiting, call XMesaDestroyVisual and XMesaDestroyContext. + +*/ + + + + +#ifndef XMESA_H +#define XMESA_H + +#ifdef __VMS +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef XFree86Server +#include "xmesa_xf86.h" +#else +#include +#include +#include "xmesa_x.h" +#endif +#include "GL/gl.h" + +#ifdef AMIWIN +#include +extern struct Library *XLibBase; +#endif + + +#define XMESA_MAJOR_VERSION 6 +#define XMESA_MINOR_VERSION 3 + + + +/* + * Values passed to XMesaGetString: + */ +#define XMESA_VERSION 1 +#define XMESA_EXTENSIONS 2 + + +/* + * Values passed to XMesaSetFXmode: + */ +#define XMESA_FX_WINDOW 1 +#define XMESA_FX_FULLSCREEN 2 + + + +typedef struct xmesa_context *XMesaContext; + +typedef struct xmesa_visual *XMesaVisual; + +typedef struct xmesa_buffer *XMesaBuffer; + + + +/* + * Create a new X/Mesa visual. + * Input: display - X11 display + * visinfo - an XVisualInfo pointer + * rgb_flag - GL_TRUE = RGB mode, + * GL_FALSE = color index mode + * alpha_flag - alpha buffer requested? + * db_flag - GL_TRUE = double-buffered, + * GL_FALSE = single buffered + * stereo_flag - stereo visual? + * ximage_flag - GL_TRUE = use an XImage for back buffer, + * GL_FALSE = use an off-screen pixmap for back buffer + * depth_size - requested bits/depth values, or zero + * stencil_size - requested bits/stencil values, or zero + * accum_red_size - requested bits/red accum values, or zero + * accum_green_size - requested bits/green accum values, or zero + * accum_blue_size - requested bits/blue accum values, or zero + * accum_alpha_size - requested bits/alpha accum values, or zero + * num_samples - number of samples/pixel if multisampling, or zero + * level - visual level, usually 0 + * visualCaveat - ala the GLX extension, usually GLX_NONE_EXT + * Return; a new XMesaVisual or 0 if error. + */ +extern XMesaVisual XMesaCreateVisual( XMesaDisplay *display, + XMesaVisualInfo visinfo, + GLboolean rgb_flag, + GLboolean alpha_flag, + GLboolean db_flag, + GLboolean stereo_flag, + GLboolean ximage_flag, + GLint depth_size, + GLint stencil_size, + GLint accum_red_size, + GLint accum_green_size, + GLint accum_blue_size, + GLint accum_alpha_size, + GLint num_samples, + GLint level, + GLint visualCaveat ); + +/* + * Destroy an XMesaVisual, but not the associated XVisualInfo. + */ +extern void XMesaDestroyVisual( XMesaVisual v ); + + + +/* + * Create a new XMesaContext for rendering into an X11 window. + * + * Input: visual - an XMesaVisual + * share_list - another XMesaContext with which to share display + * lists or NULL if no sharing is wanted. + * Return: an XMesaContext or NULL if error. + */ +extern XMesaContext XMesaCreateContext( XMesaVisual v, + XMesaContext share_list ); + + +/* + * Destroy a rendering context as returned by XMesaCreateContext() + */ +extern void XMesaDestroyContext( XMesaContext c ); + + +/* + * Create an XMesaBuffer from an X window. + */ +extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v, XMesaWindow w ); + + +/* + * Create an XMesaBuffer from an X pixmap. + */ +extern XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, + XMesaPixmap p, + XMesaColormap cmap ); + + +/* + * Destroy an XMesaBuffer, but not the corresponding window or pixmap. + */ +extern void XMesaDestroyBuffer( XMesaBuffer b ); + + +/* + * Return the XMesaBuffer handle which corresponds to an X drawable, if any. + * + * New in Mesa 2.3. + */ +extern XMesaBuffer XMesaFindBuffer( XMesaDisplay *dpy, + XMesaDrawable d ); + + + +/* + * Bind a buffer to a context and make the context the current one. + */ +extern GLboolean XMesaMakeCurrent( XMesaContext c, + XMesaBuffer b ); + + +/* + * Bind two buffers (read and draw) to a context and make the + * context the current one. + * New in Mesa 3.3 + */ +extern GLboolean XMesaMakeCurrent2( XMesaContext c, + XMesaBuffer drawBuffer, + XMesaBuffer readBuffer ); + + +/* + * Unbind the current context from its buffer. + */ +extern GLboolean XMesaUnbindContext( XMesaContext c ); + + +/* + * Return a handle to the current context. + */ +extern XMesaContext XMesaGetCurrentContext( void ); + + +/* + * Return handle to the current (draw) buffer. + */ +extern XMesaBuffer XMesaGetCurrentBuffer( void ); + + +/* + * Return handle to the current read buffer. + * New in Mesa 3.3 + */ +extern XMesaBuffer XMesaGetCurrentReadBuffer( void ); + + +/* + * Swap the front and back buffers for the given buffer. No action is + * taken if the buffer is not double buffered. + */ +extern void XMesaSwapBuffers( XMesaBuffer b ); + + +/* + * Copy a sub-region of the back buffer to the front buffer. + * + * New in Mesa 2.6 + */ +extern void XMesaCopySubBuffer( XMesaBuffer b, + int x, + int y, + int width, + int height ); + + +/* + * Return a pointer to the the Pixmap or XImage being used as the back + * color buffer of an XMesaBuffer. This function is a way to get "under + * the hood" of X/Mesa so one can manipulate the back buffer directly. + * Input: b - the XMesaBuffer + * Output: pixmap - pointer to back buffer's Pixmap, or 0 + * ximage - pointer to back buffer's XImage, or NULL + * Return: GL_TRUE = context is double buffered + * GL_FALSE = context is single buffered + */ +extern GLboolean XMesaGetBackBuffer( XMesaBuffer b, + XMesaPixmap *pixmap, + XMesaImage **ximage ); + + + +/* + * Return the depth buffer associated with an XMesaBuffer. + * Input: b - the XMesa buffer handle + * Output: width, height - size of buffer in pixels + * bytesPerValue - bytes per depth value (2 or 4) + * buffer - pointer to depth buffer values + * Return: GL_TRUE or GL_FALSE to indicate success or failure. + * + * New in Mesa 2.4. + */ +extern GLboolean XMesaGetDepthBuffer( XMesaBuffer b, + GLint *width, + GLint *height, + GLint *bytesPerValue, + void **buffer ); + + + +/* + * Flush/sync a context + */ +extern void XMesaFlush( XMesaContext c ); + + + +/* + * Get an X/Mesa-specific string. + * Input: name - either XMESA_VERSION or XMESA_EXTENSIONS + */ +extern const char *XMesaGetString( XMesaContext c, int name ); + + + +/* + * Scan for XMesaBuffers whose window/pixmap has been destroyed, then free + * any memory used by that buffer. + * + * New in Mesa 2.3. + */ +extern void XMesaGarbageCollect( void ); + + + +/* + * Return a dithered pixel value. + * Input: c - XMesaContext + * x, y - window coordinate + * red, green, blue, alpha - color components in [0,1] + * Return: pixel value + * + * New in Mesa 2.3. + */ +extern unsigned long XMesaDitherColor( XMesaContext xmesa, + GLint x, + GLint y, + GLfloat red, + GLfloat green, + GLfloat blue, + GLfloat alpha ); + + + +/* + * 3Dfx Glide driver only! + * Set 3Dfx/Glide full-screen or window rendering mode. + * Input: mode - either XMESA_FX_WINDOW (window rendering mode) or + * XMESA_FX_FULLSCREEN (full-screen rendering mode) + * Return: GL_TRUE if success + * GL_FALSE if invalid mode or if not using 3Dfx driver + * + * New in Mesa 2.6. + */ +extern GLboolean XMesaSetFXmode( GLint mode ); + + + +/* + * Reallocate the back/depth/stencil/accum/etc/ buffers associated with + * buffer if its size has changed. + * + * New in Mesa 4.0.2 + */ +extern void XMesaResizeBuffers( XMesaBuffer b ); + + + +/* + * Create a pbuffer. + * New in Mesa 4.1 + */ +extern XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap, + unsigned int width, unsigned int height); + + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/reactos/dll/mesa32/include/GL/xmesa_x.h b/reactos/dll/mesa32/include/GL/xmesa_x.h new file mode 100644 index 00000000000..1455c88adbc --- /dev/null +++ b/reactos/dll/mesa32/include/GL/xmesa_x.h @@ -0,0 +1,84 @@ + +/************************************************************************** + +Copyright 1998-1999 Precision Insight, 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 PRECISION INSIGHT 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. + +**************************************************************************/ + +/* + * Authors: + * Kevin E. Martin + * + * When we're building the XMesa driver for stand-alone Mesa we + * include this file when building the xm_*.c files. + * We need to define some types and macros differently when building + * in the Xserver vs. stand-alone Mesa. + */ + +#ifndef _XMESA_X_H_ +#define _XMESA_X_H_ + +typedef Display XMesaDisplay; +typedef Pixmap XMesaPixmap; +typedef Colormap XMesaColormap; +typedef Drawable XMesaDrawable; +typedef Window XMesaWindow; +typedef GC XMesaGC; +typedef XVisualInfo *XMesaVisualInfo; +typedef XImage XMesaImage; +typedef XPoint XMesaPoint; +typedef XColor XMesaColor; + +#define XMesaDestroyImage XDestroyImage + +#define XMesaPutPixel XPutPixel +#define XMesaGetPixel XGetPixel + +#define XMesaSetForeground XSetForeground +#define XMesaSetBackground XSetBackground +#define XMesaSetPlaneMask XSetPlaneMask +#define XMesaSetFunction XSetFunction +#define XMesaSetFillStyle XSetFillStyle +#define XMesaSetTile XSetTile + +#define XMesaDrawPoint XDrawPoint +#define XMesaDrawPoints XDrawPoints +#define XMesaFillRectangle XFillRectangle +#define XMesaPutImage XPutImage +#define XMesaCopyArea XCopyArea + +#define XMesaCreatePixmap XCreatePixmap +#define XMesaFreePixmap XFreePixmap +#define XMesaFreeGC XFreeGC + +#define GET_COLORMAP_SIZE(__v) __v->visinfo->colormap_size +#define GET_REDMASK(__v) __v->mesa_visual.redMask +#define GET_GREENMASK(__v) __v->mesa_visual.greenMask +#define GET_BLUEMASK(__v) __v->mesa_visual.blueMask +#define GET_VISUAL_DEPTH(__v) __v->visinfo->depth +#define GET_BLACK_PIXEL(__v) BlackPixel(__v->display, __v->mesa_visual.screen) +#define CHECK_BYTE_ORDER(__v) host_byte_order()==ImageByteOrder(__v->display) +#define CHECK_FOR_HPCR(__v) XInternAtom(__v->display, "_HP_RGB_SMOOTH_MAP_LIST", True) + +#endif diff --git a/reactos/dll/mesa32/include/GL/xmesa_xf86.h b/reactos/dll/mesa32/include/GL/xmesa_xf86.h new file mode 100644 index 00000000000..63a8e57dbca --- /dev/null +++ b/reactos/dll/mesa32/include/GL/xmesa_xf86.h @@ -0,0 +1,153 @@ + +/************************************************************************** + +Copyright 1998-1999 Precision Insight, 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 PRECISION INSIGHT 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. + +**************************************************************************/ + +/* + * Authors: + * Kevin E. Martin + * + * When we're building the XMesa driver for use in the X server (as the + * indirect render) we include this file when building the xm_*.c files. + * We need to define some types and macros differently when building + * in the Xserver vs. stand-alone Mesa. + */ + +#ifndef _XMESA_XF86_H_ +#define _XMESA_XF86_H_ + +#include "scrnintstr.h" +#include "pixmapstr.h" + +typedef struct _XMesaImageRec XMesaImage; + +typedef ScreenRec XMesaDisplay; +typedef PixmapPtr XMesaPixmap; +typedef ColormapPtr XMesaColormap; +typedef DrawablePtr XMesaDrawable; +typedef WindowPtr XMesaWindow; +typedef GCPtr XMesaGC; +typedef VisualPtr XMesaVisualInfo; +typedef DDXPointRec XMesaPoint; +typedef xColorItem XMesaColor; + +#define XMesaSetGeneric(__d,__gc,__val,__mask) \ +do { \ + CARD32 __v[1]; \ + (void) __d; \ + __v[0] = __val; \ + dixChangeGC(NullClient, __gc, __mask, __v, NULL); \ +} while (0) + +#define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \ +do { \ + ChangeGCVal __v[1]; \ + (void) __d; \ + __v[0].ptr = __pval; \ + dixChangeGC(NullClient, __gc, __mask, NULL, __v); \ +} while (0) + +#define XMesaSetForeground(d,gc,v) XMesaSetGeneric(d,gc,v,GCForeground) +#define XMesaSetBackground(d,gc,v) XMesaSetGeneric(d,gc,v,GCBackground) +#define XMesaSetPlaneMask(d,gc,v) XMesaSetGeneric(d,gc,v,GCPlaneMask) +#define XMesaSetFunction(d,gc,v) XMesaSetGeneric(d,gc,v,GCFunction) +#define XMesaSetFillStyle(d,gc,v) XMesaSetGeneric(d,gc,v,GCFillStyle) + +#define XMesaSetTile(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCTile) + +#define XMesaDrawPoint(__d,__b,__gc,__x,__y) \ +do { \ + XMesaPoint __p[1]; \ + (void) __d; \ + __p[0].x = __x; \ + __p[0].y = __y; \ + ValidateGC(__b, __gc); \ + (*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \ +} while (0) + +#define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \ +do { \ + (void) __d; \ + ValidateGC(__b, __gc); \ + (*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \ +} while (0) + +#define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \ +do { \ + xRectangle __r[1]; \ + (void) __d; \ + ValidateGC((DrawablePtr)__b, __gc); \ + __r[0].x = __x; \ + __r[0].y = __y; \ + __r[0].width = __w; \ + __r[0].height = __h; \ + (*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \ +} while (0) + +#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \ +do { \ + /* Assumes: Images are always in ZPixmap format */ \ + (void) __d; \ + if (__sx || __sy) /* The non-trivial case */ \ + XMesaPutImageHelper(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h); \ + ValidateGC(__b, __gc); \ + (*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \ + __x, __y, __w, __h, 0, ZPixmap, \ + ((XMesaImage *)(__i))->data); \ +} while (0) + +#define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \ +do { \ + (void) __d; \ + ValidateGC(__db, __gc); \ + (*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \ + __sx, __sy, __w, __h, __x, __y); \ +} while (0) + + +/* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */ +#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \ + (*__d->CreatePixmap)(__d, __w, __h, __depth) + +#define XMesaFreePixmap(__d,__b) \ + (*__d->DestroyPixmap)(__b) + +#define XMesaFreeGC(__d,__gc) \ +do { \ + (void) __d; \ + FreeScratchGC(__gc); \ +} while (0) + +#define GET_COLORMAP_SIZE(__v) __v->ColormapEntries +#define GET_REDMASK(__v) __v->mesa_visual.redMask +#define GET_GREENMASK(__v) __v->mesa_visual.greenMask +#define GET_BLUEMASK(__v) __v->mesa_visual.blueMask +#define GET_VISUAL_DEPTH(__v) __v->nplanes +#define GET_BLACK_PIXEL(__v) __v->display->blackPixel +#define CHECK_BYTE_ORDER(__v) GL_TRUE +#define CHECK_FOR_HPCR(__v) GL_FALSE + +#endif diff --git a/reactos/dll/mesa32/include/GLView.h b/reactos/dll/mesa32/include/GLView.h new file mode 100644 index 00000000000..8d9d25bb1cb --- /dev/null +++ b/reactos/dll/mesa32/include/GLView.h @@ -0,0 +1,192 @@ +/******************************************************************************* +/ +/ File: GLView.h +/ +/ Copyright 1993-98, Be Incorporated, All Rights Reserved. +/ +*******************************************************************************/ + +#ifndef BGLVIEW_H +#define BGLVIEW_H + +#include + +#define BGL_RGB 0 +#define BGL_INDEX 1 +#define BGL_SINGLE 0 +#define BGL_DOUBLE 2 +#define BGL_DIRECT 0 +#define BGL_INDIRECT 4 +#define BGL_ACCUM 8 +#define BGL_ALPHA 16 +#define BGL_DEPTH 32 +#define BGL_OVERLAY 64 +#define BGL_UNDERLAY 128 +#define BGL_STENCIL 512 + +#ifdef __cplusplus + + +#include +#include +#include +#include +#include +#include + +class BGLView : public BView { +public: + + BGLView(BRect rect, char *name, + ulong resizingMode, ulong mode, + ulong options); +virtual ~BGLView(); + + void LockGL(); + void UnlockGL(); + void SwapBuffers(); + void SwapBuffers( bool vSync ); + BView * EmbeddedView(); + status_t CopyPixelsOut(BPoint source, BBitmap *dest); + status_t CopyPixelsIn(BBitmap *source, BPoint dest); +virtual void ErrorCallback(unsigned long errorCode); // Mesa's GLenum is uint where Be's ones was ulong! + +virtual void Draw(BRect updateRect); + +virtual void AttachedToWindow(); +virtual void AllAttached(); +virtual void DetachedFromWindow(); +virtual void AllDetached(); + +virtual void FrameResized(float width, float height); +virtual status_t Perform(perform_code d, void *arg); + + /* The public methods below, for the moment, + are just pass-throughs to BView */ + +virtual status_t Archive(BMessage *data, bool deep = true) const; + +virtual void MessageReceived(BMessage *msg); +virtual void SetResizingMode(uint32 mode); + +virtual void Show(); +virtual void Hide(); + +virtual BHandler *ResolveSpecifier(BMessage *msg, int32 index, + BMessage *specifier, int32 form, + const char *property); +virtual status_t GetSupportedSuites(BMessage *data); + +/* New public functions */ + void DirectConnected( direct_buffer_info *info ); + void EnableDirectMode( bool enabled ); + + void * getGC() { return m_gc; } + +private: + +virtual void _ReservedGLView1(); +virtual void _ReservedGLView2(); +virtual void _ReservedGLView3(); +virtual void _ReservedGLView4(); +virtual void _ReservedGLView5(); +virtual void _ReservedGLView6(); +virtual void _ReservedGLView7(); +virtual void _ReservedGLView8(); + + BGLView(const BGLView &); + BGLView &operator=(const BGLView &); + + void dither_front(); + bool confirm_dither(); + void draw(BRect r); + + void * m_gc; + uint32 m_options; + uint32 m_ditherCount; + BLocker m_drawLock; + BLocker m_displayLock; + void * m_clip_info; + void * _Unused1; + + BBitmap * m_ditherMap; + BRect m_bounds; + int16 * m_errorBuffer[2]; + uint64 _reserved[8]; + + /* Direct Window stuff */ +private: + void drawScanline( int x1, int x2, int y, void *data ); +static void scanlineHandler(struct rasStateRec *state, GLint x1, GLint x2); + + void lock_draw(); + void unlock_draw(); + bool validateView(); +}; + + + +class BGLScreen : public BWindowScreen { +public: + BGLScreen(char *name, + ulong screenMode, ulong options, + status_t *error, bool debug=false); + ~BGLScreen(); + + void LockGL(); + void UnlockGL(); + void SwapBuffers(); + virtual void ErrorCallback(GLenum errorCode); + + virtual void ScreenConnected(bool connected); + virtual void FrameResized(float width, float height); + virtual status_t Perform(perform_code d, void *arg); + + /* The public methods below, for the moment, + are just pass-throughs to BWindowScreen */ + + virtual status_t Archive(BMessage *data, bool deep = true) const; + virtual void MessageReceived(BMessage *msg); + + virtual void Show(); + virtual void Hide(); + + virtual BHandler *ResolveSpecifier(BMessage *msg, + int32 index, + BMessage *specifier, + int32 form, + const char *property); + virtual status_t GetSupportedSuites(BMessage *data); + +private: + + virtual void _ReservedGLScreen1(); + virtual void _ReservedGLScreen2(); + virtual void _ReservedGLScreen3(); + virtual void _ReservedGLScreen4(); + virtual void _ReservedGLScreen5(); + virtual void _ReservedGLScreen6(); + virtual void _ReservedGLScreen7(); + virtual void _ReservedGLScreen8(); + + BGLScreen(const BGLScreen &); + BGLScreen &operator=(const BGLScreen &); + + void * m_gc; + long m_options; + BLocker m_drawLock; + + int32 m_colorSpace; + uint32 m_screen_mode; + + uint64 _reserved[7]; +}; + +#endif // __cplusplus + +#endif // BGLVIEW_H + + + + + diff --git a/reactos/dll/mesa32/mesa32.xml b/reactos/dll/mesa32/mesa32.xml new file mode 100644 index 00000000000..4f221d1acbb --- /dev/null +++ b/reactos/dll/mesa32/mesa32.xml @@ -0,0 +1,213 @@ + + + + -Wl,--enable-stdcall-fixup + ntdll + kernel32 + + + + gdi32 + + + + + + + + + include + src + src/main + src/glapi + src/math + src/tnl + src/shader + src/shader/grammar + src/shader/slang + src/shader/slang/OSDependent/Linux + src/shader/slang/OGLCompilersDLL + src/main/api_arrayelt.c + src/main/api_loopback.c + src/main/api_noop.c + src/main/api_validate.c + src/main/accum.c + src/main/attrib.c + src/main/blend.c + src/main/bufferobj.c + src/main/buffers.c + src/main/clip.c + src/main/colortab.c + src/main/context.c + src/main/convolve.c + src/main/debug.c + src/main/depth.c + src/main/dispatch.c + src/main/dlist.c + src/main/drawpix.c + src/main/enable.c + src/main/enums.c + src/main/eval.c + src/main/execmem.c + src/main/extensions.c + src/main/fbobject.c + src/main/feedback.c + src/main/fog.c + src/main/framebuffer.c + src/main/get.c + src/main/getstring.c + src/main/hash.c + src/main/hint.c + src/main/histogram.c + src/main/image.c + src/main/imports.c + src/main/light.c + src/main/lines.c + src/main/matrix.c + src/main/mm.c + src/main/occlude.c + src/main/pixel.c + src/main/points.c + src/main/polygon.c + src/main/rastpos.c + src/main/renderbuffer.c + src/main/state.c + src/main/stencil.c + src/main/texcompress.c + src/main/texcompress_s3tc.c + src/main/texcompress_fxt1.c + src/main/texenvprogram.c + src/main/texformat.c + src/main/teximage.c + src/main/texrender.c + src/main/texobj.c + src/main/texstate.c + src/main/texstore.c + src/main/varray.c + src/main/vtxfmt.c + src/glapi/glapi.c + src/glapi/glthread.c + src/math/m_debug_clip.c + src/math/m_debug_norm.c + src/math/m_debug_xform.c + src/math/m_eval.c + src/math/m_matrix.c + src/math/m_translate.c + src/math/m_vector.c + src/math/m_xform.c + src/array_cache/ac_context.c + src/array_cache/ac_import.c + src/tnl/t_array_api.c + src/tnl/t_array_import.c + src/tnl/t_context.c + src/tnl/t_pipeline.c + src/tnl/t_save_api.c + src/tnl/t_save_loopback.c + src/tnl/t_save_playback.c + src/tnl/t_vb_arbprogram.c + src/tnl/t_vb_arbprogram_sse.c + src/tnl/t_vb_program.c + src/tnl/t_vb_render.c + src/tnl/t_vb_texgen.c + src/tnl/t_vb_texmat.c + src/tnl/t_vb_vertex.c + src/tnl/t_vb_cull.c + src/tnl/t_vb_fog.c + src/tnl/t_vb_light.c + src/tnl/t_vb_normals.c + src/tnl/t_vb_points.c + src/tnl/t_vp_build.c + src/tnl/t_vertex.c + src/tnl/t_vertex_sse.c + src/tnl/t_vertex_generic.c + src/tnl/t_vtx_api.c + src/tnl/t_vtx_generic.c + src/tnl/t_vtx_x86.c + src/tnl/t_vtx_eval.c + src/tnl/t_vtx_exec.c + src/shader/arbfragparse.c + src/shader/arbprogparse.c + src/shader/arbprogram.c + src/shader/arbvertparse.c + src/shader/atifragshader.c + src/shader/grammar/grammar_mesa.c + src/shader/nvfragparse.c + src/shader/nvprogram.c + src/shader/nvvertexec.c + src/shader/nvvertparse.c + src/shader/program.c + src/shader/shaderobjects.c + src/shader/shaderobjects_3dlabs.c + src/swrast/s_fragprog_to_c.c + src/swrast/s_aaline.c + src/swrast/s_aatriangle.c + src/swrast/s_accum.c + src/swrast/s_alpha.c + src/swrast/s_atifragshader.c + src/swrast/s_bitmap.c + src/swrast/s_blend.c + src/swrast/s_buffers.c + src/swrast/s_copypix.c + src/swrast/s_context.c + src/swrast/s_depth.c + src/swrast/s_drawpix.c + src/swrast/s_feedback.c + src/swrast/s_fog.c + src/swrast/s_imaging.c + src/swrast/s_lines.c + src/swrast/s_logic.c + src/swrast/s_masking.c + src/swrast/s_nvfragprog.c + src/swrast/s_pixeltex.c + src/swrast/s_points.c + src/swrast/s_readpix.c + src/swrast/s_span.c + src/swrast/s_stencil.c + src/swrast/s_tcc.c + src/swrast/s_texture.c + src/swrast/s_texstore.c + src/swrast/s_triangle.c + src/swrast/s_zoom.c + src/swrast_setup/ss_context.c + src/swrast_setup/ss_triangle.c + src/x86/common_x86.c + src/x86/x86.c + src/x86/3dnow.c + src/x86/sse.c + src/x86/rtasm/x86sse.c + src/sparc/sparc.c + src/ppc/common_ppc.c + src/x86-64/x86-64.c + src/shader/slang/slang_assemble.c + src/shader/slang/slang_assemble_assignment.c + src/shader/slang/slang_assemble_conditional.c + src/shader/slang/slang_assemble_constructor.c + src/shader/slang/slang_assemble_typeinfo.c + src/shader/slang/slang_compile.c + src/shader/slang/slang_execute.c + src/shader/slang/slang_preprocess.c + src/shader/slang/slang_storage.c + src/shader/slang/slang_utility.c + src/x86/common_x86_asm.S + src/x86/x86_xform2.S + src/x86/x86_xform3.S + src/x86/x86_xform4.S + src/x86/x86_cliptest.S + src/x86/mmx_blend.S + src/x86/3dnow_xform1.S + src/x86/3dnow_xform2.S + src/x86/3dnow_xform3.S + src/x86/3dnow_xform4.S + src/x86/3dnow_normal.S + src/x86/sse_xform1.S + src/x86/sse_xform2.S + src/x86/sse_xform3.S + src/x86/sse_xform4.S + src/x86/sse_normal.S + src/x86/read_rgba_span_x86.S + src/tnl/t_vtx_x86_gcc.S + src/x86/glapi_x86.S + src/drivers/common/driverfuncs.c + src/drivers/windows/gdi/wmesa.c + src/drivers/windows/icd/icd.c + diff --git a/reactos/dll/mesa32/src/Makefile b/reactos/dll/mesa32/src/Makefile new file mode 100644 index 00000000000..b6c0b85f421 --- /dev/null +++ b/reactos/dll/mesa32/src/Makefile @@ -0,0 +1,230 @@ +# src/mesa/Makefile + +TOP = ../.. +include $(TOP)/configs/current + +include sources + + +GL_MAJOR = 1 +GL_MINOR = 5 +GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) + + +.SUFFIXES : .cpp + +.c.o: + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ + +.cpp.o: + $(CXX) -c $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@ + +.S.o: + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ + + +# Figure out what to make here +default: + @if [ "${DRIVER_DIRS}" = "dri" ] ; then \ + $(MAKE) linux-solo ; \ + elif [ "${DRIVER_DIRS}" = "osmesa" ] ; then \ + $(MAKE) osmesa-only ; \ + elif [ "$(DRIVER_DIRS)" = "beos" ]; then \ + $(MAKE) beos ; \ + elif [ "$(DRIVER_DIRS)" = "directfb" ]; then \ + $(MAKE) directfb; \ + else \ + $(MAKE) stand-alone ; \ + fi + +# BeOS driver target +beos: depend subdirs mesa.a + cd drivers/beos; $(MAKE) + + +install: default + @if [ "${DRIVER_DIRS}" = "dri" ] ; then \ + cd drivers/dri ; $(MAKE) install ; \ + fi + +###################################################################### +# Linux solo DRI drivers + +SOLO_C_SOURCES = \ + $(MAIN_SOURCES) \ + $(MATH_SOURCES) \ + $(ARRAY_CACHE_SOURCES) \ + $(TNL_SOURCES) \ + $(SWRAST_SOURCES) \ + $(SWRAST_SETUP_SOURCES) \ + $(SHADER_SOURCES) \ + $(SLANG_SOURCES) \ + $(ASM_C_SOURCES) + +SOLO_OBJECTS = $(SOLO_C_SOURCES:.c=.o) \ + $(ASM_SOURCES:.S=.o) + +linux-solo: depend subdirs mesa.a drivers-dri + +# Make archive of core object files +mesa.a: $(SOLO_OBJECTS) + rm -f $@ + ar rcv $@ $(SOLO_OBJECTS) + ranlib $@ + @if [ "${CONFIG_NAME}" = "beos" ] ; then \ + mimeset -f "$@" ; \ + fi + +# note: cannot use the name of the directory ("drivers") as the +# target, otherwise make will look & see that the "drivers" directory +# already exists, so not try to rebuild it... +drivers-dri: + cd drivers/dri ; $(MAKE) + + + +##################################################################### +# Stand-alone Mesa libGL, no built-in drivers (DirectFB) + +LIBGL_CORE_SOURCES = \ + $(CORE_SOURCES) \ + $(ASM_SOURCES) + +LIBGL_CORE_OBJECTS = \ + $(CORE_OBJECTS) \ + $(ASM_SOURCES:.S=.o) + +# Make libGL from core object files +libgl-core: $(LIBGL_CORE_OBJECTS) + @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \ + -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ + -install $(LIB_DIR) $(MKLIB_OPTIONS) $(LIBGL_CORE_OBJECTS) $(GL_LIB_DEPS) + +# DirectFB driver target +directfb: depend subdirs libgl-core + cd drivers/directfb; $(MAKE) + + + +###################################################################### +# Stand-alone Mesa libGL and libOSMesa + +STAND_ALONE_DRIVER_SOURCES = \ + $(COMMON_DRIVER_SOURCES) \ + $(X11_DRIVER_SOURCES) \ + $(GLIDE_DRIVER_SOURCES) \ + $(SVGA_DRIVER_SOURCES) \ + $(FBDEV_DRIVER_SOURCES) + +STAND_ALONE_SOURCES = \ + $(CORE_SOURCES) \ + $(ASM_SOURCES) \ + $(STAND_ALONE_DRIVER_SOURCES) + +# ASM_SOURCES is defined in the config file +ASM_OBJECTS = $(ASM_SOURCES:.S=.o) + +STAND_ALONE_DRIVER_OBJECTS = $(STAND_ALONE_DRIVER_SOURCES:.c=.o) + +STAND_ALONE_OBJECTS = \ + $(CORE_OBJECTS) \ + $(ASM_OBJECTS) \ + $(STAND_ALONE_DRIVER_OBJECTS) + +# For libOSMesa16 or libOSMesa32 we link _all_ the objects into the library, +# not just the osmesa.o object (i.e. we don't have a libGL). +OSMESA16_OBJECTS = \ + $(CORE_OBJECTS) \ + $(ASM_OBJECTS) \ + $(COMMON_DRIVER_OBJECTS) \ + $(OSMESA_DRIVER_OBJECTS) + + +stand-alone: depend subdirs $(LIB_DIR)/$(GL_LIB_NAME) $(LIB_DIR)/$(OSMESA_LIB_NAME) + +osmesa-only: depend subdirs $(LIB_DIR)/$(OSMESA_LIB_NAME) + +subdirs: + @ (cd x86 ; $(MAKE)) + @ (cd x86-64 ; $(MAKE)) + +# Make the GL library +$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS) + @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \ + -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \ + -install $(LIB_DIR) \ + $(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(STAND_ALONE_OBJECTS) + +# Make the OSMesa library +$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECTS) + @ if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \ + $(TOP)/bin/mklib -o $(OSMESA_LIB) -linker '$(CC)' \ + -major $(MESA_MAJOR) \ + -minor $(MESA_MINOR) -patch $(MESA_TINY) \ + -install $(LIB_DIR) $(MKLIB_OPTIONS) \ + $(OSMESA_LIB_DEPS) $(OSMESA16_OBJECTS) ; \ + else \ + $(TOP)/bin/mklib -o $(OSMESA_LIB) -linker '$(CC)' \ + -major $(MESA_MAJOR) \ + -minor $(MESA_MINOR) -patch $(GL_TINY) \ + -install $(LIB_DIR) $(MKLIB_OPTIONS) \ + $(OSMESA_LIB_DEPS) $(OSMESA_DRIVER_OBJECTS) ; \ + fi + + +###################################################################### +# 16 (or 32) bit/channel OSMesa + +# $(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA16_OBJECTS) +# $(TOP)/bin/mklib -o $(OSMESA_LIB) \ +# -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ +# -install $(LIB_DIR) \ +# $(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(OSMESA16_OBJECTS) + + + +###################################################################### +# Generic stuff + +ALL_SOURCES = \ + $(GLAPI_SOURCES) \ + $(MAIN_SOURCES) \ + $(MATH_SOURCES) \ + $(ARRAY_CACHE_SOURCES) \ + $(TNL_SOURCES) \ + $(SHADER_SOURCES) \ + $(SWRAST_SOURCES) \ + $(SWRAST_SETUP_SOURCES) \ + $(ASM_C_SOURCES) \ + $(X86_SOURCES) \ + $(COMMON_DRIVER_SOURCES)\ + $(X11_DRIVER_SOURCES) \ + $(OSMESA_DRIVER_SOURCES) + + +SUBDIRS = array_cache drivers/dri glapi main math sparc swrast swrast_setup \ + tnl tnl_dd + + +# Update dependencies +depend: $(ALL_SOURCES) + @ echo "running $(MKDEP)" + @ touch depend + $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \ + > /dev/null + + +# Emacs tags +tags: + etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h + +clean: + -rm -f */*.o + -rm -f */*/*.o + -rm -f depend depend.bak mesa.a + -rm -f drivers/*/*.o + (cd drivers/dri ; $(MAKE) clean) + (cd x86 ; $(MAKE) clean) + (cd x86-64 ; $(MAKE) clean) + +include depend diff --git a/reactos/dll/mesa32/src/Makefile.DJ b/reactos/dll/mesa32/src/Makefile.DJ new file mode 100644 index 00000000000..53c4370703e --- /dev/null +++ b/reactos/dll/mesa32/src/Makefile.DJ @@ -0,0 +1,168 @@ +# 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. + +# DOS/DJGPP core makefile v1.7 for Mesa +# +# Copyright (C) 2002 - Daniel Borca +# Email : dborca@users.sourceforge.net +# Web : http://www.geocities.com/dborca + + +# +# Available options: +# +# Environment variables: +# CFLAGS +# +# GLIDE path to Glide3 SDK; used with FX. +# default = $(TOP)/glide3 +# FX=1 build for 3dfx Glide3. Note that this disables +# compilation of most DMesa code and requires fxMesa. +# As a consequence, you'll need the DJGPP Glide3 +# library to build any application. +# default = no +# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). +# default = no +# +# Targets: +# all: build GL +# clean: remove object files +# + + + +.PHONY: all clean +.INTERMEDIATE: x86/gen_matypes.exe + +TOP = ../.. +GLIDE ?= $(TOP)/glide3 +LIBDIR = $(TOP)/lib +GL_LIB = libgl.a +GL_DXE = gl.dxe +GL_IMP = libigl.a + +export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH);$(LIBDIR);$(GLIDE)/lib + +CC = gcc +CFLAGS += $(INCLUDE_DIRS) +CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1 +ifeq ($(FX),1) +CFLAGS += -D__DOS__ +CFLAGS += -I$(GLIDE)/include -DFX +LIBNAME = "Mesa/FX DJGPP" +else +LIBNAME = "Mesa DJGPP" +endif + +AR = ar +ARFLAGS = crus + +HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe) + +ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) +UNLINK = del $(subst /,\,$(1)) +else +UNLINK = $(RM) $(1) +endif + +include sources + +ifeq ($(X86),1) +CFLAGS += -DUSE_X86_ASM +CFLAGS += -DUSE_MMX_ASM +CFLAGS += -DUSE_SSE_ASM +CFLAGS += -DUSE_3DNOW_ASM +X86_SOURCES += $(X86_API) +else +X86_SOURCES = +endif + +DRIVER_SOURCES = \ + drivers/dos/dmesa.c +ifeq ($(FX),1) +DRIVER_SOURCES += \ + $(GLIDE_DRIVER_SOURCES) +else +DRIVER_SOURCES += \ + drivers/dos/video.c \ + drivers/dos/virtual.S \ + drivers/dos/vesa.c \ + drivers/dos/blit.S \ + drivers/dos/vga.c \ + drivers/dos/null.c \ + drivers/dos/dpmi.c +endif + +#DRIVER_SOURCES += $(OSMESA_DRIVER_SOURCES) + +SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(COMMON_DRIVER_SOURCES) $(DRIVER_SOURCES) + +OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) + +X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES))) + +.c.o: + $(CC) -o $@ $(CFLAGS) -c $< +.S.o: + $(CC) -o $@ $(CFLAGS) -c $< +.s.o: + $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $< + +all: $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_IMP) + +$(LIBDIR)/$(GL_LIB): $(OBJECTS) + $(AR) $(ARFLAGS) $@ $^ + +$(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_IMP): $(OBJECTS) +ifeq ($(HAVEDXE3),) + $(warning Missing DXE3 package... Skipping $(GL_DXE)) +else +ifeq ($(FX),1) + -dxe3gen -o $(LIBDIR)/$(GL_DXE) -Y $(LIBDIR)/$(GL_IMP) -D $(LIBNAME) -E _gl -E _DMesa -P glide3x.dxe -U $^ +else + -dxe3gen -o $(LIBDIR)/$(GL_DXE) -Y $(LIBDIR)/$(GL_IMP) -D $(LIBNAME) -E _gl -E _DMesa -U $^ +endif +endif + +$(X86_OBJECTS): x86/matypes.h + +x86/matypes.h: x86/gen_matypes.exe + $< > $@ + +x86/gen_matypes.exe: x86/gen_matypes.c + $(CC) -o $@ $(CFLAGS) -s $< + +clean: + -$(call UNLINK,array_cache/*.o) + -$(call UNLINK,glapi/*.o) + -$(call UNLINK,main/*.o) + -$(call UNLINK,math/*.o) + -$(call UNLINK,shader/*.o) + -$(call UNLINK,sparc/*.o) + -$(call UNLINK,ppc/*.o) + -$(call UNLINK,swrast/*.o) + -$(call UNLINK,swrast_setup/*.o) + -$(call UNLINK,tnl/*.o) + -$(call UNLINK,x86/*.o) + -$(call UNLINK,drivers/common/*.o) + -$(call UNLINK,drivers/dos/*.o) + -$(call UNLINK,drivers/glide/*.o) diff --git a/reactos/dll/mesa32/src/Makefile.mgw b/reactos/dll/mesa32/src/Makefile.mgw new file mode 100644 index 00000000000..ebec5c055a8 --- /dev/null +++ b/reactos/dll/mesa32/src/Makefile.mgw @@ -0,0 +1,206 @@ +# 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. + +# MinGW core makefile v1.4 for Mesa +# +# Copyright (C) 2002 - Daniel Borca +# Email : dborca@users.sourceforge.net +# Web : http://www.geocities.com/dborca + + +# +# Available options: +# +# Environment variables: +# CFLAGS +# +# GLIDE path to Glide3 SDK; used with FX. +# default = $(TOP)/glide3 +# FX=1 build for 3dfx Glide3. Note that this disables +# compilation of most WMesa code and requires fxMesa. +# As a consequence, you'll need the Win32 Glide3 +# library to build any application. +# default = no +# ICD=1 build the installable client driver interface +# (windows opengl driver interface) +# default = no +# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). +# default = no +# +# Targets: +# all: build GL +# clean: remove object files +# + + + +.PHONY: all clean +.INTERMEDIATE: x86/gen_matypes.exe +.SUFFIXES: .rc .res + +# Set this to the prefix of your build tools, i.e. mingw32- +TOOLS_PREFIX = mingw32- + +TOP = ../.. +GLIDE ?= $(TOP)/glide3 +LIBDIR = $(TOP)/lib +ifeq ($(ICD),1) + GL_DLL = mesa32.dll + GL_IMP = libmesa32.a +else + GL_DLL = opengl32.dll + GL_IMP = libopengl32.a +endif + +LDLIBS = -lgdi32 + +CC = $(TOOLS_PREFIX)gcc +CFLAGS += -DBUILD_GL32 -D_OPENGL32_ +CFLAGS += $(INCLUDE_DIRS) +CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1 +ifeq ($(FX),1) + CFLAGS += -I$(GLIDE)/include -DFX + LDLIBS += -L$(GLIDE)/lib -lglide3x + GL_DEF = drivers/windows/fx/fxopengl.def + GL_RES = drivers/windows/fx/fx.rc +else + ifeq ($(ICD),1) + CFLAGS += -DUSE_MGL_NAMESPACE + GL_DEF = drivers/windows/icd/mesa.def + else + GL_DEF = drivers/windows/gdi/mesa.def + endif +endif + +AR = ar +ARFLAGS = crus + +UNLINK = del $(subst /,\,$(1)) +ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) +UNLINK = $(RM) $(1) +endif +ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),) +UNLINK = $(RM) $(1) +endif + +include sources + +ifeq ($(X86),1) +CFLAGS += -DUSE_X86_ASM +CFLAGS += -DUSE_MMX_ASM +CFLAGS += -DUSE_SSE_ASM +CFLAGS += -DUSE_3DNOW_ASM +X86_SOURCES += $(X86_API) +else +X86_SOURCES = +endif + +ifeq ($(FX),1) +DRIVER_SOURCES = \ + $(GLIDE_DRIVER_SOURCES) \ + drivers/windows/fx/fxwgl.c +else +ifeq ($(ICD),1) +DRIVER_SOURCES = \ + drivers/windows/gdi/wmesa.c \ + drivers/windows/icd/icd.c +else +DRIVER_SOURCES = \ + drivers/windows/gdi/wmesa.c \ + drivers/windows/gdi/wgl.c +endif +endif + +SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(COMMON_DRIVER_SOURCES) $(DRIVER_SOURCES) + +OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) + +X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES))) + +RESOURCE = $(GL_RES:.rc=.res) + +.c.o: + $(CC) -o $@ $(CFLAGS) -c $< +.S.o: + $(CC) -o $@ $(CFLAGS) -c $< +.s.o: + $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $< +.rc.res: + windres -o $@ -Irc -Ocoff $< + +all: $(LIBDIR) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP) + +$(LIBDIR): + mkdir -p $(LIBDIR) + +$(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE) + $(TOOLS_PREFIX)dllwrap -o $(LIBDIR)/$(GL_DLL) --output-lib $(LIBDIR)/$(GL_IMP) \ + --target i386-mingw32 --def $(GL_DEF) -Wl,-enable-stdcall-fixup \ + $^ $(LDLIBS) + +$(X86_OBJECTS): x86/matypes.h + +x86/matypes.h: x86/gen_matypes.exe + $(subst /,\,$< > $@) + +x86/gen_matypes.exe: x86/gen_matypes.c + $(CC) -o $@ $(CFLAGS) -s $< + +# [dBorca] +# glapi_x86.S needs some adjustments +# in order to generate correct entrypoints +# Trick: change the following condition to +# be always false if you need C entrypoints +# with USE_X86_ASM (useful for trace/debug) +ifeq (1,1) +x86/glapi_x86.o: x86/glapi_x86.S + $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $< +else +main/dispatch.o: main/dispatch.c + $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $< +glapi/glapi.o: glapi/glapi.c + $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $< +endif + +# [dBorca] +# if we want codegen, we have to stdcall +tnl/t_vtx_x86_gcc.o: tnl/t_vtx_x86_gcc.S + $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $< + +clean: + -$(call UNLINK,array_cache/*.o) + -$(call UNLINK,glapi/*.o) + -$(call UNLINK,main/*.o) + -$(call UNLINK,math/*.o) + -$(call UNLINK,shader/*.o) + -$(call UNLINK,sparc/*.o) + -$(call UNLINK,ppc/*.o) + -$(call UNLINK,swrast/*.o) + -$(call UNLINK,swrast_setup/*.o) + -$(call UNLINK,tnl/*.o) + -$(call UNLINK,x86/*.o) + -$(call UNLINK,drivers/common/*.o) + -$(call UNLINK,drivers/glide/*.o) + -$(call UNLINK,drivers/windows/fx/*.o) + -$(call UNLINK,drivers/windows/fx/*.res) + -$(call UNLINK,drivers/windows/gdi/*.o) + -$(call UNLINK,drivers/windows/icd/*.o) diff --git a/reactos/dll/mesa32/src/array_cache/ac_context.c b/reactos/dll/mesa32/src/array_cache/ac_context.c new file mode 100644 index 00000000000..ebf3a3dc47b --- /dev/null +++ b/reactos/dll/mesa32/src/array_cache/ac_context.c @@ -0,0 +1,375 @@ +/* + * 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: + * Keith Whitwell + */ + +#include "glheader.h" +#include "macros.h" +#include "imports.h" +#include "mtypes.h" + +#include "array_cache/ac_context.h" + + +/* + * Initialize the array fallbacks. That is, by default the fallback arrays + * point into the current vertex attribute values in ctx->Current.Attrib[] + */ +static void _ac_fallbacks_init( GLcontext *ctx ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + struct gl_client_array *cl; + GLuint i; + + cl = &ac->Fallback.Normal; + cl->Size = 3; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 0; + cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; + cl->Enabled = 1; + cl->Flags = CA_CLIENT_DATA; /* hack */ +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + + cl = &ac->Fallback.Color; + cl->Size = 4; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 0; + cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; + cl->Enabled = 1; + cl->Flags = CA_CLIENT_DATA; /* hack */ +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + + cl = &ac->Fallback.SecondaryColor; + cl->Size = 3; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 0; + cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; + cl->Enabled = 1; + cl->Flags = CA_CLIENT_DATA; /* hack */ +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + + cl = &ac->Fallback.FogCoord; + cl->Size = 1; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 0; + cl->Ptr = (GLubyte *) &ctx->Current.Attrib[VERT_ATTRIB_FOG]; + cl->Enabled = 1; + cl->Flags = CA_CLIENT_DATA; /* hack */ +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + + cl = &ac->Fallback.Index; + cl->Size = 1; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 0; + cl->Ptr = (GLubyte *) &ctx->Current.Index; + cl->Enabled = 1; + cl->Flags = CA_CLIENT_DATA; /* hack */ +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + + for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++) { + cl = &ac->Fallback.TexCoord[i]; + cl->Size = 4; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 0; + cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i]; + cl->Enabled = 1; + cl->Flags = CA_CLIENT_DATA; /* hack */ +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + } + + cl = &ac->Fallback.EdgeFlag; + cl->Size = 1; + cl->Type = GL_UNSIGNED_BYTE; + cl->Stride = 0; + cl->StrideB = 0; + cl->Ptr = (GLubyte *) &ctx->Current.EdgeFlag; + cl->Enabled = 1; + cl->Flags = CA_CLIENT_DATA; /* hack */ +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + + for (i = 0; i < VERT_ATTRIB_MAX; i++) { + cl = &ac->Fallback.Attrib[i]; + cl->Size = 4; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 0; + cl->Ptr = (GLubyte *) ctx->Current.Attrib[i]; + cl->Enabled = 1; + cl->Flags = CA_CLIENT_DATA; /* hack */ +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + } +} + + +/* + * Initialize the array cache pointers, types, strides, etc. + */ +static void _ac_cache_init( GLcontext *ctx ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + struct gl_client_array *cl; + GLuint size = ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES; + GLuint i; + + cl = &ac->Cache.Vertex; + cl->Size = 4; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 4 * sizeof(GLfloat); + cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); + cl->Enabled = 1; + cl->Flags = 0; +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + + cl = &ac->Cache.Normal; + cl->Size = 3; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 3 * sizeof(GLfloat); + cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); + cl->Enabled = 1; + cl->Flags = 0; +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + + cl = &ac->Cache.Color; + cl->Size = 4; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 4 * sizeof(GLfloat); + cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); + cl->Enabled = 1; + cl->Flags = 0; +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + + cl = &ac->Cache.SecondaryColor; + cl->Size = 3; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 4 * sizeof(GLfloat); + cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); + cl->Enabled = 1; + cl->Flags = 0; +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + + cl = &ac->Cache.FogCoord; + cl->Size = 1; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = sizeof(GLfloat); + cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); + cl->Enabled = 1; + cl->Flags = 0; +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + + cl = &ac->Cache.Index; + cl->Size = 1; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = sizeof(GLfloat); + cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); + cl->Enabled = 1; + cl->Flags = 0; +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + + for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { + cl = &ac->Cache.TexCoord[i]; + cl->Size = 4; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 4 * sizeof(GLfloat); + cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); + cl->Enabled = 1; + cl->Flags = 0; +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + } + + cl = &ac->Cache.EdgeFlag; + cl->Size = 1; + cl->Type = GL_UNSIGNED_BYTE; + cl->Stride = 0; + cl->StrideB = sizeof(GLubyte); + cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); + cl->Enabled = 1; + cl->Flags = 0; +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + + for (i = 0 ; i < VERT_ATTRIB_MAX; i++) { + cl = &ac->Cache.Attrib[i]; + cl->Size = 4; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 4 * sizeof(GLfloat); + cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); + cl->Enabled = 1; + cl->Flags = 0; +#if FEATURE_ARB_vertex_buffer_object + cl->BufferObj = ctx->Array.NullBufferObj; +#endif + } +} + + +/* This storage used to hold translated client data if type or stride + * need to be fixed. + */ +static void _ac_elts_init( GLcontext *ctx ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + GLuint size = 1000; + + ac->Elts = (GLuint *)MALLOC( sizeof(GLuint) * size ); + ac->elt_size = size; +} + +static void _ac_raw_init( GLcontext *ctx ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + GLuint i; + + ac->Raw.Color = ac->Fallback.Color; + ac->Raw.EdgeFlag = ac->Fallback.EdgeFlag; + ac->Raw.FogCoord = ac->Fallback.FogCoord; + ac->Raw.Index = ac->Fallback.Index; + ac->Raw.Normal = ac->Fallback.Normal; + ac->Raw.SecondaryColor = ac->Fallback.SecondaryColor; + ac->Raw.Vertex = ctx->Array.Vertex; + + ac->IsCached.Color = GL_FALSE; + ac->IsCached.EdgeFlag = GL_FALSE; + ac->IsCached.FogCoord = GL_FALSE; + ac->IsCached.Index = GL_FALSE; + ac->IsCached.Normal = GL_FALSE; + ac->IsCached.SecondaryColor = GL_FALSE; + ac->IsCached.Vertex = GL_FALSE; + + for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++) { + ac->Raw.TexCoord[i] = ac->Fallback.TexCoord[i]; + ac->IsCached.TexCoord[i] = GL_FALSE; + } + + for (i = 0 ; i < VERT_ATTRIB_MAX ; i++) { + ac->Raw.Attrib[i] = ac->Fallback.Attrib[i]; + ac->IsCached.Attrib[i] = GL_FALSE; + } +} + +GLboolean _ac_CreateContext( GLcontext *ctx ) +{ + ctx->acache_context = CALLOC(sizeof(ACcontext)); + if (ctx->acache_context) { + _ac_cache_init( ctx ); + _ac_fallbacks_init( ctx ); + _ac_raw_init( ctx ); + _ac_elts_init( ctx ); + return GL_TRUE; + } + return GL_FALSE; +} + +void _ac_DestroyContext( GLcontext *ctx ) +{ + struct gl_buffer_object *nullObj = ctx->Array.NullBufferObj; + ACcontext *ac = AC_CONTEXT(ctx); + GLint i; + + /* only free vertex data if it's really a pointer to vertex data and + * not an offset into a buffer object. + */ + if (ac->Cache.Vertex.Ptr && ac->Cache.Vertex.BufferObj == nullObj) + FREE( (void *) ac->Cache.Vertex.Ptr ); + if (ac->Cache.Normal.Ptr && ac->Cache.Normal.BufferObj == nullObj) + FREE( (void *) ac->Cache.Normal.Ptr ); + if (ac->Cache.Color.Ptr && ac->Cache.Color.BufferObj == nullObj) + FREE( (void *) ac->Cache.Color.Ptr ); + if (ac->Cache.SecondaryColor.Ptr && ac->Cache.SecondaryColor.BufferObj == nullObj) + FREE( (void *) ac->Cache.SecondaryColor.Ptr ); + if (ac->Cache.EdgeFlag.Ptr && ac->Cache.EdgeFlag.BufferObj == nullObj) + FREE( (void *) ac->Cache.EdgeFlag.Ptr ); + if (ac->Cache.Index.Ptr && ac->Cache.Index.BufferObj == nullObj) + FREE( (void *) ac->Cache.Index.Ptr ); + if (ac->Cache.FogCoord.Ptr && ac->Cache.FogCoord.BufferObj == nullObj) + FREE( (void *) ac->Cache.FogCoord.Ptr ); + + for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { + if (ac->Cache.TexCoord[i].Ptr && ac->Cache.TexCoord[i].BufferObj == nullObj) + FREE( (void *) ac->Cache.TexCoord[i].Ptr ); + } + + for (i = 0; i < VERT_ATTRIB_MAX; i++) { + if (ac->Cache.Attrib[i].Ptr && ac->Cache.Attrib[i].BufferObj == nullObj) + FREE( (void *) ac->Cache.Attrib[i].Ptr ); + } + + if (ac->Elts) + FREE( ac->Elts ); + + /* Free the context structure itself */ + FREE(ac); + ctx->acache_context = NULL; +} + +void _ac_InvalidateState( GLcontext *ctx, GLuint new_state ) +{ + AC_CONTEXT(ctx)->NewState |= new_state; + AC_CONTEXT(ctx)->NewArrayState |= ctx->Array.NewState; +} diff --git a/reactos/dll/mesa32/src/array_cache/ac_context.h b/reactos/dll/mesa32/src/array_cache/ac_context.h new file mode 100644 index 00000000000..36aded3152c --- /dev/null +++ b/reactos/dll/mesa32/src/array_cache/ac_context.h @@ -0,0 +1,99 @@ + +/* + * 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: + * Keith Whitwell + */ + +#ifndef _AC_CONTEXT_H +#define _AC_CONTEXT_H + +#include "glheader.h" +#include "mtypes.h" + +#include "array_cache/acache.h" + +/* These are used to make the ctx->Current values look like + * arrays (with zero StrideB). + */ +struct ac_arrays { + struct gl_client_array Vertex; + struct gl_client_array Normal; + struct gl_client_array Color; + struct gl_client_array SecondaryColor; + struct gl_client_array FogCoord; + struct gl_client_array Index; + struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS]; + struct gl_client_array EdgeFlag; + struct gl_client_array Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */ +}; + +struct ac_array_pointers { + struct gl_client_array *Vertex; + struct gl_client_array *Normal; + struct gl_client_array *Color; + struct gl_client_array *SecondaryColor; + struct gl_client_array *FogCoord; + struct gl_client_array *Index; + struct gl_client_array *TexCoord[MAX_TEXTURE_COORD_UNITS]; + struct gl_client_array *EdgeFlag; + struct gl_client_array *Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */ +}; + +struct ac_array_flags { + GLboolean Vertex; + GLboolean Normal; + GLboolean Color; + GLboolean SecondaryColor; + GLboolean FogCoord; + GLboolean Index; + GLboolean TexCoord[MAX_TEXTURE_COORD_UNITS]; + GLboolean EdgeFlag; + GLboolean Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */ +}; + + +typedef struct { + GLuint NewState; /* not needed? */ + GLuint NewArrayState; + + /* Facility for importing and caching array data: + */ + struct ac_arrays Fallback; + struct ac_arrays Cache; + struct ac_arrays Raw; + struct ac_array_flags IsCached; + GLuint start; + GLuint count; + + /* Facility for importing element lists: + */ + GLuint *Elts; + GLuint elt_size; + +} ACcontext; + +#define AC_CONTEXT(ctx) ((ACcontext *)ctx->acache_context) + +#endif diff --git a/reactos/dll/mesa32/src/array_cache/ac_import.c b/reactos/dll/mesa32/src/array_cache/ac_import.c new file mode 100644 index 00000000000..416b2e793c9 --- /dev/null +++ b/reactos/dll/mesa32/src/array_cache/ac_import.c @@ -0,0 +1,902 @@ +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +#include "glheader.h" +#include "macros.h" +#include "imports.h" +#include "mtypes.h" + +#include "math/m_translate.h" +#include "array_cache/ac_context.h" +#include "math/m_translate.h" + +#define STRIDE_ARRAY( array, offset ) \ +do { \ + GLubyte *tmp = ADD_POINTERS( (array).BufferObj->Data, (array).Ptr ) \ + + (offset) * (array).StrideB; \ + (array).Ptr = tmp; \ +} while (0) + + +/* Set the array pointer back to its source when the cached data is + * invalidated: + */ +static void +reset_texcoord( GLcontext *ctx, GLuint unit ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + if (ctx->Array.TexCoord[unit].Enabled) { + ac->Raw.TexCoord[unit] = ctx->Array.TexCoord[unit]; + STRIDE_ARRAY(ac->Raw.TexCoord[unit], ac->start); + } + else { + ac->Raw.TexCoord[unit] = ac->Fallback.TexCoord[unit]; + + if (ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3] != 1.0) + ac->Raw.TexCoord[unit].Size = 4; + else if (ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2] != 0.0) + ac->Raw.TexCoord[unit].Size = 3; + else + ac->Raw.TexCoord[unit].Size = 2; + } + + ac->IsCached.TexCoord[unit] = GL_FALSE; + ac->NewArrayState &= ~_NEW_ARRAY_TEXCOORD(unit); +} + +static void +reset_vertex( GLcontext *ctx ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + ASSERT(ctx->Array.Vertex.Enabled + || (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled)); + ac->Raw.Vertex = ctx->Array.Vertex; + STRIDE_ARRAY(ac->Raw.Vertex, ac->start); + ac->IsCached.Vertex = GL_FALSE; + ac->NewArrayState &= ~_NEW_ARRAY_VERTEX; +} + + +static void +reset_normal( GLcontext *ctx ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + if (ctx->Array.Normal.Enabled) { + ac->Raw.Normal = ctx->Array.Normal; + STRIDE_ARRAY(ac->Raw.Normal, ac->start); + } + else { + ac->Raw.Normal = ac->Fallback.Normal; + } + + ac->IsCached.Normal = GL_FALSE; + ac->NewArrayState &= ~_NEW_ARRAY_NORMAL; +} + + +static void +reset_color( GLcontext *ctx ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + if (ctx->Array.Color.Enabled) { + ac->Raw.Color = ctx->Array.Color; + STRIDE_ARRAY(ac->Raw.Color, ac->start); + } + else + ac->Raw.Color = ac->Fallback.Color; + + ac->IsCached.Color = GL_FALSE; + ac->NewArrayState &= ~_NEW_ARRAY_COLOR0; +} + + +static void +reset_secondarycolor( GLcontext *ctx ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + if (ctx->Array.SecondaryColor.Enabled) { + ac->Raw.SecondaryColor = ctx->Array.SecondaryColor; + STRIDE_ARRAY(ac->Raw.SecondaryColor, ac->start); + } + else + ac->Raw.SecondaryColor = ac->Fallback.SecondaryColor; + + ac->IsCached.SecondaryColor = GL_FALSE; + ac->NewArrayState &= ~_NEW_ARRAY_COLOR1; +} + + +static void +reset_index( GLcontext *ctx ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + if (ctx->Array.Index.Enabled) { + ac->Raw.Index = ctx->Array.Index; + STRIDE_ARRAY(ac->Raw.Index, ac->start); + } + else + ac->Raw.Index = ac->Fallback.Index; + + ac->IsCached.Index = GL_FALSE; + ac->NewArrayState &= ~_NEW_ARRAY_INDEX; +} + + +static void +reset_fogcoord( GLcontext *ctx ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + if (ctx->Array.FogCoord.Enabled) { + ac->Raw.FogCoord = ctx->Array.FogCoord; + STRIDE_ARRAY(ac->Raw.FogCoord, ac->start); + } + else + ac->Raw.FogCoord = ac->Fallback.FogCoord; + + ac->IsCached.FogCoord = GL_FALSE; + ac->NewArrayState &= ~_NEW_ARRAY_FOGCOORD; +} + + +static void +reset_edgeflag( GLcontext *ctx ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + if (ctx->Array.EdgeFlag.Enabled) { + ac->Raw.EdgeFlag = ctx->Array.EdgeFlag; + STRIDE_ARRAY(ac->Raw.EdgeFlag, ac->start); + } + else + ac->Raw.EdgeFlag = ac->Fallback.EdgeFlag; + + ac->IsCached.EdgeFlag = GL_FALSE; + ac->NewArrayState &= ~_NEW_ARRAY_EDGEFLAG; +} + + +static void +reset_attrib( GLcontext *ctx, GLuint index ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + if (ctx->Array.VertexAttrib[index].Enabled) { + ac->Raw.Attrib[index] = ctx->Array.VertexAttrib[index]; + STRIDE_ARRAY(ac->Raw.Attrib[index], ac->start); + } + else + ac->Raw.Attrib[index] = ac->Fallback.Attrib[index]; + + ac->IsCached.Attrib[index] = GL_FALSE; + ac->NewArrayState &= ~_NEW_ARRAY_ATTRIB(index); +} + + +/** + * Generic import function for color data + */ +static void +import( const GLcontext *ctx, + GLenum destType, + struct gl_client_array *to, + const struct gl_client_array *from ) +{ + const ACcontext *ac = AC_CONTEXT(ctx); + + if (destType == 0) + destType = from->Type; + + switch (destType) { + case GL_FLOAT: + _math_trans_4fc( (GLfloat (*)[4]) to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + from->Size, + 0, + ac->count - ac->start); + + to->StrideB = 4 * sizeof(GLfloat); + to->Type = GL_FLOAT; + break; + + case GL_UNSIGNED_BYTE: + _math_trans_4ub( (GLubyte (*)[4]) to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + from->Size, + 0, + ac->count - ac->start); + + to->StrideB = 4 * sizeof(GLubyte); + to->Type = GL_UNSIGNED_BYTE; + break; + + case GL_UNSIGNED_SHORT: + _math_trans_4us( (GLushort (*)[4]) to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + from->Size, + 0, + ac->count - ac->start); + + to->StrideB = 4 * sizeof(GLushort); + to->Type = GL_UNSIGNED_SHORT; + break; + + default: + _mesa_problem(ctx, "Unexpected dest format in import()"); + break; + } +} + + + +/* + * Functions to import array ranges with specified types and strides. + * For example, if the vertex data is GLshort[2] and we want GLfloat[3] + * we'll use an import function to do the data conversion. + */ + +static void +import_texcoord( GLcontext *ctx, GLuint unit, GLenum type, GLuint stride ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + const struct gl_client_array *from = &ac->Raw.TexCoord[unit]; + struct gl_client_array *to = &ac->Cache.TexCoord[unit]; + (void) type; (void) stride; + + ASSERT(unit < ctx->Const.MaxTextureCoordUnits); + + /* Limited choices at this stage: + */ + ASSERT(type == GL_FLOAT); + ASSERT(stride == 4*sizeof(GLfloat) || stride == 0); + ASSERT(ac->count - ac->start < ctx->Const.MaxArrayLockSize); + + _math_trans_4f( (GLfloat (*)[4]) to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + from->Size, + 0, + ac->count - ac->start); + + to->Size = from->Size; + to->StrideB = 4 * sizeof(GLfloat); + to->Type = GL_FLOAT; + ac->IsCached.TexCoord[unit] = GL_TRUE; +} + +static void +import_vertex( GLcontext *ctx, GLenum type, GLuint stride ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + const struct gl_client_array *from = &ac->Raw.Vertex; + struct gl_client_array *to = &ac->Cache.Vertex; + (void) type; (void) stride; + + /* Limited choices at this stage: + */ + ASSERT(type == GL_FLOAT); + ASSERT(stride == 4*sizeof(GLfloat) || stride == 0); + + _math_trans_4f( (GLfloat (*)[4]) to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + from->Size, + 0, + ac->count - ac->start); + + to->Size = from->Size; + to->StrideB = 4 * sizeof(GLfloat); + to->Type = GL_FLOAT; + ac->IsCached.Vertex = GL_TRUE; +} + +static void +import_normal( GLcontext *ctx, GLenum type, GLuint stride ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + const struct gl_client_array *from = &ac->Raw.Normal; + struct gl_client_array *to = &ac->Cache.Normal; + (void) type; (void) stride; + + /* Limited choices at this stage: + */ + ASSERT(type == GL_FLOAT); + ASSERT(stride == 3*sizeof(GLfloat) || stride == 0); + + _math_trans_3f( (GLfloat (*)[3]) to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + 0, + ac->count - ac->start); + + to->StrideB = 3 * sizeof(GLfloat); + to->Type = GL_FLOAT; + ac->IsCached.Normal = GL_TRUE; +} + +static void +import_color( GLcontext *ctx, GLenum type, GLuint stride ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + const struct gl_client_array *from = &ac->Raw.Color; + struct gl_client_array *to = &ac->Cache.Color; + (void) stride; + + import( ctx, type, to, from ); + + ac->IsCached.Color = GL_TRUE; +} + +static void +import_index( GLcontext *ctx, GLenum type, GLuint stride ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + const struct gl_client_array *from = &ac->Raw.Index; + struct gl_client_array *to = &ac->Cache.Index; + (void) type; (void) stride; + + /* Limited choices at this stage: + */ + ASSERT(type == GL_UNSIGNED_INT); + ASSERT(stride == sizeof(GLuint) || stride == 0); + + _math_trans_1ui( (GLuint *) to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + 0, + ac->count - ac->start); + + to->StrideB = sizeof(GLuint); + to->Type = GL_UNSIGNED_INT; + ac->IsCached.Index = GL_TRUE; +} + +static void +import_secondarycolor( GLcontext *ctx, GLenum type, GLuint stride ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + const struct gl_client_array *from = &ac->Raw.SecondaryColor; + struct gl_client_array *to = &ac->Cache.SecondaryColor; + (void) stride; + + import( ctx, type, to, from ); + + ac->IsCached.SecondaryColor = GL_TRUE; +} + +static void +import_fogcoord( GLcontext *ctx, GLenum type, GLuint stride ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + const struct gl_client_array *from = &ac->Raw.FogCoord; + struct gl_client_array *to = &ac->Cache.FogCoord; + (void) type; (void) stride; + + /* Limited choices at this stage: + */ + ASSERT(type == GL_FLOAT); + ASSERT(stride == sizeof(GLfloat) || stride == 0); + + _math_trans_1f( (GLfloat *) to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + 0, + ac->count - ac->start); + + to->StrideB = sizeof(GLfloat); + to->Type = GL_FLOAT; + ac->IsCached.FogCoord = GL_TRUE; +} + +static void +import_edgeflag( GLcontext *ctx, GLenum type, GLuint stride ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + const struct gl_client_array *from = &ac->Raw.EdgeFlag; + struct gl_client_array *to = &ac->Cache.EdgeFlag; + (void) type; (void) stride; + + /* Limited choices at this stage: + */ + ASSERT(type == GL_UNSIGNED_BYTE); + ASSERT(stride == sizeof(GLubyte) || stride == 0); + + _math_trans_1ub( (GLubyte *) to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + 0, + ac->count - ac->start); + + to->StrideB = sizeof(GLubyte); + to->Type = GL_UNSIGNED_BYTE; + ac->IsCached.EdgeFlag = GL_TRUE; +} + +static void +import_attrib( GLcontext *ctx, GLuint index, GLenum type, GLuint stride ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + const struct gl_client_array *from = &ac->Raw.Attrib[index]; + struct gl_client_array *to = &ac->Cache.Attrib[index]; + (void) type; (void) stride; + + ASSERT(index < MAX_VERTEX_PROGRAM_ATTRIBS); + + /* Limited choices at this stage: + */ + ASSERT(type == GL_FLOAT); + ASSERT(stride == 4*sizeof(GLfloat) || stride == 0); + ASSERT(ac->count - ac->start < ctx->Const.MaxArrayLockSize); + + _math_trans_4f( (GLfloat (*)[4]) to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + from->Size, + 0, + ac->count - ac->start); + + to->Size = from->Size; + to->StrideB = 4 * sizeof(GLfloat); + to->Type = GL_FLOAT; + ac->IsCached.Attrib[index] = GL_TRUE; +} + + + +/* + * Externals to request arrays with specific properties: + */ + + +struct gl_client_array * +_ac_import_texcoord( GLcontext *ctx, + GLuint unit, + GLenum type, + GLuint reqstride, + GLuint reqsize, + GLboolean reqwriteable, + GLboolean *writeable ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + ASSERT(unit < ctx->Const.MaxTextureCoordUnits); + + /* Can we keep the existing version? + */ + if (ac->NewArrayState & _NEW_ARRAY_TEXCOORD(unit)) + reset_texcoord( ctx, unit ); + + /* Is the request impossible? + */ + if (reqsize != 0 && ac->Raw.TexCoord[unit].Size > (GLint) reqsize) + return NULL; + + /* Do we need to pull in a copy of the client data: + */ + if (ac->Raw.TexCoord[unit].Type != type || + (reqstride != 0 && ac->Raw.TexCoord[unit].StrideB != (GLint)reqstride) || + reqwriteable) + { + if (!ac->IsCached.TexCoord[unit]) + import_texcoord(ctx, unit, type, reqstride ); + *writeable = GL_TRUE; + return &ac->Cache.TexCoord[unit]; + } + else { + *writeable = GL_FALSE; + return &ac->Raw.TexCoord[unit]; + } +} + +struct gl_client_array * +_ac_import_vertex( GLcontext *ctx, + GLenum type, + GLuint reqstride, + GLuint reqsize, + GLboolean reqwriteable, + GLboolean *writeable ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + /* Can we keep the existing version? + */ + if (ac->NewArrayState & _NEW_ARRAY_VERTEX) + reset_vertex( ctx ); + + /* Is the request impossible? + */ + if (reqsize != 0 && ac->Raw.Vertex.Size > (GLint) reqsize) + return NULL; + + /* Do we need to pull in a copy of the client data: + */ + if (ac->Raw.Vertex.Type != type || + (reqstride != 0 && ac->Raw.Vertex.StrideB != (GLint) reqstride) || + reqwriteable) + { + if (!ac->IsCached.Vertex) + import_vertex(ctx, type, reqstride ); + *writeable = GL_TRUE; + return &ac->Cache.Vertex; + } + else { + *writeable = GL_FALSE; + return &ac->Raw.Vertex; + } +} + +struct gl_client_array * +_ac_import_normal( GLcontext *ctx, + GLenum type, + GLuint reqstride, + GLboolean reqwriteable, + GLboolean *writeable ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + /* Can we keep the existing version? + */ + if (ac->NewArrayState & _NEW_ARRAY_NORMAL) + reset_normal( ctx ); + + /* Do we need to pull in a copy of the client data: + */ + if (ac->Raw.Normal.Type != type || + (reqstride != 0 && ac->Raw.Normal.StrideB != (GLint) reqstride) || + reqwriteable) + { + if (!ac->IsCached.Normal) + import_normal(ctx, type, reqstride ); + *writeable = GL_TRUE; + return &ac->Cache.Normal; + } + else { + *writeable = GL_FALSE; + return &ac->Raw.Normal; + } +} + +struct gl_client_array * +_ac_import_color( GLcontext *ctx, + GLenum type, + GLuint reqstride, + GLuint reqsize, + GLboolean reqwriteable, + GLboolean *writeable ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + /* Can we keep the existing version? + */ + if (ac->NewArrayState & _NEW_ARRAY_COLOR0) + reset_color( ctx ); + + /* Is the request impossible? + */ + if (reqsize != 0 && ac->Raw.Color.Size > (GLint) reqsize) { + return NULL; + } + + /* Do we need to pull in a copy of the client data: + */ + if ((type != 0 && ac->Raw.Color.Type != type) || + (reqstride != 0 && ac->Raw.Color.StrideB != (GLint) reqstride) || + reqwriteable) + { + if (!ac->IsCached.Color) { + import_color(ctx, type, reqstride ); + } + *writeable = GL_TRUE; + return &ac->Cache.Color; + } + else { + *writeable = GL_FALSE; + return &ac->Raw.Color; + } +} + +struct gl_client_array * +_ac_import_index( GLcontext *ctx, + GLenum type, + GLuint reqstride, + GLboolean reqwriteable, + GLboolean *writeable ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + /* Can we keep the existing version? + */ + if (ac->NewArrayState & _NEW_ARRAY_INDEX) + reset_index( ctx ); + + + /* Do we need to pull in a copy of the client data: + */ + if (ac->Raw.Index.Type != type || + (reqstride != 0 && ac->Raw.Index.StrideB != (GLint) reqstride) || + reqwriteable) + { + if (!ac->IsCached.Index) + import_index(ctx, type, reqstride ); + *writeable = GL_TRUE; + return &ac->Cache.Index; + } + else { + *writeable = GL_FALSE; + return &ac->Raw.Index; + } +} + +struct gl_client_array * +_ac_import_secondarycolor( GLcontext *ctx, + GLenum type, + GLuint reqstride, + GLuint reqsize, + GLboolean reqwriteable, + GLboolean *writeable ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + /* Can we keep the existing version? + */ + if (ac->NewArrayState & _NEW_ARRAY_COLOR1) + reset_secondarycolor( ctx ); + + /* Is the request impossible? + */ + if (reqsize != 0 && ac->Raw.SecondaryColor.Size > (GLint) reqsize) + return NULL; + + /* Do we need to pull in a copy of the client data: + */ + if ((type != 0 && ac->Raw.SecondaryColor.Type != type) || + (reqstride != 0 && ac->Raw.SecondaryColor.StrideB != (GLint)reqstride) || + reqwriteable) + { + if (!ac->IsCached.SecondaryColor) + import_secondarycolor(ctx, type, reqstride ); + *writeable = GL_TRUE; + return &ac->Cache.SecondaryColor; + } + else { + *writeable = GL_FALSE; + return &ac->Raw.SecondaryColor; + } +} + +struct gl_client_array * +_ac_import_fogcoord( GLcontext *ctx, + GLenum type, + GLuint reqstride, + GLboolean reqwriteable, + GLboolean *writeable ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + /* Can we keep the existing version? + */ + if (ac->NewArrayState & _NEW_ARRAY_FOGCOORD) + reset_fogcoord( ctx ); + + /* Do we need to pull in a copy of the client data: + */ + if (ac->Raw.FogCoord.Type != type || + (reqstride != 0 && ac->Raw.FogCoord.StrideB != (GLint) reqstride) || + reqwriteable) + { + if (!ac->IsCached.FogCoord) + import_fogcoord(ctx, type, reqstride ); + *writeable = GL_TRUE; + return &ac->Cache.FogCoord; + } + else { + *writeable = GL_FALSE; + return &ac->Raw.FogCoord; + } +} + +struct gl_client_array * +_ac_import_edgeflag( GLcontext *ctx, + GLenum type, + GLuint reqstride, + GLboolean reqwriteable, + GLboolean *writeable ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + /* Can we keep the existing version? + */ + if (ac->NewArrayState & _NEW_ARRAY_EDGEFLAG) + reset_edgeflag( ctx ); + + /* Do we need to pull in a copy of the client data: + */ + if (ac->Raw.EdgeFlag.Type != type || + (reqstride != 0 && ac->Raw.EdgeFlag.StrideB != (GLint) reqstride) || + reqwriteable) + { + if (!ac->IsCached.EdgeFlag) + import_edgeflag(ctx, type, reqstride ); + *writeable = GL_TRUE; + return &ac->Cache.EdgeFlag; + } + else { + *writeable = GL_FALSE; + return &ac->Raw.EdgeFlag; + } +} + +/* GL_NV_vertex_program */ +struct gl_client_array * +_ac_import_attrib( GLcontext *ctx, + GLuint index, + GLenum type, + GLuint reqstride, + GLuint reqsize, + GLboolean reqwriteable, + GLboolean *writeable ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + ASSERT(index < VERT_ATTRIB_MAX); + + /* Can we keep the existing version? + */ + if (ac->NewArrayState & _NEW_ARRAY_ATTRIB(index)) + reset_attrib( ctx, index ); + + /* Is the request impossible? + */ + if (reqsize != 0 && ac->Raw.Attrib[index].Size > (GLint) reqsize) + return NULL; + + /* Do we need to pull in a copy of the client data: + */ + if (ac->Raw.Attrib[index].Type != type || + (reqstride != 0 && ac->Raw.Attrib[index].StrideB != (GLint)reqstride) || + reqwriteable) + { + if (!ac->IsCached.Attrib[index]) + import_attrib(ctx, index, type, reqstride ); + *writeable = GL_TRUE; + return &ac->Cache.Attrib[index]; + } + else { + *writeable = GL_FALSE; + return &ac->Raw.Attrib[index]; + } +} + + +/* Clients must call this function to validate state and set bounds + * before importing any data: + */ +void +_ac_import_range( GLcontext *ctx, GLuint start, GLuint count ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + if (!ctx->Array.LockCount) { + /* Not locked, discard cached data. Changes to lock + * status are caught via. _ac_invalidate_state(). + */ + ac->NewArrayState = _NEW_ARRAY_ALL; + ac->start = start; + ac->count = count; + } + else { + /* Locked, discard data for any disabled arrays. Require that + * the whole locked range always be dealt with, otherwise hard to + * maintain cached data in the face of clipping. + */ + ac->NewArrayState |= ~ctx->Array._Enabled; + ac->start = ctx->Array.LockFirst; + ac->count = ctx->Array.LockCount; + ASSERT(ac->start == start); /* hmm? */ + ASSERT(ac->count == count); + } +} + + + +/* Additional convienence function for importing the element list + * for glDrawElements() and glDrawRangeElements(). + */ +CONST void * +_ac_import_elements( GLcontext *ctx, + GLenum new_type, + GLuint count, + GLenum old_type, + CONST void *indices ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + if (old_type == new_type) + return indices; + + if (ac->elt_size < count * sizeof(GLuint)) { + if (ac->Elts) FREE(ac->Elts); + while (ac->elt_size < count * sizeof(GLuint)) + ac->elt_size *= 2; + ac->Elts = (GLuint *) MALLOC(ac->elt_size); + } + + switch (new_type) { + case GL_UNSIGNED_BYTE: + ASSERT(0); + return NULL; + case GL_UNSIGNED_SHORT: + ASSERT(0); + return NULL; + case GL_UNSIGNED_INT: { + GLuint *out = (GLuint *)ac->Elts; + GLuint i; + + switch (old_type) { + case GL_UNSIGNED_BYTE: { + CONST GLubyte *in = (CONST GLubyte *)indices; + for (i = 0 ; i < count ; i++) + out[i] = in[i]; + break; + } + case GL_UNSIGNED_SHORT: { + CONST GLushort *in = (CONST GLushort *)indices; + for (i = 0 ; i < count ; i++) + out[i] = in[i]; + break; + } + default: + ASSERT(0); + } + + return (CONST void *)out; + } + default: + ASSERT(0); + break; + } + + return NULL; +} diff --git a/reactos/dll/mesa32/src/array_cache/acache.h b/reactos/dll/mesa32/src/array_cache/acache.h new file mode 100644 index 00000000000..2bb64f3656c --- /dev/null +++ b/reactos/dll/mesa32/src/array_cache/acache.h @@ -0,0 +1,132 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +#ifndef _ARRAYCACHE_H +#define _ARRAYCACHE_H + +#include "mtypes.h" + + +extern GLboolean +_ac_CreateContext( GLcontext *ctx ); + +extern void +_ac_DestroyContext( GLcontext *ctx ); + +extern void +_ac_InvalidateState( GLcontext *ctx, GLuint new_state ); + +extern struct gl_client_array * +_ac_import_vertex( GLcontext *ctx, + GLenum type, + GLuint reqstride, + GLuint reqsize, + GLboolean reqwritable, + GLboolean *writable ); + +extern struct gl_client_array * +_ac_import_normal( GLcontext *ctx, + GLenum type, + GLuint reqstride, + GLboolean reqwritable, + GLboolean *writable ); + +extern struct gl_client_array * +_ac_import_color( GLcontext *ctx, + GLenum type, + GLuint reqstride, + GLuint reqsize, + GLboolean reqwritable, + GLboolean *writable ); + +extern struct gl_client_array * +_ac_import_index( GLcontext *ctx, + GLenum type, + GLuint reqstride, + GLboolean reqwritable, + GLboolean *writable ); + +extern struct gl_client_array * +_ac_import_secondarycolor( GLcontext *ctx, + GLenum type, + GLuint reqstride, + GLuint reqsize, + GLboolean reqwritable, + GLboolean *writable ); + +extern struct gl_client_array * +_ac_import_fogcoord( GLcontext *ctx, + GLenum type, + GLuint reqstride, + GLboolean reqwritable, + GLboolean *writable ); + +extern struct gl_client_array * +_ac_import_edgeflag( GLcontext *ctx, + GLenum type, + GLuint reqstride, + GLboolean reqwritable, + GLboolean *writable ); + +extern struct gl_client_array * +_ac_import_texcoord( GLcontext *ctx, + GLuint unit, + GLenum type, + GLuint reqstride, + GLuint reqsize, + GLboolean reqwritable, + GLboolean *writable ); + +extern struct gl_client_array * +_ac_import_attrib( GLcontext *ctx, + GLuint index, + GLenum type, + GLuint reqstride, + GLuint reqsize, + GLboolean reqwritable, + GLboolean *writable ); + + +/* Clients must call this function to validate state and set bounds + * before importing any data: + */ +extern void +_ac_import_range( GLcontext *ctx, GLuint start, GLuint count ); + + +/* Additional convenience function: + */ +extern CONST void * +_ac_import_elements( GLcontext *ctx, + GLenum new_type, + GLuint count, + GLenum old_type, + CONST void *indices ); + + +#endif diff --git a/reactos/dll/mesa32/src/array_cache/descrip.mms b/reactos/dll/mesa32/src/array_cache/descrip.mms new file mode 100644 index 00000000000..3555f83d8ed --- /dev/null +++ b/reactos/dll/mesa32/src/array_cache/descrip.mms @@ -0,0 +1,37 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl +# Last revision : 16 June 2003 + +.first + define gl [---.include.gl] + define math [-.math] + define array_cache [-.array_cache] + +.include [---]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [---.include],[-.main],[-.glapi] +LIBDIR = [---.lib] +CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short) + +SOURCES = ac_context.c ac_import.c + +OBJECTS = ac_context.obj,ac_import.obj +##### RULES ##### + +VERSION=Mesa V3.4 + +##### TARGETS ##### +# Make the library +$(LIBDIR)$(GL_LIB) : $(OBJECTS) + @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) + +clean : + purge + delete *.obj;* + +ac_context.obj : ac_context.c +ac_import.obj : ac_import.c diff --git a/reactos/dll/mesa32/src/depend b/reactos/dll/mesa32/src/depend new file mode 100644 index 00000000000..e69de29bb2d diff --git a/reactos/dll/mesa32/src/descrip.mms b/reactos/dll/mesa32/src/descrip.mms new file mode 100644 index 00000000000..a12e3fc1b74 --- /dev/null +++ b/reactos/dll/mesa32/src/descrip.mms @@ -0,0 +1,26 @@ +# Makefile for Mesa for VMS +# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl + +all : + set default [.main] + $(MMS)$(MMSQUALIFIERS) + set default [-.glapi] + $(MMS)$(MMSQUALIFIERS) + set default [-.shader] + $(MMS)$(MMSQUALIFIERS) + set default [-.drivers.common] + $(MMS)$(MMSQUALIFIERS) + set default [-.x11] + $(MMS)$(MMSQUALIFIERS) + set default [-.osmesa] + $(MMS)$(MMSQUALIFIERS) + set default [--.math] + $(MMS)$(MMSQUALIFIERS) + set default [-.tnl] + $(MMS)$(MMSQUALIFIERS) + set default [-.swrast] + $(MMS)$(MMSQUALIFIERS) + set default [-.swrast_setup] + $(MMS)$(MMSQUALIFIERS) + set default [-.array_cache] + $(MMS)$(MMSQUALIFIERS) diff --git a/reactos/dll/mesa32/src/drivers/common/descrip.mms b/reactos/dll/mesa32/src/drivers/common/descrip.mms new file mode 100644 index 00000000000..aa4b8ae2118 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/common/descrip.mms @@ -0,0 +1,37 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl +# Last revision : 16 June 2003 + +.first + define gl [----.include.gl] + define math [--.math] + define swrast [--.swrast] + +.include [----]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [----.include],[--.main],[--.glapi],[--.shader] +LIBDIR = [----.lib] +CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short) + +SOURCES = driverfuncs.c + +OBJECTS =driverfuncs.obj + +##### RULES ##### + +VERSION=Mesa V3.4 + +##### TARGETS ##### +# Make the library +$(LIBDIR)$(GL_LIB) : $(OBJECTS) + @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) + +clean : + purge + delete *.obj;* + +driverfuncs.obj : driverfuncs.c diff --git a/reactos/dll/mesa32/src/drivers/common/driverfuncs.c b/reactos/dll/mesa32/src/drivers/common/driverfuncs.c new file mode 100644 index 00000000000..4a8ea31a48f --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/common/driverfuncs.c @@ -0,0 +1,231 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +#include "glheader.h" +#include "imports.h" +#include "buffers.h" +#include "context.h" +#include "framebuffer.h" +#include "program.h" +#include "renderbuffer.h" +#include "texcompress.h" +#include "texformat.h" +#include "teximage.h" +#include "texobj.h" +#include "texstore.h" +#if FEATURE_ARB_vertex_buffer_object +#include "bufferobj.h" +#endif +#if FEATURE_EXT_framebuffer_object +#include "fbobject.h" +#include "texrender.h" +#endif + +#include "driverfuncs.h" +#include "swrast/swrast.h" + + + +/** + * Plug in default functions for all pointers in the dd_function_table + * structure. + * Device drivers should call this function and then plug in any + * functions which it wants to override. + * Some functions (pointers) MUST be implemented by all drivers (REQUIRED). + * + * \param table the dd_function_table to initialize + */ +void +_mesa_init_driver_functions(struct dd_function_table *driver) +{ + _mesa_bzero(driver, sizeof(*driver)); + + driver->GetString = NULL; /* REQUIRED! */ + driver->UpdateState = NULL; /* REQUIRED! */ + driver->GetBufferSize = NULL; /* REQUIRED! */ + driver->ResizeBuffers = _mesa_resize_framebuffer; + driver->Error = NULL; + + driver->Finish = NULL; + driver->Flush = NULL; + + /* framebuffer/image functions */ + driver->Clear = _swrast_Clear; + driver->Accum = _swrast_Accum; + driver->DrawPixels = _swrast_DrawPixels; + driver->ReadPixels = _swrast_ReadPixels; + driver->CopyPixels = _swrast_CopyPixels; + driver->Bitmap = _swrast_Bitmap; + + /* Texture functions */ + driver->ChooseTextureFormat = _mesa_choose_tex_format; + driver->TexImage1D = _mesa_store_teximage1d; + driver->TexImage2D = _mesa_store_teximage2d; + driver->TexImage3D = _mesa_store_teximage3d; + driver->TexSubImage1D = _mesa_store_texsubimage1d; + driver->TexSubImage2D = _mesa_store_texsubimage2d; + driver->TexSubImage3D = _mesa_store_texsubimage3d; + driver->GetTexImage = _mesa_get_teximage; + driver->CopyTexImage1D = _swrast_copy_teximage1d; + driver->CopyTexImage2D = _swrast_copy_teximage2d; + driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d; + driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d; + driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d; + driver->TestProxyTexImage = _mesa_test_proxy_teximage; + driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d; + driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d; + driver->CompressedTexImage3D = _mesa_store_compressed_teximage3d; + driver->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d; + driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; + driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; + driver->GetCompressedTexImage = _mesa_get_compressed_teximage; + driver->CompressedTextureSize = _mesa_compressed_texture_size; + driver->BindTexture = NULL; + driver->NewTextureObject = _mesa_new_texture_object; + driver->DeleteTexture = _mesa_delete_texture_object; + driver->NewTextureImage = _mesa_new_texture_image; + driver->FreeTexImageData = _mesa_free_texture_image_data; + driver->TextureMemCpy = _mesa_memcpy; + driver->IsTextureResident = NULL; + driver->PrioritizeTexture = NULL; + driver->ActiveTexture = NULL; + driver->UpdateTexturePalette = NULL; + + /* imaging */ + driver->CopyColorTable = _swrast_CopyColorTable; + driver->CopyColorSubTable = _swrast_CopyColorSubTable; + driver->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; + driver->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; + + /* Vertex/fragment programs */ + driver->BindProgram = NULL; + driver->NewProgram = _mesa_new_program; + driver->DeleteProgram = _mesa_delete_program; + + /* simple state commands */ + driver->AlphaFunc = NULL; + driver->BlendColor = NULL; + driver->BlendEquationSeparate = NULL; + driver->BlendFuncSeparate = NULL; + driver->ClearColor = NULL; + driver->ClearDepth = NULL; + driver->ClearIndex = NULL; + driver->ClearStencil = NULL; + driver->ClipPlane = NULL; + driver->ColorMask = NULL; + driver->ColorMaterial = NULL; + driver->CullFace = NULL; + driver->DrawBuffer = _swrast_DrawBuffer; + driver->DrawBuffers = NULL; /***_swrast_DrawBuffers;***/ + driver->FrontFace = NULL; + driver->DepthFunc = NULL; + driver->DepthMask = NULL; + driver->DepthRange = NULL; + driver->Enable = NULL; + driver->Fogfv = NULL; + driver->Hint = NULL; + driver->IndexMask = NULL; + driver->Lightfv = NULL; + driver->LightModelfv = NULL; + driver->LineStipple = NULL; + driver->LineWidth = NULL; + driver->LogicOpcode = NULL; + driver->PointParameterfv = NULL; + driver->PointSize = NULL; + driver->PolygonMode = NULL; + driver->PolygonOffset = NULL; + driver->PolygonStipple = NULL; + driver->ReadBuffer = NULL; + driver->RenderMode = NULL; + driver->Scissor = NULL; + driver->ShadeModel = NULL; + driver->StencilFunc = NULL; + driver->StencilMask = NULL; + driver->StencilOp = NULL; + driver->ActiveStencilFace = NULL; + driver->TexGen = NULL; + driver->TexEnv = NULL; + driver->TexParameter = NULL; + driver->TextureMatrix = NULL; + driver->Viewport = NULL; + + /* vertex arrays */ + driver->VertexPointer = NULL; + driver->NormalPointer = NULL; + driver->ColorPointer = NULL; + driver->FogCoordPointer = NULL; + driver->IndexPointer = NULL; + driver->SecondaryColorPointer = NULL; + driver->TexCoordPointer = NULL; + driver->EdgeFlagPointer = NULL; + driver->VertexAttribPointer = NULL; + driver->LockArraysEXT = NULL; + driver->UnlockArraysEXT = NULL; + + /* state queries */ + driver->GetBooleanv = NULL; + driver->GetDoublev = NULL; + driver->GetFloatv = NULL; + driver->GetIntegerv = NULL; + driver->GetPointerv = NULL; + +#if FEATURE_ARB_vertex_buffer_object + driver->NewBufferObject = _mesa_new_buffer_object; + driver->DeleteBuffer = _mesa_delete_buffer_object; + driver->BindBuffer = NULL; + driver->BufferData = _mesa_buffer_data; + driver->BufferSubData = _mesa_buffer_subdata; + driver->GetBufferSubData = _mesa_buffer_get_subdata; + driver->MapBuffer = _mesa_buffer_map; + driver->UnmapBuffer = _mesa_buffer_unmap; +#endif + +#if FEATURE_EXT_framebuffer_object + driver->NewFramebuffer = _mesa_new_framebuffer; + driver->NewRenderbuffer = _mesa_new_soft_renderbuffer; + driver->RenderbufferTexture = _mesa_renderbuffer_texture; + driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer; +#endif + + /* T&L stuff */ + driver->NeedValidate = GL_FALSE; + driver->ValidateTnlModule = NULL; + driver->CurrentExecPrimitive = 0; + driver->CurrentSavePrimitive = 0; + driver->NeedFlush = 0; + driver->SaveNeedFlush = 0; + + driver->FlushVertices = NULL; + driver->SaveFlushVertices = NULL; + driver->NotifySaveBegin = NULL; + driver->LightingSpaceChange = NULL; + driver->MakeCurrent = NULL; + + /* display list */ + driver->NewList = NULL; + driver->EndList = NULL; + driver->BeginCallList = NULL; + driver->EndCallList = NULL; +} diff --git a/reactos/dll/mesa32/src/drivers/common/driverfuncs.h b/reactos/dll/mesa32/src/drivers/common/driverfuncs.h new file mode 100644 index 00000000000..64f56d91f95 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/common/driverfuncs.h @@ -0,0 +1,32 @@ +/* + * 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 DRIVERFUNCS_H +#define DRIVERFUNCS_H + +extern void +_mesa_init_driver_functions(struct dd_function_table *driver); + +#endif diff --git a/reactos/dll/mesa32/src/drivers/windows/fx/fxopengl.def b/reactos/dll/mesa32/src/drivers/windows/fx/fxopengl.def new file mode 100644 index 00000000000..d65b763d25e --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/fx/fxopengl.def @@ -0,0 +1,955 @@ +LIBRARY OpenGL32 +DESCRIPTION "Mesa 5.1" +EXPORTS + glAccum + glActiveStencilFaceEXT + glActiveTexture + glActiveTextureARB + glAlphaFunc + glAreProgramsResidentNV + glAreTexturesResident + glAreTexturesResidentEXT + glArrayElement + glArrayElementEXT + glBegin + glBeginQueryARB + glBindBufferARB + glBindProgramARB + glBindProgramNV + glBindTexture + glBindTextureEXT + glBitmap +;glBlendColor +;glBlendColorEXT + glBlendEquation + glBlendEquationEXT + glBlendFunc + glBlendFuncSeparate + glBlendFuncSeparateEXT + glBlendFuncSeparateINGR + glBufferDataARB + glBufferSubDataARB + glCallList + glCallLists + glClear + glClearAccum + glClearColor + glClearDepth + glClearIndex + glClearStencil + glClientActiveTexture + glClientActiveTextureARB + glClipPlane + glColorMask + glColorMaterial + glColorPointer + glColorPointerEXT + glColorSubTable + glColorSubTableEXT + glColorTable + glColorTableEXT + glColorTableParameterfv + glColorTableParameterfvSGI + glColorTableParameteriv + glColorTableParameterivSGI + glColorTableSGI + glColor3b + glColor3bv + glColor3d + glColor3dv + glColor3f + glColor3fv + glColor3i + glColor3iv + glColor3s + glColor3sv + glColor3ub + glColor3ubv + glColor3ui + glColor3uiv + glColor3us + glColor3usv + glColor4b + glColor4bv + glColor4d + glColor4dv + glColor4f + glColor4fv + glColor4i + glColor4iv + glColor4s + glColor4sv + glColor4ub + glColor4ubv + glColor4ui + glColor4uiv + glColor4us + glColor4usv + glCombinerInputNV + glCombinerOutputNV + glCombinerParameterfNV + glCombinerParameterfvNV + glCombinerParameteriNV + glCombinerParameterivNV + glCompressedTexImage1D + glCompressedTexImage1DARB + glCompressedTexImage2D + glCompressedTexImage2DARB + glCompressedTexImage3D + glCompressedTexImage3DARB + glCompressedTexSubImage1D + glCompressedTexSubImage1DARB + glCompressedTexSubImage2D + glCompressedTexSubImage2DARB + glCompressedTexSubImage3D + glCompressedTexSubImage3DARB + glConvolutionFilter1D + glConvolutionFilter1DEXT + glConvolutionFilter2D + glConvolutionFilter2DEXT + glConvolutionParameterf + glConvolutionParameterfEXT + glConvolutionParameterfv + glConvolutionParameterfvEXT + glConvolutionParameteri + glConvolutionParameteriEXT + glConvolutionParameteriv + glConvolutionParameterivEXT + glCopyColorSubTable + glCopyColorSubTableEXT + glCopyColorTable + glCopyColorTableSGI + glCopyConvolutionFilter1D + glCopyConvolutionFilter1DEXT + glCopyConvolutionFilter2D + glCopyConvolutionFilter2DEXT + glCopyPixels + glCopyTexImage1D + glCopyTexImage1DEXT + glCopyTexImage2D + glCopyTexImage2DEXT + glCopyTexSubImage1D + glCopyTexSubImage1DEXT + glCopyTexSubImage2D + glCopyTexSubImage2DEXT + glCopyTexSubImage3D + glCopyTexSubImage3DEXT + glCullFace + glCullParameterdvEXT + glCullParameterfvEXT + glDeleteBuffersARB + glDeleteFencesNV + glDeleteLists + glDeleteProgramsARB + glDeleteProgramsNV + glDeleteQueriesARB + glDeleteTextures + glDeleteTexturesEXT + glDepthBoundsEXT + glDepthFunc + glDepthMask + glDepthRange + glDetailTexFuncSGIS + glDisable + glDisableClientState + glDisableVertexAttribArrayARB + glDrawArrays + glDrawArraysEXT + glDrawBuffer + glDrawElements + glDrawPixels + glDrawRangeElements + glDrawRangeElementsEXT + glEdgeFlag + glEdgeFlagPointer + glEdgeFlagPointerEXT + glEdgeFlagv + glEnable + glEnableClientState + glEnableVertexAttribArrayARB + glEnd + glEndList + glEndQueryARB + glEvalCoord1d + glEvalCoord1dv + glEvalCoord1f + glEvalCoord1fv + glEvalCoord2d + glEvalCoord2dv + glEvalCoord2f + glEvalCoord2fv + glEvalMesh1 + glEvalMesh2 + glEvalPoint1 + glEvalPoint2 + glExecuteProgramNV + glFeedbackBuffer + glFinalCombinerInputNV + glFinish + glFinishFenceNV + glFlush + glFlushRasterSGIX + glFlushVertexArrayRangeNV + glFogCoordd + glFogCoorddEXT + glFogCoorddv + glFogCoorddvEXT + glFogCoordf + glFogCoordfEXT + glFogCoordfv + glFogCoordfvEXT + glFogCoordPointer + glFogCoordPointerEXT + glFogf + glFogfv + glFogi + glFogiv + glFragmentColorMaterialSGIX + glFragmentLightfSGIX + glFragmentLightfvSGIX + glFragmentLightiSGIX + glFragmentLightivSGIX + glFragmentLightModelfSGIX + glFragmentLightModelfvSGIX + glFragmentLightModeliSGIX + glFragmentLightModelivSGIX + glFragmentMaterialfSGIX + glFragmentMaterialfvSGIX + glFragmentMaterialiSGIX + glFragmentMaterialivSGIX + glFrameZoomSGIX + glFrontFace + glFrustum + glGenBuffersARB + glGenFencesNV + glGenLists + glGenProgramsARB + glGenProgramsNV + glGenQueriesARB + glGenTextures + glGenTexturesEXT + glGetBooleanv + glGetBufferParameterivARB + glGetBufferPointervARB + glGetBufferSubDataARB + glGetClipPlane + glGetColorTable + glGetColorTableEXT + glGetColorTableParameterfv + glGetColorTableParameterfvEXT + glGetColorTableParameterfvSGI + glGetColorTableParameteriv + glGetColorTableParameterivEXT + glGetColorTableParameterivSGI + glGetColorTableSGI + glGetCombinerInputParameterfvNV + glGetCombinerInputParameterivNV + glGetCombinerOutputParameterfvNV + glGetCombinerOutputParameterivNV + glGetCompressedTexImage + glGetCompressedTexImageARB + glGetConvolutionFilter + glGetConvolutionFilterEXT + glGetConvolutionParameterfv + glGetConvolutionParameterfvEXT + glGetConvolutionParameteriv + glGetConvolutionParameterivEXT + glGetDetailTexFuncSGIS + glGetDoublev + glGetError + glGetFenceivNV + glGetFinalCombinerInputParameterfvNV + glGetFinalCombinerInputParameterivNV + glGetFloatv + glGetFragmentLightfvSGIX + glGetFragmentLightivSGIX + glGetFragmentMaterialfvSGIX + glGetFragmentMaterialivSGIX + glGetHistogram + glGetHistogramEXT + glGetHistogramParameterfv + glGetHistogramParameterfvEXT + glGetHistogramParameteriv + glGetHistogramParameterivEXT + glGetInstrumentsSGIX + glGetIntegerv + glGetLightfv + glGetLightiv + glGetListParameterfvSGIX + glGetListParameterivSGIX + glGetMapdv + glGetMapfv + glGetMapiv + glGetMaterialfv + glGetMaterialiv + glGetMinmax + glGetMinmaxEXT + glGetMinmaxParameterfv + glGetMinmaxParameterfvEXT + glGetMinmaxParameteriv + glGetMinmaxParameterivEXT + glGetPixelMapfv + glGetPixelMapuiv + glGetPixelMapusv + glGetPixelTexGenParameterfvSGIS + glGetPixelTexGenParameterivSGIS + glGetPointerv + glGetPointervEXT + glGetPolygonStipple + glGetProgramEnvParameterdvARB + glGetProgramEnvParameterfvARB + glGetProgramivARB + glGetProgramivNV + glGetProgramLocalParameterdvARB + glGetProgramLocalParameterfvARB + glGetProgramNamedParameterdvNV + glGetProgramNamedParameterfvNV + glGetProgramParameterdvNV + glGetProgramParameterfvNV + glGetProgramStringARB + glGetProgramStringNV + glGetQueryivARB + glGetQueryObjectivARB + glGetQueryObjectuivARB + glGetSeparableFilter + glGetSeparableFilterEXT + glGetSharpenTexFuncSGIS + glGetString + glGetTexEnvfv + glGetTexEnviv + glGetTexFilterFuncSGIS + glGetTexGendv + glGetTexGenfv + glGetTexGeniv + glGetTexImage + glGetTexLevelParameterfv + glGetTexLevelParameteriv + glGetTexParameterfv + glGetTexParameteriv + glGetTrackMatrixivNV + glGetVertexAttribdvARB + glGetVertexAttribdvNV + glGetVertexAttribfvARB + glGetVertexAttribfvNV + glGetVertexAttribivARB + glGetVertexAttribivNV + glGetVertexAttribPointervARB + glGetVertexAttribPointervNV + glHint + glHintPGI + glHistogram + glHistogramEXT + glIndexd + glIndexdv + glIndexf + glIndexFuncEXT + glIndexfv + glIndexi + glIndexiv + glIndexMask + glIndexMaterialEXT + glIndexPointer + glIndexPointerEXT + glIndexs + glIndexsv + glIndexub + glIndexubv + glInitNames + glInstrumentsBufferSGIX + glInterleavedArrays + glIsBufferARB + glIsEnabled + glIsFenceNV + glIsList + glIsProgramARB + glIsProgramNV + glIsQueryARB + glIsTexture + glIsTextureEXT + glLightEnviSGIX + glLightf + glLightfv + glLighti + glLightiv + glLightModelf + glLightModelfv + glLightModeli + glLightModeliv + glLineStipple + glLineWidth + glListBase + glListParameterfSGIX + glListParameterfvSGIX + glListParameteriSGIX + glListParameterivSGIX + glLoadIdentity + glLoadMatrixd + glLoadMatrixf + glLoadName + glLoadProgramNV + glLoadTransposeMatrixd + glLoadTransposeMatrixdARB + glLoadTransposeMatrixf + glLoadTransposeMatrixfARB + glLockArraysEXT + glLogicOp + glMapBufferARB + glMapGrid1d + glMapGrid1f + glMapGrid2d + glMapGrid2f + glMap1d + glMap1f + glMap2d + glMap2f + glMaterialf + glMaterialfv + glMateriali + glMaterialiv + glMatrixMode + glMinmax + glMinmaxEXT + glMultiDrawArrays + glMultiDrawArraysEXT + glMultiDrawElements + glMultiDrawElementsEXT + glMultiModeDrawArraysIBM + glMultiModeDrawElementsIBM + glMultiTexCoord1d + glMultiTexCoord1dARB + glMultiTexCoord1dv + glMultiTexCoord1dvARB + glMultiTexCoord1f + glMultiTexCoord1fARB + glMultiTexCoord1fv + glMultiTexCoord1fvARB + glMultiTexCoord1i + glMultiTexCoord1iARB + glMultiTexCoord1iv + glMultiTexCoord1ivARB + glMultiTexCoord1s + glMultiTexCoord1sARB + glMultiTexCoord1sv + glMultiTexCoord1svARB + glMultiTexCoord2d + glMultiTexCoord2dARB + glMultiTexCoord2dv + glMultiTexCoord2dvARB + glMultiTexCoord2f + glMultiTexCoord2fARB + glMultiTexCoord2fv + glMultiTexCoord2fvARB + glMultiTexCoord2i + glMultiTexCoord2iARB + glMultiTexCoord2iv + glMultiTexCoord2ivARB + glMultiTexCoord2s + glMultiTexCoord2sARB + glMultiTexCoord2sv + glMultiTexCoord2svARB + glMultiTexCoord3d + glMultiTexCoord3dARB + glMultiTexCoord3dv + glMultiTexCoord3dvARB + glMultiTexCoord3f + glMultiTexCoord3fARB + glMultiTexCoord3fv + glMultiTexCoord3fvARB + glMultiTexCoord3i + glMultiTexCoord3iARB + glMultiTexCoord3iv + glMultiTexCoord3ivARB + glMultiTexCoord3s + glMultiTexCoord3sARB + glMultiTexCoord3sv + glMultiTexCoord3svARB + glMultiTexCoord4d + glMultiTexCoord4dARB + glMultiTexCoord4dv + glMultiTexCoord4dvARB + glMultiTexCoord4f + glMultiTexCoord4fARB + glMultiTexCoord4fv + glMultiTexCoord4fvARB + glMultiTexCoord4i + glMultiTexCoord4iARB + glMultiTexCoord4iv + glMultiTexCoord4ivARB + glMultiTexCoord4s + glMultiTexCoord4sARB + glMultiTexCoord4sv + glMultiTexCoord4svARB + glMultMatrixd + glMultMatrixf + glMultTransposeMatrixd + glMultTransposeMatrixdARB + glMultTransposeMatrixf + glMultTransposeMatrixfARB + glNewList + glNormalPointer + glNormalPointerEXT + glNormal3b + glNormal3bv + glNormal3d + glNormal3dv + glNormal3f + glNormal3fv + glNormal3i + glNormal3iv + glNormal3s + glNormal3sv + glOrtho + glPassThrough + glPixelMapfv + glPixelMapuiv + glPixelMapusv + glPixelStoref + glPixelStorei + glPixelTexGenParameterfSGIS + glPixelTexGenParameterfvSGIS + glPixelTexGenParameteriSGIS + glPixelTexGenParameterivSGIS + glPixelTexGenSGIX + glPixelTransferf + glPixelTransferi + glPixelZoom + glPointParameterf + glPointParameterfARB + glPointParameterfEXT + glPointParameterfSGIS + glPointParameterfv + glPointParameterfvARB + glPointParameterfvEXT + glPointParameterfvSGIS + glPointParameteri + glPointParameteriNV + glPointParameteriv + glPointParameterivNV + glPointSize + glPollInstrumentsSGIX + glPolygonMode + glPolygonOffset + glPolygonOffsetEXT + glPolygonStipple + glPopAttrib + glPopClientAttrib + glPopMatrix + glPopName + glPrioritizeTextures + glPrioritizeTexturesEXT + glProgramEnvParameter4dARB + glProgramEnvParameter4dvARB + glProgramEnvParameter4fARB + glProgramEnvParameter4fvARB + glProgramLocalParameter4dARB + glProgramLocalParameter4dvARB + glProgramLocalParameter4fARB + glProgramLocalParameter4fvARB + glProgramNamedParameter4dNV + glProgramNamedParameter4dvNV + glProgramNamedParameter4fNV + glProgramNamedParameter4fvNV + glProgramParameters4dvNV + glProgramParameters4fvNV + glProgramParameter4dNV + glProgramParameter4dvNV + glProgramParameter4fNV + glProgramParameter4fvNV + glProgramStringARB + glPushAttrib + glPushClientAttrib + glPushMatrix + glPushName + glRasterPos2d + glRasterPos2dv + glRasterPos2f + glRasterPos2fv + glRasterPos2i + glRasterPos2iv + glRasterPos2s + glRasterPos2sv + glRasterPos3d + glRasterPos3dv + glRasterPos3f + glRasterPos3fv + glRasterPos3i + glRasterPos3iv + glRasterPos3s + glRasterPos3sv + glRasterPos4d + glRasterPos4dv + glRasterPos4f + glRasterPos4fv + glRasterPos4i + glRasterPos4iv + glRasterPos4s + glRasterPos4sv + glReadBuffer + glReadInstrumentsSGIX + glReadPixels + glRectd + glRectdv + glRectf + glRectfv + glRecti + glRectiv + glRects + glRectsv + glReferencePlaneSGIX + glRenderMode + glRequestResidentProgramsNV + glResetHistogram + glResetHistogramEXT + glResetMinmax + glResetMinmaxEXT + glResizeBuffersMESA + glRotated + glRotatef + glSampleCoverage + glSampleCoverageARB + glSampleMaskEXT + glSampleMaskSGIS + glSamplePatternEXT + glSamplePatternSGIS + glScaled + glScalef + glScissor + glSecondaryColorPointer + glSecondaryColorPointerEXT + glSecondaryColor3b + glSecondaryColor3bEXT + glSecondaryColor3bv + glSecondaryColor3bvEXT + glSecondaryColor3d + glSecondaryColor3dEXT + glSecondaryColor3dv + glSecondaryColor3dvEXT + glSecondaryColor3f + glSecondaryColor3fEXT + glSecondaryColor3fv + glSecondaryColor3fvEXT + glSecondaryColor3i + glSecondaryColor3iEXT + glSecondaryColor3iv + glSecondaryColor3ivEXT + glSecondaryColor3s + glSecondaryColor3sEXT + glSecondaryColor3sv + glSecondaryColor3svEXT + glSecondaryColor3ub + glSecondaryColor3ubEXT + glSecondaryColor3ubv + glSecondaryColor3ubvEXT + glSecondaryColor3ui + glSecondaryColor3uiEXT + glSecondaryColor3uiv + glSecondaryColor3uivEXT + glSecondaryColor3us + glSecondaryColor3usEXT + glSecondaryColor3usv + glSecondaryColor3usvEXT + glSelectBuffer + glSeparableFilter2D + glSeparableFilter2DEXT + glSetFenceNV + glShadeModel + glSharpenTexFuncSGIS + glSpriteParameterfSGIX + glSpriteParameterfvSGIX + glSpriteParameteriSGIX + glSpriteParameterivSGIX + glStartInstrumentsSGIX + glStencilFunc + glStencilMask + glStencilOp + glStopInstrumentsSGIX + glTagSampleBufferSGIX + glTbufferMask3DFX + glTestFenceNV + glTexCoordPointer + glTexCoordPointerEXT + glTexCoord1d + glTexCoord1dv + glTexCoord1f + glTexCoord1fv + glTexCoord1i + glTexCoord1iv + glTexCoord1s + glTexCoord1sv + glTexCoord2d + glTexCoord2dv + glTexCoord2f + glTexCoord2fv + glTexCoord2i + glTexCoord2iv + glTexCoord2s + glTexCoord2sv + glTexCoord3d + glTexCoord3dv + glTexCoord3f + glTexCoord3fv + glTexCoord3i + glTexCoord3iv + glTexCoord3s + glTexCoord3sv + glTexCoord4d + glTexCoord4dv + glTexCoord4f + glTexCoord4fv + glTexCoord4i + glTexCoord4iv + glTexCoord4s + glTexCoord4sv + glTexEnvf + glTexEnvfv + glTexEnvi + glTexEnviv + glTexFilterFuncSGIS + glTexGend + glTexGendv + glTexGenf + glTexGenfv + glTexGeni + glTexGeniv + glTexImage1D + glTexImage2D + glTexImage3D + glTexImage3DEXT + glTexImage4DSGIS + glTexParameterf + glTexParameterfv + glTexParameteri + glTexParameteriv + glTexSubImage1D + glTexSubImage1DEXT + glTexSubImage2D + glTexSubImage2DEXT + glTexSubImage3D + glTexSubImage3DEXT + glTexSubImage4DSGIS + glTrackMatrixNV + glTranslated + glTranslatef + glUnlockArraysEXT + glUnmapBufferARB + glVertexArrayRangeNV + glVertexAttribPointerARB + glVertexAttribPointerNV + glVertexAttribs1dvNV + glVertexAttribs1fvNV + glVertexAttribs1svNV + glVertexAttribs2dvNV + glVertexAttribs2fvNV + glVertexAttribs2svNV + glVertexAttribs3dvNV + glVertexAttribs3fvNV + glVertexAttribs3svNV + glVertexAttribs4dvNV + glVertexAttribs4fvNV + glVertexAttribs4svNV + glVertexAttribs4ubvNV + glVertexAttrib1dARB + glVertexAttrib1dNV + glVertexAttrib1dvARB + glVertexAttrib1dvNV + glVertexAttrib1fARB + glVertexAttrib1fNV + glVertexAttrib1fvARB + glVertexAttrib1fvNV + glVertexAttrib1sARB + glVertexAttrib1sNV + glVertexAttrib1svARB + glVertexAttrib1svNV + glVertexAttrib2dARB + glVertexAttrib2dNV + glVertexAttrib2dvARB + glVertexAttrib2dvNV + glVertexAttrib2fARB + glVertexAttrib2fNV + glVertexAttrib2fvARB + glVertexAttrib2fvNV + glVertexAttrib2sARB + glVertexAttrib2sNV + glVertexAttrib2svARB + glVertexAttrib2svNV + glVertexAttrib3dARB + glVertexAttrib3dNV + glVertexAttrib3dvARB + glVertexAttrib3dvNV + glVertexAttrib3fARB + glVertexAttrib3fNV + glVertexAttrib3fvARB + glVertexAttrib3fvNV + glVertexAttrib3sARB + glVertexAttrib3sNV + glVertexAttrib3svARB + glVertexAttrib3svNV + glVertexAttrib4bvARB + glVertexAttrib4dARB + glVertexAttrib4dNV + glVertexAttrib4dvARB + glVertexAttrib4dvNV + glVertexAttrib4fARB + glVertexAttrib4fNV + glVertexAttrib4fvARB + glVertexAttrib4fvNV + glVertexAttrib4ivARB + glVertexAttrib4NbvARB + glVertexAttrib4NivARB + glVertexAttrib4NsvARB + glVertexAttrib4NubARB + glVertexAttrib4NubvARB + glVertexAttrib4NuivARB + glVertexAttrib4NusvARB + glVertexAttrib4sARB + glVertexAttrib4sNV + glVertexAttrib4svARB + glVertexAttrib4svNV + glVertexAttrib4ubNV + glVertexAttrib4ubvARB + glVertexAttrib4ubvNV + glVertexAttrib4uivARB + glVertexAttrib4usvARB + glVertexPointer + glVertexPointerEXT + glVertexWeightfEXT + glVertexWeightfvEXT + glVertexWeightPointerEXT + glVertex2d + glVertex2dv + glVertex2f + glVertex2fv + glVertex2i + glVertex2iv + glVertex2s + glVertex2sv + glVertex3d + glVertex3dv + glVertex3f + glVertex3fv + glVertex3i + glVertex3iv + glVertex3s + glVertex3sv + glVertex4d + glVertex4dv + glVertex4f + glVertex4fv + glVertex4i + glVertex4iv + glVertex4s + glVertex4sv + glViewport + glWindowPos2d + glWindowPos2dARB + glWindowPos2dMESA + glWindowPos2dv + glWindowPos2dvARB + glWindowPos2dvMESA + glWindowPos2f + glWindowPos2fARB + glWindowPos2fMESA + glWindowPos2fv + glWindowPos2fvARB + glWindowPos2fvMESA + glWindowPos2i + glWindowPos2iARB + glWindowPos2iMESA + glWindowPos2iv + glWindowPos2ivARB + glWindowPos2ivMESA + glWindowPos2s + glWindowPos2sARB + glWindowPos2sMESA + glWindowPos2sv + glWindowPos2svARB + glWindowPos2svMESA + glWindowPos3d + glWindowPos3dARB + glWindowPos3dMESA + glWindowPos3dv + glWindowPos3dvARB + glWindowPos3dvMESA + glWindowPos3f + glWindowPos3fARB + glWindowPos3fMESA + glWindowPos3fv + glWindowPos3fvARB + glWindowPos3fvMESA + glWindowPos3i + glWindowPos3iARB + glWindowPos3iMESA + glWindowPos3iv + glWindowPos3ivARB + glWindowPos3ivMESA + glWindowPos3s + glWindowPos3sARB + glWindowPos3sMESA + glWindowPos3sv + glWindowPos3svARB + glWindowPos3svMESA + glWindowPos4dMESA + glWindowPos4dvMESA + glWindowPos4fMESA + glWindowPos4fvMESA + glWindowPos4iMESA + glWindowPos4ivMESA + glWindowPos4sMESA + glWindowPos4svMESA + fxCloseHardware +;fxGetScreenGeometry + fxMesaCreateBestContext + fxMesaCreateContext + fxMesaDestroyContext + fxMesaGetCurrentContext + fxMesaMakeCurrent + fxMesaSelectCurrentBoard +;fxMesaSetNearFar + fxMesaSwapBuffers + fxMesaUpdateScreenSize + wglChoosePixelFormat + wglCopyContext + wglCreateContext + wglCreateLayerContext + wglDeleteContext + wglDescribeLayerPlane + wglDescribePixelFormat + wglGetCurrentContext + wglGetCurrentDC + wglGetDefaultProcAddress + wglGetLayerPaletteEntries + wglGetPixelFormat + wglGetProcAddress + wglMakeCurrent + wglRealizeLayerPalette + wglSetLayerPaletteEntries + wglSetPixelFormat + wglShareLists + wglSwapBuffers + wglSwapLayerBuffers + wglUseFontBitmapsA + wglUseFontBitmapsW + wglUseFontOutlinesA + wglUseFontOutlinesW + ChoosePixelFormat + DescribePixelFormat + GetPixelFormat + SetPixelFormat + SwapBuffers + DrvCopyContext + DrvCreateContext + DrvCreateLayerContext + DrvDeleteContext + DrvDescribeLayerPlane + DrvDescribePixelFormat + DrvGetLayerPaletteEntries + DrvGetProcAddress + DrvReleaseContext + DrvRealizeLayerPalette + DrvSetContext + DrvSetLayerPaletteEntries + DrvSetPixelFormat + DrvShareLists + DrvSwapBuffers + DrvSwapLayerBuffers + DrvValidateVersion diff --git a/reactos/dll/mesa32/src/drivers/windows/fx/fxwgl.c b/reactos/dll/mesa32/src/drivers/windows/fx/fxwgl.c new file mode 100644 index 00000000000..ce76ecd1568 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/fx/fxwgl.c @@ -0,0 +1,1307 @@ +/* + * Mesa 3-D graphics library + * Version: 4.0 + * + * 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. + */ + +/* Authors: + * David Bucciarelli + * Brian Paul + * Keith Whitwell + * Hiroshi Morii + * Daniel Borca + */ + +/* fxwgl.c - Microsoft wgl functions emulation for + * 3Dfx VooDoo/Mesa interface + */ + + +#ifdef _WIN32 + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#define GL_GLEXT_PROTOTYPES +#include "GL/gl.h" +#include "GL/glext.h" + +#ifdef __cplusplus +} +#endif + +#include "GL/fxmesa.h" +#include "glheader.h" +#include "glapi.h" +#include "imports.h" +#include "../../glide/fxdrv.h" + +#define MAX_MESA_ATTRS 20 + +#if (_MSC_VER >= 1200) +#pragma warning( push ) +#pragma warning( disable : 4273 ) +#endif + +struct __extensions__ { + PROC proc; + char *name; +}; + +struct __pixelformat__ { + PIXELFORMATDESCRIPTOR pfd; + GLint mesaAttr[MAX_MESA_ATTRS]; +}; + +WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *); +static GLushort gammaTable[3 * 256]; + +struct __pixelformat__ pix[] = { + /* 16bit RGB565 single buffer with depth */ + { + {sizeof(PIXELFORMATDESCRIPTOR), 1, + PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL, + PFD_TYPE_RGBA, + 16, + 5, 0, 6, 5, 5, 11, 0, 0, + 0, 0, 0, 0, 0, + 16, + 0, + 0, + PFD_MAIN_PLANE, + 0, 0, 0, 0} + , + {FXMESA_COLORDEPTH, 16, + FXMESA_ALPHA_SIZE, 0, + FXMESA_DEPTH_SIZE, 16, + FXMESA_STENCIL_SIZE, 0, + FXMESA_ACCUM_SIZE, 0, + FXMESA_NONE} + } + , + /* 16bit RGB565 double buffer with depth */ + { + {sizeof(PIXELFORMATDESCRIPTOR), 1, + PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | + PFD_DOUBLEBUFFER | PFD_SWAP_COPY, + PFD_TYPE_RGBA, + 16, + 5, 0, 6, 5, 5, 11, 0, 0, + 0, 0, 0, 0, 0, + 16, + 0, + 0, + PFD_MAIN_PLANE, + 0, 0, 0, 0} + , + {FXMESA_COLORDEPTH, 16, + FXMESA_DOUBLEBUFFER, + FXMESA_ALPHA_SIZE, 0, + FXMESA_DEPTH_SIZE, 16, + FXMESA_STENCIL_SIZE, 0, + FXMESA_ACCUM_SIZE, 0, + FXMESA_NONE} + } + , + /* 16bit ARGB1555 single buffer with depth */ + { + {sizeof(PIXELFORMATDESCRIPTOR), 1, + PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL, + PFD_TYPE_RGBA, + 16, + 5, 0, 5, 5, 5, 10, 1, 15, + 0, 0, 0, 0, 0, + 16, + 0, + 0, + PFD_MAIN_PLANE, + 0, 0, 0, 0} + , + {FXMESA_COLORDEPTH, 15, + FXMESA_ALPHA_SIZE, 1, + FXMESA_DEPTH_SIZE, 16, + FXMESA_STENCIL_SIZE, 0, + FXMESA_ACCUM_SIZE, 0, + FXMESA_NONE} + } + , + /* 16bit ARGB1555 double buffer with depth */ + { + {sizeof(PIXELFORMATDESCRIPTOR), 1, + PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | + PFD_DOUBLEBUFFER | PFD_SWAP_COPY, + PFD_TYPE_RGBA, + 16, + 5, 0, 5, 5, 5, 10, 1, 15, + 0, 0, 0, 0, 0, + 16, + 0, + 0, + PFD_MAIN_PLANE, + 0, 0, 0, 0} + , + {FXMESA_COLORDEPTH, 15, + FXMESA_DOUBLEBUFFER, + FXMESA_ALPHA_SIZE, 1, + FXMESA_DEPTH_SIZE, 16, + FXMESA_STENCIL_SIZE, 0, + FXMESA_ACCUM_SIZE, 0, + FXMESA_NONE} + } + , + /* 32bit ARGB8888 single buffer with depth */ + { + {sizeof(PIXELFORMATDESCRIPTOR), 1, + PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL, + PFD_TYPE_RGBA, + 32, + 8, 0, 8, 8, 8, 16, 8, 24, + 0, 0, 0, 0, 0, + 24, + 8, + 0, + PFD_MAIN_PLANE, + 0, 0, 0, 0} + , + {FXMESA_COLORDEPTH, 32, + FXMESA_ALPHA_SIZE, 8, + FXMESA_DEPTH_SIZE, 24, + FXMESA_STENCIL_SIZE, 8, + FXMESA_ACCUM_SIZE, 0, + FXMESA_NONE} + } + , + /* 32bit ARGB8888 double buffer with depth */ + { + {sizeof(PIXELFORMATDESCRIPTOR), 1, + PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | + PFD_DOUBLEBUFFER | PFD_SWAP_COPY, + PFD_TYPE_RGBA, + 32, + 8, 0, 8, 8, 8, 16, 8, 24, + 0, 0, 0, 0, 0, + 24, + 8, + 0, + PFD_MAIN_PLANE, + 0, 0, 0, 0} + , + {FXMESA_COLORDEPTH, 32, + FXMESA_DOUBLEBUFFER, + FXMESA_ALPHA_SIZE, 8, + FXMESA_DEPTH_SIZE, 24, + FXMESA_STENCIL_SIZE, 8, + FXMESA_ACCUM_SIZE, 0, + FXMESA_NONE} + } +}; + +static fxMesaContext ctx = NULL; +static WNDPROC hWNDOldProc; +static int curPFD = 0; +static HDC hDC; +static HWND hWND; + +static GLboolean haveDualHead; + +/* For the in-window-rendering hack */ + +#ifndef GR_CONTROL_RESIZE +/* Apparently GR_CONTROL_RESIZE can be ignored. OK? */ +#define GR_CONTROL_RESIZE -1 +#endif + +static GLboolean gdiWindowHack; +static void *dibSurfacePtr; +static BITMAPINFO *dibBMI; +static HBITMAP dibHBM; +static HWND dibWnd; + +static int +env_check (const char *var, int val) +{ + const char *env = getenv(var); + return (env && (env[0] == val)); +} + +static LRESULT APIENTRY +__wglMonitor (HWND hwnd, UINT message, UINT wParam, LONG lParam) +{ + long ret; /* Now gives the resized window at the end to hWNDOldProc */ + + if (ctx && hwnd == hWND) { + switch (message) { + case WM_PAINT: + case WM_MOVE: + break; + case WM_DISPLAYCHANGE: + case WM_SIZE: +#if 0 + if (wParam != SIZE_MINIMIZED) { + static int moving = 0; + if (!moving) { + if (!FX_grSstControl(GR_CONTROL_RESIZE)) { + moving = 1; + SetWindowPos(hwnd, 0, 0, 0, 300, 300, SWP_NOMOVE | SWP_NOZORDER); + moving = 0; + if (!FX_grSstControl(GR_CONTROL_RESIZE)) { + /*MessageBox(0,_T("Error changing windowsize"),_T("fxMESA"),MB_OK);*/ + PostMessage(hWND, WM_CLOSE, 0, 0); + } + } + /* Do the clipping in the glide library */ + grClipWindow(0, 0, FX_grSstScreenWidth(), FX_grSstScreenHeight()); + /* And let the new size set in the context */ + fxMesaUpdateScreenSize(ctx); + } + } +#endif + break; + case WM_ACTIVATE: + break; + case WM_SHOWWINDOW: + break; + case WM_SYSKEYDOWN: + case WM_SYSCHAR: + break; + } + } + + /* Finally call the hWNDOldProc, which handles the resize with the + * now changed window sizes */ + ret = CallWindowProc(hWNDOldProc, hwnd, message, wParam, lParam); + + return ret; +} + +static void +wgl_error (long error) +{ +#define WGL_INVALID_PIXELFORMAT ERROR_INVALID_PIXEL_FORMAT + SetLastError(0xC0000000 /* error severity */ + |0x00070000 /* error facility (who we are) */ + |error); +} + +GLAPI BOOL GLAPIENTRY +wglCopyContext (HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask) +{ + return FALSE; +} + +GLAPI HGLRC GLAPIENTRY +wglCreateContext (HDC hdc) +{ + HWND hWnd; + WNDPROC oldProc; + int error; + + if (ctx) { + SetLastError(0); + return NULL; + } + + if (!(hWnd = WindowFromDC(hdc))) { + SetLastError(0); + return NULL; + } + + if (curPFD == 0) { + wgl_error(WGL_INVALID_PIXELFORMAT); + return NULL; + } + + if ((oldProc = (WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC)) != __wglMonitor) { + hWNDOldProc = oldProc; + SetWindowLong(hWnd, GWL_WNDPROC, (LONG)__wglMonitor); + } + + /* always log when debugging, or if user demands */ + if (TDFX_DEBUG || env_check("MESA_FX_INFO", 'r')) { + freopen("MESA.LOG", "w", stderr); + } + + { + RECT cliRect; + ShowWindow(hWnd, SW_SHOWNORMAL); + SetForegroundWindow(hWnd); + Sleep(100); /* a hack for win95 */ + if (env_check("MESA_GLX_FX", 'w') && !(GetWindowLong(hWnd, GWL_STYLE) & WS_POPUP)) { + /* XXX todo - windowed modes */ + error = !(ctx = fxMesaCreateContext((GLuint) hWnd, GR_RESOLUTION_NONE, GR_REFRESH_NONE, pix[curPFD - 1].mesaAttr)); + } else { + GetClientRect(hWnd, &cliRect); + error = !(ctx = fxMesaCreateBestContext((GLuint) hWnd, cliRect.right, cliRect.bottom, pix[curPFD - 1].mesaAttr)); + } + } + + /*if (getenv("SST_DUALHEAD")) + haveDualHead = + ((atoi(getenv("SST_DUALHEAD")) == 1) ? GL_TRUE : GL_FALSE); + else + haveDualHead = GL_FALSE;*/ + + if (error) { + SetLastError(0); + return NULL; + } + + hDC = hdc; + hWND = hWnd; + + /* Required by the OpenGL Optimizer 1.1 (is it a Optimizer bug ?) */ + wglMakeCurrent(hdc, (HGLRC)1); + + return (HGLRC)1; +} + +GLAPI HGLRC GLAPIENTRY +wglCreateLayerContext (HDC hdc, int iLayerPlane) +{ + SetLastError(0); + return NULL; +} + +GLAPI BOOL GLAPIENTRY +wglDeleteContext (HGLRC hglrc) +{ + if (ctx && hglrc == (HGLRC)1) { + + fxMesaDestroyContext(ctx); + + SetWindowLong(WindowFromDC(hDC), GWL_WNDPROC, (LONG) hWNDOldProc); + + ctx = NULL; + hDC = 0; + return TRUE; + } + + SetLastError(0); + + return FALSE; +} + +GLAPI HGLRC GLAPIENTRY +wglGetCurrentContext (VOID) +{ + if (ctx) + return (HGLRC)1; + + SetLastError(0); + return NULL; +} + +GLAPI HDC GLAPIENTRY +wglGetCurrentDC (VOID) +{ + if (ctx) + return hDC; + + SetLastError(0); + return NULL; +} + +GLAPI BOOL GLAPIENTRY +wglSwapIntervalEXT (int interval) +{ + if (ctx == NULL) { + return FALSE; + } + if (interval < 0) { + interval = 0; + } else if (interval > 3) { + interval = 3; + } + ctx->swapInterval = interval; + return TRUE; +} + +GLAPI int GLAPIENTRY +wglGetSwapIntervalEXT (void) +{ + return (ctx == NULL) ? -1 : ctx->swapInterval; +} + +GLAPI BOOL GLAPIENTRY +wglGetDeviceGammaRamp3DFX (HDC hdc, LPVOID arrays) +{ + /* gammaTable should be per-context */ + memcpy(arrays, gammaTable, 3 * 256 * sizeof(GLushort)); + return TRUE; +} + +GLAPI BOOL GLAPIENTRY +wglSetDeviceGammaRamp3DFX (HDC hdc, LPVOID arrays) +{ + GLint i, tableSize, inc, index; + GLushort *red, *green, *blue; + FxU32 gammaTableR[256], gammaTableG[256], gammaTableB[256]; + + /* gammaTable should be per-context */ + memcpy(gammaTable, arrays, 3 * 256 * sizeof(GLushort)); + + tableSize = FX_grGetInteger(GR_GAMMA_TABLE_ENTRIES); + inc = 256 / tableSize; + red = (GLushort *)arrays; + green = (GLushort *)arrays + 256; + blue = (GLushort *)arrays + 512; + for (i = 0, index = 0; i < tableSize; i++, index += inc) { + gammaTableR[i] = red[index] >> 8; + gammaTableG[i] = green[index] >> 8; + gammaTableB[i] = blue[index] >> 8; + } + + grLoadGammaTable(tableSize, gammaTableR, gammaTableG, gammaTableB); + + return TRUE; +} + +typedef void *HPBUFFERARB; + +/* WGL_ARB_pixel_format */ +GLAPI BOOL GLAPIENTRY +wglGetPixelFormatAttribivARB (HDC hdc, + int iPixelFormat, + int iLayerPlane, + UINT nAttributes, + const int *piAttributes, + int *piValues) +{ + SetLastError(0); + return FALSE; +} + +GLAPI BOOL GLAPIENTRY +wglGetPixelFormatAttribfvARB (HDC hdc, + int iPixelFormat, + int iLayerPlane, + UINT nAttributes, + const int *piAttributes, + FLOAT *pfValues) +{ + SetLastError(0); + return FALSE; +} + +GLAPI BOOL GLAPIENTRY +wglChoosePixelFormatARB (HDC hdc, + const int *piAttribIList, + const FLOAT *pfAttribFList, + UINT nMaxFormats, + int *piFormats, + UINT *nNumFormats) +{ + SetLastError(0); + return FALSE; +} + +/* WGL_ARB_render_texture */ +GLAPI BOOL GLAPIENTRY +wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer) +{ + SetLastError(0); + return FALSE; +} + +GLAPI BOOL GLAPIENTRY +wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer) +{ + SetLastError(0); + return FALSE; +} + +GLAPI BOOL GLAPIENTRY +wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, + const int *piAttribList) +{ + SetLastError(0); + return FALSE; +} + +/* WGL_ARB_pbuffer */ +GLAPI HPBUFFERARB GLAPIENTRY +wglCreatePbufferARB (HDC hDC, + int iPixelFormat, + int iWidth, + int iHeight, + const int *piAttribList) +{ + SetLastError(0); + return NULL; +} + +GLAPI HDC GLAPIENTRY +wglGetPbufferDCARB (HPBUFFERARB hPbuffer) +{ + SetLastError(0); + return NULL; +} + +GLAPI int GLAPIENTRY +wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC) +{ + SetLastError(0); + return -1; +} + +GLAPI BOOL GLAPIENTRY +wglDestroyPbufferARB (HPBUFFERARB hPbuffer) +{ + SetLastError(0); + return FALSE; +} + +GLAPI BOOL GLAPIENTRY +wglQueryPbufferARB (HPBUFFERARB hPbuffer, + int iAttribute, + int *piValue) +{ + SetLastError(0); + return FALSE; +} + +GLAPI const char * GLAPIENTRY +wglGetExtensionsStringEXT (void) +{ + return "WGL_3DFX_gamma_control " + "WGL_EXT_swap_control " + "WGL_EXT_extensions_string WGL_ARB_extensions_string" + /*WGL_ARB_pixel_format WGL_ARB_render_texture WGL_ARB_pbuffer*/; +} + +GLAPI const char * GLAPIENTRY +wglGetExtensionsStringARB (HDC hdc) +{ + return wglGetExtensionsStringEXT(); +} + +static struct { + const char *name; + PROC func; +} wgl_ext[] = { + {"wglGetExtensionsStringARB", (PROC)wglGetExtensionsStringARB}, + {"wglGetExtensionsStringEXT", (PROC)wglGetExtensionsStringEXT}, + {"wglSwapIntervalEXT", (PROC)wglSwapIntervalEXT}, + {"wglGetSwapIntervalEXT", (PROC)wglGetSwapIntervalEXT}, + {"wglGetDeviceGammaRamp3DFX", (PROC)wglGetDeviceGammaRamp3DFX}, + {"wglSetDeviceGammaRamp3DFX", (PROC)wglSetDeviceGammaRamp3DFX}, + /* WGL_ARB_pixel_format */ + {"wglGetPixelFormatAttribivARB", (PROC)wglGetPixelFormatAttribivARB}, + {"wglGetPixelFormatAttribfvARB", (PROC)wglGetPixelFormatAttribfvARB}, + {"wglChoosePixelFormatARB", (PROC)wglChoosePixelFormatARB}, + /* WGL_ARB_render_texture */ + {"wglBindTexImageARB", (PROC)wglBindTexImageARB}, + {"wglReleaseTexImageARB", (PROC)wglReleaseTexImageARB}, + {"wglSetPbufferAttribARB", (PROC)wglSetPbufferAttribARB}, + /* WGL_ARB_pbuffer */ + {"wglCreatePbufferARB", (PROC)wglCreatePbufferARB}, + {"wglGetPbufferDCARB", (PROC)wglGetPbufferDCARB}, + {"wglReleasePbufferDCARB", (PROC)wglReleasePbufferDCARB}, + {"wglDestroyPbufferARB", (PROC)wglDestroyPbufferARB}, + {"wglQueryPbufferARB", (PROC)wglQueryPbufferARB}, + {NULL, NULL} +}; + +GLAPI PROC GLAPIENTRY +wglGetProcAddress (LPCSTR lpszProc) +{ + int i; + PROC p = (PROC)_glapi_get_proc_address((const char *)lpszProc); + + /* we can't BlendColor. work around buggy applications */ + if (p && strcmp(lpszProc, "glBlendColor") + && strcmp(lpszProc, "glBlendColorEXT")) + return p; + + for (i = 0; wgl_ext[i].name; i++) { + if (!strcmp(lpszProc, wgl_ext[i].name)) { + return wgl_ext[i].func; + } + } + + SetLastError(0); + return NULL; +} + +GLAPI PROC GLAPIENTRY +wglGetDefaultProcAddress (LPCSTR lpszProc) +{ + SetLastError(0); + return NULL; +} + +GLAPI BOOL GLAPIENTRY +wglMakeCurrent (HDC hdc, HGLRC hglrc) +{ + if ((hdc == NULL) && (hglrc == NULL)) + return TRUE; + + if (!ctx || hglrc != (HGLRC)1 || WindowFromDC(hdc) != hWND) { + SetLastError(0); + return FALSE; + } + + hDC = hdc; + + fxMesaMakeCurrent(ctx); + + return TRUE; +} + +GLAPI BOOL GLAPIENTRY +wglShareLists (HGLRC hglrc1, HGLRC hglrc2) +{ + if (!ctx || hglrc1 != (HGLRC)1 || hglrc1 != hglrc2) { + SetLastError(0); + return FALSE; + } + + return TRUE; +} + +static BOOL +wglUseFontBitmaps_FX (HDC fontDevice, DWORD firstChar, DWORD numChars, + DWORD listBase) +{ + TEXTMETRIC metric; + BITMAPINFO *dibInfo; + HDC bitDevice; + COLORREF tempColor; + int i; + + GetTextMetrics(fontDevice, &metric); + + dibInfo = (BITMAPINFO *)calloc(sizeof(BITMAPINFO) + sizeof(RGBQUAD), 1); + dibInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + dibInfo->bmiHeader.biPlanes = 1; + dibInfo->bmiHeader.biBitCount = 1; + dibInfo->bmiHeader.biCompression = BI_RGB; + + bitDevice = CreateCompatibleDC(fontDevice); + + /* Swap fore and back colors so the bitmap has the right polarity */ + tempColor = GetBkColor(bitDevice); + SetBkColor(bitDevice, GetTextColor(bitDevice)); + SetTextColor(bitDevice, tempColor); + + /* Place chars based on base line */ + SetTextAlign(bitDevice, TA_BASELINE); + + for (i = 0; i < (int)numChars; i++) { + SIZE size; + char curChar; + int charWidth, charHeight, bmapWidth, bmapHeight, numBytes, res; + HBITMAP bitObject; + HGDIOBJ origBmap; + unsigned char *bmap; + + curChar = (char)(i + firstChar); /* [koolsmoky] explicit cast */ + + /* Find how high/wide this character is */ + GetTextExtentPoint32(bitDevice, &curChar, 1, &size); + + /* Create the output bitmap */ + charWidth = size.cx; + charHeight = size.cy; + bmapWidth = ((charWidth + 31) / 32) * 32; /* Round up to the next multiple of 32 bits */ + bmapHeight = charHeight; + bitObject = CreateCompatibleBitmap(bitDevice, bmapWidth, bmapHeight); + /*VERIFY(bitObject);*/ + + /* Assign the output bitmap to the device */ + origBmap = SelectObject(bitDevice, bitObject); + + PatBlt(bitDevice, 0, 0, bmapWidth, bmapHeight, BLACKNESS); + + /* Use our source font on the device */ + SelectObject(bitDevice, GetCurrentObject(fontDevice, OBJ_FONT)); + + /* Draw the character */ + TextOut(bitDevice, 0, metric.tmAscent, &curChar, 1); + + /* Unselect our bmap object */ + SelectObject(bitDevice, origBmap); + + /* Convert the display dependant representation to a 1 bit deep DIB */ + numBytes = (bmapWidth * bmapHeight) / 8; + bmap = MALLOC(numBytes); + dibInfo->bmiHeader.biWidth = bmapWidth; + dibInfo->bmiHeader.biHeight = bmapHeight; + res = GetDIBits(bitDevice, bitObject, 0, bmapHeight, bmap, + dibInfo, DIB_RGB_COLORS); + + /* Create the GL object */ + glNewList(i + listBase, GL_COMPILE); + glBitmap(bmapWidth, bmapHeight, 0.0, metric.tmDescent, + charWidth, 0.0, bmap); + glEndList(); + /* CheckGL(); */ + + /* Destroy the bmap object */ + DeleteObject(bitObject); + + /* Deallocate the bitmap data */ + FREE(bmap); + } + + /* Destroy the DC */ + DeleteDC(bitDevice); + + FREE(dibInfo); + + return TRUE; +} + +GLAPI BOOL GLAPIENTRY +wglUseFontBitmapsW (HDC hdc, DWORD first, DWORD count, DWORD listBase) +{ + return FALSE; +} + +GLAPI BOOL GLAPIENTRY +wglUseFontOutlinesA (HDC hdc, DWORD first, DWORD count, + DWORD listBase, FLOAT deviation, + FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf) +{ + SetLastError(0); + return FALSE; +} + +GLAPI BOOL GLAPIENTRY +wglUseFontOutlinesW (HDC hdc, DWORD first, DWORD count, + DWORD listBase, FLOAT deviation, + FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf) +{ + SetLastError(0); + return FALSE; +} + + +GLAPI BOOL GLAPIENTRY +wglSwapLayerBuffers (HDC hdc, UINT fuPlanes) +{ + if (ctx && WindowFromDC(hdc) == hWND) { + fxMesaSwapBuffers(); + + return TRUE; + } + + SetLastError(0); + return FALSE; +} + +static int +pfd_tablen (void) +{ + /* we should take an envvar for `fxMesaSelectCurrentBoard' */ + return (fxMesaSelectCurrentBoard(0) < GR_SSTTYPE_Voodoo4) + ? 2 /* only 16bit entries */ + : sizeof(pix) / sizeof(pix[0]); /* full table */ +} + +GLAPI int GLAPIENTRY +wglChoosePixelFormat (HDC hdc, const PIXELFORMATDESCRIPTOR *ppfd) +{ + int i, best = -1, qt_valid_pix; + PIXELFORMATDESCRIPTOR pfd = *ppfd; + + qt_valid_pix = pfd_tablen(); + +#if 1 || QUAKE2 || GORE + /* QUAKE2: 24+32 */ + /* GORE : 24+16 */ + if ((pfd.cColorBits == 24) || (pfd.cColorBits == 32)) { + /* the first 2 entries are 16bit */ + pfd.cColorBits = (qt_valid_pix > 2) ? 32 : 16; + } + if (pfd.cColorBits == 32) { + pfd.cDepthBits = 24; + } else if (pfd.cColorBits == 16) { + pfd.cDepthBits = 16; + } +#endif + + if (pfd.nSize != sizeof(PIXELFORMATDESCRIPTOR) || pfd.nVersion != 1) { + SetLastError(0); + return 0; + } + + for (i = 0; i < qt_valid_pix; i++) { + if (pfd.cColorBits > 0 && pix[i].pfd.cColorBits != pfd.cColorBits) + continue; + + if ((pfd.dwFlags & PFD_DRAW_TO_WINDOW) + && !(pix[i].pfd.dwFlags & PFD_DRAW_TO_WINDOW)) continue; + if ((pfd.dwFlags & PFD_DRAW_TO_BITMAP) + && !(pix[i].pfd.dwFlags & PFD_DRAW_TO_BITMAP)) continue; + if ((pfd.dwFlags & PFD_SUPPORT_GDI) + && !(pix[i].pfd.dwFlags & PFD_SUPPORT_GDI)) continue; + if ((pfd.dwFlags & PFD_SUPPORT_OPENGL) + && !(pix[i].pfd.dwFlags & PFD_SUPPORT_OPENGL)) continue; + if (!(pfd.dwFlags & PFD_DOUBLEBUFFER_DONTCARE) + && ((pfd.dwFlags & PFD_DOUBLEBUFFER) != + (pix[i].pfd.dwFlags & PFD_DOUBLEBUFFER))) continue; +#if 1 /* Doom3 fails here! */ + if (!(pfd.dwFlags & PFD_STEREO_DONTCARE) + && ((pfd.dwFlags & PFD_STEREO) != + (pix[i].pfd.dwFlags & PFD_STEREO))) continue; +#endif + + if (pfd.cDepthBits > 0 && pix[i].pfd.cDepthBits == 0) + continue; /* need depth buffer */ + + if (pfd.cAlphaBits > 0 && pix[i].pfd.cAlphaBits == 0) + continue; /* need alpha buffer */ + +#if 0 /* regression bug? */ + if (pfd.cStencilBits > 0 && pix[i].pfd.cStencilBits == 0) + continue; /* need stencil buffer */ +#endif + + if (pfd.iPixelType == pix[i].pfd.iPixelType) { + best = i + 1; + break; + } + } + + if (best == -1) { + FILE *err = fopen("MESA.LOG", "w"); + if (err != NULL) { + fprintf(err, "wglChoosePixelFormat failed\n"); + fprintf(err, "\tnSize = %d\n", ppfd->nSize); + fprintf(err, "\tnVersion = %d\n", ppfd->nVersion); + fprintf(err, "\tdwFlags = %lu\n", ppfd->dwFlags); + fprintf(err, "\tiPixelType = %d\n", ppfd->iPixelType); + fprintf(err, "\tcColorBits = %d\n", ppfd->cColorBits); + fprintf(err, "\tcRedBits = %d\n", ppfd->cRedBits); + fprintf(err, "\tcRedShift = %d\n", ppfd->cRedShift); + fprintf(err, "\tcGreenBits = %d\n", ppfd->cGreenBits); + fprintf(err, "\tcGreenShift = %d\n", ppfd->cGreenShift); + fprintf(err, "\tcBlueBits = %d\n", ppfd->cBlueBits); + fprintf(err, "\tcBlueShift = %d\n", ppfd->cBlueShift); + fprintf(err, "\tcAlphaBits = %d\n", ppfd->cAlphaBits); + fprintf(err, "\tcAlphaShift = %d\n", ppfd->cAlphaShift); + fprintf(err, "\tcAccumBits = %d\n", ppfd->cAccumBits); + fprintf(err, "\tcAccumRedBits = %d\n", ppfd->cAccumRedBits); + fprintf(err, "\tcAccumGreenBits = %d\n", ppfd->cAccumGreenBits); + fprintf(err, "\tcAccumBlueBits = %d\n", ppfd->cAccumBlueBits); + fprintf(err, "\tcAccumAlphaBits = %d\n", ppfd->cAccumAlphaBits); + fprintf(err, "\tcDepthBits = %d\n", ppfd->cDepthBits); + fprintf(err, "\tcStencilBits = %d\n", ppfd->cStencilBits); + fprintf(err, "\tcAuxBuffers = %d\n", ppfd->cAuxBuffers); + fprintf(err, "\tiLayerType = %d\n", ppfd->iLayerType); + fprintf(err, "\tbReserved = %d\n", ppfd->bReserved); + fprintf(err, "\tdwLayerMask = %lu\n", ppfd->dwLayerMask); + fprintf(err, "\tdwVisibleMask = %lu\n", ppfd->dwVisibleMask); + fprintf(err, "\tdwDamageMask = %lu\n", ppfd->dwDamageMask); + fclose(err); + } + + SetLastError(0); + return 0; + } + + return best; +} + +GLAPI int GLAPIENTRY +ChoosePixelFormat (HDC hdc, const PIXELFORMATDESCRIPTOR *ppfd) +{ + + return wglChoosePixelFormat(hdc, ppfd); +} + +GLAPI int GLAPIENTRY +wglDescribePixelFormat (HDC hdc, int iPixelFormat, UINT nBytes, + LPPIXELFORMATDESCRIPTOR ppfd) +{ + int qt_valid_pix; + + qt_valid_pix = pfd_tablen(); + + if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix || + ((nBytes != sizeof(PIXELFORMATDESCRIPTOR)) && (nBytes != 0))) { + SetLastError(0); + return qt_valid_pix; + } + + if (nBytes != 0) + *ppfd = pix[iPixelFormat - 1].pfd; + + return qt_valid_pix; +} + +GLAPI int GLAPIENTRY +DescribePixelFormat (HDC hdc, int iPixelFormat, UINT nBytes, + LPPIXELFORMATDESCRIPTOR ppfd) +{ + return wglDescribePixelFormat(hdc, iPixelFormat, nBytes, ppfd); +} + +GLAPI int GLAPIENTRY +wglGetPixelFormat (HDC hdc) +{ + if (curPFD == 0) { + SetLastError(0); + return 0; + } + + return curPFD; +} + +GLAPI int GLAPIENTRY +GetPixelFormat (HDC hdc) +{ + return wglGetPixelFormat(hdc); +} + +GLAPI BOOL GLAPIENTRY +wglSetPixelFormat (HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd) +{ + int qt_valid_pix; + + qt_valid_pix = pfd_tablen(); + + if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix) { + if (ppfd == NULL) { + PIXELFORMATDESCRIPTOR my_pfd; + if (!wglDescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &my_pfd)) { + SetLastError(0); + return FALSE; + } + } else if (ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR)) { + SetLastError(0); + return FALSE; + } + } + curPFD = iPixelFormat; + + return TRUE; +} + +GLAPI BOOL GLAPIENTRY +wglSwapBuffers (HDC hdc) +{ + if (!ctx) { + SetLastError(0); + return FALSE; + } + + fxMesaSwapBuffers(); + + return TRUE; +} + +GLAPI BOOL GLAPIENTRY +SetPixelFormat (HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd) +{ + return wglSetPixelFormat(hdc, iPixelFormat, ppfd); +} + +GLAPI BOOL GLAPIENTRY +SwapBuffers(HDC hdc) +{ + return wglSwapBuffers(hdc); +} + +static FIXED +FixedFromDouble (double d) +{ + struct { + FIXED f; + long l; + } pun; + pun.l = (long)(d * 65536L); + return pun.f; +} + +/* +** This was yanked from windows/gdi/wgl.c +*/ +GLAPI BOOL GLAPIENTRY +wglUseFontBitmapsA (HDC hdc, DWORD first, DWORD count, DWORD listBase) +{ + int i; + GLuint font_list; + DWORD size; + GLYPHMETRICS gm; + HANDLE hBits; + LPSTR lpBits; + MAT2 mat; + int success = TRUE; + + font_list = listBase; + + mat.eM11 = FixedFromDouble(1); + mat.eM12 = FixedFromDouble(0); + mat.eM21 = FixedFromDouble(0); + mat.eM22 = FixedFromDouble(-1); + + memset(&gm, 0, sizeof(gm)); + + /* + ** If we can't get the glyph outline, it may be because this is a fixed + ** font. Try processing it that way. + */ + if (GetGlyphOutline(hdc, first, GGO_BITMAP, &gm, 0, NULL, &mat) == GDI_ERROR) { + return wglUseFontBitmaps_FX(hdc, first, count, listBase); + } + + /* + ** Otherwise process all desired characters. + */ + for (i = 0; i < count; i++) { + DWORD err; + + glNewList(font_list + i, GL_COMPILE); + + /* allocate space for the bitmap/outline */ + size = GetGlyphOutline(hdc, first + i, GGO_BITMAP, &gm, 0, NULL, &mat); + if (size == GDI_ERROR) { + glEndList(); + err = GetLastError(); + success = FALSE; + continue; + } + + hBits = GlobalAlloc(GHND, size + 1); + lpBits = GlobalLock(hBits); + + err = GetGlyphOutline(hdc, /* handle to device context */ + first + i, /* character to query */ + GGO_BITMAP, /* format of data to return */ + &gm, /* pointer to structure for metrics */ + size, /* size of buffer for data */ + lpBits, /* pointer to buffer for data */ + &mat /* pointer to transformation */ + /* matrix structure */ + ); + + if (err == GDI_ERROR) { + GlobalUnlock(hBits); + GlobalFree(hBits); + + glEndList(); + err = GetLastError(); + success = FALSE; + continue; + } + + glBitmap(gm.gmBlackBoxX, gm.gmBlackBoxY, + -gm.gmptGlyphOrigin.x, + gm.gmptGlyphOrigin.y, + gm.gmCellIncX, gm.gmCellIncY, + (const GLubyte *)lpBits); + + GlobalUnlock(hBits); + GlobalFree(hBits); + + glEndList(); + } + + return success; +} + +GLAPI BOOL GLAPIENTRY +wglDescribeLayerPlane (HDC hdc, int iPixelFormat, int iLayerPlane, + UINT nBytes, LPLAYERPLANEDESCRIPTOR ppfd) +{ + SetLastError(0); + return FALSE; +} + +GLAPI int GLAPIENTRY +wglGetLayerPaletteEntries (HDC hdc, int iLayerPlane, int iStart, + int cEntries, COLORREF *pcr) +{ + SetLastError(0); + return FALSE; +} + +GLAPI BOOL GLAPIENTRY +wglRealizeLayerPalette (HDC hdc, int iLayerPlane, BOOL bRealize) +{ + SetLastError(0); + return FALSE; +} + +GLAPI int GLAPIENTRY +wglSetLayerPaletteEntries (HDC hdc, int iLayerPlane, int iStart, + int cEntries, CONST COLORREF *pcr) +{ + SetLastError(0); + return FALSE; +} + + +/*************************************************************************** + * [dBorca] simplistic ICD implementation, based on ICD code by Gregor Anich + */ + +typedef struct _icdTable { + DWORD size; + PROC table[336]; +} ICDTABLE, *PICDTABLE; + +#ifdef USE_MGL_NAMESPACE +#define GL_FUNC(func) mgl##func +#else +#define GL_FUNC(func) gl##func +#endif + +static ICDTABLE icdTable = { 336, { +#define ICD_ENTRY(func) (PROC)GL_FUNC(func), +#include "../icd/icdlist.h" +#undef ICD_ENTRY +} }; + + +GLAPI BOOL GLAPIENTRY +DrvCopyContext (HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask) +{ + return wglCopyContext(hglrcSrc, hglrcDst, mask); +} + + +GLAPI HGLRC GLAPIENTRY +DrvCreateContext (HDC hdc) +{ + return wglCreateContext(hdc); +} + + +GLAPI BOOL GLAPIENTRY +DrvDeleteContext (HGLRC hglrc) +{ + return wglDeleteContext(hglrc); +} + + +GLAPI HGLRC GLAPIENTRY +DrvCreateLayerContext (HDC hdc, int iLayerPlane) +{ + return wglCreateContext(hdc); +} + + +GLAPI PICDTABLE GLAPIENTRY +DrvSetContext (HDC hdc, HGLRC hglrc, void *callback) +{ + return wglMakeCurrent(hdc, hglrc) ? &icdTable : NULL; +} + + +GLAPI BOOL GLAPIENTRY +DrvReleaseContext (HGLRC hglrc) +{ + return TRUE; +} + + +GLAPI BOOL GLAPIENTRY +DrvShareLists (HGLRC hglrc1, HGLRC hglrc2) +{ + return wglShareLists(hglrc1, hglrc2); +} + + +GLAPI BOOL GLAPIENTRY +DrvDescribeLayerPlane (HDC hdc, int iPixelFormat, + int iLayerPlane, UINT nBytes, + LPLAYERPLANEDESCRIPTOR plpd) +{ + return wglDescribeLayerPlane(hdc, iPixelFormat, iLayerPlane, nBytes, plpd); +} + + +GLAPI int GLAPIENTRY +DrvSetLayerPaletteEntries (HDC hdc, int iLayerPlane, + int iStart, int cEntries, CONST COLORREF *pcr) +{ + return wglSetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr); +} + + +GLAPI int GLAPIENTRY +DrvGetLayerPaletteEntries (HDC hdc, int iLayerPlane, + int iStart, int cEntries, COLORREF *pcr) +{ + return wglGetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr); +} + + +GLAPI BOOL GLAPIENTRY +DrvRealizeLayerPalette (HDC hdc, int iLayerPlane, BOOL bRealize) +{ + return wglRealizeLayerPalette(hdc, iLayerPlane, bRealize); +} + + +GLAPI BOOL GLAPIENTRY +DrvSwapLayerBuffers (HDC hdc, UINT fuPlanes) +{ + return wglSwapLayerBuffers(hdc, fuPlanes); +} + +GLAPI int GLAPIENTRY +DrvDescribePixelFormat (HDC hdc, int iPixelFormat, UINT nBytes, + LPPIXELFORMATDESCRIPTOR ppfd) +{ + return wglDescribePixelFormat(hdc, iPixelFormat, nBytes, ppfd); +} + + +GLAPI PROC GLAPIENTRY +DrvGetProcAddress (LPCSTR lpszProc) +{ + return wglGetProcAddress(lpszProc); +} + + +GLAPI BOOL GLAPIENTRY +DrvSetPixelFormat (HDC hdc, int iPixelFormat) +{ + return wglSetPixelFormat(hdc, iPixelFormat, NULL); +} + + +GLAPI BOOL GLAPIENTRY +DrvSwapBuffers (HDC hdc) +{ + return wglSwapBuffers(hdc); +} + + +GLAPI BOOL GLAPIENTRY +DrvValidateVersion (DWORD version) +{ + (void)version; + return TRUE; +} + + +#if (_MSC_VER >= 1200) +#pragma warning( pop ) +#endif + +#endif /* FX */ diff --git a/reactos/dll/mesa32/src/drivers/windows/gdi/colors.h b/reactos/dll/mesa32/src/drivers/windows/gdi/colors.h new file mode 100644 index 00000000000..03e512c1fa9 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gdi/colors.h @@ -0,0 +1,29 @@ +/* Values for wmesa->pixelformat: */ + +#define PF_8A8B8G8R 3 /* 32-bit TrueColor: 8-A, 8-B, 8-G, 8-R */ +#define PF_8R8G8B 4 /* 32-bit TrueColor: 8-R, 8-G, 8-B */ +#define PF_5R6G5B 5 /* 16-bit TrueColor: 5-R, 6-G, 5-B bits */ +#define PF_DITHER8 6 /* Dithered RGB using a lookup table */ +#define PF_LOOKUP 7 /* Undithered RGB using a lookup table */ +#define PF_GRAYSCALE 10 /* Grayscale or StaticGray */ +#define PF_BADFORMAT 11 +#define PF_INDEX8 12 + + +#define BGR8(r,g,b) (unsigned)(((BYTE)((b & 0xc0) | ((g & 0xe0)>>2) | \ + ((r & 0xe0)>>5)))) + +/* Windows uses 5,5,5 for 16-bit */ +#define BGR16(r,g,b) ( (((unsigned short)b ) >> 3) | \ + (((unsigned short)g & 0xf8) << 2) | \ + (((unsigned short)r & 0xf8) << 7) ) + +#define BGR24(r,g,b) (unsigned long)((DWORD)(((BYTE)(b)| \ + ((WORD)((BYTE)(g))<<8))| \ + (((DWORD)(BYTE)(r))<<16))) + +#define BGR32(r,g,b) (unsigned long)((DWORD)(((BYTE)(b)| \ + ((WORD)((BYTE)(g))<<8))| \ + (((DWORD)(BYTE)(r))<<16))) + + diff --git a/reactos/dll/mesa32/src/drivers/windows/gdi/mesa.def b/reactos/dll/mesa32/src/drivers/windows/gdi/mesa.def new file mode 100644 index 00000000000..7b67c5ccb99 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gdi/mesa.def @@ -0,0 +1,1074 @@ +; DO NOT EDIT - This file generated automatically by mesadef.py script +DESCRIPTION 'Mesa (OpenGL work-alike) for Win32' +VERSION 6.0 +; +; Module definition file for Mesa (OPENGL32.DLL) +; +; Note: The OpenGL functions use the STDCALL +; function calling convention. Microsoft's +; OPENGL32 uses this convention and so must the +; Mesa OPENGL32 so that the Mesa DLL can be used +; as a drop-in replacement. +; +; The linker exports STDCALL entry points with +; 'decorated' names; e.g., _glBegin@0, where the +; trailing number is the number of bytes of +; parameter data pushed onto the stack. The +; callee is responsible for popping this data +; off the stack, usually via a RETF n instruction. +; +; However, the Microsoft OPENGL32.DLL does not export +; the decorated names, even though the calling convention +; is STDCALL. So, this module definition file is +; needed to force the Mesa OPENGL32.DLL to export the +; symbols in the same manner as the Microsoft DLL. +; Were it not for this problem, this file would not +; be needed (for the gl* functions) since the entry +; points are compiled with dllexport declspec. +; +; However, this file is still needed to export "internal" +; Mesa symbols for the benefit of the OSMESA32.DLL. +; +EXPORTS + glNewList + glEndList + glCallList + glCallLists + glDeleteLists + glGenLists + glListBase + glBegin + glBitmap + glColor3b + glColor3bv + glColor3d + glColor3dv + glColor3f + glColor3fv + glColor3i + glColor3iv + glColor3s + glColor3sv + glColor3ub + glColor3ubv + glColor3ui + glColor3uiv + glColor3us + glColor3usv + glColor4b + glColor4bv + glColor4d + glColor4dv + glColor4f + glColor4fv + glColor4i + glColor4iv + glColor4s + glColor4sv + glColor4ub + glColor4ubv + glColor4ui + glColor4uiv + glColor4us + glColor4usv + glEdgeFlag + glEdgeFlagv + glEnd + glIndexd + glIndexdv + glIndexf + glIndexfv + glIndexi + glIndexiv + glIndexs + glIndexsv + glNormal3b + glNormal3bv + glNormal3d + glNormal3dv + glNormal3f + glNormal3fv + glNormal3i + glNormal3iv + glNormal3s + glNormal3sv + glRasterPos2d + glRasterPos2dv + glRasterPos2f + glRasterPos2fv + glRasterPos2i + glRasterPos2iv + glRasterPos2s + glRasterPos2sv + glRasterPos3d + glRasterPos3dv + glRasterPos3f + glRasterPos3fv + glRasterPos3i + glRasterPos3iv + glRasterPos3s + glRasterPos3sv + glRasterPos4d + glRasterPos4dv + glRasterPos4f + glRasterPos4fv + glRasterPos4i + glRasterPos4iv + glRasterPos4s + glRasterPos4sv + glRectd + glRectdv + glRectf + glRectfv + glRecti + glRectiv + glRects + glRectsv + glTexCoord1d + glTexCoord1dv + glTexCoord1f + glTexCoord1fv + glTexCoord1i + glTexCoord1iv + glTexCoord1s + glTexCoord1sv + glTexCoord2d + glTexCoord2dv + glTexCoord2f + glTexCoord2fv + glTexCoord2i + glTexCoord2iv + glTexCoord2s + glTexCoord2sv + glTexCoord3d + glTexCoord3dv + glTexCoord3f + glTexCoord3fv + glTexCoord3i + glTexCoord3iv + glTexCoord3s + glTexCoord3sv + glTexCoord4d + glTexCoord4dv + glTexCoord4f + glTexCoord4fv + glTexCoord4i + glTexCoord4iv + glTexCoord4s + glTexCoord4sv + glVertex2d + glVertex2dv + glVertex2f + glVertex2fv + glVertex2i + glVertex2iv + glVertex2s + glVertex2sv + glVertex3d + glVertex3dv + glVertex3f + glVertex3fv + glVertex3i + glVertex3iv + glVertex3s + glVertex3sv + glVertex4d + glVertex4dv + glVertex4f + glVertex4fv + glVertex4i + glVertex4iv + glVertex4s + glVertex4sv + glClipPlane + glColorMaterial + glCullFace + glFogf + glFogfv + glFogi + glFogiv + glFrontFace + glHint + glLightf + glLightfv + glLighti + glLightiv + glLightModelf + glLightModelfv + glLightModeli + glLightModeliv + glLineStipple + glLineWidth + glMaterialf + glMaterialfv + glMateriali + glMaterialiv + glPointSize + glPolygonMode + glPolygonStipple + glScissor + glShadeModel + glTexParameterf + glTexParameterfv + glTexParameteri + glTexParameteriv + glTexImage1D + glTexImage2D + glTexEnvf + glTexEnvfv + glTexEnvi + glTexEnviv + glTexGend + glTexGendv + glTexGenf + glTexGenfv + glTexGeni + glTexGeniv + glFeedbackBuffer + glSelectBuffer + glRenderMode + glInitNames + glLoadName + glPassThrough + glPopName + glPushName + glDrawBuffer + glClear + glClearAccum + glClearIndex + glClearColor + glClearStencil + glClearDepth + glStencilMask + glColorMask + glDepthMask + glIndexMask + glAccum + glDisable + glEnable + glFinish + glFlush + glPopAttrib + glPushAttrib + glMap1d + glMap1f + glMap2d + glMap2f + glMapGrid1d + glMapGrid1f + glMapGrid2d + glMapGrid2f + glEvalCoord1d + glEvalCoord1dv + glEvalCoord1f + glEvalCoord1fv + glEvalCoord2d + glEvalCoord2dv + glEvalCoord2f + glEvalCoord2fv + glEvalMesh1 + glEvalPoint1 + glEvalMesh2 + glEvalPoint2 + glAlphaFunc + glBlendFunc + glLogicOp + glStencilFunc + glStencilOp + glDepthFunc + glPixelZoom + glPixelTransferf + glPixelTransferi + glPixelStoref + glPixelStorei + glPixelMapfv + glPixelMapuiv + glPixelMapusv + glReadBuffer + glCopyPixels + glReadPixels + glDrawPixels + glGetBooleanv + glGetClipPlane + glGetDoublev + glGetError + glGetFloatv + glGetIntegerv + glGetLightfv + glGetLightiv + glGetMapdv + glGetMapfv + glGetMapiv + glGetMaterialfv + glGetMaterialiv + glGetPixelMapfv + glGetPixelMapuiv + glGetPixelMapusv + glGetPolygonStipple + glGetString + glGetTexEnvfv + glGetTexEnviv + glGetTexGendv + glGetTexGenfv + glGetTexGeniv + glGetTexImage + glGetTexParameterfv + glGetTexParameteriv + glGetTexLevelParameterfv + glGetTexLevelParameteriv + glIsEnabled + glIsList + glDepthRange + glFrustum + glLoadIdentity + glLoadMatrixf + glLoadMatrixd + glMatrixMode + glMultMatrixf + glMultMatrixd + glOrtho + glPopMatrix + glPushMatrix + glRotated + glRotatef + glScaled + glScalef + glTranslated + glTranslatef + glViewport + glArrayElement + glColorPointer + glDisableClientState + glDrawArrays + glDrawElements + glEdgeFlagPointer + glEnableClientState + glGetPointerv + glIndexPointer + glInterleavedArrays + glNormalPointer + glTexCoordPointer + glVertexPointer + glPolygonOffset + glCopyTexImage1D + glCopyTexImage2D + glCopyTexSubImage1D + glCopyTexSubImage2D + glTexSubImage1D + glTexSubImage2D + glAreTexturesResident + glBindTexture + glDeleteTextures + glGenTextures + glIsTexture + glPrioritizeTextures + glIndexub + glIndexubv + glPopClientAttrib + glPushClientAttrib + glBlendColor + glBlendEquation + glDrawRangeElements + glColorTable + glColorTableParameterfv + glColorTableParameteriv + glCopyColorTable + glGetColorTable + glGetColorTableParameterfv + glGetColorTableParameteriv + glColorSubTable + glCopyColorSubTable + glConvolutionFilter1D + glConvolutionFilter2D + glConvolutionParameterf + glConvolutionParameterfv + glConvolutionParameteri + glConvolutionParameteriv + glCopyConvolutionFilter1D + glCopyConvolutionFilter2D + glGetConvolutionFilter + glGetConvolutionParameterfv + glGetConvolutionParameteriv + glGetSeparableFilter + glSeparableFilter2D + glGetHistogram + glGetHistogramParameterfv + glGetHistogramParameteriv + glGetMinmax + glGetMinmaxParameterfv + glGetMinmaxParameteriv + glHistogram + glMinmax + glResetHistogram + glResetMinmax + glTexImage3D + glTexSubImage3D + glCopyTexSubImage3D + glActiveTextureARB + glClientActiveTextureARB + glMultiTexCoord1dARB + glMultiTexCoord1dvARB + glMultiTexCoord1fARB + glMultiTexCoord1fvARB + glMultiTexCoord1iARB + glMultiTexCoord1ivARB + glMultiTexCoord1sARB + glMultiTexCoord1svARB + glMultiTexCoord2dARB + glMultiTexCoord2dvARB + glMultiTexCoord2fARB + glMultiTexCoord2fvARB + glMultiTexCoord2iARB + glMultiTexCoord2ivARB + glMultiTexCoord2sARB + glMultiTexCoord2svARB + glMultiTexCoord3dARB + glMultiTexCoord3dvARB + glMultiTexCoord3fARB + glMultiTexCoord3fvARB + glMultiTexCoord3iARB + glMultiTexCoord3ivARB + glMultiTexCoord3sARB + glMultiTexCoord3svARB + glMultiTexCoord4dARB + glMultiTexCoord4dvARB + glMultiTexCoord4fARB + glMultiTexCoord4fvARB + glMultiTexCoord4iARB + glMultiTexCoord4ivARB + glMultiTexCoord4sARB + glMultiTexCoord4svARB + glLoadTransposeMatrixfARB + glLoadTransposeMatrixdARB + glMultTransposeMatrixfARB + glMultTransposeMatrixdARB + glSampleCoverageARB + glCompressedTexImage3DARB + glCompressedTexImage2DARB + glCompressedTexImage1DARB + glCompressedTexSubImage3DARB + glCompressedTexSubImage2DARB + glCompressedTexSubImage1DARB + glGetCompressedTexImageARB + glActiveTexture + glClientActiveTexture + glMultiTexCoord1d + glMultiTexCoord1dv + glMultiTexCoord1f + glMultiTexCoord1fv + glMultiTexCoord1i + glMultiTexCoord1iv + glMultiTexCoord1s + glMultiTexCoord1sv + glMultiTexCoord2d + glMultiTexCoord2dv + glMultiTexCoord2f + glMultiTexCoord2fv + glMultiTexCoord2i + glMultiTexCoord2iv + glMultiTexCoord2s + glMultiTexCoord2sv + glMultiTexCoord3d + glMultiTexCoord3dv + glMultiTexCoord3f + glMultiTexCoord3fv + glMultiTexCoord3i + glMultiTexCoord3iv + glMultiTexCoord3s + glMultiTexCoord3sv + glMultiTexCoord4d + glMultiTexCoord4dv + glMultiTexCoord4f + glMultiTexCoord4fv + glMultiTexCoord4i + glMultiTexCoord4iv + glMultiTexCoord4s + glMultiTexCoord4sv + glLoadTransposeMatrixf + glLoadTransposeMatrixd + glMultTransposeMatrixf + glMultTransposeMatrixd + glSampleCoverage + glCompressedTexImage3D + glCompressedTexImage2D + glCompressedTexImage1D + glCompressedTexSubImage3D + glCompressedTexSubImage2D + glCompressedTexSubImage1D + glGetCompressedTexImage + glBlendColorEXT + glPolygonOffsetEXT + glTexImage3DEXT + glTexSubImage3DEXT + glGetTexFilterFuncSGIS + glTexFilterFuncSGIS + glTexSubImage1DEXT + glTexSubImage2DEXT + glCopyTexImage1DEXT + glCopyTexImage2DEXT + glCopyTexSubImage1DEXT + glCopyTexSubImage2DEXT + glCopyTexSubImage3DEXT + glGetHistogramEXT + glGetHistogramParameterfvEXT + glGetHistogramParameterivEXT + glGetMinmaxEXT + glGetMinmaxParameterfvEXT + glGetMinmaxParameterivEXT + glHistogramEXT + glMinmaxEXT + glResetHistogramEXT + glResetMinmaxEXT + glConvolutionFilter1DEXT + glConvolutionFilter2DEXT + glConvolutionParameterfEXT + glConvolutionParameterfvEXT + glConvolutionParameteriEXT + glConvolutionParameterivEXT + glCopyConvolutionFilter1DEXT + glCopyConvolutionFilter2DEXT + glGetConvolutionFilterEXT + glGetConvolutionParameterfvEXT + glGetConvolutionParameterivEXT + glGetSeparableFilterEXT + glSeparableFilter2DEXT + glColorTableSGI + glColorTableParameterfvSGI + glColorTableParameterivSGI + glCopyColorTableSGI + glGetColorTableSGI + glGetColorTableParameterfvSGI + glGetColorTableParameterivSGI + glPixelTexGenSGIX + glPixelTexGenParameteriSGIS + glPixelTexGenParameterivSGIS + glPixelTexGenParameterfSGIS + glPixelTexGenParameterfvSGIS + glGetPixelTexGenParameterivSGIS + glGetPixelTexGenParameterfvSGIS + glTexImage4DSGIS + glTexSubImage4DSGIS + glAreTexturesResidentEXT + glBindTextureEXT + glDeleteTexturesEXT + glGenTexturesEXT + glIsTextureEXT + glPrioritizeTexturesEXT + glDetailTexFuncSGIS + glGetDetailTexFuncSGIS + glSharpenTexFuncSGIS + glGetSharpenTexFuncSGIS + glSampleMaskSGIS + glSamplePatternSGIS + glArrayElementEXT + glColorPointerEXT + glDrawArraysEXT + glEdgeFlagPointerEXT + glGetPointervEXT + glIndexPointerEXT + glNormalPointerEXT + glTexCoordPointerEXT + glVertexPointerEXT + glBlendEquationEXT + glSpriteParameterfSGIX + glSpriteParameterfvSGIX + glSpriteParameteriSGIX + glSpriteParameterivSGIX + glPointParameterfEXT + glPointParameterfvEXT + glPointParameterfARB + glPointParameterfvARB + glPointParameterfSGIS + glPointParameterfvSGIS + glGetInstrumentsSGIX + glInstrumentsBufferSGIX + glPollInstrumentsSGIX + glReadInstrumentsSGIX + glStartInstrumentsSGIX + glStopInstrumentsSGIX + glFrameZoomSGIX + glTagSampleBufferSGIX + glReferencePlaneSGIX + glFlushRasterSGIX + glColorSubTableEXT + glCopyColorSubTableEXT + glHintPGI + glColorTableEXT + glGetColorTableEXT + glGetColorTableParameterivEXT + glGetColorTableParameterfvEXT + glGetListParameterfvSGIX + glGetListParameterivSGIX + glListParameterfSGIX + glListParameterfvSGIX + glListParameteriSGIX + glListParameterivSGIX + glIndexMaterialEXT + glIndexFuncEXT + glLockArraysEXT + glUnlockArraysEXT + glCullParameterdvEXT + glCullParameterfvEXT + glFragmentColorMaterialSGIX + glFragmentLightfSGIX + glFragmentLightfvSGIX + glFragmentLightiSGIX + glFragmentLightivSGIX + glFragmentLightModelfSGIX + glFragmentLightModelfvSGIX + glFragmentLightModeliSGIX + glFragmentLightModelivSGIX + glFragmentMaterialfSGIX + glFragmentMaterialfvSGIX + glFragmentMaterialiSGIX + glFragmentMaterialivSGIX + glGetFragmentLightfvSGIX + glGetFragmentLightivSGIX + glGetFragmentMaterialfvSGIX + glGetFragmentMaterialivSGIX + glLightEnviSGIX + glDrawRangeElementsEXT + glSecondaryColor3bEXT + glSecondaryColor3bvEXT + glSecondaryColor3dEXT + glSecondaryColor3dvEXT + glSecondaryColor3fEXT + glSecondaryColor3fvEXT + glSecondaryColor3iEXT + glSecondaryColor3ivEXT + glSecondaryColor3sEXT + glSecondaryColor3svEXT + glSecondaryColor3ubEXT + glSecondaryColor3ubvEXT + glSecondaryColor3uiEXT + glSecondaryColor3uivEXT + glSecondaryColor3usEXT + glSecondaryColor3usvEXT + glSecondaryColorPointerEXT + glMultiDrawArraysEXT + glMultiDrawElementsEXT + glFogCoordfEXT + glFogCoordfvEXT + glFogCoorddEXT + glFogCoorddvEXT + glFogCoordPointerEXT + glBlendFuncSeparateEXT + glBlendFuncSeparateINGR + glVertexWeightfEXT + glVertexWeightfvEXT + glVertexWeightPointerEXT + glFlushVertexArrayRangeNV + glVertexArrayRangeNV + glCombinerParameterfvNV + glCombinerParameterfNV + glCombinerParameterivNV + glCombinerParameteriNV + glCombinerInputNV + glCombinerOutputNV + glFinalCombinerInputNV + glGetCombinerInputParameterfvNV + glGetCombinerInputParameterivNV + glGetCombinerOutputParameterfvNV + glGetCombinerOutputParameterivNV + glGetFinalCombinerInputParameterfvNV + glGetFinalCombinerInputParameterivNV + glResizeBuffersMESA + glWindowPos2dMESA + glWindowPos2dvMESA + glWindowPos2fMESA + glWindowPos2fvMESA + glWindowPos2iMESA + glWindowPos2ivMESA + glWindowPos2sMESA + glWindowPos2svMESA + glWindowPos3dMESA + glWindowPos3dvMESA + glWindowPos3fMESA + glWindowPos3fvMESA + glWindowPos3iMESA + glWindowPos3ivMESA + glWindowPos3sMESA + glWindowPos3svMESA + glWindowPos4dMESA + glWindowPos4dvMESA + glWindowPos4fMESA + glWindowPos4fvMESA + glWindowPos4iMESA + glWindowPos4ivMESA + glWindowPos4sMESA + glWindowPos4svMESA + glMultiModeDrawArraysIBM + glMultiModeDrawElementsIBM + glTbufferMask3DFX + glSampleMaskEXT + glSamplePatternEXT + glWindowPos2dARB + glWindowPos2fARB + glWindowPos2iARB + glWindowPos2sARB + glWindowPos2dvARB + glWindowPos2fvARB + glWindowPos2ivARB + glWindowPos2svARB + glWindowPos3dARB + glWindowPos3fARB + glWindowPos3iARB + glWindowPos3sARB + glWindowPos3dvARB + glWindowPos3fvARB + glWindowPos3ivARB + glWindowPos3svARB + glAreProgramsResidentNV + glBindProgramNV + glDeleteProgramsNV + glExecuteProgramNV + glGenProgramsNV + glGetProgramParameterdvNV + glGetProgramParameterfvNV + glGetProgramivNV + glGetProgramStringNV + glGetTrackMatrixivNV + glGetVertexAttribdvNV + glGetVertexAttribfvNV + glGetVertexAttribivNV + glGetVertexAttribPointervNV + glIsProgramNV + glLoadProgramNV + glProgramParameter4dNV + glProgramParameter4dvNV + glProgramParameter4fNV + glProgramParameter4fvNV + glProgramParameters4dvNV + glProgramParameters4fvNV + glRequestResidentProgramsNV + glTrackMatrixNV + glVertexAttribPointerNV + glVertexAttrib1dNV + glVertexAttrib1dvNV + glVertexAttrib1fNV + glVertexAttrib1fvNV + glVertexAttrib1sNV + glVertexAttrib1svNV + glVertexAttrib2dNV + glVertexAttrib2dvNV + glVertexAttrib2fNV + glVertexAttrib2fvNV + glVertexAttrib2sNV + glVertexAttrib2svNV + glVertexAttrib3dNV + glVertexAttrib3dvNV + glVertexAttrib3fNV + glVertexAttrib3fvNV + glVertexAttrib3sNV + glVertexAttrib3svNV + glVertexAttrib4dNV + glVertexAttrib4dvNV + glVertexAttrib4fNV + glVertexAttrib4fvNV + glVertexAttrib4sNV + glVertexAttrib4svNV + glVertexAttrib4ubNV + glVertexAttrib4ubvNV + glVertexAttribs1dvNV + glVertexAttribs1fvNV + glVertexAttribs1svNV + glVertexAttribs2dvNV + glVertexAttribs2fvNV + glVertexAttribs2svNV + glVertexAttribs3dvNV + glVertexAttribs3fvNV + glVertexAttribs3svNV + glVertexAttribs4dvNV + glVertexAttribs4fvNV + glVertexAttribs4svNV + glVertexAttribs4ubvNV + glPointParameteriNV + glPointParameterivNV + glBlendFuncSeparate + glFogCoordf + glFogCoordfv + glFogCoordd + glFogCoorddv + glFogCoordPointer + glMultiDrawArrays + glMultiDrawElements + glPointParameterf + glPointParameterfv + glPointParameteri + glPointParameteriv + glSecondaryColor3b + glSecondaryColor3bv + glSecondaryColor3d + glSecondaryColor3dv + glSecondaryColor3f + glSecondaryColor3fv + glSecondaryColor3i + glSecondaryColor3iv + glSecondaryColor3s + glSecondaryColor3sv + glSecondaryColor3ub + glSecondaryColor3ubv + glSecondaryColor3ui + glSecondaryColor3uiv + glSecondaryColor3us + glSecondaryColor3usv + glSecondaryColorPointer + glWindowPos2d + glWindowPos2dv + glWindowPos2f + glWindowPos2fv + glWindowPos2i + glWindowPos2iv + glWindowPos2s + glWindowPos2sv + glWindowPos3d + glWindowPos3dv + glWindowPos3f + glWindowPos3fv + glWindowPos3i + glWindowPos3iv + glWindowPos3s + glWindowPos3sv + glActiveStencilFaceEXT + glDeleteFencesNV + glGenFencesNV + glIsFenceNV + glTestFenceNV + glGetFenceivNV + glFinishFenceNV + glSetFenceNV + glVertexAttrib1sARB + glVertexAttrib1fARB + glVertexAttrib1dARB + glVertexAttrib2sARB + glVertexAttrib2fARB + glVertexAttrib2dARB + glVertexAttrib3sARB + glVertexAttrib3fARB + glVertexAttrib3dARB + glVertexAttrib4sARB + glVertexAttrib4fARB + glVertexAttrib4dARB + glVertexAttrib4NubARB + glVertexAttrib1svARB + glVertexAttrib1fvARB + glVertexAttrib1dvARB + glVertexAttrib2svARB + glVertexAttrib2fvARB + glVertexAttrib2dvARB + glVertexAttrib3svARB + glVertexAttrib3fvARB + glVertexAttrib3dvARB + glVertexAttrib4bvARB + glVertexAttrib4svARB + glVertexAttrib4ivARB + glVertexAttrib4ubvARB + glVertexAttrib4usvARB + glVertexAttrib4uivARB + glVertexAttrib4fvARB + glVertexAttrib4dvARB + glVertexAttrib4NbvARB + glVertexAttrib4NsvARB + glVertexAttrib4NivARB + glVertexAttrib4NubvARB + glVertexAttrib4NusvARB + glVertexAttrib4NuivARB + glVertexAttribPointerARB + glEnableVertexAttribArrayARB + glDisableVertexAttribArrayARB + glProgramStringARB + glBindProgramARB + glDeleteProgramsARB + glGenProgramsARB + glIsProgramARB + glProgramEnvParameter4dARB + glProgramEnvParameter4dvARB + glProgramEnvParameter4fARB + glProgramEnvParameter4fvARB + glProgramLocalParameter4dARB + glProgramLocalParameter4dvARB + glProgramLocalParameter4fARB + glProgramLocalParameter4fvARB + glGetProgramEnvParameterdvARB + glGetProgramEnvParameterfvARB + glGetProgramLocalParameterdvARB + glGetProgramLocalParameterfvARB + glGetProgramivARB + glGetProgramStringARB + glGetVertexAttribdvARB + glGetVertexAttribfvARB + glGetVertexAttribivARB + glGetVertexAttribPointervARB + glProgramNamedParameter4fNV + glProgramNamedParameter4dNV + glProgramNamedParameter4fvNV + glProgramNamedParameter4dvNV + glGetProgramNamedParameterfvNV + glGetProgramNamedParameterdvNV + glBindBufferARB + glBufferDataARB + glBufferSubDataARB + glDeleteBuffersARB + glGenBuffersARB + glGetBufferParameterivARB + glGetBufferPointervARB + glGetBufferSubDataARB + glIsBufferARB + glMapBufferARB + glUnmapBufferARB + glDepthBoundsEXT + glGenQueriesARB + glDeleteQueriesARB + glIsQueryARB + glBeginQueryARB + glEndQueryARB + glGetQueryivARB + glGetQueryObjectivARB + glGetQueryObjectuivARB + glBindBuffer + glBufferData + glBufferSubData + glDeleteBuffers + glGenBuffers + glGetBufferParameteriv + glGetBufferPointerv + glGetBufferSubData + glIsBuffer + glMapBuffer + glUnmapBuffer + glGenQueries + glDeleteQueries + glIsQuery + glBeginQuery + glEndQuery + glGetQueryiv + glGetQueryObjectiv + glGetQueryObjectuiv +; +; WGL API + wglChoosePixelFormat + wglCopyContext + wglCreateContext + wglCreateLayerContext + wglDeleteContext + wglDescribeLayerPlane + wglDescribePixelFormat + wglGetCurrentContext + wglGetCurrentDC + wglGetLayerPaletteEntries + wglGetPixelFormat + wglGetProcAddress + wglMakeCurrent + wglRealizeLayerPalette + wglSetLayerPaletteEntries + wglSetPixelFormat + wglShareLists + wglSwapBuffers + wglSwapLayerBuffers + wglUseFontBitmapsA + wglUseFontBitmapsW + wglUseFontOutlinesA + wglUseFontOutlinesW +; +; Mesa internals - mostly for OSMESA + _ac_CreateContext + _ac_DestroyContext + _ac_InvalidateState + _glapi_get_context + _glapi_get_proc_address + _mesa_add_soft_renderbuffers + _mesa_add_renderbuffer + _mesa_buffer_data + _mesa_buffer_get_subdata + _mesa_buffer_map + _mesa_buffer_subdata + _mesa_buffer_unmap + _mesa_bzero + _mesa_calloc + _mesa_choose_tex_format + _mesa_compressed_texture_size + _mesa_create_framebuffer + _mesa_create_visual + _mesa_delete_buffer_object + _mesa_delete_program + _mesa_delete_texture_object + _mesa_destroy_framebuffer + _mesa_destroy_visual + _mesa_enable_1_3_extensions + _mesa_enable_1_4_extensions + _mesa_enable_1_5_extensions + _mesa_enable_sw_extensions + _mesa_error + _mesa_framebuffer_renderbuffer + _mesa_free + _mesa_free_context_data + _mesa_free_texture_image_data + _mesa_get_compressed_teximage + _mesa_get_current_context + _mesa_get_teximage + _mesa_init_default_imports + _mesa_init_driver_functions + _mesa_init_renderbuffer + _mesa_initialize_context + _mesa_make_current + _mesa_memcpy + _mesa_memset + _mesa_new_buffer_object + _mesa_new_framebuffer + _mesa_new_program + _mesa_new_soft_renderbuffer + _mesa_new_texture_image + _mesa_new_texture_object + _mesa_problem + _mesa_renderbuffer_texture + _mesa_ResizeBuffersMESA + _mesa_resize_framebuffer +; _mesa_resize_renderbuffer + _mesa_store_compressed_teximage1d + _mesa_store_compressed_teximage2d + _mesa_store_compressed_teximage3d + _mesa_store_compressed_texsubimage1d + _mesa_store_compressed_texsubimage2d + _mesa_store_compressed_texsubimage3d + _mesa_store_teximage1d + _mesa_store_teximage2d + _mesa_store_teximage3d + _mesa_store_texsubimage1d + _mesa_store_texsubimage2d + _mesa_store_texsubimage3d + _mesa_strcmp + _mesa_test_proxy_teximage + _mesa_Viewport + _swrast_Accum +; _swrast_alloc_buffers + _swrast_Bitmap + _swrast_CopyPixels + _swrast_DrawBuffer + _swrast_DrawPixels + _swrast_GetDeviceDriverReference + _swrast_Clear + _swrast_choose_line + _swrast_choose_triangle + _swrast_CopyColorSubTable + _swrast_CopyColorTable + _swrast_CopyConvolutionFilter1D + _swrast_CopyConvolutionFilter2D + _swrast_copy_teximage1d + _swrast_copy_teximage2d + _swrast_copy_texsubimage1d + _swrast_copy_texsubimage2d + _swrast_copy_texsubimage3d + _swrast_CreateContext + _swrast_DestroyContext + _swrast_InvalidateState + _swrast_ReadPixels +; _swrast_zbuffer_address + _swsetup_Wakeup + _swsetup_CreateContext + _swsetup_DestroyContext + _swsetup_InvalidateState + _tnl_CreateContext + _tnl_DestroyContext + _tnl_InvalidateState + _tnl_MakeCurrent + _tnl_run_pipeline diff --git a/reactos/dll/mesa32/src/drivers/windows/gdi/wgl.c b/reactos/dll/mesa32/src/drivers/windows/gdi/wgl.c new file mode 100644 index 00000000000..2d3f696fb55 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gdi/wgl.c @@ -0,0 +1,695 @@ +/* $Id: wgl.c,v 1.9 2005/07/01 15:56:14 kschultz Exp $ */ + +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/* + * File name : wgl.c + * WGL stuff. Added by Oleg Letsinsky, ajl@ultersys.ru + * Some things originated from the 3Dfx WGL functions + */ + +/* + * This file contains the implementation of the wgl* functions for + * Mesa on Windows. Since these functions are provided by Windows in + * GDI/OpenGL, we must supply our versions that work with Mesa here. + */ + + +/* We're essentially building part of GDI here, so define this so that + * we get the right export linkage. */ +#define _GDI32_ +#include + +#include "GL/wmesa.h" /* protos for wmesa* functions */ + +typedef struct wmesa_context *PWMC; + +/* + * Pixel Format Descriptors + */ + +/* Extend the PFD to include DB flag */ +struct __pixelformat__ +{ + PIXELFORMATDESCRIPTOR pfd; + GLboolean doubleBuffered; +}; + +/* These are the PFD's supported by this driver. */ +struct __pixelformat__ pfd[] = +{ +#if 0 + /* Double Buffer, alpha */ + { + { + sizeof(PIXELFORMATDESCRIPTOR), 1, + PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL| + PFD_GENERIC_FORMAT|PFD_DOUBLEBUFFER|PFD_SWAP_COPY, + PFD_TYPE_RGBA, + 24, + 8, 0, + 8, 8, + 8, 16, + 8, 24, + 0, 0, 0, 0, 0, + 16, 8, + 0, 0, 0, + 0, 0, 0 + }, + GL_TRUE + }, + /* Single Buffer, alpha */ + { + { + sizeof(PIXELFORMATDESCRIPTOR), 1, + PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL| + PFD_GENERIC_FORMAT, + PFD_TYPE_RGBA, + 24, + 8, 0, + 8, 8, + 8, 16, + 8, 24, + 0, 0, 0, 0, 0, + 16, 8, + 0, 0, 0, + 0, 0, 0 + }, + GL_FALSE + }, +#endif + /* Double Buffer, no alpha */ + { + { + sizeof(PIXELFORMATDESCRIPTOR), 1, + PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL| + PFD_GENERIC_FORMAT|PFD_DOUBLEBUFFER|PFD_SWAP_COPY, + PFD_TYPE_RGBA, + 24, + 8, 0, + 8, 8, + 8, 16, + 0, 0, + 0, 0, 0, 0, 0, + 16, 8, + 0, 0, 0, + 0, 0, 0 + }, + GL_TRUE + }, + /* Single Buffer, no alpha */ + { + { + sizeof(PIXELFORMATDESCRIPTOR), 1, + PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL| + PFD_GENERIC_FORMAT, + PFD_TYPE_RGBA, + 24, + 8, 0, + 8, 8, + 8, 16, + 0, 0, + 0, 0, 0, 0, 0, + 16, 8, + 0, 0, 0, + 0, 0, 0 + }, + GL_FALSE + }, +}; + +int npfd = sizeof(pfd) / sizeof(pfd[0]); + + +/* + * Contexts + */ + +typedef struct { + WMesaContext ctx; + HDC hdc; +} MesaWglCtx; + +#define MESAWGL_CTX_MAX_COUNT 20 + +static MesaWglCtx wgl_ctx[MESAWGL_CTX_MAX_COUNT]; + +static unsigned ctx_count = 0; +static int ctx_current = -1; +static unsigned curPFD = 0; + +WINGDIAPI HGLRC GLAPIENTRY wglCreateContext(HDC hdc) +{ + HWND hWnd; + int i = 0; + if(!(hWnd = WindowFromDC(hdc))) { + SetLastError(0); + return(NULL); + } + if (!ctx_count) { + for(i=0;inSize != sizeof(PIXELFORMATDESCRIPTOR) || ppfd->nVersion != 1) + { + SetLastError(0); + return(0); + } + for(i = 0; i < npfd;i++) + { + delta = 0; + if( + (ppfd->dwFlags & PFD_DRAW_TO_WINDOW) && + !(pfd[i].pfd.dwFlags & PFD_DRAW_TO_WINDOW)) + continue; + if( + (ppfd->dwFlags & PFD_DRAW_TO_BITMAP) && + !(pfd[i].pfd.dwFlags & PFD_DRAW_TO_BITMAP)) + continue; + if( + (ppfd->dwFlags & PFD_SUPPORT_GDI) && + !(pfd[i].pfd.dwFlags & PFD_SUPPORT_GDI)) + continue; + if( + (ppfd->dwFlags & PFD_SUPPORT_OPENGL) && + !(pfd[i].pfd.dwFlags & PFD_SUPPORT_OPENGL)) + continue; + if( + !(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE) && + ((ppfd->dwFlags & PFD_DOUBLEBUFFER) != + (pfd[i].pfd.dwFlags & PFD_DOUBLEBUFFER))) + continue; + if( + !(ppfd->dwFlags & PFD_STEREO_DONTCARE) && + ((ppfd->dwFlags & PFD_STEREO) != + (pfd[i].pfd.dwFlags & PFD_STEREO))) + continue; + if(ppfd->iPixelType != pfd[i].pfd.iPixelType) + delta++; + if(ppfd->cAlphaBits != pfd[i].pfd.cAlphaBits) + delta++; + if(delta < bestdelta) + { + best = i + 1; + bestdelta = delta; + if(bestdelta == 0) + break; + } + } + if(best == -1) + { + SetLastError(0); + return(0); + } + return(best); +} + +WINGDIAPI int GLAPIENTRY wglDescribePixelFormat(HDC hdc, + int iPixelFormat, + UINT nBytes, + LPPIXELFORMATDESCRIPTOR ppfd) +{ + (void) hdc; + + if(ppfd == NULL) + return(npfd); + if(iPixelFormat < 1 || iPixelFormat > npfd || + nBytes != sizeof(PIXELFORMATDESCRIPTOR)) + { + SetLastError(0); + return(0); + } + *ppfd = pfd[iPixelFormat - 1].pfd; + return(npfd); +} + +WINGDIAPI PROC GLAPIENTRY wglGetProcAddress(LPCSTR lpszProc) +{ + PROC p = (PROC) _glapi_get_proc_address((const char *) lpszProc); + if (p) + return p; + + SetLastError(0); + return(NULL); +} + +WINGDIAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc) +{ + (void) hdc; + if(curPFD == 0) { + SetLastError(0); + return(0); + } + return(curPFD); +} + +WINGDIAPI BOOL GLAPIENTRY wglSetPixelFormat(HDC hdc,int iPixelFormat, + PIXELFORMATDESCRIPTOR *ppfd) +{ + (void) hdc; + + if(iPixelFormat < 1 || iPixelFormat > npfd || + ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR)) { + SetLastError(0); + return(FALSE); + } + curPFD = iPixelFormat; + return(TRUE); +} + +WINGDIAPI BOOL GLAPIENTRY wglSwapBuffers(HDC hdc) +{ + (void) hdc; + if (ctx_current < 0) + return FALSE; + + if(wgl_ctx[ctx_current].ctx == NULL) { + SetLastError(0); + return(FALSE); + } + WMesaSwapBuffers(); + return(TRUE); +} + +static FIXED FixedFromDouble(double d) +{ + long l = (long) (d * 65536L); + return *(FIXED *) (void *) &l; +} + + +/* +** This is cribbed from FX/fxwgl.c, and seems to implement support +** for bitmap fonts where the wglUseFontBitmapsA() code implements +** support for outline fonts. In combination they hopefully give +** fairly generic support for fonts. +*/ +static BOOL wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar, + DWORD numChars, DWORD listBase) +{ +#define VERIFY(a) a + + TEXTMETRIC metric; + BITMAPINFO *dibInfo; + HDC bitDevice; + COLORREF tempColor; + int i; + + VERIFY(GetTextMetrics(fontDevice, &metric)); + + dibInfo = (BITMAPINFO *) calloc(sizeof(BITMAPINFO) + sizeof(RGBQUAD), 1); + dibInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + dibInfo->bmiHeader.biPlanes = 1; + dibInfo->bmiHeader.biBitCount = 1; + dibInfo->bmiHeader.biCompression = BI_RGB; + + bitDevice = CreateCompatibleDC(fontDevice); + + // Swap fore and back colors so the bitmap has the right polarity + tempColor = GetBkColor(bitDevice); + SetBkColor(bitDevice, GetTextColor(bitDevice)); + SetTextColor(bitDevice, tempColor); + + // Place chars based on base line + VERIFY(SetTextAlign(bitDevice, TA_BASELINE) != GDI_ERROR ? 1 : 0); + + for(i = 0; i < (int)numChars; i++) { + SIZE size; + char curChar; + int charWidth,charHeight,bmapWidth,bmapHeight,numBytes,res; + HBITMAP bitObject; + HGDIOBJ origBmap; + unsigned char *bmap; + + curChar = i + firstChar; + + // Find how high/wide this character is + VERIFY(GetTextExtentPoint32(bitDevice, &curChar, 1, &size)); + + // Create the output bitmap + charWidth = size.cx; + charHeight = size.cy; + // Round up to the next multiple of 32 bits + bmapWidth = ((charWidth + 31) / 32) * 32; + bmapHeight = charHeight; + bitObject = CreateCompatibleBitmap(bitDevice, + bmapWidth, + bmapHeight); + //VERIFY(bitObject); + + // Assign the output bitmap to the device + origBmap = SelectObject(bitDevice, bitObject); + (void) VERIFY(origBmap); + + VERIFY( PatBlt( bitDevice, 0, 0, bmapWidth, bmapHeight,BLACKNESS ) ); + + // Use our source font on the device + VERIFY(SelectObject(bitDevice, GetCurrentObject(fontDevice,OBJ_FONT))); + + // Draw the character + VERIFY(TextOut(bitDevice, 0, metric.tmAscent, &curChar, 1)); + + // Unselect our bmap object + VERIFY(SelectObject(bitDevice, origBmap)); + + // Convert the display dependant representation to a 1 bit deep DIB + numBytes = (bmapWidth * bmapHeight) / 8; + bmap = malloc(numBytes); + dibInfo->bmiHeader.biWidth = bmapWidth; + dibInfo->bmiHeader.biHeight = bmapHeight; + res = GetDIBits(bitDevice, bitObject, 0, bmapHeight, bmap, + dibInfo, + DIB_RGB_COLORS); + //VERIFY(res); + + // Create the GL object + glNewList(i + listBase, GL_COMPILE); + glBitmap(bmapWidth, bmapHeight, 0.0, metric.tmDescent, + charWidth, 0.0, + bmap); + glEndList(); + // CheckGL(); + + // Destroy the bmap object + DeleteObject(bitObject); + + // Deallocate the bitmap data + free(bmap); + } + + // Destroy the DC + VERIFY(DeleteDC(bitDevice)); + + free(dibInfo); + + return TRUE; +#undef VERIFY +} + +WINGDIAPI BOOL GLAPIENTRY wglUseFontBitmapsA(HDC hdc, DWORD first, + DWORD count, DWORD listBase) +{ + int i; + GLuint font_list; + DWORD size; + GLYPHMETRICS gm; + HANDLE hBits; + LPSTR lpBits; + MAT2 mat; + int success = TRUE; + + if (count == 0) + return FALSE; + + font_list = listBase; + + mat.eM11 = FixedFromDouble(1); + mat.eM12 = FixedFromDouble(0); + mat.eM21 = FixedFromDouble(0); + mat.eM22 = FixedFromDouble(-1); + + memset(&gm,0,sizeof(gm)); + + /* + ** If we can't get the glyph outline, it may be because this is a fixed + ** font. Try processing it that way. + */ + if( GetGlyphOutline(hdc, first, GGO_BITMAP, &gm, 0, NULL, &mat) + == GDI_ERROR ) { + return wglUseFontBitmaps_FX( hdc, first, count, listBase ); + } + + /* + ** Otherwise process all desired characters. + */ + for (i = 0; i < (int)count; i++) { + DWORD err; + + glNewList( font_list+i, GL_COMPILE ); + + /* allocate space for the bitmap/outline */ + size = GetGlyphOutline(hdc, first + i, GGO_BITMAP, + &gm, 0, NULL, &mat); + if (size == GDI_ERROR) { + glEndList( ); + err = GetLastError(); + success = FALSE; + continue; + } + + hBits = GlobalAlloc(GHND, size+1); + lpBits = GlobalLock(hBits); + + err = + GetGlyphOutline(hdc, /* handle to device context */ + first + i, /* character to query */ + GGO_BITMAP, /* format of data to return */ + &gm, /* ptr to structure for metrics*/ + size, /* size of buffer for data */ + lpBits, /* pointer to buffer for data */ + &mat /* pointer to transformation */ + /* matrix structure */ + ); + + if (err == GDI_ERROR) { + GlobalUnlock(hBits); + GlobalFree(hBits); + + glEndList( ); + err = GetLastError(); + success = FALSE; + continue; + } + + glBitmap(gm.gmBlackBoxX,gm.gmBlackBoxY, + -gm.gmptGlyphOrigin.x, + gm.gmptGlyphOrigin.y, + gm.gmCellIncX,gm.gmCellIncY, + (const GLubyte * )lpBits); + + GlobalUnlock(hBits); + GlobalFree(hBits); + + glEndList( ); + } + + return success; +} + + + +/* NOT IMPLEMENTED YET */ +WINGDIAPI BOOL GLAPIENTRY wglCopyContext(HGLRC hglrcSrc, + HGLRC hglrcDst, + UINT mask) +{ + (void) hglrcSrc; (void) hglrcDst; (void) mask; + return(FALSE); +} + +WINGDIAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC hdc, + int iLayerPlane) +{ + (void) hdc; (void) iLayerPlane; + SetLastError(0); + return(NULL); +} + +WINGDIAPI BOOL GLAPIENTRY wglShareLists(HGLRC hglrc1, + HGLRC hglrc2) +{ + (void) hglrc1; (void) hglrc2; + return(TRUE); +} + + +WINGDIAPI BOOL GLAPIENTRY wglUseFontBitmapsW(HDC hdc, + DWORD first, + DWORD count, + DWORD listBase) +{ + (void) hdc; (void) first; (void) count; (void) listBase; + return FALSE; +} + +WINGDIAPI BOOL GLAPIENTRY wglUseFontOutlinesA(HDC hdc, + DWORD first, + DWORD count, + DWORD listBase, + FLOAT deviation, + FLOAT extrusion, + int format, + LPGLYPHMETRICSFLOAT lpgmf) +{ + (void) hdc; (void) first; (void) count; + (void) listBase; (void) deviation; (void) extrusion; (void) format; + (void) lpgmf; + SetLastError(0); + return(FALSE); +} + +WINGDIAPI BOOL GLAPIENTRY wglUseFontOutlinesW(HDC hdc, + DWORD first, + DWORD count, + DWORD listBase, + FLOAT deviation, + FLOAT extrusion, + int format, + LPGLYPHMETRICSFLOAT lpgmf) +{ + (void) hdc; (void) first; (void) count; + (void) listBase; (void) deviation; (void) extrusion; (void) format; + (void) lpgmf; + SetLastError(0); + return(FALSE); +} + +WINGDIAPI BOOL GLAPIENTRY wglDescribeLayerPlane(HDC hdc, + int iPixelFormat, + int iLayerPlane, + UINT nBytes, + LPLAYERPLANEDESCRIPTOR plpd) +{ + (void) hdc; (void) iPixelFormat; (void) iLayerPlane; + (void) nBytes; (void) plpd; + SetLastError(0); + return(FALSE); +} + +WINGDIAPI int GLAPIENTRY wglSetLayerPaletteEntries(HDC hdc, + int iLayerPlane, + int iStart, + int cEntries, + CONST COLORREF *pcr) +{ + (void) hdc; (void) iLayerPlane; (void) iStart; + (void) cEntries; (void) pcr; + SetLastError(0); + return(0); +} + +WINGDIAPI int GLAPIENTRY wglGetLayerPaletteEntries(HDC hdc, + int iLayerPlane, + int iStart, + int cEntries, + COLORREF *pcr) +{ + (void) hdc; (void) iLayerPlane; (void) iStart; (void) cEntries; (void) pcr; + SetLastError(0); + return(0); +} + +WINGDIAPI BOOL GLAPIENTRY wglRealizeLayerPalette(HDC hdc, + int iLayerPlane, + BOOL bRealize) +{ + (void) hdc; (void) iLayerPlane; (void) bRealize; + SetLastError(0); + return(FALSE); +} + +WINGDIAPI BOOL GLAPIENTRY wglSwapLayerBuffers(HDC hdc, + UINT fuPlanes) +{ + (void) hdc; (void) fuPlanes; + SetLastError(0); + return(FALSE); +} + diff --git a/reactos/dll/mesa32/src/drivers/windows/gdi/wmesa.c b/reactos/dll/mesa32/src/drivers/windows/gdi/wmesa.c new file mode 100644 index 00000000000..3f785a3a215 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gdi/wmesa.c @@ -0,0 +1,1183 @@ +/* + * Windows (Win32) device driver for Mesa + * + */ + +#include "wmesadef.h" +#include "colors.h" +#include +#include "extensions.h" +#include "framebuffer.h" +#include "renderbuffer.h" +#include "drivers/common/driverfuncs.h" +#include "array_cache/acache.h" +#include "swrast/swrast.h" +#include "swrast_setup/swrast_setup.h" +#include "tnl/tnl.h" +#include "tnl/t_context.h" +#include "tnl/t_pipeline.h" + +#define FLIP(Y) (Current->height-(Y)-1) + +/* Static Data */ + +static PWMC Current = NULL; + +/* + * Every driver should implement a GetString function in order to + * return a meaningful GL_RENDERER string. + */ +static const GLubyte *wmesa_get_string(GLcontext *ctx, GLenum name) +{ + return (name == GL_RENDERER) ? + (GLubyte *) "Mesa Windows GDI Driver" : NULL; +} + +/* + * Determine the pixel format based on the pixel size. + */ +static void wmSetPixelFormat(PWMC pwc, HDC hDC) +{ + pwc->cColorBits = GetDeviceCaps(hDC, BITSPIXEL); + + // TEMP - only 16 and 32 bit targets are supported now + assert(pwc->cColorBits == 16 || + pwc->cColorBits == 32); + + switch(pwc->cColorBits){ + case 8: + pwc->pixelformat = PF_INDEX8; + break; + case 16: + pwc->pixelformat = PF_5R6G5B; + break; + case 32: + pwc->pixelformat = PF_8R8G8B; + break; + default: + pwc->pixelformat = PF_BADFORMAT; + } +} + +/* + * Create DIB for back buffer. + * We write into this memory with the span routines and then blit it + * to the window on a buffer swap. + */ + +BOOL wmCreateBackingStore(PWMC pwc, long lxSize, long lySize) +{ + HDC hdc = pwc->hDC; + LPBITMAPINFO pbmi = &(pwc->bmi); + HDC hic; + + assert(pwc->db_flag == GL_TRUE); + + pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + pbmi->bmiHeader.biWidth = lxSize; + pbmi->bmiHeader.biHeight= -lySize; + pbmi->bmiHeader.biPlanes = 1; + pbmi->bmiHeader.biBitCount = GetDeviceCaps(pwc->hDC, BITSPIXEL); + pbmi->bmiHeader.biCompression = BI_RGB; + pbmi->bmiHeader.biSizeImage = 0; + pbmi->bmiHeader.biXPelsPerMeter = 0; + pbmi->bmiHeader.biYPelsPerMeter = 0; + pbmi->bmiHeader.biClrUsed = 0; + pbmi->bmiHeader.biClrImportant = 0; + + pwc->cColorBits = pbmi->bmiHeader.biBitCount; + pwc->ScanWidth = (lxSize * (pwc->cColorBits / 8) + 3) & ~3; + + hic = CreateIC("display", NULL, NULL, NULL); + pwc->dib.hDC = CreateCompatibleDC(hic); + + pwc->hbmDIB = CreateDIBSection(hic, + &pwc->bmi, + DIB_RGB_COLORS, + (void **)&(pwc->pbPixels), + 0, + 0); + pwc->hOldBitmap = SelectObject(pwc->dib.hDC, pwc->hbmDIB); + + DeleteDC(hic); + + wmSetPixelFormat(pwc, pwc->hDC); + return TRUE; +} + +static void wmDeleteBackingStore(PWMC pwc) +{ + if (pwc->hbmDIB) { + SelectObject(pwc->dib.hDC, pwc->hOldBitmap); + DeleteDC(pwc->dib.hDC); + DeleteObject(pwc->hbmDIB); + } +} + +static void wmesa_get_buffer_size(GLframebuffer *buffer, + GLuint *width, + GLuint *height ) +{ + *width = Current->width; + *height = Current->height; +} + + +static void wmesa_flush(GLcontext* ctx) +{ + if (Current->db_flag) { + BitBlt(Current->hDC, 0, 0, Current->width, Current->height, + Current->dib.hDC, 0, 0, SRCCOPY); + } + else { + /* Do nothing for single buffer */ + } +} + + +/**********************************************************************/ +/***** CLEAR Functions *****/ +/**********************************************************************/ + +/* If we do not implement these, Mesa clears the buffers via the pixel + * span writing interface, which is very slow for a clear operation. + */ + +/* + * Set the color index used to clear the color buffer. + */ +static void clear_index(GLcontext* ctx, GLuint index) +{ + /* Note that indexed mode is not supported yet */ + Current->clearColorRef = RGB(0,0,0); +} + +/* + * Set the color used to clear the color buffer. + */ +static void clear_color(GLcontext* ctx, const GLfloat color[4]) +{ + GLubyte col[3]; + UINT bytesPerPixel = Current->cColorBits / 8; + + CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]); + Current->clearColorRef = RGB(col[0], col[1], col[2]); + DeleteObject(Current->clearPen); + DeleteObject(Current->clearBrush); + Current->clearPen = CreatePen(PS_SOLID, 1, Current->clearColorRef); + Current->clearBrush = CreateSolidBrush(Current->clearColorRef); +} + + +/* + * Clear the specified region of the color buffer using the clear color + * or index as specified by one of the two functions above. + * + * This procedure clears either the front and/or the back COLOR buffers. + * Only the "left" buffer is cleared since we are not stereo. + * Clearing of the other non-color buffers is left to the swrast. + */ + +static void clear(GLcontext* ctx, + GLbitfield mask, + GLboolean all, + GLint x, GLint y, + GLint width, GLint height) +{ + int done = 0; + + /* Let swrast do all the work if the masks are not set to + * clear all channels. */ + if (ctx->Color.ColorMask[0] != 0xff || + ctx->Color.ColorMask[1] != 0xff || + ctx->Color.ColorMask[2] != 0xff || + ctx->Color.ColorMask[3] != 0xff) { + _swrast_Clear(ctx, mask, all, x, y, width, height); + return; + } + + /* 'all' means clear the entire window */ + if (all) { + x = y = 0; + width = Current->width; + height = Current->height; + } + + /* Back buffer */ + if (mask & BUFFER_BIT_BACK_LEFT) { + + int i, rowSize; + UINT bytesPerPixel = Current->cColorBits / 8; + LPBYTE lpb, clearRow; + LPWORD lpw; + BYTE bColor; + WORD wColor; + BYTE r, g, b; + DWORD dwColor; + LPDWORD lpdw; + + /* Try for a fast clear - clearing entire buffer with a single + * byte value. */ + if (all) { /* entire buffer */ + /* Now check for an easy clear value */ + switch (bytesPerPixel) { + case 1: + bColor = BGR8(GetRValue(Current->clearColorRef), + GetGValue(Current->clearColorRef), + GetBValue(Current->clearColorRef)); + memset(Current->pbPixels, bColor, + Current->ScanWidth * height); + done = 1; + break; + case 2: + wColor = BGR16(GetRValue(Current->clearColorRef), + GetGValue(Current->clearColorRef), + GetBValue(Current->clearColorRef)); + if (((wColor >> 8) & 0xff) == (wColor & 0xff)) { + memset(Current->pbPixels, wColor & 0xff, + Current->ScanWidth * height); + done = 1; + } + break; + case 3: + /* fall through */ + case 4: + if (GetRValue(Current->clearColorRef) == + GetGValue(Current->clearColorRef) && + GetRValue(Current->clearColorRef) == + GetBValue(Current->clearColorRef)) { + memset(Current->pbPixels, + GetRValue(Current->clearColorRef), + Current->ScanWidth * height); + done = 1; + } + break; + default: + break; + } + } /* all */ + + if (!done) { + /* Need to clear a row at a time. Begin by setting the first + * row in the area to be cleared to the clear color. */ + + clearRow = Current->pbPixels + + Current->ScanWidth * FLIP(y) + + bytesPerPixel * x; + switch (bytesPerPixel) { + case 1: + lpb = clearRow; + bColor = BGR8(GetRValue(Current->clearColorRef), + GetGValue(Current->clearColorRef), + GetBValue(Current->clearColorRef)); + memset(lpb, bColor, width); + break; + case 2: + lpw = (LPWORD)clearRow; + wColor = BGR16(GetRValue(Current->clearColorRef), + GetGValue(Current->clearColorRef), + GetBValue(Current->clearColorRef)); + for (i=0; iclearColorRef); + g = GetGValue(Current->clearColorRef); + b = GetBValue(Current->clearColorRef); + for (i=0; iclearColorRef), + GetGValue(Current->clearColorRef), + GetBValue(Current->clearColorRef)); + for (i=0; iScanWidth; + rowSize = width * bytesPerPixel; + for (i=1; iScanWidth; + } + } /* not done */ + mask &= ~BUFFER_BIT_BACK_LEFT; + } /* back buffer */ + + /* front buffer */ + if (mask & BUFFER_BIT_FRONT_LEFT) { + HDC DC = Current->hDC; + HPEN Old_Pen = SelectObject(DC, Current->clearPen); + HBRUSH Old_Brush = SelectObject(DC, Current->clearBrush); + Rectangle(DC, + x, + FLIP(y), + x + width + 1, + FLIP(y) - height + 1); + SelectObject(DC, Old_Pen); + SelectObject(DC, Old_Brush); + mask &= ~BUFFER_BIT_FRONT_LEFT; + } /* front buffer */ + + /* Call swrast if there is anything left to clear (like DEPTH) */ + if (mask) + _swrast_Clear(ctx, mask, all, x, y, width, height); + +} + + +/**********************************************************************/ +/***** PIXEL Functions *****/ +/**********************************************************************/ + +/* SINGLE BUFFER */ + +/* These are slow, but work with all non-indexed visual types */ + +/* Write a horizontal span of RGBA color pixels with a boolean mask. */ +static void write_rgba_span_single(const GLcontext* ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const GLubyte rgba[][4], + const GLubyte mask[] ) +{ + PWMC pwc = Current; + GLuint i; + + (void) ctx; + y=FLIP(y); + if (mask) { + for (i=0; ihDC, x+i, y, RGB(rgba[i][RCOMP], rgba[i][GCOMP], + rgba[i][BCOMP])); + } + else { + for (i=0; ihDC, x+i, y, RGB(rgba[i][RCOMP], rgba[i][GCOMP], + rgba[i][BCOMP])); + } + +} + +/* Write a horizontal span of RGB color pixels with a boolean mask. */ +static void write_rgb_span_single(const GLcontext* ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const GLubyte rgb[][3], + const GLubyte mask[] ) +{ + PWMC pwc = Current; + GLuint i; + + (void) ctx; + y=FLIP(y); + if (mask) { + for (i=0; ihDC, x+i, y, RGB(rgb[i][RCOMP], rgb[i][GCOMP], + rgb[i][BCOMP])); + } + else { + for (i=0; ihDC, x+i, y, RGB(rgb[i][RCOMP], rgb[i][GCOMP], + rgb[i][BCOMP])); + } + +} + +/* + * Write a horizontal span of pixels with a boolean mask. The current color + * is used for all pixels. + */ +static void write_mono_rgba_span_single(const GLcontext* ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const GLchan color[4], + const GLubyte mask[]) +{ + GLuint i; + PWMC pwc = Current; + COLORREF colorref; + + (void) ctx; + colorref = RGB(color[RCOMP], color[GCOMP], color[BCOMP]); + y=FLIP(y); + if (mask) { + for (i=0; ihDC, x+i, y, colorref); + } + else + for (i=0; ihDC, x+i, y, colorref); + +} + +/* Write an array of RGBA pixels with a boolean mask. */ +static void write_rgba_pixels_single(const GLcontext* ctx, + struct gl_renderbuffer *rb, + GLuint n, + const GLint x[], const GLint y[], + const GLubyte rgba[][4], + const GLubyte mask[] ) +{ + GLuint i; + PWMC pwc = Current; + (void) ctx; + for (i=0; ihDC, x[i], FLIP(y[i]), + RGB(rgba[i][RCOMP], rgba[i][GCOMP], + rgba[i][BCOMP])); +} + + + +/* + * Write an array of pixels with a boolean mask. The current color + * is used for all pixels. + */ +static void write_mono_rgba_pixels_single(const GLcontext* ctx, + struct gl_renderbuffer *rb, + GLuint n, + const GLint x[], const GLint y[], + const GLchan color[4], + const GLubyte mask[] ) +{ + GLuint i; + PWMC pwc = Current; + COLORREF colorref; + (void) ctx; + colorref = RGB(color[RCOMP], color[GCOMP], color[BCOMP]); + for (i=0; ihDC, x[i], FLIP(y[i]), colorref); +} + +/* Read a horizontal span of color pixels. */ +static void read_rgba_span_single(const GLcontext* ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + GLubyte rgba[][4] ) +{ + GLuint i; + COLORREF Color; + y = FLIP(y); + for (i=0; ihDC, x+i, y); + rgba[i][RCOMP] = GetRValue(Color); + rgba[i][GCOMP] = GetGValue(Color); + rgba[i][BCOMP] = GetBValue(Color); + rgba[i][ACOMP] = 255; + } +} + + +/* Read an array of color pixels. */ +static void read_rgba_pixels_single(const GLcontext* ctx, + struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4]) +{ + GLuint i; + COLORREF Color; + for (i=0; ihDC, x[i], y2); + rgba[i][RCOMP] = GetRValue(Color); + rgba[i][GCOMP] = GetGValue(Color); + rgba[i][BCOMP] = GetBValue(Color); + rgba[i][ACOMP] = 255; + } +} + +/*********************************************************************/ + +/* DOUBLE BUFFER 32-bit */ + +#define WMSETPIXEL32(pwc, y, x, r, g, b) { \ +LPDWORD lpdw = ((LPDWORD)((pwc)->pbPixels + (pwc)->ScanWidth * (y)) + (x)); \ +*lpdw = BGR32((r),(g),(b)); } + + + +/* Write a horizontal span of RGBA color pixels with a boolean mask. */ +static void write_rgba_span_32(const GLcontext* ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const GLubyte rgba[][4], + const GLubyte mask[] ) +{ + PWMC pwc = Current; + GLuint i; + LPDWORD lpdw; + + (void) ctx; + + y=FLIP(y); + lpdw = ((LPDWORD)(pwc->pbPixels + pwc->ScanWidth * y)) + x; + if (mask) { + for (i=0; ipbPixels + pwc->ScanWidth * y)) + x; + if (mask) { + for (i=0; ipbPixels + pwc->ScanWidth * y)) + x; + y=FLIP(y); + pixel = BGR32(color[RCOMP], color[GCOMP], color[BCOMP]); + if (mask) { + for (i=0; ipbPixels + pwc->ScanWidth * y)) + x; + for (i=0; i> 16; + rgba[i][GCOMP] = (pixel & 0x0000ff00) >> 8; + rgba[i][BCOMP] = (pixel & 0x000000ff); + rgba[i][ACOMP] = 255; + } +} + + +/* Read an array of color pixels. */ +static void read_rgba_pixels_32(const GLcontext* ctx, + struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4]) +{ + GLuint i; + DWORD pixel; + LPDWORD lpdw; + PWMC pwc = Current; + + for (i=0; ipbPixels + pwc->ScanWidth * y2)) + x[i]; + pixel = lpdw[i]; + rgba[i][RCOMP] = (pixel & 0x00ff0000) >> 16; + rgba[i][GCOMP] = (pixel & 0x0000ff00) >> 8; + rgba[i][BCOMP] = (pixel & 0x000000ff); + rgba[i][ACOMP] = 255; + } +} + + +/*********************************************************************/ + +/* DOUBLE BUFFER 16-bit */ + +#define WMSETPIXEL16(pwc, y, x, r, g, b) { \ +LPWORD lpw = ((LPWORD)((pwc)->pbPixels + (pwc)->ScanWidth * (y)) + (x)); \ +*lpw = BGR16((r),(g),(b)); } + + + +/* Write a horizontal span of RGBA color pixels with a boolean mask. */ +static void write_rgba_span_16(const GLcontext* ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const GLubyte rgba[][4], + const GLubyte mask[] ) +{ + PWMC pwc = Current; + GLuint i; + LPWORD lpw; + + (void) ctx; + + y=FLIP(y); + lpw = ((LPWORD)(pwc->pbPixels + pwc->ScanWidth * y)) + x; + if (mask) { + for (i=0; ipbPixels + pwc->ScanWidth * y)) + x; + if (mask) { + for (i=0; ipbPixels + pwc->ScanWidth * y)) + x; + y=FLIP(y); + pixel = BGR16(color[RCOMP], color[GCOMP], color[BCOMP]); + if (mask) { + for (i=0; ipbPixels + pwc->ScanWidth * y)) + x; + for (i=0; i> 7; + rgba[i][GCOMP] = (pixel & 0x03e0) >> 2; + rgba[i][BCOMP] = (pixel & 0x001f) << 3; + rgba[i][ACOMP] = 255; + } +} + + +/* Read an array of color pixels. */ +static void read_rgba_pixels_16(const GLcontext* ctx, + struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4]) +{ + GLuint i, pixel; + LPWORD lpw; + PWMC pwc = Current; + + for (i=0; ipbPixels + pwc->ScanWidth * y2)) + x[i]; + pixel = lpw[i]; + /* Windows uses 5,5,5 for 16-bit */ + rgba[i][RCOMP] = (pixel & 0x7c00) >> 7; + rgba[i][GCOMP] = (pixel & 0x03e0) >> 2; + rgba[i][BCOMP] = (pixel & 0x001f) << 3; + rgba[i][ACOMP] = 255; + } +} + + + + +/**********************************************************************/ +/***** BUFFER Functions *****/ +/**********************************************************************/ + + + + +static void +wmesa_delete_renderbuffer(struct gl_renderbuffer *rb) +{ + _mesa_free(rb); +} + +static GLboolean +wmesa_renderbuffer_storage(GLcontext *ctx, + struct gl_renderbuffer *rb, + GLenum internalFormat, + GLuint width, + GLuint height) +{ + return GL_TRUE; +} + +/** + * Called by ctx->Driver.ResizeBuffers() + * Resize the front/back colorbuffers to match the latest window size. + */ +static void +wmesa_resize_buffers(GLcontext *ctx, GLframebuffer *buffer, + GLuint width, GLuint height) +{ + RECT CR; + if (Current->width != width || Current->height != height) { + Current->width = width; + Current->height = height; + /* Realloc back buffer */ + if (Current->db_flag) { + wmDeleteBackingStore(Current); + wmCreateBackingStore(Current, width, height); + } + GetClientRect(Current->Window, &CR); + Current->width = CR.right; + Current->height = CR.bottom; + } + _mesa_resize_framebuffer(ctx, buffer, width, height); +} + + +/** + * Called by glViewport. + * This is a good time for us to poll the current window size and adjust + * our renderbuffers to match the current window size. + * Remember, we have no opportunity to respond to conventional + * resize events since the driver has no event loop. + * Thus, we poll. + * Note that this trick isn't fool-proof. If the application never calls + * glViewport, our notion of the current window size may be incorrect. + */ +static void wmesa_viewport(GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height) +{ + if (Current->width != width || Current->height != height) { + wmesa_resize_buffers(ctx, ctx->WinSysDrawBuffer, width, height); + ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */ + } +} + + + + +/** + * Called when the driver should update it's state, based on the new_state + * flags. + */ +static void wmesa_update_state(GLcontext *ctx, GLuint new_state) +{ + _swrast_InvalidateState(ctx, new_state); + _swsetup_InvalidateState(ctx, new_state); + _ac_InvalidateState(ctx, new_state); + _tnl_InvalidateState(ctx, new_state); + + /* TODO - need code to update the span functions in case the + * renderer changes the target buffer (like a DB app writing to + * the front buffer). */ +} + + + + + +/**********************************************************************/ +/***** WMESA Functions *****/ +/**********************************************************************/ + +WMesaContext WMesaCreateContext(HWND hWnd, + HPALETTE* Pal, + GLboolean rgb_flag, + GLboolean db_flag, + GLboolean alpha_flag) +{ + RECT CR; + WMesaContext c; + struct dd_function_table functions; + struct gl_renderbuffer *rb; + + (void) Pal; + + /* Indexed mode not supported */ + if (!rgb_flag) + return NULL; + + c = CALLOC_STRUCT(wmesa_context); + if (!c) + return NULL; + + c->Window = hWnd; + c->hDC = GetDC(hWnd); + GetClientRect(c->Window, &CR); + c->width = CR.right; + c->height = CR.bottom; + + c->clearPen = CreatePen(PS_SOLID, 1, 0); + c->clearBrush = CreateSolidBrush(0); + + /* Create back buffer if double buffered */ + if (db_flag) { + c->db_flag = 1; + wmCreateBackingStore(c, c->width, c->height); + + } + + c->gl_visual = _mesa_create_visual(rgb_flag, + db_flag, /* db_flag */ + GL_FALSE, /* stereo */ + 8,8,8, /* color RGB */ + alpha_flag ? 8 : 0, /* color A */ + 0, /* index bits */ + 16, /* depth_bits */ + 8, /* stencil_bits */ + 16,16,16, /* accum RGB */ + alpha_flag ? 16 : 0, /* accum A */ + 1); + + if (!c->gl_visual) { + _mesa_free(c); + return NULL; + } + + /* Set up driver functions */ + _mesa_init_driver_functions(&functions); + /* Fill in required functions */ + functions.GetString = wmesa_get_string; + functions.UpdateState = wmesa_update_state; + functions.GetBufferSize = wmesa_get_buffer_size; + functions.Flush = wmesa_flush; + + functions.Clear = clear; + functions.ClearIndex = clear_index; + functions.ClearColor = clear_color; + + functions.ResizeBuffers = wmesa_resize_buffers; + functions.Viewport = wmesa_viewport; + + /* allocate a new Mesa context */ + c->gl_ctx = _mesa_create_context(c->gl_visual, NULL, + &functions, (void *)c); + if (!c->gl_ctx) { + _mesa_destroy_visual( c->gl_visual ); + _mesa_free(c); + return NULL; + } + + _mesa_enable_sw_extensions(c->gl_ctx); + _mesa_enable_1_3_extensions(c->gl_ctx); + _mesa_enable_1_4_extensions(c->gl_ctx); + _mesa_enable_1_5_extensions(c->gl_ctx); + _mesa_enable_2_0_extensions(c->gl_ctx); + + c->gl_buffer = _mesa_create_framebuffer(c->gl_visual); + if (!c->gl_buffer) { + _mesa_destroy_visual(c->gl_visual); + _mesa_free_context_data(c->gl_ctx); + _mesa_free(c); + return NULL; + } + + rb = CALLOC_STRUCT(gl_renderbuffer); + + if (!rb) { + _mesa_destroy_visual(c->gl_visual); + _mesa_destroy_framebuffer(c->gl_buffer); + _mesa_free_context_data(c->gl_ctx); + _mesa_free(c); + return NULL; + } + + _mesa_init_renderbuffer(rb, (GLuint)0); + + rb->_BaseFormat = GL_RGBA; + rb->InternalFormat = GL_RGBA; + rb->DataType = CHAN_TYPE; + rb->Delete = wmesa_delete_renderbuffer; + rb->AllocStorage = wmesa_renderbuffer_storage; + + if (db_flag) { + switch(c->cColorBits) { + case 16: + rb->PutRow = write_rgba_span_16; + rb->PutRowRGB = write_rgb_span_16; + rb->PutMonoRow = write_mono_rgba_span_16; + rb->PutValues = write_rgba_pixels_16; + rb->PutMonoValues = write_mono_rgba_pixels_16; + rb->GetRow = read_rgba_span_16; + rb->GetValues = read_rgba_pixels_16; + break; + case 32: + rb->PutRow = write_rgba_span_32; + rb->PutRowRGB = write_rgb_span_32; + rb->PutMonoRow = write_mono_rgba_span_32; + rb->PutValues = write_rgba_pixels_32; + rb->PutMonoValues = write_mono_rgba_pixels_32; + rb->GetRow = read_rgba_span_32; + rb->GetValues = read_rgba_pixels_32; + break; + default: + break; + } + _mesa_add_renderbuffer(c->gl_buffer, BUFFER_BACK_LEFT, rb); + } + else { /* single buffer */ + rb->PutRow = write_rgba_span_single; + rb->PutRowRGB = write_rgb_span_single; + rb->PutMonoRow = write_mono_rgba_span_single; + rb->PutValues = write_rgba_pixels_single; + rb->PutMonoValues = write_mono_rgba_pixels_single; + rb->GetRow = read_rgba_span_single; + rb->GetValues = read_rgba_pixels_single; + } + _mesa_add_renderbuffer(c->gl_buffer, BUFFER_FRONT_LEFT, rb); + + _mesa_add_soft_renderbuffers(c->gl_buffer, + GL_FALSE, /* color */ + c->gl_visual->depthBits > 0, + c->gl_visual->stencilBits > 0, + c->gl_visual->accumRedBits > 0, + alpha_flag, + GL_FALSE); + + /* Initialize the software rasterizer and helper modules. */ + if (!_swrast_CreateContext(c->gl_ctx) || + !_ac_CreateContext(c->gl_ctx) || + !_tnl_CreateContext(c->gl_ctx) || + !_swsetup_CreateContext(c->gl_ctx)) { + _mesa_destroy_visual(c->gl_visual); + _mesa_destroy_framebuffer(c->gl_buffer); + _mesa_free_context_data(c->gl_ctx); + _mesa_free(c); + return NULL; + } + + _swsetup_Wakeup(c->gl_ctx); + + TNL_CONTEXT(c->gl_ctx)->Driver.RunPipeline = _tnl_run_pipeline; + + return c; +} + +void WMesaDestroyContext( void ) +{ + WMesaContext c = Current; + + WMesaMakeCurrent(NULL); + + ReleaseDC(c->Window, c->hDC); + DeleteObject(c->clearPen); + DeleteObject(c->clearBrush); + + if (c->db_flag) + wmDeleteBackingStore(c); + + _swsetup_DestroyContext(c->gl_ctx); + _tnl_DestroyContext(c->gl_ctx); + _ac_DestroyContext(c->gl_ctx); + _swrast_DestroyContext(c->gl_ctx); + + _mesa_destroy_visual(c->gl_visual); + _mesa_destroy_framebuffer(c->gl_buffer); + _mesa_free_context_data(c->gl_ctx); + _mesa_free(c->gl_ctx); + _mesa_free(c); +} + + +void WMesaMakeCurrent(WMesaContext c) +{ + /* return if already current */ + if (Current == c) + return; + + if ((Current = c) != 0) + _mesa_make_current(c->gl_ctx, c->gl_buffer, c->gl_buffer); +} + + +void WMesaSwapBuffers( void ) +{ + GET_CURRENT_CONTEXT(ctx); + + /* If we're swapping the buffer associated with the current context + * we have to flush any pending rendering commands first. + */ + if (Current && Current->gl_ctx == ctx) + _mesa_notifySwapBuffers(ctx); + + if (Current->db_flag) + wmesa_flush(ctx); +} + +/**********************************************************************/ +/***** END *****/ +/**********************************************************************/ diff --git a/reactos/dll/mesa32/src/drivers/windows/gdi/wmesadef.h b/reactos/dll/mesa32/src/drivers/windows/gdi/wmesadef.h new file mode 100644 index 00000000000..9aa0ab20b79 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gdi/wmesadef.h @@ -0,0 +1,34 @@ + +#include "context.h" + +typedef struct _dibSection{ + HDC hDC; + HANDLE hFileMap; + BOOL fFlushed; + LPVOID base; +}WMDIBSECTION, *PWMDIBSECTION; + +typedef struct wmesa_context{ + GLcontext *gl_ctx; /* The core GL/Mesa context */ + GLvisual *gl_visual; /* Describes the buffers */ + GLframebuffer *gl_buffer; /* Depth, stencil, accum, etc buffers*/ + + HWND Window; + HDC hDC; + COLORREF clearColorRef; + HPEN clearPen; + HBRUSH clearBrush; + GLuint width; + GLuint height; + GLuint ScanWidth; + GLboolean db_flag; + WMDIBSECTION dib; + BITMAPINFO bmi; + HBITMAP hbmDIB; + HBITMAP hOldBitmap; + PBYTE pbPixels; + BYTE cColorBits; + int pixelformat; +} *PWMC; + + diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/ddlog.c b/reactos/dll/mesa32/src/drivers/windows/gldirect/ddlog.c new file mode 100644 index 00000000000..4ae79e2fdac --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/ddlog.c @@ -0,0 +1,192 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: Logging functions. +* +****************************************************************************/ + +#define STRICT +#include + +#include "ddlog.h" +#include "gld_driver.h" + +// *********************************************************************** + +static char ddlogbuf[256]; +static FILE* fpDDLog = NULL; // Log file pointer +static char szDDLogName[_MAX_PATH] = {"gldirect.log"}; // Filename of the log +static DDLOG_loggingMethodType ddlogLoggingMethod = DDLOG_NONE; // Default to No Logging +static DDLOG_severityType ddlogDebugLevel; +static BOOL bUIWarning = FALSE; // MessageBox warning ? + +// *********************************************************************** + +void ddlogOpen( + DDLOG_loggingMethodType LoggingMethod, + DDLOG_severityType Severity) +{ + if (fpDDLog != NULL) { + // Tried to re-open the log + ddlogMessage(DDLOG_WARN, "Tried to re-open the log file\n"); + return; + } + + ddlogLoggingMethod = LoggingMethod; + ddlogDebugLevel = Severity; + + if (ddlogLoggingMethod == DDLOG_NORMAL) { + fpDDLog = fopen(szDDLogName, "wt"); + if (fpDDLog == NULL) + return; + } + + ddlogMessage(DDLOG_SYSTEM, "\n"); + ddlogMessage(DDLOG_SYSTEM, "-> Logging Started\n"); +} + +// *********************************************************************** + +void ddlogClose() +{ + // Determine whether the log is already closed + if (fpDDLog == NULL && ddlogLoggingMethod == DDLOG_NORMAL) + return; // Nothing to do. + + ddlogMessage(DDLOG_SYSTEM, "<- Logging Ended\n"); + + if (ddlogLoggingMethod == DDLOG_NORMAL) { + fclose(fpDDLog); + fpDDLog = NULL; + } +} + +// *********************************************************************** + +void ddlogMessage( + DDLOG_severityType severity, + LPSTR message) +{ + char buf[256]; + + // Bail if logging is disabled + if (ddlogLoggingMethod == DDLOG_NONE) + return; + + if (ddlogLoggingMethod == DDLOG_CRASHPROOF) + fpDDLog = fopen(szDDLogName, "at"); + + if (fpDDLog == NULL) + return; + + if (severity >= ddlogDebugLevel) { + sprintf(buf, "DDLog: (%s) %s", ddlogSeverityMessages[severity], message); + fputs(buf, fpDDLog); // Write string to file + OutputDebugString(buf); // Echo to debugger + } + + if (ddlogLoggingMethod == DDLOG_CRASHPROOF) { + fflush(fpDDLog); // Write info to disk + fclose(fpDDLog); + fpDDLog = NULL; + } + + // Popup message box if critical error + if (bUIWarning && severity == DDLOG_CRITICAL) { + MessageBox(NULL, buf, "GLDirect", MB_OK | MB_ICONWARNING | MB_TASKMODAL); + } +} + +// *********************************************************************** + +// Write a string value to the log file +void ddlogError( + DDLOG_severityType severity, + LPSTR message, + HRESULT hResult) +{ +#ifdef _USE_GLD3_WGL + char dxErrStr[1024]; + _gldDriver.GetDXErrorString(hResult, &dxErrStr[0], sizeof(dxErrStr)); + if (FAILED(hResult)) { + sprintf(ddlogbuf, "DDLog: %s %8x:[ %s ]\n", message, hResult, dxErrStr); + } else + sprintf(ddlogbuf, "DDLog: %s\n", message); +#else + if (FAILED(hResult)) { + sprintf(ddlogbuf, "DDLog: %s %8x:[ %s ]\n", message, hResult, DDErrorToString(hResult)); + } else + sprintf(ddlogbuf, "DDLog: %s\n", message); +#endif + ddlogMessage(severity, ddlogbuf); +} + +// *********************************************************************** + +void ddlogPrintf( + DDLOG_severityType severity, + LPSTR message, + ...) +{ + va_list args; + + va_start(args, message); + vsprintf(ddlogbuf, message, args); + va_end(args); + + lstrcat(ddlogbuf, "\n"); + + ddlogMessage(severity, ddlogbuf); +} + +// *********************************************************************** + +void ddlogWarnOption( + BOOL bWarnOption) +{ + bUIWarning = bWarnOption; +} + +// *********************************************************************** + +void ddlogPathOption( + LPSTR szPath) +{ + char szPathName[_MAX_PATH]; + + strcpy(szPathName, szPath); + strcat(szPathName, "\\"); + strcat(szPathName, szDDLogName); + strcpy(szDDLogName, szPathName); +} + +// *********************************************************************** diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/ddlog.h b/reactos/dll/mesa32/src/drivers/windows/gldirect/ddlog.h new file mode 100644 index 00000000000..d64067e2245 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/ddlog.h @@ -0,0 +1,109 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: Logging functions. +* +****************************************************************************/ + +#ifndef __DDLOG_H +#define __DDLOG_H + +#include + +#ifndef _USE_GLD3_WGL +#include "dderrstr.h" // ddraw/d3d error string +#endif + +/*---------------------- Macros and type definitions ----------------------*/ + +typedef enum { + DDLOG_NONE = 0, // No log output + DDLOG_NORMAL = 1, // Log is kept open + DDLOG_CRASHPROOF = 2, // Log is closed and flushed + DDLOG_METHOD_FORCE_DWORD = 0x7fffffff, +} DDLOG_loggingMethodType; + +// Denotes type of message sent to the logging functions +typedef enum { + DDLOG_INFO = 0, // Information only + DDLOG_WARN = 1, // Warning only + DDLOG_ERROR = 2, // Notify user of an error + DDLOG_CRITICAL = 3, // Exceptionally severe error + DDLOG_SYSTEM = 4, // System message. Not an error + // but must always be printed. + DDLOG_SEVERITY_FORCE_DWORD = 0x7fffffff, // Make enum dword +} DDLOG_severityType; + +#ifdef _USE_GLD3_WGL +// Synomyms +#define GLDLOG_INFO DDLOG_INFO +#define GLDLOG_WARN DDLOG_WARN +#define GLDLOG_ERROR DDLOG_ERROR +#define GLDLOG_CRITICAL DDLOG_CRITICAL +#define GLDLOG_SYSTEM DDLOG_SYSTEM +#endif + +// The message that will be output to the log +static const char *ddlogSeverityMessages[] = { + "INFO", + "WARN", + "ERROR", + "*CRITICAL*", + "System", +}; + +/*------------------------- Function Prototypes ---------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +void ddlogOpen(DDLOG_loggingMethodType LoggingMethod, DDLOG_severityType Severity); +void ddlogClose(); +void ddlogMessage(DDLOG_severityType severity, LPSTR message); +void ddlogError(DDLOG_severityType severity, LPSTR message, HRESULT hResult); +void ddlogPrintf(DDLOG_severityType severity, LPSTR message, ...); +void ddlogWarnOption(BOOL bWarnOption); +void ddlogPathOption(LPSTR szPath); + +#ifdef _USE_GLD3_WGL +// Synomyms +#define gldLogMessage ddlogMessage +#define gldLogError ddlogError +#define gldLogPrintf ddlogPrintf +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/dglcontext.c b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglcontext.c new file mode 100644 index 00000000000..5dafe14518d --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglcontext.c @@ -0,0 +1,2213 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: Context handling. +* +****************************************************************************/ + +#include "dglcontext.h" + +// Get compile errors without this. KeithH +//#include "scitech.h" // ibool, etc. + +#ifdef _USE_GLD3_WGL +#include "gld_driver.h" + +extern void _gld_mesa_warning(GLcontext *, char *); +extern void _gld_mesa_fatal(GLcontext *, char *); +#endif // _USE_GLD3_WGL + +// TODO: Clean out old DX6-specific code from GLD 2.x CAD driver +// if it is no longer being built as part of GLDirect. (DaveM) + +// *********************************************************************** + +#define GLDERR_NONE 0 +#define GLDERR_MEM 1 +#define GLDERR_DDRAW 2 +#define GLDERR_D3D 3 +#define GLDERR_BPP 4 + +char szResourceWarning[] = +"GLDirect does not have enough video memory resources\n" +"to support the requested OpenGL rendering context.\n\n" +"You may have to reduce the current display resolution\n" +"to obtain satisfactory OpenGL performance.\n"; + +char szDDrawWarning[] = +"GLDirect is unable to initialize DirectDraw for the\n" +"requested OpenGL rendering context.\n\n" +"You will have to check the DirectX control panel\n" +"for further information.\n"; + +char szD3DWarning[] = +"GLDirect is unable to initialize Direct3D for the\n" +"requested OpenGL rendering context.\n\n" +"You may have to change the display mode resolution\n" +"color depth or check the DirectX control panel for\n" +"further information.\n"; + +char szBPPWarning[] = +"GLDirect is unable to use the selected color depth for\n" +"the requested OpenGL rendering context.\n\n" +"You will have to change the display mode resolution\n" +"color depth with the Display Settings control panel.\n"; + +int nContextError = GLDERR_NONE; + +// *********************************************************************** + +#define VENDORID_ATI 0x1002 + +static DWORD devATIRagePro[] = { + 0x4742, // 3D RAGE PRO BGA AGP 1X/2X + 0x4744, // 3D RAGE PRO BGA AGP 1X only + 0x4749, // 3D RAGE PRO BGA PCI 33 MHz + 0x4750, // 3D RAGE PRO PQFP PCI 33 MHz + 0x4751, // 3D RAGE PRO PQFP PCI 33 MHz limited 3D + 0x4C42, // 3D RAGE LT PRO BGA-312 AGP 133 MHz + 0x4C44, // 3D RAGE LT PRO BGA-312 AGP 66 MHz + 0x4C49, // 3D RAGE LT PRO BGA-312 PCI 33 MHz + 0x4C50, // 3D RAGE LT PRO BGA-256 PCI 33 MHz + 0x4C51, // 3D RAGE LT PRO BGA-256 PCI 33 MHz limited 3D +}; + +static DWORD devATIRageIIplus[] = { + 0x4755, // 3D RAGE II+ + 0x4756, // 3D RAGE IIC PQFP PCI + 0x4757, // 3D RAGE IIC BGA AGP + 0x475A, // 3D RAGE IIC PQFP AGP + 0x4C47, // 3D RAGE LT-G +}; + +// *********************************************************************** + +#ifndef _USE_GLD3_WGL +extern DGL_mesaFuncs mesaFuncs; +#endif + +extern DWORD dwLogging; + +#ifdef GLD_THREADS +#pragma message("compiling DGLCONTEXT.C vars for multi-threaded support") +CRITICAL_SECTION CriticalSection; // for serialized access +DWORD dwTLSCurrentContext = 0xFFFFFFFF; // TLS index for current context +DWORD dwTLSPixelFormat = 0xFFFFFFFF; // TLS index for current pixel format +#endif +HGLRC iCurrentContext = 0; // Index of current context (static) +BOOL bContextReady = FALSE; // Context state ready ? + +DGL_ctx ctxlist[DGL_MAX_CONTEXTS]; // Context list + +// *********************************************************************** + +static BOOL bHaveWin95 = FALSE; +static BOOL bHaveWinNT = FALSE; +static BOOL bHaveWin2K = FALSE; + +/**************************************************************************** +REMARKS: +Detect the installed OS type. +****************************************************************************/ +static void DetectOS(void) +{ + OSVERSIONINFO VersionInformation; + LPOSVERSIONINFO lpVersionInformation = &VersionInformation; + + VersionInformation.dwOSVersionInfoSize = sizeof(VersionInformation); + + GetVersionEx(lpVersionInformation); + + switch (VersionInformation.dwPlatformId) { + case VER_PLATFORM_WIN32_WINDOWS: + bHaveWin95 = TRUE; + bHaveWinNT = FALSE; + bHaveWin2K = FALSE; + break; + case VER_PLATFORM_WIN32_NT: + bHaveWin95 = FALSE; + if (VersionInformation.dwMajorVersion <= 4) { + bHaveWinNT = TRUE; + bHaveWin2K = FALSE; + } + else { + bHaveWinNT = FALSE; + bHaveWin2K = TRUE; + } + break; + case VER_PLATFORM_WIN32s: + bHaveWin95 = FALSE; + bHaveWinNT = FALSE; + bHaveWin2K = FALSE; + break; + } +} + +// *********************************************************************** + +HWND hWndEvent = NULL; // event monitor window +HWND hWndLastActive = NULL; // last active client window +LONG __stdcall GLD_EventWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam); + +// *********************************************************************** + +// Checks if the HGLRC is valid in range of context list. +BOOL dglIsValidContext( + HGLRC a) +{ + return ((int)a > 0 && (int)a <= DGL_MAX_CONTEXTS); +} + +// *********************************************************************** + +// Convert a HGLRC to a pointer into the context list. +DGL_ctx* dglGetContextAddress( + const HGLRC a) +{ + if (dglIsValidContext(a)) + return &ctxlist[(int)a-1]; + return NULL; +} + +// *********************************************************************** + +// Return the current HGLRC (however it may be stored for multi-threading). +HGLRC dglGetCurrentContext(void) +{ +#ifdef GLD_THREADS + HGLRC hGLRC; + // load from thread-specific instance + if (glb.bMultiThreaded) { + // protect against calls from arbitrary threads + __try { + hGLRC = (HGLRC)TlsGetValue(dwTLSCurrentContext); + } + __except(EXCEPTION_EXECUTE_HANDLER) { + hGLRC = iCurrentContext; + } + } + // load from global static var + else { + hGLRC = iCurrentContext; + } + return hGLRC; +#else + return iCurrentContext; +#endif +} + +// *********************************************************************** + +// Set the current HGLRC (however it may be stored for multi-threading). +void dglSetCurrentContext(HGLRC hGLRC) +{ +#ifdef GLD_THREADS + // store in thread-specific instance + if (glb.bMultiThreaded) { + // protect against calls from arbitrary threads + __try { + TlsSetValue(dwTLSCurrentContext, (LPVOID)hGLRC); + } + __except(EXCEPTION_EXECUTE_HANDLER) { + iCurrentContext = hGLRC; + } + } + // store in global static var + else { + iCurrentContext = hGLRC; + } +#else + iCurrentContext = hGLRC; +#endif +} + +// *********************************************************************** + +// Return the current HDC only for a currently active HGLRC. +HDC dglGetCurrentDC(void) +{ + HGLRC hGLRC; + DGL_ctx* lpCtx; + + hGLRC = dglGetCurrentContext(); + if (hGLRC) { + lpCtx = dglGetContextAddress(hGLRC); + return lpCtx->hDC; + } + return 0; +} + +// *********************************************************************** + +void dglInitContextState() +{ + int i; + WNDCLASS wc; + +#ifdef GLD_THREADS + // Allocate thread local storage indexes for current context and pixel format + dwTLSCurrentContext = TlsAlloc(); + dwTLSPixelFormat = TlsAlloc(); +#endif + + dglSetCurrentContext(NULL); // No current rendering context + + // Clear all context data + ZeroMemory(ctxlist, sizeof(ctxlist[0]) * DGL_MAX_CONTEXTS); + + for (i=0; ilpfnWndProc; + break; + } + } + // Not one of ours... + if (!lpfnWndProc) + return DefWindowProc(hwnd, msg, wParam, lParam); + + // Intercept messages amd process *before* passing on to window + switch (msg) { +#ifdef _USE_GLD3_WGL + case WM_DISPLAYCHANGE: + glb.bPixelformatsDirty = TRUE; + break; +#endif + case WM_ACTIVATEAPP: + glb.bAppActive = (BOOL)wParam; + ddlogPrintf(DDLOG_INFO, "Calling app has been %s", glb.bAppActive ? "activated" : "de-activated"); + break; + case WM_ERASEBKGND: + // Eat the GDI erase event for the GL window + if (!lpCtx || !lpCtx->bHasBeenCurrent) + break; + lpCtx->bGDIEraseBkgnd = TRUE; + return TRUE; + case WM_PAINT: + // Eat the invalidated update region if render scene is in progress + if (!lpCtx || !lpCtx->bHasBeenCurrent) + break; + if (lpCtx->bFrameStarted) { + if (GetUpdateRect(hwnd, &rect, FALSE)) { + BeginPaint(hwnd, &ps); + EndPaint(hwnd, &ps); + ValidateRect(hwnd, &rect); + return TRUE; + } + } + break; + } + // Call the appropriate window message handler + rc = CallWindowProc((WNDPROC)lpfnWndProc, hwnd, msg, wParam, lParam); + + // Intercept messages and process *after* passing on to window + switch (msg) { + case WM_QUIT: + case WM_DESTROY: + bQuit = TRUE; + if (lpCtx && lpCtx->bAllocated) { + ddlogPrintf(DDLOG_WARN, "WM_DESTROY detected for HWND=%X, HDC=%X, HGLRC=%d", hwnd, lpCtx->hDC, i+1); + dglDeleteContext((HGLRC)(i+1)); + } + break; +#if 0 + case WM_SIZE: + // Resize surfaces to fit window but not viewport (in case app did not bother) + if (!lpCtx || !lpCtx->bHasBeenCurrent) + break; + w = LOWORD(lParam); + h = HIWORD(lParam); + if (lpCtx->dwWidth < w || lpCtx->dwHeight < h) { + if (!dglWglResizeBuffers(lpCtx->glCtx, TRUE)) + dglWglResizeBuffers(lpCtx->glCtx, FALSE); + } + break; +#endif + } + + // If the main window is quitting, then so should we... + if (bMain && bQuit) { + ddlogPrintf(DDLOG_SYSTEM, "shutting down after WM_DESTROY detected for main HWND=%X", hwnd); + dglDeleteContextState(); + dglExitDriver(); + } + + return rc; +} + +// *********************************************************************** + +// Driver Window message handler +static LONG __stdcall GLD_EventWndProc( + HWND hwnd, + UINT msg, + WPARAM wParam, + LPARAM lParam) +{ + switch (msg) { + // May be sent by splash screen dialog on exit + case WM_ACTIVATE: + if (LOWORD(wParam) == WA_ACTIVE && glb.hWndActive) { + SetForegroundWindow(glb.hWndActive); + return 0; + } + break; + } + return DefWindowProc(hwnd, msg, wParam, lParam); +} + +// *********************************************************************** + +// Intercepted Keyboard handler for detecting hot keys. +LRESULT CALLBACK dglKeyProc( + int code, + WPARAM wParam, + LPARAM lParam) +{ + HWND hWnd, hWndFrame; + HGLRC hGLRC = NULL; + DGL_ctx* lpCtx = NULL; + int cmd = 0, dx1 = 0, dx2 = 0, i; + static BOOL bAltPressed = FALSE; + static BOOL bCtrlPressed = FALSE; + static BOOL bShiftPressed = FALSE; + RECT r, rf, rc; + POINT pt; + BOOL bForceReshape = FALSE; + + return CallNextHookEx(hKeyHook, code, wParam, lParam); +} + +// *********************************************************************** + +HWND hWndMatch; + +// Window handle enumeration procedure. +BOOL CALLBACK dglEnumChildProc( + HWND hWnd, + LPARAM lParam) +{ + RECT rect; + + // Find window handle with matching client rect. + GetClientRect(hWnd, &rect); + if (EqualRect(&rect, (RECT*)lParam)) { + hWndMatch = hWnd; + return FALSE; + } + // Continue with next child window. + return TRUE; +} + +// *********************************************************************** + +// Find window handle with matching client rect. +HWND dglFindWindowRect( + RECT* pRect) +{ + hWndMatch = NULL; + EnumChildWindows(GetForegroundWindow(), dglEnumChildProc, (LPARAM)pRect); + return hWndMatch; +} + +// *********************************************************************** +#ifndef _USE_GLD3_WGL +void dglChooseDisplayMode( + DGL_ctx *lpCtx) +{ + // Note: Choose an exact match if possible. + + int i; + DWORD area; + DWORD bestarea; + DDSURFACEDESC2 *lpDDSD = NULL; // Mode list pointer + DDSURFACEDESC2 *lpBestDDSD = NULL; // Pointer to best + + lpDDSD = glb.lpDisplayModes; + for (i=0; idwWidth == lpCtx->dwWidth) && + (lpDDSD->dwHeight == lpCtx->dwHeight)) + goto matched; // Mode has been exactly matched + // Choose modes that are larger in both dimensions than + // the window, but smaller in area than the current best. + if ( (lpDDSD->dwWidth >= lpCtx->dwWidth) && + (lpDDSD->dwHeight >= lpCtx->dwHeight)) + { + if (lpBestDDSD == NULL) { + lpBestDDSD = lpDDSD; + bestarea = lpDDSD->dwWidth * lpDDSD->dwHeight; + continue; + } + area = lpDDSD->dwWidth * lpDDSD->dwHeight; + if (area < bestarea) { + lpBestDDSD = lpDDSD; + bestarea = area; + } + } + } + + // Safety check + if (lpBestDDSD == NULL) { + ddlogMessage(DDLOG_CRITICAL, "dglChooseDisplayMode"); + return; + } + + lpCtx->dwModeWidth = lpBestDDSD->dwWidth; + lpCtx->dwModeHeight = lpBestDDSD->dwHeight; +matched: + ddlogPrintf(DDLOG_INFO, "Matched (%ldx%ld) to (%ldx%ld)", + lpCtx->dwWidth, lpCtx->dwHeight, lpCtx->dwModeWidth, lpCtx->dwModeHeight); +} +#endif // _USE_GLD3_WGL +// *********************************************************************** + +static BOOL IsDevice( + DWORD *lpDeviceIdList, + DWORD dwDeviceId, + int count) +{ + int i; + + for (i=0; ilpDD4 == NULL) { + // Testing for broken cards is sensitive area, so we don't want + // anything saying "broken cards" in the error message. ;) + ddlogMessage(DDLOG_ERROR, "Null DD4 passed to TFBC\n"); + return; + } + + // Microsoft really fucked up with the GetDeviceIdentifier function + // on Windows 2000, since it locks up on stock driers on the CD. Updated + // drivers from vendors appear to work, but we can't identify the drivers + // without this function!!! For now we skip these tests on Windows 2000. + if ((GetVersion() & 0x80000000UL) == 0) + return; + + // Obtain device info + if (FAILED(IDirectDraw4_GetDeviceIdentifier(lpCtx->lpDD4, &dddi, 0))) + return; + + // Useful info. Log it. + ddlogPrintf(DDLOG_INFO, "DirectDraw: VendorId=0x%x, DeviceId=0x%x", dddi.dwVendorId, dddi.dwDeviceId); + + // Vendor 1: ATI + if (dddi.dwVendorId == VENDORID_ATI) { + // Test A: ATI Rage PRO + if (IsDevice(devATIRagePro, dddi.dwDeviceId, sizeof(devATIRagePro))) + glb.bUseMipmaps = FALSE; + // Test B: ATI Rage II+ + if (IsDevice(devATIRageIIplus, dddi.dwDeviceId, sizeof(devATIRageIIplus))) + glb.bEmulateAlphaTest = TRUE; + } + + // Vendor 2: Matrox + if (dddi.dwVendorId == 0x102B) { + // Test: Matrox G400 stencil buffer support does not work for AutoCAD + if (dddi.dwDeviceId == 0x0525) { + lpCtx->lpPF->pfd.cStencilBits = 0; + if (lpCtx->lpPF->iZBufferPF != -1) { + glb.lpZBufferPF[lpCtx->lpPF->iZBufferPF].dwStencilBitDepth = 0; + glb.lpZBufferPF[lpCtx->lpPF->iZBufferPF].dwStencilBitMask = 0; + glb.lpZBufferPF[lpCtx->lpPF->iZBufferPF].dwFlags &= ~DDPF_STENCILBUFFER; + } + } + } +#endif // _GLD3 +} + +// *********************************************************************** + +BOOL dglCreateContextBuffers( + HDC a, + DGL_ctx *lpCtx, + BOOL bFallback) +{ + HRESULT hResult; + + int i; +// HGLRC hGLRC; +// DGL_ctx* lpCtx; + +#ifndef _USE_GLD3_WGL + DWORD dwFlags; + DDSURFACEDESC2 ddsd2; + DDSCAPS2 ddscaps2; + LPDIRECTDRAWCLIPPER lpddClipper; + D3DDEVICEDESC D3DHWDevDesc; // Direct3D Hardware description + D3DDEVICEDESC D3DHELDevDesc; // Direct3D Hardware Emulation Layer +#endif // _USE_GLD3_WGL + + float inv_aspect; + + GLenum bDoubleBuffer; // TRUE if double buffer required + GLenum bDepthBuffer; // TRUE if depth buffer required + + const PIXELFORMATDESCRIPTOR *lpPFD = &lpCtx->lpPF->pfd; + + // Vars for Mesa visual + DWORD dwDepthBits = 0; + DWORD dwStencilBits = 0; + DWORD dwAlphaBits = 0; + DWORD bAlphaSW = GL_FALSE; + DWORD bDouble = GL_FALSE; + + DDSURFACEDESC2 ddsd2DisplayMode; + BOOL bFullScrnWin = FALSE; // fullscreen-size window ? + DDBLTFX ddbltfx; + DWORD dwMemoryType = (bFallback) ? DDSCAPS_SYSTEMMEMORY : glb.dwMemoryType; + BOOL bBogusWindow = FALSE; // non-drawable window ? + DWORD dwColorRef = 0; // GDI background color + RECT rcDst; // GDI window rect + POINT pt; // GDI window point + + // Palette used for creating default global palette + PALETTEENTRY ppe[256]; + +#ifndef _USE_GLD3_WGL + // Vertex buffer description. Used for creation of vertex buffers + D3DVERTEXBUFFERDESC vbufdesc; +#endif // _USE_GLD3_WGL + +#define DDLOG_CRITICAL_OR_WARN (bFallback ? DDLOG_CRITICAL : DDLOG_WARN) + + ddlogPrintf(DDLOG_SYSTEM, "dglCreateContextBuffers for HDC=%X", a); + nContextError = GLDERR_NONE; + +#ifdef GLD_THREADS + // Serialize access to DirectDraw object creation or DDS start + if (glb.bMultiThreaded) + EnterCriticalSection(&CriticalSection); +#endif + + // Check for back buffer + bDoubleBuffer = GL_TRUE; //(lpPFD->dwFlags & PFD_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE; + // Since we always do back buffering, check if we emulate front buffering + lpCtx->EmulateSingle = + (lpPFD->dwFlags & PFD_DOUBLEBUFFER) ? FALSE : TRUE; +#if 0 // Don't have to mimic MS OpenGL behavior for front-buffering (DaveM) + lpCtx->EmulateSingle |= + (lpPFD->dwFlags & PFD_SUPPORT_GDI) ? TRUE : FALSE; +#endif + + // Check for depth buffer + bDepthBuffer = (lpPFD->cDepthBits) ? GL_TRUE : GL_FALSE; + + lpCtx->bDoubleBuffer = bDoubleBuffer; + lpCtx->bDepthBuffer = bDepthBuffer; + + // Set the Fullscreen flag for the context. +// lpCtx->bFullscreen = glb.bFullscreen; + + // Obtain the dimensions of the rendering window + lpCtx->hDC = a; // Cache DC + lpCtx->hWnd = WindowFromDC(lpCtx->hDC); + // Check for non-window DC = memory DC ? + if (lpCtx->hWnd == NULL) { + // bitmap memory contexts are always single-buffered + lpCtx->EmulateSingle = TRUE; + bBogusWindow = TRUE; + ddlogPrintf(DDLOG_INFO, "Non-Window Memory Device Context"); + if (GetClipBox(lpCtx->hDC, &lpCtx->rcScreenRect) == ERROR) { + ddlogMessage(DDLOG_WARN, "GetClipBox failed in dglCreateContext\n"); + SetRect(&lpCtx->rcScreenRect, 0, 0, 0, 0); + } + } + else if (!GetClientRect(lpCtx->hWnd, &lpCtx->rcScreenRect)) { + bBogusWindow = TRUE; + ddlogMessage(DDLOG_WARN, "GetClientRect failed in dglCreateContext\n"); + SetRect(&lpCtx->rcScreenRect, 0, 0, 0, 0); + } + lpCtx->dwWidth = lpCtx->rcScreenRect.right - lpCtx->rcScreenRect.left; + lpCtx->dwHeight = lpCtx->rcScreenRect.bottom - lpCtx->rcScreenRect.top; + + ddlogPrintf(DDLOG_INFO, "Input window %X: w=%i, h=%i", + lpCtx->hWnd, lpCtx->dwWidth, lpCtx->dwHeight); + + // What if app only zeroes one dimension instead of both? (DaveM) + if ( (lpCtx->dwWidth == 0) || (lpCtx->dwHeight == 0) ) { + // Make the buffer size something sensible + lpCtx->dwWidth = 8; + lpCtx->dwHeight = 8; + } + + // Set defaults + lpCtx->dwModeWidth = lpCtx->dwWidth; + lpCtx->dwModeHeight = lpCtx->dwHeight; +/* + // Find best display mode for fullscreen + if (glb.bFullscreen || !glb.bPrimary) { + dglChooseDisplayMode(lpCtx); + } +*/ + // Misc initialisation + lpCtx->bCanRender = FALSE; // No rendering allowed yet + lpCtx->bSceneStarted = FALSE; + lpCtx->bFrameStarted = FALSE; + + // Detect OS (specifically 'Windows 2000' or 'Windows XP') + DetectOS(); + + // NOTE: WinNT not supported + ddlogPrintf(DDLOG_INFO, "OS: %s", bHaveWin95 ? "Win9x" : (bHaveWin2K ? "Win2000/XP" : "Unsupported") ); + + // Test for Fullscreen + if (bHaveWin95) { // Problems with fullscreen on Win2K/XP + if ((GetSystemMetrics(SM_CXSCREEN) == lpCtx->dwWidth) && + (GetSystemMetrics(SM_CYSCREEN) == lpCtx->dwHeight)) + { + // Workaround for some apps that crash when going fullscreen. + //lpCtx->bFullscreen = TRUE; + } + + } + +#ifdef _USE_GLD3_WGL + _gldDriver.CreateDrawable(lpCtx, glb.bDirectDrawPersistant, glb.bPersistantBuffers); +#else + // Check if DirectDraw has already been created by original GLRC (DaveM) + if (glb.bDirectDrawPersistant && glb.bDirectDraw) { + lpCtx->lpDD4 = glb.lpDD4; + IDirectDraw4_AddRef(lpCtx->lpDD4); + goto SkipDirectDrawCreate; + } + + // Create DirectDraw object + if (glb.bPrimary) + hResult = DirectDrawCreate(NULL, &lpCtx->lpDD1, NULL); + else { + // A non-primary device is to be used. + // Force context to be Fullscreen, secondary adaptors can not + // be used in a window. + hResult = DirectDrawCreate(&glb.ddGuid, &lpCtx->lpDD1, NULL); + lpCtx->bFullscreen = TRUE; + } + if (FAILED(hResult)) { + MessageBox(NULL, "Unable to initialize DirectDraw", "GLDirect", MB_OK); + ddlogError(DDLOG_CRITICAL_OR_WARN, "Unable to create DirectDraw interface", hResult); + nContextError = GLDERR_DDRAW; + goto return_with_error; + } + + // Query for DX6 IDirectDraw4. + hResult = IDirectDraw_QueryInterface(lpCtx->lpDD1, + &IID_IDirectDraw4, + (void**)&lpCtx->lpDD4); + if (FAILED(hResult)) { + MessageBox(NULL, "GLDirect requires DirectX 6.0 or above", "GLDirect", MB_OK); + ddlogError(DDLOG_CRITICAL_OR_WARN, "Unable to create DirectDraw4 interface", hResult); + nContextError = GLDERR_DDRAW; + goto return_with_error; + } + + // Cache DirectDraw interface for subsequent GLRCs + if (glb.bDirectDrawPersistant && !glb.bDirectDraw) { + glb.lpDD4 = lpCtx->lpDD4; + IDirectDraw4_AddRef(glb.lpDD4); + glb.bDirectDraw = TRUE; + } +SkipDirectDrawCreate: + + // Now we have a DD4 interface we can check for broken cards + dglTestForBrokenCards(lpCtx); + + // Test if primary device can use flipping instead of blitting + ZeroMemory(&ddsd2DisplayMode, sizeof(ddsd2DisplayMode)); + ddsd2DisplayMode.dwSize = sizeof(ddsd2DisplayMode); + hResult = IDirectDraw4_GetDisplayMode( + lpCtx->lpDD4, + &ddsd2DisplayMode); + if (SUCCEEDED(hResult)) { + if ( (lpCtx->dwWidth == ddsd2DisplayMode.dwWidth) && + (lpCtx->dwHeight == ddsd2DisplayMode.dwHeight) ) { + // We have a fullscreen-size window + bFullScrnWin = TRUE; + // OK to use DirectDraw fullscreen mode ? + if (glb.bPrimary && !glb.bFullscreenBlit && !lpCtx->EmulateSingle && !glb.bDirectDrawPersistant) { + lpCtx->bFullscreen = TRUE; + ddlogMessage(DDLOG_INFO, "Primary upgraded to page flipping.\n"); + } + } + // Cache the display mode dimensions + lpCtx->dwModeWidth = ddsd2DisplayMode.dwWidth; + lpCtx->dwModeHeight = ddsd2DisplayMode.dwHeight; + } + + // Clamp the effective window dimensions to primary surface. + // We need to do this for D3D viewport dimensions even if wide + // surfaces are supported. This also is a good idea for handling + // whacked-out window dimensions passed for non-drawable windows + // like Solid Edge. (DaveM) + if (lpCtx->dwWidth > ddsd2DisplayMode.dwWidth) + lpCtx->dwWidth = ddsd2DisplayMode.dwWidth; + if (lpCtx->dwHeight > ddsd2DisplayMode.dwHeight) + lpCtx->dwHeight = ddsd2DisplayMode.dwHeight; + + // Check for non-RGB desktop resolution + if (!lpCtx->bFullscreen && ddsd2DisplayMode.ddpfPixelFormat.dwRGBBitCount <= 8) { + ddlogPrintf(DDLOG_CRITICAL_OR_WARN, "Desktop color depth %d bpp not supported", + ddsd2DisplayMode.ddpfPixelFormat.dwRGBBitCount); + nContextError = GLDERR_BPP; + goto return_with_error; + } +#endif // _USE_GLD3_WGL + + ddlogPrintf(DDLOG_INFO, "Window: w=%i, h=%i (%s)", + lpCtx->dwWidth, + lpCtx->dwHeight, + lpCtx->bFullscreen ? "fullscreen" : "windowed"); + +#ifndef _USE_GLD3_WGL + // Obtain ddraw caps + ZeroMemory(&lpCtx->ddCaps, sizeof(DDCAPS)); + lpCtx->ddCaps.dwSize = sizeof(DDCAPS); + if (glb.bHardware) { + // Get HAL caps + IDirectDraw4_GetCaps(lpCtx->lpDD4, &lpCtx->ddCaps, NULL); + } else { + // Get HEL caps + IDirectDraw4_GetCaps(lpCtx->lpDD4, NULL, &lpCtx->ddCaps); + } + + // If this flag is present then we can't default to Mesa + // SW rendering between BeginScene() and EndScene(). + if (lpCtx->ddCaps.dwCaps2 & DDCAPS2_NO2DDURING3DSCENE) { + ddlogMessage(DDLOG_INFO, + "Warning : No 2D allowed during 3D scene.\n"); + } + + // Query for DX6 Direct3D3 interface + hResult = IDirectDraw4_QueryInterface(lpCtx->lpDD4, + &IID_IDirect3D3, + (void**)&lpCtx->lpD3D3); + if (FAILED(hResult)) { + MessageBox(NULL, "Unable to initialize Direct3D", "GLDirect", MB_OK); + ddlogError(DDLOG_CRITICAL_OR_WARN, "Unable to create Direct3D interface", hResult); + nContextError = GLDERR_D3D; + goto return_with_error; + } + + // Context creation + if (lpCtx->bFullscreen) { + // FULLSCREEN + + // Disable warning popups when in fullscreen mode + ddlogWarnOption(FALSE); + + // Have to release persistant primary surface if fullscreen mode + if (glb.bDirectDrawPersistant && glb.bDirectDrawPrimary) { + RELEASE(glb.lpPrimary4); + glb.bDirectDrawPrimary = FALSE; + } + + dwFlags = DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT; + if (glb.bFastFPU) + dwFlags |= DDSCL_FPUSETUP; // fast FPU setup optional (DaveM) + hResult = IDirectDraw4_SetCooperativeLevel(lpCtx->lpDD4, lpCtx->hWnd, dwFlags); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "Unable to set Exclusive Fullscreen mode", hResult); + goto return_with_error; + } + + hResult = IDirectDraw4_SetDisplayMode(lpCtx->lpDD4, + lpCtx->dwModeWidth, + lpCtx->dwModeHeight, + lpPFD->cColorBits, + 0, + 0); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "SetDisplayMode failed", hResult); + goto return_with_error; + } + + // ** The display mode has changed, so dont use MessageBox! ** + + ZeroMemory(&ddsd2, sizeof(ddsd2)); + ddsd2.dwSize = sizeof(ddsd2); + + if (bDoubleBuffer) { + // Double buffered + // Primary surface + ddsd2.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + DDSCAPS_FLIP | + DDSCAPS_COMPLEX | + DDSCAPS_3DDEVICE | + dwMemoryType; + ddsd2.dwBackBufferCount = 1; + + hResult = IDirectDraw4_CreateSurface(lpCtx->lpDD4, &ddsd2, &lpCtx->lpFront4, NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "CreateSurface (primary) failed", hResult); + nContextError = GLDERR_MEM; + goto return_with_error; + } + + // Render target surface + ZeroMemory(&ddscaps2, sizeof(ddscaps2)); // Clear the entire struct. + ddscaps2.dwCaps = DDSCAPS_BACKBUFFER; + hResult = IDirectDrawSurface4_GetAttachedSurface(lpCtx->lpFront4, &ddscaps2, &lpCtx->lpBack4); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "GetAttachedSurface failed", hResult); + nContextError = GLDERR_MEM; + goto return_with_error; + } + } else { + // Single buffered + // Primary surface + ddsd2.dwFlags = DDSD_CAPS; + ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + //DDSCAPS_3DDEVICE | + dwMemoryType; + + hResult = IDirectDraw4_CreateSurface(lpCtx->lpDD4, &ddsd2, &lpCtx->lpFront4, NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "CreateSurface (primary) failed", hResult); + nContextError = GLDERR_MEM; + goto return_with_error; + } + + lpCtx->lpBack4 = NULL; + } + } else { + // WINDOWED + + // OK to enable warning popups in windowed mode + ddlogWarnOption(glb.bMessageBoxWarnings); + + dwFlags = DDSCL_NORMAL; + if (glb.bMultiThreaded) + dwFlags |= DDSCL_MULTITHREADED; + if (glb.bFastFPU) + dwFlags |= DDSCL_FPUSETUP; // fast FPU setup optional (DaveM) + hResult = IDirectDraw4_SetCooperativeLevel(lpCtx->lpDD4, + lpCtx->hWnd, + dwFlags); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "Unable to set Normal coop level", hResult); + goto return_with_error; + } + // Has Primary surface already been created for original GLRC ? + // Note this can only be applicable for windowed modes + if (glb.bDirectDrawPersistant && glb.bDirectDrawPrimary) { + lpCtx->lpFront4 = glb.lpPrimary4; + IDirectDrawSurface4_AddRef(lpCtx->lpFront4); + // Update the window on the default clipper + IDirectDrawSurface4_GetClipper(lpCtx->lpFront4, &lpddClipper); + IDirectDrawClipper_SetHWnd(lpddClipper, 0, lpCtx->hWnd); + IDirectDrawClipper_Release(lpddClipper); + goto SkipPrimaryCreate; + } + + // Primary surface + ZeroMemory(&ddsd2, sizeof(ddsd2)); + ddsd2.dwSize = sizeof(ddsd2); + ddsd2.dwFlags = DDSD_CAPS; + ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + hResult = IDirectDraw4_CreateSurface(lpCtx->lpDD4, &ddsd2, &lpCtx->lpFront4, NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "CreateSurface (primary) failed", hResult); + nContextError = GLDERR_MEM; + goto return_with_error; + } + + // Cache Primary surface for subsequent GLRCs + // Note this can only be applicable to subsequent windowed modes + if (glb.bDirectDrawPersistant && !glb.bDirectDrawPrimary) { + glb.lpPrimary4 = lpCtx->lpFront4; + IDirectDrawSurface4_AddRef(glb.lpPrimary4); + glb.bDirectDrawPrimary = TRUE; + } + + // Clipper object + hResult = DirectDrawCreateClipper(0, &lpddClipper, NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "CreateClipper failed", hResult); + goto return_with_error; + } + hResult = IDirectDrawClipper_SetHWnd(lpddClipper, 0, lpCtx->hWnd); + if (FAILED(hResult)) { + RELEASE(lpddClipper); + ddlogError(DDLOG_CRITICAL_OR_WARN, "SetHWnd failed", hResult); + goto return_with_error; + } + hResult = IDirectDrawSurface4_SetClipper(lpCtx->lpFront4, lpddClipper); + RELEASE(lpddClipper); // We have finished with it. + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "SetClipper failed", hResult); + goto return_with_error; + } +SkipPrimaryCreate: + + if (bDoubleBuffer) { + // Render target surface + ZeroMemory(&ddsd2, sizeof(ddsd2)); + ddsd2.dwSize = sizeof(ddsd2); + ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + ddsd2.dwWidth = lpCtx->dwWidth; + ddsd2.dwHeight = lpCtx->dwHeight; + ddsd2.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | + DDSCAPS_OFFSCREENPLAIN | + dwMemoryType; + + // Reserve the entire desktop size for persistant buffers option + if (glb.bDirectDrawPersistant && glb.bPersistantBuffers) { + ddsd2.dwWidth = ddsd2DisplayMode.dwWidth; + ddsd2.dwHeight = ddsd2DisplayMode.dwHeight; + } + // Re-use original back buffer if persistant buffers exist + if (glb.bDirectDrawPersistant && glb.bPersistantBuffers && glb.lpBack4) + hResult = IDirectDrawSurface4_AddRef(lpCtx->lpBack4 = glb.lpBack4); + else + hResult = IDirectDraw4_CreateSurface(lpCtx->lpDD4, &ddsd2, &lpCtx->lpBack4, NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "Create Backbuffer failed", hResult); + nContextError = GLDERR_MEM; + goto return_with_error; + } + if (glb.bDirectDrawPersistant && glb.bPersistantBuffers && !glb.lpBack4) + IDirectDrawSurface4_AddRef(glb.lpBack4 = lpCtx->lpBack4); + } else { + lpCtx->lpBack4 = NULL; + } + } + + // + // Now create the Z-buffer + // + lpCtx->bStencil = FALSE; // Default to no stencil buffer + if (bDepthBuffer && (lpCtx->lpPF->iZBufferPF != -1)) { + // Get z-buffer dimensions from the render target + // Setup the surface desc for the z-buffer. + ZeroMemory(&ddsd2, sizeof(ddsd2)); + ddsd2.dwSize = sizeof(ddsd2); + ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; + ddsd2.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | dwMemoryType; + ddsd2.dwWidth = lpCtx->dwWidth; + ddsd2.dwHeight = lpCtx->dwHeight; + memcpy(&ddsd2.ddpfPixelFormat, + &glb.lpZBufferPF[lpCtx->lpPF->iZBufferPF], + sizeof(DDPIXELFORMAT) ); + + // Reserve the entire desktop size for persistant buffers option + if (glb.bDirectDrawPersistant && glb.bPersistantBuffers) { + ddsd2.dwWidth = ddsd2DisplayMode.dwWidth; + ddsd2.dwHeight = ddsd2DisplayMode.dwHeight; + } + + // Create a z-buffer + if (glb.bDirectDrawPersistant && glb.bPersistantBuffers && glb.lpDepth4) + hResult = IDirectDrawSurface4_AddRef(lpCtx->lpDepth4 = glb.lpDepth4); + else + hResult = IDirectDraw4_CreateSurface(lpCtx->lpDD4, &ddsd2, &lpCtx->lpDepth4, NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "CreateSurface (ZBuffer) failed", hResult); + nContextError = GLDERR_MEM; + goto return_with_error; + } + if (glb.bDirectDrawPersistant && glb.bPersistantBuffers && !glb.lpDepth4) + IDirectDrawSurface4_AddRef(glb.lpDepth4 = lpCtx->lpDepth4); + else if (glb.bDirectDrawPersistant && glb.bPersistantBuffers && glb.lpDepth4 && glb.lpBack4) + IDirectDrawSurface4_DeleteAttachedSurface(glb.lpBack4, 0, glb.lpDepth4); + + // Attach Zbuffer to render target + TRY(IDirectDrawSurface4_AddAttachedSurface( + bDoubleBuffer ? lpCtx->lpBack4 : lpCtx->lpFront4, + lpCtx->lpDepth4), + "dglCreateContext: Attach Zbuffer"); + if (glb.lpZBufferPF[lpCtx->lpPF->iZBufferPF].dwFlags & DDPF_STENCILBUFFER) { + lpCtx->bStencil = TRUE; + ddlogMessage(DDLOG_INFO, "Depth buffer has stencil\n"); + } + } + + // Clear all back buffers and Z-buffers in case of memory recycling. + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + IDirectDrawSurface4_Blt(lpCtx->lpBack4, NULL, NULL, NULL, + DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); + if (lpCtx->lpDepth4) + IDirectDrawSurface4_Blt(lpCtx->lpDepth4, NULL, NULL, NULL, + DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); + + // Now that we have a Z-buffer we can create the 3D device + hResult = IDirect3D3_CreateDevice(lpCtx->lpD3D3, + &glb.d3dGuid, + bDoubleBuffer ? lpCtx->lpBack4 : lpCtx->lpFront4, + &lpCtx->lpDev3, + NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "Unable to create Direct3D device", hResult); + nContextError = GLDERR_D3D; + goto return_with_error; + } + + // We must do this as soon as the device is created + dglInitStateCaches(lpCtx); + + // Obtain the D3D Device Description + D3DHWDevDesc.dwSize = D3DHELDevDesc.dwSize = sizeof(D3DDEVICEDESC); + TRY(IDirect3DDevice3_GetCaps(lpCtx->lpDev3, + &D3DHWDevDesc, + &D3DHELDevDesc), + "dglCreateContext: GetCaps failed"); + + // Choose the relevant description and cache it in the context. + // We will use this description later for caps checking + memcpy( &lpCtx->D3DDevDesc, + glb.bHardware ? &D3DHWDevDesc : &D3DHELDevDesc, + sizeof(D3DDEVICEDESC)); + + // Now we can examine the texture formats + if (!dglBuildTextureFormatList(lpCtx->lpDev3)) { + ddlogMessage(DDLOG_CRITICAL_OR_WARN, "dglBuildTextureFormatList failed\n"); + goto return_with_error; + } + + // Get the pixel format of the back buffer + lpCtx->ddpfRender.dwSize = sizeof(lpCtx->ddpfRender); + if (bDoubleBuffer) + hResult = IDirectDrawSurface4_GetPixelFormat( + lpCtx->lpBack4, + &lpCtx->ddpfRender); + else + hResult = IDirectDrawSurface4_GetPixelFormat( + lpCtx->lpFront4, + &lpCtx->ddpfRender); + + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "GetPixelFormat failed", hResult); + goto return_with_error; + } + // Find a pixel packing function suitable for this surface + pxClassifyPixelFormat(&lpCtx->ddpfRender, + &lpCtx->fnPackFunc, + &lpCtx->fnUnpackFunc, + &lpCtx->fnPackSpanFunc); + + // Viewport + hResult = IDirect3D3_CreateViewport(lpCtx->lpD3D3, &lpCtx->lpViewport3, NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "CreateViewport failed", hResult); + goto return_with_error; + } + + hResult = IDirect3DDevice3_AddViewport(lpCtx->lpDev3, lpCtx->lpViewport3); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "AddViewport failed", hResult); + goto return_with_error; + } + + // Initialise the viewport + // Note screen coordinates are used for viewport clipping since D3D + // transform operations are not used in the GLD CAD driver. (DaveM) + inv_aspect = (float)lpCtx->dwHeight/(float)lpCtx->dwWidth; + + lpCtx->d3dViewport.dwSize = sizeof(lpCtx->d3dViewport); + lpCtx->d3dViewport.dwX = 0; + lpCtx->d3dViewport.dwY = 0; + lpCtx->d3dViewport.dwWidth = lpCtx->dwWidth; + lpCtx->d3dViewport.dwHeight = lpCtx->dwHeight; + lpCtx->d3dViewport.dvClipX = 0; // -1.0f; + lpCtx->d3dViewport.dvClipY = 0; // inv_aspect; + lpCtx->d3dViewport.dvClipWidth = lpCtx->dwWidth; // 2.0f; + lpCtx->d3dViewport.dvClipHeight = lpCtx->dwHeight; // 2.0f * inv_aspect; + lpCtx->d3dViewport.dvMinZ = 0.0f; + lpCtx->d3dViewport.dvMaxZ = 1.0f; + TRY(IDirect3DViewport3_SetViewport2(lpCtx->lpViewport3, &lpCtx->d3dViewport), "dglCreateContext: SetViewport2"); + + hResult = IDirect3DDevice3_SetCurrentViewport(lpCtx->lpDev3, lpCtx->lpViewport3); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "SetCurrentViewport failed", hResult); + goto return_with_error; + } + + lpCtx->dwBPP = lpPFD->cColorBits; + lpCtx->iZBufferPF = lpCtx->lpPF->iZBufferPF; + + // Set last texture to NULL + for (i=0; iColorOp[i] = D3DTOP_DISABLE; + lpCtx->AlphaOp[i] = D3DTOP_DISABLE; + lpCtx->tObj[i] = NULL; + } + + // Default to perspective correct texture mapping + dglSetRenderState(lpCtx, D3DRENDERSTATE_TEXTUREPERSPECTIVE, TRUE, "TexturePersp"); + + // Set the default culling mode + lpCtx->cullmode = D3DCULL_NONE; + dglSetRenderState(lpCtx, D3DRENDERSTATE_CULLMODE, D3DCULL_NONE, "CullMode"); + + // Disable specular + dglSetRenderState(lpCtx, D3DRENDERSTATE_SPECULARENABLE, FALSE, "SpecularEnable"); + // Disable subpixel correction +// dglSetRenderState(lpCtx, D3DRENDERSTATE_SUBPIXEL, FALSE, "SubpixelEnable"); + // Disable dithering + dglSetRenderState(lpCtx, D3DRENDERSTATE_DITHERENABLE, FALSE, "DitherEnable"); + + // Initialise the primitive caches +// lpCtx->dwNextLineVert = 0; +// lpCtx->dwNextTriVert = 0; + + // Init the global texture palette + lpCtx->lpGlobalPalette = NULL; + + // Init the HW/SW usage counters +// lpCtx->dwHWUsageCount = lpCtx->dwSWUsageCount = 0L; + + // + // Create two D3D vertex buffers. + // One will hold the pre-transformed data with the other one + // being used to hold the post-transformed & clipped verts. + // +#if 0 // never used (DaveM) + vbufdesc.dwSize = sizeof(D3DVERTEXBUFFERDESC); + vbufdesc.dwCaps = D3DVBCAPS_WRITEONLY; + if (glb.bHardware == FALSE) + vbufdesc.dwCaps = D3DVBCAPS_SYSTEMMEMORY; + vbufdesc.dwNumVertices = 32768; // For the time being + + // Source vertex buffer + vbufdesc.dwFVF = DGL_LVERTEX; + hResult = IDirect3D3_CreateVertexBuffer(lpCtx->lpD3D3, &vbufdesc, &lpCtx->m_vbuf, 0, NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "CreateVertexBuffer(src) failed", hResult); + goto return_with_error; + } + + // Destination vertex buffer + vbufdesc.dwFVF = (glb.bMultitexture == FALSE) ? D3DFVF_TLVERTEX : (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX2); + hResult = IDirect3D3_CreateVertexBuffer(lpCtx->lpD3D3, &vbufdesc, &lpCtx->m_pvbuf, 0, NULL); + if(FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "CreateVertexBuffer(dst) failed", hResult); + goto return_with_error; + } +#endif + +#endif _USE_GLD3_WGL + + // + // Now create the Mesa context + // + + // Create the Mesa visual + if (lpPFD->cDepthBits) + dwDepthBits = 16; + if (lpPFD->cStencilBits) + dwStencilBits = 8; + if (lpPFD->cAlphaBits) { + dwAlphaBits = 8; + bAlphaSW = GL_TRUE; + } + if (lpPFD->dwFlags & PFD_DOUBLEBUFFER) + bDouble = GL_TRUE; +// lpCtx->EmulateSingle = +// (lpPFD->dwFlags & PFD_DOUBLEBUFFER) ? FALSE : TRUE; + +#ifdef _USE_GLD3_WGL + lpCtx->glVis = _mesa_create_visual( + GL_TRUE, // RGB mode + bDouble, /* double buffer */ + GL_FALSE, // stereo + lpPFD->cRedBits, + lpPFD->cGreenBits, + lpPFD->cBlueBits, + dwAlphaBits, + 0, // index bits + dwDepthBits, + dwStencilBits, + lpPFD->cAccumRedBits, // accum bits + lpPFD->cAccumGreenBits, // accum bits + lpPFD->cAccumBlueBits, // accum bits + lpPFD->cAccumAlphaBits, // accum alpha bits + 1 // num samples + ); +#else // _USE_GLD3_WGL + lpCtx->glVis = (*mesaFuncs.gl_create_visual)( + GL_TRUE, // RGB mode + bAlphaSW, // Is an alpha buffer required? + bDouble, // Is an double-buffering required? + GL_FALSE, // stereo + dwDepthBits, // depth_size + dwStencilBits, // stencil_size + lpPFD->cAccumBits, // accum_size + 0, // colour-index bits + lpPFD->cRedBits, // Red bit count + lpPFD->cGreenBits, // Green bit count + lpPFD->cBlueBits, // Blue bit count + dwAlphaBits // Alpha bit count + ); +#endif // _USE_GLD3_WGL + + if (lpCtx->glVis == NULL) { + ddlogMessage(DDLOG_CRITICAL_OR_WARN, "gl_create_visual failed\n"); + goto return_with_error; + } + +#ifdef _USE_GLD3_WGL + lpCtx->glCtx = _mesa_create_context(lpCtx->glVis, NULL, (void *)lpCtx, GL_TRUE); +#else + // Create the Mesa context + lpCtx->glCtx = (*mesaFuncs.gl_create_context)( + lpCtx->glVis, // Mesa visual + NULL, // share list context + (void *)lpCtx, // Pointer to our driver context + GL_TRUE // Direct context flag + ); +#endif // _USE_GLD3_WGL + + if (lpCtx->glCtx == NULL) { + ddlogMessage(DDLOG_CRITICAL_OR_WARN, "gl_create_context failed\n"); + goto return_with_error; + } + + // Create the Mesa framebuffer +#ifdef _USE_GLD3_WGL + lpCtx->glBuffer = _mesa_create_framebuffer( + lpCtx->glVis, + lpCtx->glVis->depthBits > 0, + lpCtx->glVis->stencilBits > 0, + lpCtx->glVis->accumRedBits > 0, + GL_FALSE //swalpha + ); +#else + lpCtx->glBuffer = (*mesaFuncs.gl_create_framebuffer)(lpCtx->glVis); +#endif // _USE_GLD3_WGL + + if (lpCtx->glBuffer == NULL) { + ddlogMessage(DDLOG_CRITICAL_OR_WARN, "gl_create_framebuffer failed\n"); + goto return_with_error; + } + +#ifdef _USE_GLD3_WGL + // Init Mesa internals + _swrast_CreateContext( lpCtx->glCtx ); + _ac_CreateContext( lpCtx->glCtx ); + _tnl_CreateContext( lpCtx->glCtx ); + _swsetup_CreateContext( lpCtx->glCtx ); + + _gldDriver.InitialiseMesa(lpCtx); + + lpCtx->glCtx->imports.warning = _gld_mesa_warning; + lpCtx->glCtx->imports.fatal = _gld_mesa_fatal; + +#else + // Tell Mesa how many texture stages we have + glb.wMaxSimultaneousTextures = lpCtx->D3DDevDesc.wMaxSimultaneousTextures; + // Only use as many Units as the spec requires + if (glb.wMaxSimultaneousTextures > MAX_TEXTURE_UNITS) + glb.wMaxSimultaneousTextures = MAX_TEXTURE_UNITS; + lpCtx->glCtx->Const.MaxTextureUnits = glb.wMaxSimultaneousTextures; + ddlogPrintf(DDLOG_INFO, "Texture stages : %d", glb.wMaxSimultaneousTextures); + + // Set the max texture size. + // NOTE: clamped to a max of 1024 for extra performance! + lpCtx->dwMaxTextureSize = (lpCtx->D3DDevDesc.dwMaxTextureWidth <= 1024) ? lpCtx->D3DDevDesc.dwMaxTextureWidth : 1024; + +// Texture resize takes place elsewhere. KH +// NOTE: This was added to workaround an issue with the Intel app. +#if 0 + lpCtx->glCtx->Const.MaxTextureSize = lpCtx->dwMaxTextureSize; +#else + lpCtx->glCtx->Const.MaxTextureSize = 1024; +#endif + + // Setup the Display Driver pointers + dglSetupDDPointers(lpCtx->glCtx); + + // Initialise all the Direct3D renderstates + dglInitStateD3D(lpCtx->glCtx); + +#if 0 + // Signal a reload of texture state on next glBegin + lpCtx->m_texHandleValid = FALSE; + lpCtx->m_mtex = FALSE; + lpCtx->m_texturing = FALSE; +#else + // Set default texture unit state +// dglSetTexture(lpCtx, 0, NULL); +// dglSetTexture(lpCtx, 1, NULL); +#endif + + // + // Set the global texture palette to default values. + // + + // Clear the entire palette + ZeroMemory(ppe, sizeof(PALETTEENTRY) * 256); + + // Fill the palette with a default colour. + // A garish colour is used to catch bugs. Here Magenta is used. + for (i=0; i < 256; i++) { + ppe[i].peRed = 255; + ppe[i].peGreen = 0; + ppe[i].peBlue = 255; + } + + RELEASE(lpCtx->lpGlobalPalette); + + if (glb.bDirectDrawPersistant && glb.bPersistantBuffers && glb.lpGlobalPalette) + hResult = IDirectDrawPalette_AddRef(lpCtx->lpGlobalPalette = glb.lpGlobalPalette); + else + hResult = IDirectDraw4_CreatePalette( + lpCtx->lpDD4, + DDPCAPS_INITIALIZE | DDPCAPS_8BIT | DDPCAPS_ALLOW256, + ppe, + &(lpCtx->lpGlobalPalette), + NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_ERROR, "Default CreatePalette failed\n", hResult); + lpCtx->lpGlobalPalette = NULL; + goto return_with_error; + } + if (glb.bDirectDrawPersistant && glb.bPersistantBuffers && !glb.lpGlobalPalette) + IDirectDrawPalette_AddRef(glb.lpGlobalPalette = lpCtx->lpGlobalPalette); + +#endif // _USE_GLD3_WGL + + // ** If we have made it to here then we can enable rendering ** + lpCtx->bCanRender = TRUE; + +// ddlogMessage(DDLOG_SYSTEM, "dglCreateContextBuffers succeded\n"); + +#ifdef GLD_THREADS + // Release serialized access + if (glb.bMultiThreaded) + LeaveCriticalSection(&CriticalSection); +#endif + + return TRUE; + +return_with_error: + // Clean up before returning. + // This is critical for secondary devices. + + lpCtx->bCanRender = FALSE; + +#ifdef _USE_GLD3_WGL + // Destroy the Mesa context + if (lpCtx->glBuffer) + _mesa_destroy_framebuffer(lpCtx->glBuffer); + if (lpCtx->glCtx) + _mesa_destroy_context(lpCtx->glCtx); + if (lpCtx->glVis) + _mesa_destroy_visual(lpCtx->glVis); + + // Destroy driver data + _gldDriver.DestroyDrawable(lpCtx); +#else + // Destroy the Mesa context + if (lpCtx->glBuffer) + (*mesaFuncs.gl_destroy_framebuffer)(lpCtx->glBuffer); + if (lpCtx->glCtx) + (*mesaFuncs.gl_destroy_context)(lpCtx->glCtx); + if (lpCtx->glVis) + (*mesaFuncs.gl_destroy_visual)(lpCtx->glVis); + + RELEASE(lpCtx->m_pvbuf); // Release D3D vertex buffer + RELEASE(lpCtx->m_vbuf); // Release D3D vertex buffer + + if (lpCtx->lpViewport3) { + if (lpCtx->lpDev3) IDirect3DDevice3_DeleteViewport(lpCtx->lpDev3, lpCtx->lpViewport3); + RELEASE(lpCtx->lpViewport3); + lpCtx->lpViewport3 = NULL; + } + + RELEASE(lpCtx->lpDev3); + if (lpCtx->lpDepth4) { + if (lpCtx->lpBack4) + IDirectDrawSurface4_DeleteAttachedSurface(lpCtx->lpBack4, 0L, lpCtx->lpDepth4); + else + IDirectDrawSurface4_DeleteAttachedSurface(lpCtx->lpFront4, 0L, lpCtx->lpDepth4); + RELEASE(lpCtx->lpDepth4); + lpCtx->lpDepth4 = NULL; + } + RELEASE(lpCtx->lpBack4); + RELEASE(lpCtx->lpFront4); + else + if (lpCtx->bFullscreen) { + IDirectDraw4_RestoreDisplayMode(lpCtx->lpDD4); + IDirectDraw4_SetCooperativeLevel(lpCtx->lpDD4, NULL, DDSCL_NORMAL); + } + RELEASE(lpCtx->lpD3D3); + RELEASE(lpCtx->lpDD4); + RELEASE(lpCtx->lpDD1); +#endif // _USE_GLD3_WGL + + lpCtx->bAllocated = FALSE; + +#ifdef GLD_THREADS + // Release serialized access + if (glb.bMultiThreaded) + LeaveCriticalSection(&CriticalSection); +#endif + + return FALSE; + +#undef DDLOG_CRITICAL_OR_WARN +} + +// *********************************************************************** + +HGLRC dglCreateContext( + HDC a, + const DGL_pixelFormat *lpPF) +{ + int i; + HGLRC hGLRC; + DGL_ctx* lpCtx; + static BOOL bWarnOnce = TRUE; + DWORD dwThreadId = GetCurrentThreadId(); + char szMsg[256]; + HWND hWnd; + LONG lpfnWndProc; + + // Validate license + if (!dglValidate()) + return NULL; + + // Is context state ready ? + if (!bContextReady) + return NULL; + + ddlogPrintf(DDLOG_SYSTEM, "dglCreateContext for HDC=%X, ThreadId=%X", a, dwThreadId); + + // Find next free context. + // Also ensure that only one Fullscreen context is created at any one time. + hGLRC = 0; // Default to Not Found + for (i=0; ibAllocated = TRUE; + // Flag that buffers need creating on next wglMakeCurrent call. + lpCtx->bHasBeenCurrent = FALSE; + lpCtx->lpPF = (DGL_pixelFormat *)lpPF; // cache pixel format + lpCtx->bCanRender = FALSE; + + // Create all the internal resources here, not in dglMakeCurrent(). + // We do a re-size check in dglMakeCurrent in case of re-allocations. (DaveM) + // We now try context allocations twice, first with video memory, + // then again with system memory. This is similar to technique + // used for dglWglResizeBuffers(). (DaveM) + if (lpCtx->bHasBeenCurrent == FALSE) { + if (!dglCreateContextBuffers(a, lpCtx, FALSE)) { + if (glb.bMessageBoxWarnings && bWarnOnce && dwLogging) { + bWarnOnce = FALSE; + switch (nContextError) { + case GLDERR_DDRAW: strcpy(szMsg, szDDrawWarning); break; + case GLDERR_D3D: strcpy(szMsg, szD3DWarning); break; + case GLDERR_MEM: strcpy(szMsg, szResourceWarning); break; + case GLDERR_BPP: strcpy(szMsg, szBPPWarning); break; + default: strcpy(szMsg, ""); + } + if (strlen(szMsg)) + MessageBox(NULL, szMsg, "GLDirect", MB_OK | MB_ICONWARNING); + } + // Only need to try again if memory error + if (nContextError == GLDERR_MEM) { + ddlogPrintf(DDLOG_WARN, "dglCreateContext failed 1st time with video memory"); + } + else { + ddlogPrintf(DDLOG_ERROR, "dglCreateContext failed"); + return NULL; + } + } + } + + // Now that we have a hWnd, we can intercept the WindowProc. + hWnd = lpCtx->hWnd; + if (hWnd) { + // Only hook individual window handler once if not hooked before. + lpfnWndProc = GetWindowLong(hWnd, GWL_WNDPROC); + if (lpfnWndProc != (LONG)dglWndProc) { + lpCtx->lpfnWndProc = lpfnWndProc; + SetWindowLong(hWnd, GWL_WNDPROC, (LONG)dglWndProc); + } + // Find the parent window of the app too. + if (glb.hWndActive == NULL) { + while (hWnd != NULL) { + glb.hWndActive = hWnd; + hWnd = GetParent(hWnd); + } + // Hook the parent window too. + lpfnWndProc = GetWindowLong(glb.hWndActive, GWL_WNDPROC); + if (glb.hWndActive == lpCtx->hWnd) + glb.lpfnWndProc = lpCtx->lpfnWndProc; + else if (lpfnWndProc != (LONG)dglWndProc) + glb.lpfnWndProc = lpfnWndProc; + if (glb.lpfnWndProc) + SetWindowLong(glb.hWndActive, GWL_WNDPROC, (LONG)dglWndProc); + } + } + + ddlogPrintf(DDLOG_SYSTEM, "dglCreateContext succeeded for HGLRC=%d", (int)hGLRC); + + return hGLRC; +} + +// *********************************************************************** +// Make a DirectGL context current +// Used by wgl functions and dgl functions +BOOL dglMakeCurrent( + HDC a, + HGLRC b) +{ + int context; + DGL_ctx* lpCtx; + HWND hWnd; + BOOL bNeedResize = FALSE; + BOOL bWindowChanged, bContextChanged; + LPDIRECTDRAWCLIPPER lpddClipper; + DWORD dwThreadId = GetCurrentThreadId(); + LONG lpfnWndProc; + + // Validate license + if (!dglValidate()) + return FALSE; + + // Is context state ready ? + if (!bContextReady) + return FALSE; + + context = (int)b; // This is as a result of STRICT! + ddlogPrintf(DDLOG_SYSTEM, "dglMakeCurrent: HDC=%X, HGLRC=%d, ThreadId=%X", a, context, dwThreadId); + + // If the HGLRC is NULL then make no context current; + // Ditto if the HDC is NULL either. (DaveM) + if (context == 0 || a == 0) { + // Corresponding Mesa operation +#ifdef _USE_GLD3_WGL + _mesa_make_current(NULL, NULL); +#else + (*mesaFuncs.gl_make_current)(NULL, NULL); +#endif + dglSetCurrentContext(0); + return TRUE; + } + + // Make sure the HGLRC is in range + if ((context > DGL_MAX_CONTEXTS) || (context < 0)) { + ddlogMessage(DDLOG_ERROR, "dglMakeCurrent: HGLRC out of range\n"); + return FALSE; + } + + // Find address of context and make sure that it has been allocated + lpCtx = dglGetContextAddress(b); + if (!lpCtx->bAllocated) { + ddlogMessage(DDLOG_ERROR, "dglMakeCurrent: Context not allocated\n"); +// return FALSE; + return TRUE; // HACK: Shuts up "WebLab Viewer Pro". KeithH + } + +#ifdef GLD_THREADS + // Serialize access to DirectDraw or DDS operations + if (glb.bMultiThreaded) + EnterCriticalSection(&CriticalSection); +#endif + + // Check if window has changed + hWnd = (a != lpCtx->hDC) ? WindowFromDC(a) : lpCtx->hWnd; + bWindowChanged = (hWnd != lpCtx->hWnd) ? TRUE : FALSE; + bContextChanged = (b != dglGetCurrentContext()) ? TRUE : FALSE; + + // If the window has changed, make sure the clipper is updated. (DaveM) + if (glb.bDirectDrawPersistant && !lpCtx->bFullscreen && (bWindowChanged || bContextChanged)) { + lpCtx->hWnd = hWnd; +#ifndef _USE_GLD3_WGL + IDirectDrawSurface4_GetClipper(lpCtx->lpFront4, &lpddClipper); + IDirectDrawClipper_SetHWnd(lpddClipper, 0, lpCtx->hWnd); + IDirectDrawClipper_Release(lpddClipper); +#endif // _USE_GLD3_WGL + } + + // Make sure hDC and hWnd is current. (DaveM) + // Obtain the dimensions of the rendering window + lpCtx->hDC = a; // Cache DC + lpCtx->hWnd = hWnd; + hWndLastActive = hWnd; + + // Check for non-window DC = memory DC ? + if (hWnd == NULL) { + if (GetClipBox(a, &lpCtx->rcScreenRect) == ERROR) { + ddlogMessage(DDLOG_WARN, "GetClipBox failed in dglMakeCurrent\n"); + SetRect(&lpCtx->rcScreenRect, 0, 0, 0, 0); + } + } + else if (!GetClientRect(lpCtx->hWnd, &lpCtx->rcScreenRect)) { + ddlogMessage(DDLOG_WARN, "GetClientRect failed in dglMakeCurrent\n"); + SetRect(&lpCtx->rcScreenRect, 0, 0, 0, 0); + } + // Check if buffers need to be re-sized; + // If so, wait until Mesa GL stuff is setup before re-sizing; + if (lpCtx->dwWidth != lpCtx->rcScreenRect.right - lpCtx->rcScreenRect.left || + lpCtx->dwHeight != lpCtx->rcScreenRect.bottom - lpCtx->rcScreenRect.top) + bNeedResize = TRUE; + + // Now we can update our globals + dglSetCurrentContext(b); + + // Corresponding Mesa operation +#ifdef _USE_GLD3_WGL + _mesa_make_current(lpCtx->glCtx, lpCtx->glBuffer); + lpCtx->glCtx->Driver.UpdateState(lpCtx->glCtx, _NEW_ALL); + if (bNeedResize) { + // Resize buffers (Note Mesa GL needs to be setup beforehand); + // Resize Mesa internal buffer too via glViewport() command, + // which subsequently calls dglWglResizeBuffers() too. + lpCtx->glCtx->Driver.Viewport(lpCtx->glCtx, 0, 0, lpCtx->dwWidth, lpCtx->dwHeight); + lpCtx->bHasBeenCurrent = TRUE; + } +#else + (*mesaFuncs.gl_make_current)(lpCtx->glCtx, lpCtx->glBuffer); + + dglSetupDDPointers(lpCtx->glCtx); + + // Insure DirectDraw surfaces fit current window DC + if (bNeedResize) { + // Resize buffers (Note Mesa GL needs to be setup beforehand); + // Resize Mesa internal buffer too via glViewport() command, + // which subsequently calls dglWglResizeBuffers() too. + (*mesaFuncs.gl_Viewport)(lpCtx->glCtx, 0, 0, lpCtx->dwWidth, lpCtx->dwHeight); + lpCtx->bHasBeenCurrent = TRUE; + } +#endif // _USE_GLD3_WGL + ddlogPrintf(DDLOG_SYSTEM, "dglMakeCurrent: width = %d, height = %d", lpCtx->dwWidth, lpCtx->dwHeight); + + // We have to clear D3D back buffer and render state if emulated front buffering + // for different window (but not context) like in Solid Edge. + if (glb.bDirectDrawPersistant && glb.bPersistantBuffers + && (bWindowChanged /* || bContextChanged */) && lpCtx->EmulateSingle) { +#ifdef _USE_GLD3_WGL +// IDirect3DDevice8_EndScene(lpCtx->pDev); +// lpCtx->bSceneStarted = FALSE; + lpCtx->glCtx->Driver.Clear(lpCtx->glCtx, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, + GL_TRUE, 0, 0, lpCtx->dwWidth, lpCtx->dwHeight); +#else + IDirect3DDevice3_EndScene(lpCtx->lpDev3); + lpCtx->bSceneStarted = FALSE; + dglClearD3D(lpCtx->glCtx, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, + GL_TRUE, 0, 0, lpCtx->dwWidth, lpCtx->dwHeight); +#endif // _USE_GLD3_WGL + } + + // The first time we call MakeCurrent we set the initial viewport size + if (lpCtx->bHasBeenCurrent == FALSE) +#ifdef _USE_GLD3_WGL + lpCtx->glCtx->Driver.Viewport(lpCtx->glCtx, 0, 0, lpCtx->dwWidth, lpCtx->dwHeight); +#else + (*mesaFuncs.gl_Viewport)(lpCtx->glCtx, 0, 0, lpCtx->dwWidth, lpCtx->dwHeight); +#endif // _USE_GLD3_WGL + lpCtx->bHasBeenCurrent = TRUE; + +#ifdef GLD_THREADS + // Release serialized access + if (glb.bMultiThreaded) + LeaveCriticalSection(&CriticalSection); +#endif + + return TRUE; +} + +// *********************************************************************** + +BOOL dglDeleteContext( + HGLRC a) +{ + DGL_ctx* lpCtx; + DWORD dwThreadId = GetCurrentThreadId(); + char argstr[256]; + +#if 0 // We have enough trouble throwing exceptions as it is... (DaveM) + // Validate license + if (!dglValidate()) + return FALSE; +#endif + + // Is context state ready ? + if (!bContextReady) + return FALSE; + + ddlogPrintf(DDLOG_SYSTEM, "dglDeleteContext: Deleting context HGLRC=%d, ThreadId=%X", (int)a, dwThreadId); + + // Make sure the HGLRC is in range + if (((int) a> DGL_MAX_CONTEXTS) || ((int)a < 0)) { + ddlogMessage(DDLOG_ERROR, "dglDeleteCurrent: HGLRC out of range\n"); + return FALSE; + } + + // Make sure context is valid + lpCtx = dglGetContextAddress(a); + if (!lpCtx->bAllocated) { + ddlogPrintf(DDLOG_WARN, "Tried to delete unallocated context HGLRC=%d", (int)a); +// return FALSE; + return TRUE; // HACK: Shuts up "WebLab Viewer Pro". KeithH + } + + // Make sure context is de-activated + if (a == dglGetCurrentContext()) { + ddlogPrintf(DDLOG_WARN, "dglDeleteContext: context HGLRC=%d still active", (int)a); + dglMakeCurrent(NULL, NULL); + } + +#ifdef GLD_THREADS + // Serialize access to DirectDraw or DDS operations + if (glb.bMultiThreaded) + EnterCriticalSection(&CriticalSection); +#endif + + // We are about to destroy all Direct3D objects. + // Therefore we must disable rendering + lpCtx->bCanRender = FALSE; + + // This exception handler was installed to catch some + // particularly nasty apps. Console apps that call exit() + // fall into this catagory (i.e. Win32 Glut). + + // VC cannot successfully implement multiple exception handlers + // if more than one exception occurs. Therefore reverting back to + // single exception handler as Keith originally had it. (DaveM) + +#define WARN_MESSAGE(p) strcpy(argstr, (#p)); +#define SAFE_RELEASE(p) WARN_MESSAGE(p); RELEASE(p); + +__try { +#ifdef _USE_GLD3_WGL + WARN_MESSAGE(gl_destroy_framebuffer); + if (lpCtx->glBuffer) + _mesa_destroy_framebuffer(lpCtx->glBuffer); + WARN_MESSAGE(gl_destroy_context); + if (lpCtx->glCtx) + _mesa_destroy_context(lpCtx->glCtx); + WARN_MESSAGE(gl_destroy_visual); + if (lpCtx->glVis) + _mesa_destroy_visual(lpCtx->glVis); + + _gldDriver.DestroyDrawable(lpCtx); +#else + // Destroy the Mesa context + WARN_MESSAGE(gl_destroy_framebuffer); + if (lpCtx->glBuffer) + (*mesaFuncs.gl_destroy_framebuffer)(lpCtx->glBuffer); + WARN_MESSAGE(gl_destroy_context); + if (lpCtx->glCtx) + (*mesaFuncs.gl_destroy_context)(lpCtx->glCtx); + WARN_MESSAGE(gl_destroy_visual); + if (lpCtx->glVis) + (*mesaFuncs.gl_destroy_visual)(lpCtx->glVis); + + SAFE_RELEASE(lpCtx->m_pvbuf); // release D3D vertex buffer + SAFE_RELEASE(lpCtx->m_vbuf); // release D3D vertex buffer + + // Delete the global palette + SAFE_RELEASE(lpCtx->lpGlobalPalette); + + // Clean up. + if (lpCtx->lpViewport3) { + if (lpCtx->lpDev3) IDirect3DDevice3_DeleteViewport(lpCtx->lpDev3, lpCtx->lpViewport3); + SAFE_RELEASE(lpCtx->lpViewport3); + lpCtx->lpViewport3 = NULL; + } + + SAFE_RELEASE(lpCtx->lpDev3); + if (lpCtx->lpDepth4) { + if (lpCtx->lpBack4) + IDirectDrawSurface4_DeleteAttachedSurface(lpCtx->lpBack4, 0L, lpCtx->lpDepth4); + else + IDirectDrawSurface4_DeleteAttachedSurface(lpCtx->lpFront4, 0L, lpCtx->lpDepth4); + SAFE_RELEASE(lpCtx->lpDepth4); + lpCtx->lpDepth4 = NULL; + } + SAFE_RELEASE(lpCtx->lpBack4); + SAFE_RELEASE(lpCtx->lpFront4); + if (lpCtx->bFullscreen) { + IDirectDraw4_RestoreDisplayMode(lpCtx->lpDD4); + IDirectDraw4_SetCooperativeLevel(lpCtx->lpDD4, NULL, DDSCL_NORMAL); + } + SAFE_RELEASE(lpCtx->lpD3D3); + SAFE_RELEASE(lpCtx->lpDD4); + SAFE_RELEASE(lpCtx->lpDD1); +#endif // _ULSE_GLD3_WGL + +} +__except(EXCEPTION_EXECUTE_HANDLER) { + ddlogPrintf(DDLOG_WARN, "Exception raised in dglDeleteContext: %s", argstr); +} + + // Restore the window message handler because this context may be used + // again by another window with a *different* message handler. (DaveM) + if (lpCtx->lpfnWndProc) { + SetWindowLong(lpCtx->hWnd, GWL_WNDPROC, (LONG)lpCtx->lpfnWndProc); + lpCtx->lpfnWndProc = (LONG)NULL; + } + + lpCtx->bAllocated = FALSE; // This context is now free for use + +#ifdef GLD_THREADS + // Release serialized access + if (glb.bMultiThreaded) + LeaveCriticalSection(&CriticalSection); +#endif + + return TRUE; +} + +// *********************************************************************** + +BOOL dglSwapBuffers( + HDC hDC) +{ + RECT rSrcRect; // Source rectangle + RECT rDstRect; // Destination rectangle + POINT pt; + HRESULT hResult; + + DDBLTFX bltFX; + DWORD dwBlitFlags; + DDBLTFX *lpBltFX; + +// DWORD dwThreadId = GetCurrentThreadId(); + HGLRC hGLRC = dglGetCurrentContext(); + DGL_ctx *lpCtx = dglGetContextAddress(hGLRC); + HWND hWnd; + + HDC hDCAux; // for memory DC + int x,y,w,h; // for memory DC BitBlt + +#if 0 // Perhaps not a good idea. Called too often. KH + // Validate license + if (!dglValidate()) + return FALSE; +#endif + + if (!lpCtx) { + return TRUE; //FALSE; // No current context + } + + if (!lpCtx->bCanRender) { + // Don't return false else some apps will bail. + return TRUE; + } + + hWnd = lpCtx->hWnd; + if (hDC != lpCtx->hDC) { + ddlogPrintf(DDLOG_WARN, "dglSwapBuffers: HDC=%X does not match HDC=%X for HGLRC=%d", hDC, lpCtx->hDC, hGLRC); + hWnd = WindowFromDC(hDC); + } + +#ifndef _USE_GLD3_WGL + // Ensure that the surfaces exist before we tell + // the device to render to them. + IDirectDraw4_RestoreAllSurfaces(lpCtx->lpDD4); + + // Make sure that the vertex caches have been emptied +// dglStateChange(lpCtx); + + // Some OpenGL programs don't issue a glFinish - check for it here. + if (lpCtx->bSceneStarted) { + IDirect3DDevice3_EndScene(lpCtx->lpDev3); + lpCtx->bSceneStarted = FALSE; + } +#endif + +#if 0 + // If the calling app is not active then we don't need to Blit/Flip. + // We can therefore simply return TRUE. + if (!glb.bAppActive) + return TRUE; + // Addendum: This is WRONG! We should bail if the app is *minimized*, + // not merely if the app is just plain 'not active'. + // KeithH, 27/May/2000. +#endif + + // Check for non-window DC = memory DC ? + if (hWnd == NULL) { + if (GetClipBox(hDC, &rSrcRect) == ERROR) + return TRUE; + // Use GDI BitBlt instead from compatible DirectDraw DC + x = rSrcRect.left; + y = rSrcRect.top; + w = rSrcRect.right - rSrcRect.left; + h = rSrcRect.bottom - rSrcRect.top; + + // Ack. DX8 does not have a GetDC() function... + // TODO: Defer to DX7 or DX9 drivers... (DaveM) + return TRUE; + } + + // Bail if window client region is not drawable, like in Solid Edge + if (!IsWindow(hWnd) /* || !IsWindowVisible(hWnd) */ || !GetClientRect(hWnd, &rSrcRect)) + return TRUE; + +#ifdef GLD_THREADS + // Serialize access to DirectDraw or DDS operations + if (glb.bMultiThreaded) + EnterCriticalSection(&CriticalSection); +#endif + +#ifdef _USE_GLD3_WGL + // Notify Mesa of impending swap, so Mesa can flush internal buffers. + _mesa_notifySwapBuffers(lpCtx->glCtx); + // Now perform driver buffer swap + _gldDriver.SwapBuffers(lpCtx, hDC, hWnd); +#else + if (lpCtx->bFullscreen) { + // Sync with retrace if required + if (glb.bWaitForRetrace) { + IDirectDraw4_WaitForVerticalBlank( + lpCtx->lpDD4, + DDWAITVB_BLOCKBEGIN, + 0); + } + + // Perform the fullscreen flip + TRY(IDirectDrawSurface4_Flip( + lpCtx->lpFront4, + NULL, + DDFLIP_WAIT), + "dglSwapBuffers: Flip"); + } else { + // Calculate current window position and size + pt.x = pt.y = 0; + ClientToScreen(hWnd, &pt); + GetClientRect(hWnd, &rDstRect); + if (rDstRect.right > lpCtx->dwModeWidth) + rDstRect.right = lpCtx->dwModeWidth; + if (rDstRect.bottom > lpCtx->dwModeHeight) + rDstRect.bottom = lpCtx->dwModeHeight; + OffsetRect(&rDstRect, pt.x, pt.y); + rSrcRect.left = rSrcRect.top = 0; + rSrcRect.right = lpCtx->dwWidth; + rSrcRect.bottom = lpCtx->dwHeight; + if (rSrcRect.right > lpCtx->dwModeWidth) + rSrcRect.right = lpCtx->dwModeWidth; + if (rSrcRect.bottom > lpCtx->dwModeHeight) + rSrcRect.bottom = lpCtx->dwModeHeight; + + if (glb.bWaitForRetrace) { + // Sync the blit to the vertical retrace + ZeroMemory(&bltFX, sizeof(bltFX)); + bltFX.dwSize = sizeof(bltFX); + bltFX.dwDDFX = DDBLTFX_NOTEARING; + dwBlitFlags = DDBLT_WAIT | DDBLT_DDFX; + lpBltFX = &bltFX; + } else { + dwBlitFlags = DDBLT_WAIT; + lpBltFX = NULL; + } + + // Perform the actual blit + TRY(IDirectDrawSurface4_Blt( + lpCtx->lpFront4, + &rDstRect, + lpCtx->lpBack4, // Blit source + &rSrcRect, + dwBlitFlags, + lpBltFX), + "dglSwapBuffers: Blt"); + } +#endif // _USE_GLD3_WGL + +#ifdef GLD_THREADS + // Release serialized access + if (glb.bMultiThreaded) + LeaveCriticalSection(&CriticalSection); +#endif + + // TODO: Re-instate rendering bitmap snapshot feature??? (DaveM) + + // Render frame is completed + ValidateRect(hWnd, NULL); + lpCtx->bFrameStarted = FALSE; + + return TRUE; +} + +// *********************************************************************** diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/dglcontext.h b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglcontext.h new file mode 100644 index 00000000000..5c433b857ef --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglcontext.h @@ -0,0 +1,281 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: OpenGL context handling. +* +****************************************************************************/ + +#ifndef __DGLCONTEXT_H +#define __DGLCONTEXT_H + +// Disable compiler complaints about DLL linkage +#pragma warning (disable:4273) + +// Macros to control compilation +#ifndef STRICT +#define STRICT +#endif // STRICT +#define WIN32_LEAN_AND_MEAN +#include +#include + +#ifdef _USE_GLD3_WGL + #include "dglmacros.h" + #include "dglglobals.h" + #include "pixpack.h" + #include "ddlog.h" + #include "dglpf.h" + #include "context.h" // Mesa context +#else + #include + #include + + #include "dglmacros.h" + #include "dglglobals.h" + #include "pixpack.h" + #include "ddlog.h" + #include "dglpf.h" + #include "d3dvertex.h" + + #include "DirectGL.h" + + #include "context.h" // Mesa context + #include "vb.h" // Mesa vertex buffer +#endif // _USE_GLD3_WGL + +/*---------------------- Macros and type definitions ----------------------*/ + +// TODO: Use a list instead of this constant! +#define DGL_MAX_CONTEXTS 32 + +// Structure for describing an OpenGL context +#ifdef _USE_GLD3_WGL +typedef struct { + BOOL bHasBeenCurrent; + DGL_pixelFormat *lpPF; + + // Pointer to private driver data (this also contains the drawable). + void *glPriv; + + // Mesa vars: + GLcontext *glCtx; // The core Mesa context + GLvisual *glVis; // Describes the color buffer + GLframebuffer *glBuffer; // Ancillary buffers + + GLuint ClearIndex; + GLuint CurrentIndex; + GLubyte ClearColor[4]; + GLubyte CurrentColor[4]; + + BOOL EmulateSingle; // Emulate single-buffering + BOOL bDoubleBuffer; + BOOL bDepthBuffer; + + // Shared driver vars: + BOOL bAllocated; + BOOL bFullscreen; // Is this a fullscreen context? + BOOL bSceneStarted; // Has a lpDev->BeginScene been issued? + BOOL bCanRender; // Flag: states whether rendering is OK + BOOL bFrameStarted; // Has frame update started at all? + BOOL bStencil; // TRUE if this context has stencil + BOOL bGDIEraseBkgnd; // GDI Erase Background command + + // Window information + HWND hWnd; // Window handle + HDC hDC; // Windows' Device Context of the window + DWORD dwWidth; // Window width + DWORD dwHeight; // Window height + DWORD dwBPP; // Window bits-per-pixel; + RECT rcScreenRect; // Screen rectangle + DWORD dwModeWidth; // Display mode width + DWORD dwModeHeight; // Display mode height + float dvClipX; + float dvClipY; + LONG lpfnWndProc; // window message handler function + +} DGL_ctx; + +#define GLD_context DGL_ctx +#define GLD_GET_CONTEXT(c) (GLD_context*)(c)->DriverCtx + +#else // _USE_GLD3_WGL + +typedef struct { + BOOL bHasBeenCurrent; + DGL_pixelFormat *lpPF; + // + // Mesa context vars: + // + GLcontext *glCtx; // The core Mesa context + GLvisual *glVis; // Describes the color buffer + GLframebuffer *glBuffer; // Ancillary buffers + + GLuint ClearIndex; + GLuint CurrentIndex; + GLubyte ClearColor[4]; + GLubyte CurrentColor[4]; + + BOOL EmulateSingle; // Emulate single-buffering + BOOL bDoubleBuffer; + BOOL bDepthBuffer; + int iZBufferPF; // Index of Zbuffer pixel format + + // Vertex buffer: one-to-one correlation with Mesa's vertex buffer. + // This will be filled by our setup function (see d3dvsetup.c) + DGL_TLvertex gWin[VB_SIZE]; // Transformed and lit vertices +// DGL_Lvertex gObj[VB_SIZE]; // Lit vertices in object coordinates. + + // Indices for DrawIndexedPrimitive. + // Clipped quads are drawn seperately, so use VB_SIZE. + // 6 indices are needed to make 2 triangles for each possible quad +// WORD wIndices[(VB_SIZE / 4) * 6]; + WORD wIndices[32768]; + + // + // Device driver vars: + // + BOOL bAllocated; + BOOL bFullscreen; // Is this a fullscreen context? + BOOL bSceneStarted; // Has a lpDev->BeginScene been issued? + BOOL bCanRender; // Flag: states whether rendering is OK + BOOL bFrameStarted; // Has frame update started at all? + + // DirectX COM interfaces, postfixed with the interface number + IDirectDraw *lpDD1; + IDirectDraw4 *lpDD4; + IDirect3D3 *lpD3D3; + IDirect3DDevice3 *lpDev3; + IDirect3DViewport3 *lpViewport3; + IDirectDrawSurface4 *lpFront4; + IDirectDrawSurface4 *lpBack4; + IDirectDrawSurface4 *lpDepth4; + + // Vertex buffers + BOOL bD3DPipeline; // True if using D3D geometry pipeline + IDirect3DVertexBuffer *m_vbuf; // Unprocessed vertices + IDirect3DVertexBuffer *m_pvbuf; // Processed vertices ready to be rendered + + D3DTEXTUREOP ColorOp[MAX_TEXTURE_UNITS]; // Used for re-enabling texturing + D3DTEXTUREOP AlphaOp[MAX_TEXTURE_UNITS]; // Used for re-enabling texturing + struct gl_texture_object *tObj[MAX_TEXTURE_UNITS]; + + DDCAPS ddCaps; // DirectDraw caps + D3DDEVICEDESC D3DDevDesc; // Direct3D Device description + + DDPIXELFORMAT ddpfRender; // Pixel format of the render buffer + DDPIXELFORMAT ddpfDepth; // Pixel format of the depth buffer + + BOOL bStencil; // TRUE is this context has stencil + + PX_packFunc fnPackFunc; // Pixel packing function for SW + PX_unpackFunc fnUnpackFunc; // Pixel unpacking function for SW + PX_packSpanFunc fnPackSpanFunc; // Pixel span packer + + D3DVIEWPORT2 d3dViewport; // D3D Viewport object + + D3DCULL cullmode; // Direct3D cull mode + D3DCOLOR curcolor; // Current color + DWORD dwColorPF; // Current color, in format of target surface + D3DCOLOR d3dClearColor; // Clear color + D3DCOLOR ConstantColor; // For flat shading + DWORD dwClearColorPF; // Clear color, in format of target surface + BOOL bGDIEraseBkgnd; // GDI Erase Background command + + // Primitive caches +// DGL_vertex LineCache[DGL_MAX_LINE_VERTS]; +// DGL_vertex TriCache[DGL_MAX_TRI_VERTS]; +// DWORD dwNextLineVert; +// DWORD dwNextTriVert; + + // Window information + HWND hWnd; // Window handle + HDC hDC; // Windows' Device Context of the window + DWORD dwWidth; // Window width + DWORD dwHeight; // Window height + DWORD dwBPP; // Window bits-per-pixel; + RECT rcScreenRect; // Screen rectangle + DWORD dwModeWidth; // Display mode width + DWORD dwModeHeight; // Display mode height + float dvClipX; + float dvClipY; + LONG lpfnWndProc; // window message handler function + + // Shared texture palette + IDirectDrawPalette *lpGlobalPalette; + + // Usage counters. + // One of these counters will be incremented when we choose + // between hardware and software rendering functions. +// DWORD dwHWUsageCount; // Hardware usage count +// DWORD dwSWUsageCount; // Software usage count + + // Texture state flags. +// BOOL m_texturing; // TRUE is texturing +// BOOL m_mtex; // TRUE if multitexture +// BOOL m_texHandleValid; // TRUE if tex state valid + + // Renderstate caches to ensure no redundant state changes + DWORD dwRS[256]; // Renderstates + DWORD dwTSS[2][24]; // Texture-stage states + LPDIRECT3DTEXTURE2 lpTex[2]; // Texture (1 per stage) + + DWORD dwMaxTextureSize; // Max texture size: + // clamped to 1024. + +} DGL_ctx; +#endif // _USE_GLD3_WGL + +/*------------------------- Function Prototypes ---------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +HHOOK hKeyHook; +LRESULT CALLBACK dglKeyProc(int code,WPARAM wParam,LPARAM lParam); + +void dglInitContextState(); +void dglDeleteContextState(); +BOOL dglIsValidContext(HGLRC a); +DGL_ctx* dglGetContextAddress(const HGLRC a); +HDC dglGetCurrentDC(void); +HGLRC dglGetCurrentContext(void); +HGLRC dglCreateContext(HDC a, const DGL_pixelFormat *lpPF); +BOOL dglMakeCurrent(HDC a, HGLRC b); +BOOL dglDeleteContext(HGLRC a); +BOOL dglSwapBuffers(HDC hDC); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/dglglobals.c b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglglobals.c new file mode 100644 index 00000000000..c633e3bcfab --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglglobals.c @@ -0,0 +1,149 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: Global variables. +* +****************************************************************************/ + +#include "dglglobals.h" + +// ======================================================================= +// Global Variables +// ======================================================================= + +char szCopyright[] = "Copyright (c) 1998 SciTech Software, Inc."; +char szDllName[] = "Scitech GLDirect"; +char szErrorTitle[] = "GLDirect Error"; + +DGL_globals glb; + +// Shared result variable +HRESULT hResult; + +// *********************************************************************** + +// Patch function for missing function in Mesa +int finite( + double x) +{ + return _finite(x); +}; + +// *********************************************************************** + +void dglInitGlobals() +{ + // Zero all fields just in case + memset(&glb, 0, sizeof(glb)); + + // Set the global defaults + glb.bPrimary = FALSE; // Not the primary device + glb.bHardware = FALSE; // Not a hardware device +// glb.bFullscreen = FALSE; // Not running fullscreen + glb.bSquareTextures = FALSE; // Device does not need sq + glb.bPAL8 = FALSE; // Device cannot do 8bit + glb.dwMemoryType = DDSCAPS_SYSTEMMEMORY; + glb.dwRendering = DGL_RENDER_D3D; + + glb.bWaitForRetrace = TRUE; // Sync to vertical retrace + glb.bFullscreenBlit = FALSE; + + glb.nPixelFormatCount = 0; + glb.lpPF = NULL; // Pixel format list +#ifndef _USE_GLD3_WGL + glb.nZBufferPFCount = 0; + glb.lpZBufferPF = NULL; + glb.nDisplayModeCount = 0; + glb.lpDisplayModes = NULL; + glb.nTextureFormatCount = 0; + glb.lpTextureFormat = NULL; +#endif // _USE_GLD3_WGL + + glb.wMaxSimultaneousTextures = 1; + + // Enable support for multitexture, if available. + glb.bMultitexture = TRUE; + + // Enable support for mipmapping + glb.bUseMipmaps = TRUE; + + // Alpha emulation via chroma key + glb.bEmulateAlphaTest = FALSE; + + // Use Mesa pipeline always (for compatibility) + glb.bForceMesaPipeline = FALSE; + + // Init support for multiple GLRCs + glb.bDirectDraw = FALSE; + glb.bDirectDrawPrimary = FALSE; + glb.bDirect3D = FALSE; + glb.bDirect3DDevice = FALSE; + glb.bDirectDrawStereo = FALSE; + glb.iDirectDrawStereo = 0; + glb.hWndActive = NULL; + // Init DirectX COM interfaces for multiple GLRCs +// glb.lpDD4 = NULL; +// glb.lpPrimary4 = NULL; +// glb.lpBack4 = NULL; +// glb.lpDepth4 = NULL; +// glb.lpGlobalPalette = NULL; + + // Init special support options + glb.bMessageBoxWarnings = TRUE; + glb.bDirectDrawPersistant = FALSE; + glb.bPersistantBuffers = FALSE; + + // Do not assume single-precision-only FPU (for compatibility) + glb.bFastFPU = FALSE; + + // Allow hot-key support + glb.bHotKeySupport = TRUE; + + // Default to single-threaded support (for simplicity) + glb.bMultiThreaded = FALSE; + + // Use application-specific customizations (for end-user convenience) + glb.bAppCustomizations = TRUE; + +#ifdef _USE_GLD3_WGL + // Registry/ini-file settings for GLDirect 3.x + glb.dwAdapter = 0; // Primary DX8 adapter + glb.dwTnL = 1; // MesaSW TnL + glb.dwMultisample = 0; // Multisample Off + glb.dwDriver = 2; // Direct3D HW + + // Signal a pixelformat list rebuild + glb.bPixelformatsDirty = TRUE; +#endif +} + +// *********************************************************************** diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/dglglobals.h b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglglobals.h new file mode 100644 index 00000000000..995f1cd5e48 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglglobals.h @@ -0,0 +1,198 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: Globals. +* +****************************************************************************/ + +#ifndef __DGLGLOBALS_H +#define __DGLGLOBALS_H + +#include "dglcontext.h" +#include "dglpf.h" // Pixel format +#ifndef _USE_GLD3_WGL +#include "d3dtexture.h" +#endif + +/*---------------------- Macros and type definitions ----------------------*/ + +typedef enum { + DGL_RENDER_MESASW = 0, + DGL_RENDER_D3D = 1, + DGL_RENDER_FORCE_DWORD = 0x7ffffff, +} DGL_renderType; + +#ifdef _USE_GLD3_WGL + +// Same as DGL_renderType? KeithH +typedef enum { + GLDS_DRIVER_MESA_SW = 0, // Mesa SW rendering + GLDS_DRIVER_REF = 1, // Direct3D Reference Rasteriser + GLDS_DRIVER_HAL = 2, // Direct3D HW rendering +} GLDS_DRIVER; + +typedef enum { + GLDS_TNL_DEFAULT = 0, // Choose best TnL method + GLDS_TNL_MESA = 1, // Mesa TnL + GLDS_TNL_D3DSW = 2, // D3D Software TnL + GLDS_TNL_D3DHW = 3, // D3D Hardware TnL +} GLDS_TNL; + +typedef enum { + GLDS_MULTISAMPLE_NONE = 0, + GLDS_MULTISAMPLE_FASTEST = 1, + GLDS_MULTISAMPLE_NICEST = 2, +} GLDS_MULTISAMPLE; +#endif + +typedef struct { + // Registry settings + char szDDName[MAX_DDDEVICEID_STRING]; // DirectDraw device name + char szD3DName[MAX_DDDEVICEID_STRING]; // Direct3D driver name + BOOL bPrimary; // Is ddraw device the Primary device? + BOOL bHardware; // Is the d3d driver a Hardware driver? +#ifndef _USE_GLD3_WGL + GUID ddGuid; // GUID of the ddraw device + GUID d3dGuid; // GUID of the direct3d driver +#endif // _USE_GLD3_WGL +// BOOL bFullscreen; // Force fullscreen - only useful for primary adaptors. + BOOL bSquareTextures; // Does this driver require square textures? + DWORD dwRendering; // Type of rendering required + + BOOL bWaitForRetrace; // Sync to vertical retrace + BOOL bFullscreenBlit; // Use Blt instead of Flip in fullscreen modes + + // Multitexture + BOOL bMultitexture; + + BOOL bUseMipmaps; + + DWORD dwMemoryType; // Sysmem or Vidmem + + // Global palette + BOOL bPAL8; + DDPIXELFORMAT ddpfPAL8; + + // Multitexture + WORD wMaxSimultaneousTextures; + + // Win32 internals + BOOL bAppActive; // Keep track of Alt-Tab + LONG lpfnWndProc; // WndProc of calling app + + // Pixel Format Descriptior list. + int nPixelFormatCount; + DGL_pixelFormat *lpPF; +#ifndef _USE_GLD3_WGL + // ZBuffer pixel formats + int nZBufferPFCount; // Count of Zbuffer pixel formats + DDPIXELFORMAT *lpZBufferPF; // ZBuffer pixel formats + + // Display modes (for secondary devices) + int nDisplayModeCount; + DDSURFACEDESC2 *lpDisplayModes; + + // Texture pixel formats + int nTextureFormatCount; + DGL_textureFormat *lpTextureFormat; +#endif // _USE_GLD3_WGL + // Alpha emulation via chroma key + BOOL bEmulateAlphaTest; + + // Geom pipeline override. + // If this is set TRUE then the D3D pipeline will never be used, + // and the Mesa pipline will always be used. + BOOL bForceMesaPipeline; + +#ifdef _USE_GLD3_WGL + BOOL bPixelformatsDirty; // Signal a list rebuild +#endif + + // Additional globals to support multiple GL rendering contexts, GLRCs + BOOL bDirectDraw; // DirectDraw interface exists ? + BOOL bDirectDrawPrimary; // DirectDraw primary surface exists ? + BOOL bDirect3D; // Direct3D interface exists ? + BOOL bDirect3DDevice; // Direct3D device exists ? + + BOOL bDirectDrawStereo; // DirectDraw Stereo driver started ? + int iDirectDrawStereo; // DirectDraw Stereo driver reference count + HWND hWndActive; // copy of active window + + // Copies of DirectX COM interfaces for re-referencing across multiple GLRCs +// IDirectDraw4 *lpDD4; // copy of DirectDraw interface +// IDirectDrawSurface4 *lpPrimary4; // copy of DirectDraw primary surface +// IDirectDrawSurface4 *lpBack4; +// IDirectDrawSurface4 *lpDepth4; +// IDirectDrawPalette *lpGlobalPalette; + + // Aids for heavy-duty MFC-windowed OGL apps, like AutoCAD + BOOL bMessageBoxWarnings; // popup message box warning + BOOL bDirectDrawPersistant; // DirectDraw is persisitant + BOOL bPersistantBuffers; // DirectDraw buffers persisitant + + // FPU setup option for CAD precision (AutoCAD) vs GAME speed (Quake) + BOOL bFastFPU; // single-precision-only FPU ? + + // Hot-Key support, like for real-time stereo parallax adjustments + BOOL bHotKeySupport; // hot-key support ? + + // Multi-threaded support, for apps like 3DStudio + BOOL bMultiThreaded; // multi-threaded ? + + // Detect and use app-specific customizations for apps like 3DStudio + BOOL bAppCustomizations; // app customizations ? + +#ifdef _USE_GLD3_WGL + DWORD dwAdapter; // Primary DX8 adapter + DWORD dwTnL; // MesaSW TnL + DWORD dwMultisample; // Multisample Off + DWORD dwDriver; // Direct3D HW + void *pDrvPrivate; // Driver-specific data +#endif + +} DGL_globals; + +/*------------------------- Function Prototypes ---------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +DGL_globals glb; + +void dglInitGlobals(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/dglmacros.h b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglmacros.h new file mode 100644 index 00000000000..aed0f2110ea --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglmacros.h @@ -0,0 +1,91 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: Useful generic macros. +* +****************************************************************************/ + +#ifndef __DGLMACROS_H +#define __DGLMACROS_H + +#include + +// Define the relevant RELEASE macro depending on C or C++ +#if !defined(__cplusplus) || defined(CINTERFACE) + // Standard C version + #define RELEASE(x) if (x!=NULL) { x->lpVtbl->Release(x); x=NULL; } +#else + // C++ version + #define RELEASE(x) if (x!=NULL) { x->Release(); x=NULL; } +#endif + +// We don't want a message *every* time we call an unsupported function +#define UNSUPPORTED(x) \ + { \ + static BOOL bFirstTime = TRUE; \ + if (bFirstTime) { \ + bFirstTime = FALSE; \ + ddlogError(DDLOG_WARN, (x), DDERR_CURRENTLYNOTAVAIL); \ + } \ + } + +#define DGL_CHECK_CONTEXT \ + if (ctx == NULL) return; + +// Don't render if bCanRender is not TRUE. +#define DGL_CHECK_RENDER \ + if (!dgl->bCanRender) return; + +#if 0 +#define TRY(a,b) (a) +#define TRY_ERR(a,b) (a) +#else +// hResult should be defined in the function +// Return codes should be checked via SUCCEDDED and FAILED macros +#define TRY(a,b) \ + { \ + if (FAILED(hResult=(a))) \ + ddlogError(DDLOG_ERROR, (b), hResult); \ + } + +// hResult is a global +// The label exit_with_error should be defined within the calling scope +#define TRY_ERR(a,b) \ + { \ + if (FAILED(hResult=(a))) { \ + ddlogError(DDLOG_ERROR, (b), hResult); \ + goto exit_with_error; \ + } \ + } +#endif // #if 1 + +#endif diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/dglpf.c b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglpf.c new file mode 100644 index 00000000000..4cd4d0334ac --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglpf.c @@ -0,0 +1,620 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: Pixel Formats. +* +****************************************************************************/ + +#include "dglpf.h" + +#ifdef _USE_GLD3_WGL +#include "gld_driver.h" +#endif + +// *********************************************************************** + +char szColorDepthWarning[] = +"GLDirect does not support the current desktop\n\ +color depth.\n\n\ +You may need to change the display resolution to\n\ +16 bits per pixel or higher color depth using\n\ +the Windows Display Settings control panel\n\ +before running this OpenGL application.\n"; + +// *********************************************************************** +// This pixel format will be used as a template when compiling the list +// of pixel formats supported by the hardware. Many fields will be +// filled in at runtime. +// PFD flag defaults are upgraded to match ChoosePixelFormat() -- DaveM +DGL_pixelFormat pfTemplateHW = +{ + { + sizeof(PIXELFORMATDESCRIPTOR), // Size of the data structure + 1, // Structure version - should be 1 + // Flags: + PFD_DRAW_TO_WINDOW | // The buffer can draw to a window or device surface. + PFD_DRAW_TO_BITMAP | // The buffer can draw to a bitmap. (DaveM) + PFD_SUPPORT_GDI | // The buffer supports GDI drawing. (DaveM) + PFD_SUPPORT_OPENGL | // The buffer supports OpenGL drawing. + PFD_DOUBLEBUFFER | // The buffer is double-buffered. + 0, // Placeholder for easy commenting of above flags + PFD_TYPE_RGBA, // Pixel type RGBA. + 16, // Total colour bitplanes (excluding alpha bitplanes) + 5, 0, // Red bits, shift + 5, 5, // Green bits, shift + 5, 10, // Blue bits, shift + 0, 0, // Alpha bits, shift (destination alpha) + 0, // Accumulator bits (total) + 0, 0, 0, 0, // Accumulator bits: Red, Green, Blue, Alpha + 0, // Depth bits + 0, // Stencil bits + 0, // Number of auxiliary buffers + 0, // Layer type + 0, // Specifies the number of overlay and underlay planes. + 0, // Layer mask + 0, // Specifies the transparent color or index of an underlay plane. + 0 // Damage mask + }, + -1, // No depth/stencil buffer +}; + +// *********************************************************************** +// Return the count of the number of bits in a Bit Mask. +int BitCount( + DWORD dw) +{ + int i; + + if (dw == 0) + return 0; // account for non-RGB mode + + for (i=0; dw; dw=dw>>1) + i += (dw & 1); + return i; +} + +// *********************************************************************** + +DWORD BitShift( + DWORD dwMaskIn) +{ + DWORD dwShift, dwMask; + + if (dwMaskIn == 0) + return 0; // account for non-RGB mode + + for (dwShift=0, dwMask=dwMaskIn; !(dwMask&1); dwShift++, dwMask>>=1); + + return dwShift; +} + +// *********************************************************************** + +BOOL IsValidPFD(int iPFD) +{ + DGL_pixelFormat *lpPF; + + // Validate license + if (!dglValidate()) + return FALSE; + + if ((glb.lpPF == NULL) || + (glb.nPixelFormatCount == 0)) + return FALSE; + + // Check PFD range + if ( (iPFD < 1) || (iPFD > glb.nPixelFormatCount) ) { + ddlogMessage(DDLOG_ERROR, "PFD out of range\n"); + return FALSE; // PFD is invalid + } + + // Make a pointer to the pixel format + lpPF = &glb.lpPF[iPFD-1]; + + // Check size + if (lpPF->pfd.nSize != sizeof(PIXELFORMATDESCRIPTOR)) { + ddlogMessage(DDLOG_ERROR, "Bad PFD size\n"); + return FALSE; // PFD is invalid + } + + // Check version + if (lpPF->pfd.nVersion != 1) { + ddlogMessage(DDLOG_ERROR, "PFD is not Version 1\n"); + return FALSE; // PFD is invalid + } + + return TRUE; // PFD is valid +} + +// *********************************************************************** + +#ifndef _USE_GLD3_WGL + +int iEnumCount; // Enumeration count +DWORD dwDisplayBitDepth; // Bit depth of current display mode + +// *********************************************************************** + +HRESULT WINAPI EnumDisplayModesCallback( + DDSURFACEDESC2* pddsd, + void *pvContext) +{ + DWORD dwModeDepth; + DDSURFACEDESC2 *lpDisplayMode; + char buf[32]; + + // Check parameters + if (pddsd == NULL) + return DDENUMRET_CANCEL; + + dwModeDepth = pddsd->ddpfPixelFormat.dwRGBBitCount; + lpDisplayMode = (DDSURFACEDESC2 *)pvContext; + + // Check mode for compatability with device. + if (dwModeDepth != dwDisplayBitDepth) + return DDENUMRET_OK; + + if (lpDisplayMode != NULL) { + memcpy(&lpDisplayMode[iEnumCount], pddsd, sizeof(DDSURFACEDESC2)); + sprintf(buf, TEXT("Mode: %ld x %ld x %ld\n"), + pddsd->dwWidth, pddsd->dwHeight, dwModeDepth); + ddlogMessage(DDLOG_INFO, buf); + } + + iEnumCount++; + + return DDENUMRET_OK; +} + +// *********************************************************************** + +HRESULT CALLBACK d3dEnumZBufferFormatsCallback( + DDPIXELFORMAT* pddpf, + VOID* lpZBufferPF ) +{ + char buf[64]; + + if(pddpf == NULL) + return D3DENUMRET_CANCEL; + + if (pddpf->dwFlags & DDPF_ZBUFFER) { + if (lpZBufferPF == NULL) { + // Pass 1. Merely counting the PF + glb.nZBufferPFCount++; + } else { + // Pass 2. Save the PF + if (pddpf->dwFlags & DDPF_STENCILBUFFER) { + sprintf(buf, " %d: Z=%d S=%d\n", + iEnumCount, + pddpf->dwZBufferBitDepth, + pddpf->dwStencilBitDepth); + } else { + sprintf(buf, " %d: Z=%d S=0\n", + iEnumCount, + pddpf->dwZBufferBitDepth); + } + ddlogMessage(DDLOG_INFO, buf); + + memcpy(&glb.lpZBufferPF[iEnumCount++], + pddpf, + sizeof(DDPIXELFORMAT)); + } + } + + return D3DENUMRET_OK; +} +#endif // _USE_GLD3_WGL + +// *********************************************************************** + +BOOL IsStencilSupportBroken(LPDIRECTDRAW4 lpDD4) +{ + DDDEVICEIDENTIFIER dddi; // DX6 device identifier + BOOL bBroken = FALSE; + + // Microsoft really fucked up with the GetDeviceIdentifier function + // on Windows 2000, since it locks up on stock driers on the CD. Updated + // drivers from vendors appear to work, but we can't identify the drivers + // without this function!!! For now we skip these tests on Windows 2000. + if ((GetVersion() & 0x80000000UL) == 0) + return FALSE; + + // Obtain device info + if (FAILED(IDirectDraw4_GetDeviceIdentifier(lpDD4, &dddi, 0))) + return FALSE; + + // Matrox G400 stencil buffer support does not draw anything in AutoCAD, + // but ordinary Z buffers draw shaded models fine. (DaveM) + if (dddi.dwVendorId == 0x102B) { // Matrox + if (dddi.dwDeviceId == 0x0525) { // G400 + bBroken = TRUE; + } + } + + return bBroken; +} + +// *********************************************************************** + +void dglBuildPixelFormatList() +{ + int i; + char buf[128]; + char cat[8]; + DGL_pixelFormat *lpPF; + +#ifdef _USE_GLD3_WGL + _gldDriver.BuildPixelformatList(); +#else + HRESULT hRes; + IDirectDraw *lpDD1 = NULL; + IDirectDraw4 *lpDD4 = NULL; + IDirect3D3 *lpD3D3 = NULL; + DDSURFACEDESC2 ddsdDisplayMode; + + DWORD dwRb, dwGb, dwBb, dwAb; // Bit counts + DWORD dwRs, dwGs, dwBs, dwAs; // Bit shifts + DWORD dwPixelType; // RGB or color index + + // Set defaults + glb.nPixelFormatCount = 0; + glb.lpPF = NULL; + glb.nZBufferPFCount = 0; + glb.lpZBufferPF = NULL; + glb.nDisplayModeCount = 0; + glb.lpDisplayModes = NULL; + + // + // Examine the hardware for depth and stencil + // + + if (glb.bPrimary) + hRes = DirectDrawCreate(NULL, &lpDD1, NULL); + else + hRes = DirectDrawCreate(&glb.ddGuid, &lpDD1, NULL); + + if (FAILED(hRes)) { + ddlogError(DDLOG_ERROR, "dglBPFL: DirectDrawCreate failed", hRes); + return; + } + + // Query for DX6 IDirectDraw4. + hRes = IDirectDraw_QueryInterface( + lpDD1, + &IID_IDirectDraw4, + (void**)&lpDD4); + if (FAILED(hRes)) { + ddlogError(DDLOG_ERROR, "dglBPFL: QueryInterface (DD4) failed", hRes); + goto clean_up; + } + + + // Retrieve caps of current display mode + ZeroMemory(&ddsdDisplayMode, sizeof(ddsdDisplayMode)); + ddsdDisplayMode.dwSize = sizeof(ddsdDisplayMode); + hRes = IDirectDraw4_GetDisplayMode(lpDD4, &ddsdDisplayMode); + if (FAILED(hRes)) + goto clean_up; + + dwDisplayBitDepth = ddsdDisplayMode.ddpfPixelFormat.dwRGBBitCount; + dwPixelType = (dwDisplayBitDepth <= 8) ? PFD_TYPE_COLORINDEX : PFD_TYPE_RGBA; + dwRb = BitCount(ddsdDisplayMode.ddpfPixelFormat.dwRBitMask); + dwGb = BitCount(ddsdDisplayMode.ddpfPixelFormat.dwGBitMask); + dwBb = BitCount(ddsdDisplayMode.ddpfPixelFormat.dwBBitMask); + dwRs = BitShift(ddsdDisplayMode.ddpfPixelFormat.dwRBitMask); + dwGs = BitShift(ddsdDisplayMode.ddpfPixelFormat.dwGBitMask); + dwBs = BitShift(ddsdDisplayMode.ddpfPixelFormat.dwBBitMask); + + if (BitCount(ddsdDisplayMode.ddpfPixelFormat.dwRGBAlphaBitMask)) { + dwAb = BitCount(ddsdDisplayMode.ddpfPixelFormat.dwRGBAlphaBitMask); + dwAs = BitShift(ddsdDisplayMode.ddpfPixelFormat.dwRGBAlphaBitMask); + } else { + dwAb = 0; + dwAs = 0; + } + + // Query for available display modes + ddlogMessage(DDLOG_INFO, "\n"); + ddlogMessage(DDLOG_INFO, "Display Modes:\n"); + + // Pass 1: Determine count + iEnumCount = 0; + hRes = IDirectDraw4_EnumDisplayModes( + lpDD4, + 0, + NULL, + NULL, + EnumDisplayModesCallback); + if (FAILED(hRes)) { + ddlogError(DDLOG_ERROR, "dglBPFL: EnumDisplayModes failed", hRes); + goto clean_up; + } + if (iEnumCount == 0) { + ddlogMessage(DDLOG_ERROR, "dglBPFL: No display modes found"); + goto clean_up; + } + glb.lpDisplayModes = (DDSURFACEDESC2 *)calloc(iEnumCount, + sizeof(DDSURFACEDESC2)); + if (glb.lpDisplayModes == NULL) { + ddlogMessage(DDLOG_ERROR, "dglBPFL: DDSURFACEDESC2 calloc failed"); + goto clean_up; + } + glb.nDisplayModeCount = iEnumCount; + // Pass 2: Save modes + iEnumCount = 0; + hRes = IDirectDraw4_EnumDisplayModes( + lpDD4, + 0, + NULL, + (void *)glb.lpDisplayModes, + EnumDisplayModesCallback); + if (FAILED(hRes)) { + ddlogError(DDLOG_ERROR, "dglBPFL: EnumDisplayModes failed", hRes); + goto clean_up; + } + // Query for IDirect3D3 interface + hRes = IDirectDraw4_QueryInterface( + lpDD4, + &IID_IDirect3D3, + (void**)&lpD3D3); + if (FAILED(hRes)) { + ddlogError(DDLOG_ERROR, "dglBPFL: QueryInterface (D3D3) failed", hRes); + goto clean_up; + } + + ddlogMessage(DDLOG_INFO, "\n"); + ddlogMessage(DDLOG_INFO, "ZBuffer formats:\n"); + + // Pass 1. Count the ZBuffer pixel formats + hRes = IDirect3D3_EnumZBufferFormats( + lpD3D3, + &glb.d3dGuid, + d3dEnumZBufferFormatsCallback, + NULL); + + if (FAILED(hRes)) + goto clean_up; + + if (glb.nZBufferPFCount) { + glb.lpZBufferPF = (DDPIXELFORMAT *)calloc(glb.nZBufferPFCount, + sizeof(DDPIXELFORMAT)); + if(glb.lpZBufferPF == NULL) + goto clean_up; + + // Pass 2. Cache the ZBuffer pixel formats + iEnumCount = 0; // (Used by the enum function) + hRes = IDirect3D3_EnumZBufferFormats( + lpD3D3, + &glb.d3dGuid, + d3dEnumZBufferFormatsCallback, + glb.lpZBufferPF); + + if (FAILED(hRes)) + goto clean_up; + } + + // Remove stencil support for boards which don't work for AutoCAD; + // Matrox G400 does not work, but NVidia TNT2 and ATI Rage128 do... (DaveM) + if (IsStencilSupportBroken(lpDD4)) { + for (i=0; iiZBufferPF = i-1; + lpPF->pfd.cDepthBits = glb.lpZBufferPF[i-1].dwZBufferBitDepth; + lpPF->pfd.cStencilBits = glb.lpZBufferPF[i-1].dwStencilBitDepth; + } + } + // Fill in the single-buffered pixel formats + for (i=0; i<(glb.nZBufferPFCount + 1); i++, lpPF++) { + memcpy(lpPF, &pfTemplateHW, sizeof(DGL_pixelFormat)); + if (i) { + lpPF->iZBufferPF = i-1; + lpPF->pfd.cDepthBits = glb.lpZBufferPF[i-1].dwZBufferBitDepth; + lpPF->pfd.cStencilBits = glb.lpZBufferPF[i-1].dwStencilBitDepth; + } + // Remove double-buffer flag. Could use XOR instead... + lpPF->pfd.dwFlags &= (~(PFD_DOUBLEBUFFER)); + // Insert GDI flag for single buffered format only. + lpPF->pfd.dwFlags |= PFD_SUPPORT_GDI; + } +#endif // _USE_GLD3_WGL + + // Lets dump the list to the log + // ** Based on "wglinfo" by Nate Robins ** + ddlogMessage(DDLOG_INFO, "\n"); + ddlogMessage(DDLOG_INFO, "Pixel Formats:\n"); + ddlogMessage(DDLOG_INFO, + " visual x bf lv rg d st r g b a ax dp st accum buffs ms\n"); + ddlogMessage(DDLOG_INFO, + " id dep cl sp sz l ci b ro sz sz sz sz bf th cl r g b a ns b\n"); + ddlogMessage(DDLOG_INFO, + "-----------------------------------------------------------------\n"); + for (i=0, lpPF = glb.lpPF; ipfd.cColorBits); + strcat(buf, cat); + if(lpPF->pfd.dwFlags & PFD_DRAW_TO_WINDOW) sprintf(cat, "wn "); + else if(lpPF->pfd.dwFlags & PFD_DRAW_TO_BITMAP) sprintf(cat, "bm "); + else sprintf(cat, ". "); + strcat(buf, cat); + + /* should find transparent pixel from LAYERPLANEDESCRIPTOR */ + sprintf(cat, " . "); + strcat(buf, cat); + + sprintf(cat, "%2d ", lpPF->pfd.cColorBits); + strcat(buf, cat); + + /* bReserved field indicates number of over/underlays */ + if(lpPF->pfd.bReserved) sprintf(cat, " %d ", lpPF->pfd.bReserved); + else sprintf(cat, " . "); + strcat(buf, cat); + + sprintf(cat, " %c ", lpPF->pfd.iPixelType == PFD_TYPE_RGBA ? 'r' : 'c'); + strcat(buf, cat); + + sprintf(cat, "%c ", lpPF->pfd.dwFlags & PFD_DOUBLEBUFFER ? 'y' : '.'); + strcat(buf, cat); + + sprintf(cat, " %c ", lpPF->pfd.dwFlags & PFD_STEREO ? 'y' : '.'); + strcat(buf, cat); + + if(lpPF->pfd.cRedBits && lpPF->pfd.iPixelType == PFD_TYPE_RGBA) + sprintf(cat, "%2d ", lpPF->pfd.cRedBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(lpPF->pfd.cGreenBits && lpPF->pfd.iPixelType == PFD_TYPE_RGBA) + sprintf(cat, "%2d ", lpPF->pfd.cGreenBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(lpPF->pfd.cBlueBits && lpPF->pfd.iPixelType == PFD_TYPE_RGBA) + sprintf(cat, "%2d ", lpPF->pfd.cBlueBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(lpPF->pfd.cAlphaBits && lpPF->pfd.iPixelType == PFD_TYPE_RGBA) + sprintf(cat, "%2d ", lpPF->pfd.cAlphaBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(lpPF->pfd.cAuxBuffers) sprintf(cat, "%2d ", lpPF->pfd.cAuxBuffers); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(lpPF->pfd.cDepthBits) sprintf(cat, "%2d ", lpPF->pfd.cDepthBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(lpPF->pfd.cStencilBits) sprintf(cat, "%2d ", lpPF->pfd.cStencilBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(lpPF->pfd.cAccumRedBits) sprintf(cat, "%2d ", lpPF->pfd.cAccumRedBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(lpPF->pfd.cAccumGreenBits) sprintf(cat, "%2d ", lpPF->pfd.cAccumGreenBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(lpPF->pfd.cAccumBlueBits) sprintf(cat, "%2d ", lpPF->pfd.cAccumBlueBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(lpPF->pfd.cAccumAlphaBits) sprintf(cat, "%2d ", lpPF->pfd.cAccumAlphaBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + /* no multisample in Win32 */ + sprintf(cat, " . .\n"); + strcat(buf, cat); + + ddlogMessage(DDLOG_INFO, buf); + } + ddlogMessage(DDLOG_INFO, + "-----------------------------------------------------------------\n"); + ddlogMessage(DDLOG_INFO, "\n"); + +#ifndef _USE_GLD3_WGL +clean_up: + // Release COM objects + RELEASE(lpD3D3); + RELEASE(lpDD4); + RELEASE(lpDD1); + + // Popup warning message if non RGB color mode + if (dwDisplayBitDepth <= 8) { + ddlogPrintf(DDLOG_WARN, "Current Color Depth %d bpp is not supported", dwDisplayBitDepth); + MessageBox(NULL, szColorDepthWarning, "GLDirect", MB_OK | MB_ICONWARNING); + } +#endif // _USE_GLD3_WGL +} + +// *********************************************************************** + +void dglReleasePixelFormatList() +{ + glb.nPixelFormatCount = 0; + if (glb.lpPF) { + free(glb.lpPF); + glb.lpPF = NULL; + } +#ifndef _USE_GLD3_WGL + glb.nZBufferPFCount = 0; + if (glb.lpZBufferPF) { + free(glb.lpZBufferPF); + glb.lpZBufferPF = NULL; + } + glb.nDisplayModeCount = 0; + if (glb.lpDisplayModes) { + free(glb.lpDisplayModes); + glb.lpDisplayModes = NULL; + } +#endif // _USE_GLD3_WGL +} + +// *********************************************************************** diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/dglpf.h b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglpf.h new file mode 100644 index 00000000000..8a7e38c4b39 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglpf.h @@ -0,0 +1,77 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: Pixel Formats. +* +****************************************************************************/ + +#ifndef __DGLPF_H +#define __DGLPF_H + +#ifndef STRICT +#define STRICT +#endif // STRICT +#define WIN32_LEAN_AND_MEAN + +#include + +/*---------------------- Macros and type definitions ----------------------*/ + +typedef struct { + PIXELFORMATDESCRIPTOR pfd; // Win32 Pixel Format Descriptor +#ifdef _USE_GLD3_WGL + // Driver-specific data. + // Example: The DX8 driver uses this to hold an index into a + // list of depth-stencil descriptions. + DWORD dwDriverData; +#else + int iZBufferPF; // Index of depth buffer pixel format +#endif +} DGL_pixelFormat; + +#include "dglglobals.h" + +/*------------------------- Function Prototypes ---------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL IsValidPFD(int iPFD); +void dglBuildPixelFormatList(); +void dglReleasePixelFormatList(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/dglwgl.c b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglwgl.c new file mode 100644 index 00000000000..74ecb01a5b0 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglwgl.c @@ -0,0 +1,2964 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: OpenGL window functions (wgl*). +* +****************************************************************************/ + +#include "dglwgl.h" +#ifdef _USE_GLD3_WGL +#include "gld_driver.h" +#endif + +#include "gl/glu.h" // MUST USE MICROSOFT'S GLU32! + +#ifndef _USE_GLD3_WGL +extern DGL_mesaFuncs mesaFuncs; +#endif + +// Need to export wgl* functions if using GLD3, +// otherwise export GLD2 DGL_* functions. +#ifdef _USE_GLD3_WGL +#define _GLD_WGL_EXPORT(a) wgl##a +#else +#define _GLD_WGL_EXPORT(a) DGL_##a +#endif + +// Calls into Mesa 4.x are different +#ifdef _USE_GLD3_WGL +#include "dlist.h" +#include "drawpix.h" +#include "get.h" +#include "matrix.h" +// NOTE: All the _GLD* macros now call the gl* functions direct. +// This ensures that the correct internal pathway is taken. KeithH +#define _GLD_glNewList glNewList +#define _GLD_glBitmap glBitmap +#define _GLD_glEndList glEndList +#define _GLD_glDeleteLists glDeleteLists +#define _GLD_glGetError glGetError +#define _GLD_glTranslatef glTranslatef +#define _GLD_glBegin glBegin +#define _GLD_glVertex2fv glVertex2fv +#define _GLD_glEnd glEnd +#define _GLD_glNormal3f glNormal3f +#define _GLD_glVertex3f glVertex3f +#define _GLD_glVertex3fv glVertex3fv +#else // _USE_GLD3_WGL +#define _GLD_glNewList (*mesaFuncs.glNewList) +#define _GLD_glBitmap (*mesaFuncs.glBitmap) +#define _GLD_glEndList (*mesaFuncs.glEndList) +#define _GLD_glDeleteLists (*mesaFuncs.glDeleteLists) +#define _GLD_glGetError (*mesaFuncs.glGetError) +#define _GLD_glTranslatef (*mesaFuncs.glTranslatef) +#define _GLD_glBegin (*mesaFuncs.glBegin) +#define _GLD_glVertex2fv (*mesaFuncs.glVertex2fv) +#define _GLD_glEnd (*mesaFuncs.glEnd) +#define _GLD_glNormal3f (*mesaFuncs.glNormal3f) +#define _GLD_glVertex3f (*mesaFuncs.glVertex3f) +#define _GLD_glVertex3fv (*mesaFuncs.glVertex3fv) +#endif // _USE_GLD3_WGL + +// *********************************************************************** + +// Emulate SGI DDK calls. +#define __wglMalloc(a) GlobalAlloc(GPTR, (a)) +#define __wglFree(a) GlobalFree((a)) + +// *********************************************************************** + +// Mesa glu.h and MS glu.h call these different things... +//#define GLUtesselator GLUtriangulatorObj +//#define GLU_TESS_VERTEX_DATA GLU_VERTEX_DATA + +// For wglFontOutlines + +typedef GLUtesselator *(APIENTRY *gluNewTessProto)(void); +typedef void (APIENTRY *gluDeleteTessProto)(GLUtesselator *tess); +typedef void (APIENTRY *gluTessBeginPolygonProto)(GLUtesselator *tess, void *polygon_data); +typedef void (APIENTRY *gluTessBeginContourProto)(GLUtesselator *tess); +typedef void (APIENTRY *gluTessVertexProto)(GLUtesselator *tess, GLdouble coords[3], void *data); +typedef void (APIENTRY *gluTessEndContourProto)(GLUtesselator *tess); +typedef void (APIENTRY *gluTessEndPolygonProto)(GLUtesselator *tess); +typedef void (APIENTRY *gluTessPropertyProto)(GLUtesselator *tess, GLenum which, GLdouble value); +typedef void (APIENTRY *gluTessNormalProto)(GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRY *gluTessCallbackProto)(GLUtesselator *tess, GLenum which, void (CALLBACK *)()); + +static HINSTANCE gluModuleHandle; +static gluNewTessProto gluNewTessProc; +static gluDeleteTessProto gluDeleteTessProc; +static gluTessBeginPolygonProto gluTessBeginPolygonProc; +static gluTessBeginContourProto gluTessBeginContourProc; +static gluTessVertexProto gluTessVertexProc; +static gluTessEndContourProto gluTessEndContourProc; +static gluTessEndPolygonProto gluTessEndPolygonProc; +static gluTessPropertyProto gluTessPropertyProc; +static gluTessNormalProto gluTessNormalProc; +static gluTessCallbackProto gluTessCallbackProc; + +static HFONT hNewFont, hOldFont; +static FLOAT ScaleFactor; + +#define LINE_BUF_QUANT 4000 +#define VERT_BUF_QUANT 4000 + +static FLOAT* LineBuf; +static DWORD LineBufSize; +static DWORD LineBufIndex; +static FLOAT* VertBuf; +static DWORD VertBufSize; +static DWORD VertBufIndex; +static GLenum TessErrorOccurred; + +static int AppendToLineBuf( + FLOAT value); + +static int AppendToVertBuf( + FLOAT value); + +static int DrawGlyph( + UCHAR* glyphBuf, + DWORD glyphSize, + FLOAT chordalDeviation, + FLOAT extrusion, + INT format); + +static void FreeLineBuf(void); + +static void FreeVertBuf(void); + +static long GetWord( + UCHAR** p); + +static long GetDWord( + UCHAR** p); + +static double GetFixed( + UCHAR** p); + +static int InitLineBuf(void); + +static int InitVertBuf(void); + +static HFONT CreateHighResolutionFont( + HDC hDC); + +static int MakeDisplayListFromGlyph( + DWORD listName, + UCHAR* glyphBuf, + DWORD glyphSize, + LPGLYPHMETRICSFLOAT glyphMetricsFloat, + FLOAT chordalDeviation, + FLOAT extrusion, + INT format); + +static BOOL LoadGLUTesselator(void); +static BOOL UnloadGLUTesselator(void); + +static int MakeLinesFromArc( + FLOAT x0, + FLOAT y0, + FLOAT x1, + FLOAT y1, + FLOAT x2, + FLOAT y2, + DWORD vertexCountIndex, + FLOAT chordalDeviationSquared); + +static int MakeLinesFromGlyph( UCHAR* glyphBuf, + DWORD glyphSize, + FLOAT chordalDeviation); + +static int MakeLinesFromTTLine( UCHAR** pp, + DWORD vertexCountIndex, + WORD pointCount); + +static int MakeLinesFromTTPolycurve( UCHAR** pp, + DWORD vertexCountIndex, + FLOAT chordalDeviation); + +static int MakeLinesFromTTPolygon( UCHAR** pp, + FLOAT chordalDeviation); + +static int MakeLinesFromTTQSpline( UCHAR** pp, + DWORD vertexCountIndex, + WORD pointCount, + FLOAT chordalDeviation); + +static void CALLBACK TessCombine( double coords[3], + void* vertex_data[4], + FLOAT weight[4], + void** outData); + +static void CALLBACK TessError( GLenum error); + +static void CALLBACK TessVertexOutData( FLOAT p[3], + GLfloat z); + +// *********************************************************************** + +#ifdef GLD_THREADS +#pragma message("compiling DGLWGL.C vars for multi-threaded support") +extern CRITICAL_SECTION CriticalSection; +extern DWORD dwTLSPixelFormat; // TLS index for current pixel format +#endif +int curPFD = 0; // Current PFD (static) + +// *********************************************************************** + +int dglGetPixelFormat(void) +{ +#ifdef GLD_THREADS + int iPixelFormat; + // get thread-specific instance + if (glb.bMultiThreaded) { + __try { + iPixelFormat = (int)TlsGetValue(dwTLSPixelFormat); + } + __except(EXCEPTION_EXECUTE_HANDLER) { + iPixelFormat = curPFD; + } + } + // get global static var + else { + iPixelFormat = curPFD; + } + return iPixelFormat; +#else + return curPFD; +#endif +} + +// *********************************************************************** + +void dglSetPixelFormat(int iPixelFormat) +{ +#ifdef GLD_THREADS + // set thread-specific instance + if (glb.bMultiThreaded) { + __try { + TlsSetValue(dwTLSPixelFormat, (LPVOID)iPixelFormat); + } + __except(EXCEPTION_EXECUTE_HANDLER) { + curPFD = iPixelFormat; + } + } + // set global static var + else { + curPFD = iPixelFormat; + } +#else + curPFD = iPixelFormat; +#endif +} + +// *********************************************************************** + +int APIENTRY _GLD_WGL_EXPORT(ChoosePixelFormat)( + HDC a, + CONST PIXELFORMATDESCRIPTOR *ppfd) +{ + DGL_pixelFormat *lpPF = glb.lpPF; + + PIXELFORMATDESCRIPTOR ppfdBest; + int i; + int bestIndex = -1; + int numPixelFormats; + DWORD dwFlags; + + char buf[128]; + char cat[8]; + + DWORD dwAllFlags = + PFD_DRAW_TO_WINDOW | + PFD_DRAW_TO_BITMAP | + PFD_SUPPORT_GDI | + PFD_SUPPORT_OPENGL | + PFD_GENERIC_FORMAT | + PFD_NEED_PALETTE | + PFD_NEED_SYSTEM_PALETTE | + PFD_DOUBLEBUFFER | + PFD_STEREO | + /*PFD_SWAP_LAYER_BUFFERS |*/ + PFD_DOUBLEBUFFER_DONTCARE | + PFD_STEREO_DONTCARE | + PFD_SWAP_COPY | + PFD_SWAP_EXCHANGE | + PFD_GENERIC_ACCELERATED | + 0; + + // Validate license + if (!dglValidate()) + return 0; + + // List may not be built until dglValidate() is called! KeithH + lpPF = glb.lpPF; + + // + // Lets print the input pixel format to the log + // ** Based on "wglinfo" by Nate Robins ** + // + ddlogMessage(DDLOG_SYSTEM, "ChoosePixelFormat:\n"); + ddlogMessage(DDLOG_INFO, "Input pixel format for ChoosePixelFormat:\n"); + ddlogMessage(DDLOG_INFO, + " visual x bf lv rg d st r g b a ax dp st accum buffs ms\n"); + ddlogMessage(DDLOG_INFO, + " id dep cl sp sz l ci b ro sz sz sz sz bf th cl r g b a ns b\n"); + ddlogMessage(DDLOG_INFO, + "-----------------------------------------------------------------\n"); + sprintf(buf, " . "); + + sprintf(cat, "%2d ", ppfd->cColorBits); + strcat(buf, cat); + if(ppfd->dwFlags & PFD_DRAW_TO_WINDOW) sprintf(cat, "wn "); + else if(ppfd->dwFlags & PFD_DRAW_TO_BITMAP) sprintf(cat, "bm "); + else sprintf(cat, ". "); + strcat(buf, cat); + + /* should find transparent pixel from LAYERPLANEDESCRIPTOR */ + sprintf(cat, " . "); + strcat(buf, cat); + + sprintf(cat, "%2d ", ppfd->cColorBits); + strcat(buf, cat); + + /* bReserved field indicates number of over/underlays */ + if(ppfd->bReserved) sprintf(cat, " %d ", ppfd->bReserved); + else sprintf(cat, " . "); + strcat(buf, cat); + + sprintf(cat, " %c ", ppfd->iPixelType == PFD_TYPE_RGBA ? 'r' : 'c'); + strcat(buf, cat); + + sprintf(cat, "%c ", ppfd->dwFlags & PFD_DOUBLEBUFFER ? 'y' : '.'); + strcat(buf, cat); + + sprintf(cat, " %c ", ppfd->dwFlags & PFD_STEREO ? 'y' : '.'); + strcat(buf, cat); + + if(ppfd->cRedBits && ppfd->iPixelType == PFD_TYPE_RGBA) + sprintf(cat, "%2d ", ppfd->cRedBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(ppfd->cGreenBits && ppfd->iPixelType == PFD_TYPE_RGBA) + sprintf(cat, "%2d ", ppfd->cGreenBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(ppfd->cBlueBits && ppfd->iPixelType == PFD_TYPE_RGBA) + sprintf(cat, "%2d ", ppfd->cBlueBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(ppfd->cAlphaBits && ppfd->iPixelType == PFD_TYPE_RGBA) + sprintf(cat, "%2d ", ppfd->cAlphaBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(ppfd->cAuxBuffers) sprintf(cat, "%2d ", ppfd->cAuxBuffers); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(ppfd->cDepthBits) sprintf(cat, "%2d ", ppfd->cDepthBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(ppfd->cStencilBits) sprintf(cat, "%2d ", ppfd->cStencilBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(ppfd->cAccumRedBits) sprintf(cat, "%2d ", ppfd->cAccumRedBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(ppfd->cAccumGreenBits) sprintf(cat, "%2d ", ppfd->cAccumGreenBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(ppfd->cAccumBlueBits) sprintf(cat, "%2d ", ppfd->cAccumBlueBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + if(ppfd->cAccumAlphaBits) sprintf(cat, "%2d ", ppfd->cAccumAlphaBits); + else sprintf(cat, " . "); + strcat(buf, cat); + + /* no multisample in Win32 */ + sprintf(cat, " . .\n"); + strcat(buf, cat); + + ddlogMessage(DDLOG_INFO, buf); + ddlogMessage(DDLOG_INFO, + "-----------------------------------------------------------------\n"); + ddlogMessage(DDLOG_INFO, "\n"); + + // + // Examine the flags for correctness + // + dwFlags = ppfd->dwFlags; + if (dwFlags != (dwFlags & dwAllFlags)) + { + /* error: bad dwFlags */ + ddlogPrintf(DDLOG_WARN, + "ChoosePixelFormat: bad flags (0x%x)", + dwFlags & (~dwAllFlags)); + // Mask illegal flags and continue + dwFlags = dwFlags & dwAllFlags; + } + + switch (ppfd->iPixelType) { + case PFD_TYPE_RGBA: + case PFD_TYPE_COLORINDEX: + break; + default: + /* error: bad iPixelType */ + ddlogMessage(DDLOG_WARN, "ChoosePixelFormat: bad pixel type\n"); + return 0; + } + + switch (ppfd->iLayerType) { + case PFD_MAIN_PLANE: + case PFD_OVERLAY_PLANE: + case PFD_UNDERLAY_PLANE: + break; + default: + /* error: bad iLayerType */ + ddlogMessage(DDLOG_WARN, "ChoosePixelFormat: bad layer type\n"); + return 0; + } + + numPixelFormats = glb.nPixelFormatCount; + + /* loop through candidate pixel format descriptors */ + for (i=0; iiPixelType != ppfdCandidate.iPixelType) { + continue; + } + + if (ppfd->iLayerType != ppfdCandidate.iLayerType) { + continue; + } + + if (((dwFlags ^ ppfdCandidate.dwFlags) & dwFlags) & + (PFD_DRAW_TO_WINDOW | PFD_DRAW_TO_BITMAP | + PFD_SUPPORT_GDI | PFD_SUPPORT_OPENGL)) + { + continue; + } + + if (!(dwFlags & PFD_DOUBLEBUFFER_DONTCARE)) { + if ((dwFlags & PFD_DOUBLEBUFFER) != + (ppfdCandidate.dwFlags & PFD_DOUBLEBUFFER)) + { + continue; + } + } + +// if (!(dwFlags & PFD_STEREO_DONTCARE)) { + if ((dwFlags & PFD_STEREO) != + (ppfdCandidate.dwFlags & PFD_STEREO)) + { + continue; + } +// } + + if (ppfd->iPixelType==PFD_TYPE_RGBA + && ppfd->cAlphaBits && !ppfdCandidate.cAlphaBits) { + continue; + } + + if (ppfd->iPixelType==PFD_TYPE_RGBA + && ppfd->cAccumBits && !ppfdCandidate.cAccumBits) { + continue; + } + + if (ppfd->cDepthBits && !ppfdCandidate.cDepthBits) { + continue; + } + + if (ppfd->cStencilBits && !ppfdCandidate.cStencilBits) { + continue; + } + + if (ppfd->cAuxBuffers && !ppfdCandidate.cAuxBuffers) { + continue; + } + + /* + ** See if candidate is better than the previous best choice + */ + if (bestIndex == -1) { + ppfdBest = ppfdCandidate; + bestIndex = i; + continue; + } + + if ((ppfd->cColorBits > ppfdBest.cColorBits && + ppfdCandidate.cColorBits > ppfdBest.cColorBits) || + (ppfd->cColorBits <= ppfdCandidate.cColorBits && + ppfdCandidate.cColorBits < ppfdBest.cColorBits)) + { + ppfdBest = ppfdCandidate; + bestIndex = i; + continue; + } + + if (ppfd->iPixelType==PFD_TYPE_RGBA + && ppfd->cAlphaBits + && ppfdCandidate.cAlphaBits > ppfdBest.cAlphaBits) + { + ppfdBest = ppfdCandidate; + bestIndex = i; + continue; + } + + if (ppfd->iPixelType==PFD_TYPE_RGBA + && ppfd->cAccumBits + && ppfdCandidate.cAccumBits > ppfdBest.cAccumBits) + { + ppfdBest = ppfdCandidate; + bestIndex = i; + continue; + } + + if ((ppfd->cDepthBits > ppfdBest.cDepthBits && + ppfdCandidate.cDepthBits > ppfdBest.cDepthBits) || + (ppfd->cDepthBits <= ppfdCandidate.cDepthBits && + ppfdCandidate.cDepthBits < ppfdBest.cDepthBits)) + { + ppfdBest = ppfdCandidate; + bestIndex = i; + continue; + } + + if (ppfd->cStencilBits && + ppfdCandidate.cStencilBits > ppfdBest.cStencilBits) + { + ppfdBest = ppfdCandidate; + bestIndex = i; + continue; + } + + if (ppfd->cAuxBuffers && + ppfdCandidate.cAuxBuffers > ppfdBest.cAuxBuffers) + { + ppfdBest = ppfdCandidate; + bestIndex = i; + continue; + } + } + + if (bestIndex != -1) { + ddlogPrintf(DDLOG_SYSTEM, "Pixel Format %d chosen as best match", bestIndex+1); + return bestIndex + 1; + } + + // Return the pixelformat that has the most capabilities. + // ** NOTE: This is only possible due to the way the list + // of pixelformats is built. ** + // Now picks best pixelformat. KeithH + bestIndex = numPixelFormats; // most capable double buffer format + ddlogPrintf(DDLOG_SYSTEM, "Pixel Format %d chosen by default", bestIndex); + return (bestIndex); +} + +// *********************************************************************** + +BOOL APIENTRY _GLD_WGL_EXPORT(CopyContext)( + HGLRC a, + HGLRC b, + UINT c) +{ + // Validate license + if (!dglValidate()) + return FALSE; + UNSUPPORTED("wglCopyContext") + return FALSE; // Failed +} + +// *********************************************************************** + +HGLRC APIENTRY _GLD_WGL_EXPORT(CreateContext)( + HDC a) +{ + int ipf; + + // Validate license + if (!dglValidate()) + return 0; + + // Check that the current PFD is valid + ipf = dglGetPixelFormat(); + if (!IsValidPFD(ipf)) + return (HGLRC)0; + + return dglCreateContext(a, &glb.lpPF[ipf-1]); +} + +// *********************************************************************** + +HGLRC APIENTRY _GLD_WGL_EXPORT(CreateLayerContext)( + HDC a, + int b) +{ + // Validate license + if (!dglValidate()) + return 0; + + UNSUPPORTED("wglCreateLayerContext") + return NULL; // Failed +} + +// *********************************************************************** + +BOOL APIENTRY _GLD_WGL_EXPORT(DeleteContext)( + HGLRC a) +{ + // Validate license + if (!dglValidate()) + return FALSE; + + return dglDeleteContext(a); +} + +// *********************************************************************** + +BOOL APIENTRY _GLD_WGL_EXPORT(DescribeLayerPlane)( + HDC hDC, + int iPixelFormat, + int iLayerPlane, + UINT nBytes, + LPLAYERPLANEDESCRIPTOR plpd) +{ + // Validate license + if (!dglValidate()) + return FALSE; + + UNSUPPORTED("DGL_DescribeLayerPlane") + +// gldLogPrintf(GLDLOG_INFO, "DescribeLayerPlane: %d, %d", iPixelFormat, iLayerPlane); + + return FALSE; +} + +// *********************************************************************** + +int APIENTRY _GLD_WGL_EXPORT(DescribePixelFormat)( + HDC a, + int b, + UINT c, + LPPIXELFORMATDESCRIPTOR d) +{ + UINT nSize; + + // Validate license + if (!dglValidate()) + return 0; + + if (d == NULL) // Calling app requires max number of PF's + return glb.nPixelFormatCount; + + // The supplied buffer may be larger than the info that we + // will be copying. + if (c > sizeof(PIXELFORMATDESCRIPTOR)) + nSize = sizeof(PIXELFORMATDESCRIPTOR); + else + nSize = c; + + // Setup an empty PFD before doing validation check + memset(d, 0, nSize); + d->nSize = nSize; + d->nVersion = 1; + + if (!IsValidPFD(b)) + return 0; // Bail if PFD index is invalid + + memcpy(d, &glb.lpPF[b-1].pfd, nSize); + + return glb.nPixelFormatCount; +} + +// *********************************************************************** + +HGLRC APIENTRY _GLD_WGL_EXPORT(GetCurrentContext)(void) +{ + // Validate license + if (!dglValidate()) + return 0; + + return dglGetCurrentContext(); +} + +// *********************************************************************** + +HDC APIENTRY _GLD_WGL_EXPORT(GetCurrentDC)(void) +{ + // Validate license + if (!dglValidate()) + return 0; + + return dglGetCurrentDC(); +} + +// *********************************************************************** + +PROC APIENTRY _GLD_WGL_EXPORT(GetDefaultProcAddress)( + LPCSTR a) +{ + // Validate license + if (!dglValidate()) + return NULL; + + UNSUPPORTED("DGL_GetDefaultProcAddress") + return NULL; +} + +// *********************************************************************** + +int APIENTRY _GLD_WGL_EXPORT(GetLayerPaletteEntries)( + HDC a, + int b, + int c, + int d, + COLORREF *e) +{ + // Validate license + if (!dglValidate()) + return 0; + + UNSUPPORTED("DGL_GetLayerPaletteEntries") + return 0; +} + +// *********************************************************************** + +int APIENTRY _GLD_WGL_EXPORT(GetPixelFormat)( + HDC a) +{ + // Validate license + if (!dglValidate()) + return 0; + + return dglGetPixelFormat(); +} + +// *********************************************************************** + +PROC APIENTRY _GLD_WGL_EXPORT(GetProcAddress)( + LPCSTR a) +{ + PROC dglGetProcAddressD3D(LPCSTR a); + + // Validate license + if (!dglValidate()) + return NULL; + +#ifdef _USE_GLD3_WGL + return _gldDriver.wglGetProcAddress(a); +#else + return dglGetProcAddressD3D(a); +#endif +} + +// *********************************************************************** + +BOOL APIENTRY _GLD_WGL_EXPORT(MakeCurrent)( + HDC a, + HGLRC b) +{ + // Validate license + if (!dglValidate()) + return FALSE; + + return dglMakeCurrent(a, b); +} + +// *********************************************************************** + +BOOL APIENTRY _GLD_WGL_EXPORT(RealizeLayerPalette)( + HDC a, + int b, + BOOL c) +{ + // Validate license + if (!dglValidate()) + return FALSE; + + UNSUPPORTED("DGL_RealizeLayerPalette") + return FALSE; +} + +// *********************************************************************** + +int APIENTRY _GLD_WGL_EXPORT(SetLayerPaletteEntries)( + HDC a, + int b, + int c, + int d, + CONST COLORREF *e) +{ + // Validate license + if (!dglValidate()) + return 0; + + UNSUPPORTED("DGL_SetLayerPaletteEntries") + return 0; +} + +// *********************************************************************** + +BOOL APIENTRY _GLD_WGL_EXPORT(SetPixelFormat)( + HDC a, + int b, + CONST PIXELFORMATDESCRIPTOR *c) +{ + // Validate license + if (!dglValidate()) + return FALSE; + + if (IsValidPFD(b)) { + ddlogPrintf(DDLOG_SYSTEM, "SetPixelFormat: PixelFormat %d has been set", b); + dglSetPixelFormat(b); + return TRUE; + } else { + ddlogPrintf(DDLOG_ERROR, + "SetPixelFormat: PixelFormat %d is invalid and cannot be set", b); + return FALSE; + } +} + +// *********************************************************************** +/* + * Share lists between two gl_context structures. + * This was added for WIN32 WGL function support, since wglShareLists() + * must be called *after* wglCreateContext() with valid GLRCs. (DaveM) + */ +// +// Copied from GLD2.x. KeithH +// +static GLboolean _gldShareLists( + GLcontext *ctx1, + GLcontext *ctx2) +{ + /* Sanity check context pointers */ + if (ctx1 == NULL || ctx2 == NULL) + return GL_FALSE; + /* Sanity check shared list pointers */ + if (ctx1->Shared == NULL || ctx2->Shared == NULL) + return GL_FALSE; + /* Decrement reference count on sharee to release previous list */ + ctx2->Shared->RefCount--; +#if 0 /* 3DStudio exits on this memory release */ + if (ctx2->Shared->RefCount == 0) + free_shared_state(ctx2, ctx2->Shared); +#endif + /* Re-assign list from sharer to sharee and increment reference count */ + ctx2->Shared = ctx1->Shared; + ctx1->Shared->RefCount++; + return GL_TRUE; +} + +// *********************************************************************** + +BOOL APIENTRY _GLD_WGL_EXPORT(ShareLists)( + HGLRC a, + HGLRC b) +{ + DGL_ctx *dgl1, *dgl2; + + // Validate license + if (!dglValidate()) + return FALSE; + + // Mesa supports shared lists, but you need to supply the shared + // GL context info when calling gl_create_context(). An auxiliary + // function gl_share_lists() has been added to update the shared + // list info after the GL contexts have been created. (DaveM) + dgl1 = dglGetContextAddress(a); + dgl2 = dglGetContextAddress(b); + if (dgl1->bAllocated && dgl2->bAllocated) { +#ifdef _USE_GLD3_WGL + return _gldShareLists(dgl1->glCtx, dgl2->glCtx); +#else + return (*mesaFuncs.gl_share_lists)(dgl1->glCtx, dgl2->glCtx); +#endif + } + return FALSE; +} + +// *********************************************************************** + +BOOL APIENTRY _GLD_WGL_EXPORT(SwapBuffers)( + HDC a) +{ + // Validate license + if (!dglValidate()) + return FALSE; + + return dglSwapBuffers(a); +} + +// *********************************************************************** + +BOOL APIENTRY _GLD_WGL_EXPORT(SwapLayerBuffers)( + HDC a, + UINT b) +{ + // Validate license + if (!dglValidate()) + return FALSE; + + return dglSwapBuffers(a); +} + +// *********************************************************************** + +// *********************************************************************** +// Note: This ResizeBuffers() function may be called from +// either MESA glViewport() or GLD wglMakeCurrent(). + +BOOL dglWglResizeBuffers( + GLcontext *ctx, + BOOL bDefaultDriver) +{ + DGL_ctx *dgl = NULL; + RECT rcScreenRect; + DWORD dwWidth; + DWORD dwHeight; + DDSURFACEDESC2 ddsd2; + DDSCAPS2 ddscaps2; + IDirectDrawClipper *lpddClipper = NULL; + DWORD dwFlags; + HRESULT hResult; + + DWORD dwMemoryType; + + int i; + struct gl_texture_object *tObj; + struct gl_texture_image *image; + + BOOL bWasFullscreen; + BOOL bSaveDesktop; + BOOL bFullScrnWin = FALSE; + DDSURFACEDESC2 ddsd2DisplayMode; + + DDBLTFX ddbltfx; + POINT pt; + RECT rcDst; +#ifdef _USE_GLD3_WGL + GLD_displayMode glddm; +#endif + +#define DDLOG_CRITICAL_OR_WARN (bDefaultDriver ? DDLOG_WARN : DDLOG_CRITICAL) + + // Validate license + if (!dglValidate()) + return FALSE; + + // Sanity checks + if (ctx == NULL) + return FALSE; + dgl = ctx->DriverCtx; + if (dgl == NULL) + return FALSE; + + // Get the window size and calculate its dimensions + if (dgl->hWnd == NULL) { + // Check for non-window DC = memory DC ? + if (GetClipBox(dgl->hDC, &rcScreenRect) == ERROR) + SetRect(&rcScreenRect, 0, 0, 0, 0); + } + else if (!GetClientRect(dgl->hWnd, &rcScreenRect)) + SetRect(&rcScreenRect, 0, 0, 0, 0); + dwWidth = rcScreenRect.right - rcScreenRect.left; + dwHeight = rcScreenRect.bottom - rcScreenRect.top; + CopyRect(&dgl->rcScreenRect, &rcScreenRect); + + // This will occur on Alt-Tab + if ((dwWidth == 0) && (dwHeight == 0)) { + //dgl->bCanRender = FALSE; + return TRUE; // No resize possible! + } + + // Some apps zero only 1 dimension for non-visible window... (DaveM) + if ((dwWidth == 0) || (dwHeight == 0)) { + dwWidth = 8; + dwHeight = 8; + } + + // Test to see if a resize is required. + // Note that the dimensions will be the same if a prior resize attempt failed. + if ((dwWidth == dgl->dwWidth) && (dwHeight == dgl->dwHeight) && bDefaultDriver) { + return TRUE; // No resize required + } + + ddlogPrintf(DDLOG_SYSTEM, "dglResize: %dx%d", dwWidth, dwHeight); +#ifndef _USE_GLD3_WGL + // Work out where we want our surfaces created + dwMemoryType = (bDefaultDriver) ? glb.dwMemoryType : DDSCAPS_SYSTEMMEMORY; +#endif // _USE_GLD3_WGL + + // Note previous fullscreen vs window display status + bWasFullscreen = dgl->bFullscreen; + +#ifdef _USE_GLD3_WGL + if (_gldDriver.GetDisplayMode(dgl, &glddm)) { + if ( (dwWidth == glddm.Width) && + (dwHeight == glddm.Height) ) { + bFullScrnWin = TRUE; + } + if (bFullScrnWin && glb.bPrimary && !glb.bFullscreenBlit && !glb.bDirectDrawPersistant) { + dgl->bFullscreen = TRUE; + ddlogMessage(DDLOG_INFO, "Fullscreen window after resize.\n"); + } + else { + dgl->bFullscreen = FALSE; + ddlogMessage(DDLOG_INFO, "Non-Fullscreen window after resize.\n"); + } + // Cache the display mode dimensions + dgl->dwModeWidth = glddm.Width; + dgl->dwModeHeight = glddm.Height; + } + + // Clamp the effective window dimensions to primary surface. + // We need to do this for D3D viewport dimensions even if wide + // surfaces are supported. This also is a good idea for handling + // whacked-out window dimensions passed for non-drawable windows + // like Solid Edge. (DaveM) + if (dgl->dwWidth > glddm.Width) + dgl->dwWidth = glddm.Width; + if (dgl->dwHeight > glddm.Height) + dgl->dwHeight = glddm.Height; +#else // _USE_GLD3_WGL + // Window resize may have changed to fullscreen + ZeroMemory(&ddsd2DisplayMode, sizeof(ddsd2DisplayMode)); + ddsd2DisplayMode.dwSize = sizeof(ddsd2DisplayMode); + hResult = IDirectDraw4_GetDisplayMode( + dgl->lpDD4, + &ddsd2DisplayMode); + if (SUCCEEDED(hResult)) { + if ( (dwWidth == ddsd2DisplayMode.dwWidth) && + (dwHeight == ddsd2DisplayMode.dwHeight) ) { + bFullScrnWin = TRUE; + } + if (bFullScrnWin && glb.bPrimary && !glb.bFullscreenBlit && !glb.bDirectDrawPersistant) { + dgl->bFullscreen = TRUE; + ddlogMessage(DDLOG_INFO, "Fullscreen window after resize.\n"); + } + else { + dgl->bFullscreen = FALSE; + ddlogMessage(DDLOG_INFO, "Non-Fullscreen window after resize.\n"); + } + // Cache the display mode dimensions + dgl->dwModeWidth = ddsd2DisplayMode.dwWidth; + dgl->dwModeHeight = ddsd2DisplayMode.dwHeight; + } + + // Clamp the effective window dimensions to primary surface. + // We need to do this for D3D viewport dimensions even if wide + // surfaces are supported. This also is a good idea for handling + // whacked-out window dimensions passed for non-drawable windows + // like Solid Edge. (DaveM) + if (dgl->dwWidth > ddsd2DisplayMode.dwWidth) + dgl->dwWidth = ddsd2DisplayMode.dwWidth; + if (dgl->dwHeight > ddsd2DisplayMode.dwHeight) + dgl->dwHeight = ddsd2DisplayMode.dwHeight; +#endif // _USE_GLD3_WGL + + // Note if fullscreen vs window display has changed? + bSaveDesktop = (!bWasFullscreen && !dgl->bFullscreen) ? TRUE : FALSE; + // Save the desktop primary surface from being destroyed + // whenever remaining in windowed mode, since the stereo mode + // switches are expensive... + +#ifndef _USE_GLD3_WGL + // Don't need to re-allocate persistant buffers. (DaveM) + // Though we should clear the back buffers to hide artifacts. + if (glb.bDirectDrawPersistant && glb.bPersistantBuffers) { + dgl->dwWidth = dwWidth; + dgl->dwHeight = dwHeight; + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = dgl->dwClearColorPF; + IDirectDrawSurface4_Blt(dgl->lpBack4, &rcScreenRect, NULL, NULL, + DDBLT_WAIT | DDBLT_COLORFILL, &ddbltfx); + return TRUE; + } + + // Ensure all rendering is complete + if (ctx->Driver.Finish) + (*ctx->Driver.Finish)(ctx); + if (dgl->bSceneStarted == TRUE) { + IDirect3DDevice3_EndScene(dgl->lpDev3); + dgl->bSceneStarted = FALSE; + } +#endif // _USE_GLD3_WGL + dgl->bCanRender = FALSE; + +#ifdef GLD_THREADS + // Serialize access to DirectDraw and DDS operations + if (glb.bMultiThreaded) + EnterCriticalSection(&CriticalSection); +#endif + +#ifndef _USE_GLD3_WGL + // Release existing surfaces + RELEASE(dgl->lpDev3); + RELEASE(dgl->lpDepth4); + RELEASE(dgl->lpBack4); + if (glb.bDirectDrawPersistant && glb.bDirectDrawPrimary) + ; + else + RELEASE(dgl->lpFront4); +#endif // _USE_GLD3_WGL + dgl->dwWidth = dwWidth; + dgl->dwHeight = dwHeight; + + // Set defaults + dgl->dwModeWidth = dgl->dwWidth; + dgl->dwModeHeight = dgl->dwHeight; + +#ifdef _USE_GLD3_WGL + if (!_gldDriver.ResizeDrawable(dgl, bDefaultDriver, glb.bDirectDrawPersistant, glb.bPersistantBuffers)) + goto cleanup_and_return_with_error; +#else // _USE_GLD3_WGL + + if (dgl->bFullscreen) { + // + // FULLSCREEN + // + + // Disable warning popups when in fullscreen mode + ddlogWarnOption(FALSE); + + // Have to release the persistant DirectDraw primary surface + // if switching to fullscreen mode. So if application wants + // persistant display in fullscreen mode, a fullscreen-size + // window should be used instead via fullscreen-blit option. + if (glb.bDirectDrawPersistant && glb.bDirectDrawPrimary) { + RELEASE(glb.lpPrimary4); + glb.bDirectDrawPrimary = FALSE; + } + + dwFlags = DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT; + if (glb.bFastFPU) + dwFlags |= DDSCL_FPUSETUP; // optional + hResult = IDirectDraw4_SetCooperativeLevel(dgl->lpDD4, dgl->hWnd, dwFlags); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: Unable to set Exclusive Fullscreen mode", hResult); + goto cleanup_and_return_with_error; + } + + hResult = IDirectDraw4_SetDisplayMode(dgl->lpDD4, + dgl->dwModeWidth, + dgl->dwModeHeight, + dgl->dwBPP, + 0, + 0); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: SetDisplayMode failed", hResult); + goto cleanup_and_return_with_error; + } + + // ** The display mode has changed, so dont use MessageBox! ** + + ZeroMemory(&ddsd2, sizeof(ddsd2)); + ddsd2.dwSize = sizeof(ddsd2); + + if (dgl->bDoubleBuffer) { + // Double buffered + // Primary surface + ddsd2.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + DDSCAPS_FLIP | + DDSCAPS_COMPLEX | + DDSCAPS_3DDEVICE | + dwMemoryType; + ddsd2.dwBackBufferCount = 1; + hResult = IDirectDraw4_CreateSurface(dgl->lpDD4, &ddsd2, &dgl->lpFront4, NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: CreateSurface (primary) failed", hResult); + goto cleanup_and_return_with_error; + } + // Render target surface + ZeroMemory(&ddscaps2, sizeof(ddscaps2)); // Clear the entire struct. + ddscaps2.dwCaps = DDSCAPS_BACKBUFFER; + hResult = IDirectDrawSurface4_GetAttachedSurface(dgl->lpFront4, &ddscaps2, &dgl->lpBack4); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: GetAttachedSurface failed", hResult); + goto cleanup_and_return_with_error; + } + } else { + // Single buffered + // Primary surface + ddsd2.dwFlags = DDSD_CAPS; + ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + //DDSCAPS_3DDEVICE | + dwMemoryType; + + hResult = IDirectDraw4_CreateSurface(dgl->lpDD4, &ddsd2, &dgl->lpFront4, NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: CreateSurface (primary) failed", hResult); + goto cleanup_and_return_with_error; + } + + dgl->lpBack4 = NULL; + } + } else { + // WINDOWED + + // OK to enable warning popups in windowed mode + ddlogWarnOption(glb.bMessageBoxWarnings); + + // Ditto if persistant DirectDraw primary + if (glb.bDirectDrawPersistant && glb.bDirectDrawPrimary) + goto DoClipperOnly; + + // WINDOWED + dwFlags = DDSCL_NORMAL; + if (glb.bMultiThreaded) + dwFlags |= DDSCL_MULTITHREADED; + if (glb.bFastFPU) + dwFlags |= DDSCL_FPUSETUP; // optional + hResult = IDirectDraw4_SetCooperativeLevel(dgl->lpDD4, + dgl->hWnd, + dwFlags); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: Unable to set Normal coop level", hResult); + goto cleanup_and_return_with_error; + } + // Primary surface + ZeroMemory(&ddsd2, sizeof(ddsd2)); + ddsd2.dwSize = sizeof(ddsd2); + ddsd2.dwFlags = DDSD_CAPS; + ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + hResult = IDirectDraw4_CreateSurface(dgl->lpDD4, &ddsd2, &dgl->lpFront4, NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: CreateSurface (primary) failed", hResult); + goto cleanup_and_return_with_error; + } + + // Cache the primary surface for persistant DirectDraw state + if (glb.bDirectDrawPersistant && !glb.bDirectDrawPrimary) { + glb.lpPrimary4 = dgl->lpFront4; + IDirectDrawSurface4_AddRef(glb.lpPrimary4); + glb.bDirectDrawPrimary = TRUE; + } + + // Clipper object + hResult = DirectDrawCreateClipper(0, &lpddClipper, NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: CreateClipper failed", hResult); + goto cleanup_and_return_with_error; + } + hResult = IDirectDrawClipper_SetHWnd(lpddClipper, 0, dgl->hWnd); + if (FAILED(hResult)) { + RELEASE(lpddClipper); + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: SetHWnd failed", hResult); + goto cleanup_and_return_with_error; + } + hResult = IDirectDrawSurface4_SetClipper(dgl->lpFront4, lpddClipper); + RELEASE(lpddClipper); // We have finished with it. + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: SetClipper failed", hResult); + goto cleanup_and_return_with_error; + } +DoClipperOnly: + // Update the window for the original clipper + if ((glb.bDirectDrawPersistant && glb.bDirectDrawPrimary) || bSaveDesktop) { + IDirectDrawSurface4_GetClipper(dgl->lpFront4, &lpddClipper); + IDirectDrawClipper_SetHWnd(lpddClipper, 0, dgl->hWnd); + RELEASE(lpddClipper); + } + + if (dgl->bDoubleBuffer) { + // Render target surface + ZeroMemory(&ddsd2, sizeof(ddsd2)); + ddsd2.dwSize = sizeof(ddsd2); + ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + ddsd2.dwWidth = dgl->dwWidth; + ddsd2.dwHeight = dgl->dwHeight; + ddsd2.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | + DDSCAPS_OFFSCREENPLAIN | + dwMemoryType; + hResult = IDirectDraw4_CreateSurface(dgl->lpDD4, &ddsd2, &dgl->lpBack4, NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: Create Backbuffer failed", hResult); + goto cleanup_and_return_with_error; + } + + } else { + dgl->lpBack4 = NULL; + } + } + + // + // Now create the Zbuffer + // + if (dgl->bDepthBuffer) { + // Get z-buffer dimensions from the render target + // Setup the surface desc for the z-buffer. + ZeroMemory(&ddsd2, sizeof(ddsd2)); + ddsd2.dwSize = sizeof(ddsd2); + ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; + ddsd2.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | dwMemoryType; + ddsd2.dwWidth = dgl->dwWidth; + ddsd2.dwHeight = dgl->dwHeight; + memcpy(&ddsd2.ddpfPixelFormat, + &glb.lpZBufferPF[dgl->iZBufferPF], + sizeof(DDPIXELFORMAT) ); + + // Create a z-buffer + hResult = IDirectDraw4_CreateSurface(dgl->lpDD4, &ddsd2, &dgl->lpDepth4, NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: CreateSurface (ZBuffer) failed", hResult); + goto cleanup_and_return_with_error; + } + + // Attach Zbuffer to render target + TRY(IDirectDrawSurface4_AddAttachedSurface( + dgl->bDoubleBuffer ? dgl->lpBack4 : dgl->lpFront4, + dgl->lpDepth4), + "dglResize: Attach Zbuffer"); + + } + + // Clear the newly resized back buffers for the window client area. + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = dgl->dwClearColorPF; + IDirectDrawSurface4_Blt(dgl->lpBack4, &rcScreenRect, NULL, NULL, + DDBLT_WAIT | DDBLT_COLORFILL, &ddbltfx); + + // + // Now that we have a zbuffer we can create the 3D device + // + hResult = IDirect3D3_CreateDevice(dgl->lpD3D3, + bDefaultDriver ? &glb.d3dGuid : &IID_IDirect3DRGBDevice, + dgl->bDoubleBuffer ? dgl->lpBack4 : dgl->lpFront4, + &dgl->lpDev3, + NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: Could not create Direct3D device", hResult); + goto cleanup_and_return_with_error; + } + + // We must do this as soon as the device is created + dglInitStateCaches(dgl); + + // + // Viewport + // + hResult = IDirect3DDevice3_AddViewport(dgl->lpDev3, dgl->lpViewport3); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: AddViewport failed", hResult); + goto cleanup_and_return_with_error; + } + + // Initialise the viewport + dgl->d3dViewport.dwSize = sizeof(dgl->d3dViewport); + dgl->d3dViewport.dwX = 0; + dgl->d3dViewport.dwY = 0; + dgl->d3dViewport.dwWidth = dgl->dwWidth; + dgl->d3dViewport.dwHeight = dgl->dwHeight; + dgl->d3dViewport.dvClipX = 0; + dgl->d3dViewport.dvClipY = 0; + dgl->d3dViewport.dvClipWidth = dgl->dwWidth; + dgl->d3dViewport.dvClipHeight = dgl->dwHeight; +// dgl->d3dViewport.dvMinZ = 0.0f; +// dgl->d3dViewport.dvMaxZ = 1.0f; + TRY(IDirect3DViewport3_SetViewport2(dgl->lpViewport3, &dgl->d3dViewport), + "dglResize: SetViewport2"); + + hResult = IDirect3DDevice3_SetCurrentViewport(dgl->lpDev3, dgl->lpViewport3); + if (FAILED(hResult)) { + ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: SetCurrentViewport failed", hResult); + goto cleanup_and_return_with_error; + } + + // (Re)Initialise all the Direct3D renderstates + dglInitStateD3D(ctx); + + // Now we have to recreate all of our textures (+ mipmaps). + // Walk over all textures in hash table + // XXX what about the default texture objects (id=0)? + { + struct _mesa_HashTable *textures = ctx->Shared->TexObjects; + GLuint id; + for (id = _mesa_HashFirstEntry(textures); + id; + id = _mesa_HashNextEntry(textures, id)) { + tObj = (struct gl_texture_object *) _mesa_HashLookup(textures, id); + if (tObj->DriverData) { + // We could call our TexImage function directly, but it's + // safer to use the driver pointer. + for (i=0; iImage[i]; + if (image) { + switch (tObj->Dimensions){ + case 1: + if (ctx->Driver.TexImage) + (*ctx->Driver.TexImage)(ctx, GL_TEXTURE_1D, tObj, i, image->Format, image); + break; + case 2: + if (ctx->Driver.TexImage) + (*ctx->Driver.TexImage)(ctx, GL_TEXTURE_2D, tObj, i, image->Format, image); + break; + default: + break; + } + } + } + } + } + } + + // Re-Bind each texture Unit + for (i=0; iTexture.Unit[i].Current; + if (tObj) { + DGL_texture *lpTex = (DGL_texture *)tObj->DriverData; + hResult = dglSetTexture(dgl, i, lpTex ? lpTex->lpTexture : NULL); + if (FAILED(hResult)) { + ddlogError(DDLOG_ERROR, "dglResize: SetTexture failed", hResult); + } + } + } +#endif // _USE_GLD3_WGL + + dgl->bCanRender = TRUE; + +#ifdef GLD_THREADS + // Release serialized access + if (glb.bMultiThreaded) + LeaveCriticalSection(&CriticalSection); +#endif + + // SUCCESS. + return TRUE; + +cleanup_and_return_with_error: + // Relase all interfaces before returning. +#ifdef _USE_GLD3_WGL + _gldDriver.DestroyDrawable(dgl); +#else // _USE_GLD3_WGL + RELEASE(dgl->lpDev3); + RELEASE(dgl->lpDepth4); + RELEASE(dgl->lpBack4); + if (glb.bDirectDrawPersistant && glb.bDirectDrawPrimary) + ; + else + RELEASE(dgl->lpFront4); + +#undef DDLOG_CRITICAL_OR_WARN +#endif // _USE_GLD3_WGL + + // Mark context as not being able to render + dgl->bCanRender = FALSE; + +#ifdef GLD_THREADS + // Release serialized access + if (glb.bMultiThreaded) + LeaveCriticalSection(&CriticalSection); +#endif + + return FALSE; +} + +// *********************************************************************** +// *********************************************************************** +// Support for bitmap fonts. +// *********************************************************************** +// *********************************************************************** + +/***************************************************************************** +** +** InvertGlyphBitmap. +** +** Invert the bitmap so that it suits OpenGL's representation. +** Each row starts on a double word boundary. +** +*****************************************************************************/ + +static void InvertGlyphBitmap( + int w, + int h, + DWORD *fptr, + DWORD *tptr) +{ + int dWordsInRow = (w+31)/32; + int i, j; + DWORD *tmp = tptr; + + if (w <= 0 || h <= 0) { + return; + } + + tptr += ((h-1)*dWordsInRow); + for (i = 0; i < h; i++) { + for (j = 0; j < dWordsInRow; j++) { + *(tptr + j) = *(fptr + j); + } + tptr -= dWordsInRow; + fptr += dWordsInRow; + } +} + +// *********************************************************************** + +/***************************************************************************** + * wglUseFontBitmaps + * + * Converts a subrange of the glyphs in a GDI font to OpenGL display + * lists. + * + * Extended to support any GDI font, not just TrueType fonts. (DaveM) + * + *****************************************************************************/ + +BOOL APIENTRY _GLD_WGL_EXPORT(UseFontBitmapsA)( + HDC hDC, + DWORD first, + DWORD count, + DWORD listBase) +{ + int i, ox, oy, ix, iy; + int w, h; + int iBufSize, iCurBufSize = 0; + DWORD *bitmapBuffer = NULL; + DWORD *invertedBitmapBuffer = NULL; + BOOL bSuccessOrFail = TRUE; + BOOL bTrueType = FALSE; + TEXTMETRIC tm; + GLYPHMETRICS gm; + RASTERIZER_STATUS rs; + MAT2 mat; + SIZE size; + RECT rect; + HDC hDCMem; + HBITMAP hBitmap; + BITMAPINFO bmi; + HFONT hFont; + + // Validate SciTech DirectGL license + if (!dglValidate()) + return FALSE; + + // Set up a unity matrix. + ZeroMemory(&mat, sizeof(mat)); + mat.eM11.value = 1; + mat.eM22.value = 1; + + // Test to see if selected font is TrueType or not + ZeroMemory(&tm, sizeof(tm)); + if (!GetTextMetrics(hDC, &tm)) { + ddlogMessage(DDLOG_ERROR, "DGL_UseFontBitmaps: Font metrics error\n"); + return (FALSE); + } + bTrueType = (tm.tmPitchAndFamily & TMPF_TRUETYPE) ? TRUE : FALSE; + + // Test to see if TRUE-TYPE capabilities are installed + // (only necessary if TrueType font selected) + ZeroMemory(&rs, sizeof(rs)); + if (bTrueType) { + if (!GetRasterizerCaps (&rs, sizeof (RASTERIZER_STATUS))) { + ddlogMessage(DDLOG_ERROR, "DGL_UseFontBitmaps: Raster caps error\n"); + return (FALSE); + } + if (!(rs.wFlags & TT_ENABLED)) { + ddlogMessage(DDLOG_ERROR, "DGL_UseFontBitmaps: No TrueType caps\n"); + return (FALSE); + } + } + + // Trick to get the current font handle + hFont = SelectObject(hDC, GetStockObject(SYSTEM_FONT)); + SelectObject(hDC, hFont); + + // Have memory device context available for holding bitmaps of font glyphs + hDCMem = CreateCompatibleDC(hDC); + SelectObject(hDCMem, hFont); + SetTextColor(hDCMem, RGB(0xFF, 0xFF, 0xFF)); + SetBkColor(hDCMem, 0); + + for (i = first; (DWORD) i < (first + count); i++) { + // Find out how much space is needed for the bitmap so we can + // Set the buffer size correctly. + if (bTrueType) { + // Use TrueType support to get bitmap size of glyph + iBufSize = GetGlyphOutline(hDC, i, GGO_BITMAP, &gm, + 0, NULL, &mat); + if (iBufSize == GDI_ERROR) { + bSuccessOrFail = FALSE; + break; + } + } + else { + // Use generic GDI support to compute bitmap size of glyph + w = tm.tmMaxCharWidth; + h = tm.tmHeight; + if (GetTextExtentPoint32(hDC, (LPCTSTR)&i, 1, &size)) { + w = size.cx; + h = size.cy; + } + iBufSize = w * h; + // Use DWORD multiple for compatibility + iBufSize += 3; + iBufSize /= 4; + iBufSize *= 4; + } + + // If we need to allocate Larger Buffers, then do so - but allocate + // An extra 50 % so that we don't do too many mallocs ! + if (iBufSize > iCurBufSize) { + if (bitmapBuffer) { + __wglFree(bitmapBuffer); + } + if (invertedBitmapBuffer) { + __wglFree(invertedBitmapBuffer); + } + + iCurBufSize = iBufSize * 2; + bitmapBuffer = (DWORD *) __wglMalloc(iCurBufSize); + invertedBitmapBuffer = (DWORD *) __wglMalloc(iCurBufSize); + + if (bitmapBuffer == NULL || invertedBitmapBuffer == NULL) { + bSuccessOrFail = FALSE; + break; + } + } + + // If we fail to get the Glyph data, delete the display lists + // Created so far and return FALSE. + if (bTrueType) { + // Use TrueType support to get bitmap of glyph + if (GetGlyphOutline(hDC, i, GGO_BITMAP, &gm, + iBufSize, bitmapBuffer, &mat) == GDI_ERROR) { + bSuccessOrFail = FALSE; + break; + } + + // Setup glBitmap parameters for current font glyph + w = gm.gmBlackBoxX; + h = gm.gmBlackBoxY; + ox = gm.gmptGlyphOrigin.x; + oy = gm.gmptGlyphOrigin.y; + ix = gm.gmCellIncX; + iy = gm.gmCellIncY; + } + else { + // Use generic GDI support to create bitmap of glyph + ZeroMemory(bitmapBuffer, iBufSize); + + if (i >= tm.tmFirstChar && i <= tm.tmLastChar) { + // Only create bitmaps for actual font glyphs + hBitmap = CreateBitmap(w, h, 1, 1, NULL); + SelectObject(hDCMem, hBitmap); + // Make bitmap of current font glyph + SetRect(&rect, 0, 0, w, h); + DrawText(hDCMem, (LPCTSTR)&i, 1, &rect, + DT_LEFT | DT_BOTTOM | DT_SINGLELINE | DT_NOCLIP); + // Make copy of bitmap in our local buffer + ZeroMemory(&bmi, sizeof(bmi)); + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi.bmiHeader.biWidth = w; + bmi.bmiHeader.biHeight = -h; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 1; + bmi.bmiHeader.biCompression = BI_RGB; + GetDIBits(hDCMem, hBitmap, 0, h, bitmapBuffer, &bmi, 0); + DeleteObject(hBitmap); + } + else { + // Otherwise use empty display list for non-existing glyph + iBufSize = 0; + } + + // Setup glBitmap parameters for current font glyph + ox = 0; + oy = tm.tmDescent; + ix = w; + iy = 0; + } + + // Create an OpenGL display list. + _GLD_glNewList((listBase + i), GL_COMPILE); + + // Some fonts have no data for the space character, yet advertise + // a non-zero size. + if (0 == iBufSize) { + _GLD_glBitmap(0, 0, 0.0f, 0.0f, (GLfloat) ix, (GLfloat) iy, NULL); + } else { + // Invert the Glyph data. + InvertGlyphBitmap(w, h, bitmapBuffer, invertedBitmapBuffer); + + // Render an OpenGL bitmap and invert the origin. + _GLD_glBitmap(w, h, + (GLfloat) ox, (GLfloat) (h-oy), + (GLfloat) ix, (GLfloat) iy, + (GLubyte *) invertedBitmapBuffer); + } + + // Close this display list. + _GLD_glEndList(); + } + + if (bSuccessOrFail == FALSE) { + ddlogMessage(DDLOG_ERROR, "DGL_UseFontBitmaps: Get glyph failed\n"); + _GLD_glDeleteLists((i+listBase), (i-first)); + } + + // Release resources used + DeleteObject(hFont); + DeleteDC(hDCMem); + + if (bitmapBuffer) + __wglFree(bitmapBuffer); + if (invertedBitmapBuffer) + __wglFree(invertedBitmapBuffer); + + return(bSuccessOrFail); +} + +// *********************************************************************** + +BOOL APIENTRY _GLD_WGL_EXPORT(UseFontBitmapsW)( + HDC a, + DWORD b, + DWORD c, + DWORD d) +{ + // Validate license + if (!dglValidate()) + return FALSE; + + return _GLD_WGL_EXPORT(UseFontBitmapsA)(a, b, c, d); +} + +// *********************************************************************** +// *********************************************************************** +// Support for outline TrueType fonts. +// *********************************************************************** +// *********************************************************************** + +void * __wglRealloc( + void *oldPtr, + size_t newSize) +{ + void *newPtr = NULL; + + if (newSize != 0) { + newPtr = (void *) GlobalAlloc(GPTR, newSize); + if (oldPtr && newPtr) { + DWORD oldSize = GlobalSize(oldPtr); + + memcpy(newPtr, oldPtr, (oldSize <= newSize ? oldSize : newSize)); + GlobalFree(oldPtr); + } + } else if (oldPtr) { + GlobalFree(oldPtr); + } + if (newPtr == NULL) { + return NULL; /* XXX out of memory error */ + } + return newPtr; +} + +// *********************************************************************** + + +/***************************************************************************** + * wglUseFontOutlinesW + * + * Converts a subrange of the glyphs in a TrueType font to OpenGL display + * lists. + *****************************************************************************/ + +BOOL APIENTRY _GLD_WGL_EXPORT(UseFontOutlinesW)( + IN HDC hDC, + IN DWORD first, + IN DWORD count, + IN DWORD listBase, + IN FLOAT chordalDeviation, + IN FLOAT extrusion, + IN INT format, + OUT LPGLYPHMETRICSFLOAT lpgmf) +{ + return _GLD_WGL_EXPORT(UseFontOutlinesA)(hDC, first, count, listBase, + chordalDeviation, extrusion, format, lpgmf); +} + +/***************************************************************************** + * wglUseFontOutlinesA + * + * Converts a subrange of the glyphs in a TrueType font to OpenGL display + * lists. + *****************************************************************************/ + +BOOL APIENTRY _GLD_WGL_EXPORT(UseFontOutlinesA)( + IN HDC hDC, + IN DWORD first, + IN DWORD count, + IN DWORD listBase, + IN FLOAT chordalDeviation, + IN FLOAT extrusion, + IN INT format, + OUT LPGLYPHMETRICSFLOAT glyphMetricsFloatArray) + { + DWORD glyphIndex; + UCHAR* glyphBuf; + DWORD glyphBufSize; + + + /* + * Flush any previous OpenGL errors. This allows us to check for + * new errors so they can be reported via the function return value. + */ + while (_GLD_glGetError() != GL_NO_ERROR) + ; + + /* + * Make sure that the current font can be sampled accurately. + */ + hNewFont = CreateHighResolutionFont(hDC); + if (!hNewFont) + return FALSE; + + hOldFont = SelectObject(hDC, hNewFont); + if (!hOldFont) + return FALSE; + + /* + * Preallocate a buffer for the outline data, and track its size: + */ + glyphBuf = (UCHAR*) __wglMalloc(glyphBufSize = 10240); + if (!glyphBuf) + return FALSE; /*WGL_STATUS_NOT_ENOUGH_MEMORY*/ + + /* + * Process each glyph in the given range: + */ + for (glyphIndex = first; glyphIndex - first < count; ++glyphIndex) + { + GLYPHMETRICS glyphMetrics; + DWORD glyphSize; + static MAT2 matrix = + { + {0, 1}, {0, 0}, + {0, 0}, {0, 1} + }; + LPGLYPHMETRICSFLOAT glyphMetricsFloat = + &glyphMetricsFloatArray[glyphIndex - first]; + + + /* + * Determine how much space is needed to store the glyph's + * outlines. If our glyph buffer isn't large enough, + * resize it. + */ + glyphSize = GetGlyphOutline( hDC, + glyphIndex, + GGO_NATIVE, + &glyphMetrics, + 0, + NULL, + &matrix + ); + if (glyphSize < 0) + return FALSE; /*WGL_STATUS_FAILURE*/ + if (glyphSize > glyphBufSize) + { + __wglFree(glyphBuf); + glyphBuf = (UCHAR*) __wglMalloc(glyphBufSize = glyphSize); + if (!glyphBuf) + return FALSE; /*WGL_STATUS_NOT_ENOUGH_MEMORY*/ + } + + + /* + * Get the glyph's outlines. + */ + if (GetGlyphOutline( hDC, + glyphIndex, + GGO_NATIVE, + &glyphMetrics, + glyphBufSize, + glyphBuf, + &matrix + ) < 0) + { + __wglFree(glyphBuf); + return FALSE; /*WGL_STATUS_FAILURE*/ + } + + glyphMetricsFloat->gmfBlackBoxX = + (FLOAT) glyphMetrics.gmBlackBoxX * ScaleFactor; + glyphMetricsFloat->gmfBlackBoxY = + (FLOAT) glyphMetrics.gmBlackBoxY * ScaleFactor; + glyphMetricsFloat->gmfptGlyphOrigin.x = + (FLOAT) glyphMetrics.gmptGlyphOrigin.x * ScaleFactor; + glyphMetricsFloat->gmfptGlyphOrigin.y = + (FLOAT) glyphMetrics.gmptGlyphOrigin.y * ScaleFactor; + glyphMetricsFloat->gmfCellIncX = + (FLOAT) glyphMetrics.gmCellIncX * ScaleFactor; + glyphMetricsFloat->gmfCellIncY = + (FLOAT) glyphMetrics.gmCellIncY * ScaleFactor; + + /* + * Turn the glyph into a display list: + */ + if (!MakeDisplayListFromGlyph( (glyphIndex - first) + listBase, + glyphBuf, + glyphSize, + glyphMetricsFloat, + chordalDeviation + ScaleFactor, + extrusion, + format)) + { + __wglFree(glyphBuf); + return FALSE; /*WGL_STATUS_FAILURE*/ + } + } + + + /* + * Clean up temporary storage and return. If an error occurred, + * clear all OpenGL error flags and return FAILURE status; + * otherwise just return SUCCESS. + */ + __wglFree(glyphBuf); + + SelectObject(hDC, hOldFont); + + if (_GLD_glGetError() == GL_NO_ERROR) + return TRUE; /*WGL_STATUS_SUCCESS*/ + else + { + while (_GLD_glGetError() != GL_NO_ERROR) + ; + return FALSE; /*WGL_STATUS_FAILURE*/ + } + } + + + +/***************************************************************************** + * CreateHighResolutionFont + * + * Gets metrics for the current font and creates an equivalent font + * scaled to the design units of the font. + * + *****************************************************************************/ + +static HFONT +CreateHighResolutionFont(HDC hDC) + { + UINT otmSize; + OUTLINETEXTMETRIC *otm; + LONG fontHeight, fontWidth, fontUnits; + LOGFONT logFont; + + otmSize = GetOutlineTextMetrics(hDC, 0, NULL); + if (otmSize == 0) + return NULL; + + otm = (OUTLINETEXTMETRIC *) __wglMalloc(otmSize); + if (otm == NULL) + return NULL; + + otm->otmSize = otmSize; + if (GetOutlineTextMetrics(hDC, otmSize, otm) == 0) + return NULL; + + fontHeight = otm->otmTextMetrics.tmHeight - + otm->otmTextMetrics.tmInternalLeading; + fontWidth = otm->otmTextMetrics.tmAveCharWidth; + fontUnits = (LONG) otm->otmEMSquare; + + ScaleFactor = 1.0F / (FLOAT) fontUnits; + + logFont.lfHeight = - ((LONG) fontUnits); + logFont.lfWidth = (LONG) + ((FLOAT) (fontWidth * fontUnits) / (FLOAT) fontHeight); + logFont.lfEscapement = 0; + logFont.lfOrientation = 0; + logFont.lfWeight = otm->otmTextMetrics.tmWeight; + logFont.lfItalic = otm->otmTextMetrics.tmItalic; + logFont.lfUnderline = otm->otmTextMetrics.tmUnderlined; + logFont.lfStrikeOut = otm->otmTextMetrics.tmStruckOut; + logFont.lfCharSet = otm->otmTextMetrics.tmCharSet; + logFont.lfOutPrecision = OUT_OUTLINE_PRECIS; + logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS; + logFont.lfQuality = DEFAULT_QUALITY; + logFont.lfPitchAndFamily = + otm->otmTextMetrics.tmPitchAndFamily & 0xf0; + strcpy(logFont.lfFaceName, + (char *)otm + (int)otm->otmpFaceName); + + hNewFont = CreateFontIndirect(&logFont); + if (hNewFont == NULL) + return NULL; + + __wglFree(otm); + + return hNewFont; + } + + + +/***************************************************************************** + * MakeDisplayListFromGlyph + * + * Converts the outline of a glyph to an OpenGL display list. + * + * Return value is nonzero for success, zero for failure. + * + * Does not check for OpenGL errors, so if the caller needs to know about them, + * it should call glGetError(). + *****************************************************************************/ + +static int +MakeDisplayListFromGlyph( IN DWORD listName, + IN UCHAR* glyphBuf, + IN DWORD glyphSize, + IN LPGLYPHMETRICSFLOAT glyphMetricsFloat, + IN FLOAT chordalDeviation, + IN FLOAT extrusion, + IN INT format) + { + int status; + + _GLD_glNewList(listName, GL_COMPILE); + status = DrawGlyph( glyphBuf, + glyphSize, + chordalDeviation, + extrusion, + format); + + _GLD_glTranslatef(glyphMetricsFloat->gmfCellIncX, + glyphMetricsFloat->gmfCellIncY, + 0.0F); + _GLD_glEndList(); + + return status; + } + + + +/***************************************************************************** + * DrawGlyph + * + * Converts the outline of a glyph to OpenGL drawing primitives, tessellating + * as needed, and then draws the glyph. Tessellation of the quadratic splines + * in the outline is controlled by "chordalDeviation", and the drawing + * primitives (lines or polygons) are selected by "format". + * + * Return value is nonzero for success, zero for failure. + * + * Does not check for OpenGL errors, so if the caller needs to know about them, + * it should call glGetError(). + *****************************************************************************/ + +static int +DrawGlyph( IN UCHAR* glyphBuf, + IN DWORD glyphSize, + IN FLOAT chordalDeviation, + IN FLOAT extrusion, + IN INT format) + { + INT status = 0; + FLOAT* p; + DWORD loop; + DWORD point; + GLUtesselator* tess = NULL; + + + /* + * Initialize the global buffer into which we place the outlines: + */ + if (!InitLineBuf()) + goto exit; + + + /* + * Convert the glyph outlines to a set of polyline loops. + * (See MakeLinesFromGlyph() for the format of the loop data + * structure.) + */ + if (!MakeLinesFromGlyph(glyphBuf, glyphSize, chordalDeviation)) + goto exit; + p = LineBuf; + + + /* + * Now draw the loops in the appropriate format: + */ + if (format == WGL_FONT_LINES) + { + /* + * This is the easy case. Just draw the outlines. + */ + for (loop = (DWORD) *p++; loop; --loop) + { + _GLD_glBegin(GL_LINE_LOOP); + for (point = (DWORD) *p++; point; --point) + { + _GLD_glVertex2fv(p); + p += 2; + } + _GLD_glEnd(); + } + status = 1; + } + + else if (format == WGL_FONT_POLYGONS) + { + double v[3]; + FLOAT *save_p = p; + GLfloat z_value; + + /* + * This is the hard case. We have to set up a tessellator + * to convert the outlines into a set of polygonal + * primitives, which the tessellator passes to some + * auxiliary routines for drawing. + */ + if (!LoadGLUTesselator()) + goto exit; + if (!InitVertBuf()) + goto exit; + if (!(tess = gluNewTessProc())) + goto exit; + gluTessCallbackProc(tess, GLU_BEGIN, (void(CALLBACK *)()) _GLD_glBegin); + gluTessCallbackProc(tess, GLU_TESS_VERTEX_DATA, + (void(CALLBACK *)()) TessVertexOutData); + gluTessCallbackProc(tess, GLU_END, (void(CALLBACK *)()) _GLD_glEnd); + gluTessCallbackProc(tess, GLU_ERROR, (void(CALLBACK *)()) TessError); + gluTessCallbackProc(tess, GLU_TESS_COMBINE, (void(CALLBACK *)()) TessCombine); + gluTessNormalProc(tess, 0.0F, 0.0F, 1.0F); + + TessErrorOccurred = 0; + _GLD_glNormal3f(0.0f, 0.0f, 1.0f); + v[2] = 0.0; + z_value = 0.0f; + + gluTessBeginPolygonProc(tess, (void *)*(int *)&z_value); + for (loop = (DWORD) *p++; loop; --loop) + { + gluTessBeginContourProc(tess); + + for (point = (DWORD) *p++; point; --point) + { + v[0] = p[0]; + v[1] = p[1]; + gluTessVertexProc(tess, v, p); + p += 2; + } + + gluTessEndContourProc(tess); + } + gluTessEndPolygonProc(tess); + + status = !TessErrorOccurred; + + /* Extrusion code */ + if (extrusion) { + DWORD loops; + GLfloat thickness = (GLfloat) -extrusion; + FLOAT *vert, *vert2; + DWORD count; + + p = save_p; + loops = (DWORD) *p++; + + for (loop = 0; loop < loops; loop++) { + GLfloat dx, dy, len; + DWORD last; + + count = (DWORD) *p++; + _GLD_glBegin(GL_QUAD_STRIP); + + /* Check if the first and last vertex are identical + * so we don't draw the same quad twice. + */ + vert = p + (count-1)*2; + last = (p[0] == vert[0] && p[1] == vert[1]) ? count-1 : count; + + for (point = 0; point <= last; point++) { + vert = p + 2 * (point % last); + vert2 = p + 2 * ((point+1) % last); + + dx = vert[0] - vert2[0]; + dy = vert[1] - vert2[1]; + len = (GLfloat)sqrt(dx * dx + dy * dy); + + _GLD_glNormal3f(dy / len, -dx / len, 0.0f); + _GLD_glVertex3f((GLfloat) vert[0], + (GLfloat) vert[1], thickness); + _GLD_glVertex3f((GLfloat) vert[0], + (GLfloat) vert[1], 0.0f); + } + + _GLD_glEnd(); + p += count*2; + } + + /* Draw the back face */ + p = save_p; + v[2] = thickness; + _GLD_glNormal3f(0.0f, 0.0f, -1.0f); + gluTessNormalProc(tess, 0.0F, 0.0F, -1.0F); + + gluTessBeginPolygonProc(tess, (void *)*(int *)&thickness); + + for (loop = (DWORD) *p++; loop; --loop) + { + count = (DWORD) *p++; + + gluTessBeginContourProc(tess); + + for (point = 0; point < count; point++) + { + vert = p + ((count-point-1)<<1); + v[0] = vert[0]; + v[1] = vert[1]; + gluTessVertexProc(tess, v, vert); + } + p += count*2; + + gluTessEndContourProc(tess); + } + gluTessEndPolygonProc(tess); + } + +#if DEBUG + if (TessErrorOccurred) + printf("Tessellation error %s\n", + gluErrorString(TessErrorOccurred)); +#endif + } + + +exit: + FreeLineBuf(); + if (tess) + gluDeleteTessProc(tess); + // UnloadGLUTesselator(); + FreeVertBuf(); + return status; + } + + + +/***************************************************************************** + * LoadGLUTesselator + * + * Maps the glu32.dll module and gets function pointers for the + * tesselator functions. + *****************************************************************************/ + +static BOOL +LoadGLUTesselator(void) + { + if (gluModuleHandle != NULL) + return TRUE; + + { + extern HINSTANCE hInstanceOpenGL; + char *gluName = "GLU32.DLL"; +// char name[256]; +// char *ptr; +// int len; + +/* + len = GetModuleFileName(hInstanceOpenGL, name, 255); + if (len != 0) + { + ptr = name+len-1; + while (ptr > name && *ptr != '\\') + ptr--; + if (*ptr == '\\') + ptr++; + if (!stricmp(ptr, "cosmogl.dll")) + { + gluName = "COSMOGLU.DLL"; + } + else if (!stricmp(ptr, "opengl32.dll")) + { + gluName = "GLU32.DLL"; + } + } +*/ + if ((gluModuleHandle = LoadLibrary(gluName)) == NULL) + return FALSE; + } + + if ((gluNewTessProc = (gluNewTessProto) + GetProcAddress(gluModuleHandle, "gluNewTess")) == NULL) + return FALSE; + + if ((gluDeleteTessProc = (gluDeleteTessProto) + GetProcAddress(gluModuleHandle, "gluDeleteTess")) == NULL) + return FALSE; + + if ((gluTessBeginPolygonProc = (gluTessBeginPolygonProto) + GetProcAddress(gluModuleHandle, "gluTessBeginPolygon")) == NULL) + return FALSE; + + if ((gluTessBeginContourProc = (gluTessBeginContourProto) + GetProcAddress(gluModuleHandle, "gluTessBeginContour")) == NULL) + return FALSE; + + if ((gluTessVertexProc = (gluTessVertexProto) + GetProcAddress(gluModuleHandle, "gluTessVertex")) == NULL) + return FALSE; + + if ((gluTessEndContourProc = (gluTessEndContourProto) + GetProcAddress(gluModuleHandle, "gluTessEndContour")) == NULL) + return FALSE; + + if ((gluTessEndPolygonProc = (gluTessEndPolygonProto) + GetProcAddress(gluModuleHandle, "gluTessEndPolygon")) == NULL) + return FALSE; + + if ((gluTessPropertyProc = (gluTessPropertyProto) + GetProcAddress(gluModuleHandle, "gluTessProperty")) == NULL) + return FALSE; + + if ((gluTessNormalProc = (gluTessNormalProto) + GetProcAddress(gluModuleHandle, "gluTessNormal")) == NULL) + return FALSE; + + if ((gluTessCallbackProc = (gluTessCallbackProto) + GetProcAddress(gluModuleHandle, "gluTessCallback")) == NULL) + return FALSE; + + return TRUE; + } + + + +/***************************************************************************** + * UnloadGLUTesselator + * + * Unmaps the glu32.dll module. + *****************************************************************************/ + +static BOOL +UnloadGLUTesselator(void) + { + if (gluModuleHandle != NULL) + if (FreeLibrary(gluModuleHandle) == FALSE) + return FALSE; + gluModuleHandle = NULL; + } + + + +/***************************************************************************** + * TessVertexOut + * + * Used by tessellator to handle output vertexes. + *****************************************************************************/ + +static void CALLBACK +TessVertexOut(FLOAT p[3]) + { + GLfloat v[2]; + + v[0] = p[0] * ScaleFactor; + v[1] = p[1] * ScaleFactor; + _GLD_glVertex2fv(v); + } + +static void CALLBACK +TessVertexOutData(FLOAT p[3], GLfloat z) +{ + GLfloat v[3]; + + v[0] = (GLfloat) p[0]; + v[1] = (GLfloat) p[1]; + v[2] = z; + _GLD_glVertex3fv(v); +} + + +/***************************************************************************** + * TessCombine + * + * Used by tessellator to handle self-intersecting contours and degenerate + * geometry. + *****************************************************************************/ + +static void CALLBACK +TessCombine(double coords[3], + void* vertex_data[4], + FLOAT weight[4], + void** outData) + { + if (!AppendToVertBuf((FLOAT) coords[0]) + || !AppendToVertBuf((FLOAT) coords[1]) + || !AppendToVertBuf((FLOAT) coords[2])) + TessErrorOccurred = GL_OUT_OF_MEMORY; + *outData = VertBuf + (VertBufIndex - 3); + } + + + +/***************************************************************************** + * TessError + * + * Saves the last tessellator error code in the global TessErrorOccurred. + *****************************************************************************/ + +static void CALLBACK +TessError(GLenum error) + { + TessErrorOccurred = error; + } + + + +/***************************************************************************** + * MakeLinesFromGlyph + * + * Converts the outline of a glyph from the TTPOLYGON format to a simple + * array of floating-point values containing one or more loops. + * + * The first element of the output array is a count of the number of loops. + * The loop data follows this count. Each loop consists of a count of the + * number of vertices it contains, followed by the vertices. Each vertex + * is an X and Y coordinate. For example, a single triangle might be + * described by this array: + * + * 1., 3., 0., 0., 1., 0., 0., 1. + * ^ ^ ^ ^ ^ ^ ^ ^ + * #loops #verts x1 y1 x2 y2 x3 y3 + * + * A two-loop glyph would look like this: + * + * 2., 3., 0.,0., 1.,0., 0.,1., 3., .2,.2, .4,.2, .2,.4 + * + * Line segments from the TTPOLYGON are transferred to the output array in + * the obvious way. Quadratic splines in the TTPOLYGON are converted to + * collections of line segments + *****************************************************************************/ + +static int +MakeLinesFromGlyph(IN UCHAR* glyphBuf, + IN DWORD glyphSize, + IN FLOAT chordalDeviation) + { + UCHAR* p; + int status = 0; + + + /* + * Pick up all the polygons (aka loops) that make up the glyph: + */ + if (!AppendToLineBuf(0.0F)) /* loop count at LineBuf[0] */ + goto exit; + + p = glyphBuf; + while (p < glyphBuf + glyphSize) + { + if (!MakeLinesFromTTPolygon(&p, chordalDeviation)) + goto exit; + LineBuf[0] += 1.0F; /* increment loop count */ + } + + status = 1; + +exit: + return status; + } + + + +/***************************************************************************** + * MakeLinesFromTTPolygon + * + * Converts a TTPOLYGONHEADER and its associated curve structures into a + * single polyline loop in the global LineBuf. + *****************************************************************************/ + +static int +MakeLinesFromTTPolygon( IN OUT UCHAR** pp, + IN FLOAT chordalDeviation) + { + DWORD polySize; + UCHAR* polyStart; + DWORD vertexCountIndex; + + /* + * Record where the polygon data begins, and where the loop's + * vertex count resides: + */ + polyStart = *pp; + vertexCountIndex = LineBufIndex; + if (!AppendToLineBuf(0.0F)) + return 0; + + /* + * Extract relevant data from the TTPOLYGONHEADER: + */ + polySize = GetDWord(pp); + if (GetDWord(pp) != TT_POLYGON_TYPE) /* polygon type */ + return 0; + if (!AppendToLineBuf((FLOAT) GetFixed(pp))) /* first X coord */ + return 0; + if (!AppendToLineBuf((FLOAT) GetFixed(pp))) /* first Y coord */ + return 0; + LineBuf[vertexCountIndex] += 1.0F; + + /* + * Process each of the TTPOLYCURVE structures in the polygon: + */ + while (*pp < polyStart + polySize) + if (!MakeLinesFromTTPolycurve( pp, + vertexCountIndex, + chordalDeviation)) + return 0; + + return 1; + } + + + +/***************************************************************************** + * MakeLinesFromTTPolyCurve + * + * Converts the lines and splines in a single TTPOLYCURVE structure to points + * in the global LineBuf. + *****************************************************************************/ + +static int +MakeLinesFromTTPolycurve( IN OUT UCHAR** pp, + IN DWORD vertexCountIndex, + IN FLOAT chordalDeviation) + { + WORD type; + WORD pointCount; + + + /* + * Pick up the relevant fields of the TTPOLYCURVE structure: + */ + type = (WORD) GetWord(pp); + pointCount = (WORD) GetWord(pp); + + /* + * Convert the "curve" to line segments: + */ + if (type == TT_PRIM_LINE) + return MakeLinesFromTTLine( pp, + vertexCountIndex, + pointCount); + else if (type == TT_PRIM_QSPLINE) + return MakeLinesFromTTQSpline( pp, + vertexCountIndex, + pointCount, + chordalDeviation); + else + return 0; + } + + + +/***************************************************************************** + * MakeLinesFromTTLine + * + * Converts points from the polyline in a TT_PRIM_LINE structure to + * equivalent points in the global LineBuf. + *****************************************************************************/ +static int +MakeLinesFromTTLine( IN OUT UCHAR** pp, + IN DWORD vertexCountIndex, + IN WORD pointCount) + { + /* + * Just copy the line segments into the line buffer (converting + * type as we go): + */ + LineBuf[vertexCountIndex] += pointCount; + while (pointCount--) + { + if (!AppendToLineBuf((FLOAT) GetFixed(pp)) /* X coord */ + || !AppendToLineBuf((FLOAT) GetFixed(pp))) /* Y coord */ + return 0; + } + + return 1; + } + + + +/***************************************************************************** + * MakeLinesFromTTQSpline + * + * Converts points from the poly quadratic spline in a TT_PRIM_QSPLINE + * structure to polyline points in the global LineBuf. + *****************************************************************************/ + +static int +MakeLinesFromTTQSpline( IN OUT UCHAR** pp, + IN DWORD vertexCountIndex, + IN WORD pointCount, + IN FLOAT chordalDeviation) + { + FLOAT x0, y0, x1, y1, x2, y2; + WORD point; + + /* + * Process each of the non-interpolated points in the outline. + * To do this, we need to generate two interpolated points (the + * start and end of the arc) for each non-interpolated point. + * The first interpolated point is always the one most recently + * stored in LineBuf, so we just extract it from there. The + * second interpolated point is either the average of the next + * two points in the QSpline, or the last point in the QSpline + * if only one remains. + */ + for (point = 0; point < pointCount - 1; ++point) + { + x0 = LineBuf[LineBufIndex - 2]; + y0 = LineBuf[LineBufIndex - 1]; + + x1 = (FLOAT) GetFixed(pp); + y1 = (FLOAT) GetFixed(pp); + + if (point == pointCount - 2) + { + /* + * This is the last arc in the QSpline. The final + * point is the end of the arc. + */ + x2 = (FLOAT) GetFixed(pp); + y2 = (FLOAT) GetFixed(pp); + } + else + { + /* + * Peek at the next point in the input to compute + * the end of the arc: + */ + x2 = 0.5F * (x1 + (FLOAT) GetFixed(pp)); + y2 = 0.5F * (y1 + (FLOAT) GetFixed(pp)); + /* + * Push the point back onto the input so it will + * be reused as the next off-curve point: + */ + *pp -= 8; + } + + if (!MakeLinesFromArc( x0, y0, + x1, y1, + x2, y2, + vertexCountIndex, + chordalDeviation * chordalDeviation)) + return 0; + } + + return 1; + } + + + +/***************************************************************************** + * MakeLinesFromArc + * + * Subdivides one arc of a quadratic spline until the chordal deviation + * tolerance requirement is met, then places the resulting set of line + * segments in the global LineBuf. + *****************************************************************************/ + +static int +MakeLinesFromArc( IN FLOAT x0, + IN FLOAT y0, + IN FLOAT x1, + IN FLOAT y1, + IN FLOAT x2, + IN FLOAT y2, + IN DWORD vertexCountIndex, + IN FLOAT chordalDeviationSquared) + { + FLOAT x01; + FLOAT y01; + FLOAT x12; + FLOAT y12; + FLOAT midPointX; + FLOAT midPointY; + FLOAT deltaX; + FLOAT deltaY; + + /* + * Calculate midpoint of the curve by de Casteljau: + */ + x01 = 0.5F * (x0 + x1); + y01 = 0.5F * (y0 + y1); + x12 = 0.5F * (x1 + x2); + y12 = 0.5F * (y1 + y2); + midPointX = 0.5F * (x01 + x12); + midPointY = 0.5F * (y01 + y12); + + + /* + * Estimate chordal deviation by the distance from the midpoint + * of the curve to its non-interpolated control point. If this + * distance is greater than the specified chordal deviation + * constraint, then subdivide. Otherwise, generate polylines + * from the three control points. + */ + deltaX = midPointX - x1; + deltaY = midPointY - y1; + if (deltaX * deltaX + deltaY * deltaY > chordalDeviationSquared) + { + MakeLinesFromArc( x0, y0, + x01, y01, + midPointX, midPointY, + vertexCountIndex, + chordalDeviationSquared); + + MakeLinesFromArc( midPointX, midPointY, + x12, y12, + x2, y2, + vertexCountIndex, + chordalDeviationSquared); + } + else + { + /* + * The "pen" is already at (x0, y0), so we don't need to + * add that point to the LineBuf. + */ + if (!AppendToLineBuf(x1) + || !AppendToLineBuf(y1) + || !AppendToLineBuf(x2) + || !AppendToLineBuf(y2)) + return 0; + LineBuf[vertexCountIndex] += 2.0F; + } + + return 1; + } + + + +/***************************************************************************** + * InitLineBuf + * + * Initializes the global LineBuf and its associated size and current-element + * counters. + *****************************************************************************/ + +static int +InitLineBuf(void) + { + if (!(LineBuf = (FLOAT*) + __wglMalloc((LineBufSize = LINE_BUF_QUANT) * sizeof(FLOAT)))) + return 0; + LineBufIndex = 0; + return 1; + } + + + +/***************************************************************************** + * InitVertBuf + * + * Initializes the global VertBuf and its associated size and current-element + * counters. + *****************************************************************************/ + +static int +InitVertBuf(void) + { + if (!(VertBuf = (FLOAT*) + __wglMalloc((VertBufSize = VERT_BUF_QUANT) * sizeof(FLOAT)))) + return 0; + VertBufIndex = 0; + return 1; + } + + + +/***************************************************************************** + * AppendToLineBuf + * + * Appends one floating-point value to the global LineBuf array. Return value + * is non-zero for success, zero for failure. + *****************************************************************************/ + +static int +AppendToLineBuf(FLOAT value) + { + if (LineBufIndex >= LineBufSize) + { + FLOAT* f; + + f = (FLOAT*) __wglRealloc(LineBuf, + (LineBufSize += LINE_BUF_QUANT) * sizeof(FLOAT)); + if (!f) + return 0; + LineBuf = f; + } + LineBuf[LineBufIndex++] = value; + return 1; + } + + + +/***************************************************************************** + * AppendToVertBuf + * + * Appends one floating-point value to the global VertBuf array. Return value + * is non-zero for success, zero for failure. + * + * Note that we can't realloc this one, because the tessellator is using + * pointers into it. + *****************************************************************************/ + +static int +AppendToVertBuf(FLOAT value) + { + if (VertBufIndex >= VertBufSize) + return 0; + VertBuf[VertBufIndex++] = value; + return 1; + } + + + +/***************************************************************************** + * FreeLineBuf + * + * Cleans up vertex buffer structure. + *****************************************************************************/ + +static void +FreeLineBuf(void) + { + if (LineBuf) + { + __wglFree(LineBuf); + LineBuf = NULL; + } + } + + + +/***************************************************************************** + * FreeVertBuf + * + * Cleans up vertex buffer structure. + *****************************************************************************/ + +static void +FreeVertBuf(void) + { + if (VertBuf) + { + __wglFree(VertBuf); + VertBuf = NULL; + } + } + + + +/***************************************************************************** + * GetWord + * + * Fetch the next 16-bit word from a little-endian byte stream, and increment + * the stream pointer to the next unscanned byte. + *****************************************************************************/ + +static long GetWord(UCHAR** p) + { + long value; + + value = ((*p)[1] << 8) + (*p)[0]; + *p += 2; + return value; + } + + + +/***************************************************************************** + * GetDWord + * + * Fetch the next 32-bit word from a little-endian byte stream, and increment + * the stream pointer to the next unscanned byte. + *****************************************************************************/ + +static long GetDWord(UCHAR** p) + { + long value; + + value = ((*p)[3] << 24) + ((*p)[2] << 16) + ((*p)[1] << 8) + (*p)[0]; + *p += 4; + return value; + } + + + + +/***************************************************************************** + * GetFixed + * + * Fetch the next 32-bit fixed-point value from a little-endian byte stream, + * convert it to floating-point, and increment the stream pointer to the next + * unscanned byte. + *****************************************************************************/ + +static double GetFixed( + UCHAR** p) +{ + long hiBits, loBits; + double value; + + loBits = GetWord(p); + hiBits = GetWord(p); + value = (double) ((hiBits << 16) | loBits) / 65536.0; + + return value * ScaleFactor; +} + +// *********************************************************************** + diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/dglwgl.h b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglwgl.h new file mode 100644 index 00000000000..c488ff9e659 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/dglwgl.h @@ -0,0 +1,102 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: OpenGL window functions (wgl*). +* +****************************************************************************/ + +#ifndef __DGLWGL_H +#define __DGLWGL_H + +// Disable compiler complaints about DLL linkage +#pragma warning (disable:4273) + +// Macros to control compilation +#define STRICT +#define WIN32_LEAN_AND_MEAN + +#include +#include + +#include "dglcontext.h" +#include "dglglobals.h" +#include "dglmacros.h" +#include "ddlog.h" +#include "dglpf.h" + +/*---------------------- Macros and type definitions ----------------------*/ + +typedef struct { + PROC proc; + char *name; +} DGL_extension; + +/*------------------------- Function Prototypes ---------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _USE_GLD3_WGL +int APIENTRY DGL_ChoosePixelFormat(HDC a, CONST PIXELFORMATDESCRIPTOR *ppfd); +BOOL APIENTRY DGL_CopyContext(HGLRC a, HGLRC b, UINT c); +HGLRC APIENTRY DGL_CreateContext(HDC a); +HGLRC APIENTRY DGL_CreateLayerContext(HDC a, int b); +BOOL APIENTRY DGL_DeleteContext(HGLRC a); +BOOL APIENTRY DGL_DescribeLayerPlane(HDC a, int b, int c, UINT d, LPLAYERPLANEDESCRIPTOR e); +int APIENTRY DGL_DescribePixelFormat(HDC a, int b, UINT c, LPPIXELFORMATDESCRIPTOR d); +HGLRC APIENTRY DGL_GetCurrentContext(void); +HDC APIENTRY DGL_GetCurrentDC(void); +PROC APIENTRY DGL_GetDefaultProcAddress(LPCSTR a); +int APIENTRY DGL_GetLayerPaletteEntries(HDC a, int b, int c, int d, COLORREF *e); +int APIENTRY DGL_GetPixelFormat(HDC a); +PROC APIENTRY DGL_GetProcAddress(LPCSTR a); +BOOL APIENTRY DGL_MakeCurrent(HDC a, HGLRC b); +BOOL APIENTRY DGL_RealizeLayerPalette(HDC a, int b, BOOL c); +int APIENTRY DGL_SetLayerPaletteEntries(HDC a, int b, int c, int d, CONST COLORREF *e); +BOOL APIENTRY DGL_SetPixelFormat(HDC a, int b, CONST PIXELFORMATDESCRIPTOR *c); +BOOL APIENTRY DGL_ShareLists(HGLRC a, HGLRC b); +BOOL APIENTRY DGL_SwapBuffers(HDC a); +BOOL APIENTRY DGL_SwapLayerBuffers(HDC a, UINT b); +BOOL APIENTRY DGL_UseFontBitmapsA(HDC a, DWORD b, DWORD c, DWORD d); +BOOL APIENTRY DGL_UseFontBitmapsW(HDC a, DWORD b, DWORD c, DWORD d); +BOOL APIENTRY DGL_UseFontOutlinesA(HDC a, DWORD b, DWORD c, DWORD d, FLOAT e, FLOAT f, int g, LPGLYPHMETRICSFLOAT h); +BOOL APIENTRY DGL_UseFontOutlinesW(HDC a, DWORD b, DWORD c, DWORD d, FLOAT e, FLOAT f, int g, LPGLYPHMETRICSFLOAT h); +#endif //_USE_GLD3_WGL + +BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/dll_main.c b/reactos/dll/mesa32/src/drivers/windows/gldirect/dll_main.c new file mode 100644 index 00000000000..1d7ac64f498 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/dll_main.c @@ -0,0 +1,817 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: Win32 DllMain functions. +* +****************************************************************************/ + +// INITGUID must only be defined once. +// Don't put it in a shared header file! +// GLD3 uses dxguid.lib, so INITGUID must *not* be used! +#ifndef _USE_GLD3_WGL +#define INITGUID +#endif // _USE_GLD3_WGL + +#include "dllmain.h" + +//#include "snap/graphics.h" +//#include "drvlib/os/os.h" + +#ifdef _USE_GLD3_WGL +typedef void (APIENTRY *LPDGLSPLASHSCREEN)(int, int, char*); +#include "gld_driver.h" +#endif + +// *********************************************************************** + +BOOL bInitialized = FALSE; // callback driver initialized? +BOOL bExited = FALSE; // callback driver exited this instance? +HINSTANCE hInstanceDll = NULL; // DLL instance handle + +static BOOL bDriverValidated = FALSE; // prior validation status +static BOOL bSplashScreen = TRUE; // Splash Screen ? +static BOOL bValidINIFound = FALSE; // Have we found a valid INI file? + +HHOOK hKeyHook = NULL; // global keyboard handler hook + +// Multi-threaded support needs to be reflected in Mesa code. (DaveM) +int _gld_bMultiThreaded = FALSE; + +// *********************************************************************** + +DWORD dwLogging = 0; // Logging flag +DWORD dwDebugLevel = 0; // Log debug level + +char szLogPath[_MAX_PATH] = {"\0"}; // Log file path +char szSNAPPath[_MAX_PATH] = {"\0"}; // SNAP driver path + +#ifndef _USE_GLD3_WGL +DGL_wglFuncs wglFuncs = { + sizeof(DGL_wglFuncs), + DGL_ChoosePixelFormat, + DGL_CopyContext, + DGL_CreateContext, + DGL_CreateLayerContext, + DGL_DeleteContext, + DGL_DescribeLayerPlane, + DGL_DescribePixelFormat, + DGL_GetCurrentContext, + DGL_GetCurrentDC, + DGL_GetDefaultProcAddress, + DGL_GetLayerPaletteEntries, + DGL_GetPixelFormat, + DGL_GetProcAddress, + DGL_MakeCurrent, + DGL_RealizeLayerPalette, + DGL_SetLayerPaletteEntries, + DGL_SetPixelFormat, + DGL_ShareLists, + DGL_SwapBuffers, + DGL_SwapLayerBuffers, + DGL_UseFontBitmapsA, + DGL_UseFontBitmapsW, + DGL_UseFontOutlinesA, + DGL_UseFontOutlinesW, +}; + +DGL_mesaFuncs mesaFuncs = { + sizeof(DGL_mesaFuncs), +}; +#endif // _USE_GLD3_WGL + +// *********************************************************************** + +typedef struct { + DWORD dwDriver; // 0=SciTech SW, 1=Direct3D SW, 2=Direct3D HW + BOOL bMipmapping; // 0=off, 1=on + BOOL bMultitexture; // 0=off, 1=on + BOOL bWaitForRetrace; // 0=off, 1=on + BOOL bFullscreenBlit; // 0=off, 1=on + BOOL bFastFPU; // 0=off, 1=on + BOOL bDirectDrawPersistant;// 0=off, 1=on + BOOL bPersistantBuffers; // 0=off, 1=on + DWORD dwLogging; // 0=off, 1=normal, 2=crash-proof + DWORD dwLoggingSeverity; // 0=all, 1=warnings+errors, 2=errors only + BOOL bMessageBoxWarnings;// 0=off, 1=on + BOOL bMultiThreaded; // 0=off, 1=on + BOOL bAppCustomizations; // 0=off, 1=on + BOOL bHotKeySupport; // 0=off, 1=on + BOOL bSplashScreen; // 0=off, 1=on + +#ifdef _USE_GLD3_WGL + // + // New for GLDirect 3.0 + // + DWORD dwAdapter; // DX8 adpater ordinal + DWORD dwTnL; // Transform & Lighting type + DWORD dwMultisample; // DX8 multisample type +#endif // _USE_GLD3_WGL +} INI_settings; + +static INI_settings ini; + +// *********************************************************************** + +BOOL APIENTRY DGL_initDriver( +#ifdef _USE_GLD3_WGL + void) +{ +#else + DGL_wglFuncs *lpWglFuncs, + DGL_mesaFuncs *lpMesaFuncs) +{ + // Check for valid pointers + if ((lpWglFuncs == NULL) || (lpMesaFuncs == NULL)) + return FALSE; + + // Check for valid structs + if (lpWglFuncs->dwSize != sizeof(DGL_wglFuncs)) { + return FALSE; + } + + // Check for valid structs + if (lpMesaFuncs->dwSize != sizeof(DGL_mesaFuncs)) { + return FALSE; + } + + // Copy the Mesa functions + memcpy(&mesaFuncs, lpMesaFuncs, sizeof(DGL_mesaFuncs)); + + // Pass back the wgl functions + memcpy(lpWglFuncs, &wglFuncs, sizeof(DGL_wglFuncs)); +#endif // _USE_GLD3_WGL + + // Finally initialize the callback driver + if (!dglInitDriver()) + return FALSE; + + return TRUE; +}; + +// *********************************************************************** + +BOOL ReadINIFile( + HINSTANCE hInstance) +{ + char szModuleFilename[MAX_PATH]; + char szSystemDirectory[MAX_PATH]; + const char szSectionName[] = "Config"; + char szINIFile[MAX_PATH]; + int pos; + + // Now using the DLL module handle. KeithH, 24/May/2000. + // Addendum: GetModuleFileName(NULL, ... returns process filename, + // GetModuleFileName(hModule, ... returns DLL filename, + + // Get the dll path and filename. + GetModuleFileName(hInstance, &szModuleFilename[0], MAX_PATH); // NULL for current process + // Get the System directory. + GetSystemDirectory(&szSystemDirectory[0], MAX_PATH); + + // Test to see if DLL is in system directory. + if (strnicmp(szModuleFilename, szSystemDirectory, strlen(szSystemDirectory))==0) { + // DLL *is* in system directory. + // Return FALSE to indicate that registry keys should be read. + return FALSE; + } + + // Compose filename of INI file + strcpy(szINIFile, szModuleFilename); + pos = strlen(szINIFile); + while (szINIFile[pos] != '\\') { + pos--; + } + szINIFile[pos+1] = '\0'; + // Use run-time DLL path for log file too + strcpy(szLogPath, szINIFile); + szLogPath[pos] = '\0'; + // Complete full INI file path + strcat(szINIFile, "gldirect.ini"); + + // Read settings from private INI file. + // Note that defaults are contained in the calls. + ini.dwDriver = GetPrivateProfileInt(szSectionName, "dwDriver", 2, szINIFile); + ini.bMipmapping = GetPrivateProfileInt(szSectionName, "bMipmapping", 1, szINIFile); + ini.bMultitexture = GetPrivateProfileInt(szSectionName, "bMultitexture", 1, szINIFile); + ini.bWaitForRetrace = GetPrivateProfileInt(szSectionName, "bWaitForRetrace", 0, szINIFile); + ini.bFullscreenBlit = GetPrivateProfileInt(szSectionName, "bFullscreenBlit", 0, szINIFile); + ini.bFastFPU = GetPrivateProfileInt(szSectionName, "bFastFPU", 1, szINIFile); + ini.bDirectDrawPersistant = GetPrivateProfileInt(szSectionName, "bPersistantDisplay", 0, szINIFile); + ini.bPersistantBuffers = GetPrivateProfileInt(szSectionName, "bPersistantResources", 0, szINIFile); + ini.dwLogging = GetPrivateProfileInt(szSectionName, "dwLogging", 0, szINIFile); + ini.dwLoggingSeverity = GetPrivateProfileInt(szSectionName, "dwLoggingSeverity", 0, szINIFile); + ini.bMessageBoxWarnings = GetPrivateProfileInt(szSectionName, "bMessageBoxWarnings", 0, szINIFile); + ini.bMultiThreaded = GetPrivateProfileInt(szSectionName, "bMultiThreaded", 0, szINIFile); + ini.bAppCustomizations = GetPrivateProfileInt(szSectionName, "bAppCustomizations", 1, szINIFile); + ini.bHotKeySupport = GetPrivateProfileInt(szSectionName, "bHotKeySupport", 0, szINIFile); + ini.bSplashScreen = GetPrivateProfileInt(szSectionName, "bSplashScreen", 1, szINIFile); + +#ifdef _USE_GLD3_WGL + // New for GLDirect 3.x + ini.dwAdapter = GetPrivateProfileInt(szSectionName, "dwAdapter", 0, szINIFile); + // dwTnL now defaults to zero (chooses TnL at runtime). KeithH + ini.dwTnL = GetPrivateProfileInt(szSectionName, "dwTnL", 0, szINIFile); + ini.dwMultisample = GetPrivateProfileInt(szSectionName, "dwMultisample", 0, szINIFile); +#endif + + return TRUE; +} + +// *********************************************************************** + +BOOL dllReadRegistry( + HINSTANCE hInstance) +{ + // Read settings from INI file, if available + bValidINIFound = FALSE; + if (ReadINIFile(hInstance)) { + const char *szRendering[3] = { + "SciTech Software Renderer", + "Direct3D MMX Software Renderer", + "Direct3D Hardware Renderer" + }; + // Set globals + glb.bPrimary = 1; + glb.bHardware = (ini.dwDriver == 2) ? 1 : 0; +#ifndef _USE_GLD3_WGL + memset(&glb.ddGuid, 0, sizeof(glb.ddGuid)); + glb.d3dGuid = (ini.dwDriver == 2) ? IID_IDirect3DHALDevice : IID_IDirect3DRGBDevice; +#endif // _USE_GLD3_WGL + strcpy(glb.szDDName, "Primary"); + strcpy(glb.szD3DName, szRendering[ini.dwDriver]); + glb.dwRendering = ini.dwDriver; + glb.bUseMipmaps = ini.bMipmapping; + glb.bMultitexture = ini.bMultitexture; + glb.bWaitForRetrace = ini.bWaitForRetrace; + glb.bFullscreenBlit = ini.bFullscreenBlit; + glb.bFastFPU = ini.bFastFPU; + glb.bDirectDrawPersistant = ini.bDirectDrawPersistant; + glb.bPersistantBuffers = ini.bPersistantBuffers; + dwLogging = ini.dwLogging; + dwDebugLevel = ini.dwLoggingSeverity; + glb.bMessageBoxWarnings = ini.bMessageBoxWarnings; + glb.bMultiThreaded = ini.bMultiThreaded; + glb.bAppCustomizations = ini.bAppCustomizations; + glb.bHotKeySupport = ini.bHotKeySupport; + bSplashScreen = ini.bSplashScreen; +#ifdef _USE_GLD3_WGL + // New for GLDirect 3.x + glb.dwAdapter = ini.dwAdapter; + glb.dwDriver = ini.dwDriver; + glb.dwTnL = ini.dwTnL; + glb.dwMultisample = ini.dwMultisample; +#endif + bValidINIFound = TRUE; + return TRUE; + } + // Read settings from registry + else { + HKEY hReg; + DWORD cbValSize; + DWORD dwType = REG_SZ; // Registry data type for strings + BOOL bRegistryError; + BOOL bSuccess; + +#define REG_READ_DWORD(a, b) \ + cbValSize = sizeof(b); \ + if (ERROR_SUCCESS != RegQueryValueEx( hReg, (a), \ + NULL, NULL, (LPBYTE)&(b), &cbValSize )) \ + bRegistryError = TRUE; + +#define REG_READ_DEVICEID(a, b) \ + cbValSize = MAX_DDDEVICEID_STRING; \ + if(ERROR_SUCCESS != RegQueryValueEx(hReg, (a), 0, &dwType, \ + (LPBYTE)&(b), &cbValSize)) \ + bRegistryError = TRUE; + +#define REG_READ_STRING(a, b) \ + cbValSize = sizeof((b)); \ + if(ERROR_SUCCESS != RegQueryValueEx(hReg, (a), 0, &dwType, \ + (LPBYTE)&(b), &cbValSize)) \ + bRegistryError = TRUE; + + // Read settings from the registry. + + // Open the registry key for the current user if it exists. + bSuccess = (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER, + DIRECTGL_REG_SETTINGS_KEY, + 0, + KEY_READ, + &hReg)); + // Otherwise open the registry key for the local machine. + if (!bSuccess) + bSuccess = (ERROR_SUCCESS == RegOpenKeyEx(DIRECTGL_REG_KEY_ROOT, + DIRECTGL_REG_SETTINGS_KEY, + 0, + KEY_READ, + &hReg)); + if (!bSuccess) + return FALSE; + + bRegistryError = FALSE; + + REG_READ_DWORD(DIRECTGL_REG_SETTING_PRIMARY, glb.bPrimary); + REG_READ_DWORD(DIRECTGL_REG_SETTING_D3D_HW, glb.bHardware); +#ifndef _USE_GLD3_WGL + REG_READ_DWORD(DIRECTGL_REG_SETTING_DD_GUID, glb.ddGuid); + REG_READ_DWORD(DIRECTGL_REG_SETTING_D3D_GUID, glb.d3dGuid); +#endif // _USE_GLD3_WGL + REG_READ_DWORD(DIRECTGL_REG_SETTING_LOGGING, dwLogging); + REG_READ_DWORD(DIRECTGL_REG_SETTING_DEBUGLEVEL, dwDebugLevel); + REG_READ_DWORD(DIRECTGL_REG_SETTING_RENDERING, glb.dwRendering); + REG_READ_DWORD(DIRECTGL_REG_SETTING_MULTITEXTURE, glb.bMultitexture); + REG_READ_DWORD(DIRECTGL_REG_SETTING_WAITFORRETRACE, glb.bWaitForRetrace); + REG_READ_DWORD(DIRECTGL_REG_SETTING_FULLSCREENBLIT, glb.bFullscreenBlit); + REG_READ_DWORD(DIRECTGL_REG_SETTING_USEMIPMAPS, glb.bUseMipmaps); + + REG_READ_DEVICEID(DIRECTGL_REG_SETTING_DD_NAME, glb.szDDName); + REG_READ_DEVICEID(DIRECTGL_REG_SETTING_D3D_NAME, glb.szD3DName); + + REG_READ_DWORD(DIRECTGL_REG_SETTING_MSGBOXWARNINGS, glb.bMessageBoxWarnings); + REG_READ_DWORD(DIRECTGL_REG_SETTING_PERSISTDISPLAY, glb.bDirectDrawPersistant); + REG_READ_DWORD(DIRECTGL_REG_SETTING_PERSISTBUFFERS, glb.bPersistantBuffers); + REG_READ_DWORD(DIRECTGL_REG_SETTING_FASTFPU, glb.bFastFPU); + REG_READ_DWORD(DIRECTGL_REG_SETTING_HOTKEYS, glb.bHotKeySupport); + REG_READ_DWORD(DIRECTGL_REG_SETTING_MULTITHREAD, glb.bMultiThreaded); + REG_READ_DWORD(DIRECTGL_REG_SETTING_APPCUSTOM, glb.bAppCustomizations); + REG_READ_DWORD(DIRECTGL_REG_SETTING_SPLASHSCREEN, bSplashScreen); + +#ifdef _USE_GLD3_WGL + // New for GLDirect 3.x + glb.dwDriver = glb.dwRendering; + REG_READ_DWORD(DIRECTGL_REG_SETTING_ADAPTER, glb.dwAdapter); + REG_READ_DWORD(DIRECTGL_REG_SETTING_TNL, glb.dwTnL); + REG_READ_DWORD(DIRECTGL_REG_SETTING_MULTISAMPLE, glb.dwMultisample); +#endif + + RegCloseKey(hReg); + + // Open the global registry key for GLDirect + bSuccess = (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, + DIRECTGL_REG_SETTINGS_KEY, + 0, + KEY_READ, + &hReg)); + if (bSuccess) { + // Read the installation path for GLDirect + REG_READ_STRING("InstallLocation",szLogPath); + RegCloseKey(hReg); + } + + if (bRegistryError || !bSuccess) + return FALSE; + else + + return TRUE; + +#undef REG_READ_DWORD +#undef REG_READ_DEVICEID +#undef REG_READ_STRING + } +} + +// *********************************************************************** + +BOOL dllWriteRegistry( + void ) +{ + HKEY hReg; + DWORD dwCreateDisposition, cbValSize; + BOOL bRegistryError = FALSE; + +#define REG_WRITE_DWORD(a, b) \ + cbValSize = sizeof(b); \ + if (ERROR_SUCCESS != RegSetValueEx( hReg, (a), \ + 0, REG_DWORD, (LPBYTE)&(b), cbValSize )) \ + bRegistryError = TRUE; + + if (ERROR_SUCCESS == RegCreateKeyEx( DIRECTGL_REG_KEY_ROOT, DIRECTGL_REG_SETTINGS_KEY, + 0, NULL, 0, KEY_WRITE, NULL, &hReg, + &dwCreateDisposition )) { + RegFlushKey(hReg); // Make sure keys are written to disk + RegCloseKey(hReg); + hReg = NULL; + } + + if (bRegistryError) + return FALSE; + else + return TRUE; + +#undef REG_WRITE_DWORD +} + +// *********************************************************************** + +void dglInitHotKeys(HINSTANCE hInstance) +{ + // Hot-Key support at all? + if (!glb.bHotKeySupport) + return; + + // Install global keyboard interceptor + hKeyHook = SetWindowsHookEx(WH_KEYBOARD, dglKeyProc, hInstance, 0); +} + +// *********************************************************************** + +void dglExitHotKeys(void) +{ + // Hot-Key support at all? + if (!glb.bHotKeySupport) + return; + + // Remove global keyboard interceptor + if (hKeyHook) + UnhookWindowsHookEx(hKeyHook); + hKeyHook = NULL; +} + +// *********************************************************************** + +// Note: This app-customization step must be performed in both the main +// OpenGL32 driver and the callback driver DLLs for multithreading option. +void dglSetAppCustomizations(void) +{ + char szModuleFileName[MAX_PATH]; + int iSize = MAX_PATH; + + // Get the currently loaded EXE filename. + GetModuleFileName(NULL, &szModuleFileName[0], MAX_PATH); // NULL for current process + strupr(szModuleFileName); + iSize = strlen(szModuleFileName); + + // Check for specific EXEs and adjust global settings accordingly + + // NOTE: In GLD3.x "bDirectDrawPersistant" corresponds to IDirect3D8 and + // "bPersistantBuffers" corresponds to IDirect3DDevice8. KeithH + + // Case 1: 3DStudio must be multi-threaded + // Added: Discreet GMAX (3DStudio MAX 4 for gamers. KeithH) + if (strstr(szModuleFileName, "3DSMAX.EXE") + || strstr(szModuleFileName, "3DSVIZ.EXE") + || strstr(szModuleFileName, "GMAX.EXE")) { + glb.bMultiThreaded = TRUE; + glb.bDirectDrawPersistant = FALSE; + glb.bPersistantBuffers = FALSE; + return; + } + + // Case 2: Solid Edge must use pre-allocated resources for all GLRCs + if (strstr(szModuleFileName, "PART.EXE") + || strstr(szModuleFileName, "ASSEMBL.EXE") + || strstr(szModuleFileName, "DRAFT.EXE") + || strstr(szModuleFileName, "SMARTVW.EXE") + || strstr(szModuleFileName, "SMETAL.EXE")) { + glb.bMultiThreaded = FALSE; + glb.bDirectDrawPersistant = TRUE; + glb.bPersistantBuffers = FALSE; + return; + } + + // Case 3: Sudden Depth creates and destroys GLRCs on paint commands + if (strstr(szModuleFileName, "SUDDEPTH.EXE") + || strstr(szModuleFileName, "SUDDEMO.EXE")) { + glb.bMultiThreaded = FALSE; + glb.bDirectDrawPersistant = TRUE; + glb.bPersistantBuffers = TRUE; + glb.bFullscreenBlit = TRUE; + return; + } + + // Case 4: StereoGraphics test apps create and destroy GLRCs on paint commands + if (strstr(szModuleFileName, "REDBLUE.EXE") + || strstr(szModuleFileName, "DIAGNOSE.EXE")) { + glb.bMultiThreaded = FALSE; + glb.bDirectDrawPersistant = TRUE; + glb.bPersistantBuffers = TRUE; + return; + } + + // Case 5: Pipes screen savers share multiple GLRCs for same window + if (strstr(szModuleFileName, "PIPES.SCR") + || (strstr(szModuleFileName, "PIPES") && strstr(szModuleFileName, ".SCR"))) { + glb.bMultiThreaded = FALSE; + glb.bDirectDrawPersistant = TRUE; + glb.bPersistantBuffers = TRUE; + return; + } + + // Case 6: AutoVue uses sub-viewport ops which are temporarily broken in stereo window + if (strstr(szModuleFileName, "AVWIN.EXE")) { + glb.bMultiThreaded = FALSE; + glb.bDirectDrawPersistant = TRUE; + glb.bPersistantBuffers = TRUE; + return; + } + // Case 7: Quake3 is waiting for DDraw objects to be released at exit + if (strstr(szModuleFileName, "QUAKE")) { + glb.bMultiThreaded = FALSE; + glb.bDirectDrawPersistant = FALSE; + glb.bPersistantBuffers = FALSE; + glb.bFullscreenBlit = FALSE; + return; + } + // Case 8: Reflection GLX server is unable to switch contexts at run-time + if (strstr(szModuleFileName, "RX.EXE")) { + glb.bMultiThreaded = FALSE; + glb.bMessageBoxWarnings = FALSE; + return; + } + // Case 9: Original AutoCAD 2000 must share DDraw objects across GLRCs + if (strstr(szModuleFileName, "ACAD.EXE")) { + glb.bFastFPU = FALSE; + if (GetModuleHandle("wopengl6.hdi") != NULL) { + glb.bMultiThreaded = FALSE; + glb.bDirectDrawPersistant = TRUE; + glb.bPersistantBuffers = FALSE; + } + return; + } +} + +// *********************************************************************** + +BOOL dglInitDriver(void) +{ + UCHAR szExeName[MAX_PATH]; + const char *szRendering[] = { + "Mesa Software", + "Direct3D RGB SW", + "Direct3D HW", + }; + static BOOL bWarnOnce = FALSE; + + // Already initialized? + if (bInitialized) + return TRUE; + + // Moved from DllMain DLL_PROCESS_ATTACH: + + // (Re-)Init defaults + dglInitGlobals(); + + // Read registry or INI file settings + if (!dllReadRegistry(hInstanceDll)) { + if (!bWarnOnce) + MessageBox( NULL, "GLDirect has not been configured.\n\n" + "Please run the configuration program\n" + "before using GLDirect with applications.\n", + "GLDirect", MB_OK | MB_ICONWARNING); + bWarnOnce = TRUE; + return FALSE; + } + +#ifdef _USE_GLD3_WGL + // Must do this as early as possible. + // Need to read regkeys/ini-file first though. + gldInitDriverPointers(glb.dwDriver); + + // Create private driver globals + _gldDriver.CreatePrivateGlobals(); +#endif + // Overide settings with application customizations + if (glb.bAppCustomizations) + dglSetAppCustomizations(); + +//#ifndef _USE_GLD3_WGL + // Set the global memory type to either sysmem or vidmem + glb.dwMemoryType = glb.bHardware ? DDSCAPS_VIDEOMEMORY : DDSCAPS_SYSTEMMEMORY; +//#endif + + // Multi-threaded support overides persistant display support + if (glb.bMultiThreaded) + glb.bDirectDrawPersistant = glb.bPersistantBuffers = FALSE; + + // Multi-threaded support needs to be reflected in Mesa code. (DaveM) + _gld_bMultiThreaded = glb.bMultiThreaded; + + // Start logging + ddlogPathOption(szLogPath); + ddlogWarnOption(glb.bMessageBoxWarnings); + ddlogOpen((DDLOG_loggingMethodType)dwLogging, + (DDLOG_severityType)dwDebugLevel); + + // Obtain the name of the calling app + ddlogMessage(DDLOG_SYSTEM, "Driver : SciTech GLDirect 4.0\n"); + GetModuleFileName(NULL, szExeName, sizeof(szExeName)); + ddlogPrintf(DDLOG_SYSTEM, "Executable : %s", szExeName); + + ddlogPrintf(DDLOG_SYSTEM, "DirectDraw device: %s", glb.szDDName); + ddlogPrintf(DDLOG_SYSTEM, "Direct3D driver : %s", glb.szD3DName); + + ddlogPrintf(DDLOG_SYSTEM, "Rendering type : %s", szRendering[glb.dwRendering]); + + ddlogPrintf(DDLOG_SYSTEM, "Multithreaded : %s", glb.bMultiThreaded ? "Enabled" : "Disabled"); + ddlogPrintf(DDLOG_SYSTEM, "Display resources: %s", glb.bDirectDrawPersistant ? "Persistant" : "Instanced"); + ddlogPrintf(DDLOG_SYSTEM, "Buffer resources : %s", glb.bPersistantBuffers ? "Persistant" : "Instanced"); + + dglInitContextState(); + dglBuildPixelFormatList(); + //dglBuildTextureFormatList(); + + // D3D callback driver is now successfully initialized + bInitialized = TRUE; + // D3D callback driver is now ready to be exited + bExited = FALSE; + + return TRUE; +} + +// *********************************************************************** + +void dglExitDriver(void) +{ + + // Only need to clean up once per instance: + // May be called implicitly from DLL_PROCESS_DETACH, + // or explicitly from DGL_exitDriver(). + if (bExited) + return; + bExited = TRUE; + + // DDraw objects may be invalid when DLL unloads. +__try { + + // Clean-up sequence (moved from DLL_PROCESS_DETACH) +#ifndef _USE_GLD3_WGL + dglReleaseTextureFormatList(); +#endif + dglReleasePixelFormatList(); + dglDeleteContextState(); + +#ifdef _USE_GLD3_WGL + _gldDriver.DestroyPrivateGlobals(); +#endif + +} +__except(EXCEPTION_EXECUTE_HANDLER) { + ddlogPrintf(DDLOG_WARN, "Exception raised in dglExitDriver."); +} + + // Close the log file + ddlogClose(); +} + +// *********************************************************************** + +int WINAPI DllMain( + HINSTANCE hInstance, + DWORD fdwReason, + PVOID pvReserved) +{ + switch (fdwReason) { + case DLL_PROCESS_ATTACH: + // Cache DLL instance handle + hInstanceDll = hInstance; + + // Flag that callback driver has yet to be initialized + bInitialized = bExited = FALSE; + +#ifndef _USE_GLD3_WGL + // Init internal Mesa function pointers + memset(&mesaFuncs, 0, sizeof(DGL_mesaFuncs)); +#endif // _USE_GLD3_WGL + + // Init defaults + dglInitGlobals(); + + // Defer rest of DLL initialization to 1st WGL function call + break; + + case DLL_PROCESS_DETACH: + // Call exit clean-up sequence + dglExitDriver(); + break; + } + + return TRUE; +} + +// *********************************************************************** + +void APIENTRY DGL_exitDriver(void) +{ + // Call exit clean-up sequence + dglExitDriver(); +} + +// *********************************************************************** + +void APIENTRY DGL_reinitDriver(void) +{ + // Force init sequence again + bInitialized = bExited = FALSE; + dglInitDriver(); +} + +// *********************************************************************** + +int WINAPI DllInitialize( + HINSTANCE hInstance, + DWORD fdwReason, + PVOID pvReserved) +{ + // Some Watcom compiled executables require this. + return DllMain(hInstance, fdwReason, pvReserved); +} + +// *********************************************************************** + +void DGL_LoadSplashScreen(int piReg, char* pszUser) +{ + HINSTANCE hSplashDll = NULL; + LPDGLSPLASHSCREEN dglSplashScreen = NULL; + static BOOL bOnce = FALSE; + static int iReg = 0; + static char szUser[255] = {"\0"}; + + // Display splash screen at all? + if (!bSplashScreen) + return; + + // Only display splash screen once + if (bOnce) + return; + bOnce = TRUE; + + // Make local copy of string for passing to DLL + if (pszUser) + strcpy(szUser, pszUser); + iReg = piReg; + + // Load Splash Screen DLL + // (If it fails to load for any reason, we don't care...) + hSplashDll = LoadLibrary("gldsplash.dll"); + if (hSplashDll) { + // Execute the Splash Screen function + dglSplashScreen = (LPDGLSPLASHSCREEN)GetProcAddress(hSplashDll, "GLDSplashScreen"); + if (dglSplashScreen) + (*dglSplashScreen)(1, iReg, szUser); + // Don't unload the DLL since splash screen dialog is modeless now + } +} + +// *********************************************************************** + +BOOL dglValidate() +{ + char *szCaption = "SciTech GLDirect Driver"; + UINT uType = MB_OK | MB_ICONEXCLAMATION; + +#ifdef _USE_GLD3_WGL + // (Re)build pixelformat list + if (glb.bPixelformatsDirty) + _gldDriver.BuildPixelformatList(); +#endif + + // Check to see if we have already validated + if (bDriverValidated && bInitialized) + return TRUE; + + // Since all (most) the WGL functions must be validated at this point, + // this also insure that the callback driver is completely initialized. + if (!bInitialized) + if (!dglInitDriver()) { + MessageBox(NULL, + "The GLDirect driver could not initialize.\n\n" + "Please run the configuration program to\n" + "properly configure the driver, or else\n" + "re-run the installation program.", szCaption, uType); + _exit(1); // Bail + } + + return TRUE; +} + +// *********************************************************************** + diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/dllmain.h b/reactos/dll/mesa32/src/drivers/windows/gldirect/dllmain.h new file mode 100644 index 00000000000..03343ef7ad3 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/dllmain.h @@ -0,0 +1,64 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: Win32 DllMain functions. +* +****************************************************************************/ + +#ifndef __DLLMAIN_H +#define __DLLMAIN_H + +// Macros to control compilation +#define STRICT +#define WIN32_LEAN_AND_MEAN + +#include + +#ifndef _USE_GLD3_WGL +#include "DirectGL.h" +#endif // _USE_GLD3_WGL + +//#include "gldirect/regkeys.h" +#include "dglglobals.h" +#include "ddlog.h" +#ifndef _USE_GLD3_WGL +#include "d3dtexture.h" +#endif // _USE_GLD3_WGL + +#include "dglwgl.h" + +extern BOOL bInitialized; + +BOOL dglInitDriver(void); +void dglExitDriver(void); + +#endif diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_debug_clip.c b/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_debug_clip.c new file mode 100644 index 00000000000..1eb19ca84b0 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_debug_clip.c @@ -0,0 +1,40 @@ +/* $Id: gld_debug_clip.c,v 1.1 2004/04/20 11:13:11 alanh Exp $ */ + +/* + * 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. + * + * Authors: + * Gareth Hughes + */ + +#ifdef DEBUG /* This code only used for debugging */ + +// Stub to enable Mesa to build. KeithH +#pragma message("NOTE: Using gld_debug_clip.c HACK") + +void _math_test_all_cliptest_functions( char *description ) +{ +} + + +#endif /* DEBUG */ diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_debug_norm.c b/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_debug_norm.c new file mode 100644 index 00000000000..00c428bd262 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_debug_norm.c @@ -0,0 +1,40 @@ +/* $Id: gld_debug_norm.c,v 1.1 2004/04/20 11:13:11 alanh Exp $ */ + +/* + * 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. + * + * Authors: + * Gareth Hughes + */ + +#ifdef DEBUG /* This code only used for debugging */ + +// Stub to enable Mesa to build. KeithH +#pragma message("NOTE: Using gld_debug_norm.c HACK") + +void _math_test_all_normal_transform_functions( char *description ) +{ +} + + +#endif /* DEBUG */ diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_debug_xform.c b/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_debug_xform.c new file mode 100644 index 00000000000..d6e64b8ffdf --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_debug_xform.c @@ -0,0 +1,42 @@ +/* $Id: gld_debug_xform.c,v 1.1 2004/04/20 11:13:11 alanh Exp $ */ + +/* + * 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. + */ + +/* + * Updated for P6 architecture by Gareth Hughes. + */ + + +#ifdef DEBUG /* This code only used for debugging */ + +// Stub to enable Mesa to build. KeithH +#pragma message("NOTE: Using gld_debug_xform.c HACK") + +void _math_test_all_transform_functions( char *description ) +{ +} + + +#endif /* DEBUG */ diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_dispatch.c b/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_dispatch.c new file mode 100644 index 00000000000..e05d767e302 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_dispatch.c @@ -0,0 +1,73 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x/2000/XP/XBox (Win32) +* +* Description: Thread-aware dispatch table. +* +****************************************************************************/ + +#include "glheader.h" +#include "glapi.h" +#include "glapitable.h" +#include "mtypes.h" +#include "context.h" + +#define KEYWORD1 +#define KEYWORD2 GLAPIENTRY +#if defined(USE_MGL_NAMESPACE) + #define NAME(func) mgl##func +#else + #define NAME(func) gl##func +#endif + +#if 0 +// Altered these to get the dispatch table from +// the current context of the calling thread. +#define DISPATCH(FUNC, ARGS, MESSAGE) \ + GET_CURRENT_CONTEXT(gc); \ + (gc->CurrentDispatch->FUNC) ARGS +#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ + GET_CURRENT_CONTEXT(gc); \ + return (gc->CurrentDispatch->FUNC) ARGS +#else // #if 0 +#define DISPATCH(FUNC, ARGS, MESSAGE) \ + GET_CURRENT_CONTEXT(gc); \ + (_glapi_Dispatch->FUNC) ARGS +#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ + GET_CURRENT_CONTEXT(gc); \ + return (_glapi_Dispatch->FUNC) ARGS +#endif // #if 0 + +#ifndef GLAPIENTRY +#define GLAPIENTRY +#endif + +#include "glapitemp.h" diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_driver.c b/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_driver.c new file mode 100644 index 00000000000..f7c575614b4 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_driver.c @@ -0,0 +1,279 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x/2000/XP/XBox (Win32) +* +* Description: Driver functions and interfaces +* +****************************************************************************/ + +#define STRICT +#define WIN32_LEAN_AND_MEAN +#include + +#include "gld_driver.h" +#include "ddlog.h" +#include "glheader.h" + +// For glGetString(). +#include "common_x86_asm.h" + +//--------------------------------------------------------------------------- + +static char *szDriverError = "Driver used before initialisation!"; + +// This holds our dynamically created OpenGL renderer string. +// 256 chars should be plenty - remember that some apps display this. +static char _gldRendererString[256]; + +static char *szVendor = "SciTech Software, Inc."; + +//--------------------------------------------------------------------------- + +extern BOOL gldGetDXErrorString_DX(HRESULT hr, char *buf, int nBufSize); + +extern BOOL gldCreateDrawable_MesaSW(DGL_ctx *ctx, BOOL bPersistantInterface, BOOL bPersistantBuffers); +extern BOOL gldResizeDrawable_MesaSW(DGL_ctx *ctx, BOOL bDefaultDriver, BOOL bPersistantInterface, BOOL bPersistantBuffers); +extern BOOL gldDestroyDrawable_MesaSW(DGL_ctx *ctx); +extern BOOL gldCreatePrivateGlobals_MesaSW(void); +extern BOOL gldDestroyPrivateGlobals_MesaSW(void); +extern BOOL gldBuildPixelformatList_MesaSW(void); +extern BOOL gldInitialiseMesa_MesaSW(DGL_ctx *ctx); +extern BOOL gldSwapBuffers_MesaSW(DGL_ctx *ctx, HDC hDC, HWND hWnd); +extern PROC gldGetProcAddress_MesaSW(LPCSTR a); +extern BOOL gldGetDisplayMode_MesaSW(DGL_ctx *ctx, GLD_displayMode *glddm); + +extern BOOL gldCreateDrawable_DX(DGL_ctx *ctx, BOOL bPersistantInterface, BOOL bPersistantBuffers); +extern BOOL gldResizeDrawable_DX(DGL_ctx *ctx, BOOL bDefaultDriver, BOOL bPersistantInterface, BOOL bPersistantBuffers); +extern BOOL gldDestroyDrawable_DX(DGL_ctx *ctx); +extern BOOL gldCreatePrivateGlobals_DX(void); +extern BOOL gldDestroyPrivateGlobals_DX(void); +extern BOOL gldBuildPixelformatList_DX(void); +extern BOOL gldInitialiseMesa_DX(DGL_ctx *ctx); +extern BOOL gldSwapBuffers_DX(DGL_ctx *ctx, HDC hDC, HWND hWnd); +extern PROC gldGetProcAddress_DX(LPCSTR a); +extern BOOL gldGetDisplayMode_DX(DGL_ctx *ctx, GLD_displayMode *glddm); + +//--------------------------------------------------------------------------- +// NOP functions. Called if proper driver functions are not set. +//--------------------------------------------------------------------------- + +static BOOL _gldDriverError(void) +{ + ddlogMessage(DDLOG_CRITICAL, szDriverError); + return FALSE; +} + +//--------------------------------------------------------------------------- + +static BOOL _GetDXErrorString_ERROR( + HRESULT hr, + char *buf, + int nBufSize) +{ + return _gldDriverError(); +} + +//--------------------------------------------------------------------------- + +static BOOL _CreateDrawable_ERROR( + DGL_ctx *ctx, + BOOL bPersistantInterface, + BOOL bPersistantBuffers) +{ + return _gldDriverError(); +} + +//--------------------------------------------------------------------------- + +static BOOL _ResizeDrawable_ERROR( + DGL_ctx *ctx, + BOOL bDefaultDriver, + BOOL bPersistantInterface, + BOOL bPersistantBuffers) +{ + return _gldDriverError(); +} + +//--------------------------------------------------------------------------- + +static BOOL _DestroyDrawable_ERROR( + DGL_ctx *ctx) +{ + return _gldDriverError(); +} + +//--------------------------------------------------------------------------- + +static BOOL _CreatePrivateGlobals_ERROR(void) +{ + return _gldDriverError(); +} + +//--------------------------------------------------------------------------- + +static BOOL _DestroyPrivateGlobals_ERROR(void) +{ + return _gldDriverError(); +} + +//--------------------------------------------------------------------------- + +static BOOL _BuildPixelformatList_ERROR(void) +{ + return _gldDriverError(); +} + +//--------------------------------------------------------------------------- + + +static BOOL _InitialiseMesa_ERROR( + DGL_ctx *ctx) +{ + return _gldDriverError(); +} + +//--------------------------------------------------------------------------- + +static BOOL _SwapBuffers_ERROR( + DGL_ctx *ctx, + HDC hDC, + HWND hWnd) +{ + return _gldDriverError(); +} + +//--------------------------------------------------------------------------- + +static PROC _GetProcAddress_ERROR( + LPCSTR a) +{ + _gldDriverError(); + return NULL; +} + +//--------------------------------------------------------------------------- + +static BOOL _GetDisplayMode_ERROR( + DGL_ctx *ctx, + GLD_displayMode *glddm) +{ + return _gldDriverError(); +} + +//--------------------------------------------------------------------------- +// Functions useful to all drivers +//--------------------------------------------------------------------------- + +const GLubyte* _gldGetStringGeneric( + GLcontext *ctx, + GLenum name) +{ + if (!ctx) + return NULL; + + switch (name) { + case GL_RENDERER: + sprintf(_gldRendererString, "GLDirect 4.0 %s%s%s%s (%s %s)", + _mesa_x86_cpu_features ? "/x86" : "", + cpu_has_mmx ? "/MMX" : "", + cpu_has_3dnow ? "/3DNow!" : "", + cpu_has_xmm ? "/SSE" : "", + __DATE__, __TIME__); + return (const GLubyte *) _gldRendererString; + case GL_VENDOR: + return (const GLubyte *) szVendor; + default: + return NULL; + } +} + +//--------------------------------------------------------------------------- +// Global driver function pointers, initially set to functions that +// will report an error when called. +//--------------------------------------------------------------------------- + +GLD_driver _gldDriver = { + _GetDXErrorString_ERROR, + _CreateDrawable_ERROR, + _ResizeDrawable_ERROR, + _DestroyDrawable_ERROR, + _CreatePrivateGlobals_ERROR, + _DestroyPrivateGlobals_ERROR, + _BuildPixelformatList_ERROR, + _InitialiseMesa_ERROR, + _SwapBuffers_ERROR, + _GetProcAddress_ERROR, + _GetDisplayMode_ERROR +}; + +//--------------------------------------------------------------------------- +// Init function. Should be called as soon as regkeys/ini-settings are read. +//--------------------------------------------------------------------------- + +BOOL gldInitDriverPointers( + DWORD dwDriver) +{ + _gldDriver.GetDXErrorString = gldGetDXErrorString_DX; + + if (dwDriver == GLDS_DRIVER_MESA_SW) { + // Mesa Software driver + _gldDriver.CreateDrawable = gldCreateDrawable_MesaSW; + _gldDriver.ResizeDrawable = gldResizeDrawable_MesaSW; + _gldDriver.DestroyDrawable = gldDestroyDrawable_MesaSW; + _gldDriver.CreatePrivateGlobals = gldCreatePrivateGlobals_MesaSW; + _gldDriver.DestroyPrivateGlobals = gldDestroyPrivateGlobals_MesaSW; + _gldDriver.BuildPixelformatList = gldBuildPixelformatList_MesaSW; + _gldDriver.InitialiseMesa = gldInitialiseMesa_MesaSW; + _gldDriver.SwapBuffers = gldSwapBuffers_MesaSW; + _gldDriver.wglGetProcAddress = gldGetProcAddress_MesaSW; + _gldDriver.GetDisplayMode = gldGetDisplayMode_MesaSW; + return TRUE; + } + + if ((dwDriver == GLDS_DRIVER_REF) || (dwDriver == GLDS_DRIVER_HAL)) { + // Direct3D driver, either HW or SW + _gldDriver.CreateDrawable = gldCreateDrawable_DX; + _gldDriver.ResizeDrawable = gldResizeDrawable_DX; + _gldDriver.DestroyDrawable = gldDestroyDrawable_DX; + _gldDriver.CreatePrivateGlobals = gldCreatePrivateGlobals_DX; + _gldDriver.DestroyPrivateGlobals = gldDestroyPrivateGlobals_DX; + _gldDriver.BuildPixelformatList = gldBuildPixelformatList_DX; + _gldDriver.InitialiseMesa = gldInitialiseMesa_DX; + _gldDriver.SwapBuffers = gldSwapBuffers_DX; + _gldDriver.wglGetProcAddress = gldGetProcAddress_DX; + _gldDriver.GetDisplayMode = gldGetDisplayMode_DX; + return TRUE; + }; + + return FALSE; +} + +//--------------------------------------------------------------------------- diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_driver.h b/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_driver.h new file mode 100644 index 00000000000..01a46a8325f --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/gld_driver.h @@ -0,0 +1,90 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x/2000/XP/XBox (Win32) +* +* Description: Driver functions and interfaces +* +****************************************************************************/ + +#ifndef _GLD_DRIVER_H +#define _GLD_DRIVER_H + +// This file is only useful is we're using the new GLD3 WGL code. +#ifdef _USE_GLD3_WGL + +#include "dglcontext.h" + +// Same as DX8 D3DDISPLAYMODE +typedef struct { + DWORD Width; + DWORD Height; + DWORD Refresh; + DWORD BPP; +} GLD_displayMode; + +typedef struct { + // Returns a string for a given HRESULT error code. + BOOL (*GetDXErrorString)(HRESULT hr, char *buf, int nBufSize); + + // Driver functions for managing drawables. + // Functions must respect persistant buffers / persistant interface. + // NOTE: Persistant interface is: DirectDraw, pre-DX8; Direct3D, DX8 and above. + BOOL (*CreateDrawable)(DGL_ctx *ctx, BOOL bPersistantInterface, BOOL bPersistantBuffers); + BOOL (*ResizeDrawable)(DGL_ctx *ctx, BOOL bDefaultDriver, BOOL bPersistantInterface, BOOL bPersistantBuffers); + BOOL (*DestroyDrawable)(DGL_ctx *ctx); + + // Create/Destroy private globals belonging to driver + BOOL (*CreatePrivateGlobals)(void); + BOOL (*DestroyPrivateGlobals)(void); + + // Build pixelformat list + BOOL (*BuildPixelformatList)(void); + + // Initialise Mesa's driver pointers + BOOL (*InitialiseMesa)(DGL_ctx *ctx); + + // Swap buffers + BOOL (*SwapBuffers)(DGL_ctx *ctx, HDC hDC, HWND hWnd); + + // wglGetProcAddress() + PROC (*wglGetProcAddress)(LPCSTR a); + + BOOL (*GetDisplayMode)(DGL_ctx *ctx, GLD_displayMode *glddm); +} GLD_driver; + +extern GLD_driver _gldDriver; + +BOOL gldInitDriverPointers(DWORD dwDriver); +const GLubyte* _gldGetStringGeneric(GLcontext *ctx, GLenum name); + +#endif // _USE_GLD3_WGL + +#endif // _GLD_DRIVER_H diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/gldlame8.c b/reactos/dll/mesa32/src/drivers/windows/gldirect/gldlame8.c new file mode 100644 index 00000000000..5ac519c1749 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/gldlame8.c @@ -0,0 +1,181 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: GLDirect utility for determining lame boards/drivers. +* +****************************************************************************/ + +#define STRICT +#define WIN32_LEAN_AND_MEAN +#include + +/* +Ack. Broken out from gldlame.c because of broken D3D headers. KeithH +*/ + +/**************************************************************************** +REMARKS: +Scans list of DirectDraw devices for specific device IDs. +****************************************************************************/ + +#define VENDORID_ATI 0x1002 + +static DWORD devATIRagePro[] = { + 0x4742, // 3D RAGE PRO BGA AGP 1X/2X + 0x4744, // 3D RAGE PRO BGA AGP 1X only + 0x4749, // 3D RAGE PRO BGA PCI 33 MHz + 0x4750, // 3D RAGE PRO PQFP PCI 33 MHz + 0x4751, // 3D RAGE PRO PQFP PCI 33 MHz limited 3D + 0x4C42, // 3D RAGE LT PRO BGA-312 AGP 133 MHz + 0x4C44, // 3D RAGE LT PRO BGA-312 AGP 66 MHz + 0x4C49, // 3D RAGE LT PRO BGA-312 PCI 33 MHz + 0x4C50, // 3D RAGE LT PRO BGA-256 PCI 33 MHz + 0x4C51, // 3D RAGE LT PRO BGA-256 PCI 33 MHz limited 3D +}; + +static DWORD devATIRageIIplus[] = { + 0x4755, // 3D RAGE II+ + 0x4756, // 3D RAGE IIC PQFP PCI + 0x4757, // 3D RAGE IIC BGA AGP + 0x475A, // 3D RAGE IIC PQFP AGP + 0x4C47, // 3D RAGE LT-G +}; + +static __inline BOOL IsDevice( + DWORD *lpDeviceIdList, + DWORD dwDeviceId, + int count) +{ + int i; + + for (i=0; i 1 ) && + (d3dCaps.MaxSimultaneousTextures > 1 ) && + (d3dCaps.TextureOpCaps & D3DTEXOPCAPS_MODULATE )) ) + return TRUE; + + return FALSE; // Not lame +} diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/opengl32.def b/reactos/dll/mesa32/src/drivers/windows/gldirect/opengl32.def new file mode 100644 index 00000000000..b213b6e0470 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/opengl32.def @@ -0,0 +1,488 @@ +;**************************************************************************** +;* +;* Mesa 3-D graphics library +;* Direct3D Driver Interface +;* +;* ======================================================================== +;* +;* Copyright (C) 1991-2004 SciTech Software, 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 +;* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +;* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;* SOFTWARE. +;* +;* ====================================================================== +;* +;* Language: ANSI C +;* Environment: Windows 9x/2000/XP/XBox (Win32) +;* +;* Description: DLL Module definition file +;* +;****************************************************************************/ + +DESCRIPTION 'GLDirect' + +VERSION 3.0 + +EXPORTS + glAccum=glAccum @1 + glAlphaFunc=glAlphaFunc @2 + glAreTexturesResident=glAreTexturesResident @3 + glArrayElement=glArrayElement @4 + glBegin=glBegin @5 + glBindTexture=glBindTexture @6 + glBitmap=glBitmap @7 + glBlendFunc=glBlendFunc @8 + glCallList=glCallList @9 + glCallLists=glCallLists @10 + glClear=glClear @11 + glClearAccum=glClearAccum @12 + glClearIndex=glClearIndex @13 + glClearColor=glClearColor @14 + glClearDepth=glClearDepth @15 + glClearStencil=glClearStencil @16 + glClipPlane=glClipPlane @17 + glColor3b=glColor3b @18 + glColor3d=glColor3d @19 + glColor3f=glColor3f @20 + glColor3i=glColor3i @21 + glColor3s=glColor3s @22 + glColor3ub=glColor3ub @23 + glColor3ui=glColor3ui @24 + glColor3us=glColor3us @25 + glColor4b=glColor4b @26 + glColor4d=glColor4d @27 + glColor4f=glColor4f @28 + glColor4i=glColor4i @29 + glColor4s=glColor4s @30 + glColor4ub=glColor4ub @31 + glColor4ui=glColor4ui @32 + glColor4us=glColor4us @33 + glColor3bv=glColor3bv @34 + glColor3dv=glColor3dv @35 + glColor3fv=glColor3fv @36 + glColor3iv=glColor3iv @37 + glColor3sv=glColor3sv @38 + glColor3ubv=glColor3ubv @39 + glColor3uiv=glColor3uiv @40 + glColor3usv=glColor3usv @41 + glColor4bv=glColor4bv @42 + glColor4dv=glColor4dv @43 + glColor4fv=glColor4fv @44 + glColor4iv=glColor4iv @45 + glColor4sv=glColor4sv @46 + glColor4ubv=glColor4ubv @47 + glColor4uiv=glColor4uiv @48 + glColor4usv=glColor4usv @49 + glColorMask=glColorMask @50 + glColorMaterial=glColorMaterial @51 + glColorPointer=glColorPointer @52 + glColorTableEXT=glColorTableEXT @53 + glColorSubTableEXT=glColorSubTableEXT @54 + glCopyPixels=glCopyPixels @55 + glCopyTexImage1D=glCopyTexImage1D @56 + glCopyTexImage2D=glCopyTexImage2D @57 + glCopyTexSubImage1D=glCopyTexSubImage1D @58 + glCopyTexSubImage2D=glCopyTexSubImage2D @59 + glCullFace=glCullFace @60 + glDepthFunc=glDepthFunc @61 + glDepthMask=glDepthMask @62 + glDepthRange=glDepthRange @63 + glDeleteLists=glDeleteLists @64 + glDeleteTextures=glDeleteTextures @65 + glDisable=glDisable @66 + glDisableClientState=glDisableClientState @67 + glDrawArrays=glDrawArrays @68 + glDrawBuffer=glDrawBuffer @69 + glDrawElements=glDrawElements @70 + glDrawPixels=glDrawPixels @71 + glEnable=glEnable @72 + glEnableClientState=glEnableClientState @73 + glEnd=glEnd @74 + glEndList=glEndList @75 + glEvalCoord1d=glEvalCoord1d @76 + glEvalCoord1f=glEvalCoord1f @77 + glEvalCoord1dv=glEvalCoord1dv @78 + glEvalCoord1fv=glEvalCoord1fv @79 + glEvalCoord2d=glEvalCoord2d @80 + glEvalCoord2f=glEvalCoord2f @81 + glEvalCoord2dv=glEvalCoord2dv @82 + glEvalCoord2fv=glEvalCoord2fv @83 + glEvalPoint1=glEvalPoint1 @84 + glEvalPoint2=glEvalPoint2 @85 + glEvalMesh1=glEvalMesh1 @86 + glEdgeFlag=glEdgeFlag @87 + glEdgeFlagv=glEdgeFlagv @88 + glEdgeFlagPointer=glEdgeFlagPointer @89 + glEvalMesh2=glEvalMesh2 @90 + glFeedbackBuffer=glFeedbackBuffer @91 + glFinish=glFinish @92 + glFlush=glFlush @93 + glFogf=glFogf @94 + glFogi=glFogi @95 + glFogfv=glFogfv @96 + glFogiv=glFogiv @97 + glFrontFace=glFrontFace @98 + glFrustum=glFrustum @99 + glGenLists=glGenLists @100 + glGenTextures=glGenTextures @101 + glGetBooleanv=glGetBooleanv @102 + glGetClipPlane=glGetClipPlane @103 + glGetColorTableEXT=glGetColorTableEXT @104 + glGetColorTableParameterivEXT=glGetColorTableParameterivEXT @105 + glGetColorTableParameterfvEXT=glGetColorTableParameterfvEXT @106 + glGetDoublev=glGetDoublev @107 + glGetError=glGetError @108 + glGetFloatv=glGetFloatv @109 + glGetIntegerv=glGetIntegerv @110 + glGetLightfv=glGetLightfv @111 + glGetLightiv=glGetLightiv @112 + glGetMapdv=glGetMapdv @113 + glGetMapfv=glGetMapfv @114 + glGetMapiv=glGetMapiv @115 + glGetMaterialfv=glGetMaterialfv @116 + glGetMaterialiv=glGetMaterialiv @117 + glGetPixelMapfv=glGetPixelMapfv @118 + glGetPixelMapuiv=glGetPixelMapuiv @119 + glGetPixelMapusv=glGetPixelMapusv @120 + glGetPointerv=glGetPointerv @121 + glGetPolygonStipple=glGetPolygonStipple @122 + glGetString=glGetString @123 + glGetTexEnvfv=glGetTexEnvfv @124 + glGetTexEnviv=glGetTexEnviv @125 + glGetTexGeniv=glGetTexGeniv @126 + glGetTexGendv=glGetTexGendv @127 + glGetTexGenfv=glGetTexGenfv @128 + glGetTexImage=glGetTexImage @129 + glGetTexLevelParameterfv=glGetTexLevelParameterfv @130 + glGetTexLevelParameteriv=glGetTexLevelParameteriv @131 + glGetTexParameterfv=glGetTexParameterfv @132 + glGetTexParameteriv=glGetTexParameteriv @133 + glHint=glHint @134 + glIndexd=glIndexd @135 + glIndexf=glIndexf @136 + glIndexi=glIndexi @137 + glIndexs=glIndexs @138 + glIndexub=glIndexub @139 + glIndexdv=glIndexdv @140 + glIndexfv=glIndexfv @141 + glIndexiv=glIndexiv @142 + glIndexsv=glIndexsv @143 + glIndexubv=glIndexubv @144 + glIndexMask=glIndexMask @145 + glIndexPointer=glIndexPointer @146 + glInterleavedArrays=glInterleavedArrays @147 + glInitNames=glInitNames @148 + glIsList=glIsList @149 + glIsTexture=glIsTexture @150 + glLightf=glLightf @151 + glLighti=glLighti @152 + glLightfv=glLightfv @153 + glLightiv=glLightiv @154 + glLightModelf=glLightModelf @155 + glLightModeli=glLightModeli @156 + glLightModelfv=glLightModelfv @157 + glLightModeliv=glLightModeliv @158 + glLineWidth=glLineWidth @159 + glLineStipple=glLineStipple @160 + glListBase=glListBase @161 + glLoadIdentity=glLoadIdentity @162 + glLoadMatrixd=glLoadMatrixd @163 + glLoadMatrixf=glLoadMatrixf @164 + glLoadName=glLoadName @165 + glLogicOp=glLogicOp @166 + glMap1d=glMap1d @167 + glMap1f=glMap1f @168 + glMap2d=glMap2d @169 + glMap2f=glMap2f @170 + glMapGrid1d=glMapGrid1d @171 + glMapGrid1f=glMapGrid1f @172 + glMapGrid2d=glMapGrid2d @173 + glMapGrid2f=glMapGrid2f @174 + glMaterialf=glMaterialf @175 + glMateriali=glMateriali @176 + glMaterialfv=glMaterialfv @177 + glMaterialiv=glMaterialiv @178 + glMatrixMode=glMatrixMode @179 + glMultMatrixd=glMultMatrixd @180 + glMultMatrixf=glMultMatrixf @181 + glNewList=glNewList @182 + glNormal3b=glNormal3b @183 + glNormal3d=glNormal3d @184 + glNormal3f=glNormal3f @185 + glNormal3i=glNormal3i @186 + glNormal3s=glNormal3s @187 + glNormal3bv=glNormal3bv @188 + glNormal3dv=glNormal3dv @189 + glNormal3fv=glNormal3fv @190 + glNormal3iv=glNormal3iv @191 + glNormal3sv=glNormal3sv @192 + glNormalPointer=glNormalPointer @193 + glOrtho=glOrtho @194 + glPassThrough=glPassThrough @195 + glPixelMapfv=glPixelMapfv @196 + glPixelMapuiv=glPixelMapuiv @197 + glPixelMapusv=glPixelMapusv @198 + glPixelStoref=glPixelStoref @199 + glPixelStorei=glPixelStorei @200 + glPixelTransferf=glPixelTransferf @201 + glPixelTransferi=glPixelTransferi @202 + glPixelZoom=glPixelZoom @203 + glPointSize=glPointSize @204 + glPolygonMode=glPolygonMode @205 + glPolygonOffset=glPolygonOffset @206 + glPolygonOffsetEXT=glPolygonOffsetEXT @207 + glPolygonStipple=glPolygonStipple @208 + glPopAttrib=glPopAttrib @209 + glPopClientAttrib=glPopClientAttrib @210 + glPopMatrix=glPopMatrix @211 + glPopName=glPopName @212 + glPrioritizeTextures=glPrioritizeTextures @213 + glPushMatrix=glPushMatrix @214 + glRasterPos2d=glRasterPos2d @215 + glRasterPos2f=glRasterPos2f @216 + glRasterPos2i=glRasterPos2i @217 + glRasterPos2s=glRasterPos2s @218 + glRasterPos3d=glRasterPos3d @219 + glRasterPos3f=glRasterPos3f @220 + glRasterPos3i=glRasterPos3i @221 + glRasterPos3s=glRasterPos3s @222 + glRasterPos4d=glRasterPos4d @223 + glRasterPos4f=glRasterPos4f @224 + glRasterPos4i=glRasterPos4i @225 + glRasterPos4s=glRasterPos4s @226 + glRasterPos2dv=glRasterPos2dv @227 + glRasterPos2fv=glRasterPos2fv @228 + glRasterPos2iv=glRasterPos2iv @229 + glRasterPos2sv=glRasterPos2sv @230 + glRasterPos3dv=glRasterPos3dv @231 + glRasterPos3fv=glRasterPos3fv @232 + glRasterPos3iv=glRasterPos3iv @233 + glRasterPos3sv=glRasterPos3sv @234 + glRasterPos4dv=glRasterPos4dv @235 + glRasterPos4fv=glRasterPos4fv @236 + glRasterPos4iv=glRasterPos4iv @237 + glRasterPos4sv=glRasterPos4sv @238 + glReadBuffer=glReadBuffer @239 + glReadPixels=glReadPixels @240 + glRectd=glRectd @241 + glRectf=glRectf @242 + glRecti=glRecti @243 + glRects=glRects @244 + glRectdv=glRectdv @245 + glRectfv=glRectfv @246 + glRectiv=glRectiv @247 + glRectsv=glRectsv @248 + glScissor=glScissor @249 + glIsEnabled=glIsEnabled @250 + glPushAttrib=glPushAttrib @251 + glPushClientAttrib=glPushClientAttrib @252 + glPushName=glPushName @253 + glRenderMode=glRenderMode @254 + glRotated=glRotated @255 + glRotatef=glRotatef @256 + glSelectBuffer=glSelectBuffer @257 + glScaled=glScaled @258 + glScalef=glScalef @259 + glShadeModel=glShadeModel @260 + glStencilFunc=glStencilFunc @261 + glStencilMask=glStencilMask @262 + glStencilOp=glStencilOp @263 + glTexCoord1d=glTexCoord1d @264 + glTexCoord1f=glTexCoord1f @265 + glTexCoord1i=glTexCoord1i @266 + glTexCoord1s=glTexCoord1s @267 + glTexCoord2d=glTexCoord2d @268 + glTexCoord2f=glTexCoord2f @269 + glTexCoord2i=glTexCoord2i @270 + glTexCoord2s=glTexCoord2s @271 + glTexCoord3d=glTexCoord3d @272 + glTexCoord3f=glTexCoord3f @273 + glTexCoord3i=glTexCoord3i @274 + glTexCoord3s=glTexCoord3s @275 + glTexCoord4d=glTexCoord4d @276 + glTexCoord4f=glTexCoord4f @277 + glTexCoord4i=glTexCoord4i @278 + glTexCoord4s=glTexCoord4s @279 + glTexCoord1dv=glTexCoord1dv @280 + glTexCoord1fv=glTexCoord1fv @281 + glTexCoord1iv=glTexCoord1iv @282 + glTexCoord1sv=glTexCoord1sv @283 + glTexCoord2dv=glTexCoord2dv @284 + glTexCoord2fv=glTexCoord2fv @285 + glTexCoord2iv=glTexCoord2iv @286 + glTexCoord2sv=glTexCoord2sv @287 + glTexCoord3dv=glTexCoord3dv @288 + glTexCoord3fv=glTexCoord3fv @289 + glTexCoord3iv=glTexCoord3iv @290 + glTexCoord3sv=glTexCoord3sv @291 + glTexCoord4dv=glTexCoord4dv @292 + glTexCoord4fv=glTexCoord4fv @293 + glTexCoord4iv=glTexCoord4iv @294 + glTexCoord4sv=glTexCoord4sv @295 + glTexCoordPointer=glTexCoordPointer @296 + glTexGend=glTexGend @297 + glTexGenf=glTexGenf @298 + glTexGeni=glTexGeni @299 + glTexGendv=glTexGendv @300 + glTexGeniv=glTexGeniv @301 + glTexGenfv=glTexGenfv @302 + glTexEnvf=glTexEnvf @303 + glTexEnvi=glTexEnvi @304 + glTexEnvfv=glTexEnvfv @305 + glTexEnviv=glTexEnviv @306 + glTexImage1D=glTexImage1D @307 + glTexImage2D=glTexImage2D @308 + glTexParameterf=glTexParameterf @309 + glTexParameteri=glTexParameteri @310 + glTexParameterfv=glTexParameterfv @311 + glTexParameteriv=glTexParameteriv @312 + glTexSubImage1D=glTexSubImage1D @313 + glTexSubImage2D=glTexSubImage2D @314 + glTranslated=glTranslated @315 + glTranslatef=glTranslatef @316 + glVertex2d=glVertex2d @317 + glVertex2f=glVertex2f @318 + glVertex2i=glVertex2i @319 + glVertex2s=glVertex2s @320 + glVertex3d=glVertex3d @321 + glVertex3f=glVertex3f @322 + glVertex3i=glVertex3i @323 + glVertex3s=glVertex3s @324 + glVertex4d=glVertex4d @325 + glVertex4f=glVertex4f @326 + glVertex4i=glVertex4i @327 + glVertex4s=glVertex4s @328 + glVertex2dv=glVertex2dv @329 + glVertex2fv=glVertex2fv @330 + glVertex2iv=glVertex2iv @331 + glVertex2sv=glVertex2sv @332 + glVertex3dv=glVertex3dv @333 + glVertex3fv=glVertex3fv @334 + glVertex3iv=glVertex3iv @335 + glVertex3sv=glVertex3sv @336 + glVertex4dv=glVertex4dv @337 + glVertex4fv=glVertex4fv @338 + glVertex4iv=glVertex4iv @339 + glVertex4sv=glVertex4sv @340 + glVertexPointer=glVertexPointer @341 + glViewport=glViewport @342 + glBlendEquationEXT=glBlendEquationEXT @343 + glBlendColorEXT=glBlendColorEXT @344 + glVertexPointerEXT=glVertexPointerEXT @345 + glNormalPointerEXT=glNormalPointerEXT @346 + glColorPointerEXT=glColorPointerEXT @347 + glIndexPointerEXT=glIndexPointerEXT @348 + glTexCoordPointerEXT=glTexCoordPointerEXT @349 + glEdgeFlagPointerEXT=glEdgeFlagPointerEXT @350 + glGetPointervEXT=glGetPointervEXT @351 + glArrayElementEXT=glArrayElementEXT @352 + glDrawArraysEXT=glDrawArraysEXT @353 + glBindTextureEXT=glBindTextureEXT @354 + glDeleteTexturesEXT=glDeleteTexturesEXT @355 + glGenTexturesEXT=glGenTexturesEXT @356 + glPrioritizeTexturesEXT=glPrioritizeTexturesEXT @357 + glCopyTexSubImage3DEXT=glCopyTexSubImage3DEXT @358 + glTexImage3DEXT=glTexImage3DEXT @359 + glTexSubImage3DEXT=glTexSubImage3DEXT @360 + glWindowPos4fMESA=glWindowPos4fMESA @361 + glWindowPos2iMESA=glWindowPos2iMESA @362 + glWindowPos2sMESA=glWindowPos2sMESA @363 + glWindowPos2fMESA=glWindowPos2fMESA @364 + glWindowPos2dMESA=glWindowPos2dMESA @365 + glWindowPos2ivMESA=glWindowPos2ivMESA @366 + glWindowPos2svMESA=glWindowPos2svMESA @367 + glWindowPos2fvMESA=glWindowPos2fvMESA @368 + glWindowPos2dvMESA=glWindowPos2dvMESA @369 + glWindowPos3iMESA=glWindowPos3iMESA @370 + glWindowPos3sMESA=glWindowPos3sMESA @371 + glWindowPos3fMESA=glWindowPos3fMESA @372 + glWindowPos3dMESA=glWindowPos3dMESA @373 + glWindowPos3ivMESA=glWindowPos3ivMESA @374 + glWindowPos3svMESA=glWindowPos3svMESA @375 + glWindowPos3fvMESA=glWindowPos3fvMESA @376 + glWindowPos3dvMESA=glWindowPos3dvMESA @377 + glWindowPos4iMESA=glWindowPos4iMESA @378 + glWindowPos4sMESA=glWindowPos4sMESA @379 + glWindowPos4dMESA=glWindowPos4dMESA @380 + glWindowPos4ivMESA=glWindowPos4ivMESA @381 + glWindowPos4svMESA=glWindowPos4svMESA @382 + glWindowPos4fvMESA=glWindowPos4fvMESA @383 + glWindowPos4dvMESA=glWindowPos4dvMESA @384 + glResizeBuffersMESA=glResizeBuffersMESA @385 + wglCopyContext=wglCopyContext @386 + wglCreateContext=wglCreateContext @387 + wglCreateLayerContext=wglCreateLayerContext @388 + wglDeleteContext=wglDeleteContext @389 + wglDescribeLayerPlane=wglDescribeLayerPlane @390 + wglGetCurrentContext=wglGetCurrentContext @391 + wglGetCurrentDC=wglGetCurrentDC @392 + wglGetLayerPaletteEntries=wglGetLayerPaletteEntries @393 + wglGetProcAddress=wglGetProcAddress @394 + wglMakeCurrent=wglMakeCurrent @395 + wglRealizeLayerPalette=wglRealizeLayerPalette @396 + wglSetLayerPaletteEntries=wglSetLayerPaletteEntries @397 + wglShareLists=wglShareLists @398 + wglSwapLayerBuffers=wglSwapLayerBuffers @399 + wglUseFontBitmapsA=wglUseFontBitmapsA @400 + wglUseFontBitmapsW=wglUseFontBitmapsW @401 + wglUseFontOutlinesA=wglUseFontOutlinesA @402 + wglUseFontOutlinesW=wglUseFontOutlinesW @403 + ChoosePixelFormat=ChoosePixelFormat @404 + DescribePixelFormat=DescribePixelFormat @405 + GetPixelFormat=GetPixelFormat @406 + SetPixelFormat=SetPixelFormat @407 + SwapBuffers=SwapBuffers @408 + wglChoosePixelFormat=wglChoosePixelFormat @409 + wglDescribePixelFormat=wglDescribePixelFormat @410 + wglGetPixelFormat=wglGetPixelFormat @411 + wglSetPixelFormat=wglSetPixelFormat @412 + wglSwapBuffers=wglSwapBuffers @413 + glActiveTextureARB=glActiveTextureARB @414 + glClientActiveTextureARB=glClientActiveTextureARB @415 + glMultiTexCoord1dARB=glMultiTexCoord1dARB @416 + glMultiTexCoord1dvARB=glMultiTexCoord1dvARB @417 + glMultiTexCoord1fARB=glMultiTexCoord1fARB @418 + glMultiTexCoord1fvARB=glMultiTexCoord1fvARB @419 + glMultiTexCoord1iARB=glMultiTexCoord1iARB @420 + glMultiTexCoord1ivARB=glMultiTexCoord1ivARB @421 + glMultiTexCoord1sARB=glMultiTexCoord1sARB @422 + glMultiTexCoord1svARB=glMultiTexCoord1svARB @423 + glMultiTexCoord2dARB=glMultiTexCoord2dARB @424 + glMultiTexCoord2dvARB=glMultiTexCoord2dvARB @425 + glMultiTexCoord2fARB=glMultiTexCoord2fARB @426 + glMultiTexCoord2fvARB=glMultiTexCoord2fvARB @427 + glMultiTexCoord2iARB=glMultiTexCoord2iARB @428 + glMultiTexCoord2ivARB=glMultiTexCoord2ivARB @429 + glMultiTexCoord2sARB=glMultiTexCoord2sARB @430 + glMultiTexCoord2svARB=glMultiTexCoord2svARB @431 + glMultiTexCoord3dARB=glMultiTexCoord3dARB @432 + glMultiTexCoord3dvARB=glMultiTexCoord3dvARB @433 + glMultiTexCoord3fARB=glMultiTexCoord3fARB @434 + glMultiTexCoord3fvARB=glMultiTexCoord3fvARB @435 + glMultiTexCoord3iARB=glMultiTexCoord3iARB @436 + glMultiTexCoord3ivARB=glMultiTexCoord3ivARB @437 + glMultiTexCoord3sARB=glMultiTexCoord3sARB @438 + glMultiTexCoord3svARB=glMultiTexCoord3svARB @439 + glMultiTexCoord4dARB=glMultiTexCoord4dARB @440 + glMultiTexCoord4dvARB=glMultiTexCoord4dvARB @441 + glMultiTexCoord4fARB=glMultiTexCoord4fARB @442 + glMultiTexCoord4fvARB=glMultiTexCoord4fvARB @443 + glMultiTexCoord4iARB=glMultiTexCoord4iARB @444 + glMultiTexCoord4ivARB=glMultiTexCoord4ivARB @445 + glMultiTexCoord4sARB=glMultiTexCoord4sARB @446 + glMultiTexCoord4svARB=glMultiTexCoord4svARB @447 diff --git a/reactos/dll/mesa32/src/drivers/windows/gldirect/pixpack.h b/reactos/dll/mesa32/src/drivers/windows/gldirect/pixpack.h new file mode 100644 index 00000000000..ec848d455b8 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/gldirect/pixpack.h @@ -0,0 +1,108 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, 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 +* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x (Win32) +* +* Description: Pixel packing functions. +* +****************************************************************************/ + +#ifndef __PIXPACK_H +#define __PIXPACK_H + +#include +#include + +#include "ddlog.h" + +/*---------------------- Macros and type definitions ----------------------*/ + +#define PXAPI + +// Typedef that can be used for pixel packing function pointers. +#define PX_PACK_FUNC(a) void PXAPI (a)(unsigned char *pixdata, void *dst, GLenum Format, const LPDDSURFACEDESC2 lpDDSD2) +typedef void (PXAPI *PX_packFunc)(unsigned char *pixdata, void *dst, GLenum Format, const LPDDSURFACEDESC2 lpDDSD2); + +// Typedef that can be used for pixel unpacking function pointers. +#define PX_UNPACK_FUNC(a) void PXAPI (a)(unsigned char *pixdata, void *src, GLenum Format, const LPDDSURFACEDESC2 lpDDSD2) +typedef void (PXAPI *PX_unpackFunc)(unsigned char *pixdata, void *src, GLenum Format, const LPDDSURFACEDESC2 lpDDSD2); + +// Typedef that can be used for pixel span packing function pointers. +#define PX_PACK_SPAN_FUNC(a) void PXAPI (a)(GLuint n, unsigned char *pixdata, unsigned char *dst, GLenum Format, const LPDDSURFACEDESC2 lpDDSD2) +typedef void (PXAPI *PX_packSpanFunc)(GLuint n, unsigned char *pixdata, unsigned char *dst, GLenum Format, const LPDDSURFACEDESC2 lpDDSD2); + +/*------------------------- Function Prototypes ---------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +// Function that examines a pixel format and returns the relevent +// pixel-packing function +void PXAPI pxClassifyPixelFormat(const LPDDPIXELFORMAT lpddpf, PX_packFunc *lpPackFn ,PX_unpackFunc *lpUnpackFn, PX_packSpanFunc *lpPackSpanFn); + +// Packing functions +PX_PACK_FUNC(pxPackGeneric); +PX_PACK_FUNC(pxPackRGB555); +PX_PACK_FUNC(pxPackARGB4444); +PX_PACK_FUNC(pxPackARGB1555); +PX_PACK_FUNC(pxPackRGB565); +PX_PACK_FUNC(pxPackRGB332); +PX_PACK_FUNC(pxPackRGB888); +PX_PACK_FUNC(pxPackARGB8888); +PX_PACK_FUNC(pxPackPAL8); + +// Unpacking functions +PX_UNPACK_FUNC(pxUnpackGeneric); +PX_UNPACK_FUNC(pxUnpackRGB555); +PX_UNPACK_FUNC(pxUnpackARGB4444); +PX_UNPACK_FUNC(pxUnpackARGB1555); +PX_UNPACK_FUNC(pxUnpackRGB565); +PX_UNPACK_FUNC(pxUnpackRGB332); +PX_UNPACK_FUNC(pxUnpackRGB888); +PX_UNPACK_FUNC(pxUnpackARGB8888); +PX_UNPACK_FUNC(pxUnpackPAL8); + +// Span Packing functions +PX_PACK_SPAN_FUNC(pxPackSpanGeneric); +PX_PACK_SPAN_FUNC(pxPackSpanRGB555); +PX_PACK_SPAN_FUNC(pxPackSpanARGB4444); +PX_PACK_SPAN_FUNC(pxPackSpanARGB1555); +PX_PACK_SPAN_FUNC(pxPackSpanRGB565); +PX_PACK_SPAN_FUNC(pxPackSpanRGB332); +PX_PACK_SPAN_FUNC(pxPackSpanRGB888); +PX_PACK_SPAN_FUNC(pxPackSpanARGB8888); +PX_PACK_SPAN_FUNC(pxPackSpanPAL8); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/dll/mesa32/src/drivers/windows/icd/icd.c b/reactos/dll/mesa32/src/drivers/windows/icd/icd.c new file mode 100644 index 00000000000..4bc6176b1a9 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/icd/icd.c @@ -0,0 +1,347 @@ +/* + * 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. + */ + +/* + * File name: icd.c + * Author: Gregor Anich + * + * ICD (Installable Client Driver) interface. + * Based on the windows GDI/WGL driver. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#define GL_GLEXT_PROTOTYPES +#include "GL/gl.h" +#include "GL/glext.h" + +#ifdef __cplusplus +} +#endif + +#include +#include +#include "GL/wmesa.h" +#include "mtypes.h" +#include "glapi.h" + +#define MAX_MESA_ATTRS 20 + +typedef struct wmesa_context *PWMC; + +typedef struct _icdTable { + DWORD size; + PROC table[336]; +} ICDTABLE, *PICDTABLE; + +#ifdef USE_MGL_NAMESPACE +# define GL_FUNC(func) mgl##func +#else +# define GL_FUNC(func) gl##func +#endif + +static ICDTABLE icdTable = { 336, { +#define ICD_ENTRY(func) (PROC)GL_FUNC(func), +#include "icdlist.h" +#undef ICD_ENTRY +} }; + +struct __pixelformat__ +{ + PIXELFORMATDESCRIPTOR pfd; + GLboolean doubleBuffered; +}; + +struct __pixelformat__ pix[] = +{ + /* Double Buffer, alpha */ + { { sizeof(PIXELFORMATDESCRIPTOR), 1, + PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER|PFD_SWAP_COPY, + PFD_TYPE_RGBA, + 24, 8, 0, 8, 8, 8, 16, 8, 24, + 0, 0, 0, 0, 0, 16, 8, 0, 0, 0, 0, 0, 0 }, + GL_TRUE + }, + /* Single Buffer, alpha */ + { { sizeof(PIXELFORMATDESCRIPTOR), 1, + PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL, /* | PFD_SUPPORT_GDI ? */ + PFD_TYPE_RGBA, + 24, 8, 0, 8, 8, 8, 16, 8, 24, + 0, 0, 0, 0, 0, 16, 8, 0, 0, 0, 0, 0, 0 }, + GL_FALSE + }, + /* Double Buffer, no alpha */ + { { sizeof(PIXELFORMATDESCRIPTOR), 1, + PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER|PFD_SWAP_COPY, + PFD_TYPE_RGBA, + 24, 8, 0, 8, 8, 8, 16, 0, 0, + 0, 0, 0, 0, 0, 16, 8, 0, 0, 0, 0, 0, 0 }, + GL_TRUE + }, + /* Single Buffer, no alpha */ + { { sizeof(PIXELFORMATDESCRIPTOR), 1, + PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL, /* | PFD_SUPPORT_GDI ? */ + PFD_TYPE_RGBA, + 24, 8, 0, 8, 8, 8, 16, 0, 0, + 0, 0, 0, 0, 0, 16, 8, 0, 0, 0, 0, 0, 0 }, + GL_FALSE + }, +}; + +int qt_pix = sizeof(pix) / sizeof(pix[0]); + +typedef struct { + WMesaContext ctx; + HDC hdc; +} MesaWglCtx; + +#define MESAWGL_CTX_MAX_COUNT 20 + +static MesaWglCtx wgl_ctx[MESAWGL_CTX_MAX_COUNT]; + +static unsigned ctx_count = 0; +static int ctx_current = -1; +static unsigned curPFD = 0; + +WGLAPI BOOL GLAPIENTRY DrvCopyContext(HGLRC hglrcSrc,HGLRC hglrcDst,UINT mask) +{ + (void) hglrcSrc; (void) hglrcDst; (void) mask; + return(FALSE); +} + +WGLAPI HGLRC GLAPIENTRY DrvCreateContext(HDC hdc) +{ + HWND hWnd; + int i = 0; + + if(!(hWnd = WindowFromDC(hdc))) + { + SetLastError(0); + return(NULL); + } + if (!ctx_count) + { + for(i=0;i qt_valid_pix || nBytes != sizeof(PIXELFORMATDESCRIPTOR)) + { + SetLastError(0); + return(0); + } + *ppfd = pix[iPixelFormat - 1].pfd; + return(qt_valid_pix); +} + +/* +* GetProcAddress - return the address of an appropriate extension +*/ +WGLAPI PROC GLAPIENTRY DrvGetProcAddress(LPCSTR lpszProc) +{ + PROC p = (PROC) (int) _glapi_get_proc_address((const char *) lpszProc); + if (p) + return p; + + SetLastError(0); + return(NULL); +} + +WGLAPI BOOL GLAPIENTRY DrvSetPixelFormat(HDC hdc,int iPixelFormat) +{ + int qt_valid_pix; + (void) hdc; + + qt_valid_pix = qt_pix; + if(iPixelFormat < 1 || iPixelFormat > qt_valid_pix) + { + SetLastError(0); + return(FALSE); + } + curPFD = iPixelFormat; + return(TRUE); +} + +WGLAPI BOOL GLAPIENTRY DrvSwapBuffers(HDC hdc) +{ + (void) hdc; + if (ctx_current < 0) + return FALSE; + + if(wgl_ctx[ctx_current].ctx == NULL) { + SetLastError(0); + return(FALSE); + } + WMesaSwapBuffers(); + return(TRUE); +} + +WGLAPI BOOL GLAPIENTRY DrvValidateVersion(DWORD version) +{ + (void) version; + return TRUE; +} diff --git a/reactos/dll/mesa32/src/drivers/windows/icd/icdlist.h b/reactos/dll/mesa32/src/drivers/windows/icd/icdlist.h new file mode 100644 index 00000000000..1318804cf4a --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/icd/icdlist.h @@ -0,0 +1,336 @@ +ICD_ENTRY(NewList) /* 0 */ +ICD_ENTRY(EndList) /* 1 */ +ICD_ENTRY(CallList) /* 2 */ +ICD_ENTRY(CallLists) /* 3 */ +ICD_ENTRY(DeleteLists) /* 4 */ +ICD_ENTRY(GenLists) /* 5 */ +ICD_ENTRY(ListBase) /* 6 */ +ICD_ENTRY(Begin) /* 7 */ +ICD_ENTRY(Bitmap) /* 8 */ +ICD_ENTRY(Color3b) /* 9 */ +ICD_ENTRY(Color3bv) /* 10 */ +ICD_ENTRY(Color3d) /* 11 */ +ICD_ENTRY(Color3dv) /* 12 */ +ICD_ENTRY(Color3f) /* 13 */ +ICD_ENTRY(Color3fv) /* 14 */ +ICD_ENTRY(Color3i) /* 15 */ +ICD_ENTRY(Color3iv) /* 16 */ +ICD_ENTRY(Color3s) /* 17 */ +ICD_ENTRY(Color3sv) /* 18 */ +ICD_ENTRY(Color3ub) /* 19 */ +ICD_ENTRY(Color3ubv) /* 20 */ +ICD_ENTRY(Color3ui) /* 21 */ +ICD_ENTRY(Color3uiv) /* 22 */ +ICD_ENTRY(Color3us) /* 23 */ +ICD_ENTRY(Color3usv) /* 24 */ +ICD_ENTRY(Color4b) /* 25 */ +ICD_ENTRY(Color4bv) /* 26 */ +ICD_ENTRY(Color4d) /* 27 */ +ICD_ENTRY(Color4dv) /* 28 */ +ICD_ENTRY(Color4f) /* 29 */ +ICD_ENTRY(Color4fv) /* 30 */ +ICD_ENTRY(Color4i) /* 31 */ +ICD_ENTRY(Color4iv) /* 32 */ +ICD_ENTRY(Color4s) /* 33 */ +ICD_ENTRY(Color4sv) /* 34 */ +ICD_ENTRY(Color4ub) /* 35 */ +ICD_ENTRY(Color4ubv) /* 36 */ +ICD_ENTRY(Color4ui) /* 37 */ +ICD_ENTRY(Color4uiv) /* 38 */ +ICD_ENTRY(Color4us) /* 39 */ +ICD_ENTRY(Color4usv) /* 40 */ +ICD_ENTRY(EdgeFlag) /* 41 */ +ICD_ENTRY(EdgeFlagv) /* 42 */ +ICD_ENTRY(End) /* 43 */ +ICD_ENTRY(Indexd) /* 44 */ +ICD_ENTRY(Indexdv) /* 45 */ +ICD_ENTRY(Indexf) /* 46 */ +ICD_ENTRY(Indexfv) /* 47 */ +ICD_ENTRY(Indexi) /* 48 */ +ICD_ENTRY(Indexiv) /* 49 */ +ICD_ENTRY(Indexs) /* 50 */ +ICD_ENTRY(Indexsv) /* 51 */ +ICD_ENTRY(Normal3b) /* 52 */ +ICD_ENTRY(Normal3bv) /* 53 */ +ICD_ENTRY(Normal3d) /* 54 */ +ICD_ENTRY(Normal3dv) /* 55 */ +ICD_ENTRY(Normal3f) /* 56 */ +ICD_ENTRY(Normal3fv) /* 57 */ +ICD_ENTRY(Normal3i) /* 58 */ +ICD_ENTRY(Normal3iv) /* 59 */ +ICD_ENTRY(Normal3s) /* 60 */ +ICD_ENTRY(Normal3sv) /* 61 */ +ICD_ENTRY(RasterPos2d) /* 62 */ +ICD_ENTRY(RasterPos2dv) /* 63 */ +ICD_ENTRY(RasterPos2f) /* 64 */ +ICD_ENTRY(RasterPos2fv) /* 65 */ +ICD_ENTRY(RasterPos2i) /* 66 */ +ICD_ENTRY(RasterPos2iv) /* 67 */ +ICD_ENTRY(RasterPos2s) /* 68 */ +ICD_ENTRY(RasterPos2sv) /* 69 */ +ICD_ENTRY(RasterPos3d) /* 70 */ +ICD_ENTRY(RasterPos3dv) /* 71 */ +ICD_ENTRY(RasterPos3f) /* 72 */ +ICD_ENTRY(RasterPos3fv) /* 73 */ +ICD_ENTRY(RasterPos3i) /* 74 */ +ICD_ENTRY(RasterPos3iv) /* 75 */ +ICD_ENTRY(RasterPos3s) /* 76 */ +ICD_ENTRY(RasterPos3sv) /* 77 */ +ICD_ENTRY(RasterPos4d) /* 78 */ +ICD_ENTRY(RasterPos4dv) /* 79 */ +ICD_ENTRY(RasterPos4f) /* 80 */ +ICD_ENTRY(RasterPos4fv) /* 81 */ +ICD_ENTRY(RasterPos4i) /* 82 */ +ICD_ENTRY(RasterPos4iv) /* 83 */ +ICD_ENTRY(RasterPos4s) /* 84 */ +ICD_ENTRY(RasterPos4sv) /* 85 */ +ICD_ENTRY(Rectd) /* 86 */ +ICD_ENTRY(Rectdv) /* 87 */ +ICD_ENTRY(Rectf) /* 88 */ +ICD_ENTRY(Rectfv) /* 89 */ +ICD_ENTRY(Recti) /* 90 */ +ICD_ENTRY(Rectiv) /* 91 */ +ICD_ENTRY(Rects) /* 92 */ +ICD_ENTRY(Rectsv) /* 93 */ +ICD_ENTRY(TexCoord1d) /* 94 */ +ICD_ENTRY(TexCoord1dv) /* 95 */ +ICD_ENTRY(TexCoord1f) /* 96 */ +ICD_ENTRY(TexCoord1fv) /* 97 */ +ICD_ENTRY(TexCoord1i) /* 98 */ +ICD_ENTRY(TexCoord1iv) /* 99 */ +ICD_ENTRY(TexCoord1s) /* 100 */ +ICD_ENTRY(TexCoord1sv) /* 101 */ +ICD_ENTRY(TexCoord2d) /* 102 */ +ICD_ENTRY(TexCoord2dv) /* 103 */ +ICD_ENTRY(TexCoord2f) /* 104 */ +ICD_ENTRY(TexCoord2fv) /* 105 */ +ICD_ENTRY(TexCoord2i) /* 106 */ +ICD_ENTRY(TexCoord2iv) /* 107 */ +ICD_ENTRY(TexCoord2s) /* 108 */ +ICD_ENTRY(TexCoord2sv) /* 109 */ +ICD_ENTRY(TexCoord3d) /* 110 */ +ICD_ENTRY(TexCoord3dv) /* 111 */ +ICD_ENTRY(TexCoord3f) /* 112 */ +ICD_ENTRY(TexCoord3fv) /* 113 */ +ICD_ENTRY(TexCoord3i) /* 114 */ +ICD_ENTRY(TexCoord3iv) /* 115 */ +ICD_ENTRY(TexCoord3s) /* 116 */ +ICD_ENTRY(TexCoord3sv) /* 117 */ +ICD_ENTRY(TexCoord4d) /* 118 */ +ICD_ENTRY(TexCoord4dv) /* 119 */ +ICD_ENTRY(TexCoord4f) /* 120 */ +ICD_ENTRY(TexCoord4fv) /* 121 */ +ICD_ENTRY(TexCoord4i) /* 122 */ +ICD_ENTRY(TexCoord4iv) /* 123 */ +ICD_ENTRY(TexCoord4s) /* 124 */ +ICD_ENTRY(TexCoord4sv) /* 125 */ +ICD_ENTRY(Vertex2d) /* 126 */ +ICD_ENTRY(Vertex2dv) /* 127 */ +ICD_ENTRY(Vertex2f) /* 128 */ +ICD_ENTRY(Vertex2fv) /* 129 */ +ICD_ENTRY(Vertex2i) /* 130 */ +ICD_ENTRY(Vertex2iv) /* 131 */ +ICD_ENTRY(Vertex2s) /* 132 */ +ICD_ENTRY(Vertex2sv) /* 133 */ +ICD_ENTRY(Vertex3d) /* 134 */ +ICD_ENTRY(Vertex3dv) /* 135 */ +ICD_ENTRY(Vertex3f) /* 136 */ +ICD_ENTRY(Vertex3fv) /* 137 */ +ICD_ENTRY(Vertex3i) /* 138 */ +ICD_ENTRY(Vertex3iv) /* 139 */ +ICD_ENTRY(Vertex3s) /* 140 */ +ICD_ENTRY(Vertex3sv) /* 141 */ +ICD_ENTRY(Vertex4d) /* 142 */ +ICD_ENTRY(Vertex4dv) /* 143 */ +ICD_ENTRY(Vertex4f) /* 144 */ +ICD_ENTRY(Vertex4fv) /* 145 */ +ICD_ENTRY(Vertex4i) /* 146 */ +ICD_ENTRY(Vertex4iv) /* 147 */ +ICD_ENTRY(Vertex4s) /* 148 */ +ICD_ENTRY(Vertex4sv) /* 149 */ +ICD_ENTRY(ClipPlane) /* 150 */ +ICD_ENTRY(ColorMaterial) /* 151 */ +ICD_ENTRY(CullFace) /* 152 */ +ICD_ENTRY(Fogf) /* 153 */ +ICD_ENTRY(Fogfv) /* 154 */ +ICD_ENTRY(Fogi) /* 155 */ +ICD_ENTRY(Fogiv) /* 156 */ +ICD_ENTRY(FrontFace) /* 157 */ +ICD_ENTRY(Hint) /* 158 */ +ICD_ENTRY(Lightf) /* 159 */ +ICD_ENTRY(Lightfv) /* 160 */ +ICD_ENTRY(Lighti) /* 161 */ +ICD_ENTRY(Lightiv) /* 162 */ +ICD_ENTRY(LightModelf) /* 163 */ +ICD_ENTRY(LightModelfv) /* 164 */ +ICD_ENTRY(LightModeli) /* 165 */ +ICD_ENTRY(LightModeliv) /* 166 */ +ICD_ENTRY(LineStipple) /* 167 */ +ICD_ENTRY(LineWidth) /* 168 */ +ICD_ENTRY(Materialf) /* 169 */ +ICD_ENTRY(Materialfv) /* 170 */ +ICD_ENTRY(Materiali) /* 171 */ +ICD_ENTRY(Materialiv) /* 172 */ +ICD_ENTRY(PointSize) /* 173 */ +ICD_ENTRY(PolygonMode) /* 174 */ +ICD_ENTRY(PolygonStipple) /* 175 */ +ICD_ENTRY(Scissor) /* 176 */ +ICD_ENTRY(ShadeModel) /* 177 */ +ICD_ENTRY(TexParameterf) /* 178 */ +ICD_ENTRY(TexParameterfv) /* 179 */ +ICD_ENTRY(TexParameteri) /* 180 */ +ICD_ENTRY(TexParameteriv) /* 181 */ +ICD_ENTRY(TexImage1D) /* 182 */ +ICD_ENTRY(TexImage2D) /* 183 */ +ICD_ENTRY(TexEnvf) /* 184 */ +ICD_ENTRY(TexEnvfv) /* 185 */ +ICD_ENTRY(TexEnvi) /* 186 */ +ICD_ENTRY(TexEnviv) /* 187 */ +ICD_ENTRY(TexGend) /* 188 */ +ICD_ENTRY(TexGendv) /* 189 */ +ICD_ENTRY(TexGenf) /* 190 */ +ICD_ENTRY(TexGenfv) /* 191 */ +ICD_ENTRY(TexGeni) /* 192 */ +ICD_ENTRY(TexGeniv) /* 193 */ +ICD_ENTRY(FeedbackBuffer) /* 194 */ +ICD_ENTRY(SelectBuffer) /* 195 */ +ICD_ENTRY(RenderMode) /* 196 */ +ICD_ENTRY(InitNames) /* 197 */ +ICD_ENTRY(LoadName) /* 198 */ +ICD_ENTRY(PassThrough) /* 199 */ +ICD_ENTRY(PopName) /* 200 */ +ICD_ENTRY(PushName) /* 201 */ +ICD_ENTRY(DrawBuffer) /* 202 */ +ICD_ENTRY(Clear) /* 203 */ +ICD_ENTRY(ClearAccum) /* 204 */ +ICD_ENTRY(ClearIndex) /* 205 */ +ICD_ENTRY(ClearColor) /* 206 */ +ICD_ENTRY(ClearStencil) /* 207 */ +ICD_ENTRY(ClearDepth) /* 208 */ +ICD_ENTRY(StencilMask) /* 209 */ +ICD_ENTRY(ColorMask) /* 210 */ +ICD_ENTRY(DepthMask) /* 211 */ +ICD_ENTRY(IndexMask) /* 212 */ +ICD_ENTRY(Accum) /* 213 */ +ICD_ENTRY(Disable) /* 214 */ +ICD_ENTRY(Enable) /* 215 */ +ICD_ENTRY(Finish) /* 216 */ +ICD_ENTRY(Flush) /* 217 */ +ICD_ENTRY(PopAttrib) /* 218 */ +ICD_ENTRY(PushAttrib) /* 219 */ +ICD_ENTRY(Map1d) /* 220 */ +ICD_ENTRY(Map1f) /* 221 */ +ICD_ENTRY(Map2d) /* 222 */ +ICD_ENTRY(Map2f) /* 223 */ +ICD_ENTRY(MapGrid1d) /* 224 */ +ICD_ENTRY(MapGrid1f) /* 225 */ +ICD_ENTRY(MapGrid2d) /* 226 */ +ICD_ENTRY(MapGrid2f) /* 227 */ +ICD_ENTRY(EvalCoord1d) /* 228 */ +ICD_ENTRY(EvalCoord1dv) /* 229 */ +ICD_ENTRY(EvalCoord1f) /* 230 */ +ICD_ENTRY(EvalCoord1fv) /* 231 */ +ICD_ENTRY(EvalCoord2d) /* 232 */ +ICD_ENTRY(EvalCoord2dv) /* 233 */ +ICD_ENTRY(EvalCoord2f) /* 234 */ +ICD_ENTRY(EvalCoord2fv) /* 235 */ +ICD_ENTRY(EvalMesh1) /* 236 */ +ICD_ENTRY(EvalPoint1) /* 237 */ +ICD_ENTRY(EvalMesh2) /* 238 */ +ICD_ENTRY(EvalPoint2) /* 239 */ +ICD_ENTRY(AlphaFunc) /* 240 */ +ICD_ENTRY(BlendFunc) /* 241 */ +ICD_ENTRY(LogicOp) /* 242 */ +ICD_ENTRY(StencilFunc) /* 243 */ +ICD_ENTRY(StencilOp) /* 244 */ +ICD_ENTRY(DepthFunc) /* 245 */ +ICD_ENTRY(PixelZoom) /* 246 */ +ICD_ENTRY(PixelTransferf) /* 247 */ +ICD_ENTRY(PixelTransferi) /* 248 */ +ICD_ENTRY(PixelStoref) /* 249 */ +ICD_ENTRY(PixelStorei) /* 250 */ +ICD_ENTRY(PixelMapfv) /* 251 */ +ICD_ENTRY(PixelMapuiv) /* 252 */ +ICD_ENTRY(PixelMapusv) /* 253 */ +ICD_ENTRY(ReadBuffer) /* 254 */ +ICD_ENTRY(CopyPixels) /* 255 */ +ICD_ENTRY(ReadPixels) /* 256 */ +ICD_ENTRY(DrawPixels) /* 257 */ +ICD_ENTRY(GetBooleanv) /* 258 */ +ICD_ENTRY(GetClipPlane) /* 259 */ +ICD_ENTRY(GetDoublev) /* 260 */ +ICD_ENTRY(GetError) /* 261 */ +ICD_ENTRY(GetFloatv) /* 262 */ +ICD_ENTRY(GetIntegerv) /* 263 */ +ICD_ENTRY(GetLightfv) /* 264 */ +ICD_ENTRY(GetLightiv) /* 265 */ +ICD_ENTRY(GetMapdv) /* 266 */ +ICD_ENTRY(GetMapfv) /* 267 */ +ICD_ENTRY(GetMapiv) /* 268 */ +ICD_ENTRY(GetMaterialfv) /* 269 */ +ICD_ENTRY(GetMaterialiv) /* 270 */ +ICD_ENTRY(GetPixelMapfv) /* 271 */ +ICD_ENTRY(GetPixelMapuiv) /* 272 */ +ICD_ENTRY(GetPixelMapusv) /* 273 */ +ICD_ENTRY(GetPolygonStipple) /* 274 */ +ICD_ENTRY(GetString) /* 275 */ +ICD_ENTRY(GetTexEnvfv) /* 276 */ +ICD_ENTRY(GetTexEnviv) /* 277 */ +ICD_ENTRY(GetTexGendv) /* 278 */ +ICD_ENTRY(GetTexGenfv) /* 279 */ +ICD_ENTRY(GetTexGeniv) /* 280 */ +ICD_ENTRY(GetTexImage) /* 281 */ +ICD_ENTRY(GetTexParameterfv) /* 282 */ +ICD_ENTRY(GetTexParameteriv) /* 283 */ +ICD_ENTRY(GetTexLevelParameterfv) /* 284 */ +ICD_ENTRY(GetTexLevelParameteriv) /* 285 */ +ICD_ENTRY(IsEnabled) /* 286 */ +ICD_ENTRY(IsList) /* 287 */ +ICD_ENTRY(DepthRange) /* 288 */ +ICD_ENTRY(Frustum) /* 289 */ +ICD_ENTRY(LoadIdentity) /* 290 */ +ICD_ENTRY(LoadMatrixf) /* 291 */ +ICD_ENTRY(LoadMatrixd) /* 292 */ +ICD_ENTRY(MatrixMode) /* 293 */ +ICD_ENTRY(MultMatrixf) /* 294 */ +ICD_ENTRY(MultMatrixd) /* 295 */ +ICD_ENTRY(Ortho) /* 296 */ +ICD_ENTRY(PopMatrix) /* 297 */ +ICD_ENTRY(PushMatrix) /* 298 */ +ICD_ENTRY(Rotated) /* 299 */ +ICD_ENTRY(Rotatef) /* 300 */ +ICD_ENTRY(Scaled) /* 301 */ +ICD_ENTRY(Scalef) /* 302 */ +ICD_ENTRY(Translated) /* 303 */ +ICD_ENTRY(Translatef) /* 304 */ +ICD_ENTRY(Viewport) /* 305 */ +ICD_ENTRY(ArrayElement) /* 306 */ +ICD_ENTRY(BindTexture) /* 307 */ +ICD_ENTRY(ColorPointer) /* 308 */ +ICD_ENTRY(DisableClientState) /* 309 */ +ICD_ENTRY(DrawArrays) /* 310 */ +ICD_ENTRY(DrawElements) /* 311 */ +ICD_ENTRY(EdgeFlagPointer) /* 312 */ +ICD_ENTRY(EnableClientState) /* 313 */ +ICD_ENTRY(IndexPointer) /* 314 */ +ICD_ENTRY(Indexub) /* 315 */ +ICD_ENTRY(Indexubv) /* 316 */ +ICD_ENTRY(InterleavedArrays) /* 317 */ +ICD_ENTRY(NormalPointer) /* 318 */ +ICD_ENTRY(PolygonOffset) /* 319 */ +ICD_ENTRY(TexCoordPointer) /* 320 */ +ICD_ENTRY(VertexPointer) /* 321 */ +ICD_ENTRY(AreTexturesResident) /* 322 */ +ICD_ENTRY(CopyTexImage1D) /* 323 */ +ICD_ENTRY(CopyTexImage2D) /* 324 */ +ICD_ENTRY(CopyTexSubImage1D) /* 325 */ +ICD_ENTRY(CopyTexSubImage2D) /* 326 */ +ICD_ENTRY(DeleteTextures) /* 327 */ +ICD_ENTRY(GenTextures) /* 328 */ +ICD_ENTRY(GetPointerv) /* 329 */ +ICD_ENTRY(IsTexture) /* 330 */ +ICD_ENTRY(PrioritizeTextures) /* 331 */ +ICD_ENTRY(TexSubImage1D) /* 332 */ +ICD_ENTRY(TexSubImage2D) /* 333 */ +ICD_ENTRY(PopClientAttrib) /* 334 */ +ICD_ENTRY(PushClientAttrib) /* 335 */ diff --git a/reactos/dll/mesa32/src/drivers/windows/icd/mesa.def b/reactos/dll/mesa32/src/drivers/windows/icd/mesa.def new file mode 100644 index 00000000000..1826192d307 --- /dev/null +++ b/reactos/dll/mesa32/src/drivers/windows/icd/mesa.def @@ -0,0 +1,108 @@ +DESCRIPTION 'Mesa (OpenGL driver) for Win32' +VERSION 6.1 + +EXPORTS +; +; ICD API + DrvCopyContext + DrvCreateContext + DrvCreateLayerContext + DrvDeleteContext + DrvDescribeLayerPlane + DrvDescribePixelFormat + DrvGetLayerPaletteEntries + DrvGetProcAddress + DrvReleaseContext + DrvRealizeLayerPalette + DrvSetContext + DrvSetLayerPaletteEntries + DrvSetPixelFormat + DrvShareLists + DrvSwapBuffers + DrvSwapLayerBuffers + DrvValidateVersion + +; +; Mesa internals - mostly for OSMESA + _ac_CreateContext + _ac_DestroyContext + _ac_InvalidateState + _glapi_get_context + _glapi_get_proc_address + _mesa_buffer_data + _mesa_buffer_map + _mesa_buffer_subdata + _mesa_bzero + _mesa_calloc + _mesa_choose_tex_format + _mesa_compressed_texture_size + _mesa_create_framebuffer + _mesa_create_visual + _mesa_delete_buffer_object + _mesa_delete_texture_object + _mesa_destroy_framebuffer + _mesa_destroy_visual + _mesa_enable_1_3_extensions + _mesa_enable_1_4_extensions + _mesa_enable_1_5_extensions + _mesa_enable_sw_extensions + _mesa_error + _mesa_free + _mesa_free_context_data + _mesa_get_current_context + _mesa_init_default_imports + _mesa_init_driver_functions + _mesa_initialize_context + _mesa_make_current + _mesa_memcpy + _mesa_memset + _mesa_new_buffer_object + _mesa_new_texture_object + _mesa_problem + _mesa_ResizeBuffersMESA + _mesa_store_compressed_teximage1d + _mesa_store_compressed_teximage2d + _mesa_store_compressed_teximage3d + _mesa_store_compressed_texsubimage1d + _mesa_store_compressed_texsubimage2d + _mesa_store_compressed_texsubimage3d + _mesa_store_teximage1d + _mesa_store_teximage2d + _mesa_store_teximage3d + _mesa_store_texsubimage1d + _mesa_store_texsubimage2d + _mesa_store_texsubimage3d + _mesa_strcmp + _mesa_test_proxy_teximage + _mesa_Viewport + _swrast_Accum + _swrast_Bitmap + _swrast_CopyPixels + _swrast_DrawBuffer + _swrast_DrawPixels + _swrast_GetDeviceDriverReference + _swrast_Clear + _swrast_choose_line + _swrast_choose_triangle + _swrast_CopyColorSubTable + _swrast_CopyColorTable + _swrast_CopyConvolutionFilter1D + _swrast_CopyConvolutionFilter2D + _swrast_copy_teximage1d + _swrast_copy_teximage2d + _swrast_copy_texsubimage1d + _swrast_copy_texsubimage2d + _swrast_copy_texsubimage3d + _swrast_CreateContext + _swrast_DestroyContext + _swrast_InvalidateState + _swrast_ReadPixels + _swsetup_Wakeup + _swsetup_CreateContext + _swsetup_DestroyContext + _swsetup_InvalidateState + _tnl_CreateContext + _tnl_DestroyContext + _tnl_InvalidateState + _tnl_MakeCurrent + _tnl_run_pipeline diff --git a/reactos/dll/mesa32/src/glapi/descrip.mms b/reactos/dll/mesa32/src/glapi/descrip.mms new file mode 100644 index 00000000000..20573b9ac9a --- /dev/null +++ b/reactos/dll/mesa32/src/glapi/descrip.mms @@ -0,0 +1,37 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl +# Last revision : 16 June 2003 + +.first + define gl [---.include.gl] + +.include [---]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [---.include],[-.main] +LIBDIR = [---.lib] +CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short) + +SOURCES = glapi.c glthread.c + +OBJECTS = glapi.obj,glthread.obj + +##### RULES ##### + +VERSION=Mesa V3.4 + +##### TARGETS ##### +# Make the library +$(LIBDIR)$(GL_LIB) : $(OBJECTS) + @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) + +clean : + purge + delete *.obj;* + +glapi.obj : glapi.c + +glthread.obj : glthread.c diff --git a/reactos/dll/mesa32/src/glapi/dispatch.h b/reactos/dll/mesa32/src/glapi/dispatch.h new file mode 100644 index 00000000000..9a456b5409d --- /dev/null +++ b/reactos/dll/mesa32/src/glapi/dispatch.h @@ -0,0 +1,4151 @@ +/* DO NOT EDIT - This file generated automatically by gl_table.py (from Mesa) script */ + +/* + * (C) Copyright IBM Corporation 2005 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * IBM, + * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#if !defined( _DISPATCH_H_ ) +# define _DISPATCH_H_ + +/** + * \file dispatch.h + * Macros for handling GL dispatch tables. + * + * For each known GL function, there are 3 macros in this file. The first + * macro is named CALL_FuncName and is used to call that GL function using + * the specified dispatch table. The other 2 macros, called GET_FuncName + * can SET_FuncName, are used to get and set the dispatch pointer for the + * named function in the specified dispatch table. + */ + +#define CALL_by_offset(disp, cast, offset, parameters) \ + (*(cast (GET_by_offset(disp, offset)))) parameters +#define GET_by_offset(disp, offset) \ + (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL +#define SET_by_offset(disp, offset, fn) \ + do { \ + if ( (offset) < 0 ) { \ + /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\n", */ \ + /* __func__, __LINE__, disp, offset, # fn); */ \ + /* abort(); */ \ + } \ + else { \ + ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \ + } \ + } while(0) + +#define CALL_NewList(disp, parameters) (*((disp)->NewList)) parameters +#define GET_NewList(disp) ((disp)->NewList) +#define SET_NewList(disp, fn) ((disp)->NewList = fn) +#define CALL_EndList(disp, parameters) (*((disp)->EndList)) parameters +#define GET_EndList(disp) ((disp)->EndList) +#define SET_EndList(disp, fn) ((disp)->EndList = fn) +#define CALL_CallList(disp, parameters) (*((disp)->CallList)) parameters +#define GET_CallList(disp) ((disp)->CallList) +#define SET_CallList(disp, fn) ((disp)->CallList = fn) +#define CALL_CallLists(disp, parameters) (*((disp)->CallLists)) parameters +#define GET_CallLists(disp) ((disp)->CallLists) +#define SET_CallLists(disp, fn) ((disp)->CallLists = fn) +#define CALL_DeleteLists(disp, parameters) (*((disp)->DeleteLists)) parameters +#define GET_DeleteLists(disp) ((disp)->DeleteLists) +#define SET_DeleteLists(disp, fn) ((disp)->DeleteLists = fn) +#define CALL_GenLists(disp, parameters) (*((disp)->GenLists)) parameters +#define GET_GenLists(disp) ((disp)->GenLists) +#define SET_GenLists(disp, fn) ((disp)->GenLists = fn) +#define CALL_ListBase(disp, parameters) (*((disp)->ListBase)) parameters +#define GET_ListBase(disp) ((disp)->ListBase) +#define SET_ListBase(disp, fn) ((disp)->ListBase = fn) +#define CALL_Begin(disp, parameters) (*((disp)->Begin)) parameters +#define GET_Begin(disp) ((disp)->Begin) +#define SET_Begin(disp, fn) ((disp)->Begin = fn) +#define CALL_Bitmap(disp, parameters) (*((disp)->Bitmap)) parameters +#define GET_Bitmap(disp) ((disp)->Bitmap) +#define SET_Bitmap(disp, fn) ((disp)->Bitmap = fn) +#define CALL_Color3b(disp, parameters) (*((disp)->Color3b)) parameters +#define GET_Color3b(disp) ((disp)->Color3b) +#define SET_Color3b(disp, fn) ((disp)->Color3b = fn) +#define CALL_Color3bv(disp, parameters) (*((disp)->Color3bv)) parameters +#define GET_Color3bv(disp) ((disp)->Color3bv) +#define SET_Color3bv(disp, fn) ((disp)->Color3bv = fn) +#define CALL_Color3d(disp, parameters) (*((disp)->Color3d)) parameters +#define GET_Color3d(disp) ((disp)->Color3d) +#define SET_Color3d(disp, fn) ((disp)->Color3d = fn) +#define CALL_Color3dv(disp, parameters) (*((disp)->Color3dv)) parameters +#define GET_Color3dv(disp) ((disp)->Color3dv) +#define SET_Color3dv(disp, fn) ((disp)->Color3dv = fn) +#define CALL_Color3f(disp, parameters) (*((disp)->Color3f)) parameters +#define GET_Color3f(disp) ((disp)->Color3f) +#define SET_Color3f(disp, fn) ((disp)->Color3f = fn) +#define CALL_Color3fv(disp, parameters) (*((disp)->Color3fv)) parameters +#define GET_Color3fv(disp) ((disp)->Color3fv) +#define SET_Color3fv(disp, fn) ((disp)->Color3fv = fn) +#define CALL_Color3i(disp, parameters) (*((disp)->Color3i)) parameters +#define GET_Color3i(disp) ((disp)->Color3i) +#define SET_Color3i(disp, fn) ((disp)->Color3i = fn) +#define CALL_Color3iv(disp, parameters) (*((disp)->Color3iv)) parameters +#define GET_Color3iv(disp) ((disp)->Color3iv) +#define SET_Color3iv(disp, fn) ((disp)->Color3iv = fn) +#define CALL_Color3s(disp, parameters) (*((disp)->Color3s)) parameters +#define GET_Color3s(disp) ((disp)->Color3s) +#define SET_Color3s(disp, fn) ((disp)->Color3s = fn) +#define CALL_Color3sv(disp, parameters) (*((disp)->Color3sv)) parameters +#define GET_Color3sv(disp) ((disp)->Color3sv) +#define SET_Color3sv(disp, fn) ((disp)->Color3sv = fn) +#define CALL_Color3ub(disp, parameters) (*((disp)->Color3ub)) parameters +#define GET_Color3ub(disp) ((disp)->Color3ub) +#define SET_Color3ub(disp, fn) ((disp)->Color3ub = fn) +#define CALL_Color3ubv(disp, parameters) (*((disp)->Color3ubv)) parameters +#define GET_Color3ubv(disp) ((disp)->Color3ubv) +#define SET_Color3ubv(disp, fn) ((disp)->Color3ubv = fn) +#define CALL_Color3ui(disp, parameters) (*((disp)->Color3ui)) parameters +#define GET_Color3ui(disp) ((disp)->Color3ui) +#define SET_Color3ui(disp, fn) ((disp)->Color3ui = fn) +#define CALL_Color3uiv(disp, parameters) (*((disp)->Color3uiv)) parameters +#define GET_Color3uiv(disp) ((disp)->Color3uiv) +#define SET_Color3uiv(disp, fn) ((disp)->Color3uiv = fn) +#define CALL_Color3us(disp, parameters) (*((disp)->Color3us)) parameters +#define GET_Color3us(disp) ((disp)->Color3us) +#define SET_Color3us(disp, fn) ((disp)->Color3us = fn) +#define CALL_Color3usv(disp, parameters) (*((disp)->Color3usv)) parameters +#define GET_Color3usv(disp) ((disp)->Color3usv) +#define SET_Color3usv(disp, fn) ((disp)->Color3usv = fn) +#define CALL_Color4b(disp, parameters) (*((disp)->Color4b)) parameters +#define GET_Color4b(disp) ((disp)->Color4b) +#define SET_Color4b(disp, fn) ((disp)->Color4b = fn) +#define CALL_Color4bv(disp, parameters) (*((disp)->Color4bv)) parameters +#define GET_Color4bv(disp) ((disp)->Color4bv) +#define SET_Color4bv(disp, fn) ((disp)->Color4bv = fn) +#define CALL_Color4d(disp, parameters) (*((disp)->Color4d)) parameters +#define GET_Color4d(disp) ((disp)->Color4d) +#define SET_Color4d(disp, fn) ((disp)->Color4d = fn) +#define CALL_Color4dv(disp, parameters) (*((disp)->Color4dv)) parameters +#define GET_Color4dv(disp) ((disp)->Color4dv) +#define SET_Color4dv(disp, fn) ((disp)->Color4dv = fn) +#define CALL_Color4f(disp, parameters) (*((disp)->Color4f)) parameters +#define GET_Color4f(disp) ((disp)->Color4f) +#define SET_Color4f(disp, fn) ((disp)->Color4f = fn) +#define CALL_Color4fv(disp, parameters) (*((disp)->Color4fv)) parameters +#define GET_Color4fv(disp) ((disp)->Color4fv) +#define SET_Color4fv(disp, fn) ((disp)->Color4fv = fn) +#define CALL_Color4i(disp, parameters) (*((disp)->Color4i)) parameters +#define GET_Color4i(disp) ((disp)->Color4i) +#define SET_Color4i(disp, fn) ((disp)->Color4i = fn) +#define CALL_Color4iv(disp, parameters) (*((disp)->Color4iv)) parameters +#define GET_Color4iv(disp) ((disp)->Color4iv) +#define SET_Color4iv(disp, fn) ((disp)->Color4iv = fn) +#define CALL_Color4s(disp, parameters) (*((disp)->Color4s)) parameters +#define GET_Color4s(disp) ((disp)->Color4s) +#define SET_Color4s(disp, fn) ((disp)->Color4s = fn) +#define CALL_Color4sv(disp, parameters) (*((disp)->Color4sv)) parameters +#define GET_Color4sv(disp) ((disp)->Color4sv) +#define SET_Color4sv(disp, fn) ((disp)->Color4sv = fn) +#define CALL_Color4ub(disp, parameters) (*((disp)->Color4ub)) parameters +#define GET_Color4ub(disp) ((disp)->Color4ub) +#define SET_Color4ub(disp, fn) ((disp)->Color4ub = fn) +#define CALL_Color4ubv(disp, parameters) (*((disp)->Color4ubv)) parameters +#define GET_Color4ubv(disp) ((disp)->Color4ubv) +#define SET_Color4ubv(disp, fn) ((disp)->Color4ubv = fn) +#define CALL_Color4ui(disp, parameters) (*((disp)->Color4ui)) parameters +#define GET_Color4ui(disp) ((disp)->Color4ui) +#define SET_Color4ui(disp, fn) ((disp)->Color4ui = fn) +#define CALL_Color4uiv(disp, parameters) (*((disp)->Color4uiv)) parameters +#define GET_Color4uiv(disp) ((disp)->Color4uiv) +#define SET_Color4uiv(disp, fn) ((disp)->Color4uiv = fn) +#define CALL_Color4us(disp, parameters) (*((disp)->Color4us)) parameters +#define GET_Color4us(disp) ((disp)->Color4us) +#define SET_Color4us(disp, fn) ((disp)->Color4us = fn) +#define CALL_Color4usv(disp, parameters) (*((disp)->Color4usv)) parameters +#define GET_Color4usv(disp) ((disp)->Color4usv) +#define SET_Color4usv(disp, fn) ((disp)->Color4usv = fn) +#define CALL_EdgeFlag(disp, parameters) (*((disp)->EdgeFlag)) parameters +#define GET_EdgeFlag(disp) ((disp)->EdgeFlag) +#define SET_EdgeFlag(disp, fn) ((disp)->EdgeFlag = fn) +#define CALL_EdgeFlagv(disp, parameters) (*((disp)->EdgeFlagv)) parameters +#define GET_EdgeFlagv(disp) ((disp)->EdgeFlagv) +#define SET_EdgeFlagv(disp, fn) ((disp)->EdgeFlagv = fn) +#define CALL_End(disp, parameters) (*((disp)->End)) parameters +#define GET_End(disp) ((disp)->End) +#define SET_End(disp, fn) ((disp)->End = fn) +#define CALL_Indexd(disp, parameters) (*((disp)->Indexd)) parameters +#define GET_Indexd(disp) ((disp)->Indexd) +#define SET_Indexd(disp, fn) ((disp)->Indexd = fn) +#define CALL_Indexdv(disp, parameters) (*((disp)->Indexdv)) parameters +#define GET_Indexdv(disp) ((disp)->Indexdv) +#define SET_Indexdv(disp, fn) ((disp)->Indexdv = fn) +#define CALL_Indexf(disp, parameters) (*((disp)->Indexf)) parameters +#define GET_Indexf(disp) ((disp)->Indexf) +#define SET_Indexf(disp, fn) ((disp)->Indexf = fn) +#define CALL_Indexfv(disp, parameters) (*((disp)->Indexfv)) parameters +#define GET_Indexfv(disp) ((disp)->Indexfv) +#define SET_Indexfv(disp, fn) ((disp)->Indexfv = fn) +#define CALL_Indexi(disp, parameters) (*((disp)->Indexi)) parameters +#define GET_Indexi(disp) ((disp)->Indexi) +#define SET_Indexi(disp, fn) ((disp)->Indexi = fn) +#define CALL_Indexiv(disp, parameters) (*((disp)->Indexiv)) parameters +#define GET_Indexiv(disp) ((disp)->Indexiv) +#define SET_Indexiv(disp, fn) ((disp)->Indexiv = fn) +#define CALL_Indexs(disp, parameters) (*((disp)->Indexs)) parameters +#define GET_Indexs(disp) ((disp)->Indexs) +#define SET_Indexs(disp, fn) ((disp)->Indexs = fn) +#define CALL_Indexsv(disp, parameters) (*((disp)->Indexsv)) parameters +#define GET_Indexsv(disp) ((disp)->Indexsv) +#define SET_Indexsv(disp, fn) ((disp)->Indexsv = fn) +#define CALL_Normal3b(disp, parameters) (*((disp)->Normal3b)) parameters +#define GET_Normal3b(disp) ((disp)->Normal3b) +#define SET_Normal3b(disp, fn) ((disp)->Normal3b = fn) +#define CALL_Normal3bv(disp, parameters) (*((disp)->Normal3bv)) parameters +#define GET_Normal3bv(disp) ((disp)->Normal3bv) +#define SET_Normal3bv(disp, fn) ((disp)->Normal3bv = fn) +#define CALL_Normal3d(disp, parameters) (*((disp)->Normal3d)) parameters +#define GET_Normal3d(disp) ((disp)->Normal3d) +#define SET_Normal3d(disp, fn) ((disp)->Normal3d = fn) +#define CALL_Normal3dv(disp, parameters) (*((disp)->Normal3dv)) parameters +#define GET_Normal3dv(disp) ((disp)->Normal3dv) +#define SET_Normal3dv(disp, fn) ((disp)->Normal3dv = fn) +#define CALL_Normal3f(disp, parameters) (*((disp)->Normal3f)) parameters +#define GET_Normal3f(disp) ((disp)->Normal3f) +#define SET_Normal3f(disp, fn) ((disp)->Normal3f = fn) +#define CALL_Normal3fv(disp, parameters) (*((disp)->Normal3fv)) parameters +#define GET_Normal3fv(disp) ((disp)->Normal3fv) +#define SET_Normal3fv(disp, fn) ((disp)->Normal3fv = fn) +#define CALL_Normal3i(disp, parameters) (*((disp)->Normal3i)) parameters +#define GET_Normal3i(disp) ((disp)->Normal3i) +#define SET_Normal3i(disp, fn) ((disp)->Normal3i = fn) +#define CALL_Normal3iv(disp, parameters) (*((disp)->Normal3iv)) parameters +#define GET_Normal3iv(disp) ((disp)->Normal3iv) +#define SET_Normal3iv(disp, fn) ((disp)->Normal3iv = fn) +#define CALL_Normal3s(disp, parameters) (*((disp)->Normal3s)) parameters +#define GET_Normal3s(disp) ((disp)->Normal3s) +#define SET_Normal3s(disp, fn) ((disp)->Normal3s = fn) +#define CALL_Normal3sv(disp, parameters) (*((disp)->Normal3sv)) parameters +#define GET_Normal3sv(disp) ((disp)->Normal3sv) +#define SET_Normal3sv(disp, fn) ((disp)->Normal3sv = fn) +#define CALL_RasterPos2d(disp, parameters) (*((disp)->RasterPos2d)) parameters +#define GET_RasterPos2d(disp) ((disp)->RasterPos2d) +#define SET_RasterPos2d(disp, fn) ((disp)->RasterPos2d = fn) +#define CALL_RasterPos2dv(disp, parameters) (*((disp)->RasterPos2dv)) parameters +#define GET_RasterPos2dv(disp) ((disp)->RasterPos2dv) +#define SET_RasterPos2dv(disp, fn) ((disp)->RasterPos2dv = fn) +#define CALL_RasterPos2f(disp, parameters) (*((disp)->RasterPos2f)) parameters +#define GET_RasterPos2f(disp) ((disp)->RasterPos2f) +#define SET_RasterPos2f(disp, fn) ((disp)->RasterPos2f = fn) +#define CALL_RasterPos2fv(disp, parameters) (*((disp)->RasterPos2fv)) parameters +#define GET_RasterPos2fv(disp) ((disp)->RasterPos2fv) +#define SET_RasterPos2fv(disp, fn) ((disp)->RasterPos2fv = fn) +#define CALL_RasterPos2i(disp, parameters) (*((disp)->RasterPos2i)) parameters +#define GET_RasterPos2i(disp) ((disp)->RasterPos2i) +#define SET_RasterPos2i(disp, fn) ((disp)->RasterPos2i = fn) +#define CALL_RasterPos2iv(disp, parameters) (*((disp)->RasterPos2iv)) parameters +#define GET_RasterPos2iv(disp) ((disp)->RasterPos2iv) +#define SET_RasterPos2iv(disp, fn) ((disp)->RasterPos2iv = fn) +#define CALL_RasterPos2s(disp, parameters) (*((disp)->RasterPos2s)) parameters +#define GET_RasterPos2s(disp) ((disp)->RasterPos2s) +#define SET_RasterPos2s(disp, fn) ((disp)->RasterPos2s = fn) +#define CALL_RasterPos2sv(disp, parameters) (*((disp)->RasterPos2sv)) parameters +#define GET_RasterPos2sv(disp) ((disp)->RasterPos2sv) +#define SET_RasterPos2sv(disp, fn) ((disp)->RasterPos2sv = fn) +#define CALL_RasterPos3d(disp, parameters) (*((disp)->RasterPos3d)) parameters +#define GET_RasterPos3d(disp) ((disp)->RasterPos3d) +#define SET_RasterPos3d(disp, fn) ((disp)->RasterPos3d = fn) +#define CALL_RasterPos3dv(disp, parameters) (*((disp)->RasterPos3dv)) parameters +#define GET_RasterPos3dv(disp) ((disp)->RasterPos3dv) +#define SET_RasterPos3dv(disp, fn) ((disp)->RasterPos3dv = fn) +#define CALL_RasterPos3f(disp, parameters) (*((disp)->RasterPos3f)) parameters +#define GET_RasterPos3f(disp) ((disp)->RasterPos3f) +#define SET_RasterPos3f(disp, fn) ((disp)->RasterPos3f = fn) +#define CALL_RasterPos3fv(disp, parameters) (*((disp)->RasterPos3fv)) parameters +#define GET_RasterPos3fv(disp) ((disp)->RasterPos3fv) +#define SET_RasterPos3fv(disp, fn) ((disp)->RasterPos3fv = fn) +#define CALL_RasterPos3i(disp, parameters) (*((disp)->RasterPos3i)) parameters +#define GET_RasterPos3i(disp) ((disp)->RasterPos3i) +#define SET_RasterPos3i(disp, fn) ((disp)->RasterPos3i = fn) +#define CALL_RasterPos3iv(disp, parameters) (*((disp)->RasterPos3iv)) parameters +#define GET_RasterPos3iv(disp) ((disp)->RasterPos3iv) +#define SET_RasterPos3iv(disp, fn) ((disp)->RasterPos3iv = fn) +#define CALL_RasterPos3s(disp, parameters) (*((disp)->RasterPos3s)) parameters +#define GET_RasterPos3s(disp) ((disp)->RasterPos3s) +#define SET_RasterPos3s(disp, fn) ((disp)->RasterPos3s = fn) +#define CALL_RasterPos3sv(disp, parameters) (*((disp)->RasterPos3sv)) parameters +#define GET_RasterPos3sv(disp) ((disp)->RasterPos3sv) +#define SET_RasterPos3sv(disp, fn) ((disp)->RasterPos3sv = fn) +#define CALL_RasterPos4d(disp, parameters) (*((disp)->RasterPos4d)) parameters +#define GET_RasterPos4d(disp) ((disp)->RasterPos4d) +#define SET_RasterPos4d(disp, fn) ((disp)->RasterPos4d = fn) +#define CALL_RasterPos4dv(disp, parameters) (*((disp)->RasterPos4dv)) parameters +#define GET_RasterPos4dv(disp) ((disp)->RasterPos4dv) +#define SET_RasterPos4dv(disp, fn) ((disp)->RasterPos4dv = fn) +#define CALL_RasterPos4f(disp, parameters) (*((disp)->RasterPos4f)) parameters +#define GET_RasterPos4f(disp) ((disp)->RasterPos4f) +#define SET_RasterPos4f(disp, fn) ((disp)->RasterPos4f = fn) +#define CALL_RasterPos4fv(disp, parameters) (*((disp)->RasterPos4fv)) parameters +#define GET_RasterPos4fv(disp) ((disp)->RasterPos4fv) +#define SET_RasterPos4fv(disp, fn) ((disp)->RasterPos4fv = fn) +#define CALL_RasterPos4i(disp, parameters) (*((disp)->RasterPos4i)) parameters +#define GET_RasterPos4i(disp) ((disp)->RasterPos4i) +#define SET_RasterPos4i(disp, fn) ((disp)->RasterPos4i = fn) +#define CALL_RasterPos4iv(disp, parameters) (*((disp)->RasterPos4iv)) parameters +#define GET_RasterPos4iv(disp) ((disp)->RasterPos4iv) +#define SET_RasterPos4iv(disp, fn) ((disp)->RasterPos4iv = fn) +#define CALL_RasterPos4s(disp, parameters) (*((disp)->RasterPos4s)) parameters +#define GET_RasterPos4s(disp) ((disp)->RasterPos4s) +#define SET_RasterPos4s(disp, fn) ((disp)->RasterPos4s = fn) +#define CALL_RasterPos4sv(disp, parameters) (*((disp)->RasterPos4sv)) parameters +#define GET_RasterPos4sv(disp) ((disp)->RasterPos4sv) +#define SET_RasterPos4sv(disp, fn) ((disp)->RasterPos4sv = fn) +#define CALL_Rectd(disp, parameters) (*((disp)->Rectd)) parameters +#define GET_Rectd(disp) ((disp)->Rectd) +#define SET_Rectd(disp, fn) ((disp)->Rectd = fn) +#define CALL_Rectdv(disp, parameters) (*((disp)->Rectdv)) parameters +#define GET_Rectdv(disp) ((disp)->Rectdv) +#define SET_Rectdv(disp, fn) ((disp)->Rectdv = fn) +#define CALL_Rectf(disp, parameters) (*((disp)->Rectf)) parameters +#define GET_Rectf(disp) ((disp)->Rectf) +#define SET_Rectf(disp, fn) ((disp)->Rectf = fn) +#define CALL_Rectfv(disp, parameters) (*((disp)->Rectfv)) parameters +#define GET_Rectfv(disp) ((disp)->Rectfv) +#define SET_Rectfv(disp, fn) ((disp)->Rectfv = fn) +#define CALL_Recti(disp, parameters) (*((disp)->Recti)) parameters +#define GET_Recti(disp) ((disp)->Recti) +#define SET_Recti(disp, fn) ((disp)->Recti = fn) +#define CALL_Rectiv(disp, parameters) (*((disp)->Rectiv)) parameters +#define GET_Rectiv(disp) ((disp)->Rectiv) +#define SET_Rectiv(disp, fn) ((disp)->Rectiv = fn) +#define CALL_Rects(disp, parameters) (*((disp)->Rects)) parameters +#define GET_Rects(disp) ((disp)->Rects) +#define SET_Rects(disp, fn) ((disp)->Rects = fn) +#define CALL_Rectsv(disp, parameters) (*((disp)->Rectsv)) parameters +#define GET_Rectsv(disp) ((disp)->Rectsv) +#define SET_Rectsv(disp, fn) ((disp)->Rectsv = fn) +#define CALL_TexCoord1d(disp, parameters) (*((disp)->TexCoord1d)) parameters +#define GET_TexCoord1d(disp) ((disp)->TexCoord1d) +#define SET_TexCoord1d(disp, fn) ((disp)->TexCoord1d = fn) +#define CALL_TexCoord1dv(disp, parameters) (*((disp)->TexCoord1dv)) parameters +#define GET_TexCoord1dv(disp) ((disp)->TexCoord1dv) +#define SET_TexCoord1dv(disp, fn) ((disp)->TexCoord1dv = fn) +#define CALL_TexCoord1f(disp, parameters) (*((disp)->TexCoord1f)) parameters +#define GET_TexCoord1f(disp) ((disp)->TexCoord1f) +#define SET_TexCoord1f(disp, fn) ((disp)->TexCoord1f = fn) +#define CALL_TexCoord1fv(disp, parameters) (*((disp)->TexCoord1fv)) parameters +#define GET_TexCoord1fv(disp) ((disp)->TexCoord1fv) +#define SET_TexCoord1fv(disp, fn) ((disp)->TexCoord1fv = fn) +#define CALL_TexCoord1i(disp, parameters) (*((disp)->TexCoord1i)) parameters +#define GET_TexCoord1i(disp) ((disp)->TexCoord1i) +#define SET_TexCoord1i(disp, fn) ((disp)->TexCoord1i = fn) +#define CALL_TexCoord1iv(disp, parameters) (*((disp)->TexCoord1iv)) parameters +#define GET_TexCoord1iv(disp) ((disp)->TexCoord1iv) +#define SET_TexCoord1iv(disp, fn) ((disp)->TexCoord1iv = fn) +#define CALL_TexCoord1s(disp, parameters) (*((disp)->TexCoord1s)) parameters +#define GET_TexCoord1s(disp) ((disp)->TexCoord1s) +#define SET_TexCoord1s(disp, fn) ((disp)->TexCoord1s = fn) +#define CALL_TexCoord1sv(disp, parameters) (*((disp)->TexCoord1sv)) parameters +#define GET_TexCoord1sv(disp) ((disp)->TexCoord1sv) +#define SET_TexCoord1sv(disp, fn) ((disp)->TexCoord1sv = fn) +#define CALL_TexCoord2d(disp, parameters) (*((disp)->TexCoord2d)) parameters +#define GET_TexCoord2d(disp) ((disp)->TexCoord2d) +#define SET_TexCoord2d(disp, fn) ((disp)->TexCoord2d = fn) +#define CALL_TexCoord2dv(disp, parameters) (*((disp)->TexCoord2dv)) parameters +#define GET_TexCoord2dv(disp) ((disp)->TexCoord2dv) +#define SET_TexCoord2dv(disp, fn) ((disp)->TexCoord2dv = fn) +#define CALL_TexCoord2f(disp, parameters) (*((disp)->TexCoord2f)) parameters +#define GET_TexCoord2f(disp) ((disp)->TexCoord2f) +#define SET_TexCoord2f(disp, fn) ((disp)->TexCoord2f = fn) +#define CALL_TexCoord2fv(disp, parameters) (*((disp)->TexCoord2fv)) parameters +#define GET_TexCoord2fv(disp) ((disp)->TexCoord2fv) +#define SET_TexCoord2fv(disp, fn) ((disp)->TexCoord2fv = fn) +#define CALL_TexCoord2i(disp, parameters) (*((disp)->TexCoord2i)) parameters +#define GET_TexCoord2i(disp) ((disp)->TexCoord2i) +#define SET_TexCoord2i(disp, fn) ((disp)->TexCoord2i = fn) +#define CALL_TexCoord2iv(disp, parameters) (*((disp)->TexCoord2iv)) parameters +#define GET_TexCoord2iv(disp) ((disp)->TexCoord2iv) +#define SET_TexCoord2iv(disp, fn) ((disp)->TexCoord2iv = fn) +#define CALL_TexCoord2s(disp, parameters) (*((disp)->TexCoord2s)) parameters +#define GET_TexCoord2s(disp) ((disp)->TexCoord2s) +#define SET_TexCoord2s(disp, fn) ((disp)->TexCoord2s = fn) +#define CALL_TexCoord2sv(disp, parameters) (*((disp)->TexCoord2sv)) parameters +#define GET_TexCoord2sv(disp) ((disp)->TexCoord2sv) +#define SET_TexCoord2sv(disp, fn) ((disp)->TexCoord2sv = fn) +#define CALL_TexCoord3d(disp, parameters) (*((disp)->TexCoord3d)) parameters +#define GET_TexCoord3d(disp) ((disp)->TexCoord3d) +#define SET_TexCoord3d(disp, fn) ((disp)->TexCoord3d = fn) +#define CALL_TexCoord3dv(disp, parameters) (*((disp)->TexCoord3dv)) parameters +#define GET_TexCoord3dv(disp) ((disp)->TexCoord3dv) +#define SET_TexCoord3dv(disp, fn) ((disp)->TexCoord3dv = fn) +#define CALL_TexCoord3f(disp, parameters) (*((disp)->TexCoord3f)) parameters +#define GET_TexCoord3f(disp) ((disp)->TexCoord3f) +#define SET_TexCoord3f(disp, fn) ((disp)->TexCoord3f = fn) +#define CALL_TexCoord3fv(disp, parameters) (*((disp)->TexCoord3fv)) parameters +#define GET_TexCoord3fv(disp) ((disp)->TexCoord3fv) +#define SET_TexCoord3fv(disp, fn) ((disp)->TexCoord3fv = fn) +#define CALL_TexCoord3i(disp, parameters) (*((disp)->TexCoord3i)) parameters +#define GET_TexCoord3i(disp) ((disp)->TexCoord3i) +#define SET_TexCoord3i(disp, fn) ((disp)->TexCoord3i = fn) +#define CALL_TexCoord3iv(disp, parameters) (*((disp)->TexCoord3iv)) parameters +#define GET_TexCoord3iv(disp) ((disp)->TexCoord3iv) +#define SET_TexCoord3iv(disp, fn) ((disp)->TexCoord3iv = fn) +#define CALL_TexCoord3s(disp, parameters) (*((disp)->TexCoord3s)) parameters +#define GET_TexCoord3s(disp) ((disp)->TexCoord3s) +#define SET_TexCoord3s(disp, fn) ((disp)->TexCoord3s = fn) +#define CALL_TexCoord3sv(disp, parameters) (*((disp)->TexCoord3sv)) parameters +#define GET_TexCoord3sv(disp) ((disp)->TexCoord3sv) +#define SET_TexCoord3sv(disp, fn) ((disp)->TexCoord3sv = fn) +#define CALL_TexCoord4d(disp, parameters) (*((disp)->TexCoord4d)) parameters +#define GET_TexCoord4d(disp) ((disp)->TexCoord4d) +#define SET_TexCoord4d(disp, fn) ((disp)->TexCoord4d = fn) +#define CALL_TexCoord4dv(disp, parameters) (*((disp)->TexCoord4dv)) parameters +#define GET_TexCoord4dv(disp) ((disp)->TexCoord4dv) +#define SET_TexCoord4dv(disp, fn) ((disp)->TexCoord4dv = fn) +#define CALL_TexCoord4f(disp, parameters) (*((disp)->TexCoord4f)) parameters +#define GET_TexCoord4f(disp) ((disp)->TexCoord4f) +#define SET_TexCoord4f(disp, fn) ((disp)->TexCoord4f = fn) +#define CALL_TexCoord4fv(disp, parameters) (*((disp)->TexCoord4fv)) parameters +#define GET_TexCoord4fv(disp) ((disp)->TexCoord4fv) +#define SET_TexCoord4fv(disp, fn) ((disp)->TexCoord4fv = fn) +#define CALL_TexCoord4i(disp, parameters) (*((disp)->TexCoord4i)) parameters +#define GET_TexCoord4i(disp) ((disp)->TexCoord4i) +#define SET_TexCoord4i(disp, fn) ((disp)->TexCoord4i = fn) +#define CALL_TexCoord4iv(disp, parameters) (*((disp)->TexCoord4iv)) parameters +#define GET_TexCoord4iv(disp) ((disp)->TexCoord4iv) +#define SET_TexCoord4iv(disp, fn) ((disp)->TexCoord4iv = fn) +#define CALL_TexCoord4s(disp, parameters) (*((disp)->TexCoord4s)) parameters +#define GET_TexCoord4s(disp) ((disp)->TexCoord4s) +#define SET_TexCoord4s(disp, fn) ((disp)->TexCoord4s = fn) +#define CALL_TexCoord4sv(disp, parameters) (*((disp)->TexCoord4sv)) parameters +#define GET_TexCoord4sv(disp) ((disp)->TexCoord4sv) +#define SET_TexCoord4sv(disp, fn) ((disp)->TexCoord4sv = fn) +#define CALL_Vertex2d(disp, parameters) (*((disp)->Vertex2d)) parameters +#define GET_Vertex2d(disp) ((disp)->Vertex2d) +#define SET_Vertex2d(disp, fn) ((disp)->Vertex2d = fn) +#define CALL_Vertex2dv(disp, parameters) (*((disp)->Vertex2dv)) parameters +#define GET_Vertex2dv(disp) ((disp)->Vertex2dv) +#define SET_Vertex2dv(disp, fn) ((disp)->Vertex2dv = fn) +#define CALL_Vertex2f(disp, parameters) (*((disp)->Vertex2f)) parameters +#define GET_Vertex2f(disp) ((disp)->Vertex2f) +#define SET_Vertex2f(disp, fn) ((disp)->Vertex2f = fn) +#define CALL_Vertex2fv(disp, parameters) (*((disp)->Vertex2fv)) parameters +#define GET_Vertex2fv(disp) ((disp)->Vertex2fv) +#define SET_Vertex2fv(disp, fn) ((disp)->Vertex2fv = fn) +#define CALL_Vertex2i(disp, parameters) (*((disp)->Vertex2i)) parameters +#define GET_Vertex2i(disp) ((disp)->Vertex2i) +#define SET_Vertex2i(disp, fn) ((disp)->Vertex2i = fn) +#define CALL_Vertex2iv(disp, parameters) (*((disp)->Vertex2iv)) parameters +#define GET_Vertex2iv(disp) ((disp)->Vertex2iv) +#define SET_Vertex2iv(disp, fn) ((disp)->Vertex2iv = fn) +#define CALL_Vertex2s(disp, parameters) (*((disp)->Vertex2s)) parameters +#define GET_Vertex2s(disp) ((disp)->Vertex2s) +#define SET_Vertex2s(disp, fn) ((disp)->Vertex2s = fn) +#define CALL_Vertex2sv(disp, parameters) (*((disp)->Vertex2sv)) parameters +#define GET_Vertex2sv(disp) ((disp)->Vertex2sv) +#define SET_Vertex2sv(disp, fn) ((disp)->Vertex2sv = fn) +#define CALL_Vertex3d(disp, parameters) (*((disp)->Vertex3d)) parameters +#define GET_Vertex3d(disp) ((disp)->Vertex3d) +#define SET_Vertex3d(disp, fn) ((disp)->Vertex3d = fn) +#define CALL_Vertex3dv(disp, parameters) (*((disp)->Vertex3dv)) parameters +#define GET_Vertex3dv(disp) ((disp)->Vertex3dv) +#define SET_Vertex3dv(disp, fn) ((disp)->Vertex3dv = fn) +#define CALL_Vertex3f(disp, parameters) (*((disp)->Vertex3f)) parameters +#define GET_Vertex3f(disp) ((disp)->Vertex3f) +#define SET_Vertex3f(disp, fn) ((disp)->Vertex3f = fn) +#define CALL_Vertex3fv(disp, parameters) (*((disp)->Vertex3fv)) parameters +#define GET_Vertex3fv(disp) ((disp)->Vertex3fv) +#define SET_Vertex3fv(disp, fn) ((disp)->Vertex3fv = fn) +#define CALL_Vertex3i(disp, parameters) (*((disp)->Vertex3i)) parameters +#define GET_Vertex3i(disp) ((disp)->Vertex3i) +#define SET_Vertex3i(disp, fn) ((disp)->Vertex3i = fn) +#define CALL_Vertex3iv(disp, parameters) (*((disp)->Vertex3iv)) parameters +#define GET_Vertex3iv(disp) ((disp)->Vertex3iv) +#define SET_Vertex3iv(disp, fn) ((disp)->Vertex3iv = fn) +#define CALL_Vertex3s(disp, parameters) (*((disp)->Vertex3s)) parameters +#define GET_Vertex3s(disp) ((disp)->Vertex3s) +#define SET_Vertex3s(disp, fn) ((disp)->Vertex3s = fn) +#define CALL_Vertex3sv(disp, parameters) (*((disp)->Vertex3sv)) parameters +#define GET_Vertex3sv(disp) ((disp)->Vertex3sv) +#define SET_Vertex3sv(disp, fn) ((disp)->Vertex3sv = fn) +#define CALL_Vertex4d(disp, parameters) (*((disp)->Vertex4d)) parameters +#define GET_Vertex4d(disp) ((disp)->Vertex4d) +#define SET_Vertex4d(disp, fn) ((disp)->Vertex4d = fn) +#define CALL_Vertex4dv(disp, parameters) (*((disp)->Vertex4dv)) parameters +#define GET_Vertex4dv(disp) ((disp)->Vertex4dv) +#define SET_Vertex4dv(disp, fn) ((disp)->Vertex4dv = fn) +#define CALL_Vertex4f(disp, parameters) (*((disp)->Vertex4f)) parameters +#define GET_Vertex4f(disp) ((disp)->Vertex4f) +#define SET_Vertex4f(disp, fn) ((disp)->Vertex4f = fn) +#define CALL_Vertex4fv(disp, parameters) (*((disp)->Vertex4fv)) parameters +#define GET_Vertex4fv(disp) ((disp)->Vertex4fv) +#define SET_Vertex4fv(disp, fn) ((disp)->Vertex4fv = fn) +#define CALL_Vertex4i(disp, parameters) (*((disp)->Vertex4i)) parameters +#define GET_Vertex4i(disp) ((disp)->Vertex4i) +#define SET_Vertex4i(disp, fn) ((disp)->Vertex4i = fn) +#define CALL_Vertex4iv(disp, parameters) (*((disp)->Vertex4iv)) parameters +#define GET_Vertex4iv(disp) ((disp)->Vertex4iv) +#define SET_Vertex4iv(disp, fn) ((disp)->Vertex4iv = fn) +#define CALL_Vertex4s(disp, parameters) (*((disp)->Vertex4s)) parameters +#define GET_Vertex4s(disp) ((disp)->Vertex4s) +#define SET_Vertex4s(disp, fn) ((disp)->Vertex4s = fn) +#define CALL_Vertex4sv(disp, parameters) (*((disp)->Vertex4sv)) parameters +#define GET_Vertex4sv(disp) ((disp)->Vertex4sv) +#define SET_Vertex4sv(disp, fn) ((disp)->Vertex4sv = fn) +#define CALL_ClipPlane(disp, parameters) (*((disp)->ClipPlane)) parameters +#define GET_ClipPlane(disp) ((disp)->ClipPlane) +#define SET_ClipPlane(disp, fn) ((disp)->ClipPlane = fn) +#define CALL_ColorMaterial(disp, parameters) (*((disp)->ColorMaterial)) parameters +#define GET_ColorMaterial(disp) ((disp)->ColorMaterial) +#define SET_ColorMaterial(disp, fn) ((disp)->ColorMaterial = fn) +#define CALL_CullFace(disp, parameters) (*((disp)->CullFace)) parameters +#define GET_CullFace(disp) ((disp)->CullFace) +#define SET_CullFace(disp, fn) ((disp)->CullFace = fn) +#define CALL_Fogf(disp, parameters) (*((disp)->Fogf)) parameters +#define GET_Fogf(disp) ((disp)->Fogf) +#define SET_Fogf(disp, fn) ((disp)->Fogf = fn) +#define CALL_Fogfv(disp, parameters) (*((disp)->Fogfv)) parameters +#define GET_Fogfv(disp) ((disp)->Fogfv) +#define SET_Fogfv(disp, fn) ((disp)->Fogfv = fn) +#define CALL_Fogi(disp, parameters) (*((disp)->Fogi)) parameters +#define GET_Fogi(disp) ((disp)->Fogi) +#define SET_Fogi(disp, fn) ((disp)->Fogi = fn) +#define CALL_Fogiv(disp, parameters) (*((disp)->Fogiv)) parameters +#define GET_Fogiv(disp) ((disp)->Fogiv) +#define SET_Fogiv(disp, fn) ((disp)->Fogiv = fn) +#define CALL_FrontFace(disp, parameters) (*((disp)->FrontFace)) parameters +#define GET_FrontFace(disp) ((disp)->FrontFace) +#define SET_FrontFace(disp, fn) ((disp)->FrontFace = fn) +#define CALL_Hint(disp, parameters) (*((disp)->Hint)) parameters +#define GET_Hint(disp) ((disp)->Hint) +#define SET_Hint(disp, fn) ((disp)->Hint = fn) +#define CALL_Lightf(disp, parameters) (*((disp)->Lightf)) parameters +#define GET_Lightf(disp) ((disp)->Lightf) +#define SET_Lightf(disp, fn) ((disp)->Lightf = fn) +#define CALL_Lightfv(disp, parameters) (*((disp)->Lightfv)) parameters +#define GET_Lightfv(disp) ((disp)->Lightfv) +#define SET_Lightfv(disp, fn) ((disp)->Lightfv = fn) +#define CALL_Lighti(disp, parameters) (*((disp)->Lighti)) parameters +#define GET_Lighti(disp) ((disp)->Lighti) +#define SET_Lighti(disp, fn) ((disp)->Lighti = fn) +#define CALL_Lightiv(disp, parameters) (*((disp)->Lightiv)) parameters +#define GET_Lightiv(disp) ((disp)->Lightiv) +#define SET_Lightiv(disp, fn) ((disp)->Lightiv = fn) +#define CALL_LightModelf(disp, parameters) (*((disp)->LightModelf)) parameters +#define GET_LightModelf(disp) ((disp)->LightModelf) +#define SET_LightModelf(disp, fn) ((disp)->LightModelf = fn) +#define CALL_LightModelfv(disp, parameters) (*((disp)->LightModelfv)) parameters +#define GET_LightModelfv(disp) ((disp)->LightModelfv) +#define SET_LightModelfv(disp, fn) ((disp)->LightModelfv = fn) +#define CALL_LightModeli(disp, parameters) (*((disp)->LightModeli)) parameters +#define GET_LightModeli(disp) ((disp)->LightModeli) +#define SET_LightModeli(disp, fn) ((disp)->LightModeli = fn) +#define CALL_LightModeliv(disp, parameters) (*((disp)->LightModeliv)) parameters +#define GET_LightModeliv(disp) ((disp)->LightModeliv) +#define SET_LightModeliv(disp, fn) ((disp)->LightModeliv = fn) +#define CALL_LineStipple(disp, parameters) (*((disp)->LineStipple)) parameters +#define GET_LineStipple(disp) ((disp)->LineStipple) +#define SET_LineStipple(disp, fn) ((disp)->LineStipple = fn) +#define CALL_LineWidth(disp, parameters) (*((disp)->LineWidth)) parameters +#define GET_LineWidth(disp) ((disp)->LineWidth) +#define SET_LineWidth(disp, fn) ((disp)->LineWidth = fn) +#define CALL_Materialf(disp, parameters) (*((disp)->Materialf)) parameters +#define GET_Materialf(disp) ((disp)->Materialf) +#define SET_Materialf(disp, fn) ((disp)->Materialf = fn) +#define CALL_Materialfv(disp, parameters) (*((disp)->Materialfv)) parameters +#define GET_Materialfv(disp) ((disp)->Materialfv) +#define SET_Materialfv(disp, fn) ((disp)->Materialfv = fn) +#define CALL_Materiali(disp, parameters) (*((disp)->Materiali)) parameters +#define GET_Materiali(disp) ((disp)->Materiali) +#define SET_Materiali(disp, fn) ((disp)->Materiali = fn) +#define CALL_Materialiv(disp, parameters) (*((disp)->Materialiv)) parameters +#define GET_Materialiv(disp) ((disp)->Materialiv) +#define SET_Materialiv(disp, fn) ((disp)->Materialiv = fn) +#define CALL_PointSize(disp, parameters) (*((disp)->PointSize)) parameters +#define GET_PointSize(disp) ((disp)->PointSize) +#define SET_PointSize(disp, fn) ((disp)->PointSize = fn) +#define CALL_PolygonMode(disp, parameters) (*((disp)->PolygonMode)) parameters +#define GET_PolygonMode(disp) ((disp)->PolygonMode) +#define SET_PolygonMode(disp, fn) ((disp)->PolygonMode = fn) +#define CALL_PolygonStipple(disp, parameters) (*((disp)->PolygonStipple)) parameters +#define GET_PolygonStipple(disp) ((disp)->PolygonStipple) +#define SET_PolygonStipple(disp, fn) ((disp)->PolygonStipple = fn) +#define CALL_Scissor(disp, parameters) (*((disp)->Scissor)) parameters +#define GET_Scissor(disp) ((disp)->Scissor) +#define SET_Scissor(disp, fn) ((disp)->Scissor = fn) +#define CALL_ShadeModel(disp, parameters) (*((disp)->ShadeModel)) parameters +#define GET_ShadeModel(disp) ((disp)->ShadeModel) +#define SET_ShadeModel(disp, fn) ((disp)->ShadeModel = fn) +#define CALL_TexParameterf(disp, parameters) (*((disp)->TexParameterf)) parameters +#define GET_TexParameterf(disp) ((disp)->TexParameterf) +#define SET_TexParameterf(disp, fn) ((disp)->TexParameterf = fn) +#define CALL_TexParameterfv(disp, parameters) (*((disp)->TexParameterfv)) parameters +#define GET_TexParameterfv(disp) ((disp)->TexParameterfv) +#define SET_TexParameterfv(disp, fn) ((disp)->TexParameterfv = fn) +#define CALL_TexParameteri(disp, parameters) (*((disp)->TexParameteri)) parameters +#define GET_TexParameteri(disp) ((disp)->TexParameteri) +#define SET_TexParameteri(disp, fn) ((disp)->TexParameteri = fn) +#define CALL_TexParameteriv(disp, parameters) (*((disp)->TexParameteriv)) parameters +#define GET_TexParameteriv(disp) ((disp)->TexParameteriv) +#define SET_TexParameteriv(disp, fn) ((disp)->TexParameteriv = fn) +#define CALL_TexImage1D(disp, parameters) (*((disp)->TexImage1D)) parameters +#define GET_TexImage1D(disp) ((disp)->TexImage1D) +#define SET_TexImage1D(disp, fn) ((disp)->TexImage1D = fn) +#define CALL_TexImage2D(disp, parameters) (*((disp)->TexImage2D)) parameters +#define GET_TexImage2D(disp) ((disp)->TexImage2D) +#define SET_TexImage2D(disp, fn) ((disp)->TexImage2D = fn) +#define CALL_TexEnvf(disp, parameters) (*((disp)->TexEnvf)) parameters +#define GET_TexEnvf(disp) ((disp)->TexEnvf) +#define SET_TexEnvf(disp, fn) ((disp)->TexEnvf = fn) +#define CALL_TexEnvfv(disp, parameters) (*((disp)->TexEnvfv)) parameters +#define GET_TexEnvfv(disp) ((disp)->TexEnvfv) +#define SET_TexEnvfv(disp, fn) ((disp)->TexEnvfv = fn) +#define CALL_TexEnvi(disp, parameters) (*((disp)->TexEnvi)) parameters +#define GET_TexEnvi(disp) ((disp)->TexEnvi) +#define SET_TexEnvi(disp, fn) ((disp)->TexEnvi = fn) +#define CALL_TexEnviv(disp, parameters) (*((disp)->TexEnviv)) parameters +#define GET_TexEnviv(disp) ((disp)->TexEnviv) +#define SET_TexEnviv(disp, fn) ((disp)->TexEnviv = fn) +#define CALL_TexGend(disp, parameters) (*((disp)->TexGend)) parameters +#define GET_TexGend(disp) ((disp)->TexGend) +#define SET_TexGend(disp, fn) ((disp)->TexGend = fn) +#define CALL_TexGendv(disp, parameters) (*((disp)->TexGendv)) parameters +#define GET_TexGendv(disp) ((disp)->TexGendv) +#define SET_TexGendv(disp, fn) ((disp)->TexGendv = fn) +#define CALL_TexGenf(disp, parameters) (*((disp)->TexGenf)) parameters +#define GET_TexGenf(disp) ((disp)->TexGenf) +#define SET_TexGenf(disp, fn) ((disp)->TexGenf = fn) +#define CALL_TexGenfv(disp, parameters) (*((disp)->TexGenfv)) parameters +#define GET_TexGenfv(disp) ((disp)->TexGenfv) +#define SET_TexGenfv(disp, fn) ((disp)->TexGenfv = fn) +#define CALL_TexGeni(disp, parameters) (*((disp)->TexGeni)) parameters +#define GET_TexGeni(disp) ((disp)->TexGeni) +#define SET_TexGeni(disp, fn) ((disp)->TexGeni = fn) +#define CALL_TexGeniv(disp, parameters) (*((disp)->TexGeniv)) parameters +#define GET_TexGeniv(disp) ((disp)->TexGeniv) +#define SET_TexGeniv(disp, fn) ((disp)->TexGeniv = fn) +#define CALL_FeedbackBuffer(disp, parameters) (*((disp)->FeedbackBuffer)) parameters +#define GET_FeedbackBuffer(disp) ((disp)->FeedbackBuffer) +#define SET_FeedbackBuffer(disp, fn) ((disp)->FeedbackBuffer = fn) +#define CALL_SelectBuffer(disp, parameters) (*((disp)->SelectBuffer)) parameters +#define GET_SelectBuffer(disp) ((disp)->SelectBuffer) +#define SET_SelectBuffer(disp, fn) ((disp)->SelectBuffer = fn) +#define CALL_RenderMode(disp, parameters) (*((disp)->RenderMode)) parameters +#define GET_RenderMode(disp) ((disp)->RenderMode) +#define SET_RenderMode(disp, fn) ((disp)->RenderMode = fn) +#define CALL_InitNames(disp, parameters) (*((disp)->InitNames)) parameters +#define GET_InitNames(disp) ((disp)->InitNames) +#define SET_InitNames(disp, fn) ((disp)->InitNames = fn) +#define CALL_LoadName(disp, parameters) (*((disp)->LoadName)) parameters +#define GET_LoadName(disp) ((disp)->LoadName) +#define SET_LoadName(disp, fn) ((disp)->LoadName = fn) +#define CALL_PassThrough(disp, parameters) (*((disp)->PassThrough)) parameters +#define GET_PassThrough(disp) ((disp)->PassThrough) +#define SET_PassThrough(disp, fn) ((disp)->PassThrough = fn) +#define CALL_PopName(disp, parameters) (*((disp)->PopName)) parameters +#define GET_PopName(disp) ((disp)->PopName) +#define SET_PopName(disp, fn) ((disp)->PopName = fn) +#define CALL_PushName(disp, parameters) (*((disp)->PushName)) parameters +#define GET_PushName(disp) ((disp)->PushName) +#define SET_PushName(disp, fn) ((disp)->PushName = fn) +#define CALL_DrawBuffer(disp, parameters) (*((disp)->DrawBuffer)) parameters +#define GET_DrawBuffer(disp) ((disp)->DrawBuffer) +#define SET_DrawBuffer(disp, fn) ((disp)->DrawBuffer = fn) +#define CALL_Clear(disp, parameters) (*((disp)->Clear)) parameters +#define GET_Clear(disp) ((disp)->Clear) +#define SET_Clear(disp, fn) ((disp)->Clear = fn) +#define CALL_ClearAccum(disp, parameters) (*((disp)->ClearAccum)) parameters +#define GET_ClearAccum(disp) ((disp)->ClearAccum) +#define SET_ClearAccum(disp, fn) ((disp)->ClearAccum = fn) +#define CALL_ClearIndex(disp, parameters) (*((disp)->ClearIndex)) parameters +#define GET_ClearIndex(disp) ((disp)->ClearIndex) +#define SET_ClearIndex(disp, fn) ((disp)->ClearIndex = fn) +#define CALL_ClearColor(disp, parameters) (*((disp)->ClearColor)) parameters +#define GET_ClearColor(disp) ((disp)->ClearColor) +#define SET_ClearColor(disp, fn) ((disp)->ClearColor = fn) +#define CALL_ClearStencil(disp, parameters) (*((disp)->ClearStencil)) parameters +#define GET_ClearStencil(disp) ((disp)->ClearStencil) +#define SET_ClearStencil(disp, fn) ((disp)->ClearStencil = fn) +#define CALL_ClearDepth(disp, parameters) (*((disp)->ClearDepth)) parameters +#define GET_ClearDepth(disp) ((disp)->ClearDepth) +#define SET_ClearDepth(disp, fn) ((disp)->ClearDepth = fn) +#define CALL_StencilMask(disp, parameters) (*((disp)->StencilMask)) parameters +#define GET_StencilMask(disp) ((disp)->StencilMask) +#define SET_StencilMask(disp, fn) ((disp)->StencilMask = fn) +#define CALL_ColorMask(disp, parameters) (*((disp)->ColorMask)) parameters +#define GET_ColorMask(disp) ((disp)->ColorMask) +#define SET_ColorMask(disp, fn) ((disp)->ColorMask = fn) +#define CALL_DepthMask(disp, parameters) (*((disp)->DepthMask)) parameters +#define GET_DepthMask(disp) ((disp)->DepthMask) +#define SET_DepthMask(disp, fn) ((disp)->DepthMask = fn) +#define CALL_IndexMask(disp, parameters) (*((disp)->IndexMask)) parameters +#define GET_IndexMask(disp) ((disp)->IndexMask) +#define SET_IndexMask(disp, fn) ((disp)->IndexMask = fn) +#define CALL_Accum(disp, parameters) (*((disp)->Accum)) parameters +#define GET_Accum(disp) ((disp)->Accum) +#define SET_Accum(disp, fn) ((disp)->Accum = fn) +#define CALL_Disable(disp, parameters) (*((disp)->Disable)) parameters +#define GET_Disable(disp) ((disp)->Disable) +#define SET_Disable(disp, fn) ((disp)->Disable = fn) +#define CALL_Enable(disp, parameters) (*((disp)->Enable)) parameters +#define GET_Enable(disp) ((disp)->Enable) +#define SET_Enable(disp, fn) ((disp)->Enable = fn) +#define CALL_Finish(disp, parameters) (*((disp)->Finish)) parameters +#define GET_Finish(disp) ((disp)->Finish) +#define SET_Finish(disp, fn) ((disp)->Finish = fn) +#define CALL_Flush(disp, parameters) (*((disp)->Flush)) parameters +#define GET_Flush(disp) ((disp)->Flush) +#define SET_Flush(disp, fn) ((disp)->Flush = fn) +#define CALL_PopAttrib(disp, parameters) (*((disp)->PopAttrib)) parameters +#define GET_PopAttrib(disp) ((disp)->PopAttrib) +#define SET_PopAttrib(disp, fn) ((disp)->PopAttrib = fn) +#define CALL_PushAttrib(disp, parameters) (*((disp)->PushAttrib)) parameters +#define GET_PushAttrib(disp) ((disp)->PushAttrib) +#define SET_PushAttrib(disp, fn) ((disp)->PushAttrib = fn) +#define CALL_Map1d(disp, parameters) (*((disp)->Map1d)) parameters +#define GET_Map1d(disp) ((disp)->Map1d) +#define SET_Map1d(disp, fn) ((disp)->Map1d = fn) +#define CALL_Map1f(disp, parameters) (*((disp)->Map1f)) parameters +#define GET_Map1f(disp) ((disp)->Map1f) +#define SET_Map1f(disp, fn) ((disp)->Map1f = fn) +#define CALL_Map2d(disp, parameters) (*((disp)->Map2d)) parameters +#define GET_Map2d(disp) ((disp)->Map2d) +#define SET_Map2d(disp, fn) ((disp)->Map2d = fn) +#define CALL_Map2f(disp, parameters) (*((disp)->Map2f)) parameters +#define GET_Map2f(disp) ((disp)->Map2f) +#define SET_Map2f(disp, fn) ((disp)->Map2f = fn) +#define CALL_MapGrid1d(disp, parameters) (*((disp)->MapGrid1d)) parameters +#define GET_MapGrid1d(disp) ((disp)->MapGrid1d) +#define SET_MapGrid1d(disp, fn) ((disp)->MapGrid1d = fn) +#define CALL_MapGrid1f(disp, parameters) (*((disp)->MapGrid1f)) parameters +#define GET_MapGrid1f(disp) ((disp)->MapGrid1f) +#define SET_MapGrid1f(disp, fn) ((disp)->MapGrid1f = fn) +#define CALL_MapGrid2d(disp, parameters) (*((disp)->MapGrid2d)) parameters +#define GET_MapGrid2d(disp) ((disp)->MapGrid2d) +#define SET_MapGrid2d(disp, fn) ((disp)->MapGrid2d = fn) +#define CALL_MapGrid2f(disp, parameters) (*((disp)->MapGrid2f)) parameters +#define GET_MapGrid2f(disp) ((disp)->MapGrid2f) +#define SET_MapGrid2f(disp, fn) ((disp)->MapGrid2f = fn) +#define CALL_EvalCoord1d(disp, parameters) (*((disp)->EvalCoord1d)) parameters +#define GET_EvalCoord1d(disp) ((disp)->EvalCoord1d) +#define SET_EvalCoord1d(disp, fn) ((disp)->EvalCoord1d = fn) +#define CALL_EvalCoord1dv(disp, parameters) (*((disp)->EvalCoord1dv)) parameters +#define GET_EvalCoord1dv(disp) ((disp)->EvalCoord1dv) +#define SET_EvalCoord1dv(disp, fn) ((disp)->EvalCoord1dv = fn) +#define CALL_EvalCoord1f(disp, parameters) (*((disp)->EvalCoord1f)) parameters +#define GET_EvalCoord1f(disp) ((disp)->EvalCoord1f) +#define SET_EvalCoord1f(disp, fn) ((disp)->EvalCoord1f = fn) +#define CALL_EvalCoord1fv(disp, parameters) (*((disp)->EvalCoord1fv)) parameters +#define GET_EvalCoord1fv(disp) ((disp)->EvalCoord1fv) +#define SET_EvalCoord1fv(disp, fn) ((disp)->EvalCoord1fv = fn) +#define CALL_EvalCoord2d(disp, parameters) (*((disp)->EvalCoord2d)) parameters +#define GET_EvalCoord2d(disp) ((disp)->EvalCoord2d) +#define SET_EvalCoord2d(disp, fn) ((disp)->EvalCoord2d = fn) +#define CALL_EvalCoord2dv(disp, parameters) (*((disp)->EvalCoord2dv)) parameters +#define GET_EvalCoord2dv(disp) ((disp)->EvalCoord2dv) +#define SET_EvalCoord2dv(disp, fn) ((disp)->EvalCoord2dv = fn) +#define CALL_EvalCoord2f(disp, parameters) (*((disp)->EvalCoord2f)) parameters +#define GET_EvalCoord2f(disp) ((disp)->EvalCoord2f) +#define SET_EvalCoord2f(disp, fn) ((disp)->EvalCoord2f = fn) +#define CALL_EvalCoord2fv(disp, parameters) (*((disp)->EvalCoord2fv)) parameters +#define GET_EvalCoord2fv(disp) ((disp)->EvalCoord2fv) +#define SET_EvalCoord2fv(disp, fn) ((disp)->EvalCoord2fv = fn) +#define CALL_EvalMesh1(disp, parameters) (*((disp)->EvalMesh1)) parameters +#define GET_EvalMesh1(disp) ((disp)->EvalMesh1) +#define SET_EvalMesh1(disp, fn) ((disp)->EvalMesh1 = fn) +#define CALL_EvalPoint1(disp, parameters) (*((disp)->EvalPoint1)) parameters +#define GET_EvalPoint1(disp) ((disp)->EvalPoint1) +#define SET_EvalPoint1(disp, fn) ((disp)->EvalPoint1 = fn) +#define CALL_EvalMesh2(disp, parameters) (*((disp)->EvalMesh2)) parameters +#define GET_EvalMesh2(disp) ((disp)->EvalMesh2) +#define SET_EvalMesh2(disp, fn) ((disp)->EvalMesh2 = fn) +#define CALL_EvalPoint2(disp, parameters) (*((disp)->EvalPoint2)) parameters +#define GET_EvalPoint2(disp) ((disp)->EvalPoint2) +#define SET_EvalPoint2(disp, fn) ((disp)->EvalPoint2 = fn) +#define CALL_AlphaFunc(disp, parameters) (*((disp)->AlphaFunc)) parameters +#define GET_AlphaFunc(disp) ((disp)->AlphaFunc) +#define SET_AlphaFunc(disp, fn) ((disp)->AlphaFunc = fn) +#define CALL_BlendFunc(disp, parameters) (*((disp)->BlendFunc)) parameters +#define GET_BlendFunc(disp) ((disp)->BlendFunc) +#define SET_BlendFunc(disp, fn) ((disp)->BlendFunc = fn) +#define CALL_LogicOp(disp, parameters) (*((disp)->LogicOp)) parameters +#define GET_LogicOp(disp) ((disp)->LogicOp) +#define SET_LogicOp(disp, fn) ((disp)->LogicOp = fn) +#define CALL_StencilFunc(disp, parameters) (*((disp)->StencilFunc)) parameters +#define GET_StencilFunc(disp) ((disp)->StencilFunc) +#define SET_StencilFunc(disp, fn) ((disp)->StencilFunc = fn) +#define CALL_StencilOp(disp, parameters) (*((disp)->StencilOp)) parameters +#define GET_StencilOp(disp) ((disp)->StencilOp) +#define SET_StencilOp(disp, fn) ((disp)->StencilOp = fn) +#define CALL_DepthFunc(disp, parameters) (*((disp)->DepthFunc)) parameters +#define GET_DepthFunc(disp) ((disp)->DepthFunc) +#define SET_DepthFunc(disp, fn) ((disp)->DepthFunc = fn) +#define CALL_PixelZoom(disp, parameters) (*((disp)->PixelZoom)) parameters +#define GET_PixelZoom(disp) ((disp)->PixelZoom) +#define SET_PixelZoom(disp, fn) ((disp)->PixelZoom = fn) +#define CALL_PixelTransferf(disp, parameters) (*((disp)->PixelTransferf)) parameters +#define GET_PixelTransferf(disp) ((disp)->PixelTransferf) +#define SET_PixelTransferf(disp, fn) ((disp)->PixelTransferf = fn) +#define CALL_PixelTransferi(disp, parameters) (*((disp)->PixelTransferi)) parameters +#define GET_PixelTransferi(disp) ((disp)->PixelTransferi) +#define SET_PixelTransferi(disp, fn) ((disp)->PixelTransferi = fn) +#define CALL_PixelStoref(disp, parameters) (*((disp)->PixelStoref)) parameters +#define GET_PixelStoref(disp) ((disp)->PixelStoref) +#define SET_PixelStoref(disp, fn) ((disp)->PixelStoref = fn) +#define CALL_PixelStorei(disp, parameters) (*((disp)->PixelStorei)) parameters +#define GET_PixelStorei(disp) ((disp)->PixelStorei) +#define SET_PixelStorei(disp, fn) ((disp)->PixelStorei = fn) +#define CALL_PixelMapfv(disp, parameters) (*((disp)->PixelMapfv)) parameters +#define GET_PixelMapfv(disp) ((disp)->PixelMapfv) +#define SET_PixelMapfv(disp, fn) ((disp)->PixelMapfv = fn) +#define CALL_PixelMapuiv(disp, parameters) (*((disp)->PixelMapuiv)) parameters +#define GET_PixelMapuiv(disp) ((disp)->PixelMapuiv) +#define SET_PixelMapuiv(disp, fn) ((disp)->PixelMapuiv = fn) +#define CALL_PixelMapusv(disp, parameters) (*((disp)->PixelMapusv)) parameters +#define GET_PixelMapusv(disp) ((disp)->PixelMapusv) +#define SET_PixelMapusv(disp, fn) ((disp)->PixelMapusv = fn) +#define CALL_ReadBuffer(disp, parameters) (*((disp)->ReadBuffer)) parameters +#define GET_ReadBuffer(disp) ((disp)->ReadBuffer) +#define SET_ReadBuffer(disp, fn) ((disp)->ReadBuffer = fn) +#define CALL_CopyPixels(disp, parameters) (*((disp)->CopyPixels)) parameters +#define GET_CopyPixels(disp) ((disp)->CopyPixels) +#define SET_CopyPixels(disp, fn) ((disp)->CopyPixels = fn) +#define CALL_ReadPixels(disp, parameters) (*((disp)->ReadPixels)) parameters +#define GET_ReadPixels(disp) ((disp)->ReadPixels) +#define SET_ReadPixels(disp, fn) ((disp)->ReadPixels = fn) +#define CALL_DrawPixels(disp, parameters) (*((disp)->DrawPixels)) parameters +#define GET_DrawPixels(disp) ((disp)->DrawPixels) +#define SET_DrawPixels(disp, fn) ((disp)->DrawPixels = fn) +#define CALL_GetBooleanv(disp, parameters) (*((disp)->GetBooleanv)) parameters +#define GET_GetBooleanv(disp) ((disp)->GetBooleanv) +#define SET_GetBooleanv(disp, fn) ((disp)->GetBooleanv = fn) +#define CALL_GetClipPlane(disp, parameters) (*((disp)->GetClipPlane)) parameters +#define GET_GetClipPlane(disp) ((disp)->GetClipPlane) +#define SET_GetClipPlane(disp, fn) ((disp)->GetClipPlane = fn) +#define CALL_GetDoublev(disp, parameters) (*((disp)->GetDoublev)) parameters +#define GET_GetDoublev(disp) ((disp)->GetDoublev) +#define SET_GetDoublev(disp, fn) ((disp)->GetDoublev = fn) +#define CALL_GetError(disp, parameters) (*((disp)->GetError)) parameters +#define GET_GetError(disp) ((disp)->GetError) +#define SET_GetError(disp, fn) ((disp)->GetError = fn) +#define CALL_GetFloatv(disp, parameters) (*((disp)->GetFloatv)) parameters +#define GET_GetFloatv(disp) ((disp)->GetFloatv) +#define SET_GetFloatv(disp, fn) ((disp)->GetFloatv = fn) +#define CALL_GetIntegerv(disp, parameters) (*((disp)->GetIntegerv)) parameters +#define GET_GetIntegerv(disp) ((disp)->GetIntegerv) +#define SET_GetIntegerv(disp, fn) ((disp)->GetIntegerv = fn) +#define CALL_GetLightfv(disp, parameters) (*((disp)->GetLightfv)) parameters +#define GET_GetLightfv(disp) ((disp)->GetLightfv) +#define SET_GetLightfv(disp, fn) ((disp)->GetLightfv = fn) +#define CALL_GetLightiv(disp, parameters) (*((disp)->GetLightiv)) parameters +#define GET_GetLightiv(disp) ((disp)->GetLightiv) +#define SET_GetLightiv(disp, fn) ((disp)->GetLightiv = fn) +#define CALL_GetMapdv(disp, parameters) (*((disp)->GetMapdv)) parameters +#define GET_GetMapdv(disp) ((disp)->GetMapdv) +#define SET_GetMapdv(disp, fn) ((disp)->GetMapdv = fn) +#define CALL_GetMapfv(disp, parameters) (*((disp)->GetMapfv)) parameters +#define GET_GetMapfv(disp) ((disp)->GetMapfv) +#define SET_GetMapfv(disp, fn) ((disp)->GetMapfv = fn) +#define CALL_GetMapiv(disp, parameters) (*((disp)->GetMapiv)) parameters +#define GET_GetMapiv(disp) ((disp)->GetMapiv) +#define SET_GetMapiv(disp, fn) ((disp)->GetMapiv = fn) +#define CALL_GetMaterialfv(disp, parameters) (*((disp)->GetMaterialfv)) parameters +#define GET_GetMaterialfv(disp) ((disp)->GetMaterialfv) +#define SET_GetMaterialfv(disp, fn) ((disp)->GetMaterialfv = fn) +#define CALL_GetMaterialiv(disp, parameters) (*((disp)->GetMaterialiv)) parameters +#define GET_GetMaterialiv(disp) ((disp)->GetMaterialiv) +#define SET_GetMaterialiv(disp, fn) ((disp)->GetMaterialiv = fn) +#define CALL_GetPixelMapfv(disp, parameters) (*((disp)->GetPixelMapfv)) parameters +#define GET_GetPixelMapfv(disp) ((disp)->GetPixelMapfv) +#define SET_GetPixelMapfv(disp, fn) ((disp)->GetPixelMapfv = fn) +#define CALL_GetPixelMapuiv(disp, parameters) (*((disp)->GetPixelMapuiv)) parameters +#define GET_GetPixelMapuiv(disp) ((disp)->GetPixelMapuiv) +#define SET_GetPixelMapuiv(disp, fn) ((disp)->GetPixelMapuiv = fn) +#define CALL_GetPixelMapusv(disp, parameters) (*((disp)->GetPixelMapusv)) parameters +#define GET_GetPixelMapusv(disp) ((disp)->GetPixelMapusv) +#define SET_GetPixelMapusv(disp, fn) ((disp)->GetPixelMapusv = fn) +#define CALL_GetPolygonStipple(disp, parameters) (*((disp)->GetPolygonStipple)) parameters +#define GET_GetPolygonStipple(disp) ((disp)->GetPolygonStipple) +#define SET_GetPolygonStipple(disp, fn) ((disp)->GetPolygonStipple = fn) +#define CALL_GetString(disp, parameters) (*((disp)->GetString)) parameters +#define GET_GetString(disp) ((disp)->GetString) +#define SET_GetString(disp, fn) ((disp)->GetString = fn) +#define CALL_GetTexEnvfv(disp, parameters) (*((disp)->GetTexEnvfv)) parameters +#define GET_GetTexEnvfv(disp) ((disp)->GetTexEnvfv) +#define SET_GetTexEnvfv(disp, fn) ((disp)->GetTexEnvfv = fn) +#define CALL_GetTexEnviv(disp, parameters) (*((disp)->GetTexEnviv)) parameters +#define GET_GetTexEnviv(disp) ((disp)->GetTexEnviv) +#define SET_GetTexEnviv(disp, fn) ((disp)->GetTexEnviv = fn) +#define CALL_GetTexGendv(disp, parameters) (*((disp)->GetTexGendv)) parameters +#define GET_GetTexGendv(disp) ((disp)->GetTexGendv) +#define SET_GetTexGendv(disp, fn) ((disp)->GetTexGendv = fn) +#define CALL_GetTexGenfv(disp, parameters) (*((disp)->GetTexGenfv)) parameters +#define GET_GetTexGenfv(disp) ((disp)->GetTexGenfv) +#define SET_GetTexGenfv(disp, fn) ((disp)->GetTexGenfv = fn) +#define CALL_GetTexGeniv(disp, parameters) (*((disp)->GetTexGeniv)) parameters +#define GET_GetTexGeniv(disp) ((disp)->GetTexGeniv) +#define SET_GetTexGeniv(disp, fn) ((disp)->GetTexGeniv = fn) +#define CALL_GetTexImage(disp, parameters) (*((disp)->GetTexImage)) parameters +#define GET_GetTexImage(disp) ((disp)->GetTexImage) +#define SET_GetTexImage(disp, fn) ((disp)->GetTexImage = fn) +#define CALL_GetTexParameterfv(disp, parameters) (*((disp)->GetTexParameterfv)) parameters +#define GET_GetTexParameterfv(disp) ((disp)->GetTexParameterfv) +#define SET_GetTexParameterfv(disp, fn) ((disp)->GetTexParameterfv = fn) +#define CALL_GetTexParameteriv(disp, parameters) (*((disp)->GetTexParameteriv)) parameters +#define GET_GetTexParameteriv(disp) ((disp)->GetTexParameteriv) +#define SET_GetTexParameteriv(disp, fn) ((disp)->GetTexParameteriv = fn) +#define CALL_GetTexLevelParameterfv(disp, parameters) (*((disp)->GetTexLevelParameterfv)) parameters +#define GET_GetTexLevelParameterfv(disp) ((disp)->GetTexLevelParameterfv) +#define SET_GetTexLevelParameterfv(disp, fn) ((disp)->GetTexLevelParameterfv = fn) +#define CALL_GetTexLevelParameteriv(disp, parameters) (*((disp)->GetTexLevelParameteriv)) parameters +#define GET_GetTexLevelParameteriv(disp) ((disp)->GetTexLevelParameteriv) +#define SET_GetTexLevelParameteriv(disp, fn) ((disp)->GetTexLevelParameteriv = fn) +#define CALL_IsEnabled(disp, parameters) (*((disp)->IsEnabled)) parameters +#define GET_IsEnabled(disp) ((disp)->IsEnabled) +#define SET_IsEnabled(disp, fn) ((disp)->IsEnabled = fn) +#define CALL_IsList(disp, parameters) (*((disp)->IsList)) parameters +#define GET_IsList(disp) ((disp)->IsList) +#define SET_IsList(disp, fn) ((disp)->IsList = fn) +#define CALL_DepthRange(disp, parameters) (*((disp)->DepthRange)) parameters +#define GET_DepthRange(disp) ((disp)->DepthRange) +#define SET_DepthRange(disp, fn) ((disp)->DepthRange = fn) +#define CALL_Frustum(disp, parameters) (*((disp)->Frustum)) parameters +#define GET_Frustum(disp) ((disp)->Frustum) +#define SET_Frustum(disp, fn) ((disp)->Frustum = fn) +#define CALL_LoadIdentity(disp, parameters) (*((disp)->LoadIdentity)) parameters +#define GET_LoadIdentity(disp) ((disp)->LoadIdentity) +#define SET_LoadIdentity(disp, fn) ((disp)->LoadIdentity = fn) +#define CALL_LoadMatrixf(disp, parameters) (*((disp)->LoadMatrixf)) parameters +#define GET_LoadMatrixf(disp) ((disp)->LoadMatrixf) +#define SET_LoadMatrixf(disp, fn) ((disp)->LoadMatrixf = fn) +#define CALL_LoadMatrixd(disp, parameters) (*((disp)->LoadMatrixd)) parameters +#define GET_LoadMatrixd(disp) ((disp)->LoadMatrixd) +#define SET_LoadMatrixd(disp, fn) ((disp)->LoadMatrixd = fn) +#define CALL_MatrixMode(disp, parameters) (*((disp)->MatrixMode)) parameters +#define GET_MatrixMode(disp) ((disp)->MatrixMode) +#define SET_MatrixMode(disp, fn) ((disp)->MatrixMode = fn) +#define CALL_MultMatrixf(disp, parameters) (*((disp)->MultMatrixf)) parameters +#define GET_MultMatrixf(disp) ((disp)->MultMatrixf) +#define SET_MultMatrixf(disp, fn) ((disp)->MultMatrixf = fn) +#define CALL_MultMatrixd(disp, parameters) (*((disp)->MultMatrixd)) parameters +#define GET_MultMatrixd(disp) ((disp)->MultMatrixd) +#define SET_MultMatrixd(disp, fn) ((disp)->MultMatrixd = fn) +#define CALL_Ortho(disp, parameters) (*((disp)->Ortho)) parameters +#define GET_Ortho(disp) ((disp)->Ortho) +#define SET_Ortho(disp, fn) ((disp)->Ortho = fn) +#define CALL_PopMatrix(disp, parameters) (*((disp)->PopMatrix)) parameters +#define GET_PopMatrix(disp) ((disp)->PopMatrix) +#define SET_PopMatrix(disp, fn) ((disp)->PopMatrix = fn) +#define CALL_PushMatrix(disp, parameters) (*((disp)->PushMatrix)) parameters +#define GET_PushMatrix(disp) ((disp)->PushMatrix) +#define SET_PushMatrix(disp, fn) ((disp)->PushMatrix = fn) +#define CALL_Rotated(disp, parameters) (*((disp)->Rotated)) parameters +#define GET_Rotated(disp) ((disp)->Rotated) +#define SET_Rotated(disp, fn) ((disp)->Rotated = fn) +#define CALL_Rotatef(disp, parameters) (*((disp)->Rotatef)) parameters +#define GET_Rotatef(disp) ((disp)->Rotatef) +#define SET_Rotatef(disp, fn) ((disp)->Rotatef = fn) +#define CALL_Scaled(disp, parameters) (*((disp)->Scaled)) parameters +#define GET_Scaled(disp) ((disp)->Scaled) +#define SET_Scaled(disp, fn) ((disp)->Scaled = fn) +#define CALL_Scalef(disp, parameters) (*((disp)->Scalef)) parameters +#define GET_Scalef(disp) ((disp)->Scalef) +#define SET_Scalef(disp, fn) ((disp)->Scalef = fn) +#define CALL_Translated(disp, parameters) (*((disp)->Translated)) parameters +#define GET_Translated(disp) ((disp)->Translated) +#define SET_Translated(disp, fn) ((disp)->Translated = fn) +#define CALL_Translatef(disp, parameters) (*((disp)->Translatef)) parameters +#define GET_Translatef(disp) ((disp)->Translatef) +#define SET_Translatef(disp, fn) ((disp)->Translatef = fn) +#define CALL_Viewport(disp, parameters) (*((disp)->Viewport)) parameters +#define GET_Viewport(disp) ((disp)->Viewport) +#define SET_Viewport(disp, fn) ((disp)->Viewport = fn) +#define CALL_ArrayElement(disp, parameters) (*((disp)->ArrayElement)) parameters +#define GET_ArrayElement(disp) ((disp)->ArrayElement) +#define SET_ArrayElement(disp, fn) ((disp)->ArrayElement = fn) +#define CALL_BindTexture(disp, parameters) (*((disp)->BindTexture)) parameters +#define GET_BindTexture(disp) ((disp)->BindTexture) +#define SET_BindTexture(disp, fn) ((disp)->BindTexture = fn) +#define CALL_ColorPointer(disp, parameters) (*((disp)->ColorPointer)) parameters +#define GET_ColorPointer(disp) ((disp)->ColorPointer) +#define SET_ColorPointer(disp, fn) ((disp)->ColorPointer = fn) +#define CALL_DisableClientState(disp, parameters) (*((disp)->DisableClientState)) parameters +#define GET_DisableClientState(disp) ((disp)->DisableClientState) +#define SET_DisableClientState(disp, fn) ((disp)->DisableClientState = fn) +#define CALL_DrawArrays(disp, parameters) (*((disp)->DrawArrays)) parameters +#define GET_DrawArrays(disp) ((disp)->DrawArrays) +#define SET_DrawArrays(disp, fn) ((disp)->DrawArrays = fn) +#define CALL_DrawElements(disp, parameters) (*((disp)->DrawElements)) parameters +#define GET_DrawElements(disp) ((disp)->DrawElements) +#define SET_DrawElements(disp, fn) ((disp)->DrawElements = fn) +#define CALL_EdgeFlagPointer(disp, parameters) (*((disp)->EdgeFlagPointer)) parameters +#define GET_EdgeFlagPointer(disp) ((disp)->EdgeFlagPointer) +#define SET_EdgeFlagPointer(disp, fn) ((disp)->EdgeFlagPointer = fn) +#define CALL_EnableClientState(disp, parameters) (*((disp)->EnableClientState)) parameters +#define GET_EnableClientState(disp) ((disp)->EnableClientState) +#define SET_EnableClientState(disp, fn) ((disp)->EnableClientState = fn) +#define CALL_IndexPointer(disp, parameters) (*((disp)->IndexPointer)) parameters +#define GET_IndexPointer(disp) ((disp)->IndexPointer) +#define SET_IndexPointer(disp, fn) ((disp)->IndexPointer = fn) +#define CALL_Indexub(disp, parameters) (*((disp)->Indexub)) parameters +#define GET_Indexub(disp) ((disp)->Indexub) +#define SET_Indexub(disp, fn) ((disp)->Indexub = fn) +#define CALL_Indexubv(disp, parameters) (*((disp)->Indexubv)) parameters +#define GET_Indexubv(disp) ((disp)->Indexubv) +#define SET_Indexubv(disp, fn) ((disp)->Indexubv = fn) +#define CALL_InterleavedArrays(disp, parameters) (*((disp)->InterleavedArrays)) parameters +#define GET_InterleavedArrays(disp) ((disp)->InterleavedArrays) +#define SET_InterleavedArrays(disp, fn) ((disp)->InterleavedArrays = fn) +#define CALL_NormalPointer(disp, parameters) (*((disp)->NormalPointer)) parameters +#define GET_NormalPointer(disp) ((disp)->NormalPointer) +#define SET_NormalPointer(disp, fn) ((disp)->NormalPointer = fn) +#define CALL_PolygonOffset(disp, parameters) (*((disp)->PolygonOffset)) parameters +#define GET_PolygonOffset(disp) ((disp)->PolygonOffset) +#define SET_PolygonOffset(disp, fn) ((disp)->PolygonOffset = fn) +#define CALL_TexCoordPointer(disp, parameters) (*((disp)->TexCoordPointer)) parameters +#define GET_TexCoordPointer(disp) ((disp)->TexCoordPointer) +#define SET_TexCoordPointer(disp, fn) ((disp)->TexCoordPointer = fn) +#define CALL_VertexPointer(disp, parameters) (*((disp)->VertexPointer)) parameters +#define GET_VertexPointer(disp) ((disp)->VertexPointer) +#define SET_VertexPointer(disp, fn) ((disp)->VertexPointer = fn) +#define CALL_AreTexturesResident(disp, parameters) (*((disp)->AreTexturesResident)) parameters +#define GET_AreTexturesResident(disp) ((disp)->AreTexturesResident) +#define SET_AreTexturesResident(disp, fn) ((disp)->AreTexturesResident = fn) +#define CALL_CopyTexImage1D(disp, parameters) (*((disp)->CopyTexImage1D)) parameters +#define GET_CopyTexImage1D(disp) ((disp)->CopyTexImage1D) +#define SET_CopyTexImage1D(disp, fn) ((disp)->CopyTexImage1D = fn) +#define CALL_CopyTexImage2D(disp, parameters) (*((disp)->CopyTexImage2D)) parameters +#define GET_CopyTexImage2D(disp) ((disp)->CopyTexImage2D) +#define SET_CopyTexImage2D(disp, fn) ((disp)->CopyTexImage2D = fn) +#define CALL_CopyTexSubImage1D(disp, parameters) (*((disp)->CopyTexSubImage1D)) parameters +#define GET_CopyTexSubImage1D(disp) ((disp)->CopyTexSubImage1D) +#define SET_CopyTexSubImage1D(disp, fn) ((disp)->CopyTexSubImage1D = fn) +#define CALL_CopyTexSubImage2D(disp, parameters) (*((disp)->CopyTexSubImage2D)) parameters +#define GET_CopyTexSubImage2D(disp) ((disp)->CopyTexSubImage2D) +#define SET_CopyTexSubImage2D(disp, fn) ((disp)->CopyTexSubImage2D = fn) +#define CALL_DeleteTextures(disp, parameters) (*((disp)->DeleteTextures)) parameters +#define GET_DeleteTextures(disp) ((disp)->DeleteTextures) +#define SET_DeleteTextures(disp, fn) ((disp)->DeleteTextures = fn) +#define CALL_GenTextures(disp, parameters) (*((disp)->GenTextures)) parameters +#define GET_GenTextures(disp) ((disp)->GenTextures) +#define SET_GenTextures(disp, fn) ((disp)->GenTextures = fn) +#define CALL_GetPointerv(disp, parameters) (*((disp)->GetPointerv)) parameters +#define GET_GetPointerv(disp) ((disp)->GetPointerv) +#define SET_GetPointerv(disp, fn) ((disp)->GetPointerv = fn) +#define CALL_IsTexture(disp, parameters) (*((disp)->IsTexture)) parameters +#define GET_IsTexture(disp) ((disp)->IsTexture) +#define SET_IsTexture(disp, fn) ((disp)->IsTexture = fn) +#define CALL_PrioritizeTextures(disp, parameters) (*((disp)->PrioritizeTextures)) parameters +#define GET_PrioritizeTextures(disp) ((disp)->PrioritizeTextures) +#define SET_PrioritizeTextures(disp, fn) ((disp)->PrioritizeTextures = fn) +#define CALL_TexSubImage1D(disp, parameters) (*((disp)->TexSubImage1D)) parameters +#define GET_TexSubImage1D(disp) ((disp)->TexSubImage1D) +#define SET_TexSubImage1D(disp, fn) ((disp)->TexSubImage1D = fn) +#define CALL_TexSubImage2D(disp, parameters) (*((disp)->TexSubImage2D)) parameters +#define GET_TexSubImage2D(disp) ((disp)->TexSubImage2D) +#define SET_TexSubImage2D(disp, fn) ((disp)->TexSubImage2D = fn) +#define CALL_PopClientAttrib(disp, parameters) (*((disp)->PopClientAttrib)) parameters +#define GET_PopClientAttrib(disp) ((disp)->PopClientAttrib) +#define SET_PopClientAttrib(disp, fn) ((disp)->PopClientAttrib = fn) +#define CALL_PushClientAttrib(disp, parameters) (*((disp)->PushClientAttrib)) parameters +#define GET_PushClientAttrib(disp) ((disp)->PushClientAttrib) +#define SET_PushClientAttrib(disp, fn) ((disp)->PushClientAttrib = fn) +#define CALL_BlendColor(disp, parameters) (*((disp)->BlendColor)) parameters +#define GET_BlendColor(disp) ((disp)->BlendColor) +#define SET_BlendColor(disp, fn) ((disp)->BlendColor = fn) +#define CALL_BlendEquation(disp, parameters) (*((disp)->BlendEquation)) parameters +#define GET_BlendEquation(disp) ((disp)->BlendEquation) +#define SET_BlendEquation(disp, fn) ((disp)->BlendEquation = fn) +#define CALL_DrawRangeElements(disp, parameters) (*((disp)->DrawRangeElements)) parameters +#define GET_DrawRangeElements(disp) ((disp)->DrawRangeElements) +#define SET_DrawRangeElements(disp, fn) ((disp)->DrawRangeElements = fn) +#define CALL_ColorTable(disp, parameters) (*((disp)->ColorTable)) parameters +#define GET_ColorTable(disp) ((disp)->ColorTable) +#define SET_ColorTable(disp, fn) ((disp)->ColorTable = fn) +#define CALL_ColorTableParameterfv(disp, parameters) (*((disp)->ColorTableParameterfv)) parameters +#define GET_ColorTableParameterfv(disp) ((disp)->ColorTableParameterfv) +#define SET_ColorTableParameterfv(disp, fn) ((disp)->ColorTableParameterfv = fn) +#define CALL_ColorTableParameteriv(disp, parameters) (*((disp)->ColorTableParameteriv)) parameters +#define GET_ColorTableParameteriv(disp) ((disp)->ColorTableParameteriv) +#define SET_ColorTableParameteriv(disp, fn) ((disp)->ColorTableParameteriv = fn) +#define CALL_CopyColorTable(disp, parameters) (*((disp)->CopyColorTable)) parameters +#define GET_CopyColorTable(disp) ((disp)->CopyColorTable) +#define SET_CopyColorTable(disp, fn) ((disp)->CopyColorTable = fn) +#define CALL_GetColorTable(disp, parameters) (*((disp)->GetColorTable)) parameters +#define GET_GetColorTable(disp) ((disp)->GetColorTable) +#define SET_GetColorTable(disp, fn) ((disp)->GetColorTable = fn) +#define CALL_GetColorTableParameterfv(disp, parameters) (*((disp)->GetColorTableParameterfv)) parameters +#define GET_GetColorTableParameterfv(disp) ((disp)->GetColorTableParameterfv) +#define SET_GetColorTableParameterfv(disp, fn) ((disp)->GetColorTableParameterfv = fn) +#define CALL_GetColorTableParameteriv(disp, parameters) (*((disp)->GetColorTableParameteriv)) parameters +#define GET_GetColorTableParameteriv(disp) ((disp)->GetColorTableParameteriv) +#define SET_GetColorTableParameteriv(disp, fn) ((disp)->GetColorTableParameteriv = fn) +#define CALL_ColorSubTable(disp, parameters) (*((disp)->ColorSubTable)) parameters +#define GET_ColorSubTable(disp) ((disp)->ColorSubTable) +#define SET_ColorSubTable(disp, fn) ((disp)->ColorSubTable = fn) +#define CALL_CopyColorSubTable(disp, parameters) (*((disp)->CopyColorSubTable)) parameters +#define GET_CopyColorSubTable(disp) ((disp)->CopyColorSubTable) +#define SET_CopyColorSubTable(disp, fn) ((disp)->CopyColorSubTable = fn) +#define CALL_ConvolutionFilter1D(disp, parameters) (*((disp)->ConvolutionFilter1D)) parameters +#define GET_ConvolutionFilter1D(disp) ((disp)->ConvolutionFilter1D) +#define SET_ConvolutionFilter1D(disp, fn) ((disp)->ConvolutionFilter1D = fn) +#define CALL_ConvolutionFilter2D(disp, parameters) (*((disp)->ConvolutionFilter2D)) parameters +#define GET_ConvolutionFilter2D(disp) ((disp)->ConvolutionFilter2D) +#define SET_ConvolutionFilter2D(disp, fn) ((disp)->ConvolutionFilter2D = fn) +#define CALL_ConvolutionParameterf(disp, parameters) (*((disp)->ConvolutionParameterf)) parameters +#define GET_ConvolutionParameterf(disp) ((disp)->ConvolutionParameterf) +#define SET_ConvolutionParameterf(disp, fn) ((disp)->ConvolutionParameterf = fn) +#define CALL_ConvolutionParameterfv(disp, parameters) (*((disp)->ConvolutionParameterfv)) parameters +#define GET_ConvolutionParameterfv(disp) ((disp)->ConvolutionParameterfv) +#define SET_ConvolutionParameterfv(disp, fn) ((disp)->ConvolutionParameterfv = fn) +#define CALL_ConvolutionParameteri(disp, parameters) (*((disp)->ConvolutionParameteri)) parameters +#define GET_ConvolutionParameteri(disp) ((disp)->ConvolutionParameteri) +#define SET_ConvolutionParameteri(disp, fn) ((disp)->ConvolutionParameteri = fn) +#define CALL_ConvolutionParameteriv(disp, parameters) (*((disp)->ConvolutionParameteriv)) parameters +#define GET_ConvolutionParameteriv(disp) ((disp)->ConvolutionParameteriv) +#define SET_ConvolutionParameteriv(disp, fn) ((disp)->ConvolutionParameteriv = fn) +#define CALL_CopyConvolutionFilter1D(disp, parameters) (*((disp)->CopyConvolutionFilter1D)) parameters +#define GET_CopyConvolutionFilter1D(disp) ((disp)->CopyConvolutionFilter1D) +#define SET_CopyConvolutionFilter1D(disp, fn) ((disp)->CopyConvolutionFilter1D = fn) +#define CALL_CopyConvolutionFilter2D(disp, parameters) (*((disp)->CopyConvolutionFilter2D)) parameters +#define GET_CopyConvolutionFilter2D(disp) ((disp)->CopyConvolutionFilter2D) +#define SET_CopyConvolutionFilter2D(disp, fn) ((disp)->CopyConvolutionFilter2D = fn) +#define CALL_GetConvolutionFilter(disp, parameters) (*((disp)->GetConvolutionFilter)) parameters +#define GET_GetConvolutionFilter(disp) ((disp)->GetConvolutionFilter) +#define SET_GetConvolutionFilter(disp, fn) ((disp)->GetConvolutionFilter = fn) +#define CALL_GetConvolutionParameterfv(disp, parameters) (*((disp)->GetConvolutionParameterfv)) parameters +#define GET_GetConvolutionParameterfv(disp) ((disp)->GetConvolutionParameterfv) +#define SET_GetConvolutionParameterfv(disp, fn) ((disp)->GetConvolutionParameterfv = fn) +#define CALL_GetConvolutionParameteriv(disp, parameters) (*((disp)->GetConvolutionParameteriv)) parameters +#define GET_GetConvolutionParameteriv(disp) ((disp)->GetConvolutionParameteriv) +#define SET_GetConvolutionParameteriv(disp, fn) ((disp)->GetConvolutionParameteriv = fn) +#define CALL_GetSeparableFilter(disp, parameters) (*((disp)->GetSeparableFilter)) parameters +#define GET_GetSeparableFilter(disp) ((disp)->GetSeparableFilter) +#define SET_GetSeparableFilter(disp, fn) ((disp)->GetSeparableFilter = fn) +#define CALL_SeparableFilter2D(disp, parameters) (*((disp)->SeparableFilter2D)) parameters +#define GET_SeparableFilter2D(disp) ((disp)->SeparableFilter2D) +#define SET_SeparableFilter2D(disp, fn) ((disp)->SeparableFilter2D = fn) +#define CALL_GetHistogram(disp, parameters) (*((disp)->GetHistogram)) parameters +#define GET_GetHistogram(disp) ((disp)->GetHistogram) +#define SET_GetHistogram(disp, fn) ((disp)->GetHistogram = fn) +#define CALL_GetHistogramParameterfv(disp, parameters) (*((disp)->GetHistogramParameterfv)) parameters +#define GET_GetHistogramParameterfv(disp) ((disp)->GetHistogramParameterfv) +#define SET_GetHistogramParameterfv(disp, fn) ((disp)->GetHistogramParameterfv = fn) +#define CALL_GetHistogramParameteriv(disp, parameters) (*((disp)->GetHistogramParameteriv)) parameters +#define GET_GetHistogramParameteriv(disp) ((disp)->GetHistogramParameteriv) +#define SET_GetHistogramParameteriv(disp, fn) ((disp)->GetHistogramParameteriv = fn) +#define CALL_GetMinmax(disp, parameters) (*((disp)->GetMinmax)) parameters +#define GET_GetMinmax(disp) ((disp)->GetMinmax) +#define SET_GetMinmax(disp, fn) ((disp)->GetMinmax = fn) +#define CALL_GetMinmaxParameterfv(disp, parameters) (*((disp)->GetMinmaxParameterfv)) parameters +#define GET_GetMinmaxParameterfv(disp) ((disp)->GetMinmaxParameterfv) +#define SET_GetMinmaxParameterfv(disp, fn) ((disp)->GetMinmaxParameterfv = fn) +#define CALL_GetMinmaxParameteriv(disp, parameters) (*((disp)->GetMinmaxParameteriv)) parameters +#define GET_GetMinmaxParameteriv(disp) ((disp)->GetMinmaxParameteriv) +#define SET_GetMinmaxParameteriv(disp, fn) ((disp)->GetMinmaxParameteriv = fn) +#define CALL_Histogram(disp, parameters) (*((disp)->Histogram)) parameters +#define GET_Histogram(disp) ((disp)->Histogram) +#define SET_Histogram(disp, fn) ((disp)->Histogram = fn) +#define CALL_Minmax(disp, parameters) (*((disp)->Minmax)) parameters +#define GET_Minmax(disp) ((disp)->Minmax) +#define SET_Minmax(disp, fn) ((disp)->Minmax = fn) +#define CALL_ResetHistogram(disp, parameters) (*((disp)->ResetHistogram)) parameters +#define GET_ResetHistogram(disp) ((disp)->ResetHistogram) +#define SET_ResetHistogram(disp, fn) ((disp)->ResetHistogram = fn) +#define CALL_ResetMinmax(disp, parameters) (*((disp)->ResetMinmax)) parameters +#define GET_ResetMinmax(disp) ((disp)->ResetMinmax) +#define SET_ResetMinmax(disp, fn) ((disp)->ResetMinmax = fn) +#define CALL_TexImage3D(disp, parameters) (*((disp)->TexImage3D)) parameters +#define GET_TexImage3D(disp) ((disp)->TexImage3D) +#define SET_TexImage3D(disp, fn) ((disp)->TexImage3D = fn) +#define CALL_TexSubImage3D(disp, parameters) (*((disp)->TexSubImage3D)) parameters +#define GET_TexSubImage3D(disp) ((disp)->TexSubImage3D) +#define SET_TexSubImage3D(disp, fn) ((disp)->TexSubImage3D = fn) +#define CALL_CopyTexSubImage3D(disp, parameters) (*((disp)->CopyTexSubImage3D)) parameters +#define GET_CopyTexSubImage3D(disp) ((disp)->CopyTexSubImage3D) +#define SET_CopyTexSubImage3D(disp, fn) ((disp)->CopyTexSubImage3D = fn) +#define CALL_ActiveTextureARB(disp, parameters) (*((disp)->ActiveTextureARB)) parameters +#define GET_ActiveTextureARB(disp) ((disp)->ActiveTextureARB) +#define SET_ActiveTextureARB(disp, fn) ((disp)->ActiveTextureARB = fn) +#define CALL_ClientActiveTextureARB(disp, parameters) (*((disp)->ClientActiveTextureARB)) parameters +#define GET_ClientActiveTextureARB(disp) ((disp)->ClientActiveTextureARB) +#define SET_ClientActiveTextureARB(disp, fn) ((disp)->ClientActiveTextureARB = fn) +#define CALL_MultiTexCoord1dARB(disp, parameters) (*((disp)->MultiTexCoord1dARB)) parameters +#define GET_MultiTexCoord1dARB(disp) ((disp)->MultiTexCoord1dARB) +#define SET_MultiTexCoord1dARB(disp, fn) ((disp)->MultiTexCoord1dARB = fn) +#define CALL_MultiTexCoord1dvARB(disp, parameters) (*((disp)->MultiTexCoord1dvARB)) parameters +#define GET_MultiTexCoord1dvARB(disp) ((disp)->MultiTexCoord1dvARB) +#define SET_MultiTexCoord1dvARB(disp, fn) ((disp)->MultiTexCoord1dvARB = fn) +#define CALL_MultiTexCoord1fARB(disp, parameters) (*((disp)->MultiTexCoord1fARB)) parameters +#define GET_MultiTexCoord1fARB(disp) ((disp)->MultiTexCoord1fARB) +#define SET_MultiTexCoord1fARB(disp, fn) ((disp)->MultiTexCoord1fARB = fn) +#define CALL_MultiTexCoord1fvARB(disp, parameters) (*((disp)->MultiTexCoord1fvARB)) parameters +#define GET_MultiTexCoord1fvARB(disp) ((disp)->MultiTexCoord1fvARB) +#define SET_MultiTexCoord1fvARB(disp, fn) ((disp)->MultiTexCoord1fvARB = fn) +#define CALL_MultiTexCoord1iARB(disp, parameters) (*((disp)->MultiTexCoord1iARB)) parameters +#define GET_MultiTexCoord1iARB(disp) ((disp)->MultiTexCoord1iARB) +#define SET_MultiTexCoord1iARB(disp, fn) ((disp)->MultiTexCoord1iARB = fn) +#define CALL_MultiTexCoord1ivARB(disp, parameters) (*((disp)->MultiTexCoord1ivARB)) parameters +#define GET_MultiTexCoord1ivARB(disp) ((disp)->MultiTexCoord1ivARB) +#define SET_MultiTexCoord1ivARB(disp, fn) ((disp)->MultiTexCoord1ivARB = fn) +#define CALL_MultiTexCoord1sARB(disp, parameters) (*((disp)->MultiTexCoord1sARB)) parameters +#define GET_MultiTexCoord1sARB(disp) ((disp)->MultiTexCoord1sARB) +#define SET_MultiTexCoord1sARB(disp, fn) ((disp)->MultiTexCoord1sARB = fn) +#define CALL_MultiTexCoord1svARB(disp, parameters) (*((disp)->MultiTexCoord1svARB)) parameters +#define GET_MultiTexCoord1svARB(disp) ((disp)->MultiTexCoord1svARB) +#define SET_MultiTexCoord1svARB(disp, fn) ((disp)->MultiTexCoord1svARB = fn) +#define CALL_MultiTexCoord2dARB(disp, parameters) (*((disp)->MultiTexCoord2dARB)) parameters +#define GET_MultiTexCoord2dARB(disp) ((disp)->MultiTexCoord2dARB) +#define SET_MultiTexCoord2dARB(disp, fn) ((disp)->MultiTexCoord2dARB = fn) +#define CALL_MultiTexCoord2dvARB(disp, parameters) (*((disp)->MultiTexCoord2dvARB)) parameters +#define GET_MultiTexCoord2dvARB(disp) ((disp)->MultiTexCoord2dvARB) +#define SET_MultiTexCoord2dvARB(disp, fn) ((disp)->MultiTexCoord2dvARB = fn) +#define CALL_MultiTexCoord2fARB(disp, parameters) (*((disp)->MultiTexCoord2fARB)) parameters +#define GET_MultiTexCoord2fARB(disp) ((disp)->MultiTexCoord2fARB) +#define SET_MultiTexCoord2fARB(disp, fn) ((disp)->MultiTexCoord2fARB = fn) +#define CALL_MultiTexCoord2fvARB(disp, parameters) (*((disp)->MultiTexCoord2fvARB)) parameters +#define GET_MultiTexCoord2fvARB(disp) ((disp)->MultiTexCoord2fvARB) +#define SET_MultiTexCoord2fvARB(disp, fn) ((disp)->MultiTexCoord2fvARB = fn) +#define CALL_MultiTexCoord2iARB(disp, parameters) (*((disp)->MultiTexCoord2iARB)) parameters +#define GET_MultiTexCoord2iARB(disp) ((disp)->MultiTexCoord2iARB) +#define SET_MultiTexCoord2iARB(disp, fn) ((disp)->MultiTexCoord2iARB = fn) +#define CALL_MultiTexCoord2ivARB(disp, parameters) (*((disp)->MultiTexCoord2ivARB)) parameters +#define GET_MultiTexCoord2ivARB(disp) ((disp)->MultiTexCoord2ivARB) +#define SET_MultiTexCoord2ivARB(disp, fn) ((disp)->MultiTexCoord2ivARB = fn) +#define CALL_MultiTexCoord2sARB(disp, parameters) (*((disp)->MultiTexCoord2sARB)) parameters +#define GET_MultiTexCoord2sARB(disp) ((disp)->MultiTexCoord2sARB) +#define SET_MultiTexCoord2sARB(disp, fn) ((disp)->MultiTexCoord2sARB = fn) +#define CALL_MultiTexCoord2svARB(disp, parameters) (*((disp)->MultiTexCoord2svARB)) parameters +#define GET_MultiTexCoord2svARB(disp) ((disp)->MultiTexCoord2svARB) +#define SET_MultiTexCoord2svARB(disp, fn) ((disp)->MultiTexCoord2svARB = fn) +#define CALL_MultiTexCoord3dARB(disp, parameters) (*((disp)->MultiTexCoord3dARB)) parameters +#define GET_MultiTexCoord3dARB(disp) ((disp)->MultiTexCoord3dARB) +#define SET_MultiTexCoord3dARB(disp, fn) ((disp)->MultiTexCoord3dARB = fn) +#define CALL_MultiTexCoord3dvARB(disp, parameters) (*((disp)->MultiTexCoord3dvARB)) parameters +#define GET_MultiTexCoord3dvARB(disp) ((disp)->MultiTexCoord3dvARB) +#define SET_MultiTexCoord3dvARB(disp, fn) ((disp)->MultiTexCoord3dvARB = fn) +#define CALL_MultiTexCoord3fARB(disp, parameters) (*((disp)->MultiTexCoord3fARB)) parameters +#define GET_MultiTexCoord3fARB(disp) ((disp)->MultiTexCoord3fARB) +#define SET_MultiTexCoord3fARB(disp, fn) ((disp)->MultiTexCoord3fARB = fn) +#define CALL_MultiTexCoord3fvARB(disp, parameters) (*((disp)->MultiTexCoord3fvARB)) parameters +#define GET_MultiTexCoord3fvARB(disp) ((disp)->MultiTexCoord3fvARB) +#define SET_MultiTexCoord3fvARB(disp, fn) ((disp)->MultiTexCoord3fvARB = fn) +#define CALL_MultiTexCoord3iARB(disp, parameters) (*((disp)->MultiTexCoord3iARB)) parameters +#define GET_MultiTexCoord3iARB(disp) ((disp)->MultiTexCoord3iARB) +#define SET_MultiTexCoord3iARB(disp, fn) ((disp)->MultiTexCoord3iARB = fn) +#define CALL_MultiTexCoord3ivARB(disp, parameters) (*((disp)->MultiTexCoord3ivARB)) parameters +#define GET_MultiTexCoord3ivARB(disp) ((disp)->MultiTexCoord3ivARB) +#define SET_MultiTexCoord3ivARB(disp, fn) ((disp)->MultiTexCoord3ivARB = fn) +#define CALL_MultiTexCoord3sARB(disp, parameters) (*((disp)->MultiTexCoord3sARB)) parameters +#define GET_MultiTexCoord3sARB(disp) ((disp)->MultiTexCoord3sARB) +#define SET_MultiTexCoord3sARB(disp, fn) ((disp)->MultiTexCoord3sARB = fn) +#define CALL_MultiTexCoord3svARB(disp, parameters) (*((disp)->MultiTexCoord3svARB)) parameters +#define GET_MultiTexCoord3svARB(disp) ((disp)->MultiTexCoord3svARB) +#define SET_MultiTexCoord3svARB(disp, fn) ((disp)->MultiTexCoord3svARB = fn) +#define CALL_MultiTexCoord4dARB(disp, parameters) (*((disp)->MultiTexCoord4dARB)) parameters +#define GET_MultiTexCoord4dARB(disp) ((disp)->MultiTexCoord4dARB) +#define SET_MultiTexCoord4dARB(disp, fn) ((disp)->MultiTexCoord4dARB = fn) +#define CALL_MultiTexCoord4dvARB(disp, parameters) (*((disp)->MultiTexCoord4dvARB)) parameters +#define GET_MultiTexCoord4dvARB(disp) ((disp)->MultiTexCoord4dvARB) +#define SET_MultiTexCoord4dvARB(disp, fn) ((disp)->MultiTexCoord4dvARB = fn) +#define CALL_MultiTexCoord4fARB(disp, parameters) (*((disp)->MultiTexCoord4fARB)) parameters +#define GET_MultiTexCoord4fARB(disp) ((disp)->MultiTexCoord4fARB) +#define SET_MultiTexCoord4fARB(disp, fn) ((disp)->MultiTexCoord4fARB = fn) +#define CALL_MultiTexCoord4fvARB(disp, parameters) (*((disp)->MultiTexCoord4fvARB)) parameters +#define GET_MultiTexCoord4fvARB(disp) ((disp)->MultiTexCoord4fvARB) +#define SET_MultiTexCoord4fvARB(disp, fn) ((disp)->MultiTexCoord4fvARB = fn) +#define CALL_MultiTexCoord4iARB(disp, parameters) (*((disp)->MultiTexCoord4iARB)) parameters +#define GET_MultiTexCoord4iARB(disp) ((disp)->MultiTexCoord4iARB) +#define SET_MultiTexCoord4iARB(disp, fn) ((disp)->MultiTexCoord4iARB = fn) +#define CALL_MultiTexCoord4ivARB(disp, parameters) (*((disp)->MultiTexCoord4ivARB)) parameters +#define GET_MultiTexCoord4ivARB(disp) ((disp)->MultiTexCoord4ivARB) +#define SET_MultiTexCoord4ivARB(disp, fn) ((disp)->MultiTexCoord4ivARB = fn) +#define CALL_MultiTexCoord4sARB(disp, parameters) (*((disp)->MultiTexCoord4sARB)) parameters +#define GET_MultiTexCoord4sARB(disp) ((disp)->MultiTexCoord4sARB) +#define SET_MultiTexCoord4sARB(disp, fn) ((disp)->MultiTexCoord4sARB = fn) +#define CALL_MultiTexCoord4svARB(disp, parameters) (*((disp)->MultiTexCoord4svARB)) parameters +#define GET_MultiTexCoord4svARB(disp) ((disp)->MultiTexCoord4svARB) +#define SET_MultiTexCoord4svARB(disp, fn) ((disp)->MultiTexCoord4svARB = fn) + +#if !defined(IN_DRI_DRIVER) + +#define CALL_LoadTransposeMatrixfARB(disp, parameters) (*((disp)->LoadTransposeMatrixfARB)) parameters +#define GET_LoadTransposeMatrixfARB(disp) ((disp)->LoadTransposeMatrixfARB) +#define SET_LoadTransposeMatrixfARB(disp, fn) ((disp)->LoadTransposeMatrixfARB = fn) +#define CALL_LoadTransposeMatrixdARB(disp, parameters) (*((disp)->LoadTransposeMatrixdARB)) parameters +#define GET_LoadTransposeMatrixdARB(disp) ((disp)->LoadTransposeMatrixdARB) +#define SET_LoadTransposeMatrixdARB(disp, fn) ((disp)->LoadTransposeMatrixdARB = fn) +#define CALL_MultTransposeMatrixfARB(disp, parameters) (*((disp)->MultTransposeMatrixfARB)) parameters +#define GET_MultTransposeMatrixfARB(disp) ((disp)->MultTransposeMatrixfARB) +#define SET_MultTransposeMatrixfARB(disp, fn) ((disp)->MultTransposeMatrixfARB = fn) +#define CALL_MultTransposeMatrixdARB(disp, parameters) (*((disp)->MultTransposeMatrixdARB)) parameters +#define GET_MultTransposeMatrixdARB(disp) ((disp)->MultTransposeMatrixdARB) +#define SET_MultTransposeMatrixdARB(disp, fn) ((disp)->MultTransposeMatrixdARB = fn) +#define CALL_SampleCoverageARB(disp, parameters) (*((disp)->SampleCoverageARB)) parameters +#define GET_SampleCoverageARB(disp) ((disp)->SampleCoverageARB) +#define SET_SampleCoverageARB(disp, fn) ((disp)->SampleCoverageARB = fn) +#define CALL_DrawBuffersARB(disp, parameters) (*((disp)->DrawBuffersARB)) parameters +#define GET_DrawBuffersARB(disp) ((disp)->DrawBuffersARB) +#define SET_DrawBuffersARB(disp, fn) ((disp)->DrawBuffersARB = fn) +#define CALL_PolygonOffsetEXT(disp, parameters) (*((disp)->PolygonOffsetEXT)) parameters +#define GET_PolygonOffsetEXT(disp) ((disp)->PolygonOffsetEXT) +#define SET_PolygonOffsetEXT(disp, fn) ((disp)->PolygonOffsetEXT = fn) +#define CALL_GetTexFilterFuncSGIS(disp, parameters) (*((disp)->GetTexFilterFuncSGIS)) parameters +#define GET_GetTexFilterFuncSGIS(disp) ((disp)->GetTexFilterFuncSGIS) +#define SET_GetTexFilterFuncSGIS(disp, fn) ((disp)->GetTexFilterFuncSGIS = fn) +#define CALL_TexFilterFuncSGIS(disp, parameters) (*((disp)->TexFilterFuncSGIS)) parameters +#define GET_TexFilterFuncSGIS(disp) ((disp)->TexFilterFuncSGIS) +#define SET_TexFilterFuncSGIS(disp, fn) ((disp)->TexFilterFuncSGIS = fn) +#define CALL_GetHistogramEXT(disp, parameters) (*((disp)->GetHistogramEXT)) parameters +#define GET_GetHistogramEXT(disp) ((disp)->GetHistogramEXT) +#define SET_GetHistogramEXT(disp, fn) ((disp)->GetHistogramEXT = fn) +#define CALL_GetHistogramParameterfvEXT(disp, parameters) (*((disp)->GetHistogramParameterfvEXT)) parameters +#define GET_GetHistogramParameterfvEXT(disp) ((disp)->GetHistogramParameterfvEXT) +#define SET_GetHistogramParameterfvEXT(disp, fn) ((disp)->GetHistogramParameterfvEXT = fn) +#define CALL_GetHistogramParameterivEXT(disp, parameters) (*((disp)->GetHistogramParameterivEXT)) parameters +#define GET_GetHistogramParameterivEXT(disp) ((disp)->GetHistogramParameterivEXT) +#define SET_GetHistogramParameterivEXT(disp, fn) ((disp)->GetHistogramParameterivEXT = fn) +#define CALL_GetMinmaxEXT(disp, parameters) (*((disp)->GetMinmaxEXT)) parameters +#define GET_GetMinmaxEXT(disp) ((disp)->GetMinmaxEXT) +#define SET_GetMinmaxEXT(disp, fn) ((disp)->GetMinmaxEXT = fn) +#define CALL_GetMinmaxParameterfvEXT(disp, parameters) (*((disp)->GetMinmaxParameterfvEXT)) parameters +#define GET_GetMinmaxParameterfvEXT(disp) ((disp)->GetMinmaxParameterfvEXT) +#define SET_GetMinmaxParameterfvEXT(disp, fn) ((disp)->GetMinmaxParameterfvEXT = fn) +#define CALL_GetMinmaxParameterivEXT(disp, parameters) (*((disp)->GetMinmaxParameterivEXT)) parameters +#define GET_GetMinmaxParameterivEXT(disp) ((disp)->GetMinmaxParameterivEXT) +#define SET_GetMinmaxParameterivEXT(disp, fn) ((disp)->GetMinmaxParameterivEXT = fn) +#define CALL_GetConvolutionFilterEXT(disp, parameters) (*((disp)->GetConvolutionFilterEXT)) parameters +#define GET_GetConvolutionFilterEXT(disp) ((disp)->GetConvolutionFilterEXT) +#define SET_GetConvolutionFilterEXT(disp, fn) ((disp)->GetConvolutionFilterEXT = fn) +#define CALL_GetConvolutionParameterfvEXT(disp, parameters) (*((disp)->GetConvolutionParameterfvEXT)) parameters +#define GET_GetConvolutionParameterfvEXT(disp) ((disp)->GetConvolutionParameterfvEXT) +#define SET_GetConvolutionParameterfvEXT(disp, fn) ((disp)->GetConvolutionParameterfvEXT = fn) +#define CALL_GetConvolutionParameterivEXT(disp, parameters) (*((disp)->GetConvolutionParameterivEXT)) parameters +#define GET_GetConvolutionParameterivEXT(disp) ((disp)->GetConvolutionParameterivEXT) +#define SET_GetConvolutionParameterivEXT(disp, fn) ((disp)->GetConvolutionParameterivEXT = fn) +#define CALL_GetSeparableFilterEXT(disp, parameters) (*((disp)->GetSeparableFilterEXT)) parameters +#define GET_GetSeparableFilterEXT(disp) ((disp)->GetSeparableFilterEXT) +#define SET_GetSeparableFilterEXT(disp, fn) ((disp)->GetSeparableFilterEXT = fn) +#define CALL_GetColorTableSGI(disp, parameters) (*((disp)->GetColorTableSGI)) parameters +#define GET_GetColorTableSGI(disp) ((disp)->GetColorTableSGI) +#define SET_GetColorTableSGI(disp, fn) ((disp)->GetColorTableSGI = fn) +#define CALL_GetColorTableParameterfvSGI(disp, parameters) (*((disp)->GetColorTableParameterfvSGI)) parameters +#define GET_GetColorTableParameterfvSGI(disp) ((disp)->GetColorTableParameterfvSGI) +#define SET_GetColorTableParameterfvSGI(disp, fn) ((disp)->GetColorTableParameterfvSGI = fn) +#define CALL_GetColorTableParameterivSGI(disp, parameters) (*((disp)->GetColorTableParameterivSGI)) parameters +#define GET_GetColorTableParameterivSGI(disp) ((disp)->GetColorTableParameterivSGI) +#define SET_GetColorTableParameterivSGI(disp, fn) ((disp)->GetColorTableParameterivSGI = fn) +#define CALL_PixelTexGenSGIX(disp, parameters) (*((disp)->PixelTexGenSGIX)) parameters +#define GET_PixelTexGenSGIX(disp) ((disp)->PixelTexGenSGIX) +#define SET_PixelTexGenSGIX(disp, fn) ((disp)->PixelTexGenSGIX = fn) +#define CALL_PixelTexGenParameteriSGIS(disp, parameters) (*((disp)->PixelTexGenParameteriSGIS)) parameters +#define GET_PixelTexGenParameteriSGIS(disp) ((disp)->PixelTexGenParameteriSGIS) +#define SET_PixelTexGenParameteriSGIS(disp, fn) ((disp)->PixelTexGenParameteriSGIS = fn) +#define CALL_PixelTexGenParameterivSGIS(disp, parameters) (*((disp)->PixelTexGenParameterivSGIS)) parameters +#define GET_PixelTexGenParameterivSGIS(disp) ((disp)->PixelTexGenParameterivSGIS) +#define SET_PixelTexGenParameterivSGIS(disp, fn) ((disp)->PixelTexGenParameterivSGIS = fn) +#define CALL_PixelTexGenParameterfSGIS(disp, parameters) (*((disp)->PixelTexGenParameterfSGIS)) parameters +#define GET_PixelTexGenParameterfSGIS(disp) ((disp)->PixelTexGenParameterfSGIS) +#define SET_PixelTexGenParameterfSGIS(disp, fn) ((disp)->PixelTexGenParameterfSGIS = fn) +#define CALL_PixelTexGenParameterfvSGIS(disp, parameters) (*((disp)->PixelTexGenParameterfvSGIS)) parameters +#define GET_PixelTexGenParameterfvSGIS(disp) ((disp)->PixelTexGenParameterfvSGIS) +#define SET_PixelTexGenParameterfvSGIS(disp, fn) ((disp)->PixelTexGenParameterfvSGIS = fn) +#define CALL_GetPixelTexGenParameterivSGIS(disp, parameters) (*((disp)->GetPixelTexGenParameterivSGIS)) parameters +#define GET_GetPixelTexGenParameterivSGIS(disp) ((disp)->GetPixelTexGenParameterivSGIS) +#define SET_GetPixelTexGenParameterivSGIS(disp, fn) ((disp)->GetPixelTexGenParameterivSGIS = fn) +#define CALL_GetPixelTexGenParameterfvSGIS(disp, parameters) (*((disp)->GetPixelTexGenParameterfvSGIS)) parameters +#define GET_GetPixelTexGenParameterfvSGIS(disp) ((disp)->GetPixelTexGenParameterfvSGIS) +#define SET_GetPixelTexGenParameterfvSGIS(disp, fn) ((disp)->GetPixelTexGenParameterfvSGIS = fn) +#define CALL_TexImage4DSGIS(disp, parameters) (*((disp)->TexImage4DSGIS)) parameters +#define GET_TexImage4DSGIS(disp) ((disp)->TexImage4DSGIS) +#define SET_TexImage4DSGIS(disp, fn) ((disp)->TexImage4DSGIS = fn) +#define CALL_TexSubImage4DSGIS(disp, parameters) (*((disp)->TexSubImage4DSGIS)) parameters +#define GET_TexSubImage4DSGIS(disp) ((disp)->TexSubImage4DSGIS) +#define SET_TexSubImage4DSGIS(disp, fn) ((disp)->TexSubImage4DSGIS = fn) +#define CALL_AreTexturesResidentEXT(disp, parameters) (*((disp)->AreTexturesResidentEXT)) parameters +#define GET_AreTexturesResidentEXT(disp) ((disp)->AreTexturesResidentEXT) +#define SET_AreTexturesResidentEXT(disp, fn) ((disp)->AreTexturesResidentEXT = fn) +#define CALL_GenTexturesEXT(disp, parameters) (*((disp)->GenTexturesEXT)) parameters +#define GET_GenTexturesEXT(disp) ((disp)->GenTexturesEXT) +#define SET_GenTexturesEXT(disp, fn) ((disp)->GenTexturesEXT = fn) +#define CALL_IsTextureEXT(disp, parameters) (*((disp)->IsTextureEXT)) parameters +#define GET_IsTextureEXT(disp) ((disp)->IsTextureEXT) +#define SET_IsTextureEXT(disp, fn) ((disp)->IsTextureEXT = fn) +#define CALL_DetailTexFuncSGIS(disp, parameters) (*((disp)->DetailTexFuncSGIS)) parameters +#define GET_DetailTexFuncSGIS(disp) ((disp)->DetailTexFuncSGIS) +#define SET_DetailTexFuncSGIS(disp, fn) ((disp)->DetailTexFuncSGIS = fn) +#define CALL_GetDetailTexFuncSGIS(disp, parameters) (*((disp)->GetDetailTexFuncSGIS)) parameters +#define GET_GetDetailTexFuncSGIS(disp) ((disp)->GetDetailTexFuncSGIS) +#define SET_GetDetailTexFuncSGIS(disp, fn) ((disp)->GetDetailTexFuncSGIS = fn) +#define CALL_SharpenTexFuncSGIS(disp, parameters) (*((disp)->SharpenTexFuncSGIS)) parameters +#define GET_SharpenTexFuncSGIS(disp) ((disp)->SharpenTexFuncSGIS) +#define SET_SharpenTexFuncSGIS(disp, fn) ((disp)->SharpenTexFuncSGIS = fn) +#define CALL_GetSharpenTexFuncSGIS(disp, parameters) (*((disp)->GetSharpenTexFuncSGIS)) parameters +#define GET_GetSharpenTexFuncSGIS(disp) ((disp)->GetSharpenTexFuncSGIS) +#define SET_GetSharpenTexFuncSGIS(disp, fn) ((disp)->GetSharpenTexFuncSGIS = fn) +#define CALL_SampleMaskSGIS(disp, parameters) (*((disp)->SampleMaskSGIS)) parameters +#define GET_SampleMaskSGIS(disp) ((disp)->SampleMaskSGIS) +#define SET_SampleMaskSGIS(disp, fn) ((disp)->SampleMaskSGIS = fn) +#define CALL_SamplePatternSGIS(disp, parameters) (*((disp)->SamplePatternSGIS)) parameters +#define GET_SamplePatternSGIS(disp) ((disp)->SamplePatternSGIS) +#define SET_SamplePatternSGIS(disp, fn) ((disp)->SamplePatternSGIS = fn) +#define CALL_ColorPointerEXT(disp, parameters) (*((disp)->ColorPointerEXT)) parameters +#define GET_ColorPointerEXT(disp) ((disp)->ColorPointerEXT) +#define SET_ColorPointerEXT(disp, fn) ((disp)->ColorPointerEXT = fn) +#define CALL_EdgeFlagPointerEXT(disp, parameters) (*((disp)->EdgeFlagPointerEXT)) parameters +#define GET_EdgeFlagPointerEXT(disp) ((disp)->EdgeFlagPointerEXT) +#define SET_EdgeFlagPointerEXT(disp, fn) ((disp)->EdgeFlagPointerEXT = fn) +#define CALL_IndexPointerEXT(disp, parameters) (*((disp)->IndexPointerEXT)) parameters +#define GET_IndexPointerEXT(disp) ((disp)->IndexPointerEXT) +#define SET_IndexPointerEXT(disp, fn) ((disp)->IndexPointerEXT = fn) +#define CALL_NormalPointerEXT(disp, parameters) (*((disp)->NormalPointerEXT)) parameters +#define GET_NormalPointerEXT(disp) ((disp)->NormalPointerEXT) +#define SET_NormalPointerEXT(disp, fn) ((disp)->NormalPointerEXT = fn) +#define CALL_TexCoordPointerEXT(disp, parameters) (*((disp)->TexCoordPointerEXT)) parameters +#define GET_TexCoordPointerEXT(disp) ((disp)->TexCoordPointerEXT) +#define SET_TexCoordPointerEXT(disp, fn) ((disp)->TexCoordPointerEXT = fn) +#define CALL_VertexPointerEXT(disp, parameters) (*((disp)->VertexPointerEXT)) parameters +#define GET_VertexPointerEXT(disp) ((disp)->VertexPointerEXT) +#define SET_VertexPointerEXT(disp, fn) ((disp)->VertexPointerEXT = fn) +#define CALL_SpriteParameterfSGIX(disp, parameters) (*((disp)->SpriteParameterfSGIX)) parameters +#define GET_SpriteParameterfSGIX(disp) ((disp)->SpriteParameterfSGIX) +#define SET_SpriteParameterfSGIX(disp, fn) ((disp)->SpriteParameterfSGIX = fn) +#define CALL_SpriteParameterfvSGIX(disp, parameters) (*((disp)->SpriteParameterfvSGIX)) parameters +#define GET_SpriteParameterfvSGIX(disp) ((disp)->SpriteParameterfvSGIX) +#define SET_SpriteParameterfvSGIX(disp, fn) ((disp)->SpriteParameterfvSGIX = fn) +#define CALL_SpriteParameteriSGIX(disp, parameters) (*((disp)->SpriteParameteriSGIX)) parameters +#define GET_SpriteParameteriSGIX(disp) ((disp)->SpriteParameteriSGIX) +#define SET_SpriteParameteriSGIX(disp, fn) ((disp)->SpriteParameteriSGIX = fn) +#define CALL_SpriteParameterivSGIX(disp, parameters) (*((disp)->SpriteParameterivSGIX)) parameters +#define GET_SpriteParameterivSGIX(disp) ((disp)->SpriteParameterivSGIX) +#define SET_SpriteParameterivSGIX(disp, fn) ((disp)->SpriteParameterivSGIX = fn) +#define CALL_PointParameterfEXT(disp, parameters) (*((disp)->PointParameterfEXT)) parameters +#define GET_PointParameterfEXT(disp) ((disp)->PointParameterfEXT) +#define SET_PointParameterfEXT(disp, fn) ((disp)->PointParameterfEXT = fn) +#define CALL_PointParameterfvEXT(disp, parameters) (*((disp)->PointParameterfvEXT)) parameters +#define GET_PointParameterfvEXT(disp) ((disp)->PointParameterfvEXT) +#define SET_PointParameterfvEXT(disp, fn) ((disp)->PointParameterfvEXT = fn) +#define CALL_GetInstrumentsSGIX(disp, parameters) (*((disp)->GetInstrumentsSGIX)) parameters +#define GET_GetInstrumentsSGIX(disp) ((disp)->GetInstrumentsSGIX) +#define SET_GetInstrumentsSGIX(disp, fn) ((disp)->GetInstrumentsSGIX = fn) +#define CALL_InstrumentsBufferSGIX(disp, parameters) (*((disp)->InstrumentsBufferSGIX)) parameters +#define GET_InstrumentsBufferSGIX(disp) ((disp)->InstrumentsBufferSGIX) +#define SET_InstrumentsBufferSGIX(disp, fn) ((disp)->InstrumentsBufferSGIX = fn) +#define CALL_PollInstrumentsSGIX(disp, parameters) (*((disp)->PollInstrumentsSGIX)) parameters +#define GET_PollInstrumentsSGIX(disp) ((disp)->PollInstrumentsSGIX) +#define SET_PollInstrumentsSGIX(disp, fn) ((disp)->PollInstrumentsSGIX = fn) +#define CALL_ReadInstrumentsSGIX(disp, parameters) (*((disp)->ReadInstrumentsSGIX)) parameters +#define GET_ReadInstrumentsSGIX(disp) ((disp)->ReadInstrumentsSGIX) +#define SET_ReadInstrumentsSGIX(disp, fn) ((disp)->ReadInstrumentsSGIX = fn) +#define CALL_StartInstrumentsSGIX(disp, parameters) (*((disp)->StartInstrumentsSGIX)) parameters +#define GET_StartInstrumentsSGIX(disp) ((disp)->StartInstrumentsSGIX) +#define SET_StartInstrumentsSGIX(disp, fn) ((disp)->StartInstrumentsSGIX = fn) +#define CALL_StopInstrumentsSGIX(disp, parameters) (*((disp)->StopInstrumentsSGIX)) parameters +#define GET_StopInstrumentsSGIX(disp) ((disp)->StopInstrumentsSGIX) +#define SET_StopInstrumentsSGIX(disp, fn) ((disp)->StopInstrumentsSGIX = fn) +#define CALL_FrameZoomSGIX(disp, parameters) (*((disp)->FrameZoomSGIX)) parameters +#define GET_FrameZoomSGIX(disp) ((disp)->FrameZoomSGIX) +#define SET_FrameZoomSGIX(disp, fn) ((disp)->FrameZoomSGIX = fn) +#define CALL_TagSampleBufferSGIX(disp, parameters) (*((disp)->TagSampleBufferSGIX)) parameters +#define GET_TagSampleBufferSGIX(disp) ((disp)->TagSampleBufferSGIX) +#define SET_TagSampleBufferSGIX(disp, fn) ((disp)->TagSampleBufferSGIX = fn) +#define CALL_ReferencePlaneSGIX(disp, parameters) (*((disp)->ReferencePlaneSGIX)) parameters +#define GET_ReferencePlaneSGIX(disp) ((disp)->ReferencePlaneSGIX) +#define SET_ReferencePlaneSGIX(disp, fn) ((disp)->ReferencePlaneSGIX = fn) +#define CALL_FlushRasterSGIX(disp, parameters) (*((disp)->FlushRasterSGIX)) parameters +#define GET_FlushRasterSGIX(disp) ((disp)->FlushRasterSGIX) +#define SET_FlushRasterSGIX(disp, fn) ((disp)->FlushRasterSGIX = fn) +#define CALL_GetListParameterfvSGIX(disp, parameters) (*((disp)->GetListParameterfvSGIX)) parameters +#define GET_GetListParameterfvSGIX(disp) ((disp)->GetListParameterfvSGIX) +#define SET_GetListParameterfvSGIX(disp, fn) ((disp)->GetListParameterfvSGIX = fn) +#define CALL_GetListParameterivSGIX(disp, parameters) (*((disp)->GetListParameterivSGIX)) parameters +#define GET_GetListParameterivSGIX(disp) ((disp)->GetListParameterivSGIX) +#define SET_GetListParameterivSGIX(disp, fn) ((disp)->GetListParameterivSGIX = fn) +#define CALL_ListParameterfSGIX(disp, parameters) (*((disp)->ListParameterfSGIX)) parameters +#define GET_ListParameterfSGIX(disp) ((disp)->ListParameterfSGIX) +#define SET_ListParameterfSGIX(disp, fn) ((disp)->ListParameterfSGIX = fn) +#define CALL_ListParameterfvSGIX(disp, parameters) (*((disp)->ListParameterfvSGIX)) parameters +#define GET_ListParameterfvSGIX(disp) ((disp)->ListParameterfvSGIX) +#define SET_ListParameterfvSGIX(disp, fn) ((disp)->ListParameterfvSGIX = fn) +#define CALL_ListParameteriSGIX(disp, parameters) (*((disp)->ListParameteriSGIX)) parameters +#define GET_ListParameteriSGIX(disp) ((disp)->ListParameteriSGIX) +#define SET_ListParameteriSGIX(disp, fn) ((disp)->ListParameteriSGIX = fn) +#define CALL_ListParameterivSGIX(disp, parameters) (*((disp)->ListParameterivSGIX)) parameters +#define GET_ListParameterivSGIX(disp) ((disp)->ListParameterivSGIX) +#define SET_ListParameterivSGIX(disp, fn) ((disp)->ListParameterivSGIX = fn) +#define CALL_FragmentColorMaterialSGIX(disp, parameters) (*((disp)->FragmentColorMaterialSGIX)) parameters +#define GET_FragmentColorMaterialSGIX(disp) ((disp)->FragmentColorMaterialSGIX) +#define SET_FragmentColorMaterialSGIX(disp, fn) ((disp)->FragmentColorMaterialSGIX = fn) +#define CALL_FragmentLightfSGIX(disp, parameters) (*((disp)->FragmentLightfSGIX)) parameters +#define GET_FragmentLightfSGIX(disp) ((disp)->FragmentLightfSGIX) +#define SET_FragmentLightfSGIX(disp, fn) ((disp)->FragmentLightfSGIX = fn) +#define CALL_FragmentLightfvSGIX(disp, parameters) (*((disp)->FragmentLightfvSGIX)) parameters +#define GET_FragmentLightfvSGIX(disp) ((disp)->FragmentLightfvSGIX) +#define SET_FragmentLightfvSGIX(disp, fn) ((disp)->FragmentLightfvSGIX = fn) +#define CALL_FragmentLightiSGIX(disp, parameters) (*((disp)->FragmentLightiSGIX)) parameters +#define GET_FragmentLightiSGIX(disp) ((disp)->FragmentLightiSGIX) +#define SET_FragmentLightiSGIX(disp, fn) ((disp)->FragmentLightiSGIX = fn) +#define CALL_FragmentLightivSGIX(disp, parameters) (*((disp)->FragmentLightivSGIX)) parameters +#define GET_FragmentLightivSGIX(disp) ((disp)->FragmentLightivSGIX) +#define SET_FragmentLightivSGIX(disp, fn) ((disp)->FragmentLightivSGIX = fn) +#define CALL_FragmentLightModelfSGIX(disp, parameters) (*((disp)->FragmentLightModelfSGIX)) parameters +#define GET_FragmentLightModelfSGIX(disp) ((disp)->FragmentLightModelfSGIX) +#define SET_FragmentLightModelfSGIX(disp, fn) ((disp)->FragmentLightModelfSGIX = fn) +#define CALL_FragmentLightModelfvSGIX(disp, parameters) (*((disp)->FragmentLightModelfvSGIX)) parameters +#define GET_FragmentLightModelfvSGIX(disp) ((disp)->FragmentLightModelfvSGIX) +#define SET_FragmentLightModelfvSGIX(disp, fn) ((disp)->FragmentLightModelfvSGIX = fn) +#define CALL_FragmentLightModeliSGIX(disp, parameters) (*((disp)->FragmentLightModeliSGIX)) parameters +#define GET_FragmentLightModeliSGIX(disp) ((disp)->FragmentLightModeliSGIX) +#define SET_FragmentLightModeliSGIX(disp, fn) ((disp)->FragmentLightModeliSGIX = fn) +#define CALL_FragmentLightModelivSGIX(disp, parameters) (*((disp)->FragmentLightModelivSGIX)) parameters +#define GET_FragmentLightModelivSGIX(disp) ((disp)->FragmentLightModelivSGIX) +#define SET_FragmentLightModelivSGIX(disp, fn) ((disp)->FragmentLightModelivSGIX = fn) +#define CALL_FragmentMaterialfSGIX(disp, parameters) (*((disp)->FragmentMaterialfSGIX)) parameters +#define GET_FragmentMaterialfSGIX(disp) ((disp)->FragmentMaterialfSGIX) +#define SET_FragmentMaterialfSGIX(disp, fn) ((disp)->FragmentMaterialfSGIX = fn) +#define CALL_FragmentMaterialfvSGIX(disp, parameters) (*((disp)->FragmentMaterialfvSGIX)) parameters +#define GET_FragmentMaterialfvSGIX(disp) ((disp)->FragmentMaterialfvSGIX) +#define SET_FragmentMaterialfvSGIX(disp, fn) ((disp)->FragmentMaterialfvSGIX = fn) +#define CALL_FragmentMaterialiSGIX(disp, parameters) (*((disp)->FragmentMaterialiSGIX)) parameters +#define GET_FragmentMaterialiSGIX(disp) ((disp)->FragmentMaterialiSGIX) +#define SET_FragmentMaterialiSGIX(disp, fn) ((disp)->FragmentMaterialiSGIX = fn) +#define CALL_FragmentMaterialivSGIX(disp, parameters) (*((disp)->FragmentMaterialivSGIX)) parameters +#define GET_FragmentMaterialivSGIX(disp) ((disp)->FragmentMaterialivSGIX) +#define SET_FragmentMaterialivSGIX(disp, fn) ((disp)->FragmentMaterialivSGIX = fn) +#define CALL_GetFragmentLightfvSGIX(disp, parameters) (*((disp)->GetFragmentLightfvSGIX)) parameters +#define GET_GetFragmentLightfvSGIX(disp) ((disp)->GetFragmentLightfvSGIX) +#define SET_GetFragmentLightfvSGIX(disp, fn) ((disp)->GetFragmentLightfvSGIX = fn) +#define CALL_GetFragmentLightivSGIX(disp, parameters) (*((disp)->GetFragmentLightivSGIX)) parameters +#define GET_GetFragmentLightivSGIX(disp) ((disp)->GetFragmentLightivSGIX) +#define SET_GetFragmentLightivSGIX(disp, fn) ((disp)->GetFragmentLightivSGIX = fn) +#define CALL_GetFragmentMaterialfvSGIX(disp, parameters) (*((disp)->GetFragmentMaterialfvSGIX)) parameters +#define GET_GetFragmentMaterialfvSGIX(disp) ((disp)->GetFragmentMaterialfvSGIX) +#define SET_GetFragmentMaterialfvSGIX(disp, fn) ((disp)->GetFragmentMaterialfvSGIX = fn) +#define CALL_GetFragmentMaterialivSGIX(disp, parameters) (*((disp)->GetFragmentMaterialivSGIX)) parameters +#define GET_GetFragmentMaterialivSGIX(disp) ((disp)->GetFragmentMaterialivSGIX) +#define SET_GetFragmentMaterialivSGIX(disp, fn) ((disp)->GetFragmentMaterialivSGIX = fn) +#define CALL_LightEnviSGIX(disp, parameters) (*((disp)->LightEnviSGIX)) parameters +#define GET_LightEnviSGIX(disp) ((disp)->LightEnviSGIX) +#define SET_LightEnviSGIX(disp, fn) ((disp)->LightEnviSGIX = fn) +#define CALL_VertexWeightfEXT(disp, parameters) (*((disp)->VertexWeightfEXT)) parameters +#define GET_VertexWeightfEXT(disp) ((disp)->VertexWeightfEXT) +#define SET_VertexWeightfEXT(disp, fn) ((disp)->VertexWeightfEXT = fn) +#define CALL_VertexWeightfvEXT(disp, parameters) (*((disp)->VertexWeightfvEXT)) parameters +#define GET_VertexWeightfvEXT(disp) ((disp)->VertexWeightfvEXT) +#define SET_VertexWeightfvEXT(disp, fn) ((disp)->VertexWeightfvEXT = fn) +#define CALL_VertexWeightPointerEXT(disp, parameters) (*((disp)->VertexWeightPointerEXT)) parameters +#define GET_VertexWeightPointerEXT(disp) ((disp)->VertexWeightPointerEXT) +#define SET_VertexWeightPointerEXT(disp, fn) ((disp)->VertexWeightPointerEXT = fn) +#define CALL_FlushVertexArrayRangeNV(disp, parameters) (*((disp)->FlushVertexArrayRangeNV)) parameters +#define GET_FlushVertexArrayRangeNV(disp) ((disp)->FlushVertexArrayRangeNV) +#define SET_FlushVertexArrayRangeNV(disp, fn) ((disp)->FlushVertexArrayRangeNV = fn) +#define CALL_VertexArrayRangeNV(disp, parameters) (*((disp)->VertexArrayRangeNV)) parameters +#define GET_VertexArrayRangeNV(disp) ((disp)->VertexArrayRangeNV) +#define SET_VertexArrayRangeNV(disp, fn) ((disp)->VertexArrayRangeNV = fn) +#define CALL_CombinerParameterfvNV(disp, parameters) (*((disp)->CombinerParameterfvNV)) parameters +#define GET_CombinerParameterfvNV(disp) ((disp)->CombinerParameterfvNV) +#define SET_CombinerParameterfvNV(disp, fn) ((disp)->CombinerParameterfvNV = fn) +#define CALL_CombinerParameterfNV(disp, parameters) (*((disp)->CombinerParameterfNV)) parameters +#define GET_CombinerParameterfNV(disp) ((disp)->CombinerParameterfNV) +#define SET_CombinerParameterfNV(disp, fn) ((disp)->CombinerParameterfNV = fn) +#define CALL_CombinerParameterivNV(disp, parameters) (*((disp)->CombinerParameterivNV)) parameters +#define GET_CombinerParameterivNV(disp) ((disp)->CombinerParameterivNV) +#define SET_CombinerParameterivNV(disp, fn) ((disp)->CombinerParameterivNV = fn) +#define CALL_CombinerParameteriNV(disp, parameters) (*((disp)->CombinerParameteriNV)) parameters +#define GET_CombinerParameteriNV(disp) ((disp)->CombinerParameteriNV) +#define SET_CombinerParameteriNV(disp, fn) ((disp)->CombinerParameteriNV = fn) +#define CALL_CombinerInputNV(disp, parameters) (*((disp)->CombinerInputNV)) parameters +#define GET_CombinerInputNV(disp) ((disp)->CombinerInputNV) +#define SET_CombinerInputNV(disp, fn) ((disp)->CombinerInputNV = fn) +#define CALL_CombinerOutputNV(disp, parameters) (*((disp)->CombinerOutputNV)) parameters +#define GET_CombinerOutputNV(disp) ((disp)->CombinerOutputNV) +#define SET_CombinerOutputNV(disp, fn) ((disp)->CombinerOutputNV = fn) +#define CALL_FinalCombinerInputNV(disp, parameters) (*((disp)->FinalCombinerInputNV)) parameters +#define GET_FinalCombinerInputNV(disp) ((disp)->FinalCombinerInputNV) +#define SET_FinalCombinerInputNV(disp, fn) ((disp)->FinalCombinerInputNV = fn) +#define CALL_GetCombinerInputParameterfvNV(disp, parameters) (*((disp)->GetCombinerInputParameterfvNV)) parameters +#define GET_GetCombinerInputParameterfvNV(disp) ((disp)->GetCombinerInputParameterfvNV) +#define SET_GetCombinerInputParameterfvNV(disp, fn) ((disp)->GetCombinerInputParameterfvNV = fn) +#define CALL_GetCombinerInputParameterivNV(disp, parameters) (*((disp)->GetCombinerInputParameterivNV)) parameters +#define GET_GetCombinerInputParameterivNV(disp) ((disp)->GetCombinerInputParameterivNV) +#define SET_GetCombinerInputParameterivNV(disp, fn) ((disp)->GetCombinerInputParameterivNV = fn) +#define CALL_GetCombinerOutputParameterfvNV(disp, parameters) (*((disp)->GetCombinerOutputParameterfvNV)) parameters +#define GET_GetCombinerOutputParameterfvNV(disp) ((disp)->GetCombinerOutputParameterfvNV) +#define SET_GetCombinerOutputParameterfvNV(disp, fn) ((disp)->GetCombinerOutputParameterfvNV = fn) +#define CALL_GetCombinerOutputParameterivNV(disp, parameters) (*((disp)->GetCombinerOutputParameterivNV)) parameters +#define GET_GetCombinerOutputParameterivNV(disp) ((disp)->GetCombinerOutputParameterivNV) +#define SET_GetCombinerOutputParameterivNV(disp, fn) ((disp)->GetCombinerOutputParameterivNV = fn) +#define CALL_GetFinalCombinerInputParameterfvNV(disp, parameters) (*((disp)->GetFinalCombinerInputParameterfvNV)) parameters +#define GET_GetFinalCombinerInputParameterfvNV(disp) ((disp)->GetFinalCombinerInputParameterfvNV) +#define SET_GetFinalCombinerInputParameterfvNV(disp, fn) ((disp)->GetFinalCombinerInputParameterfvNV = fn) +#define CALL_GetFinalCombinerInputParameterivNV(disp, parameters) (*((disp)->GetFinalCombinerInputParameterivNV)) parameters +#define GET_GetFinalCombinerInputParameterivNV(disp) ((disp)->GetFinalCombinerInputParameterivNV) +#define SET_GetFinalCombinerInputParameterivNV(disp, fn) ((disp)->GetFinalCombinerInputParameterivNV = fn) +#define CALL_ResizeBuffersMESA(disp, parameters) (*((disp)->ResizeBuffersMESA)) parameters +#define GET_ResizeBuffersMESA(disp) ((disp)->ResizeBuffersMESA) +#define SET_ResizeBuffersMESA(disp, fn) ((disp)->ResizeBuffersMESA = fn) +#define CALL_WindowPos2dMESA(disp, parameters) (*((disp)->WindowPos2dMESA)) parameters +#define GET_WindowPos2dMESA(disp) ((disp)->WindowPos2dMESA) +#define SET_WindowPos2dMESA(disp, fn) ((disp)->WindowPos2dMESA = fn) +#define CALL_WindowPos2dvMESA(disp, parameters) (*((disp)->WindowPos2dvMESA)) parameters +#define GET_WindowPos2dvMESA(disp) ((disp)->WindowPos2dvMESA) +#define SET_WindowPos2dvMESA(disp, fn) ((disp)->WindowPos2dvMESA = fn) +#define CALL_WindowPos2fMESA(disp, parameters) (*((disp)->WindowPos2fMESA)) parameters +#define GET_WindowPos2fMESA(disp) ((disp)->WindowPos2fMESA) +#define SET_WindowPos2fMESA(disp, fn) ((disp)->WindowPos2fMESA = fn) +#define CALL_WindowPos2fvMESA(disp, parameters) (*((disp)->WindowPos2fvMESA)) parameters +#define GET_WindowPos2fvMESA(disp) ((disp)->WindowPos2fvMESA) +#define SET_WindowPos2fvMESA(disp, fn) ((disp)->WindowPos2fvMESA = fn) +#define CALL_WindowPos2iMESA(disp, parameters) (*((disp)->WindowPos2iMESA)) parameters +#define GET_WindowPos2iMESA(disp) ((disp)->WindowPos2iMESA) +#define SET_WindowPos2iMESA(disp, fn) ((disp)->WindowPos2iMESA = fn) +#define CALL_WindowPos2ivMESA(disp, parameters) (*((disp)->WindowPos2ivMESA)) parameters +#define GET_WindowPos2ivMESA(disp) ((disp)->WindowPos2ivMESA) +#define SET_WindowPos2ivMESA(disp, fn) ((disp)->WindowPos2ivMESA = fn) +#define CALL_WindowPos2sMESA(disp, parameters) (*((disp)->WindowPos2sMESA)) parameters +#define GET_WindowPos2sMESA(disp) ((disp)->WindowPos2sMESA) +#define SET_WindowPos2sMESA(disp, fn) ((disp)->WindowPos2sMESA = fn) +#define CALL_WindowPos2svMESA(disp, parameters) (*((disp)->WindowPos2svMESA)) parameters +#define GET_WindowPos2svMESA(disp) ((disp)->WindowPos2svMESA) +#define SET_WindowPos2svMESA(disp, fn) ((disp)->WindowPos2svMESA = fn) +#define CALL_WindowPos3dMESA(disp, parameters) (*((disp)->WindowPos3dMESA)) parameters +#define GET_WindowPos3dMESA(disp) ((disp)->WindowPos3dMESA) +#define SET_WindowPos3dMESA(disp, fn) ((disp)->WindowPos3dMESA = fn) +#define CALL_WindowPos3dvMESA(disp, parameters) (*((disp)->WindowPos3dvMESA)) parameters +#define GET_WindowPos3dvMESA(disp) ((disp)->WindowPos3dvMESA) +#define SET_WindowPos3dvMESA(disp, fn) ((disp)->WindowPos3dvMESA = fn) +#define CALL_WindowPos3fMESA(disp, parameters) (*((disp)->WindowPos3fMESA)) parameters +#define GET_WindowPos3fMESA(disp) ((disp)->WindowPos3fMESA) +#define SET_WindowPos3fMESA(disp, fn) ((disp)->WindowPos3fMESA = fn) +#define CALL_WindowPos3fvMESA(disp, parameters) (*((disp)->WindowPos3fvMESA)) parameters +#define GET_WindowPos3fvMESA(disp) ((disp)->WindowPos3fvMESA) +#define SET_WindowPos3fvMESA(disp, fn) ((disp)->WindowPos3fvMESA = fn) +#define CALL_WindowPos3iMESA(disp, parameters) (*((disp)->WindowPos3iMESA)) parameters +#define GET_WindowPos3iMESA(disp) ((disp)->WindowPos3iMESA) +#define SET_WindowPos3iMESA(disp, fn) ((disp)->WindowPos3iMESA = fn) +#define CALL_WindowPos3ivMESA(disp, parameters) (*((disp)->WindowPos3ivMESA)) parameters +#define GET_WindowPos3ivMESA(disp) ((disp)->WindowPos3ivMESA) +#define SET_WindowPos3ivMESA(disp, fn) ((disp)->WindowPos3ivMESA = fn) +#define CALL_WindowPos3sMESA(disp, parameters) (*((disp)->WindowPos3sMESA)) parameters +#define GET_WindowPos3sMESA(disp) ((disp)->WindowPos3sMESA) +#define SET_WindowPos3sMESA(disp, fn) ((disp)->WindowPos3sMESA = fn) +#define CALL_WindowPos3svMESA(disp, parameters) (*((disp)->WindowPos3svMESA)) parameters +#define GET_WindowPos3svMESA(disp) ((disp)->WindowPos3svMESA) +#define SET_WindowPos3svMESA(disp, fn) ((disp)->WindowPos3svMESA = fn) +#define CALL_WindowPos4dMESA(disp, parameters) (*((disp)->WindowPos4dMESA)) parameters +#define GET_WindowPos4dMESA(disp) ((disp)->WindowPos4dMESA) +#define SET_WindowPos4dMESA(disp, fn) ((disp)->WindowPos4dMESA = fn) +#define CALL_WindowPos4dvMESA(disp, parameters) (*((disp)->WindowPos4dvMESA)) parameters +#define GET_WindowPos4dvMESA(disp) ((disp)->WindowPos4dvMESA) +#define SET_WindowPos4dvMESA(disp, fn) ((disp)->WindowPos4dvMESA = fn) +#define CALL_WindowPos4fMESA(disp, parameters) (*((disp)->WindowPos4fMESA)) parameters +#define GET_WindowPos4fMESA(disp) ((disp)->WindowPos4fMESA) +#define SET_WindowPos4fMESA(disp, fn) ((disp)->WindowPos4fMESA = fn) +#define CALL_WindowPos4fvMESA(disp, parameters) (*((disp)->WindowPos4fvMESA)) parameters +#define GET_WindowPos4fvMESA(disp) ((disp)->WindowPos4fvMESA) +#define SET_WindowPos4fvMESA(disp, fn) ((disp)->WindowPos4fvMESA = fn) +#define CALL_WindowPos4iMESA(disp, parameters) (*((disp)->WindowPos4iMESA)) parameters +#define GET_WindowPos4iMESA(disp) ((disp)->WindowPos4iMESA) +#define SET_WindowPos4iMESA(disp, fn) ((disp)->WindowPos4iMESA = fn) +#define CALL_WindowPos4ivMESA(disp, parameters) (*((disp)->WindowPos4ivMESA)) parameters +#define GET_WindowPos4ivMESA(disp) ((disp)->WindowPos4ivMESA) +#define SET_WindowPos4ivMESA(disp, fn) ((disp)->WindowPos4ivMESA = fn) +#define CALL_WindowPos4sMESA(disp, parameters) (*((disp)->WindowPos4sMESA)) parameters +#define GET_WindowPos4sMESA(disp) ((disp)->WindowPos4sMESA) +#define SET_WindowPos4sMESA(disp, fn) ((disp)->WindowPos4sMESA = fn) +#define CALL_WindowPos4svMESA(disp, parameters) (*((disp)->WindowPos4svMESA)) parameters +#define GET_WindowPos4svMESA(disp) ((disp)->WindowPos4svMESA) +#define SET_WindowPos4svMESA(disp, fn) ((disp)->WindowPos4svMESA = fn) +#define CALL_BlendFuncSeparateEXT(disp, parameters) (*((disp)->BlendFuncSeparateEXT)) parameters +#define GET_BlendFuncSeparateEXT(disp) ((disp)->BlendFuncSeparateEXT) +#define SET_BlendFuncSeparateEXT(disp, fn) ((disp)->BlendFuncSeparateEXT = fn) +#define CALL_IndexMaterialEXT(disp, parameters) (*((disp)->IndexMaterialEXT)) parameters +#define GET_IndexMaterialEXT(disp) ((disp)->IndexMaterialEXT) +#define SET_IndexMaterialEXT(disp, fn) ((disp)->IndexMaterialEXT = fn) +#define CALL_IndexFuncEXT(disp, parameters) (*((disp)->IndexFuncEXT)) parameters +#define GET_IndexFuncEXT(disp) ((disp)->IndexFuncEXT) +#define SET_IndexFuncEXT(disp, fn) ((disp)->IndexFuncEXT = fn) +#define CALL_LockArraysEXT(disp, parameters) (*((disp)->LockArraysEXT)) parameters +#define GET_LockArraysEXT(disp) ((disp)->LockArraysEXT) +#define SET_LockArraysEXT(disp, fn) ((disp)->LockArraysEXT = fn) +#define CALL_UnlockArraysEXT(disp, parameters) (*((disp)->UnlockArraysEXT)) parameters +#define GET_UnlockArraysEXT(disp) ((disp)->UnlockArraysEXT) +#define SET_UnlockArraysEXT(disp, fn) ((disp)->UnlockArraysEXT = fn) +#define CALL_CullParameterdvEXT(disp, parameters) (*((disp)->CullParameterdvEXT)) parameters +#define GET_CullParameterdvEXT(disp) ((disp)->CullParameterdvEXT) +#define SET_CullParameterdvEXT(disp, fn) ((disp)->CullParameterdvEXT = fn) +#define CALL_CullParameterfvEXT(disp, parameters) (*((disp)->CullParameterfvEXT)) parameters +#define GET_CullParameterfvEXT(disp) ((disp)->CullParameterfvEXT) +#define SET_CullParameterfvEXT(disp, fn) ((disp)->CullParameterfvEXT = fn) +#define CALL_HintPGI(disp, parameters) (*((disp)->HintPGI)) parameters +#define GET_HintPGI(disp) ((disp)->HintPGI) +#define SET_HintPGI(disp, fn) ((disp)->HintPGI = fn) +#define CALL_FogCoordfEXT(disp, parameters) (*((disp)->FogCoordfEXT)) parameters +#define GET_FogCoordfEXT(disp) ((disp)->FogCoordfEXT) +#define SET_FogCoordfEXT(disp, fn) ((disp)->FogCoordfEXT = fn) +#define CALL_FogCoordfvEXT(disp, parameters) (*((disp)->FogCoordfvEXT)) parameters +#define GET_FogCoordfvEXT(disp) ((disp)->FogCoordfvEXT) +#define SET_FogCoordfvEXT(disp, fn) ((disp)->FogCoordfvEXT = fn) +#define CALL_FogCoorddEXT(disp, parameters) (*((disp)->FogCoorddEXT)) parameters +#define GET_FogCoorddEXT(disp) ((disp)->FogCoorddEXT) +#define SET_FogCoorddEXT(disp, fn) ((disp)->FogCoorddEXT = fn) +#define CALL_FogCoorddvEXT(disp, parameters) (*((disp)->FogCoorddvEXT)) parameters +#define GET_FogCoorddvEXT(disp) ((disp)->FogCoorddvEXT) +#define SET_FogCoorddvEXT(disp, fn) ((disp)->FogCoorddvEXT = fn) +#define CALL_FogCoordPointerEXT(disp, parameters) (*((disp)->FogCoordPointerEXT)) parameters +#define GET_FogCoordPointerEXT(disp) ((disp)->FogCoordPointerEXT) +#define SET_FogCoordPointerEXT(disp, fn) ((disp)->FogCoordPointerEXT = fn) +#define CALL_GetColorTableEXT(disp, parameters) (*((disp)->GetColorTableEXT)) parameters +#define GET_GetColorTableEXT(disp) ((disp)->GetColorTableEXT) +#define SET_GetColorTableEXT(disp, fn) ((disp)->GetColorTableEXT = fn) +#define CALL_GetColorTableParameterivEXT(disp, parameters) (*((disp)->GetColorTableParameterivEXT)) parameters +#define GET_GetColorTableParameterivEXT(disp) ((disp)->GetColorTableParameterivEXT) +#define SET_GetColorTableParameterivEXT(disp, fn) ((disp)->GetColorTableParameterivEXT = fn) +#define CALL_GetColorTableParameterfvEXT(disp, parameters) (*((disp)->GetColorTableParameterfvEXT)) parameters +#define GET_GetColorTableParameterfvEXT(disp) ((disp)->GetColorTableParameterfvEXT) +#define SET_GetColorTableParameterfvEXT(disp, fn) ((disp)->GetColorTableParameterfvEXT = fn) +#define CALL_TbufferMask3DFX(disp, parameters) (*((disp)->TbufferMask3DFX)) parameters +#define GET_TbufferMask3DFX(disp) ((disp)->TbufferMask3DFX) +#define SET_TbufferMask3DFX(disp, fn) ((disp)->TbufferMask3DFX = fn) +#define CALL_CompressedTexImage3DARB(disp, parameters) (*((disp)->CompressedTexImage3DARB)) parameters +#define GET_CompressedTexImage3DARB(disp) ((disp)->CompressedTexImage3DARB) +#define SET_CompressedTexImage3DARB(disp, fn) ((disp)->CompressedTexImage3DARB = fn) +#define CALL_CompressedTexImage2DARB(disp, parameters) (*((disp)->CompressedTexImage2DARB)) parameters +#define GET_CompressedTexImage2DARB(disp) ((disp)->CompressedTexImage2DARB) +#define SET_CompressedTexImage2DARB(disp, fn) ((disp)->CompressedTexImage2DARB = fn) +#define CALL_CompressedTexImage1DARB(disp, parameters) (*((disp)->CompressedTexImage1DARB)) parameters +#define GET_CompressedTexImage1DARB(disp) ((disp)->CompressedTexImage1DARB) +#define SET_CompressedTexImage1DARB(disp, fn) ((disp)->CompressedTexImage1DARB = fn) +#define CALL_CompressedTexSubImage3DARB(disp, parameters) (*((disp)->CompressedTexSubImage3DARB)) parameters +#define GET_CompressedTexSubImage3DARB(disp) ((disp)->CompressedTexSubImage3DARB) +#define SET_CompressedTexSubImage3DARB(disp, fn) ((disp)->CompressedTexSubImage3DARB = fn) +#define CALL_CompressedTexSubImage2DARB(disp, parameters) (*((disp)->CompressedTexSubImage2DARB)) parameters +#define GET_CompressedTexSubImage2DARB(disp) ((disp)->CompressedTexSubImage2DARB) +#define SET_CompressedTexSubImage2DARB(disp, fn) ((disp)->CompressedTexSubImage2DARB = fn) +#define CALL_CompressedTexSubImage1DARB(disp, parameters) (*((disp)->CompressedTexSubImage1DARB)) parameters +#define GET_CompressedTexSubImage1DARB(disp) ((disp)->CompressedTexSubImage1DARB) +#define SET_CompressedTexSubImage1DARB(disp, fn) ((disp)->CompressedTexSubImage1DARB = fn) +#define CALL_GetCompressedTexImageARB(disp, parameters) (*((disp)->GetCompressedTexImageARB)) parameters +#define GET_GetCompressedTexImageARB(disp) ((disp)->GetCompressedTexImageARB) +#define SET_GetCompressedTexImageARB(disp, fn) ((disp)->GetCompressedTexImageARB = fn) +#define CALL_SecondaryColor3bEXT(disp, parameters) (*((disp)->SecondaryColor3bEXT)) parameters +#define GET_SecondaryColor3bEXT(disp) ((disp)->SecondaryColor3bEXT) +#define SET_SecondaryColor3bEXT(disp, fn) ((disp)->SecondaryColor3bEXT = fn) +#define CALL_SecondaryColor3bvEXT(disp, parameters) (*((disp)->SecondaryColor3bvEXT)) parameters +#define GET_SecondaryColor3bvEXT(disp) ((disp)->SecondaryColor3bvEXT) +#define SET_SecondaryColor3bvEXT(disp, fn) ((disp)->SecondaryColor3bvEXT = fn) +#define CALL_SecondaryColor3dEXT(disp, parameters) (*((disp)->SecondaryColor3dEXT)) parameters +#define GET_SecondaryColor3dEXT(disp) ((disp)->SecondaryColor3dEXT) +#define SET_SecondaryColor3dEXT(disp, fn) ((disp)->SecondaryColor3dEXT = fn) +#define CALL_SecondaryColor3dvEXT(disp, parameters) (*((disp)->SecondaryColor3dvEXT)) parameters +#define GET_SecondaryColor3dvEXT(disp) ((disp)->SecondaryColor3dvEXT) +#define SET_SecondaryColor3dvEXT(disp, fn) ((disp)->SecondaryColor3dvEXT = fn) +#define CALL_SecondaryColor3fEXT(disp, parameters) (*((disp)->SecondaryColor3fEXT)) parameters +#define GET_SecondaryColor3fEXT(disp) ((disp)->SecondaryColor3fEXT) +#define SET_SecondaryColor3fEXT(disp, fn) ((disp)->SecondaryColor3fEXT = fn) +#define CALL_SecondaryColor3fvEXT(disp, parameters) (*((disp)->SecondaryColor3fvEXT)) parameters +#define GET_SecondaryColor3fvEXT(disp) ((disp)->SecondaryColor3fvEXT) +#define SET_SecondaryColor3fvEXT(disp, fn) ((disp)->SecondaryColor3fvEXT = fn) +#define CALL_SecondaryColor3iEXT(disp, parameters) (*((disp)->SecondaryColor3iEXT)) parameters +#define GET_SecondaryColor3iEXT(disp) ((disp)->SecondaryColor3iEXT) +#define SET_SecondaryColor3iEXT(disp, fn) ((disp)->SecondaryColor3iEXT = fn) +#define CALL_SecondaryColor3ivEXT(disp, parameters) (*((disp)->SecondaryColor3ivEXT)) parameters +#define GET_SecondaryColor3ivEXT(disp) ((disp)->SecondaryColor3ivEXT) +#define SET_SecondaryColor3ivEXT(disp, fn) ((disp)->SecondaryColor3ivEXT = fn) +#define CALL_SecondaryColor3sEXT(disp, parameters) (*((disp)->SecondaryColor3sEXT)) parameters +#define GET_SecondaryColor3sEXT(disp) ((disp)->SecondaryColor3sEXT) +#define SET_SecondaryColor3sEXT(disp, fn) ((disp)->SecondaryColor3sEXT = fn) +#define CALL_SecondaryColor3svEXT(disp, parameters) (*((disp)->SecondaryColor3svEXT)) parameters +#define GET_SecondaryColor3svEXT(disp) ((disp)->SecondaryColor3svEXT) +#define SET_SecondaryColor3svEXT(disp, fn) ((disp)->SecondaryColor3svEXT = fn) +#define CALL_SecondaryColor3ubEXT(disp, parameters) (*((disp)->SecondaryColor3ubEXT)) parameters +#define GET_SecondaryColor3ubEXT(disp) ((disp)->SecondaryColor3ubEXT) +#define SET_SecondaryColor3ubEXT(disp, fn) ((disp)->SecondaryColor3ubEXT = fn) +#define CALL_SecondaryColor3ubvEXT(disp, parameters) (*((disp)->SecondaryColor3ubvEXT)) parameters +#define GET_SecondaryColor3ubvEXT(disp) ((disp)->SecondaryColor3ubvEXT) +#define SET_SecondaryColor3ubvEXT(disp, fn) ((disp)->SecondaryColor3ubvEXT = fn) +#define CALL_SecondaryColor3uiEXT(disp, parameters) (*((disp)->SecondaryColor3uiEXT)) parameters +#define GET_SecondaryColor3uiEXT(disp) ((disp)->SecondaryColor3uiEXT) +#define SET_SecondaryColor3uiEXT(disp, fn) ((disp)->SecondaryColor3uiEXT = fn) +#define CALL_SecondaryColor3uivEXT(disp, parameters) (*((disp)->SecondaryColor3uivEXT)) parameters +#define GET_SecondaryColor3uivEXT(disp) ((disp)->SecondaryColor3uivEXT) +#define SET_SecondaryColor3uivEXT(disp, fn) ((disp)->SecondaryColor3uivEXT = fn) +#define CALL_SecondaryColor3usEXT(disp, parameters) (*((disp)->SecondaryColor3usEXT)) parameters +#define GET_SecondaryColor3usEXT(disp) ((disp)->SecondaryColor3usEXT) +#define SET_SecondaryColor3usEXT(disp, fn) ((disp)->SecondaryColor3usEXT = fn) +#define CALL_SecondaryColor3usvEXT(disp, parameters) (*((disp)->SecondaryColor3usvEXT)) parameters +#define GET_SecondaryColor3usvEXT(disp) ((disp)->SecondaryColor3usvEXT) +#define SET_SecondaryColor3usvEXT(disp, fn) ((disp)->SecondaryColor3usvEXT = fn) +#define CALL_SecondaryColorPointerEXT(disp, parameters) (*((disp)->SecondaryColorPointerEXT)) parameters +#define GET_SecondaryColorPointerEXT(disp) ((disp)->SecondaryColorPointerEXT) +#define SET_SecondaryColorPointerEXT(disp, fn) ((disp)->SecondaryColorPointerEXT = fn) +#define CALL_AreProgramsResidentNV(disp, parameters) (*((disp)->AreProgramsResidentNV)) parameters +#define GET_AreProgramsResidentNV(disp) ((disp)->AreProgramsResidentNV) +#define SET_AreProgramsResidentNV(disp, fn) ((disp)->AreProgramsResidentNV = fn) +#define CALL_BindProgramNV(disp, parameters) (*((disp)->BindProgramNV)) parameters +#define GET_BindProgramNV(disp) ((disp)->BindProgramNV) +#define SET_BindProgramNV(disp, fn) ((disp)->BindProgramNV = fn) +#define CALL_DeleteProgramsNV(disp, parameters) (*((disp)->DeleteProgramsNV)) parameters +#define GET_DeleteProgramsNV(disp) ((disp)->DeleteProgramsNV) +#define SET_DeleteProgramsNV(disp, fn) ((disp)->DeleteProgramsNV = fn) +#define CALL_ExecuteProgramNV(disp, parameters) (*((disp)->ExecuteProgramNV)) parameters +#define GET_ExecuteProgramNV(disp) ((disp)->ExecuteProgramNV) +#define SET_ExecuteProgramNV(disp, fn) ((disp)->ExecuteProgramNV = fn) +#define CALL_GenProgramsNV(disp, parameters) (*((disp)->GenProgramsNV)) parameters +#define GET_GenProgramsNV(disp) ((disp)->GenProgramsNV) +#define SET_GenProgramsNV(disp, fn) ((disp)->GenProgramsNV = fn) +#define CALL_GetProgramParameterdvNV(disp, parameters) (*((disp)->GetProgramParameterdvNV)) parameters +#define GET_GetProgramParameterdvNV(disp) ((disp)->GetProgramParameterdvNV) +#define SET_GetProgramParameterdvNV(disp, fn) ((disp)->GetProgramParameterdvNV = fn) +#define CALL_GetProgramParameterfvNV(disp, parameters) (*((disp)->GetProgramParameterfvNV)) parameters +#define GET_GetProgramParameterfvNV(disp) ((disp)->GetProgramParameterfvNV) +#define SET_GetProgramParameterfvNV(disp, fn) ((disp)->GetProgramParameterfvNV = fn) +#define CALL_GetProgramivNV(disp, parameters) (*((disp)->GetProgramivNV)) parameters +#define GET_GetProgramivNV(disp) ((disp)->GetProgramivNV) +#define SET_GetProgramivNV(disp, fn) ((disp)->GetProgramivNV = fn) +#define CALL_GetProgramStringNV(disp, parameters) (*((disp)->GetProgramStringNV)) parameters +#define GET_GetProgramStringNV(disp) ((disp)->GetProgramStringNV) +#define SET_GetProgramStringNV(disp, fn) ((disp)->GetProgramStringNV = fn) +#define CALL_GetTrackMatrixivNV(disp, parameters) (*((disp)->GetTrackMatrixivNV)) parameters +#define GET_GetTrackMatrixivNV(disp) ((disp)->GetTrackMatrixivNV) +#define SET_GetTrackMatrixivNV(disp, fn) ((disp)->GetTrackMatrixivNV = fn) +#define CALL_GetVertexAttribdvARB(disp, parameters) (*((disp)->GetVertexAttribdvARB)) parameters +#define GET_GetVertexAttribdvARB(disp) ((disp)->GetVertexAttribdvARB) +#define SET_GetVertexAttribdvARB(disp, fn) ((disp)->GetVertexAttribdvARB = fn) +#define CALL_GetVertexAttribfvARB(disp, parameters) (*((disp)->GetVertexAttribfvARB)) parameters +#define GET_GetVertexAttribfvARB(disp) ((disp)->GetVertexAttribfvARB) +#define SET_GetVertexAttribfvARB(disp, fn) ((disp)->GetVertexAttribfvARB = fn) +#define CALL_GetVertexAttribivARB(disp, parameters) (*((disp)->GetVertexAttribivARB)) parameters +#define GET_GetVertexAttribivARB(disp) ((disp)->GetVertexAttribivARB) +#define SET_GetVertexAttribivARB(disp, fn) ((disp)->GetVertexAttribivARB = fn) +#define CALL_GetVertexAttribPointervNV(disp, parameters) (*((disp)->GetVertexAttribPointervNV)) parameters +#define GET_GetVertexAttribPointervNV(disp) ((disp)->GetVertexAttribPointervNV) +#define SET_GetVertexAttribPointervNV(disp, fn) ((disp)->GetVertexAttribPointervNV = fn) +#define CALL_IsProgramNV(disp, parameters) (*((disp)->IsProgramNV)) parameters +#define GET_IsProgramNV(disp) ((disp)->IsProgramNV) +#define SET_IsProgramNV(disp, fn) ((disp)->IsProgramNV = fn) +#define CALL_LoadProgramNV(disp, parameters) (*((disp)->LoadProgramNV)) parameters +#define GET_LoadProgramNV(disp) ((disp)->LoadProgramNV) +#define SET_LoadProgramNV(disp, fn) ((disp)->LoadProgramNV = fn) +#define CALL_ProgramParameter4dNV(disp, parameters) (*((disp)->ProgramParameter4dNV)) parameters +#define GET_ProgramParameter4dNV(disp) ((disp)->ProgramParameter4dNV) +#define SET_ProgramParameter4dNV(disp, fn) ((disp)->ProgramParameter4dNV = fn) +#define CALL_ProgramParameter4dvNV(disp, parameters) (*((disp)->ProgramParameter4dvNV)) parameters +#define GET_ProgramParameter4dvNV(disp) ((disp)->ProgramParameter4dvNV) +#define SET_ProgramParameter4dvNV(disp, fn) ((disp)->ProgramParameter4dvNV = fn) +#define CALL_ProgramParameter4fNV(disp, parameters) (*((disp)->ProgramParameter4fNV)) parameters +#define GET_ProgramParameter4fNV(disp) ((disp)->ProgramParameter4fNV) +#define SET_ProgramParameter4fNV(disp, fn) ((disp)->ProgramParameter4fNV = fn) +#define CALL_ProgramParameter4fvNV(disp, parameters) (*((disp)->ProgramParameter4fvNV)) parameters +#define GET_ProgramParameter4fvNV(disp) ((disp)->ProgramParameter4fvNV) +#define SET_ProgramParameter4fvNV(disp, fn) ((disp)->ProgramParameter4fvNV = fn) +#define CALL_ProgramParameters4dvNV(disp, parameters) (*((disp)->ProgramParameters4dvNV)) parameters +#define GET_ProgramParameters4dvNV(disp) ((disp)->ProgramParameters4dvNV) +#define SET_ProgramParameters4dvNV(disp, fn) ((disp)->ProgramParameters4dvNV = fn) +#define CALL_ProgramParameters4fvNV(disp, parameters) (*((disp)->ProgramParameters4fvNV)) parameters +#define GET_ProgramParameters4fvNV(disp) ((disp)->ProgramParameters4fvNV) +#define SET_ProgramParameters4fvNV(disp, fn) ((disp)->ProgramParameters4fvNV = fn) +#define CALL_RequestResidentProgramsNV(disp, parameters) (*((disp)->RequestResidentProgramsNV)) parameters +#define GET_RequestResidentProgramsNV(disp) ((disp)->RequestResidentProgramsNV) +#define SET_RequestResidentProgramsNV(disp, fn) ((disp)->RequestResidentProgramsNV = fn) +#define CALL_TrackMatrixNV(disp, parameters) (*((disp)->TrackMatrixNV)) parameters +#define GET_TrackMatrixNV(disp) ((disp)->TrackMatrixNV) +#define SET_TrackMatrixNV(disp, fn) ((disp)->TrackMatrixNV = fn) +#define CALL_VertexAttribPointerNV(disp, parameters) (*((disp)->VertexAttribPointerNV)) parameters +#define GET_VertexAttribPointerNV(disp) ((disp)->VertexAttribPointerNV) +#define SET_VertexAttribPointerNV(disp, fn) ((disp)->VertexAttribPointerNV = fn) +#define CALL_VertexAttrib1dARB(disp, parameters) (*((disp)->VertexAttrib1dARB)) parameters +#define GET_VertexAttrib1dARB(disp) ((disp)->VertexAttrib1dARB) +#define SET_VertexAttrib1dARB(disp, fn) ((disp)->VertexAttrib1dARB = fn) +#define CALL_VertexAttrib1dvARB(disp, parameters) (*((disp)->VertexAttrib1dvARB)) parameters +#define GET_VertexAttrib1dvARB(disp) ((disp)->VertexAttrib1dvARB) +#define SET_VertexAttrib1dvARB(disp, fn) ((disp)->VertexAttrib1dvARB = fn) +#define CALL_VertexAttrib1fARB(disp, parameters) (*((disp)->VertexAttrib1fARB)) parameters +#define GET_VertexAttrib1fARB(disp) ((disp)->VertexAttrib1fARB) +#define SET_VertexAttrib1fARB(disp, fn) ((disp)->VertexAttrib1fARB = fn) +#define CALL_VertexAttrib1fvARB(disp, parameters) (*((disp)->VertexAttrib1fvARB)) parameters +#define GET_VertexAttrib1fvARB(disp) ((disp)->VertexAttrib1fvARB) +#define SET_VertexAttrib1fvARB(disp, fn) ((disp)->VertexAttrib1fvARB = fn) +#define CALL_VertexAttrib1sARB(disp, parameters) (*((disp)->VertexAttrib1sARB)) parameters +#define GET_VertexAttrib1sARB(disp) ((disp)->VertexAttrib1sARB) +#define SET_VertexAttrib1sARB(disp, fn) ((disp)->VertexAttrib1sARB = fn) +#define CALL_VertexAttrib1svARB(disp, parameters) (*((disp)->VertexAttrib1svARB)) parameters +#define GET_VertexAttrib1svARB(disp) ((disp)->VertexAttrib1svARB) +#define SET_VertexAttrib1svARB(disp, fn) ((disp)->VertexAttrib1svARB = fn) +#define CALL_VertexAttrib2dARB(disp, parameters) (*((disp)->VertexAttrib2dARB)) parameters +#define GET_VertexAttrib2dARB(disp) ((disp)->VertexAttrib2dARB) +#define SET_VertexAttrib2dARB(disp, fn) ((disp)->VertexAttrib2dARB = fn) +#define CALL_VertexAttrib2dvARB(disp, parameters) (*((disp)->VertexAttrib2dvARB)) parameters +#define GET_VertexAttrib2dvARB(disp) ((disp)->VertexAttrib2dvARB) +#define SET_VertexAttrib2dvARB(disp, fn) ((disp)->VertexAttrib2dvARB = fn) +#define CALL_VertexAttrib2fARB(disp, parameters) (*((disp)->VertexAttrib2fARB)) parameters +#define GET_VertexAttrib2fARB(disp) ((disp)->VertexAttrib2fARB) +#define SET_VertexAttrib2fARB(disp, fn) ((disp)->VertexAttrib2fARB = fn) +#define CALL_VertexAttrib2fvARB(disp, parameters) (*((disp)->VertexAttrib2fvARB)) parameters +#define GET_VertexAttrib2fvARB(disp) ((disp)->VertexAttrib2fvARB) +#define SET_VertexAttrib2fvARB(disp, fn) ((disp)->VertexAttrib2fvARB = fn) +#define CALL_VertexAttrib2sARB(disp, parameters) (*((disp)->VertexAttrib2sARB)) parameters +#define GET_VertexAttrib2sARB(disp) ((disp)->VertexAttrib2sARB) +#define SET_VertexAttrib2sARB(disp, fn) ((disp)->VertexAttrib2sARB = fn) +#define CALL_VertexAttrib2svARB(disp, parameters) (*((disp)->VertexAttrib2svARB)) parameters +#define GET_VertexAttrib2svARB(disp) ((disp)->VertexAttrib2svARB) +#define SET_VertexAttrib2svARB(disp, fn) ((disp)->VertexAttrib2svARB = fn) +#define CALL_VertexAttrib3dARB(disp, parameters) (*((disp)->VertexAttrib3dARB)) parameters +#define GET_VertexAttrib3dARB(disp) ((disp)->VertexAttrib3dARB) +#define SET_VertexAttrib3dARB(disp, fn) ((disp)->VertexAttrib3dARB = fn) +#define CALL_VertexAttrib3dvARB(disp, parameters) (*((disp)->VertexAttrib3dvARB)) parameters +#define GET_VertexAttrib3dvARB(disp) ((disp)->VertexAttrib3dvARB) +#define SET_VertexAttrib3dvARB(disp, fn) ((disp)->VertexAttrib3dvARB = fn) +#define CALL_VertexAttrib3fARB(disp, parameters) (*((disp)->VertexAttrib3fARB)) parameters +#define GET_VertexAttrib3fARB(disp) ((disp)->VertexAttrib3fARB) +#define SET_VertexAttrib3fARB(disp, fn) ((disp)->VertexAttrib3fARB = fn) +#define CALL_VertexAttrib3fvARB(disp, parameters) (*((disp)->VertexAttrib3fvARB)) parameters +#define GET_VertexAttrib3fvARB(disp) ((disp)->VertexAttrib3fvARB) +#define SET_VertexAttrib3fvARB(disp, fn) ((disp)->VertexAttrib3fvARB = fn) +#define CALL_VertexAttrib3sARB(disp, parameters) (*((disp)->VertexAttrib3sARB)) parameters +#define GET_VertexAttrib3sARB(disp) ((disp)->VertexAttrib3sARB) +#define SET_VertexAttrib3sARB(disp, fn) ((disp)->VertexAttrib3sARB = fn) +#define CALL_VertexAttrib3svARB(disp, parameters) (*((disp)->VertexAttrib3svARB)) parameters +#define GET_VertexAttrib3svARB(disp) ((disp)->VertexAttrib3svARB) +#define SET_VertexAttrib3svARB(disp, fn) ((disp)->VertexAttrib3svARB = fn) +#define CALL_VertexAttrib4dARB(disp, parameters) (*((disp)->VertexAttrib4dARB)) parameters +#define GET_VertexAttrib4dARB(disp) ((disp)->VertexAttrib4dARB) +#define SET_VertexAttrib4dARB(disp, fn) ((disp)->VertexAttrib4dARB = fn) +#define CALL_VertexAttrib4dvARB(disp, parameters) (*((disp)->VertexAttrib4dvARB)) parameters +#define GET_VertexAttrib4dvARB(disp) ((disp)->VertexAttrib4dvARB) +#define SET_VertexAttrib4dvARB(disp, fn) ((disp)->VertexAttrib4dvARB = fn) +#define CALL_VertexAttrib4fARB(disp, parameters) (*((disp)->VertexAttrib4fARB)) parameters +#define GET_VertexAttrib4fARB(disp) ((disp)->VertexAttrib4fARB) +#define SET_VertexAttrib4fARB(disp, fn) ((disp)->VertexAttrib4fARB = fn) +#define CALL_VertexAttrib4fvARB(disp, parameters) (*((disp)->VertexAttrib4fvARB)) parameters +#define GET_VertexAttrib4fvARB(disp) ((disp)->VertexAttrib4fvARB) +#define SET_VertexAttrib4fvARB(disp, fn) ((disp)->VertexAttrib4fvARB = fn) +#define CALL_VertexAttrib4sARB(disp, parameters) (*((disp)->VertexAttrib4sARB)) parameters +#define GET_VertexAttrib4sARB(disp) ((disp)->VertexAttrib4sARB) +#define SET_VertexAttrib4sARB(disp, fn) ((disp)->VertexAttrib4sARB = fn) +#define CALL_VertexAttrib4svARB(disp, parameters) (*((disp)->VertexAttrib4svARB)) parameters +#define GET_VertexAttrib4svARB(disp) ((disp)->VertexAttrib4svARB) +#define SET_VertexAttrib4svARB(disp, fn) ((disp)->VertexAttrib4svARB = fn) +#define CALL_VertexAttrib4NubARB(disp, parameters) (*((disp)->VertexAttrib4NubARB)) parameters +#define GET_VertexAttrib4NubARB(disp) ((disp)->VertexAttrib4NubARB) +#define SET_VertexAttrib4NubARB(disp, fn) ((disp)->VertexAttrib4NubARB = fn) +#define CALL_VertexAttrib4NubvARB(disp, parameters) (*((disp)->VertexAttrib4NubvARB)) parameters +#define GET_VertexAttrib4NubvARB(disp) ((disp)->VertexAttrib4NubvARB) +#define SET_VertexAttrib4NubvARB(disp, fn) ((disp)->VertexAttrib4NubvARB = fn) +#define CALL_VertexAttribs1dvNV(disp, parameters) (*((disp)->VertexAttribs1dvNV)) parameters +#define GET_VertexAttribs1dvNV(disp) ((disp)->VertexAttribs1dvNV) +#define SET_VertexAttribs1dvNV(disp, fn) ((disp)->VertexAttribs1dvNV = fn) +#define CALL_VertexAttribs1fvNV(disp, parameters) (*((disp)->VertexAttribs1fvNV)) parameters +#define GET_VertexAttribs1fvNV(disp) ((disp)->VertexAttribs1fvNV) +#define SET_VertexAttribs1fvNV(disp, fn) ((disp)->VertexAttribs1fvNV = fn) +#define CALL_VertexAttribs1svNV(disp, parameters) (*((disp)->VertexAttribs1svNV)) parameters +#define GET_VertexAttribs1svNV(disp) ((disp)->VertexAttribs1svNV) +#define SET_VertexAttribs1svNV(disp, fn) ((disp)->VertexAttribs1svNV = fn) +#define CALL_VertexAttribs2dvNV(disp, parameters) (*((disp)->VertexAttribs2dvNV)) parameters +#define GET_VertexAttribs2dvNV(disp) ((disp)->VertexAttribs2dvNV) +#define SET_VertexAttribs2dvNV(disp, fn) ((disp)->VertexAttribs2dvNV = fn) +#define CALL_VertexAttribs2fvNV(disp, parameters) (*((disp)->VertexAttribs2fvNV)) parameters +#define GET_VertexAttribs2fvNV(disp) ((disp)->VertexAttribs2fvNV) +#define SET_VertexAttribs2fvNV(disp, fn) ((disp)->VertexAttribs2fvNV = fn) +#define CALL_VertexAttribs2svNV(disp, parameters) (*((disp)->VertexAttribs2svNV)) parameters +#define GET_VertexAttribs2svNV(disp) ((disp)->VertexAttribs2svNV) +#define SET_VertexAttribs2svNV(disp, fn) ((disp)->VertexAttribs2svNV = fn) +#define CALL_VertexAttribs3dvNV(disp, parameters) (*((disp)->VertexAttribs3dvNV)) parameters +#define GET_VertexAttribs3dvNV(disp) ((disp)->VertexAttribs3dvNV) +#define SET_VertexAttribs3dvNV(disp, fn) ((disp)->VertexAttribs3dvNV = fn) +#define CALL_VertexAttribs3fvNV(disp, parameters) (*((disp)->VertexAttribs3fvNV)) parameters +#define GET_VertexAttribs3fvNV(disp) ((disp)->VertexAttribs3fvNV) +#define SET_VertexAttribs3fvNV(disp, fn) ((disp)->VertexAttribs3fvNV = fn) +#define CALL_VertexAttribs3svNV(disp, parameters) (*((disp)->VertexAttribs3svNV)) parameters +#define GET_VertexAttribs3svNV(disp) ((disp)->VertexAttribs3svNV) +#define SET_VertexAttribs3svNV(disp, fn) ((disp)->VertexAttribs3svNV = fn) +#define CALL_VertexAttribs4dvNV(disp, parameters) (*((disp)->VertexAttribs4dvNV)) parameters +#define GET_VertexAttribs4dvNV(disp) ((disp)->VertexAttribs4dvNV) +#define SET_VertexAttribs4dvNV(disp, fn) ((disp)->VertexAttribs4dvNV = fn) +#define CALL_VertexAttribs4fvNV(disp, parameters) (*((disp)->VertexAttribs4fvNV)) parameters +#define GET_VertexAttribs4fvNV(disp) ((disp)->VertexAttribs4fvNV) +#define SET_VertexAttribs4fvNV(disp, fn) ((disp)->VertexAttribs4fvNV = fn) +#define CALL_VertexAttribs4svNV(disp, parameters) (*((disp)->VertexAttribs4svNV)) parameters +#define GET_VertexAttribs4svNV(disp) ((disp)->VertexAttribs4svNV) +#define SET_VertexAttribs4svNV(disp, fn) ((disp)->VertexAttribs4svNV = fn) +#define CALL_VertexAttribs4ubvNV(disp, parameters) (*((disp)->VertexAttribs4ubvNV)) parameters +#define GET_VertexAttribs4ubvNV(disp) ((disp)->VertexAttribs4ubvNV) +#define SET_VertexAttribs4ubvNV(disp, fn) ((disp)->VertexAttribs4ubvNV = fn) +#define CALL_PointParameteriNV(disp, parameters) (*((disp)->PointParameteriNV)) parameters +#define GET_PointParameteriNV(disp) ((disp)->PointParameteriNV) +#define SET_PointParameteriNV(disp, fn) ((disp)->PointParameteriNV = fn) +#define CALL_PointParameterivNV(disp, parameters) (*((disp)->PointParameterivNV)) parameters +#define GET_PointParameterivNV(disp) ((disp)->PointParameterivNV) +#define SET_PointParameterivNV(disp, fn) ((disp)->PointParameterivNV = fn) +#define CALL_MultiDrawArraysEXT(disp, parameters) (*((disp)->MultiDrawArraysEXT)) parameters +#define GET_MultiDrawArraysEXT(disp) ((disp)->MultiDrawArraysEXT) +#define SET_MultiDrawArraysEXT(disp, fn) ((disp)->MultiDrawArraysEXT = fn) +#define CALL_MultiDrawElementsEXT(disp, parameters) (*((disp)->MultiDrawElementsEXT)) parameters +#define GET_MultiDrawElementsEXT(disp) ((disp)->MultiDrawElementsEXT) +#define SET_MultiDrawElementsEXT(disp, fn) ((disp)->MultiDrawElementsEXT = fn) +#define CALL_ActiveStencilFaceEXT(disp, parameters) (*((disp)->ActiveStencilFaceEXT)) parameters +#define GET_ActiveStencilFaceEXT(disp) ((disp)->ActiveStencilFaceEXT) +#define SET_ActiveStencilFaceEXT(disp, fn) ((disp)->ActiveStencilFaceEXT = fn) +#define CALL_DeleteFencesNV(disp, parameters) (*((disp)->DeleteFencesNV)) parameters +#define GET_DeleteFencesNV(disp) ((disp)->DeleteFencesNV) +#define SET_DeleteFencesNV(disp, fn) ((disp)->DeleteFencesNV = fn) +#define CALL_GenFencesNV(disp, parameters) (*((disp)->GenFencesNV)) parameters +#define GET_GenFencesNV(disp) ((disp)->GenFencesNV) +#define SET_GenFencesNV(disp, fn) ((disp)->GenFencesNV = fn) +#define CALL_IsFenceNV(disp, parameters) (*((disp)->IsFenceNV)) parameters +#define GET_IsFenceNV(disp) ((disp)->IsFenceNV) +#define SET_IsFenceNV(disp, fn) ((disp)->IsFenceNV = fn) +#define CALL_TestFenceNV(disp, parameters) (*((disp)->TestFenceNV)) parameters +#define GET_TestFenceNV(disp) ((disp)->TestFenceNV) +#define SET_TestFenceNV(disp, fn) ((disp)->TestFenceNV = fn) +#define CALL_GetFenceivNV(disp, parameters) (*((disp)->GetFenceivNV)) parameters +#define GET_GetFenceivNV(disp) ((disp)->GetFenceivNV) +#define SET_GetFenceivNV(disp, fn) ((disp)->GetFenceivNV = fn) +#define CALL_FinishFenceNV(disp, parameters) (*((disp)->FinishFenceNV)) parameters +#define GET_FinishFenceNV(disp) ((disp)->FinishFenceNV) +#define SET_FinishFenceNV(disp, fn) ((disp)->FinishFenceNV = fn) +#define CALL_SetFenceNV(disp, parameters) (*((disp)->SetFenceNV)) parameters +#define GET_SetFenceNV(disp) ((disp)->SetFenceNV) +#define SET_SetFenceNV(disp, fn) ((disp)->SetFenceNV = fn) +#define CALL_VertexAttrib4bvARB(disp, parameters) (*((disp)->VertexAttrib4bvARB)) parameters +#define GET_VertexAttrib4bvARB(disp) ((disp)->VertexAttrib4bvARB) +#define SET_VertexAttrib4bvARB(disp, fn) ((disp)->VertexAttrib4bvARB = fn) +#define CALL_VertexAttrib4ivARB(disp, parameters) (*((disp)->VertexAttrib4ivARB)) parameters +#define GET_VertexAttrib4ivARB(disp) ((disp)->VertexAttrib4ivARB) +#define SET_VertexAttrib4ivARB(disp, fn) ((disp)->VertexAttrib4ivARB = fn) +#define CALL_VertexAttrib4ubvARB(disp, parameters) (*((disp)->VertexAttrib4ubvARB)) parameters +#define GET_VertexAttrib4ubvARB(disp) ((disp)->VertexAttrib4ubvARB) +#define SET_VertexAttrib4ubvARB(disp, fn) ((disp)->VertexAttrib4ubvARB = fn) +#define CALL_VertexAttrib4usvARB(disp, parameters) (*((disp)->VertexAttrib4usvARB)) parameters +#define GET_VertexAttrib4usvARB(disp) ((disp)->VertexAttrib4usvARB) +#define SET_VertexAttrib4usvARB(disp, fn) ((disp)->VertexAttrib4usvARB = fn) +#define CALL_VertexAttrib4uivARB(disp, parameters) (*((disp)->VertexAttrib4uivARB)) parameters +#define GET_VertexAttrib4uivARB(disp) ((disp)->VertexAttrib4uivARB) +#define SET_VertexAttrib4uivARB(disp, fn) ((disp)->VertexAttrib4uivARB = fn) +#define CALL_VertexAttrib4NbvARB(disp, parameters) (*((disp)->VertexAttrib4NbvARB)) parameters +#define GET_VertexAttrib4NbvARB(disp) ((disp)->VertexAttrib4NbvARB) +#define SET_VertexAttrib4NbvARB(disp, fn) ((disp)->VertexAttrib4NbvARB = fn) +#define CALL_VertexAttrib4NsvARB(disp, parameters) (*((disp)->VertexAttrib4NsvARB)) parameters +#define GET_VertexAttrib4NsvARB(disp) ((disp)->VertexAttrib4NsvARB) +#define SET_VertexAttrib4NsvARB(disp, fn) ((disp)->VertexAttrib4NsvARB = fn) +#define CALL_VertexAttrib4NivARB(disp, parameters) (*((disp)->VertexAttrib4NivARB)) parameters +#define GET_VertexAttrib4NivARB(disp) ((disp)->VertexAttrib4NivARB) +#define SET_VertexAttrib4NivARB(disp, fn) ((disp)->VertexAttrib4NivARB = fn) +#define CALL_VertexAttrib4NusvARB(disp, parameters) (*((disp)->VertexAttrib4NusvARB)) parameters +#define GET_VertexAttrib4NusvARB(disp) ((disp)->VertexAttrib4NusvARB) +#define SET_VertexAttrib4NusvARB(disp, fn) ((disp)->VertexAttrib4NusvARB = fn) +#define CALL_VertexAttrib4NuivARB(disp, parameters) (*((disp)->VertexAttrib4NuivARB)) parameters +#define GET_VertexAttrib4NuivARB(disp) ((disp)->VertexAttrib4NuivARB) +#define SET_VertexAttrib4NuivARB(disp, fn) ((disp)->VertexAttrib4NuivARB = fn) +#define CALL_VertexAttribPointerARB(disp, parameters) (*((disp)->VertexAttribPointerARB)) parameters +#define GET_VertexAttribPointerARB(disp) ((disp)->VertexAttribPointerARB) +#define SET_VertexAttribPointerARB(disp, fn) ((disp)->VertexAttribPointerARB = fn) +#define CALL_EnableVertexAttribArrayARB(disp, parameters) (*((disp)->EnableVertexAttribArrayARB)) parameters +#define GET_EnableVertexAttribArrayARB(disp) ((disp)->EnableVertexAttribArrayARB) +#define SET_EnableVertexAttribArrayARB(disp, fn) ((disp)->EnableVertexAttribArrayARB = fn) +#define CALL_DisableVertexAttribArrayARB(disp, parameters) (*((disp)->DisableVertexAttribArrayARB)) parameters +#define GET_DisableVertexAttribArrayARB(disp) ((disp)->DisableVertexAttribArrayARB) +#define SET_DisableVertexAttribArrayARB(disp, fn) ((disp)->DisableVertexAttribArrayARB = fn) +#define CALL_ProgramStringARB(disp, parameters) (*((disp)->ProgramStringARB)) parameters +#define GET_ProgramStringARB(disp) ((disp)->ProgramStringARB) +#define SET_ProgramStringARB(disp, fn) ((disp)->ProgramStringARB = fn) +#define CALL_ProgramEnvParameter4dARB(disp, parameters) (*((disp)->ProgramEnvParameter4dARB)) parameters +#define GET_ProgramEnvParameter4dARB(disp) ((disp)->ProgramEnvParameter4dARB) +#define SET_ProgramEnvParameter4dARB(disp, fn) ((disp)->ProgramEnvParameter4dARB = fn) +#define CALL_ProgramEnvParameter4dvARB(disp, parameters) (*((disp)->ProgramEnvParameter4dvARB)) parameters +#define GET_ProgramEnvParameter4dvARB(disp) ((disp)->ProgramEnvParameter4dvARB) +#define SET_ProgramEnvParameter4dvARB(disp, fn) ((disp)->ProgramEnvParameter4dvARB = fn) +#define CALL_ProgramEnvParameter4fARB(disp, parameters) (*((disp)->ProgramEnvParameter4fARB)) parameters +#define GET_ProgramEnvParameter4fARB(disp) ((disp)->ProgramEnvParameter4fARB) +#define SET_ProgramEnvParameter4fARB(disp, fn) ((disp)->ProgramEnvParameter4fARB = fn) +#define CALL_ProgramEnvParameter4fvARB(disp, parameters) (*((disp)->ProgramEnvParameter4fvARB)) parameters +#define GET_ProgramEnvParameter4fvARB(disp) ((disp)->ProgramEnvParameter4fvARB) +#define SET_ProgramEnvParameter4fvARB(disp, fn) ((disp)->ProgramEnvParameter4fvARB = fn) +#define CALL_ProgramLocalParameter4dARB(disp, parameters) (*((disp)->ProgramLocalParameter4dARB)) parameters +#define GET_ProgramLocalParameter4dARB(disp) ((disp)->ProgramLocalParameter4dARB) +#define SET_ProgramLocalParameter4dARB(disp, fn) ((disp)->ProgramLocalParameter4dARB = fn) +#define CALL_ProgramLocalParameter4dvARB(disp, parameters) (*((disp)->ProgramLocalParameter4dvARB)) parameters +#define GET_ProgramLocalParameter4dvARB(disp) ((disp)->ProgramLocalParameter4dvARB) +#define SET_ProgramLocalParameter4dvARB(disp, fn) ((disp)->ProgramLocalParameter4dvARB = fn) +#define CALL_ProgramLocalParameter4fARB(disp, parameters) (*((disp)->ProgramLocalParameter4fARB)) parameters +#define GET_ProgramLocalParameter4fARB(disp) ((disp)->ProgramLocalParameter4fARB) +#define SET_ProgramLocalParameter4fARB(disp, fn) ((disp)->ProgramLocalParameter4fARB = fn) +#define CALL_ProgramLocalParameter4fvARB(disp, parameters) (*((disp)->ProgramLocalParameter4fvARB)) parameters +#define GET_ProgramLocalParameter4fvARB(disp) ((disp)->ProgramLocalParameter4fvARB) +#define SET_ProgramLocalParameter4fvARB(disp, fn) ((disp)->ProgramLocalParameter4fvARB = fn) +#define CALL_GetProgramEnvParameterdvARB(disp, parameters) (*((disp)->GetProgramEnvParameterdvARB)) parameters +#define GET_GetProgramEnvParameterdvARB(disp) ((disp)->GetProgramEnvParameterdvARB) +#define SET_GetProgramEnvParameterdvARB(disp, fn) ((disp)->GetProgramEnvParameterdvARB = fn) +#define CALL_GetProgramEnvParameterfvARB(disp, parameters) (*((disp)->GetProgramEnvParameterfvARB)) parameters +#define GET_GetProgramEnvParameterfvARB(disp) ((disp)->GetProgramEnvParameterfvARB) +#define SET_GetProgramEnvParameterfvARB(disp, fn) ((disp)->GetProgramEnvParameterfvARB = fn) +#define CALL_GetProgramLocalParameterdvARB(disp, parameters) (*((disp)->GetProgramLocalParameterdvARB)) parameters +#define GET_GetProgramLocalParameterdvARB(disp) ((disp)->GetProgramLocalParameterdvARB) +#define SET_GetProgramLocalParameterdvARB(disp, fn) ((disp)->GetProgramLocalParameterdvARB = fn) +#define CALL_GetProgramLocalParameterfvARB(disp, parameters) (*((disp)->GetProgramLocalParameterfvARB)) parameters +#define GET_GetProgramLocalParameterfvARB(disp) ((disp)->GetProgramLocalParameterfvARB) +#define SET_GetProgramLocalParameterfvARB(disp, fn) ((disp)->GetProgramLocalParameterfvARB = fn) +#define CALL_GetProgramivARB(disp, parameters) (*((disp)->GetProgramivARB)) parameters +#define GET_GetProgramivARB(disp) ((disp)->GetProgramivARB) +#define SET_GetProgramivARB(disp, fn) ((disp)->GetProgramivARB = fn) +#define CALL_GetProgramStringARB(disp, parameters) (*((disp)->GetProgramStringARB)) parameters +#define GET_GetProgramStringARB(disp) ((disp)->GetProgramStringARB) +#define SET_GetProgramStringARB(disp, fn) ((disp)->GetProgramStringARB = fn) +#define CALL_ProgramNamedParameter4fNV(disp, parameters) (*((disp)->ProgramNamedParameter4fNV)) parameters +#define GET_ProgramNamedParameter4fNV(disp) ((disp)->ProgramNamedParameter4fNV) +#define SET_ProgramNamedParameter4fNV(disp, fn) ((disp)->ProgramNamedParameter4fNV = fn) +#define CALL_ProgramNamedParameter4dNV(disp, parameters) (*((disp)->ProgramNamedParameter4dNV)) parameters +#define GET_ProgramNamedParameter4dNV(disp) ((disp)->ProgramNamedParameter4dNV) +#define SET_ProgramNamedParameter4dNV(disp, fn) ((disp)->ProgramNamedParameter4dNV = fn) +#define CALL_ProgramNamedParameter4fvNV(disp, parameters) (*((disp)->ProgramNamedParameter4fvNV)) parameters +#define GET_ProgramNamedParameter4fvNV(disp) ((disp)->ProgramNamedParameter4fvNV) +#define SET_ProgramNamedParameter4fvNV(disp, fn) ((disp)->ProgramNamedParameter4fvNV = fn) +#define CALL_ProgramNamedParameter4dvNV(disp, parameters) (*((disp)->ProgramNamedParameter4dvNV)) parameters +#define GET_ProgramNamedParameter4dvNV(disp) ((disp)->ProgramNamedParameter4dvNV) +#define SET_ProgramNamedParameter4dvNV(disp, fn) ((disp)->ProgramNamedParameter4dvNV = fn) +#define CALL_GetProgramNamedParameterfvNV(disp, parameters) (*((disp)->GetProgramNamedParameterfvNV)) parameters +#define GET_GetProgramNamedParameterfvNV(disp) ((disp)->GetProgramNamedParameterfvNV) +#define SET_GetProgramNamedParameterfvNV(disp, fn) ((disp)->GetProgramNamedParameterfvNV = fn) +#define CALL_GetProgramNamedParameterdvNV(disp, parameters) (*((disp)->GetProgramNamedParameterdvNV)) parameters +#define GET_GetProgramNamedParameterdvNV(disp) ((disp)->GetProgramNamedParameterdvNV) +#define SET_GetProgramNamedParameterdvNV(disp, fn) ((disp)->GetProgramNamedParameterdvNV = fn) +#define CALL_BindBufferARB(disp, parameters) (*((disp)->BindBufferARB)) parameters +#define GET_BindBufferARB(disp) ((disp)->BindBufferARB) +#define SET_BindBufferARB(disp, fn) ((disp)->BindBufferARB = fn) +#define CALL_BufferDataARB(disp, parameters) (*((disp)->BufferDataARB)) parameters +#define GET_BufferDataARB(disp) ((disp)->BufferDataARB) +#define SET_BufferDataARB(disp, fn) ((disp)->BufferDataARB = fn) +#define CALL_BufferSubDataARB(disp, parameters) (*((disp)->BufferSubDataARB)) parameters +#define GET_BufferSubDataARB(disp) ((disp)->BufferSubDataARB) +#define SET_BufferSubDataARB(disp, fn) ((disp)->BufferSubDataARB = fn) +#define CALL_DeleteBuffersARB(disp, parameters) (*((disp)->DeleteBuffersARB)) parameters +#define GET_DeleteBuffersARB(disp) ((disp)->DeleteBuffersARB) +#define SET_DeleteBuffersARB(disp, fn) ((disp)->DeleteBuffersARB = fn) +#define CALL_GenBuffersARB(disp, parameters) (*((disp)->GenBuffersARB)) parameters +#define GET_GenBuffersARB(disp) ((disp)->GenBuffersARB) +#define SET_GenBuffersARB(disp, fn) ((disp)->GenBuffersARB = fn) +#define CALL_GetBufferParameterivARB(disp, parameters) (*((disp)->GetBufferParameterivARB)) parameters +#define GET_GetBufferParameterivARB(disp) ((disp)->GetBufferParameterivARB) +#define SET_GetBufferParameterivARB(disp, fn) ((disp)->GetBufferParameterivARB = fn) +#define CALL_GetBufferPointervARB(disp, parameters) (*((disp)->GetBufferPointervARB)) parameters +#define GET_GetBufferPointervARB(disp) ((disp)->GetBufferPointervARB) +#define SET_GetBufferPointervARB(disp, fn) ((disp)->GetBufferPointervARB = fn) +#define CALL_GetBufferSubDataARB(disp, parameters) (*((disp)->GetBufferSubDataARB)) parameters +#define GET_GetBufferSubDataARB(disp) ((disp)->GetBufferSubDataARB) +#define SET_GetBufferSubDataARB(disp, fn) ((disp)->GetBufferSubDataARB = fn) +#define CALL_IsBufferARB(disp, parameters) (*((disp)->IsBufferARB)) parameters +#define GET_IsBufferARB(disp) ((disp)->IsBufferARB) +#define SET_IsBufferARB(disp, fn) ((disp)->IsBufferARB = fn) +#define CALL_MapBufferARB(disp, parameters) (*((disp)->MapBufferARB)) parameters +#define GET_MapBufferARB(disp) ((disp)->MapBufferARB) +#define SET_MapBufferARB(disp, fn) ((disp)->MapBufferARB = fn) +#define CALL_UnmapBufferARB(disp, parameters) (*((disp)->UnmapBufferARB)) parameters +#define GET_UnmapBufferARB(disp) ((disp)->UnmapBufferARB) +#define SET_UnmapBufferARB(disp, fn) ((disp)->UnmapBufferARB = fn) +#define CALL_DepthBoundsEXT(disp, parameters) (*((disp)->DepthBoundsEXT)) parameters +#define GET_DepthBoundsEXT(disp) ((disp)->DepthBoundsEXT) +#define SET_DepthBoundsEXT(disp, fn) ((disp)->DepthBoundsEXT = fn) +#define CALL_GenQueriesARB(disp, parameters) (*((disp)->GenQueriesARB)) parameters +#define GET_GenQueriesARB(disp) ((disp)->GenQueriesARB) +#define SET_GenQueriesARB(disp, fn) ((disp)->GenQueriesARB = fn) +#define CALL_DeleteQueriesARB(disp, parameters) (*((disp)->DeleteQueriesARB)) parameters +#define GET_DeleteQueriesARB(disp) ((disp)->DeleteQueriesARB) +#define SET_DeleteQueriesARB(disp, fn) ((disp)->DeleteQueriesARB = fn) +#define CALL_IsQueryARB(disp, parameters) (*((disp)->IsQueryARB)) parameters +#define GET_IsQueryARB(disp) ((disp)->IsQueryARB) +#define SET_IsQueryARB(disp, fn) ((disp)->IsQueryARB = fn) +#define CALL_BeginQueryARB(disp, parameters) (*((disp)->BeginQueryARB)) parameters +#define GET_BeginQueryARB(disp) ((disp)->BeginQueryARB) +#define SET_BeginQueryARB(disp, fn) ((disp)->BeginQueryARB = fn) +#define CALL_EndQueryARB(disp, parameters) (*((disp)->EndQueryARB)) parameters +#define GET_EndQueryARB(disp) ((disp)->EndQueryARB) +#define SET_EndQueryARB(disp, fn) ((disp)->EndQueryARB = fn) +#define CALL_GetQueryivARB(disp, parameters) (*((disp)->GetQueryivARB)) parameters +#define GET_GetQueryivARB(disp) ((disp)->GetQueryivARB) +#define SET_GetQueryivARB(disp, fn) ((disp)->GetQueryivARB = fn) +#define CALL_GetQueryObjectivARB(disp, parameters) (*((disp)->GetQueryObjectivARB)) parameters +#define GET_GetQueryObjectivARB(disp) ((disp)->GetQueryObjectivARB) +#define SET_GetQueryObjectivARB(disp, fn) ((disp)->GetQueryObjectivARB = fn) +#define CALL_GetQueryObjectuivARB(disp, parameters) (*((disp)->GetQueryObjectuivARB)) parameters +#define GET_GetQueryObjectuivARB(disp) ((disp)->GetQueryObjectuivARB) +#define SET_GetQueryObjectuivARB(disp, fn) ((disp)->GetQueryObjectuivARB = fn) +#define CALL_MultiModeDrawArraysIBM(disp, parameters) (*((disp)->MultiModeDrawArraysIBM)) parameters +#define GET_MultiModeDrawArraysIBM(disp) ((disp)->MultiModeDrawArraysIBM) +#define SET_MultiModeDrawArraysIBM(disp, fn) ((disp)->MultiModeDrawArraysIBM = fn) +#define CALL_MultiModeDrawElementsIBM(disp, parameters) (*((disp)->MultiModeDrawElementsIBM)) parameters +#define GET_MultiModeDrawElementsIBM(disp) ((disp)->MultiModeDrawElementsIBM) +#define SET_MultiModeDrawElementsIBM(disp, fn) ((disp)->MultiModeDrawElementsIBM = fn) +#define CALL_BlendEquationSeparateEXT(disp, parameters) (*((disp)->BlendEquationSeparateEXT)) parameters +#define GET_BlendEquationSeparateEXT(disp) ((disp)->BlendEquationSeparateEXT) +#define SET_BlendEquationSeparateEXT(disp, fn) ((disp)->BlendEquationSeparateEXT = fn) +#define CALL_DeleteObjectARB(disp, parameters) (*((disp)->DeleteObjectARB)) parameters +#define GET_DeleteObjectARB(disp) ((disp)->DeleteObjectARB) +#define SET_DeleteObjectARB(disp, fn) ((disp)->DeleteObjectARB = fn) +#define CALL_GetHandleARB(disp, parameters) (*((disp)->GetHandleARB)) parameters +#define GET_GetHandleARB(disp) ((disp)->GetHandleARB) +#define SET_GetHandleARB(disp, fn) ((disp)->GetHandleARB = fn) +#define CALL_DetachObjectARB(disp, parameters) (*((disp)->DetachObjectARB)) parameters +#define GET_DetachObjectARB(disp) ((disp)->DetachObjectARB) +#define SET_DetachObjectARB(disp, fn) ((disp)->DetachObjectARB = fn) +#define CALL_CreateShaderObjectARB(disp, parameters) (*((disp)->CreateShaderObjectARB)) parameters +#define GET_CreateShaderObjectARB(disp) ((disp)->CreateShaderObjectARB) +#define SET_CreateShaderObjectARB(disp, fn) ((disp)->CreateShaderObjectARB = fn) +#define CALL_ShaderSourceARB(disp, parameters) (*((disp)->ShaderSourceARB)) parameters +#define GET_ShaderSourceARB(disp) ((disp)->ShaderSourceARB) +#define SET_ShaderSourceARB(disp, fn) ((disp)->ShaderSourceARB = fn) +#define CALL_CompileShaderARB(disp, parameters) (*((disp)->CompileShaderARB)) parameters +#define GET_CompileShaderARB(disp) ((disp)->CompileShaderARB) +#define SET_CompileShaderARB(disp, fn) ((disp)->CompileShaderARB = fn) +#define CALL_CreateProgramObjectARB(disp, parameters) (*((disp)->CreateProgramObjectARB)) parameters +#define GET_CreateProgramObjectARB(disp) ((disp)->CreateProgramObjectARB) +#define SET_CreateProgramObjectARB(disp, fn) ((disp)->CreateProgramObjectARB = fn) +#define CALL_AttachObjectARB(disp, parameters) (*((disp)->AttachObjectARB)) parameters +#define GET_AttachObjectARB(disp) ((disp)->AttachObjectARB) +#define SET_AttachObjectARB(disp, fn) ((disp)->AttachObjectARB = fn) +#define CALL_LinkProgramARB(disp, parameters) (*((disp)->LinkProgramARB)) parameters +#define GET_LinkProgramARB(disp) ((disp)->LinkProgramARB) +#define SET_LinkProgramARB(disp, fn) ((disp)->LinkProgramARB = fn) +#define CALL_UseProgramObjectARB(disp, parameters) (*((disp)->UseProgramObjectARB)) parameters +#define GET_UseProgramObjectARB(disp) ((disp)->UseProgramObjectARB) +#define SET_UseProgramObjectARB(disp, fn) ((disp)->UseProgramObjectARB = fn) +#define CALL_ValidateProgramARB(disp, parameters) (*((disp)->ValidateProgramARB)) parameters +#define GET_ValidateProgramARB(disp) ((disp)->ValidateProgramARB) +#define SET_ValidateProgramARB(disp, fn) ((disp)->ValidateProgramARB = fn) +#define CALL_Uniform1fARB(disp, parameters) (*((disp)->Uniform1fARB)) parameters +#define GET_Uniform1fARB(disp) ((disp)->Uniform1fARB) +#define SET_Uniform1fARB(disp, fn) ((disp)->Uniform1fARB = fn) +#define CALL_Uniform2fARB(disp, parameters) (*((disp)->Uniform2fARB)) parameters +#define GET_Uniform2fARB(disp) ((disp)->Uniform2fARB) +#define SET_Uniform2fARB(disp, fn) ((disp)->Uniform2fARB = fn) +#define CALL_Uniform3fARB(disp, parameters) (*((disp)->Uniform3fARB)) parameters +#define GET_Uniform3fARB(disp) ((disp)->Uniform3fARB) +#define SET_Uniform3fARB(disp, fn) ((disp)->Uniform3fARB = fn) +#define CALL_Uniform4fARB(disp, parameters) (*((disp)->Uniform4fARB)) parameters +#define GET_Uniform4fARB(disp) ((disp)->Uniform4fARB) +#define SET_Uniform4fARB(disp, fn) ((disp)->Uniform4fARB = fn) +#define CALL_Uniform1iARB(disp, parameters) (*((disp)->Uniform1iARB)) parameters +#define GET_Uniform1iARB(disp) ((disp)->Uniform1iARB) +#define SET_Uniform1iARB(disp, fn) ((disp)->Uniform1iARB = fn) +#define CALL_Uniform2iARB(disp, parameters) (*((disp)->Uniform2iARB)) parameters +#define GET_Uniform2iARB(disp) ((disp)->Uniform2iARB) +#define SET_Uniform2iARB(disp, fn) ((disp)->Uniform2iARB = fn) +#define CALL_Uniform3iARB(disp, parameters) (*((disp)->Uniform3iARB)) parameters +#define GET_Uniform3iARB(disp) ((disp)->Uniform3iARB) +#define SET_Uniform3iARB(disp, fn) ((disp)->Uniform3iARB = fn) +#define CALL_Uniform4iARB(disp, parameters) (*((disp)->Uniform4iARB)) parameters +#define GET_Uniform4iARB(disp) ((disp)->Uniform4iARB) +#define SET_Uniform4iARB(disp, fn) ((disp)->Uniform4iARB = fn) +#define CALL_Uniform1fvARB(disp, parameters) (*((disp)->Uniform1fvARB)) parameters +#define GET_Uniform1fvARB(disp) ((disp)->Uniform1fvARB) +#define SET_Uniform1fvARB(disp, fn) ((disp)->Uniform1fvARB = fn) +#define CALL_Uniform2fvARB(disp, parameters) (*((disp)->Uniform2fvARB)) parameters +#define GET_Uniform2fvARB(disp) ((disp)->Uniform2fvARB) +#define SET_Uniform2fvARB(disp, fn) ((disp)->Uniform2fvARB = fn) +#define CALL_Uniform3fvARB(disp, parameters) (*((disp)->Uniform3fvARB)) parameters +#define GET_Uniform3fvARB(disp) ((disp)->Uniform3fvARB) +#define SET_Uniform3fvARB(disp, fn) ((disp)->Uniform3fvARB = fn) +#define CALL_Uniform4fvARB(disp, parameters) (*((disp)->Uniform4fvARB)) parameters +#define GET_Uniform4fvARB(disp) ((disp)->Uniform4fvARB) +#define SET_Uniform4fvARB(disp, fn) ((disp)->Uniform4fvARB = fn) +#define CALL_Uniform1ivARB(disp, parameters) (*((disp)->Uniform1ivARB)) parameters +#define GET_Uniform1ivARB(disp) ((disp)->Uniform1ivARB) +#define SET_Uniform1ivARB(disp, fn) ((disp)->Uniform1ivARB = fn) +#define CALL_Uniform2ivARB(disp, parameters) (*((disp)->Uniform2ivARB)) parameters +#define GET_Uniform2ivARB(disp) ((disp)->Uniform2ivARB) +#define SET_Uniform2ivARB(disp, fn) ((disp)->Uniform2ivARB = fn) +#define CALL_Uniform3ivARB(disp, parameters) (*((disp)->Uniform3ivARB)) parameters +#define GET_Uniform3ivARB(disp) ((disp)->Uniform3ivARB) +#define SET_Uniform3ivARB(disp, fn) ((disp)->Uniform3ivARB = fn) +#define CALL_Uniform4ivARB(disp, parameters) (*((disp)->Uniform4ivARB)) parameters +#define GET_Uniform4ivARB(disp) ((disp)->Uniform4ivARB) +#define SET_Uniform4ivARB(disp, fn) ((disp)->Uniform4ivARB = fn) +#define CALL_UniformMatrix2fvARB(disp, parameters) (*((disp)->UniformMatrix2fvARB)) parameters +#define GET_UniformMatrix2fvARB(disp) ((disp)->UniformMatrix2fvARB) +#define SET_UniformMatrix2fvARB(disp, fn) ((disp)->UniformMatrix2fvARB = fn) +#define CALL_UniformMatrix3fvARB(disp, parameters) (*((disp)->UniformMatrix3fvARB)) parameters +#define GET_UniformMatrix3fvARB(disp) ((disp)->UniformMatrix3fvARB) +#define SET_UniformMatrix3fvARB(disp, fn) ((disp)->UniformMatrix3fvARB = fn) +#define CALL_UniformMatrix4fvARB(disp, parameters) (*((disp)->UniformMatrix4fvARB)) parameters +#define GET_UniformMatrix4fvARB(disp) ((disp)->UniformMatrix4fvARB) +#define SET_UniformMatrix4fvARB(disp, fn) ((disp)->UniformMatrix4fvARB = fn) +#define CALL_GetObjectParameterfvARB(disp, parameters) (*((disp)->GetObjectParameterfvARB)) parameters +#define GET_GetObjectParameterfvARB(disp) ((disp)->GetObjectParameterfvARB) +#define SET_GetObjectParameterfvARB(disp, fn) ((disp)->GetObjectParameterfvARB = fn) +#define CALL_GetObjectParameterivARB(disp, parameters) (*((disp)->GetObjectParameterivARB)) parameters +#define GET_GetObjectParameterivARB(disp) ((disp)->GetObjectParameterivARB) +#define SET_GetObjectParameterivARB(disp, fn) ((disp)->GetObjectParameterivARB = fn) +#define CALL_GetInfoLogARB(disp, parameters) (*((disp)->GetInfoLogARB)) parameters +#define GET_GetInfoLogARB(disp) ((disp)->GetInfoLogARB) +#define SET_GetInfoLogARB(disp, fn) ((disp)->GetInfoLogARB = fn) +#define CALL_GetAttachedObjectsARB(disp, parameters) (*((disp)->GetAttachedObjectsARB)) parameters +#define GET_GetAttachedObjectsARB(disp) ((disp)->GetAttachedObjectsARB) +#define SET_GetAttachedObjectsARB(disp, fn) ((disp)->GetAttachedObjectsARB = fn) +#define CALL_GetUniformLocationARB(disp, parameters) (*((disp)->GetUniformLocationARB)) parameters +#define GET_GetUniformLocationARB(disp) ((disp)->GetUniformLocationARB) +#define SET_GetUniformLocationARB(disp, fn) ((disp)->GetUniformLocationARB = fn) +#define CALL_GetActiveUniformARB(disp, parameters) (*((disp)->GetActiveUniformARB)) parameters +#define GET_GetActiveUniformARB(disp) ((disp)->GetActiveUniformARB) +#define SET_GetActiveUniformARB(disp, fn) ((disp)->GetActiveUniformARB = fn) +#define CALL_GetUniformfvARB(disp, parameters) (*((disp)->GetUniformfvARB)) parameters +#define GET_GetUniformfvARB(disp) ((disp)->GetUniformfvARB) +#define SET_GetUniformfvARB(disp, fn) ((disp)->GetUniformfvARB = fn) +#define CALL_GetUniformivARB(disp, parameters) (*((disp)->GetUniformivARB)) parameters +#define GET_GetUniformivARB(disp) ((disp)->GetUniformivARB) +#define SET_GetUniformivARB(disp, fn) ((disp)->GetUniformivARB = fn) +#define CALL_GetShaderSourceARB(disp, parameters) (*((disp)->GetShaderSourceARB)) parameters +#define GET_GetShaderSourceARB(disp) ((disp)->GetShaderSourceARB) +#define SET_GetShaderSourceARB(disp, fn) ((disp)->GetShaderSourceARB = fn) +#define CALL_BindAttribLocationARB(disp, parameters) (*((disp)->BindAttribLocationARB)) parameters +#define GET_BindAttribLocationARB(disp) ((disp)->BindAttribLocationARB) +#define SET_BindAttribLocationARB(disp, fn) ((disp)->BindAttribLocationARB = fn) +#define CALL_GetActiveAttribARB(disp, parameters) (*((disp)->GetActiveAttribARB)) parameters +#define GET_GetActiveAttribARB(disp) ((disp)->GetActiveAttribARB) +#define SET_GetActiveAttribARB(disp, fn) ((disp)->GetActiveAttribARB = fn) +#define CALL_GetAttribLocationARB(disp, parameters) (*((disp)->GetAttribLocationARB)) parameters +#define GET_GetAttribLocationARB(disp) ((disp)->GetAttribLocationARB) +#define SET_GetAttribLocationARB(disp, fn) ((disp)->GetAttribLocationARB = fn) +#define CALL_GetVertexAttribdvNV(disp, parameters) (*((disp)->GetVertexAttribdvNV)) parameters +#define GET_GetVertexAttribdvNV(disp) ((disp)->GetVertexAttribdvNV) +#define SET_GetVertexAttribdvNV(disp, fn) ((disp)->GetVertexAttribdvNV = fn) +#define CALL_GetVertexAttribfvNV(disp, parameters) (*((disp)->GetVertexAttribfvNV)) parameters +#define GET_GetVertexAttribfvNV(disp) ((disp)->GetVertexAttribfvNV) +#define SET_GetVertexAttribfvNV(disp, fn) ((disp)->GetVertexAttribfvNV = fn) +#define CALL_GetVertexAttribivNV(disp, parameters) (*((disp)->GetVertexAttribivNV)) parameters +#define GET_GetVertexAttribivNV(disp) ((disp)->GetVertexAttribivNV) +#define SET_GetVertexAttribivNV(disp, fn) ((disp)->GetVertexAttribivNV = fn) +#define CALL_VertexAttrib1dNV(disp, parameters) (*((disp)->VertexAttrib1dNV)) parameters +#define GET_VertexAttrib1dNV(disp) ((disp)->VertexAttrib1dNV) +#define SET_VertexAttrib1dNV(disp, fn) ((disp)->VertexAttrib1dNV = fn) +#define CALL_VertexAttrib1dvNV(disp, parameters) (*((disp)->VertexAttrib1dvNV)) parameters +#define GET_VertexAttrib1dvNV(disp) ((disp)->VertexAttrib1dvNV) +#define SET_VertexAttrib1dvNV(disp, fn) ((disp)->VertexAttrib1dvNV = fn) +#define CALL_VertexAttrib1fNV(disp, parameters) (*((disp)->VertexAttrib1fNV)) parameters +#define GET_VertexAttrib1fNV(disp) ((disp)->VertexAttrib1fNV) +#define SET_VertexAttrib1fNV(disp, fn) ((disp)->VertexAttrib1fNV = fn) +#define CALL_VertexAttrib1fvNV(disp, parameters) (*((disp)->VertexAttrib1fvNV)) parameters +#define GET_VertexAttrib1fvNV(disp) ((disp)->VertexAttrib1fvNV) +#define SET_VertexAttrib1fvNV(disp, fn) ((disp)->VertexAttrib1fvNV = fn) +#define CALL_VertexAttrib1sNV(disp, parameters) (*((disp)->VertexAttrib1sNV)) parameters +#define GET_VertexAttrib1sNV(disp) ((disp)->VertexAttrib1sNV) +#define SET_VertexAttrib1sNV(disp, fn) ((disp)->VertexAttrib1sNV = fn) +#define CALL_VertexAttrib1svNV(disp, parameters) (*((disp)->VertexAttrib1svNV)) parameters +#define GET_VertexAttrib1svNV(disp) ((disp)->VertexAttrib1svNV) +#define SET_VertexAttrib1svNV(disp, fn) ((disp)->VertexAttrib1svNV = fn) +#define CALL_VertexAttrib2dNV(disp, parameters) (*((disp)->VertexAttrib2dNV)) parameters +#define GET_VertexAttrib2dNV(disp) ((disp)->VertexAttrib2dNV) +#define SET_VertexAttrib2dNV(disp, fn) ((disp)->VertexAttrib2dNV = fn) +#define CALL_VertexAttrib2dvNV(disp, parameters) (*((disp)->VertexAttrib2dvNV)) parameters +#define GET_VertexAttrib2dvNV(disp) ((disp)->VertexAttrib2dvNV) +#define SET_VertexAttrib2dvNV(disp, fn) ((disp)->VertexAttrib2dvNV = fn) +#define CALL_VertexAttrib2fNV(disp, parameters) (*((disp)->VertexAttrib2fNV)) parameters +#define GET_VertexAttrib2fNV(disp) ((disp)->VertexAttrib2fNV) +#define SET_VertexAttrib2fNV(disp, fn) ((disp)->VertexAttrib2fNV = fn) +#define CALL_VertexAttrib2fvNV(disp, parameters) (*((disp)->VertexAttrib2fvNV)) parameters +#define GET_VertexAttrib2fvNV(disp) ((disp)->VertexAttrib2fvNV) +#define SET_VertexAttrib2fvNV(disp, fn) ((disp)->VertexAttrib2fvNV = fn) +#define CALL_VertexAttrib2sNV(disp, parameters) (*((disp)->VertexAttrib2sNV)) parameters +#define GET_VertexAttrib2sNV(disp) ((disp)->VertexAttrib2sNV) +#define SET_VertexAttrib2sNV(disp, fn) ((disp)->VertexAttrib2sNV = fn) +#define CALL_VertexAttrib2svNV(disp, parameters) (*((disp)->VertexAttrib2svNV)) parameters +#define GET_VertexAttrib2svNV(disp) ((disp)->VertexAttrib2svNV) +#define SET_VertexAttrib2svNV(disp, fn) ((disp)->VertexAttrib2svNV = fn) +#define CALL_VertexAttrib3dNV(disp, parameters) (*((disp)->VertexAttrib3dNV)) parameters +#define GET_VertexAttrib3dNV(disp) ((disp)->VertexAttrib3dNV) +#define SET_VertexAttrib3dNV(disp, fn) ((disp)->VertexAttrib3dNV = fn) +#define CALL_VertexAttrib3dvNV(disp, parameters) (*((disp)->VertexAttrib3dvNV)) parameters +#define GET_VertexAttrib3dvNV(disp) ((disp)->VertexAttrib3dvNV) +#define SET_VertexAttrib3dvNV(disp, fn) ((disp)->VertexAttrib3dvNV = fn) +#define CALL_VertexAttrib3fNV(disp, parameters) (*((disp)->VertexAttrib3fNV)) parameters +#define GET_VertexAttrib3fNV(disp) ((disp)->VertexAttrib3fNV) +#define SET_VertexAttrib3fNV(disp, fn) ((disp)->VertexAttrib3fNV = fn) +#define CALL_VertexAttrib3fvNV(disp, parameters) (*((disp)->VertexAttrib3fvNV)) parameters +#define GET_VertexAttrib3fvNV(disp) ((disp)->VertexAttrib3fvNV) +#define SET_VertexAttrib3fvNV(disp, fn) ((disp)->VertexAttrib3fvNV = fn) +#define CALL_VertexAttrib3sNV(disp, parameters) (*((disp)->VertexAttrib3sNV)) parameters +#define GET_VertexAttrib3sNV(disp) ((disp)->VertexAttrib3sNV) +#define SET_VertexAttrib3sNV(disp, fn) ((disp)->VertexAttrib3sNV = fn) +#define CALL_VertexAttrib3svNV(disp, parameters) (*((disp)->VertexAttrib3svNV)) parameters +#define GET_VertexAttrib3svNV(disp) ((disp)->VertexAttrib3svNV) +#define SET_VertexAttrib3svNV(disp, fn) ((disp)->VertexAttrib3svNV = fn) +#define CALL_VertexAttrib4dNV(disp, parameters) (*((disp)->VertexAttrib4dNV)) parameters +#define GET_VertexAttrib4dNV(disp) ((disp)->VertexAttrib4dNV) +#define SET_VertexAttrib4dNV(disp, fn) ((disp)->VertexAttrib4dNV = fn) +#define CALL_VertexAttrib4dvNV(disp, parameters) (*((disp)->VertexAttrib4dvNV)) parameters +#define GET_VertexAttrib4dvNV(disp) ((disp)->VertexAttrib4dvNV) +#define SET_VertexAttrib4dvNV(disp, fn) ((disp)->VertexAttrib4dvNV = fn) +#define CALL_VertexAttrib4fNV(disp, parameters) (*((disp)->VertexAttrib4fNV)) parameters +#define GET_VertexAttrib4fNV(disp) ((disp)->VertexAttrib4fNV) +#define SET_VertexAttrib4fNV(disp, fn) ((disp)->VertexAttrib4fNV = fn) +#define CALL_VertexAttrib4fvNV(disp, parameters) (*((disp)->VertexAttrib4fvNV)) parameters +#define GET_VertexAttrib4fvNV(disp) ((disp)->VertexAttrib4fvNV) +#define SET_VertexAttrib4fvNV(disp, fn) ((disp)->VertexAttrib4fvNV = fn) +#define CALL_VertexAttrib4sNV(disp, parameters) (*((disp)->VertexAttrib4sNV)) parameters +#define GET_VertexAttrib4sNV(disp) ((disp)->VertexAttrib4sNV) +#define SET_VertexAttrib4sNV(disp, fn) ((disp)->VertexAttrib4sNV = fn) +#define CALL_VertexAttrib4svNV(disp, parameters) (*((disp)->VertexAttrib4svNV)) parameters +#define GET_VertexAttrib4svNV(disp) ((disp)->VertexAttrib4svNV) +#define SET_VertexAttrib4svNV(disp, fn) ((disp)->VertexAttrib4svNV = fn) +#define CALL_VertexAttrib4ubNV(disp, parameters) (*((disp)->VertexAttrib4ubNV)) parameters +#define GET_VertexAttrib4ubNV(disp) ((disp)->VertexAttrib4ubNV) +#define SET_VertexAttrib4ubNV(disp, fn) ((disp)->VertexAttrib4ubNV = fn) +#define CALL_VertexAttrib4ubvNV(disp, parameters) (*((disp)->VertexAttrib4ubvNV)) parameters +#define GET_VertexAttrib4ubvNV(disp) ((disp)->VertexAttrib4ubvNV) +#define SET_VertexAttrib4ubvNV(disp, fn) ((disp)->VertexAttrib4ubvNV = fn) +#define CALL_GenFragmentShadersATI(disp, parameters) (*((disp)->GenFragmentShadersATI)) parameters +#define GET_GenFragmentShadersATI(disp) ((disp)->GenFragmentShadersATI) +#define SET_GenFragmentShadersATI(disp, fn) ((disp)->GenFragmentShadersATI = fn) +#define CALL_BindFragmentShaderATI(disp, parameters) (*((disp)->BindFragmentShaderATI)) parameters +#define GET_BindFragmentShaderATI(disp) ((disp)->BindFragmentShaderATI) +#define SET_BindFragmentShaderATI(disp, fn) ((disp)->BindFragmentShaderATI = fn) +#define CALL_DeleteFragmentShaderATI(disp, parameters) (*((disp)->DeleteFragmentShaderATI)) parameters +#define GET_DeleteFragmentShaderATI(disp) ((disp)->DeleteFragmentShaderATI) +#define SET_DeleteFragmentShaderATI(disp, fn) ((disp)->DeleteFragmentShaderATI = fn) +#define CALL_BeginFragmentShaderATI(disp, parameters) (*((disp)->BeginFragmentShaderATI)) parameters +#define GET_BeginFragmentShaderATI(disp) ((disp)->BeginFragmentShaderATI) +#define SET_BeginFragmentShaderATI(disp, fn) ((disp)->BeginFragmentShaderATI = fn) +#define CALL_EndFragmentShaderATI(disp, parameters) (*((disp)->EndFragmentShaderATI)) parameters +#define GET_EndFragmentShaderATI(disp) ((disp)->EndFragmentShaderATI) +#define SET_EndFragmentShaderATI(disp, fn) ((disp)->EndFragmentShaderATI = fn) +#define CALL_PassTexCoordATI(disp, parameters) (*((disp)->PassTexCoordATI)) parameters +#define GET_PassTexCoordATI(disp) ((disp)->PassTexCoordATI) +#define SET_PassTexCoordATI(disp, fn) ((disp)->PassTexCoordATI = fn) +#define CALL_SampleMapATI(disp, parameters) (*((disp)->SampleMapATI)) parameters +#define GET_SampleMapATI(disp) ((disp)->SampleMapATI) +#define SET_SampleMapATI(disp, fn) ((disp)->SampleMapATI = fn) +#define CALL_ColorFragmentOp1ATI(disp, parameters) (*((disp)->ColorFragmentOp1ATI)) parameters +#define GET_ColorFragmentOp1ATI(disp) ((disp)->ColorFragmentOp1ATI) +#define SET_ColorFragmentOp1ATI(disp, fn) ((disp)->ColorFragmentOp1ATI = fn) +#define CALL_ColorFragmentOp2ATI(disp, parameters) (*((disp)->ColorFragmentOp2ATI)) parameters +#define GET_ColorFragmentOp2ATI(disp) ((disp)->ColorFragmentOp2ATI) +#define SET_ColorFragmentOp2ATI(disp, fn) ((disp)->ColorFragmentOp2ATI = fn) +#define CALL_ColorFragmentOp3ATI(disp, parameters) (*((disp)->ColorFragmentOp3ATI)) parameters +#define GET_ColorFragmentOp3ATI(disp) ((disp)->ColorFragmentOp3ATI) +#define SET_ColorFragmentOp3ATI(disp, fn) ((disp)->ColorFragmentOp3ATI = fn) +#define CALL_AlphaFragmentOp1ATI(disp, parameters) (*((disp)->AlphaFragmentOp1ATI)) parameters +#define GET_AlphaFragmentOp1ATI(disp) ((disp)->AlphaFragmentOp1ATI) +#define SET_AlphaFragmentOp1ATI(disp, fn) ((disp)->AlphaFragmentOp1ATI = fn) +#define CALL_AlphaFragmentOp2ATI(disp, parameters) (*((disp)->AlphaFragmentOp2ATI)) parameters +#define GET_AlphaFragmentOp2ATI(disp) ((disp)->AlphaFragmentOp2ATI) +#define SET_AlphaFragmentOp2ATI(disp, fn) ((disp)->AlphaFragmentOp2ATI = fn) +#define CALL_AlphaFragmentOp3ATI(disp, parameters) (*((disp)->AlphaFragmentOp3ATI)) parameters +#define GET_AlphaFragmentOp3ATI(disp) ((disp)->AlphaFragmentOp3ATI) +#define SET_AlphaFragmentOp3ATI(disp, fn) ((disp)->AlphaFragmentOp3ATI = fn) +#define CALL_SetFragmentShaderConstantATI(disp, parameters) (*((disp)->SetFragmentShaderConstantATI)) parameters +#define GET_SetFragmentShaderConstantATI(disp) ((disp)->SetFragmentShaderConstantATI) +#define SET_SetFragmentShaderConstantATI(disp, fn) ((disp)->SetFragmentShaderConstantATI = fn) +#define CALL_IsRenderbufferEXT(disp, parameters) (*((disp)->IsRenderbufferEXT)) parameters +#define GET_IsRenderbufferEXT(disp) ((disp)->IsRenderbufferEXT) +#define SET_IsRenderbufferEXT(disp, fn) ((disp)->IsRenderbufferEXT = fn) +#define CALL_BindRenderbufferEXT(disp, parameters) (*((disp)->BindRenderbufferEXT)) parameters +#define GET_BindRenderbufferEXT(disp) ((disp)->BindRenderbufferEXT) +#define SET_BindRenderbufferEXT(disp, fn) ((disp)->BindRenderbufferEXT = fn) +#define CALL_DeleteRenderbuffersEXT(disp, parameters) (*((disp)->DeleteRenderbuffersEXT)) parameters +#define GET_DeleteRenderbuffersEXT(disp) ((disp)->DeleteRenderbuffersEXT) +#define SET_DeleteRenderbuffersEXT(disp, fn) ((disp)->DeleteRenderbuffersEXT = fn) +#define CALL_GenRenderbuffersEXT(disp, parameters) (*((disp)->GenRenderbuffersEXT)) parameters +#define GET_GenRenderbuffersEXT(disp) ((disp)->GenRenderbuffersEXT) +#define SET_GenRenderbuffersEXT(disp, fn) ((disp)->GenRenderbuffersEXT = fn) +#define CALL_RenderbufferStorageEXT(disp, parameters) (*((disp)->RenderbufferStorageEXT)) parameters +#define GET_RenderbufferStorageEXT(disp) ((disp)->RenderbufferStorageEXT) +#define SET_RenderbufferStorageEXT(disp, fn) ((disp)->RenderbufferStorageEXT = fn) +#define CALL_GetRenderbufferParameterivEXT(disp, parameters) (*((disp)->GetRenderbufferParameterivEXT)) parameters +#define GET_GetRenderbufferParameterivEXT(disp) ((disp)->GetRenderbufferParameterivEXT) +#define SET_GetRenderbufferParameterivEXT(disp, fn) ((disp)->GetRenderbufferParameterivEXT = fn) +#define CALL_IsFramebufferEXT(disp, parameters) (*((disp)->IsFramebufferEXT)) parameters +#define GET_IsFramebufferEXT(disp) ((disp)->IsFramebufferEXT) +#define SET_IsFramebufferEXT(disp, fn) ((disp)->IsFramebufferEXT = fn) +#define CALL_BindFramebufferEXT(disp, parameters) (*((disp)->BindFramebufferEXT)) parameters +#define GET_BindFramebufferEXT(disp) ((disp)->BindFramebufferEXT) +#define SET_BindFramebufferEXT(disp, fn) ((disp)->BindFramebufferEXT = fn) +#define CALL_DeleteFramebuffersEXT(disp, parameters) (*((disp)->DeleteFramebuffersEXT)) parameters +#define GET_DeleteFramebuffersEXT(disp) ((disp)->DeleteFramebuffersEXT) +#define SET_DeleteFramebuffersEXT(disp, fn) ((disp)->DeleteFramebuffersEXT = fn) +#define CALL_GenFramebuffersEXT(disp, parameters) (*((disp)->GenFramebuffersEXT)) parameters +#define GET_GenFramebuffersEXT(disp) ((disp)->GenFramebuffersEXT) +#define SET_GenFramebuffersEXT(disp, fn) ((disp)->GenFramebuffersEXT = fn) +#define CALL_CheckFramebufferStatusEXT(disp, parameters) (*((disp)->CheckFramebufferStatusEXT)) parameters +#define GET_CheckFramebufferStatusEXT(disp) ((disp)->CheckFramebufferStatusEXT) +#define SET_CheckFramebufferStatusEXT(disp, fn) ((disp)->CheckFramebufferStatusEXT = fn) +#define CALL_FramebufferTexture1DEXT(disp, parameters) (*((disp)->FramebufferTexture1DEXT)) parameters +#define GET_FramebufferTexture1DEXT(disp) ((disp)->FramebufferTexture1DEXT) +#define SET_FramebufferTexture1DEXT(disp, fn) ((disp)->FramebufferTexture1DEXT = fn) +#define CALL_FramebufferTexture2DEXT(disp, parameters) (*((disp)->FramebufferTexture2DEXT)) parameters +#define GET_FramebufferTexture2DEXT(disp) ((disp)->FramebufferTexture2DEXT) +#define SET_FramebufferTexture2DEXT(disp, fn) ((disp)->FramebufferTexture2DEXT = fn) +#define CALL_FramebufferTexture3DEXT(disp, parameters) (*((disp)->FramebufferTexture3DEXT)) parameters +#define GET_FramebufferTexture3DEXT(disp) ((disp)->FramebufferTexture3DEXT) +#define SET_FramebufferTexture3DEXT(disp, fn) ((disp)->FramebufferTexture3DEXT = fn) +#define CALL_FramebufferRenderbufferEXT(disp, parameters) (*((disp)->FramebufferRenderbufferEXT)) parameters +#define GET_FramebufferRenderbufferEXT(disp) ((disp)->FramebufferRenderbufferEXT) +#define SET_FramebufferRenderbufferEXT(disp, fn) ((disp)->FramebufferRenderbufferEXT = fn) +#define CALL_GetFramebufferAttachmentParameterivEXT(disp, parameters) (*((disp)->GetFramebufferAttachmentParameterivEXT)) parameters +#define GET_GetFramebufferAttachmentParameterivEXT(disp) ((disp)->GetFramebufferAttachmentParameterivEXT) +#define SET_GetFramebufferAttachmentParameterivEXT(disp, fn) ((disp)->GetFramebufferAttachmentParameterivEXT = fn) +#define CALL_GenerateMipmapEXT(disp, parameters) (*((disp)->GenerateMipmapEXT)) parameters +#define GET_GenerateMipmapEXT(disp) ((disp)->GenerateMipmapEXT) +#define SET_GenerateMipmapEXT(disp, fn) ((disp)->GenerateMipmapEXT = fn) +#define CALL_StencilFuncSeparate(disp, parameters) (*((disp)->StencilFuncSeparate)) parameters +#define GET_StencilFuncSeparate(disp) ((disp)->StencilFuncSeparate) +#define SET_StencilFuncSeparate(disp, fn) ((disp)->StencilFuncSeparate = fn) +#define CALL_StencilOpSeparate(disp, parameters) (*((disp)->StencilOpSeparate)) parameters +#define GET_StencilOpSeparate(disp) ((disp)->StencilOpSeparate) +#define SET_StencilOpSeparate(disp, fn) ((disp)->StencilOpSeparate = fn) +#define CALL_StencilMaskSeparate(disp, parameters) (*((disp)->StencilMaskSeparate)) parameters +#define GET_StencilMaskSeparate(disp) ((disp)->StencilMaskSeparate) +#define SET_StencilMaskSeparate(disp, fn) ((disp)->StencilMaskSeparate = fn) + +#else + +#define driDispatchRemapTable_size 408 +extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; + +#define LoadTransposeMatrixfARB_remap_index 0 +#define LoadTransposeMatrixdARB_remap_index 1 +#define MultTransposeMatrixfARB_remap_index 2 +#define MultTransposeMatrixdARB_remap_index 3 +#define SampleCoverageARB_remap_index 4 +#define DrawBuffersARB_remap_index 5 +#define PolygonOffsetEXT_remap_index 6 +#define GetTexFilterFuncSGIS_remap_index 7 +#define TexFilterFuncSGIS_remap_index 8 +#define GetHistogramEXT_remap_index 9 +#define GetHistogramParameterfvEXT_remap_index 10 +#define GetHistogramParameterivEXT_remap_index 11 +#define GetMinmaxEXT_remap_index 12 +#define GetMinmaxParameterfvEXT_remap_index 13 +#define GetMinmaxParameterivEXT_remap_index 14 +#define GetConvolutionFilterEXT_remap_index 15 +#define GetConvolutionParameterfvEXT_remap_index 16 +#define GetConvolutionParameterivEXT_remap_index 17 +#define GetSeparableFilterEXT_remap_index 18 +#define GetColorTableSGI_remap_index 19 +#define GetColorTableParameterfvSGI_remap_index 20 +#define GetColorTableParameterivSGI_remap_index 21 +#define PixelTexGenSGIX_remap_index 22 +#define PixelTexGenParameteriSGIS_remap_index 23 +#define PixelTexGenParameterivSGIS_remap_index 24 +#define PixelTexGenParameterfSGIS_remap_index 25 +#define PixelTexGenParameterfvSGIS_remap_index 26 +#define GetPixelTexGenParameterivSGIS_remap_index 27 +#define GetPixelTexGenParameterfvSGIS_remap_index 28 +#define TexImage4DSGIS_remap_index 29 +#define TexSubImage4DSGIS_remap_index 30 +#define AreTexturesResidentEXT_remap_index 31 +#define GenTexturesEXT_remap_index 32 +#define IsTextureEXT_remap_index 33 +#define DetailTexFuncSGIS_remap_index 34 +#define GetDetailTexFuncSGIS_remap_index 35 +#define SharpenTexFuncSGIS_remap_index 36 +#define GetSharpenTexFuncSGIS_remap_index 37 +#define SampleMaskSGIS_remap_index 38 +#define SamplePatternSGIS_remap_index 39 +#define ColorPointerEXT_remap_index 40 +#define EdgeFlagPointerEXT_remap_index 41 +#define IndexPointerEXT_remap_index 42 +#define NormalPointerEXT_remap_index 43 +#define TexCoordPointerEXT_remap_index 44 +#define VertexPointerEXT_remap_index 45 +#define SpriteParameterfSGIX_remap_index 46 +#define SpriteParameterfvSGIX_remap_index 47 +#define SpriteParameteriSGIX_remap_index 48 +#define SpriteParameterivSGIX_remap_index 49 +#define PointParameterfEXT_remap_index 50 +#define PointParameterfvEXT_remap_index 51 +#define GetInstrumentsSGIX_remap_index 52 +#define InstrumentsBufferSGIX_remap_index 53 +#define PollInstrumentsSGIX_remap_index 54 +#define ReadInstrumentsSGIX_remap_index 55 +#define StartInstrumentsSGIX_remap_index 56 +#define StopInstrumentsSGIX_remap_index 57 +#define FrameZoomSGIX_remap_index 58 +#define TagSampleBufferSGIX_remap_index 59 +#define ReferencePlaneSGIX_remap_index 60 +#define FlushRasterSGIX_remap_index 61 +#define GetListParameterfvSGIX_remap_index 62 +#define GetListParameterivSGIX_remap_index 63 +#define ListParameterfSGIX_remap_index 64 +#define ListParameterfvSGIX_remap_index 65 +#define ListParameteriSGIX_remap_index 66 +#define ListParameterivSGIX_remap_index 67 +#define FragmentColorMaterialSGIX_remap_index 68 +#define FragmentLightfSGIX_remap_index 69 +#define FragmentLightfvSGIX_remap_index 70 +#define FragmentLightiSGIX_remap_index 71 +#define FragmentLightivSGIX_remap_index 72 +#define FragmentLightModelfSGIX_remap_index 73 +#define FragmentLightModelfvSGIX_remap_index 74 +#define FragmentLightModeliSGIX_remap_index 75 +#define FragmentLightModelivSGIX_remap_index 76 +#define FragmentMaterialfSGIX_remap_index 77 +#define FragmentMaterialfvSGIX_remap_index 78 +#define FragmentMaterialiSGIX_remap_index 79 +#define FragmentMaterialivSGIX_remap_index 80 +#define GetFragmentLightfvSGIX_remap_index 81 +#define GetFragmentLightivSGIX_remap_index 82 +#define GetFragmentMaterialfvSGIX_remap_index 83 +#define GetFragmentMaterialivSGIX_remap_index 84 +#define LightEnviSGIX_remap_index 85 +#define VertexWeightfEXT_remap_index 86 +#define VertexWeightfvEXT_remap_index 87 +#define VertexWeightPointerEXT_remap_index 88 +#define FlushVertexArrayRangeNV_remap_index 89 +#define VertexArrayRangeNV_remap_index 90 +#define CombinerParameterfvNV_remap_index 91 +#define CombinerParameterfNV_remap_index 92 +#define CombinerParameterivNV_remap_index 93 +#define CombinerParameteriNV_remap_index 94 +#define CombinerInputNV_remap_index 95 +#define CombinerOutputNV_remap_index 96 +#define FinalCombinerInputNV_remap_index 97 +#define GetCombinerInputParameterfvNV_remap_index 98 +#define GetCombinerInputParameterivNV_remap_index 99 +#define GetCombinerOutputParameterfvNV_remap_index 100 +#define GetCombinerOutputParameterivNV_remap_index 101 +#define GetFinalCombinerInputParameterfvNV_remap_index 102 +#define GetFinalCombinerInputParameterivNV_remap_index 103 +#define ResizeBuffersMESA_remap_index 104 +#define WindowPos2dMESA_remap_index 105 +#define WindowPos2dvMESA_remap_index 106 +#define WindowPos2fMESA_remap_index 107 +#define WindowPos2fvMESA_remap_index 108 +#define WindowPos2iMESA_remap_index 109 +#define WindowPos2ivMESA_remap_index 110 +#define WindowPos2sMESA_remap_index 111 +#define WindowPos2svMESA_remap_index 112 +#define WindowPos3dMESA_remap_index 113 +#define WindowPos3dvMESA_remap_index 114 +#define WindowPos3fMESA_remap_index 115 +#define WindowPos3fvMESA_remap_index 116 +#define WindowPos3iMESA_remap_index 117 +#define WindowPos3ivMESA_remap_index 118 +#define WindowPos3sMESA_remap_index 119 +#define WindowPos3svMESA_remap_index 120 +#define WindowPos4dMESA_remap_index 121 +#define WindowPos4dvMESA_remap_index 122 +#define WindowPos4fMESA_remap_index 123 +#define WindowPos4fvMESA_remap_index 124 +#define WindowPos4iMESA_remap_index 125 +#define WindowPos4ivMESA_remap_index 126 +#define WindowPos4sMESA_remap_index 127 +#define WindowPos4svMESA_remap_index 128 +#define BlendFuncSeparateEXT_remap_index 129 +#define IndexMaterialEXT_remap_index 130 +#define IndexFuncEXT_remap_index 131 +#define LockArraysEXT_remap_index 132 +#define UnlockArraysEXT_remap_index 133 +#define CullParameterdvEXT_remap_index 134 +#define CullParameterfvEXT_remap_index 135 +#define HintPGI_remap_index 136 +#define FogCoordfEXT_remap_index 137 +#define FogCoordfvEXT_remap_index 138 +#define FogCoorddEXT_remap_index 139 +#define FogCoorddvEXT_remap_index 140 +#define FogCoordPointerEXT_remap_index 141 +#define GetColorTableEXT_remap_index 142 +#define GetColorTableParameterivEXT_remap_index 143 +#define GetColorTableParameterfvEXT_remap_index 144 +#define TbufferMask3DFX_remap_index 145 +#define CompressedTexImage3DARB_remap_index 146 +#define CompressedTexImage2DARB_remap_index 147 +#define CompressedTexImage1DARB_remap_index 148 +#define CompressedTexSubImage3DARB_remap_index 149 +#define CompressedTexSubImage2DARB_remap_index 150 +#define CompressedTexSubImage1DARB_remap_index 151 +#define GetCompressedTexImageARB_remap_index 152 +#define SecondaryColor3bEXT_remap_index 153 +#define SecondaryColor3bvEXT_remap_index 154 +#define SecondaryColor3dEXT_remap_index 155 +#define SecondaryColor3dvEXT_remap_index 156 +#define SecondaryColor3fEXT_remap_index 157 +#define SecondaryColor3fvEXT_remap_index 158 +#define SecondaryColor3iEXT_remap_index 159 +#define SecondaryColor3ivEXT_remap_index 160 +#define SecondaryColor3sEXT_remap_index 161 +#define SecondaryColor3svEXT_remap_index 162 +#define SecondaryColor3ubEXT_remap_index 163 +#define SecondaryColor3ubvEXT_remap_index 164 +#define SecondaryColor3uiEXT_remap_index 165 +#define SecondaryColor3uivEXT_remap_index 166 +#define SecondaryColor3usEXT_remap_index 167 +#define SecondaryColor3usvEXT_remap_index 168 +#define SecondaryColorPointerEXT_remap_index 169 +#define AreProgramsResidentNV_remap_index 170 +#define BindProgramNV_remap_index 171 +#define DeleteProgramsNV_remap_index 172 +#define ExecuteProgramNV_remap_index 173 +#define GenProgramsNV_remap_index 174 +#define GetProgramParameterdvNV_remap_index 175 +#define GetProgramParameterfvNV_remap_index 176 +#define GetProgramivNV_remap_index 177 +#define GetProgramStringNV_remap_index 178 +#define GetTrackMatrixivNV_remap_index 179 +#define GetVertexAttribdvARB_remap_index 180 +#define GetVertexAttribfvARB_remap_index 181 +#define GetVertexAttribivARB_remap_index 182 +#define GetVertexAttribPointervNV_remap_index 183 +#define IsProgramNV_remap_index 184 +#define LoadProgramNV_remap_index 185 +#define ProgramParameter4dNV_remap_index 186 +#define ProgramParameter4dvNV_remap_index 187 +#define ProgramParameter4fNV_remap_index 188 +#define ProgramParameter4fvNV_remap_index 189 +#define ProgramParameters4dvNV_remap_index 190 +#define ProgramParameters4fvNV_remap_index 191 +#define RequestResidentProgramsNV_remap_index 192 +#define TrackMatrixNV_remap_index 193 +#define VertexAttribPointerNV_remap_index 194 +#define VertexAttrib1dARB_remap_index 195 +#define VertexAttrib1dvARB_remap_index 196 +#define VertexAttrib1fARB_remap_index 197 +#define VertexAttrib1fvARB_remap_index 198 +#define VertexAttrib1sARB_remap_index 199 +#define VertexAttrib1svARB_remap_index 200 +#define VertexAttrib2dARB_remap_index 201 +#define VertexAttrib2dvARB_remap_index 202 +#define VertexAttrib2fARB_remap_index 203 +#define VertexAttrib2fvARB_remap_index 204 +#define VertexAttrib2sARB_remap_index 205 +#define VertexAttrib2svARB_remap_index 206 +#define VertexAttrib3dARB_remap_index 207 +#define VertexAttrib3dvARB_remap_index 208 +#define VertexAttrib3fARB_remap_index 209 +#define VertexAttrib3fvARB_remap_index 210 +#define VertexAttrib3sARB_remap_index 211 +#define VertexAttrib3svARB_remap_index 212 +#define VertexAttrib4dARB_remap_index 213 +#define VertexAttrib4dvARB_remap_index 214 +#define VertexAttrib4fARB_remap_index 215 +#define VertexAttrib4fvARB_remap_index 216 +#define VertexAttrib4sARB_remap_index 217 +#define VertexAttrib4svARB_remap_index 218 +#define VertexAttrib4NubARB_remap_index 219 +#define VertexAttrib4NubvARB_remap_index 220 +#define VertexAttribs1dvNV_remap_index 221 +#define VertexAttribs1fvNV_remap_index 222 +#define VertexAttribs1svNV_remap_index 223 +#define VertexAttribs2dvNV_remap_index 224 +#define VertexAttribs2fvNV_remap_index 225 +#define VertexAttribs2svNV_remap_index 226 +#define VertexAttribs3dvNV_remap_index 227 +#define VertexAttribs3fvNV_remap_index 228 +#define VertexAttribs3svNV_remap_index 229 +#define VertexAttribs4dvNV_remap_index 230 +#define VertexAttribs4fvNV_remap_index 231 +#define VertexAttribs4svNV_remap_index 232 +#define VertexAttribs4ubvNV_remap_index 233 +#define PointParameteriNV_remap_index 234 +#define PointParameterivNV_remap_index 235 +#define MultiDrawArraysEXT_remap_index 236 +#define MultiDrawElementsEXT_remap_index 237 +#define ActiveStencilFaceEXT_remap_index 238 +#define DeleteFencesNV_remap_index 239 +#define GenFencesNV_remap_index 240 +#define IsFenceNV_remap_index 241 +#define TestFenceNV_remap_index 242 +#define GetFenceivNV_remap_index 243 +#define FinishFenceNV_remap_index 244 +#define SetFenceNV_remap_index 245 +#define VertexAttrib4bvARB_remap_index 246 +#define VertexAttrib4ivARB_remap_index 247 +#define VertexAttrib4ubvARB_remap_index 248 +#define VertexAttrib4usvARB_remap_index 249 +#define VertexAttrib4uivARB_remap_index 250 +#define VertexAttrib4NbvARB_remap_index 251 +#define VertexAttrib4NsvARB_remap_index 252 +#define VertexAttrib4NivARB_remap_index 253 +#define VertexAttrib4NusvARB_remap_index 254 +#define VertexAttrib4NuivARB_remap_index 255 +#define VertexAttribPointerARB_remap_index 256 +#define EnableVertexAttribArrayARB_remap_index 257 +#define DisableVertexAttribArrayARB_remap_index 258 +#define ProgramStringARB_remap_index 259 +#define ProgramEnvParameter4dARB_remap_index 260 +#define ProgramEnvParameter4dvARB_remap_index 261 +#define ProgramEnvParameter4fARB_remap_index 262 +#define ProgramEnvParameter4fvARB_remap_index 263 +#define ProgramLocalParameter4dARB_remap_index 264 +#define ProgramLocalParameter4dvARB_remap_index 265 +#define ProgramLocalParameter4fARB_remap_index 266 +#define ProgramLocalParameter4fvARB_remap_index 267 +#define GetProgramEnvParameterdvARB_remap_index 268 +#define GetProgramEnvParameterfvARB_remap_index 269 +#define GetProgramLocalParameterdvARB_remap_index 270 +#define GetProgramLocalParameterfvARB_remap_index 271 +#define GetProgramivARB_remap_index 272 +#define GetProgramStringARB_remap_index 273 +#define ProgramNamedParameter4fNV_remap_index 274 +#define ProgramNamedParameter4dNV_remap_index 275 +#define ProgramNamedParameter4fvNV_remap_index 276 +#define ProgramNamedParameter4dvNV_remap_index 277 +#define GetProgramNamedParameterfvNV_remap_index 278 +#define GetProgramNamedParameterdvNV_remap_index 279 +#define BindBufferARB_remap_index 280 +#define BufferDataARB_remap_index 281 +#define BufferSubDataARB_remap_index 282 +#define DeleteBuffersARB_remap_index 283 +#define GenBuffersARB_remap_index 284 +#define GetBufferParameterivARB_remap_index 285 +#define GetBufferPointervARB_remap_index 286 +#define GetBufferSubDataARB_remap_index 287 +#define IsBufferARB_remap_index 288 +#define MapBufferARB_remap_index 289 +#define UnmapBufferARB_remap_index 290 +#define DepthBoundsEXT_remap_index 291 +#define GenQueriesARB_remap_index 292 +#define DeleteQueriesARB_remap_index 293 +#define IsQueryARB_remap_index 294 +#define BeginQueryARB_remap_index 295 +#define EndQueryARB_remap_index 296 +#define GetQueryivARB_remap_index 297 +#define GetQueryObjectivARB_remap_index 298 +#define GetQueryObjectuivARB_remap_index 299 +#define MultiModeDrawArraysIBM_remap_index 300 +#define MultiModeDrawElementsIBM_remap_index 301 +#define BlendEquationSeparateEXT_remap_index 302 +#define DeleteObjectARB_remap_index 303 +#define GetHandleARB_remap_index 304 +#define DetachObjectARB_remap_index 305 +#define CreateShaderObjectARB_remap_index 306 +#define ShaderSourceARB_remap_index 307 +#define CompileShaderARB_remap_index 308 +#define CreateProgramObjectARB_remap_index 309 +#define AttachObjectARB_remap_index 310 +#define LinkProgramARB_remap_index 311 +#define UseProgramObjectARB_remap_index 312 +#define ValidateProgramARB_remap_index 313 +#define Uniform1fARB_remap_index 314 +#define Uniform2fARB_remap_index 315 +#define Uniform3fARB_remap_index 316 +#define Uniform4fARB_remap_index 317 +#define Uniform1iARB_remap_index 318 +#define Uniform2iARB_remap_index 319 +#define Uniform3iARB_remap_index 320 +#define Uniform4iARB_remap_index 321 +#define Uniform1fvARB_remap_index 322 +#define Uniform2fvARB_remap_index 323 +#define Uniform3fvARB_remap_index 324 +#define Uniform4fvARB_remap_index 325 +#define Uniform1ivARB_remap_index 326 +#define Uniform2ivARB_remap_index 327 +#define Uniform3ivARB_remap_index 328 +#define Uniform4ivARB_remap_index 329 +#define UniformMatrix2fvARB_remap_index 330 +#define UniformMatrix3fvARB_remap_index 331 +#define UniformMatrix4fvARB_remap_index 332 +#define GetObjectParameterfvARB_remap_index 333 +#define GetObjectParameterivARB_remap_index 334 +#define GetInfoLogARB_remap_index 335 +#define GetAttachedObjectsARB_remap_index 336 +#define GetUniformLocationARB_remap_index 337 +#define GetActiveUniformARB_remap_index 338 +#define GetUniformfvARB_remap_index 339 +#define GetUniformivARB_remap_index 340 +#define GetShaderSourceARB_remap_index 341 +#define BindAttribLocationARB_remap_index 342 +#define GetActiveAttribARB_remap_index 343 +#define GetAttribLocationARB_remap_index 344 +#define GetVertexAttribdvNV_remap_index 345 +#define GetVertexAttribfvNV_remap_index 346 +#define GetVertexAttribivNV_remap_index 347 +#define VertexAttrib1dNV_remap_index 348 +#define VertexAttrib1dvNV_remap_index 349 +#define VertexAttrib1fNV_remap_index 350 +#define VertexAttrib1fvNV_remap_index 351 +#define VertexAttrib1sNV_remap_index 352 +#define VertexAttrib1svNV_remap_index 353 +#define VertexAttrib2dNV_remap_index 354 +#define VertexAttrib2dvNV_remap_index 355 +#define VertexAttrib2fNV_remap_index 356 +#define VertexAttrib2fvNV_remap_index 357 +#define VertexAttrib2sNV_remap_index 358 +#define VertexAttrib2svNV_remap_index 359 +#define VertexAttrib3dNV_remap_index 360 +#define VertexAttrib3dvNV_remap_index 361 +#define VertexAttrib3fNV_remap_index 362 +#define VertexAttrib3fvNV_remap_index 363 +#define VertexAttrib3sNV_remap_index 364 +#define VertexAttrib3svNV_remap_index 365 +#define VertexAttrib4dNV_remap_index 366 +#define VertexAttrib4dvNV_remap_index 367 +#define VertexAttrib4fNV_remap_index 368 +#define VertexAttrib4fvNV_remap_index 369 +#define VertexAttrib4sNV_remap_index 370 +#define VertexAttrib4svNV_remap_index 371 +#define VertexAttrib4ubNV_remap_index 372 +#define VertexAttrib4ubvNV_remap_index 373 +#define GenFragmentShadersATI_remap_index 374 +#define BindFragmentShaderATI_remap_index 375 +#define DeleteFragmentShaderATI_remap_index 376 +#define BeginFragmentShaderATI_remap_index 377 +#define EndFragmentShaderATI_remap_index 378 +#define PassTexCoordATI_remap_index 379 +#define SampleMapATI_remap_index 380 +#define ColorFragmentOp1ATI_remap_index 381 +#define ColorFragmentOp2ATI_remap_index 382 +#define ColorFragmentOp3ATI_remap_index 383 +#define AlphaFragmentOp1ATI_remap_index 384 +#define AlphaFragmentOp2ATI_remap_index 385 +#define AlphaFragmentOp3ATI_remap_index 386 +#define SetFragmentShaderConstantATI_remap_index 387 +#define IsRenderbufferEXT_remap_index 388 +#define BindRenderbufferEXT_remap_index 389 +#define DeleteRenderbuffersEXT_remap_index 390 +#define GenRenderbuffersEXT_remap_index 391 +#define RenderbufferStorageEXT_remap_index 392 +#define GetRenderbufferParameterivEXT_remap_index 393 +#define IsFramebufferEXT_remap_index 394 +#define BindFramebufferEXT_remap_index 395 +#define DeleteFramebuffersEXT_remap_index 396 +#define GenFramebuffersEXT_remap_index 397 +#define CheckFramebufferStatusEXT_remap_index 398 +#define FramebufferTexture1DEXT_remap_index 399 +#define FramebufferTexture2DEXT_remap_index 400 +#define FramebufferTexture3DEXT_remap_index 401 +#define FramebufferRenderbufferEXT_remap_index 402 +#define GetFramebufferAttachmentParameterivEXT_remap_index 403 +#define GenerateMipmapEXT_remap_index 404 +#define StencilFuncSeparate_remap_index 405 +#define StencilOpSeparate_remap_index 406 +#define StencilMaskSeparate_remap_index 407 + +#define CALL_LoadTransposeMatrixfARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index], parameters) +#define GET_LoadTransposeMatrixfARB(disp) GET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index]) +#define SET_LoadTransposeMatrixfARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index], fn) +#define CALL_LoadTransposeMatrixdARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index], parameters) +#define GET_LoadTransposeMatrixdARB(disp) GET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index]) +#define SET_LoadTransposeMatrixdARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index], fn) +#define CALL_MultTransposeMatrixfARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[MultTransposeMatrixfARB_remap_index], parameters) +#define GET_MultTransposeMatrixfARB(disp) GET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixfARB_remap_index]) +#define SET_MultTransposeMatrixfARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixfARB_remap_index], fn) +#define CALL_MultTransposeMatrixdARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[MultTransposeMatrixdARB_remap_index], parameters) +#define GET_MultTransposeMatrixdARB(disp) GET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixdARB_remap_index]) +#define SET_MultTransposeMatrixdARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixdARB_remap_index], fn) +#define CALL_SampleCoverageARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLclampf, GLboolean)), driDispatchRemapTable[SampleCoverageARB_remap_index], parameters) +#define GET_SampleCoverageARB(disp) GET_by_offset(disp, driDispatchRemapTable[SampleCoverageARB_remap_index]) +#define SET_SampleCoverageARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SampleCoverageARB_remap_index], fn) +#define CALL_DrawBuffersARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLenum *)), driDispatchRemapTable[DrawBuffersARB_remap_index], parameters) +#define GET_DrawBuffersARB(disp) GET_by_offset(disp, driDispatchRemapTable[DrawBuffersARB_remap_index]) +#define SET_DrawBuffersARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DrawBuffersARB_remap_index], fn) +#define CALL_PolygonOffsetEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat)), driDispatchRemapTable[PolygonOffsetEXT_remap_index], parameters) +#define GET_PolygonOffsetEXT(disp) GET_by_offset(disp, driDispatchRemapTable[PolygonOffsetEXT_remap_index]) +#define SET_PolygonOffsetEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PolygonOffsetEXT_remap_index], fn) +#define CALL_GetTexFilterFuncSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetTexFilterFuncSGIS_remap_index], parameters) +#define GET_GetTexFilterFuncSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[GetTexFilterFuncSGIS_remap_index]) +#define SET_GetTexFilterFuncSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTexFilterFuncSGIS_remap_index], fn) +#define CALL_TexFilterFuncSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLsizei, const GLfloat *)), driDispatchRemapTable[TexFilterFuncSGIS_remap_index], parameters) +#define GET_TexFilterFuncSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[TexFilterFuncSGIS_remap_index]) +#define SET_TexFilterFuncSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexFilterFuncSGIS_remap_index], fn) +#define CALL_GetHistogramEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLboolean, GLenum, GLenum, GLvoid *)), driDispatchRemapTable[GetHistogramEXT_remap_index], parameters) +#define GET_GetHistogramEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetHistogramEXT_remap_index]) +#define SET_GetHistogramEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetHistogramEXT_remap_index], fn) +#define CALL_GetHistogramParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetHistogramParameterfvEXT_remap_index], parameters) +#define GET_GetHistogramParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetHistogramParameterfvEXT_remap_index]) +#define SET_GetHistogramParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetHistogramParameterfvEXT_remap_index], fn) +#define CALL_GetHistogramParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetHistogramParameterivEXT_remap_index], parameters) +#define GET_GetHistogramParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetHistogramParameterivEXT_remap_index]) +#define SET_GetHistogramParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetHistogramParameterivEXT_remap_index], fn) +#define CALL_GetMinmaxEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLboolean, GLenum, GLenum, GLvoid *)), driDispatchRemapTable[GetMinmaxEXT_remap_index], parameters) +#define GET_GetMinmaxEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetMinmaxEXT_remap_index]) +#define SET_GetMinmaxEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetMinmaxEXT_remap_index], fn) +#define CALL_GetMinmaxParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetMinmaxParameterfvEXT_remap_index], parameters) +#define GET_GetMinmaxParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetMinmaxParameterfvEXT_remap_index]) +#define SET_GetMinmaxParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetMinmaxParameterfvEXT_remap_index], fn) +#define CALL_GetMinmaxParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetMinmaxParameterivEXT_remap_index], parameters) +#define GET_GetMinmaxParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetMinmaxParameterivEXT_remap_index]) +#define SET_GetMinmaxParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetMinmaxParameterivEXT_remap_index], fn) +#define CALL_GetConvolutionFilterEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLvoid *)), driDispatchRemapTable[GetConvolutionFilterEXT_remap_index], parameters) +#define GET_GetConvolutionFilterEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetConvolutionFilterEXT_remap_index]) +#define SET_GetConvolutionFilterEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetConvolutionFilterEXT_remap_index], fn) +#define CALL_GetConvolutionParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetConvolutionParameterfvEXT_remap_index], parameters) +#define GET_GetConvolutionParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetConvolutionParameterfvEXT_remap_index]) +#define SET_GetConvolutionParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetConvolutionParameterfvEXT_remap_index], fn) +#define CALL_GetConvolutionParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetConvolutionParameterivEXT_remap_index], parameters) +#define GET_GetConvolutionParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetConvolutionParameterivEXT_remap_index]) +#define SET_GetConvolutionParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetConvolutionParameterivEXT_remap_index], fn) +#define CALL_GetSeparableFilterEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *)), driDispatchRemapTable[GetSeparableFilterEXT_remap_index], parameters) +#define GET_GetSeparableFilterEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetSeparableFilterEXT_remap_index]) +#define SET_GetSeparableFilterEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetSeparableFilterEXT_remap_index], fn) +#define CALL_GetColorTableSGI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLvoid *)), driDispatchRemapTable[GetColorTableSGI_remap_index], parameters) +#define GET_GetColorTableSGI(disp) GET_by_offset(disp, driDispatchRemapTable[GetColorTableSGI_remap_index]) +#define SET_GetColorTableSGI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetColorTableSGI_remap_index], fn) +#define CALL_GetColorTableParameterfvSGI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetColorTableParameterfvSGI_remap_index], parameters) +#define GET_GetColorTableParameterfvSGI(disp) GET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterfvSGI_remap_index]) +#define SET_GetColorTableParameterfvSGI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterfvSGI_remap_index], fn) +#define CALL_GetColorTableParameterivSGI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetColorTableParameterivSGI_remap_index], parameters) +#define GET_GetColorTableParameterivSGI(disp) GET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterivSGI_remap_index]) +#define SET_GetColorTableParameterivSGI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterivSGI_remap_index], fn) +#define CALL_PixelTexGenSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[PixelTexGenSGIX_remap_index], parameters) +#define GET_PixelTexGenSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenSGIX_remap_index]) +#define SET_PixelTexGenSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenSGIX_remap_index], fn) +#define CALL_PixelTexGenParameteriSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index], parameters) +#define GET_PixelTexGenParameteriSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index]) +#define SET_PixelTexGenParameteriSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index], fn) +#define CALL_PixelTexGenParameterivSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index], parameters) +#define GET_PixelTexGenParameterivSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index]) +#define SET_PixelTexGenParameterivSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index], fn) +#define CALL_PixelTexGenParameterfSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index], parameters) +#define GET_PixelTexGenParameterfSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index]) +#define SET_PixelTexGenParameterfSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index], fn) +#define CALL_PixelTexGenParameterfvSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index], parameters) +#define GET_PixelTexGenParameterfvSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index]) +#define SET_PixelTexGenParameterfvSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index], fn) +#define CALL_GetPixelTexGenParameterivSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint *)), driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index], parameters) +#define GET_GetPixelTexGenParameterivSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index]) +#define SET_GetPixelTexGenParameterivSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index], fn) +#define CALL_GetPixelTexGenParameterfvSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index], parameters) +#define GET_GetPixelTexGenParameterfvSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index]) +#define SET_GetPixelTexGenParameterfvSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index], fn) +#define CALL_TexImage4DSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)), driDispatchRemapTable[TexImage4DSGIS_remap_index], parameters) +#define GET_TexImage4DSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[TexImage4DSGIS_remap_index]) +#define SET_TexImage4DSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexImage4DSGIS_remap_index], fn) +#define CALL_TexSubImage4DSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)), driDispatchRemapTable[TexSubImage4DSGIS_remap_index], parameters) +#define GET_TexSubImage4DSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[TexSubImage4DSGIS_remap_index]) +#define SET_TexSubImage4DSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexSubImage4DSGIS_remap_index], fn) +#define CALL_AreTexturesResidentEXT(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLsizei, const GLuint *, GLboolean *)), driDispatchRemapTable[AreTexturesResidentEXT_remap_index], parameters) +#define GET_AreTexturesResidentEXT(disp) GET_by_offset(disp, driDispatchRemapTable[AreTexturesResidentEXT_remap_index]) +#define SET_AreTexturesResidentEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AreTexturesResidentEXT_remap_index], fn) +#define CALL_GenTexturesEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenTexturesEXT_remap_index], parameters) +#define GET_GenTexturesEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GenTexturesEXT_remap_index]) +#define SET_GenTexturesEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenTexturesEXT_remap_index], fn) +#define CALL_IsTextureEXT(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsTextureEXT_remap_index], parameters) +#define GET_IsTextureEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IsTextureEXT_remap_index]) +#define SET_IsTextureEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsTextureEXT_remap_index], fn) +#define CALL_DetailTexFuncSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, const GLfloat *)), driDispatchRemapTable[DetailTexFuncSGIS_remap_index], parameters) +#define GET_DetailTexFuncSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[DetailTexFuncSGIS_remap_index]) +#define SET_DetailTexFuncSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DetailTexFuncSGIS_remap_index], fn) +#define CALL_GetDetailTexFuncSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[GetDetailTexFuncSGIS_remap_index], parameters) +#define GET_GetDetailTexFuncSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[GetDetailTexFuncSGIS_remap_index]) +#define SET_GetDetailTexFuncSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetDetailTexFuncSGIS_remap_index], fn) +#define CALL_SharpenTexFuncSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, const GLfloat *)), driDispatchRemapTable[SharpenTexFuncSGIS_remap_index], parameters) +#define GET_SharpenTexFuncSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[SharpenTexFuncSGIS_remap_index]) +#define SET_SharpenTexFuncSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SharpenTexFuncSGIS_remap_index], fn) +#define CALL_GetSharpenTexFuncSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[GetSharpenTexFuncSGIS_remap_index], parameters) +#define GET_GetSharpenTexFuncSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[GetSharpenTexFuncSGIS_remap_index]) +#define SET_GetSharpenTexFuncSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetSharpenTexFuncSGIS_remap_index], fn) +#define CALL_SampleMaskSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLclampf, GLboolean)), driDispatchRemapTable[SampleMaskSGIS_remap_index], parameters) +#define GET_SampleMaskSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[SampleMaskSGIS_remap_index]) +#define SET_SampleMaskSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SampleMaskSGIS_remap_index], fn) +#define CALL_SamplePatternSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[SamplePatternSGIS_remap_index], parameters) +#define GET_SamplePatternSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[SamplePatternSGIS_remap_index]) +#define SET_SamplePatternSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SamplePatternSGIS_remap_index], fn) +#define CALL_ColorPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[ColorPointerEXT_remap_index], parameters) +#define GET_ColorPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ColorPointerEXT_remap_index]) +#define SET_ColorPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorPointerEXT_remap_index], fn) +#define CALL_EdgeFlagPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLsizei, const GLboolean *)), driDispatchRemapTable[EdgeFlagPointerEXT_remap_index], parameters) +#define GET_EdgeFlagPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[EdgeFlagPointerEXT_remap_index]) +#define SET_EdgeFlagPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EdgeFlagPointerEXT_remap_index], fn) +#define CALL_IndexPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[IndexPointerEXT_remap_index], parameters) +#define GET_IndexPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IndexPointerEXT_remap_index]) +#define SET_IndexPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IndexPointerEXT_remap_index], fn) +#define CALL_NormalPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[NormalPointerEXT_remap_index], parameters) +#define GET_NormalPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[NormalPointerEXT_remap_index]) +#define SET_NormalPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[NormalPointerEXT_remap_index], fn) +#define CALL_TexCoordPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[TexCoordPointerEXT_remap_index], parameters) +#define GET_TexCoordPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[TexCoordPointerEXT_remap_index]) +#define SET_TexCoordPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexCoordPointerEXT_remap_index], fn) +#define CALL_VertexPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[VertexPointerEXT_remap_index], parameters) +#define GET_VertexPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[VertexPointerEXT_remap_index]) +#define SET_VertexPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexPointerEXT_remap_index], fn) +#define CALL_SpriteParameterfSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[SpriteParameterfSGIX_remap_index], parameters) +#define GET_SpriteParameterfSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[SpriteParameterfSGIX_remap_index]) +#define SET_SpriteParameterfSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SpriteParameterfSGIX_remap_index], fn) +#define CALL_SpriteParameterfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[SpriteParameterfvSGIX_remap_index], parameters) +#define GET_SpriteParameterfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[SpriteParameterfvSGIX_remap_index]) +#define SET_SpriteParameterfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SpriteParameterfvSGIX_remap_index], fn) +#define CALL_SpriteParameteriSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[SpriteParameteriSGIX_remap_index], parameters) +#define GET_SpriteParameteriSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[SpriteParameteriSGIX_remap_index]) +#define SET_SpriteParameteriSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SpriteParameteriSGIX_remap_index], fn) +#define CALL_SpriteParameterivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[SpriteParameterivSGIX_remap_index], parameters) +#define GET_SpriteParameterivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[SpriteParameterivSGIX_remap_index]) +#define SET_SpriteParameterivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SpriteParameterivSGIX_remap_index], fn) +#define CALL_PointParameterfEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[PointParameterfEXT_remap_index], parameters) +#define GET_PointParameterfEXT(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameterfEXT_remap_index]) +#define SET_PointParameterfEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameterfEXT_remap_index], fn) +#define CALL_PointParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[PointParameterfvEXT_remap_index], parameters) +#define GET_PointParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameterfvEXT_remap_index]) +#define SET_PointParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameterfvEXT_remap_index], fn) +#define CALL_GetInstrumentsSGIX(disp, parameters) CALL_by_offset(disp, (GLint (GLAPIENTRYP)(void)), driDispatchRemapTable[GetInstrumentsSGIX_remap_index], parameters) +#define GET_GetInstrumentsSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[GetInstrumentsSGIX_remap_index]) +#define SET_GetInstrumentsSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetInstrumentsSGIX_remap_index], fn) +#define CALL_InstrumentsBufferSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLint *)), driDispatchRemapTable[InstrumentsBufferSGIX_remap_index], parameters) +#define GET_InstrumentsBufferSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[InstrumentsBufferSGIX_remap_index]) +#define SET_InstrumentsBufferSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[InstrumentsBufferSGIX_remap_index], fn) +#define CALL_PollInstrumentsSGIX(disp, parameters) CALL_by_offset(disp, (GLint (GLAPIENTRYP)(GLint *)), driDispatchRemapTable[PollInstrumentsSGIX_remap_index], parameters) +#define GET_PollInstrumentsSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[PollInstrumentsSGIX_remap_index]) +#define SET_PollInstrumentsSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PollInstrumentsSGIX_remap_index], fn) +#define CALL_ReadInstrumentsSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint)), driDispatchRemapTable[ReadInstrumentsSGIX_remap_index], parameters) +#define GET_ReadInstrumentsSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[ReadInstrumentsSGIX_remap_index]) +#define SET_ReadInstrumentsSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ReadInstrumentsSGIX_remap_index], fn) +#define CALL_StartInstrumentsSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[StartInstrumentsSGIX_remap_index], parameters) +#define GET_StartInstrumentsSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[StartInstrumentsSGIX_remap_index]) +#define SET_StartInstrumentsSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StartInstrumentsSGIX_remap_index], fn) +#define CALL_StopInstrumentsSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint)), driDispatchRemapTable[StopInstrumentsSGIX_remap_index], parameters) +#define GET_StopInstrumentsSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[StopInstrumentsSGIX_remap_index]) +#define SET_StopInstrumentsSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StopInstrumentsSGIX_remap_index], fn) +#define CALL_FrameZoomSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint)), driDispatchRemapTable[FrameZoomSGIX_remap_index], parameters) +#define GET_FrameZoomSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FrameZoomSGIX_remap_index]) +#define SET_FrameZoomSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FrameZoomSGIX_remap_index], fn) +#define CALL_TagSampleBufferSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[TagSampleBufferSGIX_remap_index], parameters) +#define GET_TagSampleBufferSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[TagSampleBufferSGIX_remap_index]) +#define SET_TagSampleBufferSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TagSampleBufferSGIX_remap_index], fn) +#define CALL_ReferencePlaneSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[ReferencePlaneSGIX_remap_index], parameters) +#define GET_ReferencePlaneSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[ReferencePlaneSGIX_remap_index]) +#define SET_ReferencePlaneSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ReferencePlaneSGIX_remap_index], fn) +#define CALL_FlushRasterSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[FlushRasterSGIX_remap_index], parameters) +#define GET_FlushRasterSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FlushRasterSGIX_remap_index]) +#define SET_FlushRasterSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FlushRasterSGIX_remap_index], fn) +#define CALL_GetListParameterfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLfloat *)), driDispatchRemapTable[GetListParameterfvSGIX_remap_index], parameters) +#define GET_GetListParameterfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[GetListParameterfvSGIX_remap_index]) +#define SET_GetListParameterfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetListParameterfvSGIX_remap_index], fn) +#define CALL_GetListParameterivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetListParameterivSGIX_remap_index], parameters) +#define GET_GetListParameterivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[GetListParameterivSGIX_remap_index]) +#define SET_GetListParameterivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetListParameterivSGIX_remap_index], fn) +#define CALL_ListParameterfSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLfloat)), driDispatchRemapTable[ListParameterfSGIX_remap_index], parameters) +#define GET_ListParameterfSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[ListParameterfSGIX_remap_index]) +#define SET_ListParameterfSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ListParameterfSGIX_remap_index], fn) +#define CALL_ListParameterfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, const GLfloat *)), driDispatchRemapTable[ListParameterfvSGIX_remap_index], parameters) +#define GET_ListParameterfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[ListParameterfvSGIX_remap_index]) +#define SET_ListParameterfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ListParameterfvSGIX_remap_index], fn) +#define CALL_ListParameteriSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint)), driDispatchRemapTable[ListParameteriSGIX_remap_index], parameters) +#define GET_ListParameteriSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[ListParameteriSGIX_remap_index]) +#define SET_ListParameteriSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ListParameteriSGIX_remap_index], fn) +#define CALL_ListParameterivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, const GLint *)), driDispatchRemapTable[ListParameterivSGIX_remap_index], parameters) +#define GET_ListParameterivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[ListParameterivSGIX_remap_index]) +#define SET_ListParameterivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ListParameterivSGIX_remap_index], fn) +#define CALL_FragmentColorMaterialSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum)), driDispatchRemapTable[FragmentColorMaterialSGIX_remap_index], parameters) +#define GET_FragmentColorMaterialSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentColorMaterialSGIX_remap_index]) +#define SET_FragmentColorMaterialSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentColorMaterialSGIX_remap_index], fn) +#define CALL_FragmentLightfSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat)), driDispatchRemapTable[FragmentLightfSGIX_remap_index], parameters) +#define GET_FragmentLightfSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightfSGIX_remap_index]) +#define SET_FragmentLightfSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightfSGIX_remap_index], fn) +#define CALL_FragmentLightfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, const GLfloat *)), driDispatchRemapTable[FragmentLightfvSGIX_remap_index], parameters) +#define GET_FragmentLightfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightfvSGIX_remap_index]) +#define SET_FragmentLightfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightfvSGIX_remap_index], fn) +#define CALL_FragmentLightiSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint)), driDispatchRemapTable[FragmentLightiSGIX_remap_index], parameters) +#define GET_FragmentLightiSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightiSGIX_remap_index]) +#define SET_FragmentLightiSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightiSGIX_remap_index], fn) +#define CALL_FragmentLightivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, const GLint *)), driDispatchRemapTable[FragmentLightivSGIX_remap_index], parameters) +#define GET_FragmentLightivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightivSGIX_remap_index]) +#define SET_FragmentLightivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightivSGIX_remap_index], fn) +#define CALL_FragmentLightModelfSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[FragmentLightModelfSGIX_remap_index], parameters) +#define GET_FragmentLightModelfSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightModelfSGIX_remap_index]) +#define SET_FragmentLightModelfSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightModelfSGIX_remap_index], fn) +#define CALL_FragmentLightModelfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[FragmentLightModelfvSGIX_remap_index], parameters) +#define GET_FragmentLightModelfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightModelfvSGIX_remap_index]) +#define SET_FragmentLightModelfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightModelfvSGIX_remap_index], fn) +#define CALL_FragmentLightModeliSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[FragmentLightModeliSGIX_remap_index], parameters) +#define GET_FragmentLightModeliSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightModeliSGIX_remap_index]) +#define SET_FragmentLightModeliSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightModeliSGIX_remap_index], fn) +#define CALL_FragmentLightModelivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[FragmentLightModelivSGIX_remap_index], parameters) +#define GET_FragmentLightModelivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightModelivSGIX_remap_index]) +#define SET_FragmentLightModelivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightModelivSGIX_remap_index], fn) +#define CALL_FragmentMaterialfSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat)), driDispatchRemapTable[FragmentMaterialfSGIX_remap_index], parameters) +#define GET_FragmentMaterialfSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentMaterialfSGIX_remap_index]) +#define SET_FragmentMaterialfSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentMaterialfSGIX_remap_index], fn) +#define CALL_FragmentMaterialfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, const GLfloat *)), driDispatchRemapTable[FragmentMaterialfvSGIX_remap_index], parameters) +#define GET_FragmentMaterialfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentMaterialfvSGIX_remap_index]) +#define SET_FragmentMaterialfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentMaterialfvSGIX_remap_index], fn) +#define CALL_FragmentMaterialiSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint)), driDispatchRemapTable[FragmentMaterialiSGIX_remap_index], parameters) +#define GET_FragmentMaterialiSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentMaterialiSGIX_remap_index]) +#define SET_FragmentMaterialiSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentMaterialiSGIX_remap_index], fn) +#define CALL_FragmentMaterialivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, const GLint *)), driDispatchRemapTable[FragmentMaterialivSGIX_remap_index], parameters) +#define GET_FragmentMaterialivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentMaterialivSGIX_remap_index]) +#define SET_FragmentMaterialivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentMaterialivSGIX_remap_index], fn) +#define CALL_GetFragmentLightfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetFragmentLightfvSGIX_remap_index], parameters) +#define GET_GetFragmentLightfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[GetFragmentLightfvSGIX_remap_index]) +#define SET_GetFragmentLightfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFragmentLightfvSGIX_remap_index], fn) +#define CALL_GetFragmentLightivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetFragmentLightivSGIX_remap_index], parameters) +#define GET_GetFragmentLightivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[GetFragmentLightivSGIX_remap_index]) +#define SET_GetFragmentLightivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFragmentLightivSGIX_remap_index], fn) +#define CALL_GetFragmentMaterialfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetFragmentMaterialfvSGIX_remap_index], parameters) +#define GET_GetFragmentMaterialfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[GetFragmentMaterialfvSGIX_remap_index]) +#define SET_GetFragmentMaterialfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFragmentMaterialfvSGIX_remap_index], fn) +#define CALL_GetFragmentMaterialivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetFragmentMaterialivSGIX_remap_index], parameters) +#define GET_GetFragmentMaterialivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[GetFragmentMaterialivSGIX_remap_index]) +#define SET_GetFragmentMaterialivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFragmentMaterialivSGIX_remap_index], fn) +#define CALL_LightEnviSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[LightEnviSGIX_remap_index], parameters) +#define GET_LightEnviSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[LightEnviSGIX_remap_index]) +#define SET_LightEnviSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LightEnviSGIX_remap_index], fn) +#define CALL_VertexWeightfEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat)), driDispatchRemapTable[VertexWeightfEXT_remap_index], parameters) +#define GET_VertexWeightfEXT(disp) GET_by_offset(disp, driDispatchRemapTable[VertexWeightfEXT_remap_index]) +#define SET_VertexWeightfEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexWeightfEXT_remap_index], fn) +#define CALL_VertexWeightfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[VertexWeightfvEXT_remap_index], parameters) +#define GET_VertexWeightfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[VertexWeightfvEXT_remap_index]) +#define SET_VertexWeightfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexWeightfvEXT_remap_index], fn) +#define CALL_VertexWeightPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[VertexWeightPointerEXT_remap_index], parameters) +#define GET_VertexWeightPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[VertexWeightPointerEXT_remap_index]) +#define SET_VertexWeightPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexWeightPointerEXT_remap_index], fn) +#define CALL_FlushVertexArrayRangeNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index], parameters) +#define GET_FlushVertexArrayRangeNV(disp) GET_by_offset(disp, driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index]) +#define SET_FlushVertexArrayRangeNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index], fn) +#define CALL_VertexArrayRangeNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLvoid *)), driDispatchRemapTable[VertexArrayRangeNV_remap_index], parameters) +#define GET_VertexArrayRangeNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexArrayRangeNV_remap_index]) +#define SET_VertexArrayRangeNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexArrayRangeNV_remap_index], fn) +#define CALL_CombinerParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[CombinerParameterfvNV_remap_index], parameters) +#define GET_CombinerParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameterfvNV_remap_index]) +#define SET_CombinerParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameterfvNV_remap_index], fn) +#define CALL_CombinerParameterfNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[CombinerParameterfNV_remap_index], parameters) +#define GET_CombinerParameterfNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameterfNV_remap_index]) +#define SET_CombinerParameterfNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameterfNV_remap_index], fn) +#define CALL_CombinerParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[CombinerParameterivNV_remap_index], parameters) +#define GET_CombinerParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameterivNV_remap_index]) +#define SET_CombinerParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameterivNV_remap_index], fn) +#define CALL_CombinerParameteriNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[CombinerParameteriNV_remap_index], parameters) +#define GET_CombinerParameteriNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameteriNV_remap_index]) +#define SET_CombinerParameteriNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameteriNV_remap_index], fn) +#define CALL_CombinerInputNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[CombinerInputNV_remap_index], parameters) +#define GET_CombinerInputNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerInputNV_remap_index]) +#define SET_CombinerInputNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerInputNV_remap_index], fn) +#define CALL_CombinerOutputNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean)), driDispatchRemapTable[CombinerOutputNV_remap_index], parameters) +#define GET_CombinerOutputNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerOutputNV_remap_index]) +#define SET_CombinerOutputNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerOutputNV_remap_index], fn) +#define CALL_FinalCombinerInputNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[FinalCombinerInputNV_remap_index], parameters) +#define GET_FinalCombinerInputNV(disp) GET_by_offset(disp, driDispatchRemapTable[FinalCombinerInputNV_remap_index]) +#define SET_FinalCombinerInputNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FinalCombinerInputNV_remap_index], fn) +#define CALL_GetCombinerInputParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index], parameters) +#define GET_GetCombinerInputParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index]) +#define SET_GetCombinerInputParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index], fn) +#define CALL_GetCombinerInputParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLint *)), driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index], parameters) +#define GET_GetCombinerInputParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index]) +#define SET_GetCombinerInputParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index], fn) +#define CALL_GetCombinerOutputParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index], parameters) +#define GET_GetCombinerOutputParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index]) +#define SET_GetCombinerOutputParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index], fn) +#define CALL_GetCombinerOutputParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLint *)), driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index], parameters) +#define GET_GetCombinerOutputParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index]) +#define SET_GetCombinerOutputParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index], fn) +#define CALL_GetFinalCombinerInputParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index], parameters) +#define GET_GetFinalCombinerInputParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index]) +#define SET_GetFinalCombinerInputParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index], fn) +#define CALL_GetFinalCombinerInputParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index], parameters) +#define GET_GetFinalCombinerInputParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index]) +#define SET_GetFinalCombinerInputParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index], fn) +#define CALL_ResizeBuffersMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[ResizeBuffersMESA_remap_index], parameters) +#define GET_ResizeBuffersMESA(disp) GET_by_offset(disp, driDispatchRemapTable[ResizeBuffersMESA_remap_index]) +#define SET_ResizeBuffersMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ResizeBuffersMESA_remap_index], fn) +#define CALL_WindowPos2dMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble)), driDispatchRemapTable[WindowPos2dMESA_remap_index], parameters) +#define GET_WindowPos2dMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2dMESA_remap_index]) +#define SET_WindowPos2dMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2dMESA_remap_index], fn) +#define CALL_WindowPos2dvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[WindowPos2dvMESA_remap_index], parameters) +#define GET_WindowPos2dvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2dvMESA_remap_index]) +#define SET_WindowPos2dvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2dvMESA_remap_index], fn) +#define CALL_WindowPos2fMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat)), driDispatchRemapTable[WindowPos2fMESA_remap_index], parameters) +#define GET_WindowPos2fMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2fMESA_remap_index]) +#define SET_WindowPos2fMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2fMESA_remap_index], fn) +#define CALL_WindowPos2fvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[WindowPos2fvMESA_remap_index], parameters) +#define GET_WindowPos2fvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2fvMESA_remap_index]) +#define SET_WindowPos2fvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2fvMESA_remap_index], fn) +#define CALL_WindowPos2iMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint)), driDispatchRemapTable[WindowPos2iMESA_remap_index], parameters) +#define GET_WindowPos2iMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2iMESA_remap_index]) +#define SET_WindowPos2iMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2iMESA_remap_index], fn) +#define CALL_WindowPos2ivMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[WindowPos2ivMESA_remap_index], parameters) +#define GET_WindowPos2ivMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2ivMESA_remap_index]) +#define SET_WindowPos2ivMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2ivMESA_remap_index], fn) +#define CALL_WindowPos2sMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort)), driDispatchRemapTable[WindowPos2sMESA_remap_index], parameters) +#define GET_WindowPos2sMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2sMESA_remap_index]) +#define SET_WindowPos2sMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2sMESA_remap_index], fn) +#define CALL_WindowPos2svMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[WindowPos2svMESA_remap_index], parameters) +#define GET_WindowPos2svMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2svMESA_remap_index]) +#define SET_WindowPos2svMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2svMESA_remap_index], fn) +#define CALL_WindowPos3dMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[WindowPos3dMESA_remap_index], parameters) +#define GET_WindowPos3dMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3dMESA_remap_index]) +#define SET_WindowPos3dMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3dMESA_remap_index], fn) +#define CALL_WindowPos3dvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[WindowPos3dvMESA_remap_index], parameters) +#define GET_WindowPos3dvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3dvMESA_remap_index]) +#define SET_WindowPos3dvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3dvMESA_remap_index], fn) +#define CALL_WindowPos3fMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[WindowPos3fMESA_remap_index], parameters) +#define GET_WindowPos3fMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3fMESA_remap_index]) +#define SET_WindowPos3fMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3fMESA_remap_index], fn) +#define CALL_WindowPos3fvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[WindowPos3fvMESA_remap_index], parameters) +#define GET_WindowPos3fvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3fvMESA_remap_index]) +#define SET_WindowPos3fvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3fvMESA_remap_index], fn) +#define CALL_WindowPos3iMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint)), driDispatchRemapTable[WindowPos3iMESA_remap_index], parameters) +#define GET_WindowPos3iMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3iMESA_remap_index]) +#define SET_WindowPos3iMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3iMESA_remap_index], fn) +#define CALL_WindowPos3ivMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[WindowPos3ivMESA_remap_index], parameters) +#define GET_WindowPos3ivMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3ivMESA_remap_index]) +#define SET_WindowPos3ivMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3ivMESA_remap_index], fn) +#define CALL_WindowPos3sMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort, GLshort)), driDispatchRemapTable[WindowPos3sMESA_remap_index], parameters) +#define GET_WindowPos3sMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3sMESA_remap_index]) +#define SET_WindowPos3sMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3sMESA_remap_index], fn) +#define CALL_WindowPos3svMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[WindowPos3svMESA_remap_index], parameters) +#define GET_WindowPos3svMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3svMESA_remap_index]) +#define SET_WindowPos3svMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3svMESA_remap_index], fn) +#define CALL_WindowPos4dMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[WindowPos4dMESA_remap_index], parameters) +#define GET_WindowPos4dMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4dMESA_remap_index]) +#define SET_WindowPos4dMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4dMESA_remap_index], fn) +#define CALL_WindowPos4dvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[WindowPos4dvMESA_remap_index], parameters) +#define GET_WindowPos4dvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4dvMESA_remap_index]) +#define SET_WindowPos4dvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4dvMESA_remap_index], fn) +#define CALL_WindowPos4fMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[WindowPos4fMESA_remap_index], parameters) +#define GET_WindowPos4fMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4fMESA_remap_index]) +#define SET_WindowPos4fMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4fMESA_remap_index], fn) +#define CALL_WindowPos4fvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[WindowPos4fvMESA_remap_index], parameters) +#define GET_WindowPos4fvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4fvMESA_remap_index]) +#define SET_WindowPos4fvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4fvMESA_remap_index], fn) +#define CALL_WindowPos4iMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint)), driDispatchRemapTable[WindowPos4iMESA_remap_index], parameters) +#define GET_WindowPos4iMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4iMESA_remap_index]) +#define SET_WindowPos4iMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4iMESA_remap_index], fn) +#define CALL_WindowPos4ivMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[WindowPos4ivMESA_remap_index], parameters) +#define GET_WindowPos4ivMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4ivMESA_remap_index]) +#define SET_WindowPos4ivMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4ivMESA_remap_index], fn) +#define CALL_WindowPos4sMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort, GLshort, GLshort)), driDispatchRemapTable[WindowPos4sMESA_remap_index], parameters) +#define GET_WindowPos4sMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4sMESA_remap_index]) +#define SET_WindowPos4sMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4sMESA_remap_index], fn) +#define CALL_WindowPos4svMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[WindowPos4svMESA_remap_index], parameters) +#define GET_WindowPos4svMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4svMESA_remap_index]) +#define SET_WindowPos4svMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4svMESA_remap_index], fn) +#define CALL_BlendFuncSeparateEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[BlendFuncSeparateEXT_remap_index], parameters) +#define GET_BlendFuncSeparateEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BlendFuncSeparateEXT_remap_index]) +#define SET_BlendFuncSeparateEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BlendFuncSeparateEXT_remap_index], fn) +#define CALL_IndexMaterialEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum)), driDispatchRemapTable[IndexMaterialEXT_remap_index], parameters) +#define GET_IndexMaterialEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IndexMaterialEXT_remap_index]) +#define SET_IndexMaterialEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IndexMaterialEXT_remap_index], fn) +#define CALL_IndexFuncEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLclampf)), driDispatchRemapTable[IndexFuncEXT_remap_index], parameters) +#define GET_IndexFuncEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IndexFuncEXT_remap_index]) +#define SET_IndexFuncEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IndexFuncEXT_remap_index], fn) +#define CALL_LockArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei)), driDispatchRemapTable[LockArraysEXT_remap_index], parameters) +#define GET_LockArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[LockArraysEXT_remap_index]) +#define SET_LockArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LockArraysEXT_remap_index], fn) +#define CALL_UnlockArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[UnlockArraysEXT_remap_index], parameters) +#define GET_UnlockArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[UnlockArraysEXT_remap_index]) +#define SET_UnlockArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UnlockArraysEXT_remap_index], fn) +#define CALL_CullParameterdvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLdouble *)), driDispatchRemapTable[CullParameterdvEXT_remap_index], parameters) +#define GET_CullParameterdvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[CullParameterdvEXT_remap_index]) +#define SET_CullParameterdvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CullParameterdvEXT_remap_index], fn) +#define CALL_CullParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[CullParameterfvEXT_remap_index], parameters) +#define GET_CullParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[CullParameterfvEXT_remap_index]) +#define SET_CullParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CullParameterfvEXT_remap_index], fn) +#define CALL_HintPGI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[HintPGI_remap_index], parameters) +#define GET_HintPGI(disp) GET_by_offset(disp, driDispatchRemapTable[HintPGI_remap_index]) +#define SET_HintPGI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[HintPGI_remap_index], fn) +#define CALL_FogCoordfEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat)), driDispatchRemapTable[FogCoordfEXT_remap_index], parameters) +#define GET_FogCoordfEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoordfEXT_remap_index]) +#define SET_FogCoordfEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoordfEXT_remap_index], fn) +#define CALL_FogCoordfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[FogCoordfvEXT_remap_index], parameters) +#define GET_FogCoordfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoordfvEXT_remap_index]) +#define SET_FogCoordfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoordfvEXT_remap_index], fn) +#define CALL_FogCoorddEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble)), driDispatchRemapTable[FogCoorddEXT_remap_index], parameters) +#define GET_FogCoorddEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoorddEXT_remap_index]) +#define SET_FogCoorddEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoorddEXT_remap_index], fn) +#define CALL_FogCoorddvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[FogCoorddvEXT_remap_index], parameters) +#define GET_FogCoorddvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoorddvEXT_remap_index]) +#define SET_FogCoorddvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoorddvEXT_remap_index], fn) +#define CALL_FogCoordPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[FogCoordPointerEXT_remap_index], parameters) +#define GET_FogCoordPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoordPointerEXT_remap_index]) +#define SET_FogCoordPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoordPointerEXT_remap_index], fn) +#define CALL_GetColorTableEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLvoid *)), driDispatchRemapTable[GetColorTableEXT_remap_index], parameters) +#define GET_GetColorTableEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetColorTableEXT_remap_index]) +#define SET_GetColorTableEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetColorTableEXT_remap_index], fn) +#define CALL_GetColorTableParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetColorTableParameterivEXT_remap_index], parameters) +#define GET_GetColorTableParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterivEXT_remap_index]) +#define SET_GetColorTableParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterivEXT_remap_index], fn) +#define CALL_GetColorTableParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetColorTableParameterfvEXT_remap_index], parameters) +#define GET_GetColorTableParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterfvEXT_remap_index]) +#define SET_GetColorTableParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterfvEXT_remap_index], fn) +#define CALL_TbufferMask3DFX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[TbufferMask3DFX_remap_index], parameters) +#define GET_TbufferMask3DFX(disp) GET_by_offset(disp, driDispatchRemapTable[TbufferMask3DFX_remap_index]) +#define SET_TbufferMask3DFX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TbufferMask3DFX_remap_index], fn) +#define CALL_CompressedTexImage3DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexImage3DARB_remap_index], parameters) +#define GET_CompressedTexImage3DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexImage3DARB_remap_index]) +#define SET_CompressedTexImage3DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexImage3DARB_remap_index], fn) +#define CALL_CompressedTexImage2DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexImage2DARB_remap_index], parameters) +#define GET_CompressedTexImage2DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexImage2DARB_remap_index]) +#define SET_CompressedTexImage2DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexImage2DARB_remap_index], fn) +#define CALL_CompressedTexImage1DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexImage1DARB_remap_index], parameters) +#define GET_CompressedTexImage1DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexImage1DARB_remap_index]) +#define SET_CompressedTexImage1DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexImage1DARB_remap_index], fn) +#define CALL_CompressedTexSubImage3DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index], parameters) +#define GET_CompressedTexSubImage3DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index]) +#define SET_CompressedTexSubImage3DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index], fn) +#define CALL_CompressedTexSubImage2DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index], parameters) +#define GET_CompressedTexSubImage2DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index]) +#define SET_CompressedTexSubImage2DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index], fn) +#define CALL_CompressedTexSubImage1DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index], parameters) +#define GET_CompressedTexSubImage1DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index]) +#define SET_CompressedTexSubImage1DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index], fn) +#define CALL_GetCompressedTexImageARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLvoid *)), driDispatchRemapTable[GetCompressedTexImageARB_remap_index], parameters) +#define GET_GetCompressedTexImageARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetCompressedTexImageARB_remap_index]) +#define SET_GetCompressedTexImageARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCompressedTexImageARB_remap_index], fn) +#define CALL_SecondaryColor3bEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLbyte, GLbyte, GLbyte)), driDispatchRemapTable[SecondaryColor3bEXT_remap_index], parameters) +#define GET_SecondaryColor3bEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bEXT_remap_index]) +#define SET_SecondaryColor3bEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bEXT_remap_index], fn) +#define CALL_SecondaryColor3bvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLbyte *)), driDispatchRemapTable[SecondaryColor3bvEXT_remap_index], parameters) +#define GET_SecondaryColor3bvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bvEXT_remap_index]) +#define SET_SecondaryColor3bvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bvEXT_remap_index], fn) +#define CALL_SecondaryColor3dEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[SecondaryColor3dEXT_remap_index], parameters) +#define GET_SecondaryColor3dEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dEXT_remap_index]) +#define SET_SecondaryColor3dEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dEXT_remap_index], fn) +#define CALL_SecondaryColor3dvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[SecondaryColor3dvEXT_remap_index], parameters) +#define GET_SecondaryColor3dvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dvEXT_remap_index]) +#define SET_SecondaryColor3dvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dvEXT_remap_index], fn) +#define CALL_SecondaryColor3fEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[SecondaryColor3fEXT_remap_index], parameters) +#define GET_SecondaryColor3fEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fEXT_remap_index]) +#define SET_SecondaryColor3fEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fEXT_remap_index], fn) +#define CALL_SecondaryColor3fvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[SecondaryColor3fvEXT_remap_index], parameters) +#define GET_SecondaryColor3fvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fvEXT_remap_index]) +#define SET_SecondaryColor3fvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fvEXT_remap_index], fn) +#define CALL_SecondaryColor3iEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint)), driDispatchRemapTable[SecondaryColor3iEXT_remap_index], parameters) +#define GET_SecondaryColor3iEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3iEXT_remap_index]) +#define SET_SecondaryColor3iEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3iEXT_remap_index], fn) +#define CALL_SecondaryColor3ivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[SecondaryColor3ivEXT_remap_index], parameters) +#define GET_SecondaryColor3ivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ivEXT_remap_index]) +#define SET_SecondaryColor3ivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ivEXT_remap_index], fn) +#define CALL_SecondaryColor3sEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort, GLshort)), driDispatchRemapTable[SecondaryColor3sEXT_remap_index], parameters) +#define GET_SecondaryColor3sEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3sEXT_remap_index]) +#define SET_SecondaryColor3sEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3sEXT_remap_index], fn) +#define CALL_SecondaryColor3svEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[SecondaryColor3svEXT_remap_index], parameters) +#define GET_SecondaryColor3svEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3svEXT_remap_index]) +#define SET_SecondaryColor3svEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3svEXT_remap_index], fn) +#define CALL_SecondaryColor3ubEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLubyte, GLubyte, GLubyte)), driDispatchRemapTable[SecondaryColor3ubEXT_remap_index], parameters) +#define GET_SecondaryColor3ubEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubEXT_remap_index]) +#define SET_SecondaryColor3ubEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubEXT_remap_index], fn) +#define CALL_SecondaryColor3ubvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLubyte *)), driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index], parameters) +#define GET_SecondaryColor3ubvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index]) +#define SET_SecondaryColor3ubvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index], fn) +#define CALL_SecondaryColor3uiEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint, GLuint)), driDispatchRemapTable[SecondaryColor3uiEXT_remap_index], parameters) +#define GET_SecondaryColor3uiEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uiEXT_remap_index]) +#define SET_SecondaryColor3uiEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uiEXT_remap_index], fn) +#define CALL_SecondaryColor3uivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLuint *)), driDispatchRemapTable[SecondaryColor3uivEXT_remap_index], parameters) +#define GET_SecondaryColor3uivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uivEXT_remap_index]) +#define SET_SecondaryColor3uivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uivEXT_remap_index], fn) +#define CALL_SecondaryColor3usEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLushort, GLushort, GLushort)), driDispatchRemapTable[SecondaryColor3usEXT_remap_index], parameters) +#define GET_SecondaryColor3usEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usEXT_remap_index]) +#define SET_SecondaryColor3usEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usEXT_remap_index], fn) +#define CALL_SecondaryColor3usvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLushort *)), driDispatchRemapTable[SecondaryColor3usvEXT_remap_index], parameters) +#define GET_SecondaryColor3usvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usvEXT_remap_index]) +#define SET_SecondaryColor3usvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usvEXT_remap_index], fn) +#define CALL_SecondaryColorPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[SecondaryColorPointerEXT_remap_index], parameters) +#define GET_SecondaryColorPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColorPointerEXT_remap_index]) +#define SET_SecondaryColorPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColorPointerEXT_remap_index], fn) +#define CALL_AreProgramsResidentNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLsizei, const GLuint *, GLboolean *)), driDispatchRemapTable[AreProgramsResidentNV_remap_index], parameters) +#define GET_AreProgramsResidentNV(disp) GET_by_offset(disp, driDispatchRemapTable[AreProgramsResidentNV_remap_index]) +#define SET_AreProgramsResidentNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AreProgramsResidentNV_remap_index], fn) +#define CALL_BindProgramNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindProgramNV_remap_index], parameters) +#define GET_BindProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[BindProgramNV_remap_index]) +#define SET_BindProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindProgramNV_remap_index], fn) +#define CALL_DeleteProgramsNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteProgramsNV_remap_index], parameters) +#define GET_DeleteProgramsNV(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteProgramsNV_remap_index]) +#define SET_DeleteProgramsNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteProgramsNV_remap_index], fn) +#define CALL_ExecuteProgramNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLfloat *)), driDispatchRemapTable[ExecuteProgramNV_remap_index], parameters) +#define GET_ExecuteProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[ExecuteProgramNV_remap_index]) +#define SET_ExecuteProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ExecuteProgramNV_remap_index], fn) +#define CALL_GenProgramsNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenProgramsNV_remap_index], parameters) +#define GET_GenProgramsNV(disp) GET_by_offset(disp, driDispatchRemapTable[GenProgramsNV_remap_index]) +#define SET_GenProgramsNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenProgramsNV_remap_index], fn) +#define CALL_GetProgramParameterdvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLdouble *)), driDispatchRemapTable[GetProgramParameterdvNV_remap_index], parameters) +#define GET_GetProgramParameterdvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramParameterdvNV_remap_index]) +#define SET_GetProgramParameterdvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramParameterdvNV_remap_index], fn) +#define CALL_GetProgramParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLfloat *)), driDispatchRemapTable[GetProgramParameterfvNV_remap_index], parameters) +#define GET_GetProgramParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramParameterfvNV_remap_index]) +#define SET_GetProgramParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramParameterfvNV_remap_index], fn) +#define CALL_GetProgramivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetProgramivNV_remap_index], parameters) +#define GET_GetProgramivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramivNV_remap_index]) +#define SET_GetProgramivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramivNV_remap_index], fn) +#define CALL_GetProgramStringNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLubyte *)), driDispatchRemapTable[GetProgramStringNV_remap_index], parameters) +#define GET_GetProgramStringNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramStringNV_remap_index]) +#define SET_GetProgramStringNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramStringNV_remap_index], fn) +#define CALL_GetTrackMatrixivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLint *)), driDispatchRemapTable[GetTrackMatrixivNV_remap_index], parameters) +#define GET_GetTrackMatrixivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetTrackMatrixivNV_remap_index]) +#define SET_GetTrackMatrixivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTrackMatrixivNV_remap_index], fn) +#define CALL_GetVertexAttribdvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLdouble *)), driDispatchRemapTable[GetVertexAttribdvARB_remap_index], parameters) +#define GET_GetVertexAttribdvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvARB_remap_index]) +#define SET_GetVertexAttribdvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvARB_remap_index], fn) +#define CALL_GetVertexAttribfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLfloat *)), driDispatchRemapTable[GetVertexAttribfvARB_remap_index], parameters) +#define GET_GetVertexAttribfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvARB_remap_index]) +#define SET_GetVertexAttribfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvARB_remap_index], fn) +#define CALL_GetVertexAttribivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetVertexAttribivARB_remap_index], parameters) +#define GET_GetVertexAttribivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivARB_remap_index]) +#define SET_GetVertexAttribivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivARB_remap_index], fn) +#define CALL_GetVertexAttribPointervNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLvoid **)), driDispatchRemapTable[GetVertexAttribPointervNV_remap_index], parameters) +#define GET_GetVertexAttribPointervNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribPointervNV_remap_index]) +#define SET_GetVertexAttribPointervNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribPointervNV_remap_index], fn) +#define CALL_IsProgramNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsProgramNV_remap_index], parameters) +#define GET_IsProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[IsProgramNV_remap_index]) +#define SET_IsProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsProgramNV_remap_index], fn) +#define CALL_LoadProgramNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLsizei, const GLubyte *)), driDispatchRemapTable[LoadProgramNV_remap_index], parameters) +#define GET_LoadProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[LoadProgramNV_remap_index]) +#define SET_LoadProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LoadProgramNV_remap_index], fn) +#define CALL_ProgramParameter4dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[ProgramParameter4dNV_remap_index], parameters) +#define GET_ProgramParameter4dNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameter4dNV_remap_index]) +#define SET_ProgramParameter4dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameter4dNV_remap_index], fn) +#define CALL_ProgramParameter4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLdouble *)), driDispatchRemapTable[ProgramParameter4dvNV_remap_index], parameters) +#define GET_ProgramParameter4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameter4dvNV_remap_index]) +#define SET_ProgramParameter4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameter4dvNV_remap_index], fn) +#define CALL_ProgramParameter4fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[ProgramParameter4fNV_remap_index], parameters) +#define GET_ProgramParameter4fNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameter4fNV_remap_index]) +#define SET_ProgramParameter4fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameter4fNV_remap_index], fn) +#define CALL_ProgramParameter4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLfloat *)), driDispatchRemapTable[ProgramParameter4fvNV_remap_index], parameters) +#define GET_ProgramParameter4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameter4fvNV_remap_index]) +#define SET_ProgramParameter4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameter4fvNV_remap_index], fn) +#define CALL_ProgramParameters4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, const GLdouble *)), driDispatchRemapTable[ProgramParameters4dvNV_remap_index], parameters) +#define GET_ProgramParameters4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameters4dvNV_remap_index]) +#define SET_ProgramParameters4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameters4dvNV_remap_index], fn) +#define CALL_ProgramParameters4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, const GLfloat *)), driDispatchRemapTable[ProgramParameters4fvNV_remap_index], parameters) +#define GET_ProgramParameters4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameters4fvNV_remap_index]) +#define SET_ProgramParameters4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameters4fvNV_remap_index], fn) +#define CALL_RequestResidentProgramsNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[RequestResidentProgramsNV_remap_index], parameters) +#define GET_RequestResidentProgramsNV(disp) GET_by_offset(disp, driDispatchRemapTable[RequestResidentProgramsNV_remap_index]) +#define SET_RequestResidentProgramsNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[RequestResidentProgramsNV_remap_index], fn) +#define CALL_TrackMatrixNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLenum)), driDispatchRemapTable[TrackMatrixNV_remap_index], parameters) +#define GET_TrackMatrixNV(disp) GET_by_offset(disp, driDispatchRemapTable[TrackMatrixNV_remap_index]) +#define SET_TrackMatrixNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TrackMatrixNV_remap_index], fn) +#define CALL_VertexAttribPointerNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLint, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[VertexAttribPointerNV_remap_index], parameters) +#define GET_VertexAttribPointerNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerNV_remap_index]) +#define SET_VertexAttribPointerNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerNV_remap_index], fn) +#define CALL_VertexAttrib1dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble)), driDispatchRemapTable[VertexAttrib1dARB_remap_index], parameters) +#define GET_VertexAttrib1dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dARB_remap_index]) +#define SET_VertexAttrib1dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dARB_remap_index], fn) +#define CALL_VertexAttrib1dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib1dvARB_remap_index], parameters) +#define GET_VertexAttrib1dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvARB_remap_index]) +#define SET_VertexAttrib1dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvARB_remap_index], fn) +#define CALL_VertexAttrib1fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat)), driDispatchRemapTable[VertexAttrib1fARB_remap_index], parameters) +#define GET_VertexAttrib1fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fARB_remap_index]) +#define SET_VertexAttrib1fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fARB_remap_index], fn) +#define CALL_VertexAttrib1fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib1fvARB_remap_index], parameters) +#define GET_VertexAttrib1fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvARB_remap_index]) +#define SET_VertexAttrib1fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvARB_remap_index], fn) +#define CALL_VertexAttrib1sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort)), driDispatchRemapTable[VertexAttrib1sARB_remap_index], parameters) +#define GET_VertexAttrib1sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sARB_remap_index]) +#define SET_VertexAttrib1sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sARB_remap_index], fn) +#define CALL_VertexAttrib1svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib1svARB_remap_index], parameters) +#define GET_VertexAttrib1svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svARB_remap_index]) +#define SET_VertexAttrib1svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svARB_remap_index], fn) +#define CALL_VertexAttrib2dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib2dARB_remap_index], parameters) +#define GET_VertexAttrib2dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dARB_remap_index]) +#define SET_VertexAttrib2dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dARB_remap_index], fn) +#define CALL_VertexAttrib2dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib2dvARB_remap_index], parameters) +#define GET_VertexAttrib2dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvARB_remap_index]) +#define SET_VertexAttrib2dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvARB_remap_index], fn) +#define CALL_VertexAttrib2fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib2fARB_remap_index], parameters) +#define GET_VertexAttrib2fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fARB_remap_index]) +#define SET_VertexAttrib2fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fARB_remap_index], fn) +#define CALL_VertexAttrib2fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib2fvARB_remap_index], parameters) +#define GET_VertexAttrib2fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvARB_remap_index]) +#define SET_VertexAttrib2fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvARB_remap_index], fn) +#define CALL_VertexAttrib2sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib2sARB_remap_index], parameters) +#define GET_VertexAttrib2sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sARB_remap_index]) +#define SET_VertexAttrib2sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sARB_remap_index], fn) +#define CALL_VertexAttrib2svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib2svARB_remap_index], parameters) +#define GET_VertexAttrib2svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svARB_remap_index]) +#define SET_VertexAttrib2svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svARB_remap_index], fn) +#define CALL_VertexAttrib3dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib3dARB_remap_index], parameters) +#define GET_VertexAttrib3dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dARB_remap_index]) +#define SET_VertexAttrib3dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dARB_remap_index], fn) +#define CALL_VertexAttrib3dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib3dvARB_remap_index], parameters) +#define GET_VertexAttrib3dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvARB_remap_index]) +#define SET_VertexAttrib3dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvARB_remap_index], fn) +#define CALL_VertexAttrib3fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib3fARB_remap_index], parameters) +#define GET_VertexAttrib3fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fARB_remap_index]) +#define SET_VertexAttrib3fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fARB_remap_index], fn) +#define CALL_VertexAttrib3fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib3fvARB_remap_index], parameters) +#define GET_VertexAttrib3fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvARB_remap_index]) +#define SET_VertexAttrib3fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvARB_remap_index], fn) +#define CALL_VertexAttrib3sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib3sARB_remap_index], parameters) +#define GET_VertexAttrib3sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sARB_remap_index]) +#define SET_VertexAttrib3sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sARB_remap_index], fn) +#define CALL_VertexAttrib3svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib3svARB_remap_index], parameters) +#define GET_VertexAttrib3svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svARB_remap_index]) +#define SET_VertexAttrib3svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svARB_remap_index], fn) +#define CALL_VertexAttrib4dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib4dARB_remap_index], parameters) +#define GET_VertexAttrib4dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dARB_remap_index]) +#define SET_VertexAttrib4dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dARB_remap_index], fn) +#define CALL_VertexAttrib4dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib4dvARB_remap_index], parameters) +#define GET_VertexAttrib4dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvARB_remap_index]) +#define SET_VertexAttrib4dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvARB_remap_index], fn) +#define CALL_VertexAttrib4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib4fARB_remap_index], parameters) +#define GET_VertexAttrib4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fARB_remap_index]) +#define SET_VertexAttrib4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fARB_remap_index], fn) +#define CALL_VertexAttrib4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib4fvARB_remap_index], parameters) +#define GET_VertexAttrib4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvARB_remap_index]) +#define SET_VertexAttrib4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvARB_remap_index], fn) +#define CALL_VertexAttrib4sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib4sARB_remap_index], parameters) +#define GET_VertexAttrib4sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sARB_remap_index]) +#define SET_VertexAttrib4sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sARB_remap_index], fn) +#define CALL_VertexAttrib4svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib4svARB_remap_index], parameters) +#define GET_VertexAttrib4svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svARB_remap_index]) +#define SET_VertexAttrib4svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svARB_remap_index], fn) +#define CALL_VertexAttrib4NubARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte)), driDispatchRemapTable[VertexAttrib4NubARB_remap_index], parameters) +#define GET_VertexAttrib4NubARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubARB_remap_index]) +#define SET_VertexAttrib4NubARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubARB_remap_index], fn) +#define CALL_VertexAttrib4NubvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLubyte *)), driDispatchRemapTable[VertexAttrib4NubvARB_remap_index], parameters) +#define GET_VertexAttrib4NubvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubvARB_remap_index]) +#define SET_VertexAttrib4NubvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubvARB_remap_index], fn) +#define CALL_VertexAttribs1dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs1dvNV_remap_index], parameters) +#define GET_VertexAttribs1dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs1dvNV_remap_index]) +#define SET_VertexAttribs1dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs1dvNV_remap_index], fn) +#define CALL_VertexAttribs1fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs1fvNV_remap_index], parameters) +#define GET_VertexAttribs1fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs1fvNV_remap_index]) +#define SET_VertexAttribs1fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs1fvNV_remap_index], fn) +#define CALL_VertexAttribs1svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs1svNV_remap_index], parameters) +#define GET_VertexAttribs1svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs1svNV_remap_index]) +#define SET_VertexAttribs1svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs1svNV_remap_index], fn) +#define CALL_VertexAttribs2dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs2dvNV_remap_index], parameters) +#define GET_VertexAttribs2dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs2dvNV_remap_index]) +#define SET_VertexAttribs2dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs2dvNV_remap_index], fn) +#define CALL_VertexAttribs2fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs2fvNV_remap_index], parameters) +#define GET_VertexAttribs2fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs2fvNV_remap_index]) +#define SET_VertexAttribs2fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs2fvNV_remap_index], fn) +#define CALL_VertexAttribs2svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs2svNV_remap_index], parameters) +#define GET_VertexAttribs2svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs2svNV_remap_index]) +#define SET_VertexAttribs2svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs2svNV_remap_index], fn) +#define CALL_VertexAttribs3dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs3dvNV_remap_index], parameters) +#define GET_VertexAttribs3dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs3dvNV_remap_index]) +#define SET_VertexAttribs3dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs3dvNV_remap_index], fn) +#define CALL_VertexAttribs3fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs3fvNV_remap_index], parameters) +#define GET_VertexAttribs3fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs3fvNV_remap_index]) +#define SET_VertexAttribs3fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs3fvNV_remap_index], fn) +#define CALL_VertexAttribs3svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs3svNV_remap_index], parameters) +#define GET_VertexAttribs3svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs3svNV_remap_index]) +#define SET_VertexAttribs3svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs3svNV_remap_index], fn) +#define CALL_VertexAttribs4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs4dvNV_remap_index], parameters) +#define GET_VertexAttribs4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4dvNV_remap_index]) +#define SET_VertexAttribs4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4dvNV_remap_index], fn) +#define CALL_VertexAttribs4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs4fvNV_remap_index], parameters) +#define GET_VertexAttribs4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4fvNV_remap_index]) +#define SET_VertexAttribs4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4fvNV_remap_index], fn) +#define CALL_VertexAttribs4svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs4svNV_remap_index], parameters) +#define GET_VertexAttribs4svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4svNV_remap_index]) +#define SET_VertexAttribs4svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4svNV_remap_index], fn) +#define CALL_VertexAttribs4ubvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *)), driDispatchRemapTable[VertexAttribs4ubvNV_remap_index], parameters) +#define GET_VertexAttribs4ubvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4ubvNV_remap_index]) +#define SET_VertexAttribs4ubvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4ubvNV_remap_index], fn) +#define CALL_PointParameteriNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[PointParameteriNV_remap_index], parameters) +#define GET_PointParameteriNV(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameteriNV_remap_index]) +#define SET_PointParameteriNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameteriNV_remap_index], fn) +#define CALL_PointParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[PointParameterivNV_remap_index], parameters) +#define GET_PointParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameterivNV_remap_index]) +#define SET_PointParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameterivNV_remap_index], fn) +#define CALL_MultiDrawArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint *, GLsizei *, GLsizei)), driDispatchRemapTable[MultiDrawArraysEXT_remap_index], parameters) +#define GET_MultiDrawArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[MultiDrawArraysEXT_remap_index]) +#define SET_MultiDrawArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiDrawArraysEXT_remap_index], fn) +#define CALL_MultiDrawElementsEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei)), driDispatchRemapTable[MultiDrawElementsEXT_remap_index], parameters) +#define GET_MultiDrawElementsEXT(disp) GET_by_offset(disp, driDispatchRemapTable[MultiDrawElementsEXT_remap_index]) +#define SET_MultiDrawElementsEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiDrawElementsEXT_remap_index], fn) +#define CALL_ActiveStencilFaceEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[ActiveStencilFaceEXT_remap_index], parameters) +#define GET_ActiveStencilFaceEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ActiveStencilFaceEXT_remap_index]) +#define SET_ActiveStencilFaceEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ActiveStencilFaceEXT_remap_index], fn) +#define CALL_DeleteFencesNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteFencesNV_remap_index], parameters) +#define GET_DeleteFencesNV(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteFencesNV_remap_index]) +#define SET_DeleteFencesNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteFencesNV_remap_index], fn) +#define CALL_GenFencesNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenFencesNV_remap_index], parameters) +#define GET_GenFencesNV(disp) GET_by_offset(disp, driDispatchRemapTable[GenFencesNV_remap_index]) +#define SET_GenFencesNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenFencesNV_remap_index], fn) +#define CALL_IsFenceNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsFenceNV_remap_index], parameters) +#define GET_IsFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[IsFenceNV_remap_index]) +#define SET_IsFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsFenceNV_remap_index], fn) +#define CALL_TestFenceNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[TestFenceNV_remap_index], parameters) +#define GET_TestFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[TestFenceNV_remap_index]) +#define SET_TestFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TestFenceNV_remap_index], fn) +#define CALL_GetFenceivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetFenceivNV_remap_index], parameters) +#define GET_GetFenceivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetFenceivNV_remap_index]) +#define SET_GetFenceivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFenceivNV_remap_index], fn) +#define CALL_FinishFenceNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[FinishFenceNV_remap_index], parameters) +#define GET_FinishFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[FinishFenceNV_remap_index]) +#define SET_FinishFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FinishFenceNV_remap_index], fn) +#define CALL_SetFenceNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum)), driDispatchRemapTable[SetFenceNV_remap_index], parameters) +#define GET_SetFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[SetFenceNV_remap_index]) +#define SET_SetFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SetFenceNV_remap_index], fn) +#define CALL_VertexAttrib4bvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLbyte *)), driDispatchRemapTable[VertexAttrib4bvARB_remap_index], parameters) +#define GET_VertexAttrib4bvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4bvARB_remap_index]) +#define SET_VertexAttrib4bvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4bvARB_remap_index], fn) +#define CALL_VertexAttrib4ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLint *)), driDispatchRemapTable[VertexAttrib4ivARB_remap_index], parameters) +#define GET_VertexAttrib4ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ivARB_remap_index]) +#define SET_VertexAttrib4ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ivARB_remap_index], fn) +#define CALL_VertexAttrib4ubvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLubyte *)), driDispatchRemapTable[VertexAttrib4ubvARB_remap_index], parameters) +#define GET_VertexAttrib4ubvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvARB_remap_index]) +#define SET_VertexAttrib4ubvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvARB_remap_index], fn) +#define CALL_VertexAttrib4usvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLushort *)), driDispatchRemapTable[VertexAttrib4usvARB_remap_index], parameters) +#define GET_VertexAttrib4usvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4usvARB_remap_index]) +#define SET_VertexAttrib4usvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4usvARB_remap_index], fn) +#define CALL_VertexAttrib4uivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLuint *)), driDispatchRemapTable[VertexAttrib4uivARB_remap_index], parameters) +#define GET_VertexAttrib4uivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4uivARB_remap_index]) +#define SET_VertexAttrib4uivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4uivARB_remap_index], fn) +#define CALL_VertexAttrib4NbvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLbyte *)), driDispatchRemapTable[VertexAttrib4NbvARB_remap_index], parameters) +#define GET_VertexAttrib4NbvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NbvARB_remap_index]) +#define SET_VertexAttrib4NbvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NbvARB_remap_index], fn) +#define CALL_VertexAttrib4NsvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib4NsvARB_remap_index], parameters) +#define GET_VertexAttrib4NsvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NsvARB_remap_index]) +#define SET_VertexAttrib4NsvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NsvARB_remap_index], fn) +#define CALL_VertexAttrib4NivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLint *)), driDispatchRemapTable[VertexAttrib4NivARB_remap_index], parameters) +#define GET_VertexAttrib4NivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NivARB_remap_index]) +#define SET_VertexAttrib4NivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NivARB_remap_index], fn) +#define CALL_VertexAttrib4NusvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLushort *)), driDispatchRemapTable[VertexAttrib4NusvARB_remap_index], parameters) +#define GET_VertexAttrib4NusvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NusvARB_remap_index]) +#define SET_VertexAttrib4NusvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NusvARB_remap_index], fn) +#define CALL_VertexAttrib4NuivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLuint *)), driDispatchRemapTable[VertexAttrib4NuivARB_remap_index], parameters) +#define GET_VertexAttrib4NuivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NuivARB_remap_index]) +#define SET_VertexAttrib4NuivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NuivARB_remap_index], fn) +#define CALL_VertexAttribPointerARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *)), driDispatchRemapTable[VertexAttribPointerARB_remap_index], parameters) +#define GET_VertexAttribPointerARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerARB_remap_index]) +#define SET_VertexAttribPointerARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerARB_remap_index], fn) +#define CALL_EnableVertexAttribArrayARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index], parameters) +#define GET_EnableVertexAttribArrayARB(disp) GET_by_offset(disp, driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index]) +#define SET_EnableVertexAttribArrayARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index], fn) +#define CALL_DisableVertexAttribArrayARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index], parameters) +#define GET_DisableVertexAttribArrayARB(disp) GET_by_offset(disp, driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index]) +#define SET_DisableVertexAttribArrayARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index], fn) +#define CALL_ProgramStringARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[ProgramStringARB_remap_index], parameters) +#define GET_ProgramStringARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramStringARB_remap_index]) +#define SET_ProgramStringARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramStringARB_remap_index], fn) +#define CALL_ProgramEnvParameter4dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index], parameters) +#define GET_ProgramEnvParameter4dARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index]) +#define SET_ProgramEnvParameter4dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index], fn) +#define CALL_ProgramEnvParameter4dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLdouble *)), driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index], parameters) +#define GET_ProgramEnvParameter4dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index]) +#define SET_ProgramEnvParameter4dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index], fn) +#define CALL_ProgramEnvParameter4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index], parameters) +#define GET_ProgramEnvParameter4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index]) +#define SET_ProgramEnvParameter4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index], fn) +#define CALL_ProgramEnvParameter4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLfloat *)), driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index], parameters) +#define GET_ProgramEnvParameter4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index]) +#define SET_ProgramEnvParameter4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index], fn) +#define CALL_ProgramLocalParameter4dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index], parameters) +#define GET_ProgramLocalParameter4dARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index]) +#define SET_ProgramLocalParameter4dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index], fn) +#define CALL_ProgramLocalParameter4dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLdouble *)), driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index], parameters) +#define GET_ProgramLocalParameter4dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index]) +#define SET_ProgramLocalParameter4dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index], fn) +#define CALL_ProgramLocalParameter4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index], parameters) +#define GET_ProgramLocalParameter4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index]) +#define SET_ProgramLocalParameter4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index], fn) +#define CALL_ProgramLocalParameter4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLfloat *)), driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index], parameters) +#define GET_ProgramLocalParameter4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index]) +#define SET_ProgramLocalParameter4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index], fn) +#define CALL_GetProgramEnvParameterdvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble *)), driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index], parameters) +#define GET_GetProgramEnvParameterdvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index]) +#define SET_GetProgramEnvParameterdvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index], fn) +#define CALL_GetProgramEnvParameterfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat *)), driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index], parameters) +#define GET_GetProgramEnvParameterfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index]) +#define SET_GetProgramEnvParameterfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index], fn) +#define CALL_GetProgramLocalParameterdvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble *)), driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index], parameters) +#define GET_GetProgramLocalParameterdvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index]) +#define SET_GetProgramLocalParameterdvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index], fn) +#define CALL_GetProgramLocalParameterfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat *)), driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index], parameters) +#define GET_GetProgramLocalParameterfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index]) +#define SET_GetProgramLocalParameterfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index], fn) +#define CALL_GetProgramivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetProgramivARB_remap_index], parameters) +#define GET_GetProgramivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramivARB_remap_index]) +#define SET_GetProgramivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramivARB_remap_index], fn) +#define CALL_GetProgramStringARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLvoid *)), driDispatchRemapTable[GetProgramStringARB_remap_index], parameters) +#define GET_GetProgramStringARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramStringARB_remap_index]) +#define SET_GetProgramStringARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramStringARB_remap_index], fn) +#define CALL_ProgramNamedParameter4fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index], parameters) +#define GET_ProgramNamedParameter4fNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index]) +#define SET_ProgramNamedParameter4fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index], fn) +#define CALL_ProgramNamedParameter4dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index], parameters) +#define GET_ProgramNamedParameter4dNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index]) +#define SET_ProgramNamedParameter4dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index], fn) +#define CALL_ProgramNamedParameter4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, const GLfloat *)), driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index], parameters) +#define GET_ProgramNamedParameter4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index]) +#define SET_ProgramNamedParameter4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index], fn) +#define CALL_ProgramNamedParameter4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, const GLdouble *)), driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index], parameters) +#define GET_ProgramNamedParameter4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index]) +#define SET_ProgramNamedParameter4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index], fn) +#define CALL_GetProgramNamedParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLfloat *)), driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index], parameters) +#define GET_GetProgramNamedParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index]) +#define SET_GetProgramNamedParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index], fn) +#define CALL_GetProgramNamedParameterdvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLdouble *)), driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index], parameters) +#define GET_GetProgramNamedParameterdvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index]) +#define SET_GetProgramNamedParameterdvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index], fn) +#define CALL_BindBufferARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindBufferARB_remap_index], parameters) +#define GET_BindBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[BindBufferARB_remap_index]) +#define SET_BindBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindBufferARB_remap_index], fn) +#define CALL_BufferDataARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizeiptrARB, const GLvoid *, GLenum)), driDispatchRemapTable[BufferDataARB_remap_index], parameters) +#define GET_BufferDataARB(disp) GET_by_offset(disp, driDispatchRemapTable[BufferDataARB_remap_index]) +#define SET_BufferDataARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BufferDataARB_remap_index], fn) +#define CALL_BufferSubDataARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *)), driDispatchRemapTable[BufferSubDataARB_remap_index], parameters) +#define GET_BufferSubDataARB(disp) GET_by_offset(disp, driDispatchRemapTable[BufferSubDataARB_remap_index]) +#define SET_BufferSubDataARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BufferSubDataARB_remap_index], fn) +#define CALL_DeleteBuffersARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteBuffersARB_remap_index], parameters) +#define GET_DeleteBuffersARB(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteBuffersARB_remap_index]) +#define SET_DeleteBuffersARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteBuffersARB_remap_index], fn) +#define CALL_GenBuffersARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenBuffersARB_remap_index], parameters) +#define GET_GenBuffersARB(disp) GET_by_offset(disp, driDispatchRemapTable[GenBuffersARB_remap_index]) +#define SET_GenBuffersARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenBuffersARB_remap_index], fn) +#define CALL_GetBufferParameterivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetBufferParameterivARB_remap_index], parameters) +#define GET_GetBufferParameterivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetBufferParameterivARB_remap_index]) +#define SET_GetBufferParameterivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetBufferParameterivARB_remap_index], fn) +#define CALL_GetBufferPointervARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLvoid **)), driDispatchRemapTable[GetBufferPointervARB_remap_index], parameters) +#define GET_GetBufferPointervARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetBufferPointervARB_remap_index]) +#define SET_GetBufferPointervARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetBufferPointervARB_remap_index], fn) +#define CALL_GetBufferSubDataARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *)), driDispatchRemapTable[GetBufferSubDataARB_remap_index], parameters) +#define GET_GetBufferSubDataARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetBufferSubDataARB_remap_index]) +#define SET_GetBufferSubDataARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetBufferSubDataARB_remap_index], fn) +#define CALL_IsBufferARB(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsBufferARB_remap_index], parameters) +#define GET_IsBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[IsBufferARB_remap_index]) +#define SET_IsBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsBufferARB_remap_index], fn) +#define CALL_MapBufferARB(disp, parameters) CALL_by_offset(disp, (GLvoid * (GLAPIENTRYP)(GLenum, GLenum)), driDispatchRemapTable[MapBufferARB_remap_index], parameters) +#define GET_MapBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[MapBufferARB_remap_index]) +#define SET_MapBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MapBufferARB_remap_index], fn) +#define CALL_UnmapBufferARB(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[UnmapBufferARB_remap_index], parameters) +#define GET_UnmapBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[UnmapBufferARB_remap_index]) +#define SET_UnmapBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UnmapBufferARB_remap_index], fn) +#define CALL_DepthBoundsEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLclampd, GLclampd)), driDispatchRemapTable[DepthBoundsEXT_remap_index], parameters) +#define GET_DepthBoundsEXT(disp) GET_by_offset(disp, driDispatchRemapTable[DepthBoundsEXT_remap_index]) +#define SET_DepthBoundsEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DepthBoundsEXT_remap_index], fn) +#define CALL_GenQueriesARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenQueriesARB_remap_index], parameters) +#define GET_GenQueriesARB(disp) GET_by_offset(disp, driDispatchRemapTable[GenQueriesARB_remap_index]) +#define SET_GenQueriesARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenQueriesARB_remap_index], fn) +#define CALL_DeleteQueriesARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteQueriesARB_remap_index], parameters) +#define GET_DeleteQueriesARB(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteQueriesARB_remap_index]) +#define SET_DeleteQueriesARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteQueriesARB_remap_index], fn) +#define CALL_IsQueryARB(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsQueryARB_remap_index], parameters) +#define GET_IsQueryARB(disp) GET_by_offset(disp, driDispatchRemapTable[IsQueryARB_remap_index]) +#define SET_IsQueryARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsQueryARB_remap_index], fn) +#define CALL_BeginQueryARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BeginQueryARB_remap_index], parameters) +#define GET_BeginQueryARB(disp) GET_by_offset(disp, driDispatchRemapTable[BeginQueryARB_remap_index]) +#define SET_BeginQueryARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BeginQueryARB_remap_index], fn) +#define CALL_EndQueryARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[EndQueryARB_remap_index], parameters) +#define GET_EndQueryARB(disp) GET_by_offset(disp, driDispatchRemapTable[EndQueryARB_remap_index]) +#define SET_EndQueryARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EndQueryARB_remap_index], fn) +#define CALL_GetQueryivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetQueryivARB_remap_index], parameters) +#define GET_GetQueryivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryivARB_remap_index]) +#define SET_GetQueryivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryivARB_remap_index], fn) +#define CALL_GetQueryObjectivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetQueryObjectivARB_remap_index], parameters) +#define GET_GetQueryObjectivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryObjectivARB_remap_index]) +#define SET_GetQueryObjectivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryObjectivARB_remap_index], fn) +#define CALL_GetQueryObjectuivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLuint *)), driDispatchRemapTable[GetQueryObjectuivARB_remap_index], parameters) +#define GET_GetQueryObjectuivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryObjectuivARB_remap_index]) +#define SET_GetQueryObjectuivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryObjectuivARB_remap_index], fn) +#define CALL_MultiModeDrawArraysIBM(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint)), driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index], parameters) +#define GET_MultiModeDrawArraysIBM(disp) GET_by_offset(disp, driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index]) +#define SET_MultiModeDrawArraysIBM(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index], fn) +#define CALL_MultiModeDrawElementsIBM(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLenum *, const GLsizei *, GLenum, const GLvoid * const *, GLsizei, GLint)), driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index], parameters) +#define GET_MultiModeDrawElementsIBM(disp) GET_by_offset(disp, driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index]) +#define SET_MultiModeDrawElementsIBM(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index], fn) +#define CALL_BlendEquationSeparateEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum)), driDispatchRemapTable[BlendEquationSeparateEXT_remap_index], parameters) +#define GET_BlendEquationSeparateEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BlendEquationSeparateEXT_remap_index]) +#define SET_BlendEquationSeparateEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BlendEquationSeparateEXT_remap_index], fn) +#define CALL_DeleteObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[DeleteObjectARB_remap_index], parameters) +#define GET_DeleteObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteObjectARB_remap_index]) +#define SET_DeleteObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteObjectARB_remap_index], fn) +#define CALL_GetHandleARB(disp, parameters) CALL_by_offset(disp, (GLhandleARB (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[GetHandleARB_remap_index], parameters) +#define GET_GetHandleARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetHandleARB_remap_index]) +#define SET_GetHandleARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetHandleARB_remap_index], fn) +#define CALL_DetachObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLhandleARB)), driDispatchRemapTable[DetachObjectARB_remap_index], parameters) +#define GET_DetachObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[DetachObjectARB_remap_index]) +#define SET_DetachObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DetachObjectARB_remap_index], fn) +#define CALL_CreateShaderObjectARB(disp, parameters) CALL_by_offset(disp, (GLhandleARB (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[CreateShaderObjectARB_remap_index], parameters) +#define GET_CreateShaderObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[CreateShaderObjectARB_remap_index]) +#define SET_CreateShaderObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CreateShaderObjectARB_remap_index], fn) +#define CALL_ShaderSourceARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, const GLcharARB **, const GLint *)), driDispatchRemapTable[ShaderSourceARB_remap_index], parameters) +#define GET_ShaderSourceARB(disp) GET_by_offset(disp, driDispatchRemapTable[ShaderSourceARB_remap_index]) +#define SET_ShaderSourceARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ShaderSourceARB_remap_index], fn) +#define CALL_CompileShaderARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[CompileShaderARB_remap_index], parameters) +#define GET_CompileShaderARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompileShaderARB_remap_index]) +#define SET_CompileShaderARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompileShaderARB_remap_index], fn) +#define CALL_CreateProgramObjectARB(disp, parameters) CALL_by_offset(disp, (GLhandleARB (GLAPIENTRYP)(void)), driDispatchRemapTable[CreateProgramObjectARB_remap_index], parameters) +#define GET_CreateProgramObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[CreateProgramObjectARB_remap_index]) +#define SET_CreateProgramObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CreateProgramObjectARB_remap_index], fn) +#define CALL_AttachObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLhandleARB)), driDispatchRemapTable[AttachObjectARB_remap_index], parameters) +#define GET_AttachObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[AttachObjectARB_remap_index]) +#define SET_AttachObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AttachObjectARB_remap_index], fn) +#define CALL_LinkProgramARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[LinkProgramARB_remap_index], parameters) +#define GET_LinkProgramARB(disp) GET_by_offset(disp, driDispatchRemapTable[LinkProgramARB_remap_index]) +#define SET_LinkProgramARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LinkProgramARB_remap_index], fn) +#define CALL_UseProgramObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[UseProgramObjectARB_remap_index], parameters) +#define GET_UseProgramObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[UseProgramObjectARB_remap_index]) +#define SET_UseProgramObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UseProgramObjectARB_remap_index], fn) +#define CALL_ValidateProgramARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[ValidateProgramARB_remap_index], parameters) +#define GET_ValidateProgramARB(disp) GET_by_offset(disp, driDispatchRemapTable[ValidateProgramARB_remap_index]) +#define SET_ValidateProgramARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ValidateProgramARB_remap_index], fn) +#define CALL_Uniform1fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat)), driDispatchRemapTable[Uniform1fARB_remap_index], parameters) +#define GET_Uniform1fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1fARB_remap_index]) +#define SET_Uniform1fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1fARB_remap_index], fn) +#define CALL_Uniform2fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat, GLfloat)), driDispatchRemapTable[Uniform2fARB_remap_index], parameters) +#define GET_Uniform2fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2fARB_remap_index]) +#define SET_Uniform2fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2fARB_remap_index], fn) +#define CALL_Uniform3fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[Uniform3fARB_remap_index], parameters) +#define GET_Uniform3fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3fARB_remap_index]) +#define SET_Uniform3fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3fARB_remap_index], fn) +#define CALL_Uniform4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[Uniform4fARB_remap_index], parameters) +#define GET_Uniform4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4fARB_remap_index]) +#define SET_Uniform4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4fARB_remap_index], fn) +#define CALL_Uniform1iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint)), driDispatchRemapTable[Uniform1iARB_remap_index], parameters) +#define GET_Uniform1iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1iARB_remap_index]) +#define SET_Uniform1iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1iARB_remap_index], fn) +#define CALL_Uniform2iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint)), driDispatchRemapTable[Uniform2iARB_remap_index], parameters) +#define GET_Uniform2iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2iARB_remap_index]) +#define SET_Uniform2iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2iARB_remap_index], fn) +#define CALL_Uniform3iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint)), driDispatchRemapTable[Uniform3iARB_remap_index], parameters) +#define GET_Uniform3iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3iARB_remap_index]) +#define SET_Uniform3iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3iARB_remap_index], fn) +#define CALL_Uniform4iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint, GLint)), driDispatchRemapTable[Uniform4iARB_remap_index], parameters) +#define GET_Uniform4iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4iARB_remap_index]) +#define SET_Uniform4iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4iARB_remap_index], fn) +#define CALL_Uniform1fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform1fvARB_remap_index], parameters) +#define GET_Uniform1fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1fvARB_remap_index]) +#define SET_Uniform1fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1fvARB_remap_index], fn) +#define CALL_Uniform2fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform2fvARB_remap_index], parameters) +#define GET_Uniform2fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2fvARB_remap_index]) +#define SET_Uniform2fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2fvARB_remap_index], fn) +#define CALL_Uniform3fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform3fvARB_remap_index], parameters) +#define GET_Uniform3fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3fvARB_remap_index]) +#define SET_Uniform3fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3fvARB_remap_index], fn) +#define CALL_Uniform4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform4fvARB_remap_index], parameters) +#define GET_Uniform4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4fvARB_remap_index]) +#define SET_Uniform4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4fvARB_remap_index], fn) +#define CALL_Uniform1ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform1ivARB_remap_index], parameters) +#define GET_Uniform1ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1ivARB_remap_index]) +#define SET_Uniform1ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1ivARB_remap_index], fn) +#define CALL_Uniform2ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform2ivARB_remap_index], parameters) +#define GET_Uniform2ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2ivARB_remap_index]) +#define SET_Uniform2ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2ivARB_remap_index], fn) +#define CALL_Uniform3ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform3ivARB_remap_index], parameters) +#define GET_Uniform3ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3ivARB_remap_index]) +#define SET_Uniform3ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3ivARB_remap_index], fn) +#define CALL_Uniform4ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform4ivARB_remap_index], parameters) +#define GET_Uniform4ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4ivARB_remap_index]) +#define SET_Uniform4ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4ivARB_remap_index], fn) +#define CALL_UniformMatrix2fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix2fvARB_remap_index], parameters) +#define GET_UniformMatrix2fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix2fvARB_remap_index]) +#define SET_UniformMatrix2fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix2fvARB_remap_index], fn) +#define CALL_UniformMatrix3fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix3fvARB_remap_index], parameters) +#define GET_UniformMatrix3fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix3fvARB_remap_index]) +#define SET_UniformMatrix3fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix3fvARB_remap_index], fn) +#define CALL_UniformMatrix4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix4fvARB_remap_index], parameters) +#define GET_UniformMatrix4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix4fvARB_remap_index]) +#define SET_UniformMatrix4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix4fvARB_remap_index], fn) +#define CALL_GetObjectParameterfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLenum, GLfloat *)), driDispatchRemapTable[GetObjectParameterfvARB_remap_index], parameters) +#define GET_GetObjectParameterfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetObjectParameterfvARB_remap_index]) +#define SET_GetObjectParameterfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetObjectParameterfvARB_remap_index], fn) +#define CALL_GetObjectParameterivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLenum, GLint *)), driDispatchRemapTable[GetObjectParameterivARB_remap_index], parameters) +#define GET_GetObjectParameterivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetObjectParameterivARB_remap_index]) +#define SET_GetObjectParameterivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetObjectParameterivARB_remap_index], fn) +#define CALL_GetInfoLogARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *)), driDispatchRemapTable[GetInfoLogARB_remap_index], parameters) +#define GET_GetInfoLogARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetInfoLogARB_remap_index]) +#define SET_GetInfoLogARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetInfoLogARB_remap_index], fn) +#define CALL_GetAttachedObjectsARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *)), driDispatchRemapTable[GetAttachedObjectsARB_remap_index], parameters) +#define GET_GetAttachedObjectsARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetAttachedObjectsARB_remap_index]) +#define SET_GetAttachedObjectsARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetAttachedObjectsARB_remap_index], fn) +#define CALL_GetUniformLocationARB(disp, parameters) CALL_by_offset(disp, (GLint (GLAPIENTRYP)(GLhandleARB, const GLcharARB *)), driDispatchRemapTable[GetUniformLocationARB_remap_index], parameters) +#define GET_GetUniformLocationARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetUniformLocationARB_remap_index]) +#define SET_GetUniformLocationARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetUniformLocationARB_remap_index], fn) +#define CALL_GetActiveUniformARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *)), driDispatchRemapTable[GetActiveUniformARB_remap_index], parameters) +#define GET_GetActiveUniformARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetActiveUniformARB_remap_index]) +#define SET_GetActiveUniformARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetActiveUniformARB_remap_index], fn) +#define CALL_GetUniformfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLint, GLfloat *)), driDispatchRemapTable[GetUniformfvARB_remap_index], parameters) +#define GET_GetUniformfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetUniformfvARB_remap_index]) +#define SET_GetUniformfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetUniformfvARB_remap_index], fn) +#define CALL_GetUniformivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLint, GLint *)), driDispatchRemapTable[GetUniformivARB_remap_index], parameters) +#define GET_GetUniformivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetUniformivARB_remap_index]) +#define SET_GetUniformivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetUniformivARB_remap_index], fn) +#define CALL_GetShaderSourceARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *)), driDispatchRemapTable[GetShaderSourceARB_remap_index], parameters) +#define GET_GetShaderSourceARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetShaderSourceARB_remap_index]) +#define SET_GetShaderSourceARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetShaderSourceARB_remap_index], fn) +#define CALL_BindAttribLocationARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLuint, const GLcharARB *)), driDispatchRemapTable[BindAttribLocationARB_remap_index], parameters) +#define GET_BindAttribLocationARB(disp) GET_by_offset(disp, driDispatchRemapTable[BindAttribLocationARB_remap_index]) +#define SET_BindAttribLocationARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindAttribLocationARB_remap_index], fn) +#define CALL_GetActiveAttribARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *)), driDispatchRemapTable[GetActiveAttribARB_remap_index], parameters) +#define GET_GetActiveAttribARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetActiveAttribARB_remap_index]) +#define SET_GetActiveAttribARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetActiveAttribARB_remap_index], fn) +#define CALL_GetAttribLocationARB(disp, parameters) CALL_by_offset(disp, (GLint (GLAPIENTRYP)(GLhandleARB, const GLcharARB *)), driDispatchRemapTable[GetAttribLocationARB_remap_index], parameters) +#define GET_GetAttribLocationARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetAttribLocationARB_remap_index]) +#define SET_GetAttribLocationARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetAttribLocationARB_remap_index], fn) +#define CALL_GetVertexAttribdvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLdouble *)), driDispatchRemapTable[GetVertexAttribdvNV_remap_index], parameters) +#define GET_GetVertexAttribdvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvNV_remap_index]) +#define SET_GetVertexAttribdvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvNV_remap_index], fn) +#define CALL_GetVertexAttribfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLfloat *)), driDispatchRemapTable[GetVertexAttribfvNV_remap_index], parameters) +#define GET_GetVertexAttribfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvNV_remap_index]) +#define SET_GetVertexAttribfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvNV_remap_index], fn) +#define CALL_GetVertexAttribivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetVertexAttribivNV_remap_index], parameters) +#define GET_GetVertexAttribivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivNV_remap_index]) +#define SET_GetVertexAttribivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivNV_remap_index], fn) +#define CALL_VertexAttrib1dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble)), driDispatchRemapTable[VertexAttrib1dNV_remap_index], parameters) +#define GET_VertexAttrib1dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dNV_remap_index]) +#define SET_VertexAttrib1dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dNV_remap_index], fn) +#define CALL_VertexAttrib1dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib1dvNV_remap_index], parameters) +#define GET_VertexAttrib1dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvNV_remap_index]) +#define SET_VertexAttrib1dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvNV_remap_index], fn) +#define CALL_VertexAttrib1fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat)), driDispatchRemapTable[VertexAttrib1fNV_remap_index], parameters) +#define GET_VertexAttrib1fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fNV_remap_index]) +#define SET_VertexAttrib1fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fNV_remap_index], fn) +#define CALL_VertexAttrib1fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib1fvNV_remap_index], parameters) +#define GET_VertexAttrib1fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvNV_remap_index]) +#define SET_VertexAttrib1fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvNV_remap_index], fn) +#define CALL_VertexAttrib1sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort)), driDispatchRemapTable[VertexAttrib1sNV_remap_index], parameters) +#define GET_VertexAttrib1sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sNV_remap_index]) +#define SET_VertexAttrib1sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sNV_remap_index], fn) +#define CALL_VertexAttrib1svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib1svNV_remap_index], parameters) +#define GET_VertexAttrib1svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svNV_remap_index]) +#define SET_VertexAttrib1svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svNV_remap_index], fn) +#define CALL_VertexAttrib2dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib2dNV_remap_index], parameters) +#define GET_VertexAttrib2dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dNV_remap_index]) +#define SET_VertexAttrib2dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dNV_remap_index], fn) +#define CALL_VertexAttrib2dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib2dvNV_remap_index], parameters) +#define GET_VertexAttrib2dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvNV_remap_index]) +#define SET_VertexAttrib2dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvNV_remap_index], fn) +#define CALL_VertexAttrib2fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib2fNV_remap_index], parameters) +#define GET_VertexAttrib2fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fNV_remap_index]) +#define SET_VertexAttrib2fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fNV_remap_index], fn) +#define CALL_VertexAttrib2fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib2fvNV_remap_index], parameters) +#define GET_VertexAttrib2fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvNV_remap_index]) +#define SET_VertexAttrib2fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvNV_remap_index], fn) +#define CALL_VertexAttrib2sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib2sNV_remap_index], parameters) +#define GET_VertexAttrib2sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sNV_remap_index]) +#define SET_VertexAttrib2sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sNV_remap_index], fn) +#define CALL_VertexAttrib2svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib2svNV_remap_index], parameters) +#define GET_VertexAttrib2svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svNV_remap_index]) +#define SET_VertexAttrib2svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svNV_remap_index], fn) +#define CALL_VertexAttrib3dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib3dNV_remap_index], parameters) +#define GET_VertexAttrib3dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dNV_remap_index]) +#define SET_VertexAttrib3dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dNV_remap_index], fn) +#define CALL_VertexAttrib3dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib3dvNV_remap_index], parameters) +#define GET_VertexAttrib3dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvNV_remap_index]) +#define SET_VertexAttrib3dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvNV_remap_index], fn) +#define CALL_VertexAttrib3fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib3fNV_remap_index], parameters) +#define GET_VertexAttrib3fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fNV_remap_index]) +#define SET_VertexAttrib3fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fNV_remap_index], fn) +#define CALL_VertexAttrib3fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib3fvNV_remap_index], parameters) +#define GET_VertexAttrib3fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvNV_remap_index]) +#define SET_VertexAttrib3fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvNV_remap_index], fn) +#define CALL_VertexAttrib3sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib3sNV_remap_index], parameters) +#define GET_VertexAttrib3sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sNV_remap_index]) +#define SET_VertexAttrib3sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sNV_remap_index], fn) +#define CALL_VertexAttrib3svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib3svNV_remap_index], parameters) +#define GET_VertexAttrib3svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svNV_remap_index]) +#define SET_VertexAttrib3svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svNV_remap_index], fn) +#define CALL_VertexAttrib4dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib4dNV_remap_index], parameters) +#define GET_VertexAttrib4dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dNV_remap_index]) +#define SET_VertexAttrib4dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dNV_remap_index], fn) +#define CALL_VertexAttrib4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib4dvNV_remap_index], parameters) +#define GET_VertexAttrib4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvNV_remap_index]) +#define SET_VertexAttrib4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvNV_remap_index], fn) +#define CALL_VertexAttrib4fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib4fNV_remap_index], parameters) +#define GET_VertexAttrib4fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fNV_remap_index]) +#define SET_VertexAttrib4fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fNV_remap_index], fn) +#define CALL_VertexAttrib4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib4fvNV_remap_index], parameters) +#define GET_VertexAttrib4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvNV_remap_index]) +#define SET_VertexAttrib4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvNV_remap_index], fn) +#define CALL_VertexAttrib4sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib4sNV_remap_index], parameters) +#define GET_VertexAttrib4sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sNV_remap_index]) +#define SET_VertexAttrib4sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sNV_remap_index], fn) +#define CALL_VertexAttrib4svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib4svNV_remap_index], parameters) +#define GET_VertexAttrib4svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svNV_remap_index]) +#define SET_VertexAttrib4svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svNV_remap_index], fn) +#define CALL_VertexAttrib4ubNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte)), driDispatchRemapTable[VertexAttrib4ubNV_remap_index], parameters) +#define GET_VertexAttrib4ubNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubNV_remap_index]) +#define SET_VertexAttrib4ubNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubNV_remap_index], fn) +#define CALL_VertexAttrib4ubvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLubyte *)), driDispatchRemapTable[VertexAttrib4ubvNV_remap_index], parameters) +#define GET_VertexAttrib4ubvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvNV_remap_index]) +#define SET_VertexAttrib4ubvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvNV_remap_index], fn) +#define CALL_GenFragmentShadersATI(disp, parameters) CALL_by_offset(disp, (GLuint (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[GenFragmentShadersATI_remap_index], parameters) +#define GET_GenFragmentShadersATI(disp) GET_by_offset(disp, driDispatchRemapTable[GenFragmentShadersATI_remap_index]) +#define SET_GenFragmentShadersATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenFragmentShadersATI_remap_index], fn) +#define CALL_BindFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[BindFragmentShaderATI_remap_index], parameters) +#define GET_BindFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[BindFragmentShaderATI_remap_index]) +#define SET_BindFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindFragmentShaderATI_remap_index], fn) +#define CALL_DeleteFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[DeleteFragmentShaderATI_remap_index], parameters) +#define GET_DeleteFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteFragmentShaderATI_remap_index]) +#define SET_DeleteFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteFragmentShaderATI_remap_index], fn) +#define CALL_BeginFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[BeginFragmentShaderATI_remap_index], parameters) +#define GET_BeginFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[BeginFragmentShaderATI_remap_index]) +#define SET_BeginFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BeginFragmentShaderATI_remap_index], fn) +#define CALL_EndFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[EndFragmentShaderATI_remap_index], parameters) +#define GET_EndFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[EndFragmentShaderATI_remap_index]) +#define SET_EndFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EndFragmentShaderATI_remap_index], fn) +#define CALL_PassTexCoordATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint, GLenum)), driDispatchRemapTable[PassTexCoordATI_remap_index], parameters) +#define GET_PassTexCoordATI(disp) GET_by_offset(disp, driDispatchRemapTable[PassTexCoordATI_remap_index]) +#define SET_PassTexCoordATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PassTexCoordATI_remap_index], fn) +#define CALL_SampleMapATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint, GLenum)), driDispatchRemapTable[SampleMapATI_remap_index], parameters) +#define GET_SampleMapATI(disp) GET_by_offset(disp, driDispatchRemapTable[SampleMapATI_remap_index]) +#define SET_SampleMapATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SampleMapATI_remap_index], fn) +#define CALL_ColorFragmentOp1ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[ColorFragmentOp1ATI_remap_index], parameters) +#define GET_ColorFragmentOp1ATI(disp) GET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp1ATI_remap_index]) +#define SET_ColorFragmentOp1ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp1ATI_remap_index], fn) +#define CALL_ColorFragmentOp2ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[ColorFragmentOp2ATI_remap_index], parameters) +#define GET_ColorFragmentOp2ATI(disp) GET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp2ATI_remap_index]) +#define SET_ColorFragmentOp2ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp2ATI_remap_index], fn) +#define CALL_ColorFragmentOp3ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[ColorFragmentOp3ATI_remap_index], parameters) +#define GET_ColorFragmentOp3ATI(disp) GET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp3ATI_remap_index]) +#define SET_ColorFragmentOp3ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp3ATI_remap_index], fn) +#define CALL_AlphaFragmentOp1ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index], parameters) +#define GET_AlphaFragmentOp1ATI(disp) GET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index]) +#define SET_AlphaFragmentOp1ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index], fn) +#define CALL_AlphaFragmentOp2ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index], parameters) +#define GET_AlphaFragmentOp2ATI(disp) GET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index]) +#define SET_AlphaFragmentOp2ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index], fn) +#define CALL_AlphaFragmentOp3ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index], parameters) +#define GET_AlphaFragmentOp3ATI(disp) GET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index]) +#define SET_AlphaFragmentOp3ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index], fn) +#define CALL_SetFragmentShaderConstantATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index], parameters) +#define GET_SetFragmentShaderConstantATI(disp) GET_by_offset(disp, driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index]) +#define SET_SetFragmentShaderConstantATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index], fn) +#define CALL_IsRenderbufferEXT(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsRenderbufferEXT_remap_index], parameters) +#define GET_IsRenderbufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IsRenderbufferEXT_remap_index]) +#define SET_IsRenderbufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsRenderbufferEXT_remap_index], fn) +#define CALL_BindRenderbufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindRenderbufferEXT_remap_index], parameters) +#define GET_BindRenderbufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BindRenderbufferEXT_remap_index]) +#define SET_BindRenderbufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindRenderbufferEXT_remap_index], fn) +#define CALL_DeleteRenderbuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index], parameters) +#define GET_DeleteRenderbuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index]) +#define SET_DeleteRenderbuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index], fn) +#define CALL_GenRenderbuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenRenderbuffersEXT_remap_index], parameters) +#define GET_GenRenderbuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GenRenderbuffersEXT_remap_index]) +#define SET_GenRenderbuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenRenderbuffersEXT_remap_index], fn) +#define CALL_RenderbufferStorageEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLsizei, GLsizei)), driDispatchRemapTable[RenderbufferStorageEXT_remap_index], parameters) +#define GET_RenderbufferStorageEXT(disp) GET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageEXT_remap_index]) +#define SET_RenderbufferStorageEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageEXT_remap_index], fn) +#define CALL_GetRenderbufferParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index], parameters) +#define GET_GetRenderbufferParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index]) +#define SET_GetRenderbufferParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index], fn) +#define CALL_IsFramebufferEXT(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsFramebufferEXT_remap_index], parameters) +#define GET_IsFramebufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IsFramebufferEXT_remap_index]) +#define SET_IsFramebufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsFramebufferEXT_remap_index], fn) +#define CALL_BindFramebufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindFramebufferEXT_remap_index], parameters) +#define GET_BindFramebufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BindFramebufferEXT_remap_index]) +#define SET_BindFramebufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindFramebufferEXT_remap_index], fn) +#define CALL_DeleteFramebuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteFramebuffersEXT_remap_index], parameters) +#define GET_DeleteFramebuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteFramebuffersEXT_remap_index]) +#define SET_DeleteFramebuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteFramebuffersEXT_remap_index], fn) +#define CALL_GenFramebuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenFramebuffersEXT_remap_index], parameters) +#define GET_GenFramebuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GenFramebuffersEXT_remap_index]) +#define SET_GenFramebuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenFramebuffersEXT_remap_index], fn) +#define CALL_CheckFramebufferStatusEXT(disp, parameters) CALL_by_offset(disp, (GLenum (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index], parameters) +#define GET_CheckFramebufferStatusEXT(disp) GET_by_offset(disp, driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index]) +#define SET_CheckFramebufferStatusEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index], fn) +#define CALL_FramebufferTexture1DEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint)), driDispatchRemapTable[FramebufferTexture1DEXT_remap_index], parameters) +#define GET_FramebufferTexture1DEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTexture1DEXT_remap_index]) +#define SET_FramebufferTexture1DEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTexture1DEXT_remap_index], fn) +#define CALL_FramebufferTexture2DEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint)), driDispatchRemapTable[FramebufferTexture2DEXT_remap_index], parameters) +#define GET_FramebufferTexture2DEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTexture2DEXT_remap_index]) +#define SET_FramebufferTexture2DEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTexture2DEXT_remap_index], fn) +#define CALL_FramebufferTexture3DEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint, GLint)), driDispatchRemapTable[FramebufferTexture3DEXT_remap_index], parameters) +#define GET_FramebufferTexture3DEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTexture3DEXT_remap_index]) +#define SET_FramebufferTexture3DEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTexture3DEXT_remap_index], fn) +#define CALL_FramebufferRenderbufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint)), driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index], parameters) +#define GET_FramebufferRenderbufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index]) +#define SET_FramebufferRenderbufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index], fn) +#define CALL_GetFramebufferAttachmentParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLint *)), driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index], parameters) +#define GET_GetFramebufferAttachmentParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index]) +#define SET_GetFramebufferAttachmentParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index], fn) +#define CALL_GenerateMipmapEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[GenerateMipmapEXT_remap_index], parameters) +#define GET_GenerateMipmapEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GenerateMipmapEXT_remap_index]) +#define SET_GenerateMipmapEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenerateMipmapEXT_remap_index], fn) +#define CALL_StencilFuncSeparate(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint, GLuint)), driDispatchRemapTable[StencilFuncSeparate_remap_index], parameters) +#define GET_StencilFuncSeparate(disp) GET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparate_remap_index]) +#define SET_StencilFuncSeparate(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparate_remap_index], fn) +#define CALL_StencilOpSeparate(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[StencilOpSeparate_remap_index], parameters) +#define GET_StencilOpSeparate(disp) GET_by_offset(disp, driDispatchRemapTable[StencilOpSeparate_remap_index]) +#define SET_StencilOpSeparate(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilOpSeparate_remap_index], fn) +#define CALL_StencilMaskSeparate(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[StencilMaskSeparate_remap_index], parameters) +#define GET_StencilMaskSeparate(disp) GET_by_offset(disp, driDispatchRemapTable[StencilMaskSeparate_remap_index]) +#define SET_StencilMaskSeparate(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilMaskSeparate_remap_index], fn) + +#endif /* !defined(IN_DRI_DRIVER) */ + +#endif /* !defined( _DISPATCH_H_ ) */ diff --git a/reactos/dll/mesa32/src/glapi/glapi.c b/reactos/dll/mesa32/src/glapi/glapi.c new file mode 100644 index 00000000000..39eb9b91bd8 --- /dev/null +++ b/reactos/dll/mesa32/src/glapi/glapi.c @@ -0,0 +1,1058 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +/* + * This file manages the OpenGL API dispatch layer. + * The dispatch table (struct _glapi_table) is basically just a list + * of function pointers. + * There are functions to set/get the current dispatch table for the + * current thread and to manage registration/dispatch of dynamically + * added extension functions. + * + * It's intended that this file and the other glapi*.[ch] files are + * flexible enough to be reused in several places: XFree86, DRI- + * based libGL.so, and perhaps the SGI SI. + * + * NOTE: There are no dependencies on Mesa in this code. + * + * Versions (API changes): + * 2000/02/23 - original version for Mesa 3.3 and XFree86 4.0 + * 2001/01/16 - added dispatch override feature for Mesa 3.5 + * 2002/06/28 - added _glapi_set_warning_func(), Mesa 4.1. + * 2002/10/01 - _glapi_get_proc_address() will now generate new entrypoints + * itself (using offset ~0). _glapi_add_entrypoint() can be + * called afterward and it'll fill in the correct dispatch + * offset. This allows DRI libGL to avoid probing for DRI + * drivers! No changes to the public glapi interface. + */ + + + +#include "glheader.h" +#include "glapi.h" +#include "glapioffsets.h" +#include "glapitable.h" +#include "glthread.h" + +/***** BEGIN NO-OP DISPATCH *****/ + +static GLboolean WarnFlag = GL_FALSE; +static _glapi_warning_func warning_func; + +static void init_glapi_relocs(void); + +static _glapi_proc generate_entrypoint(GLuint functionOffset); +static void fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset); + +/* + * Enable/disable printing of warning messages. + */ +PUBLIC void +_glapi_noop_enable_warnings(GLboolean enable) +{ + WarnFlag = enable; +} + +/* + * Register a callback function for reporting errors. + */ +PUBLIC void +_glapi_set_warning_func( _glapi_warning_func func ) +{ + warning_func = func; +} + +static GLboolean +warn(void) +{ + if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) + && warning_func) { + return GL_TRUE; + } + else { + return GL_FALSE; + } +} + + +#define KEYWORD1 static +#define KEYWORD2 GLAPIENTRY +#define NAME(func) NoOp##func + +#define F NULL + +#define DISPATCH(func, args, msg) \ + if (warn()) { \ + warning_func(NULL, "GL User Error: called without context: %s", #func); \ + } + +#define RETURN_DISPATCH(func, args, msg) \ + if (warn()) { \ + warning_func(NULL, "GL User Error: called without context: %s", #func); \ + } \ + return 0 + +#define DISPATCH_TABLE_NAME __glapi_noop_table +#define UNUSED_TABLE_NAME __unused_noop_functions + +#define TABLE_ENTRY(name) (_glapi_proc) NoOp##name + +static GLint NoOpUnused(void) +{ + if (warn()) { + warning_func(NULL, "GL User Error: calling extension function without a current context\n"); + } + return 0; +} + +#include "glapitemp.h" + +/***** END NO-OP DISPATCH *****/ + + + +/** + * \name Current dispatch and current context control variables + * + * Depending on whether or not multithreading is support, and the type of + * support available, several variables are used to store the current context + * pointer and the current dispatch table pointer. In the non-threaded case, + * the variables \c _glapi_Dispatch and \c _glapi_Context are used for this + * purpose. + * + * In the "normal" threaded case, the variables \c _glapi_Dispatch and + * \c _glapi_Context will be \c NULL if an application is detected as being + * multithreaded. Single-threaded applications will use \c _glapi_Dispatch + * and \c _glapi_Context just like the case without any threading support. + * When \c _glapi_Dispatch and \c _glapi_Context are \c NULL, the thread state + * data \c _gl_DispatchTSD and \c ContextTSD are used. Drivers and the + * static dispatch functions access these variables via \c _glapi_get_dispatch + * and \c _glapi_get_context. + * + * There is a race condition in setting \c _glapi_Dispatch to \c NULL. It is + * possible for the original thread to be setting it at the same instant a new + * thread, perhaps running on a different processor, is clearing it. Because + * of that, \c ThreadSafe, which can only ever be changed to \c GL_TRUE, is + * used to determine whether or not the application is multithreaded. + * + * In the TLS case, the variables \c _glapi_Dispatch and \c _glapi_Context are + * hardcoded to \c NULL. Instead the TLS variables \c _glapi_tls_Dispatch and + * \c _glapi_tls_Context are used. Having \c _glapi_Dispatch and + * \c _glapi_Context be hardcoded to \c NULL maintains binary compatability + * between TLS enabled loaders and non-TLS DRI drivers. + */ +/*@{*/ +#if defined(GLX_USE_TLS) + +PUBLIC __thread struct _glapi_table * _glapi_tls_Dispatch + __attribute__((tls_model("initial-exec"))) + = (struct _glapi_table *) __glapi_noop_table; + +PUBLIC __thread void * _glapi_tls_Context + __attribute__((tls_model("initial-exec"))); + +PUBLIC const struct _glapi_table *_glapi_Dispatch = NULL; +PUBLIC const void *_glapi_Context = NULL; + +#else + +#if defined(THREADS) + +static GLboolean ThreadSafe = GL_FALSE; /**< In thread-safe mode? */ +_glthread_TSD _gl_DispatchTSD; /**< Per-thread dispatch pointer */ +static _glthread_TSD ContextTSD; /**< Per-thread context pointer */ + +#endif /* defined(THREADS) */ + +PUBLIC struct _glapi_table *_glapi_Dispatch = + (struct _glapi_table *) __glapi_noop_table; +PUBLIC void *_glapi_Context = NULL; + +#endif /* defined(GLX_USE_TLS) */ +/*@}*/ + + +/** + * strdup() is actually not a standard ANSI C or POSIX routine. + * Irix will not define it if ANSI mode is in effect. + */ +static char * +str_dup(const char *str) +{ + char *copy; + copy = (char*) malloc(strlen(str) + 1); + if (!copy) + return NULL; + strcpy(copy, str); + return copy; +} + + + +/** + * We should call this periodically from a function such as glXMakeCurrent + * in order to test if multiple threads are being used. + */ +void +_glapi_check_multithread(void) +{ +#if defined(THREADS) && !defined(GLX_USE_TLS) + if (!ThreadSafe) { + static unsigned long knownID; + static GLboolean firstCall = GL_TRUE; + if (firstCall) { + knownID = _glthread_GetID(); + firstCall = GL_FALSE; + } + else if (knownID != _glthread_GetID()) { + ThreadSafe = GL_TRUE; + _glapi_set_dispatch(NULL); + } + } + else if (!_glapi_get_dispatch()) { + /* make sure that this thread's dispatch pointer isn't null */ + _glapi_set_dispatch(NULL); + } +#endif +} + + + +/** + * Set the current context pointer for this thread. + * The context pointer is an opaque type which should be cast to + * void from the real context pointer type. + */ +PUBLIC void +_glapi_set_context(void *context) +{ + (void) __unused_noop_functions; /* silence a warning */ +#if defined(GLX_USE_TLS) + _glapi_tls_Context = context; +#elif defined(THREADS) + _glthread_SetTSD(&ContextTSD, context); + _glapi_Context = (ThreadSafe) ? NULL : context; +#else + _glapi_Context = context; +#endif +} + + + +/** + * Get the current context pointer for this thread. + * The context pointer is an opaque type which should be cast from + * void to the real context pointer type. + */ +PUBLIC void * +_glapi_get_context(void) +{ +#if defined(GLX_USE_TLS) + return _glapi_tls_Context; +#elif defined(THREADS) + if (ThreadSafe) { + return _glthread_GetTSD(&ContextTSD); + } + else { + return _glapi_Context; + } +#else + return _glapi_Context; +#endif +} + + + +/** + * Set the global or per-thread dispatch table pointer. + */ +PUBLIC void +_glapi_set_dispatch(struct _glapi_table *dispatch) +{ +#if defined(PTHREADS) || defined(GLX_USE_TLS) + static pthread_once_t once_control = PTHREAD_ONCE_INIT; + + + pthread_once( & once_control, init_glapi_relocs ); +#endif + + if (!dispatch) { + /* use the no-op functions */ + dispatch = (struct _glapi_table *) __glapi_noop_table; + } +#ifdef DEBUG + else { + _glapi_check_table(dispatch); + } +#endif + +#if defined(GLX_USE_TLS) + _glapi_tls_Dispatch = dispatch; +#elif defined(THREADS) + _glthread_SetTSD(&_gl_DispatchTSD, (void *) dispatch); + _glapi_Dispatch = (ThreadSafe) ? NULL : dispatch; +#else /*THREADS*/ + _glapi_Dispatch = dispatch; +#endif /*THREADS*/ +} + + + +/** + * Return pointer to current dispatch table for calling thread. + */ +PUBLIC struct _glapi_table * +_glapi_get_dispatch(void) +{ + struct _glapi_table * api; + +#if defined(GLX_USE_TLS) + api = _glapi_tls_Dispatch; +#elif defined(THREADS) + api = (ThreadSafe) + ? (struct _glapi_table *) _glthread_GetTSD(&_gl_DispatchTSD) + : _glapi_Dispatch; +#else + api = _glapi_Dispatch; +#endif + + assert( api != NULL ); + return api; +} + + +#if !defined( USE_X86_ASM ) && !defined( XFree86Server ) +#define NEED_FUNCTION_POINTER +#endif + +/* The code in this file is auto-generated with Python */ +#include "glprocs.h" + + +/** + * Search the table of static entrypoint functions for the named function + * and return the corresponding glprocs_table_t entry. + */ +static const glprocs_table_t * +find_entry( const char * n ) +{ + GLuint i; + + for (i = 0; static_functions[i].Name_offset >= 0; i++) { + const char * test_name; + + test_name = gl_string_table + static_functions[i].Name_offset; + if (strcmp(test_name, n) == 0) { + return & static_functions[i]; + } + } + return NULL; +} + + +/** + * Return dispatch table offset of the named static (built-in) function. + * Return -1 if function not found. + */ +static GLint +get_static_proc_offset(const char *funcName) +{ + const glprocs_table_t * const f = find_entry( funcName ); + + if ( f != NULL ) { + return f->Offset; + } + return -1; +} + + +#if !defined( XFree86Server ) +#ifdef USE_X86_ASM + +#if defined( GLX_USE_TLS ) +extern GLubyte gl_dispatch_functions_start[]; +extern GLubyte gl_dispatch_functions_end[]; +#else +extern const GLubyte gl_dispatch_functions_start[]; +#endif + +# if defined(THREADS) && !defined(GLX_USE_TLS) +# define X86_DISPATCH_FUNCTION_SIZE 32 +# else +# define X86_DISPATCH_FUNCTION_SIZE 16 +# endif + + +/** + * Return dispatch function address the named static (built-in) function. + * Return NULL if function not found. + */ +static const _glapi_proc +get_static_proc_address(const char *funcName) +{ + const glprocs_table_t * const f = find_entry( funcName ); + + if ( f != NULL ) { + return (_glapi_proc) (gl_dispatch_functions_start + + (X86_DISPATCH_FUNCTION_SIZE * f->Offset)); + } + else { + return NULL; + } +} + +#else + + +/** + * Return pointer to the named static (built-in) function. + * \return NULL if function not found. + */ +static const _glapi_proc +get_static_proc_address(const char *funcName) +{ + const glprocs_table_t * const f = find_entry( funcName ); + return ( f != NULL ) ? f->Address : NULL; +} + +#endif /* USE_X86_ASM */ +#endif /* !defined( XFree86Server ) */ + + +/** + * Return the name of the function at the given offset in the dispatch + * table. For debugging only. + */ +static const char * +get_static_proc_name( GLuint offset ) +{ + GLuint i; + + for (i = 0; static_functions[i].Name_offset >= 0; i++) { + if (static_functions[i].Offset == offset) { + return gl_string_table + static_functions[i].Name_offset; + } + } + return NULL; +} + + + +/********************************************************************** + * Extension function management. + */ + +/* + * Number of extension functions which we can dynamically add at runtime. + */ +#define MAX_EXTENSION_FUNCS 300 + + +/* + * The dispatch table size (number of entries) is the size of the + * _glapi_table struct plus the number of dynamic entries we can add. + * The extra slots can be filled in by DRI drivers that register new extension + * functions. + */ +#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS) + + +/** + * Track information about a function added to the GL API. + */ +struct _glapi_function { + /** + * Name of the function. + */ + const char * name; + + + /** + * Text string that describes the types of the parameters passed to the + * named function. Parameter types are converted to characters using the + * following rules: + * - 'i' for \c GLint, \c GLuint, and \c GLenum + * - 'p' for any pointer type + * - 'f' for \c GLfloat and \c GLclampf + * - 'd' for \c GLdouble and \c GLclampd + */ + const char * parameter_signature; + + + /** + * Offset in the dispatch table where the pointer to the real function is + * located. If the driver has not requested that the named function be + * added to the dispatch table, this will have the value ~0. + */ + unsigned dispatch_offset; + + + /** + * Pointer to the dispatch stub for the named function. + * + * \todo + * The semantic of this field should be changed slightly. Currently, it + * is always expected to be non-\c NULL. However, it would be better to + * only allocate the entry-point stub when the application requests the + * function via \c glXGetProcAddress. This would save memory for all the + * functions that the driver exports but that the application never wants + * to call. + */ + _glapi_proc dispatch_stub; +}; + + +static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS]; +static GLuint NumExtEntryPoints = 0; + +#ifdef USE_SPARC_ASM +extern void __glapi_sparc_icache_flush(unsigned int *); +#endif + +/** + * Generate a dispatch function (entrypoint) which jumps through + * the given slot number (offset) in the current dispatch table. + * We need assembly language in order to accomplish this. + */ +static _glapi_proc +generate_entrypoint(GLuint functionOffset) +{ +#if defined(USE_X86_ASM) + /* 32 is chosen as something of a magic offset. For x86, the dispatch + * at offset 32 is the first one where the offset in the + * "jmp OFFSET*4(%eax)" can't be encoded in a single byte. + */ + const GLubyte * const template_func = gl_dispatch_functions_start + + (X86_DISPATCH_FUNCTION_SIZE * 32); + GLubyte * const code = (GLubyte *) malloc( X86_DISPATCH_FUNCTION_SIZE ); + + + if ( code != NULL ) { + (void) memcpy( code, template_func, X86_DISPATCH_FUNCTION_SIZE ); + fill_in_entrypoint_offset( (_glapi_proc) code, functionOffset ); + } + + return (_glapi_proc) code; +#elif defined(USE_SPARC_ASM) + +#ifdef __arch64__ + static const unsigned int insn_template[] = { + 0x05000000, /* sethi %uhi(_glapi_Dispatch), %g2 */ + 0x03000000, /* sethi %hi(_glapi_Dispatch), %g1 */ + 0x8410a000, /* or %g2, %ulo(_glapi_Dispatch), %g2 */ + 0x82106000, /* or %g1, %lo(_glapi_Dispatch), %g1 */ + 0x8528b020, /* sllx %g2, 32, %g2 */ + 0xc2584002, /* ldx [%g1 + %g2], %g1 */ + 0x05000000, /* sethi %hi(8 * glapioffset), %g2 */ + 0x8410a000, /* or %g2, %lo(8 * glapioffset), %g2 */ + 0xc6584002, /* ldx [%g1 + %g2], %g3 */ + 0x81c0c000, /* jmpl %g3, %g0 */ + 0x01000000 /* nop */ + }; +#else + static const unsigned int insn_template[] = { + 0x03000000, /* sethi %hi(_glapi_Dispatch), %g1 */ + 0xc2006000, /* ld [%g1 + %lo(_glapi_Dispatch)], %g1 */ + 0xc6006000, /* ld [%g1 + %lo(4*glapioffset)], %g3 */ + 0x81c0c000, /* jmpl %g3, %g0 */ + 0x01000000 /* nop */ + }; +#endif + unsigned int *code = (unsigned int *) malloc(sizeof(insn_template)); + unsigned long glapi_addr = (unsigned long) &_glapi_Dispatch; + if (code) { + memcpy(code, insn_template, sizeof(insn_template)); + +#ifdef __arch64__ + code[0] |= (glapi_addr >> (32 + 10)); + code[1] |= ((glapi_addr & 0xffffffff) >> 10); + __glapi_sparc_icache_flush(&code[0]); + code[2] |= ((glapi_addr >> 32) & ((1 << 10) - 1)); + code[3] |= (glapi_addr & ((1 << 10) - 1)); + __glapi_sparc_icache_flush(&code[2]); + code[6] |= ((functionOffset * 8) >> 10); + code[7] |= ((functionOffset * 8) & ((1 << 10) - 1)); + __glapi_sparc_icache_flush(&code[6]); +#else + code[0] |= (glapi_addr >> 10); + code[1] |= (glapi_addr & ((1 << 10) - 1)); + __glapi_sparc_icache_flush(&code[0]); + code[2] |= (functionOffset * 4); + __glapi_sparc_icache_flush(&code[2]); +#endif + } + return (_glapi_proc) code; +#else + (void) functionOffset; + return NULL; +#endif /* USE_*_ASM */ +} + + +/** + * This function inserts a new dispatch offset into the assembly language + * stub that was generated with the preceeding function. + */ +static void +fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset) +{ +#if defined(USE_X86_ASM) + GLubyte * const code = (GLubyte *) entrypoint; + + +#if X86_DISPATCH_FUNCTION_SIZE == 32 + *((unsigned int *)(code + 11)) = 4 * offset; + *((unsigned int *)(code + 22)) = 4 * offset; +#elif X86_DISPATCH_FUNCTION_SIZE == 16 && defined( GLX_USE_TLS ) + *((unsigned int *)(code + 8)) = 4 * offset; +#elif X86_DISPATCH_FUNCTION_SIZE == 16 + *((unsigned int *)(code + 7)) = 4 * offset; +#else +# error Invalid X86_DISPATCH_FUNCTION_SIZE! +#endif + +#elif defined(USE_SPARC_ASM) + + /* XXX this hasn't been tested! */ + unsigned int *code = (unsigned int *) entrypoint; +#ifdef __arch64__ + code[6] = 0x05000000; /* sethi %hi(8 * glapioffset), %g2 */ + code[7] = 0x8410a000; /* or %g2, %lo(8 * glapioffset), %g2 */ + code[6] |= ((offset * 8) >> 10); + code[7] |= ((offset * 8) & ((1 << 10) - 1)); + __glapi_sparc_icache_flush(&code[6]); +#else /* __arch64__ */ + code[2] = 0xc6006000; /* ld [%g1 + %lo(4*glapioffset)], %g3 */ + code[2] |= (offset * 4); + __glapi_sparc_icache_flush(&code[2]); +#endif /* __arch64__ */ + +#else + + /* an unimplemented architecture */ + (void) entrypoint; + (void) offset; + +#endif /* USE_*_ASM */ +} + + +/** + * Generate new entrypoint + * + * Use a temporary dispatch offset of ~0 (i.e. -1). Later, when the driver + * calls \c _glapi_add_dispatch we'll put in the proper offset. If that + * never happens, and the user calls this function, he'll segfault. That's + * what you get when you try calling a GL function that doesn't really exist. + * + * \param funcName Name of the function to create an entry-point for. + * + * \sa _glapi_add_entrypoint + */ + +static struct _glapi_function * +add_function_name( const char * funcName ) +{ + struct _glapi_function * entry = NULL; + + if (NumExtEntryPoints < MAX_EXTENSION_FUNCS) { + _glapi_proc entrypoint = generate_entrypoint(~0); + if (entrypoint != NULL) { + entry = & ExtEntryTable[NumExtEntryPoints]; + + ExtEntryTable[NumExtEntryPoints].name = str_dup(funcName); + ExtEntryTable[NumExtEntryPoints].parameter_signature = NULL; + ExtEntryTable[NumExtEntryPoints].dispatch_offset = ~0; + ExtEntryTable[NumExtEntryPoints].dispatch_stub = entrypoint; + NumExtEntryPoints++; + } + } + + return entry; +} + + +/** + * Fill-in the dispatch stub for the named function. + * + * This function is intended to be called by a hardware driver. When called, + * a dispatch stub may be created created for the function. A pointer to this + * dispatch function will be returned by glXGetProcAddress. + * + * \param function_names Array of pointers to function names that should + * share a common dispatch offset. + * \param parameter_signature String representing the types of the parameters + * passed to the named function. Parameter types + * are converted to characters using the following + * rules: + * - 'i' for \c GLint, \c GLuint, and \c GLenum + * - 'p' for any pointer type + * - 'f' for \c GLfloat and \c GLclampf + * - 'd' for \c GLdouble and \c GLclampd + * + * \returns + * The offset in the dispatch table of the named function. A pointer to the + * driver's implementation of the named function should be stored at + * \c dispatch_table[\c offset]. + * + * \sa glXGetProcAddress + * + * \warning + * This function can only handle up to 8 names at a time. As far as I know, + * the maximum number of names ever associated with an existing GL function is + * 4 (\c glPointParameterfSGIS, \c glPointParameterfEXT, + * \c glPointParameterfARB, and \c glPointParameterf), so this should not be + * too painful of a limitation. + * + * \todo + * Determine whether or not \c parameter_signature should be allowed to be + * \c NULL. It doesn't seem like much of a hardship for drivers to have to + * pass in an empty string. + * + * \todo + * Determine if code should be added to reject function names that start with + * 'glX'. + * + * \bug + * Add code to compare \c parameter_signature with the parameter signature of + * a static function. In order to do that, we need to find a way to \b get + * the parameter signature of a static function. + */ + +PUBLIC int +_glapi_add_dispatch( const char * const * function_names, + const char * parameter_signature ) +{ + static int next_dynamic_offset = _gloffset_FIRST_DYNAMIC; + const char * const real_sig = (parameter_signature != NULL) + ? parameter_signature : ""; + struct _glapi_function * entry[8]; + GLboolean is_static[8]; + unsigned i; + unsigned j; + int offset = ~0; + int new_offset; + + + (void) memset( is_static, 0, sizeof( is_static ) ); + (void) memset( entry, 0, sizeof( entry ) ); + + for ( i = 0 ; function_names[i] != NULL ; i++ ) { + /* Do some trivial validation on the name of the function. + */ + +#ifdef MANGLE + if (!function_names[i] || function_names[i][0] != 'm' || function_names[i][1] != 'g' || function_names[i][2] != 'l') + return GL_FALSE; +#else + if (!function_names[i] || function_names[i][0] != 'g' || function_names[i][1] != 'l') + return GL_FALSE; +#endif + + + /* Determine if the named function already exists. If the function does + * exist, it must have the same parameter signature as the function + * being added. + */ + + new_offset = get_static_proc_offset(function_names[i]); + if (new_offset >= 0) { + /* FIXME: Make sure the parameter signatures match! How do we get + * FIXME: the parameter signature for static functions? + */ + + if ( (offset != ~0) && (new_offset != offset) ) { + return -1; + } + + is_static[i] = GL_TRUE; + offset = new_offset; + } + + + for ( j = 0 ; j < NumExtEntryPoints ; j++ ) { + if (strcmp(ExtEntryTable[j].name, function_names[i]) == 0) { + /* The offset may be ~0 if the function name was added by + * glXGetProcAddress but never filled in by the driver. + */ + + if (ExtEntryTable[j].dispatch_offset != ~0) { + if (strcmp(real_sig, ExtEntryTable[j].parameter_signature) + != 0) { + return -1; + } + + if ( (offset != ~0) && (ExtEntryTable[j].dispatch_offset != offset) ) { + return -1; + } + + offset = ExtEntryTable[j].dispatch_offset; + } + + entry[i] = & ExtEntryTable[j]; + break; + } + } + } + + + if (offset == ~0) { + offset = next_dynamic_offset; + next_dynamic_offset++; + } + + + for ( i = 0 ; function_names[i] != NULL ; i++ ) { + if (! is_static[i] ) { + if (entry[i] == NULL) { + entry[i] = add_function_name( function_names[i] ); + if (entry[i] == NULL) { + /* FIXME: Possible memory leak here. + */ + return -1; + } + } + + + entry[i]->parameter_signature = str_dup(real_sig); + fill_in_entrypoint_offset(entry[i]->dispatch_stub, offset); + entry[i]->dispatch_offset = offset; + } + } + + return offset; +} + + +/** + * Return offset of entrypoint for named function within dispatch table. + */ +PUBLIC GLint +_glapi_get_proc_offset(const char *funcName) +{ + /* search extension functions first */ + GLuint i; + for (i = 0; i < NumExtEntryPoints; i++) { + if (strcmp(ExtEntryTable[i].name, funcName) == 0) { + return ExtEntryTable[i].dispatch_offset; + } + } + + /* search static functions */ + return get_static_proc_offset(funcName); +} + + + +/** + * Return pointer to the named function. If the function name isn't found + * in the name of static functions, try generating a new API entrypoint on + * the fly with assembly language. + */ +_glapi_proc +_glapi_get_proc_address(const char *funcName) +{ + struct _glapi_function * entry; + GLuint i; + +#ifdef MANGLE + if (funcName[0] != 'm' || funcName[1] != 'g' || funcName[2] != 'l') + return NULL; +#else + if (funcName[0] != 'g' || funcName[1] != 'l') + return NULL; +#endif + + /* search extension functions first */ + for (i = 0; i < NumExtEntryPoints; i++) { + if (strcmp(ExtEntryTable[i].name, funcName) == 0) { + return ExtEntryTable[i].dispatch_stub; + } + } + +#if !defined( XFree86Server ) + /* search static functions */ + { + const _glapi_proc func = get_static_proc_address(funcName); + if (func) + return func; + } +#endif /* !defined( XFree86Server ) */ + + entry = add_function_name(funcName); + return (entry == NULL) ? NULL : entry->dispatch_stub; +} + + + +/** + * Return the name of the function at the given dispatch offset. + * This is only intended for debugging. + */ +const char * +_glapi_get_proc_name(GLuint offset) +{ + GLuint i; + const char * n; + + /* search built-in functions */ + n = get_static_proc_name(offset); + if ( n != NULL ) { + return n; + } + + /* search added extension functions */ + for (i = 0; i < NumExtEntryPoints; i++) { + if (ExtEntryTable[i].dispatch_offset == offset) { + return ExtEntryTable[i].name; + } + } + return NULL; +} + + + +/** + * Return size of dispatch table struct as number of functions (or + * slots). + */ +PUBLIC GLuint +_glapi_get_dispatch_table_size(void) +{ + return DISPATCH_TABLE_SIZE; +} + + + +/** + * Make sure there are no NULL pointers in the given dispatch table. + * Intended for debugging purposes. + */ +void +_glapi_check_table(const struct _glapi_table *table) +{ +#ifdef DEBUG + const GLuint entries = _glapi_get_dispatch_table_size(); + const void **tab = (const void **) table; + GLuint i; + for (i = 1; i < entries; i++) { + assert(tab[i]); + } + + /* Do some spot checks to be sure that the dispatch table + * slots are assigned correctly. + */ + { + GLuint BeginOffset = _glapi_get_proc_offset("glBegin"); + char *BeginFunc = (char*) &table->Begin; + GLuint offset = (BeginFunc - (char *) table) / sizeof(void *); + assert(BeginOffset == _gloffset_Begin); + assert(BeginOffset == offset); + } + { + GLuint viewportOffset = _glapi_get_proc_offset("glViewport"); + char *viewportFunc = (char*) &table->Viewport; + GLuint offset = (viewportFunc - (char *) table) / sizeof(void *); + assert(viewportOffset == _gloffset_Viewport); + assert(viewportOffset == offset); + } + { + GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer"); + char *VertexPointerFunc = (char*) &table->VertexPointer; + GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *); + assert(VertexPointerOffset == _gloffset_VertexPointer); + assert(VertexPointerOffset == offset); + } + { + GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax"); + char *ResetMinMaxFunc = (char*) &table->ResetMinmax; + GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *); + assert(ResetMinMaxOffset == _gloffset_ResetMinmax); + assert(ResetMinMaxOffset == offset); + } + { + GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor"); + char *blendColorFunc = (char*) &table->BlendColor; + GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *); + assert(blendColorOffset == _gloffset_BlendColor); + assert(blendColorOffset == offset); + } + { + GLuint istextureOffset = _glapi_get_proc_offset("glIsTextureEXT"); + char *istextureFunc = (char*) &table->IsTextureEXT; + GLuint offset = (istextureFunc - (char *) table) / sizeof(void *); + assert(istextureOffset == _gloffset_IsTextureEXT); + assert(istextureOffset == offset); + } + { + GLuint secondaryColor3fOffset = _glapi_get_proc_offset("glSecondaryColor3fEXT"); + char *secondaryColor3fFunc = (char*) &table->SecondaryColor3fEXT; + GLuint offset = (secondaryColor3fFunc - (char *) table) / sizeof(void *); + assert(secondaryColor3fOffset == _gloffset_SecondaryColor3fEXT); + assert(secondaryColor3fOffset == offset); + assert(_glapi_get_proc_address("glSecondaryColor3fEXT") == (_glapi_proc) &glSecondaryColor3fEXT); + } + { + GLuint pointParameterivOffset = _glapi_get_proc_offset("glPointParameterivNV"); + char *pointParameterivFunc = (char*) &table->PointParameterivNV; + GLuint offset = (pointParameterivFunc - (char *) table) / sizeof(void *); + assert(pointParameterivOffset == _gloffset_PointParameterivNV); + assert(pointParameterivOffset == offset); + assert(_glapi_get_proc_address("glPointParameterivNV") == (_glapi_proc) &glPointParameterivNV); + } + { + GLuint setFenceOffset = _glapi_get_proc_offset("glSetFenceNV"); + char *setFenceFunc = (char*) &table->SetFenceNV; + GLuint offset = (setFenceFunc - (char *) table) / sizeof(void *); + assert(setFenceOffset == _gloffset_SetFenceNV); + assert(setFenceOffset == offset); + assert(_glapi_get_proc_address("glSetFenceNV") == (_glapi_proc) &glSetFenceNV); + } +#else + (void) table; +#endif +} + + +/** + * Perform platform-specific GL API entry-point fixups. + * + * + */ +static void +init_glapi_relocs( void ) +{ +#if defined( USE_X86_ASM ) && defined( GLX_USE_TLS ) + extern void * _x86_get_dispatch(void); + const GLubyte * const get_disp = (const GLubyte *) _x86_get_dispatch; + GLubyte * curr_func = (GLubyte *) gl_dispatch_functions_start; + + + while ( curr_func != (GLubyte *) gl_dispatch_functions_end ) { + (void) memcpy( curr_func, get_disp, 6 ); + curr_func += X86_DISPATCH_FUNCTION_SIZE; + } +#endif /* defined( USE_X86_ASM ) && defined( GLX_USE_TLS ) */ +} diff --git a/reactos/dll/mesa32/src/glapi/glapi.h b/reactos/dll/mesa32/src/glapi/glapi.h new file mode 100644 index 00000000000..80ce2c324d2 --- /dev/null +++ b/reactos/dll/mesa32/src/glapi/glapi.h @@ -0,0 +1,152 @@ +/* + * 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. + */ + + +/** + * \mainpage Mesa GL API Module + * + * \section GLAPIIntroduction Introduction + * + * The Mesa GL API module is responsible for dispatching all the + * gl*() functions. All GL functions are dispatched by jumping through + * the current dispatch table (basically a struct full of function + * pointers.) + * + * A per-thread current dispatch table and per-thread current context + * pointer are managed by this module too. + * + * This module is intended to be non-Mesa-specific so it can be used + * with the X/DRI libGL also. + */ + + +#ifndef _GLAPI_H +#define _GLAPI_H + + +#include "GL/gl.h" +#include "glapitable.h" + +typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...); + + +#if defined (GLX_USE_TLS) + +const extern void *_glapi_Context; +const extern struct _glapi_table *_glapi_Dispatch; + +extern __thread void * _glapi_tls_Context + __attribute__((tls_model("initial-exec"))); + +# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context + +#else + +extern void *_glapi_Context; +extern struct _glapi_table *_glapi_Dispatch; + +/** + * Macro for declaration and fetching the current context. + * + * \param C local variable which will hold the current context. + * + * It should be used in the variable declaration area of a function: + * \code + * ... + * { + * GET_CURRENT_CONTEXT(ctx); + * ... + * \endcode + */ +# ifdef THREADS +# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) (_glapi_Context ? _glapi_Context : _glapi_get_context()) +# else +# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context +# endif + +#endif /* defined (GLX_USE_TLS) */ + +extern void +_glapi_noop_enable_warnings(GLboolean enable); + +extern void +_glapi_set_warning_func(_glapi_warning_func func); + +extern void +_glapi_check_multithread(void); + + +extern void +_glapi_set_context(void *context); + + +extern void * +_glapi_get_context(void); + + +extern void +_glapi_set_dispatch(struct _glapi_table *dispatch); + + +extern struct _glapi_table * +_glapi_get_dispatch(void); + + +extern int +_glapi_begin_dispatch_override(struct _glapi_table *override); + + +extern void +_glapi_end_dispatch_override(int layer); + + +struct _glapi_table * +_glapi_get_override_dispatch(int layer); + + +extern GLuint +_glapi_get_dispatch_table_size(void); + + +extern void +_glapi_check_table(const struct _glapi_table *table); + + +extern int +_glapi_add_dispatch( const char * const * function_names, + const char * parameter_signature ); + +extern GLint +_glapi_get_proc_offset(const char *funcName); + + +extern _glapi_proc +_glapi_get_proc_address(const char *funcName); + + +extern const char * +_glapi_get_proc_name(GLuint offset); + + +#endif diff --git a/reactos/dll/mesa32/src/glapi/glapioffsets.h b/reactos/dll/mesa32/src/glapi/glapioffsets.h new file mode 100644 index 00000000000..9e266450e9e --- /dev/null +++ b/reactos/dll/mesa32/src/glapi/glapioffsets.h @@ -0,0 +1,1266 @@ +/* DO NOT EDIT - This file generated automatically by gl_offsets.py (from Mesa) script */ + +/* + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * (C) Copyright IBM Corporation 2004 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL, IBM, + * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#if !defined( _GLAPI_OFFSETS_H_ ) +# define _GLAPI_OFFSETS_H_ + +#define _gloffset_NewList 0 +#define _gloffset_EndList 1 +#define _gloffset_CallList 2 +#define _gloffset_CallLists 3 +#define _gloffset_DeleteLists 4 +#define _gloffset_GenLists 5 +#define _gloffset_ListBase 6 +#define _gloffset_Begin 7 +#define _gloffset_Bitmap 8 +#define _gloffset_Color3b 9 +#define _gloffset_Color3bv 10 +#define _gloffset_Color3d 11 +#define _gloffset_Color3dv 12 +#define _gloffset_Color3f 13 +#define _gloffset_Color3fv 14 +#define _gloffset_Color3i 15 +#define _gloffset_Color3iv 16 +#define _gloffset_Color3s 17 +#define _gloffset_Color3sv 18 +#define _gloffset_Color3ub 19 +#define _gloffset_Color3ubv 20 +#define _gloffset_Color3ui 21 +#define _gloffset_Color3uiv 22 +#define _gloffset_Color3us 23 +#define _gloffset_Color3usv 24 +#define _gloffset_Color4b 25 +#define _gloffset_Color4bv 26 +#define _gloffset_Color4d 27 +#define _gloffset_Color4dv 28 +#define _gloffset_Color4f 29 +#define _gloffset_Color4fv 30 +#define _gloffset_Color4i 31 +#define _gloffset_Color4iv 32 +#define _gloffset_Color4s 33 +#define _gloffset_Color4sv 34 +#define _gloffset_Color4ub 35 +#define _gloffset_Color4ubv 36 +#define _gloffset_Color4ui 37 +#define _gloffset_Color4uiv 38 +#define _gloffset_Color4us 39 +#define _gloffset_Color4usv 40 +#define _gloffset_EdgeFlag 41 +#define _gloffset_EdgeFlagv 42 +#define _gloffset_End 43 +#define _gloffset_Indexd 44 +#define _gloffset_Indexdv 45 +#define _gloffset_Indexf 46 +#define _gloffset_Indexfv 47 +#define _gloffset_Indexi 48 +#define _gloffset_Indexiv 49 +#define _gloffset_Indexs 50 +#define _gloffset_Indexsv 51 +#define _gloffset_Normal3b 52 +#define _gloffset_Normal3bv 53 +#define _gloffset_Normal3d 54 +#define _gloffset_Normal3dv 55 +#define _gloffset_Normal3f 56 +#define _gloffset_Normal3fv 57 +#define _gloffset_Normal3i 58 +#define _gloffset_Normal3iv 59 +#define _gloffset_Normal3s 60 +#define _gloffset_Normal3sv 61 +#define _gloffset_RasterPos2d 62 +#define _gloffset_RasterPos2dv 63 +#define _gloffset_RasterPos2f 64 +#define _gloffset_RasterPos2fv 65 +#define _gloffset_RasterPos2i 66 +#define _gloffset_RasterPos2iv 67 +#define _gloffset_RasterPos2s 68 +#define _gloffset_RasterPos2sv 69 +#define _gloffset_RasterPos3d 70 +#define _gloffset_RasterPos3dv 71 +#define _gloffset_RasterPos3f 72 +#define _gloffset_RasterPos3fv 73 +#define _gloffset_RasterPos3i 74 +#define _gloffset_RasterPos3iv 75 +#define _gloffset_RasterPos3s 76 +#define _gloffset_RasterPos3sv 77 +#define _gloffset_RasterPos4d 78 +#define _gloffset_RasterPos4dv 79 +#define _gloffset_RasterPos4f 80 +#define _gloffset_RasterPos4fv 81 +#define _gloffset_RasterPos4i 82 +#define _gloffset_RasterPos4iv 83 +#define _gloffset_RasterPos4s 84 +#define _gloffset_RasterPos4sv 85 +#define _gloffset_Rectd 86 +#define _gloffset_Rectdv 87 +#define _gloffset_Rectf 88 +#define _gloffset_Rectfv 89 +#define _gloffset_Recti 90 +#define _gloffset_Rectiv 91 +#define _gloffset_Rects 92 +#define _gloffset_Rectsv 93 +#define _gloffset_TexCoord1d 94 +#define _gloffset_TexCoord1dv 95 +#define _gloffset_TexCoord1f 96 +#define _gloffset_TexCoord1fv 97 +#define _gloffset_TexCoord1i 98 +#define _gloffset_TexCoord1iv 99 +#define _gloffset_TexCoord1s 100 +#define _gloffset_TexCoord1sv 101 +#define _gloffset_TexCoord2d 102 +#define _gloffset_TexCoord2dv 103 +#define _gloffset_TexCoord2f 104 +#define _gloffset_TexCoord2fv 105 +#define _gloffset_TexCoord2i 106 +#define _gloffset_TexCoord2iv 107 +#define _gloffset_TexCoord2s 108 +#define _gloffset_TexCoord2sv 109 +#define _gloffset_TexCoord3d 110 +#define _gloffset_TexCoord3dv 111 +#define _gloffset_TexCoord3f 112 +#define _gloffset_TexCoord3fv 113 +#define _gloffset_TexCoord3i 114 +#define _gloffset_TexCoord3iv 115 +#define _gloffset_TexCoord3s 116 +#define _gloffset_TexCoord3sv 117 +#define _gloffset_TexCoord4d 118 +#define _gloffset_TexCoord4dv 119 +#define _gloffset_TexCoord4f 120 +#define _gloffset_TexCoord4fv 121 +#define _gloffset_TexCoord4i 122 +#define _gloffset_TexCoord4iv 123 +#define _gloffset_TexCoord4s 124 +#define _gloffset_TexCoord4sv 125 +#define _gloffset_Vertex2d 126 +#define _gloffset_Vertex2dv 127 +#define _gloffset_Vertex2f 128 +#define _gloffset_Vertex2fv 129 +#define _gloffset_Vertex2i 130 +#define _gloffset_Vertex2iv 131 +#define _gloffset_Vertex2s 132 +#define _gloffset_Vertex2sv 133 +#define _gloffset_Vertex3d 134 +#define _gloffset_Vertex3dv 135 +#define _gloffset_Vertex3f 136 +#define _gloffset_Vertex3fv 137 +#define _gloffset_Vertex3i 138 +#define _gloffset_Vertex3iv 139 +#define _gloffset_Vertex3s 140 +#define _gloffset_Vertex3sv 141 +#define _gloffset_Vertex4d 142 +#define _gloffset_Vertex4dv 143 +#define _gloffset_Vertex4f 144 +#define _gloffset_Vertex4fv 145 +#define _gloffset_Vertex4i 146 +#define _gloffset_Vertex4iv 147 +#define _gloffset_Vertex4s 148 +#define _gloffset_Vertex4sv 149 +#define _gloffset_ClipPlane 150 +#define _gloffset_ColorMaterial 151 +#define _gloffset_CullFace 152 +#define _gloffset_Fogf 153 +#define _gloffset_Fogfv 154 +#define _gloffset_Fogi 155 +#define _gloffset_Fogiv 156 +#define _gloffset_FrontFace 157 +#define _gloffset_Hint 158 +#define _gloffset_Lightf 159 +#define _gloffset_Lightfv 160 +#define _gloffset_Lighti 161 +#define _gloffset_Lightiv 162 +#define _gloffset_LightModelf 163 +#define _gloffset_LightModelfv 164 +#define _gloffset_LightModeli 165 +#define _gloffset_LightModeliv 166 +#define _gloffset_LineStipple 167 +#define _gloffset_LineWidth 168 +#define _gloffset_Materialf 169 +#define _gloffset_Materialfv 170 +#define _gloffset_Materiali 171 +#define _gloffset_Materialiv 172 +#define _gloffset_PointSize 173 +#define _gloffset_PolygonMode 174 +#define _gloffset_PolygonStipple 175 +#define _gloffset_Scissor 176 +#define _gloffset_ShadeModel 177 +#define _gloffset_TexParameterf 178 +#define _gloffset_TexParameterfv 179 +#define _gloffset_TexParameteri 180 +#define _gloffset_TexParameteriv 181 +#define _gloffset_TexImage1D 182 +#define _gloffset_TexImage2D 183 +#define _gloffset_TexEnvf 184 +#define _gloffset_TexEnvfv 185 +#define _gloffset_TexEnvi 186 +#define _gloffset_TexEnviv 187 +#define _gloffset_TexGend 188 +#define _gloffset_TexGendv 189 +#define _gloffset_TexGenf 190 +#define _gloffset_TexGenfv 191 +#define _gloffset_TexGeni 192 +#define _gloffset_TexGeniv 193 +#define _gloffset_FeedbackBuffer 194 +#define _gloffset_SelectBuffer 195 +#define _gloffset_RenderMode 196 +#define _gloffset_InitNames 197 +#define _gloffset_LoadName 198 +#define _gloffset_PassThrough 199 +#define _gloffset_PopName 200 +#define _gloffset_PushName 201 +#define _gloffset_DrawBuffer 202 +#define _gloffset_Clear 203 +#define _gloffset_ClearAccum 204 +#define _gloffset_ClearIndex 205 +#define _gloffset_ClearColor 206 +#define _gloffset_ClearStencil 207 +#define _gloffset_ClearDepth 208 +#define _gloffset_StencilMask 209 +#define _gloffset_ColorMask 210 +#define _gloffset_DepthMask 211 +#define _gloffset_IndexMask 212 +#define _gloffset_Accum 213 +#define _gloffset_Disable 214 +#define _gloffset_Enable 215 +#define _gloffset_Finish 216 +#define _gloffset_Flush 217 +#define _gloffset_PopAttrib 218 +#define _gloffset_PushAttrib 219 +#define _gloffset_Map1d 220 +#define _gloffset_Map1f 221 +#define _gloffset_Map2d 222 +#define _gloffset_Map2f 223 +#define _gloffset_MapGrid1d 224 +#define _gloffset_MapGrid1f 225 +#define _gloffset_MapGrid2d 226 +#define _gloffset_MapGrid2f 227 +#define _gloffset_EvalCoord1d 228 +#define _gloffset_EvalCoord1dv 229 +#define _gloffset_EvalCoord1f 230 +#define _gloffset_EvalCoord1fv 231 +#define _gloffset_EvalCoord2d 232 +#define _gloffset_EvalCoord2dv 233 +#define _gloffset_EvalCoord2f 234 +#define _gloffset_EvalCoord2fv 235 +#define _gloffset_EvalMesh1 236 +#define _gloffset_EvalPoint1 237 +#define _gloffset_EvalMesh2 238 +#define _gloffset_EvalPoint2 239 +#define _gloffset_AlphaFunc 240 +#define _gloffset_BlendFunc 241 +#define _gloffset_LogicOp 242 +#define _gloffset_StencilFunc 243 +#define _gloffset_StencilOp 244 +#define _gloffset_DepthFunc 245 +#define _gloffset_PixelZoom 246 +#define _gloffset_PixelTransferf 247 +#define _gloffset_PixelTransferi 248 +#define _gloffset_PixelStoref 249 +#define _gloffset_PixelStorei 250 +#define _gloffset_PixelMapfv 251 +#define _gloffset_PixelMapuiv 252 +#define _gloffset_PixelMapusv 253 +#define _gloffset_ReadBuffer 254 +#define _gloffset_CopyPixels 255 +#define _gloffset_ReadPixels 256 +#define _gloffset_DrawPixels 257 +#define _gloffset_GetBooleanv 258 +#define _gloffset_GetClipPlane 259 +#define _gloffset_GetDoublev 260 +#define _gloffset_GetError 261 +#define _gloffset_GetFloatv 262 +#define _gloffset_GetIntegerv 263 +#define _gloffset_GetLightfv 264 +#define _gloffset_GetLightiv 265 +#define _gloffset_GetMapdv 266 +#define _gloffset_GetMapfv 267 +#define _gloffset_GetMapiv 268 +#define _gloffset_GetMaterialfv 269 +#define _gloffset_GetMaterialiv 270 +#define _gloffset_GetPixelMapfv 271 +#define _gloffset_GetPixelMapuiv 272 +#define _gloffset_GetPixelMapusv 273 +#define _gloffset_GetPolygonStipple 274 +#define _gloffset_GetString 275 +#define _gloffset_GetTexEnvfv 276 +#define _gloffset_GetTexEnviv 277 +#define _gloffset_GetTexGendv 278 +#define _gloffset_GetTexGenfv 279 +#define _gloffset_GetTexGeniv 280 +#define _gloffset_GetTexImage 281 +#define _gloffset_GetTexParameterfv 282 +#define _gloffset_GetTexParameteriv 283 +#define _gloffset_GetTexLevelParameterfv 284 +#define _gloffset_GetTexLevelParameteriv 285 +#define _gloffset_IsEnabled 286 +#define _gloffset_IsList 287 +#define _gloffset_DepthRange 288 +#define _gloffset_Frustum 289 +#define _gloffset_LoadIdentity 290 +#define _gloffset_LoadMatrixf 291 +#define _gloffset_LoadMatrixd 292 +#define _gloffset_MatrixMode 293 +#define _gloffset_MultMatrixf 294 +#define _gloffset_MultMatrixd 295 +#define _gloffset_Ortho 296 +#define _gloffset_PopMatrix 297 +#define _gloffset_PushMatrix 298 +#define _gloffset_Rotated 299 +#define _gloffset_Rotatef 300 +#define _gloffset_Scaled 301 +#define _gloffset_Scalef 302 +#define _gloffset_Translated 303 +#define _gloffset_Translatef 304 +#define _gloffset_Viewport 305 +#define _gloffset_ArrayElement 306 +#define _gloffset_BindTexture 307 +#define _gloffset_ColorPointer 308 +#define _gloffset_DisableClientState 309 +#define _gloffset_DrawArrays 310 +#define _gloffset_DrawElements 311 +#define _gloffset_EdgeFlagPointer 312 +#define _gloffset_EnableClientState 313 +#define _gloffset_IndexPointer 314 +#define _gloffset_Indexub 315 +#define _gloffset_Indexubv 316 +#define _gloffset_InterleavedArrays 317 +#define _gloffset_NormalPointer 318 +#define _gloffset_PolygonOffset 319 +#define _gloffset_TexCoordPointer 320 +#define _gloffset_VertexPointer 321 +#define _gloffset_AreTexturesResident 322 +#define _gloffset_CopyTexImage1D 323 +#define _gloffset_CopyTexImage2D 324 +#define _gloffset_CopyTexSubImage1D 325 +#define _gloffset_CopyTexSubImage2D 326 +#define _gloffset_DeleteTextures 327 +#define _gloffset_GenTextures 328 +#define _gloffset_GetPointerv 329 +#define _gloffset_IsTexture 330 +#define _gloffset_PrioritizeTextures 331 +#define _gloffset_TexSubImage1D 332 +#define _gloffset_TexSubImage2D 333 +#define _gloffset_PopClientAttrib 334 +#define _gloffset_PushClientAttrib 335 +#define _gloffset_BlendColor 336 +#define _gloffset_BlendEquation 337 +#define _gloffset_DrawRangeElements 338 +#define _gloffset_ColorTable 339 +#define _gloffset_ColorTableParameterfv 340 +#define _gloffset_ColorTableParameteriv 341 +#define _gloffset_CopyColorTable 342 +#define _gloffset_GetColorTable 343 +#define _gloffset_GetColorTableParameterfv 344 +#define _gloffset_GetColorTableParameteriv 345 +#define _gloffset_ColorSubTable 346 +#define _gloffset_CopyColorSubTable 347 +#define _gloffset_ConvolutionFilter1D 348 +#define _gloffset_ConvolutionFilter2D 349 +#define _gloffset_ConvolutionParameterf 350 +#define _gloffset_ConvolutionParameterfv 351 +#define _gloffset_ConvolutionParameteri 352 +#define _gloffset_ConvolutionParameteriv 353 +#define _gloffset_CopyConvolutionFilter1D 354 +#define _gloffset_CopyConvolutionFilter2D 355 +#define _gloffset_GetConvolutionFilter 356 +#define _gloffset_GetConvolutionParameterfv 357 +#define _gloffset_GetConvolutionParameteriv 358 +#define _gloffset_GetSeparableFilter 359 +#define _gloffset_SeparableFilter2D 360 +#define _gloffset_GetHistogram 361 +#define _gloffset_GetHistogramParameterfv 362 +#define _gloffset_GetHistogramParameteriv 363 +#define _gloffset_GetMinmax 364 +#define _gloffset_GetMinmaxParameterfv 365 +#define _gloffset_GetMinmaxParameteriv 366 +#define _gloffset_Histogram 367 +#define _gloffset_Minmax 368 +#define _gloffset_ResetHistogram 369 +#define _gloffset_ResetMinmax 370 +#define _gloffset_TexImage3D 371 +#define _gloffset_TexSubImage3D 372 +#define _gloffset_CopyTexSubImage3D 373 +#define _gloffset_ActiveTextureARB 374 +#define _gloffset_ClientActiveTextureARB 375 +#define _gloffset_MultiTexCoord1dARB 376 +#define _gloffset_MultiTexCoord1dvARB 377 +#define _gloffset_MultiTexCoord1fARB 378 +#define _gloffset_MultiTexCoord1fvARB 379 +#define _gloffset_MultiTexCoord1iARB 380 +#define _gloffset_MultiTexCoord1ivARB 381 +#define _gloffset_MultiTexCoord1sARB 382 +#define _gloffset_MultiTexCoord1svARB 383 +#define _gloffset_MultiTexCoord2dARB 384 +#define _gloffset_MultiTexCoord2dvARB 385 +#define _gloffset_MultiTexCoord2fARB 386 +#define _gloffset_MultiTexCoord2fvARB 387 +#define _gloffset_MultiTexCoord2iARB 388 +#define _gloffset_MultiTexCoord2ivARB 389 +#define _gloffset_MultiTexCoord2sARB 390 +#define _gloffset_MultiTexCoord2svARB 391 +#define _gloffset_MultiTexCoord3dARB 392 +#define _gloffset_MultiTexCoord3dvARB 393 +#define _gloffset_MultiTexCoord3fARB 394 +#define _gloffset_MultiTexCoord3fvARB 395 +#define _gloffset_MultiTexCoord3iARB 396 +#define _gloffset_MultiTexCoord3ivARB 397 +#define _gloffset_MultiTexCoord3sARB 398 +#define _gloffset_MultiTexCoord3svARB 399 +#define _gloffset_MultiTexCoord4dARB 400 +#define _gloffset_MultiTexCoord4dvARB 401 +#define _gloffset_MultiTexCoord4fARB 402 +#define _gloffset_MultiTexCoord4fvARB 403 +#define _gloffset_MultiTexCoord4iARB 404 +#define _gloffset_MultiTexCoord4ivARB 405 +#define _gloffset_MultiTexCoord4sARB 406 +#define _gloffset_MultiTexCoord4svARB 407 + +#if !defined(IN_DRI_DRIVER) + +#define _gloffset_LoadTransposeMatrixfARB 408 +#define _gloffset_LoadTransposeMatrixdARB 409 +#define _gloffset_MultTransposeMatrixfARB 410 +#define _gloffset_MultTransposeMatrixdARB 411 +#define _gloffset_SampleCoverageARB 412 +#define _gloffset_DrawBuffersARB 413 +#define _gloffset_PolygonOffsetEXT 414 +#define _gloffset_GetTexFilterFuncSGIS 415 +#define _gloffset_TexFilterFuncSGIS 416 +#define _gloffset_GetHistogramEXT 417 +#define _gloffset_GetHistogramParameterfvEXT 418 +#define _gloffset_GetHistogramParameterivEXT 419 +#define _gloffset_GetMinmaxEXT 420 +#define _gloffset_GetMinmaxParameterfvEXT 421 +#define _gloffset_GetMinmaxParameterivEXT 422 +#define _gloffset_GetConvolutionFilterEXT 423 +#define _gloffset_GetConvolutionParameterfvEXT 424 +#define _gloffset_GetConvolutionParameterivEXT 425 +#define _gloffset_GetSeparableFilterEXT 426 +#define _gloffset_GetColorTableSGI 427 +#define _gloffset_GetColorTableParameterfvSGI 428 +#define _gloffset_GetColorTableParameterivSGI 429 +#define _gloffset_PixelTexGenSGIX 430 +#define _gloffset_PixelTexGenParameteriSGIS 431 +#define _gloffset_PixelTexGenParameterivSGIS 432 +#define _gloffset_PixelTexGenParameterfSGIS 433 +#define _gloffset_PixelTexGenParameterfvSGIS 434 +#define _gloffset_GetPixelTexGenParameterivSGIS 435 +#define _gloffset_GetPixelTexGenParameterfvSGIS 436 +#define _gloffset_TexImage4DSGIS 437 +#define _gloffset_TexSubImage4DSGIS 438 +#define _gloffset_AreTexturesResidentEXT 439 +#define _gloffset_GenTexturesEXT 440 +#define _gloffset_IsTextureEXT 441 +#define _gloffset_DetailTexFuncSGIS 442 +#define _gloffset_GetDetailTexFuncSGIS 443 +#define _gloffset_SharpenTexFuncSGIS 444 +#define _gloffset_GetSharpenTexFuncSGIS 445 +#define _gloffset_SampleMaskSGIS 446 +#define _gloffset_SamplePatternSGIS 447 +#define _gloffset_ColorPointerEXT 448 +#define _gloffset_EdgeFlagPointerEXT 449 +#define _gloffset_IndexPointerEXT 450 +#define _gloffset_NormalPointerEXT 451 +#define _gloffset_TexCoordPointerEXT 452 +#define _gloffset_VertexPointerEXT 453 +#define _gloffset_SpriteParameterfSGIX 454 +#define _gloffset_SpriteParameterfvSGIX 455 +#define _gloffset_SpriteParameteriSGIX 456 +#define _gloffset_SpriteParameterivSGIX 457 +#define _gloffset_PointParameterfEXT 458 +#define _gloffset_PointParameterfvEXT 459 +#define _gloffset_GetInstrumentsSGIX 460 +#define _gloffset_InstrumentsBufferSGIX 461 +#define _gloffset_PollInstrumentsSGIX 462 +#define _gloffset_ReadInstrumentsSGIX 463 +#define _gloffset_StartInstrumentsSGIX 464 +#define _gloffset_StopInstrumentsSGIX 465 +#define _gloffset_FrameZoomSGIX 466 +#define _gloffset_TagSampleBufferSGIX 467 +#define _gloffset_ReferencePlaneSGIX 468 +#define _gloffset_FlushRasterSGIX 469 +#define _gloffset_GetListParameterfvSGIX 470 +#define _gloffset_GetListParameterivSGIX 471 +#define _gloffset_ListParameterfSGIX 472 +#define _gloffset_ListParameterfvSGIX 473 +#define _gloffset_ListParameteriSGIX 474 +#define _gloffset_ListParameterivSGIX 475 +#define _gloffset_FragmentColorMaterialSGIX 476 +#define _gloffset_FragmentLightfSGIX 477 +#define _gloffset_FragmentLightfvSGIX 478 +#define _gloffset_FragmentLightiSGIX 479 +#define _gloffset_FragmentLightivSGIX 480 +#define _gloffset_FragmentLightModelfSGIX 481 +#define _gloffset_FragmentLightModelfvSGIX 482 +#define _gloffset_FragmentLightModeliSGIX 483 +#define _gloffset_FragmentLightModelivSGIX 484 +#define _gloffset_FragmentMaterialfSGIX 485 +#define _gloffset_FragmentMaterialfvSGIX 486 +#define _gloffset_FragmentMaterialiSGIX 487 +#define _gloffset_FragmentMaterialivSGIX 488 +#define _gloffset_GetFragmentLightfvSGIX 489 +#define _gloffset_GetFragmentLightivSGIX 490 +#define _gloffset_GetFragmentMaterialfvSGIX 491 +#define _gloffset_GetFragmentMaterialivSGIX 492 +#define _gloffset_LightEnviSGIX 493 +#define _gloffset_VertexWeightfEXT 494 +#define _gloffset_VertexWeightfvEXT 495 +#define _gloffset_VertexWeightPointerEXT 496 +#define _gloffset_FlushVertexArrayRangeNV 497 +#define _gloffset_VertexArrayRangeNV 498 +#define _gloffset_CombinerParameterfvNV 499 +#define _gloffset_CombinerParameterfNV 500 +#define _gloffset_CombinerParameterivNV 501 +#define _gloffset_CombinerParameteriNV 502 +#define _gloffset_CombinerInputNV 503 +#define _gloffset_CombinerOutputNV 504 +#define _gloffset_FinalCombinerInputNV 505 +#define _gloffset_GetCombinerInputParameterfvNV 506 +#define _gloffset_GetCombinerInputParameterivNV 507 +#define _gloffset_GetCombinerOutputParameterfvNV 508 +#define _gloffset_GetCombinerOutputParameterivNV 509 +#define _gloffset_GetFinalCombinerInputParameterfvNV 510 +#define _gloffset_GetFinalCombinerInputParameterivNV 511 +#define _gloffset_ResizeBuffersMESA 512 +#define _gloffset_WindowPos2dMESA 513 +#define _gloffset_WindowPos2dvMESA 514 +#define _gloffset_WindowPos2fMESA 515 +#define _gloffset_WindowPos2fvMESA 516 +#define _gloffset_WindowPos2iMESA 517 +#define _gloffset_WindowPos2ivMESA 518 +#define _gloffset_WindowPos2sMESA 519 +#define _gloffset_WindowPos2svMESA 520 +#define _gloffset_WindowPos3dMESA 521 +#define _gloffset_WindowPos3dvMESA 522 +#define _gloffset_WindowPos3fMESA 523 +#define _gloffset_WindowPos3fvMESA 524 +#define _gloffset_WindowPos3iMESA 525 +#define _gloffset_WindowPos3ivMESA 526 +#define _gloffset_WindowPos3sMESA 527 +#define _gloffset_WindowPos3svMESA 528 +#define _gloffset_WindowPos4dMESA 529 +#define _gloffset_WindowPos4dvMESA 530 +#define _gloffset_WindowPos4fMESA 531 +#define _gloffset_WindowPos4fvMESA 532 +#define _gloffset_WindowPos4iMESA 533 +#define _gloffset_WindowPos4ivMESA 534 +#define _gloffset_WindowPos4sMESA 535 +#define _gloffset_WindowPos4svMESA 536 +#define _gloffset_BlendFuncSeparateEXT 537 +#define _gloffset_IndexMaterialEXT 538 +#define _gloffset_IndexFuncEXT 539 +#define _gloffset_LockArraysEXT 540 +#define _gloffset_UnlockArraysEXT 541 +#define _gloffset_CullParameterdvEXT 542 +#define _gloffset_CullParameterfvEXT 543 +#define _gloffset_HintPGI 544 +#define _gloffset_FogCoordfEXT 545 +#define _gloffset_FogCoordfvEXT 546 +#define _gloffset_FogCoorddEXT 547 +#define _gloffset_FogCoorddvEXT 548 +#define _gloffset_FogCoordPointerEXT 549 +#define _gloffset_GetColorTableEXT 550 +#define _gloffset_GetColorTableParameterivEXT 551 +#define _gloffset_GetColorTableParameterfvEXT 552 +#define _gloffset_TbufferMask3DFX 553 +#define _gloffset_CompressedTexImage3DARB 554 +#define _gloffset_CompressedTexImage2DARB 555 +#define _gloffset_CompressedTexImage1DARB 556 +#define _gloffset_CompressedTexSubImage3DARB 557 +#define _gloffset_CompressedTexSubImage2DARB 558 +#define _gloffset_CompressedTexSubImage1DARB 559 +#define _gloffset_GetCompressedTexImageARB 560 +#define _gloffset_SecondaryColor3bEXT 561 +#define _gloffset_SecondaryColor3bvEXT 562 +#define _gloffset_SecondaryColor3dEXT 563 +#define _gloffset_SecondaryColor3dvEXT 564 +#define _gloffset_SecondaryColor3fEXT 565 +#define _gloffset_SecondaryColor3fvEXT 566 +#define _gloffset_SecondaryColor3iEXT 567 +#define _gloffset_SecondaryColor3ivEXT 568 +#define _gloffset_SecondaryColor3sEXT 569 +#define _gloffset_SecondaryColor3svEXT 570 +#define _gloffset_SecondaryColor3ubEXT 571 +#define _gloffset_SecondaryColor3ubvEXT 572 +#define _gloffset_SecondaryColor3uiEXT 573 +#define _gloffset_SecondaryColor3uivEXT 574 +#define _gloffset_SecondaryColor3usEXT 575 +#define _gloffset_SecondaryColor3usvEXT 576 +#define _gloffset_SecondaryColorPointerEXT 577 +#define _gloffset_AreProgramsResidentNV 578 +#define _gloffset_BindProgramNV 579 +#define _gloffset_DeleteProgramsNV 580 +#define _gloffset_ExecuteProgramNV 581 +#define _gloffset_GenProgramsNV 582 +#define _gloffset_GetProgramParameterdvNV 583 +#define _gloffset_GetProgramParameterfvNV 584 +#define _gloffset_GetProgramivNV 585 +#define _gloffset_GetProgramStringNV 586 +#define _gloffset_GetTrackMatrixivNV 587 +#define _gloffset_GetVertexAttribdvARB 588 +#define _gloffset_GetVertexAttribfvARB 589 +#define _gloffset_GetVertexAttribivARB 590 +#define _gloffset_GetVertexAttribPointervNV 591 +#define _gloffset_IsProgramNV 592 +#define _gloffset_LoadProgramNV 593 +#define _gloffset_ProgramParameter4dNV 594 +#define _gloffset_ProgramParameter4dvNV 595 +#define _gloffset_ProgramParameter4fNV 596 +#define _gloffset_ProgramParameter4fvNV 597 +#define _gloffset_ProgramParameters4dvNV 598 +#define _gloffset_ProgramParameters4fvNV 599 +#define _gloffset_RequestResidentProgramsNV 600 +#define _gloffset_TrackMatrixNV 601 +#define _gloffset_VertexAttribPointerNV 602 +#define _gloffset_VertexAttrib1dARB 603 +#define _gloffset_VertexAttrib1dvARB 604 +#define _gloffset_VertexAttrib1fARB 605 +#define _gloffset_VertexAttrib1fvARB 606 +#define _gloffset_VertexAttrib1sARB 607 +#define _gloffset_VertexAttrib1svARB 608 +#define _gloffset_VertexAttrib2dARB 609 +#define _gloffset_VertexAttrib2dvARB 610 +#define _gloffset_VertexAttrib2fARB 611 +#define _gloffset_VertexAttrib2fvARB 612 +#define _gloffset_VertexAttrib2sARB 613 +#define _gloffset_VertexAttrib2svARB 614 +#define _gloffset_VertexAttrib3dARB 615 +#define _gloffset_VertexAttrib3dvARB 616 +#define _gloffset_VertexAttrib3fARB 617 +#define _gloffset_VertexAttrib3fvARB 618 +#define _gloffset_VertexAttrib3sARB 619 +#define _gloffset_VertexAttrib3svARB 620 +#define _gloffset_VertexAttrib4dARB 621 +#define _gloffset_VertexAttrib4dvARB 622 +#define _gloffset_VertexAttrib4fARB 623 +#define _gloffset_VertexAttrib4fvARB 624 +#define _gloffset_VertexAttrib4sARB 625 +#define _gloffset_VertexAttrib4svARB 626 +#define _gloffset_VertexAttrib4NubARB 627 +#define _gloffset_VertexAttrib4NubvARB 628 +#define _gloffset_VertexAttribs1dvNV 629 +#define _gloffset_VertexAttribs1fvNV 630 +#define _gloffset_VertexAttribs1svNV 631 +#define _gloffset_VertexAttribs2dvNV 632 +#define _gloffset_VertexAttribs2fvNV 633 +#define _gloffset_VertexAttribs2svNV 634 +#define _gloffset_VertexAttribs3dvNV 635 +#define _gloffset_VertexAttribs3fvNV 636 +#define _gloffset_VertexAttribs3svNV 637 +#define _gloffset_VertexAttribs4dvNV 638 +#define _gloffset_VertexAttribs4fvNV 639 +#define _gloffset_VertexAttribs4svNV 640 +#define _gloffset_VertexAttribs4ubvNV 641 +#define _gloffset_PointParameteriNV 642 +#define _gloffset_PointParameterivNV 643 +#define _gloffset_MultiDrawArraysEXT 644 +#define _gloffset_MultiDrawElementsEXT 645 +#define _gloffset_ActiveStencilFaceEXT 646 +#define _gloffset_DeleteFencesNV 647 +#define _gloffset_GenFencesNV 648 +#define _gloffset_IsFenceNV 649 +#define _gloffset_TestFenceNV 650 +#define _gloffset_GetFenceivNV 651 +#define _gloffset_FinishFenceNV 652 +#define _gloffset_SetFenceNV 653 +#define _gloffset_VertexAttrib4bvARB 654 +#define _gloffset_VertexAttrib4ivARB 655 +#define _gloffset_VertexAttrib4ubvARB 656 +#define _gloffset_VertexAttrib4usvARB 657 +#define _gloffset_VertexAttrib4uivARB 658 +#define _gloffset_VertexAttrib4NbvARB 659 +#define _gloffset_VertexAttrib4NsvARB 660 +#define _gloffset_VertexAttrib4NivARB 661 +#define _gloffset_VertexAttrib4NusvARB 662 +#define _gloffset_VertexAttrib4NuivARB 663 +#define _gloffset_VertexAttribPointerARB 664 +#define _gloffset_EnableVertexAttribArrayARB 665 +#define _gloffset_DisableVertexAttribArrayARB 666 +#define _gloffset_ProgramStringARB 667 +#define _gloffset_ProgramEnvParameter4dARB 668 +#define _gloffset_ProgramEnvParameter4dvARB 669 +#define _gloffset_ProgramEnvParameter4fARB 670 +#define _gloffset_ProgramEnvParameter4fvARB 671 +#define _gloffset_ProgramLocalParameter4dARB 672 +#define _gloffset_ProgramLocalParameter4dvARB 673 +#define _gloffset_ProgramLocalParameter4fARB 674 +#define _gloffset_ProgramLocalParameter4fvARB 675 +#define _gloffset_GetProgramEnvParameterdvARB 676 +#define _gloffset_GetProgramEnvParameterfvARB 677 +#define _gloffset_GetProgramLocalParameterdvARB 678 +#define _gloffset_GetProgramLocalParameterfvARB 679 +#define _gloffset_GetProgramivARB 680 +#define _gloffset_GetProgramStringARB 681 +#define _gloffset_ProgramNamedParameter4fNV 682 +#define _gloffset_ProgramNamedParameter4dNV 683 +#define _gloffset_ProgramNamedParameter4fvNV 684 +#define _gloffset_ProgramNamedParameter4dvNV 685 +#define _gloffset_GetProgramNamedParameterfvNV 686 +#define _gloffset_GetProgramNamedParameterdvNV 687 +#define _gloffset_BindBufferARB 688 +#define _gloffset_BufferDataARB 689 +#define _gloffset_BufferSubDataARB 690 +#define _gloffset_DeleteBuffersARB 691 +#define _gloffset_GenBuffersARB 692 +#define _gloffset_GetBufferParameterivARB 693 +#define _gloffset_GetBufferPointervARB 694 +#define _gloffset_GetBufferSubDataARB 695 +#define _gloffset_IsBufferARB 696 +#define _gloffset_MapBufferARB 697 +#define _gloffset_UnmapBufferARB 698 +#define _gloffset_DepthBoundsEXT 699 +#define _gloffset_GenQueriesARB 700 +#define _gloffset_DeleteQueriesARB 701 +#define _gloffset_IsQueryARB 702 +#define _gloffset_BeginQueryARB 703 +#define _gloffset_EndQueryARB 704 +#define _gloffset_GetQueryivARB 705 +#define _gloffset_GetQueryObjectivARB 706 +#define _gloffset_GetQueryObjectuivARB 707 +#define _gloffset_MultiModeDrawArraysIBM 708 +#define _gloffset_MultiModeDrawElementsIBM 709 +#define _gloffset_BlendEquationSeparateEXT 710 +#define _gloffset_DeleteObjectARB 711 +#define _gloffset_GetHandleARB 712 +#define _gloffset_DetachObjectARB 713 +#define _gloffset_CreateShaderObjectARB 714 +#define _gloffset_ShaderSourceARB 715 +#define _gloffset_CompileShaderARB 716 +#define _gloffset_CreateProgramObjectARB 717 +#define _gloffset_AttachObjectARB 718 +#define _gloffset_LinkProgramARB 719 +#define _gloffset_UseProgramObjectARB 720 +#define _gloffset_ValidateProgramARB 721 +#define _gloffset_Uniform1fARB 722 +#define _gloffset_Uniform2fARB 723 +#define _gloffset_Uniform3fARB 724 +#define _gloffset_Uniform4fARB 725 +#define _gloffset_Uniform1iARB 726 +#define _gloffset_Uniform2iARB 727 +#define _gloffset_Uniform3iARB 728 +#define _gloffset_Uniform4iARB 729 +#define _gloffset_Uniform1fvARB 730 +#define _gloffset_Uniform2fvARB 731 +#define _gloffset_Uniform3fvARB 732 +#define _gloffset_Uniform4fvARB 733 +#define _gloffset_Uniform1ivARB 734 +#define _gloffset_Uniform2ivARB 735 +#define _gloffset_Uniform3ivARB 736 +#define _gloffset_Uniform4ivARB 737 +#define _gloffset_UniformMatrix2fvARB 738 +#define _gloffset_UniformMatrix3fvARB 739 +#define _gloffset_UniformMatrix4fvARB 740 +#define _gloffset_GetObjectParameterfvARB 741 +#define _gloffset_GetObjectParameterivARB 742 +#define _gloffset_GetInfoLogARB 743 +#define _gloffset_GetAttachedObjectsARB 744 +#define _gloffset_GetUniformLocationARB 745 +#define _gloffset_GetActiveUniformARB 746 +#define _gloffset_GetUniformfvARB 747 +#define _gloffset_GetUniformivARB 748 +#define _gloffset_GetShaderSourceARB 749 +#define _gloffset_BindAttribLocationARB 750 +#define _gloffset_GetActiveAttribARB 751 +#define _gloffset_GetAttribLocationARB 752 +#define _gloffset_GetVertexAttribdvNV 753 +#define _gloffset_GetVertexAttribfvNV 754 +#define _gloffset_GetVertexAttribivNV 755 +#define _gloffset_VertexAttrib1dNV 756 +#define _gloffset_VertexAttrib1dvNV 757 +#define _gloffset_VertexAttrib1fNV 758 +#define _gloffset_VertexAttrib1fvNV 759 +#define _gloffset_VertexAttrib1sNV 760 +#define _gloffset_VertexAttrib1svNV 761 +#define _gloffset_VertexAttrib2dNV 762 +#define _gloffset_VertexAttrib2dvNV 763 +#define _gloffset_VertexAttrib2fNV 764 +#define _gloffset_VertexAttrib2fvNV 765 +#define _gloffset_VertexAttrib2sNV 766 +#define _gloffset_VertexAttrib2svNV 767 +#define _gloffset_VertexAttrib3dNV 768 +#define _gloffset_VertexAttrib3dvNV 769 +#define _gloffset_VertexAttrib3fNV 770 +#define _gloffset_VertexAttrib3fvNV 771 +#define _gloffset_VertexAttrib3sNV 772 +#define _gloffset_VertexAttrib3svNV 773 +#define _gloffset_VertexAttrib4dNV 774 +#define _gloffset_VertexAttrib4dvNV 775 +#define _gloffset_VertexAttrib4fNV 776 +#define _gloffset_VertexAttrib4fvNV 777 +#define _gloffset_VertexAttrib4sNV 778 +#define _gloffset_VertexAttrib4svNV 779 +#define _gloffset_VertexAttrib4ubNV 780 +#define _gloffset_VertexAttrib4ubvNV 781 +#define _gloffset_GenFragmentShadersATI 782 +#define _gloffset_BindFragmentShaderATI 783 +#define _gloffset_DeleteFragmentShaderATI 784 +#define _gloffset_BeginFragmentShaderATI 785 +#define _gloffset_EndFragmentShaderATI 786 +#define _gloffset_PassTexCoordATI 787 +#define _gloffset_SampleMapATI 788 +#define _gloffset_ColorFragmentOp1ATI 789 +#define _gloffset_ColorFragmentOp2ATI 790 +#define _gloffset_ColorFragmentOp3ATI 791 +#define _gloffset_AlphaFragmentOp1ATI 792 +#define _gloffset_AlphaFragmentOp2ATI 793 +#define _gloffset_AlphaFragmentOp3ATI 794 +#define _gloffset_SetFragmentShaderConstantATI 795 +#define _gloffset_IsRenderbufferEXT 796 +#define _gloffset_BindRenderbufferEXT 797 +#define _gloffset_DeleteRenderbuffersEXT 798 +#define _gloffset_GenRenderbuffersEXT 799 +#define _gloffset_RenderbufferStorageEXT 800 +#define _gloffset_GetRenderbufferParameterivEXT 801 +#define _gloffset_IsFramebufferEXT 802 +#define _gloffset_BindFramebufferEXT 803 +#define _gloffset_DeleteFramebuffersEXT 804 +#define _gloffset_GenFramebuffersEXT 805 +#define _gloffset_CheckFramebufferStatusEXT 806 +#define _gloffset_FramebufferTexture1DEXT 807 +#define _gloffset_FramebufferTexture2DEXT 808 +#define _gloffset_FramebufferTexture3DEXT 809 +#define _gloffset_FramebufferRenderbufferEXT 810 +#define _gloffset_GetFramebufferAttachmentParameterivEXT 811 +#define _gloffset_GenerateMipmapEXT 812 +#define _gloffset_StencilFuncSeparate 813 +#define _gloffset_StencilOpSeparate 814 +#define _gloffset_StencilMaskSeparate 815 +#define _gloffset_FIRST_DYNAMIC 816 + +#else + +#define _gloffset_LoadTransposeMatrixfARB driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index] +#define _gloffset_LoadTransposeMatrixdARB driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index] +#define _gloffset_MultTransposeMatrixfARB driDispatchRemapTable[MultTransposeMatrixfARB_remap_index] +#define _gloffset_MultTransposeMatrixdARB driDispatchRemapTable[MultTransposeMatrixdARB_remap_index] +#define _gloffset_SampleCoverageARB driDispatchRemapTable[SampleCoverageARB_remap_index] +#define _gloffset_DrawBuffersARB driDispatchRemapTable[DrawBuffersARB_remap_index] +#define _gloffset_PolygonOffsetEXT driDispatchRemapTable[PolygonOffsetEXT_remap_index] +#define _gloffset_GetTexFilterFuncSGIS driDispatchRemapTable[GetTexFilterFuncSGIS_remap_index] +#define _gloffset_TexFilterFuncSGIS driDispatchRemapTable[TexFilterFuncSGIS_remap_index] +#define _gloffset_GetHistogramEXT driDispatchRemapTable[GetHistogramEXT_remap_index] +#define _gloffset_GetHistogramParameterfvEXT driDispatchRemapTable[GetHistogramParameterfvEXT_remap_index] +#define _gloffset_GetHistogramParameterivEXT driDispatchRemapTable[GetHistogramParameterivEXT_remap_index] +#define _gloffset_GetMinmaxEXT driDispatchRemapTable[GetMinmaxEXT_remap_index] +#define _gloffset_GetMinmaxParameterfvEXT driDispatchRemapTable[GetMinmaxParameterfvEXT_remap_index] +#define _gloffset_GetMinmaxParameterivEXT driDispatchRemapTable[GetMinmaxParameterivEXT_remap_index] +#define _gloffset_GetConvolutionFilterEXT driDispatchRemapTable[GetConvolutionFilterEXT_remap_index] +#define _gloffset_GetConvolutionParameterfvEXT driDispatchRemapTable[GetConvolutionParameterfvEXT_remap_index] +#define _gloffset_GetConvolutionParameterivEXT driDispatchRemapTable[GetConvolutionParameterivEXT_remap_index] +#define _gloffset_GetSeparableFilterEXT driDispatchRemapTable[GetSeparableFilterEXT_remap_index] +#define _gloffset_GetColorTableSGI driDispatchRemapTable[GetColorTableSGI_remap_index] +#define _gloffset_GetColorTableParameterfvSGI driDispatchRemapTable[GetColorTableParameterfvSGI_remap_index] +#define _gloffset_GetColorTableParameterivSGI driDispatchRemapTable[GetColorTableParameterivSGI_remap_index] +#define _gloffset_PixelTexGenSGIX driDispatchRemapTable[PixelTexGenSGIX_remap_index] +#define _gloffset_PixelTexGenParameteriSGIS driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index] +#define _gloffset_PixelTexGenParameterivSGIS driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index] +#define _gloffset_PixelTexGenParameterfSGIS driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index] +#define _gloffset_PixelTexGenParameterfvSGIS driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index] +#define _gloffset_GetPixelTexGenParameterivSGIS driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index] +#define _gloffset_GetPixelTexGenParameterfvSGIS driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index] +#define _gloffset_TexImage4DSGIS driDispatchRemapTable[TexImage4DSGIS_remap_index] +#define _gloffset_TexSubImage4DSGIS driDispatchRemapTable[TexSubImage4DSGIS_remap_index] +#define _gloffset_AreTexturesResidentEXT driDispatchRemapTable[AreTexturesResidentEXT_remap_index] +#define _gloffset_GenTexturesEXT driDispatchRemapTable[GenTexturesEXT_remap_index] +#define _gloffset_IsTextureEXT driDispatchRemapTable[IsTextureEXT_remap_index] +#define _gloffset_DetailTexFuncSGIS driDispatchRemapTable[DetailTexFuncSGIS_remap_index] +#define _gloffset_GetDetailTexFuncSGIS driDispatchRemapTable[GetDetailTexFuncSGIS_remap_index] +#define _gloffset_SharpenTexFuncSGIS driDispatchRemapTable[SharpenTexFuncSGIS_remap_index] +#define _gloffset_GetSharpenTexFuncSGIS driDispatchRemapTable[GetSharpenTexFuncSGIS_remap_index] +#define _gloffset_SampleMaskSGIS driDispatchRemapTable[SampleMaskSGIS_remap_index] +#define _gloffset_SamplePatternSGIS driDispatchRemapTable[SamplePatternSGIS_remap_index] +#define _gloffset_ColorPointerEXT driDispatchRemapTable[ColorPointerEXT_remap_index] +#define _gloffset_EdgeFlagPointerEXT driDispatchRemapTable[EdgeFlagPointerEXT_remap_index] +#define _gloffset_IndexPointerEXT driDispatchRemapTable[IndexPointerEXT_remap_index] +#define _gloffset_NormalPointerEXT driDispatchRemapTable[NormalPointerEXT_remap_index] +#define _gloffset_TexCoordPointerEXT driDispatchRemapTable[TexCoordPointerEXT_remap_index] +#define _gloffset_VertexPointerEXT driDispatchRemapTable[VertexPointerEXT_remap_index] +#define _gloffset_SpriteParameterfSGIX driDispatchRemapTable[SpriteParameterfSGIX_remap_index] +#define _gloffset_SpriteParameterfvSGIX driDispatchRemapTable[SpriteParameterfvSGIX_remap_index] +#define _gloffset_SpriteParameteriSGIX driDispatchRemapTable[SpriteParameteriSGIX_remap_index] +#define _gloffset_SpriteParameterivSGIX driDispatchRemapTable[SpriteParameterivSGIX_remap_index] +#define _gloffset_PointParameterfEXT driDispatchRemapTable[PointParameterfEXT_remap_index] +#define _gloffset_PointParameterfvEXT driDispatchRemapTable[PointParameterfvEXT_remap_index] +#define _gloffset_GetInstrumentsSGIX driDispatchRemapTable[GetInstrumentsSGIX_remap_index] +#define _gloffset_InstrumentsBufferSGIX driDispatchRemapTable[InstrumentsBufferSGIX_remap_index] +#define _gloffset_PollInstrumentsSGIX driDispatchRemapTable[PollInstrumentsSGIX_remap_index] +#define _gloffset_ReadInstrumentsSGIX driDispatchRemapTable[ReadInstrumentsSGIX_remap_index] +#define _gloffset_StartInstrumentsSGIX driDispatchRemapTable[StartInstrumentsSGIX_remap_index] +#define _gloffset_StopInstrumentsSGIX driDispatchRemapTable[StopInstrumentsSGIX_remap_index] +#define _gloffset_FrameZoomSGIX driDispatchRemapTable[FrameZoomSGIX_remap_index] +#define _gloffset_TagSampleBufferSGIX driDispatchRemapTable[TagSampleBufferSGIX_remap_index] +#define _gloffset_ReferencePlaneSGIX driDispatchRemapTable[ReferencePlaneSGIX_remap_index] +#define _gloffset_FlushRasterSGIX driDispatchRemapTable[FlushRasterSGIX_remap_index] +#define _gloffset_GetListParameterfvSGIX driDispatchRemapTable[GetListParameterfvSGIX_remap_index] +#define _gloffset_GetListParameterivSGIX driDispatchRemapTable[GetListParameterivSGIX_remap_index] +#define _gloffset_ListParameterfSGIX driDispatchRemapTable[ListParameterfSGIX_remap_index] +#define _gloffset_ListParameterfvSGIX driDispatchRemapTable[ListParameterfvSGIX_remap_index] +#define _gloffset_ListParameteriSGIX driDispatchRemapTable[ListParameteriSGIX_remap_index] +#define _gloffset_ListParameterivSGIX driDispatchRemapTable[ListParameterivSGIX_remap_index] +#define _gloffset_FragmentColorMaterialSGIX driDispatchRemapTable[FragmentColorMaterialSGIX_remap_index] +#define _gloffset_FragmentLightfSGIX driDispatchRemapTable[FragmentLightfSGIX_remap_index] +#define _gloffset_FragmentLightfvSGIX driDispatchRemapTable[FragmentLightfvSGIX_remap_index] +#define _gloffset_FragmentLightiSGIX driDispatchRemapTable[FragmentLightiSGIX_remap_index] +#define _gloffset_FragmentLightivSGIX driDispatchRemapTable[FragmentLightivSGIX_remap_index] +#define _gloffset_FragmentLightModelfSGIX driDispatchRemapTable[FragmentLightModelfSGIX_remap_index] +#define _gloffset_FragmentLightModelfvSGIX driDispatchRemapTable[FragmentLightModelfvSGIX_remap_index] +#define _gloffset_FragmentLightModeliSGIX driDispatchRemapTable[FragmentLightModeliSGIX_remap_index] +#define _gloffset_FragmentLightModelivSGIX driDispatchRemapTable[FragmentLightModelivSGIX_remap_index] +#define _gloffset_FragmentMaterialfSGIX driDispatchRemapTable[FragmentMaterialfSGIX_remap_index] +#define _gloffset_FragmentMaterialfvSGIX driDispatchRemapTable[FragmentMaterialfvSGIX_remap_index] +#define _gloffset_FragmentMaterialiSGIX driDispatchRemapTable[FragmentMaterialiSGIX_remap_index] +#define _gloffset_FragmentMaterialivSGIX driDispatchRemapTable[FragmentMaterialivSGIX_remap_index] +#define _gloffset_GetFragmentLightfvSGIX driDispatchRemapTable[GetFragmentLightfvSGIX_remap_index] +#define _gloffset_GetFragmentLightivSGIX driDispatchRemapTable[GetFragmentLightivSGIX_remap_index] +#define _gloffset_GetFragmentMaterialfvSGIX driDispatchRemapTable[GetFragmentMaterialfvSGIX_remap_index] +#define _gloffset_GetFragmentMaterialivSGIX driDispatchRemapTable[GetFragmentMaterialivSGIX_remap_index] +#define _gloffset_LightEnviSGIX driDispatchRemapTable[LightEnviSGIX_remap_index] +#define _gloffset_VertexWeightfEXT driDispatchRemapTable[VertexWeightfEXT_remap_index] +#define _gloffset_VertexWeightfvEXT driDispatchRemapTable[VertexWeightfvEXT_remap_index] +#define _gloffset_VertexWeightPointerEXT driDispatchRemapTable[VertexWeightPointerEXT_remap_index] +#define _gloffset_FlushVertexArrayRangeNV driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index] +#define _gloffset_VertexArrayRangeNV driDispatchRemapTable[VertexArrayRangeNV_remap_index] +#define _gloffset_CombinerParameterfvNV driDispatchRemapTable[CombinerParameterfvNV_remap_index] +#define _gloffset_CombinerParameterfNV driDispatchRemapTable[CombinerParameterfNV_remap_index] +#define _gloffset_CombinerParameterivNV driDispatchRemapTable[CombinerParameterivNV_remap_index] +#define _gloffset_CombinerParameteriNV driDispatchRemapTable[CombinerParameteriNV_remap_index] +#define _gloffset_CombinerInputNV driDispatchRemapTable[CombinerInputNV_remap_index] +#define _gloffset_CombinerOutputNV driDispatchRemapTable[CombinerOutputNV_remap_index] +#define _gloffset_FinalCombinerInputNV driDispatchRemapTable[FinalCombinerInputNV_remap_index] +#define _gloffset_GetCombinerInputParameterfvNV driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index] +#define _gloffset_GetCombinerInputParameterivNV driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index] +#define _gloffset_GetCombinerOutputParameterfvNV driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index] +#define _gloffset_GetCombinerOutputParameterivNV driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index] +#define _gloffset_GetFinalCombinerInputParameterfvNV driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index] +#define _gloffset_GetFinalCombinerInputParameterivNV driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index] +#define _gloffset_ResizeBuffersMESA driDispatchRemapTable[ResizeBuffersMESA_remap_index] +#define _gloffset_WindowPos2dMESA driDispatchRemapTable[WindowPos2dMESA_remap_index] +#define _gloffset_WindowPos2dvMESA driDispatchRemapTable[WindowPos2dvMESA_remap_index] +#define _gloffset_WindowPos2fMESA driDispatchRemapTable[WindowPos2fMESA_remap_index] +#define _gloffset_WindowPos2fvMESA driDispatchRemapTable[WindowPos2fvMESA_remap_index] +#define _gloffset_WindowPos2iMESA driDispatchRemapTable[WindowPos2iMESA_remap_index] +#define _gloffset_WindowPos2ivMESA driDispatchRemapTable[WindowPos2ivMESA_remap_index] +#define _gloffset_WindowPos2sMESA driDispatchRemapTable[WindowPos2sMESA_remap_index] +#define _gloffset_WindowPos2svMESA driDispatchRemapTable[WindowPos2svMESA_remap_index] +#define _gloffset_WindowPos3dMESA driDispatchRemapTable[WindowPos3dMESA_remap_index] +#define _gloffset_WindowPos3dvMESA driDispatchRemapTable[WindowPos3dvMESA_remap_index] +#define _gloffset_WindowPos3fMESA driDispatchRemapTable[WindowPos3fMESA_remap_index] +#define _gloffset_WindowPos3fvMESA driDispatchRemapTable[WindowPos3fvMESA_remap_index] +#define _gloffset_WindowPos3iMESA driDispatchRemapTable[WindowPos3iMESA_remap_index] +#define _gloffset_WindowPos3ivMESA driDispatchRemapTable[WindowPos3ivMESA_remap_index] +#define _gloffset_WindowPos3sMESA driDispatchRemapTable[WindowPos3sMESA_remap_index] +#define _gloffset_WindowPos3svMESA driDispatchRemapTable[WindowPos3svMESA_remap_index] +#define _gloffset_WindowPos4dMESA driDispatchRemapTable[WindowPos4dMESA_remap_index] +#define _gloffset_WindowPos4dvMESA driDispatchRemapTable[WindowPos4dvMESA_remap_index] +#define _gloffset_WindowPos4fMESA driDispatchRemapTable[WindowPos4fMESA_remap_index] +#define _gloffset_WindowPos4fvMESA driDispatchRemapTable[WindowPos4fvMESA_remap_index] +#define _gloffset_WindowPos4iMESA driDispatchRemapTable[WindowPos4iMESA_remap_index] +#define _gloffset_WindowPos4ivMESA driDispatchRemapTable[WindowPos4ivMESA_remap_index] +#define _gloffset_WindowPos4sMESA driDispatchRemapTable[WindowPos4sMESA_remap_index] +#define _gloffset_WindowPos4svMESA driDispatchRemapTable[WindowPos4svMESA_remap_index] +#define _gloffset_BlendFuncSeparateEXT driDispatchRemapTable[BlendFuncSeparateEXT_remap_index] +#define _gloffset_IndexMaterialEXT driDispatchRemapTable[IndexMaterialEXT_remap_index] +#define _gloffset_IndexFuncEXT driDispatchRemapTable[IndexFuncEXT_remap_index] +#define _gloffset_LockArraysEXT driDispatchRemapTable[LockArraysEXT_remap_index] +#define _gloffset_UnlockArraysEXT driDispatchRemapTable[UnlockArraysEXT_remap_index] +#define _gloffset_CullParameterdvEXT driDispatchRemapTable[CullParameterdvEXT_remap_index] +#define _gloffset_CullParameterfvEXT driDispatchRemapTable[CullParameterfvEXT_remap_index] +#define _gloffset_HintPGI driDispatchRemapTable[HintPGI_remap_index] +#define _gloffset_FogCoordfEXT driDispatchRemapTable[FogCoordfEXT_remap_index] +#define _gloffset_FogCoordfvEXT driDispatchRemapTable[FogCoordfvEXT_remap_index] +#define _gloffset_FogCoorddEXT driDispatchRemapTable[FogCoorddEXT_remap_index] +#define _gloffset_FogCoorddvEXT driDispatchRemapTable[FogCoorddvEXT_remap_index] +#define _gloffset_FogCoordPointerEXT driDispatchRemapTable[FogCoordPointerEXT_remap_index] +#define _gloffset_GetColorTableEXT driDispatchRemapTable[GetColorTableEXT_remap_index] +#define _gloffset_GetColorTableParameterivEXT driDispatchRemapTable[GetColorTableParameterivEXT_remap_index] +#define _gloffset_GetColorTableParameterfvEXT driDispatchRemapTable[GetColorTableParameterfvEXT_remap_index] +#define _gloffset_TbufferMask3DFX driDispatchRemapTable[TbufferMask3DFX_remap_index] +#define _gloffset_CompressedTexImage3DARB driDispatchRemapTable[CompressedTexImage3DARB_remap_index] +#define _gloffset_CompressedTexImage2DARB driDispatchRemapTable[CompressedTexImage2DARB_remap_index] +#define _gloffset_CompressedTexImage1DARB driDispatchRemapTable[CompressedTexImage1DARB_remap_index] +#define _gloffset_CompressedTexSubImage3DARB driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index] +#define _gloffset_CompressedTexSubImage2DARB driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index] +#define _gloffset_CompressedTexSubImage1DARB driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index] +#define _gloffset_GetCompressedTexImageARB driDispatchRemapTable[GetCompressedTexImageARB_remap_index] +#define _gloffset_SecondaryColor3bEXT driDispatchRemapTable[SecondaryColor3bEXT_remap_index] +#define _gloffset_SecondaryColor3bvEXT driDispatchRemapTable[SecondaryColor3bvEXT_remap_index] +#define _gloffset_SecondaryColor3dEXT driDispatchRemapTable[SecondaryColor3dEXT_remap_index] +#define _gloffset_SecondaryColor3dvEXT driDispatchRemapTable[SecondaryColor3dvEXT_remap_index] +#define _gloffset_SecondaryColor3fEXT driDispatchRemapTable[SecondaryColor3fEXT_remap_index] +#define _gloffset_SecondaryColor3fvEXT driDispatchRemapTable[SecondaryColor3fvEXT_remap_index] +#define _gloffset_SecondaryColor3iEXT driDispatchRemapTable[SecondaryColor3iEXT_remap_index] +#define _gloffset_SecondaryColor3ivEXT driDispatchRemapTable[SecondaryColor3ivEXT_remap_index] +#define _gloffset_SecondaryColor3sEXT driDispatchRemapTable[SecondaryColor3sEXT_remap_index] +#define _gloffset_SecondaryColor3svEXT driDispatchRemapTable[SecondaryColor3svEXT_remap_index] +#define _gloffset_SecondaryColor3ubEXT driDispatchRemapTable[SecondaryColor3ubEXT_remap_index] +#define _gloffset_SecondaryColor3ubvEXT driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index] +#define _gloffset_SecondaryColor3uiEXT driDispatchRemapTable[SecondaryColor3uiEXT_remap_index] +#define _gloffset_SecondaryColor3uivEXT driDispatchRemapTable[SecondaryColor3uivEXT_remap_index] +#define _gloffset_SecondaryColor3usEXT driDispatchRemapTable[SecondaryColor3usEXT_remap_index] +#define _gloffset_SecondaryColor3usvEXT driDispatchRemapTable[SecondaryColor3usvEXT_remap_index] +#define _gloffset_SecondaryColorPointerEXT driDispatchRemapTable[SecondaryColorPointerEXT_remap_index] +#define _gloffset_AreProgramsResidentNV driDispatchRemapTable[AreProgramsResidentNV_remap_index] +#define _gloffset_BindProgramNV driDispatchRemapTable[BindProgramNV_remap_index] +#define _gloffset_DeleteProgramsNV driDispatchRemapTable[DeleteProgramsNV_remap_index] +#define _gloffset_ExecuteProgramNV driDispatchRemapTable[ExecuteProgramNV_remap_index] +#define _gloffset_GenProgramsNV driDispatchRemapTable[GenProgramsNV_remap_index] +#define _gloffset_GetProgramParameterdvNV driDispatchRemapTable[GetProgramParameterdvNV_remap_index] +#define _gloffset_GetProgramParameterfvNV driDispatchRemapTable[GetProgramParameterfvNV_remap_index] +#define _gloffset_GetProgramivNV driDispatchRemapTable[GetProgramivNV_remap_index] +#define _gloffset_GetProgramStringNV driDispatchRemapTable[GetProgramStringNV_remap_index] +#define _gloffset_GetTrackMatrixivNV driDispatchRemapTable[GetTrackMatrixivNV_remap_index] +#define _gloffset_GetVertexAttribdvARB driDispatchRemapTable[GetVertexAttribdvARB_remap_index] +#define _gloffset_GetVertexAttribfvARB driDispatchRemapTable[GetVertexAttribfvARB_remap_index] +#define _gloffset_GetVertexAttribivARB driDispatchRemapTable[GetVertexAttribivARB_remap_index] +#define _gloffset_GetVertexAttribPointervNV driDispatchRemapTable[GetVertexAttribPointervNV_remap_index] +#define _gloffset_IsProgramNV driDispatchRemapTable[IsProgramNV_remap_index] +#define _gloffset_LoadProgramNV driDispatchRemapTable[LoadProgramNV_remap_index] +#define _gloffset_ProgramParameter4dNV driDispatchRemapTable[ProgramParameter4dNV_remap_index] +#define _gloffset_ProgramParameter4dvNV driDispatchRemapTable[ProgramParameter4dvNV_remap_index] +#define _gloffset_ProgramParameter4fNV driDispatchRemapTable[ProgramParameter4fNV_remap_index] +#define _gloffset_ProgramParameter4fvNV driDispatchRemapTable[ProgramParameter4fvNV_remap_index] +#define _gloffset_ProgramParameters4dvNV driDispatchRemapTable[ProgramParameters4dvNV_remap_index] +#define _gloffset_ProgramParameters4fvNV driDispatchRemapTable[ProgramParameters4fvNV_remap_index] +#define _gloffset_RequestResidentProgramsNV driDispatchRemapTable[RequestResidentProgramsNV_remap_index] +#define _gloffset_TrackMatrixNV driDispatchRemapTable[TrackMatrixNV_remap_index] +#define _gloffset_VertexAttribPointerNV driDispatchRemapTable[VertexAttribPointerNV_remap_index] +#define _gloffset_VertexAttrib1dARB driDispatchRemapTable[VertexAttrib1dARB_remap_index] +#define _gloffset_VertexAttrib1dvARB driDispatchRemapTable[VertexAttrib1dvARB_remap_index] +#define _gloffset_VertexAttrib1fARB driDispatchRemapTable[VertexAttrib1fARB_remap_index] +#define _gloffset_VertexAttrib1fvARB driDispatchRemapTable[VertexAttrib1fvARB_remap_index] +#define _gloffset_VertexAttrib1sARB driDispatchRemapTable[VertexAttrib1sARB_remap_index] +#define _gloffset_VertexAttrib1svARB driDispatchRemapTable[VertexAttrib1svARB_remap_index] +#define _gloffset_VertexAttrib2dARB driDispatchRemapTable[VertexAttrib2dARB_remap_index] +#define _gloffset_VertexAttrib2dvARB driDispatchRemapTable[VertexAttrib2dvARB_remap_index] +#define _gloffset_VertexAttrib2fARB driDispatchRemapTable[VertexAttrib2fARB_remap_index] +#define _gloffset_VertexAttrib2fvARB driDispatchRemapTable[VertexAttrib2fvARB_remap_index] +#define _gloffset_VertexAttrib2sARB driDispatchRemapTable[VertexAttrib2sARB_remap_index] +#define _gloffset_VertexAttrib2svARB driDispatchRemapTable[VertexAttrib2svARB_remap_index] +#define _gloffset_VertexAttrib3dARB driDispatchRemapTable[VertexAttrib3dARB_remap_index] +#define _gloffset_VertexAttrib3dvARB driDispatchRemapTable[VertexAttrib3dvARB_remap_index] +#define _gloffset_VertexAttrib3fARB driDispatchRemapTable[VertexAttrib3fARB_remap_index] +#define _gloffset_VertexAttrib3fvARB driDispatchRemapTable[VertexAttrib3fvARB_remap_index] +#define _gloffset_VertexAttrib3sARB driDispatchRemapTable[VertexAttrib3sARB_remap_index] +#define _gloffset_VertexAttrib3svARB driDispatchRemapTable[VertexAttrib3svARB_remap_index] +#define _gloffset_VertexAttrib4dARB driDispatchRemapTable[VertexAttrib4dARB_remap_index] +#define _gloffset_VertexAttrib4dvARB driDispatchRemapTable[VertexAttrib4dvARB_remap_index] +#define _gloffset_VertexAttrib4fARB driDispatchRemapTable[VertexAttrib4fARB_remap_index] +#define _gloffset_VertexAttrib4fvARB driDispatchRemapTable[VertexAttrib4fvARB_remap_index] +#define _gloffset_VertexAttrib4sARB driDispatchRemapTable[VertexAttrib4sARB_remap_index] +#define _gloffset_VertexAttrib4svARB driDispatchRemapTable[VertexAttrib4svARB_remap_index] +#define _gloffset_VertexAttrib4NubARB driDispatchRemapTable[VertexAttrib4NubARB_remap_index] +#define _gloffset_VertexAttrib4NubvARB driDispatchRemapTable[VertexAttrib4NubvARB_remap_index] +#define _gloffset_VertexAttribs1dvNV driDispatchRemapTable[VertexAttribs1dvNV_remap_index] +#define _gloffset_VertexAttribs1fvNV driDispatchRemapTable[VertexAttribs1fvNV_remap_index] +#define _gloffset_VertexAttribs1svNV driDispatchRemapTable[VertexAttribs1svNV_remap_index] +#define _gloffset_VertexAttribs2dvNV driDispatchRemapTable[VertexAttribs2dvNV_remap_index] +#define _gloffset_VertexAttribs2fvNV driDispatchRemapTable[VertexAttribs2fvNV_remap_index] +#define _gloffset_VertexAttribs2svNV driDispatchRemapTable[VertexAttribs2svNV_remap_index] +#define _gloffset_VertexAttribs3dvNV driDispatchRemapTable[VertexAttribs3dvNV_remap_index] +#define _gloffset_VertexAttribs3fvNV driDispatchRemapTable[VertexAttribs3fvNV_remap_index] +#define _gloffset_VertexAttribs3svNV driDispatchRemapTable[VertexAttribs3svNV_remap_index] +#define _gloffset_VertexAttribs4dvNV driDispatchRemapTable[VertexAttribs4dvNV_remap_index] +#define _gloffset_VertexAttribs4fvNV driDispatchRemapTable[VertexAttribs4fvNV_remap_index] +#define _gloffset_VertexAttribs4svNV driDispatchRemapTable[VertexAttribs4svNV_remap_index] +#define _gloffset_VertexAttribs4ubvNV driDispatchRemapTable[VertexAttribs4ubvNV_remap_index] +#define _gloffset_PointParameteriNV driDispatchRemapTable[PointParameteriNV_remap_index] +#define _gloffset_PointParameterivNV driDispatchRemapTable[PointParameterivNV_remap_index] +#define _gloffset_MultiDrawArraysEXT driDispatchRemapTable[MultiDrawArraysEXT_remap_index] +#define _gloffset_MultiDrawElementsEXT driDispatchRemapTable[MultiDrawElementsEXT_remap_index] +#define _gloffset_ActiveStencilFaceEXT driDispatchRemapTable[ActiveStencilFaceEXT_remap_index] +#define _gloffset_DeleteFencesNV driDispatchRemapTable[DeleteFencesNV_remap_index] +#define _gloffset_GenFencesNV driDispatchRemapTable[GenFencesNV_remap_index] +#define _gloffset_IsFenceNV driDispatchRemapTable[IsFenceNV_remap_index] +#define _gloffset_TestFenceNV driDispatchRemapTable[TestFenceNV_remap_index] +#define _gloffset_GetFenceivNV driDispatchRemapTable[GetFenceivNV_remap_index] +#define _gloffset_FinishFenceNV driDispatchRemapTable[FinishFenceNV_remap_index] +#define _gloffset_SetFenceNV driDispatchRemapTable[SetFenceNV_remap_index] +#define _gloffset_VertexAttrib4bvARB driDispatchRemapTable[VertexAttrib4bvARB_remap_index] +#define _gloffset_VertexAttrib4ivARB driDispatchRemapTable[VertexAttrib4ivARB_remap_index] +#define _gloffset_VertexAttrib4ubvARB driDispatchRemapTable[VertexAttrib4ubvARB_remap_index] +#define _gloffset_VertexAttrib4usvARB driDispatchRemapTable[VertexAttrib4usvARB_remap_index] +#define _gloffset_VertexAttrib4uivARB driDispatchRemapTable[VertexAttrib4uivARB_remap_index] +#define _gloffset_VertexAttrib4NbvARB driDispatchRemapTable[VertexAttrib4NbvARB_remap_index] +#define _gloffset_VertexAttrib4NsvARB driDispatchRemapTable[VertexAttrib4NsvARB_remap_index] +#define _gloffset_VertexAttrib4NivARB driDispatchRemapTable[VertexAttrib4NivARB_remap_index] +#define _gloffset_VertexAttrib4NusvARB driDispatchRemapTable[VertexAttrib4NusvARB_remap_index] +#define _gloffset_VertexAttrib4NuivARB driDispatchRemapTable[VertexAttrib4NuivARB_remap_index] +#define _gloffset_VertexAttribPointerARB driDispatchRemapTable[VertexAttribPointerARB_remap_index] +#define _gloffset_EnableVertexAttribArrayARB driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index] +#define _gloffset_DisableVertexAttribArrayARB driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index] +#define _gloffset_ProgramStringARB driDispatchRemapTable[ProgramStringARB_remap_index] +#define _gloffset_ProgramEnvParameter4dARB driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index] +#define _gloffset_ProgramEnvParameter4dvARB driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index] +#define _gloffset_ProgramEnvParameter4fARB driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index] +#define _gloffset_ProgramEnvParameter4fvARB driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index] +#define _gloffset_ProgramLocalParameter4dARB driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index] +#define _gloffset_ProgramLocalParameter4dvARB driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index] +#define _gloffset_ProgramLocalParameter4fARB driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index] +#define _gloffset_ProgramLocalParameter4fvARB driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index] +#define _gloffset_GetProgramEnvParameterdvARB driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index] +#define _gloffset_GetProgramEnvParameterfvARB driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index] +#define _gloffset_GetProgramLocalParameterdvARB driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index] +#define _gloffset_GetProgramLocalParameterfvARB driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index] +#define _gloffset_GetProgramivARB driDispatchRemapTable[GetProgramivARB_remap_index] +#define _gloffset_GetProgramStringARB driDispatchRemapTable[GetProgramStringARB_remap_index] +#define _gloffset_ProgramNamedParameter4fNV driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index] +#define _gloffset_ProgramNamedParameter4dNV driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index] +#define _gloffset_ProgramNamedParameter4fvNV driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index] +#define _gloffset_ProgramNamedParameter4dvNV driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index] +#define _gloffset_GetProgramNamedParameterfvNV driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index] +#define _gloffset_GetProgramNamedParameterdvNV driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index] +#define _gloffset_BindBufferARB driDispatchRemapTable[BindBufferARB_remap_index] +#define _gloffset_BufferDataARB driDispatchRemapTable[BufferDataARB_remap_index] +#define _gloffset_BufferSubDataARB driDispatchRemapTable[BufferSubDataARB_remap_index] +#define _gloffset_DeleteBuffersARB driDispatchRemapTable[DeleteBuffersARB_remap_index] +#define _gloffset_GenBuffersARB driDispatchRemapTable[GenBuffersARB_remap_index] +#define _gloffset_GetBufferParameterivARB driDispatchRemapTable[GetBufferParameterivARB_remap_index] +#define _gloffset_GetBufferPointervARB driDispatchRemapTable[GetBufferPointervARB_remap_index] +#define _gloffset_GetBufferSubDataARB driDispatchRemapTable[GetBufferSubDataARB_remap_index] +#define _gloffset_IsBufferARB driDispatchRemapTable[IsBufferARB_remap_index] +#define _gloffset_MapBufferARB driDispatchRemapTable[MapBufferARB_remap_index] +#define _gloffset_UnmapBufferARB driDispatchRemapTable[UnmapBufferARB_remap_index] +#define _gloffset_DepthBoundsEXT driDispatchRemapTable[DepthBoundsEXT_remap_index] +#define _gloffset_GenQueriesARB driDispatchRemapTable[GenQueriesARB_remap_index] +#define _gloffset_DeleteQueriesARB driDispatchRemapTable[DeleteQueriesARB_remap_index] +#define _gloffset_IsQueryARB driDispatchRemapTable[IsQueryARB_remap_index] +#define _gloffset_BeginQueryARB driDispatchRemapTable[BeginQueryARB_remap_index] +#define _gloffset_EndQueryARB driDispatchRemapTable[EndQueryARB_remap_index] +#define _gloffset_GetQueryivARB driDispatchRemapTable[GetQueryivARB_remap_index] +#define _gloffset_GetQueryObjectivARB driDispatchRemapTable[GetQueryObjectivARB_remap_index] +#define _gloffset_GetQueryObjectuivARB driDispatchRemapTable[GetQueryObjectuivARB_remap_index] +#define _gloffset_MultiModeDrawArraysIBM driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index] +#define _gloffset_MultiModeDrawElementsIBM driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index] +#define _gloffset_BlendEquationSeparateEXT driDispatchRemapTable[BlendEquationSeparateEXT_remap_index] +#define _gloffset_DeleteObjectARB driDispatchRemapTable[DeleteObjectARB_remap_index] +#define _gloffset_GetHandleARB driDispatchRemapTable[GetHandleARB_remap_index] +#define _gloffset_DetachObjectARB driDispatchRemapTable[DetachObjectARB_remap_index] +#define _gloffset_CreateShaderObjectARB driDispatchRemapTable[CreateShaderObjectARB_remap_index] +#define _gloffset_ShaderSourceARB driDispatchRemapTable[ShaderSourceARB_remap_index] +#define _gloffset_CompileShaderARB driDispatchRemapTable[CompileShaderARB_remap_index] +#define _gloffset_CreateProgramObjectARB driDispatchRemapTable[CreateProgramObjectARB_remap_index] +#define _gloffset_AttachObjectARB driDispatchRemapTable[AttachObjectARB_remap_index] +#define _gloffset_LinkProgramARB driDispatchRemapTable[LinkProgramARB_remap_index] +#define _gloffset_UseProgramObjectARB driDispatchRemapTable[UseProgramObjectARB_remap_index] +#define _gloffset_ValidateProgramARB driDispatchRemapTable[ValidateProgramARB_remap_index] +#define _gloffset_Uniform1fARB driDispatchRemapTable[Uniform1fARB_remap_index] +#define _gloffset_Uniform2fARB driDispatchRemapTable[Uniform2fARB_remap_index] +#define _gloffset_Uniform3fARB driDispatchRemapTable[Uniform3fARB_remap_index] +#define _gloffset_Uniform4fARB driDispatchRemapTable[Uniform4fARB_remap_index] +#define _gloffset_Uniform1iARB driDispatchRemapTable[Uniform1iARB_remap_index] +#define _gloffset_Uniform2iARB driDispatchRemapTable[Uniform2iARB_remap_index] +#define _gloffset_Uniform3iARB driDispatchRemapTable[Uniform3iARB_remap_index] +#define _gloffset_Uniform4iARB driDispatchRemapTable[Uniform4iARB_remap_index] +#define _gloffset_Uniform1fvARB driDispatchRemapTable[Uniform1fvARB_remap_index] +#define _gloffset_Uniform2fvARB driDispatchRemapTable[Uniform2fvARB_remap_index] +#define _gloffset_Uniform3fvARB driDispatchRemapTable[Uniform3fvARB_remap_index] +#define _gloffset_Uniform4fvARB driDispatchRemapTable[Uniform4fvARB_remap_index] +#define _gloffset_Uniform1ivARB driDispatchRemapTable[Uniform1ivARB_remap_index] +#define _gloffset_Uniform2ivARB driDispatchRemapTable[Uniform2ivARB_remap_index] +#define _gloffset_Uniform3ivARB driDispatchRemapTable[Uniform3ivARB_remap_index] +#define _gloffset_Uniform4ivARB driDispatchRemapTable[Uniform4ivARB_remap_index] +#define _gloffset_UniformMatrix2fvARB driDispatchRemapTable[UniformMatrix2fvARB_remap_index] +#define _gloffset_UniformMatrix3fvARB driDispatchRemapTable[UniformMatrix3fvARB_remap_index] +#define _gloffset_UniformMatrix4fvARB driDispatchRemapTable[UniformMatrix4fvARB_remap_index] +#define _gloffset_GetObjectParameterfvARB driDispatchRemapTable[GetObjectParameterfvARB_remap_index] +#define _gloffset_GetObjectParameterivARB driDispatchRemapTable[GetObjectParameterivARB_remap_index] +#define _gloffset_GetInfoLogARB driDispatchRemapTable[GetInfoLogARB_remap_index] +#define _gloffset_GetAttachedObjectsARB driDispatchRemapTable[GetAttachedObjectsARB_remap_index] +#define _gloffset_GetUniformLocationARB driDispatchRemapTable[GetUniformLocationARB_remap_index] +#define _gloffset_GetActiveUniformARB driDispatchRemapTable[GetActiveUniformARB_remap_index] +#define _gloffset_GetUniformfvARB driDispatchRemapTable[GetUniformfvARB_remap_index] +#define _gloffset_GetUniformivARB driDispatchRemapTable[GetUniformivARB_remap_index] +#define _gloffset_GetShaderSourceARB driDispatchRemapTable[GetShaderSourceARB_remap_index] +#define _gloffset_BindAttribLocationARB driDispatchRemapTable[BindAttribLocationARB_remap_index] +#define _gloffset_GetActiveAttribARB driDispatchRemapTable[GetActiveAttribARB_remap_index] +#define _gloffset_GetAttribLocationARB driDispatchRemapTable[GetAttribLocationARB_remap_index] +#define _gloffset_GetVertexAttribdvNV driDispatchRemapTable[GetVertexAttribdvNV_remap_index] +#define _gloffset_GetVertexAttribfvNV driDispatchRemapTable[GetVertexAttribfvNV_remap_index] +#define _gloffset_GetVertexAttribivNV driDispatchRemapTable[GetVertexAttribivNV_remap_index] +#define _gloffset_VertexAttrib1dNV driDispatchRemapTable[VertexAttrib1dNV_remap_index] +#define _gloffset_VertexAttrib1dvNV driDispatchRemapTable[VertexAttrib1dvNV_remap_index] +#define _gloffset_VertexAttrib1fNV driDispatchRemapTable[VertexAttrib1fNV_remap_index] +#define _gloffset_VertexAttrib1fvNV driDispatchRemapTable[VertexAttrib1fvNV_remap_index] +#define _gloffset_VertexAttrib1sNV driDispatchRemapTable[VertexAttrib1sNV_remap_index] +#define _gloffset_VertexAttrib1svNV driDispatchRemapTable[VertexAttrib1svNV_remap_index] +#define _gloffset_VertexAttrib2dNV driDispatchRemapTable[VertexAttrib2dNV_remap_index] +#define _gloffset_VertexAttrib2dvNV driDispatchRemapTable[VertexAttrib2dvNV_remap_index] +#define _gloffset_VertexAttrib2fNV driDispatchRemapTable[VertexAttrib2fNV_remap_index] +#define _gloffset_VertexAttrib2fvNV driDispatchRemapTable[VertexAttrib2fvNV_remap_index] +#define _gloffset_VertexAttrib2sNV driDispatchRemapTable[VertexAttrib2sNV_remap_index] +#define _gloffset_VertexAttrib2svNV driDispatchRemapTable[VertexAttrib2svNV_remap_index] +#define _gloffset_VertexAttrib3dNV driDispatchRemapTable[VertexAttrib3dNV_remap_index] +#define _gloffset_VertexAttrib3dvNV driDispatchRemapTable[VertexAttrib3dvNV_remap_index] +#define _gloffset_VertexAttrib3fNV driDispatchRemapTable[VertexAttrib3fNV_remap_index] +#define _gloffset_VertexAttrib3fvNV driDispatchRemapTable[VertexAttrib3fvNV_remap_index] +#define _gloffset_VertexAttrib3sNV driDispatchRemapTable[VertexAttrib3sNV_remap_index] +#define _gloffset_VertexAttrib3svNV driDispatchRemapTable[VertexAttrib3svNV_remap_index] +#define _gloffset_VertexAttrib4dNV driDispatchRemapTable[VertexAttrib4dNV_remap_index] +#define _gloffset_VertexAttrib4dvNV driDispatchRemapTable[VertexAttrib4dvNV_remap_index] +#define _gloffset_VertexAttrib4fNV driDispatchRemapTable[VertexAttrib4fNV_remap_index] +#define _gloffset_VertexAttrib4fvNV driDispatchRemapTable[VertexAttrib4fvNV_remap_index] +#define _gloffset_VertexAttrib4sNV driDispatchRemapTable[VertexAttrib4sNV_remap_index] +#define _gloffset_VertexAttrib4svNV driDispatchRemapTable[VertexAttrib4svNV_remap_index] +#define _gloffset_VertexAttrib4ubNV driDispatchRemapTable[VertexAttrib4ubNV_remap_index] +#define _gloffset_VertexAttrib4ubvNV driDispatchRemapTable[VertexAttrib4ubvNV_remap_index] +#define _gloffset_GenFragmentShadersATI driDispatchRemapTable[GenFragmentShadersATI_remap_index] +#define _gloffset_BindFragmentShaderATI driDispatchRemapTable[BindFragmentShaderATI_remap_index] +#define _gloffset_DeleteFragmentShaderATI driDispatchRemapTable[DeleteFragmentShaderATI_remap_index] +#define _gloffset_BeginFragmentShaderATI driDispatchRemapTable[BeginFragmentShaderATI_remap_index] +#define _gloffset_EndFragmentShaderATI driDispatchRemapTable[EndFragmentShaderATI_remap_index] +#define _gloffset_PassTexCoordATI driDispatchRemapTable[PassTexCoordATI_remap_index] +#define _gloffset_SampleMapATI driDispatchRemapTable[SampleMapATI_remap_index] +#define _gloffset_ColorFragmentOp1ATI driDispatchRemapTable[ColorFragmentOp1ATI_remap_index] +#define _gloffset_ColorFragmentOp2ATI driDispatchRemapTable[ColorFragmentOp2ATI_remap_index] +#define _gloffset_ColorFragmentOp3ATI driDispatchRemapTable[ColorFragmentOp3ATI_remap_index] +#define _gloffset_AlphaFragmentOp1ATI driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index] +#define _gloffset_AlphaFragmentOp2ATI driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index] +#define _gloffset_AlphaFragmentOp3ATI driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index] +#define _gloffset_SetFragmentShaderConstantATI driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index] +#define _gloffset_IsRenderbufferEXT driDispatchRemapTable[IsRenderbufferEXT_remap_index] +#define _gloffset_BindRenderbufferEXT driDispatchRemapTable[BindRenderbufferEXT_remap_index] +#define _gloffset_DeleteRenderbuffersEXT driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index] +#define _gloffset_GenRenderbuffersEXT driDispatchRemapTable[GenRenderbuffersEXT_remap_index] +#define _gloffset_RenderbufferStorageEXT driDispatchRemapTable[RenderbufferStorageEXT_remap_index] +#define _gloffset_GetRenderbufferParameterivEXT driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index] +#define _gloffset_IsFramebufferEXT driDispatchRemapTable[IsFramebufferEXT_remap_index] +#define _gloffset_BindFramebufferEXT driDispatchRemapTable[BindFramebufferEXT_remap_index] +#define _gloffset_DeleteFramebuffersEXT driDispatchRemapTable[DeleteFramebuffersEXT_remap_index] +#define _gloffset_GenFramebuffersEXT driDispatchRemapTable[GenFramebuffersEXT_remap_index] +#define _gloffset_CheckFramebufferStatusEXT driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index] +#define _gloffset_FramebufferTexture1DEXT driDispatchRemapTable[FramebufferTexture1DEXT_remap_index] +#define _gloffset_FramebufferTexture2DEXT driDispatchRemapTable[FramebufferTexture2DEXT_remap_index] +#define _gloffset_FramebufferTexture3DEXT driDispatchRemapTable[FramebufferTexture3DEXT_remap_index] +#define _gloffset_FramebufferRenderbufferEXT driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index] +#define _gloffset_GetFramebufferAttachmentParameterivEXT driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index] +#define _gloffset_GenerateMipmapEXT driDispatchRemapTable[GenerateMipmapEXT_remap_index] +#define _gloffset_StencilFuncSeparate driDispatchRemapTable[StencilFuncSeparate_remap_index] +#define _gloffset_StencilOpSeparate driDispatchRemapTable[StencilOpSeparate_remap_index] +#define _gloffset_StencilMaskSeparate driDispatchRemapTable[StencilMaskSeparate_remap_index] + +#endif /* !defined(IN_DRI_DRIVER) */ + +#endif /* !defined( _GLAPI_OFFSETS_H_ ) */ diff --git a/reactos/dll/mesa32/src/glapi/glapitable.h b/reactos/dll/mesa32/src/glapi/glapitable.h new file mode 100644 index 00000000000..b4c70bdaae9 --- /dev/null +++ b/reactos/dll/mesa32/src/glapi/glapitable.h @@ -0,0 +1,858 @@ +/* DO NOT EDIT - This file generated automatically by gl_table.py (from Mesa) script */ + +/* + * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * (C) Copyright IBM Corporation 2004 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL, IBM, + * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#if !defined( _GLAPI_TABLE_H_ ) +# define _GLAPI_TABLE_H_ + +#ifndef GLAPIENTRYP +#define GLAPIENTRYP +#endif + +typedef void (*_glapi_proc)(void); /* generic function pointer */ + +struct _glapi_table +{ + void (GLAPIENTRYP NewList)(GLuint list, GLenum mode); /* 0 */ + void (GLAPIENTRYP EndList)(void); /* 1 */ + void (GLAPIENTRYP CallList)(GLuint list); /* 2 */ + void (GLAPIENTRYP CallLists)(GLsizei n, GLenum type, const GLvoid * lists); /* 3 */ + void (GLAPIENTRYP DeleteLists)(GLuint list, GLsizei range); /* 4 */ + GLuint (GLAPIENTRYP GenLists)(GLsizei range); /* 5 */ + void (GLAPIENTRYP ListBase)(GLuint base); /* 6 */ + void (GLAPIENTRYP Begin)(GLenum mode); /* 7 */ + void (GLAPIENTRYP Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap); /* 8 */ + void (GLAPIENTRYP Color3b)(GLbyte red, GLbyte green, GLbyte blue); /* 9 */ + void (GLAPIENTRYP Color3bv)(const GLbyte * v); /* 10 */ + void (GLAPIENTRYP Color3d)(GLdouble red, GLdouble green, GLdouble blue); /* 11 */ + void (GLAPIENTRYP Color3dv)(const GLdouble * v); /* 12 */ + void (GLAPIENTRYP Color3f)(GLfloat red, GLfloat green, GLfloat blue); /* 13 */ + void (GLAPIENTRYP Color3fv)(const GLfloat * v); /* 14 */ + void (GLAPIENTRYP Color3i)(GLint red, GLint green, GLint blue); /* 15 */ + void (GLAPIENTRYP Color3iv)(const GLint * v); /* 16 */ + void (GLAPIENTRYP Color3s)(GLshort red, GLshort green, GLshort blue); /* 17 */ + void (GLAPIENTRYP Color3sv)(const GLshort * v); /* 18 */ + void (GLAPIENTRYP Color3ub)(GLubyte red, GLubyte green, GLubyte blue); /* 19 */ + void (GLAPIENTRYP Color3ubv)(const GLubyte * v); /* 20 */ + void (GLAPIENTRYP Color3ui)(GLuint red, GLuint green, GLuint blue); /* 21 */ + void (GLAPIENTRYP Color3uiv)(const GLuint * v); /* 22 */ + void (GLAPIENTRYP Color3us)(GLushort red, GLushort green, GLushort blue); /* 23 */ + void (GLAPIENTRYP Color3usv)(const GLushort * v); /* 24 */ + void (GLAPIENTRYP Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); /* 25 */ + void (GLAPIENTRYP Color4bv)(const GLbyte * v); /* 26 */ + void (GLAPIENTRYP Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); /* 27 */ + void (GLAPIENTRYP Color4dv)(const GLdouble * v); /* 28 */ + void (GLAPIENTRYP Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 29 */ + void (GLAPIENTRYP Color4fv)(const GLfloat * v); /* 30 */ + void (GLAPIENTRYP Color4i)(GLint red, GLint green, GLint blue, GLint alpha); /* 31 */ + void (GLAPIENTRYP Color4iv)(const GLint * v); /* 32 */ + void (GLAPIENTRYP Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha); /* 33 */ + void (GLAPIENTRYP Color4sv)(const GLshort * v); /* 34 */ + void (GLAPIENTRYP Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); /* 35 */ + void (GLAPIENTRYP Color4ubv)(const GLubyte * v); /* 36 */ + void (GLAPIENTRYP Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha); /* 37 */ + void (GLAPIENTRYP Color4uiv)(const GLuint * v); /* 38 */ + void (GLAPIENTRYP Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha); /* 39 */ + void (GLAPIENTRYP Color4usv)(const GLushort * v); /* 40 */ + void (GLAPIENTRYP EdgeFlag)(GLboolean flag); /* 41 */ + void (GLAPIENTRYP EdgeFlagv)(const GLboolean * flag); /* 42 */ + void (GLAPIENTRYP End)(void); /* 43 */ + void (GLAPIENTRYP Indexd)(GLdouble c); /* 44 */ + void (GLAPIENTRYP Indexdv)(const GLdouble * c); /* 45 */ + void (GLAPIENTRYP Indexf)(GLfloat c); /* 46 */ + void (GLAPIENTRYP Indexfv)(const GLfloat * c); /* 47 */ + void (GLAPIENTRYP Indexi)(GLint c); /* 48 */ + void (GLAPIENTRYP Indexiv)(const GLint * c); /* 49 */ + void (GLAPIENTRYP Indexs)(GLshort c); /* 50 */ + void (GLAPIENTRYP Indexsv)(const GLshort * c); /* 51 */ + void (GLAPIENTRYP Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz); /* 52 */ + void (GLAPIENTRYP Normal3bv)(const GLbyte * v); /* 53 */ + void (GLAPIENTRYP Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz); /* 54 */ + void (GLAPIENTRYP Normal3dv)(const GLdouble * v); /* 55 */ + void (GLAPIENTRYP Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz); /* 56 */ + void (GLAPIENTRYP Normal3fv)(const GLfloat * v); /* 57 */ + void (GLAPIENTRYP Normal3i)(GLint nx, GLint ny, GLint nz); /* 58 */ + void (GLAPIENTRYP Normal3iv)(const GLint * v); /* 59 */ + void (GLAPIENTRYP Normal3s)(GLshort nx, GLshort ny, GLshort nz); /* 60 */ + void (GLAPIENTRYP Normal3sv)(const GLshort * v); /* 61 */ + void (GLAPIENTRYP RasterPos2d)(GLdouble x, GLdouble y); /* 62 */ + void (GLAPIENTRYP RasterPos2dv)(const GLdouble * v); /* 63 */ + void (GLAPIENTRYP RasterPos2f)(GLfloat x, GLfloat y); /* 64 */ + void (GLAPIENTRYP RasterPos2fv)(const GLfloat * v); /* 65 */ + void (GLAPIENTRYP RasterPos2i)(GLint x, GLint y); /* 66 */ + void (GLAPIENTRYP RasterPos2iv)(const GLint * v); /* 67 */ + void (GLAPIENTRYP RasterPos2s)(GLshort x, GLshort y); /* 68 */ + void (GLAPIENTRYP RasterPos2sv)(const GLshort * v); /* 69 */ + void (GLAPIENTRYP RasterPos3d)(GLdouble x, GLdouble y, GLdouble z); /* 70 */ + void (GLAPIENTRYP RasterPos3dv)(const GLdouble * v); /* 71 */ + void (GLAPIENTRYP RasterPos3f)(GLfloat x, GLfloat y, GLfloat z); /* 72 */ + void (GLAPIENTRYP RasterPos3fv)(const GLfloat * v); /* 73 */ + void (GLAPIENTRYP RasterPos3i)(GLint x, GLint y, GLint z); /* 74 */ + void (GLAPIENTRYP RasterPos3iv)(const GLint * v); /* 75 */ + void (GLAPIENTRYP RasterPos3s)(GLshort x, GLshort y, GLshort z); /* 76 */ + void (GLAPIENTRYP RasterPos3sv)(const GLshort * v); /* 77 */ + void (GLAPIENTRYP RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 78 */ + void (GLAPIENTRYP RasterPos4dv)(const GLdouble * v); /* 79 */ + void (GLAPIENTRYP RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 80 */ + void (GLAPIENTRYP RasterPos4fv)(const GLfloat * v); /* 81 */ + void (GLAPIENTRYP RasterPos4i)(GLint x, GLint y, GLint z, GLint w); /* 82 */ + void (GLAPIENTRYP RasterPos4iv)(const GLint * v); /* 83 */ + void (GLAPIENTRYP RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 84 */ + void (GLAPIENTRYP RasterPos4sv)(const GLshort * v); /* 85 */ + void (GLAPIENTRYP Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); /* 86 */ + void (GLAPIENTRYP Rectdv)(const GLdouble * v1, const GLdouble * v2); /* 87 */ + void (GLAPIENTRYP Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); /* 88 */ + void (GLAPIENTRYP Rectfv)(const GLfloat * v1, const GLfloat * v2); /* 89 */ + void (GLAPIENTRYP Recti)(GLint x1, GLint y1, GLint x2, GLint y2); /* 90 */ + void (GLAPIENTRYP Rectiv)(const GLint * v1, const GLint * v2); /* 91 */ + void (GLAPIENTRYP Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); /* 92 */ + void (GLAPIENTRYP Rectsv)(const GLshort * v1, const GLshort * v2); /* 93 */ + void (GLAPIENTRYP TexCoord1d)(GLdouble s); /* 94 */ + void (GLAPIENTRYP TexCoord1dv)(const GLdouble * v); /* 95 */ + void (GLAPIENTRYP TexCoord1f)(GLfloat s); /* 96 */ + void (GLAPIENTRYP TexCoord1fv)(const GLfloat * v); /* 97 */ + void (GLAPIENTRYP TexCoord1i)(GLint s); /* 98 */ + void (GLAPIENTRYP TexCoord1iv)(const GLint * v); /* 99 */ + void (GLAPIENTRYP TexCoord1s)(GLshort s); /* 100 */ + void (GLAPIENTRYP TexCoord1sv)(const GLshort * v); /* 101 */ + void (GLAPIENTRYP TexCoord2d)(GLdouble s, GLdouble t); /* 102 */ + void (GLAPIENTRYP TexCoord2dv)(const GLdouble * v); /* 103 */ + void (GLAPIENTRYP TexCoord2f)(GLfloat s, GLfloat t); /* 104 */ + void (GLAPIENTRYP TexCoord2fv)(const GLfloat * v); /* 105 */ + void (GLAPIENTRYP TexCoord2i)(GLint s, GLint t); /* 106 */ + void (GLAPIENTRYP TexCoord2iv)(const GLint * v); /* 107 */ + void (GLAPIENTRYP TexCoord2s)(GLshort s, GLshort t); /* 108 */ + void (GLAPIENTRYP TexCoord2sv)(const GLshort * v); /* 109 */ + void (GLAPIENTRYP TexCoord3d)(GLdouble s, GLdouble t, GLdouble r); /* 110 */ + void (GLAPIENTRYP TexCoord3dv)(const GLdouble * v); /* 111 */ + void (GLAPIENTRYP TexCoord3f)(GLfloat s, GLfloat t, GLfloat r); /* 112 */ + void (GLAPIENTRYP TexCoord3fv)(const GLfloat * v); /* 113 */ + void (GLAPIENTRYP TexCoord3i)(GLint s, GLint t, GLint r); /* 114 */ + void (GLAPIENTRYP TexCoord3iv)(const GLint * v); /* 115 */ + void (GLAPIENTRYP TexCoord3s)(GLshort s, GLshort t, GLshort r); /* 116 */ + void (GLAPIENTRYP TexCoord3sv)(const GLshort * v); /* 117 */ + void (GLAPIENTRYP TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 118 */ + void (GLAPIENTRYP TexCoord4dv)(const GLdouble * v); /* 119 */ + void (GLAPIENTRYP TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 120 */ + void (GLAPIENTRYP TexCoord4fv)(const GLfloat * v); /* 121 */ + void (GLAPIENTRYP TexCoord4i)(GLint s, GLint t, GLint r, GLint q); /* 122 */ + void (GLAPIENTRYP TexCoord4iv)(const GLint * v); /* 123 */ + void (GLAPIENTRYP TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q); /* 124 */ + void (GLAPIENTRYP TexCoord4sv)(const GLshort * v); /* 125 */ + void (GLAPIENTRYP Vertex2d)(GLdouble x, GLdouble y); /* 126 */ + void (GLAPIENTRYP Vertex2dv)(const GLdouble * v); /* 127 */ + void (GLAPIENTRYP Vertex2f)(GLfloat x, GLfloat y); /* 128 */ + void (GLAPIENTRYP Vertex2fv)(const GLfloat * v); /* 129 */ + void (GLAPIENTRYP Vertex2i)(GLint x, GLint y); /* 130 */ + void (GLAPIENTRYP Vertex2iv)(const GLint * v); /* 131 */ + void (GLAPIENTRYP Vertex2s)(GLshort x, GLshort y); /* 132 */ + void (GLAPIENTRYP Vertex2sv)(const GLshort * v); /* 133 */ + void (GLAPIENTRYP Vertex3d)(GLdouble x, GLdouble y, GLdouble z); /* 134 */ + void (GLAPIENTRYP Vertex3dv)(const GLdouble * v); /* 135 */ + void (GLAPIENTRYP Vertex3f)(GLfloat x, GLfloat y, GLfloat z); /* 136 */ + void (GLAPIENTRYP Vertex3fv)(const GLfloat * v); /* 137 */ + void (GLAPIENTRYP Vertex3i)(GLint x, GLint y, GLint z); /* 138 */ + void (GLAPIENTRYP Vertex3iv)(const GLint * v); /* 139 */ + void (GLAPIENTRYP Vertex3s)(GLshort x, GLshort y, GLshort z); /* 140 */ + void (GLAPIENTRYP Vertex3sv)(const GLshort * v); /* 141 */ + void (GLAPIENTRYP Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 142 */ + void (GLAPIENTRYP Vertex4dv)(const GLdouble * v); /* 143 */ + void (GLAPIENTRYP Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 144 */ + void (GLAPIENTRYP Vertex4fv)(const GLfloat * v); /* 145 */ + void (GLAPIENTRYP Vertex4i)(GLint x, GLint y, GLint z, GLint w); /* 146 */ + void (GLAPIENTRYP Vertex4iv)(const GLint * v); /* 147 */ + void (GLAPIENTRYP Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 148 */ + void (GLAPIENTRYP Vertex4sv)(const GLshort * v); /* 149 */ + void (GLAPIENTRYP ClipPlane)(GLenum plane, const GLdouble * equation); /* 150 */ + void (GLAPIENTRYP ColorMaterial)(GLenum face, GLenum mode); /* 151 */ + void (GLAPIENTRYP CullFace)(GLenum mode); /* 152 */ + void (GLAPIENTRYP Fogf)(GLenum pname, GLfloat param); /* 153 */ + void (GLAPIENTRYP Fogfv)(GLenum pname, const GLfloat * params); /* 154 */ + void (GLAPIENTRYP Fogi)(GLenum pname, GLint param); /* 155 */ + void (GLAPIENTRYP Fogiv)(GLenum pname, const GLint * params); /* 156 */ + void (GLAPIENTRYP FrontFace)(GLenum mode); /* 157 */ + void (GLAPIENTRYP Hint)(GLenum target, GLenum mode); /* 158 */ + void (GLAPIENTRYP Lightf)(GLenum light, GLenum pname, GLfloat param); /* 159 */ + void (GLAPIENTRYP Lightfv)(GLenum light, GLenum pname, const GLfloat * params); /* 160 */ + void (GLAPIENTRYP Lighti)(GLenum light, GLenum pname, GLint param); /* 161 */ + void (GLAPIENTRYP Lightiv)(GLenum light, GLenum pname, const GLint * params); /* 162 */ + void (GLAPIENTRYP LightModelf)(GLenum pname, GLfloat param); /* 163 */ + void (GLAPIENTRYP LightModelfv)(GLenum pname, const GLfloat * params); /* 164 */ + void (GLAPIENTRYP LightModeli)(GLenum pname, GLint param); /* 165 */ + void (GLAPIENTRYP LightModeliv)(GLenum pname, const GLint * params); /* 166 */ + void (GLAPIENTRYP LineStipple)(GLint factor, GLushort pattern); /* 167 */ + void (GLAPIENTRYP LineWidth)(GLfloat width); /* 168 */ + void (GLAPIENTRYP Materialf)(GLenum face, GLenum pname, GLfloat param); /* 169 */ + void (GLAPIENTRYP Materialfv)(GLenum face, GLenum pname, const GLfloat * params); /* 170 */ + void (GLAPIENTRYP Materiali)(GLenum face, GLenum pname, GLint param); /* 171 */ + void (GLAPIENTRYP Materialiv)(GLenum face, GLenum pname, const GLint * params); /* 172 */ + void (GLAPIENTRYP PointSize)(GLfloat size); /* 173 */ + void (GLAPIENTRYP PolygonMode)(GLenum face, GLenum mode); /* 174 */ + void (GLAPIENTRYP PolygonStipple)(const GLubyte * mask); /* 175 */ + void (GLAPIENTRYP Scissor)(GLint x, GLint y, GLsizei width, GLsizei height); /* 176 */ + void (GLAPIENTRYP ShadeModel)(GLenum mode); /* 177 */ + void (GLAPIENTRYP TexParameterf)(GLenum target, GLenum pname, GLfloat param); /* 178 */ + void (GLAPIENTRYP TexParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 179 */ + void (GLAPIENTRYP TexParameteri)(GLenum target, GLenum pname, GLint param); /* 180 */ + void (GLAPIENTRYP TexParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 181 */ + void (GLAPIENTRYP TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 182 */ + void (GLAPIENTRYP TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 183 */ + void (GLAPIENTRYP TexEnvf)(GLenum target, GLenum pname, GLfloat param); /* 184 */ + void (GLAPIENTRYP TexEnvfv)(GLenum target, GLenum pname, const GLfloat * params); /* 185 */ + void (GLAPIENTRYP TexEnvi)(GLenum target, GLenum pname, GLint param); /* 186 */ + void (GLAPIENTRYP TexEnviv)(GLenum target, GLenum pname, const GLint * params); /* 187 */ + void (GLAPIENTRYP TexGend)(GLenum coord, GLenum pname, GLdouble param); /* 188 */ + void (GLAPIENTRYP TexGendv)(GLenum coord, GLenum pname, const GLdouble * params); /* 189 */ + void (GLAPIENTRYP TexGenf)(GLenum coord, GLenum pname, GLfloat param); /* 190 */ + void (GLAPIENTRYP TexGenfv)(GLenum coord, GLenum pname, const GLfloat * params); /* 191 */ + void (GLAPIENTRYP TexGeni)(GLenum coord, GLenum pname, GLint param); /* 192 */ + void (GLAPIENTRYP TexGeniv)(GLenum coord, GLenum pname, const GLint * params); /* 193 */ + void (GLAPIENTRYP FeedbackBuffer)(GLsizei size, GLenum type, GLfloat * buffer); /* 194 */ + void (GLAPIENTRYP SelectBuffer)(GLsizei size, GLuint * buffer); /* 195 */ + GLint (GLAPIENTRYP RenderMode)(GLenum mode); /* 196 */ + void (GLAPIENTRYP InitNames)(void); /* 197 */ + void (GLAPIENTRYP LoadName)(GLuint name); /* 198 */ + void (GLAPIENTRYP PassThrough)(GLfloat token); /* 199 */ + void (GLAPIENTRYP PopName)(void); /* 200 */ + void (GLAPIENTRYP PushName)(GLuint name); /* 201 */ + void (GLAPIENTRYP DrawBuffer)(GLenum mode); /* 202 */ + void (GLAPIENTRYP Clear)(GLbitfield mask); /* 203 */ + void (GLAPIENTRYP ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 204 */ + void (GLAPIENTRYP ClearIndex)(GLfloat c); /* 205 */ + void (GLAPIENTRYP ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 206 */ + void (GLAPIENTRYP ClearStencil)(GLint s); /* 207 */ + void (GLAPIENTRYP ClearDepth)(GLclampd depth); /* 208 */ + void (GLAPIENTRYP StencilMask)(GLuint mask); /* 209 */ + void (GLAPIENTRYP ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); /* 210 */ + void (GLAPIENTRYP DepthMask)(GLboolean flag); /* 211 */ + void (GLAPIENTRYP IndexMask)(GLuint mask); /* 212 */ + void (GLAPIENTRYP Accum)(GLenum op, GLfloat value); /* 213 */ + void (GLAPIENTRYP Disable)(GLenum cap); /* 214 */ + void (GLAPIENTRYP Enable)(GLenum cap); /* 215 */ + void (GLAPIENTRYP Finish)(void); /* 216 */ + void (GLAPIENTRYP Flush)(void); /* 217 */ + void (GLAPIENTRYP PopAttrib)(void); /* 218 */ + void (GLAPIENTRYP PushAttrib)(GLbitfield mask); /* 219 */ + void (GLAPIENTRYP Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points); /* 220 */ + void (GLAPIENTRYP Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points); /* 221 */ + void (GLAPIENTRYP Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points); /* 222 */ + void (GLAPIENTRYP Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points); /* 223 */ + void (GLAPIENTRYP MapGrid1d)(GLint un, GLdouble u1, GLdouble u2); /* 224 */ + void (GLAPIENTRYP MapGrid1f)(GLint un, GLfloat u1, GLfloat u2); /* 225 */ + void (GLAPIENTRYP MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); /* 226 */ + void (GLAPIENTRYP MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); /* 227 */ + void (GLAPIENTRYP EvalCoord1d)(GLdouble u); /* 228 */ + void (GLAPIENTRYP EvalCoord1dv)(const GLdouble * u); /* 229 */ + void (GLAPIENTRYP EvalCoord1f)(GLfloat u); /* 230 */ + void (GLAPIENTRYP EvalCoord1fv)(const GLfloat * u); /* 231 */ + void (GLAPIENTRYP EvalCoord2d)(GLdouble u, GLdouble v); /* 232 */ + void (GLAPIENTRYP EvalCoord2dv)(const GLdouble * u); /* 233 */ + void (GLAPIENTRYP EvalCoord2f)(GLfloat u, GLfloat v); /* 234 */ + void (GLAPIENTRYP EvalCoord2fv)(const GLfloat * u); /* 235 */ + void (GLAPIENTRYP EvalMesh1)(GLenum mode, GLint i1, GLint i2); /* 236 */ + void (GLAPIENTRYP EvalPoint1)(GLint i); /* 237 */ + void (GLAPIENTRYP EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); /* 238 */ + void (GLAPIENTRYP EvalPoint2)(GLint i, GLint j); /* 239 */ + void (GLAPIENTRYP AlphaFunc)(GLenum func, GLclampf ref); /* 240 */ + void (GLAPIENTRYP BlendFunc)(GLenum sfactor, GLenum dfactor); /* 241 */ + void (GLAPIENTRYP LogicOp)(GLenum opcode); /* 242 */ + void (GLAPIENTRYP StencilFunc)(GLenum func, GLint ref, GLuint mask); /* 243 */ + void (GLAPIENTRYP StencilOp)(GLenum fail, GLenum zfail, GLenum zpass); /* 244 */ + void (GLAPIENTRYP DepthFunc)(GLenum func); /* 245 */ + void (GLAPIENTRYP PixelZoom)(GLfloat xfactor, GLfloat yfactor); /* 246 */ + void (GLAPIENTRYP PixelTransferf)(GLenum pname, GLfloat param); /* 247 */ + void (GLAPIENTRYP PixelTransferi)(GLenum pname, GLint param); /* 248 */ + void (GLAPIENTRYP PixelStoref)(GLenum pname, GLfloat param); /* 249 */ + void (GLAPIENTRYP PixelStorei)(GLenum pname, GLint param); /* 250 */ + void (GLAPIENTRYP PixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat * values); /* 251 */ + void (GLAPIENTRYP PixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint * values); /* 252 */ + void (GLAPIENTRYP PixelMapusv)(GLenum map, GLsizei mapsize, const GLushort * values); /* 253 */ + void (GLAPIENTRYP ReadBuffer)(GLenum mode); /* 254 */ + void (GLAPIENTRYP CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); /* 255 */ + void (GLAPIENTRYP ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels); /* 256 */ + void (GLAPIENTRYP DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 257 */ + void (GLAPIENTRYP GetBooleanv)(GLenum pname, GLboolean * params); /* 258 */ + void (GLAPIENTRYP GetClipPlane)(GLenum plane, GLdouble * equation); /* 259 */ + void (GLAPIENTRYP GetDoublev)(GLenum pname, GLdouble * params); /* 260 */ + GLenum (GLAPIENTRYP GetError)(void); /* 261 */ + void (GLAPIENTRYP GetFloatv)(GLenum pname, GLfloat * params); /* 262 */ + void (GLAPIENTRYP GetIntegerv)(GLenum pname, GLint * params); /* 263 */ + void (GLAPIENTRYP GetLightfv)(GLenum light, GLenum pname, GLfloat * params); /* 264 */ + void (GLAPIENTRYP GetLightiv)(GLenum light, GLenum pname, GLint * params); /* 265 */ + void (GLAPIENTRYP GetMapdv)(GLenum target, GLenum query, GLdouble * v); /* 266 */ + void (GLAPIENTRYP GetMapfv)(GLenum target, GLenum query, GLfloat * v); /* 267 */ + void (GLAPIENTRYP GetMapiv)(GLenum target, GLenum query, GLint * v); /* 268 */ + void (GLAPIENTRYP GetMaterialfv)(GLenum face, GLenum pname, GLfloat * params); /* 269 */ + void (GLAPIENTRYP GetMaterialiv)(GLenum face, GLenum pname, GLint * params); /* 270 */ + void (GLAPIENTRYP GetPixelMapfv)(GLenum map, GLfloat * values); /* 271 */ + void (GLAPIENTRYP GetPixelMapuiv)(GLenum map, GLuint * values); /* 272 */ + void (GLAPIENTRYP GetPixelMapusv)(GLenum map, GLushort * values); /* 273 */ + void (GLAPIENTRYP GetPolygonStipple)(GLubyte * mask); /* 274 */ + const GLubyte * (GLAPIENTRYP GetString)(GLenum name); /* 275 */ + void (GLAPIENTRYP GetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params); /* 276 */ + void (GLAPIENTRYP GetTexEnviv)(GLenum target, GLenum pname, GLint * params); /* 277 */ + void (GLAPIENTRYP GetTexGendv)(GLenum coord, GLenum pname, GLdouble * params); /* 278 */ + void (GLAPIENTRYP GetTexGenfv)(GLenum coord, GLenum pname, GLfloat * params); /* 279 */ + void (GLAPIENTRYP GetTexGeniv)(GLenum coord, GLenum pname, GLint * params); /* 280 */ + void (GLAPIENTRYP GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels); /* 281 */ + void (GLAPIENTRYP GetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 282 */ + void (GLAPIENTRYP GetTexParameteriv)(GLenum target, GLenum pname, GLint * params); /* 283 */ + void (GLAPIENTRYP GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params); /* 284 */ + void (GLAPIENTRYP GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params); /* 285 */ + GLboolean (GLAPIENTRYP IsEnabled)(GLenum cap); /* 286 */ + GLboolean (GLAPIENTRYP IsList)(GLuint list); /* 287 */ + void (GLAPIENTRYP DepthRange)(GLclampd zNear, GLclampd zFar); /* 288 */ + void (GLAPIENTRYP Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 289 */ + void (GLAPIENTRYP LoadIdentity)(void); /* 290 */ + void (GLAPIENTRYP LoadMatrixf)(const GLfloat * m); /* 291 */ + void (GLAPIENTRYP LoadMatrixd)(const GLdouble * m); /* 292 */ + void (GLAPIENTRYP MatrixMode)(GLenum mode); /* 293 */ + void (GLAPIENTRYP MultMatrixf)(const GLfloat * m); /* 294 */ + void (GLAPIENTRYP MultMatrixd)(const GLdouble * m); /* 295 */ + void (GLAPIENTRYP Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 296 */ + void (GLAPIENTRYP PopMatrix)(void); /* 297 */ + void (GLAPIENTRYP PushMatrix)(void); /* 298 */ + void (GLAPIENTRYP Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); /* 299 */ + void (GLAPIENTRYP Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); /* 300 */ + void (GLAPIENTRYP Scaled)(GLdouble x, GLdouble y, GLdouble z); /* 301 */ + void (GLAPIENTRYP Scalef)(GLfloat x, GLfloat y, GLfloat z); /* 302 */ + void (GLAPIENTRYP Translated)(GLdouble x, GLdouble y, GLdouble z); /* 303 */ + void (GLAPIENTRYP Translatef)(GLfloat x, GLfloat y, GLfloat z); /* 304 */ + void (GLAPIENTRYP Viewport)(GLint x, GLint y, GLsizei width, GLsizei height); /* 305 */ + void (GLAPIENTRYP ArrayElement)(GLint i); /* 306 */ + void (GLAPIENTRYP BindTexture)(GLenum target, GLuint texture); /* 307 */ + void (GLAPIENTRYP ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 308 */ + void (GLAPIENTRYP DisableClientState)(GLenum array); /* 309 */ + void (GLAPIENTRYP DrawArrays)(GLenum mode, GLint first, GLsizei count); /* 310 */ + void (GLAPIENTRYP DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices); /* 311 */ + void (GLAPIENTRYP EdgeFlagPointer)(GLsizei stride, const GLvoid * pointer); /* 312 */ + void (GLAPIENTRYP EnableClientState)(GLenum array); /* 313 */ + void (GLAPIENTRYP IndexPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 314 */ + void (GLAPIENTRYP Indexub)(GLubyte c); /* 315 */ + void (GLAPIENTRYP Indexubv)(const GLubyte * c); /* 316 */ + void (GLAPIENTRYP InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid * pointer); /* 317 */ + void (GLAPIENTRYP NormalPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 318 */ + void (GLAPIENTRYP PolygonOffset)(GLfloat factor, GLfloat units); /* 319 */ + void (GLAPIENTRYP TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 320 */ + void (GLAPIENTRYP VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 321 */ + GLboolean (GLAPIENTRYP AreTexturesResident)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 322 */ + void (GLAPIENTRYP CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); /* 323 */ + void (GLAPIENTRYP CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); /* 324 */ + void (GLAPIENTRYP CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); /* 325 */ + void (GLAPIENTRYP CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 326 */ + void (GLAPIENTRYP DeleteTextures)(GLsizei n, const GLuint * textures); /* 327 */ + void (GLAPIENTRYP GenTextures)(GLsizei n, GLuint * textures); /* 328 */ + void (GLAPIENTRYP GetPointerv)(GLenum pname, GLvoid ** params); /* 329 */ + GLboolean (GLAPIENTRYP IsTexture)(GLuint texture); /* 330 */ + void (GLAPIENTRYP PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities); /* 331 */ + void (GLAPIENTRYP TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels); /* 332 */ + void (GLAPIENTRYP TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 333 */ + void (GLAPIENTRYP PopClientAttrib)(void); /* 334 */ + void (GLAPIENTRYP PushClientAttrib)(GLbitfield mask); /* 335 */ + void (GLAPIENTRYP BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 336 */ + void (GLAPIENTRYP BlendEquation)(GLenum mode); /* 337 */ + void (GLAPIENTRYP DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices); /* 338 */ + void (GLAPIENTRYP ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table); /* 339 */ + void (GLAPIENTRYP ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 340 */ + void (GLAPIENTRYP ColorTableParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 341 */ + void (GLAPIENTRYP CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 342 */ + void (GLAPIENTRYP GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 343 */ + void (GLAPIENTRYP GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 344 */ + void (GLAPIENTRYP GetColorTableParameteriv)(GLenum target, GLenum pname, GLint * params); /* 345 */ + void (GLAPIENTRYP ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data); /* 346 */ + void (GLAPIENTRYP CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); /* 347 */ + void (GLAPIENTRYP ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image); /* 348 */ + void (GLAPIENTRYP ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image); /* 349 */ + void (GLAPIENTRYP ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params); /* 350 */ + void (GLAPIENTRYP ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 351 */ + void (GLAPIENTRYP ConvolutionParameteri)(GLenum target, GLenum pname, GLint params); /* 352 */ + void (GLAPIENTRYP ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 353 */ + void (GLAPIENTRYP CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 354 */ + void (GLAPIENTRYP CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); /* 355 */ + void (GLAPIENTRYP GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 356 */ + void (GLAPIENTRYP GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 357 */ + void (GLAPIENTRYP GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint * params); /* 358 */ + void (GLAPIENTRYP GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 359 */ + void (GLAPIENTRYP SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column); /* 360 */ + void (GLAPIENTRYP GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 361 */ + void (GLAPIENTRYP GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 362 */ + void (GLAPIENTRYP GetHistogramParameteriv)(GLenum target, GLenum pname, GLint * params); /* 363 */ + void (GLAPIENTRYP GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 364 */ + void (GLAPIENTRYP GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 365 */ + void (GLAPIENTRYP GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint * params); /* 366 */ + void (GLAPIENTRYP Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); /* 367 */ + void (GLAPIENTRYP Minmax)(GLenum target, GLenum internalformat, GLboolean sink); /* 368 */ + void (GLAPIENTRYP ResetHistogram)(GLenum target); /* 369 */ + void (GLAPIENTRYP ResetMinmax)(GLenum target); /* 370 */ + void (GLAPIENTRYP TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 371 */ + void (GLAPIENTRYP TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels); /* 372 */ + void (GLAPIENTRYP CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 373 */ + void (GLAPIENTRYP ActiveTextureARB)(GLenum texture); /* 374 */ + void (GLAPIENTRYP ClientActiveTextureARB)(GLenum texture); /* 375 */ + void (GLAPIENTRYP MultiTexCoord1dARB)(GLenum target, GLdouble s); /* 376 */ + void (GLAPIENTRYP MultiTexCoord1dvARB)(GLenum target, const GLdouble * v); /* 377 */ + void (GLAPIENTRYP MultiTexCoord1fARB)(GLenum target, GLfloat s); /* 378 */ + void (GLAPIENTRYP MultiTexCoord1fvARB)(GLenum target, const GLfloat * v); /* 379 */ + void (GLAPIENTRYP MultiTexCoord1iARB)(GLenum target, GLint s); /* 380 */ + void (GLAPIENTRYP MultiTexCoord1ivARB)(GLenum target, const GLint * v); /* 381 */ + void (GLAPIENTRYP MultiTexCoord1sARB)(GLenum target, GLshort s); /* 382 */ + void (GLAPIENTRYP MultiTexCoord1svARB)(GLenum target, const GLshort * v); /* 383 */ + void (GLAPIENTRYP MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t); /* 384 */ + void (GLAPIENTRYP MultiTexCoord2dvARB)(GLenum target, const GLdouble * v); /* 385 */ + void (GLAPIENTRYP MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t); /* 386 */ + void (GLAPIENTRYP MultiTexCoord2fvARB)(GLenum target, const GLfloat * v); /* 387 */ + void (GLAPIENTRYP MultiTexCoord2iARB)(GLenum target, GLint s, GLint t); /* 388 */ + void (GLAPIENTRYP MultiTexCoord2ivARB)(GLenum target, const GLint * v); /* 389 */ + void (GLAPIENTRYP MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t); /* 390 */ + void (GLAPIENTRYP MultiTexCoord2svARB)(GLenum target, const GLshort * v); /* 391 */ + void (GLAPIENTRYP MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r); /* 392 */ + void (GLAPIENTRYP MultiTexCoord3dvARB)(GLenum target, const GLdouble * v); /* 393 */ + void (GLAPIENTRYP MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r); /* 394 */ + void (GLAPIENTRYP MultiTexCoord3fvARB)(GLenum target, const GLfloat * v); /* 395 */ + void (GLAPIENTRYP MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r); /* 396 */ + void (GLAPIENTRYP MultiTexCoord3ivARB)(GLenum target, const GLint * v); /* 397 */ + void (GLAPIENTRYP MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r); /* 398 */ + void (GLAPIENTRYP MultiTexCoord3svARB)(GLenum target, const GLshort * v); /* 399 */ + void (GLAPIENTRYP MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 400 */ + void (GLAPIENTRYP MultiTexCoord4dvARB)(GLenum target, const GLdouble * v); /* 401 */ + void (GLAPIENTRYP MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 402 */ + void (GLAPIENTRYP MultiTexCoord4fvARB)(GLenum target, const GLfloat * v); /* 403 */ + void (GLAPIENTRYP MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q); /* 404 */ + void (GLAPIENTRYP MultiTexCoord4ivARB)(GLenum target, const GLint * v); /* 405 */ + void (GLAPIENTRYP MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); /* 406 */ + void (GLAPIENTRYP MultiTexCoord4svARB)(GLenum target, const GLshort * v); /* 407 */ + void (GLAPIENTRYP LoadTransposeMatrixfARB)(const GLfloat * m); /* 408 */ + void (GLAPIENTRYP LoadTransposeMatrixdARB)(const GLdouble * m); /* 409 */ + void (GLAPIENTRYP MultTransposeMatrixfARB)(const GLfloat * m); /* 410 */ + void (GLAPIENTRYP MultTransposeMatrixdARB)(const GLdouble * m); /* 411 */ + void (GLAPIENTRYP SampleCoverageARB)(GLclampf value, GLboolean invert); /* 412 */ + void (GLAPIENTRYP DrawBuffersARB)(GLsizei n, const GLenum * bufs); /* 413 */ + void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 414 */ + void (GLAPIENTRYP GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat * weights); /* 415 */ + void (GLAPIENTRYP TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat * weights); /* 416 */ + void (GLAPIENTRYP GetHistogramEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 417 */ + void (GLAPIENTRYP GetHistogramParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 418 */ + void (GLAPIENTRYP GetHistogramParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 419 */ + void (GLAPIENTRYP GetMinmaxEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 420 */ + void (GLAPIENTRYP GetMinmaxParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 421 */ + void (GLAPIENTRYP GetMinmaxParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 422 */ + void (GLAPIENTRYP GetConvolutionFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 423 */ + void (GLAPIENTRYP GetConvolutionParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 424 */ + void (GLAPIENTRYP GetConvolutionParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 425 */ + void (GLAPIENTRYP GetSeparableFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 426 */ + void (GLAPIENTRYP GetColorTableSGI)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 427 */ + void (GLAPIENTRYP GetColorTableParameterfvSGI)(GLenum target, GLenum pname, GLfloat * params); /* 428 */ + void (GLAPIENTRYP GetColorTableParameterivSGI)(GLenum target, GLenum pname, GLint * params); /* 429 */ + void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 430 */ + void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 431 */ + void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 432 */ + void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 433 */ + void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 434 */ + void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 435 */ + void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 436 */ + void (GLAPIENTRYP TexImage4DSGIS)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 437 */ + void (GLAPIENTRYP TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid * pixels); /* 438 */ + GLboolean (GLAPIENTRYP AreTexturesResidentEXT)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 439 */ + void (GLAPIENTRYP GenTexturesEXT)(GLsizei n, GLuint * textures); /* 440 */ + GLboolean (GLAPIENTRYP IsTextureEXT)(GLuint texture); /* 441 */ + void (GLAPIENTRYP DetailTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points); /* 442 */ + void (GLAPIENTRYP GetDetailTexFuncSGIS)(GLenum target, GLfloat * points); /* 443 */ + void (GLAPIENTRYP SharpenTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points); /* 444 */ + void (GLAPIENTRYP GetSharpenTexFuncSGIS)(GLenum target, GLfloat * points); /* 445 */ + void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 446 */ + void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 447 */ + void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 448 */ + void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 449 */ + void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 450 */ + void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 451 */ + void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 452 */ + void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 453 */ + void (GLAPIENTRYP SpriteParameterfSGIX)(GLenum pname, GLfloat param); /* 454 */ + void (GLAPIENTRYP SpriteParameterfvSGIX)(GLenum pname, const GLfloat * params); /* 455 */ + void (GLAPIENTRYP SpriteParameteriSGIX)(GLenum pname, GLint param); /* 456 */ + void (GLAPIENTRYP SpriteParameterivSGIX)(GLenum pname, const GLint * params); /* 457 */ + void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 458 */ + void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 459 */ + GLint (GLAPIENTRYP GetInstrumentsSGIX)(void); /* 460 */ + void (GLAPIENTRYP InstrumentsBufferSGIX)(GLsizei size, GLint * buffer); /* 461 */ + GLint (GLAPIENTRYP PollInstrumentsSGIX)(GLint * marker_p); /* 462 */ + void (GLAPIENTRYP ReadInstrumentsSGIX)(GLint marker); /* 463 */ + void (GLAPIENTRYP StartInstrumentsSGIX)(void); /* 464 */ + void (GLAPIENTRYP StopInstrumentsSGIX)(GLint marker); /* 465 */ + void (GLAPIENTRYP FrameZoomSGIX)(GLint factor); /* 466 */ + void (GLAPIENTRYP TagSampleBufferSGIX)(void); /* 467 */ + void (GLAPIENTRYP ReferencePlaneSGIX)(const GLdouble * equation); /* 468 */ + void (GLAPIENTRYP FlushRasterSGIX)(void); /* 469 */ + void (GLAPIENTRYP GetListParameterfvSGIX)(GLuint list, GLenum pname, GLfloat * params); /* 470 */ + void (GLAPIENTRYP GetListParameterivSGIX)(GLuint list, GLenum pname, GLint * params); /* 471 */ + void (GLAPIENTRYP ListParameterfSGIX)(GLuint list, GLenum pname, GLfloat param); /* 472 */ + void (GLAPIENTRYP ListParameterfvSGIX)(GLuint list, GLenum pname, const GLfloat * params); /* 473 */ + void (GLAPIENTRYP ListParameteriSGIX)(GLuint list, GLenum pname, GLint param); /* 474 */ + void (GLAPIENTRYP ListParameterivSGIX)(GLuint list, GLenum pname, const GLint * params); /* 475 */ + void (GLAPIENTRYP FragmentColorMaterialSGIX)(GLenum face, GLenum mode); /* 476 */ + void (GLAPIENTRYP FragmentLightfSGIX)(GLenum light, GLenum pname, GLfloat param); /* 477 */ + void (GLAPIENTRYP FragmentLightfvSGIX)(GLenum light, GLenum pname, const GLfloat * params); /* 478 */ + void (GLAPIENTRYP FragmentLightiSGIX)(GLenum light, GLenum pname, GLint param); /* 479 */ + void (GLAPIENTRYP FragmentLightivSGIX)(GLenum light, GLenum pname, const GLint * params); /* 480 */ + void (GLAPIENTRYP FragmentLightModelfSGIX)(GLenum pname, GLfloat param); /* 481 */ + void (GLAPIENTRYP FragmentLightModelfvSGIX)(GLenum pname, const GLfloat * params); /* 482 */ + void (GLAPIENTRYP FragmentLightModeliSGIX)(GLenum pname, GLint param); /* 483 */ + void (GLAPIENTRYP FragmentLightModelivSGIX)(GLenum pname, const GLint * params); /* 484 */ + void (GLAPIENTRYP FragmentMaterialfSGIX)(GLenum face, GLenum pname, GLfloat param); /* 485 */ + void (GLAPIENTRYP FragmentMaterialfvSGIX)(GLenum face, GLenum pname, const GLfloat * params); /* 486 */ + void (GLAPIENTRYP FragmentMaterialiSGIX)(GLenum face, GLenum pname, GLint param); /* 487 */ + void (GLAPIENTRYP FragmentMaterialivSGIX)(GLenum face, GLenum pname, const GLint * params); /* 488 */ + void (GLAPIENTRYP GetFragmentLightfvSGIX)(GLenum light, GLenum pname, GLfloat * params); /* 489 */ + void (GLAPIENTRYP GetFragmentLightivSGIX)(GLenum light, GLenum pname, GLint * params); /* 490 */ + void (GLAPIENTRYP GetFragmentMaterialfvSGIX)(GLenum face, GLenum pname, GLfloat * params); /* 491 */ + void (GLAPIENTRYP GetFragmentMaterialivSGIX)(GLenum face, GLenum pname, GLint * params); /* 492 */ + void (GLAPIENTRYP LightEnviSGIX)(GLenum pname, GLint param); /* 493 */ + void (GLAPIENTRYP VertexWeightfEXT)(GLfloat weight); /* 494 */ + void (GLAPIENTRYP VertexWeightfvEXT)(const GLfloat * weight); /* 495 */ + void (GLAPIENTRYP VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 496 */ + void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 497 */ + void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 498 */ + void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 499 */ + void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 500 */ + void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 501 */ + void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 502 */ + void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 503 */ + void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 504 */ + void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 505 */ + void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 506 */ + void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 507 */ + void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 508 */ + void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 509 */ + void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 510 */ + void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 511 */ + void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 512 */ + void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 513 */ + void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 514 */ + void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 515 */ + void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 516 */ + void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 517 */ + void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 518 */ + void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 519 */ + void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 520 */ + void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 521 */ + void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 522 */ + void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 523 */ + void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 524 */ + void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 525 */ + void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 526 */ + void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 527 */ + void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 528 */ + void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 529 */ + void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 530 */ + void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 531 */ + void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 532 */ + void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 533 */ + void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 534 */ + void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 535 */ + void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 536 */ + void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 537 */ + void (GLAPIENTRYP IndexMaterialEXT)(GLenum face, GLenum mode); /* 538 */ + void (GLAPIENTRYP IndexFuncEXT)(GLenum func, GLclampf ref); /* 539 */ + void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 540 */ + void (GLAPIENTRYP UnlockArraysEXT)(void); /* 541 */ + void (GLAPIENTRYP CullParameterdvEXT)(GLenum pname, GLdouble * params); /* 542 */ + void (GLAPIENTRYP CullParameterfvEXT)(GLenum pname, GLfloat * params); /* 543 */ + void (GLAPIENTRYP HintPGI)(GLenum target, GLint mode); /* 544 */ + void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 545 */ + void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 546 */ + void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 547 */ + void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 548 */ + void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 549 */ + void (GLAPIENTRYP GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid * data); /* 550 */ + void (GLAPIENTRYP GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 551 */ + void (GLAPIENTRYP GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 552 */ + void (GLAPIENTRYP TbufferMask3DFX)(GLuint mask); /* 553 */ + void (GLAPIENTRYP CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data); /* 554 */ + void (GLAPIENTRYP CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data); /* 555 */ + void (GLAPIENTRYP CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data); /* 556 */ + void (GLAPIENTRYP CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data); /* 557 */ + void (GLAPIENTRYP CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data); /* 558 */ + void (GLAPIENTRYP CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data); /* 559 */ + void (GLAPIENTRYP GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img); /* 560 */ + void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 561 */ + void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 562 */ + void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 563 */ + void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 564 */ + void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 565 */ + void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 566 */ + void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 567 */ + void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 568 */ + void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 569 */ + void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 570 */ + void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 571 */ + void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 572 */ + void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 573 */ + void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 574 */ + void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 575 */ + void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 576 */ + void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 577 */ + GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 578 */ + void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 579 */ + void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 580 */ + void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 581 */ + void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 582 */ + void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 583 */ + void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 584 */ + void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 585 */ + void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 586 */ + void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 587 */ + void (GLAPIENTRYP GetVertexAttribdvARB)(GLuint index, GLenum pname, GLdouble * params); /* 588 */ + void (GLAPIENTRYP GetVertexAttribfvARB)(GLuint index, GLenum pname, GLfloat * params); /* 589 */ + void (GLAPIENTRYP GetVertexAttribivARB)(GLuint index, GLenum pname, GLint * params); /* 590 */ + void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** params); /* 591 */ + GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 592 */ + void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 593 */ + void (GLAPIENTRYP ProgramParameter4dNV)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 594 */ + void (GLAPIENTRYP ProgramParameter4dvNV)(GLenum target, GLuint index, const GLdouble * params); /* 595 */ + void (GLAPIENTRYP ProgramParameter4fNV)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 596 */ + void (GLAPIENTRYP ProgramParameter4fvNV)(GLenum target, GLuint index, const GLfloat * params); /* 597 */ + void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 598 */ + void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 599 */ + void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 600 */ + void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 601 */ + void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 602 */ + void (GLAPIENTRYP VertexAttrib1dARB)(GLuint index, GLdouble x); /* 603 */ + void (GLAPIENTRYP VertexAttrib1dvARB)(GLuint index, const GLdouble * v); /* 604 */ + void (GLAPIENTRYP VertexAttrib1fARB)(GLuint index, GLfloat x); /* 605 */ + void (GLAPIENTRYP VertexAttrib1fvARB)(GLuint index, const GLfloat * v); /* 606 */ + void (GLAPIENTRYP VertexAttrib1sARB)(GLuint index, GLshort x); /* 607 */ + void (GLAPIENTRYP VertexAttrib1svARB)(GLuint index, const GLshort * v); /* 608 */ + void (GLAPIENTRYP VertexAttrib2dARB)(GLuint index, GLdouble x, GLdouble y); /* 609 */ + void (GLAPIENTRYP VertexAttrib2dvARB)(GLuint index, const GLdouble * v); /* 610 */ + void (GLAPIENTRYP VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y); /* 611 */ + void (GLAPIENTRYP VertexAttrib2fvARB)(GLuint index, const GLfloat * v); /* 612 */ + void (GLAPIENTRYP VertexAttrib2sARB)(GLuint index, GLshort x, GLshort y); /* 613 */ + void (GLAPIENTRYP VertexAttrib2svARB)(GLuint index, const GLshort * v); /* 614 */ + void (GLAPIENTRYP VertexAttrib3dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 615 */ + void (GLAPIENTRYP VertexAttrib3dvARB)(GLuint index, const GLdouble * v); /* 616 */ + void (GLAPIENTRYP VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 617 */ + void (GLAPIENTRYP VertexAttrib3fvARB)(GLuint index, const GLfloat * v); /* 618 */ + void (GLAPIENTRYP VertexAttrib3sARB)(GLuint index, GLshort x, GLshort y, GLshort z); /* 619 */ + void (GLAPIENTRYP VertexAttrib3svARB)(GLuint index, const GLshort * v); /* 620 */ + void (GLAPIENTRYP VertexAttrib4dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 621 */ + void (GLAPIENTRYP VertexAttrib4dvARB)(GLuint index, const GLdouble * v); /* 622 */ + void (GLAPIENTRYP VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 623 */ + void (GLAPIENTRYP VertexAttrib4fvARB)(GLuint index, const GLfloat * v); /* 624 */ + void (GLAPIENTRYP VertexAttrib4sARB)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 625 */ + void (GLAPIENTRYP VertexAttrib4svARB)(GLuint index, const GLshort * v); /* 626 */ + void (GLAPIENTRYP VertexAttrib4NubARB)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 627 */ + void (GLAPIENTRYP VertexAttrib4NubvARB)(GLuint index, const GLubyte * v); /* 628 */ + void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 629 */ + void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 630 */ + void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 631 */ + void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 632 */ + void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 633 */ + void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 634 */ + void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 635 */ + void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 636 */ + void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 637 */ + void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 638 */ + void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 639 */ + void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 640 */ + void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 641 */ + void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 642 */ + void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 643 */ + void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount); /* 644 */ + void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 645 */ + void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 646 */ + void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 647 */ + void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 648 */ + GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 649 */ + GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 650 */ + void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 651 */ + void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 652 */ + void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 653 */ + void (GLAPIENTRYP VertexAttrib4bvARB)(GLuint index, const GLbyte * v); /* 654 */ + void (GLAPIENTRYP VertexAttrib4ivARB)(GLuint index, const GLint * v); /* 655 */ + void (GLAPIENTRYP VertexAttrib4ubvARB)(GLuint index, const GLubyte * v); /* 656 */ + void (GLAPIENTRYP VertexAttrib4usvARB)(GLuint index, const GLushort * v); /* 657 */ + void (GLAPIENTRYP VertexAttrib4uivARB)(GLuint index, const GLuint * v); /* 658 */ + void (GLAPIENTRYP VertexAttrib4NbvARB)(GLuint index, const GLbyte * v); /* 659 */ + void (GLAPIENTRYP VertexAttrib4NsvARB)(GLuint index, const GLshort * v); /* 660 */ + void (GLAPIENTRYP VertexAttrib4NivARB)(GLuint index, const GLint * v); /* 661 */ + void (GLAPIENTRYP VertexAttrib4NusvARB)(GLuint index, const GLushort * v); /* 662 */ + void (GLAPIENTRYP VertexAttrib4NuivARB)(GLuint index, const GLuint * v); /* 663 */ + void (GLAPIENTRYP VertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer); /* 664 */ + void (GLAPIENTRYP EnableVertexAttribArrayARB)(GLuint index); /* 665 */ + void (GLAPIENTRYP DisableVertexAttribArrayARB)(GLuint index); /* 666 */ + void (GLAPIENTRYP ProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid * string); /* 667 */ + void (GLAPIENTRYP ProgramEnvParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 668 */ + void (GLAPIENTRYP ProgramEnvParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 669 */ + void (GLAPIENTRYP ProgramEnvParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 670 */ + void (GLAPIENTRYP ProgramEnvParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 671 */ + void (GLAPIENTRYP ProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 672 */ + void (GLAPIENTRYP ProgramLocalParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 673 */ + void (GLAPIENTRYP ProgramLocalParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 674 */ + void (GLAPIENTRYP ProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 675 */ + void (GLAPIENTRYP GetProgramEnvParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 676 */ + void (GLAPIENTRYP GetProgramEnvParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 677 */ + void (GLAPIENTRYP GetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 678 */ + void (GLAPIENTRYP GetProgramLocalParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 679 */ + void (GLAPIENTRYP GetProgramivARB)(GLenum target, GLenum pname, GLint * params); /* 680 */ + void (GLAPIENTRYP GetProgramStringARB)(GLenum target, GLenum pname, GLvoid * string); /* 681 */ + void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 682 */ + void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 683 */ + void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 684 */ + void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 685 */ + void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 686 */ + void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 687 */ + void (GLAPIENTRYP BindBufferARB)(GLenum target, GLuint buffer); /* 688 */ + void (GLAPIENTRYP BufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); /* 689 */ + void (GLAPIENTRYP BufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); /* 690 */ + void (GLAPIENTRYP DeleteBuffersARB)(GLsizei n, const GLuint * buffer); /* 691 */ + void (GLAPIENTRYP GenBuffersARB)(GLsizei n, GLuint * buffer); /* 692 */ + void (GLAPIENTRYP GetBufferParameterivARB)(GLenum target, GLenum pname, GLint * params); /* 693 */ + void (GLAPIENTRYP GetBufferPointervARB)(GLenum target, GLenum pname, GLvoid ** params); /* 694 */ + void (GLAPIENTRYP GetBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data); /* 695 */ + GLboolean (GLAPIENTRYP IsBufferARB)(GLuint buffer); /* 696 */ + GLvoid * (GLAPIENTRYP MapBufferARB)(GLenum target, GLenum access); /* 697 */ + GLboolean (GLAPIENTRYP UnmapBufferARB)(GLenum target); /* 698 */ + void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 699 */ + void (GLAPIENTRYP GenQueriesARB)(GLsizei n, GLuint * ids); /* 700 */ + void (GLAPIENTRYP DeleteQueriesARB)(GLsizei n, const GLuint * ids); /* 701 */ + GLboolean (GLAPIENTRYP IsQueryARB)(GLuint id); /* 702 */ + void (GLAPIENTRYP BeginQueryARB)(GLenum target, GLuint id); /* 703 */ + void (GLAPIENTRYP EndQueryARB)(GLenum target); /* 704 */ + void (GLAPIENTRYP GetQueryivARB)(GLenum target, GLenum pname, GLint * params); /* 705 */ + void (GLAPIENTRYP GetQueryObjectivARB)(GLuint id, GLenum pname, GLint * params); /* 706 */ + void (GLAPIENTRYP GetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint * params); /* 707 */ + void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 708 */ + void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 709 */ + void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 710 */ + void (GLAPIENTRYP DeleteObjectARB)(GLhandleARB obj); /* 711 */ + GLhandleARB (GLAPIENTRYP GetHandleARB)(GLenum pname); /* 712 */ + void (GLAPIENTRYP DetachObjectARB)(GLhandleARB containerObj, GLhandleARB attachedObj); /* 713 */ + GLhandleARB (GLAPIENTRYP CreateShaderObjectARB)(GLenum shaderType); /* 714 */ + void (GLAPIENTRYP ShaderSourceARB)(GLhandleARB shaderObj, GLsizei count, const GLcharARB ** string, const GLint * length); /* 715 */ + void (GLAPIENTRYP CompileShaderARB)(GLhandleARB shaderObj); /* 716 */ + GLhandleARB (GLAPIENTRYP CreateProgramObjectARB)(void); /* 717 */ + void (GLAPIENTRYP AttachObjectARB)(GLhandleARB containerObj, GLhandleARB obj); /* 718 */ + void (GLAPIENTRYP LinkProgramARB)(GLhandleARB programObj); /* 719 */ + void (GLAPIENTRYP UseProgramObjectARB)(GLhandleARB programObj); /* 720 */ + void (GLAPIENTRYP ValidateProgramARB)(GLhandleARB programObj); /* 721 */ + void (GLAPIENTRYP Uniform1fARB)(GLint location, GLfloat v0); /* 722 */ + void (GLAPIENTRYP Uniform2fARB)(GLint location, GLfloat v0, GLfloat v1); /* 723 */ + void (GLAPIENTRYP Uniform3fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); /* 724 */ + void (GLAPIENTRYP Uniform4fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); /* 725 */ + void (GLAPIENTRYP Uniform1iARB)(GLint location, GLint v0); /* 726 */ + void (GLAPIENTRYP Uniform2iARB)(GLint location, GLint v0, GLint v1); /* 727 */ + void (GLAPIENTRYP Uniform3iARB)(GLint location, GLint v0, GLint v1, GLint v2); /* 728 */ + void (GLAPIENTRYP Uniform4iARB)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); /* 729 */ + void (GLAPIENTRYP Uniform1fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 730 */ + void (GLAPIENTRYP Uniform2fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 731 */ + void (GLAPIENTRYP Uniform3fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 732 */ + void (GLAPIENTRYP Uniform4fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 733 */ + void (GLAPIENTRYP Uniform1ivARB)(GLint location, GLsizei count, const GLint * value); /* 734 */ + void (GLAPIENTRYP Uniform2ivARB)(GLint location, GLsizei count, const GLint * value); /* 735 */ + void (GLAPIENTRYP Uniform3ivARB)(GLint location, GLsizei count, const GLint * value); /* 736 */ + void (GLAPIENTRYP Uniform4ivARB)(GLint location, GLsizei count, const GLint * value); /* 737 */ + void (GLAPIENTRYP UniformMatrix2fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 738 */ + void (GLAPIENTRYP UniformMatrix3fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 739 */ + void (GLAPIENTRYP UniformMatrix4fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 740 */ + void (GLAPIENTRYP GetObjectParameterfvARB)(GLhandleARB obj, GLenum pname, GLfloat * params); /* 741 */ + void (GLAPIENTRYP GetObjectParameterivARB)(GLhandleARB obj, GLenum pname, GLint * params); /* 742 */ + void (GLAPIENTRYP GetInfoLogARB)(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog); /* 743 */ + void (GLAPIENTRYP GetAttachedObjectsARB)(GLhandleARB containerObj, GLsizei maxLength, GLsizei * length, GLhandleARB * infoLog); /* 744 */ + GLint (GLAPIENTRYP GetUniformLocationARB)(GLhandleARB programObj, const GLcharARB * name); /* 745 */ + void (GLAPIENTRYP GetActiveUniformARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name); /* 746 */ + void (GLAPIENTRYP GetUniformfvARB)(GLhandleARB programObj, GLint location, GLfloat * params); /* 747 */ + void (GLAPIENTRYP GetUniformivARB)(GLhandleARB programObj, GLint location, GLint * params); /* 748 */ + void (GLAPIENTRYP GetShaderSourceARB)(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * source); /* 749 */ + void (GLAPIENTRYP BindAttribLocationARB)(GLhandleARB programObj, GLuint index, const GLcharARB * name); /* 750 */ + void (GLAPIENTRYP GetActiveAttribARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name); /* 751 */ + GLint (GLAPIENTRYP GetAttribLocationARB)(GLhandleARB programObj, const GLcharARB * name); /* 752 */ + void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 753 */ + void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 754 */ + void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 755 */ + void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 756 */ + void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 757 */ + void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 758 */ + void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 759 */ + void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 760 */ + void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 761 */ + void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 762 */ + void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 763 */ + void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 764 */ + void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 765 */ + void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 766 */ + void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 767 */ + void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 768 */ + void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 769 */ + void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 770 */ + void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 771 */ + void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 772 */ + void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 773 */ + void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 774 */ + void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 775 */ + void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 776 */ + void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 777 */ + void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 778 */ + void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 779 */ + void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 780 */ + void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 781 */ + GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 782 */ + void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 783 */ + void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 784 */ + void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 785 */ + void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 786 */ + void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 787 */ + void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 788 */ + void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 789 */ + void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 790 */ + void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 791 */ + void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 792 */ + void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 793 */ + void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 794 */ + void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 795 */ + GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 796 */ + void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 797 */ + void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 798 */ + void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 799 */ + void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 800 */ + void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 801 */ + GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 802 */ + void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 803 */ + void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 804 */ + void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 805 */ + GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 806 */ + void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 807 */ + void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 808 */ + void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 809 */ + void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 810 */ + void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 811 */ + void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 812 */ + void (GLAPIENTRYP StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); /* 813 */ + void (GLAPIENTRYP StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); /* 814 */ + void (GLAPIENTRYP StencilMaskSeparate)(GLenum face, GLuint mask); /* 815 */ +}; + +#endif /* !defined( _GLAPI_TABLE_H_ ) */ diff --git a/reactos/dll/mesa32/src/glapi/glapitemp.h b/reactos/dll/mesa32/src/glapi/glapitemp.h new file mode 100644 index 00000000000..70bb05ec6ce --- /dev/null +++ b/reactos/dll/mesa32/src/glapi/glapitemp.h @@ -0,0 +1,6175 @@ +/* DO NOT EDIT - This file generated automatically by gl_apitemp.py (from Mesa) script */ + +/* + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * (C) Copyright IBM Corporation 2004 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL, IBM, + * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + + +/* + * This file is a template which generates the OpenGL API entry point + * functions. It should be included by a .c file which first defines + * the following macros: + * KEYWORD1 - usually nothing, but might be __declspec(dllexport) on Win32 + * KEYWORD2 - usually nothing, but might be __stdcall on Win32 + * NAME(n) - builds the final function name (usually add "gl" prefix) + * DISPATCH(func, args, msg) - code to do dispatch of named function. + * msg is a printf-style debug message. + * RETURN_DISPATCH(func, args, msg) - code to do dispatch with a return value + * + * Here is an example which generates the usual OpenGL functions: + * #define KEYWORD1 + * #define KEYWORD2 + * #define NAME(func) gl##func + * #define DISPATCH(func, args, msg) \ + * struct _glapi_table *dispatch = CurrentDispatch; \ + * (*dispatch->func) args + * #define RETURN DISPATCH(func, args, msg) \ + * struct _glapi_table *dispatch = CurrentDispatch; \ + * return (*dispatch->func) args + * + */ + + +#if defined( NAME ) +#ifndef KEYWORD1 +#define KEYWORD1 +#endif + +#ifndef KEYWORD2 +#define KEYWORD2 +#endif + +#ifndef DISPATCH +#error DISPATCH must be defined +#endif + +#ifndef RETURN_DISPATCH +#error RETURN_DISPATCH must be defined +#endif + + +KEYWORD1 void KEYWORD2 NAME(NewList)(GLuint list, GLenum mode) +{ + DISPATCH(NewList, (list, mode), (F, "glNewList(%d, 0x%x);\n", list, mode)); +} + +KEYWORD1 void KEYWORD2 NAME(EndList)(void) +{ + DISPATCH(EndList, (), (F, "glEndList();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(CallList)(GLuint list) +{ + DISPATCH(CallList, (list), (F, "glCallList(%d);\n", list)); +} + +KEYWORD1 void KEYWORD2 NAME(CallLists)(GLsizei n, GLenum type, const GLvoid * lists) +{ + DISPATCH(CallLists, (n, type, lists), (F, "glCallLists(%d, 0x%x, %p);\n", n, type, (const void *) lists)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteLists)(GLuint list, GLsizei range) +{ + DISPATCH(DeleteLists, (list, range), (F, "glDeleteLists(%d, %d);\n", list, range)); +} + +KEYWORD1 GLuint KEYWORD2 NAME(GenLists)(GLsizei range) +{ + RETURN_DISPATCH(GenLists, (range), (F, "glGenLists(%d);\n", range)); +} + +KEYWORD1 void KEYWORD2 NAME(ListBase)(GLuint base) +{ + DISPATCH(ListBase, (base), (F, "glListBase(%d);\n", base)); +} + +KEYWORD1 void KEYWORD2 NAME(Begin)(GLenum mode) +{ + DISPATCH(Begin, (mode), (F, "glBegin(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap) +{ + DISPATCH(Bitmap, (width, height, xorig, yorig, xmove, ymove, bitmap), (F, "glBitmap(%d, %d, %f, %f, %f, %f, %p);\n", width, height, xorig, yorig, xmove, ymove, (const void *) bitmap)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3b)(GLbyte red, GLbyte green, GLbyte blue) +{ + DISPATCH(Color3b, (red, green, blue), (F, "glColor3b(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3bv)(const GLbyte * v) +{ + DISPATCH(Color3bv, (v), (F, "glColor3bv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3d)(GLdouble red, GLdouble green, GLdouble blue) +{ + DISPATCH(Color3d, (red, green, blue), (F, "glColor3d(%f, %f, %f);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3dv)(const GLdouble * v) +{ + DISPATCH(Color3dv, (v), (F, "glColor3dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3f)(GLfloat red, GLfloat green, GLfloat blue) +{ + DISPATCH(Color3f, (red, green, blue), (F, "glColor3f(%f, %f, %f);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3fv)(const GLfloat * v) +{ + DISPATCH(Color3fv, (v), (F, "glColor3fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3i)(GLint red, GLint green, GLint blue) +{ + DISPATCH(Color3i, (red, green, blue), (F, "glColor3i(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3iv)(const GLint * v) +{ + DISPATCH(Color3iv, (v), (F, "glColor3iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3s)(GLshort red, GLshort green, GLshort blue) +{ + DISPATCH(Color3s, (red, green, blue), (F, "glColor3s(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3sv)(const GLshort * v) +{ + DISPATCH(Color3sv, (v), (F, "glColor3sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3ub)(GLubyte red, GLubyte green, GLubyte blue) +{ + DISPATCH(Color3ub, (red, green, blue), (F, "glColor3ub(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3ubv)(const GLubyte * v) +{ + DISPATCH(Color3ubv, (v), (F, "glColor3ubv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3ui)(GLuint red, GLuint green, GLuint blue) +{ + DISPATCH(Color3ui, (red, green, blue), (F, "glColor3ui(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3uiv)(const GLuint * v) +{ + DISPATCH(Color3uiv, (v), (F, "glColor3uiv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3us)(GLushort red, GLushort green, GLushort blue) +{ + DISPATCH(Color3us, (red, green, blue), (F, "glColor3us(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(Color3usv)(const GLushort * v) +{ + DISPATCH(Color3usv, (v), (F, "glColor3usv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha) +{ + DISPATCH(Color4b, (red, green, blue, alpha), (F, "glColor4b(%d, %d, %d, %d);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4bv)(const GLbyte * v) +{ + DISPATCH(Color4bv, (v), (F, "glColor4bv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) +{ + DISPATCH(Color4d, (red, green, blue, alpha), (F, "glColor4d(%f, %f, %f, %f);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4dv)(const GLdouble * v) +{ + DISPATCH(Color4dv, (v), (F, "glColor4dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) +{ + DISPATCH(Color4f, (red, green, blue, alpha), (F, "glColor4f(%f, %f, %f, %f);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4fv)(const GLfloat * v) +{ + DISPATCH(Color4fv, (v), (F, "glColor4fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4i)(GLint red, GLint green, GLint blue, GLint alpha) +{ + DISPATCH(Color4i, (red, green, blue, alpha), (F, "glColor4i(%d, %d, %d, %d);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4iv)(const GLint * v) +{ + DISPATCH(Color4iv, (v), (F, "glColor4iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha) +{ + DISPATCH(Color4s, (red, green, blue, alpha), (F, "glColor4s(%d, %d, %d, %d);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4sv)(const GLshort * v) +{ + DISPATCH(Color4sv, (v), (F, "glColor4sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) +{ + DISPATCH(Color4ub, (red, green, blue, alpha), (F, "glColor4ub(%d, %d, %d, %d);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4ubv)(const GLubyte * v) +{ + DISPATCH(Color4ubv, (v), (F, "glColor4ubv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha) +{ + DISPATCH(Color4ui, (red, green, blue, alpha), (F, "glColor4ui(%d, %d, %d, %d);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4uiv)(const GLuint * v) +{ + DISPATCH(Color4uiv, (v), (F, "glColor4uiv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha) +{ + DISPATCH(Color4us, (red, green, blue, alpha), (F, "glColor4us(%d, %d, %d, %d);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4usv)(const GLushort * v) +{ + DISPATCH(Color4usv, (v), (F, "glColor4usv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(EdgeFlag)(GLboolean flag) +{ + DISPATCH(EdgeFlag, (flag), (F, "glEdgeFlag(%d);\n", flag)); +} + +KEYWORD1 void KEYWORD2 NAME(EdgeFlagv)(const GLboolean * flag) +{ + DISPATCH(EdgeFlagv, (flag), (F, "glEdgeFlagv(%p);\n", (const void *) flag)); +} + +KEYWORD1 void KEYWORD2 NAME(End)(void) +{ + DISPATCH(End, (), (F, "glEnd();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(Indexd)(GLdouble c) +{ + DISPATCH(Indexd, (c), (F, "glIndexd(%f);\n", c)); +} + +KEYWORD1 void KEYWORD2 NAME(Indexdv)(const GLdouble * c) +{ + DISPATCH(Indexdv, (c), (F, "glIndexdv(%p);\n", (const void *) c)); +} + +KEYWORD1 void KEYWORD2 NAME(Indexf)(GLfloat c) +{ + DISPATCH(Indexf, (c), (F, "glIndexf(%f);\n", c)); +} + +KEYWORD1 void KEYWORD2 NAME(Indexfv)(const GLfloat * c) +{ + DISPATCH(Indexfv, (c), (F, "glIndexfv(%p);\n", (const void *) c)); +} + +KEYWORD1 void KEYWORD2 NAME(Indexi)(GLint c) +{ + DISPATCH(Indexi, (c), (F, "glIndexi(%d);\n", c)); +} + +KEYWORD1 void KEYWORD2 NAME(Indexiv)(const GLint * c) +{ + DISPATCH(Indexiv, (c), (F, "glIndexiv(%p);\n", (const void *) c)); +} + +KEYWORD1 void KEYWORD2 NAME(Indexs)(GLshort c) +{ + DISPATCH(Indexs, (c), (F, "glIndexs(%d);\n", c)); +} + +KEYWORD1 void KEYWORD2 NAME(Indexsv)(const GLshort * c) +{ + DISPATCH(Indexsv, (c), (F, "glIndexsv(%p);\n", (const void *) c)); +} + +KEYWORD1 void KEYWORD2 NAME(Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz) +{ + DISPATCH(Normal3b, (nx, ny, nz), (F, "glNormal3b(%d, %d, %d);\n", nx, ny, nz)); +} + +KEYWORD1 void KEYWORD2 NAME(Normal3bv)(const GLbyte * v) +{ + DISPATCH(Normal3bv, (v), (F, "glNormal3bv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz) +{ + DISPATCH(Normal3d, (nx, ny, nz), (F, "glNormal3d(%f, %f, %f);\n", nx, ny, nz)); +} + +KEYWORD1 void KEYWORD2 NAME(Normal3dv)(const GLdouble * v) +{ + DISPATCH(Normal3dv, (v), (F, "glNormal3dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz) +{ + DISPATCH(Normal3f, (nx, ny, nz), (F, "glNormal3f(%f, %f, %f);\n", nx, ny, nz)); +} + +KEYWORD1 void KEYWORD2 NAME(Normal3fv)(const GLfloat * v) +{ + DISPATCH(Normal3fv, (v), (F, "glNormal3fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Normal3i)(GLint nx, GLint ny, GLint nz) +{ + DISPATCH(Normal3i, (nx, ny, nz), (F, "glNormal3i(%d, %d, %d);\n", nx, ny, nz)); +} + +KEYWORD1 void KEYWORD2 NAME(Normal3iv)(const GLint * v) +{ + DISPATCH(Normal3iv, (v), (F, "glNormal3iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Normal3s)(GLshort nx, GLshort ny, GLshort nz) +{ + DISPATCH(Normal3s, (nx, ny, nz), (F, "glNormal3s(%d, %d, %d);\n", nx, ny, nz)); +} + +KEYWORD1 void KEYWORD2 NAME(Normal3sv)(const GLshort * v) +{ + DISPATCH(Normal3sv, (v), (F, "glNormal3sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos2d)(GLdouble x, GLdouble y) +{ + DISPATCH(RasterPos2d, (x, y), (F, "glRasterPos2d(%f, %f);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos2dv)(const GLdouble * v) +{ + DISPATCH(RasterPos2dv, (v), (F, "glRasterPos2dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos2f)(GLfloat x, GLfloat y) +{ + DISPATCH(RasterPos2f, (x, y), (F, "glRasterPos2f(%f, %f);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos2fv)(const GLfloat * v) +{ + DISPATCH(RasterPos2fv, (v), (F, "glRasterPos2fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos2i)(GLint x, GLint y) +{ + DISPATCH(RasterPos2i, (x, y), (F, "glRasterPos2i(%d, %d);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos2iv)(const GLint * v) +{ + DISPATCH(RasterPos2iv, (v), (F, "glRasterPos2iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos2s)(GLshort x, GLshort y) +{ + DISPATCH(RasterPos2s, (x, y), (F, "glRasterPos2s(%d, %d);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos2sv)(const GLshort * v) +{ + DISPATCH(RasterPos2sv, (v), (F, "glRasterPos2sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos3d)(GLdouble x, GLdouble y, GLdouble z) +{ + DISPATCH(RasterPos3d, (x, y, z), (F, "glRasterPos3d(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos3dv)(const GLdouble * v) +{ + DISPATCH(RasterPos3dv, (v), (F, "glRasterPos3dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos3f)(GLfloat x, GLfloat y, GLfloat z) +{ + DISPATCH(RasterPos3f, (x, y, z), (F, "glRasterPos3f(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos3fv)(const GLfloat * v) +{ + DISPATCH(RasterPos3fv, (v), (F, "glRasterPos3fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos3i)(GLint x, GLint y, GLint z) +{ + DISPATCH(RasterPos3i, (x, y, z), (F, "glRasterPos3i(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos3iv)(const GLint * v) +{ + DISPATCH(RasterPos3iv, (v), (F, "glRasterPos3iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos3s)(GLshort x, GLshort y, GLshort z) +{ + DISPATCH(RasterPos3s, (x, y, z), (F, "glRasterPos3s(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos3sv)(const GLshort * v) +{ + DISPATCH(RasterPos3sv, (v), (F, "glRasterPos3sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + DISPATCH(RasterPos4d, (x, y, z, w), (F, "glRasterPos4d(%f, %f, %f, %f);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos4dv)(const GLdouble * v) +{ + DISPATCH(RasterPos4dv, (v), (F, "glRasterPos4dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + DISPATCH(RasterPos4f, (x, y, z, w), (F, "glRasterPos4f(%f, %f, %f, %f);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos4fv)(const GLfloat * v) +{ + DISPATCH(RasterPos4fv, (v), (F, "glRasterPos4fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos4i)(GLint x, GLint y, GLint z, GLint w) +{ + DISPATCH(RasterPos4i, (x, y, z, w), (F, "glRasterPos4i(%d, %d, %d, %d);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos4iv)(const GLint * v) +{ + DISPATCH(RasterPos4iv, (v), (F, "glRasterPos4iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w) +{ + DISPATCH(RasterPos4s, (x, y, z, w), (F, "glRasterPos4s(%d, %d, %d, %d);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos4sv)(const GLshort * v) +{ + DISPATCH(RasterPos4sv, (v), (F, "glRasterPos4sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) +{ + DISPATCH(Rectd, (x1, y1, x2, y2), (F, "glRectd(%f, %f, %f, %f);\n", x1, y1, x2, y2)); +} + +KEYWORD1 void KEYWORD2 NAME(Rectdv)(const GLdouble * v1, const GLdouble * v2) +{ + DISPATCH(Rectdv, (v1, v2), (F, "glRectdv(%p, %p);\n", (const void *) v1, (const void *) v2)); +} + +KEYWORD1 void KEYWORD2 NAME(Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) +{ + DISPATCH(Rectf, (x1, y1, x2, y2), (F, "glRectf(%f, %f, %f, %f);\n", x1, y1, x2, y2)); +} + +KEYWORD1 void KEYWORD2 NAME(Rectfv)(const GLfloat * v1, const GLfloat * v2) +{ + DISPATCH(Rectfv, (v1, v2), (F, "glRectfv(%p, %p);\n", (const void *) v1, (const void *) v2)); +} + +KEYWORD1 void KEYWORD2 NAME(Recti)(GLint x1, GLint y1, GLint x2, GLint y2) +{ + DISPATCH(Recti, (x1, y1, x2, y2), (F, "glRecti(%d, %d, %d, %d);\n", x1, y1, x2, y2)); +} + +KEYWORD1 void KEYWORD2 NAME(Rectiv)(const GLint * v1, const GLint * v2) +{ + DISPATCH(Rectiv, (v1, v2), (F, "glRectiv(%p, %p);\n", (const void *) v1, (const void *) v2)); +} + +KEYWORD1 void KEYWORD2 NAME(Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2) +{ + DISPATCH(Rects, (x1, y1, x2, y2), (F, "glRects(%d, %d, %d, %d);\n", x1, y1, x2, y2)); +} + +KEYWORD1 void KEYWORD2 NAME(Rectsv)(const GLshort * v1, const GLshort * v2) +{ + DISPATCH(Rectsv, (v1, v2), (F, "glRectsv(%p, %p);\n", (const void *) v1, (const void *) v2)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord1d)(GLdouble s) +{ + DISPATCH(TexCoord1d, (s), (F, "glTexCoord1d(%f);\n", s)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord1dv)(const GLdouble * v) +{ + DISPATCH(TexCoord1dv, (v), (F, "glTexCoord1dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord1f)(GLfloat s) +{ + DISPATCH(TexCoord1f, (s), (F, "glTexCoord1f(%f);\n", s)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord1fv)(const GLfloat * v) +{ + DISPATCH(TexCoord1fv, (v), (F, "glTexCoord1fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord1i)(GLint s) +{ + DISPATCH(TexCoord1i, (s), (F, "glTexCoord1i(%d);\n", s)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord1iv)(const GLint * v) +{ + DISPATCH(TexCoord1iv, (v), (F, "glTexCoord1iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord1s)(GLshort s) +{ + DISPATCH(TexCoord1s, (s), (F, "glTexCoord1s(%d);\n", s)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord1sv)(const GLshort * v) +{ + DISPATCH(TexCoord1sv, (v), (F, "glTexCoord1sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord2d)(GLdouble s, GLdouble t) +{ + DISPATCH(TexCoord2d, (s, t), (F, "glTexCoord2d(%f, %f);\n", s, t)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord2dv)(const GLdouble * v) +{ + DISPATCH(TexCoord2dv, (v), (F, "glTexCoord2dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord2f)(GLfloat s, GLfloat t) +{ + DISPATCH(TexCoord2f, (s, t), (F, "glTexCoord2f(%f, %f);\n", s, t)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord2fv)(const GLfloat * v) +{ + DISPATCH(TexCoord2fv, (v), (F, "glTexCoord2fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord2i)(GLint s, GLint t) +{ + DISPATCH(TexCoord2i, (s, t), (F, "glTexCoord2i(%d, %d);\n", s, t)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord2iv)(const GLint * v) +{ + DISPATCH(TexCoord2iv, (v), (F, "glTexCoord2iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord2s)(GLshort s, GLshort t) +{ + DISPATCH(TexCoord2s, (s, t), (F, "glTexCoord2s(%d, %d);\n", s, t)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord2sv)(const GLshort * v) +{ + DISPATCH(TexCoord2sv, (v), (F, "glTexCoord2sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord3d)(GLdouble s, GLdouble t, GLdouble r) +{ + DISPATCH(TexCoord3d, (s, t, r), (F, "glTexCoord3d(%f, %f, %f);\n", s, t, r)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord3dv)(const GLdouble * v) +{ + DISPATCH(TexCoord3dv, (v), (F, "glTexCoord3dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord3f)(GLfloat s, GLfloat t, GLfloat r) +{ + DISPATCH(TexCoord3f, (s, t, r), (F, "glTexCoord3f(%f, %f, %f);\n", s, t, r)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord3fv)(const GLfloat * v) +{ + DISPATCH(TexCoord3fv, (v), (F, "glTexCoord3fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord3i)(GLint s, GLint t, GLint r) +{ + DISPATCH(TexCoord3i, (s, t, r), (F, "glTexCoord3i(%d, %d, %d);\n", s, t, r)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord3iv)(const GLint * v) +{ + DISPATCH(TexCoord3iv, (v), (F, "glTexCoord3iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord3s)(GLshort s, GLshort t, GLshort r) +{ + DISPATCH(TexCoord3s, (s, t, r), (F, "glTexCoord3s(%d, %d, %d);\n", s, t, r)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord3sv)(const GLshort * v) +{ + DISPATCH(TexCoord3sv, (v), (F, "glTexCoord3sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q) +{ + DISPATCH(TexCoord4d, (s, t, r, q), (F, "glTexCoord4d(%f, %f, %f, %f);\n", s, t, r, q)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord4dv)(const GLdouble * v) +{ + DISPATCH(TexCoord4dv, (v), (F, "glTexCoord4dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q) +{ + DISPATCH(TexCoord4f, (s, t, r, q), (F, "glTexCoord4f(%f, %f, %f, %f);\n", s, t, r, q)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord4fv)(const GLfloat * v) +{ + DISPATCH(TexCoord4fv, (v), (F, "glTexCoord4fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord4i)(GLint s, GLint t, GLint r, GLint q) +{ + DISPATCH(TexCoord4i, (s, t, r, q), (F, "glTexCoord4i(%d, %d, %d, %d);\n", s, t, r, q)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord4iv)(const GLint * v) +{ + DISPATCH(TexCoord4iv, (v), (F, "glTexCoord4iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q) +{ + DISPATCH(TexCoord4s, (s, t, r, q), (F, "glTexCoord4s(%d, %d, %d, %d);\n", s, t, r, q)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoord4sv)(const GLshort * v) +{ + DISPATCH(TexCoord4sv, (v), (F, "glTexCoord4sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex2d)(GLdouble x, GLdouble y) +{ + DISPATCH(Vertex2d, (x, y), (F, "glVertex2d(%f, %f);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex2dv)(const GLdouble * v) +{ + DISPATCH(Vertex2dv, (v), (F, "glVertex2dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex2f)(GLfloat x, GLfloat y) +{ + DISPATCH(Vertex2f, (x, y), (F, "glVertex2f(%f, %f);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex2fv)(const GLfloat * v) +{ + DISPATCH(Vertex2fv, (v), (F, "glVertex2fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex2i)(GLint x, GLint y) +{ + DISPATCH(Vertex2i, (x, y), (F, "glVertex2i(%d, %d);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex2iv)(const GLint * v) +{ + DISPATCH(Vertex2iv, (v), (F, "glVertex2iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex2s)(GLshort x, GLshort y) +{ + DISPATCH(Vertex2s, (x, y), (F, "glVertex2s(%d, %d);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex2sv)(const GLshort * v) +{ + DISPATCH(Vertex2sv, (v), (F, "glVertex2sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex3d)(GLdouble x, GLdouble y, GLdouble z) +{ + DISPATCH(Vertex3d, (x, y, z), (F, "glVertex3d(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex3dv)(const GLdouble * v) +{ + DISPATCH(Vertex3dv, (v), (F, "glVertex3dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex3f)(GLfloat x, GLfloat y, GLfloat z) +{ + DISPATCH(Vertex3f, (x, y, z), (F, "glVertex3f(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex3fv)(const GLfloat * v) +{ + DISPATCH(Vertex3fv, (v), (F, "glVertex3fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex3i)(GLint x, GLint y, GLint z) +{ + DISPATCH(Vertex3i, (x, y, z), (F, "glVertex3i(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex3iv)(const GLint * v) +{ + DISPATCH(Vertex3iv, (v), (F, "glVertex3iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex3s)(GLshort x, GLshort y, GLshort z) +{ + DISPATCH(Vertex3s, (x, y, z), (F, "glVertex3s(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex3sv)(const GLshort * v) +{ + DISPATCH(Vertex3sv, (v), (F, "glVertex3sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + DISPATCH(Vertex4d, (x, y, z, w), (F, "glVertex4d(%f, %f, %f, %f);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4dv)(const GLdouble * v) +{ + DISPATCH(Vertex4dv, (v), (F, "glVertex4dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + DISPATCH(Vertex4f, (x, y, z, w), (F, "glVertex4f(%f, %f, %f, %f);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4fv)(const GLfloat * v) +{ + DISPATCH(Vertex4fv, (v), (F, "glVertex4fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4i)(GLint x, GLint y, GLint z, GLint w) +{ + DISPATCH(Vertex4i, (x, y, z, w), (F, "glVertex4i(%d, %d, %d, %d);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4iv)(const GLint * v) +{ + DISPATCH(Vertex4iv, (v), (F, "glVertex4iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w) +{ + DISPATCH(Vertex4s, (x, y, z, w), (F, "glVertex4s(%d, %d, %d, %d);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4sv)(const GLshort * v) +{ + DISPATCH(Vertex4sv, (v), (F, "glVertex4sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(ClipPlane)(GLenum plane, const GLdouble * equation) +{ + DISPATCH(ClipPlane, (plane, equation), (F, "glClipPlane(0x%x, %p);\n", plane, (const void *) equation)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorMaterial)(GLenum face, GLenum mode) +{ + DISPATCH(ColorMaterial, (face, mode), (F, "glColorMaterial(0x%x, 0x%x);\n", face, mode)); +} + +KEYWORD1 void KEYWORD2 NAME(CullFace)(GLenum mode) +{ + DISPATCH(CullFace, (mode), (F, "glCullFace(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(Fogf)(GLenum pname, GLfloat param) +{ + DISPATCH(Fogf, (pname, param), (F, "glFogf(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(Fogfv)(GLenum pname, const GLfloat * params) +{ + DISPATCH(Fogfv, (pname, params), (F, "glFogfv(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(Fogi)(GLenum pname, GLint param) +{ + DISPATCH(Fogi, (pname, param), (F, "glFogi(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(Fogiv)(GLenum pname, const GLint * params) +{ + DISPATCH(Fogiv, (pname, params), (F, "glFogiv(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(FrontFace)(GLenum mode) +{ + DISPATCH(FrontFace, (mode), (F, "glFrontFace(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(Hint)(GLenum target, GLenum mode) +{ + DISPATCH(Hint, (target, mode), (F, "glHint(0x%x, 0x%x);\n", target, mode)); +} + +KEYWORD1 void KEYWORD2 NAME(Lightf)(GLenum light, GLenum pname, GLfloat param) +{ + DISPATCH(Lightf, (light, pname, param), (F, "glLightf(0x%x, 0x%x, %f);\n", light, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(Lightfv)(GLenum light, GLenum pname, const GLfloat * params) +{ + DISPATCH(Lightfv, (light, pname, params), (F, "glLightfv(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(Lighti)(GLenum light, GLenum pname, GLint param) +{ + DISPATCH(Lighti, (light, pname, param), (F, "glLighti(0x%x, 0x%x, %d);\n", light, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(Lightiv)(GLenum light, GLenum pname, const GLint * params) +{ + DISPATCH(Lightiv, (light, pname, params), (F, "glLightiv(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(LightModelf)(GLenum pname, GLfloat param) +{ + DISPATCH(LightModelf, (pname, param), (F, "glLightModelf(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(LightModelfv)(GLenum pname, const GLfloat * params) +{ + DISPATCH(LightModelfv, (pname, params), (F, "glLightModelfv(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(LightModeli)(GLenum pname, GLint param) +{ + DISPATCH(LightModeli, (pname, param), (F, "glLightModeli(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(LightModeliv)(GLenum pname, const GLint * params) +{ + DISPATCH(LightModeliv, (pname, params), (F, "glLightModeliv(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(LineStipple)(GLint factor, GLushort pattern) +{ + DISPATCH(LineStipple, (factor, pattern), (F, "glLineStipple(%d, %d);\n", factor, pattern)); +} + +KEYWORD1 void KEYWORD2 NAME(LineWidth)(GLfloat width) +{ + DISPATCH(LineWidth, (width), (F, "glLineWidth(%f);\n", width)); +} + +KEYWORD1 void KEYWORD2 NAME(Materialf)(GLenum face, GLenum pname, GLfloat param) +{ + DISPATCH(Materialf, (face, pname, param), (F, "glMaterialf(0x%x, 0x%x, %f);\n", face, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(Materialfv)(GLenum face, GLenum pname, const GLfloat * params) +{ + DISPATCH(Materialfv, (face, pname, params), (F, "glMaterialfv(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(Materiali)(GLenum face, GLenum pname, GLint param) +{ + DISPATCH(Materiali, (face, pname, param), (F, "glMateriali(0x%x, 0x%x, %d);\n", face, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(Materialiv)(GLenum face, GLenum pname, const GLint * params) +{ + DISPATCH(Materialiv, (face, pname, params), (F, "glMaterialiv(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(PointSize)(GLfloat size) +{ + DISPATCH(PointSize, (size), (F, "glPointSize(%f);\n", size)); +} + +KEYWORD1 void KEYWORD2 NAME(PolygonMode)(GLenum face, GLenum mode) +{ + DISPATCH(PolygonMode, (face, mode), (F, "glPolygonMode(0x%x, 0x%x);\n", face, mode)); +} + +KEYWORD1 void KEYWORD2 NAME(PolygonStipple)(const GLubyte * mask) +{ + DISPATCH(PolygonStipple, (mask), (F, "glPolygonStipple(%p);\n", (const void *) mask)); +} + +KEYWORD1 void KEYWORD2 NAME(Scissor)(GLint x, GLint y, GLsizei width, GLsizei height) +{ + DISPATCH(Scissor, (x, y, width, height), (F, "glScissor(%d, %d, %d, %d);\n", x, y, width, height)); +} + +KEYWORD1 void KEYWORD2 NAME(ShadeModel)(GLenum mode) +{ + DISPATCH(ShadeModel, (mode), (F, "glShadeModel(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(TexParameterf)(GLenum target, GLenum pname, GLfloat param) +{ + DISPATCH(TexParameterf, (target, pname, param), (F, "glTexParameterf(0x%x, 0x%x, %f);\n", target, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(TexParameterfv)(GLenum target, GLenum pname, const GLfloat * params) +{ + DISPATCH(TexParameterfv, (target, pname, params), (F, "glTexParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(TexParameteri)(GLenum target, GLenum pname, GLint param) +{ + DISPATCH(TexParameteri, (target, pname, param), (F, "glTexParameteri(0x%x, 0x%x, %d);\n", target, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(TexParameteriv)(GLenum target, GLenum pname, const GLint * params) +{ + DISPATCH(TexParameteriv, (target, pname, params), (F, "glTexParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels) +{ + DISPATCH(TexImage1D, (target, level, internalformat, width, border, format, type, pixels), (F, "glTexImage1D(0x%x, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, border, format, type, (const void *) pixels)); +} + +KEYWORD1 void KEYWORD2 NAME(TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels) +{ + DISPATCH(TexImage2D, (target, level, internalformat, width, height, border, format, type, pixels), (F, "glTexImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, border, format, type, (const void *) pixels)); +} + +KEYWORD1 void KEYWORD2 NAME(TexEnvf)(GLenum target, GLenum pname, GLfloat param) +{ + DISPATCH(TexEnvf, (target, pname, param), (F, "glTexEnvf(0x%x, 0x%x, %f);\n", target, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(TexEnvfv)(GLenum target, GLenum pname, const GLfloat * params) +{ + DISPATCH(TexEnvfv, (target, pname, params), (F, "glTexEnvfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(TexEnvi)(GLenum target, GLenum pname, GLint param) +{ + DISPATCH(TexEnvi, (target, pname, param), (F, "glTexEnvi(0x%x, 0x%x, %d);\n", target, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(TexEnviv)(GLenum target, GLenum pname, const GLint * params) +{ + DISPATCH(TexEnviv, (target, pname, params), (F, "glTexEnviv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(TexGend)(GLenum coord, GLenum pname, GLdouble param) +{ + DISPATCH(TexGend, (coord, pname, param), (F, "glTexGend(0x%x, 0x%x, %f);\n", coord, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(TexGendv)(GLenum coord, GLenum pname, const GLdouble * params) +{ + DISPATCH(TexGendv, (coord, pname, params), (F, "glTexGendv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(TexGenf)(GLenum coord, GLenum pname, GLfloat param) +{ + DISPATCH(TexGenf, (coord, pname, param), (F, "glTexGenf(0x%x, 0x%x, %f);\n", coord, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(TexGenfv)(GLenum coord, GLenum pname, const GLfloat * params) +{ + DISPATCH(TexGenfv, (coord, pname, params), (F, "glTexGenfv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(TexGeni)(GLenum coord, GLenum pname, GLint param) +{ + DISPATCH(TexGeni, (coord, pname, param), (F, "glTexGeni(0x%x, 0x%x, %d);\n", coord, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(TexGeniv)(GLenum coord, GLenum pname, const GLint * params) +{ + DISPATCH(TexGeniv, (coord, pname, params), (F, "glTexGeniv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(FeedbackBuffer)(GLsizei size, GLenum type, GLfloat * buffer) +{ + DISPATCH(FeedbackBuffer, (size, type, buffer), (F, "glFeedbackBuffer(%d, 0x%x, %p);\n", size, type, (const void *) buffer)); +} + +KEYWORD1 void KEYWORD2 NAME(SelectBuffer)(GLsizei size, GLuint * buffer) +{ + DISPATCH(SelectBuffer, (size, buffer), (F, "glSelectBuffer(%d, %p);\n", size, (const void *) buffer)); +} + +KEYWORD1 GLint KEYWORD2 NAME(RenderMode)(GLenum mode) +{ + RETURN_DISPATCH(RenderMode, (mode), (F, "glRenderMode(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(InitNames)(void) +{ + DISPATCH(InitNames, (), (F, "glInitNames();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(LoadName)(GLuint name) +{ + DISPATCH(LoadName, (name), (F, "glLoadName(%d);\n", name)); +} + +KEYWORD1 void KEYWORD2 NAME(PassThrough)(GLfloat token) +{ + DISPATCH(PassThrough, (token), (F, "glPassThrough(%f);\n", token)); +} + +KEYWORD1 void KEYWORD2 NAME(PopName)(void) +{ + DISPATCH(PopName, (), (F, "glPopName();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(PushName)(GLuint name) +{ + DISPATCH(PushName, (name), (F, "glPushName(%d);\n", name)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawBuffer)(GLenum mode) +{ + DISPATCH(DrawBuffer, (mode), (F, "glDrawBuffer(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(Clear)(GLbitfield mask) +{ + DISPATCH(Clear, (mask), (F, "glClear(%d);\n", mask)); +} + +KEYWORD1 void KEYWORD2 NAME(ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) +{ + DISPATCH(ClearAccum, (red, green, blue, alpha), (F, "glClearAccum(%f, %f, %f, %f);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(ClearIndex)(GLfloat c) +{ + DISPATCH(ClearIndex, (c), (F, "glClearIndex(%f);\n", c)); +} + +KEYWORD1 void KEYWORD2 NAME(ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + DISPATCH(ClearColor, (red, green, blue, alpha), (F, "glClearColor(%f, %f, %f, %f);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(ClearStencil)(GLint s) +{ + DISPATCH(ClearStencil, (s), (F, "glClearStencil(%d);\n", s)); +} + +KEYWORD1 void KEYWORD2 NAME(ClearDepth)(GLclampd depth) +{ + DISPATCH(ClearDepth, (depth), (F, "glClearDepth(%f);\n", depth)); +} + +KEYWORD1 void KEYWORD2 NAME(StencilMask)(GLuint mask) +{ + DISPATCH(StencilMask, (mask), (F, "glStencilMask(%d);\n", mask)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) +{ + DISPATCH(ColorMask, (red, green, blue, alpha), (F, "glColorMask(%d, %d, %d, %d);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(DepthMask)(GLboolean flag) +{ + DISPATCH(DepthMask, (flag), (F, "glDepthMask(%d);\n", flag)); +} + +KEYWORD1 void KEYWORD2 NAME(IndexMask)(GLuint mask) +{ + DISPATCH(IndexMask, (mask), (F, "glIndexMask(%d);\n", mask)); +} + +KEYWORD1 void KEYWORD2 NAME(Accum)(GLenum op, GLfloat value) +{ + DISPATCH(Accum, (op, value), (F, "glAccum(0x%x, %f);\n", op, value)); +} + +KEYWORD1 void KEYWORD2 NAME(Disable)(GLenum cap) +{ + DISPATCH(Disable, (cap), (F, "glDisable(0x%x);\n", cap)); +} + +KEYWORD1 void KEYWORD2 NAME(Enable)(GLenum cap) +{ + DISPATCH(Enable, (cap), (F, "glEnable(0x%x);\n", cap)); +} + +KEYWORD1 void KEYWORD2 NAME(Finish)(void) +{ + DISPATCH(Finish, (), (F, "glFinish();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(Flush)(void) +{ + DISPATCH(Flush, (), (F, "glFlush();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(PopAttrib)(void) +{ + DISPATCH(PopAttrib, (), (F, "glPopAttrib();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(PushAttrib)(GLbitfield mask) +{ + DISPATCH(PushAttrib, (mask), (F, "glPushAttrib(%d);\n", mask)); +} + +KEYWORD1 void KEYWORD2 NAME(Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points) +{ + DISPATCH(Map1d, (target, u1, u2, stride, order, points), (F, "glMap1d(0x%x, %f, %f, %d, %d, %p);\n", target, u1, u2, stride, order, (const void *) points)); +} + +KEYWORD1 void KEYWORD2 NAME(Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points) +{ + DISPATCH(Map1f, (target, u1, u2, stride, order, points), (F, "glMap1f(0x%x, %f, %f, %d, %d, %p);\n", target, u1, u2, stride, order, (const void *) points)); +} + +KEYWORD1 void KEYWORD2 NAME(Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points) +{ + DISPATCH(Map2d, (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points), (F, "glMap2d(0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p);\n", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, (const void *) points)); +} + +KEYWORD1 void KEYWORD2 NAME(Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points) +{ + DISPATCH(Map2f, (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points), (F, "glMap2f(0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p);\n", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, (const void *) points)); +} + +KEYWORD1 void KEYWORD2 NAME(MapGrid1d)(GLint un, GLdouble u1, GLdouble u2) +{ + DISPATCH(MapGrid1d, (un, u1, u2), (F, "glMapGrid1d(%d, %f, %f);\n", un, u1, u2)); +} + +KEYWORD1 void KEYWORD2 NAME(MapGrid1f)(GLint un, GLfloat u1, GLfloat u2) +{ + DISPATCH(MapGrid1f, (un, u1, u2), (F, "glMapGrid1f(%d, %f, %f);\n", un, u1, u2)); +} + +KEYWORD1 void KEYWORD2 NAME(MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2) +{ + DISPATCH(MapGrid2d, (un, u1, u2, vn, v1, v2), (F, "glMapGrid2d(%d, %f, %f, %d, %f, %f);\n", un, u1, u2, vn, v1, v2)); +} + +KEYWORD1 void KEYWORD2 NAME(MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2) +{ + DISPATCH(MapGrid2f, (un, u1, u2, vn, v1, v2), (F, "glMapGrid2f(%d, %f, %f, %d, %f, %f);\n", un, u1, u2, vn, v1, v2)); +} + +KEYWORD1 void KEYWORD2 NAME(EvalCoord1d)(GLdouble u) +{ + DISPATCH(EvalCoord1d, (u), (F, "glEvalCoord1d(%f);\n", u)); +} + +KEYWORD1 void KEYWORD2 NAME(EvalCoord1dv)(const GLdouble * u) +{ + DISPATCH(EvalCoord1dv, (u), (F, "glEvalCoord1dv(%p);\n", (const void *) u)); +} + +KEYWORD1 void KEYWORD2 NAME(EvalCoord1f)(GLfloat u) +{ + DISPATCH(EvalCoord1f, (u), (F, "glEvalCoord1f(%f);\n", u)); +} + +KEYWORD1 void KEYWORD2 NAME(EvalCoord1fv)(const GLfloat * u) +{ + DISPATCH(EvalCoord1fv, (u), (F, "glEvalCoord1fv(%p);\n", (const void *) u)); +} + +KEYWORD1 void KEYWORD2 NAME(EvalCoord2d)(GLdouble u, GLdouble v) +{ + DISPATCH(EvalCoord2d, (u, v), (F, "glEvalCoord2d(%f, %f);\n", u, v)); +} + +KEYWORD1 void KEYWORD2 NAME(EvalCoord2dv)(const GLdouble * u) +{ + DISPATCH(EvalCoord2dv, (u), (F, "glEvalCoord2dv(%p);\n", (const void *) u)); +} + +KEYWORD1 void KEYWORD2 NAME(EvalCoord2f)(GLfloat u, GLfloat v) +{ + DISPATCH(EvalCoord2f, (u, v), (F, "glEvalCoord2f(%f, %f);\n", u, v)); +} + +KEYWORD1 void KEYWORD2 NAME(EvalCoord2fv)(const GLfloat * u) +{ + DISPATCH(EvalCoord2fv, (u), (F, "glEvalCoord2fv(%p);\n", (const void *) u)); +} + +KEYWORD1 void KEYWORD2 NAME(EvalMesh1)(GLenum mode, GLint i1, GLint i2) +{ + DISPATCH(EvalMesh1, (mode, i1, i2), (F, "glEvalMesh1(0x%x, %d, %d);\n", mode, i1, i2)); +} + +KEYWORD1 void KEYWORD2 NAME(EvalPoint1)(GLint i) +{ + DISPATCH(EvalPoint1, (i), (F, "glEvalPoint1(%d);\n", i)); +} + +KEYWORD1 void KEYWORD2 NAME(EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) +{ + DISPATCH(EvalMesh2, (mode, i1, i2, j1, j2), (F, "glEvalMesh2(0x%x, %d, %d, %d, %d);\n", mode, i1, i2, j1, j2)); +} + +KEYWORD1 void KEYWORD2 NAME(EvalPoint2)(GLint i, GLint j) +{ + DISPATCH(EvalPoint2, (i, j), (F, "glEvalPoint2(%d, %d);\n", i, j)); +} + +KEYWORD1 void KEYWORD2 NAME(AlphaFunc)(GLenum func, GLclampf ref) +{ + DISPATCH(AlphaFunc, (func, ref), (F, "glAlphaFunc(0x%x, %f);\n", func, ref)); +} + +KEYWORD1 void KEYWORD2 NAME(BlendFunc)(GLenum sfactor, GLenum dfactor) +{ + DISPATCH(BlendFunc, (sfactor, dfactor), (F, "glBlendFunc(0x%x, 0x%x);\n", sfactor, dfactor)); +} + +KEYWORD1 void KEYWORD2 NAME(LogicOp)(GLenum opcode) +{ + DISPATCH(LogicOp, (opcode), (F, "glLogicOp(0x%x);\n", opcode)); +} + +KEYWORD1 void KEYWORD2 NAME(StencilFunc)(GLenum func, GLint ref, GLuint mask) +{ + DISPATCH(StencilFunc, (func, ref, mask), (F, "glStencilFunc(0x%x, %d, %d);\n", func, ref, mask)); +} + +KEYWORD1 void KEYWORD2 NAME(StencilOp)(GLenum fail, GLenum zfail, GLenum zpass) +{ + DISPATCH(StencilOp, (fail, zfail, zpass), (F, "glStencilOp(0x%x, 0x%x, 0x%x);\n", fail, zfail, zpass)); +} + +KEYWORD1 void KEYWORD2 NAME(DepthFunc)(GLenum func) +{ + DISPATCH(DepthFunc, (func), (F, "glDepthFunc(0x%x);\n", func)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelZoom)(GLfloat xfactor, GLfloat yfactor) +{ + DISPATCH(PixelZoom, (xfactor, yfactor), (F, "glPixelZoom(%f, %f);\n", xfactor, yfactor)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransferf)(GLenum pname, GLfloat param) +{ + DISPATCH(PixelTransferf, (pname, param), (F, "glPixelTransferf(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransferi)(GLenum pname, GLint param) +{ + DISPATCH(PixelTransferi, (pname, param), (F, "glPixelTransferi(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelStoref)(GLenum pname, GLfloat param) +{ + DISPATCH(PixelStoref, (pname, param), (F, "glPixelStoref(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelStorei)(GLenum pname, GLint param) +{ + DISPATCH(PixelStorei, (pname, param), (F, "glPixelStorei(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat * values) +{ + DISPATCH(PixelMapfv, (map, mapsize, values), (F, "glPixelMapfv(0x%x, %d, %p);\n", map, mapsize, (const void *) values)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint * values) +{ + DISPATCH(PixelMapuiv, (map, mapsize, values), (F, "glPixelMapuiv(0x%x, %d, %p);\n", map, mapsize, (const void *) values)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelMapusv)(GLenum map, GLsizei mapsize, const GLushort * values) +{ + DISPATCH(PixelMapusv, (map, mapsize, values), (F, "glPixelMapusv(0x%x, %d, %p);\n", map, mapsize, (const void *) values)); +} + +KEYWORD1 void KEYWORD2 NAME(ReadBuffer)(GLenum mode) +{ + DISPATCH(ReadBuffer, (mode), (F, "glReadBuffer(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) +{ + DISPATCH(CopyPixels, (x, y, width, height, type), (F, "glCopyPixels(%d, %d, %d, %d, 0x%x);\n", x, y, width, height, type)); +} + +KEYWORD1 void KEYWORD2 NAME(ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels) +{ + DISPATCH(ReadPixels, (x, y, width, height, format, type, pixels), (F, "glReadPixels(%d, %d, %d, %d, 0x%x, 0x%x, %p);\n", x, y, width, height, format, type, (const void *) pixels)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels) +{ + DISPATCH(DrawPixels, (width, height, format, type, pixels), (F, "glDrawPixels(%d, %d, 0x%x, 0x%x, %p);\n", width, height, format, type, (const void *) pixels)); +} + +KEYWORD1 void KEYWORD2 NAME(GetBooleanv)(GLenum pname, GLboolean * params) +{ + DISPATCH(GetBooleanv, (pname, params), (F, "glGetBooleanv(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetClipPlane)(GLenum plane, GLdouble * equation) +{ + DISPATCH(GetClipPlane, (plane, equation), (F, "glGetClipPlane(0x%x, %p);\n", plane, (const void *) equation)); +} + +KEYWORD1 void KEYWORD2 NAME(GetDoublev)(GLenum pname, GLdouble * params) +{ + DISPATCH(GetDoublev, (pname, params), (F, "glGetDoublev(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 GLenum KEYWORD2 NAME(GetError)(void) +{ + RETURN_DISPATCH(GetError, (), (F, "glGetError();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(GetFloatv)(GLenum pname, GLfloat * params) +{ + DISPATCH(GetFloatv, (pname, params), (F, "glGetFloatv(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetIntegerv)(GLenum pname, GLint * params) +{ + DISPATCH(GetIntegerv, (pname, params), (F, "glGetIntegerv(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetLightfv)(GLenum light, GLenum pname, GLfloat * params) +{ + DISPATCH(GetLightfv, (light, pname, params), (F, "glGetLightfv(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetLightiv)(GLenum light, GLenum pname, GLint * params) +{ + DISPATCH(GetLightiv, (light, pname, params), (F, "glGetLightiv(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetMapdv)(GLenum target, GLenum query, GLdouble * v) +{ + DISPATCH(GetMapdv, (target, query, v), (F, "glGetMapdv(0x%x, 0x%x, %p);\n", target, query, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(GetMapfv)(GLenum target, GLenum query, GLfloat * v) +{ + DISPATCH(GetMapfv, (target, query, v), (F, "glGetMapfv(0x%x, 0x%x, %p);\n", target, query, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(GetMapiv)(GLenum target, GLenum query, GLint * v) +{ + DISPATCH(GetMapiv, (target, query, v), (F, "glGetMapiv(0x%x, 0x%x, %p);\n", target, query, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(GetMaterialfv)(GLenum face, GLenum pname, GLfloat * params) +{ + DISPATCH(GetMaterialfv, (face, pname, params), (F, "glGetMaterialfv(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetMaterialiv)(GLenum face, GLenum pname, GLint * params) +{ + DISPATCH(GetMaterialiv, (face, pname, params), (F, "glGetMaterialiv(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPixelMapfv)(GLenum map, GLfloat * values) +{ + DISPATCH(GetPixelMapfv, (map, values), (F, "glGetPixelMapfv(0x%x, %p);\n", map, (const void *) values)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPixelMapuiv)(GLenum map, GLuint * values) +{ + DISPATCH(GetPixelMapuiv, (map, values), (F, "glGetPixelMapuiv(0x%x, %p);\n", map, (const void *) values)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPixelMapusv)(GLenum map, GLushort * values) +{ + DISPATCH(GetPixelMapusv, (map, values), (F, "glGetPixelMapusv(0x%x, %p);\n", map, (const void *) values)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPolygonStipple)(GLubyte * mask) +{ + DISPATCH(GetPolygonStipple, (mask), (F, "glGetPolygonStipple(%p);\n", (const void *) mask)); +} + +KEYWORD1 const GLubyte * KEYWORD2 NAME(GetString)(GLenum name) +{ + RETURN_DISPATCH(GetString, (name), (F, "glGetString(0x%x);\n", name)); +} + +KEYWORD1 void KEYWORD2 NAME(GetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params) +{ + DISPATCH(GetTexEnvfv, (target, pname, params), (F, "glGetTexEnvfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetTexEnviv)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetTexEnviv, (target, pname, params), (F, "glGetTexEnviv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetTexGendv)(GLenum coord, GLenum pname, GLdouble * params) +{ + DISPATCH(GetTexGendv, (coord, pname, params), (F, "glGetTexGendv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetTexGenfv)(GLenum coord, GLenum pname, GLfloat * params) +{ + DISPATCH(GetTexGenfv, (coord, pname, params), (F, "glGetTexGenfv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetTexGeniv)(GLenum coord, GLenum pname, GLint * params) +{ + DISPATCH(GetTexGeniv, (coord, pname, params), (F, "glGetTexGeniv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels) +{ + DISPATCH(GetTexImage, (target, level, format, type, pixels), (F, "glGetTexImage(0x%x, %d, 0x%x, 0x%x, %p);\n", target, level, format, type, (const void *) pixels)); +} + +KEYWORD1 void KEYWORD2 NAME(GetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params) +{ + DISPATCH(GetTexParameterfv, (target, pname, params), (F, "glGetTexParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetTexParameteriv)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetTexParameteriv, (target, pname, params), (F, "glGetTexParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params) +{ + DISPATCH(GetTexLevelParameterfv, (target, level, pname, params), (F, "glGetTexLevelParameterfv(0x%x, %d, 0x%x, %p);\n", target, level, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params) +{ + DISPATCH(GetTexLevelParameteriv, (target, level, pname, params), (F, "glGetTexLevelParameteriv(0x%x, %d, 0x%x, %p);\n", target, level, pname, (const void *) params)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(IsEnabled)(GLenum cap) +{ + RETURN_DISPATCH(IsEnabled, (cap), (F, "glIsEnabled(0x%x);\n", cap)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(IsList)(GLuint list) +{ + RETURN_DISPATCH(IsList, (list), (F, "glIsList(%d);\n", list)); +} + +KEYWORD1 void KEYWORD2 NAME(DepthRange)(GLclampd zNear, GLclampd zFar) +{ + DISPATCH(DepthRange, (zNear, zFar), (F, "glDepthRange(%f, %f);\n", zNear, zFar)); +} + +KEYWORD1 void KEYWORD2 NAME(Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) +{ + DISPATCH(Frustum, (left, right, bottom, top, zNear, zFar), (F, "glFrustum(%f, %f, %f, %f, %f, %f);\n", left, right, bottom, top, zNear, zFar)); +} + +KEYWORD1 void KEYWORD2 NAME(LoadIdentity)(void) +{ + DISPATCH(LoadIdentity, (), (F, "glLoadIdentity();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(LoadMatrixf)(const GLfloat * m) +{ + DISPATCH(LoadMatrixf, (m), (F, "glLoadMatrixf(%p);\n", (const void *) m)); +} + +KEYWORD1 void KEYWORD2 NAME(LoadMatrixd)(const GLdouble * m) +{ + DISPATCH(LoadMatrixd, (m), (F, "glLoadMatrixd(%p);\n", (const void *) m)); +} + +KEYWORD1 void KEYWORD2 NAME(MatrixMode)(GLenum mode) +{ + DISPATCH(MatrixMode, (mode), (F, "glMatrixMode(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(MultMatrixf)(const GLfloat * m) +{ + DISPATCH(MultMatrixf, (m), (F, "glMultMatrixf(%p);\n", (const void *) m)); +} + +KEYWORD1 void KEYWORD2 NAME(MultMatrixd)(const GLdouble * m) +{ + DISPATCH(MultMatrixd, (m), (F, "glMultMatrixd(%p);\n", (const void *) m)); +} + +KEYWORD1 void KEYWORD2 NAME(Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) +{ + DISPATCH(Ortho, (left, right, bottom, top, zNear, zFar), (F, "glOrtho(%f, %f, %f, %f, %f, %f);\n", left, right, bottom, top, zNear, zFar)); +} + +KEYWORD1 void KEYWORD2 NAME(PopMatrix)(void) +{ + DISPATCH(PopMatrix, (), (F, "glPopMatrix();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(PushMatrix)(void) +{ + DISPATCH(PushMatrix, (), (F, "glPushMatrix();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z) +{ + DISPATCH(Rotated, (angle, x, y, z), (F, "glRotated(%f, %f, %f, %f);\n", angle, x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) +{ + DISPATCH(Rotatef, (angle, x, y, z), (F, "glRotatef(%f, %f, %f, %f);\n", angle, x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(Scaled)(GLdouble x, GLdouble y, GLdouble z) +{ + DISPATCH(Scaled, (x, y, z), (F, "glScaled(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(Scalef)(GLfloat x, GLfloat y, GLfloat z) +{ + DISPATCH(Scalef, (x, y, z), (F, "glScalef(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(Translated)(GLdouble x, GLdouble y, GLdouble z) +{ + DISPATCH(Translated, (x, y, z), (F, "glTranslated(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(Translatef)(GLfloat x, GLfloat y, GLfloat z) +{ + DISPATCH(Translatef, (x, y, z), (F, "glTranslatef(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(Viewport)(GLint x, GLint y, GLsizei width, GLsizei height) +{ + DISPATCH(Viewport, (x, y, width, height), (F, "glViewport(%d, %d, %d, %d);\n", x, y, width, height)); +} + +KEYWORD1 void KEYWORD2 NAME(ArrayElement)(GLint i) +{ + DISPATCH(ArrayElement, (i), (F, "glArrayElement(%d);\n", i)); +} + +KEYWORD1 void KEYWORD2 NAME(ArrayElementEXT)(GLint i) +{ + DISPATCH(ArrayElement, (i), (F, "glArrayElementEXT(%d);\n", i)); +} + +KEYWORD1 void KEYWORD2 NAME(BindTexture)(GLenum target, GLuint texture) +{ + DISPATCH(BindTexture, (target, texture), (F, "glBindTexture(0x%x, %d);\n", target, texture)); +} + +KEYWORD1 void KEYWORD2 NAME(BindTextureEXT)(GLenum target, GLuint texture) +{ + DISPATCH(BindTexture, (target, texture), (F, "glBindTextureEXT(0x%x, %d);\n", target, texture)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(ColorPointer, (size, type, stride, pointer), (F, "glColorPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(DisableClientState)(GLenum array) +{ + DISPATCH(DisableClientState, (array), (F, "glDisableClientState(0x%x);\n", array)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawArrays)(GLenum mode, GLint first, GLsizei count) +{ + DISPATCH(DrawArrays, (mode, first, count), (F, "glDrawArrays(0x%x, %d, %d);\n", mode, first, count)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawArraysEXT)(GLenum mode, GLint first, GLsizei count) +{ + DISPATCH(DrawArrays, (mode, first, count), (F, "glDrawArraysEXT(0x%x, %d, %d);\n", mode, first, count)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices) +{ + DISPATCH(DrawElements, (mode, count, type, indices), (F, "glDrawElements(0x%x, %d, 0x%x, %p);\n", mode, count, type, (const void *) indices)); +} + +KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointer)(GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(EdgeFlagPointer, (stride, pointer), (F, "glEdgeFlagPointer(%d, %p);\n", stride, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(EnableClientState)(GLenum array) +{ + DISPATCH(EnableClientState, (array), (F, "glEnableClientState(0x%x);\n", array)); +} + +KEYWORD1 void KEYWORD2 NAME(IndexPointer)(GLenum type, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(IndexPointer, (type, stride, pointer), (F, "glIndexPointer(0x%x, %d, %p);\n", type, stride, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(Indexub)(GLubyte c) +{ + DISPATCH(Indexub, (c), (F, "glIndexub(%d);\n", c)); +} + +KEYWORD1 void KEYWORD2 NAME(Indexubv)(const GLubyte * c) +{ + DISPATCH(Indexubv, (c), (F, "glIndexubv(%p);\n", (const void *) c)); +} + +KEYWORD1 void KEYWORD2 NAME(InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(InterleavedArrays, (format, stride, pointer), (F, "glInterleavedArrays(0x%x, %d, %p);\n", format, stride, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(NormalPointer)(GLenum type, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(NormalPointer, (type, stride, pointer), (F, "glNormalPointer(0x%x, %d, %p);\n", type, stride, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(PolygonOffset)(GLfloat factor, GLfloat units) +{ + DISPATCH(PolygonOffset, (factor, units), (F, "glPolygonOffset(%f, %f);\n", factor, units)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(TexCoordPointer, (size, type, stride, pointer), (F, "glTexCoordPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(VertexPointer, (size, type, stride, pointer), (F, "glVertexPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResident)(GLsizei n, const GLuint * textures, GLboolean * residences) +{ + RETURN_DISPATCH(AreTexturesResident, (n, textures, residences), (F, "glAreTexturesResident(%d, %p, %p);\n", n, (const void *) textures, (const void *) residences)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) +{ + DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, "glCopyTexImage1D(0x%x, %d, 0x%x, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, border)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyTexImage1DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) +{ + DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, "glCopyTexImage1DEXT(0x%x, %d, 0x%x, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, border)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +{ + DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, "glCopyTexImage2D(0x%x, %d, 0x%x, %d, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, height, border)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyTexImage2DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +{ + DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, "glCopyTexImage2DEXT(0x%x, %d, 0x%x, %d, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, height, border)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) +{ + DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, "glCopyTexSubImage1D(0x%x, %d, %d, %d, %d, %d);\n", target, level, xoffset, x, y, width)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) +{ + DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, "glCopyTexSubImage1DEXT(0x%x, %d, %d, %d, %d, %d);\n", target, level, xoffset, x, y, width)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, "glCopyTexSubImage2D(0x%x, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, x, y, width, height)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, "glCopyTexSubImage2DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, x, y, width, height)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteTextures)(GLsizei n, const GLuint * textures) +{ + DISPATCH(DeleteTextures, (n, textures), (F, "glDeleteTextures(%d, %p);\n", n, (const void *) textures)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteTexturesEXT)(GLsizei n, const GLuint * textures) +{ + DISPATCH(DeleteTextures, (n, textures), (F, "glDeleteTexturesEXT(%d, %p);\n", n, (const void *) textures)); +} + +KEYWORD1 void KEYWORD2 NAME(GenTextures)(GLsizei n, GLuint * textures) +{ + DISPATCH(GenTextures, (n, textures), (F, "glGenTextures(%d, %p);\n", n, (const void *) textures)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPointerv)(GLenum pname, GLvoid ** params) +{ + DISPATCH(GetPointerv, (pname, params), (F, "glGetPointerv(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPointervEXT)(GLenum pname, GLvoid ** params) +{ + DISPATCH(GetPointerv, (pname, params), (F, "glGetPointervEXT(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(IsTexture)(GLuint texture) +{ + RETURN_DISPATCH(IsTexture, (texture), (F, "glIsTexture(%d);\n", texture)); +} + +KEYWORD1 void KEYWORD2 NAME(PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities) +{ + DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, "glPrioritizeTextures(%d, %p, %p);\n", n, (const void *) textures, (const void *) priorities)); +} + +KEYWORD1 void KEYWORD2 NAME(PrioritizeTexturesEXT)(GLsizei n, const GLuint * textures, const GLclampf * priorities) +{ + DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, "glPrioritizeTexturesEXT(%d, %p, %p);\n", n, (const void *) textures, (const void *) priorities)); +} + +KEYWORD1 void KEYWORD2 NAME(TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels) +{ + DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, "glTexSubImage1D(0x%x, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, width, format, type, (const void *) pixels)); +} + +KEYWORD1 void KEYWORD2 NAME(TexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels) +{ + DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, "glTexSubImage1DEXT(0x%x, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, width, format, type, (const void *) pixels)); +} + +KEYWORD1 void KEYWORD2 NAME(TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels) +{ + DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, "glTexSubImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, width, height, format, type, (const void *) pixels)); +} + +KEYWORD1 void KEYWORD2 NAME(TexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels) +{ + DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, "glTexSubImage2DEXT(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, width, height, format, type, (const void *) pixels)); +} + +KEYWORD1 void KEYWORD2 NAME(PopClientAttrib)(void) +{ + DISPATCH(PopClientAttrib, (), (F, "glPopClientAttrib();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(PushClientAttrib)(GLbitfield mask) +{ + DISPATCH(PushClientAttrib, (mask), (F, "glPushClientAttrib(%d);\n", mask)); +} + +KEYWORD1 void KEYWORD2 NAME(BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + DISPATCH(BlendColor, (red, green, blue, alpha), (F, "glBlendColor(%f, %f, %f, %f);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(BlendColorEXT)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + DISPATCH(BlendColor, (red, green, blue, alpha), (F, "glBlendColorEXT(%f, %f, %f, %f);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(BlendEquation)(GLenum mode) +{ + DISPATCH(BlendEquation, (mode), (F, "glBlendEquation(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(BlendEquationEXT)(GLenum mode) +{ + DISPATCH(BlendEquation, (mode), (F, "glBlendEquationEXT(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices) +{ + DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, "glDrawRangeElements(0x%x, %d, %d, %d, 0x%x, %p);\n", mode, start, end, count, type, (const void *) indices)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices) +{ + DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, "glDrawRangeElementsEXT(0x%x, %d, %d, %d, 0x%x, %p);\n", mode, start, end, count, type, (const void *) indices)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table) +{ + DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, "glColorTable(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (const void *) table)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorTableSGI)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table) +{ + DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, "glColorTableSGI(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (const void *) table)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorTableEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table) +{ + DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, "glColorTableEXT(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (const void *) table)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat * params) +{ + DISPATCH(ColorTableParameterfv, (target, pname, params), (F, "glColorTableParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfvSGI)(GLenum target, GLenum pname, const GLfloat * params) +{ + DISPATCH(ColorTableParameterfv, (target, pname, params), (F, "glColorTableParameterfvSGI(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorTableParameteriv)(GLenum target, GLenum pname, const GLint * params) +{ + DISPATCH(ColorTableParameteriv, (target, pname, params), (F, "glColorTableParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorTableParameterivSGI)(GLenum target, GLenum pname, const GLint * params) +{ + DISPATCH(ColorTableParameteriv, (target, pname, params), (F, "glColorTableParameterivSGI(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +{ + DISPATCH(CopyColorTable, (target, internalformat, x, y, width), (F, "glCopyColorTable(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyColorTableSGI)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +{ + DISPATCH(CopyColorTable, (target, internalformat, x, y, width), (F, "glCopyColorTableSGI(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); +} + +KEYWORD1 void KEYWORD2 NAME(GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid * table) +{ + DISPATCH(GetColorTable, (target, format, type, table), (F, "glGetColorTable(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) table)); +} + +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat * params) +{ + DISPATCH(GetColorTableParameterfv, (target, pname, params), (F, "glGetColorTableParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameteriv)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetColorTableParameteriv, (target, pname, params), (F, "glGetColorTableParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data) +{ + DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, "glColorSubTable(0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, start, count, format, type, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorSubTableEXT)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data) +{ + DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, "glColorSubTableEXT(0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, start, count, format, type, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) +{ + DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, "glCopyColorSubTable(0x%x, %d, %d, %d, %d);\n", target, start, x, y, width)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyColorSubTableEXT)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) +{ + DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, "glCopyColorSubTableEXT(0x%x, %d, %d, %d, %d);\n", target, start, x, y, width)); +} + +KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image) +{ + DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, "glConvolutionFilter1D(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (const void *) image)); +} + +KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image) +{ + DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, "glConvolutionFilter1DEXT(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (const void *) image)); +} + +KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image) +{ + DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, "glConvolutionFilter2D(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, height, format, type, (const void *) image)); +} + +KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image) +{ + DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, "glConvolutionFilter2DEXT(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, height, format, type, (const void *) image)); +} + +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params) +{ + DISPATCH(ConvolutionParameterf, (target, pname, params), (F, "glConvolutionParameterf(0x%x, 0x%x, %f);\n", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfEXT)(GLenum target, GLenum pname, GLfloat params) +{ + DISPATCH(ConvolutionParameterf, (target, pname, params), (F, "glConvolutionParameterfEXT(0x%x, 0x%x, %f);\n", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat * params) +{ + DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, "glConvolutionParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfvEXT)(GLenum target, GLenum pname, const GLfloat * params) +{ + DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, "glConvolutionParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteri)(GLenum target, GLenum pname, GLint params) +{ + DISPATCH(ConvolutionParameteri, (target, pname, params), (F, "glConvolutionParameteri(0x%x, 0x%x, %d);\n", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriEXT)(GLenum target, GLenum pname, GLint params) +{ + DISPATCH(ConvolutionParameteri, (target, pname, params), (F, "glConvolutionParameteriEXT(0x%x, 0x%x, %d);\n", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint * params) +{ + DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, "glConvolutionParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterivEXT)(GLenum target, GLenum pname, const GLint * params) +{ + DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, "glConvolutionParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +{ + DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, "glCopyConvolutionFilter1D(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +{ + DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, "glCopyConvolutionFilter1DEXT(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) +{ + DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, "glCopyConvolutionFilter2D(0x%x, 0x%x, %d, %d, %d, %d);\n", target, internalformat, x, y, width, height)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) +{ + DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, "glCopyConvolutionFilter2DEXT(0x%x, 0x%x, %d, %d, %d, %d);\n", target, internalformat, x, y, width, height)); +} + +KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid * image) +{ + DISPATCH(GetConvolutionFilter, (target, format, type, image), (F, "glGetConvolutionFilter(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) image)); +} + +KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat * params) +{ + DISPATCH(GetConvolutionParameterfv, (target, pname, params), (F, "glGetConvolutionParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetConvolutionParameteriv, (target, pname, params), (F, "glGetConvolutionParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span) +{ + DISPATCH(GetSeparableFilter, (target, format, type, row, column, span), (F, "glGetSeparableFilter(0x%x, 0x%x, 0x%x, %p, %p, %p);\n", target, format, type, (const void *) row, (const void *) column, (const void *) span)); +} + +KEYWORD1 void KEYWORD2 NAME(SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column) +{ + DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, "glSeparableFilter2D(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p, %p);\n", target, internalformat, width, height, format, type, (const void *) row, (const void *) column)); +} + +KEYWORD1 void KEYWORD2 NAME(SeparableFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column) +{ + DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, "glSeparableFilter2DEXT(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p, %p);\n", target, internalformat, width, height, format, type, (const void *) row, (const void *) column)); +} + +KEYWORD1 void KEYWORD2 NAME(GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) +{ + DISPATCH(GetHistogram, (target, reset, format, type, values), (F, "glGetHistogram(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (const void *) values)); +} + +KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat * params) +{ + DISPATCH(GetHistogramParameterfv, (target, pname, params), (F, "glGetHistogramParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetHistogramParameteriv)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetHistogramParameteriv, (target, pname, params), (F, "glGetHistogramParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) +{ + DISPATCH(GetMinmax, (target, reset, format, type, values), (F, "glGetMinmax(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (const void *) values)); +} + +KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat * params) +{ + DISPATCH(GetMinmaxParameterfv, (target, pname, params), (F, "glGetMinmaxParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetMinmaxParameteriv, (target, pname, params), (F, "glGetMinmaxParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) +{ + DISPATCH(Histogram, (target, width, internalformat, sink), (F, "glHistogram(0x%x, %d, 0x%x, %d);\n", target, width, internalformat, sink)); +} + +KEYWORD1 void KEYWORD2 NAME(HistogramEXT)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) +{ + DISPATCH(Histogram, (target, width, internalformat, sink), (F, "glHistogramEXT(0x%x, %d, 0x%x, %d);\n", target, width, internalformat, sink)); +} + +KEYWORD1 void KEYWORD2 NAME(Minmax)(GLenum target, GLenum internalformat, GLboolean sink) +{ + DISPATCH(Minmax, (target, internalformat, sink), (F, "glMinmax(0x%x, 0x%x, %d);\n", target, internalformat, sink)); +} + +KEYWORD1 void KEYWORD2 NAME(MinmaxEXT)(GLenum target, GLenum internalformat, GLboolean sink) +{ + DISPATCH(Minmax, (target, internalformat, sink), (F, "glMinmaxEXT(0x%x, 0x%x, %d);\n", target, internalformat, sink)); +} + +KEYWORD1 void KEYWORD2 NAME(ResetHistogram)(GLenum target) +{ + DISPATCH(ResetHistogram, (target), (F, "glResetHistogram(0x%x);\n", target)); +} + +KEYWORD1 void KEYWORD2 NAME(ResetHistogramEXT)(GLenum target) +{ + DISPATCH(ResetHistogram, (target), (F, "glResetHistogramEXT(0x%x);\n", target)); +} + +KEYWORD1 void KEYWORD2 NAME(ResetMinmax)(GLenum target) +{ + DISPATCH(ResetMinmax, (target), (F, "glResetMinmax(0x%x);\n", target)); +} + +KEYWORD1 void KEYWORD2 NAME(ResetMinmaxEXT)(GLenum target) +{ + DISPATCH(ResetMinmax, (target), (F, "glResetMinmaxEXT(0x%x);\n", target)); +} + +KEYWORD1 void KEYWORD2 NAME(TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels) +{ + DISPATCH(TexImage3D, (target, level, internalformat, width, height, depth, border, format, type, pixels), (F, "glTexImage3D(0x%x, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, border, format, type, (const void *) pixels)); +} + +KEYWORD1 void KEYWORD2 NAME(TexImage3DEXT)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels) +{ + DISPATCH(TexImage3D, (target, level, internalformat, width, height, depth, border, format, type, pixels), (F, "glTexImage3DEXT(0x%x, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, border, format, type, (const void *) pixels)); +} + +KEYWORD1 void KEYWORD2 NAME(TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels) +{ + DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, "glTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (const void *) pixels)); +} + +KEYWORD1 void KEYWORD2 NAME(TexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels) +{ + DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, "glTexSubImage3DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (const void *) pixels)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, "glCopyTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, zoffset, x, y, width, height)); +} + +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, "glCopyTexSubImage3DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, zoffset, x, y, width, height)); +} + +KEYWORD1 void KEYWORD2 NAME(ActiveTexture)(GLenum texture) +{ + DISPATCH(ActiveTextureARB, (texture), (F, "glActiveTexture(0x%x);\n", texture)); +} + +KEYWORD1 void KEYWORD2 NAME(ActiveTextureARB)(GLenum texture) +{ + DISPATCH(ActiveTextureARB, (texture), (F, "glActiveTextureARB(0x%x);\n", texture)); +} + +KEYWORD1 void KEYWORD2 NAME(ClientActiveTexture)(GLenum texture) +{ + DISPATCH(ClientActiveTextureARB, (texture), (F, "glClientActiveTexture(0x%x);\n", texture)); +} + +KEYWORD1 void KEYWORD2 NAME(ClientActiveTextureARB)(GLenum texture) +{ + DISPATCH(ClientActiveTextureARB, (texture), (F, "glClientActiveTextureARB(0x%x);\n", texture)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1d)(GLenum target, GLdouble s) +{ + DISPATCH(MultiTexCoord1dARB, (target, s), (F, "glMultiTexCoord1d(0x%x, %f);\n", target, s)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dARB)(GLenum target, GLdouble s) +{ + DISPATCH(MultiTexCoord1dARB, (target, s), (F, "glMultiTexCoord1dARB(0x%x, %f);\n", target, s)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dv)(GLenum target, const GLdouble * v) +{ + DISPATCH(MultiTexCoord1dvARB, (target, v), (F, "glMultiTexCoord1dv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dvARB)(GLenum target, const GLdouble * v) +{ + DISPATCH(MultiTexCoord1dvARB, (target, v), (F, "glMultiTexCoord1dvARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1f)(GLenum target, GLfloat s) +{ + DISPATCH(MultiTexCoord1fARB, (target, s), (F, "glMultiTexCoord1f(0x%x, %f);\n", target, s)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fARB)(GLenum target, GLfloat s) +{ + DISPATCH(MultiTexCoord1fARB, (target, s), (F, "glMultiTexCoord1fARB(0x%x, %f);\n", target, s)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fv)(GLenum target, const GLfloat * v) +{ + DISPATCH(MultiTexCoord1fvARB, (target, v), (F, "glMultiTexCoord1fv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fvARB)(GLenum target, const GLfloat * v) +{ + DISPATCH(MultiTexCoord1fvARB, (target, v), (F, "glMultiTexCoord1fvARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1i)(GLenum target, GLint s) +{ + DISPATCH(MultiTexCoord1iARB, (target, s), (F, "glMultiTexCoord1i(0x%x, %d);\n", target, s)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iARB)(GLenum target, GLint s) +{ + DISPATCH(MultiTexCoord1iARB, (target, s), (F, "glMultiTexCoord1iARB(0x%x, %d);\n", target, s)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iv)(GLenum target, const GLint * v) +{ + DISPATCH(MultiTexCoord1ivARB, (target, v), (F, "glMultiTexCoord1iv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1ivARB)(GLenum target, const GLint * v) +{ + DISPATCH(MultiTexCoord1ivARB, (target, v), (F, "glMultiTexCoord1ivARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1s)(GLenum target, GLshort s) +{ + DISPATCH(MultiTexCoord1sARB, (target, s), (F, "glMultiTexCoord1s(0x%x, %d);\n", target, s)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sARB)(GLenum target, GLshort s) +{ + DISPATCH(MultiTexCoord1sARB, (target, s), (F, "glMultiTexCoord1sARB(0x%x, %d);\n", target, s)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sv)(GLenum target, const GLshort * v) +{ + DISPATCH(MultiTexCoord1svARB, (target, v), (F, "glMultiTexCoord1sv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1svARB)(GLenum target, const GLshort * v) +{ + DISPATCH(MultiTexCoord1svARB, (target, v), (F, "glMultiTexCoord1svARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2d)(GLenum target, GLdouble s, GLdouble t) +{ + DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, "glMultiTexCoord2d(0x%x, %f, %f);\n", target, s, t)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t) +{ + DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, "glMultiTexCoord2dARB(0x%x, %f, %f);\n", target, s, t)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dv)(GLenum target, const GLdouble * v) +{ + DISPATCH(MultiTexCoord2dvARB, (target, v), (F, "glMultiTexCoord2dv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dvARB)(GLenum target, const GLdouble * v) +{ + DISPATCH(MultiTexCoord2dvARB, (target, v), (F, "glMultiTexCoord2dvARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2f)(GLenum target, GLfloat s, GLfloat t) +{ + DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, "glMultiTexCoord2f(0x%x, %f, %f);\n", target, s, t)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t) +{ + DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, "glMultiTexCoord2fARB(0x%x, %f, %f);\n", target, s, t)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fv)(GLenum target, const GLfloat * v) +{ + DISPATCH(MultiTexCoord2fvARB, (target, v), (F, "glMultiTexCoord2fv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fvARB)(GLenum target, const GLfloat * v) +{ + DISPATCH(MultiTexCoord2fvARB, (target, v), (F, "glMultiTexCoord2fvARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2i)(GLenum target, GLint s, GLint t) +{ + DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, "glMultiTexCoord2i(0x%x, %d, %d);\n", target, s, t)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iARB)(GLenum target, GLint s, GLint t) +{ + DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, "glMultiTexCoord2iARB(0x%x, %d, %d);\n", target, s, t)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iv)(GLenum target, const GLint * v) +{ + DISPATCH(MultiTexCoord2ivARB, (target, v), (F, "glMultiTexCoord2iv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2ivARB)(GLenum target, const GLint * v) +{ + DISPATCH(MultiTexCoord2ivARB, (target, v), (F, "glMultiTexCoord2ivARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2s)(GLenum target, GLshort s, GLshort t) +{ + DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, "glMultiTexCoord2s(0x%x, %d, %d);\n", target, s, t)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t) +{ + DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, "glMultiTexCoord2sARB(0x%x, %d, %d);\n", target, s, t)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sv)(GLenum target, const GLshort * v) +{ + DISPATCH(MultiTexCoord2svARB, (target, v), (F, "glMultiTexCoord2sv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2svARB)(GLenum target, const GLshort * v) +{ + DISPATCH(MultiTexCoord2svARB, (target, v), (F, "glMultiTexCoord2svARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3d)(GLenum target, GLdouble s, GLdouble t, GLdouble r) +{ + DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, "glMultiTexCoord3d(0x%x, %f, %f, %f);\n", target, s, t, r)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r) +{ + DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, "glMultiTexCoord3dARB(0x%x, %f, %f, %f);\n", target, s, t, r)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dv)(GLenum target, const GLdouble * v) +{ + DISPATCH(MultiTexCoord3dvARB, (target, v), (F, "glMultiTexCoord3dv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dvARB)(GLenum target, const GLdouble * v) +{ + DISPATCH(MultiTexCoord3dvARB, (target, v), (F, "glMultiTexCoord3dvARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3f)(GLenum target, GLfloat s, GLfloat t, GLfloat r) +{ + DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, "glMultiTexCoord3f(0x%x, %f, %f, %f);\n", target, s, t, r)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r) +{ + DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, "glMultiTexCoord3fARB(0x%x, %f, %f, %f);\n", target, s, t, r)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fv)(GLenum target, const GLfloat * v) +{ + DISPATCH(MultiTexCoord3fvARB, (target, v), (F, "glMultiTexCoord3fv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fvARB)(GLenum target, const GLfloat * v) +{ + DISPATCH(MultiTexCoord3fvARB, (target, v), (F, "glMultiTexCoord3fvARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3i)(GLenum target, GLint s, GLint t, GLint r) +{ + DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, "glMultiTexCoord3i(0x%x, %d, %d, %d);\n", target, s, t, r)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r) +{ + DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, "glMultiTexCoord3iARB(0x%x, %d, %d, %d);\n", target, s, t, r)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iv)(GLenum target, const GLint * v) +{ + DISPATCH(MultiTexCoord3ivARB, (target, v), (F, "glMultiTexCoord3iv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3ivARB)(GLenum target, const GLint * v) +{ + DISPATCH(MultiTexCoord3ivARB, (target, v), (F, "glMultiTexCoord3ivARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3s)(GLenum target, GLshort s, GLshort t, GLshort r) +{ + DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, "glMultiTexCoord3s(0x%x, %d, %d, %d);\n", target, s, t, r)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r) +{ + DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, "glMultiTexCoord3sARB(0x%x, %d, %d, %d);\n", target, s, t, r)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sv)(GLenum target, const GLshort * v) +{ + DISPATCH(MultiTexCoord3svARB, (target, v), (F, "glMultiTexCoord3sv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3svARB)(GLenum target, const GLshort * v) +{ + DISPATCH(MultiTexCoord3svARB, (target, v), (F, "glMultiTexCoord3svARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4d)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) +{ + DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, "glMultiTexCoord4d(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) +{ + DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, "glMultiTexCoord4dARB(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dv)(GLenum target, const GLdouble * v) +{ + DISPATCH(MultiTexCoord4dvARB, (target, v), (F, "glMultiTexCoord4dv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dvARB)(GLenum target, const GLdouble * v) +{ + DISPATCH(MultiTexCoord4dvARB, (target, v), (F, "glMultiTexCoord4dvARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +{ + DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, "glMultiTexCoord4f(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +{ + DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, "glMultiTexCoord4fARB(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fv)(GLenum target, const GLfloat * v) +{ + DISPATCH(MultiTexCoord4fvARB, (target, v), (F, "glMultiTexCoord4fv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fvARB)(GLenum target, const GLfloat * v) +{ + DISPATCH(MultiTexCoord4fvARB, (target, v), (F, "glMultiTexCoord4fvARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4i)(GLenum target, GLint s, GLint t, GLint r, GLint q) +{ + DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, "glMultiTexCoord4i(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q) +{ + DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, "glMultiTexCoord4iARB(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iv)(GLenum target, const GLint * v) +{ + DISPATCH(MultiTexCoord4ivARB, (target, v), (F, "glMultiTexCoord4iv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4ivARB)(GLenum target, const GLint * v) +{ + DISPATCH(MultiTexCoord4ivARB, (target, v), (F, "glMultiTexCoord4ivARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4s)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) +{ + DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, "glMultiTexCoord4s(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) +{ + DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, "glMultiTexCoord4sARB(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sv)(GLenum target, const GLshort * v) +{ + DISPATCH(MultiTexCoord4svARB, (target, v), (F, "glMultiTexCoord4sv(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4svARB)(GLenum target, const GLshort * v) +{ + DISPATCH(MultiTexCoord4svARB, (target, v), (F, "glMultiTexCoord4svARB(0x%x, %p);\n", target, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixf)(const GLfloat * m) +{ + DISPATCH(LoadTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixf(%p);\n", (const void *) m)); +} + +KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixfARB)(const GLfloat * m) +{ + DISPATCH(LoadTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixfARB(%p);\n", (const void *) m)); +} + +KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixd)(const GLdouble * m) +{ + DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixd(%p);\n", (const void *) m)); +} + +KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixdARB)(const GLdouble * m) +{ + DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixdARB(%p);\n", (const void *) m)); +} + +KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixf)(const GLfloat * m) +{ + DISPATCH(MultTransposeMatrixfARB, (m), (F, "glMultTransposeMatrixf(%p);\n", (const void *) m)); +} + +KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixfARB)(const GLfloat * m) +{ + DISPATCH(MultTransposeMatrixfARB, (m), (F, "glMultTransposeMatrixfARB(%p);\n", (const void *) m)); +} + +KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixd)(const GLdouble * m) +{ + DISPATCH(MultTransposeMatrixdARB, (m), (F, "glMultTransposeMatrixd(%p);\n", (const void *) m)); +} + +KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixdARB)(const GLdouble * m) +{ + DISPATCH(MultTransposeMatrixdARB, (m), (F, "glMultTransposeMatrixdARB(%p);\n", (const void *) m)); +} + +KEYWORD1 void KEYWORD2 NAME(SampleCoverage)(GLclampf value, GLboolean invert) +{ + DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverage(%f, %d);\n", value, invert)); +} + +KEYWORD1 void KEYWORD2 NAME(SampleCoverageARB)(GLclampf value, GLboolean invert) +{ + DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverageARB(%f, %d);\n", value, invert)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawBuffersARB)(GLsizei n, const GLenum * bufs) +{ + DISPATCH(DrawBuffersARB, (n, bufs), (F, "glDrawBuffersARB(%d, %p);\n", n, (const void *) bufs)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawBuffersATI)(GLsizei n, const GLenum * bufs) +{ + DISPATCH(DrawBuffersARB, (n, bufs), (F, "glDrawBuffersATI(%d, %p);\n", n, (const void *) bufs)); +} + +KEYWORD1 void KEYWORD2 NAME(PolygonOffsetEXT)(GLfloat factor, GLfloat bias) +{ + DISPATCH(PolygonOffsetEXT, (factor, bias), (F, "glPolygonOffsetEXT(%f, %f);\n", factor, bias)); +} + +KEYWORD1 void KEYWORD2 NAME(GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat * weights) +{ + DISPATCH(GetTexFilterFuncSGIS, (target, filter, weights), (F, "glGetTexFilterFuncSGIS(0x%x, 0x%x, %p);\n", target, filter, (const void *) weights)); +} + +KEYWORD1 void KEYWORD2 NAME(TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat * weights) +{ + DISPATCH(TexFilterFuncSGIS, (target, filter, n, weights), (F, "glTexFilterFuncSGIS(0x%x, 0x%x, %d, %p);\n", target, filter, n, (const void *) weights)); +} + +KEYWORD1 void KEYWORD2 NAME(GetHistogramEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) +{ + DISPATCH(GetHistogramEXT, (target, reset, format, type, values), (F, "glGetHistogramEXT(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (const void *) values)); +} + +KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) +{ + DISPATCH(GetHistogramParameterfvEXT, (target, pname, params), (F, "glGetHistogramParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterivEXT)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetHistogramParameterivEXT, (target, pname, params), (F, "glGetHistogramParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetMinmaxEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) +{ + DISPATCH(GetMinmaxEXT, (target, reset, format, type, values), (F, "glGetMinmaxEXT(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (const void *) values)); +} + +KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) +{ + DISPATCH(GetMinmaxParameterfvEXT, (target, pname, params), (F, "glGetMinmaxParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterivEXT)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetMinmaxParameterivEXT, (target, pname, params), (F, "glGetMinmaxParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * image) +{ + DISPATCH(GetConvolutionFilterEXT, (target, format, type, image), (F, "glGetConvolutionFilterEXT(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) image)); +} + +KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) +{ + DISPATCH(GetConvolutionParameterfvEXT, (target, pname, params), (F, "glGetConvolutionParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterivEXT)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetConvolutionParameterivEXT, (target, pname, params), (F, "glGetConvolutionParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetSeparableFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span) +{ + DISPATCH(GetSeparableFilterEXT, (target, format, type, row, column, span), (F, "glGetSeparableFilterEXT(0x%x, 0x%x, 0x%x, %p, %p, %p);\n", target, format, type, (const void *) row, (const void *) column, (const void *) span)); +} + +KEYWORD1 void KEYWORD2 NAME(GetColorTableSGI)(GLenum target, GLenum format, GLenum type, GLvoid * table) +{ + DISPATCH(GetColorTableSGI, (target, format, type, table), (F, "glGetColorTableSGI(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) table)); +} + +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvSGI)(GLenum target, GLenum pname, GLfloat * params) +{ + DISPATCH(GetColorTableParameterfvSGI, (target, pname, params), (F, "glGetColorTableParameterfvSGI(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivSGI)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetColorTableParameterivSGI, (target, pname, params), (F, "glGetColorTableParameterivSGI(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTexGenSGIX)(GLenum mode) +{ + DISPATCH(PixelTexGenSGIX, (mode), (F, "glPixelTexGenSGIX(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameteriSGIS)(GLenum pname, GLint param) +{ + DISPATCH(PixelTexGenParameteriSGIS, (pname, param), (F, "glPixelTexGenParameteriSGIS(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params) +{ + DISPATCH(PixelTexGenParameterivSGIS, (pname, params), (F, "glPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param) +{ + DISPATCH(PixelTexGenParameterfSGIS, (pname, param), (F, "glPixelTexGenParameterfSGIS(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params) +{ + DISPATCH(PixelTexGenParameterfvSGIS, (pname, params), (F, "glPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params) +{ + DISPATCH(GetPixelTexGenParameterivSGIS, (pname, params), (F, "glGetPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params) +{ + DISPATCH(GetPixelTexGenParameterfvSGIS, (pname, params), (F, "glGetPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(TexImage4DSGIS)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels) +{ + DISPATCH(TexImage4DSGIS, (target, level, internalformat, width, height, depth, size4d, border, format, type, pixels), (F, "glTexImage4DSGIS(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, size4d, border, format, type, (const void *) pixels)); +} + +KEYWORD1 void KEYWORD2 NAME(TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid * pixels) +{ + DISPATCH(TexSubImage4DSGIS, (target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, size4d, format, type, pixels), (F, "glTexSubImage4DSGIS(0x%x, %d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, size4d, format, type, (const void *) pixels)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResidentEXT)(GLsizei n, const GLuint * textures, GLboolean * residences) +{ + RETURN_DISPATCH(AreTexturesResidentEXT, (n, textures, residences), (F, "glAreTexturesResidentEXT(%d, %p, %p);\n", n, (const void *) textures, (const void *) residences)); +} + +KEYWORD1 void KEYWORD2 NAME(GenTexturesEXT)(GLsizei n, GLuint * textures) +{ + DISPATCH(GenTexturesEXT, (n, textures), (F, "glGenTexturesEXT(%d, %p);\n", n, (const void *) textures)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(IsTextureEXT)(GLuint texture) +{ + RETURN_DISPATCH(IsTextureEXT, (texture), (F, "glIsTextureEXT(%d);\n", texture)); +} + +KEYWORD1 void KEYWORD2 NAME(DetailTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points) +{ + DISPATCH(DetailTexFuncSGIS, (target, n, points), (F, "glDetailTexFuncSGIS(0x%x, %d, %p);\n", target, n, (const void *) points)); +} + +KEYWORD1 void KEYWORD2 NAME(GetDetailTexFuncSGIS)(GLenum target, GLfloat * points) +{ + DISPATCH(GetDetailTexFuncSGIS, (target, points), (F, "glGetDetailTexFuncSGIS(0x%x, %p);\n", target, (const void *) points)); +} + +KEYWORD1 void KEYWORD2 NAME(SharpenTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points) +{ + DISPATCH(SharpenTexFuncSGIS, (target, n, points), (F, "glSharpenTexFuncSGIS(0x%x, %d, %p);\n", target, n, (const void *) points)); +} + +KEYWORD1 void KEYWORD2 NAME(GetSharpenTexFuncSGIS)(GLenum target, GLfloat * points) +{ + DISPATCH(GetSharpenTexFuncSGIS, (target, points), (F, "glGetSharpenTexFuncSGIS(0x%x, %p);\n", target, (const void *) points)); +} + +KEYWORD1 void KEYWORD2 NAME(SampleMaskSGIS)(GLclampf value, GLboolean invert) +{ + DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskSGIS(%f, %d);\n", value, invert)); +} + +KEYWORD1 void KEYWORD2 NAME(SampleMaskEXT)(GLclampf value, GLboolean invert) +{ + DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskEXT(%f, %d);\n", value, invert)); +} + +KEYWORD1 void KEYWORD2 NAME(SamplePatternSGIS)(GLenum pattern) +{ + DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternSGIS(0x%x);\n", pattern)); +} + +KEYWORD1 void KEYWORD2 NAME(SamplePatternEXT)(GLenum pattern) +{ + DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternEXT(0x%x);\n", pattern)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) +{ + DISPATCH(ColorPointerEXT, (size, type, stride, count, pointer), (F, "glColorPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer) +{ + DISPATCH(EdgeFlagPointerEXT, (stride, count, pointer), (F, "glEdgeFlagPointerEXT(%d, %d, %p);\n", stride, count, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) +{ + DISPATCH(IndexPointerEXT, (type, stride, count, pointer), (F, "glIndexPointerEXT(0x%x, %d, %d, %p);\n", type, stride, count, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) +{ + DISPATCH(NormalPointerEXT, (type, stride, count, pointer), (F, "glNormalPointerEXT(0x%x, %d, %d, %p);\n", type, stride, count, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) +{ + DISPATCH(TexCoordPointerEXT, (size, type, stride, count, pointer), (F, "glTexCoordPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) +{ + DISPATCH(VertexPointerEXT, (size, type, stride, count, pointer), (F, "glVertexPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(SpriteParameterfSGIX)(GLenum pname, GLfloat param) +{ + DISPATCH(SpriteParameterfSGIX, (pname, param), (F, "glSpriteParameterfSGIX(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(SpriteParameterfvSGIX)(GLenum pname, const GLfloat * params) +{ + DISPATCH(SpriteParameterfvSGIX, (pname, params), (F, "glSpriteParameterfvSGIX(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(SpriteParameteriSGIX)(GLenum pname, GLint param) +{ + DISPATCH(SpriteParameteriSGIX, (pname, param), (F, "glSpriteParameteriSGIX(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(SpriteParameterivSGIX)(GLenum pname, const GLint * params) +{ + DISPATCH(SpriteParameterivSGIX, (pname, params), (F, "glSpriteParameterivSGIX(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(PointParameterf)(GLenum pname, GLfloat param) +{ + DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterf(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PointParameterfARB)(GLenum pname, GLfloat param) +{ + DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfARB(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PointParameterfEXT)(GLenum pname, GLfloat param) +{ + DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfEXT(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PointParameterfSGIS)(GLenum pname, GLfloat param) +{ + DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfSGIS(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PointParameterfv)(GLenum pname, const GLfloat * params) +{ + DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfv(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(PointParameterfvARB)(GLenum pname, const GLfloat * params) +{ + DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvARB(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum pname, const GLfloat * params) +{ + DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvEXT(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(PointParameterfvSGIS)(GLenum pname, const GLfloat * params) +{ + DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 GLint KEYWORD2 NAME(GetInstrumentsSGIX)(void) +{ + RETURN_DISPATCH(GetInstrumentsSGIX, (), (F, "glGetInstrumentsSGIX();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(InstrumentsBufferSGIX)(GLsizei size, GLint * buffer) +{ + DISPATCH(InstrumentsBufferSGIX, (size, buffer), (F, "glInstrumentsBufferSGIX(%d, %p);\n", size, (const void *) buffer)); +} + +KEYWORD1 GLint KEYWORD2 NAME(PollInstrumentsSGIX)(GLint * marker_p) +{ + RETURN_DISPATCH(PollInstrumentsSGIX, (marker_p), (F, "glPollInstrumentsSGIX(%p);\n", (const void *) marker_p)); +} + +KEYWORD1 void KEYWORD2 NAME(ReadInstrumentsSGIX)(GLint marker) +{ + DISPATCH(ReadInstrumentsSGIX, (marker), (F, "glReadInstrumentsSGIX(%d);\n", marker)); +} + +KEYWORD1 void KEYWORD2 NAME(StartInstrumentsSGIX)(void) +{ + DISPATCH(StartInstrumentsSGIX, (), (F, "glStartInstrumentsSGIX();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(StopInstrumentsSGIX)(GLint marker) +{ + DISPATCH(StopInstrumentsSGIX, (marker), (F, "glStopInstrumentsSGIX(%d);\n", marker)); +} + +KEYWORD1 void KEYWORD2 NAME(FrameZoomSGIX)(GLint factor) +{ + DISPATCH(FrameZoomSGIX, (factor), (F, "glFrameZoomSGIX(%d);\n", factor)); +} + +KEYWORD1 void KEYWORD2 NAME(TagSampleBufferSGIX)(void) +{ + DISPATCH(TagSampleBufferSGIX, (), (F, "glTagSampleBufferSGIX();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(ReferencePlaneSGIX)(const GLdouble * equation) +{ + DISPATCH(ReferencePlaneSGIX, (equation), (F, "glReferencePlaneSGIX(%p);\n", (const void *) equation)); +} + +KEYWORD1 void KEYWORD2 NAME(FlushRasterSGIX)(void) +{ + DISPATCH(FlushRasterSGIX, (), (F, "glFlushRasterSGIX();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(GetListParameterfvSGIX)(GLuint list, GLenum pname, GLfloat * params) +{ + DISPATCH(GetListParameterfvSGIX, (list, pname, params), (F, "glGetListParameterfvSGIX(%d, 0x%x, %p);\n", list, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetListParameterivSGIX)(GLuint list, GLenum pname, GLint * params) +{ + DISPATCH(GetListParameterivSGIX, (list, pname, params), (F, "glGetListParameterivSGIX(%d, 0x%x, %p);\n", list, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ListParameterfSGIX)(GLuint list, GLenum pname, GLfloat param) +{ + DISPATCH(ListParameterfSGIX, (list, pname, param), (F, "glListParameterfSGIX(%d, 0x%x, %f);\n", list, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(ListParameterfvSGIX)(GLuint list, GLenum pname, const GLfloat * params) +{ + DISPATCH(ListParameterfvSGIX, (list, pname, params), (F, "glListParameterfvSGIX(%d, 0x%x, %p);\n", list, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ListParameteriSGIX)(GLuint list, GLenum pname, GLint param) +{ + DISPATCH(ListParameteriSGIX, (list, pname, param), (F, "glListParameteriSGIX(%d, 0x%x, %d);\n", list, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(ListParameterivSGIX)(GLuint list, GLenum pname, const GLint * params) +{ + DISPATCH(ListParameterivSGIX, (list, pname, params), (F, "glListParameterivSGIX(%d, 0x%x, %p);\n", list, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentColorMaterialSGIX)(GLenum face, GLenum mode) +{ + DISPATCH(FragmentColorMaterialSGIX, (face, mode), (F, "glFragmentColorMaterialSGIX(0x%x, 0x%x);\n", face, mode)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightfSGIX)(GLenum light, GLenum pname, GLfloat param) +{ + DISPATCH(FragmentLightfSGIX, (light, pname, param), (F, "glFragmentLightfSGIX(0x%x, 0x%x, %f);\n", light, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightfvSGIX)(GLenum light, GLenum pname, const GLfloat * params) +{ + DISPATCH(FragmentLightfvSGIX, (light, pname, params), (F, "glFragmentLightfvSGIX(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightiSGIX)(GLenum light, GLenum pname, GLint param) +{ + DISPATCH(FragmentLightiSGIX, (light, pname, param), (F, "glFragmentLightiSGIX(0x%x, 0x%x, %d);\n", light, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightivSGIX)(GLenum light, GLenum pname, const GLint * params) +{ + DISPATCH(FragmentLightivSGIX, (light, pname, params), (F, "glFragmentLightivSGIX(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfSGIX)(GLenum pname, GLfloat param) +{ + DISPATCH(FragmentLightModelfSGIX, (pname, param), (F, "glFragmentLightModelfSGIX(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfvSGIX)(GLenum pname, const GLfloat * params) +{ + DISPATCH(FragmentLightModelfvSGIX, (pname, params), (F, "glFragmentLightModelfvSGIX(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightModeliSGIX)(GLenum pname, GLint param) +{ + DISPATCH(FragmentLightModeliSGIX, (pname, param), (F, "glFragmentLightModeliSGIX(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightModelivSGIX)(GLenum pname, const GLint * params) +{ + DISPATCH(FragmentLightModelivSGIX, (pname, params), (F, "glFragmentLightModelivSGIX(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfSGIX)(GLenum face, GLenum pname, GLfloat param) +{ + DISPATCH(FragmentMaterialfSGIX, (face, pname, param), (F, "glFragmentMaterialfSGIX(0x%x, 0x%x, %f);\n", face, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfvSGIX)(GLenum face, GLenum pname, const GLfloat * params) +{ + DISPATCH(FragmentMaterialfvSGIX, (face, pname, params), (F, "glFragmentMaterialfvSGIX(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentMaterialiSGIX)(GLenum face, GLenum pname, GLint param) +{ + DISPATCH(FragmentMaterialiSGIX, (face, pname, param), (F, "glFragmentMaterialiSGIX(0x%x, 0x%x, %d);\n", face, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentMaterialivSGIX)(GLenum face, GLenum pname, const GLint * params) +{ + DISPATCH(FragmentMaterialivSGIX, (face, pname, params), (F, "glFragmentMaterialivSGIX(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetFragmentLightfvSGIX)(GLenum light, GLenum pname, GLfloat * params) +{ + DISPATCH(GetFragmentLightfvSGIX, (light, pname, params), (F, "glGetFragmentLightfvSGIX(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetFragmentLightivSGIX)(GLenum light, GLenum pname, GLint * params) +{ + DISPATCH(GetFragmentLightivSGIX, (light, pname, params), (F, "glGetFragmentLightivSGIX(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialfvSGIX)(GLenum face, GLenum pname, GLfloat * params) +{ + DISPATCH(GetFragmentMaterialfvSGIX, (face, pname, params), (F, "glGetFragmentMaterialfvSGIX(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialivSGIX)(GLenum face, GLenum pname, GLint * params) +{ + DISPATCH(GetFragmentMaterialivSGIX, (face, pname, params), (F, "glGetFragmentMaterialivSGIX(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(LightEnviSGIX)(GLenum pname, GLint param) +{ + DISPATCH(LightEnviSGIX, (pname, param), (F, "glLightEnviSGIX(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexWeightfEXT)(GLfloat weight) +{ + DISPATCH(VertexWeightfEXT, (weight), (F, "glVertexWeightfEXT(%f);\n", weight)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexWeightfvEXT)(const GLfloat * weight) +{ + DISPATCH(VertexWeightfvEXT, (weight), (F, "glVertexWeightfvEXT(%p);\n", (const void *) weight)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(VertexWeightPointerEXT, (size, type, stride, pointer), (F, "glVertexWeightPointerEXT(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(FlushVertexArrayRangeNV)(void) +{ + DISPATCH(FlushVertexArrayRangeNV, (), (F, "glFlushVertexArrayRangeNV();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer) +{ + DISPATCH(VertexArrayRangeNV, (length, pointer), (F, "glVertexArrayRangeNV(%d, %p);\n", length, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(CombinerParameterfvNV)(GLenum pname, const GLfloat * params) +{ + DISPATCH(CombinerParameterfvNV, (pname, params), (F, "glCombinerParameterfvNV(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(CombinerParameterfNV)(GLenum pname, GLfloat param) +{ + DISPATCH(CombinerParameterfNV, (pname, param), (F, "glCombinerParameterfNV(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(CombinerParameterivNV)(GLenum pname, const GLint * params) +{ + DISPATCH(CombinerParameterivNV, (pname, params), (F, "glCombinerParameterivNV(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(CombinerParameteriNV)(GLenum pname, GLint param) +{ + DISPATCH(CombinerParameteriNV, (pname, param), (F, "glCombinerParameteriNV(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage) +{ + DISPATCH(CombinerInputNV, (stage, portion, variable, input, mapping, componentUsage), (F, "glCombinerInputNV(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x);\n", stage, portion, variable, input, mapping, componentUsage)); +} + +KEYWORD1 void KEYWORD2 NAME(CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum) +{ + DISPATCH(CombinerOutputNV, (stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum), (F, "glCombinerOutputNV(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, %d, %d, %d);\n", stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum)); +} + +KEYWORD1 void KEYWORD2 NAME(FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage) +{ + DISPATCH(FinalCombinerInputNV, (variable, input, mapping, componentUsage), (F, "glFinalCombinerInputNV(0x%x, 0x%x, 0x%x, 0x%x);\n", variable, input, mapping, componentUsage)); +} + +KEYWORD1 void KEYWORD2 NAME(GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params) +{ + DISPATCH(GetCombinerInputParameterfvNV, (stage, portion, variable, pname, params), (F, "glGetCombinerInputParameterfvNV(0x%x, 0x%x, 0x%x, 0x%x, %p);\n", stage, portion, variable, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params) +{ + DISPATCH(GetCombinerInputParameterivNV, (stage, portion, variable, pname, params), (F, "glGetCombinerInputParameterivNV(0x%x, 0x%x, 0x%x, 0x%x, %p);\n", stage, portion, variable, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params) +{ + DISPATCH(GetCombinerOutputParameterfvNV, (stage, portion, pname, params), (F, "glGetCombinerOutputParameterfvNV(0x%x, 0x%x, 0x%x, %p);\n", stage, portion, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params) +{ + DISPATCH(GetCombinerOutputParameterivNV, (stage, portion, pname, params), (F, "glGetCombinerOutputParameterivNV(0x%x, 0x%x, 0x%x, %p);\n", stage, portion, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params) +{ + DISPATCH(GetFinalCombinerInputParameterfvNV, (variable, pname, params), (F, "glGetFinalCombinerInputParameterfvNV(0x%x, 0x%x, %p);\n", variable, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params) +{ + DISPATCH(GetFinalCombinerInputParameterivNV, (variable, pname, params), (F, "glGetFinalCombinerInputParameterivNV(0x%x, 0x%x, %p);\n", variable, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ResizeBuffersMESA)(void) +{ + DISPATCH(ResizeBuffersMESA, (), (F, "glResizeBuffersMESA();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2d)(GLdouble x, GLdouble y) +{ + DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2d(%f, %f);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2dARB)(GLdouble x, GLdouble y) +{ + DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2dARB(%f, %f);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2dMESA)(GLdouble x, GLdouble y) +{ + DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2dMESA(%f, %f);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2dv)(const GLdouble * v) +{ + DISPATCH(WindowPos2dvMESA, (v), (F, "glWindowPos2dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2dvARB)(const GLdouble * v) +{ + DISPATCH(WindowPos2dvMESA, (v), (F, "glWindowPos2dvARB(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2dvMESA)(const GLdouble * v) +{ + DISPATCH(WindowPos2dvMESA, (v), (F, "glWindowPos2dvMESA(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2f)(GLfloat x, GLfloat y) +{ + DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2f(%f, %f);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2fARB)(GLfloat x, GLfloat y) +{ + DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2fARB(%f, %f);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2fMESA)(GLfloat x, GLfloat y) +{ + DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2fMESA(%f, %f);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2fv)(const GLfloat * v) +{ + DISPATCH(WindowPos2fvMESA, (v), (F, "glWindowPos2fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2fvARB)(const GLfloat * v) +{ + DISPATCH(WindowPos2fvMESA, (v), (F, "glWindowPos2fvARB(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2fvMESA)(const GLfloat * v) +{ + DISPATCH(WindowPos2fvMESA, (v), (F, "glWindowPos2fvMESA(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2i)(GLint x, GLint y) +{ + DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2i(%d, %d);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2iARB)(GLint x, GLint y) +{ + DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2iARB(%d, %d);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2iMESA)(GLint x, GLint y) +{ + DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2iMESA(%d, %d);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2iv)(const GLint * v) +{ + DISPATCH(WindowPos2ivMESA, (v), (F, "glWindowPos2iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2ivARB)(const GLint * v) +{ + DISPATCH(WindowPos2ivMESA, (v), (F, "glWindowPos2ivARB(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2ivMESA)(const GLint * v) +{ + DISPATCH(WindowPos2ivMESA, (v), (F, "glWindowPos2ivMESA(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2s)(GLshort x, GLshort y) +{ + DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2s(%d, %d);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2sARB)(GLshort x, GLshort y) +{ + DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2sARB(%d, %d);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2sMESA)(GLshort x, GLshort y) +{ + DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2sMESA(%d, %d);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2sv)(const GLshort * v) +{ + DISPATCH(WindowPos2svMESA, (v), (F, "glWindowPos2sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2svARB)(const GLshort * v) +{ + DISPATCH(WindowPos2svMESA, (v), (F, "glWindowPos2svARB(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2svMESA)(const GLshort * v) +{ + DISPATCH(WindowPos2svMESA, (v), (F, "glWindowPos2svMESA(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3d)(GLdouble x, GLdouble y, GLdouble z) +{ + DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3d(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3dARB)(GLdouble x, GLdouble y, GLdouble z) +{ + DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3dARB(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z) +{ + DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3dMESA(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3dv)(const GLdouble * v) +{ + DISPATCH(WindowPos3dvMESA, (v), (F, "glWindowPos3dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3dvARB)(const GLdouble * v) +{ + DISPATCH(WindowPos3dvMESA, (v), (F, "glWindowPos3dvARB(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3dvMESA)(const GLdouble * v) +{ + DISPATCH(WindowPos3dvMESA, (v), (F, "glWindowPos3dvMESA(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3f)(GLfloat x, GLfloat y, GLfloat z) +{ + DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3f(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3fARB)(GLfloat x, GLfloat y, GLfloat z) +{ + DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3fARB(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z) +{ + DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3fMESA(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3fv)(const GLfloat * v) +{ + DISPATCH(WindowPos3fvMESA, (v), (F, "glWindowPos3fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3fvARB)(const GLfloat * v) +{ + DISPATCH(WindowPos3fvMESA, (v), (F, "glWindowPos3fvARB(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3fvMESA)(const GLfloat * v) +{ + DISPATCH(WindowPos3fvMESA, (v), (F, "glWindowPos3fvMESA(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3i)(GLint x, GLint y, GLint z) +{ + DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3i(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3iARB)(GLint x, GLint y, GLint z) +{ + DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3iARB(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3iMESA)(GLint x, GLint y, GLint z) +{ + DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3iMESA(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3iv)(const GLint * v) +{ + DISPATCH(WindowPos3ivMESA, (v), (F, "glWindowPos3iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3ivARB)(const GLint * v) +{ + DISPATCH(WindowPos3ivMESA, (v), (F, "glWindowPos3ivARB(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3ivMESA)(const GLint * v) +{ + DISPATCH(WindowPos3ivMESA, (v), (F, "glWindowPos3ivMESA(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3s)(GLshort x, GLshort y, GLshort z) +{ + DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3s(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3sARB)(GLshort x, GLshort y, GLshort z) +{ + DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3sARB(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3sMESA)(GLshort x, GLshort y, GLshort z) +{ + DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3sMESA(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3sv)(const GLshort * v) +{ + DISPATCH(WindowPos3svMESA, (v), (F, "glWindowPos3sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3svARB)(const GLshort * v) +{ + DISPATCH(WindowPos3svMESA, (v), (F, "glWindowPos3svARB(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3svMESA)(const GLshort * v) +{ + DISPATCH(WindowPos3svMESA, (v), (F, "glWindowPos3svMESA(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + DISPATCH(WindowPos4dMESA, (x, y, z, w), (F, "glWindowPos4dMESA(%f, %f, %f, %f);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos4dvMESA)(const GLdouble * v) +{ + DISPATCH(WindowPos4dvMESA, (v), (F, "glWindowPos4dvMESA(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + DISPATCH(WindowPos4fMESA, (x, y, z, w), (F, "glWindowPos4fMESA(%f, %f, %f, %f);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos4fvMESA)(const GLfloat * v) +{ + DISPATCH(WindowPos4fvMESA, (v), (F, "glWindowPos4fvMESA(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w) +{ + DISPATCH(WindowPos4iMESA, (x, y, z, w), (F, "glWindowPos4iMESA(%d, %d, %d, %d);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos4ivMESA)(const GLint * v) +{ + DISPATCH(WindowPos4ivMESA, (v), (F, "glWindowPos4ivMESA(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w) +{ + DISPATCH(WindowPos4sMESA, (x, y, z, w), (F, "glWindowPos4sMESA(%d, %d, %d, %d);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos4svMESA)(const GLshort * v) +{ + DISPATCH(WindowPos4svMESA, (v), (F, "glWindowPos4svMESA(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparate)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +{ + DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); +} + +KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +{ + DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateEXT(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); +} + +KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateINGR)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +{ + DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateINGR(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); +} + +KEYWORD1 void KEYWORD2 NAME(IndexMaterialEXT)(GLenum face, GLenum mode) +{ + DISPATCH(IndexMaterialEXT, (face, mode), (F, "glIndexMaterialEXT(0x%x, 0x%x);\n", face, mode)); +} + +KEYWORD1 void KEYWORD2 NAME(IndexFuncEXT)(GLenum func, GLclampf ref) +{ + DISPATCH(IndexFuncEXT, (func, ref), (F, "glIndexFuncEXT(0x%x, %f);\n", func, ref)); +} + +KEYWORD1 void KEYWORD2 NAME(LockArraysEXT)(GLint first, GLsizei count) +{ + DISPATCH(LockArraysEXT, (first, count), (F, "glLockArraysEXT(%d, %d);\n", first, count)); +} + +KEYWORD1 void KEYWORD2 NAME(UnlockArraysEXT)(void) +{ + DISPATCH(UnlockArraysEXT, (), (F, "glUnlockArraysEXT();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(CullParameterdvEXT)(GLenum pname, GLdouble * params) +{ + DISPATCH(CullParameterdvEXT, (pname, params), (F, "glCullParameterdvEXT(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(CullParameterfvEXT)(GLenum pname, GLfloat * params) +{ + DISPATCH(CullParameterfvEXT, (pname, params), (F, "glCullParameterfvEXT(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(HintPGI)(GLenum target, GLint mode) +{ + DISPATCH(HintPGI, (target, mode), (F, "glHintPGI(0x%x, %d);\n", target, mode)); +} + +KEYWORD1 void KEYWORD2 NAME(FogCoordf)(GLfloat coord) +{ + DISPATCH(FogCoordfEXT, (coord), (F, "glFogCoordf(%f);\n", coord)); +} + +KEYWORD1 void KEYWORD2 NAME(FogCoordfEXT)(GLfloat coord) +{ + DISPATCH(FogCoordfEXT, (coord), (F, "glFogCoordfEXT(%f);\n", coord)); +} + +KEYWORD1 void KEYWORD2 NAME(FogCoordfv)(const GLfloat * coord) +{ + DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfv(%p);\n", (const void *) coord)); +} + +KEYWORD1 void KEYWORD2 NAME(FogCoordfvEXT)(const GLfloat * coord) +{ + DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfvEXT(%p);\n", (const void *) coord)); +} + +KEYWORD1 void KEYWORD2 NAME(FogCoordd)(GLdouble coord) +{ + DISPATCH(FogCoorddEXT, (coord), (F, "glFogCoordd(%f);\n", coord)); +} + +KEYWORD1 void KEYWORD2 NAME(FogCoorddEXT)(GLdouble coord) +{ + DISPATCH(FogCoorddEXT, (coord), (F, "glFogCoorddEXT(%f);\n", coord)); +} + +KEYWORD1 void KEYWORD2 NAME(FogCoorddv)(const GLdouble * coord) +{ + DISPATCH(FogCoorddvEXT, (coord), (F, "glFogCoorddv(%p);\n", (const void *) coord)); +} + +KEYWORD1 void KEYWORD2 NAME(FogCoorddvEXT)(const GLdouble * coord) +{ + DISPATCH(FogCoorddvEXT, (coord), (F, "glFogCoorddvEXT(%p);\n", (const void *) coord)); +} + +KEYWORD1 void KEYWORD2 NAME(FogCoordPointer)(GLenum type, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(FogCoordPointerEXT, (type, stride, pointer), (F, "glFogCoordPointer(0x%x, %d, %p);\n", type, stride, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(FogCoordPointerEXT, (type, stride, pointer), (F, "glFogCoordPointerEXT(0x%x, %d, %p);\n", type, stride, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid * data) +{ + DISPATCH(GetColorTableEXT, (target, format, type, data), (F, "glGetColorTableEXT(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetColorTableParameterivEXT, (target, pname, params), (F, "glGetColorTableParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) +{ + DISPATCH(GetColorTableParameterfvEXT, (target, pname, params), (F, "glGetColorTableParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(TbufferMask3DFX)(GLuint mask) +{ + DISPATCH(TbufferMask3DFX, (mask), (F, "glTbufferMask3DFX(%d);\n", mask)); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data) +{ + DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3D(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, depth, border, imageSize, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data) +{ + DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3DARB(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, depth, border, imageSize, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data) +{ + DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2D(0x%x, %d, 0x%x, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, border, imageSize, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data) +{ + DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2DARB(0x%x, %d, 0x%x, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, border, imageSize, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data) +{ + DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1D(0x%x, %d, 0x%x, %d, %d, %d, %p);\n", target, level, internalformat, width, border, imageSize, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data) +{ + DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1DARB(0x%x, %d, 0x%x, %d, %d, %d, %p);\n", target, level, internalformat, width, border, imageSize, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data) +{ + DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data) +{ + DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3DARB(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data) +{ + DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, width, height, format, imageSize, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data) +{ + DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2DARB(0x%x, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, width, height, format, imageSize, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data) +{ + DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1D(0x%x, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, width, format, imageSize, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data) +{ + DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1DARB(0x%x, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, width, format, imageSize, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImage)(GLenum target, GLint level, GLvoid * img) +{ + DISPATCH(GetCompressedTexImageARB, (target, level, img), (F, "glGetCompressedTexImage(0x%x, %d, %p);\n", target, level, (const void *) img)); +} + +KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img) +{ + DISPATCH(GetCompressedTexImageARB, (target, level, img), (F, "glGetCompressedTexImageARB(0x%x, %d, %p);\n", target, level, (const void *) img)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3b)(GLbyte red, GLbyte green, GLbyte blue) +{ + DISPATCH(SecondaryColor3bEXT, (red, green, blue), (F, "glSecondaryColor3b(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue) +{ + DISPATCH(SecondaryColor3bEXT, (red, green, blue), (F, "glSecondaryColor3bEXT(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bv)(const GLbyte * v) +{ + DISPATCH(SecondaryColor3bvEXT, (v), (F, "glSecondaryColor3bv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bvEXT)(const GLbyte * v) +{ + DISPATCH(SecondaryColor3bvEXT, (v), (F, "glSecondaryColor3bvEXT(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3d)(GLdouble red, GLdouble green, GLdouble blue) +{ + DISPATCH(SecondaryColor3dEXT, (red, green, blue), (F, "glSecondaryColor3d(%f, %f, %f);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue) +{ + DISPATCH(SecondaryColor3dEXT, (red, green, blue), (F, "glSecondaryColor3dEXT(%f, %f, %f);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dv)(const GLdouble * v) +{ + DISPATCH(SecondaryColor3dvEXT, (v), (F, "glSecondaryColor3dv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dvEXT)(const GLdouble * v) +{ + DISPATCH(SecondaryColor3dvEXT, (v), (F, "glSecondaryColor3dvEXT(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3f)(GLfloat red, GLfloat green, GLfloat blue) +{ + DISPATCH(SecondaryColor3fEXT, (red, green, blue), (F, "glSecondaryColor3f(%f, %f, %f);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue) +{ + DISPATCH(SecondaryColor3fEXT, (red, green, blue), (F, "glSecondaryColor3fEXT(%f, %f, %f);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fv)(const GLfloat * v) +{ + DISPATCH(SecondaryColor3fvEXT, (v), (F, "glSecondaryColor3fv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fvEXT)(const GLfloat * v) +{ + DISPATCH(SecondaryColor3fvEXT, (v), (F, "glSecondaryColor3fvEXT(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3i)(GLint red, GLint green, GLint blue) +{ + DISPATCH(SecondaryColor3iEXT, (red, green, blue), (F, "glSecondaryColor3i(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3iEXT)(GLint red, GLint green, GLint blue) +{ + DISPATCH(SecondaryColor3iEXT, (red, green, blue), (F, "glSecondaryColor3iEXT(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3iv)(const GLint * v) +{ + DISPATCH(SecondaryColor3ivEXT, (v), (F, "glSecondaryColor3iv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ivEXT)(const GLint * v) +{ + DISPATCH(SecondaryColor3ivEXT, (v), (F, "glSecondaryColor3ivEXT(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3s)(GLshort red, GLshort green, GLshort blue) +{ + DISPATCH(SecondaryColor3sEXT, (red, green, blue), (F, "glSecondaryColor3s(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue) +{ + DISPATCH(SecondaryColor3sEXT, (red, green, blue), (F, "glSecondaryColor3sEXT(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3sv)(const GLshort * v) +{ + DISPATCH(SecondaryColor3svEXT, (v), (F, "glSecondaryColor3sv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3svEXT)(const GLshort * v) +{ + DISPATCH(SecondaryColor3svEXT, (v), (F, "glSecondaryColor3svEXT(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ub)(GLubyte red, GLubyte green, GLubyte blue) +{ + DISPATCH(SecondaryColor3ubEXT, (red, green, blue), (F, "glSecondaryColor3ub(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue) +{ + DISPATCH(SecondaryColor3ubEXT, (red, green, blue), (F, "glSecondaryColor3ubEXT(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubv)(const GLubyte * v) +{ + DISPATCH(SecondaryColor3ubvEXT, (v), (F, "glSecondaryColor3ubv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubvEXT)(const GLubyte * v) +{ + DISPATCH(SecondaryColor3ubvEXT, (v), (F, "glSecondaryColor3ubvEXT(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ui)(GLuint red, GLuint green, GLuint blue) +{ + DISPATCH(SecondaryColor3uiEXT, (red, green, blue), (F, "glSecondaryColor3ui(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue) +{ + DISPATCH(SecondaryColor3uiEXT, (red, green, blue), (F, "glSecondaryColor3uiEXT(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uiv)(const GLuint * v) +{ + DISPATCH(SecondaryColor3uivEXT, (v), (F, "glSecondaryColor3uiv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uivEXT)(const GLuint * v) +{ + DISPATCH(SecondaryColor3uivEXT, (v), (F, "glSecondaryColor3uivEXT(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3us)(GLushort red, GLushort green, GLushort blue) +{ + DISPATCH(SecondaryColor3usEXT, (red, green, blue), (F, "glSecondaryColor3us(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue) +{ + DISPATCH(SecondaryColor3usEXT, (red, green, blue), (F, "glSecondaryColor3usEXT(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usv)(const GLushort * v) +{ + DISPATCH(SecondaryColor3usvEXT, (v), (F, "glSecondaryColor3usv(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usvEXT)(const GLushort * v) +{ + DISPATCH(SecondaryColor3usvEXT, (v), (F, "glSecondaryColor3usvEXT(%p);\n", (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointerEXT(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences) +{ + RETURN_DISPATCH(AreProgramsResidentNV, (n, ids, residences), (F, "glAreProgramsResidentNV(%d, %p, %p);\n", n, (const void *) ids, (const void *) residences)); +} + +KEYWORD1 void KEYWORD2 NAME(BindProgramARB)(GLenum target, GLuint program) +{ + DISPATCH(BindProgramNV, (target, program), (F, "glBindProgramARB(0x%x, %d);\n", target, program)); +} + +KEYWORD1 void KEYWORD2 NAME(BindProgramNV)(GLenum target, GLuint program) +{ + DISPATCH(BindProgramNV, (target, program), (F, "glBindProgramNV(0x%x, %d);\n", target, program)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteProgramsARB)(GLsizei n, const GLuint * programs) +{ + DISPATCH(DeleteProgramsNV, (n, programs), (F, "glDeleteProgramsARB(%d, %p);\n", n, (const void *) programs)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteProgramsNV)(GLsizei n, const GLuint * programs) +{ + DISPATCH(DeleteProgramsNV, (n, programs), (F, "glDeleteProgramsNV(%d, %p);\n", n, (const void *) programs)); +} + +KEYWORD1 void KEYWORD2 NAME(ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params) +{ + DISPATCH(ExecuteProgramNV, (target, id, params), (F, "glExecuteProgramNV(0x%x, %d, %p);\n", target, id, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GenProgramsARB)(GLsizei n, GLuint * programs) +{ + DISPATCH(GenProgramsNV, (n, programs), (F, "glGenProgramsARB(%d, %p);\n", n, (const void *) programs)); +} + +KEYWORD1 void KEYWORD2 NAME(GenProgramsNV)(GLsizei n, GLuint * programs) +{ + DISPATCH(GenProgramsNV, (n, programs), (F, "glGenProgramsNV(%d, %p);\n", n, (const void *) programs)); +} + +KEYWORD1 void KEYWORD2 NAME(GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params) +{ + DISPATCH(GetProgramParameterdvNV, (target, index, pname, params), (F, "glGetProgramParameterdvNV(0x%x, %d, 0x%x, %p);\n", target, index, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params) +{ + DISPATCH(GetProgramParameterfvNV, (target, index, pname, params), (F, "glGetProgramParameterfvNV(0x%x, %d, 0x%x, %p);\n", target, index, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetProgramivNV)(GLuint id, GLenum pname, GLint * params) +{ + DISPATCH(GetProgramivNV, (id, pname, params), (F, "glGetProgramivNV(%d, 0x%x, %p);\n", id, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program) +{ + DISPATCH(GetProgramStringNV, (id, pname, program), (F, "glGetProgramStringNV(%d, 0x%x, %p);\n", id, pname, (const void *) program)); +} + +KEYWORD1 void KEYWORD2 NAME(GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params) +{ + DISPATCH(GetTrackMatrixivNV, (target, address, pname, params), (F, "glGetTrackMatrixivNV(0x%x, %d, 0x%x, %p);\n", target, address, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribdvARB)(GLuint index, GLenum pname, GLdouble * params) +{ + DISPATCH(GetVertexAttribdvARB, (index, pname, params), (F, "glGetVertexAttribdvARB(%d, 0x%x, %p);\n", index, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribfvARB)(GLuint index, GLenum pname, GLfloat * params) +{ + DISPATCH(GetVertexAttribfvARB, (index, pname, params), (F, "glGetVertexAttribfvARB(%d, 0x%x, %p);\n", index, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribivARB)(GLuint index, GLenum pname, GLint * params) +{ + DISPATCH(GetVertexAttribivARB, (index, pname, params), (F, "glGetVertexAttribivARB(%d, 0x%x, %p);\n", index, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribPointervARB)(GLuint index, GLenum pname, GLvoid ** params) +{ + DISPATCH(GetVertexAttribPointervNV, (index, pname, params), (F, "glGetVertexAttribPointervARB(%d, 0x%x, %p);\n", index, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** params) +{ + DISPATCH(GetVertexAttribPointervNV, (index, pname, params), (F, "glGetVertexAttribPointervNV(%d, 0x%x, %p);\n", index, pname, (const void *) params)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(IsProgramARB)(GLuint program) +{ + RETURN_DISPATCH(IsProgramNV, (program), (F, "glIsProgramARB(%d);\n", program)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(IsProgramNV)(GLuint program) +{ + RETURN_DISPATCH(IsProgramNV, (program), (F, "glIsProgramNV(%d);\n", program)); +} + +KEYWORD1 void KEYWORD2 NAME(LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program) +{ + DISPATCH(LoadProgramNV, (target, id, len, program), (F, "glLoadProgramNV(0x%x, %d, %d, %p);\n", target, id, len, (const void *) program)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramParameter4dNV)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + DISPATCH(ProgramParameter4dNV, (target, index, x, y, z, w), (F, "glProgramParameter4dNV(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramParameter4dvNV)(GLenum target, GLuint index, const GLdouble * params) +{ + DISPATCH(ProgramParameter4dvNV, (target, index, params), (F, "glProgramParameter4dvNV(0x%x, %d, %p);\n", target, index, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramParameter4fNV)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + DISPATCH(ProgramParameter4fNV, (target, index, x, y, z, w), (F, "glProgramParameter4fNV(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramParameter4fvNV)(GLenum target, GLuint index, const GLfloat * params) +{ + DISPATCH(ProgramParameter4fvNV, (target, index, params), (F, "glProgramParameter4fvNV(0x%x, %d, %p);\n", target, index, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params) +{ + DISPATCH(ProgramParameters4dvNV, (target, index, num, params), (F, "glProgramParameters4dvNV(0x%x, %d, %d, %p);\n", target, index, num, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params) +{ + DISPATCH(ProgramParameters4fvNV, (target, index, num, params), (F, "glProgramParameters4fvNV(0x%x, %d, %d, %p);\n", target, index, num, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(RequestResidentProgramsNV)(GLsizei n, const GLuint * ids) +{ + DISPATCH(RequestResidentProgramsNV, (n, ids), (F, "glRequestResidentProgramsNV(%d, %p);\n", n, (const void *) ids)); +} + +KEYWORD1 void KEYWORD2 NAME(TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform) +{ + DISPATCH(TrackMatrixNV, (target, address, matrix, transform), (F, "glTrackMatrixNV(0x%x, %d, 0x%x, 0x%x);\n", target, address, matrix, transform)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(VertexAttribPointerNV, (index, size, type, stride, pointer), (F, "glVertexAttribPointerNV(%d, %d, 0x%x, %d, %p);\n", index, size, type, stride, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dARB)(GLuint index, GLdouble x) +{ + DISPATCH(VertexAttrib1dARB, (index, x), (F, "glVertexAttrib1dARB(%d, %f);\n", index, x)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dvARB)(GLuint index, const GLdouble * v) +{ + DISPATCH(VertexAttrib1dvARB, (index, v), (F, "glVertexAttrib1dvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fARB)(GLuint index, GLfloat x) +{ + DISPATCH(VertexAttrib1fARB, (index, x), (F, "glVertexAttrib1fARB(%d, %f);\n", index, x)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fvARB)(GLuint index, const GLfloat * v) +{ + DISPATCH(VertexAttrib1fvARB, (index, v), (F, "glVertexAttrib1fvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1sARB)(GLuint index, GLshort x) +{ + DISPATCH(VertexAttrib1sARB, (index, x), (F, "glVertexAttrib1sARB(%d, %d);\n", index, x)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1svARB)(GLuint index, const GLshort * v) +{ + DISPATCH(VertexAttrib1svARB, (index, v), (F, "glVertexAttrib1svARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dARB)(GLuint index, GLdouble x, GLdouble y) +{ + DISPATCH(VertexAttrib2dARB, (index, x, y), (F, "glVertexAttrib2dARB(%d, %f, %f);\n", index, x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dvARB)(GLuint index, const GLdouble * v) +{ + DISPATCH(VertexAttrib2dvARB, (index, v), (F, "glVertexAttrib2dvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y) +{ + DISPATCH(VertexAttrib2fARB, (index, x, y), (F, "glVertexAttrib2fARB(%d, %f, %f);\n", index, x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fvARB)(GLuint index, const GLfloat * v) +{ + DISPATCH(VertexAttrib2fvARB, (index, v), (F, "glVertexAttrib2fvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2sARB)(GLuint index, GLshort x, GLshort y) +{ + DISPATCH(VertexAttrib2sARB, (index, x, y), (F, "glVertexAttrib2sARB(%d, %d, %d);\n", index, x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2svARB)(GLuint index, const GLshort * v) +{ + DISPATCH(VertexAttrib2svARB, (index, v), (F, "glVertexAttrib2svARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + DISPATCH(VertexAttrib3dARB, (index, x, y, z), (F, "glVertexAttrib3dARB(%d, %f, %f, %f);\n", index, x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dvARB)(GLuint index, const GLdouble * v) +{ + DISPATCH(VertexAttrib3dvARB, (index, v), (F, "glVertexAttrib3dvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z) +{ + DISPATCH(VertexAttrib3fARB, (index, x, y, z), (F, "glVertexAttrib3fARB(%d, %f, %f, %f);\n", index, x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fvARB)(GLuint index, const GLfloat * v) +{ + DISPATCH(VertexAttrib3fvARB, (index, v), (F, "glVertexAttrib3fvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3sARB)(GLuint index, GLshort x, GLshort y, GLshort z) +{ + DISPATCH(VertexAttrib3sARB, (index, x, y, z), (F, "glVertexAttrib3sARB(%d, %d, %d, %d);\n", index, x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3svARB)(GLuint index, const GLshort * v) +{ + DISPATCH(VertexAttrib3svARB, (index, v), (F, "glVertexAttrib3svARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + DISPATCH(VertexAttrib4dARB, (index, x, y, z, w), (F, "glVertexAttrib4dARB(%d, %f, %f, %f, %f);\n", index, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dvARB)(GLuint index, const GLdouble * v) +{ + DISPATCH(VertexAttrib4dvARB, (index, v), (F, "glVertexAttrib4dvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + DISPATCH(VertexAttrib4fARB, (index, x, y, z, w), (F, "glVertexAttrib4fARB(%d, %f, %f, %f, %f);\n", index, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fvARB)(GLuint index, const GLfloat * v) +{ + DISPATCH(VertexAttrib4fvARB, (index, v), (F, "glVertexAttrib4fvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4sARB)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) +{ + DISPATCH(VertexAttrib4sARB, (index, x, y, z, w), (F, "glVertexAttrib4sARB(%d, %d, %d, %d, %d);\n", index, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4svARB)(GLuint index, const GLshort * v) +{ + DISPATCH(VertexAttrib4svARB, (index, v), (F, "glVertexAttrib4svARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NubARB)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) +{ + DISPATCH(VertexAttrib4NubARB, (index, x, y, z, w), (F, "glVertexAttrib4NubARB(%d, %d, %d, %d, %d);\n", index, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NubvARB)(GLuint index, const GLubyte * v) +{ + DISPATCH(VertexAttrib4NubvARB, (index, v), (F, "glVertexAttrib4NubvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v) +{ + DISPATCH(VertexAttribs1dvNV, (index, n, v), (F, "glVertexAttribs1dvNV(%d, %d, %p);\n", index, n, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v) +{ + DISPATCH(VertexAttribs1fvNV, (index, n, v), (F, "glVertexAttribs1fvNV(%d, %d, %p);\n", index, n, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v) +{ + DISPATCH(VertexAttribs1svNV, (index, n, v), (F, "glVertexAttribs1svNV(%d, %d, %p);\n", index, n, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v) +{ + DISPATCH(VertexAttribs2dvNV, (index, n, v), (F, "glVertexAttribs2dvNV(%d, %d, %p);\n", index, n, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v) +{ + DISPATCH(VertexAttribs2fvNV, (index, n, v), (F, "glVertexAttribs2fvNV(%d, %d, %p);\n", index, n, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v) +{ + DISPATCH(VertexAttribs2svNV, (index, n, v), (F, "glVertexAttribs2svNV(%d, %d, %p);\n", index, n, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v) +{ + DISPATCH(VertexAttribs3dvNV, (index, n, v), (F, "glVertexAttribs3dvNV(%d, %d, %p);\n", index, n, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v) +{ + DISPATCH(VertexAttribs3fvNV, (index, n, v), (F, "glVertexAttribs3fvNV(%d, %d, %p);\n", index, n, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v) +{ + DISPATCH(VertexAttribs3svNV, (index, n, v), (F, "glVertexAttribs3svNV(%d, %d, %p);\n", index, n, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v) +{ + DISPATCH(VertexAttribs4dvNV, (index, n, v), (F, "glVertexAttribs4dvNV(%d, %d, %p);\n", index, n, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v) +{ + DISPATCH(VertexAttribs4fvNV, (index, n, v), (F, "glVertexAttribs4fvNV(%d, %d, %p);\n", index, n, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v) +{ + DISPATCH(VertexAttribs4svNV, (index, n, v), (F, "glVertexAttribs4svNV(%d, %d, %p);\n", index, n, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v) +{ + DISPATCH(VertexAttribs4ubvNV, (index, n, v), (F, "glVertexAttribs4ubvNV(%d, %d, %p);\n", index, n, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(PointParameteri)(GLenum pname, GLint param) +{ + DISPATCH(PointParameteriNV, (pname, param), (F, "glPointParameteri(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PointParameteriNV)(GLenum pname, GLint param) +{ + DISPATCH(PointParameteriNV, (pname, param), (F, "glPointParameteriNV(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PointParameteriv)(GLenum pname, const GLint * params) +{ + DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameteriv(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(PointParameterivNV)(GLenum pname, const GLint * params) +{ + DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameterivNV(0x%x, %p);\n", pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiDrawArrays)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount) +{ + DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArrays(0x%x, %p, %p, %d);\n", mode, (const void *) first, (const void *) count, primcount)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount) +{ + DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArraysEXT(0x%x, %p, %p, %d);\n", mode, (const void *) first, (const void *) count, primcount)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiDrawElements)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount) +{ + DISPATCH(MultiDrawElementsEXT, (mode, count, type, indices, primcount), (F, "glMultiDrawElements(0x%x, %p, 0x%x, %p, %d);\n", mode, (const void *) count, type, (const void *) indices, primcount)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount) +{ + DISPATCH(MultiDrawElementsEXT, (mode, count, type, indices, primcount), (F, "glMultiDrawElementsEXT(0x%x, %p, 0x%x, %p, %d);\n", mode, (const void *) count, type, (const void *) indices, primcount)); +} + +KEYWORD1 void KEYWORD2 NAME(ActiveStencilFaceEXT)(GLenum face) +{ + DISPATCH(ActiveStencilFaceEXT, (face), (F, "glActiveStencilFaceEXT(0x%x);\n", face)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteFencesNV)(GLsizei n, const GLuint * fences) +{ + DISPATCH(DeleteFencesNV, (n, fences), (F, "glDeleteFencesNV(%d, %p);\n", n, (const void *) fences)); +} + +KEYWORD1 void KEYWORD2 NAME(GenFencesNV)(GLsizei n, GLuint * fences) +{ + DISPATCH(GenFencesNV, (n, fences), (F, "glGenFencesNV(%d, %p);\n", n, (const void *) fences)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(IsFenceNV)(GLuint fence) +{ + RETURN_DISPATCH(IsFenceNV, (fence), (F, "glIsFenceNV(%d);\n", fence)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(TestFenceNV)(GLuint fence) +{ + RETURN_DISPATCH(TestFenceNV, (fence), (F, "glTestFenceNV(%d);\n", fence)); +} + +KEYWORD1 void KEYWORD2 NAME(GetFenceivNV)(GLuint fence, GLenum pname, GLint * params) +{ + DISPATCH(GetFenceivNV, (fence, pname, params), (F, "glGetFenceivNV(%d, 0x%x, %p);\n", fence, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(FinishFenceNV)(GLuint fence) +{ + DISPATCH(FinishFenceNV, (fence), (F, "glFinishFenceNV(%d);\n", fence)); +} + +KEYWORD1 void KEYWORD2 NAME(SetFenceNV)(GLuint fence, GLenum condition) +{ + DISPATCH(SetFenceNV, (fence, condition), (F, "glSetFenceNV(%d, 0x%x);\n", fence, condition)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4bvARB)(GLuint index, const GLbyte * v) +{ + DISPATCH(VertexAttrib4bvARB, (index, v), (F, "glVertexAttrib4bvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ivARB)(GLuint index, const GLint * v) +{ + DISPATCH(VertexAttrib4ivARB, (index, v), (F, "glVertexAttrib4ivARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubvARB)(GLuint index, const GLubyte * v) +{ + DISPATCH(VertexAttrib4ubvARB, (index, v), (F, "glVertexAttrib4ubvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4usvARB)(GLuint index, const GLushort * v) +{ + DISPATCH(VertexAttrib4usvARB, (index, v), (F, "glVertexAttrib4usvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4uivARB)(GLuint index, const GLuint * v) +{ + DISPATCH(VertexAttrib4uivARB, (index, v), (F, "glVertexAttrib4uivARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NbvARB)(GLuint index, const GLbyte * v) +{ + DISPATCH(VertexAttrib4NbvARB, (index, v), (F, "glVertexAttrib4NbvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NsvARB)(GLuint index, const GLshort * v) +{ + DISPATCH(VertexAttrib4NsvARB, (index, v), (F, "glVertexAttrib4NsvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NivARB)(GLuint index, const GLint * v) +{ + DISPATCH(VertexAttrib4NivARB, (index, v), (F, "glVertexAttrib4NivARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NusvARB)(GLuint index, const GLushort * v) +{ + DISPATCH(VertexAttrib4NusvARB, (index, v), (F, "glVertexAttrib4NusvARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NuivARB)(GLuint index, const GLuint * v) +{ + DISPATCH(VertexAttrib4NuivARB, (index, v), (F, "glVertexAttrib4NuivARB(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(VertexAttribPointerARB, (index, size, type, normalized, stride, pointer), (F, "glVertexAttribPointerARB(%d, %d, 0x%x, %d, %d, %p);\n", index, size, type, normalized, stride, (const void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(EnableVertexAttribArrayARB)(GLuint index) +{ + DISPATCH(EnableVertexAttribArrayARB, (index), (F, "glEnableVertexAttribArrayARB(%d);\n", index)); +} + +KEYWORD1 void KEYWORD2 NAME(DisableVertexAttribArrayARB)(GLuint index) +{ + DISPATCH(DisableVertexAttribArrayARB, (index), (F, "glDisableVertexAttribArrayARB(%d);\n", index)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid * string) +{ + DISPATCH(ProgramStringARB, (target, format, len, string), (F, "glProgramStringARB(0x%x, 0x%x, %d, %p);\n", target, format, len, (const void *) string)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramEnvParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + DISPATCH(ProgramEnvParameter4dARB, (target, index, x, y, z, w), (F, "glProgramEnvParameter4dARB(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramEnvParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params) +{ + DISPATCH(ProgramEnvParameter4dvARB, (target, index, params), (F, "glProgramEnvParameter4dvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramEnvParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + DISPATCH(ProgramEnvParameter4fARB, (target, index, x, y, z, w), (F, "glProgramEnvParameter4fARB(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramEnvParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params) +{ + DISPATCH(ProgramEnvParameter4fvARB, (target, index, params), (F, "glProgramEnvParameter4fvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + DISPATCH(ProgramLocalParameter4dARB, (target, index, x, y, z, w), (F, "glProgramLocalParameter4dARB(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramLocalParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params) +{ + DISPATCH(ProgramLocalParameter4dvARB, (target, index, params), (F, "glProgramLocalParameter4dvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramLocalParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + DISPATCH(ProgramLocalParameter4fARB, (target, index, x, y, z, w), (F, "glProgramLocalParameter4fARB(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params) +{ + DISPATCH(ProgramLocalParameter4fvARB, (target, index, params), (F, "glProgramLocalParameter4fvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetProgramEnvParameterdvARB)(GLenum target, GLuint index, GLdouble * params) +{ + DISPATCH(GetProgramEnvParameterdvARB, (target, index, params), (F, "glGetProgramEnvParameterdvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetProgramEnvParameterfvARB)(GLenum target, GLuint index, GLfloat * params) +{ + DISPATCH(GetProgramEnvParameterfvARB, (target, index, params), (F, "glGetProgramEnvParameterfvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble * params) +{ + DISPATCH(GetProgramLocalParameterdvARB, (target, index, params), (F, "glGetProgramLocalParameterdvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetProgramLocalParameterfvARB)(GLenum target, GLuint index, GLfloat * params) +{ + DISPATCH(GetProgramLocalParameterfvARB, (target, index, params), (F, "glGetProgramLocalParameterfvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetProgramivARB)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetProgramivARB, (target, pname, params), (F, "glGetProgramivARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetProgramStringARB)(GLenum target, GLenum pname, GLvoid * string) +{ + DISPATCH(GetProgramStringARB, (target, pname, string), (F, "glGetProgramStringARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) string)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + DISPATCH(ProgramNamedParameter4fNV, (id, len, name, x, y, z, w), (F, "glProgramNamedParameter4fNV(%d, %d, %p, %f, %f, %f, %f);\n", id, len, (const void *) name, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + DISPATCH(ProgramNamedParameter4dNV, (id, len, name, x, y, z, w), (F, "glProgramNamedParameter4dNV(%d, %d, %p, %f, %f, %f, %f);\n", id, len, (const void *) name, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v) +{ + DISPATCH(ProgramNamedParameter4fvNV, (id, len, name, v), (F, "glProgramNamedParameter4fvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v) +{ + DISPATCH(ProgramNamedParameter4dvNV, (id, len, name, v), (F, "glProgramNamedParameter4dvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params) +{ + DISPATCH(GetProgramNamedParameterfvNV, (id, len, name, params), (F, "glGetProgramNamedParameterfvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params) +{ + DISPATCH(GetProgramNamedParameterdvNV, (id, len, name, params), (F, "glGetProgramNamedParameterdvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(BindBuffer)(GLenum target, GLuint buffer) +{ + DISPATCH(BindBufferARB, (target, buffer), (F, "glBindBuffer(0x%x, %d);\n", target, buffer)); +} + +KEYWORD1 void KEYWORD2 NAME(BindBufferARB)(GLenum target, GLuint buffer) +{ + DISPATCH(BindBufferARB, (target, buffer), (F, "glBindBufferARB(0x%x, %d);\n", target, buffer)); +} + +KEYWORD1 void KEYWORD2 NAME(BufferData)(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage) +{ + DISPATCH(BufferDataARB, (target, size, data, usage), (F, "glBufferData(0x%x, %d, %p, 0x%x);\n", target, size, (const void *) data, usage)); +} + +KEYWORD1 void KEYWORD2 NAME(BufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage) +{ + DISPATCH(BufferDataARB, (target, size, data, usage), (F, "glBufferDataARB(0x%x, %d, %p, 0x%x);\n", target, size, (const void *) data, usage)); +} + +KEYWORD1 void KEYWORD2 NAME(BufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data) +{ + DISPATCH(BufferSubDataARB, (target, offset, size, data), (F, "glBufferSubData(0x%x, %d, %d, %p);\n", target, offset, size, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(BufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data) +{ + DISPATCH(BufferSubDataARB, (target, offset, size, data), (F, "glBufferSubDataARB(0x%x, %d, %d, %p);\n", target, offset, size, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteBuffers)(GLsizei n, const GLuint * buffer) +{ + DISPATCH(DeleteBuffersARB, (n, buffer), (F, "glDeleteBuffers(%d, %p);\n", n, (const void *) buffer)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteBuffersARB)(GLsizei n, const GLuint * buffer) +{ + DISPATCH(DeleteBuffersARB, (n, buffer), (F, "glDeleteBuffersARB(%d, %p);\n", n, (const void *) buffer)); +} + +KEYWORD1 void KEYWORD2 NAME(GenBuffers)(GLsizei n, GLuint * buffer) +{ + DISPATCH(GenBuffersARB, (n, buffer), (F, "glGenBuffers(%d, %p);\n", n, (const void *) buffer)); +} + +KEYWORD1 void KEYWORD2 NAME(GenBuffersARB)(GLsizei n, GLuint * buffer) +{ + DISPATCH(GenBuffersARB, (n, buffer), (F, "glGenBuffersARB(%d, %p);\n", n, (const void *) buffer)); +} + +KEYWORD1 void KEYWORD2 NAME(GetBufferParameteriv)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetBufferParameterivARB, (target, pname, params), (F, "glGetBufferParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetBufferParameterivARB)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetBufferParameterivARB, (target, pname, params), (F, "glGetBufferParameterivARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetBufferPointerv)(GLenum target, GLenum pname, GLvoid ** params) +{ + DISPATCH(GetBufferPointervARB, (target, pname, params), (F, "glGetBufferPointerv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetBufferPointervARB)(GLenum target, GLenum pname, GLvoid ** params) +{ + DISPATCH(GetBufferPointervARB, (target, pname, params), (F, "glGetBufferPointervARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid * data) +{ + DISPATCH(GetBufferSubDataARB, (target, offset, size, data), (F, "glGetBufferSubData(0x%x, %d, %d, %p);\n", target, offset, size, (const void *) data)); +} + +KEYWORD1 void KEYWORD2 NAME(GetBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data) +{ + DISPATCH(GetBufferSubDataARB, (target, offset, size, data), (F, "glGetBufferSubDataARB(0x%x, %d, %d, %p);\n", target, offset, size, (const void *) data)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(IsBuffer)(GLuint buffer) +{ + RETURN_DISPATCH(IsBufferARB, (buffer), (F, "glIsBuffer(%d);\n", buffer)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(IsBufferARB)(GLuint buffer) +{ + RETURN_DISPATCH(IsBufferARB, (buffer), (F, "glIsBufferARB(%d);\n", buffer)); +} + +KEYWORD1 GLvoid * KEYWORD2 NAME(MapBuffer)(GLenum target, GLenum access) +{ + RETURN_DISPATCH(MapBufferARB, (target, access), (F, "glMapBuffer(0x%x, 0x%x);\n", target, access)); +} + +KEYWORD1 GLvoid * KEYWORD2 NAME(MapBufferARB)(GLenum target, GLenum access) +{ + RETURN_DISPATCH(MapBufferARB, (target, access), (F, "glMapBufferARB(0x%x, 0x%x);\n", target, access)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(UnmapBuffer)(GLenum target) +{ + RETURN_DISPATCH(UnmapBufferARB, (target), (F, "glUnmapBuffer(0x%x);\n", target)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(UnmapBufferARB)(GLenum target) +{ + RETURN_DISPATCH(UnmapBufferARB, (target), (F, "glUnmapBufferARB(0x%x);\n", target)); +} + +KEYWORD1 void KEYWORD2 NAME(DepthBoundsEXT)(GLclampd zmin, GLclampd zmax) +{ + DISPATCH(DepthBoundsEXT, (zmin, zmax), (F, "glDepthBoundsEXT(%f, %f);\n", zmin, zmax)); +} + +KEYWORD1 void KEYWORD2 NAME(GenQueries)(GLsizei n, GLuint * ids) +{ + DISPATCH(GenQueriesARB, (n, ids), (F, "glGenQueries(%d, %p);\n", n, (const void *) ids)); +} + +KEYWORD1 void KEYWORD2 NAME(GenQueriesARB)(GLsizei n, GLuint * ids) +{ + DISPATCH(GenQueriesARB, (n, ids), (F, "glGenQueriesARB(%d, %p);\n", n, (const void *) ids)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteQueries)(GLsizei n, const GLuint * ids) +{ + DISPATCH(DeleteQueriesARB, (n, ids), (F, "glDeleteQueries(%d, %p);\n", n, (const void *) ids)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteQueriesARB)(GLsizei n, const GLuint * ids) +{ + DISPATCH(DeleteQueriesARB, (n, ids), (F, "glDeleteQueriesARB(%d, %p);\n", n, (const void *) ids)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(IsQuery)(GLuint id) +{ + RETURN_DISPATCH(IsQueryARB, (id), (F, "glIsQuery(%d);\n", id)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(IsQueryARB)(GLuint id) +{ + RETURN_DISPATCH(IsQueryARB, (id), (F, "glIsQueryARB(%d);\n", id)); +} + +KEYWORD1 void KEYWORD2 NAME(BeginQuery)(GLenum target, GLuint id) +{ + DISPATCH(BeginQueryARB, (target, id), (F, "glBeginQuery(0x%x, %d);\n", target, id)); +} + +KEYWORD1 void KEYWORD2 NAME(BeginQueryARB)(GLenum target, GLuint id) +{ + DISPATCH(BeginQueryARB, (target, id), (F, "glBeginQueryARB(0x%x, %d);\n", target, id)); +} + +KEYWORD1 void KEYWORD2 NAME(EndQuery)(GLenum target) +{ + DISPATCH(EndQueryARB, (target), (F, "glEndQuery(0x%x);\n", target)); +} + +KEYWORD1 void KEYWORD2 NAME(EndQueryARB)(GLenum target) +{ + DISPATCH(EndQueryARB, (target), (F, "glEndQueryARB(0x%x);\n", target)); +} + +KEYWORD1 void KEYWORD2 NAME(GetQueryiv)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetQueryivARB, (target, pname, params), (F, "glGetQueryiv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetQueryivARB)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetQueryivARB, (target, pname, params), (F, "glGetQueryivARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetQueryObjectiv)(GLuint id, GLenum pname, GLint * params) +{ + DISPATCH(GetQueryObjectivARB, (id, pname, params), (F, "glGetQueryObjectiv(%d, 0x%x, %p);\n", id, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetQueryObjectivARB)(GLuint id, GLenum pname, GLint * params) +{ + DISPATCH(GetQueryObjectivARB, (id, pname, params), (F, "glGetQueryObjectivARB(%d, 0x%x, %p);\n", id, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetQueryObjectuiv)(GLuint id, GLenum pname, GLuint * params) +{ + DISPATCH(GetQueryObjectuivARB, (id, pname, params), (F, "glGetQueryObjectuiv(%d, 0x%x, %p);\n", id, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint * params) +{ + DISPATCH(GetQueryObjectuivARB, (id, pname, params), (F, "glGetQueryObjectuivARB(%d, 0x%x, %p);\n", id, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride) +{ + DISPATCH(MultiModeDrawArraysIBM, (mode, first, count, primcount, modestride), (F, "glMultiModeDrawArraysIBM(%p, %p, %p, %d, %d);\n", (const void *) mode, (const void *) first, (const void *) count, primcount, modestride)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride) +{ + DISPATCH(MultiModeDrawElementsIBM, (mode, count, type, indices, primcount, modestride), (F, "glMultiModeDrawElementsIBM(%p, %p, 0x%x, %p, %d, %d);\n", (const void *) mode, (const void *) count, type, (const void *) indices, primcount, modestride)); +} + +KEYWORD1 void KEYWORD2 NAME(BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA) +{ + DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparateEXT(0x%x, 0x%x);\n", modeRGB, modeA)); +} + +KEYWORD1 void KEYWORD2 NAME(BlendEquationSeparateATI)(GLenum modeRGB, GLenum modeA) +{ + DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparateATI(0x%x, 0x%x);\n", modeRGB, modeA)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteObjectARB)(GLhandleARB obj) +{ + DISPATCH(DeleteObjectARB, (obj), (F, "glDeleteObjectARB(%d);\n", obj)); +} + +KEYWORD1 GLhandleARB KEYWORD2 NAME(GetHandleARB)(GLenum pname) +{ + RETURN_DISPATCH(GetHandleARB, (pname), (F, "glGetHandleARB(0x%x);\n", pname)); +} + +KEYWORD1 void KEYWORD2 NAME(DetachObjectARB)(GLhandleARB containerObj, GLhandleARB attachedObj) +{ + DISPATCH(DetachObjectARB, (containerObj, attachedObj), (F, "glDetachObjectARB(%d, %d);\n", containerObj, attachedObj)); +} + +KEYWORD1 GLhandleARB KEYWORD2 NAME(CreateShaderObjectARB)(GLenum shaderType) +{ + RETURN_DISPATCH(CreateShaderObjectARB, (shaderType), (F, "glCreateShaderObjectARB(0x%x);\n", shaderType)); +} + +KEYWORD1 void KEYWORD2 NAME(ShaderSourceARB)(GLhandleARB shaderObj, GLsizei count, const GLcharARB ** string, const GLint * length) +{ + DISPATCH(ShaderSourceARB, (shaderObj, count, string, length), (F, "glShaderSourceARB(%d, %d, %p, %p);\n", shaderObj, count, (const void *) string, (const void *) length)); +} + +KEYWORD1 void KEYWORD2 NAME(CompileShaderARB)(GLhandleARB shaderObj) +{ + DISPATCH(CompileShaderARB, (shaderObj), (F, "glCompileShaderARB(%d);\n", shaderObj)); +} + +KEYWORD1 GLhandleARB KEYWORD2 NAME(CreateProgramObjectARB)(void) +{ + RETURN_DISPATCH(CreateProgramObjectARB, (), (F, "glCreateProgramObjectARB();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(AttachObjectARB)(GLhandleARB containerObj, GLhandleARB obj) +{ + DISPATCH(AttachObjectARB, (containerObj, obj), (F, "glAttachObjectARB(%d, %d);\n", containerObj, obj)); +} + +KEYWORD1 void KEYWORD2 NAME(LinkProgramARB)(GLhandleARB programObj) +{ + DISPATCH(LinkProgramARB, (programObj), (F, "glLinkProgramARB(%d);\n", programObj)); +} + +KEYWORD1 void KEYWORD2 NAME(UseProgramObjectARB)(GLhandleARB programObj) +{ + DISPATCH(UseProgramObjectARB, (programObj), (F, "glUseProgramObjectARB(%d);\n", programObj)); +} + +KEYWORD1 void KEYWORD2 NAME(ValidateProgramARB)(GLhandleARB programObj) +{ + DISPATCH(ValidateProgramARB, (programObj), (F, "glValidateProgramARB(%d);\n", programObj)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform1fARB)(GLint location, GLfloat v0) +{ + DISPATCH(Uniform1fARB, (location, v0), (F, "glUniform1fARB(%d, %f);\n", location, v0)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform2fARB)(GLint location, GLfloat v0, GLfloat v1) +{ + DISPATCH(Uniform2fARB, (location, v0, v1), (F, "glUniform2fARB(%d, %f, %f);\n", location, v0, v1)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform3fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) +{ + DISPATCH(Uniform3fARB, (location, v0, v1, v2), (F, "glUniform3fARB(%d, %f, %f, %f);\n", location, v0, v1, v2)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform4fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) +{ + DISPATCH(Uniform4fARB, (location, v0, v1, v2, v3), (F, "glUniform4fARB(%d, %f, %f, %f, %f);\n", location, v0, v1, v2, v3)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform1iARB)(GLint location, GLint v0) +{ + DISPATCH(Uniform1iARB, (location, v0), (F, "glUniform1iARB(%d, %d);\n", location, v0)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform2iARB)(GLint location, GLint v0, GLint v1) +{ + DISPATCH(Uniform2iARB, (location, v0, v1), (F, "glUniform2iARB(%d, %d, %d);\n", location, v0, v1)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform3iARB)(GLint location, GLint v0, GLint v1, GLint v2) +{ + DISPATCH(Uniform3iARB, (location, v0, v1, v2), (F, "glUniform3iARB(%d, %d, %d, %d);\n", location, v0, v1, v2)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform4iARB)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) +{ + DISPATCH(Uniform4iARB, (location, v0, v1, v2, v3), (F, "glUniform4iARB(%d, %d, %d, %d, %d);\n", location, v0, v1, v2, v3)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform1fvARB)(GLint location, GLsizei count, const GLfloat * value) +{ + DISPATCH(Uniform1fvARB, (location, count, value), (F, "glUniform1fvARB(%d, %d, %p);\n", location, count, (const void *) value)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform2fvARB)(GLint location, GLsizei count, const GLfloat * value) +{ + DISPATCH(Uniform2fvARB, (location, count, value), (F, "glUniform2fvARB(%d, %d, %p);\n", location, count, (const void *) value)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform3fvARB)(GLint location, GLsizei count, const GLfloat * value) +{ + DISPATCH(Uniform3fvARB, (location, count, value), (F, "glUniform3fvARB(%d, %d, %p);\n", location, count, (const void *) value)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform4fvARB)(GLint location, GLsizei count, const GLfloat * value) +{ + DISPATCH(Uniform4fvARB, (location, count, value), (F, "glUniform4fvARB(%d, %d, %p);\n", location, count, (const void *) value)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform1ivARB)(GLint location, GLsizei count, const GLint * value) +{ + DISPATCH(Uniform1ivARB, (location, count, value), (F, "glUniform1ivARB(%d, %d, %p);\n", location, count, (const void *) value)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform2ivARB)(GLint location, GLsizei count, const GLint * value) +{ + DISPATCH(Uniform2ivARB, (location, count, value), (F, "glUniform2ivARB(%d, %d, %p);\n", location, count, (const void *) value)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform3ivARB)(GLint location, GLsizei count, const GLint * value) +{ + DISPATCH(Uniform3ivARB, (location, count, value), (F, "glUniform3ivARB(%d, %d, %p);\n", location, count, (const void *) value)); +} + +KEYWORD1 void KEYWORD2 NAME(Uniform4ivARB)(GLint location, GLsizei count, const GLint * value) +{ + DISPATCH(Uniform4ivARB, (location, count, value), (F, "glUniform4ivARB(%d, %d, %p);\n", location, count, (const void *) value)); +} + +KEYWORD1 void KEYWORD2 NAME(UniformMatrix2fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + DISPATCH(UniformMatrix2fvARB, (location, count, transpose, value), (F, "glUniformMatrix2fvARB(%d, %d, %d, %p);\n", location, count, transpose, (const void *) value)); +} + +KEYWORD1 void KEYWORD2 NAME(UniformMatrix3fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + DISPATCH(UniformMatrix3fvARB, (location, count, transpose, value), (F, "glUniformMatrix3fvARB(%d, %d, %d, %p);\n", location, count, transpose, (const void *) value)); +} + +KEYWORD1 void KEYWORD2 NAME(UniformMatrix4fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + DISPATCH(UniformMatrix4fvARB, (location, count, transpose, value), (F, "glUniformMatrix4fvARB(%d, %d, %d, %p);\n", location, count, transpose, (const void *) value)); +} + +KEYWORD1 void KEYWORD2 NAME(GetObjectParameterfvARB)(GLhandleARB obj, GLenum pname, GLfloat * params) +{ + DISPATCH(GetObjectParameterfvARB, (obj, pname, params), (F, "glGetObjectParameterfvARB(%d, 0x%x, %p);\n", obj, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetObjectParameterivARB)(GLhandleARB obj, GLenum pname, GLint * params) +{ + DISPATCH(GetObjectParameterivARB, (obj, pname, params), (F, "glGetObjectParameterivARB(%d, 0x%x, %p);\n", obj, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetInfoLogARB)(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog) +{ + DISPATCH(GetInfoLogARB, (obj, maxLength, length, infoLog), (F, "glGetInfoLogARB(%d, %d, %p, %p);\n", obj, maxLength, (const void *) length, (const void *) infoLog)); +} + +KEYWORD1 void KEYWORD2 NAME(GetAttachedObjectsARB)(GLhandleARB containerObj, GLsizei maxLength, GLsizei * length, GLhandleARB * infoLog) +{ + DISPATCH(GetAttachedObjectsARB, (containerObj, maxLength, length, infoLog), (F, "glGetAttachedObjectsARB(%d, %d, %p, %p);\n", containerObj, maxLength, (const void *) length, (const void *) infoLog)); +} + +KEYWORD1 GLint KEYWORD2 NAME(GetUniformLocationARB)(GLhandleARB programObj, const GLcharARB * name) +{ + RETURN_DISPATCH(GetUniformLocationARB, (programObj, name), (F, "glGetUniformLocationARB(%d, %p);\n", programObj, (const void *) name)); +} + +KEYWORD1 void KEYWORD2 NAME(GetActiveUniformARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name) +{ + DISPATCH(GetActiveUniformARB, (programObj, index, maxLength, length, size, type, name), (F, "glGetActiveUniformARB(%d, %d, %d, %p, %p, %p, %p);\n", programObj, index, maxLength, (const void *) length, (const void *) size, (const void *) type, (const void *) name)); +} + +KEYWORD1 void KEYWORD2 NAME(GetUniformfvARB)(GLhandleARB programObj, GLint location, GLfloat * params) +{ + DISPATCH(GetUniformfvARB, (programObj, location, params), (F, "glGetUniformfvARB(%d, %d, %p);\n", programObj, location, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetUniformivARB)(GLhandleARB programObj, GLint location, GLint * params) +{ + DISPATCH(GetUniformivARB, (programObj, location, params), (F, "glGetUniformivARB(%d, %d, %p);\n", programObj, location, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetShaderSourceARB)(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * source) +{ + DISPATCH(GetShaderSourceARB, (obj, maxLength, length, source), (F, "glGetShaderSourceARB(%d, %d, %p, %p);\n", obj, maxLength, (const void *) length, (const void *) source)); +} + +KEYWORD1 void KEYWORD2 NAME(BindAttribLocationARB)(GLhandleARB programObj, GLuint index, const GLcharARB * name) +{ + DISPATCH(BindAttribLocationARB, (programObj, index, name), (F, "glBindAttribLocationARB(%d, %d, %p);\n", programObj, index, (const void *) name)); +} + +KEYWORD1 void KEYWORD2 NAME(GetActiveAttribARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name) +{ + DISPATCH(GetActiveAttribARB, (programObj, index, maxLength, length, size, type, name), (F, "glGetActiveAttribARB(%d, %d, %d, %p, %p, %p, %p);\n", programObj, index, maxLength, (const void *) length, (const void *) size, (const void *) type, (const void *) name)); +} + +KEYWORD1 GLint KEYWORD2 NAME(GetAttribLocationARB)(GLhandleARB programObj, const GLcharARB * name) +{ + RETURN_DISPATCH(GetAttribLocationARB, (programObj, name), (F, "glGetAttribLocationARB(%d, %p);\n", programObj, (const void *) name)); +} + +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params) +{ + DISPATCH(GetVertexAttribdvNV, (index, pname, params), (F, "glGetVertexAttribdvNV(%d, 0x%x, %p);\n", index, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params) +{ + DISPATCH(GetVertexAttribfvNV, (index, pname, params), (F, "glGetVertexAttribfvNV(%d, 0x%x, %p);\n", index, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params) +{ + DISPATCH(GetVertexAttribivNV, (index, pname, params), (F, "glGetVertexAttribivNV(%d, 0x%x, %p);\n", index, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dNV)(GLuint index, GLdouble x) +{ + DISPATCH(VertexAttrib1dNV, (index, x), (F, "glVertexAttrib1dNV(%d, %f);\n", index, x)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dvNV)(GLuint index, const GLdouble * v) +{ + DISPATCH(VertexAttrib1dvNV, (index, v), (F, "glVertexAttrib1dvNV(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fNV)(GLuint index, GLfloat x) +{ + DISPATCH(VertexAttrib1fNV, (index, x), (F, "glVertexAttrib1fNV(%d, %f);\n", index, x)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fvNV)(GLuint index, const GLfloat * v) +{ + DISPATCH(VertexAttrib1fvNV, (index, v), (F, "glVertexAttrib1fvNV(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1sNV)(GLuint index, GLshort x) +{ + DISPATCH(VertexAttrib1sNV, (index, x), (F, "glVertexAttrib1sNV(%d, %d);\n", index, x)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1svNV)(GLuint index, const GLshort * v) +{ + DISPATCH(VertexAttrib1svNV, (index, v), (F, "glVertexAttrib1svNV(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y) +{ + DISPATCH(VertexAttrib2dNV, (index, x, y), (F, "glVertexAttrib2dNV(%d, %f, %f);\n", index, x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dvNV)(GLuint index, const GLdouble * v) +{ + DISPATCH(VertexAttrib2dvNV, (index, v), (F, "glVertexAttrib2dvNV(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y) +{ + DISPATCH(VertexAttrib2fNV, (index, x, y), (F, "glVertexAttrib2fNV(%d, %f, %f);\n", index, x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fvNV)(GLuint index, const GLfloat * v) +{ + DISPATCH(VertexAttrib2fvNV, (index, v), (F, "glVertexAttrib2fvNV(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y) +{ + DISPATCH(VertexAttrib2sNV, (index, x, y), (F, "glVertexAttrib2sNV(%d, %d, %d);\n", index, x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2svNV)(GLuint index, const GLshort * v) +{ + DISPATCH(VertexAttrib2svNV, (index, v), (F, "glVertexAttrib2svNV(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + DISPATCH(VertexAttrib3dNV, (index, x, y, z), (F, "glVertexAttrib3dNV(%d, %f, %f, %f);\n", index, x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dvNV)(GLuint index, const GLdouble * v) +{ + DISPATCH(VertexAttrib3dvNV, (index, v), (F, "glVertexAttrib3dvNV(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z) +{ + DISPATCH(VertexAttrib3fNV, (index, x, y, z), (F, "glVertexAttrib3fNV(%d, %f, %f, %f);\n", index, x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fvNV)(GLuint index, const GLfloat * v) +{ + DISPATCH(VertexAttrib3fvNV, (index, v), (F, "glVertexAttrib3fvNV(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z) +{ + DISPATCH(VertexAttrib3sNV, (index, x, y, z), (F, "glVertexAttrib3sNV(%d, %d, %d, %d);\n", index, x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3svNV)(GLuint index, const GLshort * v) +{ + DISPATCH(VertexAttrib3svNV, (index, v), (F, "glVertexAttrib3svNV(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + DISPATCH(VertexAttrib4dNV, (index, x, y, z, w), (F, "glVertexAttrib4dNV(%d, %f, %f, %f, %f);\n", index, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dvNV)(GLuint index, const GLdouble * v) +{ + DISPATCH(VertexAttrib4dvNV, (index, v), (F, "glVertexAttrib4dvNV(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + DISPATCH(VertexAttrib4fNV, (index, x, y, z, w), (F, "glVertexAttrib4fNV(%d, %f, %f, %f, %f);\n", index, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fvNV)(GLuint index, const GLfloat * v) +{ + DISPATCH(VertexAttrib4fvNV, (index, v), (F, "glVertexAttrib4fvNV(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) +{ + DISPATCH(VertexAttrib4sNV, (index, x, y, z, w), (F, "glVertexAttrib4sNV(%d, %d, %d, %d, %d);\n", index, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4svNV)(GLuint index, const GLshort * v) +{ + DISPATCH(VertexAttrib4svNV, (index, v), (F, "glVertexAttrib4svNV(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) +{ + DISPATCH(VertexAttrib4ubNV, (index, x, y, z, w), (F, "glVertexAttrib4ubNV(%d, %d, %d, %d, %d);\n", index, x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubvNV)(GLuint index, const GLubyte * v) +{ + DISPATCH(VertexAttrib4ubvNV, (index, v), (F, "glVertexAttrib4ubvNV(%d, %p);\n", index, (const void *) v)); +} + +KEYWORD1 GLuint KEYWORD2 NAME(GenFragmentShadersATI)(GLuint range) +{ + RETURN_DISPATCH(GenFragmentShadersATI, (range), (F, "glGenFragmentShadersATI(%d);\n", range)); +} + +KEYWORD1 void KEYWORD2 NAME(BindFragmentShaderATI)(GLuint id) +{ + DISPATCH(BindFragmentShaderATI, (id), (F, "glBindFragmentShaderATI(%d);\n", id)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteFragmentShaderATI)(GLuint id) +{ + DISPATCH(DeleteFragmentShaderATI, (id), (F, "glDeleteFragmentShaderATI(%d);\n", id)); +} + +KEYWORD1 void KEYWORD2 NAME(BeginFragmentShaderATI)(void) +{ + DISPATCH(BeginFragmentShaderATI, (), (F, "glBeginFragmentShaderATI();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(EndFragmentShaderATI)(void) +{ + DISPATCH(EndFragmentShaderATI, (), (F, "glEndFragmentShaderATI();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle) +{ + DISPATCH(PassTexCoordATI, (dst, coord, swizzle), (F, "glPassTexCoordATI(%d, %d, 0x%x);\n", dst, coord, swizzle)); +} + +KEYWORD1 void KEYWORD2 NAME(SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle) +{ + DISPATCH(SampleMapATI, (dst, interp, swizzle), (F, "glSampleMapATI(%d, %d, 0x%x);\n", dst, interp, swizzle)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod) +{ + DISPATCH(ColorFragmentOp1ATI, (op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod), (F, "glColorFragmentOp1ATI(0x%x, %d, %d, %d, %d, %d, %d);\n", op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod) +{ + DISPATCH(ColorFragmentOp2ATI, (op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod), (F, "glColorFragmentOp2ATI(0x%x, %d, %d, %d, %d, %d, %d, %d, %d, %d);\n", op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod) +{ + DISPATCH(ColorFragmentOp3ATI, (op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod), (F, "glColorFragmentOp3ATI(0x%x, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d);\n", op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod)); +} + +KEYWORD1 void KEYWORD2 NAME(AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod) +{ + DISPATCH(AlphaFragmentOp1ATI, (op, dst, dstMod, arg1, arg1Rep, arg1Mod), (F, "glAlphaFragmentOp1ATI(0x%x, %d, %d, %d, %d, %d);\n", op, dst, dstMod, arg1, arg1Rep, arg1Mod)); +} + +KEYWORD1 void KEYWORD2 NAME(AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod) +{ + DISPATCH(AlphaFragmentOp2ATI, (op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod), (F, "glAlphaFragmentOp2ATI(0x%x, %d, %d, %d, %d, %d, %d, %d, %d);\n", op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod)); +} + +KEYWORD1 void KEYWORD2 NAME(AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod) +{ + DISPATCH(AlphaFragmentOp3ATI, (op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod), (F, "glAlphaFragmentOp3ATI(0x%x, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d);\n", op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod)); +} + +KEYWORD1 void KEYWORD2 NAME(SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value) +{ + DISPATCH(SetFragmentShaderConstantATI, (dst, value), (F, "glSetFragmentShaderConstantATI(%d, %p);\n", dst, (const void *) value)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(IsRenderbufferEXT)(GLuint renderbuffer) +{ + RETURN_DISPATCH(IsRenderbufferEXT, (renderbuffer), (F, "glIsRenderbufferEXT(%d);\n", renderbuffer)); +} + +KEYWORD1 void KEYWORD2 NAME(BindRenderbufferEXT)(GLenum target, GLuint renderbuffer) +{ + DISPATCH(BindRenderbufferEXT, (target, renderbuffer), (F, "glBindRenderbufferEXT(0x%x, %d);\n", target, renderbuffer)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers) +{ + DISPATCH(DeleteRenderbuffersEXT, (n, renderbuffers), (F, "glDeleteRenderbuffersEXT(%d, %p);\n", n, (const void *) renderbuffers)); +} + +KEYWORD1 void KEYWORD2 NAME(GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers) +{ + DISPATCH(GenRenderbuffersEXT, (n, renderbuffers), (F, "glGenRenderbuffersEXT(%d, %p);\n", n, (const void *) renderbuffers)); +} + +KEYWORD1 void KEYWORD2 NAME(RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) +{ + DISPATCH(RenderbufferStorageEXT, (target, internalformat, width, height), (F, "glRenderbufferStorageEXT(0x%x, 0x%x, %d, %d);\n", target, internalformat, width, height)); +} + +KEYWORD1 void KEYWORD2 NAME(GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetRenderbufferParameterivEXT, (target, pname, params), (F, "glGetRenderbufferParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(IsFramebufferEXT)(GLuint framebuffer) +{ + RETURN_DISPATCH(IsFramebufferEXT, (framebuffer), (F, "glIsFramebufferEXT(%d);\n", framebuffer)); +} + +KEYWORD1 void KEYWORD2 NAME(BindFramebufferEXT)(GLenum target, GLuint framebuffer) +{ + DISPATCH(BindFramebufferEXT, (target, framebuffer), (F, "glBindFramebufferEXT(0x%x, %d);\n", target, framebuffer)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers) +{ + DISPATCH(DeleteFramebuffersEXT, (n, framebuffers), (F, "glDeleteFramebuffersEXT(%d, %p);\n", n, (const void *) framebuffers)); +} + +KEYWORD1 void KEYWORD2 NAME(GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers) +{ + DISPATCH(GenFramebuffersEXT, (n, framebuffers), (F, "glGenFramebuffersEXT(%d, %p);\n", n, (const void *) framebuffers)); +} + +KEYWORD1 GLenum KEYWORD2 NAME(CheckFramebufferStatusEXT)(GLenum target) +{ + RETURN_DISPATCH(CheckFramebufferStatusEXT, (target), (F, "glCheckFramebufferStatusEXT(0x%x);\n", target)); +} + +KEYWORD1 void KEYWORD2 NAME(FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ + DISPATCH(FramebufferTexture1DEXT, (target, attachment, textarget, texture, level), (F, "glFramebufferTexture1DEXT(0x%x, 0x%x, 0x%x, %d, %d);\n", target, attachment, textarget, texture, level)); +} + +KEYWORD1 void KEYWORD2 NAME(FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ + DISPATCH(FramebufferTexture2DEXT, (target, attachment, textarget, texture, level), (F, "glFramebufferTexture2DEXT(0x%x, 0x%x, 0x%x, %d, %d);\n", target, attachment, textarget, texture, level)); +} + +KEYWORD1 void KEYWORD2 NAME(FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) +{ + DISPATCH(FramebufferTexture3DEXT, (target, attachment, textarget, texture, level, zoffset), (F, "glFramebufferTexture3DEXT(0x%x, 0x%x, 0x%x, %d, %d, %d);\n", target, attachment, textarget, texture, level, zoffset)); +} + +KEYWORD1 void KEYWORD2 NAME(FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) +{ + DISPATCH(FramebufferRenderbufferEXT, (target, attachment, renderbuffertarget, renderbuffer), (F, "glFramebufferRenderbufferEXT(0x%x, 0x%x, 0x%x, %d);\n", target, attachment, renderbuffertarget, renderbuffer)); +} + +KEYWORD1 void KEYWORD2 NAME(GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params) +{ + DISPATCH(GetFramebufferAttachmentParameterivEXT, (target, attachment, pname, params), (F, "glGetFramebufferAttachmentParameterivEXT(0x%x, 0x%x, 0x%x, %p);\n", target, attachment, pname, (const void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GenerateMipmapEXT)(GLenum target) +{ + DISPATCH(GenerateMipmapEXT, (target), (F, "glGenerateMipmapEXT(0x%x);\n", target)); +} + +KEYWORD1 void KEYWORD2 NAME(StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask) +{ + DISPATCH(StencilFuncSeparate, (face, func, ref, mask), (F, "glStencilFuncSeparate(0x%x, 0x%x, %d, %d);\n", face, func, ref, mask)); +} + +KEYWORD1 void KEYWORD2 NAME(StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) +{ + DISPATCH(StencilOpSeparate, (face, fail, zfail, zpass), (F, "glStencilOpSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", face, fail, zfail, zpass)); +} + +KEYWORD1 void KEYWORD2 NAME(StencilMaskSeparate)(GLenum face, GLuint mask) +{ + DISPATCH(StencilMaskSeparate, (face, mask), (F, "glStencilMaskSeparate(0x%x, %d);\n", face, mask)); +} + + +#endif /* defined( NAME ) */ + +/* + * This is how a dispatch table can be initialized with all the functions + * we generated above. + */ +#ifdef DISPATCH_TABLE_NAME + +#ifndef TABLE_ENTRY +#error TABLE_ENTRY must be defined +#endif + +static _glapi_proc DISPATCH_TABLE_NAME[] = { + TABLE_ENTRY(NewList), + TABLE_ENTRY(EndList), + TABLE_ENTRY(CallList), + TABLE_ENTRY(CallLists), + TABLE_ENTRY(DeleteLists), + TABLE_ENTRY(GenLists), + TABLE_ENTRY(ListBase), + TABLE_ENTRY(Begin), + TABLE_ENTRY(Bitmap), + TABLE_ENTRY(Color3b), + TABLE_ENTRY(Color3bv), + TABLE_ENTRY(Color3d), + TABLE_ENTRY(Color3dv), + TABLE_ENTRY(Color3f), + TABLE_ENTRY(Color3fv), + TABLE_ENTRY(Color3i), + TABLE_ENTRY(Color3iv), + TABLE_ENTRY(Color3s), + TABLE_ENTRY(Color3sv), + TABLE_ENTRY(Color3ub), + TABLE_ENTRY(Color3ubv), + TABLE_ENTRY(Color3ui), + TABLE_ENTRY(Color3uiv), + TABLE_ENTRY(Color3us), + TABLE_ENTRY(Color3usv), + TABLE_ENTRY(Color4b), + TABLE_ENTRY(Color4bv), + TABLE_ENTRY(Color4d), + TABLE_ENTRY(Color4dv), + TABLE_ENTRY(Color4f), + TABLE_ENTRY(Color4fv), + TABLE_ENTRY(Color4i), + TABLE_ENTRY(Color4iv), + TABLE_ENTRY(Color4s), + TABLE_ENTRY(Color4sv), + TABLE_ENTRY(Color4ub), + TABLE_ENTRY(Color4ubv), + TABLE_ENTRY(Color4ui), + TABLE_ENTRY(Color4uiv), + TABLE_ENTRY(Color4us), + TABLE_ENTRY(Color4usv), + TABLE_ENTRY(EdgeFlag), + TABLE_ENTRY(EdgeFlagv), + TABLE_ENTRY(End), + TABLE_ENTRY(Indexd), + TABLE_ENTRY(Indexdv), + TABLE_ENTRY(Indexf), + TABLE_ENTRY(Indexfv), + TABLE_ENTRY(Indexi), + TABLE_ENTRY(Indexiv), + TABLE_ENTRY(Indexs), + TABLE_ENTRY(Indexsv), + TABLE_ENTRY(Normal3b), + TABLE_ENTRY(Normal3bv), + TABLE_ENTRY(Normal3d), + TABLE_ENTRY(Normal3dv), + TABLE_ENTRY(Normal3f), + TABLE_ENTRY(Normal3fv), + TABLE_ENTRY(Normal3i), + TABLE_ENTRY(Normal3iv), + TABLE_ENTRY(Normal3s), + TABLE_ENTRY(Normal3sv), + TABLE_ENTRY(RasterPos2d), + TABLE_ENTRY(RasterPos2dv), + TABLE_ENTRY(RasterPos2f), + TABLE_ENTRY(RasterPos2fv), + TABLE_ENTRY(RasterPos2i), + TABLE_ENTRY(RasterPos2iv), + TABLE_ENTRY(RasterPos2s), + TABLE_ENTRY(RasterPos2sv), + TABLE_ENTRY(RasterPos3d), + TABLE_ENTRY(RasterPos3dv), + TABLE_ENTRY(RasterPos3f), + TABLE_ENTRY(RasterPos3fv), + TABLE_ENTRY(RasterPos3i), + TABLE_ENTRY(RasterPos3iv), + TABLE_ENTRY(RasterPos3s), + TABLE_ENTRY(RasterPos3sv), + TABLE_ENTRY(RasterPos4d), + TABLE_ENTRY(RasterPos4dv), + TABLE_ENTRY(RasterPos4f), + TABLE_ENTRY(RasterPos4fv), + TABLE_ENTRY(RasterPos4i), + TABLE_ENTRY(RasterPos4iv), + TABLE_ENTRY(RasterPos4s), + TABLE_ENTRY(RasterPos4sv), + TABLE_ENTRY(Rectd), + TABLE_ENTRY(Rectdv), + TABLE_ENTRY(Rectf), + TABLE_ENTRY(Rectfv), + TABLE_ENTRY(Recti), + TABLE_ENTRY(Rectiv), + TABLE_ENTRY(Rects), + TABLE_ENTRY(Rectsv), + TABLE_ENTRY(TexCoord1d), + TABLE_ENTRY(TexCoord1dv), + TABLE_ENTRY(TexCoord1f), + TABLE_ENTRY(TexCoord1fv), + TABLE_ENTRY(TexCoord1i), + TABLE_ENTRY(TexCoord1iv), + TABLE_ENTRY(TexCoord1s), + TABLE_ENTRY(TexCoord1sv), + TABLE_ENTRY(TexCoord2d), + TABLE_ENTRY(TexCoord2dv), + TABLE_ENTRY(TexCoord2f), + TABLE_ENTRY(TexCoord2fv), + TABLE_ENTRY(TexCoord2i), + TABLE_ENTRY(TexCoord2iv), + TABLE_ENTRY(TexCoord2s), + TABLE_ENTRY(TexCoord2sv), + TABLE_ENTRY(TexCoord3d), + TABLE_ENTRY(TexCoord3dv), + TABLE_ENTRY(TexCoord3f), + TABLE_ENTRY(TexCoord3fv), + TABLE_ENTRY(TexCoord3i), + TABLE_ENTRY(TexCoord3iv), + TABLE_ENTRY(TexCoord3s), + TABLE_ENTRY(TexCoord3sv), + TABLE_ENTRY(TexCoord4d), + TABLE_ENTRY(TexCoord4dv), + TABLE_ENTRY(TexCoord4f), + TABLE_ENTRY(TexCoord4fv), + TABLE_ENTRY(TexCoord4i), + TABLE_ENTRY(TexCoord4iv), + TABLE_ENTRY(TexCoord4s), + TABLE_ENTRY(TexCoord4sv), + TABLE_ENTRY(Vertex2d), + TABLE_ENTRY(Vertex2dv), + TABLE_ENTRY(Vertex2f), + TABLE_ENTRY(Vertex2fv), + TABLE_ENTRY(Vertex2i), + TABLE_ENTRY(Vertex2iv), + TABLE_ENTRY(Vertex2s), + TABLE_ENTRY(Vertex2sv), + TABLE_ENTRY(Vertex3d), + TABLE_ENTRY(Vertex3dv), + TABLE_ENTRY(Vertex3f), + TABLE_ENTRY(Vertex3fv), + TABLE_ENTRY(Vertex3i), + TABLE_ENTRY(Vertex3iv), + TABLE_ENTRY(Vertex3s), + TABLE_ENTRY(Vertex3sv), + TABLE_ENTRY(Vertex4d), + TABLE_ENTRY(Vertex4dv), + TABLE_ENTRY(Vertex4f), + TABLE_ENTRY(Vertex4fv), + TABLE_ENTRY(Vertex4i), + TABLE_ENTRY(Vertex4iv), + TABLE_ENTRY(Vertex4s), + TABLE_ENTRY(Vertex4sv), + TABLE_ENTRY(ClipPlane), + TABLE_ENTRY(ColorMaterial), + TABLE_ENTRY(CullFace), + TABLE_ENTRY(Fogf), + TABLE_ENTRY(Fogfv), + TABLE_ENTRY(Fogi), + TABLE_ENTRY(Fogiv), + TABLE_ENTRY(FrontFace), + TABLE_ENTRY(Hint), + TABLE_ENTRY(Lightf), + TABLE_ENTRY(Lightfv), + TABLE_ENTRY(Lighti), + TABLE_ENTRY(Lightiv), + TABLE_ENTRY(LightModelf), + TABLE_ENTRY(LightModelfv), + TABLE_ENTRY(LightModeli), + TABLE_ENTRY(LightModeliv), + TABLE_ENTRY(LineStipple), + TABLE_ENTRY(LineWidth), + TABLE_ENTRY(Materialf), + TABLE_ENTRY(Materialfv), + TABLE_ENTRY(Materiali), + TABLE_ENTRY(Materialiv), + TABLE_ENTRY(PointSize), + TABLE_ENTRY(PolygonMode), + TABLE_ENTRY(PolygonStipple), + TABLE_ENTRY(Scissor), + TABLE_ENTRY(ShadeModel), + TABLE_ENTRY(TexParameterf), + TABLE_ENTRY(TexParameterfv), + TABLE_ENTRY(TexParameteri), + TABLE_ENTRY(TexParameteriv), + TABLE_ENTRY(TexImage1D), + TABLE_ENTRY(TexImage2D), + TABLE_ENTRY(TexEnvf), + TABLE_ENTRY(TexEnvfv), + TABLE_ENTRY(TexEnvi), + TABLE_ENTRY(TexEnviv), + TABLE_ENTRY(TexGend), + TABLE_ENTRY(TexGendv), + TABLE_ENTRY(TexGenf), + TABLE_ENTRY(TexGenfv), + TABLE_ENTRY(TexGeni), + TABLE_ENTRY(TexGeniv), + TABLE_ENTRY(FeedbackBuffer), + TABLE_ENTRY(SelectBuffer), + TABLE_ENTRY(RenderMode), + TABLE_ENTRY(InitNames), + TABLE_ENTRY(LoadName), + TABLE_ENTRY(PassThrough), + TABLE_ENTRY(PopName), + TABLE_ENTRY(PushName), + TABLE_ENTRY(DrawBuffer), + TABLE_ENTRY(Clear), + TABLE_ENTRY(ClearAccum), + TABLE_ENTRY(ClearIndex), + TABLE_ENTRY(ClearColor), + TABLE_ENTRY(ClearStencil), + TABLE_ENTRY(ClearDepth), + TABLE_ENTRY(StencilMask), + TABLE_ENTRY(ColorMask), + TABLE_ENTRY(DepthMask), + TABLE_ENTRY(IndexMask), + TABLE_ENTRY(Accum), + TABLE_ENTRY(Disable), + TABLE_ENTRY(Enable), + TABLE_ENTRY(Finish), + TABLE_ENTRY(Flush), + TABLE_ENTRY(PopAttrib), + TABLE_ENTRY(PushAttrib), + TABLE_ENTRY(Map1d), + TABLE_ENTRY(Map1f), + TABLE_ENTRY(Map2d), + TABLE_ENTRY(Map2f), + TABLE_ENTRY(MapGrid1d), + TABLE_ENTRY(MapGrid1f), + TABLE_ENTRY(MapGrid2d), + TABLE_ENTRY(MapGrid2f), + TABLE_ENTRY(EvalCoord1d), + TABLE_ENTRY(EvalCoord1dv), + TABLE_ENTRY(EvalCoord1f), + TABLE_ENTRY(EvalCoord1fv), + TABLE_ENTRY(EvalCoord2d), + TABLE_ENTRY(EvalCoord2dv), + TABLE_ENTRY(EvalCoord2f), + TABLE_ENTRY(EvalCoord2fv), + TABLE_ENTRY(EvalMesh1), + TABLE_ENTRY(EvalPoint1), + TABLE_ENTRY(EvalMesh2), + TABLE_ENTRY(EvalPoint2), + TABLE_ENTRY(AlphaFunc), + TABLE_ENTRY(BlendFunc), + TABLE_ENTRY(LogicOp), + TABLE_ENTRY(StencilFunc), + TABLE_ENTRY(StencilOp), + TABLE_ENTRY(DepthFunc), + TABLE_ENTRY(PixelZoom), + TABLE_ENTRY(PixelTransferf), + TABLE_ENTRY(PixelTransferi), + TABLE_ENTRY(PixelStoref), + TABLE_ENTRY(PixelStorei), + TABLE_ENTRY(PixelMapfv), + TABLE_ENTRY(PixelMapuiv), + TABLE_ENTRY(PixelMapusv), + TABLE_ENTRY(ReadBuffer), + TABLE_ENTRY(CopyPixels), + TABLE_ENTRY(ReadPixels), + TABLE_ENTRY(DrawPixels), + TABLE_ENTRY(GetBooleanv), + TABLE_ENTRY(GetClipPlane), + TABLE_ENTRY(GetDoublev), + TABLE_ENTRY(GetError), + TABLE_ENTRY(GetFloatv), + TABLE_ENTRY(GetIntegerv), + TABLE_ENTRY(GetLightfv), + TABLE_ENTRY(GetLightiv), + TABLE_ENTRY(GetMapdv), + TABLE_ENTRY(GetMapfv), + TABLE_ENTRY(GetMapiv), + TABLE_ENTRY(GetMaterialfv), + TABLE_ENTRY(GetMaterialiv), + TABLE_ENTRY(GetPixelMapfv), + TABLE_ENTRY(GetPixelMapuiv), + TABLE_ENTRY(GetPixelMapusv), + TABLE_ENTRY(GetPolygonStipple), + TABLE_ENTRY(GetString), + TABLE_ENTRY(GetTexEnvfv), + TABLE_ENTRY(GetTexEnviv), + TABLE_ENTRY(GetTexGendv), + TABLE_ENTRY(GetTexGenfv), + TABLE_ENTRY(GetTexGeniv), + TABLE_ENTRY(GetTexImage), + TABLE_ENTRY(GetTexParameterfv), + TABLE_ENTRY(GetTexParameteriv), + TABLE_ENTRY(GetTexLevelParameterfv), + TABLE_ENTRY(GetTexLevelParameteriv), + TABLE_ENTRY(IsEnabled), + TABLE_ENTRY(IsList), + TABLE_ENTRY(DepthRange), + TABLE_ENTRY(Frustum), + TABLE_ENTRY(LoadIdentity), + TABLE_ENTRY(LoadMatrixf), + TABLE_ENTRY(LoadMatrixd), + TABLE_ENTRY(MatrixMode), + TABLE_ENTRY(MultMatrixf), + TABLE_ENTRY(MultMatrixd), + TABLE_ENTRY(Ortho), + TABLE_ENTRY(PopMatrix), + TABLE_ENTRY(PushMatrix), + TABLE_ENTRY(Rotated), + TABLE_ENTRY(Rotatef), + TABLE_ENTRY(Scaled), + TABLE_ENTRY(Scalef), + TABLE_ENTRY(Translated), + TABLE_ENTRY(Translatef), + TABLE_ENTRY(Viewport), + TABLE_ENTRY(ArrayElement), + TABLE_ENTRY(BindTexture), + TABLE_ENTRY(ColorPointer), + TABLE_ENTRY(DisableClientState), + TABLE_ENTRY(DrawArrays), + TABLE_ENTRY(DrawElements), + TABLE_ENTRY(EdgeFlagPointer), + TABLE_ENTRY(EnableClientState), + TABLE_ENTRY(IndexPointer), + TABLE_ENTRY(Indexub), + TABLE_ENTRY(Indexubv), + TABLE_ENTRY(InterleavedArrays), + TABLE_ENTRY(NormalPointer), + TABLE_ENTRY(PolygonOffset), + TABLE_ENTRY(TexCoordPointer), + TABLE_ENTRY(VertexPointer), + TABLE_ENTRY(AreTexturesResident), + TABLE_ENTRY(CopyTexImage1D), + TABLE_ENTRY(CopyTexImage2D), + TABLE_ENTRY(CopyTexSubImage1D), + TABLE_ENTRY(CopyTexSubImage2D), + TABLE_ENTRY(DeleteTextures), + TABLE_ENTRY(GenTextures), + TABLE_ENTRY(GetPointerv), + TABLE_ENTRY(IsTexture), + TABLE_ENTRY(PrioritizeTextures), + TABLE_ENTRY(TexSubImage1D), + TABLE_ENTRY(TexSubImage2D), + TABLE_ENTRY(PopClientAttrib), + TABLE_ENTRY(PushClientAttrib), + TABLE_ENTRY(BlendColor), + TABLE_ENTRY(BlendEquation), + TABLE_ENTRY(DrawRangeElements), + TABLE_ENTRY(ColorTable), + TABLE_ENTRY(ColorTableParameterfv), + TABLE_ENTRY(ColorTableParameteriv), + TABLE_ENTRY(CopyColorTable), + TABLE_ENTRY(GetColorTable), + TABLE_ENTRY(GetColorTableParameterfv), + TABLE_ENTRY(GetColorTableParameteriv), + TABLE_ENTRY(ColorSubTable), + TABLE_ENTRY(CopyColorSubTable), + TABLE_ENTRY(ConvolutionFilter1D), + TABLE_ENTRY(ConvolutionFilter2D), + TABLE_ENTRY(ConvolutionParameterf), + TABLE_ENTRY(ConvolutionParameterfv), + TABLE_ENTRY(ConvolutionParameteri), + TABLE_ENTRY(ConvolutionParameteriv), + TABLE_ENTRY(CopyConvolutionFilter1D), + TABLE_ENTRY(CopyConvolutionFilter2D), + TABLE_ENTRY(GetConvolutionFilter), + TABLE_ENTRY(GetConvolutionParameterfv), + TABLE_ENTRY(GetConvolutionParameteriv), + TABLE_ENTRY(GetSeparableFilter), + TABLE_ENTRY(SeparableFilter2D), + TABLE_ENTRY(GetHistogram), + TABLE_ENTRY(GetHistogramParameterfv), + TABLE_ENTRY(GetHistogramParameteriv), + TABLE_ENTRY(GetMinmax), + TABLE_ENTRY(GetMinmaxParameterfv), + TABLE_ENTRY(GetMinmaxParameteriv), + TABLE_ENTRY(Histogram), + TABLE_ENTRY(Minmax), + TABLE_ENTRY(ResetHistogram), + TABLE_ENTRY(ResetMinmax), + TABLE_ENTRY(TexImage3D), + TABLE_ENTRY(TexSubImage3D), + TABLE_ENTRY(CopyTexSubImage3D), + TABLE_ENTRY(ActiveTextureARB), + TABLE_ENTRY(ClientActiveTextureARB), + TABLE_ENTRY(MultiTexCoord1dARB), + TABLE_ENTRY(MultiTexCoord1dvARB), + TABLE_ENTRY(MultiTexCoord1fARB), + TABLE_ENTRY(MultiTexCoord1fvARB), + TABLE_ENTRY(MultiTexCoord1iARB), + TABLE_ENTRY(MultiTexCoord1ivARB), + TABLE_ENTRY(MultiTexCoord1sARB), + TABLE_ENTRY(MultiTexCoord1svARB), + TABLE_ENTRY(MultiTexCoord2dARB), + TABLE_ENTRY(MultiTexCoord2dvARB), + TABLE_ENTRY(MultiTexCoord2fARB), + TABLE_ENTRY(MultiTexCoord2fvARB), + TABLE_ENTRY(MultiTexCoord2iARB), + TABLE_ENTRY(MultiTexCoord2ivARB), + TABLE_ENTRY(MultiTexCoord2sARB), + TABLE_ENTRY(MultiTexCoord2svARB), + TABLE_ENTRY(MultiTexCoord3dARB), + TABLE_ENTRY(MultiTexCoord3dvARB), + TABLE_ENTRY(MultiTexCoord3fARB), + TABLE_ENTRY(MultiTexCoord3fvARB), + TABLE_ENTRY(MultiTexCoord3iARB), + TABLE_ENTRY(MultiTexCoord3ivARB), + TABLE_ENTRY(MultiTexCoord3sARB), + TABLE_ENTRY(MultiTexCoord3svARB), + TABLE_ENTRY(MultiTexCoord4dARB), + TABLE_ENTRY(MultiTexCoord4dvARB), + TABLE_ENTRY(MultiTexCoord4fARB), + TABLE_ENTRY(MultiTexCoord4fvARB), + TABLE_ENTRY(MultiTexCoord4iARB), + TABLE_ENTRY(MultiTexCoord4ivARB), + TABLE_ENTRY(MultiTexCoord4sARB), + TABLE_ENTRY(MultiTexCoord4svARB), + TABLE_ENTRY(LoadTransposeMatrixfARB), + TABLE_ENTRY(LoadTransposeMatrixdARB), + TABLE_ENTRY(MultTransposeMatrixfARB), + TABLE_ENTRY(MultTransposeMatrixdARB), + TABLE_ENTRY(SampleCoverageARB), + TABLE_ENTRY(DrawBuffersARB), + TABLE_ENTRY(PolygonOffsetEXT), + TABLE_ENTRY(GetTexFilterFuncSGIS), + TABLE_ENTRY(TexFilterFuncSGIS), + TABLE_ENTRY(GetHistogramEXT), + TABLE_ENTRY(GetHistogramParameterfvEXT), + TABLE_ENTRY(GetHistogramParameterivEXT), + TABLE_ENTRY(GetMinmaxEXT), + TABLE_ENTRY(GetMinmaxParameterfvEXT), + TABLE_ENTRY(GetMinmaxParameterivEXT), + TABLE_ENTRY(GetConvolutionFilterEXT), + TABLE_ENTRY(GetConvolutionParameterfvEXT), + TABLE_ENTRY(GetConvolutionParameterivEXT), + TABLE_ENTRY(GetSeparableFilterEXT), + TABLE_ENTRY(GetColorTableSGI), + TABLE_ENTRY(GetColorTableParameterfvSGI), + TABLE_ENTRY(GetColorTableParameterivSGI), + TABLE_ENTRY(PixelTexGenSGIX), + TABLE_ENTRY(PixelTexGenParameteriSGIS), + TABLE_ENTRY(PixelTexGenParameterivSGIS), + TABLE_ENTRY(PixelTexGenParameterfSGIS), + TABLE_ENTRY(PixelTexGenParameterfvSGIS), + TABLE_ENTRY(GetPixelTexGenParameterivSGIS), + TABLE_ENTRY(GetPixelTexGenParameterfvSGIS), + TABLE_ENTRY(TexImage4DSGIS), + TABLE_ENTRY(TexSubImage4DSGIS), + TABLE_ENTRY(AreTexturesResidentEXT), + TABLE_ENTRY(GenTexturesEXT), + TABLE_ENTRY(IsTextureEXT), + TABLE_ENTRY(DetailTexFuncSGIS), + TABLE_ENTRY(GetDetailTexFuncSGIS), + TABLE_ENTRY(SharpenTexFuncSGIS), + TABLE_ENTRY(GetSharpenTexFuncSGIS), + TABLE_ENTRY(SampleMaskSGIS), + TABLE_ENTRY(SamplePatternSGIS), + TABLE_ENTRY(ColorPointerEXT), + TABLE_ENTRY(EdgeFlagPointerEXT), + TABLE_ENTRY(IndexPointerEXT), + TABLE_ENTRY(NormalPointerEXT), + TABLE_ENTRY(TexCoordPointerEXT), + TABLE_ENTRY(VertexPointerEXT), + TABLE_ENTRY(SpriteParameterfSGIX), + TABLE_ENTRY(SpriteParameterfvSGIX), + TABLE_ENTRY(SpriteParameteriSGIX), + TABLE_ENTRY(SpriteParameterivSGIX), + TABLE_ENTRY(PointParameterfEXT), + TABLE_ENTRY(PointParameterfvEXT), + TABLE_ENTRY(GetInstrumentsSGIX), + TABLE_ENTRY(InstrumentsBufferSGIX), + TABLE_ENTRY(PollInstrumentsSGIX), + TABLE_ENTRY(ReadInstrumentsSGIX), + TABLE_ENTRY(StartInstrumentsSGIX), + TABLE_ENTRY(StopInstrumentsSGIX), + TABLE_ENTRY(FrameZoomSGIX), + TABLE_ENTRY(TagSampleBufferSGIX), + TABLE_ENTRY(ReferencePlaneSGIX), + TABLE_ENTRY(FlushRasterSGIX), + TABLE_ENTRY(GetListParameterfvSGIX), + TABLE_ENTRY(GetListParameterivSGIX), + TABLE_ENTRY(ListParameterfSGIX), + TABLE_ENTRY(ListParameterfvSGIX), + TABLE_ENTRY(ListParameteriSGIX), + TABLE_ENTRY(ListParameterivSGIX), + TABLE_ENTRY(FragmentColorMaterialSGIX), + TABLE_ENTRY(FragmentLightfSGIX), + TABLE_ENTRY(FragmentLightfvSGIX), + TABLE_ENTRY(FragmentLightiSGIX), + TABLE_ENTRY(FragmentLightivSGIX), + TABLE_ENTRY(FragmentLightModelfSGIX), + TABLE_ENTRY(FragmentLightModelfvSGIX), + TABLE_ENTRY(FragmentLightModeliSGIX), + TABLE_ENTRY(FragmentLightModelivSGIX), + TABLE_ENTRY(FragmentMaterialfSGIX), + TABLE_ENTRY(FragmentMaterialfvSGIX), + TABLE_ENTRY(FragmentMaterialiSGIX), + TABLE_ENTRY(FragmentMaterialivSGIX), + TABLE_ENTRY(GetFragmentLightfvSGIX), + TABLE_ENTRY(GetFragmentLightivSGIX), + TABLE_ENTRY(GetFragmentMaterialfvSGIX), + TABLE_ENTRY(GetFragmentMaterialivSGIX), + TABLE_ENTRY(LightEnviSGIX), + TABLE_ENTRY(VertexWeightfEXT), + TABLE_ENTRY(VertexWeightfvEXT), + TABLE_ENTRY(VertexWeightPointerEXT), + TABLE_ENTRY(FlushVertexArrayRangeNV), + TABLE_ENTRY(VertexArrayRangeNV), + TABLE_ENTRY(CombinerParameterfvNV), + TABLE_ENTRY(CombinerParameterfNV), + TABLE_ENTRY(CombinerParameterivNV), + TABLE_ENTRY(CombinerParameteriNV), + TABLE_ENTRY(CombinerInputNV), + TABLE_ENTRY(CombinerOutputNV), + TABLE_ENTRY(FinalCombinerInputNV), + TABLE_ENTRY(GetCombinerInputParameterfvNV), + TABLE_ENTRY(GetCombinerInputParameterivNV), + TABLE_ENTRY(GetCombinerOutputParameterfvNV), + TABLE_ENTRY(GetCombinerOutputParameterivNV), + TABLE_ENTRY(GetFinalCombinerInputParameterfvNV), + TABLE_ENTRY(GetFinalCombinerInputParameterivNV), + TABLE_ENTRY(ResizeBuffersMESA), + TABLE_ENTRY(WindowPos2dMESA), + TABLE_ENTRY(WindowPos2dvMESA), + TABLE_ENTRY(WindowPos2fMESA), + TABLE_ENTRY(WindowPos2fvMESA), + TABLE_ENTRY(WindowPos2iMESA), + TABLE_ENTRY(WindowPos2ivMESA), + TABLE_ENTRY(WindowPos2sMESA), + TABLE_ENTRY(WindowPos2svMESA), + TABLE_ENTRY(WindowPos3dMESA), + TABLE_ENTRY(WindowPos3dvMESA), + TABLE_ENTRY(WindowPos3fMESA), + TABLE_ENTRY(WindowPos3fvMESA), + TABLE_ENTRY(WindowPos3iMESA), + TABLE_ENTRY(WindowPos3ivMESA), + TABLE_ENTRY(WindowPos3sMESA), + TABLE_ENTRY(WindowPos3svMESA), + TABLE_ENTRY(WindowPos4dMESA), + TABLE_ENTRY(WindowPos4dvMESA), + TABLE_ENTRY(WindowPos4fMESA), + TABLE_ENTRY(WindowPos4fvMESA), + TABLE_ENTRY(WindowPos4iMESA), + TABLE_ENTRY(WindowPos4ivMESA), + TABLE_ENTRY(WindowPos4sMESA), + TABLE_ENTRY(WindowPos4svMESA), + TABLE_ENTRY(BlendFuncSeparateEXT), + TABLE_ENTRY(IndexMaterialEXT), + TABLE_ENTRY(IndexFuncEXT), + TABLE_ENTRY(LockArraysEXT), + TABLE_ENTRY(UnlockArraysEXT), + TABLE_ENTRY(CullParameterdvEXT), + TABLE_ENTRY(CullParameterfvEXT), + TABLE_ENTRY(HintPGI), + TABLE_ENTRY(FogCoordfEXT), + TABLE_ENTRY(FogCoordfvEXT), + TABLE_ENTRY(FogCoorddEXT), + TABLE_ENTRY(FogCoorddvEXT), + TABLE_ENTRY(FogCoordPointerEXT), + TABLE_ENTRY(GetColorTableEXT), + TABLE_ENTRY(GetColorTableParameterivEXT), + TABLE_ENTRY(GetColorTableParameterfvEXT), + TABLE_ENTRY(TbufferMask3DFX), + TABLE_ENTRY(CompressedTexImage3DARB), + TABLE_ENTRY(CompressedTexImage2DARB), + TABLE_ENTRY(CompressedTexImage1DARB), + TABLE_ENTRY(CompressedTexSubImage3DARB), + TABLE_ENTRY(CompressedTexSubImage2DARB), + TABLE_ENTRY(CompressedTexSubImage1DARB), + TABLE_ENTRY(GetCompressedTexImageARB), + TABLE_ENTRY(SecondaryColor3bEXT), + TABLE_ENTRY(SecondaryColor3bvEXT), + TABLE_ENTRY(SecondaryColor3dEXT), + TABLE_ENTRY(SecondaryColor3dvEXT), + TABLE_ENTRY(SecondaryColor3fEXT), + TABLE_ENTRY(SecondaryColor3fvEXT), + TABLE_ENTRY(SecondaryColor3iEXT), + TABLE_ENTRY(SecondaryColor3ivEXT), + TABLE_ENTRY(SecondaryColor3sEXT), + TABLE_ENTRY(SecondaryColor3svEXT), + TABLE_ENTRY(SecondaryColor3ubEXT), + TABLE_ENTRY(SecondaryColor3ubvEXT), + TABLE_ENTRY(SecondaryColor3uiEXT), + TABLE_ENTRY(SecondaryColor3uivEXT), + TABLE_ENTRY(SecondaryColor3usEXT), + TABLE_ENTRY(SecondaryColor3usvEXT), + TABLE_ENTRY(SecondaryColorPointerEXT), + TABLE_ENTRY(AreProgramsResidentNV), + TABLE_ENTRY(BindProgramNV), + TABLE_ENTRY(DeleteProgramsNV), + TABLE_ENTRY(ExecuteProgramNV), + TABLE_ENTRY(GenProgramsNV), + TABLE_ENTRY(GetProgramParameterdvNV), + TABLE_ENTRY(GetProgramParameterfvNV), + TABLE_ENTRY(GetProgramivNV), + TABLE_ENTRY(GetProgramStringNV), + TABLE_ENTRY(GetTrackMatrixivNV), + TABLE_ENTRY(GetVertexAttribdvARB), + TABLE_ENTRY(GetVertexAttribfvARB), + TABLE_ENTRY(GetVertexAttribivARB), + TABLE_ENTRY(GetVertexAttribPointervNV), + TABLE_ENTRY(IsProgramNV), + TABLE_ENTRY(LoadProgramNV), + TABLE_ENTRY(ProgramParameter4dNV), + TABLE_ENTRY(ProgramParameter4dvNV), + TABLE_ENTRY(ProgramParameter4fNV), + TABLE_ENTRY(ProgramParameter4fvNV), + TABLE_ENTRY(ProgramParameters4dvNV), + TABLE_ENTRY(ProgramParameters4fvNV), + TABLE_ENTRY(RequestResidentProgramsNV), + TABLE_ENTRY(TrackMatrixNV), + TABLE_ENTRY(VertexAttribPointerNV), + TABLE_ENTRY(VertexAttrib1dARB), + TABLE_ENTRY(VertexAttrib1dvARB), + TABLE_ENTRY(VertexAttrib1fARB), + TABLE_ENTRY(VertexAttrib1fvARB), + TABLE_ENTRY(VertexAttrib1sARB), + TABLE_ENTRY(VertexAttrib1svARB), + TABLE_ENTRY(VertexAttrib2dARB), + TABLE_ENTRY(VertexAttrib2dvARB), + TABLE_ENTRY(VertexAttrib2fARB), + TABLE_ENTRY(VertexAttrib2fvARB), + TABLE_ENTRY(VertexAttrib2sARB), + TABLE_ENTRY(VertexAttrib2svARB), + TABLE_ENTRY(VertexAttrib3dARB), + TABLE_ENTRY(VertexAttrib3dvARB), + TABLE_ENTRY(VertexAttrib3fARB), + TABLE_ENTRY(VertexAttrib3fvARB), + TABLE_ENTRY(VertexAttrib3sARB), + TABLE_ENTRY(VertexAttrib3svARB), + TABLE_ENTRY(VertexAttrib4dARB), + TABLE_ENTRY(VertexAttrib4dvARB), + TABLE_ENTRY(VertexAttrib4fARB), + TABLE_ENTRY(VertexAttrib4fvARB), + TABLE_ENTRY(VertexAttrib4sARB), + TABLE_ENTRY(VertexAttrib4svARB), + TABLE_ENTRY(VertexAttrib4NubARB), + TABLE_ENTRY(VertexAttrib4NubvARB), + TABLE_ENTRY(VertexAttribs1dvNV), + TABLE_ENTRY(VertexAttribs1fvNV), + TABLE_ENTRY(VertexAttribs1svNV), + TABLE_ENTRY(VertexAttribs2dvNV), + TABLE_ENTRY(VertexAttribs2fvNV), + TABLE_ENTRY(VertexAttribs2svNV), + TABLE_ENTRY(VertexAttribs3dvNV), + TABLE_ENTRY(VertexAttribs3fvNV), + TABLE_ENTRY(VertexAttribs3svNV), + TABLE_ENTRY(VertexAttribs4dvNV), + TABLE_ENTRY(VertexAttribs4fvNV), + TABLE_ENTRY(VertexAttribs4svNV), + TABLE_ENTRY(VertexAttribs4ubvNV), + TABLE_ENTRY(PointParameteriNV), + TABLE_ENTRY(PointParameterivNV), + TABLE_ENTRY(MultiDrawArraysEXT), + TABLE_ENTRY(MultiDrawElementsEXT), + TABLE_ENTRY(ActiveStencilFaceEXT), + TABLE_ENTRY(DeleteFencesNV), + TABLE_ENTRY(GenFencesNV), + TABLE_ENTRY(IsFenceNV), + TABLE_ENTRY(TestFenceNV), + TABLE_ENTRY(GetFenceivNV), + TABLE_ENTRY(FinishFenceNV), + TABLE_ENTRY(SetFenceNV), + TABLE_ENTRY(VertexAttrib4bvARB), + TABLE_ENTRY(VertexAttrib4ivARB), + TABLE_ENTRY(VertexAttrib4ubvARB), + TABLE_ENTRY(VertexAttrib4usvARB), + TABLE_ENTRY(VertexAttrib4uivARB), + TABLE_ENTRY(VertexAttrib4NbvARB), + TABLE_ENTRY(VertexAttrib4NsvARB), + TABLE_ENTRY(VertexAttrib4NivARB), + TABLE_ENTRY(VertexAttrib4NusvARB), + TABLE_ENTRY(VertexAttrib4NuivARB), + TABLE_ENTRY(VertexAttribPointerARB), + TABLE_ENTRY(EnableVertexAttribArrayARB), + TABLE_ENTRY(DisableVertexAttribArrayARB), + TABLE_ENTRY(ProgramStringARB), + TABLE_ENTRY(ProgramEnvParameter4dARB), + TABLE_ENTRY(ProgramEnvParameter4dvARB), + TABLE_ENTRY(ProgramEnvParameter4fARB), + TABLE_ENTRY(ProgramEnvParameter4fvARB), + TABLE_ENTRY(ProgramLocalParameter4dARB), + TABLE_ENTRY(ProgramLocalParameter4dvARB), + TABLE_ENTRY(ProgramLocalParameter4fARB), + TABLE_ENTRY(ProgramLocalParameter4fvARB), + TABLE_ENTRY(GetProgramEnvParameterdvARB), + TABLE_ENTRY(GetProgramEnvParameterfvARB), + TABLE_ENTRY(GetProgramLocalParameterdvARB), + TABLE_ENTRY(GetProgramLocalParameterfvARB), + TABLE_ENTRY(GetProgramivARB), + TABLE_ENTRY(GetProgramStringARB), + TABLE_ENTRY(ProgramNamedParameter4fNV), + TABLE_ENTRY(ProgramNamedParameter4dNV), + TABLE_ENTRY(ProgramNamedParameter4fvNV), + TABLE_ENTRY(ProgramNamedParameter4dvNV), + TABLE_ENTRY(GetProgramNamedParameterfvNV), + TABLE_ENTRY(GetProgramNamedParameterdvNV), + TABLE_ENTRY(BindBufferARB), + TABLE_ENTRY(BufferDataARB), + TABLE_ENTRY(BufferSubDataARB), + TABLE_ENTRY(DeleteBuffersARB), + TABLE_ENTRY(GenBuffersARB), + TABLE_ENTRY(GetBufferParameterivARB), + TABLE_ENTRY(GetBufferPointervARB), + TABLE_ENTRY(GetBufferSubDataARB), + TABLE_ENTRY(IsBufferARB), + TABLE_ENTRY(MapBufferARB), + TABLE_ENTRY(UnmapBufferARB), + TABLE_ENTRY(DepthBoundsEXT), + TABLE_ENTRY(GenQueriesARB), + TABLE_ENTRY(DeleteQueriesARB), + TABLE_ENTRY(IsQueryARB), + TABLE_ENTRY(BeginQueryARB), + TABLE_ENTRY(EndQueryARB), + TABLE_ENTRY(GetQueryivARB), + TABLE_ENTRY(GetQueryObjectivARB), + TABLE_ENTRY(GetQueryObjectuivARB), + TABLE_ENTRY(MultiModeDrawArraysIBM), + TABLE_ENTRY(MultiModeDrawElementsIBM), + TABLE_ENTRY(BlendEquationSeparateEXT), + TABLE_ENTRY(DeleteObjectARB), + TABLE_ENTRY(GetHandleARB), + TABLE_ENTRY(DetachObjectARB), + TABLE_ENTRY(CreateShaderObjectARB), + TABLE_ENTRY(ShaderSourceARB), + TABLE_ENTRY(CompileShaderARB), + TABLE_ENTRY(CreateProgramObjectARB), + TABLE_ENTRY(AttachObjectARB), + TABLE_ENTRY(LinkProgramARB), + TABLE_ENTRY(UseProgramObjectARB), + TABLE_ENTRY(ValidateProgramARB), + TABLE_ENTRY(Uniform1fARB), + TABLE_ENTRY(Uniform2fARB), + TABLE_ENTRY(Uniform3fARB), + TABLE_ENTRY(Uniform4fARB), + TABLE_ENTRY(Uniform1iARB), + TABLE_ENTRY(Uniform2iARB), + TABLE_ENTRY(Uniform3iARB), + TABLE_ENTRY(Uniform4iARB), + TABLE_ENTRY(Uniform1fvARB), + TABLE_ENTRY(Uniform2fvARB), + TABLE_ENTRY(Uniform3fvARB), + TABLE_ENTRY(Uniform4fvARB), + TABLE_ENTRY(Uniform1ivARB), + TABLE_ENTRY(Uniform2ivARB), + TABLE_ENTRY(Uniform3ivARB), + TABLE_ENTRY(Uniform4ivARB), + TABLE_ENTRY(UniformMatrix2fvARB), + TABLE_ENTRY(UniformMatrix3fvARB), + TABLE_ENTRY(UniformMatrix4fvARB), + TABLE_ENTRY(GetObjectParameterfvARB), + TABLE_ENTRY(GetObjectParameterivARB), + TABLE_ENTRY(GetInfoLogARB), + TABLE_ENTRY(GetAttachedObjectsARB), + TABLE_ENTRY(GetUniformLocationARB), + TABLE_ENTRY(GetActiveUniformARB), + TABLE_ENTRY(GetUniformfvARB), + TABLE_ENTRY(GetUniformivARB), + TABLE_ENTRY(GetShaderSourceARB), + TABLE_ENTRY(BindAttribLocationARB), + TABLE_ENTRY(GetActiveAttribARB), + TABLE_ENTRY(GetAttribLocationARB), + TABLE_ENTRY(GetVertexAttribdvNV), + TABLE_ENTRY(GetVertexAttribfvNV), + TABLE_ENTRY(GetVertexAttribivNV), + TABLE_ENTRY(VertexAttrib1dNV), + TABLE_ENTRY(VertexAttrib1dvNV), + TABLE_ENTRY(VertexAttrib1fNV), + TABLE_ENTRY(VertexAttrib1fvNV), + TABLE_ENTRY(VertexAttrib1sNV), + TABLE_ENTRY(VertexAttrib1svNV), + TABLE_ENTRY(VertexAttrib2dNV), + TABLE_ENTRY(VertexAttrib2dvNV), + TABLE_ENTRY(VertexAttrib2fNV), + TABLE_ENTRY(VertexAttrib2fvNV), + TABLE_ENTRY(VertexAttrib2sNV), + TABLE_ENTRY(VertexAttrib2svNV), + TABLE_ENTRY(VertexAttrib3dNV), + TABLE_ENTRY(VertexAttrib3dvNV), + TABLE_ENTRY(VertexAttrib3fNV), + TABLE_ENTRY(VertexAttrib3fvNV), + TABLE_ENTRY(VertexAttrib3sNV), + TABLE_ENTRY(VertexAttrib3svNV), + TABLE_ENTRY(VertexAttrib4dNV), + TABLE_ENTRY(VertexAttrib4dvNV), + TABLE_ENTRY(VertexAttrib4fNV), + TABLE_ENTRY(VertexAttrib4fvNV), + TABLE_ENTRY(VertexAttrib4sNV), + TABLE_ENTRY(VertexAttrib4svNV), + TABLE_ENTRY(VertexAttrib4ubNV), + TABLE_ENTRY(VertexAttrib4ubvNV), + TABLE_ENTRY(GenFragmentShadersATI), + TABLE_ENTRY(BindFragmentShaderATI), + TABLE_ENTRY(DeleteFragmentShaderATI), + TABLE_ENTRY(BeginFragmentShaderATI), + TABLE_ENTRY(EndFragmentShaderATI), + TABLE_ENTRY(PassTexCoordATI), + TABLE_ENTRY(SampleMapATI), + TABLE_ENTRY(ColorFragmentOp1ATI), + TABLE_ENTRY(ColorFragmentOp2ATI), + TABLE_ENTRY(ColorFragmentOp3ATI), + TABLE_ENTRY(AlphaFragmentOp1ATI), + TABLE_ENTRY(AlphaFragmentOp2ATI), + TABLE_ENTRY(AlphaFragmentOp3ATI), + TABLE_ENTRY(SetFragmentShaderConstantATI), + TABLE_ENTRY(IsRenderbufferEXT), + TABLE_ENTRY(BindRenderbufferEXT), + TABLE_ENTRY(DeleteRenderbuffersEXT), + TABLE_ENTRY(GenRenderbuffersEXT), + TABLE_ENTRY(RenderbufferStorageEXT), + TABLE_ENTRY(GetRenderbufferParameterivEXT), + TABLE_ENTRY(IsFramebufferEXT), + TABLE_ENTRY(BindFramebufferEXT), + TABLE_ENTRY(DeleteFramebuffersEXT), + TABLE_ENTRY(GenFramebuffersEXT), + TABLE_ENTRY(CheckFramebufferStatusEXT), + TABLE_ENTRY(FramebufferTexture1DEXT), + TABLE_ENTRY(FramebufferTexture2DEXT), + TABLE_ENTRY(FramebufferTexture3DEXT), + TABLE_ENTRY(FramebufferRenderbufferEXT), + TABLE_ENTRY(GetFramebufferAttachmentParameterivEXT), + TABLE_ENTRY(GenerateMipmapEXT), + TABLE_ENTRY(StencilFuncSeparate), + TABLE_ENTRY(StencilOpSeparate), + TABLE_ENTRY(StencilMaskSeparate), + /* A whole bunch of no-op functions. These might be called + * when someone tries to call a dynamically-registered + * extension function without a current rendering context. + */ + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), + TABLE_ENTRY(Unused), +}; +#endif /* DISPATCH_TABLE_NAME */ + + +/* + * This is just used to silence compiler warnings. + * We list the functions which are not otherwise used. + */ +#ifdef UNUSED_TABLE_NAME +static _glapi_proc UNUSED_TABLE_NAME[] = { + TABLE_ENTRY(ArrayElementEXT), + TABLE_ENTRY(BindTextureEXT), + TABLE_ENTRY(DrawArraysEXT), + TABLE_ENTRY(CopyTexImage1DEXT), + TABLE_ENTRY(CopyTexImage2DEXT), + TABLE_ENTRY(CopyTexSubImage1DEXT), + TABLE_ENTRY(CopyTexSubImage2DEXT), + TABLE_ENTRY(DeleteTexturesEXT), + TABLE_ENTRY(GetPointervEXT), + TABLE_ENTRY(PrioritizeTexturesEXT), + TABLE_ENTRY(TexSubImage1DEXT), + TABLE_ENTRY(TexSubImage2DEXT), + TABLE_ENTRY(BlendColorEXT), + TABLE_ENTRY(BlendEquationEXT), + TABLE_ENTRY(DrawRangeElementsEXT), + TABLE_ENTRY(ColorTableSGI), + TABLE_ENTRY(ColorTableEXT), + TABLE_ENTRY(ColorTableParameterfvSGI), + TABLE_ENTRY(ColorTableParameterivSGI), + TABLE_ENTRY(CopyColorTableSGI), + TABLE_ENTRY(ColorSubTableEXT), + TABLE_ENTRY(CopyColorSubTableEXT), + TABLE_ENTRY(ConvolutionFilter1DEXT), + TABLE_ENTRY(ConvolutionFilter2DEXT), + TABLE_ENTRY(ConvolutionParameterfEXT), + TABLE_ENTRY(ConvolutionParameterfvEXT), + TABLE_ENTRY(ConvolutionParameteriEXT), + TABLE_ENTRY(ConvolutionParameterivEXT), + TABLE_ENTRY(CopyConvolutionFilter1DEXT), + TABLE_ENTRY(CopyConvolutionFilter2DEXT), + TABLE_ENTRY(SeparableFilter2DEXT), + TABLE_ENTRY(HistogramEXT), + TABLE_ENTRY(MinmaxEXT), + TABLE_ENTRY(ResetHistogramEXT), + TABLE_ENTRY(ResetMinmaxEXT), + TABLE_ENTRY(TexImage3DEXT), + TABLE_ENTRY(TexSubImage3DEXT), + TABLE_ENTRY(CopyTexSubImage3DEXT), + TABLE_ENTRY(ActiveTexture), + TABLE_ENTRY(ClientActiveTexture), + TABLE_ENTRY(MultiTexCoord1d), + TABLE_ENTRY(MultiTexCoord1dv), + TABLE_ENTRY(MultiTexCoord1f), + TABLE_ENTRY(MultiTexCoord1fv), + TABLE_ENTRY(MultiTexCoord1i), + TABLE_ENTRY(MultiTexCoord1iv), + TABLE_ENTRY(MultiTexCoord1s), + TABLE_ENTRY(MultiTexCoord1sv), + TABLE_ENTRY(MultiTexCoord2d), + TABLE_ENTRY(MultiTexCoord2dv), + TABLE_ENTRY(MultiTexCoord2f), + TABLE_ENTRY(MultiTexCoord2fv), + TABLE_ENTRY(MultiTexCoord2i), + TABLE_ENTRY(MultiTexCoord2iv), + TABLE_ENTRY(MultiTexCoord2s), + TABLE_ENTRY(MultiTexCoord2sv), + TABLE_ENTRY(MultiTexCoord3d), + TABLE_ENTRY(MultiTexCoord3dv), + TABLE_ENTRY(MultiTexCoord3f), + TABLE_ENTRY(MultiTexCoord3fv), + TABLE_ENTRY(MultiTexCoord3i), + TABLE_ENTRY(MultiTexCoord3iv), + TABLE_ENTRY(MultiTexCoord3s), + TABLE_ENTRY(MultiTexCoord3sv), + TABLE_ENTRY(MultiTexCoord4d), + TABLE_ENTRY(MultiTexCoord4dv), + TABLE_ENTRY(MultiTexCoord4f), + TABLE_ENTRY(MultiTexCoord4fv), + TABLE_ENTRY(MultiTexCoord4i), + TABLE_ENTRY(MultiTexCoord4iv), + TABLE_ENTRY(MultiTexCoord4s), + TABLE_ENTRY(MultiTexCoord4sv), + TABLE_ENTRY(LoadTransposeMatrixf), + TABLE_ENTRY(LoadTransposeMatrixd), + TABLE_ENTRY(MultTransposeMatrixf), + TABLE_ENTRY(MultTransposeMatrixd), + TABLE_ENTRY(SampleCoverage), + TABLE_ENTRY(DrawBuffersATI), + TABLE_ENTRY(SampleMaskEXT), + TABLE_ENTRY(SamplePatternEXT), + TABLE_ENTRY(PointParameterf), + TABLE_ENTRY(PointParameterfARB), + TABLE_ENTRY(PointParameterfSGIS), + TABLE_ENTRY(PointParameterfv), + TABLE_ENTRY(PointParameterfvARB), + TABLE_ENTRY(PointParameterfvSGIS), + TABLE_ENTRY(WindowPos2d), + TABLE_ENTRY(WindowPos2dARB), + TABLE_ENTRY(WindowPos2dv), + TABLE_ENTRY(WindowPos2dvARB), + TABLE_ENTRY(WindowPos2f), + TABLE_ENTRY(WindowPos2fARB), + TABLE_ENTRY(WindowPos2fv), + TABLE_ENTRY(WindowPos2fvARB), + TABLE_ENTRY(WindowPos2i), + TABLE_ENTRY(WindowPos2iARB), + TABLE_ENTRY(WindowPos2iv), + TABLE_ENTRY(WindowPos2ivARB), + TABLE_ENTRY(WindowPos2s), + TABLE_ENTRY(WindowPos2sARB), + TABLE_ENTRY(WindowPos2sv), + TABLE_ENTRY(WindowPos2svARB), + TABLE_ENTRY(WindowPos3d), + TABLE_ENTRY(WindowPos3dARB), + TABLE_ENTRY(WindowPos3dv), + TABLE_ENTRY(WindowPos3dvARB), + TABLE_ENTRY(WindowPos3f), + TABLE_ENTRY(WindowPos3fARB), + TABLE_ENTRY(WindowPos3fv), + TABLE_ENTRY(WindowPos3fvARB), + TABLE_ENTRY(WindowPos3i), + TABLE_ENTRY(WindowPos3iARB), + TABLE_ENTRY(WindowPos3iv), + TABLE_ENTRY(WindowPos3ivARB), + TABLE_ENTRY(WindowPos3s), + TABLE_ENTRY(WindowPos3sARB), + TABLE_ENTRY(WindowPos3sv), + TABLE_ENTRY(WindowPos3svARB), + TABLE_ENTRY(BlendFuncSeparate), + TABLE_ENTRY(BlendFuncSeparateINGR), + TABLE_ENTRY(FogCoordf), + TABLE_ENTRY(FogCoordfv), + TABLE_ENTRY(FogCoordd), + TABLE_ENTRY(FogCoorddv), + TABLE_ENTRY(FogCoordPointer), + TABLE_ENTRY(CompressedTexImage3D), + TABLE_ENTRY(CompressedTexImage2D), + TABLE_ENTRY(CompressedTexImage1D), + TABLE_ENTRY(CompressedTexSubImage3D), + TABLE_ENTRY(CompressedTexSubImage2D), + TABLE_ENTRY(CompressedTexSubImage1D), + TABLE_ENTRY(GetCompressedTexImage), + TABLE_ENTRY(SecondaryColor3b), + TABLE_ENTRY(SecondaryColor3bv), + TABLE_ENTRY(SecondaryColor3d), + TABLE_ENTRY(SecondaryColor3dv), + TABLE_ENTRY(SecondaryColor3f), + TABLE_ENTRY(SecondaryColor3fv), + TABLE_ENTRY(SecondaryColor3i), + TABLE_ENTRY(SecondaryColor3iv), + TABLE_ENTRY(SecondaryColor3s), + TABLE_ENTRY(SecondaryColor3sv), + TABLE_ENTRY(SecondaryColor3ub), + TABLE_ENTRY(SecondaryColor3ubv), + TABLE_ENTRY(SecondaryColor3ui), + TABLE_ENTRY(SecondaryColor3uiv), + TABLE_ENTRY(SecondaryColor3us), + TABLE_ENTRY(SecondaryColor3usv), + TABLE_ENTRY(SecondaryColorPointer), + TABLE_ENTRY(BindProgramARB), + TABLE_ENTRY(DeleteProgramsARB), + TABLE_ENTRY(GenProgramsARB), + TABLE_ENTRY(GetVertexAttribPointervARB), + TABLE_ENTRY(IsProgramARB), + TABLE_ENTRY(PointParameteri), + TABLE_ENTRY(PointParameteriv), + TABLE_ENTRY(MultiDrawArrays), + TABLE_ENTRY(MultiDrawElements), + TABLE_ENTRY(BindBuffer), + TABLE_ENTRY(BufferData), + TABLE_ENTRY(BufferSubData), + TABLE_ENTRY(DeleteBuffers), + TABLE_ENTRY(GenBuffers), + TABLE_ENTRY(GetBufferParameteriv), + TABLE_ENTRY(GetBufferPointerv), + TABLE_ENTRY(GetBufferSubData), + TABLE_ENTRY(IsBuffer), + TABLE_ENTRY(MapBuffer), + TABLE_ENTRY(UnmapBuffer), + TABLE_ENTRY(GenQueries), + TABLE_ENTRY(DeleteQueries), + TABLE_ENTRY(IsQuery), + TABLE_ENTRY(BeginQuery), + TABLE_ENTRY(EndQuery), + TABLE_ENTRY(GetQueryiv), + TABLE_ENTRY(GetQueryObjectiv), + TABLE_ENTRY(GetQueryObjectuiv), + TABLE_ENTRY(BlendEquationSeparateATI), +}; +#endif /*UNUSED_TABLE_NAME*/ + + +# undef KEYWORD1 +# undef KEYWORD2 +# undef NAME +# undef DISPATCH +# undef RETURN_DISPATCH +# undef DISPATCH_TABLE_NAME +# undef UNUSED_TABLE_NAME +# undef TABLE_ENTRY diff --git a/reactos/dll/mesa32/src/glapi/glprocs.h b/reactos/dll/mesa32/src/glapi/glprocs.h new file mode 100644 index 00000000000..596a3e4cf9a --- /dev/null +++ b/reactos/dll/mesa32/src/glapi/glprocs.h @@ -0,0 +1,2043 @@ +/* DO NOT EDIT - This file generated automatically by gl_procs.py (from Mesa) script */ + +/* + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * (C) Copyright IBM Corporation 2004 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL, IBM, + * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* This file is only included by glapi.c and is used for + * the GetProcAddress() function + */ + +typedef struct { + GLint Name_offset; +#ifdef NEED_FUNCTION_POINTER + _glapi_proc Address; +#endif + GLuint Offset; +} glprocs_table_t; + +#ifdef NEED_FUNCTION_POINTER +# define NAME_FUNC_OFFSET(n,f,o) { n , (_glapi_proc) f , o } +#else +# define NAME_FUNC_OFFSET(n,f,o) { n , o } +#endif + + +static const char gl_string_table[] = + "glNewList\0" + "glEndList\0" + "glCallList\0" + "glCallLists\0" + "glDeleteLists\0" + "glGenLists\0" + "glListBase\0" + "glBegin\0" + "glBitmap\0" + "glColor3b\0" + "glColor3bv\0" + "glColor3d\0" + "glColor3dv\0" + "glColor3f\0" + "glColor3fv\0" + "glColor3i\0" + "glColor3iv\0" + "glColor3s\0" + "glColor3sv\0" + "glColor3ub\0" + "glColor3ubv\0" + "glColor3ui\0" + "glColor3uiv\0" + "glColor3us\0" + "glColor3usv\0" + "glColor4b\0" + "glColor4bv\0" + "glColor4d\0" + "glColor4dv\0" + "glColor4f\0" + "glColor4fv\0" + "glColor4i\0" + "glColor4iv\0" + "glColor4s\0" + "glColor4sv\0" + "glColor4ub\0" + "glColor4ubv\0" + "glColor4ui\0" + "glColor4uiv\0" + "glColor4us\0" + "glColor4usv\0" + "glEdgeFlag\0" + "glEdgeFlagv\0" + "glEnd\0" + "glIndexd\0" + "glIndexdv\0" + "glIndexf\0" + "glIndexfv\0" + "glIndexi\0" + "glIndexiv\0" + "glIndexs\0" + "glIndexsv\0" + "glNormal3b\0" + "glNormal3bv\0" + "glNormal3d\0" + "glNormal3dv\0" + "glNormal3f\0" + "glNormal3fv\0" + "glNormal3i\0" + "glNormal3iv\0" + "glNormal3s\0" + "glNormal3sv\0" + "glRasterPos2d\0" + "glRasterPos2dv\0" + "glRasterPos2f\0" + "glRasterPos2fv\0" + "glRasterPos2i\0" + "glRasterPos2iv\0" + "glRasterPos2s\0" + "glRasterPos2sv\0" + "glRasterPos3d\0" + "glRasterPos3dv\0" + "glRasterPos3f\0" + "glRasterPos3fv\0" + "glRasterPos3i\0" + "glRasterPos3iv\0" + "glRasterPos3s\0" + "glRasterPos3sv\0" + "glRasterPos4d\0" + "glRasterPos4dv\0" + "glRasterPos4f\0" + "glRasterPos4fv\0" + "glRasterPos4i\0" + "glRasterPos4iv\0" + "glRasterPos4s\0" + "glRasterPos4sv\0" + "glRectd\0" + "glRectdv\0" + "glRectf\0" + "glRectfv\0" + "glRecti\0" + "glRectiv\0" + "glRects\0" + "glRectsv\0" + "glTexCoord1d\0" + "glTexCoord1dv\0" + "glTexCoord1f\0" + "glTexCoord1fv\0" + "glTexCoord1i\0" + "glTexCoord1iv\0" + "glTexCoord1s\0" + "glTexCoord1sv\0" + "glTexCoord2d\0" + "glTexCoord2dv\0" + "glTexCoord2f\0" + "glTexCoord2fv\0" + "glTexCoord2i\0" + "glTexCoord2iv\0" + "glTexCoord2s\0" + "glTexCoord2sv\0" + "glTexCoord3d\0" + "glTexCoord3dv\0" + "glTexCoord3f\0" + "glTexCoord3fv\0" + "glTexCoord3i\0" + "glTexCoord3iv\0" + "glTexCoord3s\0" + "glTexCoord3sv\0" + "glTexCoord4d\0" + "glTexCoord4dv\0" + "glTexCoord4f\0" + "glTexCoord4fv\0" + "glTexCoord4i\0" + "glTexCoord4iv\0" + "glTexCoord4s\0" + "glTexCoord4sv\0" + "glVertex2d\0" + "glVertex2dv\0" + "glVertex2f\0" + "glVertex2fv\0" + "glVertex2i\0" + "glVertex2iv\0" + "glVertex2s\0" + "glVertex2sv\0" + "glVertex3d\0" + "glVertex3dv\0" + "glVertex3f\0" + "glVertex3fv\0" + "glVertex3i\0" + "glVertex3iv\0" + "glVertex3s\0" + "glVertex3sv\0" + "glVertex4d\0" + "glVertex4dv\0" + "glVertex4f\0" + "glVertex4fv\0" + "glVertex4i\0" + "glVertex4iv\0" + "glVertex4s\0" + "glVertex4sv\0" + "glClipPlane\0" + "glColorMaterial\0" + "glCullFace\0" + "glFogf\0" + "glFogfv\0" + "glFogi\0" + "glFogiv\0" + "glFrontFace\0" + "glHint\0" + "glLightf\0" + "glLightfv\0" + "glLighti\0" + "glLightiv\0" + "glLightModelf\0" + "glLightModelfv\0" + "glLightModeli\0" + "glLightModeliv\0" + "glLineStipple\0" + "glLineWidth\0" + "glMaterialf\0" + "glMaterialfv\0" + "glMateriali\0" + "glMaterialiv\0" + "glPointSize\0" + "glPolygonMode\0" + "glPolygonStipple\0" + "glScissor\0" + "glShadeModel\0" + "glTexParameterf\0" + "glTexParameterfv\0" + "glTexParameteri\0" + "glTexParameteriv\0" + "glTexImage1D\0" + "glTexImage2D\0" + "glTexEnvf\0" + "glTexEnvfv\0" + "glTexEnvi\0" + "glTexEnviv\0" + "glTexGend\0" + "glTexGendv\0" + "glTexGenf\0" + "glTexGenfv\0" + "glTexGeni\0" + "glTexGeniv\0" + "glFeedbackBuffer\0" + "glSelectBuffer\0" + "glRenderMode\0" + "glInitNames\0" + "glLoadName\0" + "glPassThrough\0" + "glPopName\0" + "glPushName\0" + "glDrawBuffer\0" + "glClear\0" + "glClearAccum\0" + "glClearIndex\0" + "glClearColor\0" + "glClearStencil\0" + "glClearDepth\0" + "glStencilMask\0" + "glColorMask\0" + "glDepthMask\0" + "glIndexMask\0" + "glAccum\0" + "glDisable\0" + "glEnable\0" + "glFinish\0" + "glFlush\0" + "glPopAttrib\0" + "glPushAttrib\0" + "glMap1d\0" + "glMap1f\0" + "glMap2d\0" + "glMap2f\0" + "glMapGrid1d\0" + "glMapGrid1f\0" + "glMapGrid2d\0" + "glMapGrid2f\0" + "glEvalCoord1d\0" + "glEvalCoord1dv\0" + "glEvalCoord1f\0" + "glEvalCoord1fv\0" + "glEvalCoord2d\0" + "glEvalCoord2dv\0" + "glEvalCoord2f\0" + "glEvalCoord2fv\0" + "glEvalMesh1\0" + "glEvalPoint1\0" + "glEvalMesh2\0" + "glEvalPoint2\0" + "glAlphaFunc\0" + "glBlendFunc\0" + "glLogicOp\0" + "glStencilFunc\0" + "glStencilOp\0" + "glDepthFunc\0" + "glPixelZoom\0" + "glPixelTransferf\0" + "glPixelTransferi\0" + "glPixelStoref\0" + "glPixelStorei\0" + "glPixelMapfv\0" + "glPixelMapuiv\0" + "glPixelMapusv\0" + "glReadBuffer\0" + "glCopyPixels\0" + "glReadPixels\0" + "glDrawPixels\0" + "glGetBooleanv\0" + "glGetClipPlane\0" + "glGetDoublev\0" + "glGetError\0" + "glGetFloatv\0" + "glGetIntegerv\0" + "glGetLightfv\0" + "glGetLightiv\0" + "glGetMapdv\0" + "glGetMapfv\0" + "glGetMapiv\0" + "glGetMaterialfv\0" + "glGetMaterialiv\0" + "glGetPixelMapfv\0" + "glGetPixelMapuiv\0" + "glGetPixelMapusv\0" + "glGetPolygonStipple\0" + "glGetString\0" + "glGetTexEnvfv\0" + "glGetTexEnviv\0" + "glGetTexGendv\0" + "glGetTexGenfv\0" + "glGetTexGeniv\0" + "glGetTexImage\0" + "glGetTexParameterfv\0" + "glGetTexParameteriv\0" + "glGetTexLevelParameterfv\0" + "glGetTexLevelParameteriv\0" + "glIsEnabled\0" + "glIsList\0" + "glDepthRange\0" + "glFrustum\0" + "glLoadIdentity\0" + "glLoadMatrixf\0" + "glLoadMatrixd\0" + "glMatrixMode\0" + "glMultMatrixf\0" + "glMultMatrixd\0" + "glOrtho\0" + "glPopMatrix\0" + "glPushMatrix\0" + "glRotated\0" + "glRotatef\0" + "glScaled\0" + "glScalef\0" + "glTranslated\0" + "glTranslatef\0" + "glViewport\0" + "glArrayElement\0" + "glBindTexture\0" + "glColorPointer\0" + "glDisableClientState\0" + "glDrawArrays\0" + "glDrawElements\0" + "glEdgeFlagPointer\0" + "glEnableClientState\0" + "glIndexPointer\0" + "glIndexub\0" + "glIndexubv\0" + "glInterleavedArrays\0" + "glNormalPointer\0" + "glPolygonOffset\0" + "glTexCoordPointer\0" + "glVertexPointer\0" + "glAreTexturesResident\0" + "glCopyTexImage1D\0" + "glCopyTexImage2D\0" + "glCopyTexSubImage1D\0" + "glCopyTexSubImage2D\0" + "glDeleteTextures\0" + "glGenTextures\0" + "glGetPointerv\0" + "glIsTexture\0" + "glPrioritizeTextures\0" + "glTexSubImage1D\0" + "glTexSubImage2D\0" + "glPopClientAttrib\0" + "glPushClientAttrib\0" + "glBlendColor\0" + "glBlendEquation\0" + "glDrawRangeElements\0" + "glColorTable\0" + "glColorTableParameterfv\0" + "glColorTableParameteriv\0" + "glCopyColorTable\0" + "glGetColorTable\0" + "glGetColorTableParameterfv\0" + "glGetColorTableParameteriv\0" + "glColorSubTable\0" + "glCopyColorSubTable\0" + "glConvolutionFilter1D\0" + "glConvolutionFilter2D\0" + "glConvolutionParameterf\0" + "glConvolutionParameterfv\0" + "glConvolutionParameteri\0" + "glConvolutionParameteriv\0" + "glCopyConvolutionFilter1D\0" + "glCopyConvolutionFilter2D\0" + "glGetConvolutionFilter\0" + "glGetConvolutionParameterfv\0" + "glGetConvolutionParameteriv\0" + "glGetSeparableFilter\0" + "glSeparableFilter2D\0" + "glGetHistogram\0" + "glGetHistogramParameterfv\0" + "glGetHistogramParameteriv\0" + "glGetMinmax\0" + "glGetMinmaxParameterfv\0" + "glGetMinmaxParameteriv\0" + "glHistogram\0" + "glMinmax\0" + "glResetHistogram\0" + "glResetMinmax\0" + "glTexImage3D\0" + "glTexSubImage3D\0" + "glCopyTexSubImage3D\0" + "glActiveTextureARB\0" + "glClientActiveTextureARB\0" + "glMultiTexCoord1dARB\0" + "glMultiTexCoord1dvARB\0" + "glMultiTexCoord1fARB\0" + "glMultiTexCoord1fvARB\0" + "glMultiTexCoord1iARB\0" + "glMultiTexCoord1ivARB\0" + "glMultiTexCoord1sARB\0" + "glMultiTexCoord1svARB\0" + "glMultiTexCoord2dARB\0" + "glMultiTexCoord2dvARB\0" + "glMultiTexCoord2fARB\0" + "glMultiTexCoord2fvARB\0" + "glMultiTexCoord2iARB\0" + "glMultiTexCoord2ivARB\0" + "glMultiTexCoord2sARB\0" + "glMultiTexCoord2svARB\0" + "glMultiTexCoord3dARB\0" + "glMultiTexCoord3dvARB\0" + "glMultiTexCoord3fARB\0" + "glMultiTexCoord3fvARB\0" + "glMultiTexCoord3iARB\0" + "glMultiTexCoord3ivARB\0" + "glMultiTexCoord3sARB\0" + "glMultiTexCoord3svARB\0" + "glMultiTexCoord4dARB\0" + "glMultiTexCoord4dvARB\0" + "glMultiTexCoord4fARB\0" + "glMultiTexCoord4fvARB\0" + "glMultiTexCoord4iARB\0" + "glMultiTexCoord4ivARB\0" + "glMultiTexCoord4sARB\0" + "glMultiTexCoord4svARB\0" + "glLoadTransposeMatrixfARB\0" + "glLoadTransposeMatrixdARB\0" + "glMultTransposeMatrixfARB\0" + "glMultTransposeMatrixdARB\0" + "glSampleCoverageARB\0" + "glDrawBuffersARB\0" + "glPolygonOffsetEXT\0" + "glGetTexFilterFuncSGIS\0" + "glTexFilterFuncSGIS\0" + "glGetHistogramEXT\0" + "glGetHistogramParameterfvEXT\0" + "glGetHistogramParameterivEXT\0" + "glGetMinmaxEXT\0" + "glGetMinmaxParameterfvEXT\0" + "glGetMinmaxParameterivEXT\0" + "glGetConvolutionFilterEXT\0" + "glGetConvolutionParameterfvEXT\0" + "glGetConvolutionParameterivEXT\0" + "glGetSeparableFilterEXT\0" + "glGetColorTableSGI\0" + "glGetColorTableParameterfvSGI\0" + "glGetColorTableParameterivSGI\0" + "glPixelTexGenSGIX\0" + "glPixelTexGenParameteriSGIS\0" + "glPixelTexGenParameterivSGIS\0" + "glPixelTexGenParameterfSGIS\0" + "glPixelTexGenParameterfvSGIS\0" + "glGetPixelTexGenParameterivSGIS\0" + "glGetPixelTexGenParameterfvSGIS\0" + "glTexImage4DSGIS\0" + "glTexSubImage4DSGIS\0" + "glAreTexturesResidentEXT\0" + "glGenTexturesEXT\0" + "glIsTextureEXT\0" + "glDetailTexFuncSGIS\0" + "glGetDetailTexFuncSGIS\0" + "glSharpenTexFuncSGIS\0" + "glGetSharpenTexFuncSGIS\0" + "glSampleMaskSGIS\0" + "glSamplePatternSGIS\0" + "glColorPointerEXT\0" + "glEdgeFlagPointerEXT\0" + "glIndexPointerEXT\0" + "glNormalPointerEXT\0" + "glTexCoordPointerEXT\0" + "glVertexPointerEXT\0" + "glSpriteParameterfSGIX\0" + "glSpriteParameterfvSGIX\0" + "glSpriteParameteriSGIX\0" + "glSpriteParameterivSGIX\0" + "glPointParameterfEXT\0" + "glPointParameterfvEXT\0" + "glGetInstrumentsSGIX\0" + "glInstrumentsBufferSGIX\0" + "glPollInstrumentsSGIX\0" + "glReadInstrumentsSGIX\0" + "glStartInstrumentsSGIX\0" + "glStopInstrumentsSGIX\0" + "glFrameZoomSGIX\0" + "glTagSampleBufferSGIX\0" + "glReferencePlaneSGIX\0" + "glFlushRasterSGIX\0" + "glGetListParameterfvSGIX\0" + "glGetListParameterivSGIX\0" + "glListParameterfSGIX\0" + "glListParameterfvSGIX\0" + "glListParameteriSGIX\0" + "glListParameterivSGIX\0" + "glFragmentColorMaterialSGIX\0" + "glFragmentLightfSGIX\0" + "glFragmentLightfvSGIX\0" + "glFragmentLightiSGIX\0" + "glFragmentLightivSGIX\0" + "glFragmentLightModelfSGIX\0" + "glFragmentLightModelfvSGIX\0" + "glFragmentLightModeliSGIX\0" + "glFragmentLightModelivSGIX\0" + "glFragmentMaterialfSGIX\0" + "glFragmentMaterialfvSGIX\0" + "glFragmentMaterialiSGIX\0" + "glFragmentMaterialivSGIX\0" + "glGetFragmentLightfvSGIX\0" + "glGetFragmentLightivSGIX\0" + "glGetFragmentMaterialfvSGIX\0" + "glGetFragmentMaterialivSGIX\0" + "glLightEnviSGIX\0" + "glVertexWeightfEXT\0" + "glVertexWeightfvEXT\0" + "glVertexWeightPointerEXT\0" + "glFlushVertexArrayRangeNV\0" + "glVertexArrayRangeNV\0" + "glCombinerParameterfvNV\0" + "glCombinerParameterfNV\0" + "glCombinerParameterivNV\0" + "glCombinerParameteriNV\0" + "glCombinerInputNV\0" + "glCombinerOutputNV\0" + "glFinalCombinerInputNV\0" + "glGetCombinerInputParameterfvNV\0" + "glGetCombinerInputParameterivNV\0" + "glGetCombinerOutputParameterfvNV\0" + "glGetCombinerOutputParameterivNV\0" + "glGetFinalCombinerInputParameterfvNV\0" + "glGetFinalCombinerInputParameterivNV\0" + "glResizeBuffersMESA\0" + "glWindowPos2dMESA\0" + "glWindowPos2dvMESA\0" + "glWindowPos2fMESA\0" + "glWindowPos2fvMESA\0" + "glWindowPos2iMESA\0" + "glWindowPos2ivMESA\0" + "glWindowPos2sMESA\0" + "glWindowPos2svMESA\0" + "glWindowPos3dMESA\0" + "glWindowPos3dvMESA\0" + "glWindowPos3fMESA\0" + "glWindowPos3fvMESA\0" + "glWindowPos3iMESA\0" + "glWindowPos3ivMESA\0" + "glWindowPos3sMESA\0" + "glWindowPos3svMESA\0" + "glWindowPos4dMESA\0" + "glWindowPos4dvMESA\0" + "glWindowPos4fMESA\0" + "glWindowPos4fvMESA\0" + "glWindowPos4iMESA\0" + "glWindowPos4ivMESA\0" + "glWindowPos4sMESA\0" + "glWindowPos4svMESA\0" + "glBlendFuncSeparateEXT\0" + "glIndexMaterialEXT\0" + "glIndexFuncEXT\0" + "glLockArraysEXT\0" + "glUnlockArraysEXT\0" + "glCullParameterdvEXT\0" + "glCullParameterfvEXT\0" + "glHintPGI\0" + "glFogCoordfEXT\0" + "glFogCoordfvEXT\0" + "glFogCoorddEXT\0" + "glFogCoorddvEXT\0" + "glFogCoordPointerEXT\0" + "glGetColorTableEXT\0" + "glGetColorTableParameterivEXT\0" + "glGetColorTableParameterfvEXT\0" + "glTbufferMask3DFX\0" + "glCompressedTexImage3DARB\0" + "glCompressedTexImage2DARB\0" + "glCompressedTexImage1DARB\0" + "glCompressedTexSubImage3DARB\0" + "glCompressedTexSubImage2DARB\0" + "glCompressedTexSubImage1DARB\0" + "glGetCompressedTexImageARB\0" + "glSecondaryColor3bEXT\0" + "glSecondaryColor3bvEXT\0" + "glSecondaryColor3dEXT\0" + "glSecondaryColor3dvEXT\0" + "glSecondaryColor3fEXT\0" + "glSecondaryColor3fvEXT\0" + "glSecondaryColor3iEXT\0" + "glSecondaryColor3ivEXT\0" + "glSecondaryColor3sEXT\0" + "glSecondaryColor3svEXT\0" + "glSecondaryColor3ubEXT\0" + "glSecondaryColor3ubvEXT\0" + "glSecondaryColor3uiEXT\0" + "glSecondaryColor3uivEXT\0" + "glSecondaryColor3usEXT\0" + "glSecondaryColor3usvEXT\0" + "glSecondaryColorPointerEXT\0" + "glAreProgramsResidentNV\0" + "glBindProgramNV\0" + "glDeleteProgramsNV\0" + "glExecuteProgramNV\0" + "glGenProgramsNV\0" + "glGetProgramParameterdvNV\0" + "glGetProgramParameterfvNV\0" + "glGetProgramivNV\0" + "glGetProgramStringNV\0" + "glGetTrackMatrixivNV\0" + "glGetVertexAttribdvARB\0" + "glGetVertexAttribfvARB\0" + "glGetVertexAttribivARB\0" + "glGetVertexAttribPointervNV\0" + "glIsProgramNV\0" + "glLoadProgramNV\0" + "glProgramParameter4dNV\0" + "glProgramParameter4dvNV\0" + "glProgramParameter4fNV\0" + "glProgramParameter4fvNV\0" + "glProgramParameters4dvNV\0" + "glProgramParameters4fvNV\0" + "glRequestResidentProgramsNV\0" + "glTrackMatrixNV\0" + "glVertexAttribPointerNV\0" + "glVertexAttrib1dARB\0" + "glVertexAttrib1dvARB\0" + "glVertexAttrib1fARB\0" + "glVertexAttrib1fvARB\0" + "glVertexAttrib1sARB\0" + "glVertexAttrib1svARB\0" + "glVertexAttrib2dARB\0" + "glVertexAttrib2dvARB\0" + "glVertexAttrib2fARB\0" + "glVertexAttrib2fvARB\0" + "glVertexAttrib2sARB\0" + "glVertexAttrib2svARB\0" + "glVertexAttrib3dARB\0" + "glVertexAttrib3dvARB\0" + "glVertexAttrib3fARB\0" + "glVertexAttrib3fvARB\0" + "glVertexAttrib3sARB\0" + "glVertexAttrib3svARB\0" + "glVertexAttrib4dARB\0" + "glVertexAttrib4dvARB\0" + "glVertexAttrib4fARB\0" + "glVertexAttrib4fvARB\0" + "glVertexAttrib4sARB\0" + "glVertexAttrib4svARB\0" + "glVertexAttrib4NubARB\0" + "glVertexAttrib4NubvARB\0" + "glVertexAttribs1dvNV\0" + "glVertexAttribs1fvNV\0" + "glVertexAttribs1svNV\0" + "glVertexAttribs2dvNV\0" + "glVertexAttribs2fvNV\0" + "glVertexAttribs2svNV\0" + "glVertexAttribs3dvNV\0" + "glVertexAttribs3fvNV\0" + "glVertexAttribs3svNV\0" + "glVertexAttribs4dvNV\0" + "glVertexAttribs4fvNV\0" + "glVertexAttribs4svNV\0" + "glVertexAttribs4ubvNV\0" + "glPointParameteriNV\0" + "glPointParameterivNV\0" + "glMultiDrawArraysEXT\0" + "glMultiDrawElementsEXT\0" + "glActiveStencilFaceEXT\0" + "glDeleteFencesNV\0" + "glGenFencesNV\0" + "glIsFenceNV\0" + "glTestFenceNV\0" + "glGetFenceivNV\0" + "glFinishFenceNV\0" + "glSetFenceNV\0" + "glVertexAttrib4bvARB\0" + "glVertexAttrib4ivARB\0" + "glVertexAttrib4ubvARB\0" + "glVertexAttrib4usvARB\0" + "glVertexAttrib4uivARB\0" + "glVertexAttrib4NbvARB\0" + "glVertexAttrib4NsvARB\0" + "glVertexAttrib4NivARB\0" + "glVertexAttrib4NusvARB\0" + "glVertexAttrib4NuivARB\0" + "glVertexAttribPointerARB\0" + "glEnableVertexAttribArrayARB\0" + "glDisableVertexAttribArrayARB\0" + "glProgramStringARB\0" + "glProgramEnvParameter4dARB\0" + "glProgramEnvParameter4dvARB\0" + "glProgramEnvParameter4fARB\0" + "glProgramEnvParameter4fvARB\0" + "glProgramLocalParameter4dARB\0" + "glProgramLocalParameter4dvARB\0" + "glProgramLocalParameter4fARB\0" + "glProgramLocalParameter4fvARB\0" + "glGetProgramEnvParameterdvARB\0" + "glGetProgramEnvParameterfvARB\0" + "glGetProgramLocalParameterdvARB\0" + "glGetProgramLocalParameterfvARB\0" + "glGetProgramivARB\0" + "glGetProgramStringARB\0" + "glProgramNamedParameter4fNV\0" + "glProgramNamedParameter4dNV\0" + "glProgramNamedParameter4fvNV\0" + "glProgramNamedParameter4dvNV\0" + "glGetProgramNamedParameterfvNV\0" + "glGetProgramNamedParameterdvNV\0" + "glBindBufferARB\0" + "glBufferDataARB\0" + "glBufferSubDataARB\0" + "glDeleteBuffersARB\0" + "glGenBuffersARB\0" + "glGetBufferParameterivARB\0" + "glGetBufferPointervARB\0" + "glGetBufferSubDataARB\0" + "glIsBufferARB\0" + "glMapBufferARB\0" + "glUnmapBufferARB\0" + "glDepthBoundsEXT\0" + "glGenQueriesARB\0" + "glDeleteQueriesARB\0" + "glIsQueryARB\0" + "glBeginQueryARB\0" + "glEndQueryARB\0" + "glGetQueryivARB\0" + "glGetQueryObjectivARB\0" + "glGetQueryObjectuivARB\0" + "glMultiModeDrawArraysIBM\0" + "glMultiModeDrawElementsIBM\0" + "glBlendEquationSeparateEXT\0" + "glDeleteObjectARB\0" + "glGetHandleARB\0" + "glDetachObjectARB\0" + "glCreateShaderObjectARB\0" + "glShaderSourceARB\0" + "glCompileShaderARB\0" + "glCreateProgramObjectARB\0" + "glAttachObjectARB\0" + "glLinkProgramARB\0" + "glUseProgramObjectARB\0" + "glValidateProgramARB\0" + "glUniform1fARB\0" + "glUniform2fARB\0" + "glUniform3fARB\0" + "glUniform4fARB\0" + "glUniform1iARB\0" + "glUniform2iARB\0" + "glUniform3iARB\0" + "glUniform4iARB\0" + "glUniform1fvARB\0" + "glUniform2fvARB\0" + "glUniform3fvARB\0" + "glUniform4fvARB\0" + "glUniform1ivARB\0" + "glUniform2ivARB\0" + "glUniform3ivARB\0" + "glUniform4ivARB\0" + "glUniformMatrix2fvARB\0" + "glUniformMatrix3fvARB\0" + "glUniformMatrix4fvARB\0" + "glGetObjectParameterfvARB\0" + "glGetObjectParameterivARB\0" + "glGetInfoLogARB\0" + "glGetAttachedObjectsARB\0" + "glGetUniformLocationARB\0" + "glGetActiveUniformARB\0" + "glGetUniformfvARB\0" + "glGetUniformivARB\0" + "glGetShaderSourceARB\0" + "glBindAttribLocationARB\0" + "glGetActiveAttribARB\0" + "glGetAttribLocationARB\0" + "glGetVertexAttribdvNV\0" + "glGetVertexAttribfvNV\0" + "glGetVertexAttribivNV\0" + "glVertexAttrib1dNV\0" + "glVertexAttrib1dvNV\0" + "glVertexAttrib1fNV\0" + "glVertexAttrib1fvNV\0" + "glVertexAttrib1sNV\0" + "glVertexAttrib1svNV\0" + "glVertexAttrib2dNV\0" + "glVertexAttrib2dvNV\0" + "glVertexAttrib2fNV\0" + "glVertexAttrib2fvNV\0" + "glVertexAttrib2sNV\0" + "glVertexAttrib2svNV\0" + "glVertexAttrib3dNV\0" + "glVertexAttrib3dvNV\0" + "glVertexAttrib3fNV\0" + "glVertexAttrib3fvNV\0" + "glVertexAttrib3sNV\0" + "glVertexAttrib3svNV\0" + "glVertexAttrib4dNV\0" + "glVertexAttrib4dvNV\0" + "glVertexAttrib4fNV\0" + "glVertexAttrib4fvNV\0" + "glVertexAttrib4sNV\0" + "glVertexAttrib4svNV\0" + "glVertexAttrib4ubNV\0" + "glVertexAttrib4ubvNV\0" + "glGenFragmentShadersATI\0" + "glBindFragmentShaderATI\0" + "glDeleteFragmentShaderATI\0" + "glBeginFragmentShaderATI\0" + "glEndFragmentShaderATI\0" + "glPassTexCoordATI\0" + "glSampleMapATI\0" + "glColorFragmentOp1ATI\0" + "glColorFragmentOp2ATI\0" + "glColorFragmentOp3ATI\0" + "glAlphaFragmentOp1ATI\0" + "glAlphaFragmentOp2ATI\0" + "glAlphaFragmentOp3ATI\0" + "glSetFragmentShaderConstantATI\0" + "glIsRenderbufferEXT\0" + "glBindRenderbufferEXT\0" + "glDeleteRenderbuffersEXT\0" + "glGenRenderbuffersEXT\0" + "glRenderbufferStorageEXT\0" + "glGetRenderbufferParameterivEXT\0" + "glIsFramebufferEXT\0" + "glBindFramebufferEXT\0" + "glDeleteFramebuffersEXT\0" + "glGenFramebuffersEXT\0" + "glCheckFramebufferStatusEXT\0" + "glFramebufferTexture1DEXT\0" + "glFramebufferTexture2DEXT\0" + "glFramebufferTexture3DEXT\0" + "glFramebufferRenderbufferEXT\0" + "glGetFramebufferAttachmentParameterivEXT\0" + "glGenerateMipmapEXT\0" + "glStencilFuncSeparate\0" + "glStencilOpSeparate\0" + "glStencilMaskSeparate\0" + "glArrayElementEXT\0" + "glBindTextureEXT\0" + "glDrawArraysEXT\0" + "glCopyTexImage1DEXT\0" + "glCopyTexImage2DEXT\0" + "glCopyTexSubImage1DEXT\0" + "glCopyTexSubImage2DEXT\0" + "glDeleteTexturesEXT\0" + "glGetPointervEXT\0" + "glPrioritizeTexturesEXT\0" + "glTexSubImage1DEXT\0" + "glTexSubImage2DEXT\0" + "glBlendColorEXT\0" + "glBlendEquationEXT\0" + "glDrawRangeElementsEXT\0" + "glColorTableSGI\0" + "glColorTableEXT\0" + "glColorTableParameterfvSGI\0" + "glColorTableParameterivSGI\0" + "glCopyColorTableSGI\0" + "glColorSubTableEXT\0" + "glCopyColorSubTableEXT\0" + "glConvolutionFilter1DEXT\0" + "glConvolutionFilter2DEXT\0" + "glConvolutionParameterfEXT\0" + "glConvolutionParameterfvEXT\0" + "glConvolutionParameteriEXT\0" + "glConvolutionParameterivEXT\0" + "glCopyConvolutionFilter1DEXT\0" + "glCopyConvolutionFilter2DEXT\0" + "glSeparableFilter2DEXT\0" + "glHistogramEXT\0" + "glMinmaxEXT\0" + "glResetHistogramEXT\0" + "glResetMinmaxEXT\0" + "glTexImage3DEXT\0" + "glTexSubImage3DEXT\0" + "glCopyTexSubImage3DEXT\0" + "glActiveTexture\0" + "glClientActiveTexture\0" + "glMultiTexCoord1d\0" + "glMultiTexCoord1dv\0" + "glMultiTexCoord1f\0" + "glMultiTexCoord1fv\0" + "glMultiTexCoord1i\0" + "glMultiTexCoord1iv\0" + "glMultiTexCoord1s\0" + "glMultiTexCoord1sv\0" + "glMultiTexCoord2d\0" + "glMultiTexCoord2dv\0" + "glMultiTexCoord2f\0" + "glMultiTexCoord2fv\0" + "glMultiTexCoord2i\0" + "glMultiTexCoord2iv\0" + "glMultiTexCoord2s\0" + "glMultiTexCoord2sv\0" + "glMultiTexCoord3d\0" + "glMultiTexCoord3dv\0" + "glMultiTexCoord3f\0" + "glMultiTexCoord3fv\0" + "glMultiTexCoord3i\0" + "glMultiTexCoord3iv\0" + "glMultiTexCoord3s\0" + "glMultiTexCoord3sv\0" + "glMultiTexCoord4d\0" + "glMultiTexCoord4dv\0" + "glMultiTexCoord4f\0" + "glMultiTexCoord4fv\0" + "glMultiTexCoord4i\0" + "glMultiTexCoord4iv\0" + "glMultiTexCoord4s\0" + "glMultiTexCoord4sv\0" + "glLoadTransposeMatrixf\0" + "glLoadTransposeMatrixd\0" + "glMultTransposeMatrixf\0" + "glMultTransposeMatrixd\0" + "glSampleCoverage\0" + "glDrawBuffersATI\0" + "glSampleMaskEXT\0" + "glSamplePatternEXT\0" + "glPointParameterf\0" + "glPointParameterfARB\0" + "glPointParameterfSGIS\0" + "glPointParameterfv\0" + "glPointParameterfvARB\0" + "glPointParameterfvSGIS\0" + "glWindowPos2d\0" + "glWindowPos2dARB\0" + "glWindowPos2dv\0" + "glWindowPos2dvARB\0" + "glWindowPos2f\0" + "glWindowPos2fARB\0" + "glWindowPos2fv\0" + "glWindowPos2fvARB\0" + "glWindowPos2i\0" + "glWindowPos2iARB\0" + "glWindowPos2iv\0" + "glWindowPos2ivARB\0" + "glWindowPos2s\0" + "glWindowPos2sARB\0" + "glWindowPos2sv\0" + "glWindowPos2svARB\0" + "glWindowPos3d\0" + "glWindowPos3dARB\0" + "glWindowPos3dv\0" + "glWindowPos3dvARB\0" + "glWindowPos3f\0" + "glWindowPos3fARB\0" + "glWindowPos3fv\0" + "glWindowPos3fvARB\0" + "glWindowPos3i\0" + "glWindowPos3iARB\0" + "glWindowPos3iv\0" + "glWindowPos3ivARB\0" + "glWindowPos3s\0" + "glWindowPos3sARB\0" + "glWindowPos3sv\0" + "glWindowPos3svARB\0" + "glBlendFuncSeparate\0" + "glBlendFuncSeparateINGR\0" + "glFogCoordf\0" + "glFogCoordfv\0" + "glFogCoordd\0" + "glFogCoorddv\0" + "glFogCoordPointer\0" + "glCompressedTexImage3D\0" + "glCompressedTexImage2D\0" + "glCompressedTexImage1D\0" + "glCompressedTexSubImage3D\0" + "glCompressedTexSubImage2D\0" + "glCompressedTexSubImage1D\0" + "glGetCompressedTexImage\0" + "glSecondaryColor3b\0" + "glSecondaryColor3bv\0" + "glSecondaryColor3d\0" + "glSecondaryColor3dv\0" + "glSecondaryColor3f\0" + "glSecondaryColor3fv\0" + "glSecondaryColor3i\0" + "glSecondaryColor3iv\0" + "glSecondaryColor3s\0" + "glSecondaryColor3sv\0" + "glSecondaryColor3ub\0" + "glSecondaryColor3ubv\0" + "glSecondaryColor3ui\0" + "glSecondaryColor3uiv\0" + "glSecondaryColor3us\0" + "glSecondaryColor3usv\0" + "glSecondaryColorPointer\0" + "glBindProgramARB\0" + "glDeleteProgramsARB\0" + "glGenProgramsARB\0" + "glGetVertexAttribPointervARB\0" + "glIsProgramARB\0" + "glPointParameteri\0" + "glPointParameteriv\0" + "glMultiDrawArrays\0" + "glMultiDrawElements\0" + "glBindBuffer\0" + "glBufferData\0" + "glBufferSubData\0" + "glDeleteBuffers\0" + "glGenBuffers\0" + "glGetBufferParameteriv\0" + "glGetBufferPointerv\0" + "glGetBufferSubData\0" + "glIsBuffer\0" + "glMapBuffer\0" + "glUnmapBuffer\0" + "glGenQueries\0" + "glDeleteQueries\0" + "glIsQuery\0" + "glBeginQuery\0" + "glEndQuery\0" + "glGetQueryiv\0" + "glGetQueryObjectiv\0" + "glGetQueryObjectuiv\0" + "glBlendEquationSeparateATI\0" + ; + +static const glprocs_table_t static_functions[] = { + NAME_FUNC_OFFSET( 0, glNewList, _gloffset_NewList ), + NAME_FUNC_OFFSET( 10, glEndList, _gloffset_EndList ), + NAME_FUNC_OFFSET( 20, glCallList, _gloffset_CallList ), + NAME_FUNC_OFFSET( 31, glCallLists, _gloffset_CallLists ), + NAME_FUNC_OFFSET( 43, glDeleteLists, _gloffset_DeleteLists ), + NAME_FUNC_OFFSET( 57, glGenLists, _gloffset_GenLists ), + NAME_FUNC_OFFSET( 68, glListBase, _gloffset_ListBase ), + NAME_FUNC_OFFSET( 79, glBegin, _gloffset_Begin ), + NAME_FUNC_OFFSET( 87, glBitmap, _gloffset_Bitmap ), + NAME_FUNC_OFFSET( 96, glColor3b, _gloffset_Color3b ), + NAME_FUNC_OFFSET( 106, glColor3bv, _gloffset_Color3bv ), + NAME_FUNC_OFFSET( 117, glColor3d, _gloffset_Color3d ), + NAME_FUNC_OFFSET( 127, glColor3dv, _gloffset_Color3dv ), + NAME_FUNC_OFFSET( 138, glColor3f, _gloffset_Color3f ), + NAME_FUNC_OFFSET( 148, glColor3fv, _gloffset_Color3fv ), + NAME_FUNC_OFFSET( 159, glColor3i, _gloffset_Color3i ), + NAME_FUNC_OFFSET( 169, glColor3iv, _gloffset_Color3iv ), + NAME_FUNC_OFFSET( 180, glColor3s, _gloffset_Color3s ), + NAME_FUNC_OFFSET( 190, glColor3sv, _gloffset_Color3sv ), + NAME_FUNC_OFFSET( 201, glColor3ub, _gloffset_Color3ub ), + NAME_FUNC_OFFSET( 212, glColor3ubv, _gloffset_Color3ubv ), + NAME_FUNC_OFFSET( 224, glColor3ui, _gloffset_Color3ui ), + NAME_FUNC_OFFSET( 235, glColor3uiv, _gloffset_Color3uiv ), + NAME_FUNC_OFFSET( 247, glColor3us, _gloffset_Color3us ), + NAME_FUNC_OFFSET( 258, glColor3usv, _gloffset_Color3usv ), + NAME_FUNC_OFFSET( 270, glColor4b, _gloffset_Color4b ), + NAME_FUNC_OFFSET( 280, glColor4bv, _gloffset_Color4bv ), + NAME_FUNC_OFFSET( 291, glColor4d, _gloffset_Color4d ), + NAME_FUNC_OFFSET( 301, glColor4dv, _gloffset_Color4dv ), + NAME_FUNC_OFFSET( 312, glColor4f, _gloffset_Color4f ), + NAME_FUNC_OFFSET( 322, glColor4fv, _gloffset_Color4fv ), + NAME_FUNC_OFFSET( 333, glColor4i, _gloffset_Color4i ), + NAME_FUNC_OFFSET( 343, glColor4iv, _gloffset_Color4iv ), + NAME_FUNC_OFFSET( 354, glColor4s, _gloffset_Color4s ), + NAME_FUNC_OFFSET( 364, glColor4sv, _gloffset_Color4sv ), + NAME_FUNC_OFFSET( 375, glColor4ub, _gloffset_Color4ub ), + NAME_FUNC_OFFSET( 386, glColor4ubv, _gloffset_Color4ubv ), + NAME_FUNC_OFFSET( 398, glColor4ui, _gloffset_Color4ui ), + NAME_FUNC_OFFSET( 409, glColor4uiv, _gloffset_Color4uiv ), + NAME_FUNC_OFFSET( 421, glColor4us, _gloffset_Color4us ), + NAME_FUNC_OFFSET( 432, glColor4usv, _gloffset_Color4usv ), + NAME_FUNC_OFFSET( 444, glEdgeFlag, _gloffset_EdgeFlag ), + NAME_FUNC_OFFSET( 455, glEdgeFlagv, _gloffset_EdgeFlagv ), + NAME_FUNC_OFFSET( 467, glEnd, _gloffset_End ), + NAME_FUNC_OFFSET( 473, glIndexd, _gloffset_Indexd ), + NAME_FUNC_OFFSET( 482, glIndexdv, _gloffset_Indexdv ), + NAME_FUNC_OFFSET( 492, glIndexf, _gloffset_Indexf ), + NAME_FUNC_OFFSET( 501, glIndexfv, _gloffset_Indexfv ), + NAME_FUNC_OFFSET( 511, glIndexi, _gloffset_Indexi ), + NAME_FUNC_OFFSET( 520, glIndexiv, _gloffset_Indexiv ), + NAME_FUNC_OFFSET( 530, glIndexs, _gloffset_Indexs ), + NAME_FUNC_OFFSET( 539, glIndexsv, _gloffset_Indexsv ), + NAME_FUNC_OFFSET( 549, glNormal3b, _gloffset_Normal3b ), + NAME_FUNC_OFFSET( 560, glNormal3bv, _gloffset_Normal3bv ), + NAME_FUNC_OFFSET( 572, glNormal3d, _gloffset_Normal3d ), + NAME_FUNC_OFFSET( 583, glNormal3dv, _gloffset_Normal3dv ), + NAME_FUNC_OFFSET( 595, glNormal3f, _gloffset_Normal3f ), + NAME_FUNC_OFFSET( 606, glNormal3fv, _gloffset_Normal3fv ), + NAME_FUNC_OFFSET( 618, glNormal3i, _gloffset_Normal3i ), + NAME_FUNC_OFFSET( 629, glNormal3iv, _gloffset_Normal3iv ), + NAME_FUNC_OFFSET( 641, glNormal3s, _gloffset_Normal3s ), + NAME_FUNC_OFFSET( 652, glNormal3sv, _gloffset_Normal3sv ), + NAME_FUNC_OFFSET( 664, glRasterPos2d, _gloffset_RasterPos2d ), + NAME_FUNC_OFFSET( 678, glRasterPos2dv, _gloffset_RasterPos2dv ), + NAME_FUNC_OFFSET( 693, glRasterPos2f, _gloffset_RasterPos2f ), + NAME_FUNC_OFFSET( 707, glRasterPos2fv, _gloffset_RasterPos2fv ), + NAME_FUNC_OFFSET( 722, glRasterPos2i, _gloffset_RasterPos2i ), + NAME_FUNC_OFFSET( 736, glRasterPos2iv, _gloffset_RasterPos2iv ), + NAME_FUNC_OFFSET( 751, glRasterPos2s, _gloffset_RasterPos2s ), + NAME_FUNC_OFFSET( 765, glRasterPos2sv, _gloffset_RasterPos2sv ), + NAME_FUNC_OFFSET( 780, glRasterPos3d, _gloffset_RasterPos3d ), + NAME_FUNC_OFFSET( 794, glRasterPos3dv, _gloffset_RasterPos3dv ), + NAME_FUNC_OFFSET( 809, glRasterPos3f, _gloffset_RasterPos3f ), + NAME_FUNC_OFFSET( 823, glRasterPos3fv, _gloffset_RasterPos3fv ), + NAME_FUNC_OFFSET( 838, glRasterPos3i, _gloffset_RasterPos3i ), + NAME_FUNC_OFFSET( 852, glRasterPos3iv, _gloffset_RasterPos3iv ), + NAME_FUNC_OFFSET( 867, glRasterPos3s, _gloffset_RasterPos3s ), + NAME_FUNC_OFFSET( 881, glRasterPos3sv, _gloffset_RasterPos3sv ), + NAME_FUNC_OFFSET( 896, glRasterPos4d, _gloffset_RasterPos4d ), + NAME_FUNC_OFFSET( 910, glRasterPos4dv, _gloffset_RasterPos4dv ), + NAME_FUNC_OFFSET( 925, glRasterPos4f, _gloffset_RasterPos4f ), + NAME_FUNC_OFFSET( 939, glRasterPos4fv, _gloffset_RasterPos4fv ), + NAME_FUNC_OFFSET( 954, glRasterPos4i, _gloffset_RasterPos4i ), + NAME_FUNC_OFFSET( 968, glRasterPos4iv, _gloffset_RasterPos4iv ), + NAME_FUNC_OFFSET( 983, glRasterPos4s, _gloffset_RasterPos4s ), + NAME_FUNC_OFFSET( 997, glRasterPos4sv, _gloffset_RasterPos4sv ), + NAME_FUNC_OFFSET( 1012, glRectd, _gloffset_Rectd ), + NAME_FUNC_OFFSET( 1020, glRectdv, _gloffset_Rectdv ), + NAME_FUNC_OFFSET( 1029, glRectf, _gloffset_Rectf ), + NAME_FUNC_OFFSET( 1037, glRectfv, _gloffset_Rectfv ), + NAME_FUNC_OFFSET( 1046, glRecti, _gloffset_Recti ), + NAME_FUNC_OFFSET( 1054, glRectiv, _gloffset_Rectiv ), + NAME_FUNC_OFFSET( 1063, glRects, _gloffset_Rects ), + NAME_FUNC_OFFSET( 1071, glRectsv, _gloffset_Rectsv ), + NAME_FUNC_OFFSET( 1080, glTexCoord1d, _gloffset_TexCoord1d ), + NAME_FUNC_OFFSET( 1093, glTexCoord1dv, _gloffset_TexCoord1dv ), + NAME_FUNC_OFFSET( 1107, glTexCoord1f, _gloffset_TexCoord1f ), + NAME_FUNC_OFFSET( 1120, glTexCoord1fv, _gloffset_TexCoord1fv ), + NAME_FUNC_OFFSET( 1134, glTexCoord1i, _gloffset_TexCoord1i ), + NAME_FUNC_OFFSET( 1147, glTexCoord1iv, _gloffset_TexCoord1iv ), + NAME_FUNC_OFFSET( 1161, glTexCoord1s, _gloffset_TexCoord1s ), + NAME_FUNC_OFFSET( 1174, glTexCoord1sv, _gloffset_TexCoord1sv ), + NAME_FUNC_OFFSET( 1188, glTexCoord2d, _gloffset_TexCoord2d ), + NAME_FUNC_OFFSET( 1201, glTexCoord2dv, _gloffset_TexCoord2dv ), + NAME_FUNC_OFFSET( 1215, glTexCoord2f, _gloffset_TexCoord2f ), + NAME_FUNC_OFFSET( 1228, glTexCoord2fv, _gloffset_TexCoord2fv ), + NAME_FUNC_OFFSET( 1242, glTexCoord2i, _gloffset_TexCoord2i ), + NAME_FUNC_OFFSET( 1255, glTexCoord2iv, _gloffset_TexCoord2iv ), + NAME_FUNC_OFFSET( 1269, glTexCoord2s, _gloffset_TexCoord2s ), + NAME_FUNC_OFFSET( 1282, glTexCoord2sv, _gloffset_TexCoord2sv ), + NAME_FUNC_OFFSET( 1296, glTexCoord3d, _gloffset_TexCoord3d ), + NAME_FUNC_OFFSET( 1309, glTexCoord3dv, _gloffset_TexCoord3dv ), + NAME_FUNC_OFFSET( 1323, glTexCoord3f, _gloffset_TexCoord3f ), + NAME_FUNC_OFFSET( 1336, glTexCoord3fv, _gloffset_TexCoord3fv ), + NAME_FUNC_OFFSET( 1350, glTexCoord3i, _gloffset_TexCoord3i ), + NAME_FUNC_OFFSET( 1363, glTexCoord3iv, _gloffset_TexCoord3iv ), + NAME_FUNC_OFFSET( 1377, glTexCoord3s, _gloffset_TexCoord3s ), + NAME_FUNC_OFFSET( 1390, glTexCoord3sv, _gloffset_TexCoord3sv ), + NAME_FUNC_OFFSET( 1404, glTexCoord4d, _gloffset_TexCoord4d ), + NAME_FUNC_OFFSET( 1417, glTexCoord4dv, _gloffset_TexCoord4dv ), + NAME_FUNC_OFFSET( 1431, glTexCoord4f, _gloffset_TexCoord4f ), + NAME_FUNC_OFFSET( 1444, glTexCoord4fv, _gloffset_TexCoord4fv ), + NAME_FUNC_OFFSET( 1458, glTexCoord4i, _gloffset_TexCoord4i ), + NAME_FUNC_OFFSET( 1471, glTexCoord4iv, _gloffset_TexCoord4iv ), + NAME_FUNC_OFFSET( 1485, glTexCoord4s, _gloffset_TexCoord4s ), + NAME_FUNC_OFFSET( 1498, glTexCoord4sv, _gloffset_TexCoord4sv ), + NAME_FUNC_OFFSET( 1512, glVertex2d, _gloffset_Vertex2d ), + NAME_FUNC_OFFSET( 1523, glVertex2dv, _gloffset_Vertex2dv ), + NAME_FUNC_OFFSET( 1535, glVertex2f, _gloffset_Vertex2f ), + NAME_FUNC_OFFSET( 1546, glVertex2fv, _gloffset_Vertex2fv ), + NAME_FUNC_OFFSET( 1558, glVertex2i, _gloffset_Vertex2i ), + NAME_FUNC_OFFSET( 1569, glVertex2iv, _gloffset_Vertex2iv ), + NAME_FUNC_OFFSET( 1581, glVertex2s, _gloffset_Vertex2s ), + NAME_FUNC_OFFSET( 1592, glVertex2sv, _gloffset_Vertex2sv ), + NAME_FUNC_OFFSET( 1604, glVertex3d, _gloffset_Vertex3d ), + NAME_FUNC_OFFSET( 1615, glVertex3dv, _gloffset_Vertex3dv ), + NAME_FUNC_OFFSET( 1627, glVertex3f, _gloffset_Vertex3f ), + NAME_FUNC_OFFSET( 1638, glVertex3fv, _gloffset_Vertex3fv ), + NAME_FUNC_OFFSET( 1650, glVertex3i, _gloffset_Vertex3i ), + NAME_FUNC_OFFSET( 1661, glVertex3iv, _gloffset_Vertex3iv ), + NAME_FUNC_OFFSET( 1673, glVertex3s, _gloffset_Vertex3s ), + NAME_FUNC_OFFSET( 1684, glVertex3sv, _gloffset_Vertex3sv ), + NAME_FUNC_OFFSET( 1696, glVertex4d, _gloffset_Vertex4d ), + NAME_FUNC_OFFSET( 1707, glVertex4dv, _gloffset_Vertex4dv ), + NAME_FUNC_OFFSET( 1719, glVertex4f, _gloffset_Vertex4f ), + NAME_FUNC_OFFSET( 1730, glVertex4fv, _gloffset_Vertex4fv ), + NAME_FUNC_OFFSET( 1742, glVertex4i, _gloffset_Vertex4i ), + NAME_FUNC_OFFSET( 1753, glVertex4iv, _gloffset_Vertex4iv ), + NAME_FUNC_OFFSET( 1765, glVertex4s, _gloffset_Vertex4s ), + NAME_FUNC_OFFSET( 1776, glVertex4sv, _gloffset_Vertex4sv ), + NAME_FUNC_OFFSET( 1788, glClipPlane, _gloffset_ClipPlane ), + NAME_FUNC_OFFSET( 1800, glColorMaterial, _gloffset_ColorMaterial ), + NAME_FUNC_OFFSET( 1816, glCullFace, _gloffset_CullFace ), + NAME_FUNC_OFFSET( 1827, glFogf, _gloffset_Fogf ), + NAME_FUNC_OFFSET( 1834, glFogfv, _gloffset_Fogfv ), + NAME_FUNC_OFFSET( 1842, glFogi, _gloffset_Fogi ), + NAME_FUNC_OFFSET( 1849, glFogiv, _gloffset_Fogiv ), + NAME_FUNC_OFFSET( 1857, glFrontFace, _gloffset_FrontFace ), + NAME_FUNC_OFFSET( 1869, glHint, _gloffset_Hint ), + NAME_FUNC_OFFSET( 1876, glLightf, _gloffset_Lightf ), + NAME_FUNC_OFFSET( 1885, glLightfv, _gloffset_Lightfv ), + NAME_FUNC_OFFSET( 1895, glLighti, _gloffset_Lighti ), + NAME_FUNC_OFFSET( 1904, glLightiv, _gloffset_Lightiv ), + NAME_FUNC_OFFSET( 1914, glLightModelf, _gloffset_LightModelf ), + NAME_FUNC_OFFSET( 1928, glLightModelfv, _gloffset_LightModelfv ), + NAME_FUNC_OFFSET( 1943, glLightModeli, _gloffset_LightModeli ), + NAME_FUNC_OFFSET( 1957, glLightModeliv, _gloffset_LightModeliv ), + NAME_FUNC_OFFSET( 1972, glLineStipple, _gloffset_LineStipple ), + NAME_FUNC_OFFSET( 1986, glLineWidth, _gloffset_LineWidth ), + NAME_FUNC_OFFSET( 1998, glMaterialf, _gloffset_Materialf ), + NAME_FUNC_OFFSET( 2010, glMaterialfv, _gloffset_Materialfv ), + NAME_FUNC_OFFSET( 2023, glMateriali, _gloffset_Materiali ), + NAME_FUNC_OFFSET( 2035, glMaterialiv, _gloffset_Materialiv ), + NAME_FUNC_OFFSET( 2048, glPointSize, _gloffset_PointSize ), + NAME_FUNC_OFFSET( 2060, glPolygonMode, _gloffset_PolygonMode ), + NAME_FUNC_OFFSET( 2074, glPolygonStipple, _gloffset_PolygonStipple ), + NAME_FUNC_OFFSET( 2091, glScissor, _gloffset_Scissor ), + NAME_FUNC_OFFSET( 2101, glShadeModel, _gloffset_ShadeModel ), + NAME_FUNC_OFFSET( 2114, glTexParameterf, _gloffset_TexParameterf ), + NAME_FUNC_OFFSET( 2130, glTexParameterfv, _gloffset_TexParameterfv ), + NAME_FUNC_OFFSET( 2147, glTexParameteri, _gloffset_TexParameteri ), + NAME_FUNC_OFFSET( 2163, glTexParameteriv, _gloffset_TexParameteriv ), + NAME_FUNC_OFFSET( 2180, glTexImage1D, _gloffset_TexImage1D ), + NAME_FUNC_OFFSET( 2193, glTexImage2D, _gloffset_TexImage2D ), + NAME_FUNC_OFFSET( 2206, glTexEnvf, _gloffset_TexEnvf ), + NAME_FUNC_OFFSET( 2216, glTexEnvfv, _gloffset_TexEnvfv ), + NAME_FUNC_OFFSET( 2227, glTexEnvi, _gloffset_TexEnvi ), + NAME_FUNC_OFFSET( 2237, glTexEnviv, _gloffset_TexEnviv ), + NAME_FUNC_OFFSET( 2248, glTexGend, _gloffset_TexGend ), + NAME_FUNC_OFFSET( 2258, glTexGendv, _gloffset_TexGendv ), + NAME_FUNC_OFFSET( 2269, glTexGenf, _gloffset_TexGenf ), + NAME_FUNC_OFFSET( 2279, glTexGenfv, _gloffset_TexGenfv ), + NAME_FUNC_OFFSET( 2290, glTexGeni, _gloffset_TexGeni ), + NAME_FUNC_OFFSET( 2300, glTexGeniv, _gloffset_TexGeniv ), + NAME_FUNC_OFFSET( 2311, glFeedbackBuffer, _gloffset_FeedbackBuffer ), + NAME_FUNC_OFFSET( 2328, glSelectBuffer, _gloffset_SelectBuffer ), + NAME_FUNC_OFFSET( 2343, glRenderMode, _gloffset_RenderMode ), + NAME_FUNC_OFFSET( 2356, glInitNames, _gloffset_InitNames ), + NAME_FUNC_OFFSET( 2368, glLoadName, _gloffset_LoadName ), + NAME_FUNC_OFFSET( 2379, glPassThrough, _gloffset_PassThrough ), + NAME_FUNC_OFFSET( 2393, glPopName, _gloffset_PopName ), + NAME_FUNC_OFFSET( 2403, glPushName, _gloffset_PushName ), + NAME_FUNC_OFFSET( 2414, glDrawBuffer, _gloffset_DrawBuffer ), + NAME_FUNC_OFFSET( 2427, glClear, _gloffset_Clear ), + NAME_FUNC_OFFSET( 2435, glClearAccum, _gloffset_ClearAccum ), + NAME_FUNC_OFFSET( 2448, glClearIndex, _gloffset_ClearIndex ), + NAME_FUNC_OFFSET( 2461, glClearColor, _gloffset_ClearColor ), + NAME_FUNC_OFFSET( 2474, glClearStencil, _gloffset_ClearStencil ), + NAME_FUNC_OFFSET( 2489, glClearDepth, _gloffset_ClearDepth ), + NAME_FUNC_OFFSET( 2502, glStencilMask, _gloffset_StencilMask ), + NAME_FUNC_OFFSET( 2516, glColorMask, _gloffset_ColorMask ), + NAME_FUNC_OFFSET( 2528, glDepthMask, _gloffset_DepthMask ), + NAME_FUNC_OFFSET( 2540, glIndexMask, _gloffset_IndexMask ), + NAME_FUNC_OFFSET( 2552, glAccum, _gloffset_Accum ), + NAME_FUNC_OFFSET( 2560, glDisable, _gloffset_Disable ), + NAME_FUNC_OFFSET( 2570, glEnable, _gloffset_Enable ), + NAME_FUNC_OFFSET( 2579, glFinish, _gloffset_Finish ), + NAME_FUNC_OFFSET( 2588, glFlush, _gloffset_Flush ), + NAME_FUNC_OFFSET( 2596, glPopAttrib, _gloffset_PopAttrib ), + NAME_FUNC_OFFSET( 2608, glPushAttrib, _gloffset_PushAttrib ), + NAME_FUNC_OFFSET( 2621, glMap1d, _gloffset_Map1d ), + NAME_FUNC_OFFSET( 2629, glMap1f, _gloffset_Map1f ), + NAME_FUNC_OFFSET( 2637, glMap2d, _gloffset_Map2d ), + NAME_FUNC_OFFSET( 2645, glMap2f, _gloffset_Map2f ), + NAME_FUNC_OFFSET( 2653, glMapGrid1d, _gloffset_MapGrid1d ), + NAME_FUNC_OFFSET( 2665, glMapGrid1f, _gloffset_MapGrid1f ), + NAME_FUNC_OFFSET( 2677, glMapGrid2d, _gloffset_MapGrid2d ), + NAME_FUNC_OFFSET( 2689, glMapGrid2f, _gloffset_MapGrid2f ), + NAME_FUNC_OFFSET( 2701, glEvalCoord1d, _gloffset_EvalCoord1d ), + NAME_FUNC_OFFSET( 2715, glEvalCoord1dv, _gloffset_EvalCoord1dv ), + NAME_FUNC_OFFSET( 2730, glEvalCoord1f, _gloffset_EvalCoord1f ), + NAME_FUNC_OFFSET( 2744, glEvalCoord1fv, _gloffset_EvalCoord1fv ), + NAME_FUNC_OFFSET( 2759, glEvalCoord2d, _gloffset_EvalCoord2d ), + NAME_FUNC_OFFSET( 2773, glEvalCoord2dv, _gloffset_EvalCoord2dv ), + NAME_FUNC_OFFSET( 2788, glEvalCoord2f, _gloffset_EvalCoord2f ), + NAME_FUNC_OFFSET( 2802, glEvalCoord2fv, _gloffset_EvalCoord2fv ), + NAME_FUNC_OFFSET( 2817, glEvalMesh1, _gloffset_EvalMesh1 ), + NAME_FUNC_OFFSET( 2829, glEvalPoint1, _gloffset_EvalPoint1 ), + NAME_FUNC_OFFSET( 2842, glEvalMesh2, _gloffset_EvalMesh2 ), + NAME_FUNC_OFFSET( 2854, glEvalPoint2, _gloffset_EvalPoint2 ), + NAME_FUNC_OFFSET( 2867, glAlphaFunc, _gloffset_AlphaFunc ), + NAME_FUNC_OFFSET( 2879, glBlendFunc, _gloffset_BlendFunc ), + NAME_FUNC_OFFSET( 2891, glLogicOp, _gloffset_LogicOp ), + NAME_FUNC_OFFSET( 2901, glStencilFunc, _gloffset_StencilFunc ), + NAME_FUNC_OFFSET( 2915, glStencilOp, _gloffset_StencilOp ), + NAME_FUNC_OFFSET( 2927, glDepthFunc, _gloffset_DepthFunc ), + NAME_FUNC_OFFSET( 2939, glPixelZoom, _gloffset_PixelZoom ), + NAME_FUNC_OFFSET( 2951, glPixelTransferf, _gloffset_PixelTransferf ), + NAME_FUNC_OFFSET( 2968, glPixelTransferi, _gloffset_PixelTransferi ), + NAME_FUNC_OFFSET( 2985, glPixelStoref, _gloffset_PixelStoref ), + NAME_FUNC_OFFSET( 2999, glPixelStorei, _gloffset_PixelStorei ), + NAME_FUNC_OFFSET( 3013, glPixelMapfv, _gloffset_PixelMapfv ), + NAME_FUNC_OFFSET( 3026, glPixelMapuiv, _gloffset_PixelMapuiv ), + NAME_FUNC_OFFSET( 3040, glPixelMapusv, _gloffset_PixelMapusv ), + NAME_FUNC_OFFSET( 3054, glReadBuffer, _gloffset_ReadBuffer ), + NAME_FUNC_OFFSET( 3067, glCopyPixels, _gloffset_CopyPixels ), + NAME_FUNC_OFFSET( 3080, glReadPixels, _gloffset_ReadPixels ), + NAME_FUNC_OFFSET( 3093, glDrawPixels, _gloffset_DrawPixels ), + NAME_FUNC_OFFSET( 3106, glGetBooleanv, _gloffset_GetBooleanv ), + NAME_FUNC_OFFSET( 3120, glGetClipPlane, _gloffset_GetClipPlane ), + NAME_FUNC_OFFSET( 3135, glGetDoublev, _gloffset_GetDoublev ), + NAME_FUNC_OFFSET( 3148, glGetError, _gloffset_GetError ), + NAME_FUNC_OFFSET( 3159, glGetFloatv, _gloffset_GetFloatv ), + NAME_FUNC_OFFSET( 3171, glGetIntegerv, _gloffset_GetIntegerv ), + NAME_FUNC_OFFSET( 3185, glGetLightfv, _gloffset_GetLightfv ), + NAME_FUNC_OFFSET( 3198, glGetLightiv, _gloffset_GetLightiv ), + NAME_FUNC_OFFSET( 3211, glGetMapdv, _gloffset_GetMapdv ), + NAME_FUNC_OFFSET( 3222, glGetMapfv, _gloffset_GetMapfv ), + NAME_FUNC_OFFSET( 3233, glGetMapiv, _gloffset_GetMapiv ), + NAME_FUNC_OFFSET( 3244, glGetMaterialfv, _gloffset_GetMaterialfv ), + NAME_FUNC_OFFSET( 3260, glGetMaterialiv, _gloffset_GetMaterialiv ), + NAME_FUNC_OFFSET( 3276, glGetPixelMapfv, _gloffset_GetPixelMapfv ), + NAME_FUNC_OFFSET( 3292, glGetPixelMapuiv, _gloffset_GetPixelMapuiv ), + NAME_FUNC_OFFSET( 3309, glGetPixelMapusv, _gloffset_GetPixelMapusv ), + NAME_FUNC_OFFSET( 3326, glGetPolygonStipple, _gloffset_GetPolygonStipple ), + NAME_FUNC_OFFSET( 3346, glGetString, _gloffset_GetString ), + NAME_FUNC_OFFSET( 3358, glGetTexEnvfv, _gloffset_GetTexEnvfv ), + NAME_FUNC_OFFSET( 3372, glGetTexEnviv, _gloffset_GetTexEnviv ), + NAME_FUNC_OFFSET( 3386, glGetTexGendv, _gloffset_GetTexGendv ), + NAME_FUNC_OFFSET( 3400, glGetTexGenfv, _gloffset_GetTexGenfv ), + NAME_FUNC_OFFSET( 3414, glGetTexGeniv, _gloffset_GetTexGeniv ), + NAME_FUNC_OFFSET( 3428, glGetTexImage, _gloffset_GetTexImage ), + NAME_FUNC_OFFSET( 3442, glGetTexParameterfv, _gloffset_GetTexParameterfv ), + NAME_FUNC_OFFSET( 3462, glGetTexParameteriv, _gloffset_GetTexParameteriv ), + NAME_FUNC_OFFSET( 3482, glGetTexLevelParameterfv, _gloffset_GetTexLevelParameterfv ), + NAME_FUNC_OFFSET( 3507, glGetTexLevelParameteriv, _gloffset_GetTexLevelParameteriv ), + NAME_FUNC_OFFSET( 3532, glIsEnabled, _gloffset_IsEnabled ), + NAME_FUNC_OFFSET( 3544, glIsList, _gloffset_IsList ), + NAME_FUNC_OFFSET( 3553, glDepthRange, _gloffset_DepthRange ), + NAME_FUNC_OFFSET( 3566, glFrustum, _gloffset_Frustum ), + NAME_FUNC_OFFSET( 3576, glLoadIdentity, _gloffset_LoadIdentity ), + NAME_FUNC_OFFSET( 3591, glLoadMatrixf, _gloffset_LoadMatrixf ), + NAME_FUNC_OFFSET( 3605, glLoadMatrixd, _gloffset_LoadMatrixd ), + NAME_FUNC_OFFSET( 3619, glMatrixMode, _gloffset_MatrixMode ), + NAME_FUNC_OFFSET( 3632, glMultMatrixf, _gloffset_MultMatrixf ), + NAME_FUNC_OFFSET( 3646, glMultMatrixd, _gloffset_MultMatrixd ), + NAME_FUNC_OFFSET( 3660, glOrtho, _gloffset_Ortho ), + NAME_FUNC_OFFSET( 3668, glPopMatrix, _gloffset_PopMatrix ), + NAME_FUNC_OFFSET( 3680, glPushMatrix, _gloffset_PushMatrix ), + NAME_FUNC_OFFSET( 3693, glRotated, _gloffset_Rotated ), + NAME_FUNC_OFFSET( 3703, glRotatef, _gloffset_Rotatef ), + NAME_FUNC_OFFSET( 3713, glScaled, _gloffset_Scaled ), + NAME_FUNC_OFFSET( 3722, glScalef, _gloffset_Scalef ), + NAME_FUNC_OFFSET( 3731, glTranslated, _gloffset_Translated ), + NAME_FUNC_OFFSET( 3744, glTranslatef, _gloffset_Translatef ), + NAME_FUNC_OFFSET( 3757, glViewport, _gloffset_Viewport ), + NAME_FUNC_OFFSET( 3768, glArrayElement, _gloffset_ArrayElement ), + NAME_FUNC_OFFSET( 3783, glBindTexture, _gloffset_BindTexture ), + NAME_FUNC_OFFSET( 3797, glColorPointer, _gloffset_ColorPointer ), + NAME_FUNC_OFFSET( 3812, glDisableClientState, _gloffset_DisableClientState ), + NAME_FUNC_OFFSET( 3833, glDrawArrays, _gloffset_DrawArrays ), + NAME_FUNC_OFFSET( 3846, glDrawElements, _gloffset_DrawElements ), + NAME_FUNC_OFFSET( 3861, glEdgeFlagPointer, _gloffset_EdgeFlagPointer ), + NAME_FUNC_OFFSET( 3879, glEnableClientState, _gloffset_EnableClientState ), + NAME_FUNC_OFFSET( 3899, glIndexPointer, _gloffset_IndexPointer ), + NAME_FUNC_OFFSET( 3914, glIndexub, _gloffset_Indexub ), + NAME_FUNC_OFFSET( 3924, glIndexubv, _gloffset_Indexubv ), + NAME_FUNC_OFFSET( 3935, glInterleavedArrays, _gloffset_InterleavedArrays ), + NAME_FUNC_OFFSET( 3955, glNormalPointer, _gloffset_NormalPointer ), + NAME_FUNC_OFFSET( 3971, glPolygonOffset, _gloffset_PolygonOffset ), + NAME_FUNC_OFFSET( 3987, glTexCoordPointer, _gloffset_TexCoordPointer ), + NAME_FUNC_OFFSET( 4005, glVertexPointer, _gloffset_VertexPointer ), + NAME_FUNC_OFFSET( 4021, glAreTexturesResident, _gloffset_AreTexturesResident ), + NAME_FUNC_OFFSET( 4043, glCopyTexImage1D, _gloffset_CopyTexImage1D ), + NAME_FUNC_OFFSET( 4060, glCopyTexImage2D, _gloffset_CopyTexImage2D ), + NAME_FUNC_OFFSET( 4077, glCopyTexSubImage1D, _gloffset_CopyTexSubImage1D ), + NAME_FUNC_OFFSET( 4097, glCopyTexSubImage2D, _gloffset_CopyTexSubImage2D ), + NAME_FUNC_OFFSET( 4117, glDeleteTextures, _gloffset_DeleteTextures ), + NAME_FUNC_OFFSET( 4134, glGenTextures, _gloffset_GenTextures ), + NAME_FUNC_OFFSET( 4148, glGetPointerv, _gloffset_GetPointerv ), + NAME_FUNC_OFFSET( 4162, glIsTexture, _gloffset_IsTexture ), + NAME_FUNC_OFFSET( 4174, glPrioritizeTextures, _gloffset_PrioritizeTextures ), + NAME_FUNC_OFFSET( 4195, glTexSubImage1D, _gloffset_TexSubImage1D ), + NAME_FUNC_OFFSET( 4211, glTexSubImage2D, _gloffset_TexSubImage2D ), + NAME_FUNC_OFFSET( 4227, glPopClientAttrib, _gloffset_PopClientAttrib ), + NAME_FUNC_OFFSET( 4245, glPushClientAttrib, _gloffset_PushClientAttrib ), + NAME_FUNC_OFFSET( 4264, glBlendColor, _gloffset_BlendColor ), + NAME_FUNC_OFFSET( 4277, glBlendEquation, _gloffset_BlendEquation ), + NAME_FUNC_OFFSET( 4293, glDrawRangeElements, _gloffset_DrawRangeElements ), + NAME_FUNC_OFFSET( 4313, glColorTable, _gloffset_ColorTable ), + NAME_FUNC_OFFSET( 4326, glColorTableParameterfv, _gloffset_ColorTableParameterfv ), + NAME_FUNC_OFFSET( 4350, glColorTableParameteriv, _gloffset_ColorTableParameteriv ), + NAME_FUNC_OFFSET( 4374, glCopyColorTable, _gloffset_CopyColorTable ), + NAME_FUNC_OFFSET( 4391, glGetColorTable, _gloffset_GetColorTable ), + NAME_FUNC_OFFSET( 4407, glGetColorTableParameterfv, _gloffset_GetColorTableParameterfv ), + NAME_FUNC_OFFSET( 4434, glGetColorTableParameteriv, _gloffset_GetColorTableParameteriv ), + NAME_FUNC_OFFSET( 4461, glColorSubTable, _gloffset_ColorSubTable ), + NAME_FUNC_OFFSET( 4477, glCopyColorSubTable, _gloffset_CopyColorSubTable ), + NAME_FUNC_OFFSET( 4497, glConvolutionFilter1D, _gloffset_ConvolutionFilter1D ), + NAME_FUNC_OFFSET( 4519, glConvolutionFilter2D, _gloffset_ConvolutionFilter2D ), + NAME_FUNC_OFFSET( 4541, glConvolutionParameterf, _gloffset_ConvolutionParameterf ), + NAME_FUNC_OFFSET( 4565, glConvolutionParameterfv, _gloffset_ConvolutionParameterfv ), + NAME_FUNC_OFFSET( 4590, glConvolutionParameteri, _gloffset_ConvolutionParameteri ), + NAME_FUNC_OFFSET( 4614, glConvolutionParameteriv, _gloffset_ConvolutionParameteriv ), + NAME_FUNC_OFFSET( 4639, glCopyConvolutionFilter1D, _gloffset_CopyConvolutionFilter1D ), + NAME_FUNC_OFFSET( 4665, glCopyConvolutionFilter2D, _gloffset_CopyConvolutionFilter2D ), + NAME_FUNC_OFFSET( 4691, glGetConvolutionFilter, _gloffset_GetConvolutionFilter ), + NAME_FUNC_OFFSET( 4714, glGetConvolutionParameterfv, _gloffset_GetConvolutionParameterfv ), + NAME_FUNC_OFFSET( 4742, glGetConvolutionParameteriv, _gloffset_GetConvolutionParameteriv ), + NAME_FUNC_OFFSET( 4770, glGetSeparableFilter, _gloffset_GetSeparableFilter ), + NAME_FUNC_OFFSET( 4791, glSeparableFilter2D, _gloffset_SeparableFilter2D ), + NAME_FUNC_OFFSET( 4811, glGetHistogram, _gloffset_GetHistogram ), + NAME_FUNC_OFFSET( 4826, glGetHistogramParameterfv, _gloffset_GetHistogramParameterfv ), + NAME_FUNC_OFFSET( 4852, glGetHistogramParameteriv, _gloffset_GetHistogramParameteriv ), + NAME_FUNC_OFFSET( 4878, glGetMinmax, _gloffset_GetMinmax ), + NAME_FUNC_OFFSET( 4890, glGetMinmaxParameterfv, _gloffset_GetMinmaxParameterfv ), + NAME_FUNC_OFFSET( 4913, glGetMinmaxParameteriv, _gloffset_GetMinmaxParameteriv ), + NAME_FUNC_OFFSET( 4936, glHistogram, _gloffset_Histogram ), + NAME_FUNC_OFFSET( 4948, glMinmax, _gloffset_Minmax ), + NAME_FUNC_OFFSET( 4957, glResetHistogram, _gloffset_ResetHistogram ), + NAME_FUNC_OFFSET( 4974, glResetMinmax, _gloffset_ResetMinmax ), + NAME_FUNC_OFFSET( 4988, glTexImage3D, _gloffset_TexImage3D ), + NAME_FUNC_OFFSET( 5001, glTexSubImage3D, _gloffset_TexSubImage3D ), + NAME_FUNC_OFFSET( 5017, glCopyTexSubImage3D, _gloffset_CopyTexSubImage3D ), + NAME_FUNC_OFFSET( 5037, glActiveTextureARB, _gloffset_ActiveTextureARB ), + NAME_FUNC_OFFSET( 5056, glClientActiveTextureARB, _gloffset_ClientActiveTextureARB ), + NAME_FUNC_OFFSET( 5081, glMultiTexCoord1dARB, _gloffset_MultiTexCoord1dARB ), + NAME_FUNC_OFFSET( 5102, glMultiTexCoord1dvARB, _gloffset_MultiTexCoord1dvARB ), + NAME_FUNC_OFFSET( 5124, glMultiTexCoord1fARB, _gloffset_MultiTexCoord1fARB ), + NAME_FUNC_OFFSET( 5145, glMultiTexCoord1fvARB, _gloffset_MultiTexCoord1fvARB ), + NAME_FUNC_OFFSET( 5167, glMultiTexCoord1iARB, _gloffset_MultiTexCoord1iARB ), + NAME_FUNC_OFFSET( 5188, glMultiTexCoord1ivARB, _gloffset_MultiTexCoord1ivARB ), + NAME_FUNC_OFFSET( 5210, glMultiTexCoord1sARB, _gloffset_MultiTexCoord1sARB ), + NAME_FUNC_OFFSET( 5231, glMultiTexCoord1svARB, _gloffset_MultiTexCoord1svARB ), + NAME_FUNC_OFFSET( 5253, glMultiTexCoord2dARB, _gloffset_MultiTexCoord2dARB ), + NAME_FUNC_OFFSET( 5274, glMultiTexCoord2dvARB, _gloffset_MultiTexCoord2dvARB ), + NAME_FUNC_OFFSET( 5296, glMultiTexCoord2fARB, _gloffset_MultiTexCoord2fARB ), + NAME_FUNC_OFFSET( 5317, glMultiTexCoord2fvARB, _gloffset_MultiTexCoord2fvARB ), + NAME_FUNC_OFFSET( 5339, glMultiTexCoord2iARB, _gloffset_MultiTexCoord2iARB ), + NAME_FUNC_OFFSET( 5360, glMultiTexCoord2ivARB, _gloffset_MultiTexCoord2ivARB ), + NAME_FUNC_OFFSET( 5382, glMultiTexCoord2sARB, _gloffset_MultiTexCoord2sARB ), + NAME_FUNC_OFFSET( 5403, glMultiTexCoord2svARB, _gloffset_MultiTexCoord2svARB ), + NAME_FUNC_OFFSET( 5425, glMultiTexCoord3dARB, _gloffset_MultiTexCoord3dARB ), + NAME_FUNC_OFFSET( 5446, glMultiTexCoord3dvARB, _gloffset_MultiTexCoord3dvARB ), + NAME_FUNC_OFFSET( 5468, glMultiTexCoord3fARB, _gloffset_MultiTexCoord3fARB ), + NAME_FUNC_OFFSET( 5489, glMultiTexCoord3fvARB, _gloffset_MultiTexCoord3fvARB ), + NAME_FUNC_OFFSET( 5511, glMultiTexCoord3iARB, _gloffset_MultiTexCoord3iARB ), + NAME_FUNC_OFFSET( 5532, glMultiTexCoord3ivARB, _gloffset_MultiTexCoord3ivARB ), + NAME_FUNC_OFFSET( 5554, glMultiTexCoord3sARB, _gloffset_MultiTexCoord3sARB ), + NAME_FUNC_OFFSET( 5575, glMultiTexCoord3svARB, _gloffset_MultiTexCoord3svARB ), + NAME_FUNC_OFFSET( 5597, glMultiTexCoord4dARB, _gloffset_MultiTexCoord4dARB ), + NAME_FUNC_OFFSET( 5618, glMultiTexCoord4dvARB, _gloffset_MultiTexCoord4dvARB ), + NAME_FUNC_OFFSET( 5640, glMultiTexCoord4fARB, _gloffset_MultiTexCoord4fARB ), + NAME_FUNC_OFFSET( 5661, glMultiTexCoord4fvARB, _gloffset_MultiTexCoord4fvARB ), + NAME_FUNC_OFFSET( 5683, glMultiTexCoord4iARB, _gloffset_MultiTexCoord4iARB ), + NAME_FUNC_OFFSET( 5704, glMultiTexCoord4ivARB, _gloffset_MultiTexCoord4ivARB ), + NAME_FUNC_OFFSET( 5726, glMultiTexCoord4sARB, _gloffset_MultiTexCoord4sARB ), + NAME_FUNC_OFFSET( 5747, glMultiTexCoord4svARB, _gloffset_MultiTexCoord4svARB ), + NAME_FUNC_OFFSET( 5769, glLoadTransposeMatrixfARB, _gloffset_LoadTransposeMatrixfARB ), + NAME_FUNC_OFFSET( 5795, glLoadTransposeMatrixdARB, _gloffset_LoadTransposeMatrixdARB ), + NAME_FUNC_OFFSET( 5821, glMultTransposeMatrixfARB, _gloffset_MultTransposeMatrixfARB ), + NAME_FUNC_OFFSET( 5847, glMultTransposeMatrixdARB, _gloffset_MultTransposeMatrixdARB ), + NAME_FUNC_OFFSET( 5873, glSampleCoverageARB, _gloffset_SampleCoverageARB ), + NAME_FUNC_OFFSET( 5893, glDrawBuffersARB, _gloffset_DrawBuffersARB ), + NAME_FUNC_OFFSET( 5910, glPolygonOffsetEXT, _gloffset_PolygonOffsetEXT ), + NAME_FUNC_OFFSET( 5929, glGetTexFilterFuncSGIS, _gloffset_GetTexFilterFuncSGIS ), + NAME_FUNC_OFFSET( 5952, glTexFilterFuncSGIS, _gloffset_TexFilterFuncSGIS ), + NAME_FUNC_OFFSET( 5972, glGetHistogramEXT, _gloffset_GetHistogramEXT ), + NAME_FUNC_OFFSET( 5990, glGetHistogramParameterfvEXT, _gloffset_GetHistogramParameterfvEXT ), + NAME_FUNC_OFFSET( 6019, glGetHistogramParameterivEXT, _gloffset_GetHistogramParameterivEXT ), + NAME_FUNC_OFFSET( 6048, glGetMinmaxEXT, _gloffset_GetMinmaxEXT ), + NAME_FUNC_OFFSET( 6063, glGetMinmaxParameterfvEXT, _gloffset_GetMinmaxParameterfvEXT ), + NAME_FUNC_OFFSET( 6089, glGetMinmaxParameterivEXT, _gloffset_GetMinmaxParameterivEXT ), + NAME_FUNC_OFFSET( 6115, glGetConvolutionFilterEXT, _gloffset_GetConvolutionFilterEXT ), + NAME_FUNC_OFFSET( 6141, glGetConvolutionParameterfvEXT, _gloffset_GetConvolutionParameterfvEXT ), + NAME_FUNC_OFFSET( 6172, glGetConvolutionParameterivEXT, _gloffset_GetConvolutionParameterivEXT ), + NAME_FUNC_OFFSET( 6203, glGetSeparableFilterEXT, _gloffset_GetSeparableFilterEXT ), + NAME_FUNC_OFFSET( 6227, glGetColorTableSGI, _gloffset_GetColorTableSGI ), + NAME_FUNC_OFFSET( 6246, glGetColorTableParameterfvSGI, _gloffset_GetColorTableParameterfvSGI ), + NAME_FUNC_OFFSET( 6276, glGetColorTableParameterivSGI, _gloffset_GetColorTableParameterivSGI ), + NAME_FUNC_OFFSET( 6306, glPixelTexGenSGIX, _gloffset_PixelTexGenSGIX ), + NAME_FUNC_OFFSET( 6324, glPixelTexGenParameteriSGIS, _gloffset_PixelTexGenParameteriSGIS ), + NAME_FUNC_OFFSET( 6352, glPixelTexGenParameterivSGIS, _gloffset_PixelTexGenParameterivSGIS ), + NAME_FUNC_OFFSET( 6381, glPixelTexGenParameterfSGIS, _gloffset_PixelTexGenParameterfSGIS ), + NAME_FUNC_OFFSET( 6409, glPixelTexGenParameterfvSGIS, _gloffset_PixelTexGenParameterfvSGIS ), + NAME_FUNC_OFFSET( 6438, glGetPixelTexGenParameterivSGIS, _gloffset_GetPixelTexGenParameterivSGIS ), + NAME_FUNC_OFFSET( 6470, glGetPixelTexGenParameterfvSGIS, _gloffset_GetPixelTexGenParameterfvSGIS ), + NAME_FUNC_OFFSET( 6502, glTexImage4DSGIS, _gloffset_TexImage4DSGIS ), + NAME_FUNC_OFFSET( 6519, glTexSubImage4DSGIS, _gloffset_TexSubImage4DSGIS ), + NAME_FUNC_OFFSET( 6539, glAreTexturesResidentEXT, _gloffset_AreTexturesResidentEXT ), + NAME_FUNC_OFFSET( 6564, glGenTexturesEXT, _gloffset_GenTexturesEXT ), + NAME_FUNC_OFFSET( 6581, glIsTextureEXT, _gloffset_IsTextureEXT ), + NAME_FUNC_OFFSET( 6596, glDetailTexFuncSGIS, _gloffset_DetailTexFuncSGIS ), + NAME_FUNC_OFFSET( 6616, glGetDetailTexFuncSGIS, _gloffset_GetDetailTexFuncSGIS ), + NAME_FUNC_OFFSET( 6639, glSharpenTexFuncSGIS, _gloffset_SharpenTexFuncSGIS ), + NAME_FUNC_OFFSET( 6660, glGetSharpenTexFuncSGIS, _gloffset_GetSharpenTexFuncSGIS ), + NAME_FUNC_OFFSET( 6684, glSampleMaskSGIS, _gloffset_SampleMaskSGIS ), + NAME_FUNC_OFFSET( 6701, glSamplePatternSGIS, _gloffset_SamplePatternSGIS ), + NAME_FUNC_OFFSET( 6721, glColorPointerEXT, _gloffset_ColorPointerEXT ), + NAME_FUNC_OFFSET( 6739, glEdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT ), + NAME_FUNC_OFFSET( 6760, glIndexPointerEXT, _gloffset_IndexPointerEXT ), + NAME_FUNC_OFFSET( 6778, glNormalPointerEXT, _gloffset_NormalPointerEXT ), + NAME_FUNC_OFFSET( 6797, glTexCoordPointerEXT, _gloffset_TexCoordPointerEXT ), + NAME_FUNC_OFFSET( 6818, glVertexPointerEXT, _gloffset_VertexPointerEXT ), + NAME_FUNC_OFFSET( 6837, glSpriteParameterfSGIX, _gloffset_SpriteParameterfSGIX ), + NAME_FUNC_OFFSET( 6860, glSpriteParameterfvSGIX, _gloffset_SpriteParameterfvSGIX ), + NAME_FUNC_OFFSET( 6884, glSpriteParameteriSGIX, _gloffset_SpriteParameteriSGIX ), + NAME_FUNC_OFFSET( 6907, glSpriteParameterivSGIX, _gloffset_SpriteParameterivSGIX ), + NAME_FUNC_OFFSET( 6931, glPointParameterfEXT, _gloffset_PointParameterfEXT ), + NAME_FUNC_OFFSET( 6952, glPointParameterfvEXT, _gloffset_PointParameterfvEXT ), + NAME_FUNC_OFFSET( 6974, glGetInstrumentsSGIX, _gloffset_GetInstrumentsSGIX ), + NAME_FUNC_OFFSET( 6995, glInstrumentsBufferSGIX, _gloffset_InstrumentsBufferSGIX ), + NAME_FUNC_OFFSET( 7019, glPollInstrumentsSGIX, _gloffset_PollInstrumentsSGIX ), + NAME_FUNC_OFFSET( 7041, glReadInstrumentsSGIX, _gloffset_ReadInstrumentsSGIX ), + NAME_FUNC_OFFSET( 7063, glStartInstrumentsSGIX, _gloffset_StartInstrumentsSGIX ), + NAME_FUNC_OFFSET( 7086, glStopInstrumentsSGIX, _gloffset_StopInstrumentsSGIX ), + NAME_FUNC_OFFSET( 7108, glFrameZoomSGIX, _gloffset_FrameZoomSGIX ), + NAME_FUNC_OFFSET( 7124, glTagSampleBufferSGIX, _gloffset_TagSampleBufferSGIX ), + NAME_FUNC_OFFSET( 7146, glReferencePlaneSGIX, _gloffset_ReferencePlaneSGIX ), + NAME_FUNC_OFFSET( 7167, glFlushRasterSGIX, _gloffset_FlushRasterSGIX ), + NAME_FUNC_OFFSET( 7185, glGetListParameterfvSGIX, _gloffset_GetListParameterfvSGIX ), + NAME_FUNC_OFFSET( 7210, glGetListParameterivSGIX, _gloffset_GetListParameterivSGIX ), + NAME_FUNC_OFFSET( 7235, glListParameterfSGIX, _gloffset_ListParameterfSGIX ), + NAME_FUNC_OFFSET( 7256, glListParameterfvSGIX, _gloffset_ListParameterfvSGIX ), + NAME_FUNC_OFFSET( 7278, glListParameteriSGIX, _gloffset_ListParameteriSGIX ), + NAME_FUNC_OFFSET( 7299, glListParameterivSGIX, _gloffset_ListParameterivSGIX ), + NAME_FUNC_OFFSET( 7321, glFragmentColorMaterialSGIX, _gloffset_FragmentColorMaterialSGIX ), + NAME_FUNC_OFFSET( 7349, glFragmentLightfSGIX, _gloffset_FragmentLightfSGIX ), + NAME_FUNC_OFFSET( 7370, glFragmentLightfvSGIX, _gloffset_FragmentLightfvSGIX ), + NAME_FUNC_OFFSET( 7392, glFragmentLightiSGIX, _gloffset_FragmentLightiSGIX ), + NAME_FUNC_OFFSET( 7413, glFragmentLightivSGIX, _gloffset_FragmentLightivSGIX ), + NAME_FUNC_OFFSET( 7435, glFragmentLightModelfSGIX, _gloffset_FragmentLightModelfSGIX ), + NAME_FUNC_OFFSET( 7461, glFragmentLightModelfvSGIX, _gloffset_FragmentLightModelfvSGIX ), + NAME_FUNC_OFFSET( 7488, glFragmentLightModeliSGIX, _gloffset_FragmentLightModeliSGIX ), + NAME_FUNC_OFFSET( 7514, glFragmentLightModelivSGIX, _gloffset_FragmentLightModelivSGIX ), + NAME_FUNC_OFFSET( 7541, glFragmentMaterialfSGIX, _gloffset_FragmentMaterialfSGIX ), + NAME_FUNC_OFFSET( 7565, glFragmentMaterialfvSGIX, _gloffset_FragmentMaterialfvSGIX ), + NAME_FUNC_OFFSET( 7590, glFragmentMaterialiSGIX, _gloffset_FragmentMaterialiSGIX ), + NAME_FUNC_OFFSET( 7614, glFragmentMaterialivSGIX, _gloffset_FragmentMaterialivSGIX ), + NAME_FUNC_OFFSET( 7639, glGetFragmentLightfvSGIX, _gloffset_GetFragmentLightfvSGIX ), + NAME_FUNC_OFFSET( 7664, glGetFragmentLightivSGIX, _gloffset_GetFragmentLightivSGIX ), + NAME_FUNC_OFFSET( 7689, glGetFragmentMaterialfvSGIX, _gloffset_GetFragmentMaterialfvSGIX ), + NAME_FUNC_OFFSET( 7717, glGetFragmentMaterialivSGIX, _gloffset_GetFragmentMaterialivSGIX ), + NAME_FUNC_OFFSET( 7745, glLightEnviSGIX, _gloffset_LightEnviSGIX ), + NAME_FUNC_OFFSET( 7761, glVertexWeightfEXT, _gloffset_VertexWeightfEXT ), + NAME_FUNC_OFFSET( 7780, glVertexWeightfvEXT, _gloffset_VertexWeightfvEXT ), + NAME_FUNC_OFFSET( 7800, glVertexWeightPointerEXT, _gloffset_VertexWeightPointerEXT ), + NAME_FUNC_OFFSET( 7825, glFlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV ), + NAME_FUNC_OFFSET( 7851, glVertexArrayRangeNV, _gloffset_VertexArrayRangeNV ), + NAME_FUNC_OFFSET( 7872, glCombinerParameterfvNV, _gloffset_CombinerParameterfvNV ), + NAME_FUNC_OFFSET( 7896, glCombinerParameterfNV, _gloffset_CombinerParameterfNV ), + NAME_FUNC_OFFSET( 7919, glCombinerParameterivNV, _gloffset_CombinerParameterivNV ), + NAME_FUNC_OFFSET( 7943, glCombinerParameteriNV, _gloffset_CombinerParameteriNV ), + NAME_FUNC_OFFSET( 7966, glCombinerInputNV, _gloffset_CombinerInputNV ), + NAME_FUNC_OFFSET( 7984, glCombinerOutputNV, _gloffset_CombinerOutputNV ), + NAME_FUNC_OFFSET( 8003, glFinalCombinerInputNV, _gloffset_FinalCombinerInputNV ), + NAME_FUNC_OFFSET( 8026, glGetCombinerInputParameterfvNV, _gloffset_GetCombinerInputParameterfvNV ), + NAME_FUNC_OFFSET( 8058, glGetCombinerInputParameterivNV, _gloffset_GetCombinerInputParameterivNV ), + NAME_FUNC_OFFSET( 8090, glGetCombinerOutputParameterfvNV, _gloffset_GetCombinerOutputParameterfvNV ), + NAME_FUNC_OFFSET( 8123, glGetCombinerOutputParameterivNV, _gloffset_GetCombinerOutputParameterivNV ), + NAME_FUNC_OFFSET( 8156, glGetFinalCombinerInputParameterfvNV, _gloffset_GetFinalCombinerInputParameterfvNV ), + NAME_FUNC_OFFSET( 8193, glGetFinalCombinerInputParameterivNV, _gloffset_GetFinalCombinerInputParameterivNV ), + NAME_FUNC_OFFSET( 8230, glResizeBuffersMESA, _gloffset_ResizeBuffersMESA ), + NAME_FUNC_OFFSET( 8250, glWindowPos2dMESA, _gloffset_WindowPos2dMESA ), + NAME_FUNC_OFFSET( 8268, glWindowPos2dvMESA, _gloffset_WindowPos2dvMESA ), + NAME_FUNC_OFFSET( 8287, glWindowPos2fMESA, _gloffset_WindowPos2fMESA ), + NAME_FUNC_OFFSET( 8305, glWindowPos2fvMESA, _gloffset_WindowPos2fvMESA ), + NAME_FUNC_OFFSET( 8324, glWindowPos2iMESA, _gloffset_WindowPos2iMESA ), + NAME_FUNC_OFFSET( 8342, glWindowPos2ivMESA, _gloffset_WindowPos2ivMESA ), + NAME_FUNC_OFFSET( 8361, glWindowPos2sMESA, _gloffset_WindowPos2sMESA ), + NAME_FUNC_OFFSET( 8379, glWindowPos2svMESA, _gloffset_WindowPos2svMESA ), + NAME_FUNC_OFFSET( 8398, glWindowPos3dMESA, _gloffset_WindowPos3dMESA ), + NAME_FUNC_OFFSET( 8416, glWindowPos3dvMESA, _gloffset_WindowPos3dvMESA ), + NAME_FUNC_OFFSET( 8435, glWindowPos3fMESA, _gloffset_WindowPos3fMESA ), + NAME_FUNC_OFFSET( 8453, glWindowPos3fvMESA, _gloffset_WindowPos3fvMESA ), + NAME_FUNC_OFFSET( 8472, glWindowPos3iMESA, _gloffset_WindowPos3iMESA ), + NAME_FUNC_OFFSET( 8490, glWindowPos3ivMESA, _gloffset_WindowPos3ivMESA ), + NAME_FUNC_OFFSET( 8509, glWindowPos3sMESA, _gloffset_WindowPos3sMESA ), + NAME_FUNC_OFFSET( 8527, glWindowPos3svMESA, _gloffset_WindowPos3svMESA ), + NAME_FUNC_OFFSET( 8546, glWindowPos4dMESA, _gloffset_WindowPos4dMESA ), + NAME_FUNC_OFFSET( 8564, glWindowPos4dvMESA, _gloffset_WindowPos4dvMESA ), + NAME_FUNC_OFFSET( 8583, glWindowPos4fMESA, _gloffset_WindowPos4fMESA ), + NAME_FUNC_OFFSET( 8601, glWindowPos4fvMESA, _gloffset_WindowPos4fvMESA ), + NAME_FUNC_OFFSET( 8620, glWindowPos4iMESA, _gloffset_WindowPos4iMESA ), + NAME_FUNC_OFFSET( 8638, glWindowPos4ivMESA, _gloffset_WindowPos4ivMESA ), + NAME_FUNC_OFFSET( 8657, glWindowPos4sMESA, _gloffset_WindowPos4sMESA ), + NAME_FUNC_OFFSET( 8675, glWindowPos4svMESA, _gloffset_WindowPos4svMESA ), + NAME_FUNC_OFFSET( 8694, glBlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT ), + NAME_FUNC_OFFSET( 8717, glIndexMaterialEXT, _gloffset_IndexMaterialEXT ), + NAME_FUNC_OFFSET( 8736, glIndexFuncEXT, _gloffset_IndexFuncEXT ), + NAME_FUNC_OFFSET( 8751, glLockArraysEXT, _gloffset_LockArraysEXT ), + NAME_FUNC_OFFSET( 8767, glUnlockArraysEXT, _gloffset_UnlockArraysEXT ), + NAME_FUNC_OFFSET( 8785, glCullParameterdvEXT, _gloffset_CullParameterdvEXT ), + NAME_FUNC_OFFSET( 8806, glCullParameterfvEXT, _gloffset_CullParameterfvEXT ), + NAME_FUNC_OFFSET( 8827, glHintPGI, _gloffset_HintPGI ), + NAME_FUNC_OFFSET( 8837, glFogCoordfEXT, _gloffset_FogCoordfEXT ), + NAME_FUNC_OFFSET( 8852, glFogCoordfvEXT, _gloffset_FogCoordfvEXT ), + NAME_FUNC_OFFSET( 8868, glFogCoorddEXT, _gloffset_FogCoorddEXT ), + NAME_FUNC_OFFSET( 8883, glFogCoorddvEXT, _gloffset_FogCoorddvEXT ), + NAME_FUNC_OFFSET( 8899, glFogCoordPointerEXT, _gloffset_FogCoordPointerEXT ), + NAME_FUNC_OFFSET( 8920, glGetColorTableEXT, _gloffset_GetColorTableEXT ), + NAME_FUNC_OFFSET( 8939, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameterivEXT ), + NAME_FUNC_OFFSET( 8969, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfvEXT ), + NAME_FUNC_OFFSET( 8999, glTbufferMask3DFX, _gloffset_TbufferMask3DFX ), + NAME_FUNC_OFFSET( 9017, glCompressedTexImage3DARB, _gloffset_CompressedTexImage3DARB ), + NAME_FUNC_OFFSET( 9043, glCompressedTexImage2DARB, _gloffset_CompressedTexImage2DARB ), + NAME_FUNC_OFFSET( 9069, glCompressedTexImage1DARB, _gloffset_CompressedTexImage1DARB ), + NAME_FUNC_OFFSET( 9095, glCompressedTexSubImage3DARB, _gloffset_CompressedTexSubImage3DARB ), + NAME_FUNC_OFFSET( 9124, glCompressedTexSubImage2DARB, _gloffset_CompressedTexSubImage2DARB ), + NAME_FUNC_OFFSET( 9153, glCompressedTexSubImage1DARB, _gloffset_CompressedTexSubImage1DARB ), + NAME_FUNC_OFFSET( 9182, glGetCompressedTexImageARB, _gloffset_GetCompressedTexImageARB ), + NAME_FUNC_OFFSET( 9209, glSecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT ), + NAME_FUNC_OFFSET( 9231, glSecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT ), + NAME_FUNC_OFFSET( 9254, glSecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT ), + NAME_FUNC_OFFSET( 9276, glSecondaryColor3dvEXT, _gloffset_SecondaryColor3dvEXT ), + NAME_FUNC_OFFSET( 9299, glSecondaryColor3fEXT, _gloffset_SecondaryColor3fEXT ), + NAME_FUNC_OFFSET( 9321, glSecondaryColor3fvEXT, _gloffset_SecondaryColor3fvEXT ), + NAME_FUNC_OFFSET( 9344, glSecondaryColor3iEXT, _gloffset_SecondaryColor3iEXT ), + NAME_FUNC_OFFSET( 9366, glSecondaryColor3ivEXT, _gloffset_SecondaryColor3ivEXT ), + NAME_FUNC_OFFSET( 9389, glSecondaryColor3sEXT, _gloffset_SecondaryColor3sEXT ), + NAME_FUNC_OFFSET( 9411, glSecondaryColor3svEXT, _gloffset_SecondaryColor3svEXT ), + NAME_FUNC_OFFSET( 9434, glSecondaryColor3ubEXT, _gloffset_SecondaryColor3ubEXT ), + NAME_FUNC_OFFSET( 9457, glSecondaryColor3ubvEXT, _gloffset_SecondaryColor3ubvEXT ), + NAME_FUNC_OFFSET( 9481, glSecondaryColor3uiEXT, _gloffset_SecondaryColor3uiEXT ), + NAME_FUNC_OFFSET( 9504, glSecondaryColor3uivEXT, _gloffset_SecondaryColor3uivEXT ), + NAME_FUNC_OFFSET( 9528, glSecondaryColor3usEXT, _gloffset_SecondaryColor3usEXT ), + NAME_FUNC_OFFSET( 9551, glSecondaryColor3usvEXT, _gloffset_SecondaryColor3usvEXT ), + NAME_FUNC_OFFSET( 9575, glSecondaryColorPointerEXT, _gloffset_SecondaryColorPointerEXT ), + NAME_FUNC_OFFSET( 9602, glAreProgramsResidentNV, _gloffset_AreProgramsResidentNV ), + NAME_FUNC_OFFSET( 9626, glBindProgramNV, _gloffset_BindProgramNV ), + NAME_FUNC_OFFSET( 9642, glDeleteProgramsNV, _gloffset_DeleteProgramsNV ), + NAME_FUNC_OFFSET( 9661, glExecuteProgramNV, _gloffset_ExecuteProgramNV ), + NAME_FUNC_OFFSET( 9680, glGenProgramsNV, _gloffset_GenProgramsNV ), + NAME_FUNC_OFFSET( 9696, glGetProgramParameterdvNV, _gloffset_GetProgramParameterdvNV ), + NAME_FUNC_OFFSET( 9722, glGetProgramParameterfvNV, _gloffset_GetProgramParameterfvNV ), + NAME_FUNC_OFFSET( 9748, glGetProgramivNV, _gloffset_GetProgramivNV ), + NAME_FUNC_OFFSET( 9765, glGetProgramStringNV, _gloffset_GetProgramStringNV ), + NAME_FUNC_OFFSET( 9786, glGetTrackMatrixivNV, _gloffset_GetTrackMatrixivNV ), + NAME_FUNC_OFFSET( 9807, glGetVertexAttribdvARB, _gloffset_GetVertexAttribdvARB ), + NAME_FUNC_OFFSET( 9830, glGetVertexAttribfvARB, _gloffset_GetVertexAttribfvARB ), + NAME_FUNC_OFFSET( 9853, glGetVertexAttribivARB, _gloffset_GetVertexAttribivARB ), + NAME_FUNC_OFFSET( 9876, glGetVertexAttribPointervNV, _gloffset_GetVertexAttribPointervNV ), + NAME_FUNC_OFFSET( 9904, glIsProgramNV, _gloffset_IsProgramNV ), + NAME_FUNC_OFFSET( 9918, glLoadProgramNV, _gloffset_LoadProgramNV ), + NAME_FUNC_OFFSET( 9934, glProgramParameter4dNV, _gloffset_ProgramParameter4dNV ), + NAME_FUNC_OFFSET( 9957, glProgramParameter4dvNV, _gloffset_ProgramParameter4dvNV ), + NAME_FUNC_OFFSET( 9981, glProgramParameter4fNV, _gloffset_ProgramParameter4fNV ), + NAME_FUNC_OFFSET( 10004, glProgramParameter4fvNV, _gloffset_ProgramParameter4fvNV ), + NAME_FUNC_OFFSET( 10028, glProgramParameters4dvNV, _gloffset_ProgramParameters4dvNV ), + NAME_FUNC_OFFSET( 10053, glProgramParameters4fvNV, _gloffset_ProgramParameters4fvNV ), + NAME_FUNC_OFFSET( 10078, glRequestResidentProgramsNV, _gloffset_RequestResidentProgramsNV ), + NAME_FUNC_OFFSET( 10106, glTrackMatrixNV, _gloffset_TrackMatrixNV ), + NAME_FUNC_OFFSET( 10122, glVertexAttribPointerNV, _gloffset_VertexAttribPointerNV ), + NAME_FUNC_OFFSET( 10146, glVertexAttrib1dARB, _gloffset_VertexAttrib1dARB ), + NAME_FUNC_OFFSET( 10166, glVertexAttrib1dvARB, _gloffset_VertexAttrib1dvARB ), + NAME_FUNC_OFFSET( 10187, glVertexAttrib1fARB, _gloffset_VertexAttrib1fARB ), + NAME_FUNC_OFFSET( 10207, glVertexAttrib1fvARB, _gloffset_VertexAttrib1fvARB ), + NAME_FUNC_OFFSET( 10228, glVertexAttrib1sARB, _gloffset_VertexAttrib1sARB ), + NAME_FUNC_OFFSET( 10248, glVertexAttrib1svARB, _gloffset_VertexAttrib1svARB ), + NAME_FUNC_OFFSET( 10269, glVertexAttrib2dARB, _gloffset_VertexAttrib2dARB ), + NAME_FUNC_OFFSET( 10289, glVertexAttrib2dvARB, _gloffset_VertexAttrib2dvARB ), + NAME_FUNC_OFFSET( 10310, glVertexAttrib2fARB, _gloffset_VertexAttrib2fARB ), + NAME_FUNC_OFFSET( 10330, glVertexAttrib2fvARB, _gloffset_VertexAttrib2fvARB ), + NAME_FUNC_OFFSET( 10351, glVertexAttrib2sARB, _gloffset_VertexAttrib2sARB ), + NAME_FUNC_OFFSET( 10371, glVertexAttrib2svARB, _gloffset_VertexAttrib2svARB ), + NAME_FUNC_OFFSET( 10392, glVertexAttrib3dARB, _gloffset_VertexAttrib3dARB ), + NAME_FUNC_OFFSET( 10412, glVertexAttrib3dvARB, _gloffset_VertexAttrib3dvARB ), + NAME_FUNC_OFFSET( 10433, glVertexAttrib3fARB, _gloffset_VertexAttrib3fARB ), + NAME_FUNC_OFFSET( 10453, glVertexAttrib3fvARB, _gloffset_VertexAttrib3fvARB ), + NAME_FUNC_OFFSET( 10474, glVertexAttrib3sARB, _gloffset_VertexAttrib3sARB ), + NAME_FUNC_OFFSET( 10494, glVertexAttrib3svARB, _gloffset_VertexAttrib3svARB ), + NAME_FUNC_OFFSET( 10515, glVertexAttrib4dARB, _gloffset_VertexAttrib4dARB ), + NAME_FUNC_OFFSET( 10535, glVertexAttrib4dvARB, _gloffset_VertexAttrib4dvARB ), + NAME_FUNC_OFFSET( 10556, glVertexAttrib4fARB, _gloffset_VertexAttrib4fARB ), + NAME_FUNC_OFFSET( 10576, glVertexAttrib4fvARB, _gloffset_VertexAttrib4fvARB ), + NAME_FUNC_OFFSET( 10597, glVertexAttrib4sARB, _gloffset_VertexAttrib4sARB ), + NAME_FUNC_OFFSET( 10617, glVertexAttrib4svARB, _gloffset_VertexAttrib4svARB ), + NAME_FUNC_OFFSET( 10638, glVertexAttrib4NubARB, _gloffset_VertexAttrib4NubARB ), + NAME_FUNC_OFFSET( 10660, glVertexAttrib4NubvARB, _gloffset_VertexAttrib4NubvARB ), + NAME_FUNC_OFFSET( 10683, glVertexAttribs1dvNV, _gloffset_VertexAttribs1dvNV ), + NAME_FUNC_OFFSET( 10704, glVertexAttribs1fvNV, _gloffset_VertexAttribs1fvNV ), + NAME_FUNC_OFFSET( 10725, glVertexAttribs1svNV, _gloffset_VertexAttribs1svNV ), + NAME_FUNC_OFFSET( 10746, glVertexAttribs2dvNV, _gloffset_VertexAttribs2dvNV ), + NAME_FUNC_OFFSET( 10767, glVertexAttribs2fvNV, _gloffset_VertexAttribs2fvNV ), + NAME_FUNC_OFFSET( 10788, glVertexAttribs2svNV, _gloffset_VertexAttribs2svNV ), + NAME_FUNC_OFFSET( 10809, glVertexAttribs3dvNV, _gloffset_VertexAttribs3dvNV ), + NAME_FUNC_OFFSET( 10830, glVertexAttribs3fvNV, _gloffset_VertexAttribs3fvNV ), + NAME_FUNC_OFFSET( 10851, glVertexAttribs3svNV, _gloffset_VertexAttribs3svNV ), + NAME_FUNC_OFFSET( 10872, glVertexAttribs4dvNV, _gloffset_VertexAttribs4dvNV ), + NAME_FUNC_OFFSET( 10893, glVertexAttribs4fvNV, _gloffset_VertexAttribs4fvNV ), + NAME_FUNC_OFFSET( 10914, glVertexAttribs4svNV, _gloffset_VertexAttribs4svNV ), + NAME_FUNC_OFFSET( 10935, glVertexAttribs4ubvNV, _gloffset_VertexAttribs4ubvNV ), + NAME_FUNC_OFFSET( 10957, glPointParameteriNV, _gloffset_PointParameteriNV ), + NAME_FUNC_OFFSET( 10977, glPointParameterivNV, _gloffset_PointParameterivNV ), + NAME_FUNC_OFFSET( 10998, glMultiDrawArraysEXT, _gloffset_MultiDrawArraysEXT ), + NAME_FUNC_OFFSET( 11019, glMultiDrawElementsEXT, _gloffset_MultiDrawElementsEXT ), + NAME_FUNC_OFFSET( 11042, glActiveStencilFaceEXT, _gloffset_ActiveStencilFaceEXT ), + NAME_FUNC_OFFSET( 11065, glDeleteFencesNV, _gloffset_DeleteFencesNV ), + NAME_FUNC_OFFSET( 11082, glGenFencesNV, _gloffset_GenFencesNV ), + NAME_FUNC_OFFSET( 11096, glIsFenceNV, _gloffset_IsFenceNV ), + NAME_FUNC_OFFSET( 11108, glTestFenceNV, _gloffset_TestFenceNV ), + NAME_FUNC_OFFSET( 11122, glGetFenceivNV, _gloffset_GetFenceivNV ), + NAME_FUNC_OFFSET( 11137, glFinishFenceNV, _gloffset_FinishFenceNV ), + NAME_FUNC_OFFSET( 11153, glSetFenceNV, _gloffset_SetFenceNV ), + NAME_FUNC_OFFSET( 11166, glVertexAttrib4bvARB, _gloffset_VertexAttrib4bvARB ), + NAME_FUNC_OFFSET( 11187, glVertexAttrib4ivARB, _gloffset_VertexAttrib4ivARB ), + NAME_FUNC_OFFSET( 11208, glVertexAttrib4ubvARB, _gloffset_VertexAttrib4ubvARB ), + NAME_FUNC_OFFSET( 11230, glVertexAttrib4usvARB, _gloffset_VertexAttrib4usvARB ), + NAME_FUNC_OFFSET( 11252, glVertexAttrib4uivARB, _gloffset_VertexAttrib4uivARB ), + NAME_FUNC_OFFSET( 11274, glVertexAttrib4NbvARB, _gloffset_VertexAttrib4NbvARB ), + NAME_FUNC_OFFSET( 11296, glVertexAttrib4NsvARB, _gloffset_VertexAttrib4NsvARB ), + NAME_FUNC_OFFSET( 11318, glVertexAttrib4NivARB, _gloffset_VertexAttrib4NivARB ), + NAME_FUNC_OFFSET( 11340, glVertexAttrib4NusvARB, _gloffset_VertexAttrib4NusvARB ), + NAME_FUNC_OFFSET( 11363, glVertexAttrib4NuivARB, _gloffset_VertexAttrib4NuivARB ), + NAME_FUNC_OFFSET( 11386, glVertexAttribPointerARB, _gloffset_VertexAttribPointerARB ), + NAME_FUNC_OFFSET( 11411, glEnableVertexAttribArrayARB, _gloffset_EnableVertexAttribArrayARB ), + NAME_FUNC_OFFSET( 11440, glDisableVertexAttribArrayARB, _gloffset_DisableVertexAttribArrayARB ), + NAME_FUNC_OFFSET( 11470, glProgramStringARB, _gloffset_ProgramStringARB ), + NAME_FUNC_OFFSET( 11489, glProgramEnvParameter4dARB, _gloffset_ProgramEnvParameter4dARB ), + NAME_FUNC_OFFSET( 11516, glProgramEnvParameter4dvARB, _gloffset_ProgramEnvParameter4dvARB ), + NAME_FUNC_OFFSET( 11544, glProgramEnvParameter4fARB, _gloffset_ProgramEnvParameter4fARB ), + NAME_FUNC_OFFSET( 11571, glProgramEnvParameter4fvARB, _gloffset_ProgramEnvParameter4fvARB ), + NAME_FUNC_OFFSET( 11599, glProgramLocalParameter4dARB, _gloffset_ProgramLocalParameter4dARB ), + NAME_FUNC_OFFSET( 11628, glProgramLocalParameter4dvARB, _gloffset_ProgramLocalParameter4dvARB ), + NAME_FUNC_OFFSET( 11658, glProgramLocalParameter4fARB, _gloffset_ProgramLocalParameter4fARB ), + NAME_FUNC_OFFSET( 11687, glProgramLocalParameter4fvARB, _gloffset_ProgramLocalParameter4fvARB ), + NAME_FUNC_OFFSET( 11717, glGetProgramEnvParameterdvARB, _gloffset_GetProgramEnvParameterdvARB ), + NAME_FUNC_OFFSET( 11747, glGetProgramEnvParameterfvARB, _gloffset_GetProgramEnvParameterfvARB ), + NAME_FUNC_OFFSET( 11777, glGetProgramLocalParameterdvARB, _gloffset_GetProgramLocalParameterdvARB ), + NAME_FUNC_OFFSET( 11809, glGetProgramLocalParameterfvARB, _gloffset_GetProgramLocalParameterfvARB ), + NAME_FUNC_OFFSET( 11841, glGetProgramivARB, _gloffset_GetProgramivARB ), + NAME_FUNC_OFFSET( 11859, glGetProgramStringARB, _gloffset_GetProgramStringARB ), + NAME_FUNC_OFFSET( 11881, glProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV ), + NAME_FUNC_OFFSET( 11909, glProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV ), + NAME_FUNC_OFFSET( 11937, glProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV ), + NAME_FUNC_OFFSET( 11966, glProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV ), + NAME_FUNC_OFFSET( 11995, glGetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV ), + NAME_FUNC_OFFSET( 12026, glGetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV ), + NAME_FUNC_OFFSET( 12057, glBindBufferARB, _gloffset_BindBufferARB ), + NAME_FUNC_OFFSET( 12073, glBufferDataARB, _gloffset_BufferDataARB ), + NAME_FUNC_OFFSET( 12089, glBufferSubDataARB, _gloffset_BufferSubDataARB ), + NAME_FUNC_OFFSET( 12108, glDeleteBuffersARB, _gloffset_DeleteBuffersARB ), + NAME_FUNC_OFFSET( 12127, glGenBuffersARB, _gloffset_GenBuffersARB ), + NAME_FUNC_OFFSET( 12143, glGetBufferParameterivARB, _gloffset_GetBufferParameterivARB ), + NAME_FUNC_OFFSET( 12169, glGetBufferPointervARB, _gloffset_GetBufferPointervARB ), + NAME_FUNC_OFFSET( 12192, glGetBufferSubDataARB, _gloffset_GetBufferSubDataARB ), + NAME_FUNC_OFFSET( 12214, glIsBufferARB, _gloffset_IsBufferARB ), + NAME_FUNC_OFFSET( 12228, glMapBufferARB, _gloffset_MapBufferARB ), + NAME_FUNC_OFFSET( 12243, glUnmapBufferARB, _gloffset_UnmapBufferARB ), + NAME_FUNC_OFFSET( 12260, glDepthBoundsEXT, _gloffset_DepthBoundsEXT ), + NAME_FUNC_OFFSET( 12277, glGenQueriesARB, _gloffset_GenQueriesARB ), + NAME_FUNC_OFFSET( 12293, glDeleteQueriesARB, _gloffset_DeleteQueriesARB ), + NAME_FUNC_OFFSET( 12312, glIsQueryARB, _gloffset_IsQueryARB ), + NAME_FUNC_OFFSET( 12325, glBeginQueryARB, _gloffset_BeginQueryARB ), + NAME_FUNC_OFFSET( 12341, glEndQueryARB, _gloffset_EndQueryARB ), + NAME_FUNC_OFFSET( 12355, glGetQueryivARB, _gloffset_GetQueryivARB ), + NAME_FUNC_OFFSET( 12371, glGetQueryObjectivARB, _gloffset_GetQueryObjectivARB ), + NAME_FUNC_OFFSET( 12393, glGetQueryObjectuivARB, _gloffset_GetQueryObjectuivARB ), + NAME_FUNC_OFFSET( 12416, glMultiModeDrawArraysIBM, _gloffset_MultiModeDrawArraysIBM ), + NAME_FUNC_OFFSET( 12441, glMultiModeDrawElementsIBM, _gloffset_MultiModeDrawElementsIBM ), + NAME_FUNC_OFFSET( 12468, glBlendEquationSeparateEXT, _gloffset_BlendEquationSeparateEXT ), + NAME_FUNC_OFFSET( 12495, glDeleteObjectARB, _gloffset_DeleteObjectARB ), + NAME_FUNC_OFFSET( 12513, glGetHandleARB, _gloffset_GetHandleARB ), + NAME_FUNC_OFFSET( 12528, glDetachObjectARB, _gloffset_DetachObjectARB ), + NAME_FUNC_OFFSET( 12546, glCreateShaderObjectARB, _gloffset_CreateShaderObjectARB ), + NAME_FUNC_OFFSET( 12570, glShaderSourceARB, _gloffset_ShaderSourceARB ), + NAME_FUNC_OFFSET( 12588, glCompileShaderARB, _gloffset_CompileShaderARB ), + NAME_FUNC_OFFSET( 12607, glCreateProgramObjectARB, _gloffset_CreateProgramObjectARB ), + NAME_FUNC_OFFSET( 12632, glAttachObjectARB, _gloffset_AttachObjectARB ), + NAME_FUNC_OFFSET( 12650, glLinkProgramARB, _gloffset_LinkProgramARB ), + NAME_FUNC_OFFSET( 12667, glUseProgramObjectARB, _gloffset_UseProgramObjectARB ), + NAME_FUNC_OFFSET( 12689, glValidateProgramARB, _gloffset_ValidateProgramARB ), + NAME_FUNC_OFFSET( 12710, glUniform1fARB, _gloffset_Uniform1fARB ), + NAME_FUNC_OFFSET( 12725, glUniform2fARB, _gloffset_Uniform2fARB ), + NAME_FUNC_OFFSET( 12740, glUniform3fARB, _gloffset_Uniform3fARB ), + NAME_FUNC_OFFSET( 12755, glUniform4fARB, _gloffset_Uniform4fARB ), + NAME_FUNC_OFFSET( 12770, glUniform1iARB, _gloffset_Uniform1iARB ), + NAME_FUNC_OFFSET( 12785, glUniform2iARB, _gloffset_Uniform2iARB ), + NAME_FUNC_OFFSET( 12800, glUniform3iARB, _gloffset_Uniform3iARB ), + NAME_FUNC_OFFSET( 12815, glUniform4iARB, _gloffset_Uniform4iARB ), + NAME_FUNC_OFFSET( 12830, glUniform1fvARB, _gloffset_Uniform1fvARB ), + NAME_FUNC_OFFSET( 12846, glUniform2fvARB, _gloffset_Uniform2fvARB ), + NAME_FUNC_OFFSET( 12862, glUniform3fvARB, _gloffset_Uniform3fvARB ), + NAME_FUNC_OFFSET( 12878, glUniform4fvARB, _gloffset_Uniform4fvARB ), + NAME_FUNC_OFFSET( 12894, glUniform1ivARB, _gloffset_Uniform1ivARB ), + NAME_FUNC_OFFSET( 12910, glUniform2ivARB, _gloffset_Uniform2ivARB ), + NAME_FUNC_OFFSET( 12926, glUniform3ivARB, _gloffset_Uniform3ivARB ), + NAME_FUNC_OFFSET( 12942, glUniform4ivARB, _gloffset_Uniform4ivARB ), + NAME_FUNC_OFFSET( 12958, glUniformMatrix2fvARB, _gloffset_UniformMatrix2fvARB ), + NAME_FUNC_OFFSET( 12980, glUniformMatrix3fvARB, _gloffset_UniformMatrix3fvARB ), + NAME_FUNC_OFFSET( 13002, glUniformMatrix4fvARB, _gloffset_UniformMatrix4fvARB ), + NAME_FUNC_OFFSET( 13024, glGetObjectParameterfvARB, _gloffset_GetObjectParameterfvARB ), + NAME_FUNC_OFFSET( 13050, glGetObjectParameterivARB, _gloffset_GetObjectParameterivARB ), + NAME_FUNC_OFFSET( 13076, glGetInfoLogARB, _gloffset_GetInfoLogARB ), + NAME_FUNC_OFFSET( 13092, glGetAttachedObjectsARB, _gloffset_GetAttachedObjectsARB ), + NAME_FUNC_OFFSET( 13116, glGetUniformLocationARB, _gloffset_GetUniformLocationARB ), + NAME_FUNC_OFFSET( 13140, glGetActiveUniformARB, _gloffset_GetActiveUniformARB ), + NAME_FUNC_OFFSET( 13162, glGetUniformfvARB, _gloffset_GetUniformfvARB ), + NAME_FUNC_OFFSET( 13180, glGetUniformivARB, _gloffset_GetUniformivARB ), + NAME_FUNC_OFFSET( 13198, glGetShaderSourceARB, _gloffset_GetShaderSourceARB ), + NAME_FUNC_OFFSET( 13219, glBindAttribLocationARB, _gloffset_BindAttribLocationARB ), + NAME_FUNC_OFFSET( 13243, glGetActiveAttribARB, _gloffset_GetActiveAttribARB ), + NAME_FUNC_OFFSET( 13264, glGetAttribLocationARB, _gloffset_GetAttribLocationARB ), + NAME_FUNC_OFFSET( 13287, glGetVertexAttribdvNV, _gloffset_GetVertexAttribdvNV ), + NAME_FUNC_OFFSET( 13309, glGetVertexAttribfvNV, _gloffset_GetVertexAttribfvNV ), + NAME_FUNC_OFFSET( 13331, glGetVertexAttribivNV, _gloffset_GetVertexAttribivNV ), + NAME_FUNC_OFFSET( 13353, glVertexAttrib1dNV, _gloffset_VertexAttrib1dNV ), + NAME_FUNC_OFFSET( 13372, glVertexAttrib1dvNV, _gloffset_VertexAttrib1dvNV ), + NAME_FUNC_OFFSET( 13392, glVertexAttrib1fNV, _gloffset_VertexAttrib1fNV ), + NAME_FUNC_OFFSET( 13411, glVertexAttrib1fvNV, _gloffset_VertexAttrib1fvNV ), + NAME_FUNC_OFFSET( 13431, glVertexAttrib1sNV, _gloffset_VertexAttrib1sNV ), + NAME_FUNC_OFFSET( 13450, glVertexAttrib1svNV, _gloffset_VertexAttrib1svNV ), + NAME_FUNC_OFFSET( 13470, glVertexAttrib2dNV, _gloffset_VertexAttrib2dNV ), + NAME_FUNC_OFFSET( 13489, glVertexAttrib2dvNV, _gloffset_VertexAttrib2dvNV ), + NAME_FUNC_OFFSET( 13509, glVertexAttrib2fNV, _gloffset_VertexAttrib2fNV ), + NAME_FUNC_OFFSET( 13528, glVertexAttrib2fvNV, _gloffset_VertexAttrib2fvNV ), + NAME_FUNC_OFFSET( 13548, glVertexAttrib2sNV, _gloffset_VertexAttrib2sNV ), + NAME_FUNC_OFFSET( 13567, glVertexAttrib2svNV, _gloffset_VertexAttrib2svNV ), + NAME_FUNC_OFFSET( 13587, glVertexAttrib3dNV, _gloffset_VertexAttrib3dNV ), + NAME_FUNC_OFFSET( 13606, glVertexAttrib3dvNV, _gloffset_VertexAttrib3dvNV ), + NAME_FUNC_OFFSET( 13626, glVertexAttrib3fNV, _gloffset_VertexAttrib3fNV ), + NAME_FUNC_OFFSET( 13645, glVertexAttrib3fvNV, _gloffset_VertexAttrib3fvNV ), + NAME_FUNC_OFFSET( 13665, glVertexAttrib3sNV, _gloffset_VertexAttrib3sNV ), + NAME_FUNC_OFFSET( 13684, glVertexAttrib3svNV, _gloffset_VertexAttrib3svNV ), + NAME_FUNC_OFFSET( 13704, glVertexAttrib4dNV, _gloffset_VertexAttrib4dNV ), + NAME_FUNC_OFFSET( 13723, glVertexAttrib4dvNV, _gloffset_VertexAttrib4dvNV ), + NAME_FUNC_OFFSET( 13743, glVertexAttrib4fNV, _gloffset_VertexAttrib4fNV ), + NAME_FUNC_OFFSET( 13762, glVertexAttrib4fvNV, _gloffset_VertexAttrib4fvNV ), + NAME_FUNC_OFFSET( 13782, glVertexAttrib4sNV, _gloffset_VertexAttrib4sNV ), + NAME_FUNC_OFFSET( 13801, glVertexAttrib4svNV, _gloffset_VertexAttrib4svNV ), + NAME_FUNC_OFFSET( 13821, glVertexAttrib4ubNV, _gloffset_VertexAttrib4ubNV ), + NAME_FUNC_OFFSET( 13841, glVertexAttrib4ubvNV, _gloffset_VertexAttrib4ubvNV ), + NAME_FUNC_OFFSET( 13862, glGenFragmentShadersATI, _gloffset_GenFragmentShadersATI ), + NAME_FUNC_OFFSET( 13886, glBindFragmentShaderATI, _gloffset_BindFragmentShaderATI ), + NAME_FUNC_OFFSET( 13910, glDeleteFragmentShaderATI, _gloffset_DeleteFragmentShaderATI ), + NAME_FUNC_OFFSET( 13936, glBeginFragmentShaderATI, _gloffset_BeginFragmentShaderATI ), + NAME_FUNC_OFFSET( 13961, glEndFragmentShaderATI, _gloffset_EndFragmentShaderATI ), + NAME_FUNC_OFFSET( 13984, glPassTexCoordATI, _gloffset_PassTexCoordATI ), + NAME_FUNC_OFFSET( 14002, glSampleMapATI, _gloffset_SampleMapATI ), + NAME_FUNC_OFFSET( 14017, glColorFragmentOp1ATI, _gloffset_ColorFragmentOp1ATI ), + NAME_FUNC_OFFSET( 14039, glColorFragmentOp2ATI, _gloffset_ColorFragmentOp2ATI ), + NAME_FUNC_OFFSET( 14061, glColorFragmentOp3ATI, _gloffset_ColorFragmentOp3ATI ), + NAME_FUNC_OFFSET( 14083, glAlphaFragmentOp1ATI, _gloffset_AlphaFragmentOp1ATI ), + NAME_FUNC_OFFSET( 14105, glAlphaFragmentOp2ATI, _gloffset_AlphaFragmentOp2ATI ), + NAME_FUNC_OFFSET( 14127, glAlphaFragmentOp3ATI, _gloffset_AlphaFragmentOp3ATI ), + NAME_FUNC_OFFSET( 14149, glSetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI ), + NAME_FUNC_OFFSET( 14180, glIsRenderbufferEXT, _gloffset_IsRenderbufferEXT ), + NAME_FUNC_OFFSET( 14200, glBindRenderbufferEXT, _gloffset_BindRenderbufferEXT ), + NAME_FUNC_OFFSET( 14222, glDeleteRenderbuffersEXT, _gloffset_DeleteRenderbuffersEXT ), + NAME_FUNC_OFFSET( 14247, glGenRenderbuffersEXT, _gloffset_GenRenderbuffersEXT ), + NAME_FUNC_OFFSET( 14269, glRenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT ), + NAME_FUNC_OFFSET( 14294, glGetRenderbufferParameterivEXT, _gloffset_GetRenderbufferParameterivEXT ), + NAME_FUNC_OFFSET( 14326, glIsFramebufferEXT, _gloffset_IsFramebufferEXT ), + NAME_FUNC_OFFSET( 14345, glBindFramebufferEXT, _gloffset_BindFramebufferEXT ), + NAME_FUNC_OFFSET( 14366, glDeleteFramebuffersEXT, _gloffset_DeleteFramebuffersEXT ), + NAME_FUNC_OFFSET( 14390, glGenFramebuffersEXT, _gloffset_GenFramebuffersEXT ), + NAME_FUNC_OFFSET( 14411, glCheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT ), + NAME_FUNC_OFFSET( 14439, glFramebufferTexture1DEXT, _gloffset_FramebufferTexture1DEXT ), + NAME_FUNC_OFFSET( 14465, glFramebufferTexture2DEXT, _gloffset_FramebufferTexture2DEXT ), + NAME_FUNC_OFFSET( 14491, glFramebufferTexture3DEXT, _gloffset_FramebufferTexture3DEXT ), + NAME_FUNC_OFFSET( 14517, glFramebufferRenderbufferEXT, _gloffset_FramebufferRenderbufferEXT ), + NAME_FUNC_OFFSET( 14546, glGetFramebufferAttachmentParameterivEXT, _gloffset_GetFramebufferAttachmentParameterivEXT ), + NAME_FUNC_OFFSET( 14587, glGenerateMipmapEXT, _gloffset_GenerateMipmapEXT ), + NAME_FUNC_OFFSET( 14607, glStencilFuncSeparate, _gloffset_StencilFuncSeparate ), + NAME_FUNC_OFFSET( 14629, glStencilOpSeparate, _gloffset_StencilOpSeparate ), + NAME_FUNC_OFFSET( 14649, glStencilMaskSeparate, _gloffset_StencilMaskSeparate ), + NAME_FUNC_OFFSET( 14671, glArrayElementEXT, _gloffset_ArrayElement ), + NAME_FUNC_OFFSET( 14689, glBindTextureEXT, _gloffset_BindTexture ), + NAME_FUNC_OFFSET( 14706, glDrawArraysEXT, _gloffset_DrawArrays ), + NAME_FUNC_OFFSET( 14722, glCopyTexImage1DEXT, _gloffset_CopyTexImage1D ), + NAME_FUNC_OFFSET( 14742, glCopyTexImage2DEXT, _gloffset_CopyTexImage2D ), + NAME_FUNC_OFFSET( 14762, glCopyTexSubImage1DEXT, _gloffset_CopyTexSubImage1D ), + NAME_FUNC_OFFSET( 14785, glCopyTexSubImage2DEXT, _gloffset_CopyTexSubImage2D ), + NAME_FUNC_OFFSET( 14808, glDeleteTexturesEXT, _gloffset_DeleteTextures ), + NAME_FUNC_OFFSET( 14828, glGetPointervEXT, _gloffset_GetPointerv ), + NAME_FUNC_OFFSET( 14845, glPrioritizeTexturesEXT, _gloffset_PrioritizeTextures ), + NAME_FUNC_OFFSET( 14869, glTexSubImage1DEXT, _gloffset_TexSubImage1D ), + NAME_FUNC_OFFSET( 14888, glTexSubImage2DEXT, _gloffset_TexSubImage2D ), + NAME_FUNC_OFFSET( 14907, glBlendColorEXT, _gloffset_BlendColor ), + NAME_FUNC_OFFSET( 14923, glBlendEquationEXT, _gloffset_BlendEquation ), + NAME_FUNC_OFFSET( 14942, glDrawRangeElementsEXT, _gloffset_DrawRangeElements ), + NAME_FUNC_OFFSET( 14965, glColorTableSGI, _gloffset_ColorTable ), + NAME_FUNC_OFFSET( 14981, glColorTableEXT, _gloffset_ColorTable ), + NAME_FUNC_OFFSET( 14997, glColorTableParameterfvSGI, _gloffset_ColorTableParameterfv ), + NAME_FUNC_OFFSET( 15024, glColorTableParameterivSGI, _gloffset_ColorTableParameteriv ), + NAME_FUNC_OFFSET( 15051, glCopyColorTableSGI, _gloffset_CopyColorTable ), + NAME_FUNC_OFFSET( 15071, glColorSubTableEXT, _gloffset_ColorSubTable ), + NAME_FUNC_OFFSET( 15090, glCopyColorSubTableEXT, _gloffset_CopyColorSubTable ), + NAME_FUNC_OFFSET( 15113, glConvolutionFilter1DEXT, _gloffset_ConvolutionFilter1D ), + NAME_FUNC_OFFSET( 15138, glConvolutionFilter2DEXT, _gloffset_ConvolutionFilter2D ), + NAME_FUNC_OFFSET( 15163, glConvolutionParameterfEXT, _gloffset_ConvolutionParameterf ), + NAME_FUNC_OFFSET( 15190, glConvolutionParameterfvEXT, _gloffset_ConvolutionParameterfv ), + NAME_FUNC_OFFSET( 15218, glConvolutionParameteriEXT, _gloffset_ConvolutionParameteri ), + NAME_FUNC_OFFSET( 15245, glConvolutionParameterivEXT, _gloffset_ConvolutionParameteriv ), + NAME_FUNC_OFFSET( 15273, glCopyConvolutionFilter1DEXT, _gloffset_CopyConvolutionFilter1D ), + NAME_FUNC_OFFSET( 15302, glCopyConvolutionFilter2DEXT, _gloffset_CopyConvolutionFilter2D ), + NAME_FUNC_OFFSET( 15331, glSeparableFilter2DEXT, _gloffset_SeparableFilter2D ), + NAME_FUNC_OFFSET( 15354, glHistogramEXT, _gloffset_Histogram ), + NAME_FUNC_OFFSET( 15369, glMinmaxEXT, _gloffset_Minmax ), + NAME_FUNC_OFFSET( 15381, glResetHistogramEXT, _gloffset_ResetHistogram ), + NAME_FUNC_OFFSET( 15401, glResetMinmaxEXT, _gloffset_ResetMinmax ), + NAME_FUNC_OFFSET( 15418, glTexImage3DEXT, _gloffset_TexImage3D ), + NAME_FUNC_OFFSET( 15434, glTexSubImage3DEXT, _gloffset_TexSubImage3D ), + NAME_FUNC_OFFSET( 15453, glCopyTexSubImage3DEXT, _gloffset_CopyTexSubImage3D ), + NAME_FUNC_OFFSET( 15476, glActiveTexture, _gloffset_ActiveTextureARB ), + NAME_FUNC_OFFSET( 15492, glClientActiveTexture, _gloffset_ClientActiveTextureARB ), + NAME_FUNC_OFFSET( 15514, glMultiTexCoord1d, _gloffset_MultiTexCoord1dARB ), + NAME_FUNC_OFFSET( 15532, glMultiTexCoord1dv, _gloffset_MultiTexCoord1dvARB ), + NAME_FUNC_OFFSET( 15551, glMultiTexCoord1f, _gloffset_MultiTexCoord1fARB ), + NAME_FUNC_OFFSET( 15569, glMultiTexCoord1fv, _gloffset_MultiTexCoord1fvARB ), + NAME_FUNC_OFFSET( 15588, glMultiTexCoord1i, _gloffset_MultiTexCoord1iARB ), + NAME_FUNC_OFFSET( 15606, glMultiTexCoord1iv, _gloffset_MultiTexCoord1ivARB ), + NAME_FUNC_OFFSET( 15625, glMultiTexCoord1s, _gloffset_MultiTexCoord1sARB ), + NAME_FUNC_OFFSET( 15643, glMultiTexCoord1sv, _gloffset_MultiTexCoord1svARB ), + NAME_FUNC_OFFSET( 15662, glMultiTexCoord2d, _gloffset_MultiTexCoord2dARB ), + NAME_FUNC_OFFSET( 15680, glMultiTexCoord2dv, _gloffset_MultiTexCoord2dvARB ), + NAME_FUNC_OFFSET( 15699, glMultiTexCoord2f, _gloffset_MultiTexCoord2fARB ), + NAME_FUNC_OFFSET( 15717, glMultiTexCoord2fv, _gloffset_MultiTexCoord2fvARB ), + NAME_FUNC_OFFSET( 15736, glMultiTexCoord2i, _gloffset_MultiTexCoord2iARB ), + NAME_FUNC_OFFSET( 15754, glMultiTexCoord2iv, _gloffset_MultiTexCoord2ivARB ), + NAME_FUNC_OFFSET( 15773, glMultiTexCoord2s, _gloffset_MultiTexCoord2sARB ), + NAME_FUNC_OFFSET( 15791, glMultiTexCoord2sv, _gloffset_MultiTexCoord2svARB ), + NAME_FUNC_OFFSET( 15810, glMultiTexCoord3d, _gloffset_MultiTexCoord3dARB ), + NAME_FUNC_OFFSET( 15828, glMultiTexCoord3dv, _gloffset_MultiTexCoord3dvARB ), + NAME_FUNC_OFFSET( 15847, glMultiTexCoord3f, _gloffset_MultiTexCoord3fARB ), + NAME_FUNC_OFFSET( 15865, glMultiTexCoord3fv, _gloffset_MultiTexCoord3fvARB ), + NAME_FUNC_OFFSET( 15884, glMultiTexCoord3i, _gloffset_MultiTexCoord3iARB ), + NAME_FUNC_OFFSET( 15902, glMultiTexCoord3iv, _gloffset_MultiTexCoord3ivARB ), + NAME_FUNC_OFFSET( 15921, glMultiTexCoord3s, _gloffset_MultiTexCoord3sARB ), + NAME_FUNC_OFFSET( 15939, glMultiTexCoord3sv, _gloffset_MultiTexCoord3svARB ), + NAME_FUNC_OFFSET( 15958, glMultiTexCoord4d, _gloffset_MultiTexCoord4dARB ), + NAME_FUNC_OFFSET( 15976, glMultiTexCoord4dv, _gloffset_MultiTexCoord4dvARB ), + NAME_FUNC_OFFSET( 15995, glMultiTexCoord4f, _gloffset_MultiTexCoord4fARB ), + NAME_FUNC_OFFSET( 16013, glMultiTexCoord4fv, _gloffset_MultiTexCoord4fvARB ), + NAME_FUNC_OFFSET( 16032, glMultiTexCoord4i, _gloffset_MultiTexCoord4iARB ), + NAME_FUNC_OFFSET( 16050, glMultiTexCoord4iv, _gloffset_MultiTexCoord4ivARB ), + NAME_FUNC_OFFSET( 16069, glMultiTexCoord4s, _gloffset_MultiTexCoord4sARB ), + NAME_FUNC_OFFSET( 16087, glMultiTexCoord4sv, _gloffset_MultiTexCoord4svARB ), + NAME_FUNC_OFFSET( 16106, glLoadTransposeMatrixf, _gloffset_LoadTransposeMatrixfARB ), + NAME_FUNC_OFFSET( 16129, glLoadTransposeMatrixd, _gloffset_LoadTransposeMatrixdARB ), + NAME_FUNC_OFFSET( 16152, glMultTransposeMatrixf, _gloffset_MultTransposeMatrixfARB ), + NAME_FUNC_OFFSET( 16175, glMultTransposeMatrixd, _gloffset_MultTransposeMatrixdARB ), + NAME_FUNC_OFFSET( 16198, glSampleCoverage, _gloffset_SampleCoverageARB ), + NAME_FUNC_OFFSET( 16215, glDrawBuffersATI, _gloffset_DrawBuffersARB ), + NAME_FUNC_OFFSET( 16232, glSampleMaskEXT, _gloffset_SampleMaskSGIS ), + NAME_FUNC_OFFSET( 16248, glSamplePatternEXT, _gloffset_SamplePatternSGIS ), + NAME_FUNC_OFFSET( 16267, glPointParameterf, _gloffset_PointParameterfEXT ), + NAME_FUNC_OFFSET( 16285, glPointParameterfARB, _gloffset_PointParameterfEXT ), + NAME_FUNC_OFFSET( 16306, glPointParameterfSGIS, _gloffset_PointParameterfEXT ), + NAME_FUNC_OFFSET( 16328, glPointParameterfv, _gloffset_PointParameterfvEXT ), + NAME_FUNC_OFFSET( 16347, glPointParameterfvARB, _gloffset_PointParameterfvEXT ), + NAME_FUNC_OFFSET( 16369, glPointParameterfvSGIS, _gloffset_PointParameterfvEXT ), + NAME_FUNC_OFFSET( 16392, glWindowPos2d, _gloffset_WindowPos2dMESA ), + NAME_FUNC_OFFSET( 16406, glWindowPos2dARB, _gloffset_WindowPos2dMESA ), + NAME_FUNC_OFFSET( 16423, glWindowPos2dv, _gloffset_WindowPos2dvMESA ), + NAME_FUNC_OFFSET( 16438, glWindowPos2dvARB, _gloffset_WindowPos2dvMESA ), + NAME_FUNC_OFFSET( 16456, glWindowPos2f, _gloffset_WindowPos2fMESA ), + NAME_FUNC_OFFSET( 16470, glWindowPos2fARB, _gloffset_WindowPos2fMESA ), + NAME_FUNC_OFFSET( 16487, glWindowPos2fv, _gloffset_WindowPos2fvMESA ), + NAME_FUNC_OFFSET( 16502, glWindowPos2fvARB, _gloffset_WindowPos2fvMESA ), + NAME_FUNC_OFFSET( 16520, glWindowPos2i, _gloffset_WindowPos2iMESA ), + NAME_FUNC_OFFSET( 16534, glWindowPos2iARB, _gloffset_WindowPos2iMESA ), + NAME_FUNC_OFFSET( 16551, glWindowPos2iv, _gloffset_WindowPos2ivMESA ), + NAME_FUNC_OFFSET( 16566, glWindowPos2ivARB, _gloffset_WindowPos2ivMESA ), + NAME_FUNC_OFFSET( 16584, glWindowPos2s, _gloffset_WindowPos2sMESA ), + NAME_FUNC_OFFSET( 16598, glWindowPos2sARB, _gloffset_WindowPos2sMESA ), + NAME_FUNC_OFFSET( 16615, glWindowPos2sv, _gloffset_WindowPos2svMESA ), + NAME_FUNC_OFFSET( 16630, glWindowPos2svARB, _gloffset_WindowPos2svMESA ), + NAME_FUNC_OFFSET( 16648, glWindowPos3d, _gloffset_WindowPos3dMESA ), + NAME_FUNC_OFFSET( 16662, glWindowPos3dARB, _gloffset_WindowPos3dMESA ), + NAME_FUNC_OFFSET( 16679, glWindowPos3dv, _gloffset_WindowPos3dvMESA ), + NAME_FUNC_OFFSET( 16694, glWindowPos3dvARB, _gloffset_WindowPos3dvMESA ), + NAME_FUNC_OFFSET( 16712, glWindowPos3f, _gloffset_WindowPos3fMESA ), + NAME_FUNC_OFFSET( 16726, glWindowPos3fARB, _gloffset_WindowPos3fMESA ), + NAME_FUNC_OFFSET( 16743, glWindowPos3fv, _gloffset_WindowPos3fvMESA ), + NAME_FUNC_OFFSET( 16758, glWindowPos3fvARB, _gloffset_WindowPos3fvMESA ), + NAME_FUNC_OFFSET( 16776, glWindowPos3i, _gloffset_WindowPos3iMESA ), + NAME_FUNC_OFFSET( 16790, glWindowPos3iARB, _gloffset_WindowPos3iMESA ), + NAME_FUNC_OFFSET( 16807, glWindowPos3iv, _gloffset_WindowPos3ivMESA ), + NAME_FUNC_OFFSET( 16822, glWindowPos3ivARB, _gloffset_WindowPos3ivMESA ), + NAME_FUNC_OFFSET( 16840, glWindowPos3s, _gloffset_WindowPos3sMESA ), + NAME_FUNC_OFFSET( 16854, glWindowPos3sARB, _gloffset_WindowPos3sMESA ), + NAME_FUNC_OFFSET( 16871, glWindowPos3sv, _gloffset_WindowPos3svMESA ), + NAME_FUNC_OFFSET( 16886, glWindowPos3svARB, _gloffset_WindowPos3svMESA ), + NAME_FUNC_OFFSET( 16904, glBlendFuncSeparate, _gloffset_BlendFuncSeparateEXT ), + NAME_FUNC_OFFSET( 16924, glBlendFuncSeparateINGR, _gloffset_BlendFuncSeparateEXT ), + NAME_FUNC_OFFSET( 16948, glFogCoordf, _gloffset_FogCoordfEXT ), + NAME_FUNC_OFFSET( 16960, glFogCoordfv, _gloffset_FogCoordfvEXT ), + NAME_FUNC_OFFSET( 16973, glFogCoordd, _gloffset_FogCoorddEXT ), + NAME_FUNC_OFFSET( 16985, glFogCoorddv, _gloffset_FogCoorddvEXT ), + NAME_FUNC_OFFSET( 16998, glFogCoordPointer, _gloffset_FogCoordPointerEXT ), + NAME_FUNC_OFFSET( 17016, glCompressedTexImage3D, _gloffset_CompressedTexImage3DARB ), + NAME_FUNC_OFFSET( 17039, glCompressedTexImage2D, _gloffset_CompressedTexImage2DARB ), + NAME_FUNC_OFFSET( 17062, glCompressedTexImage1D, _gloffset_CompressedTexImage1DARB ), + NAME_FUNC_OFFSET( 17085, glCompressedTexSubImage3D, _gloffset_CompressedTexSubImage3DARB ), + NAME_FUNC_OFFSET( 17111, glCompressedTexSubImage2D, _gloffset_CompressedTexSubImage2DARB ), + NAME_FUNC_OFFSET( 17137, glCompressedTexSubImage1D, _gloffset_CompressedTexSubImage1DARB ), + NAME_FUNC_OFFSET( 17163, glGetCompressedTexImage, _gloffset_GetCompressedTexImageARB ), + NAME_FUNC_OFFSET( 17187, glSecondaryColor3b, _gloffset_SecondaryColor3bEXT ), + NAME_FUNC_OFFSET( 17206, glSecondaryColor3bv, _gloffset_SecondaryColor3bvEXT ), + NAME_FUNC_OFFSET( 17226, glSecondaryColor3d, _gloffset_SecondaryColor3dEXT ), + NAME_FUNC_OFFSET( 17245, glSecondaryColor3dv, _gloffset_SecondaryColor3dvEXT ), + NAME_FUNC_OFFSET( 17265, glSecondaryColor3f, _gloffset_SecondaryColor3fEXT ), + NAME_FUNC_OFFSET( 17284, glSecondaryColor3fv, _gloffset_SecondaryColor3fvEXT ), + NAME_FUNC_OFFSET( 17304, glSecondaryColor3i, _gloffset_SecondaryColor3iEXT ), + NAME_FUNC_OFFSET( 17323, glSecondaryColor3iv, _gloffset_SecondaryColor3ivEXT ), + NAME_FUNC_OFFSET( 17343, glSecondaryColor3s, _gloffset_SecondaryColor3sEXT ), + NAME_FUNC_OFFSET( 17362, glSecondaryColor3sv, _gloffset_SecondaryColor3svEXT ), + NAME_FUNC_OFFSET( 17382, glSecondaryColor3ub, _gloffset_SecondaryColor3ubEXT ), + NAME_FUNC_OFFSET( 17402, glSecondaryColor3ubv, _gloffset_SecondaryColor3ubvEXT ), + NAME_FUNC_OFFSET( 17423, glSecondaryColor3ui, _gloffset_SecondaryColor3uiEXT ), + NAME_FUNC_OFFSET( 17443, glSecondaryColor3uiv, _gloffset_SecondaryColor3uivEXT ), + NAME_FUNC_OFFSET( 17464, glSecondaryColor3us, _gloffset_SecondaryColor3usEXT ), + NAME_FUNC_OFFSET( 17484, glSecondaryColor3usv, _gloffset_SecondaryColor3usvEXT ), + NAME_FUNC_OFFSET( 17505, glSecondaryColorPointer, _gloffset_SecondaryColorPointerEXT ), + NAME_FUNC_OFFSET( 17529, glBindProgramARB, _gloffset_BindProgramNV ), + NAME_FUNC_OFFSET( 17546, glDeleteProgramsARB, _gloffset_DeleteProgramsNV ), + NAME_FUNC_OFFSET( 17566, glGenProgramsARB, _gloffset_GenProgramsNV ), + NAME_FUNC_OFFSET( 17583, glGetVertexAttribPointervARB, _gloffset_GetVertexAttribPointervNV ), + NAME_FUNC_OFFSET( 17612, glIsProgramARB, _gloffset_IsProgramNV ), + NAME_FUNC_OFFSET( 17627, glPointParameteri, _gloffset_PointParameteriNV ), + NAME_FUNC_OFFSET( 17645, glPointParameteriv, _gloffset_PointParameterivNV ), + NAME_FUNC_OFFSET( 17664, glMultiDrawArrays, _gloffset_MultiDrawArraysEXT ), + NAME_FUNC_OFFSET( 17682, glMultiDrawElements, _gloffset_MultiDrawElementsEXT ), + NAME_FUNC_OFFSET( 17702, glBindBuffer, _gloffset_BindBufferARB ), + NAME_FUNC_OFFSET( 17715, glBufferData, _gloffset_BufferDataARB ), + NAME_FUNC_OFFSET( 17728, glBufferSubData, _gloffset_BufferSubDataARB ), + NAME_FUNC_OFFSET( 17744, glDeleteBuffers, _gloffset_DeleteBuffersARB ), + NAME_FUNC_OFFSET( 17760, glGenBuffers, _gloffset_GenBuffersARB ), + NAME_FUNC_OFFSET( 17773, glGetBufferParameteriv, _gloffset_GetBufferParameterivARB ), + NAME_FUNC_OFFSET( 17796, glGetBufferPointerv, _gloffset_GetBufferPointervARB ), + NAME_FUNC_OFFSET( 17816, glGetBufferSubData, _gloffset_GetBufferSubDataARB ), + NAME_FUNC_OFFSET( 17835, glIsBuffer, _gloffset_IsBufferARB ), + NAME_FUNC_OFFSET( 17846, glMapBuffer, _gloffset_MapBufferARB ), + NAME_FUNC_OFFSET( 17858, glUnmapBuffer, _gloffset_UnmapBufferARB ), + NAME_FUNC_OFFSET( 17872, glGenQueries, _gloffset_GenQueriesARB ), + NAME_FUNC_OFFSET( 17885, glDeleteQueries, _gloffset_DeleteQueriesARB ), + NAME_FUNC_OFFSET( 17901, glIsQuery, _gloffset_IsQueryARB ), + NAME_FUNC_OFFSET( 17911, glBeginQuery, _gloffset_BeginQueryARB ), + NAME_FUNC_OFFSET( 17924, glEndQuery, _gloffset_EndQueryARB ), + NAME_FUNC_OFFSET( 17935, glGetQueryiv, _gloffset_GetQueryivARB ), + NAME_FUNC_OFFSET( 17948, glGetQueryObjectiv, _gloffset_GetQueryObjectivARB ), + NAME_FUNC_OFFSET( 17967, glGetQueryObjectuiv, _gloffset_GetQueryObjectuivARB ), + NAME_FUNC_OFFSET( 17987, glBlendEquationSeparateATI, _gloffset_BlendEquationSeparateEXT ), + NAME_FUNC_OFFSET( -1, NULL, 0 ) +}; + +#undef NAME_FUNC_OFFSET diff --git a/reactos/dll/mesa32/src/glapi/glthread.c b/reactos/dll/mesa32/src/glapi/glthread.c new file mode 100644 index 00000000000..0683c1ec76f --- /dev/null +++ b/reactos/dll/mesa32/src/glapi/glthread.c @@ -0,0 +1,367 @@ + +/* + * 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. + */ + + +/* + * XXX There's probably some work to do in order to make this file + * truly reusable outside of Mesa. First, the glheader.h include must go. + */ + + +#include "glheader.h" +#include "glthread.h" + + +/* + * This file should still compile even when THREADS is not defined. + * This is to make things easier to deal with on the makefile scene.. + */ +#ifdef THREADS +#include + +/* + * Error messages + */ +#define INIT_TSD_ERROR "_glthread_: failed to allocate key for thread specific data" +#define GET_TSD_ERROR "_glthread_: failed to get thread specific data" +#define SET_TSD_ERROR "_glthread_: thread failed to set thread specific data" + + +/* + * Magic number to determine if a TSD object has been initialized. + * Kind of a hack but there doesn't appear to be a better cross-platform + * solution. + */ +#define INIT_MAGIC 0xff8adc98 + + + +/* + * POSIX Threads -- The best way to go if your platform supports them. + * Solaris >= 2.5 have POSIX threads, IRIX >= 6.4 reportedly + * has them, and many of the free Unixes now have them. + * Be sure to use appropriate -mt or -D_REENTRANT type + * compile flags when building. + */ +#ifdef PTHREADS + +unsigned long +_glthread_GetID(void) +{ + return (unsigned long) pthread_self(); +} + + +void +_glthread_InitTSD(_glthread_TSD *tsd) +{ + if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) { + perror(INIT_TSD_ERROR); + exit(-1); + } + tsd->initMagic = INIT_MAGIC; +} + + +void * +_glthread_GetTSD(_glthread_TSD *tsd) +{ + if (tsd->initMagic != (int) INIT_MAGIC) { + _glthread_InitTSD(tsd); + } + return pthread_getspecific(tsd->key); +} + + +void +_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) +{ + if (tsd->initMagic != (int) INIT_MAGIC) { + _glthread_InitTSD(tsd); + } + if (pthread_setspecific(tsd->key, ptr) != 0) { + perror(SET_TSD_ERROR); + exit(-1); + } +} + +#endif /* PTHREADS */ + + + +/* + * Solaris/Unix International Threads -- Use only if POSIX threads + * aren't available on your Unix platform. Solaris 2.[34] are examples + * of platforms where this is the case. Be sure to use -mt and/or + * -D_REENTRANT when compiling. + */ +#ifdef SOLARIS_THREADS +#define USE_LOCK_FOR_KEY /* undef this to try a version without + lock for the global key... */ + +unsigned long +_glthread_GetID(void) +{ + abort(); /* XXX not implemented yet */ + return (unsigned long) 0; +} + + +void +_glthread_InitTSD(_glthread_TSD *tsd) +{ + if ((errno = mutex_init(&tsd->keylock, 0, NULL)) != 0 || + (errno = thr_keycreate(&(tsd->key), free)) != 0) { + perror(INIT_TSD_ERROR); + exit(-1); + } + tsd->initMagic = INIT_MAGIC; +} + + +void * +_glthread_GetTSD(_glthread_TSD *tsd) +{ + void* ret; + if (tsd->initMagic != INIT_MAGIC) { + _glthread_InitTSD(tsd); + } +#ifdef USE_LOCK_FOR_KEY + mutex_lock(&tsd->keylock); + thr_getspecific(tsd->key, &ret); + mutex_unlock(&tsd->keylock); +#else + if ((errno = thr_getspecific(tsd->key, &ret)) != 0) { + perror(GET_TSD_ERROR); + exit(-1); + } +#endif + return ret; +} + + +void +_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) +{ + if (tsd->initMagic != INIT_MAGIC) { + _glthread_InitTSD(tsd); + } + if ((errno = thr_setspecific(tsd->key, ptr)) != 0) { + perror(SET_TSD_ERROR); + exit(-1); + } +} + +#undef USE_LOCK_FOR_KEY +#endif /* SOLARIS_THREADS */ + + + +/* + * Win32 Threads. The only available option for Windows 95/NT. + * Be sure that you compile using the Multithreaded runtime, otherwise + * bad things will happen. + */ +#ifdef WIN32_THREADS + +unsigned long +_glthread_GetID(void) +{ + abort(); /* XXX not implemented yet */ + return (unsigned long) 0; +} + + +void +_glthread_InitTSD(_glthread_TSD *tsd) +{ + tsd->key = TlsAlloc(); + if (tsd->key == 0xffffffff) { + /* Can Windows handle stderr messages for non-console + applications? Does Windows have perror? */ + /* perror(SET_INIT_ERROR);*/ + exit(-1); + } + tsd->initMagic = INIT_MAGIC; +} + + +void * +_glthread_GetTSD(_glthread_TSD *tsd) +{ + if (tsd->initMagic != INIT_MAGIC) { + _glthread_InitTSD(tsd); + } + return TlsGetValue(tsd->key); +} + + +void +_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) +{ + /* the following code assumes that the _glthread_TSD has been initialized + to zero at creation */ + if (tsd->initMagic != INIT_MAGIC) { + _glthread_InitTSD(tsd); + } + if (TlsSetValue(tsd->key, ptr) == 0) { + /* Can Windows handle stderr messages for non-console + applications? Does Windows have perror? */ + /* perror(SET_TSD_ERROR);*/ + exit(-1); + } +} + +#endif /* WIN32_THREADS */ + + + +/* + * XFree86 has its own thread wrapper, Xthreads.h + * We wrap it again for GL. + */ +#ifdef USE_XTHREADS + +unsigned long +_glthread_GetID(void) +{ + return (unsigned long) xthread_self(); +} + + +void +_glthread_InitTSD(_glthread_TSD *tsd) +{ + if (xthread_key_create(&tsd->key, NULL) != 0) { + perror(INIT_TSD_ERROR); + exit(-1); + } + tsd->initMagic = INIT_MAGIC; +} + + +void * +_glthread_GetTSD(_glthread_TSD *tsd) +{ + void *ptr; + if (tsd->initMagic != INIT_MAGIC) { + _glthread_InitTSD(tsd); + } + xthread_get_specific(tsd->key, &ptr); + return ptr; +} + + +void +_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) +{ + if (tsd->initMagic != INIT_MAGIC) { + _glthread_InitTSD(tsd); + } + xthread_set_specific(tsd->key, ptr); +} + +#endif /* XTHREAD */ + + + +/* + * BeOS threads + */ +#ifdef BEOS_THREADS + +unsigned long +_glthread_GetID(void) +{ + return (unsigned long) find_thread(NULL); +} + +void +_glthread_InitTSD(_glthread_TSD *tsd) +{ + tsd->key = tls_allocate(); + tsd->initMagic = INIT_MAGIC; +} + +void * +_glthread_GetTSD(_glthread_TSD *tsd) +{ + if (tsd->initMagic != (int) INIT_MAGIC) { + _glthread_InitTSD(tsd); + } + return tls_get(tsd->key); +} + +void +_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) +{ + if (tsd->initMagic != (int) INIT_MAGIC) { + _glthread_InitTSD(tsd); + } + tls_set(tsd->key, ptr); +} + +#endif /* BEOS_THREADS */ + + + +#else /* THREADS */ + + +/* + * no-op functions + */ + +unsigned long +_glthread_GetID(void) +{ + return 0; +} + + +void +_glthread_InitTSD(_glthread_TSD *tsd) +{ + (void) tsd; +} + + +void * +_glthread_GetTSD(_glthread_TSD *tsd) +{ + (void) tsd; + return NULL; +} + + +void +_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) +{ + (void) tsd; + (void) ptr; +} + + +#endif /* THREADS */ diff --git a/reactos/dll/mesa32/src/glapi/glthread.h b/reactos/dll/mesa32/src/glapi/glthread.h new file mode 100644 index 00000000000..53592aab32e --- /dev/null +++ b/reactos/dll/mesa32/src/glapi/glthread.h @@ -0,0 +1,314 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +/* + * Thread support for gl dispatch. + * + * Initial version by John Stone (j.stone@acm.org) (johns@cs.umr.edu) + * and Christoph Poliwoda (poliwoda@volumegraphics.com) + * Revised by Keith Whitwell + * Adapted for new gl dispatcher by Brian Paul + * + * + * + * DOCUMENTATION + * + * This thread module exports the following types: + * _glthread_TSD Thread-specific data area + * _glthread_Thread Thread datatype + * _glthread_Mutex Mutual exclusion lock + * + * Macros: + * _glthread_DECLARE_STATIC_MUTEX(name) Declare a non-local mutex + * _glthread_INIT_MUTEX(name) Initialize a mutex + * _glthread_LOCK_MUTEX(name) Lock a mutex + * _glthread_UNLOCK_MUTEX(name) Unlock a mutex + * + * Functions: + * _glthread_GetID(v) Get integer thread ID + * _glthread_InitTSD() Initialize thread-specific data + * _glthread_GetTSD() Get thread-specific data + * _glthread_SetTSD() Set thread-specific data + * + */ + +/* + * If this file is accidentally included by a non-threaded build, + * it should not cause the build to fail, or otherwise cause problems. + * In general, it should only be included when needed however. + */ + +#ifndef GLTHREAD_H +#define GLTHREAD_H + + +#if (defined(PTHREADS) || defined(SOLARIS_THREADS) ||\ + defined(WIN32_THREADS) || defined(USE_XTHREADS) || defined(BEOS_THREADS)) \ + && !defined(THREADS) +# define THREADS +#endif + +#ifdef VMS +#include +#endif + +/* + * POSIX threads. This should be your choice in the Unix world + * whenever possible. When building with POSIX threads, be sure + * to enable any compiler flags which will cause the MT-safe + * libc (if one exists) to be used when linking, as well as any + * header macros for MT-safe errno, etc. For Solaris, this is the -mt + * compiler flag. On Solaris with gcc, use -D_REENTRANT to enable + * proper compiling for MT-safe libc etc. + */ +#if defined(PTHREADS) +#include /* POSIX threads headers */ + +typedef struct { + pthread_key_t key; + int initMagic; +} _glthread_TSD; + +typedef pthread_t _glthread_Thread; + +typedef pthread_mutex_t _glthread_Mutex; + +#define _glthread_DECLARE_STATIC_MUTEX(name) \ + static _glthread_Mutex name = PTHREAD_MUTEX_INITIALIZER + +#define _glthread_INIT_MUTEX(name) \ + pthread_mutex_init(&(name), NULL) + +#define _glthread_DESTROY_MUTEX(name) \ + pthread_mutex_destroy(&(name)) + +#define _glthread_LOCK_MUTEX(name) \ + (void) pthread_mutex_lock(&(name)) + +#define _glthread_UNLOCK_MUTEX(name) \ + (void) pthread_mutex_unlock(&(name)) + +#endif /* PTHREADS */ + + + + +/* + * Solaris threads. Use only up to Solaris 2.4. + * Solaris 2.5 and higher provide POSIX threads. + * Be sure to compile with -mt on the Solaris compilers, or + * use -D_REENTRANT if using gcc. + */ +#ifdef SOLARIS_THREADS +#include + +typedef struct { + thread_key_t key; + mutex_t keylock; + int initMagic; +} _glthread_TSD; + +typedef thread_t _glthread_Thread; + +typedef mutex_t _glthread_Mutex; + +/* XXX need to really implement mutex-related macros */ +#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0 +#define _glthread_INIT_MUTEX(name) (void) name +#define _glthread_DESTROY_MUTEX(name) (void) name +#define _glthread_LOCK_MUTEX(name) (void) name +#define _glthread_UNLOCK_MUTEX(name) (void) name + +#endif /* SOLARIS_THREADS */ + + + + +/* + * Windows threads. Should work with Windows NT and 95. + * IMPORTANT: Link with multithreaded runtime library when THREADS are + * used! + */ +#ifdef WIN32_THREADS +#include + +typedef struct { + DWORD key; + int initMagic; +} _glthread_TSD; + +typedef HANDLE _glthread_Thread; + +typedef CRITICAL_SECTION _glthread_Mutex; + +/* XXX need to really implement mutex-related macros */ +#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0 +#define _glthread_INIT_MUTEX(name) (void) name +#define _glthread_DESTROY_MUTEX(name) (void) name +#define _glthread_LOCK_MUTEX(name) (void) name +#define _glthread_UNLOCK_MUTEX(name) (void) name + +#endif /* WIN32_THREADS */ + + + + +/* + * XFree86 has its own thread wrapper, Xthreads.h + * We wrap it again for GL. + */ +#ifdef USE_XTHREADS +#include + +typedef struct { + xthread_key_t key; + int initMagic; +} _glthread_TSD; + +typedef xthread_t _glthread_Thread; + +typedef xmutex_rec _glthread_Mutex; + +#ifdef XMUTEX_INITIALIZER +#define _glthread_DECLARE_STATIC_MUTEX(name) \ + static _glthread_Mutex name = XMUTEX_INITIALIZER +#else +#define _glthread_DECLARE_STATIC_MUTEX(name) \ + static _glthread_Mutex name +#endif + +#define _glthread_INIT_MUTEX(name) \ + xmutex_init(&(name)) + +#define _glthread_DESTROY_MUTEX(name) \ + xmutex_clear(&(name)) + +#define _glthread_LOCK_MUTEX(name) \ + (void) xmutex_lock(&(name)) + +#define _glthread_UNLOCK_MUTEX(name) \ + (void) xmutex_unlock(&(name)) + +#endif /* USE_XTHREADS */ + + + +/* + * BeOS threads. R5.x required. + */ +#ifdef BEOS_THREADS + +#include +#include + +typedef struct { + int32 key; + int initMagic; +} _glthread_TSD; + +typedef thread_id _glthread_Thread; + +/* Use Benaphore, aka speeder semaphore */ +typedef struct { + int32 lock; + sem_id sem; +} benaphore; +typedef benaphore _glthread_Mutex; + +#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = { 0, 0 } +#define _glthread_INIT_MUTEX(name) name.sem = create_sem(0, #name"_benaphore"), name.lock = 0 +#define _glthread_DESTROY_MUTEX(name) delete_sem(name.sem), name.lock = 0 +#define _glthread_LOCK_MUTEX(name) if (name.sem == 0) _glthread_INIT_MUTEX(name); \ + if (atomic_add(&(name.lock), 1) >= 1) acquire_sem(name.sem) +#define _glthread_UNLOCK_MUTEX(name) if (atomic_add(&(name.lock), -1) > 1) release_sem(name.sem) + +#endif /* BEOS_THREADS */ + + + +#ifndef THREADS + +/* + * THREADS not defined + */ + +typedef GLuint _glthread_TSD; + +typedef GLuint _glthread_Thread; + +typedef GLuint _glthread_Mutex; + +#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0 + +#define _glthread_INIT_MUTEX(name) (void) name + +#define _glthread_DESTROY_MUTEX(name) (void) name + +#define _glthread_LOCK_MUTEX(name) (void) name + +#define _glthread_UNLOCK_MUTEX(name) (void) name + +#endif /* THREADS */ + + + +/* + * Platform independent thread specific data API. + */ + +extern unsigned long +_glthread_GetID(void); + + +extern void +_glthread_InitTSD(_glthread_TSD *); + + +extern void * +_glthread_GetTSD(_glthread_TSD *); + + +extern void +_glthread_SetTSD(_glthread_TSD *, void *); + +#if defined(GLX_USE_TLS) + +extern __thread struct _glapi_table * _glapi_tls_Dispatch + __attribute__((tls_model("initial-exec"))); + +#define GET_DISPATCH() _glapi_tls_Dispatch + +#elif !defined(GL_CALL) +# if defined(THREADS) +# define GET_DISPATCH() \ + ((__builtin_expect( _glapi_Dispatch != NULL, 1 )) \ + ? _glapi_Dispatch : _glapi_get_dispatch()) +# else +# define GET_DISPATCH() _glapi_Dispatch +# endif /* defined(THREADS) */ +#endif /* ndef GL_CALL */ + + +#endif /* THREADS_H */ diff --git a/reactos/dll/mesa32/src/main/accum.c b/reactos/dll/mesa32/src/main/accum.c new file mode 100644 index 00000000000..2f7375bd3a0 --- /dev/null +++ b/reactos/dll/mesa32/src/main/accum.c @@ -0,0 +1,110 @@ +/* + * 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. + */ + +#include "glheader.h" +#include "accum.h" +#include "context.h" +#include "imports.h" +#include "macros.h" +#include "state.h" +#include "mtypes.h" + + +void GLAPIENTRY +_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) +{ + GLfloat tmp[4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + tmp[0] = CLAMP( red, -1.0F, 1.0F ); + tmp[1] = CLAMP( green, -1.0F, 1.0F ); + tmp[2] = CLAMP( blue, -1.0F, 1.0F ); + tmp[3] = CLAMP( alpha, -1.0F, 1.0F ); + + if (TEST_EQ_4V(tmp, ctx->Accum.ClearColor)) + return; + + FLUSH_VERTICES(ctx, _NEW_ACCUM); + COPY_4FV( ctx->Accum.ClearColor, tmp ); +} + + +void GLAPIENTRY +_mesa_Accum( GLenum op, GLfloat value ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + switch (op) { + case GL_ADD: + case GL_MULT: + case GL_ACCUM: + case GL_LOAD: + case GL_RETURN: + /* OK */ + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glAccum(op)"); + return; + } + + if (ctx->DrawBuffer->Visual.haveAccumBuffer == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glAccum(no accum buffer)"); + return; + } + + if (ctx->DrawBuffer != ctx->ReadBuffer) { + /* See GLX_SGI_make_current_read or WGL_ARB_make_current_read */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glAccum(different read/draw buffers)"); + return; + } + + if (ctx->NewState) + _mesa_update_state(ctx); + + if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { + _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, + "glAccum(incomplete framebuffer)"); + return; + } + + if (ctx->RenderMode == GL_RENDER) { + GLint x = ctx->DrawBuffer->_Xmin; + GLint y = ctx->DrawBuffer->_Ymin; + GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; + GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; + ctx->Driver.Accum(ctx, op, value, x, y, width, height); + } +} + + + +void +_mesa_init_accum( GLcontext *ctx ) +{ + /* Accumulate buffer group */ + ASSIGN_4V( ctx->Accum.ClearColor, 0.0, 0.0, 0.0, 0.0 ); +} diff --git a/reactos/dll/mesa32/src/main/accum.h b/reactos/dll/mesa32/src/main/accum.h new file mode 100644 index 00000000000..ce92688a5b9 --- /dev/null +++ b/reactos/dll/mesa32/src/main/accum.h @@ -0,0 +1,62 @@ +/** + * \file accum.h + * Accumulation buffer operations. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * 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 ACCUM_H +#define ACCUM_H + + +#include "mtypes.h" + +#if _HAVE_FULL_GL + +extern void GLAPIENTRY +_mesa_Accum( GLenum op, GLfloat value ); + + +extern void GLAPIENTRY +_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); + +extern void +_mesa_init_accum( GLcontext *ctx ); + +#else + +/** No-op */ +#define _mesa_init_accum( c ) ((void)0) + +#endif + +#endif diff --git a/reactos/dll/mesa32/src/main/api_arrayelt.c b/reactos/dll/mesa32/src/main/api_arrayelt.c new file mode 100644 index 00000000000..41adc1d1d29 --- /dev/null +++ b/reactos/dll/mesa32/src/main/api_arrayelt.c @@ -0,0 +1,796 @@ +/* + * 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. + */ + +/* Author: + * Keith Whitwell + */ + +#include "glheader.h" +#include "api_arrayelt.h" +#include "context.h" +#include "glapi.h" +#include "imports.h" +#include "macros.h" +#include "mtypes.h" +#include "glapioffsets.h" +#include "dispatch.h" + +typedef void (GLAPIENTRY *array_func)( const void * ); + +typedef struct { + const struct gl_client_array *array; + int offset; +} AEarray; + +typedef void (GLAPIENTRY *attrib_func)( GLuint indx, const void *data ); + +typedef struct { + const struct gl_client_array *array; + attrib_func func; + GLuint index; +} AEattrib; + +typedef struct { + AEarray arrays[32]; + AEattrib attribs[VERT_ATTRIB_MAX + 1]; + GLuint NewState; +} AEcontext; + +#define AE_CONTEXT(ctx) ((AEcontext *)(ctx)->aelt_context) + + +/* + * Convert GL_BYTE, GL_UNSIGNED_BYTE, .. GL_DOUBLE into an integer + * in the range [0, 7]. Luckily these type tokens are sequentially + * numbered in gl.h, except for GL_DOUBLE. + */ +#define TYPE_IDX(t) ( (t) == GL_DOUBLE ? 7 : (t) & 7 ) + +static const int ColorFuncs[2][8] = { + { + _gloffset_Color3bv, + _gloffset_Color3ubv, + _gloffset_Color3sv, + _gloffset_Color3usv, + _gloffset_Color3iv, + _gloffset_Color3uiv, + _gloffset_Color3fv, + _gloffset_Color3dv, + }, + { + _gloffset_Color4bv, + _gloffset_Color4ubv, + _gloffset_Color4sv, + _gloffset_Color4usv, + _gloffset_Color4iv, + _gloffset_Color4uiv, + _gloffset_Color4fv, + _gloffset_Color4dv, + }, +}; + +static const int VertexFuncs[3][8] = { + { + -1, + -1, + _gloffset_Vertex2sv, + -1, + _gloffset_Vertex2iv, + -1, + _gloffset_Vertex2fv, + _gloffset_Vertex2dv, + }, + { + -1, + -1, + _gloffset_Vertex3sv, + -1, + _gloffset_Vertex3iv, + -1, + _gloffset_Vertex3fv, + _gloffset_Vertex3dv, + }, + { + -1, + -1, + _gloffset_Vertex4sv, + -1, + _gloffset_Vertex4iv, + -1, + _gloffset_Vertex4fv, + _gloffset_Vertex4dv, + }, +}; + +static const int IndexFuncs[8] = { + -1, + _gloffset_Indexubv, + _gloffset_Indexsv, + -1, + _gloffset_Indexiv, + -1, + _gloffset_Indexfv, + _gloffset_Indexdv, +}; + +static const int NormalFuncs[8] = { + _gloffset_Normal3bv, + -1, + _gloffset_Normal3sv, + -1, + _gloffset_Normal3iv, + -1, + _gloffset_Normal3fv, + _gloffset_Normal3dv, +}; + +#if defined(IN_DRI_DRIVER) +static int SecondaryColorFuncs[8]; +static int FogCoordFuncs[8] = { + -1, + -1, + -1, + -1, + -1, + -1, + 0, + 0, +}; +#else +static const int SecondaryColorFuncs[8] = { + _gloffset_SecondaryColor3bvEXT, + _gloffset_SecondaryColor3ubvEXT, + _gloffset_SecondaryColor3svEXT, + _gloffset_SecondaryColor3usvEXT, + _gloffset_SecondaryColor3ivEXT, + _gloffset_SecondaryColor3uivEXT, + _gloffset_SecondaryColor3fvEXT, + _gloffset_SecondaryColor3dvEXT, +}; + +static const int FogCoordFuncs[8] = { + -1, + -1, + -1, + -1, + -1, + -1, + _gloffset_FogCoordfvEXT, + _gloffset_FogCoorddvEXT +}; +#endif + +/**********************************************************************/ + +/* GL_BYTE attributes */ + +static void GLAPIENTRY VertexAttrib1NbvNV(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]))); +} + +static void GLAPIENTRY VertexAttrib1bvNV(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); +} + +static void GLAPIENTRY VertexAttrib2NbvNV(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]))); +} + +static void GLAPIENTRY VertexAttrib2bvNV(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); +} + +static void GLAPIENTRY VertexAttrib3NbvNV(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), + BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2]))); +} + +static void GLAPIENTRY VertexAttrib3bvNV(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); +} + +static void GLAPIENTRY VertexAttrib4NbvNV(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), + BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2]), + BYTE_TO_FLOAT(v[3]))); +} + +static void GLAPIENTRY VertexAttrib4bvNV(GLuint index, const GLbyte *v) +{ + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); +} + +/* GL_UNSIGNED_BYTE attributes */ + +static void GLAPIENTRY VertexAttrib1NubvNV(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]))); +} + +static void GLAPIENTRY VertexAttrib1ubvNV(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); +} + +static void GLAPIENTRY VertexAttrib2NubvNV(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), + UBYTE_TO_FLOAT(v[1]))); +} + +static void GLAPIENTRY VertexAttrib2ubvNV(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); +} + +static void GLAPIENTRY VertexAttrib3NubvNV(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), + UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]))); +} +static void GLAPIENTRY VertexAttrib3ubvNV(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); +} + +static void GLAPIENTRY VertexAttrib4NubvNV(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), + UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), + UBYTE_TO_FLOAT(v[3]))); +} + +static void GLAPIENTRY VertexAttrib4ubvNV(GLuint index, const GLubyte *v) +{ + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); +} + +/* GL_SHORT attributes */ + +static void GLAPIENTRY VertexAttrib1NsvNV(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]))); +} + +static void GLAPIENTRY VertexAttrib1svNV(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); +} + +static void GLAPIENTRY VertexAttrib2NsvNV(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), + SHORT_TO_FLOAT(v[1]))); +} + +static void GLAPIENTRY VertexAttrib2svNV(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); +} + +static void GLAPIENTRY VertexAttrib3NsvNV(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), + SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2]))); +} + +static void GLAPIENTRY VertexAttrib3svNV(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); +} + +static void GLAPIENTRY VertexAttrib4NsvNV(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), + SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2]), + SHORT_TO_FLOAT(v[3]))); +} + +static void GLAPIENTRY VertexAttrib4svNV(GLuint index, const GLshort *v) +{ + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); +} + +/* GL_UNSIGNED_SHORT attributes */ + +static void GLAPIENTRY VertexAttrib1NusvNV(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]))); +} + +static void GLAPIENTRY VertexAttrib1usvNV(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); +} + +static void GLAPIENTRY VertexAttrib2NusvNV(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), + USHORT_TO_FLOAT(v[1]))); +} + +static void GLAPIENTRY VertexAttrib2usvNV(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); +} + +static void GLAPIENTRY VertexAttrib3NusvNV(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), + USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2]))); +} + +static void GLAPIENTRY VertexAttrib3usvNV(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); +} + +static void GLAPIENTRY VertexAttrib4NusvNV(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), + USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2]), + USHORT_TO_FLOAT(v[3]))); +} + +static void GLAPIENTRY VertexAttrib4usvNV(GLuint index, const GLushort *v) +{ + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); +} + +/* GL_INT attributes */ + +static void GLAPIENTRY VertexAttrib1NivNV(GLuint index, const GLint *v) +{ + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]))); +} + +static void GLAPIENTRY VertexAttrib1ivNV(GLuint index, const GLint *v) +{ + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); +} + +static void GLAPIENTRY VertexAttrib2NivNV(GLuint index, const GLint *v) +{ + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), + INT_TO_FLOAT(v[1]))); +} + +static void GLAPIENTRY VertexAttrib2ivNV(GLuint index, const GLint *v) +{ + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); +} + +static void GLAPIENTRY VertexAttrib3NivNV(GLuint index, const GLint *v) +{ + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), + INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2]))); +} + +static void GLAPIENTRY VertexAttrib3ivNV(GLuint index, const GLint *v) +{ + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); +} + +static void GLAPIENTRY VertexAttrib4NivNV(GLuint index, const GLint *v) +{ + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), + INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2]), + INT_TO_FLOAT(v[3]))); +} + +static void GLAPIENTRY VertexAttrib4ivNV(GLuint index, const GLint *v) +{ + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); +} + +/* GL_UNSIGNED_INT attributes */ + +static void GLAPIENTRY VertexAttrib1NuivNV(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]))); +} + +static void GLAPIENTRY VertexAttrib1uivNV(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); +} + +static void GLAPIENTRY VertexAttrib2NuivNV(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), + UINT_TO_FLOAT(v[1]))); +} + +static void GLAPIENTRY VertexAttrib2uivNV(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); +} + +static void GLAPIENTRY VertexAttrib3NuivNV(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), + UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2]))); +} + +static void GLAPIENTRY VertexAttrib3uivNV(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); +} + +static void GLAPIENTRY VertexAttrib4NuivNV(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), + UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2]), + UINT_TO_FLOAT(v[3]))); +} + +static void GLAPIENTRY VertexAttrib4uivNV(GLuint index, const GLuint *v) +{ + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); +} + +/* GL_FLOAT attributes */ + +static void GLAPIENTRY VertexAttrib1fvNV(GLuint index, const GLfloat *v) +{ + CALL_VertexAttrib1fvNV(GET_DISPATCH(), (index, v)); +} + +static void GLAPIENTRY VertexAttrib2fvNV(GLuint index, const GLfloat *v) +{ + CALL_VertexAttrib2fvNV(GET_DISPATCH(), (index, v)); +} + +static void GLAPIENTRY VertexAttrib3fvNV(GLuint index, const GLfloat *v) +{ + CALL_VertexAttrib3fvNV(GET_DISPATCH(), (index, v)); +} + +static void GLAPIENTRY VertexAttrib4fvNV(GLuint index, const GLfloat *v) +{ + CALL_VertexAttrib4fvNV(GET_DISPATCH(), (index, v)); +} + +/* GL_DOUBLE attributes */ + +static void GLAPIENTRY VertexAttrib1dvNV(GLuint index, const GLdouble *v) +{ + CALL_VertexAttrib1dvNV(GET_DISPATCH(), (index, v)); +} + +static void GLAPIENTRY VertexAttrib2dvNV(GLuint index, const GLdouble *v) +{ + CALL_VertexAttrib2dvNV(GET_DISPATCH(), (index, v)); +} + +static void GLAPIENTRY VertexAttrib3dvNV(GLuint index, const GLdouble *v) +{ + CALL_VertexAttrib3dvNV(GET_DISPATCH(), (index, v)); +} + +static void GLAPIENTRY VertexAttrib4dvNV(GLuint index, const GLdouble *v) +{ + CALL_VertexAttrib4dvNV(GET_DISPATCH(), (index, v)); +} + + +/* + * Array [size][type] of VertexAttrib functions + */ +static attrib_func AttribFuncsNV[2][4][8] = { + { + /* non-normalized */ + { + /* size 1 */ + (attrib_func) VertexAttrib1bvNV, + (attrib_func) VertexAttrib1ubvNV, + (attrib_func) VertexAttrib1svNV, + (attrib_func) VertexAttrib1usvNV, + (attrib_func) VertexAttrib1ivNV, + (attrib_func) VertexAttrib1uivNV, + (attrib_func) VertexAttrib1fvNV, + (attrib_func) VertexAttrib1dvNV + }, + { + /* size 2 */ + (attrib_func) VertexAttrib2bvNV, + (attrib_func) VertexAttrib2ubvNV, + (attrib_func) VertexAttrib2svNV, + (attrib_func) VertexAttrib2usvNV, + (attrib_func) VertexAttrib2ivNV, + (attrib_func) VertexAttrib2uivNV, + (attrib_func) VertexAttrib2fvNV, + (attrib_func) VertexAttrib2dvNV + }, + { + /* size 3 */ + (attrib_func) VertexAttrib3bvNV, + (attrib_func) VertexAttrib3ubvNV, + (attrib_func) VertexAttrib3svNV, + (attrib_func) VertexAttrib3usvNV, + (attrib_func) VertexAttrib3ivNV, + (attrib_func) VertexAttrib3uivNV, + (attrib_func) VertexAttrib3fvNV, + (attrib_func) VertexAttrib3dvNV + }, + { + /* size 4 */ + (attrib_func) VertexAttrib4bvNV, + (attrib_func) VertexAttrib4ubvNV, + (attrib_func) VertexAttrib4svNV, + (attrib_func) VertexAttrib4usvNV, + (attrib_func) VertexAttrib4ivNV, + (attrib_func) VertexAttrib4uivNV, + (attrib_func) VertexAttrib4fvNV, + (attrib_func) VertexAttrib4dvNV + } + }, + { + /* normalized (except for float/double) */ + { + /* size 1 */ + (attrib_func) VertexAttrib1NbvNV, + (attrib_func) VertexAttrib1NubvNV, + (attrib_func) VertexAttrib1NsvNV, + (attrib_func) VertexAttrib1NusvNV, + (attrib_func) VertexAttrib1NivNV, + (attrib_func) VertexAttrib1NuivNV, + (attrib_func) VertexAttrib1fvNV, + (attrib_func) VertexAttrib1dvNV + }, + { + /* size 2 */ + (attrib_func) VertexAttrib2NbvNV, + (attrib_func) VertexAttrib2NubvNV, + (attrib_func) VertexAttrib2NsvNV, + (attrib_func) VertexAttrib2NusvNV, + (attrib_func) VertexAttrib2NivNV, + (attrib_func) VertexAttrib2NuivNV, + (attrib_func) VertexAttrib2fvNV, + (attrib_func) VertexAttrib2dvNV + }, + { + /* size 3 */ + (attrib_func) VertexAttrib3NbvNV, + (attrib_func) VertexAttrib3NubvNV, + (attrib_func) VertexAttrib3NsvNV, + (attrib_func) VertexAttrib3NusvNV, + (attrib_func) VertexAttrib3NivNV, + (attrib_func) VertexAttrib3NuivNV, + (attrib_func) VertexAttrib3fvNV, + (attrib_func) VertexAttrib3dvNV + }, + { + /* size 4 */ + (attrib_func) VertexAttrib4NbvNV, + (attrib_func) VertexAttrib4NubvNV, + (attrib_func) VertexAttrib4NsvNV, + (attrib_func) VertexAttrib4NusvNV, + (attrib_func) VertexAttrib4NivNV, + (attrib_func) VertexAttrib4NuivNV, + (attrib_func) VertexAttrib4fvNV, + (attrib_func) VertexAttrib4dvNV + } + } +}; + +/**********************************************************************/ + + +GLboolean _ae_create_context( GLcontext *ctx ) +{ + if (ctx->aelt_context) + return GL_TRUE; + +#if defined(IN_DRI_DRIVER) + SecondaryColorFuncs[0] = _gloffset_SecondaryColor3bvEXT; + SecondaryColorFuncs[1] = _gloffset_SecondaryColor3ubvEXT; + SecondaryColorFuncs[2] = _gloffset_SecondaryColor3svEXT; + SecondaryColorFuncs[3] = _gloffset_SecondaryColor3usvEXT; + SecondaryColorFuncs[4] = _gloffset_SecondaryColor3ivEXT; + SecondaryColorFuncs[5] = _gloffset_SecondaryColor3uivEXT; + SecondaryColorFuncs[6] = _gloffset_SecondaryColor3fvEXT; + SecondaryColorFuncs[7] = _gloffset_SecondaryColor3dvEXT; + + FogCoordFuncs[6] = _gloffset_FogCoordfvEXT; + FogCoordFuncs[7] = _gloffset_FogCoorddvEXT; +#endif + + ctx->aelt_context = MALLOC( sizeof(AEcontext) ); + if (!ctx->aelt_context) + return GL_FALSE; + + AE_CONTEXT(ctx)->NewState = ~0; + return GL_TRUE; +} + + +void _ae_destroy_context( GLcontext *ctx ) +{ + if ( AE_CONTEXT( ctx ) ) { + FREE( ctx->aelt_context ); + ctx->aelt_context = NULL; + } +} + + +/** + * Make a list of per-vertex functions to call for each glArrayElement call. + * These functions access the array data (i.e. glVertex, glColor, glNormal, + * etc). + * Note: this may be called during display list construction. + */ +static void _ae_update_state( GLcontext *ctx ) +{ + AEcontext *actx = AE_CONTEXT(ctx); + AEarray *aa = actx->arrays; + AEattrib *at = actx->attribs; + GLuint i; + + /* conventional vertex arrays */ + if (ctx->Array.Index.Enabled) { + aa->array = &ctx->Array.Index; + aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)]; + aa++; + } + if (ctx->Array.EdgeFlag.Enabled) { + aa->array = &ctx->Array.EdgeFlag; + aa->offset = _gloffset_EdgeFlagv; + aa++; + } + if (ctx->Array.Normal.Enabled) { + aa->array = &ctx->Array.Normal; + aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)]; + aa++; + } + if (ctx->Array.Color.Enabled) { + aa->array = &ctx->Array.Color; + aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)]; + aa++; + } + if (ctx->Array.SecondaryColor.Enabled) { + aa->array = &ctx->Array.SecondaryColor; + aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)]; + aa++; + } + if (ctx->Array.FogCoord.Enabled) { + aa->array = &ctx->Array.FogCoord; + aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)]; + aa++; + } + for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { + if (ctx->Array.TexCoord[i].Enabled) { + /* NOTE: we use generic glVertexAttrib functions here. + * If we ever de-alias conventional/generic vertex attribs this + * will have to change. + */ + struct gl_client_array *attribArray = &ctx->Array.TexCoord[i]; + at->array = attribArray; + at->func = AttribFuncsNV[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)]; + at->index = VERT_ATTRIB_TEX0 + i; + at++; + } + } + + /* generic vertex attribute arrays */ + for (i = 1; i < VERT_ATTRIB_MAX; i++) { /* skip zero! */ + if (ctx->Array.VertexAttrib[i].Enabled) { + struct gl_client_array *attribArray = &ctx->Array.VertexAttrib[i]; + at->array = attribArray; + /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV + * function pointer here (for float arrays) since the pointer may + * change from one execution of _ae_loopback_array_elt() to + * the next. Doing so caused UT to break. + */ + at->func = AttribFuncsNV[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)]; + at->index = i; + at++; + } + } + + /* finally, vertex position */ + if (ctx->Array.VertexAttrib[0].Enabled) { + /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's + * issued as the last (proviking) attribute). + */ + aa->array = &ctx->Array.VertexAttrib[0]; + assert(aa->array->Size >= 2); /* XXX fix someday? */ + aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; + aa++; + } + else if (ctx->Array.Vertex.Enabled) { + aa->array = &ctx->Array.Vertex; + aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; + aa++; + } + + ASSERT(at - actx->attribs <= VERT_ATTRIB_MAX); + ASSERT(aa - actx->arrays < 32); + at->func = NULL; /* terminate the list */ + aa->offset = -1; /* terminate the list */ + + actx->NewState = 0; +} + + +/** + * Called via glArrayElement() and glDrawArrays(). + * Issue the glNormal, glVertex, glColor, glVertexAttrib, etc functions + * for all enabled vertex arrays (for elt-th element). + * Note: this may be called during display list construction. + */ +void GLAPIENTRY _ae_loopback_array_elt( GLint elt ) +{ + GET_CURRENT_CONTEXT(ctx); + const AEcontext *actx = AE_CONTEXT(ctx); + const AEarray *aa; + const AEattrib *at; + const struct _glapi_table * const disp = GET_DISPATCH(); + + + if (actx->NewState) + _ae_update_state( ctx ); + + /* generic attributes */ + for (at = actx->attribs; at->func; at++) { + const GLubyte *src = at->array->BufferObj->Data + + (uintptr_t) at->array->Ptr + + elt * at->array->StrideB; + at->func( at->index, src ); + } + + /* conventional arrays */ + for (aa = actx->arrays; aa->offset != -1 ; aa++) { + const GLubyte *src = aa->array->BufferObj->Data + + (uintptr_t) aa->array->Ptr + + elt * aa->array->StrideB; + CALL_by_offset( disp, (array_func), aa->offset, + ((const void *) src) ); + } +} + + +void _ae_invalidate_state( GLcontext *ctx, GLuint new_state ) +{ + AE_CONTEXT(ctx)->NewState |= new_state; +} diff --git a/reactos/dll/mesa32/src/main/api_arrayelt.h b/reactos/dll/mesa32/src/main/api_arrayelt.h new file mode 100644 index 00000000000..1c0af9f3ea8 --- /dev/null +++ b/reactos/dll/mesa32/src/main/api_arrayelt.h @@ -0,0 +1,37 @@ + +/* + * 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 API_ARRAYELT_H +#define API_ARRAYELT_H + +#include "mtypes.h" + +extern GLboolean _ae_create_context( GLcontext *ctx ); +extern void _ae_destroy_context( GLcontext *ctx ); +extern void _ae_invalidate_state( GLcontext *ctx, GLuint new_state ); +extern void GLAPIENTRY _ae_loopback_array_elt( GLint elt ); + +#endif diff --git a/reactos/dll/mesa32/src/main/api_eval.h b/reactos/dll/mesa32/src/main/api_eval.h new file mode 100644 index 00000000000..d6cb38c9f8c --- /dev/null +++ b/reactos/dll/mesa32/src/main/api_eval.h @@ -0,0 +1,42 @@ + +/* + * 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 API_EVAL_H +#define API_EVAL_H + +#include "mtypes.h" + +extern void _mesa_EvalPoint1( GLint i ); +extern void _mesa_EvalPoint2( GLint i, GLint j ); +extern void _mesa_EvalCoord1f( GLfloat u ); +extern void _mesa_EvalCoord2f( GLfloat u, GLfloat v ); +extern void _mesa_EvalCoord1fv( const GLfloat *u ); +extern void _mesa_EvalCoord2fv( const GLfloat *u ); + +#endif + + + diff --git a/reactos/dll/mesa32/src/main/api_loopback.c b/reactos/dll/mesa32/src/main/api_loopback.c new file mode 100644 index 00000000000..db30059e61d --- /dev/null +++ b/reactos/dll/mesa32/src/main/api_loopback.c @@ -0,0 +1,1647 @@ +/** + * \file api_loopback.c + * + * \author Keith Whitwell + */ + +/* + * 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. + */ + + +#include "glheader.h" +#include "glapi.h" +#include "glapitable.h" +#include "macros.h" +#include "colormac.h" +#include "api_loopback.h" +#include "glthread.h" +#include "mtypes.h" +#include "dispatch.h" + +/* KW: A set of functions to convert unusual Color/Normal/Vertex/etc + * calls to a smaller set of driver-provided formats. Currently just + * go back to dispatch to find these (eg. call glNormal3f directly), + * hence 'loopback'. + * + * The driver must supply all of the remaining entry points, which are + * listed in dd.h. The easiest way for a driver to do this is to + * install the supplied software t&l module. + */ +#define COLORF(r,g,b,a) CALL_Color4f(GET_DISPATCH(), (r,g,b,a)) +#define VERTEX2(x,y) CALL_Vertex2f(GET_DISPATCH(), (x,y)) +#define VERTEX3(x,y,z) CALL_Vertex3f(GET_DISPATCH(), (x,y,z)) +#define VERTEX4(x,y,z,w) CALL_Vertex4f(GET_DISPATCH(), (x,y,z,w)) +#define NORMAL(x,y,z) CALL_Normal3f(GET_DISPATCH(), (x,y,z)) +#define TEXCOORD1(s) CALL_TexCoord1f(GET_DISPATCH(), (s)) +#define TEXCOORD2(s,t) CALL_TexCoord2f(GET_DISPATCH(), (s,t)) +#define TEXCOORD3(s,t,u) CALL_TexCoord3f(GET_DISPATCH(), (s,t,u)) +#define TEXCOORD4(s,t,u,v) CALL_TexCoord4f(GET_DISPATCH(), (s,t,u,v)) +#define INDEX(c) CALL_Indexf(GET_DISPATCH(), (c)) +#define MULTI_TEXCOORD1(z,s) CALL_MultiTexCoord1fARB(GET_DISPATCH(), (z,s)) +#define MULTI_TEXCOORD2(z,s,t) CALL_MultiTexCoord2fARB(GET_DISPATCH(), (z,s,t)) +#define MULTI_TEXCOORD3(z,s,t,u) CALL_MultiTexCoord3fARB(GET_DISPATCH(), (z,s,t,u)) +#define MULTI_TEXCOORD4(z,s,t,u,v) CALL_MultiTexCoord4fARB(GET_DISPATCH(), (z,s,t,u,v)) +#define EVALCOORD1(x) CALL_EvalCoord1f(GET_DISPATCH(), (x)) +#define EVALCOORD2(x,y) CALL_EvalCoord2f(GET_DISPATCH(), (x,y)) +#define MATERIALFV(a,b,c) CALL_Materialfv(GET_DISPATCH(), (a,b,c)) +#define RECTF(a,b,c,d) CALL_Rectf(GET_DISPATCH(), (a,b,c,d)) + +#define ATTRIB1NV(index,x) CALL_VertexAttrib1fNV(GET_DISPATCH(), (index,x)) +#define ATTRIB2NV(index,x,y) CALL_VertexAttrib2fNV(GET_DISPATCH(), (index,x,y)) +#define ATTRIB3NV(index,x,y,z) CALL_VertexAttrib3fNV(GET_DISPATCH(), (index,x,y,z)) +#define ATTRIB4NV(index,x,y,z,w) CALL_VertexAttrib4fNV(GET_DISPATCH(), (index,x,y,z,w)) +#define ATTRIB1ARB(index,x) CALL_VertexAttrib1fARB(GET_DISPATCH(), (index,x)) +#define ATTRIB2ARB(index,x,y) CALL_VertexAttrib2fARB(GET_DISPATCH(), (index,x,y)) +#define ATTRIB3ARB(index,x,y,z) CALL_VertexAttrib3fARB(GET_DISPATCH(), (index,x,y,z)) +#define ATTRIB4ARB(index,x,y,z,w) CALL_VertexAttrib4fARB(GET_DISPATCH(), (index,x,y,z,w)) +#define FOGCOORDF(x) CALL_FogCoordfEXT(GET_DISPATCH(), (x)) +#define SECONDARYCOLORF(a,b,c) CALL_SecondaryColor3fEXT(GET_DISPATCH(), (a,b,c)) + +static void GLAPIENTRY +loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue ) +{ + COLORF( BYTE_TO_FLOAT(red), + BYTE_TO_FLOAT(green), + BYTE_TO_FLOAT(blue), + 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3d_f( GLdouble red, GLdouble green, GLdouble blue ) +{ + COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3i_f( GLint red, GLint green, GLint blue ) +{ + COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), + INT_TO_FLOAT(blue), 1.0); +} + +static void GLAPIENTRY +loopback_Color3s_f( GLshort red, GLshort green, GLshort blue ) +{ + COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), + SHORT_TO_FLOAT(blue), 1.0); +} + +static void GLAPIENTRY +loopback_Color3ui_f( GLuint red, GLuint green, GLuint blue ) +{ + COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), + UINT_TO_FLOAT(blue), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3us_f( GLushort red, GLushort green, GLushort blue ) +{ + COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), + USHORT_TO_FLOAT(blue), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3ub_f( GLubyte red, GLubyte green, GLubyte blue ) +{ + COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), + UBYTE_TO_FLOAT(blue), 1.0 ); +} + + +static void GLAPIENTRY +loopback_Color3bv_f( const GLbyte *v ) +{ + COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2]), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3dv_f( const GLdouble *v ) +{ + COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3iv_f( const GLint *v ) +{ + COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) ); +} + +static void GLAPIENTRY +loopback_Color3sv_f( const GLshort *v ) +{ + COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2]), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3uiv_f( const GLuint *v ) +{ + COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2]), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3usv_f( const GLushort *v ) +{ + COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2]), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3ubv_f( const GLubyte *v ) +{ + COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), 1.0 ); +} + + +static void GLAPIENTRY +loopback_Color4b_f( GLbyte red, GLbyte green, GLbyte blue, + GLbyte alpha ) +{ + COLORF( BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green), + BYTE_TO_FLOAT(blue), BYTE_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4d_f( GLdouble red, GLdouble green, GLdouble blue, + GLdouble alpha ) +{ + COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, (GLfloat) alpha ); +} + +static void GLAPIENTRY +loopback_Color4i_f( GLint red, GLint green, GLint blue, GLint alpha ) +{ + COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), + INT_TO_FLOAT(blue), INT_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4s_f( GLshort red, GLshort green, GLshort blue, + GLshort alpha ) +{ + COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), + SHORT_TO_FLOAT(blue), SHORT_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4ui_f( GLuint red, GLuint green, GLuint blue, GLuint alpha ) +{ + COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), + UINT_TO_FLOAT(blue), UINT_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4us_f( GLushort red, GLushort green, GLushort blue, GLushort alpha ) +{ + COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), + USHORT_TO_FLOAT(blue), USHORT_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4ub_f( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) +{ + COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), + UBYTE_TO_FLOAT(blue), UBYTE_TO_FLOAT(alpha) ); +} + + +static void GLAPIENTRY +loopback_Color4iv_f( const GLint *v ) +{ + COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) ); +} + + +static void GLAPIENTRY +loopback_Color4bv_f( const GLbyte *v ) +{ + COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]) ); +} + +static void GLAPIENTRY +loopback_Color4dv_f( const GLdouble *v ) +{ + COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); +} + + +static void GLAPIENTRY +loopback_Color4sv_f( const GLshort *v) +{ + COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3]) ); +} + + +static void GLAPIENTRY +loopback_Color4uiv_f( const GLuint *v) +{ + COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]) ); +} + +static void GLAPIENTRY +loopback_Color4usv_f( const GLushort *v) +{ + COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]) ); +} + +static void GLAPIENTRY +loopback_Color4ubv_f( const GLubyte *v) +{ + COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]) ); +} + +static void GLAPIENTRY +loopback_FogCoorddEXT( GLdouble d ) +{ + FOGCOORDF( (GLfloat) d ); +} + +static void GLAPIENTRY +loopback_FogCoorddvEXT( const GLdouble *v ) +{ + FOGCOORDF( (GLfloat) *v ); +} + + +static void GLAPIENTRY +loopback_Indexd( GLdouble c ) +{ + INDEX( (GLfloat) c ); +} + +static void GLAPIENTRY +loopback_Indexi( GLint c ) +{ + INDEX( (GLfloat) c ); +} + +static void GLAPIENTRY +loopback_Indexs( GLshort c ) +{ + INDEX( (GLfloat) c ); +} + +static void GLAPIENTRY +loopback_Indexub( GLubyte c ) +{ + INDEX( (GLfloat) c ); +} + +static void GLAPIENTRY +loopback_Indexdv( const GLdouble *c ) +{ + INDEX( (GLfloat) *c ); +} + +static void GLAPIENTRY +loopback_Indexiv( const GLint *c ) +{ + INDEX( (GLfloat) *c ); +} + +static void GLAPIENTRY +loopback_Indexsv( const GLshort *c ) +{ + INDEX( (GLfloat) *c ); +} + +static void GLAPIENTRY +loopback_Indexubv( const GLubyte *c ) +{ + INDEX( (GLfloat) *c ); +} + +static void GLAPIENTRY +loopback_Normal3b( GLbyte nx, GLbyte ny, GLbyte nz ) +{ + NORMAL( BYTE_TO_FLOAT(nx), BYTE_TO_FLOAT(ny), BYTE_TO_FLOAT(nz) ); +} + +static void GLAPIENTRY +loopback_Normal3d( GLdouble nx, GLdouble ny, GLdouble nz ) +{ + NORMAL((GLfloat) nx, (GLfloat) ny, (GLfloat) nz); +} + +static void GLAPIENTRY +loopback_Normal3i( GLint nx, GLint ny, GLint nz ) +{ + NORMAL( INT_TO_FLOAT(nx), INT_TO_FLOAT(ny), INT_TO_FLOAT(nz) ); +} + +static void GLAPIENTRY +loopback_Normal3s( GLshort nx, GLshort ny, GLshort nz ) +{ + NORMAL( SHORT_TO_FLOAT(nx), SHORT_TO_FLOAT(ny), SHORT_TO_FLOAT(nz) ); +} + +static void GLAPIENTRY +loopback_Normal3bv( const GLbyte *v ) +{ + NORMAL( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]) ); +} + +static void GLAPIENTRY +loopback_Normal3dv( const GLdouble *v ) +{ + NORMAL( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_Normal3iv( const GLint *v ) +{ + NORMAL( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]) ); +} + +static void GLAPIENTRY +loopback_Normal3sv( const GLshort *v ) +{ + NORMAL( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]) ); +} + +static void GLAPIENTRY +loopback_TexCoord1d( GLdouble s ) +{ + TEXCOORD1((GLfloat) s); +} + +static void GLAPIENTRY +loopback_TexCoord1i( GLint s ) +{ + TEXCOORD1((GLfloat) s); +} + +static void GLAPIENTRY +loopback_TexCoord1s( GLshort s ) +{ + TEXCOORD1((GLfloat) s); +} + +static void GLAPIENTRY +loopback_TexCoord2d( GLdouble s, GLdouble t ) +{ + TEXCOORD2((GLfloat) s,(GLfloat) t); +} + +static void GLAPIENTRY +loopback_TexCoord2s( GLshort s, GLshort t ) +{ + TEXCOORD2((GLfloat) s,(GLfloat) t); +} + +static void GLAPIENTRY +loopback_TexCoord2i( GLint s, GLint t ) +{ + TEXCOORD2((GLfloat) s,(GLfloat) t); +} + +static void GLAPIENTRY +loopback_TexCoord3d( GLdouble s, GLdouble t, GLdouble r ) +{ + TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); +} + +static void GLAPIENTRY +loopback_TexCoord3i( GLint s, GLint t, GLint r ) +{ + TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); +} + +static void GLAPIENTRY +loopback_TexCoord3s( GLshort s, GLshort t, GLshort r ) +{ + TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); +} + +static void GLAPIENTRY +loopback_TexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) +{ + TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); +} + +static void GLAPIENTRY +loopback_TexCoord4i( GLint s, GLint t, GLint r, GLint q ) +{ + TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); +} + +static void GLAPIENTRY +loopback_TexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ) +{ + TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); +} + +static void GLAPIENTRY +loopback_TexCoord1dv( const GLdouble *v ) +{ + TEXCOORD1((GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_TexCoord1iv( const GLint *v ) +{ + TEXCOORD1((GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_TexCoord1sv( const GLshort *v ) +{ + TEXCOORD1((GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_TexCoord2dv( const GLdouble *v ) +{ + TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_TexCoord2iv( const GLint *v ) +{ + TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_TexCoord2sv( const GLshort *v ) +{ + TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_TexCoord3dv( const GLdouble *v ) +{ + TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_TexCoord3iv( const GLint *v ) +{ + TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_TexCoord3sv( const GLshort *v ) +{ + TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_TexCoord4dv( const GLdouble *v ) +{ + TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_TexCoord4iv( const GLint *v ) +{ + TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_TexCoord4sv( const GLshort *v ) +{ + TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_Vertex2d( GLdouble x, GLdouble y ) +{ + VERTEX2( (GLfloat) x, (GLfloat) y ); +} + +static void GLAPIENTRY +loopback_Vertex2i( GLint x, GLint y ) +{ + VERTEX2( (GLfloat) x, (GLfloat) y ); +} + +static void GLAPIENTRY +loopback_Vertex2s( GLshort x, GLshort y ) +{ + VERTEX2( (GLfloat) x, (GLfloat) y ); +} + +static void GLAPIENTRY +loopback_Vertex3d( GLdouble x, GLdouble y, GLdouble z ) +{ + VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); +} + +static void GLAPIENTRY +loopback_Vertex3i( GLint x, GLint y, GLint z ) +{ + VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); +} + +static void GLAPIENTRY +loopback_Vertex3s( GLshort x, GLshort y, GLshort z ) +{ + VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); +} + +static void GLAPIENTRY +loopback_Vertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) +{ + VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); +} + +static void GLAPIENTRY +loopback_Vertex4i( GLint x, GLint y, GLint z, GLint w ) +{ + VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); +} + +static void GLAPIENTRY +loopback_Vertex4s( GLshort x, GLshort y, GLshort z, GLshort w ) +{ + VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); +} + +static void GLAPIENTRY +loopback_Vertex2dv( const GLdouble *v ) +{ + VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_Vertex2iv( const GLint *v ) +{ + VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_Vertex2sv( const GLshort *v ) +{ + VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_Vertex3dv( const GLdouble *v ) +{ + VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_Vertex3iv( const GLint *v ) +{ + VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_Vertex3sv( const GLshort *v ) +{ + VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_Vertex4dv( const GLdouble *v ) +{ + VERTEX4( (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_Vertex4iv( const GLint *v ) +{ + VERTEX4( (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_Vertex4sv( const GLshort *v ) +{ + VERTEX4( (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1dARB(GLenum target, GLdouble s) +{ + MULTI_TEXCOORD1( target, (GLfloat) s ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1dvARB(GLenum target, const GLdouble *v) +{ + MULTI_TEXCOORD1( target, (GLfloat) v[0] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1iARB(GLenum target, GLint s) +{ + MULTI_TEXCOORD1( target, (GLfloat) s ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1ivARB(GLenum target, const GLint *v) +{ + MULTI_TEXCOORD1( target, (GLfloat) v[0] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1sARB(GLenum target, GLshort s) +{ + MULTI_TEXCOORD1( target, (GLfloat) s ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1svARB(GLenum target, const GLshort *v) +{ + MULTI_TEXCOORD1( target, (GLfloat) v[0] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t) +{ + MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2dvARB(GLenum target, const GLdouble *v) +{ + MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2iARB(GLenum target, GLint s, GLint t) +{ + MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2ivARB(GLenum target, const GLint *v) +{ + MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2sARB(GLenum target, GLshort s, GLshort t) +{ + MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2svARB(GLenum target, const GLshort *v) +{ + MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r) +{ + MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3dvARB(GLenum target, const GLdouble *v) +{ + MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r) +{ + MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3ivARB(GLenum target, const GLint *v) +{ + MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r) +{ + MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3svARB(GLenum target, const GLshort *v) +{ + MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) +{ + MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, + (GLfloat) r, (GLfloat) q ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4dvARB(GLenum target, const GLdouble *v) +{ + MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q) +{ + MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, + (GLfloat) r, (GLfloat) q ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4ivARB(GLenum target, const GLint *v) +{ + MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) +{ + MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, + (GLfloat) r, (GLfloat) q ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4svARB(GLenum target, const GLshort *v) +{ + MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_EvalCoord2dv( const GLdouble *u ) +{ + EVALCOORD2( (GLfloat) u[0], (GLfloat) u[1] ); +} + +static void GLAPIENTRY +loopback_EvalCoord2fv( const GLfloat *u ) +{ + EVALCOORD2( u[0], u[1] ); +} + +static void GLAPIENTRY +loopback_EvalCoord2d( GLdouble u, GLdouble v ) +{ + EVALCOORD2( (GLfloat) u, (GLfloat) v ); +} + +static void GLAPIENTRY +loopback_EvalCoord1dv( const GLdouble *u ) +{ + EVALCOORD1( (GLfloat) *u ); +} + +static void GLAPIENTRY +loopback_EvalCoord1fv( const GLfloat *u ) +{ + EVALCOORD1( (GLfloat) *u ); +} + +static void GLAPIENTRY +loopback_EvalCoord1d( GLdouble u ) +{ + EVALCOORD1( (GLfloat) u ); +} + +static void GLAPIENTRY +loopback_Materialf( GLenum face, GLenum pname, GLfloat param ) +{ + GLfloat fparam[4]; + fparam[0] = param; + MATERIALFV( face, pname, fparam ); +} + +static void GLAPIENTRY +loopback_Materiali(GLenum face, GLenum pname, GLint param ) +{ + GLfloat p = (GLfloat) param; + MATERIALFV(face, pname, &p); +} + +static void GLAPIENTRY +loopback_Materialiv(GLenum face, GLenum pname, const GLint *params ) +{ + GLfloat fparam[4]; + switch (pname) { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_EMISSION: + case GL_AMBIENT_AND_DIFFUSE: + 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_SHININESS: + fparam[0] = (GLfloat) params[0]; + break; + case GL_COLOR_INDEXES: + fparam[0] = (GLfloat) params[0]; + fparam[1] = (GLfloat) params[1]; + fparam[2] = (GLfloat) params[2]; + break; + default: + ; + } + MATERIALFV(face, pname, fparam); +} + + +static void GLAPIENTRY +loopback_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) +{ + RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); +} + +static void GLAPIENTRY +loopback_Rectdv(const GLdouble *v1, const GLdouble *v2) +{ + RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); +} + +static void GLAPIENTRY +loopback_Rectfv(const GLfloat *v1, const GLfloat *v2) +{ + RECTF(v1[0], v1[1], v2[0], v2[1]); +} + +static void GLAPIENTRY +loopback_Recti(GLint x1, GLint y1, GLint x2, GLint y2) +{ + RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); +} + +static void GLAPIENTRY +loopback_Rectiv(const GLint *v1, const GLint *v2) +{ + RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); +} + +static void GLAPIENTRY +loopback_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2) +{ + RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); +} + +static void GLAPIENTRY +loopback_Rectsv(const GLshort *v1, const GLshort *v2) +{ + RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); +} + +static void GLAPIENTRY +loopback_SecondaryColor3bEXT_f( GLbyte red, GLbyte green, GLbyte blue ) +{ + SECONDARYCOLORF( BYTE_TO_FLOAT(red), + BYTE_TO_FLOAT(green), + BYTE_TO_FLOAT(blue) ); +} + +static void GLAPIENTRY +loopback_SecondaryColor3dEXT_f( GLdouble red, GLdouble green, GLdouble blue ) +{ + SECONDARYCOLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue ); +} + +static void GLAPIENTRY +loopback_SecondaryColor3iEXT_f( GLint red, GLint green, GLint blue ) +{ + SECONDARYCOLORF( INT_TO_FLOAT(red), + INT_TO_FLOAT(green), + INT_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3sEXT_f( GLshort red, GLshort green, GLshort blue ) +{ + SECONDARYCOLORF(SHORT_TO_FLOAT(red), + SHORT_TO_FLOAT(green), + SHORT_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3uiEXT_f( GLuint red, GLuint green, GLuint blue ) +{ + SECONDARYCOLORF(UINT_TO_FLOAT(red), + UINT_TO_FLOAT(green), + UINT_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3usEXT_f( GLushort red, GLushort green, GLushort blue ) +{ + SECONDARYCOLORF(USHORT_TO_FLOAT(red), + USHORT_TO_FLOAT(green), + USHORT_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3ubEXT_f( GLubyte red, GLubyte green, GLubyte blue ) +{ + SECONDARYCOLORF(UBYTE_TO_FLOAT(red), + UBYTE_TO_FLOAT(green), + UBYTE_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3bvEXT_f( const GLbyte *v ) +{ + SECONDARYCOLORF(BYTE_TO_FLOAT(v[0]), + BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3dvEXT_f( const GLdouble *v ) +{ + SECONDARYCOLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} +static void GLAPIENTRY +loopback_SecondaryColor3ivEXT_f( const GLint *v ) +{ + SECONDARYCOLORF(INT_TO_FLOAT(v[0]), + INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3svEXT_f( const GLshort *v ) +{ + SECONDARYCOLORF(SHORT_TO_FLOAT(v[0]), + SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3uivEXT_f( const GLuint *v ) +{ + SECONDARYCOLORF(UINT_TO_FLOAT(v[0]), + UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3usvEXT_f( const GLushort *v ) +{ + SECONDARYCOLORF(USHORT_TO_FLOAT(v[0]), + USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3ubvEXT_f( const GLubyte *v ) +{ + SECONDARYCOLORF(UBYTE_TO_FLOAT(v[0]), + UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2])); +} + + +/* + * GL_NV_vertex_program: + * Always loop-back to one of the VertexAttrib[1234]f[v]NV functions. + */ + +static void GLAPIENTRY +loopback_VertexAttrib1sNV(GLuint index, GLshort x) +{ + ATTRIB1NV(index, (GLfloat) x); +} + +static void GLAPIENTRY +loopback_VertexAttrib1dNV(GLuint index, GLdouble x) +{ + ATTRIB1NV(index, (GLfloat) x); +} + +static void GLAPIENTRY +loopback_VertexAttrib2sNV(GLuint index, GLshort x, GLshort y) +{ + ATTRIB2NV(index, (GLfloat) x, y); +} + +static void GLAPIENTRY +loopback_VertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y) +{ + ATTRIB2NV(index, (GLfloat) x, (GLfloat) y); +} + +static void GLAPIENTRY +loopback_VertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z) +{ + ATTRIB3NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z); +} + +static void GLAPIENTRY +loopback_VertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void GLAPIENTRY +loopback_VertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) +{ + ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +loopback_VertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +loopback_VertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) +{ + ATTRIB4NV(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), + UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); +} + +static void GLAPIENTRY +loopback_VertexAttrib1svNV(GLuint index, const GLshort *v) +{ + ATTRIB1NV(index, (GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttrib1dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB1NV(index, (GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttrib2svNV(GLuint index, const GLshort *v) +{ + ATTRIB2NV(index, (GLfloat) v[0], (GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_VertexAttrib2dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB2NV(index, (GLfloat) v[0], (GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_VertexAttrib3svNV(GLuint index, const GLshort *v) +{ + ATTRIB3NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_VertexAttrib3dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB3NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4svNV(GLuint index, const GLshort *v) +{ + ATTRIB4NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], + (GLfloat)v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB4NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4ubvNV(GLuint index, const GLubyte *v) +{ + ATTRIB4NV(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); +} + + +static void GLAPIENTRY +loopback_VertexAttribs1svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib1svNV(index + i, v + i); +} + +static void GLAPIENTRY +loopback_VertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + ATTRIB1NV(index + i, v[i]); +} + +static void GLAPIENTRY +loopback_VertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib1dvNV(index + i, v + i); +} + +static void GLAPIENTRY +loopback_VertexAttribs2svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib2svNV(index + i, v + 2 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + ATTRIB2NV(index + i, v[2 * i], v[2 * i + 1]); +} + +static void GLAPIENTRY +loopback_VertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib2dvNV(index + i, v + 2 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs3svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib3svNV(index + i, v + 3 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + ATTRIB3NV(index + i, v[3 * i], v[3 * i + 1], v[3 * i + 2]); +} + +static void GLAPIENTRY +loopback_VertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib3dvNV(index + i, v + 3 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs4svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4svNV(index + i, v + 4 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + ATTRIB4NV(index + i, v[4 * i], v[4 * i + 1], v[4 * i + 2], v[4 * i + 3]); +} + +static void GLAPIENTRY +loopback_VertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4dvNV(index + i, v + 4 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4ubvNV(index + i, v + 4 * i); +} + + +/* + * GL_ARB_vertex_program + * Always loop-back to one of the VertexAttrib[1234]f[v]ARB functions. + */ + +static void GLAPIENTRY +loopback_VertexAttrib1sARB(GLuint index, GLshort x) +{ + ATTRIB1ARB(index, (GLfloat) x); +} + +static void GLAPIENTRY +loopback_VertexAttrib1dARB(GLuint index, GLdouble x) +{ + ATTRIB1ARB(index, (GLfloat) x); +} + +static void GLAPIENTRY +loopback_VertexAttrib2sARB(GLuint index, GLshort x, GLshort y) +{ + ATTRIB2ARB(index, (GLfloat) x, y); +} + +static void GLAPIENTRY +loopback_VertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y) +{ + ATTRIB2ARB(index, (GLfloat) x, (GLfloat) y); +} + +static void GLAPIENTRY +loopback_VertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z) +{ + ATTRIB3ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z); +} + +static void GLAPIENTRY +loopback_VertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void GLAPIENTRY +loopback_VertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) +{ + ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +loopback_VertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +loopback_VertexAttrib1svARB(GLuint index, const GLshort *v) +{ + ATTRIB1ARB(index, (GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttrib1dvARB(GLuint index, const GLdouble *v) +{ + ATTRIB1ARB(index, (GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttrib2svARB(GLuint index, const GLshort *v) +{ + ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_VertexAttrib2dvARB(GLuint index, const GLdouble *v) +{ + ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_VertexAttrib3svARB(GLuint index, const GLshort *v) +{ + ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_VertexAttrib3dvARB(GLuint index, const GLdouble *v) +{ + ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4svARB(GLuint index, const GLshort *v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], + (GLfloat)v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4dvARB(GLuint index, const GLdouble *v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4bvARB(GLuint index, const GLbyte * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4ivARB(GLuint index, const GLint * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4ubvARB(GLuint index, const GLubyte * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4usvARB(GLuint index, const GLushort * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4uivARB(GLuint index, const GLuint * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NbvARB(GLuint index, const GLbyte * v) +{ + ATTRIB4ARB(index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NsvARB(GLuint index, const GLshort * v) +{ + ATTRIB4ARB(index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NivARB(GLuint index, const GLint * v) +{ + ATTRIB4ARB(index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) +{ + ATTRIB4ARB(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), + UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NubvARB(GLuint index, const GLubyte * v) +{ + ATTRIB4ARB(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NusvARB(GLuint index, const GLushort * v) +{ + ATTRIB4ARB(index, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NuivARB(GLuint index, const GLuint * v) +{ + ATTRIB4ARB(index, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3])); +} + + + + +/* + * This code never registers handlers for any of the entry points + * listed in vtxfmt.h. + */ +void +_mesa_loopback_init_api_table( struct _glapi_table *dest ) +{ + SET_Color3b(dest, loopback_Color3b_f); + SET_Color3d(dest, loopback_Color3d_f); + SET_Color3i(dest, loopback_Color3i_f); + SET_Color3s(dest, loopback_Color3s_f); + SET_Color3ui(dest, loopback_Color3ui_f); + SET_Color3us(dest, loopback_Color3us_f); + SET_Color3ub(dest, loopback_Color3ub_f); + SET_Color4b(dest, loopback_Color4b_f); + SET_Color4d(dest, loopback_Color4d_f); + SET_Color4i(dest, loopback_Color4i_f); + SET_Color4s(dest, loopback_Color4s_f); + SET_Color4ui(dest, loopback_Color4ui_f); + SET_Color4us(dest, loopback_Color4us_f); + SET_Color4ub(dest, loopback_Color4ub_f); + SET_Color3bv(dest, loopback_Color3bv_f); + SET_Color3dv(dest, loopback_Color3dv_f); + SET_Color3iv(dest, loopback_Color3iv_f); + SET_Color3sv(dest, loopback_Color3sv_f); + SET_Color3uiv(dest, loopback_Color3uiv_f); + SET_Color3usv(dest, loopback_Color3usv_f); + SET_Color3ubv(dest, loopback_Color3ubv_f); + SET_Color4bv(dest, loopback_Color4bv_f); + SET_Color4dv(dest, loopback_Color4dv_f); + SET_Color4iv(dest, loopback_Color4iv_f); + SET_Color4sv(dest, loopback_Color4sv_f); + SET_Color4uiv(dest, loopback_Color4uiv_f); + SET_Color4usv(dest, loopback_Color4usv_f); + SET_Color4ubv(dest, loopback_Color4ubv_f); + + SET_SecondaryColor3bEXT(dest, loopback_SecondaryColor3bEXT_f); + SET_SecondaryColor3dEXT(dest, loopback_SecondaryColor3dEXT_f); + SET_SecondaryColor3iEXT(dest, loopback_SecondaryColor3iEXT_f); + SET_SecondaryColor3sEXT(dest, loopback_SecondaryColor3sEXT_f); + SET_SecondaryColor3uiEXT(dest, loopback_SecondaryColor3uiEXT_f); + SET_SecondaryColor3usEXT(dest, loopback_SecondaryColor3usEXT_f); + SET_SecondaryColor3ubEXT(dest, loopback_SecondaryColor3ubEXT_f); + SET_SecondaryColor3bvEXT(dest, loopback_SecondaryColor3bvEXT_f); + SET_SecondaryColor3dvEXT(dest, loopback_SecondaryColor3dvEXT_f); + SET_SecondaryColor3ivEXT(dest, loopback_SecondaryColor3ivEXT_f); + SET_SecondaryColor3svEXT(dest, loopback_SecondaryColor3svEXT_f); + SET_SecondaryColor3uivEXT(dest, loopback_SecondaryColor3uivEXT_f); + SET_SecondaryColor3usvEXT(dest, loopback_SecondaryColor3usvEXT_f); + SET_SecondaryColor3ubvEXT(dest, loopback_SecondaryColor3ubvEXT_f); + + SET_Indexd(dest, loopback_Indexd); + SET_Indexi(dest, loopback_Indexi); + SET_Indexs(dest, loopback_Indexs); + SET_Indexub(dest, loopback_Indexub); + SET_Indexdv(dest, loopback_Indexdv); + SET_Indexiv(dest, loopback_Indexiv); + SET_Indexsv(dest, loopback_Indexsv); + SET_Indexubv(dest, loopback_Indexubv); + SET_Normal3b(dest, loopback_Normal3b); + SET_Normal3d(dest, loopback_Normal3d); + SET_Normal3i(dest, loopback_Normal3i); + SET_Normal3s(dest, loopback_Normal3s); + SET_Normal3bv(dest, loopback_Normal3bv); + SET_Normal3dv(dest, loopback_Normal3dv); + SET_Normal3iv(dest, loopback_Normal3iv); + SET_Normal3sv(dest, loopback_Normal3sv); + SET_TexCoord1d(dest, loopback_TexCoord1d); + SET_TexCoord1i(dest, loopback_TexCoord1i); + SET_TexCoord1s(dest, loopback_TexCoord1s); + SET_TexCoord2d(dest, loopback_TexCoord2d); + SET_TexCoord2s(dest, loopback_TexCoord2s); + SET_TexCoord2i(dest, loopback_TexCoord2i); + SET_TexCoord3d(dest, loopback_TexCoord3d); + SET_TexCoord3i(dest, loopback_TexCoord3i); + SET_TexCoord3s(dest, loopback_TexCoord3s); + SET_TexCoord4d(dest, loopback_TexCoord4d); + SET_TexCoord4i(dest, loopback_TexCoord4i); + SET_TexCoord4s(dest, loopback_TexCoord4s); + SET_TexCoord1dv(dest, loopback_TexCoord1dv); + SET_TexCoord1iv(dest, loopback_TexCoord1iv); + SET_TexCoord1sv(dest, loopback_TexCoord1sv); + SET_TexCoord2dv(dest, loopback_TexCoord2dv); + SET_TexCoord2iv(dest, loopback_TexCoord2iv); + SET_TexCoord2sv(dest, loopback_TexCoord2sv); + SET_TexCoord3dv(dest, loopback_TexCoord3dv); + SET_TexCoord3iv(dest, loopback_TexCoord3iv); + SET_TexCoord3sv(dest, loopback_TexCoord3sv); + SET_TexCoord4dv(dest, loopback_TexCoord4dv); + SET_TexCoord4iv(dest, loopback_TexCoord4iv); + SET_TexCoord4sv(dest, loopback_TexCoord4sv); + SET_Vertex2d(dest, loopback_Vertex2d); + SET_Vertex2i(dest, loopback_Vertex2i); + SET_Vertex2s(dest, loopback_Vertex2s); + SET_Vertex3d(dest, loopback_Vertex3d); + SET_Vertex3i(dest, loopback_Vertex3i); + SET_Vertex3s(dest, loopback_Vertex3s); + SET_Vertex4d(dest, loopback_Vertex4d); + SET_Vertex4i(dest, loopback_Vertex4i); + SET_Vertex4s(dest, loopback_Vertex4s); + SET_Vertex2dv(dest, loopback_Vertex2dv); + SET_Vertex2iv(dest, loopback_Vertex2iv); + SET_Vertex2sv(dest, loopback_Vertex2sv); + SET_Vertex3dv(dest, loopback_Vertex3dv); + SET_Vertex3iv(dest, loopback_Vertex3iv); + SET_Vertex3sv(dest, loopback_Vertex3sv); + SET_Vertex4dv(dest, loopback_Vertex4dv); + SET_Vertex4iv(dest, loopback_Vertex4iv); + SET_Vertex4sv(dest, loopback_Vertex4sv); + SET_MultiTexCoord1dARB(dest, loopback_MultiTexCoord1dARB); + SET_MultiTexCoord1dvARB(dest, loopback_MultiTexCoord1dvARB); + SET_MultiTexCoord1iARB(dest, loopback_MultiTexCoord1iARB); + SET_MultiTexCoord1ivARB(dest, loopback_MultiTexCoord1ivARB); + SET_MultiTexCoord1sARB(dest, loopback_MultiTexCoord1sARB); + SET_MultiTexCoord1svARB(dest, loopback_MultiTexCoord1svARB); + SET_MultiTexCoord2dARB(dest, loopback_MultiTexCoord2dARB); + SET_MultiTexCoord2dvARB(dest, loopback_MultiTexCoord2dvARB); + SET_MultiTexCoord2iARB(dest, loopback_MultiTexCoord2iARB); + SET_MultiTexCoord2ivARB(dest, loopback_MultiTexCoord2ivARB); + SET_MultiTexCoord2sARB(dest, loopback_MultiTexCoord2sARB); + SET_MultiTexCoord2svARB(dest, loopback_MultiTexCoord2svARB); + SET_MultiTexCoord3dARB(dest, loopback_MultiTexCoord3dARB); + SET_MultiTexCoord3dvARB(dest, loopback_MultiTexCoord3dvARB); + SET_MultiTexCoord3iARB(dest, loopback_MultiTexCoord3iARB); + SET_MultiTexCoord3ivARB(dest, loopback_MultiTexCoord3ivARB); + SET_MultiTexCoord3sARB(dest, loopback_MultiTexCoord3sARB); + SET_MultiTexCoord3svARB(dest, loopback_MultiTexCoord3svARB); + SET_MultiTexCoord4dARB(dest, loopback_MultiTexCoord4dARB); + SET_MultiTexCoord4dvARB(dest, loopback_MultiTexCoord4dvARB); + SET_MultiTexCoord4iARB(dest, loopback_MultiTexCoord4iARB); + SET_MultiTexCoord4ivARB(dest, loopback_MultiTexCoord4ivARB); + SET_MultiTexCoord4sARB(dest, loopback_MultiTexCoord4sARB); + SET_MultiTexCoord4svARB(dest, loopback_MultiTexCoord4svARB); + SET_EvalCoord2dv(dest, loopback_EvalCoord2dv); + SET_EvalCoord2fv(dest, loopback_EvalCoord2fv); + SET_EvalCoord2d(dest, loopback_EvalCoord2d); + SET_EvalCoord1dv(dest, loopback_EvalCoord1dv); + SET_EvalCoord1fv(dest, loopback_EvalCoord1fv); + SET_EvalCoord1d(dest, loopback_EvalCoord1d); + SET_Materialf(dest, loopback_Materialf); + SET_Materiali(dest, loopback_Materiali); + SET_Materialiv(dest, loopback_Materialiv); + SET_Rectd(dest, loopback_Rectd); + SET_Rectdv(dest, loopback_Rectdv); + SET_Rectfv(dest, loopback_Rectfv); + SET_Recti(dest, loopback_Recti); + SET_Rectiv(dest, loopback_Rectiv); + SET_Rects(dest, loopback_Rects); + SET_Rectsv(dest, loopback_Rectsv); + SET_FogCoorddEXT(dest, loopback_FogCoorddEXT); + SET_FogCoorddvEXT(dest, loopback_FogCoorddvEXT); + + SET_VertexAttrib1sNV(dest, loopback_VertexAttrib1sNV); + SET_VertexAttrib1dNV(dest, loopback_VertexAttrib1dNV); + SET_VertexAttrib2sNV(dest, loopback_VertexAttrib2sNV); + SET_VertexAttrib2dNV(dest, loopback_VertexAttrib2dNV); + SET_VertexAttrib3sNV(dest, loopback_VertexAttrib3sNV); + SET_VertexAttrib3dNV(dest, loopback_VertexAttrib3dNV); + SET_VertexAttrib4sNV(dest, loopback_VertexAttrib4sNV); + SET_VertexAttrib4dNV(dest, loopback_VertexAttrib4dNV); + SET_VertexAttrib4ubNV(dest, loopback_VertexAttrib4ubNV); + SET_VertexAttrib1svNV(dest, loopback_VertexAttrib1svNV); + SET_VertexAttrib1dvNV(dest, loopback_VertexAttrib1dvNV); + SET_VertexAttrib2svNV(dest, loopback_VertexAttrib2svNV); + SET_VertexAttrib2dvNV(dest, loopback_VertexAttrib2dvNV); + SET_VertexAttrib3svNV(dest, loopback_VertexAttrib3svNV); + SET_VertexAttrib3dvNV(dest, loopback_VertexAttrib3dvNV); + SET_VertexAttrib4svNV(dest, loopback_VertexAttrib4svNV); + SET_VertexAttrib4dvNV(dest, loopback_VertexAttrib4dvNV); + SET_VertexAttrib4ubvNV(dest, loopback_VertexAttrib4ubvNV); + SET_VertexAttribs1svNV(dest, loopback_VertexAttribs1svNV); + SET_VertexAttribs1fvNV(dest, loopback_VertexAttribs1fvNV); + SET_VertexAttribs1dvNV(dest, loopback_VertexAttribs1dvNV); + SET_VertexAttribs2svNV(dest, loopback_VertexAttribs2svNV); + SET_VertexAttribs2fvNV(dest, loopback_VertexAttribs2fvNV); + SET_VertexAttribs2dvNV(dest, loopback_VertexAttribs2dvNV); + SET_VertexAttribs3svNV(dest, loopback_VertexAttribs3svNV); + SET_VertexAttribs3fvNV(dest, loopback_VertexAttribs3fvNV); + SET_VertexAttribs3dvNV(dest, loopback_VertexAttribs3dvNV); + SET_VertexAttribs4svNV(dest, loopback_VertexAttribs4svNV); + SET_VertexAttribs4fvNV(dest, loopback_VertexAttribs4fvNV); + SET_VertexAttribs4dvNV(dest, loopback_VertexAttribs4dvNV); + SET_VertexAttribs4ubvNV(dest, loopback_VertexAttribs4ubvNV); + + SET_VertexAttrib1sARB(dest, loopback_VertexAttrib1sARB); + SET_VertexAttrib1dARB(dest, loopback_VertexAttrib1dARB); + SET_VertexAttrib2sARB(dest, loopback_VertexAttrib2sARB); + SET_VertexAttrib2dARB(dest, loopback_VertexAttrib2dARB); + SET_VertexAttrib3sARB(dest, loopback_VertexAttrib3sARB); + SET_VertexAttrib3dARB(dest, loopback_VertexAttrib3dARB); + SET_VertexAttrib4sARB(dest, loopback_VertexAttrib4sARB); + SET_VertexAttrib4dARB(dest, loopback_VertexAttrib4dARB); + SET_VertexAttrib1svARB(dest, loopback_VertexAttrib1svARB); + SET_VertexAttrib1dvARB(dest, loopback_VertexAttrib1dvARB); + SET_VertexAttrib2svARB(dest, loopback_VertexAttrib2svARB); + SET_VertexAttrib2dvARB(dest, loopback_VertexAttrib2dvARB); + SET_VertexAttrib3svARB(dest, loopback_VertexAttrib3svARB); + SET_VertexAttrib3dvARB(dest, loopback_VertexAttrib3dvARB); + SET_VertexAttrib4svARB(dest, loopback_VertexAttrib4svARB); + SET_VertexAttrib4dvARB(dest, loopback_VertexAttrib4dvARB); + SET_VertexAttrib4NubARB(dest, loopback_VertexAttrib4NubARB); + SET_VertexAttrib4NubvARB(dest, loopback_VertexAttrib4NubvARB); + SET_VertexAttrib4bvARB(dest, loopback_VertexAttrib4bvARB); + SET_VertexAttrib4ivARB(dest, loopback_VertexAttrib4ivARB); + SET_VertexAttrib4ubvARB(dest, loopback_VertexAttrib4ubvARB); + SET_VertexAttrib4usvARB(dest, loopback_VertexAttrib4usvARB); + SET_VertexAttrib4uivARB(dest, loopback_VertexAttrib4uivARB); + SET_VertexAttrib4NbvARB(dest, loopback_VertexAttrib4NbvARB); + SET_VertexAttrib4NsvARB(dest, loopback_VertexAttrib4NsvARB); + SET_VertexAttrib4NivARB(dest, loopback_VertexAttrib4NivARB); + SET_VertexAttrib4NusvARB(dest, loopback_VertexAttrib4NusvARB); + SET_VertexAttrib4NuivARB(dest, loopback_VertexAttrib4NuivARB); +} diff --git a/reactos/dll/mesa32/src/main/api_loopback.h b/reactos/dll/mesa32/src/main/api_loopback.h new file mode 100644 index 00000000000..6f85bbc1d92 --- /dev/null +++ b/reactos/dll/mesa32/src/main/api_loopback.h @@ -0,0 +1,37 @@ +/* + * 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 API_LOOPBACK_H +#define API_LOOPBACK_H + +#include "glheader.h" + + +struct _glapi_table; + +extern void _mesa_loopback_init_api_table( struct _glapi_table *dest ); + +#endif diff --git a/reactos/dll/mesa32/src/main/api_noop.c b/reactos/dll/mesa32/src/main/api_noop.c new file mode 100644 index 00000000000..f42f166ae31 --- /dev/null +++ b/reactos/dll/mesa32/src/main/api_noop.c @@ -0,0 +1,964 @@ +/* + * 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. + */ + + +#include "glheader.h" +#include "api_noop.h" +#include "api_validate.h" +#include "api_arrayelt.h" +#include "context.h" +#include "colormac.h" +#include "light.h" +#include "macros.h" +#include "mtypes.h" +#include "dlist.h" +#include "dispatch.h" + + +/* In states where certain vertex components are required for t&l or + * rasterization, we still need to keep track of the current values. + * These functions provide this service by keeping uptodate the + * 'ctx->Current' struct for all data elements not included in the + * currently enabled hardware vertex. + * I.e. these functions would typically be used when outside of glBegin/End. + */ + + +void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b ) +{ + GET_CURRENT_CONTEXT(ctx); + ctx->Current.EdgeFlag = b; +} + +void GLAPIENTRY _mesa_noop_EdgeFlagv( const GLboolean *b ) +{ + GET_CURRENT_CONTEXT(ctx); + ctx->Current.EdgeFlag = *b; +} + +void GLAPIENTRY _mesa_noop_Indexf( GLfloat f ) +{ + GET_CURRENT_CONTEXT(ctx); + ctx->Current.Index = f; +} + +void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + ctx->Current.Index = *v; +} + +void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_FOG]; + dest[0] = a; + dest[1] = 0.0; + dest[2] = 0.0; + dest[3] = 1.0; +} + +void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_FOG]; + dest[0] = v[0]; + dest[1] = 0.0; + dest[2] = 0.0; + dest[3] = 1.0; +} + +void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; + dest[0] = a; + dest[1] = b; + dest[2] = c; + dest[3] = 1.0; +} + +void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; + dest[0] = v[0]; + dest[1] = v[1]; + dest[2] = v[2]; + dest[3] = 1.0; +} + +void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; + color[0] = a; + color[1] = b; + color[2] = c; + color[3] = d; +} + +void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; + color[0] = v[0]; + color[1] = v[1]; + color[2] = v[2]; + color[3] = v[3]; +} + +void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; + color[0] = a; + color[1] = b; + color[2] = c; + color[3] = 1.0; +} + +void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; + color[0] = v[0]; + color[1] = v[1]; + color[2] = v[2]; + color[3] = 1.0; +} + +void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint unit = target - GL_TEXTURE0_ARB; + + /* unit is unsigned -- cannot be less than zero. + */ + if (unit < MAX_TEXTURE_COORD_UNITS) + { + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; + dest[0] = a; + dest[1] = 0; + dest[2] = 0; + dest[3] = 1; + } +} + +void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint unit = target - GL_TEXTURE0_ARB; + + /* unit is unsigned -- cannot be less than zero. + */ + if (unit < MAX_TEXTURE_COORD_UNITS) + { + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; + dest[0] = v[0]; + dest[1] = 0; + dest[2] = 0; + dest[3] = 1; + } +} + +void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint unit = target - GL_TEXTURE0_ARB; + + /* unit is unsigned -- cannot be less than zero. + */ + if (unit < MAX_TEXTURE_COORD_UNITS) + { + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; + dest[0] = a; + dest[1] = b; + dest[2] = 0; + dest[3] = 1; + } +} + +void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint unit = target - GL_TEXTURE0_ARB; + + /* unit is unsigned -- cannot be less than zero. + */ + if (unit < MAX_TEXTURE_COORD_UNITS) + { + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; + dest[0] = v[0]; + dest[1] = v[1]; + dest[2] = 0; + dest[3] = 1; + } +} + +void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint unit = target - GL_TEXTURE0_ARB; + + /* unit is unsigned -- cannot be less than zero. + */ + if (unit < MAX_TEXTURE_COORD_UNITS) + { + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; + dest[0] = a; + dest[1] = b; + dest[2] = c; + dest[3] = 1; + } +} + +void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint unit = target - GL_TEXTURE0_ARB; + + /* unit is unsigned -- cannot be less than zero. + */ + if (unit < MAX_TEXTURE_COORD_UNITS) + { + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; + dest[0] = v[0]; + dest[1] = v[1]; + dest[2] = v[2]; + dest[3] = 1; + } +} + +void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b, + GLfloat c, GLfloat d ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint unit = target - GL_TEXTURE0_ARB; + + /* unit is unsigned -- cannot be less than zero. + */ + if (unit < MAX_TEXTURE_COORD_UNITS) + { + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; + dest[0] = a; + dest[1] = b; + dest[2] = c; + dest[3] = d; + } +} + +void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint unit = target - GL_TEXTURE0_ARB; + + /* unit is unsigned -- cannot be less than zero. + */ + if (unit < MAX_TEXTURE_COORD_UNITS) + { + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; + dest[0] = v[0]; + dest[1] = v[1]; + dest[2] = v[2]; + dest[3] = v[3]; + } +} + +void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; + color[0] = a; + color[1] = b; + color[2] = c; + color[3] = 1.0; +} + +void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; + color[0] = v[0]; + color[1] = v[1]; + color[2] = v[2]; + color[3] = 1.0; +} + +void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; + dest[0] = a; + dest[1] = 0; + dest[2] = 0; + dest[3] = 1; +} + +void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; + dest[0] = v[0]; + dest[1] = 0; + dest[2] = 0; + dest[3] = 1; +} + +void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; + dest[0] = a; + dest[1] = b; + dest[2] = 0; + dest[3] = 1; +} + +void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; + dest[0] = v[0]; + dest[1] = v[1]; + dest[2] = 0; + dest[3] = 1; +} + +void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; + dest[0] = a; + dest[1] = b; + dest[2] = c; + dest[3] = 1; +} + +void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; + dest[0] = v[0]; + dest[1] = v[1]; + dest[2] = v[2]; + dest[3] = 1; +} + +void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; + dest[0] = a; + dest[1] = b; + dest[2] = c; + dest[3] = d; +} + +void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; + dest[0] = v[0]; + dest[1] = v[1]; + dest[2] = v[2]; + dest[3] = v[3]; +} + + + +void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fNV" ); +} + +void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fvNV" ); +} + +void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fNV" ); +} + +void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fvNV" ); +} + +void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x, + GLfloat y, GLfloat z ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fNV" ); +} + +void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fvNV" ); +} + +void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, + GLfloat y, GLfloat z, GLfloat w ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fNV" ); +} + +void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fvNV" ); +} + + +/* + * XXX Un-alias attribs here + */ + +void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fARB" ); +} + +void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fvARB" ); +} + +void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fARB" ); +} + +void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fvARB" ); +} + +void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x, + GLfloat y, GLfloat z ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fARB" ); +} + +void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fvARB" ); +} + +void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x, + GLfloat y, GLfloat z, GLfloat w ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fARB" ); +} + +void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < VERT_ATTRIB_MAX) { + ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]); + } + else + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fvARB" ); +} + + + +/* Material + */ +void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i, nr; + struct gl_material *mat = &ctx->Light.Material; + GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0, + "_mesa_noop_Materialfv" ); + + if (ctx->Light.ColorMaterialEnabled) + bitmask &= ~ctx->Light.ColorMaterialBitmask; + + if (bitmask == 0) + return; + + switch (face) { + case GL_SHININESS: nr = 1; break; + case GL_COLOR_INDEXES: nr = 3; break; + default: nr = 4 ; break; + } + + for (i = 0 ; i < MAT_ATTRIB_MAX ; i++) + if (bitmask & (1<Attrib[i], nr, params ); + + _mesa_update_material( ctx, bitmask ); +} + +/* These really are noops outside begin/end: + */ +void GLAPIENTRY _mesa_noop_Vertex2fv( const GLfloat *v ) +{ + (void) v; +} + +void GLAPIENTRY _mesa_noop_Vertex3fv( const GLfloat *v ) +{ + (void) v; +} + +void GLAPIENTRY _mesa_noop_Vertex4fv( const GLfloat *v ) +{ + (void) v; +} + +void GLAPIENTRY _mesa_noop_Vertex2f( GLfloat a, GLfloat b ) +{ + (void) a; (void) b; +} + +void GLAPIENTRY _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c ) +{ + (void) a; (void) b; (void) c; +} + +void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) +{ + (void) a; (void) b; (void) c; (void) d; +} + +/* Similarly, these have no effect outside begin/end: + */ +void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a ) +{ + (void) a; +} + +void GLAPIENTRY _mesa_noop_EvalCoord1fv( const GLfloat *v ) +{ + (void) v; +} + +void GLAPIENTRY _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b ) +{ + (void) a; (void) b; +} + +void GLAPIENTRY _mesa_noop_EvalCoord2fv( const GLfloat *v ) +{ + (void) v; +} + +void GLAPIENTRY _mesa_noop_EvalPoint1( GLint a ) +{ + (void) a; +} + +void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b ) +{ + (void) a; (void) b; +} + + +/* Begin -- call into driver, should result in the vtxfmt being + * swapped out: + */ +void GLAPIENTRY _mesa_noop_Begin( GLenum mode ) +{ + (void) mode; +} + + +/* End -- just raise an error + */ +void GLAPIENTRY _mesa_noop_End( void ) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" ); +} + + +/* Execute a glRectf() function. This is not suitable for GL_COMPILE + * modes (as the test for outside begin/end is not compiled), + * but may be useful for drivers in circumstances which exclude + * display list interactions. + * + * (None of the functions in this file are suitable for GL_COMPILE + * modes). + */ +void GLAPIENTRY _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) +{ + { + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + } + + CALL_Begin(GET_DISPATCH(), (GL_QUADS)); + CALL_Vertex2f(GET_DISPATCH(), (x1, y1)); + CALL_Vertex2f(GET_DISPATCH(), (x2, y1)); + CALL_Vertex2f(GET_DISPATCH(), (x2, y2)); + CALL_Vertex2f(GET_DISPATCH(), (x1, y2)); + CALL_End(GET_DISPATCH(), ()); +} + + +/* Some very basic support for arrays. Drivers without explicit array + * support can hook these in, but still need to supply an array-elt + * implementation. + */ +void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + + if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) + return; + + CALL_Begin(GET_DISPATCH(), (mode)); + for (i = 0; i < count; i++) + CALL_ArrayElement(GET_DISPATCH(), (start + i)); + CALL_End(GET_DISPATCH(), ()); +} + + +void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + + if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) + return; + + CALL_Begin(GET_DISPATCH(), (mode)); + + switch (type) { + case GL_UNSIGNED_BYTE: + for (i = 0 ; i < count ; i++) + CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte *)indices)[i] )); + break; + case GL_UNSIGNED_SHORT: + for (i = 0 ; i < count ; i++) + CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort *)indices)[i] )); + break; + case GL_UNSIGNED_INT: + for (i = 0 ; i < count ; i++) + CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint *)indices)[i] )); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); + break; + } + + CALL_End(GET_DISPATCH(), ()); +} + +void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode, + GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices) +{ + GET_CURRENT_CONTEXT(ctx); + + if (_mesa_validate_DrawRangeElements( ctx, mode, + start, end, + count, type, indices )) + CALL_DrawElements(GET_DISPATCH(), (mode, count, type, indices)); +} + +/* + * Eval Mesh + */ + +/* KW: If are compiling, we don't know whether eval will produce a + * vertex when it is run in the future. If this is pure immediate + * mode, eval is a noop if neither vertex map is enabled. + * + * Thus we need to have a check in the display list code or + * elsewhere for eval(1,2) vertices in the case where + * map(1,2)_vertex is disabled, and to purge those vertices from + * the vb. + */ +void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + GLfloat u, du; + GLenum prim; + + switch (mode) { + case GL_POINT: + prim = GL_POINTS; + break; + case GL_LINE: + prim = GL_LINE_STRIP; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh1(mode)" ); + return; + } + + /* No effect if vertex maps disabled. + */ + if (!ctx->Eval.Map1Vertex4 && + !ctx->Eval.Map1Vertex3 && + !(ctx->VertexProgram._Enabled && ctx->Eval.Map1Attrib[VERT_ATTRIB_POS])) + return; + + du = ctx->Eval.MapGrid1du; + u = ctx->Eval.MapGrid1u1 + i1 * du; + + CALL_Begin(GET_DISPATCH(), (prim)); + for (i=i1;i<=i2;i++,u+=du) { + CALL_EvalCoord1f(GET_DISPATCH(), (u)); + } + CALL_End(GET_DISPATCH(), ()); +} + + + +void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat u, du, v, dv, v1, u1; + GLint i, j; + + switch (mode) { + case GL_POINT: + case GL_LINE: + case GL_FILL: + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh2(mode)" ); + return; + } + + /* No effect if vertex maps disabled. + */ + if (!ctx->Eval.Map2Vertex4 && + !ctx->Eval.Map2Vertex3 && + !(ctx->VertexProgram._Enabled && ctx->Eval.Map2Attrib[VERT_ATTRIB_POS])) + return; + + du = ctx->Eval.MapGrid2du; + dv = ctx->Eval.MapGrid2dv; + v1 = ctx->Eval.MapGrid2v1 + j1 * dv; + u1 = ctx->Eval.MapGrid2u1 + i1 * du; + + switch (mode) { + case GL_POINT: + CALL_Begin(GET_DISPATCH(), (GL_POINTS)); + for (v=v1,j=j1;j<=j2;j++,v+=dv) { + for (u=u1,i=i1;i<=i2;i++,u+=du) { + CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); + } + } + CALL_End(GET_DISPATCH(), ()); + break; + case GL_LINE: + for (v=v1,j=j1;j<=j2;j++,v+=dv) { + CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP)); + for (u=u1,i=i1;i<=i2;i++,u+=du) { + CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); + } + CALL_End(GET_DISPATCH(), ()); + } + for (u=u1,i=i1;i<=i2;i++,u+=du) { + CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP)); + for (v=v1,j=j1;j<=j2;j++,v+=dv) { + CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); + } + CALL_End(GET_DISPATCH(), ()); + } + break; + case GL_FILL: + for (v=v1,j=j1;jArrayElement = _ae_loopback_array_elt; /* generic helper */ + vfmt->Begin = _mesa_noop_Begin; + vfmt->CallList = _mesa_CallList; + vfmt->CallLists = _mesa_CallLists; + vfmt->Color3f = _mesa_noop_Color3f; + vfmt->Color3fv = _mesa_noop_Color3fv; + vfmt->Color4f = _mesa_noop_Color4f; + vfmt->Color4fv = _mesa_noop_Color4fv; + vfmt->EdgeFlag = _mesa_noop_EdgeFlag; + vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv; + vfmt->End = _mesa_noop_End; + vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f; + vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv; + vfmt->EvalCoord2f = _mesa_noop_EvalCoord2f; + vfmt->EvalCoord2fv = _mesa_noop_EvalCoord2fv; + vfmt->EvalPoint1 = _mesa_noop_EvalPoint1; + vfmt->EvalPoint2 = _mesa_noop_EvalPoint2; + vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT; + vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT; + vfmt->Indexf = _mesa_noop_Indexf; + vfmt->Indexfv = _mesa_noop_Indexfv; + vfmt->Materialfv = _mesa_noop_Materialfv; + vfmt->MultiTexCoord1fARB = _mesa_noop_MultiTexCoord1fARB; + vfmt->MultiTexCoord1fvARB = _mesa_noop_MultiTexCoord1fvARB; + vfmt->MultiTexCoord2fARB = _mesa_noop_MultiTexCoord2fARB; + vfmt->MultiTexCoord2fvARB = _mesa_noop_MultiTexCoord2fvARB; + vfmt->MultiTexCoord3fARB = _mesa_noop_MultiTexCoord3fARB; + vfmt->MultiTexCoord3fvARB = _mesa_noop_MultiTexCoord3fvARB; + vfmt->MultiTexCoord4fARB = _mesa_noop_MultiTexCoord4fARB; + vfmt->MultiTexCoord4fvARB = _mesa_noop_MultiTexCoord4fvARB; + vfmt->Normal3f = _mesa_noop_Normal3f; + vfmt->Normal3fv = _mesa_noop_Normal3fv; + vfmt->SecondaryColor3fEXT = _mesa_noop_SecondaryColor3fEXT; + vfmt->SecondaryColor3fvEXT = _mesa_noop_SecondaryColor3fvEXT; + vfmt->TexCoord1f = _mesa_noop_TexCoord1f; + vfmt->TexCoord1fv = _mesa_noop_TexCoord1fv; + vfmt->TexCoord2f = _mesa_noop_TexCoord2f; + vfmt->TexCoord2fv = _mesa_noop_TexCoord2fv; + vfmt->TexCoord3f = _mesa_noop_TexCoord3f; + vfmt->TexCoord3fv = _mesa_noop_TexCoord3fv; + vfmt->TexCoord4f = _mesa_noop_TexCoord4f; + vfmt->TexCoord4fv = _mesa_noop_TexCoord4fv; + vfmt->Vertex2f = _mesa_noop_Vertex2f; + vfmt->Vertex2fv = _mesa_noop_Vertex2fv; + vfmt->Vertex3f = _mesa_noop_Vertex3f; + vfmt->Vertex3fv = _mesa_noop_Vertex3fv; + vfmt->Vertex4f = _mesa_noop_Vertex4f; + vfmt->Vertex4fv = _mesa_noop_Vertex4fv; + vfmt->VertexAttrib1fNV = _mesa_noop_VertexAttrib1fNV; + vfmt->VertexAttrib1fvNV = _mesa_noop_VertexAttrib1fvNV; + vfmt->VertexAttrib2fNV = _mesa_noop_VertexAttrib2fNV; + vfmt->VertexAttrib2fvNV = _mesa_noop_VertexAttrib2fvNV; + vfmt->VertexAttrib3fNV = _mesa_noop_VertexAttrib3fNV; + vfmt->VertexAttrib3fvNV = _mesa_noop_VertexAttrib3fvNV; + vfmt->VertexAttrib4fNV = _mesa_noop_VertexAttrib4fNV; + vfmt->VertexAttrib4fvNV = _mesa_noop_VertexAttrib4fvNV; + vfmt->VertexAttrib1fARB = _mesa_noop_VertexAttrib1fARB; + vfmt->VertexAttrib1fvARB = _mesa_noop_VertexAttrib1fvARB; + vfmt->VertexAttrib2fARB = _mesa_noop_VertexAttrib2fARB; + vfmt->VertexAttrib2fvARB = _mesa_noop_VertexAttrib2fvARB; + vfmt->VertexAttrib3fARB = _mesa_noop_VertexAttrib3fARB; + vfmt->VertexAttrib3fvARB = _mesa_noop_VertexAttrib3fvARB; + vfmt->VertexAttrib4fARB = _mesa_noop_VertexAttrib4fARB; + vfmt->VertexAttrib4fvARB = _mesa_noop_VertexAttrib4fvARB; + + vfmt->Rectf = _mesa_noop_Rectf; + + vfmt->DrawArrays = _mesa_noop_DrawArrays; + vfmt->DrawElements = _mesa_noop_DrawElements; + vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements; + vfmt->EvalMesh1 = _mesa_noop_EvalMesh1; + vfmt->EvalMesh2 = _mesa_noop_EvalMesh2; +} diff --git a/reactos/dll/mesa32/src/main/api_noop.h b/reactos/dll/mesa32/src/main/api_noop.h new file mode 100644 index 00000000000..56d930e3b04 --- /dev/null +++ b/reactos/dll/mesa32/src/main/api_noop.h @@ -0,0 +1,147 @@ + +/* + * Mesa 3-D graphics library + * Version: 4.1 + * + * 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 _API_NOOP_H +#define _API_NOOP_H + + +#include "glheader.h" +#include "mtypes.h" +#include "context.h" + +/* In states where certain vertex components are required for t&l or + * rasterization, we still need to keep track of the current values. + * These functions provide this service by keeping uptodate the + * 'ctx->Current' struct for all data elements not included in the + * currently enabled hardware vertex. + * + */ +extern void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b ); +extern void GLAPIENTRY _mesa_noop_EdgeFlagv( const GLboolean *b ); + +extern void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a ); +extern void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v ); + +extern void GLAPIENTRY _mesa_noop_Indexf( GLfloat i ); +extern void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v ); + +extern void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c ); +extern void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v ); + +extern void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *param ); + +extern void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d ); +extern void _mesa_noop_Color4ubv( const GLubyte *v ); +extern void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ); +extern void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v ); +extern void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c ); +extern void _mesa_noop_Color3ubv( const GLubyte *v ); +extern void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c ); +extern void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v ); + +extern void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a ); +extern void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b ); +extern void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c); +extern void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c, GLfloat d ); +extern void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v ); + +extern void GLAPIENTRY _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c ); +extern void GLAPIENTRY _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v ); +extern void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c ); +extern void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v ); + +extern void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a ); +extern void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ); +extern void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ); +extern void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ); +extern void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v ); + +extern void GLAPIENTRY _mesa_noop_Vertex2f( GLfloat a, GLfloat b ); +extern void GLAPIENTRY _mesa_noop_Vertex2fv( const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c ); +extern void GLAPIENTRY _mesa_noop_Vertex3fv( const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ); +extern void GLAPIENTRY _mesa_noop_Vertex4fv( const GLfloat *v ); + +extern void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x ); +extern void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ); +extern void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z ); +extern void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); + +extern void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x ); +extern void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y ); +extern void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z ); +extern void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +extern void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v ); + + +extern void GLAPIENTRY _mesa_noop_End( void ); +extern void GLAPIENTRY _mesa_noop_Begin( GLenum mode ); +extern void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b ); +extern void GLAPIENTRY _mesa_noop_EvalPoint1( GLint a ); +extern void GLAPIENTRY _mesa_noop_EvalCoord2fv( const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b ); +extern void GLAPIENTRY _mesa_noop_EvalCoord1fv( const GLfloat *v ); +extern void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a ); + +extern void _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ); + +extern void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, + GLint j1, GLint j2 ); + +extern void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 ); + + +/* Not strictly a noop -- translate Rectf down to Begin/End and + * vertices. Closer to the loopback operations, but doesn't meet the + * criteria for inclusion there (cannot be used in the Save table). + */ +extern void GLAPIENTRY _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); + + +extern void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count); +extern void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices); +extern void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode, + GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices); + + + +#endif diff --git a/reactos/dll/mesa32/src/main/api_validate.c b/reactos/dll/mesa32/src/main/api_validate.c new file mode 100644 index 00000000000..d1c8f42e747 --- /dev/null +++ b/reactos/dll/mesa32/src/main/api_validate.c @@ -0,0 +1,238 @@ +/* + * Mesa 3-D graphics library + * Version: 6.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. + */ + +#include "glheader.h" +#include "api_validate.h" +#include "context.h" +#include "imports.h" +#include "mtypes.h" +#include "state.h" + + +GLboolean +_mesa_validate_DrawElements(GLcontext *ctx, + GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices) +{ + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + if (count <= 0) { + if (count < 0) + _mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" ); + return GL_FALSE; + } + + if (mode > GL_POLYGON) { + _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(mode)" ); + return GL_FALSE; + } + + if (type != GL_UNSIGNED_INT && + type != GL_UNSIGNED_BYTE && + type != GL_UNSIGNED_SHORT) + { + _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); + return GL_FALSE; + } + + if (ctx->NewState) + _mesa_update_state(ctx); + + /* Always need vertex positions */ + if (!ctx->Array.Vertex.Enabled + && !(ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled)) + return GL_FALSE; + + /* Vertex buffer object tests */ + if (ctx->Array.ElementArrayBufferObj->Name) { + GLuint indexBytes; + + /* use indices in the buffer object */ + if (!ctx->Array.ElementArrayBufferObj->Data) { + _mesa_warning(ctx, "DrawElements with empty vertex elements buffer!"); + return GL_FALSE; + } + + /* make sure count doesn't go outside buffer bounds */ + if (type == GL_UNSIGNED_INT) { + indexBytes = count * sizeof(GLuint); + } + else if (type == GL_UNSIGNED_BYTE) { + indexBytes = count * sizeof(GLubyte); + } + else { + ASSERT(type == GL_UNSIGNED_SHORT); + indexBytes = count * sizeof(GLushort); + } + + if ((GLubyte *) indices + indexBytes > + ctx->Array.ElementArrayBufferObj->Data + + ctx->Array.ElementArrayBufferObj->Size) { + _mesa_warning(ctx, "glDrawElements index out of buffer bounds"); + return GL_FALSE; + } + + /* Actual address is the sum of pointers. Indices may be used below. */ + if (ctx->Const.CheckArrayBounds) { + indices = (const GLvoid *) + ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data, + (const GLubyte *) indices); + } + } + + if (ctx->Const.CheckArrayBounds) { + /* find max array index */ + GLuint max = 0; + GLint i; + if (type == GL_UNSIGNED_INT) { + for (i = 0; i < count; i++) + if (((GLuint *) indices)[i] > max) + max = ((GLuint *) indices)[i]; + } + else if (type == GL_UNSIGNED_SHORT) { + for (i = 0; i < count; i++) + if (((GLushort *) indices)[i] > max) + max = ((GLushort *) indices)[i]; + } + else { + ASSERT(type == GL_UNSIGNED_BYTE); + for (i = 0; i < count; i++) + if (((GLubyte *) indices)[i] > max) + max = ((GLubyte *) indices)[i]; + } + if (max >= ctx->Array._MaxElement) { + /* the max element is out of bounds of one or more enabled arrays */ + return GL_FALSE; + } + } + + return GL_TRUE; +} + + +GLboolean +_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, + GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices) +{ + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + if (count <= 0) { + if (count < 0) + _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" ); + return GL_FALSE; + } + + if (mode > GL_POLYGON) { + _mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(mode)" ); + return GL_FALSE; + } + + if (end < start) { + _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(endNewState) + _mesa_update_state(ctx); + + /* Always need vertex positions */ + if (!ctx->Array.Vertex.Enabled + && !(ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled)) + return GL_FALSE; + + if (ctx->Const.CheckArrayBounds) { + /* Find max array index. + * We don't trust the user's start and end values. + */ + GLuint max = 0; + GLint i; + if (type == GL_UNSIGNED_INT) { + for (i = 0; i < count; i++) + if (((GLuint *) indices)[i] > max) + max = ((GLuint *) indices)[i]; + } + else if (type == GL_UNSIGNED_SHORT) { + for (i = 0; i < count; i++) + if (((GLushort *) indices)[i] > max) + max = ((GLushort *) indices)[i]; + } + else { + ASSERT(type == GL_UNSIGNED_BYTE); + for (i = 0; i < count; i++) + if (((GLubyte *) indices)[i] > max) + max = ((GLubyte *) indices)[i]; + } + if (max >= ctx->Array._MaxElement) { + /* the max element is out of bounds of one or more enabled arrays */ + return GL_FALSE; + } + } + + return GL_TRUE; +} + + +/** + * Called from the tnl module to error check the function parameters and + * verify that we really can draw something. + */ +GLboolean +_mesa_validate_DrawArrays(GLcontext *ctx, + GLenum mode, GLint start, GLsizei count) +{ + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + if (count < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" ); + return GL_FALSE; + } + + if (mode > GL_POLYGON) { + _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); + return GL_FALSE; + } + + if (ctx->NewState) + _mesa_update_state(ctx); + + /* Always need vertex positions */ + if (!ctx->Array.Vertex.Enabled && !ctx->Array.VertexAttrib[0].Enabled) + return GL_FALSE; + + if (ctx->Const.CheckArrayBounds) { + if (start + count > (GLint) ctx->Array._MaxElement) + return GL_FALSE; + } + + return GL_TRUE; +} diff --git a/reactos/dll/mesa32/src/main/api_validate.h b/reactos/dll/mesa32/src/main/api_validate.h new file mode 100644 index 00000000000..10f0c34e663 --- /dev/null +++ b/reactos/dll/mesa32/src/main/api_validate.h @@ -0,0 +1,49 @@ + +/* + * 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 API_VALIDATE_H +#define API_VALIDATE_H + + +#include "mtypes.h" + +extern GLboolean +_mesa_validate_DrawArrays(GLcontext *ctx, + GLenum mode, GLint start, GLsizei count); + +extern GLboolean +_mesa_validate_DrawElements(GLcontext *ctx, + GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices); + +extern GLboolean +_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, + GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices); + + +#endif diff --git a/reactos/dll/mesa32/src/main/attrib.c b/reactos/dll/mesa32/src/main/attrib.c new file mode 100644 index 00000000000..28456942cba --- /dev/null +++ b/reactos/dll/mesa32/src/main/attrib.c @@ -0,0 +1,1328 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + +#include "glheader.h" +#include "imports.h" +#include "accum.h" +#include "attrib.h" +#include "blend.h" +#include "buffers.h" +#include "bufferobj.h" +#include "colormac.h" +#include "colortab.h" +#include "context.h" +#include "depth.h" +#include "enable.h" +#include "enums.h" +#include "fog.h" +#include "hint.h" +#include "light.h" +#include "lines.h" +#include "matrix.h" +#include "points.h" +#include "polygon.h" +#include "simple_list.h" +#include "stencil.h" +#include "texobj.h" +#include "texstate.h" +#include "mtypes.h" +#include "math/m_xform.h" + + +/* + * Allocate a new attribute state node. These nodes have a + * "kind" value and a pointer to a struct of state data. + */ +static struct gl_attrib_node * +new_attrib_node( GLbitfield kind ) +{ + struct gl_attrib_node *an = MALLOC_STRUCT(gl_attrib_node); + if (an) { + an->kind = kind; + } + return an; +} + + +void GLAPIENTRY +_mesa_PushAttrib(GLbitfield mask) +{ + struct gl_attrib_node *newnode; + struct gl_attrib_node *head; + + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glPushAttrib %x\n", (int) mask); + + if (ctx->AttribStackDepth >= MAX_ATTRIB_STACK_DEPTH) { + _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushAttrib" ); + return; + } + + /* Build linked list of attribute nodes which save all attribute */ + /* groups specified by the mask. */ + head = NULL; + + if (mask & GL_ACCUM_BUFFER_BIT) { + struct gl_accum_attrib *attr; + attr = MALLOC_STRUCT( gl_accum_attrib ); + MEMCPY( attr, &ctx->Accum, sizeof(struct gl_accum_attrib) ); + newnode = new_attrib_node( GL_ACCUM_BUFFER_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_COLOR_BUFFER_BIT) { + struct gl_colorbuffer_attrib *attr; + attr = MALLOC_STRUCT( gl_colorbuffer_attrib ); + MEMCPY( attr, &ctx->Color, sizeof(struct gl_colorbuffer_attrib) ); + newnode = new_attrib_node( GL_COLOR_BUFFER_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_CURRENT_BIT) { + struct gl_current_attrib *attr; + FLUSH_CURRENT( ctx, 0 ); + attr = MALLOC_STRUCT( gl_current_attrib ); + MEMCPY( attr, &ctx->Current, sizeof(struct gl_current_attrib) ); + newnode = new_attrib_node( GL_CURRENT_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_DEPTH_BUFFER_BIT) { + struct gl_depthbuffer_attrib *attr; + attr = MALLOC_STRUCT( gl_depthbuffer_attrib ); + MEMCPY( attr, &ctx->Depth, sizeof(struct gl_depthbuffer_attrib) ); + newnode = new_attrib_node( GL_DEPTH_BUFFER_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_ENABLE_BIT) { + struct gl_enable_attrib *attr; + GLuint i; + attr = MALLOC_STRUCT( gl_enable_attrib ); + /* Copy enable flags from all other attributes into the enable struct. */ + attr->AlphaTest = ctx->Color.AlphaEnabled; + attr->AutoNormal = ctx->Eval.AutoNormal; + attr->Blend = ctx->Color.BlendEnabled; + attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled; + attr->ColorMaterial = ctx->Light.ColorMaterialEnabled; + attr->ColorTable = ctx->Pixel.ColorTableEnabled; + attr->PostColorMatrixColorTable = ctx->Pixel.PostColorMatrixColorTableEnabled; + attr->PostConvolutionColorTable = ctx->Pixel.PostConvolutionColorTableEnabled; + attr->Convolution1D = ctx->Pixel.Convolution1DEnabled; + attr->Convolution2D = ctx->Pixel.Convolution2DEnabled; + attr->Separable2D = ctx->Pixel.Separable2DEnabled; + attr->CullFace = ctx->Polygon.CullFlag; + attr->DepthTest = ctx->Depth.Test; + attr->Dither = ctx->Color.DitherFlag; + attr->Fog = ctx->Fog.Enabled; + for (i=0;iLight[i] = ctx->Light.Light[i].Enabled; + } + attr->Lighting = ctx->Light.Enabled; + attr->LineSmooth = ctx->Line.SmoothFlag; + attr->LineStipple = ctx->Line.StippleFlag; + attr->Histogram = ctx->Pixel.HistogramEnabled; + attr->MinMax = ctx->Pixel.MinMaxEnabled; + attr->IndexLogicOp = ctx->Color.IndexLogicOpEnabled; + attr->ColorLogicOp = ctx->Color.ColorLogicOpEnabled; + attr->Map1Color4 = ctx->Eval.Map1Color4; + attr->Map1Index = ctx->Eval.Map1Index; + attr->Map1Normal = ctx->Eval.Map1Normal; + attr->Map1TextureCoord1 = ctx->Eval.Map1TextureCoord1; + attr->Map1TextureCoord2 = ctx->Eval.Map1TextureCoord2; + attr->Map1TextureCoord3 = ctx->Eval.Map1TextureCoord3; + attr->Map1TextureCoord4 = ctx->Eval.Map1TextureCoord4; + attr->Map1Vertex3 = ctx->Eval.Map1Vertex3; + attr->Map1Vertex4 = ctx->Eval.Map1Vertex4; + MEMCPY(attr->Map1Attrib, ctx->Eval.Map1Attrib, sizeof(ctx->Eval.Map1Attrib)); + attr->Map2Color4 = ctx->Eval.Map2Color4; + attr->Map2Index = ctx->Eval.Map2Index; + attr->Map2Normal = ctx->Eval.Map2Normal; + attr->Map2TextureCoord1 = ctx->Eval.Map2TextureCoord1; + attr->Map2TextureCoord2 = ctx->Eval.Map2TextureCoord2; + attr->Map2TextureCoord3 = ctx->Eval.Map2TextureCoord3; + attr->Map2TextureCoord4 = ctx->Eval.Map2TextureCoord4; + attr->Map2Vertex3 = ctx->Eval.Map2Vertex3; + attr->Map2Vertex4 = ctx->Eval.Map2Vertex4; + MEMCPY(attr->Map2Attrib, ctx->Eval.Map2Attrib, sizeof(ctx->Eval.Map2Attrib)); + attr->Normalize = ctx->Transform.Normalize; + attr->RasterPositionUnclipped = ctx->Transform.RasterPositionUnclipped; + attr->PixelTexture = ctx->Pixel.PixelTextureEnabled; + attr->PointSmooth = ctx->Point.SmoothFlag; + attr->PointSprite = ctx->Point.PointSprite; + attr->PolygonOffsetPoint = ctx->Polygon.OffsetPoint; + attr->PolygonOffsetLine = ctx->Polygon.OffsetLine; + attr->PolygonOffsetFill = ctx->Polygon.OffsetFill; + attr->PolygonSmooth = ctx->Polygon.SmoothFlag; + attr->PolygonStipple = ctx->Polygon.StippleFlag; + attr->RescaleNormals = ctx->Transform.RescaleNormals; + attr->Scissor = ctx->Scissor.Enabled; + attr->Stencil = ctx->Stencil.Enabled; + attr->StencilTwoSide = ctx->Stencil.TestTwoSide; + attr->MultisampleEnabled = ctx->Multisample.Enabled; + attr->SampleAlphaToCoverage = ctx->Multisample.SampleAlphaToCoverage; + attr->SampleAlphaToOne = ctx->Multisample.SampleAlphaToOne; + attr->SampleCoverage = ctx->Multisample.SampleCoverage; + attr->SampleCoverageInvert = ctx->Multisample.SampleCoverageInvert; + for (i=0; iTexture[i] = ctx->Texture.Unit[i].Enabled; + attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled; + attr->TextureColorTable[i] = ctx->Texture.Unit[i].ColorTableEnabled; + } + /* GL_NV_vertex_program */ + attr->VertexProgram = ctx->VertexProgram.Enabled; + attr->VertexProgramPointSize = ctx->VertexProgram.PointSizeEnabled; + attr->VertexProgramTwoSide = ctx->VertexProgram.TwoSideEnabled; + newnode = new_attrib_node( GL_ENABLE_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_EVAL_BIT) { + struct gl_eval_attrib *attr; + attr = MALLOC_STRUCT( gl_eval_attrib ); + MEMCPY( attr, &ctx->Eval, sizeof(struct gl_eval_attrib) ); + newnode = new_attrib_node( GL_EVAL_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_FOG_BIT) { + struct gl_fog_attrib *attr; + attr = MALLOC_STRUCT( gl_fog_attrib ); + MEMCPY( attr, &ctx->Fog, sizeof(struct gl_fog_attrib) ); + newnode = new_attrib_node( GL_FOG_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_HINT_BIT) { + struct gl_hint_attrib *attr; + attr = MALLOC_STRUCT( gl_hint_attrib ); + MEMCPY( attr, &ctx->Hint, sizeof(struct gl_hint_attrib) ); + newnode = new_attrib_node( GL_HINT_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_LIGHTING_BIT) { + struct gl_light_attrib *attr; + FLUSH_CURRENT(ctx, 0); /* flush material changes */ + attr = MALLOC_STRUCT( gl_light_attrib ); + MEMCPY( attr, &ctx->Light, sizeof(struct gl_light_attrib) ); + newnode = new_attrib_node( GL_LIGHTING_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_LINE_BIT) { + struct gl_line_attrib *attr; + attr = MALLOC_STRUCT( gl_line_attrib ); + MEMCPY( attr, &ctx->Line, sizeof(struct gl_line_attrib) ); + newnode = new_attrib_node( GL_LINE_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_LIST_BIT) { + struct gl_list_attrib *attr; + attr = MALLOC_STRUCT( gl_list_attrib ); + MEMCPY( attr, &ctx->List, sizeof(struct gl_list_attrib) ); + newnode = new_attrib_node( GL_LIST_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_PIXEL_MODE_BIT) { + struct gl_pixel_attrib *attr; + attr = MALLOC_STRUCT( gl_pixel_attrib ); + MEMCPY( attr, &ctx->Pixel, sizeof(struct gl_pixel_attrib) ); + newnode = new_attrib_node( GL_PIXEL_MODE_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_POINT_BIT) { + struct gl_point_attrib *attr; + attr = MALLOC_STRUCT( gl_point_attrib ); + MEMCPY( attr, &ctx->Point, sizeof(struct gl_point_attrib) ); + newnode = new_attrib_node( GL_POINT_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_POLYGON_BIT) { + struct gl_polygon_attrib *attr; + attr = MALLOC_STRUCT( gl_polygon_attrib ); + MEMCPY( attr, &ctx->Polygon, sizeof(struct gl_polygon_attrib) ); + newnode = new_attrib_node( GL_POLYGON_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_POLYGON_STIPPLE_BIT) { + GLuint *stipple; + stipple = (GLuint *) MALLOC( 32*sizeof(GLuint) ); + MEMCPY( stipple, ctx->PolygonStipple, 32*sizeof(GLuint) ); + newnode = new_attrib_node( GL_POLYGON_STIPPLE_BIT ); + newnode->data = stipple; + newnode->next = head; + head = newnode; + } + + if (mask & GL_SCISSOR_BIT) { + struct gl_scissor_attrib *attr; + attr = MALLOC_STRUCT( gl_scissor_attrib ); + MEMCPY( attr, &ctx->Scissor, sizeof(struct gl_scissor_attrib) ); + newnode = new_attrib_node( GL_SCISSOR_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_STENCIL_BUFFER_BIT) { + struct gl_stencil_attrib *attr; + attr = MALLOC_STRUCT( gl_stencil_attrib ); + MEMCPY( attr, &ctx->Stencil, sizeof(struct gl_stencil_attrib) ); + newnode = new_attrib_node( GL_STENCIL_BUFFER_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_TEXTURE_BIT) { + struct gl_texture_attrib *attr; + GLuint u; + /* Bump the texture object reference counts so that they don't + * inadvertantly get deleted. + */ + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + ctx->Texture.Unit[u].Current1D->RefCount++; + ctx->Texture.Unit[u].Current2D->RefCount++; + ctx->Texture.Unit[u].Current3D->RefCount++; + ctx->Texture.Unit[u].CurrentCubeMap->RefCount++; + ctx->Texture.Unit[u].CurrentRect->RefCount++; + } + attr = MALLOC_STRUCT( gl_texture_attrib ); + MEMCPY( attr, &ctx->Texture, sizeof(struct gl_texture_attrib) ); + /* copy state of the currently bound texture objects */ + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + _mesa_copy_texture_object(&attr->Unit[u].Saved1D, + attr->Unit[u].Current1D); + _mesa_copy_texture_object(&attr->Unit[u].Saved2D, + attr->Unit[u].Current2D); + _mesa_copy_texture_object(&attr->Unit[u].Saved3D, + attr->Unit[u].Current3D); + _mesa_copy_texture_object(&attr->Unit[u].SavedCubeMap, + attr->Unit[u].CurrentCubeMap); + _mesa_copy_texture_object(&attr->Unit[u].SavedRect, + attr->Unit[u].CurrentRect); + } + newnode = new_attrib_node( GL_TEXTURE_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_TRANSFORM_BIT) { + struct gl_transform_attrib *attr; + attr = MALLOC_STRUCT( gl_transform_attrib ); + MEMCPY( attr, &ctx->Transform, sizeof(struct gl_transform_attrib) ); + newnode = new_attrib_node( GL_TRANSFORM_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + if (mask & GL_VIEWPORT_BIT) { + struct gl_viewport_attrib *attr; + attr = MALLOC_STRUCT( gl_viewport_attrib ); + MEMCPY( attr, &ctx->Viewport, sizeof(struct gl_viewport_attrib) ); + newnode = new_attrib_node( GL_VIEWPORT_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + /* GL_ARB_multisample */ + if (mask & GL_MULTISAMPLE_BIT_ARB) { + struct gl_multisample_attrib *attr; + attr = MALLOC_STRUCT( gl_multisample_attrib ); + MEMCPY( attr, &ctx->Multisample, sizeof(struct gl_multisample_attrib) ); + newnode = new_attrib_node( GL_MULTISAMPLE_BIT_ARB ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + + ctx->AttribStack[ctx->AttribStackDepth] = head; + ctx->AttribStackDepth++; +} + + + +static void +pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) +{ + GLuint i; + +#define TEST_AND_UPDATE(VALUE, NEWVALUE, ENUM) \ + if ((VALUE) != (NEWVALUE)) { \ + _mesa_set_enable( ctx, ENUM, (NEWVALUE) ); \ + } + + TEST_AND_UPDATE(ctx->Color.AlphaEnabled, enable->AlphaTest, GL_ALPHA_TEST); + TEST_AND_UPDATE(ctx->Color.BlendEnabled, enable->Blend, GL_BLEND); + + for (i=0;iTransform.ClipPlanesEnabled & mask) != (enable->ClipPlanes & mask)) + _mesa_set_enable(ctx, (GLenum) (GL_CLIP_PLANE0 + i), + (GLboolean) ((enable->ClipPlanes & mask) ? GL_TRUE : GL_FALSE)); + } + + TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial, + GL_COLOR_MATERIAL); + TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled, enable->ColorTable, + GL_COLOR_TABLE); + TEST_AND_UPDATE(ctx->Pixel.PostColorMatrixColorTableEnabled, + enable->PostColorMatrixColorTable, + GL_POST_COLOR_MATRIX_COLOR_TABLE); + TEST_AND_UPDATE(ctx->Pixel.PostConvolutionColorTableEnabled, + enable->PostConvolutionColorTable, + GL_POST_CONVOLUTION_COLOR_TABLE); + TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE); + TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST); + TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER); + TEST_AND_UPDATE(ctx->Pixel.Convolution1DEnabled, enable->Convolution1D, + GL_CONVOLUTION_1D); + TEST_AND_UPDATE(ctx->Pixel.Convolution2DEnabled, enable->Convolution2D, + GL_CONVOLUTION_2D); + TEST_AND_UPDATE(ctx->Pixel.Separable2DEnabled, enable->Separable2D, + GL_SEPARABLE_2D); + TEST_AND_UPDATE(ctx->Fog.Enabled, enable->Fog, GL_FOG); + TEST_AND_UPDATE(ctx->Light.Enabled, enable->Lighting, GL_LIGHTING); + TEST_AND_UPDATE(ctx->Line.SmoothFlag, enable->LineSmooth, GL_LINE_SMOOTH); + TEST_AND_UPDATE(ctx->Line.StippleFlag, enable->LineStipple, + GL_LINE_STIPPLE); + TEST_AND_UPDATE(ctx->Color.IndexLogicOpEnabled, enable->IndexLogicOp, + GL_INDEX_LOGIC_OP); + TEST_AND_UPDATE(ctx->Color.ColorLogicOpEnabled, enable->ColorLogicOp, + GL_COLOR_LOGIC_OP); + + TEST_AND_UPDATE(ctx->Eval.Map1Color4, enable->Map1Color4, GL_MAP1_COLOR_4); + TEST_AND_UPDATE(ctx->Eval.Map1Index, enable->Map1Index, GL_MAP1_INDEX); + TEST_AND_UPDATE(ctx->Eval.Map1Normal, enable->Map1Normal, GL_MAP1_NORMAL); + TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord1, enable->Map1TextureCoord1, + GL_MAP1_TEXTURE_COORD_1); + TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord2, enable->Map1TextureCoord2, + GL_MAP1_TEXTURE_COORD_2); + TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord3, enable->Map1TextureCoord3, + GL_MAP1_TEXTURE_COORD_3); + TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord4, enable->Map1TextureCoord4, + GL_MAP1_TEXTURE_COORD_4); + TEST_AND_UPDATE(ctx->Eval.Map1Vertex3, enable->Map1Vertex3, + GL_MAP1_VERTEX_3); + TEST_AND_UPDATE(ctx->Eval.Map1Vertex4, enable->Map1Vertex4, + GL_MAP1_VERTEX_4); + for (i = 0; i < 16; i++) { + TEST_AND_UPDATE(ctx->Eval.Map1Attrib[i], enable->Map1Attrib[i], + GL_MAP1_VERTEX_ATTRIB0_4_NV + i); + } + + TEST_AND_UPDATE(ctx->Eval.Map2Color4, enable->Map2Color4, GL_MAP2_COLOR_4); + TEST_AND_UPDATE(ctx->Eval.Map2Index, enable->Map2Index, GL_MAP2_INDEX); + TEST_AND_UPDATE(ctx->Eval.Map2Normal, enable->Map2Normal, GL_MAP2_NORMAL); + TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord1, enable->Map2TextureCoord1, + GL_MAP2_TEXTURE_COORD_1); + TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord2, enable->Map2TextureCoord2, + GL_MAP2_TEXTURE_COORD_2); + TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord3, enable->Map2TextureCoord3, + GL_MAP2_TEXTURE_COORD_3); + TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord4, enable->Map2TextureCoord4, + GL_MAP2_TEXTURE_COORD_4); + TEST_AND_UPDATE(ctx->Eval.Map2Vertex3, enable->Map2Vertex3, + GL_MAP2_VERTEX_3); + TEST_AND_UPDATE(ctx->Eval.Map2Vertex4, enable->Map2Vertex4, + GL_MAP2_VERTEX_4); + for (i = 0; i < 16; i++) { + TEST_AND_UPDATE(ctx->Eval.Map2Attrib[i], enable->Map2Attrib[i], + GL_MAP2_VERTEX_ATTRIB0_4_NV + i); + } + + TEST_AND_UPDATE(ctx->Eval.AutoNormal, enable->AutoNormal, GL_AUTO_NORMAL); + TEST_AND_UPDATE(ctx->Transform.Normalize, enable->Normalize, GL_NORMALIZE); + TEST_AND_UPDATE(ctx->Transform.RescaleNormals, enable->RescaleNormals, + GL_RESCALE_NORMAL_EXT); + TEST_AND_UPDATE(ctx->Transform.RasterPositionUnclipped, + enable->RasterPositionUnclipped, + GL_RASTER_POSITION_UNCLIPPED_IBM); + TEST_AND_UPDATE(ctx->Pixel.PixelTextureEnabled, enable->PixelTexture, + GL_POINT_SMOOTH); + TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth, + GL_POINT_SMOOTH); + if (ctx->Extensions.NV_point_sprite || ctx->Extensions.ARB_point_sprite) { + TEST_AND_UPDATE(ctx->Point.PointSprite, enable->PointSprite, + GL_POINT_SPRITE_NV); + } + TEST_AND_UPDATE(ctx->Polygon.OffsetPoint, enable->PolygonOffsetPoint, + GL_POLYGON_OFFSET_POINT); + TEST_AND_UPDATE(ctx->Polygon.OffsetLine, enable->PolygonOffsetLine, + GL_POLYGON_OFFSET_LINE); + TEST_AND_UPDATE(ctx->Polygon.OffsetFill, enable->PolygonOffsetFill, + GL_POLYGON_OFFSET_FILL); + TEST_AND_UPDATE(ctx->Polygon.SmoothFlag, enable->PolygonSmooth, + GL_POLYGON_SMOOTH); + TEST_AND_UPDATE(ctx->Polygon.StippleFlag, enable->PolygonStipple, + GL_POLYGON_STIPPLE); + TEST_AND_UPDATE(ctx->Scissor.Enabled, enable->Scissor, GL_SCISSOR_TEST); + TEST_AND_UPDATE(ctx->Stencil.Enabled, enable->Stencil, GL_STENCIL_TEST); + if (ctx->Extensions.EXT_stencil_two_side) { + TEST_AND_UPDATE(ctx->Stencil.TestTwoSide, enable->StencilTwoSide, GL_STENCIL_TEST_TWO_SIDE_EXT); + } + TEST_AND_UPDATE(ctx->Multisample.Enabled, enable->MultisampleEnabled, + GL_MULTISAMPLE_ARB); + TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToCoverage, + enable->SampleAlphaToCoverage, + GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); + TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToOne, + enable->SampleAlphaToOne, + GL_SAMPLE_ALPHA_TO_ONE_ARB); + TEST_AND_UPDATE(ctx->Multisample.SampleCoverage, + enable->SampleCoverage, + GL_SAMPLE_COVERAGE_ARB); + TEST_AND_UPDATE(ctx->Multisample.SampleCoverageInvert, + enable->SampleCoverageInvert, + GL_SAMPLE_COVERAGE_INVERT_ARB); + /* GL_NV_vertex_program */ + TEST_AND_UPDATE(ctx->VertexProgram.Enabled, + enable->VertexProgram, + GL_VERTEX_PROGRAM_NV); + TEST_AND_UPDATE(ctx->VertexProgram.PointSizeEnabled, + enable->VertexProgramPointSize, + GL_VERTEX_PROGRAM_POINT_SIZE_NV); + TEST_AND_UPDATE(ctx->VertexProgram.TwoSideEnabled, + enable->VertexProgramTwoSide, + GL_VERTEX_PROGRAM_TWO_SIDE_NV); + +#undef TEST_AND_UPDATE + + /* texture unit enables */ + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { + if (ctx->Texture.Unit[i].Enabled != enable->Texture[i]) { + ctx->Texture.Unit[i].Enabled = enable->Texture[i]; + if (ctx->Driver.Enable) { + if (ctx->Driver.ActiveTexture) { + (*ctx->Driver.ActiveTexture)(ctx, i); + } + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_1D, + (GLboolean) (enable->Texture[i] & TEXTURE_1D_BIT) ); + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_2D, + (GLboolean) (enable->Texture[i] & TEXTURE_2D_BIT) ); + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_3D, + (GLboolean) (enable->Texture[i] & TEXTURE_3D_BIT) ); + if (ctx->Extensions.ARB_texture_cube_map) + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_CUBE_MAP_ARB, + (GLboolean) (enable->Texture[i] & TEXTURE_CUBE_BIT) ); + if (ctx->Extensions.NV_texture_rectangle) + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_RECTANGLE_NV, + (GLboolean) (enable->Texture[i] & TEXTURE_RECT_BIT) ); + } + } + + if (ctx->Texture.Unit[i].TexGenEnabled != enable->TexGen[i]) { + ctx->Texture.Unit[i].TexGenEnabled = enable->TexGen[i]; + if (ctx->Driver.Enable) { + if (ctx->Driver.ActiveTexture) { + (*ctx->Driver.ActiveTexture)(ctx, i); + } + if (enable->TexGen[i] & S_BIT) + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_S, GL_TRUE); + else + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_S, GL_FALSE); + if (enable->TexGen[i] & T_BIT) + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_T, GL_TRUE); + else + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_T, GL_FALSE); + if (enable->TexGen[i] & R_BIT) + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_R, GL_TRUE); + else + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_R, GL_FALSE); + if (enable->TexGen[i] & Q_BIT) + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_TRUE); + else + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_FALSE); + } + } + + /* GL_SGI_texture_color_table */ + ctx->Texture.Unit[i].ColorTableEnabled = enable->TextureColorTable[i]; + } + + if (ctx->Driver.ActiveTexture) { + (*ctx->Driver.ActiveTexture)(ctx, ctx->Texture.CurrentUnit); + } +} + + +static void +pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) +{ + GLuint u; + + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + const struct gl_texture_unit *unit = &texAttrib->Unit[u]; + GLuint i; + + _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + u); + _mesa_set_enable(ctx, GL_TEXTURE_1D, + (GLboolean) (unit->Enabled & TEXTURE_1D_BIT ? GL_TRUE : GL_FALSE)); + _mesa_set_enable(ctx, GL_TEXTURE_2D, + (GLboolean) (unit->Enabled & TEXTURE_2D_BIT ? GL_TRUE : GL_FALSE)); + _mesa_set_enable(ctx, GL_TEXTURE_3D, + (GLboolean) (unit->Enabled & TEXTURE_3D_BIT ? GL_TRUE : GL_FALSE)); + if (ctx->Extensions.ARB_texture_cube_map) { + _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB, + (GLboolean) (unit->Enabled & TEXTURE_CUBE_BIT ? GL_TRUE : GL_FALSE)); + } + if (ctx->Extensions.NV_texture_rectangle) { + _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_NV, + (GLboolean) (unit->Enabled & TEXTURE_RECT_BIT ? GL_TRUE : GL_FALSE)); + } + if (ctx->Extensions.SGI_texture_color_table) { + _mesa_set_enable(ctx, GL_TEXTURE_COLOR_TABLE_SGI, + unit->ColorTableEnabled); + } + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode); + _mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor); + _mesa_TexGeni(GL_S, GL_TEXTURE_GEN_MODE, unit->GenModeS); + _mesa_TexGeni(GL_T, GL_TEXTURE_GEN_MODE, unit->GenModeT); + _mesa_TexGeni(GL_R, GL_TEXTURE_GEN_MODE, unit->GenModeR); + _mesa_TexGeni(GL_Q, GL_TEXTURE_GEN_MODE, unit->GenModeQ); + _mesa_TexGenfv(GL_S, GL_OBJECT_PLANE, unit->ObjectPlaneS); + _mesa_TexGenfv(GL_T, GL_OBJECT_PLANE, unit->ObjectPlaneT); + _mesa_TexGenfv(GL_R, GL_OBJECT_PLANE, unit->ObjectPlaneR); + _mesa_TexGenfv(GL_Q, GL_OBJECT_PLANE, unit->ObjectPlaneQ); + _mesa_TexGenfv(GL_S, GL_EYE_PLANE, unit->EyePlaneS); + _mesa_TexGenfv(GL_T, GL_EYE_PLANE, unit->EyePlaneT); + _mesa_TexGenfv(GL_R, GL_EYE_PLANE, unit->EyePlaneR); + _mesa_TexGenfv(GL_Q, GL_EYE_PLANE, unit->EyePlaneQ); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, + ((unit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE)); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, + ((unit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE)); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, + ((unit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE)); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, + ((unit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE)); + if (ctx->Extensions.EXT_texture_lod_bias) { + _mesa_TexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, + GL_TEXTURE_LOD_BIAS_EXT, unit->LodBias); + } + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, + unit->Combine.ModeRGB); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, + unit->Combine.ModeA); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, + unit->Combine.SourceRGB[0]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, + unit->Combine.SourceRGB[1]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, + unit->Combine.SourceRGB[2]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, + unit->Combine.SourceA[0]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, + unit->Combine.SourceA[1]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA, + unit->Combine.SourceA[2]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, + unit->Combine.OperandRGB[0]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, + unit->Combine.OperandRGB[1]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, + unit->Combine.OperandRGB[2]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, + unit->Combine.OperandA[0]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, + unit->Combine.OperandA[1]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, + unit->Combine.OperandA[2]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, + 1 << unit->Combine.ScaleShiftRGB); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE, + 1 << unit->Combine.ScaleShiftA); + } + + /* Restore texture object state */ + for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { + GLenum target = 0; + const struct gl_texture_object *obj = NULL; + GLfloat bordColor[4]; + + switch (i) { + case 0: + target = GL_TEXTURE_1D; + obj = &unit->Saved1D; + break; + case 1: + target = GL_TEXTURE_2D; + obj = &unit->Saved2D; + break; + case 2: + target = GL_TEXTURE_3D; + obj = &unit->Saved3D; + break; + case 3: + if (!ctx->Extensions.ARB_texture_cube_map) + continue; + target = GL_TEXTURE_CUBE_MAP_ARB; + obj = &unit->SavedCubeMap; + break; + case 4: + if (!ctx->Extensions.NV_texture_rectangle) + continue; + target = GL_TEXTURE_RECTANGLE_NV; + obj = &unit->SavedRect; + break; + default: + ; /* silence warnings */ + } + + _mesa_BindTexture(target, obj->Name); + + bordColor[0] = CHAN_TO_FLOAT(obj->BorderColor[0]); + bordColor[1] = CHAN_TO_FLOAT(obj->BorderColor[1]); + bordColor[2] = CHAN_TO_FLOAT(obj->BorderColor[2]); + bordColor[3] = CHAN_TO_FLOAT(obj->BorderColor[3]); + + _mesa_TexParameterf(target, GL_TEXTURE_PRIORITY, obj->Priority); + _mesa_TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, bordColor); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, obj->WrapS); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, obj->WrapT); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_R, obj->WrapR); + _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, obj->MinFilter); + _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, obj->MagFilter); + _mesa_TexParameterf(target, GL_TEXTURE_MIN_LOD, obj->MinLod); + _mesa_TexParameterf(target, GL_TEXTURE_MAX_LOD, obj->MaxLod); + _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, obj->BaseLevel); + _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, obj->MaxLevel); + if (ctx->Extensions.EXT_texture_filter_anisotropic) { + _mesa_TexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, + obj->MaxAnisotropy); + } + if (ctx->Extensions.SGIX_shadow) { + _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_SGIX, + obj->CompareFlag); + _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_OPERATOR_SGIX, + obj->CompareOperator); + } + if (ctx->Extensions.SGIX_shadow_ambient) { + _mesa_TexParameterf(target, GL_SHADOW_AMBIENT_SGIX, + obj->ShadowAmbient); + } + + } + } + _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + + texAttrib->CurrentUnit); + + /* "un-bump" the texture object reference counts. We did that so they + * wouldn't inadvertantly get deleted while they were still referenced + * inside the attribute state stack. + */ + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + ctx->Texture.Unit[u].Current1D->RefCount--; + ctx->Texture.Unit[u].Current2D->RefCount--; + ctx->Texture.Unit[u].Current3D->RefCount--; + ctx->Texture.Unit[u].CurrentCubeMap->RefCount--; + ctx->Texture.Unit[u].CurrentRect->RefCount--; + } +} + + +/* + * This function is kind of long just because we have to call a lot + * of device driver functions to update device driver state. + * + * XXX As it is now, most of the pop-code calls immediate-mode Mesa functions + * in order to restore GL state. This isn't terribly efficient but it + * ensures that dirty flags and any derived state gets updated correctly. + * We could at least check if the value to restore equals the current value + * and then skip the Mesa call. + */ +void GLAPIENTRY +_mesa_PopAttrib(void) +{ + struct gl_attrib_node *attr, *next; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (ctx->AttribStackDepth == 0) { + _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopAttrib" ); + return; + } + + ctx->AttribStackDepth--; + attr = ctx->AttribStack[ctx->AttribStackDepth]; + + while (attr) { + + if (MESA_VERBOSE & VERBOSE_API) { + _mesa_debug(ctx, "glPopAttrib %s\n", + _mesa_lookup_enum_by_nr(attr->kind)); + } + + switch (attr->kind) { + case GL_ACCUM_BUFFER_BIT: + { + const struct gl_accum_attrib *accum; + accum = (const struct gl_accum_attrib *) attr->data; + _mesa_ClearAccum(accum->ClearColor[0], + accum->ClearColor[1], + accum->ClearColor[2], + accum->ClearColor[3]); + } + break; + case GL_COLOR_BUFFER_BIT: + { + const struct gl_colorbuffer_attrib *color; + color = (const struct gl_colorbuffer_attrib *) attr->data; + _mesa_ClearIndex((GLfloat) color->ClearIndex); + _mesa_ClearColor(color->ClearColor[0], + color->ClearColor[1], + color->ClearColor[2], + color->ClearColor[3]); + _mesa_IndexMask(color->IndexMask); + _mesa_ColorMask((GLboolean) (color->ColorMask[0] != 0), + (GLboolean) (color->ColorMask[1] != 0), + (GLboolean) (color->ColorMask[2] != 0), + (GLboolean) (color->ColorMask[3] != 0)); +#if 0 + _mesa_DrawBuffersARB(ctx->Const.MaxDrawBuffers, + color->DrawBuffer); +#else + _mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers, + color->DrawBuffer, NULL); +#endif + _mesa_set_enable(ctx, GL_ALPHA_TEST, color->AlphaEnabled); + _mesa_AlphaFunc(color->AlphaFunc, color->AlphaRef); + _mesa_set_enable(ctx, GL_BLEND, color->BlendEnabled); + _mesa_BlendFuncSeparateEXT(color->BlendSrcRGB, + color->BlendDstRGB, + color->BlendSrcA, + color->BlendDstA); + /* This special case is because glBlendEquationSeparateEXT + * cannot take GL_LOGIC_OP as a parameter. + */ + if ( color->BlendEquationRGB == color->BlendEquationA ) { + _mesa_BlendEquation(color->BlendEquationRGB); + } + else { + _mesa_BlendEquationSeparateEXT(color->BlendEquationRGB, + color->BlendEquationA); + } + _mesa_BlendColor(color->BlendColor[0], + color->BlendColor[1], + color->BlendColor[2], + color->BlendColor[3]); + _mesa_LogicOp(color->LogicOp); + _mesa_set_enable(ctx, GL_COLOR_LOGIC_OP, + color->ColorLogicOpEnabled); + _mesa_set_enable(ctx, GL_INDEX_LOGIC_OP, + color->IndexLogicOpEnabled); + _mesa_set_enable(ctx, GL_DITHER, color->DitherFlag); + } + break; + case GL_CURRENT_BIT: + FLUSH_CURRENT( ctx, 0 ); + MEMCPY( &ctx->Current, attr->data, + sizeof(struct gl_current_attrib) ); + break; + case GL_DEPTH_BUFFER_BIT: + { + const struct gl_depthbuffer_attrib *depth; + depth = (const struct gl_depthbuffer_attrib *) attr->data; + _mesa_DepthFunc(depth->Func); + _mesa_ClearDepth(depth->Clear); + _mesa_set_enable(ctx, GL_DEPTH_TEST, depth->Test); + _mesa_DepthMask(depth->Mask); + if (ctx->Extensions.HP_occlusion_test) + _mesa_set_enable(ctx, GL_OCCLUSION_TEST_HP, + depth->OcclusionTest); + } + break; + case GL_ENABLE_BIT: + { + const struct gl_enable_attrib *enable; + enable = (const struct gl_enable_attrib *) attr->data; + pop_enable_group(ctx, enable); + ctx->NewState |= _NEW_ALL; + } + break; + case GL_EVAL_BIT: + MEMCPY( &ctx->Eval, attr->data, sizeof(struct gl_eval_attrib) ); + ctx->NewState |= _NEW_EVAL; + break; + case GL_FOG_BIT: + { + const struct gl_fog_attrib *fog; + fog = (const struct gl_fog_attrib *) attr->data; + _mesa_set_enable(ctx, GL_FOG, fog->Enabled); + _mesa_Fogfv(GL_FOG_COLOR, fog->Color); + _mesa_Fogf(GL_FOG_DENSITY, fog->Density); + _mesa_Fogf(GL_FOG_START, fog->Start); + _mesa_Fogf(GL_FOG_END, fog->End); + _mesa_Fogf(GL_FOG_INDEX, fog->Index); + _mesa_Fogi(GL_FOG_MODE, fog->Mode); + } + break; + case GL_HINT_BIT: + { + const struct gl_hint_attrib *hint; + hint = (const struct gl_hint_attrib *) attr->data; + _mesa_Hint(GL_PERSPECTIVE_CORRECTION_HINT, + hint->PerspectiveCorrection ); + _mesa_Hint(GL_POINT_SMOOTH_HINT, hint->PointSmooth); + _mesa_Hint(GL_LINE_SMOOTH_HINT, hint->LineSmooth); + _mesa_Hint(GL_POLYGON_SMOOTH_HINT, hint->PolygonSmooth); + _mesa_Hint(GL_FOG_HINT, hint->Fog); + _mesa_Hint(GL_CLIP_VOLUME_CLIPPING_HINT_EXT, + hint->ClipVolumeClipping); + if (ctx->Extensions.ARB_texture_compression) + _mesa_Hint(GL_TEXTURE_COMPRESSION_HINT_ARB, + hint->TextureCompression); + } + break; + case GL_LIGHTING_BIT: + { + GLuint i; + const struct gl_light_attrib *light; + light = (const struct gl_light_attrib *) attr->data; + /* lighting enable */ + _mesa_set_enable(ctx, GL_LIGHTING, light->Enabled); + /* per-light state */ + if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); + + for (i = 0; i < MAX_LIGHTS; i++) { + GLenum lgt = (GLenum) (GL_LIGHT0 + i); + const struct gl_light *l = &light->Light[i]; + GLfloat tmp[4]; + _mesa_set_enable(ctx, lgt, l->Enabled); + _mesa_Lightfv( lgt, GL_AMBIENT, l->Ambient ); + _mesa_Lightfv( lgt, GL_DIFFUSE, l->Diffuse ); + _mesa_Lightfv( lgt, GL_SPECULAR, l->Specular ); + TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->inv, l->EyePosition ); + _mesa_Lightfv( lgt, GL_POSITION, tmp ); + TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->m, l->EyeDirection ); + _mesa_Lightfv( lgt, GL_SPOT_DIRECTION, tmp ); + _mesa_Lightfv( lgt, GL_SPOT_EXPONENT, &l->SpotExponent ); + _mesa_Lightfv( lgt, GL_SPOT_CUTOFF, &l->SpotCutoff ); + _mesa_Lightfv( lgt, GL_CONSTANT_ATTENUATION, + &l->ConstantAttenuation ); + _mesa_Lightfv( lgt, GL_LINEAR_ATTENUATION, + &l->LinearAttenuation ); + _mesa_Lightfv( lgt, GL_QUADRATIC_ATTENUATION, + &l->QuadraticAttenuation ); + } + /* light model */ + _mesa_LightModelfv(GL_LIGHT_MODEL_AMBIENT, + light->Model.Ambient); + _mesa_LightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, + (GLfloat) light->Model.LocalViewer); + _mesa_LightModelf(GL_LIGHT_MODEL_TWO_SIDE, + (GLfloat) light->Model.TwoSide); + _mesa_LightModelf(GL_LIGHT_MODEL_COLOR_CONTROL, + (GLfloat) light->Model.ColorControl); + /* materials */ + MEMCPY(&ctx->Light.Material, &light->Material, + sizeof(struct gl_material)); + /* shade model */ + _mesa_ShadeModel(light->ShadeModel); + /* color material */ + _mesa_ColorMaterial(light->ColorMaterialFace, + light->ColorMaterialMode); + _mesa_set_enable(ctx, GL_COLOR_MATERIAL, + light->ColorMaterialEnabled); + } + break; + case GL_LINE_BIT: + { + const struct gl_line_attrib *line; + line = (const struct gl_line_attrib *) attr->data; + _mesa_set_enable(ctx, GL_LINE_SMOOTH, line->SmoothFlag); + _mesa_set_enable(ctx, GL_LINE_STIPPLE, line->StippleFlag); + _mesa_LineStipple(line->StippleFactor, line->StipplePattern); + _mesa_LineWidth(line->Width); + } + break; + case GL_LIST_BIT: + MEMCPY( &ctx->List, attr->data, sizeof(struct gl_list_attrib) ); + break; + case GL_PIXEL_MODE_BIT: + MEMCPY( &ctx->Pixel, attr->data, sizeof(struct gl_pixel_attrib) ); + /* XXX what other pixel state needs to be set by function calls? */ + _mesa_ReadBuffer(ctx->Pixel.ReadBuffer); + ctx->NewState |= _NEW_PIXEL; + break; + case GL_POINT_BIT: + { + const struct gl_point_attrib *point; + point = (const struct gl_point_attrib *) attr->data; + _mesa_PointSize(point->Size); + _mesa_set_enable(ctx, GL_POINT_SMOOTH, point->SmoothFlag); + if (ctx->Extensions.EXT_point_parameters) { + _mesa_PointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, + point->Params); + _mesa_PointParameterfEXT(GL_POINT_SIZE_MIN_EXT, + point->MinSize); + _mesa_PointParameterfEXT(GL_POINT_SIZE_MAX_EXT, + point->MaxSize); + _mesa_PointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, + point->Threshold); + } + if (ctx->Extensions.NV_point_sprite + || ctx->Extensions.ARB_point_sprite) { + GLuint u; + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + _mesa_TexEnvi(GL_POINT_SPRITE_NV, GL_COORD_REPLACE_NV, + (GLint) point->CoordReplace[u]); + } + _mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite); + _mesa_PointParameteriNV(GL_POINT_SPRITE_R_MODE_NV, + ctx->Point.SpriteRMode); + _mesa_PointParameterfEXT(GL_POINT_SPRITE_COORD_ORIGIN, + (GLfloat)ctx->Point.SpriteOrigin); + } + } + break; + case GL_POLYGON_BIT: + { + const struct gl_polygon_attrib *polygon; + polygon = (const struct gl_polygon_attrib *) attr->data; + _mesa_CullFace(polygon->CullFaceMode); + _mesa_FrontFace(polygon->FrontFace); + _mesa_PolygonMode(GL_FRONT, polygon->FrontMode); + _mesa_PolygonMode(GL_BACK, polygon->BackMode); + _mesa_PolygonOffset(polygon->OffsetFactor, + polygon->OffsetUnits); + _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, polygon->SmoothFlag); + _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, polygon->StippleFlag); + _mesa_set_enable(ctx, GL_CULL_FACE, polygon->CullFlag); + _mesa_set_enable(ctx, GL_POLYGON_OFFSET_POINT, + polygon->OffsetPoint); + _mesa_set_enable(ctx, GL_POLYGON_OFFSET_LINE, + polygon->OffsetLine); + _mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL, + polygon->OffsetFill); + } + break; + case GL_POLYGON_STIPPLE_BIT: + MEMCPY( ctx->PolygonStipple, attr->data, 32*sizeof(GLuint) ); + ctx->NewState |= _NEW_POLYGONSTIPPLE; + if (ctx->Driver.PolygonStipple) + ctx->Driver.PolygonStipple( ctx, (const GLubyte *) attr->data ); + break; + case GL_SCISSOR_BIT: + { + const struct gl_scissor_attrib *scissor; + scissor = (const struct gl_scissor_attrib *) attr->data; + _mesa_Scissor(scissor->X, scissor->Y, + scissor->Width, scissor->Height); + _mesa_set_enable(ctx, GL_SCISSOR_TEST, scissor->Enabled); + } + break; + case GL_STENCIL_BUFFER_BIT: + { + GLint face; + const struct gl_stencil_attrib *stencil; + stencil = (const struct gl_stencil_attrib *) attr->data; + _mesa_set_enable(ctx, GL_STENCIL_TEST, stencil->Enabled); + _mesa_ClearStencil(stencil->Clear); + face = stencil->ActiveFace; + if (ctx->Extensions.EXT_stencil_two_side) { + _mesa_set_enable(ctx, GL_STENCIL_TEST_TWO_SIDE_EXT, stencil->TestTwoSide); + face ^= 1; + } + do { + _mesa_ActiveStencilFaceEXT(face); + _mesa_StencilFunc(stencil->Function[face], stencil->Ref[face], + stencil->ValueMask[face]); + _mesa_StencilMask(stencil->WriteMask[face]); + _mesa_StencilOp(stencil->FailFunc[face], + stencil->ZFailFunc[face], + stencil->ZPassFunc[face]); + face ^= 1; + } while (face != (stencil->ActiveFace ^ 1)); + } + break; + case GL_TRANSFORM_BIT: + { + GLuint i; + const struct gl_transform_attrib *xform; + xform = (const struct gl_transform_attrib *) attr->data; + _mesa_MatrixMode(xform->MatrixMode); + if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top)) + _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); + + /* restore clip planes */ + for (i = 0; i < MAX_CLIP_PLANES; i++) { + const GLuint mask = 1 << 1; + const GLfloat *eyePlane = xform->EyeUserPlane[i]; + COPY_4V(ctx->Transform.EyeUserPlane[i], eyePlane); + if (xform->ClipPlanesEnabled & mask) { + _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_TRUE); + } + else { + _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_FALSE); + } + if (ctx->Driver.ClipPlane) + ctx->Driver.ClipPlane( ctx, GL_CLIP_PLANE0 + i, eyePlane ); + } + + /* normalize/rescale */ + if (xform->Normalize != ctx->Transform.Normalize) + _mesa_set_enable(ctx, GL_NORMALIZE,ctx->Transform.Normalize); + if (xform->RescaleNormals != ctx->Transform.RescaleNormals) + _mesa_set_enable(ctx, GL_RESCALE_NORMAL_EXT, + ctx->Transform.RescaleNormals); + } + break; + case GL_TEXTURE_BIT: + /* Take care of texture object reference counters */ + { + const struct gl_texture_attrib *texture; + texture = (const struct gl_texture_attrib *) attr->data; + pop_texture_group(ctx, texture); + ctx->NewState |= _NEW_TEXTURE; + } + break; + case GL_VIEWPORT_BIT: + { + const struct gl_viewport_attrib *vp; + vp = (const struct gl_viewport_attrib *) attr->data; + _mesa_Viewport(vp->X, vp->Y, vp->Width, vp->Height); + _mesa_DepthRange(vp->Near, vp->Far); + } + break; + case GL_MULTISAMPLE_BIT_ARB: + { + const struct gl_multisample_attrib *ms; + ms = (const struct gl_multisample_attrib *) attr->data; + _mesa_SampleCoverageARB(ms->SampleCoverageValue, + ms->SampleCoverageInvert); + } + break; + + default: + _mesa_problem( ctx, "Bad attrib flag in PopAttrib"); + break; + } + + next = attr->next; + FREE( attr->data ); + FREE( attr ); + attr = next; + } +} + + +/** + * Helper for incrementing/decrementing vertex buffer object reference + * counts when pushing/popping the GL_CLIENT_VERTEX_ARRAY_BIT attribute group. + */ +static void +adjust_buffer_object_ref_counts(struct gl_array_attrib *array, GLint step) +{ + GLuint i; + array->Vertex.BufferObj->RefCount += step; + array->Normal.BufferObj->RefCount += step; + array->Color.BufferObj->RefCount += step; + array->SecondaryColor.BufferObj->RefCount += step; + array->FogCoord.BufferObj->RefCount += step; + array->Index.BufferObj->RefCount += step; + array->EdgeFlag.BufferObj->RefCount += step; + for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) + array->TexCoord[i].BufferObj->RefCount += step; + for (i = 0; i < VERT_ATTRIB_MAX; i++) + array->VertexAttrib[i].BufferObj->RefCount += step; + + array->ArrayBufferObj->RefCount += step; + array->ElementArrayBufferObj->RefCount += step; +} + + +#define GL_CLIENT_PACK_BIT (1<<20) +#define GL_CLIENT_UNPACK_BIT (1<<21) + + +void GLAPIENTRY +_mesa_PushClientAttrib(GLbitfield mask) +{ + struct gl_attrib_node *newnode; + struct gl_attrib_node *head; + + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->ClientAttribStackDepth >= MAX_CLIENT_ATTRIB_STACK_DEPTH) { + _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushClientAttrib" ); + return; + } + + /* Build linked list of attribute nodes which save all attribute */ + /* groups specified by the mask. */ + head = NULL; + + if (mask & GL_CLIENT_PIXEL_STORE_BIT) { + struct gl_pixelstore_attrib *attr; +#if FEATURE_EXT_pixel_buffer_object + ctx->Pack.BufferObj->RefCount++; + ctx->Unpack.BufferObj->RefCount++; +#endif + /* packing attribs */ + attr = MALLOC_STRUCT( gl_pixelstore_attrib ); + MEMCPY( attr, &ctx->Pack, sizeof(struct gl_pixelstore_attrib) ); + newnode = new_attrib_node( GL_CLIENT_PACK_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + /* unpacking attribs */ + attr = MALLOC_STRUCT( gl_pixelstore_attrib ); + MEMCPY( attr, &ctx->Unpack, sizeof(struct gl_pixelstore_attrib) ); + newnode = new_attrib_node( GL_CLIENT_UNPACK_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + } + if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) { + struct gl_array_attrib *attr; + attr = MALLOC_STRUCT( gl_array_attrib ); + MEMCPY( attr, &ctx->Array, sizeof(struct gl_array_attrib) ); + newnode = new_attrib_node( GL_CLIENT_VERTEX_ARRAY_BIT ); + newnode->data = attr; + newnode->next = head; + head = newnode; + /* bump reference counts on buffer objects */ + adjust_buffer_object_ref_counts(&ctx->Array, 1); + } + + ctx->ClientAttribStack[ctx->ClientAttribStackDepth] = head; + ctx->ClientAttribStackDepth++; +} + + + + +void GLAPIENTRY +_mesa_PopClientAttrib(void) +{ + struct gl_attrib_node *attr, *next; + + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (ctx->ClientAttribStackDepth == 0) { + _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopClientAttrib" ); + return; + } + + ctx->ClientAttribStackDepth--; + attr = ctx->ClientAttribStack[ctx->ClientAttribStackDepth]; + + while (attr) { + switch (attr->kind) { + case GL_CLIENT_PACK_BIT: +#if FEATURE_EXT_pixel_buffer_object + ctx->Pack.BufferObj->RefCount--; + if (ctx->Pack.BufferObj->RefCount <= 0) { + _mesa_remove_buffer_object( ctx, ctx->Pack.BufferObj ); + (*ctx->Driver.DeleteBuffer)( ctx, ctx->Pack.BufferObj ); + } +#endif + MEMCPY( &ctx->Pack, attr->data, + sizeof(struct gl_pixelstore_attrib) ); + ctx->NewState |= _NEW_PACKUNPACK; + break; + case GL_CLIENT_UNPACK_BIT: +#if FEATURE_EXT_pixel_buffer_object + ctx->Unpack.BufferObj->RefCount--; + if (ctx->Unpack.BufferObj->RefCount <= 0) { + _mesa_remove_buffer_object( ctx, ctx->Unpack.BufferObj ); + (*ctx->Driver.DeleteBuffer)( ctx, ctx->Unpack.BufferObj ); + } +#endif + MEMCPY( &ctx->Unpack, attr->data, + sizeof(struct gl_pixelstore_attrib) ); + ctx->NewState |= _NEW_PACKUNPACK; + break; + case GL_CLIENT_VERTEX_ARRAY_BIT: + adjust_buffer_object_ref_counts(&ctx->Array, -1); + MEMCPY( &ctx->Array, attr->data, + sizeof(struct gl_array_attrib) ); + /* decrement reference counts on buffer objects */ + ctx->NewState |= _NEW_ARRAY; + break; + default: + _mesa_problem( ctx, "Bad attrib flag in PopClientAttrib"); + break; + } + + next = attr->next; + FREE( attr->data ); + FREE( attr ); + attr = next; + } +} + + +void _mesa_init_attrib( GLcontext *ctx ) +{ + /* Renderer and client attribute stacks */ + ctx->AttribStackDepth = 0; + ctx->ClientAttribStackDepth = 0; +} diff --git a/reactos/dll/mesa32/src/main/attrib.h b/reactos/dll/mesa32/src/main/attrib.h new file mode 100644 index 00000000000..09d75196b23 --- /dev/null +++ b/reactos/dll/mesa32/src/main/attrib.h @@ -0,0 +1,68 @@ +/** + * \file attrib.h + * Attribute stacks. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * 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. + */ + + + +#ifndef ATTRIB_H +#define ATTRIB_H + + +#include "mtypes.h" + + +#if _HAVE_FULL_GL + +extern void GLAPIENTRY +_mesa_PushAttrib( GLbitfield mask ); + +extern void GLAPIENTRY +_mesa_PopAttrib( void ); + +extern void GLAPIENTRY +_mesa_PushClientAttrib( GLbitfield mask ); + +extern void GLAPIENTRY +_mesa_PopClientAttrib( void ); + +extern void +_mesa_init_attrib( GLcontext *ctx ); + +#else + +/** No-op */ +#define _mesa_init_attrib( c ) ((void)0) + +#endif + +#endif diff --git a/reactos/dll/mesa32/src/main/blend.c b/reactos/dll/mesa32/src/main/blend.c new file mode 100644 index 00000000000..61b2b17c0c3 --- /dev/null +++ b/reactos/dll/mesa32/src/main/blend.c @@ -0,0 +1,579 @@ +/** + * \file blend.c + * Blending operations. + */ + +/* + * 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. + */ + + + +#include "glheader.h" +#include "blend.h" +#include "colormac.h" +#include "context.h" +#include "enums.h" +#include "macros.h" +#include "mtypes.h" + + +/** + * Specify the blending operation. + * + * \param sfactor source factor operator. + * \param dfactor destination factor operator. + * + * \sa glBlendFunc, glBlendFuncSeparateEXT + * + * Swizzles the inputs and calls \c glBlendFuncSeparateEXT. This is done + * using the \c CurrentDispatch table in the context, so this same function + * can be used while compiling display lists. Therefore, there is no need + * for the display list code to save and restore this function. + */ +void GLAPIENTRY +_mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) +{ + GET_CURRENT_CONTEXT(ctx); + + (*ctx->CurrentDispatch->BlendFuncSeparateEXT)( sfactor, dfactor, + sfactor, dfactor ); +} + + +/** + * Process GL_EXT_blend_func_separate(). + * + * \param sfactorRGB RGB source factor operator. + * \param dfactorRGB RGB destination factor operator. + * \param sfactorA alpha source factor operator. + * \param dfactorA alpha destination factor operator. + * + * Verifies the parameters and updates gl_colorbuffer_attrib. + * On a change, flush the vertices and notify the driver via + * dd_function_table::BlendFuncSeparate. + */ +void GLAPIENTRY +_mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glBlendFuncSeparate %s %s %s %s\n", + _mesa_lookup_enum_by_nr(sfactorRGB), + _mesa_lookup_enum_by_nr(dfactorRGB), + _mesa_lookup_enum_by_nr(sfactorA), + _mesa_lookup_enum_by_nr(dfactorA)); + + switch (sfactorRGB) { + case GL_SRC_COLOR: + case GL_ONE_MINUS_SRC_COLOR: + if (!ctx->Extensions.NV_blend_square) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (sfactorRGB)"); + return; + } + /* fall-through */ + case GL_ZERO: + case GL_ONE: + case GL_DST_COLOR: + case GL_ONE_MINUS_DST_COLOR: + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + case GL_DST_ALPHA: + case GL_ONE_MINUS_DST_ALPHA: + case GL_SRC_ALPHA_SATURATE: + case GL_CONSTANT_COLOR: + case GL_ONE_MINUS_CONSTANT_COLOR: + case GL_CONSTANT_ALPHA: + case GL_ONE_MINUS_CONSTANT_ALPHA: + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (sfactorRGB)"); + return; + } + + switch (dfactorRGB) { + case GL_DST_COLOR: + case GL_ONE_MINUS_DST_COLOR: + if (!ctx->Extensions.NV_blend_square) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (dfactorRGB)"); + return; + } + /* fall-through */ + case GL_ZERO: + case GL_ONE: + case GL_SRC_COLOR: + case GL_ONE_MINUS_SRC_COLOR: + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + case GL_DST_ALPHA: + case GL_ONE_MINUS_DST_ALPHA: + case GL_CONSTANT_COLOR: + case GL_ONE_MINUS_CONSTANT_COLOR: + case GL_CONSTANT_ALPHA: + case GL_ONE_MINUS_CONSTANT_ALPHA: + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (dfactorRGB)"); + return; + } + + switch (sfactorA) { + case GL_SRC_COLOR: + case GL_ONE_MINUS_SRC_COLOR: + if (!ctx->Extensions.NV_blend_square) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (sfactorA)"); + return; + } + /* fall-through */ + case GL_ZERO: + case GL_ONE: + case GL_DST_COLOR: + case GL_ONE_MINUS_DST_COLOR: + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + case GL_DST_ALPHA: + case GL_ONE_MINUS_DST_ALPHA: + case GL_SRC_ALPHA_SATURATE: + case GL_CONSTANT_COLOR: + case GL_ONE_MINUS_CONSTANT_COLOR: + case GL_CONSTANT_ALPHA: + case GL_ONE_MINUS_CONSTANT_ALPHA: + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (sfactorA)"); + return; + } + + switch (dfactorA) { + case GL_DST_COLOR: + case GL_ONE_MINUS_DST_COLOR: + if (!ctx->Extensions.NV_blend_square) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (dfactorA)"); + return; + } + /* fall-through */ + case GL_ZERO: + case GL_ONE: + case GL_SRC_COLOR: + case GL_ONE_MINUS_SRC_COLOR: + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + case GL_DST_ALPHA: + case GL_ONE_MINUS_DST_ALPHA: + case GL_CONSTANT_COLOR: + case GL_ONE_MINUS_CONSTANT_COLOR: + case GL_CONSTANT_ALPHA: + case GL_ONE_MINUS_CONSTANT_ALPHA: + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (dfactorA)" ); + return; + } + + if (ctx->Color.BlendSrcRGB == sfactorRGB && + ctx->Color.BlendDstRGB == dfactorRGB && + ctx->Color.BlendSrcA == sfactorA && + ctx->Color.BlendDstA == dfactorA) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + + ctx->Color.BlendSrcRGB = sfactorRGB; + ctx->Color.BlendDstRGB = dfactorRGB; + ctx->Color.BlendSrcA = sfactorA; + ctx->Color.BlendDstA = dfactorA; + + if (ctx->Driver.BlendFuncSeparate) { + (*ctx->Driver.BlendFuncSeparate)( ctx, sfactorRGB, dfactorRGB, + sfactorA, dfactorA ); + } +} + + +#if _HAVE_FULL_GL + +static GLboolean +_mesa_validate_blend_equation( GLcontext *ctx, + GLenum mode, GLboolean is_separate ) +{ + switch (mode) { + case GL_FUNC_ADD: + break; + case GL_MIN: + case GL_MAX: + if (!ctx->Extensions.EXT_blend_minmax && + !ctx->Extensions.ARB_imaging) { + return GL_FALSE; + } + break; + /* glBlendEquationSeparate cannot take GL_LOGIC_OP as a parameter. + */ + case GL_LOGIC_OP: + if (!ctx->Extensions.EXT_blend_logic_op || is_separate) { + return GL_FALSE; + } + break; + case GL_FUNC_SUBTRACT: + case GL_FUNC_REVERSE_SUBTRACT: + if (!ctx->Extensions.EXT_blend_subtract && + !ctx->Extensions.ARB_imaging) { + return GL_FALSE; + } + break; + default: + return GL_FALSE; + } + + return GL_TRUE; +} + + +/* This is really an extension function! */ +void GLAPIENTRY +_mesa_BlendEquation( GLenum mode ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glBlendEquation %s\n", + _mesa_lookup_enum_by_nr(mode)); + + if ( ! _mesa_validate_blend_equation( ctx, mode, GL_FALSE ) ) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquation"); + return; + } + + if ( (ctx->Color.BlendEquationRGB == mode) && + (ctx->Color.BlendEquationA == mode) ) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.BlendEquationRGB = mode; + ctx->Color.BlendEquationA = mode; + + /* This is needed to support 1.1's RGB logic ops AND + * 1.0's blending logicops. + */ + ctx->Color._LogicOpEnabled = (ctx->Color.ColorLogicOpEnabled || + (ctx->Color.BlendEnabled && + mode == GL_LOGIC_OP)); + + if (ctx->Driver.BlendEquationSeparate) + (*ctx->Driver.BlendEquationSeparate)( ctx, mode, mode ); +} + + +void GLAPIENTRY +_mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glBlendEquationSeparateEXT %s %s\n", + _mesa_lookup_enum_by_nr(modeRGB), + _mesa_lookup_enum_by_nr(modeA)); + + if ( (modeRGB != modeA) && !ctx->Extensions.EXT_blend_equation_separate ) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlendEquationSeparateEXT not supported by driver"); + return; + } + + if ( ! _mesa_validate_blend_equation( ctx, modeRGB, GL_TRUE ) ) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparateEXT(modeRGB)"); + return; + } + + if ( ! _mesa_validate_blend_equation( ctx, modeA, GL_TRUE ) ) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparateEXT(modeA)"); + return; + } + + + if ( (ctx->Color.BlendEquationRGB == modeRGB) && + (ctx->Color.BlendEquationA == modeA) ) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.BlendEquationRGB = modeRGB; + ctx->Color.BlendEquationA = modeA; + + /* This is needed to support 1.1's RGB logic ops AND + * 1.0's blending logicops. This test is simplified over glBlendEquation + * because modeRGB cannot be GL_LOGIC_OP. + */ + ctx->Color._LogicOpEnabled = (ctx->Color.ColorLogicOpEnabled); + + if (ctx->Driver.BlendEquationSeparate) + (*ctx->Driver.BlendEquationSeparate)( ctx, modeRGB, modeA ); +} +#endif + + +/** + * Set the blending color. + * + * \param red red color component. + * \param green green color component. + * \param blue blue color component. + * \param alpha alpha color component. + * + * \sa glBlendColor(). + * + * Clamps the parameters and updates gl_colorbuffer_attrib::BlendColor. On a + * change, flushes the vertices and notifies the driver via + * dd_function_table::BlendColor callback. + */ +void GLAPIENTRY +_mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) +{ + GLfloat tmp[4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + tmp[0] = CLAMP( red, 0.0F, 1.0F ); + tmp[1] = CLAMP( green, 0.0F, 1.0F ); + tmp[2] = CLAMP( blue, 0.0F, 1.0F ); + tmp[3] = CLAMP( alpha, 0.0F, 1.0F ); + + if (TEST_EQ_4V(tmp, ctx->Color.BlendColor)) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + COPY_4FV( ctx->Color.BlendColor, tmp ); + + if (ctx->Driver.BlendColor) + (*ctx->Driver.BlendColor)(ctx, tmp); +} + + +/** + * Specify the alpha test function. + * + * \param func alpha comparison function. + * \param ref reference value. + * + * Verifies the parameters and updates gl_colorbuffer_attrib. + * On a change, flushes the vertices and notifies the driver via + * dd_function_table::AlphaFunc callback. + */ +void GLAPIENTRY +_mesa_AlphaFunc( GLenum func, GLclampf ref ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (func) { + case GL_NEVER: + case GL_LESS: + case GL_EQUAL: + case GL_LEQUAL: + case GL_GREATER: + case GL_NOTEQUAL: + case GL_GEQUAL: + case GL_ALWAYS: + ref = CLAMP(ref, 0.0F, 1.0F); + + if (ctx->Color.AlphaFunc == func && ctx->Color.AlphaRef == ref) + return; /* no change */ + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.AlphaFunc = func; + ctx->Color.AlphaRef = ref; + + if (ctx->Driver.AlphaFunc) + ctx->Driver.AlphaFunc(ctx, func, ref); + return; + + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glAlphaFunc(func)" ); + return; + } +} + + +/** + * Specify a logic pixel operation for color index rendering. + * + * \param opcode operation. + * + * Verifies that \p opcode is a valid enum and updates +gl_colorbuffer_attrib::LogicOp. + * On a change, flushes the vertices and notifies the driver via the + * dd_function_table::LogicOpcode callback. + */ +void GLAPIENTRY +_mesa_LogicOp( GLenum opcode ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (opcode) { + case GL_CLEAR: + case GL_SET: + case GL_COPY: + case GL_COPY_INVERTED: + case GL_NOOP: + case GL_INVERT: + case GL_AND: + case GL_NAND: + case GL_OR: + case GL_NOR: + case GL_XOR: + case GL_EQUIV: + case GL_AND_REVERSE: + case GL_AND_INVERTED: + case GL_OR_REVERSE: + case GL_OR_INVERTED: + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glLogicOp" ); + return; + } + + if (ctx->Color.LogicOp == opcode) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.LogicOp = opcode; + + if (ctx->Driver.LogicOpcode) + ctx->Driver.LogicOpcode( ctx, opcode ); +} + +#if _HAVE_FULL_GL +void GLAPIENTRY +_mesa_IndexMask( GLuint mask ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Color.IndexMask == mask) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.IndexMask = mask; + + if (ctx->Driver.IndexMask) + ctx->Driver.IndexMask( ctx, mask ); +} +#endif + + +/** + * Enable or disable writing of frame buffer color components. + * + * \param red whether to mask writing of the red color component. + * \param green whether to mask writing of the green color component. + * \param blue whether to mask writing of the blue color component. + * \param alpha whether to mask writing of the alpha color component. + * + * \sa glColorMask(). + * + * Sets the appropriate value of gl_colorbuffer_attrib::ColorMask. On a + * change, flushes the vertices and notifies the driver via the + * dd_function_table::ColorMask callback. + */ +void GLAPIENTRY +_mesa_ColorMask( GLboolean red, GLboolean green, + GLboolean blue, GLboolean alpha ) +{ + GET_CURRENT_CONTEXT(ctx); + GLubyte tmp[4]; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glColorMask %d %d %d %d\n", red, green, blue, alpha); + + /* Shouldn't have any information about channel depth in core mesa + * -- should probably store these as the native booleans: + */ + tmp[RCOMP] = red ? 0xff : 0x0; + tmp[GCOMP] = green ? 0xff : 0x0; + tmp[BCOMP] = blue ? 0xff : 0x0; + tmp[ACOMP] = alpha ? 0xff : 0x0; + + if (TEST_EQ_4UBV(tmp, ctx->Color.ColorMask)) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + COPY_4UBV(ctx->Color.ColorMask, tmp); + + if (ctx->Driver.ColorMask) + ctx->Driver.ColorMask( ctx, red, green, blue, alpha ); +} + + +/**********************************************************************/ +/** \name Initialization */ +/*@{*/ + +/** + * Initialization of the context's Color attribute group. + * + * \param ctx GL context. + * + * Initializes the related fields in the context color attribute group, + * __GLcontextRec::Color. + */ +void _mesa_init_color( GLcontext * ctx ) +{ + /* Color buffer group */ + ctx->Color.IndexMask = ~0u; + ctx->Color.ColorMask[0] = 0xff; + ctx->Color.ColorMask[1] = 0xff; + ctx->Color.ColorMask[2] = 0xff; + ctx->Color.ColorMask[3] = 0xff; + ctx->Color.ClearIndex = 0; + ASSIGN_4V( ctx->Color.ClearColor, 0, 0, 0, 0 ); + ctx->Color.AlphaEnabled = GL_FALSE; + ctx->Color.AlphaFunc = GL_ALWAYS; + ctx->Color.AlphaRef = 0; + ctx->Color.BlendEnabled = GL_FALSE; + ctx->Color.BlendSrcRGB = GL_ONE; + ctx->Color.BlendDstRGB = GL_ZERO; + ctx->Color.BlendSrcA = GL_ONE; + ctx->Color.BlendDstA = GL_ZERO; + ctx->Color.BlendEquationRGB = GL_FUNC_ADD; + ctx->Color.BlendEquationA = GL_FUNC_ADD; + ASSIGN_4V( ctx->Color.BlendColor, 0.0, 0.0, 0.0, 0.0 ); + ctx->Color.IndexLogicOpEnabled = GL_FALSE; + ctx->Color.ColorLogicOpEnabled = GL_FALSE; + ctx->Color._LogicOpEnabled = GL_FALSE; + ctx->Color.LogicOp = GL_COPY; + ctx->Color.DitherFlag = GL_TRUE; + + if (ctx->Visual.doubleBufferMode) { + ctx->Color.DrawBuffer[0] = GL_BACK; + } + else { + ctx->Color.DrawBuffer[0] = GL_FRONT; + } +} + +/*@}*/ diff --git a/reactos/dll/mesa32/src/main/blend.h b/reactos/dll/mesa32/src/main/blend.h new file mode 100644 index 00000000000..d6c03d903f4 --- /dev/null +++ b/reactos/dll/mesa32/src/main/blend.h @@ -0,0 +1,78 @@ +/** + * \file blend.h + * Blending functions operations. + */ + +/* + * 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 BLEND_H +#define BLEND_H + + +#include "mtypes.h" + + +extern void GLAPIENTRY +_mesa_BlendFunc( GLenum sfactor, GLenum dfactor ); + + +extern void GLAPIENTRY +_mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA ); + + +extern void GLAPIENTRY +_mesa_BlendEquation( GLenum mode ); + + +extern void GLAPIENTRY +_mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA ); + + +extern void GLAPIENTRY +_mesa_BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + + +extern void GLAPIENTRY +_mesa_AlphaFunc( GLenum func, GLclampf ref ); + + +extern void GLAPIENTRY +_mesa_LogicOp( GLenum opcode ); + + +extern void GLAPIENTRY +_mesa_IndexMask( GLuint mask ); + +extern void GLAPIENTRY +_mesa_ColorMask( GLboolean red, GLboolean green, + GLboolean blue, GLboolean alpha ); + +extern void +_mesa_init_color( GLcontext * ctx ); + +#endif diff --git a/reactos/dll/mesa32/src/main/bufferobj.c b/reactos/dll/mesa32/src/main/bufferobj.c new file mode 100644 index 00000000000..a1d4c0190a1 --- /dev/null +++ b/reactos/dll/mesa32/src/main/bufferobj.c @@ -0,0 +1,940 @@ +/* + * 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. + */ + + +/** + * \file bufferobj.c + * \brief Functions for the GL_ARB_vertex_buffer_object extension. + * \author Brian Paul, Ian Romanick + */ + + +#include "glheader.h" +#include "hash.h" +#include "imports.h" +#include "image.h" +#include "context.h" +#include "bufferobj.h" + + +/** + * Get the buffer object bound to the specified target in a GL context. + * + * \param ctx GL context + * \param target Buffer object target to be retrieved. Currently this must + * be either \c GL_ARRAY_BUFFER or \c GL_ELEMENT_ARRAY_BUFFER. + * \param str Name of caller for logging errors. + * \return A pointer to the buffer object bound to \c target in the + * specified context or \c NULL if \c target is invalid or no + * buffer object is bound. + */ +static INLINE struct gl_buffer_object * +buffer_object_get_target( GLcontext *ctx, GLenum target, const char * str ) +{ + struct gl_buffer_object * bufObj = NULL; + + switch (target) { + case GL_ARRAY_BUFFER_ARB: + bufObj = ctx->Array.ArrayBufferObj; + break; + case GL_ELEMENT_ARRAY_BUFFER_ARB: + bufObj = ctx->Array.ElementArrayBufferObj; + break; + case GL_PIXEL_PACK_BUFFER_EXT: + bufObj = ctx->Pack.BufferObj; + break; + case GL_PIXEL_UNPACK_BUFFER_EXT: + bufObj = ctx->Unpack.BufferObj; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(target)", str); + return NULL; + } + + if (bufObj->Name == 0) + return NULL; + + return bufObj; +} + + +/** + * Tests the subdata range parameters and sets the GL error code for + * \c glBufferSubDataARB and \c glGetBufferSubDataARB. + * + * \param ctx GL context. + * \param target Buffer object target on which to operate. + * \param offset Offset of the first byte of the subdata range. + * \param size Size, in bytes, of the subdata range. + * \param str Name of caller for logging errors. + * \return A pointer to the buffer object bound to \c target in the + * specified context or \c NULL if any of the parameter or state + * conditions for \c glBufferSubDataARB or \c glGetBufferSubDataARB + * are invalid. + * + * \sa glBufferSubDataARB, glGetBufferSubDataARB + */ +static struct gl_buffer_object * +buffer_object_subdata_range_good( GLcontext * ctx, GLenum target, + GLintptrARB offset, GLsizeiptrARB size, + const char * str ) +{ + struct gl_buffer_object *bufObj; + + if (size < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s(size < 0)", str); + return NULL; + } + + if (offset < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s(offset < 0)", str); + return NULL; + } + + bufObj = buffer_object_get_target( ctx, target, str ); + if (!bufObj || bufObj->Name == 0) { + return NULL; + } + + if ((GLuint) (offset + size) > bufObj->Size) { + _mesa_error(ctx, GL_INVALID_VALUE, + "%s(size + offset > buffer size)", str); + return NULL; + } + + if (bufObj->Pointer) { + /* Buffer is currently mapped */ + _mesa_error(ctx, GL_INVALID_OPERATION, "%s", str); + return NULL; + } + + return bufObj; +} + + +/** + * Allocate and initialize a new buffer object. + * + * This function is intended to be called via + * \c dd_function_table::NewBufferObject. + */ +struct gl_buffer_object * +_mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target ) +{ + struct gl_buffer_object *obj; + + (void) ctx; + + obj = MALLOC_STRUCT(gl_buffer_object); + _mesa_initialize_buffer_object(obj, name, target); + return obj; +} + + +/** + * Delete a buffer object. + * + * This function is intended to be called via + * \c dd_function_table::DeleteBuffer. + */ +void +_mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) +{ + (void) ctx; + + if (bufObj->Data) + _mesa_free(bufObj->Data); + _mesa_free(bufObj); +} + + +/** + * Initialize a buffer object to default values. + */ +void +_mesa_initialize_buffer_object( struct gl_buffer_object *obj, + GLuint name, GLenum target ) +{ + (void) target; + + _mesa_bzero(obj, sizeof(struct gl_buffer_object)); + obj->RefCount = 1; + obj->Name = name; + obj->Usage = GL_STATIC_DRAW_ARB; + obj->Access = GL_READ_WRITE_ARB; +} + + +/** + * Add the given buffer object to the buffer object pool. + */ +void +_mesa_save_buffer_object( GLcontext *ctx, struct gl_buffer_object *obj ) +{ + if (obj->Name > 0) { + /* insert into hash table */ + _mesa_HashInsert(ctx->Shared->BufferObjects, obj->Name, obj); + } +} + + +/** + * Remove the given buffer object from the buffer object pool. + * Do not deallocate the buffer object though. + */ +void +_mesa_remove_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) +{ + if (bufObj->Name > 0) { + /* remove from hash table */ + _mesa_HashRemove(ctx->Shared->BufferObjects, bufObj->Name); + } +} + + +/** + * Allocate space for and store data in a buffer object. Any data that was + * previously stored in the buffer object is lost. If \c data is \c NULL, + * memory will be allocated, but no copy will occur. + * + * This function is intended to be called via + * \c dd_function_table::BufferData. This function need not set GL error + * codes. The input parameters will have been tested before calling. + * + * \param ctx GL context. + * \param target Buffer object target on which to operate. + * \param size Size, in bytes, of the new data store. + * \param data Pointer to the data to store in the buffer object. This + * pointer may be \c NULL. + * \param usage Hints about how the data will be used. + * \param bufObj Object to be used. + * + * \sa glBufferDataARB, dd_function_table::BufferData. + */ +void +_mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, + const GLvoid * data, GLenum usage, + struct gl_buffer_object * bufObj ) +{ + void * new_data; + + (void) ctx; (void) target; + + new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size ); + if (new_data) { + bufObj->Data = (GLubyte *) new_data; + bufObj->Size = size; + bufObj->Usage = usage; + + if (data) { + _mesa_memcpy( bufObj->Data, data, size ); + } + } +} + + +/** + * Replace data in a subrange of buffer object. If the data range + * specified by \c size + \c offset extends beyond the end of the buffer or + * if \c data is \c NULL, no copy is performed. + * + * This function is intended to be called by + * \c dd_function_table::BufferSubData. This function need not set GL error + * codes. The input parameters will have been tested before calling. + * + * \param ctx GL context. + * \param target Buffer object target on which to operate. + * \param offset Offset of the first byte to be modified. + * \param size Size, in bytes, of the data range. + * \param data Pointer to the data to store in the buffer object. + * \param bufObj Object to be used. + * + * \sa glBufferSubDataARB, dd_function_table::BufferSubData. + */ +void +_mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, + GLsizeiptrARB size, const GLvoid * data, + struct gl_buffer_object * bufObj ) +{ + (void) ctx; (void) target; + + if (bufObj->Data && ((GLuint) (size + offset) <= bufObj->Size)) { + _mesa_memcpy( (GLubyte *) bufObj->Data + offset, data, size ); + } +} + + +/** + * Retrieve data from a subrange of buffer object. If the data range + * specified by \c size + \c offset extends beyond the end of the buffer or + * if \c data is \c NULL, no copy is performed. + * + * This function is intended to be called by + * \c dd_function_table::BufferGetSubData. This function need not set GL error + * codes. The input parameters will have been tested before calling. + * + * \param ctx GL context. + * \param target Buffer object target on which to operate. + * \param offset Offset of the first byte to be modified. + * \param size Size, in bytes, of the data range. + * \param data Pointer to the data to store in the buffer object. + * \param bufObj Object to be used. + * + * \sa glBufferGetSubDataARB, dd_function_table::GetBufferSubData. + */ +void +_mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, + GLsizeiptrARB size, GLvoid * data, + struct gl_buffer_object * bufObj ) +{ + (void) ctx; (void) target; + + if (bufObj->Data && ((GLsizeiptrARB) (size + offset) <= bufObj->Size)) { + _mesa_memcpy( data, (GLubyte *) bufObj->Data + offset, size ); + } +} + + +/** + * Fallback function called via ctx->Driver.MapBuffer(). + * Hardware drivers that really implement buffer objects should never use + * function. + * + * The input parameters will have been already tested for errors. + * + * \param ctx GL context. + * \param target Buffer object target on which to operate. + * \param access Information about how the buffer will be accessed. + * \param bufObj Object to be mapped. + * \return A pointer to the object's internal data store that can be accessed + * by the processor + * + * \sa glMapBufferARB, dd_function_table::MapBuffer + */ +void * +_mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, + struct gl_buffer_object *bufObj ) +{ + (void) ctx; + (void) target; + (void) access; + ASSERT(!bufObj->OnCard); + /* Just return a direct pointer to the data */ + if (bufObj->Pointer) { + /* already mapped! */ + return NULL; + } + bufObj->Pointer = bufObj->Data; + return bufObj->Pointer; +} + + +/** + * Fallback function called via ctx->Driver.MapBuffer(). + * Hardware drivers that really implement buffer objects should never use + * function. + * + * The input parameters will have been already tested for errors. + * + * \sa glUnmapBufferARB, dd_function_table::UnmapBuffer + */ +GLboolean +_mesa_buffer_unmap( GLcontext *ctx, GLenum target, + struct gl_buffer_object *bufObj ) +{ + (void) ctx; + (void) target; + ASSERT(!bufObj->OnCard); + /* XXX we might assert here that bufObj->Pointer is non-null */ + bufObj->Pointer = NULL; + return GL_TRUE; +} + + +/** + * Initialize the state associated with buffer objects + */ +void +_mesa_init_buffer_objects( GLcontext *ctx ) +{ + GLuint i; + + /* Allocate the default buffer object and set refcount so high that + * it never gets deleted. + */ + ctx->Array.NullBufferObj = _mesa_new_buffer_object(ctx, 0, 0); + if (ctx->Array.NullBufferObj) + ctx->Array.NullBufferObj->RefCount = 1000; + + ctx->Array.ArrayBufferObj = ctx->Array.NullBufferObj; + ctx->Array.ElementArrayBufferObj = ctx->Array.NullBufferObj; + + /* Vertex array buffers */ + ctx->Array.Vertex.BufferObj = ctx->Array.NullBufferObj; + ctx->Array.Normal.BufferObj = ctx->Array.NullBufferObj; + ctx->Array.Color.BufferObj = ctx->Array.NullBufferObj; + ctx->Array.SecondaryColor.BufferObj = ctx->Array.NullBufferObj; + ctx->Array.FogCoord.BufferObj = ctx->Array.NullBufferObj; + ctx->Array.Index.BufferObj = ctx->Array.NullBufferObj; + for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + ctx->Array.TexCoord[i].BufferObj = ctx->Array.NullBufferObj; + } + ctx->Array.EdgeFlag.BufferObj = ctx->Array.NullBufferObj; + for (i = 0; i < VERT_ATTRIB_MAX; i++) { + ctx->Array.VertexAttrib[i].BufferObj = ctx->Array.NullBufferObj; + } +} + + +/** + * When we're about to read pixel data out of a PBO (via glDrawPixels, + * glTexImage, etc) or write data into a PBO (via glReadPixels, + * glGetTexImage, etc) we call this function to check that we're not + * going to read out of bounds. + * + * XXX This would also be a convenient time to check that the PBO isn't + * currently mapped. Whoever calls this function should check for that. + * Remember, we can't use a PBO when it's mapped! + * + * \param width width of image to read/write + * \param height height of image to read/write + * \param depth depth of image to read/write + * \param format format of image to read/write + * \param type datatype of image to read/write + * \param ptr the user-provided pointer/offset + * \return GL_TRUE if the PBO access is OK, GL_FALSE if the access would + * go out of bounds. + */ +GLboolean +_mesa_validate_pbo_access(GLuint dimensions, + const struct gl_pixelstore_attrib *pack, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLenum type, const GLvoid *ptr) +{ + GLvoid *start, *end; + + ASSERT(pack->BufferObj->Name != 0); + + if (pack->BufferObj->Size == 0) + /* no buffer! */ + return GL_FALSE; + + /* get address of first pixel we'll read */ + start = _mesa_image_address(dimensions, pack, ptr, width, height, + format, type, 0, 0, 0); + + /* get address just past the last pixel we'll read */ + end = _mesa_image_address(dimensions, pack, ptr, width, height, + format, type, depth-1, height-1, width); + + + if ((const GLubyte *) start > (const GLubyte *)(uintptr_t) pack->BufferObj->Size) { + /* This will catch negative values / wrap-around */ + return GL_FALSE; + } + if ((const GLubyte *) end > (const GLubyte *)(uintptr_t) pack->BufferObj->Size) { + /* Image read goes beyond end of buffer */ + return GL_FALSE; + } + + /* OK! */ + return GL_TRUE; +} + + + + +/**********************************************************************/ +/* API Functions */ +/**********************************************************************/ + +void GLAPIENTRY +_mesa_BindBufferARB(GLenum target, GLuint buffer) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object *oldBufObj; + struct gl_buffer_object *newBufObj = NULL; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + oldBufObj = buffer_object_get_target( ctx, target, "BindBufferARB" ); + if (oldBufObj && oldBufObj->Name == buffer) + return; /* rebinding the same buffer object- no change */ + + /* + * Get pointer to new buffer object (newBufObj) + */ + if (buffer == 0) { + /* The spec says there's not a buffer object named 0, but we use + * one internally because it simplifies things. + */ + newBufObj = ctx->Array.NullBufferObj; + } + else { + /* non-default buffer object */ + const struct _mesa_HashTable *hash = ctx->Shared->BufferObjects; + newBufObj = (struct gl_buffer_object *) _mesa_HashLookup(hash, buffer); + if (!newBufObj) { + /* if this is a new buffer object id, allocate a buffer object now */ + newBufObj = (*ctx->Driver.NewBufferObject)(ctx, buffer, target); + if (!newBufObj) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB"); + return; + } + _mesa_save_buffer_object(ctx, newBufObj); + } + newBufObj->RefCount++; + } + + switch (target) { + case GL_ARRAY_BUFFER_ARB: + ctx->Array.ArrayBufferObj = newBufObj; + break; + case GL_ELEMENT_ARRAY_BUFFER_ARB: + ctx->Array.ElementArrayBufferObj = newBufObj; + break; + case GL_PIXEL_PACK_BUFFER_EXT: + ctx->Pack.BufferObj = newBufObj; + break; + case GL_PIXEL_UNPACK_BUFFER_EXT: + ctx->Unpack.BufferObj = newBufObj; + break; + default: + _mesa_problem(ctx, "Bad target in _mesa_BindBufferARB"); + return; + } + + /* Pass BindBuffer call to device driver */ + if (ctx->Driver.BindBuffer && newBufObj) + (*ctx->Driver.BindBuffer)( ctx, target, newBufObj ); + + if (oldBufObj) { + oldBufObj->RefCount--; + assert(oldBufObj->RefCount >= 0); + if (oldBufObj->RefCount == 0) { + assert(oldBufObj->Name != 0); + ASSERT(ctx->Driver.DeleteBuffer); + ctx->Driver.DeleteBuffer( ctx, oldBufObj ); + } + } +} + + +/** + * Delete a set of buffer objects. + * + * \param n Number of buffer objects to delete. + * \param ids Array of \c n buffer object IDs. + */ +void GLAPIENTRY +_mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) +{ + GET_CURRENT_CONTEXT(ctx); + GLsizei i; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteBuffersARB(n)"); + return; + } + + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + + for (i = 0; i < n; i++) { + if (ids[i] != 0) { + struct gl_buffer_object *bufObj = (struct gl_buffer_object *) + _mesa_HashLookup(ctx->Shared->BufferObjects, ids[i]); + if (bufObj) { + /* unbind any vertex pointers bound to this buffer */ + GLuint j; + + ASSERT(bufObj->Name == ids[i]); + + if (ctx->Array.Vertex.BufferObj == bufObj) { + bufObj->RefCount--; + ctx->Array.Vertex.BufferObj = ctx->Array.NullBufferObj; + ctx->Array.NullBufferObj->RefCount++; + } + if (ctx->Array.Normal.BufferObj == bufObj) { + bufObj->RefCount--; + ctx->Array.Normal.BufferObj = ctx->Array.NullBufferObj; + ctx->Array.NullBufferObj->RefCount++; + } + if (ctx->Array.Color.BufferObj == bufObj) { + bufObj->RefCount--; + ctx->Array.Color.BufferObj = ctx->Array.NullBufferObj; + ctx->Array.NullBufferObj->RefCount++; + } + if (ctx->Array.SecondaryColor.BufferObj == bufObj) { + bufObj->RefCount--; + ctx->Array.SecondaryColor.BufferObj = ctx->Array.NullBufferObj; + ctx->Array.NullBufferObj->RefCount++; + } + if (ctx->Array.FogCoord.BufferObj == bufObj) { + bufObj->RefCount--; + ctx->Array.FogCoord.BufferObj = ctx->Array.NullBufferObj; + ctx->Array.NullBufferObj->RefCount++; + } + if (ctx->Array.Index.BufferObj == bufObj) { + bufObj->RefCount--; + ctx->Array.Index.BufferObj = ctx->Array.NullBufferObj; + ctx->Array.NullBufferObj->RefCount++; + } + if (ctx->Array.EdgeFlag.BufferObj == bufObj) { + bufObj->RefCount--; + ctx->Array.EdgeFlag.BufferObj = ctx->Array.NullBufferObj; + ctx->Array.NullBufferObj->RefCount++; + } + for (j = 0; j < MAX_TEXTURE_UNITS; j++) { + if (ctx->Array.TexCoord[j].BufferObj == bufObj) { + bufObj->RefCount--; + ctx->Array.TexCoord[j].BufferObj = ctx->Array.NullBufferObj; + ctx->Array.NullBufferObj->RefCount++; + } + } + for (j = 0; j < VERT_ATTRIB_MAX; j++) { + if (ctx->Array.VertexAttrib[j].BufferObj == bufObj) { + bufObj->RefCount--; + ctx->Array.VertexAttrib[j].BufferObj = ctx->Array.NullBufferObj; + ctx->Array.NullBufferObj->RefCount++; + } + } + + if (ctx->Array.ArrayBufferObj == bufObj) { + _mesa_BindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); + } + if (ctx->Array.ElementArrayBufferObj == bufObj) { + _mesa_BindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 ); + } + + if (ctx->Pack.BufferObj == bufObj) { + _mesa_BindBufferARB( GL_PIXEL_PACK_BUFFER_EXT, 0 ); + } + if (ctx->Unpack.BufferObj == bufObj) { + _mesa_BindBufferARB( GL_PIXEL_UNPACK_BUFFER_EXT, 0 ); + } + + /* The ID is immediately freed for re-use */ + _mesa_remove_buffer_object(ctx, bufObj); + bufObj->RefCount--; + if (bufObj->RefCount <= 0) { + ASSERT(ctx->Array.ArrayBufferObj != bufObj); + ASSERT(ctx->Array.ElementArrayBufferObj != bufObj); + ASSERT(ctx->Array.Vertex.BufferObj != bufObj); + ASSERT(ctx->Driver.DeleteBuffer); + ctx->Driver.DeleteBuffer(ctx, bufObj); + } + } + } + } + + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); +} + + +/** + * Generate a set of unique buffer object IDs and store them in \c buffer. + * + * \param n Number of IDs to generate. + * \param buffer Array of \c n locations to store the IDs. + */ +void GLAPIENTRY +_mesa_GenBuffersARB(GLsizei n, GLuint *buffer) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint first; + GLint i; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGenBuffersARB"); + return; + } + + if (!buffer) { + return; + } + + /* + * This must be atomic (generation and allocation of buffer object IDs) + */ + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + + first = _mesa_HashFindFreeKeyBlock(ctx->Shared->BufferObjects, n); + + /* Allocate new, empty buffer objects and return identifiers */ + for (i = 0; i < n; i++) { + struct gl_buffer_object *bufObj; + GLuint name = first + i; + GLenum target = 0; + bufObj = (*ctx->Driver.NewBufferObject)( ctx, name, target ); + if (!bufObj) { + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenBuffersARB"); + return; + } + _mesa_save_buffer_object(ctx, bufObj); + buffer[i] = first + i; + } + + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); +} + + +/** + * Determine if ID is the name of a buffer object. + * + * \param id ID of the potential buffer object. + * \return \c GL_TRUE if \c id is the name of a buffer object, + * \c GL_FALSE otherwise. + */ +GLboolean GLAPIENTRY +_mesa_IsBufferARB(GLuint id) +{ + struct gl_buffer_object * bufObj; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + if (id == 0) + return GL_FALSE; + + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + bufObj = (struct gl_buffer_object *) _mesa_HashLookup(ctx->Shared->BufferObjects, id); + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + + return bufObj ? GL_TRUE : GL_FALSE; +} + + +void GLAPIENTRY +_mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, + const GLvoid * data, GLenum usage) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object *bufObj; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (size < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glBufferDataARB(size < 0)"); + return; + } + + switch (usage) { + case GL_STREAM_DRAW_ARB: + case GL_STREAM_READ_ARB: + case GL_STREAM_COPY_ARB: + case GL_STATIC_DRAW_ARB: + case GL_STATIC_READ_ARB: + case GL_STATIC_COPY_ARB: + case GL_DYNAMIC_DRAW_ARB: + case GL_DYNAMIC_READ_ARB: + case GL_DYNAMIC_COPY_ARB: + /* OK */ + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glBufferDataARB(usage)"); + return; + } + + bufObj = buffer_object_get_target( ctx, target, "BufferDataARB" ); + if (!bufObj || bufObj->Name ==0) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB" ); + return; + } + + if (bufObj->Pointer) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB(buffer is mapped)" ); + return; + } + + ASSERT(ctx->Driver.BufferData); + + /* Give the buffer object to the driver! may be null! */ + (*ctx->Driver.BufferData)( ctx, target, size, data, usage, bufObj ); +} + + +void GLAPIENTRY +_mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, + GLsizeiptrARB size, const GLvoid * data) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object *bufObj; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + bufObj = buffer_object_subdata_range_good( ctx, target, offset, size, + "BufferSubDataARB" ); + if (!bufObj) { + /* error already recorded */ + return; + } + + ASSERT(ctx->Driver.BufferSubData); + (*ctx->Driver.BufferSubData)( ctx, target, offset, size, data, bufObj ); +} + + +void GLAPIENTRY +_mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset, + GLsizeiptrARB size, void * data) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object *bufObj; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + bufObj = buffer_object_subdata_range_good( ctx, target, offset, size, + "GetBufferSubDataARB" ); + if (!bufObj) { + /* error already recorded */ + return; + } + + ASSERT(ctx->Driver.GetBufferSubData); + (*ctx->Driver.GetBufferSubData)( ctx, target, offset, size, data, bufObj ); +} + + +void * GLAPIENTRY +_mesa_MapBufferARB(GLenum target, GLenum access) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object * bufObj; + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL); + + switch (access) { + case GL_READ_ONLY_ARB: + case GL_WRITE_ONLY_ARB: + case GL_READ_WRITE_ARB: + /* OK */ + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(access)"); + return NULL; + } + + bufObj = buffer_object_get_target( ctx, target, "MapBufferARB" ); + if (!bufObj || bufObj->Name == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB" ); + return NULL; + } + + if (bufObj->Pointer) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB(already mapped)"); + return NULL; + } + + ASSERT(ctx->Driver.MapBuffer); + bufObj->Pointer = (*ctx->Driver.MapBuffer)( ctx, target, access, bufObj ); + if (!bufObj->Pointer) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(access)"); + } + + bufObj->Access = access; + + return bufObj->Pointer; +} + + +GLboolean GLAPIENTRY +_mesa_UnmapBufferARB(GLenum target) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object *bufObj; + GLboolean status = GL_TRUE; + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + bufObj = buffer_object_get_target( ctx, target, "UnmapBufferARB" ); + if (!bufObj || bufObj->Name == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB" ); + return GL_FALSE; + } + + if (!bufObj->Pointer) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB"); + return GL_FALSE; + } + + if (ctx->Driver.UnmapBuffer) { + status = (*ctx->Driver.UnmapBuffer)( ctx, target, bufObj ); + } + + bufObj->Access = GL_READ_WRITE_ARB; /* initial value, OK? */ + bufObj->Pointer = NULL; + + return status; +} + + +void GLAPIENTRY +_mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object *bufObj; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + bufObj = buffer_object_get_target( ctx, target, "GetBufferParameterivARB" ); + if (!bufObj || bufObj->Name == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, "GetBufferParameterivARB" ); + return; + } + + switch (pname) { + case GL_BUFFER_SIZE_ARB: + *params = (GLint) bufObj->Size; + break; + case GL_BUFFER_USAGE_ARB: + *params = bufObj->Usage; + break; + case GL_BUFFER_ACCESS_ARB: + *params = bufObj->Access; + break; + case GL_BUFFER_MAPPED_ARB: + *params = (bufObj->Pointer != NULL); + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(pname)"); + return; + } +} + + +void GLAPIENTRY +_mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object * bufObj; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (pname != GL_BUFFER_MAP_POINTER_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointervARB(pname)"); + return; + } + + bufObj = buffer_object_get_target( ctx, target, "GetBufferPointervARB" ); + if (!bufObj || bufObj->Name == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferPointervARB" ); + return; + } + + *params = bufObj->Pointer; +} diff --git a/reactos/dll/mesa32/src/main/bufferobj.h b/reactos/dll/mesa32/src/main/bufferobj.h new file mode 100644 index 00000000000..bc1005332ca --- /dev/null +++ b/reactos/dll/mesa32/src/main/bufferobj.h @@ -0,0 +1,124 @@ +/* + * 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. + */ + + + +#ifndef BUFFEROBJ_H +#define BUFFEROBJ_H + + +#include "context.h" + + +/* + * Internal functions + */ + +extern void +_mesa_init_buffer_objects( GLcontext *ctx ); + +extern struct gl_buffer_object * +_mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target ); + +extern void +_mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ); + +extern void +_mesa_initialize_buffer_object( struct gl_buffer_object *obj, + GLuint name, GLenum target ); + +extern void +_mesa_save_buffer_object( GLcontext *ctx, struct gl_buffer_object *obj ); + +extern void +_mesa_remove_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ); + +extern void +_mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, + const GLvoid * data, GLenum usage, + struct gl_buffer_object * bufObj ); + +extern void +_mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, + GLsizeiptrARB size, const GLvoid * data, + struct gl_buffer_object * bufObj ); + +extern void +_mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, + GLsizeiptrARB size, GLvoid * data, + struct gl_buffer_object * bufObj ); + +extern void * +_mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, + struct gl_buffer_object * bufObj ); + +extern GLboolean +_mesa_buffer_unmap( GLcontext *ctx, GLenum target, + struct gl_buffer_object * bufObj ); + +extern GLboolean +_mesa_validate_pbo_access(GLuint dimensions, + const struct gl_pixelstore_attrib *pack, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLenum type, const GLvoid *ptr); + + +/* + * API functions + */ + +extern void GLAPIENTRY +_mesa_BindBufferARB(GLenum target, GLuint buffer); + +extern void GLAPIENTRY +_mesa_DeleteBuffersARB(GLsizei n, const GLuint * buffer); + +extern void GLAPIENTRY +_mesa_GenBuffersARB(GLsizei n, GLuint * buffer); + +extern GLboolean GLAPIENTRY +_mesa_IsBufferARB(GLuint buffer); + +extern void GLAPIENTRY +_mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); + +extern void GLAPIENTRY +_mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); + +extern void GLAPIENTRY +_mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data); + +extern void * GLAPIENTRY +_mesa_MapBufferARB(GLenum target, GLenum access); + +extern GLboolean GLAPIENTRY +_mesa_UnmapBufferARB(GLenum target); + +extern void GLAPIENTRY +_mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params); + +extern void GLAPIENTRY +_mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params); + +#endif diff --git a/reactos/dll/mesa32/src/main/buffers.c b/reactos/dll/mesa32/src/main/buffers.c new file mode 100644 index 00000000000..58435e0edef --- /dev/null +++ b/reactos/dll/mesa32/src/main/buffers.c @@ -0,0 +1,723 @@ +/** + * \file buffers.c + * Frame buffer management. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +#include "glheader.h" +#include "buffers.h" +#include "colormac.h" +#include "context.h" +#include "enums.h" +#include "fbobject.h" +#include "state.h" + + +#define BAD_MASK ~0u + + +#if _HAVE_FULL_GL +void GLAPIENTRY +_mesa_ClearIndex( GLfloat c ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Color.ClearIndex == (GLuint) c) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.ClearIndex = (GLuint) c; + + if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) { + /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */ + (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex ); + } +} +#endif + + +/** + * Specify the clear values for the color buffers. + * + * \param red red color component. + * \param green green color component. + * \param blue blue color component. + * \param alpha alpha component. + * + * \sa glClearColor(). + * + * Clamps the parameters and updates gl_colorbuffer_attrib::ClearColor. On a + * change, flushes the vertices and notifies the driver via the + * dd_function_table::ClearColor callback. + */ +void GLAPIENTRY +_mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) +{ + GLfloat tmp[4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + tmp[0] = CLAMP(red, 0.0F, 1.0F); + tmp[1] = CLAMP(green, 0.0F, 1.0F); + tmp[2] = CLAMP(blue, 0.0F, 1.0F); + tmp[3] = CLAMP(alpha, 0.0F, 1.0F); + + if (TEST_EQ_4V(tmp, ctx->Color.ClearColor)) + return; /* no change */ + + FLUSH_VERTICES(ctx, _NEW_COLOR); + COPY_4V(ctx->Color.ClearColor, tmp); + + if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) { + /* it's OK to call glClearColor in CI mode but it should be a NOP */ + (*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor); + } +} + + +/** + * Clear buffers. + * + * \param mask bit-mask indicating the buffers to be cleared. + * + * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState + * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin, + * etc. If the rasterization mode is set to GL_RENDER then requests the driver + * to clear the buffers, via the dd_function_table::Clear callback. + */ +void GLAPIENTRY +_mesa_Clear( GLbitfield mask ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glClear 0x%x\n", mask); + + if (mask & ~(GL_COLOR_BUFFER_BIT | + GL_DEPTH_BUFFER_BIT | + GL_STENCIL_BUFFER_BIT | + GL_ACCUM_BUFFER_BIT)) { + /* invalid bit set */ + _mesa_error( ctx, GL_INVALID_VALUE, "glClear(0x%x)", mask); + return; + } + + if (ctx->NewState) { + _mesa_update_state( ctx ); /* update _Xmin, etc */ + } + + if (ctx->RenderMode == GL_RENDER) { + const GLint x = ctx->DrawBuffer->_Xmin; + const GLint y = ctx->DrawBuffer->_Ymin; + const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; + const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; + GLbitfield bufferMask; + + /* don't clear depth buffer if depth writing disabled */ + if (!ctx->Depth.Mask) + mask &= ~GL_DEPTH_BUFFER_BIT; + + /* Build the bitmask to send to device driver's Clear function. + * Note that the GL_COLOR_BUFFER_BIT flag will expand to 0, 1, 2 or 4 + * of the BUFFER_BIT_FRONT/BACK_LEFT/RIGHT flags, or one of the + * BUFFER_BIT_COLORn flags. + */ + bufferMask = 0; + if (mask & GL_COLOR_BUFFER_BIT) { + bufferMask |= ctx->DrawBuffer->_ColorDrawBufferMask[0]; + } + + if ((mask & GL_DEPTH_BUFFER_BIT) + && ctx->DrawBuffer->Visual.haveDepthBuffer) { + bufferMask |= BUFFER_BIT_DEPTH; + } + + if ((mask & GL_STENCIL_BUFFER_BIT) + && ctx->DrawBuffer->Visual.haveStencilBuffer) { + bufferMask |= BUFFER_BIT_STENCIL; + } + + if ((mask & GL_ACCUM_BUFFER_BIT) + && ctx->DrawBuffer->Visual.haveAccumBuffer) { + bufferMask |= BUFFER_BIT_ACCUM; + } + + ASSERT(ctx->Driver.Clear); + ctx->Driver.Clear( ctx, bufferMask, (GLboolean) !ctx->Scissor.Enabled, + x, y, width, height ); + } +} + + + +/** + * Return bitmask of BUFFER_BIT_* flags indicating which color buffers are + * available to the rendering context. + * This depends on the framebuffer we're writing to. For window system + * framebuffers we look at the framebuffer's visual. But for user- + * create framebuffers we look at the number of supported color attachments. + */ +static GLuint +supported_buffer_bitmask(const GLcontext *ctx, GLuint framebufferID) +{ + GLuint mask = 0x0; + GLint i; + + if (framebufferID > 0) { + /* A user-created renderbuffer */ + ASSERT(ctx->Extensions.EXT_framebuffer_object); + for (i = 0; i < ctx->Const.MaxColorAttachments; i++) { + mask |= (BUFFER_BIT_COLOR0 << i); + } + } + else { + /* A window system renderbuffer */ + mask = BUFFER_BIT_FRONT_LEFT; /* always have this */ + if (ctx->Visual.stereoMode) { + mask |= BUFFER_BIT_FRONT_RIGHT; + if (ctx->Visual.doubleBufferMode) { + mask |= BUFFER_BIT_BACK_LEFT | BUFFER_BIT_BACK_RIGHT; + } + } + else if (ctx->Visual.doubleBufferMode) { + mask |= BUFFER_BIT_BACK_LEFT; + } + + for (i = 0; i < ctx->Visual.numAuxBuffers; i++) { + mask |= (BUFFER_BIT_AUX0 << i); + } + } + + return mask; +} + + +/** + * Helper routine used by glDrawBuffer and glDrawBuffersARB. + * Given a GLenum naming one or more color buffers (such as + * GL_FRONT_AND_BACK), return the corresponding bitmask of BUFFER_BIT_* flags. + */ +static GLuint +draw_buffer_enum_to_bitmask(GLenum buffer) +{ + switch (buffer) { + case GL_NONE: + return 0; + case GL_FRONT: + return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT; + case GL_BACK: + return BUFFER_BIT_BACK_LEFT | BUFFER_BIT_BACK_RIGHT; + case GL_RIGHT: + return BUFFER_BIT_FRONT_RIGHT | BUFFER_BIT_BACK_RIGHT; + case GL_FRONT_RIGHT: + return BUFFER_BIT_FRONT_RIGHT; + case GL_BACK_RIGHT: + return BUFFER_BIT_BACK_RIGHT; + case GL_BACK_LEFT: + return BUFFER_BIT_BACK_LEFT; + case GL_FRONT_AND_BACK: + return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT + | BUFFER_BIT_FRONT_RIGHT | BUFFER_BIT_BACK_RIGHT; + case GL_LEFT: + return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT; + case GL_FRONT_LEFT: + return BUFFER_BIT_FRONT_LEFT; + case GL_AUX0: + return BUFFER_BIT_AUX0; + case GL_AUX1: + return BUFFER_BIT_AUX1; + case GL_AUX2: + return BUFFER_BIT_AUX2; + case GL_AUX3: + return BUFFER_BIT_AUX3; + case GL_COLOR_ATTACHMENT0_EXT: + return BUFFER_BIT_COLOR0; + case GL_COLOR_ATTACHMENT1_EXT: + return BUFFER_BIT_COLOR1; + case GL_COLOR_ATTACHMENT2_EXT: + return BUFFER_BIT_COLOR2; + case GL_COLOR_ATTACHMENT3_EXT: + return BUFFER_BIT_COLOR3; + default: + /* error */ + return BAD_MASK; + } +} + + +/** + * Helper routine used by glReadBuffer. + * Given a GLenum naming (a) color buffer(s), return the corresponding + * bitmask of DD_* flags. + */ +static GLuint +read_buffer_enum_to_bitmask(GLenum buffer) +{ + switch (buffer) { + case GL_FRONT: + return BUFFER_BIT_FRONT_LEFT; + case GL_BACK: + return BUFFER_BIT_BACK_LEFT; + case GL_RIGHT: + return BUFFER_BIT_FRONT_RIGHT; + case GL_FRONT_RIGHT: + return BUFFER_BIT_FRONT_RIGHT; + case GL_BACK_RIGHT: + return BUFFER_BIT_BACK_RIGHT; + case GL_BACK_LEFT: + return BUFFER_BIT_BACK_LEFT; + case GL_LEFT: + return BUFFER_BIT_FRONT_LEFT; + case GL_FRONT_LEFT: + return BUFFER_BIT_FRONT_LEFT; + case GL_AUX0: + return BUFFER_BIT_AUX0; + case GL_AUX1: + return BUFFER_BIT_AUX1; + case GL_AUX2: + return BUFFER_BIT_AUX2; + case GL_AUX3: + return BUFFER_BIT_AUX3; + case GL_COLOR_ATTACHMENT0_EXT: + return BUFFER_BIT_COLOR0; + case GL_COLOR_ATTACHMENT1_EXT: + return BUFFER_BIT_COLOR1; + case GL_COLOR_ATTACHMENT2_EXT: + return BUFFER_BIT_COLOR2; + case GL_COLOR_ATTACHMENT3_EXT: + return BUFFER_BIT_COLOR3; + default: + /* error */ + return BAD_MASK; + } +} + + +/** + * Specify which color buffers to draw into. + * + * \param buffer color buffer, such as GL_LEFT or GL_FRONT_AND_BACK. + * + * Flushes the vertices and verifies the parameter and updates the + * gl_colorbuffer_attrib::_DrawDestMask bitfield. Marks new color state in + * __GLcontextRec::NewState and notifies the driver via the + * dd_function_table::DrawBuffer callback. + */ +void GLAPIENTRY +_mesa_DrawBuffer(GLenum buffer) +{ + GLuint bufferID; + GLuint destMask; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex... */ + + if (MESA_VERBOSE & VERBOSE_API) { + _mesa_debug(ctx, "glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(buffer)); + } + + bufferID = ctx->DrawBuffer->Name; + + if (buffer == GL_NONE) { + destMask = 0x0; + } + else { + const GLuint supportedMask = supported_buffer_bitmask(ctx, bufferID); + destMask = draw_buffer_enum_to_bitmask(buffer); + if (destMask == BAD_MASK) { + /* totally bogus buffer */ + _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffer(buffer)"); + return; + } + destMask &= supportedMask; + if (destMask == 0x0) { + /* none of the named color buffers exist! */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffer(buffer)"); + return; + } + } + + /* if we get here, there's no error so set new state */ + _mesa_drawbuffers(ctx, 1, &buffer, &destMask); +} + + +/** + * Called by glDrawBuffersARB; specifies the destination color buffers + * for N fragment program color outputs. + * + * XXX This function is called by _mesa_PopAttrib() and we need to do + * some more work to deal with the current framebuffer binding state! + */ +void GLAPIENTRY +_mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers) +{ + GLint output; + GLuint usedBufferMask, supportedMask; + GLuint bufferID; + GLuint destMask[MAX_DRAW_BUFFERS]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (!ctx->Extensions.ARB_draw_buffers) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffersARB"); + return; + } + if (n < 1 || n > (GLsizei) ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_VALUE, "glDrawBuffersARB(n)"); + return; + } + + bufferID = ctx->DrawBuffer->Name; + + supportedMask = supported_buffer_bitmask(ctx, bufferID); + usedBufferMask = 0x0; + + /* complicated error checking... */ + for (output = 0; output < n; output++) { + if (buffers[output] == GL_NONE) { + destMask[output] = 0x0; + } + else { + destMask[output] = draw_buffer_enum_to_bitmask(buffers[output]); + if (destMask[output] == BAD_MASK + || _mesa_bitcount(destMask[output]) > 1) { + _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffersARB(buffer)"); + return; + } + destMask[output] &= supportedMask; + if (destMask[output] == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawBuffersARB(unsupported buffer)"); + return; + } + if (destMask[output] & usedBufferMask) { + /* can't specify a dest buffer more than once! */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawBuffersARB(duplicated buffer)"); + return; + } + + /* update bitmask */ + usedBufferMask |= destMask[output]; + } + } + + /* OK, if we get here, there were no errors so set the new state */ + _mesa_drawbuffers(ctx, n, buffers, destMask); +} + + +/** + * Set color output state. Traditionally, there was only one color + * output, but fragment programs can now have several distinct color + * outputs (see GL_ARB_draw_buffers). This function sets the state + * for one such color output. + */ +static void +set_color_output(GLcontext *ctx, GLuint output, GLenum buffer, GLuint destMask) +{ + struct gl_framebuffer *fb = ctx->DrawBuffer; + + ASSERT(output < ctx->Const.MaxDrawBuffers); + + fb->ColorDrawBuffer[output] = buffer; + fb->_ColorDrawBufferMask[output] = destMask; + + if (fb->Name == 0) { + /* Set traditional state var */ + ctx->Color.DrawBuffer[output] = buffer; + } + + /* not really needed, will be set later */ + fb->_NumColorDrawBuffers[output] = 0; +} + + +/** + * Helper routine used by _mesa_DrawBuffer, _mesa_DrawBuffersARB and + * _mesa_PopAttrib to set drawbuffer state. + */ +void +_mesa_drawbuffers(GLcontext *ctx, GLsizei n, const GLenum *buffers, + const GLuint *destMask) +{ + GLuint mask[MAX_DRAW_BUFFERS]; + GLint output; + + if (!destMask) { + /* compute destMask values now */ + const GLuint bufferID = ctx->DrawBuffer->Name; + const GLuint supportedMask = supported_buffer_bitmask(ctx, bufferID); + for (output = 0; output < n; output++) { + mask[output] = draw_buffer_enum_to_bitmask(buffers[output]); + ASSERT(mask[output] != BAD_MASK); + mask[output] &= supportedMask; + } + destMask = mask; + } + + for (output = 0; output < n; output++) { + set_color_output(ctx, output, buffers[output], destMask[output]); + } + + /* set remaining color outputs to NONE */ + for (output = n; output < ctx->Const.MaxDrawBuffers; output++) { + set_color_output(ctx, output, GL_NONE, 0x0); + } + + ctx->NewState |= _NEW_COLOR; + + /* + * Call device driver function. + */ + if (ctx->Driver.DrawBuffers) + ctx->Driver.DrawBuffers(ctx, n, buffers); + else if (ctx->Driver.DrawBuffer) + ctx->Driver.DrawBuffer(ctx, buffers[0]); +} + + + +/** + * Set the color buffer source for reading pixels. + * + * \param mode color buffer. + * + * \sa glReadBuffer(). + * + */ +void GLAPIENTRY +_mesa_ReadBuffer(GLenum buffer) +{ + struct gl_framebuffer *fb; + GLuint srcMask, supportedMask; + GLuint bufferID; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + fb = ctx->ReadBuffer; + bufferID = fb->Name; + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer)); + + if (bufferID > 0 && buffer == GL_NONE) { + /* legal! */ + srcMask = 0x0; + } + else { + /* general case */ + srcMask = read_buffer_enum_to_bitmask(buffer); + if (srcMask == BAD_MASK) { + _mesa_error(ctx, GL_INVALID_ENUM, "glReadBuffer(buffer)"); + return; + } + supportedMask = supported_buffer_bitmask(ctx, bufferID); + if ((srcMask & supportedMask) == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glReadBuffer(buffer)"); + return; + } + } + + if (bufferID == 0) { + ctx->Pixel.ReadBuffer = buffer; + } + fb->ColorReadBuffer = buffer; + fb->_ColorReadBufferMask = srcMask; + + ctx->NewState |= _NEW_PIXEL; + + /* + * Call device driver function. + */ + if (ctx->Driver.ReadBuffer) + (*ctx->Driver.ReadBuffer)(ctx, buffer); +} + + +#if _HAVE_FULL_GL + +/** + * GL_MESA_resize_buffers extension. + * + * When this function is called, we'll ask the window system how large + * the current window is. If it's a new size, we'll call the driver's + * ResizeBuffers function. The driver will then resize its color buffers + * as needed, and maybe call the swrast's routine for reallocating + * swrast-managed depth/stencil/accum/etc buffers. + * \note This function may be called from within Mesa or called by the + * user directly (see the GL_MESA_resize_buffers extension). + */ +void GLAPIENTRY +_mesa_ResizeBuffersMESA( void ) +{ + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glResizeBuffersMESA\n"); + + if (ctx->DrawBuffer && ctx->DrawBuffer->Name == 0) { + GLuint newWidth, newHeight; + GLframebuffer *buffer = ctx->DrawBuffer; + + /* ask device driver for size of output buffer */ + ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight ); + + /* see if size of device driver's color buffer (window) has changed */ + if (buffer->Width != newWidth || buffer->Height != newHeight) { + if (ctx->Driver.ResizeBuffers) + ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight ); + } + } + + if (ctx->ReadBuffer && ctx->ReadBuffer != ctx->DrawBuffer + && ctx->ReadBuffer->Name == 0) { + GLuint newWidth, newHeight; + GLframebuffer *buffer = ctx->ReadBuffer; + + /* ask device driver for size of read buffer */ + ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight ); + + /* see if size of device driver's color buffer (window) has changed */ + if (buffer->Width != newWidth || buffer->Height != newHeight) { + if (ctx->Driver.ResizeBuffers) + ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight ); + } + } + + ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */ +} + + +/* + * XXX move somewhere else someday? + */ +void GLAPIENTRY +_mesa_SampleCoverageARB(GLclampf value, GLboolean invert) +{ + GET_CURRENT_CONTEXT(ctx); + + if (!ctx->Extensions.ARB_multisample) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleCoverageARB"); + return; + } + + 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; +} + +#endif /* _HAVE_FULL_GL */ + + + +/** + * 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 __GLcontextRec::Scissor. On a + * change flushes the vertices and notifies the driver via + * the dd_function_table::Scissor callback. + */ +void GLAPIENTRY +_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (width < 0 || height < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" ); + return; + } + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, 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 ); +} + + + +/**********************************************************************/ +/** \name Initialization */ +/*@{*/ + +/** + * Initialize the context's scissor state. + * \param ctx the GL context. + */ +void +_mesa_init_scissor(GLcontext *ctx) +{ + /* Scissor group */ + ctx->Scissor.Enabled = GL_FALSE; + ctx->Scissor.X = 0; + ctx->Scissor.Y = 0; + ctx->Scissor.Width = 0; + ctx->Scissor.Height = 0; +} + + +/** + * Initialize the context's multisample state. + * \param ctx the GL context. + */ +void +_mesa_init_multisample(GLcontext *ctx) +{ + ctx->Multisample.Enabled = GL_FALSE; + 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/reactos/dll/mesa32/src/main/buffers.h b/reactos/dll/mesa32/src/main/buffers.h new file mode 100644 index 00000000000..0c7f68ee79e --- /dev/null +++ b/reactos/dll/mesa32/src/main/buffers.h @@ -0,0 +1,78 @@ +/** + * \file buffers.h + * Frame buffer management functions declarations. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 BUFFERS_H +#define BUFFERS_H + + +#include "mtypes.h" + + +extern void GLAPIENTRY +_mesa_ClearIndex( GLfloat c ); + +extern void GLAPIENTRY +_mesa_ClearColor( GLclampf red, GLclampf green, + GLclampf blue, GLclampf alpha ); + +extern void GLAPIENTRY +_mesa_Clear( GLbitfield mask ); + +extern void GLAPIENTRY +_mesa_DrawBuffer( GLenum mode ); + +extern void GLAPIENTRY +_mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers); + +extern void +_mesa_drawbuffers(GLcontext *ctx, GLsizei n, const GLenum *buffers, + const GLuint *destMask); + +extern void GLAPIENTRY +_mesa_ReadBuffer( GLenum mode ); + +extern void GLAPIENTRY +_mesa_ResizeBuffersMESA( void ); + +extern void GLAPIENTRY +_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); + +extern void GLAPIENTRY +_mesa_SampleCoverageARB(GLclampf value, GLboolean invert); + +extern void +_mesa_init_scissor(GLcontext *ctx); + +extern void +_mesa_init_multisample(GLcontext *ctx); + + +#endif diff --git a/reactos/dll/mesa32/src/main/clip.c b/reactos/dll/mesa32/src/main/clip.c new file mode 100644 index 00000000000..43ef55ee3b5 --- /dev/null +++ b/reactos/dll/mesa32/src/main/clip.c @@ -0,0 +1,160 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +#include "glheader.h" +#include "clip.h" +#include "context.h" +#include "macros.h" +#include "mtypes.h" + +#include "math/m_xform.h" +#include "math/m_matrix.h" + + + +/**********************************************************************/ +/* Get/Set User clip-planes. */ +/**********************************************************************/ + + + +void GLAPIENTRY +_mesa_ClipPlane( GLenum plane, const GLdouble *eq ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint p; + GLfloat equation[4]; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + p = (GLint) plane - (GLint) GL_CLIP_PLANE0; + if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { + _mesa_error( ctx, GL_INVALID_ENUM, "glClipPlane" ); + return; + } + + equation[0] = (GLfloat) eq[0]; + equation[1] = (GLfloat) eq[1]; + equation[2] = (GLfloat) eq[2]; + equation[3] = (GLfloat) eq[3]; + + /* + * The equation is transformed by the transpose of the inverse of the + * current modelview matrix and stored in the resulting eye coordinates. + * + * KW: Eqn is then transformed to the current clip space, where user + * clipping now takes place. The clip-space equations are recalculated + * whenever the projection matrix changes. + */ + if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); + + _mesa_transform_vector( equation, equation, + ctx->ModelviewMatrixStack.Top->inv ); + + if (TEST_EQ_4V(ctx->Transform.EyeUserPlane[p], equation)) + return; + + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + COPY_4FV(ctx->Transform.EyeUserPlane[p], equation); + + /* Update derived state. This state also depends on the projection + * matrix, and is recalculated on changes to the projection matrix by + * code in _mesa_update_state(). + */ + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { + if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top)) + _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); + + _mesa_transform_vector( ctx->Transform._ClipUserPlane[p], + ctx->Transform.EyeUserPlane[p], + ctx->ProjectionMatrixStack.Top->inv ); + } + + if (ctx->Driver.ClipPlane) + ctx->Driver.ClipPlane( ctx, plane, equation ); +} + + +void GLAPIENTRY +_mesa_GetClipPlane( GLenum plane, GLdouble *equation ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint p; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + p = (GLint) (plane - GL_CLIP_PLANE0); + if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetClipPlane" ); + return; + } + + equation[0] = (GLdouble) ctx->Transform.EyeUserPlane[p][0]; + equation[1] = (GLdouble) ctx->Transform.EyeUserPlane[p][1]; + equation[2] = (GLdouble) ctx->Transform.EyeUserPlane[p][2]; + equation[3] = (GLdouble) ctx->Transform.EyeUserPlane[p][3]; +} + +void GLAPIENTRY +_mesa_CullParameterfvEXT (GLenum cap, GLfloat *v) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (cap) { + case GL_CULL_VERTEX_EYE_POSITION_EXT: + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + COPY_4FV(ctx->Transform.CullEyePos, v); + + _mesa_transform_vector( ctx->Transform.CullObjPos, + ctx->Transform.CullEyePos, + ctx->ModelviewMatrixStack.Top->inv ); + break; + + case GL_CULL_VERTEX_OBJECT_POSITION_EXT: + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + COPY_4FV(ctx->Transform.CullObjPos, v); + + _mesa_transform_vector( ctx->Transform.CullEyePos, + ctx->Transform.CullObjPos, + ctx->ModelviewMatrixStack.Top->m ); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glCullParameterfvEXT" ); + } +} + +void GLAPIENTRY +_mesa_CullParameterdvEXT (GLenum cap, GLdouble *v) +{ + GLfloat f[4]; + + f[0] = (GLfloat)v[0]; + f[1] = (GLfloat)v[1]; + f[2] = (GLfloat)v[2]; + f[3] = (GLfloat)v[3]; + + _mesa_CullParameterfvEXT(cap, f); +} + diff --git a/reactos/dll/mesa32/src/main/clip.h b/reactos/dll/mesa32/src/main/clip.h new file mode 100644 index 00000000000..d53afb45bdf --- /dev/null +++ b/reactos/dll/mesa32/src/main/clip.h @@ -0,0 +1,49 @@ +/** + * \file clip.h + */ + +/* + * 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 CLIP_H +#define CLIP_H + +#include "mtypes.h" + +extern void GLAPIENTRY +_mesa_ClipPlane( GLenum plane, const GLdouble *equation ); + +extern void GLAPIENTRY +_mesa_GetClipPlane( GLenum plane, GLdouble *equation ); + +extern void GLAPIENTRY +_mesa_CullParameterfvEXT (GLenum cap, GLfloat *v); + +extern void GLAPIENTRY +_mesa_CullParameterdvEXT (GLenum cap, GLdouble *v); + + +#endif diff --git a/reactos/dll/mesa32/src/main/colormac.h b/reactos/dll/mesa32/src/main/colormac.h new file mode 100644 index 00000000000..a19521fc85b --- /dev/null +++ b/reactos/dll/mesa32/src/main/colormac.h @@ -0,0 +1,227 @@ +/* + * 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. + */ + + +/** + * \file colormac.h + * Color-related macros + */ + + +#ifndef COLORMAC_H +#define COLORMAC_H + + +#include "imports.h" +#include "config.h" +#include "macros.h" + + +/** \def BYTE_TO_CHAN + * Convert from GLbyte to GLchan */ + +/** \def UBYTE_TO_CHAN + * Convert from GLubyte to GLchan */ + +/** \def SHORT_TO_CHAN + * Convert from GLshort to GLchan */ + +/** \def USHORT_TO_CHAN + * Convert from GLushort to GLchan */ + +/** \def INT_TO_CHAN + * Convert from GLint to GLchan */ + +/** \def UINT_TO_CHAN + * Convert from GLuint to GLchan */ + +/** \def CHAN_TO_UBYTE + * Convert from GLchan to GLubyte */ + +/** \def CHAN_TO_FLOAT + * Convert from GLchan to GLfloat */ + +/** \def CLAMPED_FLOAT_TO_CHAN + * Convert from GLclampf to GLchan */ + +/** \def UNCLAMPED_FLOAT_TO_CHAN + * Convert from GLfloat to GLchan */ + +/** \def COPY_CHAN4 + * Copy a GLchan[4] array */ + +/** \def CHAN_PRODUCT + * Scaled product (usually approximated) between two GLchan arguments */ + +#if CHAN_BITS == 8 + +#define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (GLchan) (b)) +#define UBYTE_TO_CHAN(b) (b) +#define SHORT_TO_CHAN(s) ((s) < 0 ? 0 : (GLchan) ((s) >> 7)) +#define USHORT_TO_CHAN(s) ((GLchan) ((s) >> 8)) +#define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 23)) +#define UINT_TO_CHAN(i) ((GLchan) ((i) >> 24)) + +#define CHAN_TO_UBYTE(c) (c) +#define CHAN_TO_FLOAT(c) UBYTE_TO_FLOAT(c) + +#define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_UBYTE(c, f) +#define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_UBYTE(c, f) + +#define COPY_CHAN4(DST, SRC) COPY_4UBV(DST, SRC) + +#define CHAN_PRODUCT(a, b) ((GLubyte) (((GLint)(a) * ((GLint)(b) + 1)) >> 8)) + +#elif CHAN_BITS == 16 + +#define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (((GLchan) (b)) * 516)) +#define UBYTE_TO_CHAN(b) ((((GLchan) (b)) << 8) | ((GLchan) (b))) +#define SHORT_TO_CHAN(s) ((s) < 0 ? 0 : (GLchan) (s)) +#define USHORT_TO_CHAN(s) (s) +#define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 15)) +#define UINT_TO_CHAN(i) ((GLchan) ((i) >> 16)) + +#define CHAN_TO_UBYTE(c) ((c) >> 8) +#define CHAN_TO_FLOAT(c) ((GLfloat) ((c) * (1.0 / CHAN_MAXF))) + +#define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_USHORT(c, f) +#define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_USHORT(c, f) + +#define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC) + +#define CHAN_PRODUCT(a, b) ((GLchan) ((((GLuint) (a)) * ((GLuint) (b))) / 65535)) + +#elif CHAN_BITS == 32 + +/* XXX floating-point color channels not fully thought-out */ +#define BYTE_TO_CHAN(b) ((GLfloat) ((b) * (1.0F / 127.0F))) +#define UBYTE_TO_CHAN(b) ((GLfloat) ((b) * (1.0F / 255.0F))) +#define SHORT_TO_CHAN(s) ((GLfloat) ((s) * (1.0F / 32767.0F))) +#define USHORT_TO_CHAN(s) ((GLfloat) ((s) * (1.0F / 65535.0F))) +#define INT_TO_CHAN(i) ((GLfloat) ((i) * (1.0F / 2147483647.0F))) +#define UINT_TO_CHAN(i) ((GLfloat) ((i) * (1.0F / 4294967295.0F))) + +#define CHAN_TO_UBYTE(c) FLOAT_TO_UBYTE(c) +#define CHAN_TO_FLOAT(c) (c) + +#define CLAMPED_FLOAT_TO_CHAN(c, f) c = (f) +#define UNCLAMPED_FLOAT_TO_CHAN(c, f) c = (f) + +#define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC) + +#define CHAN_PRODUCT(a, b) ((a) * (b)) + +#else + +#error unexpected CHAN_BITS size + +#endif + + +/** + * Convert 3 channels at once. + * + * \param dst pointer to destination GLchan[3] array. + * \param f pointer to source GLfloat[3] array. + * + * \sa #UNCLAMPED_FLOAT_TO_CHAN. + */ +#define UNCLAMPED_FLOAT_TO_RGB_CHAN(dst, f) \ +do { \ + UNCLAMPED_FLOAT_TO_CHAN(dst[0], f[0]); \ + UNCLAMPED_FLOAT_TO_CHAN(dst[1], f[1]); \ + UNCLAMPED_FLOAT_TO_CHAN(dst[2], f[2]); \ +} while (0) + + +/** + * Convert 4 channels at once. + * + * \param dst pointer to destination GLchan[4] array. + * \param f pointer to source GLfloat[4] array. + * + * \sa #UNCLAMPED_FLOAT_TO_CHAN. + */ +#define UNCLAMPED_FLOAT_TO_RGBA_CHAN(dst, f) \ +do { \ + UNCLAMPED_FLOAT_TO_CHAN(dst[0], f[0]); \ + UNCLAMPED_FLOAT_TO_CHAN(dst[1], f[1]); \ + UNCLAMPED_FLOAT_TO_CHAN(dst[2], f[2]); \ + UNCLAMPED_FLOAT_TO_CHAN(dst[3], f[3]); \ +} while (0) + + + +/** + * \name Generic color packing macros. All inputs should be GLubytes. + * + * \todo We may move these into texstore.h at some point. + */ +/*@{*/ + +#define PACK_COLOR_8888( R, G, B, A ) \ + (((R) << 24) | ((G) << 16) | ((B) << 8) | (A)) + +#define PACK_COLOR_8888_REV( R, G, B, A ) \ + (((A) << 24) | ((B) << 16) | ((G) << 8) | (R)) + +#define PACK_COLOR_888( R, G, B ) \ + (((R) << 16) | ((G) << 8) | (B)) + +#define PACK_COLOR_565( R, G, B ) \ + ((((R) & 0xf8) << 8) | (((G) & 0xfc) << 3) | (((B) & 0xf8) >> 3)) + +#define PACK_COLOR_565_REV( R, G, B ) \ + (((R) & 0xf8) | ((G) & 0xe0) >> 5 | (((G) & 0x1c) << 11) | (((B) & 0xf8) << 5)) + +#define PACK_COLOR_1555( A, B, G, R ) \ + ((((B) & 0xf8) << 7) | (((G) & 0xf8) << 2) | (((R) & 0xf8) >> 3) | \ + ((A) ? 0x8000 : 0)) + +#define PACK_COLOR_1555_REV( A, B, G, R ) \ + ((((B) & 0xf8) >> 1) | (((G) & 0xc0) >> 6) | (((G) & 0x38) << 10) | (((R) & 0xf8) << 5) | \ + ((A) ? 0x80 : 0)) + +#define PACK_COLOR_4444( R, G, B, A ) \ + ((((R) & 0xf0) << 8) | (((G) & 0xf0) << 4) | ((B) & 0xf0) | ((A) >> 4)) + +#define PACK_COLOR_4444_REV( R, G, B, A ) \ + ((((B) & 0xf0) << 8) | (((A) & 0xf0) << 4) | ((R) & 0xf0) | ((G) >> 4)) + +#define PACK_COLOR_88( L, A ) \ + (((L) << 8) | (A)) + +#define PACK_COLOR_88_REV( L, A ) \ + (((A) << 8) | (L)) + +#define PACK_COLOR_332( R, G, B ) \ + (((R) & 0xe0) | (((G) & 0xe0) >> 3) | (((B) & 0xc0) >> 6)) + +#define PACK_COLOR_233( B, G, R ) \ + (((B) & 0xc0) | (((G) & 0xe0) >> 2) | (((R) & 0xe0) >> 5)) + +/*@}*/ + + +#endif /* COLORMAC_H */ diff --git a/reactos/dll/mesa32/src/main/colortab.c b/reactos/dll/mesa32/src/main/colortab.c new file mode 100644 index 00000000000..4f0801578ce --- /dev/null +++ b/reactos/dll/mesa32/src/main/colortab.c @@ -0,0 +1,1445 @@ +/* + * 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. + */ + + +#include "glheader.h" +#include "bufferobj.h" +#include "colortab.h" +#include "context.h" +#include "image.h" +#include "macros.h" +#include "state.h" + + +/* + * Given an internalFormat token passed to glColorTable, + * return the corresponding base format. + * Return -1 if invalid token. + */ +static GLint +base_colortab_format( GLenum format ) +{ + switch (format) { + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + return GL_ALPHA; + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + return GL_LUMINANCE; + 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 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 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: + return -1; /* error */ + } +} + + + +/* + * Examine table's format and set the component sizes accordingly. + */ +static void +set_component_sizes( struct gl_color_table *table ) +{ + GLubyte sz; + + switch (table->Type) { + case GL_UNSIGNED_BYTE: + sz = 8 * sizeof(GLubyte); + break; + case GL_UNSIGNED_SHORT: + sz = 8 * sizeof(GLushort); + break; + case GL_FLOAT: + /* Don't actually return 32 here since that causes the conformance + * tests to blow up. Conform thinks the component is an integer, + * not a float. + */ + sz = 8; /** 8 * sizeof(GLfloat); **/ + break; + default: + _mesa_problem(NULL, "bad color table type in set_component_sizes 0x%x", table->Type); + return; + } + + switch (table->Format) { + case GL_ALPHA: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = sz; + table->IntensitySize = 0; + table->LuminanceSize = 0; + break; + case GL_LUMINANCE: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = 0; + table->IntensitySize = 0; + table->LuminanceSize = sz; + break; + case GL_LUMINANCE_ALPHA: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = sz; + table->IntensitySize = 0; + table->LuminanceSize = sz; + break; + case GL_INTENSITY: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = 0; + table->IntensitySize = sz; + table->LuminanceSize = 0; + break; + case GL_RGB: + table->RedSize = sz; + table->GreenSize = sz; + table->BlueSize = sz; + table->AlphaSize = 0; + table->IntensitySize = 0; + table->LuminanceSize = 0; + break; + case GL_RGBA: + table->RedSize = sz; + table->GreenSize = sz; + table->BlueSize = sz; + table->AlphaSize = sz; + table->IntensitySize = 0; + table->LuminanceSize = 0; + break; + default: + _mesa_problem(NULL, "unexpected format in set_component_sizes"); + } +} + + + +/** + * Update/replace all or part of a color table. Helper function + * used by _mesa_ColorTable() and _mesa_ColorSubTable(). + * The table->Table buffer should already be allocated. + * \param start first entry to update + * \param count number of entries to update + * \param format format of user-provided table data + * \param type datatype of user-provided table data + * \param data user-provided table data + * \param [rgba]Scale - RGBA scale factors + * \param [rgba]Bias - RGBA bias factors + */ +static void +store_colortable_entries(GLcontext *ctx, struct gl_color_table *table, + GLsizei start, GLsizei count, + GLenum format, GLenum type, const GLvoid *data, + GLfloat rScale, GLfloat rBias, + GLfloat gScale, GLfloat gBias, + GLfloat bScale, GLfloat bBias, + GLfloat aScale, GLfloat aBias) +{ + if (ctx->Unpack.BufferObj->Name) { + /* Get/unpack the color table data from a PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(1, &ctx->Unpack, count, 1, 1, + format, type, data)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glColor[Sub]Table(bad PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, + ctx->Unpack.BufferObj); + if (!buf) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glColor[Sub]Table(PBO mapped)"); + return; + } + data = ADD_POINTERS(buf, data); + } + + + if (table->Type == GL_FLOAT) { + /* convert user-provided data to GLfloat values */ + GLfloat tempTab[MAX_COLOR_TABLE_SIZE * 4]; + GLfloat *tableF; + GLint i; + + _mesa_unpack_color_span_float(ctx, + count, /* number of pixels */ + table->Format, /* dest format */ + tempTab, /* dest address */ + format, type, /* src format/type */ + data, /* src data */ + &ctx->Unpack, + IMAGE_CLAMP_BIT); /* transfer ops */ + + /* the destination */ + tableF = (GLfloat *) table->Table; + + /* Apply scale & bias & clamp now */ + switch (table->Format) { + case GL_INTENSITY: + for (i = 0; i < count; i++) { + GLuint j = start + i; + tableF[j] = CLAMP(tempTab[i] * rScale + rBias, 0.0F, 1.0F); + } + break; + case GL_LUMINANCE: + for (i = 0; i < count; i++) { + GLuint j = start + i; + tableF[j] = CLAMP(tempTab[i] * rScale + rBias, 0.0F, 1.0F); + } + break; + case GL_ALPHA: + for (i = 0; i < count; i++) { + GLuint j = start + i; + tableF[j] = CLAMP(tempTab[i] * aScale + aBias, 0.0F, 1.0F); + } + break; + case GL_LUMINANCE_ALPHA: + for (i = 0; i < count; i++) { + GLuint j = start + i; + tableF[j*2+0] = CLAMP(tempTab[i*2+0] * rScale + rBias, 0.0F, 1.0F); + tableF[j*2+1] = CLAMP(tempTab[i*2+1] * aScale + aBias, 0.0F, 1.0F); + } + break; + case GL_RGB: + for (i = 0; i < count; i++) { + GLuint j = start + i; + tableF[j*3+0] = CLAMP(tempTab[i*3+0] * rScale + rBias, 0.0F, 1.0F); + tableF[j*3+1] = CLAMP(tempTab[i*3+1] * gScale + gBias, 0.0F, 1.0F); + tableF[j*3+2] = CLAMP(tempTab[i*3+2] * bScale + bBias, 0.0F, 1.0F); + } + break; + case GL_RGBA: + for (i = 0; i < count; i++) { + GLuint j = start + i; + tableF[j*4+0] = CLAMP(tempTab[i*4+0] * rScale + rBias, 0.0F, 1.0F); + tableF[j*4+1] = CLAMP(tempTab[i*4+1] * gScale + gBias, 0.0F, 1.0F); + tableF[j*4+2] = CLAMP(tempTab[i*4+2] * bScale + bBias, 0.0F, 1.0F); + tableF[j*4+3] = CLAMP(tempTab[i*4+3] * aScale + aBias, 0.0F, 1.0F); + } + break; + default: + _mesa_problem(ctx, "Bad format in store_colortable_entries"); + return; + } + } + else { + /* non-float (GLchan) */ + const GLint comps = _mesa_components_in_format(table->Format); + GLchan *dest = (GLchan *) table->Table + start * comps; + _mesa_unpack_color_span_chan(ctx, count, /* number of entries */ + table->Format, /* dest format */ + dest, /* dest address */ + format, type, data, /* src data */ + &ctx->Unpack, + 0); /* transfer ops */ + } + + if (ctx->Unpack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + ctx->Unpack.BufferObj); + } +} + + + +void GLAPIENTRY +_mesa_ColorTable( GLenum target, GLenum internalFormat, + GLsizei width, GLenum format, GLenum type, + const GLvoid *data ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_object *texObj = NULL; + struct gl_color_table *table = NULL; + GLboolean proxy = GL_FALSE; + GLint baseFormat; + GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0; + GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0; + GLenum tableType = CHAN_TYPE; + GLint comps; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */ + + switch (target) { + case GL_TEXTURE_1D: + texObj = texUnit->Current1D; + table = &texObj->Palette; + break; + case GL_TEXTURE_2D: + texObj = texUnit->Current2D; + table = &texObj->Palette; + break; + case GL_TEXTURE_3D: + texObj = texUnit->Current3D; + table = &texObj->Palette; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); + return; + } + texObj = texUnit->CurrentCubeMap; + table = &texObj->Palette; + break; + case GL_PROXY_TEXTURE_1D: + texObj = ctx->Texture.Proxy1D; + table = &texObj->Palette; + proxy = GL_TRUE; + break; + case GL_PROXY_TEXTURE_2D: + texObj = ctx->Texture.Proxy2D; + table = &texObj->Palette; + proxy = GL_TRUE; + break; + case GL_PROXY_TEXTURE_3D: + texObj = ctx->Texture.Proxy3D; + table = &texObj->Palette; + proxy = GL_TRUE; + break; + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); + return; + } + texObj = ctx->Texture.ProxyCubeMap; + table = &texObj->Palette; + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + table = &ctx->Texture.Palette; + tableType = GL_FLOAT; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + tableType = GL_FLOAT; + rScale = ctx->Pixel.ColorTableScale[0]; + gScale = ctx->Pixel.ColorTableScale[1]; + bScale = ctx->Pixel.ColorTableScale[2]; + aScale = ctx->Pixel.ColorTableScale[3]; + rBias = ctx->Pixel.ColorTableBias[0]; + gBias = ctx->Pixel.ColorTableBias[1]; + bBias = ctx->Pixel.ColorTableBias[2]; + aBias = ctx->Pixel.ColorTableBias[3]; + break; + case GL_PROXY_COLOR_TABLE: + table = &ctx->ProxyColorTable; + proxy = GL_TRUE; + break; + case GL_TEXTURE_COLOR_TABLE_SGI: + if (!ctx->Extensions.SGI_texture_color_table) { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); + return; + } + table = &(texUnit->ColorTable); + tableType = GL_FLOAT; + rScale = ctx->Pixel.TextureColorTableScale[0]; + gScale = ctx->Pixel.TextureColorTableScale[1]; + bScale = ctx->Pixel.TextureColorTableScale[2]; + aScale = ctx->Pixel.TextureColorTableScale[3]; + rBias = ctx->Pixel.TextureColorTableBias[0]; + gBias = ctx->Pixel.TextureColorTableBias[1]; + bBias = ctx->Pixel.TextureColorTableBias[2]; + aBias = ctx->Pixel.TextureColorTableBias[3]; + break; + case GL_PROXY_TEXTURE_COLOR_TABLE_SGI: + if (!ctx->Extensions.SGI_texture_color_table) { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); + return; + } + table = &(texUnit->ProxyColorTable); + tableType = GL_FLOAT; + proxy = GL_TRUE; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + tableType = GL_FLOAT; + rScale = ctx->Pixel.PCCTscale[0]; + gScale = ctx->Pixel.PCCTscale[1]; + bScale = ctx->Pixel.PCCTscale[2]; + aScale = ctx->Pixel.PCCTscale[3]; + rBias = ctx->Pixel.PCCTbias[0]; + gBias = ctx->Pixel.PCCTbias[1]; + bBias = ctx->Pixel.PCCTbias[2]; + aBias = ctx->Pixel.PCCTbias[3]; + break; + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->ProxyPostConvolutionColorTable; + tableType = GL_FLOAT; + proxy = GL_TRUE; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; + tableType = GL_FLOAT; + rScale = ctx->Pixel.PCMCTscale[0]; + gScale = ctx->Pixel.PCMCTscale[1]; + bScale = ctx->Pixel.PCMCTscale[2]; + aScale = ctx->Pixel.PCMCTscale[3]; + rBias = ctx->Pixel.PCMCTbias[0]; + gBias = ctx->Pixel.PCMCTbias[1]; + bBias = ctx->Pixel.PCMCTbias[2]; + aBias = ctx->Pixel.PCMCTbias[3]; + break; + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->ProxyPostColorMatrixColorTable; + tableType = GL_FLOAT; + proxy = GL_TRUE; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); + return; + } + + assert(table); + + if (!_mesa_is_legal_format_and_type(ctx, format, type) || + format == GL_INTENSITY) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glColorTable(format or type)"); + return; + } + + baseFormat = base_colortab_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(internalFormat)"); + return; + } + + if (width < 0 || (width != 0 && _mesa_bitcount(width) != 1)) { + /* error */ + if (proxy) { + table->Size = 0; + table->IntFormat = (GLenum) 0; + table->Format = (GLenum) 0; + } + else { + _mesa_error(ctx, GL_INVALID_VALUE, "glColorTable(width=%d)", width); + } + return; + } + + if (width > (GLsizei) ctx->Const.MaxColorTableSize) { + if (proxy) { + table->Size = 0; + table->IntFormat = (GLenum) 0; + table->Format = (GLenum) 0; + } + else { + _mesa_error(ctx, GL_TABLE_TOO_LARGE, "glColorTable(width)"); + } + return; + } + + table->Size = width; + table->IntFormat = internalFormat; + table->Format = (GLenum) baseFormat; + table->Type = (tableType == GL_FLOAT) ? GL_FLOAT : CHAN_TYPE; + + comps = _mesa_components_in_format(table->Format); + assert(comps > 0); /* error should have been caught sooner */ + + if (!proxy) { + /* free old table, if any */ + if (table->Table) { + FREE(table->Table); + table->Table = NULL; + } + + if (width > 0) { + if (table->Type == GL_FLOAT) { + table->Table = MALLOC(comps * width * sizeof(GLfloat)); + } + else { + table->Table = MALLOC(comps * width * sizeof(GLchan)); + } + + if (!table->Table) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorTable"); + return; + } + + store_colortable_entries(ctx, table, + 0, width, /* start, count */ + format, type, data, + rScale, rBias, + gScale, gBias, + bScale, bBias, + aScale, aBias); + } + } /* proxy */ + + /* do this after the table's Type and Format are set */ + set_component_sizes(table); + + if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) { + /* texture object palette, texObj==NULL means the shared palette */ + if (ctx->Driver.UpdateTexturePalette) { + (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); + } + } + + ctx->NewState |= _NEW_PIXEL; +} + + + +void GLAPIENTRY +_mesa_ColorSubTable( GLenum target, GLsizei start, + GLsizei count, GLenum format, GLenum type, + const GLvoid *data ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_object *texObj = NULL; + struct gl_color_table *table = NULL; + GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0; + GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + switch (target) { + case GL_TEXTURE_1D: + texObj = texUnit->Current1D; + table = &texObj->Palette; + break; + case GL_TEXTURE_2D: + texObj = texUnit->Current2D; + table = &texObj->Palette; + break; + case GL_TEXTURE_3D: + texObj = texUnit->Current3D; + table = &texObj->Palette; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); + return; + } + texObj = texUnit->CurrentCubeMap; + table = &texObj->Palette; + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + rScale = ctx->Pixel.ColorTableScale[0]; + gScale = ctx->Pixel.ColorTableScale[1]; + bScale = ctx->Pixel.ColorTableScale[2]; + aScale = ctx->Pixel.ColorTableScale[3]; + rBias = ctx->Pixel.ColorTableBias[0]; + gBias = ctx->Pixel.ColorTableBias[1]; + bBias = ctx->Pixel.ColorTableBias[2]; + aBias = ctx->Pixel.ColorTableBias[3]; + break; + case GL_TEXTURE_COLOR_TABLE_SGI: + if (!ctx->Extensions.SGI_texture_color_table) { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); + return; + } + table = &(texUnit->ColorTable); + rScale = ctx->Pixel.TextureColorTableScale[0]; + gScale = ctx->Pixel.TextureColorTableScale[1]; + bScale = ctx->Pixel.TextureColorTableScale[2]; + aScale = ctx->Pixel.TextureColorTableScale[3]; + rBias = ctx->Pixel.TextureColorTableBias[0]; + gBias = ctx->Pixel.TextureColorTableBias[1]; + bBias = ctx->Pixel.TextureColorTableBias[2]; + aBias = ctx->Pixel.TextureColorTableBias[3]; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + rScale = ctx->Pixel.PCCTscale[0]; + gScale = ctx->Pixel.PCCTscale[1]; + bScale = ctx->Pixel.PCCTscale[2]; + aScale = ctx->Pixel.PCCTscale[3]; + rBias = ctx->Pixel.PCCTbias[0]; + gBias = ctx->Pixel.PCCTbias[1]; + bBias = ctx->Pixel.PCCTbias[2]; + aBias = ctx->Pixel.PCCTbias[3]; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; + rScale = ctx->Pixel.PCMCTscale[0]; + gScale = ctx->Pixel.PCMCTscale[1]; + bScale = ctx->Pixel.PCMCTscale[2]; + aScale = ctx->Pixel.PCMCTscale[3]; + rBias = ctx->Pixel.PCMCTbias[0]; + gBias = ctx->Pixel.PCMCTbias[1]; + bBias = ctx->Pixel.PCMCTbias[2]; + aBias = ctx->Pixel.PCMCTbias[3]; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); + return; + } + + assert(table); + + if (!_mesa_is_legal_format_and_type(ctx, format, type) || + format == GL_INTENSITY) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glColorSubTable(format or type)"); + return; + } + + if (count < 1) { + _mesa_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)"); + return; + } + + /* error should have been caught sooner */ + assert(_mesa_components_in_format(table->Format) > 0); + + if (start + count > (GLint) table->Size) { + _mesa_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)"); + return; + } + + if (!table->Table) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorSubTable"); + return; + } + + store_colortable_entries(ctx, table, start, count, + format, type, data, + rScale, rBias, + gScale, gBias, + bScale, bBias, + aScale, aBias); + + if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) { + /* per-texture object palette */ + if (ctx->Driver.UpdateTexturePalette) { + (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); + } + } + + ctx->NewState |= _NEW_PIXEL; +} + + + +void GLAPIENTRY +_mesa_CopyColorTable(GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + /* Select buffer to read from */ + ctx->Driver.CopyColorTable( ctx, target, internalformat, x, y, width ); +} + + + +void GLAPIENTRY +_mesa_CopyColorSubTable(GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + ctx->Driver.CopyColorSubTable( ctx, target, start, x, y, width ); +} + + + +void GLAPIENTRY +_mesa_GetColorTable( GLenum target, GLenum format, + GLenum type, GLvoid *data ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_color_table *table = NULL; + GLchan rgba[MAX_COLOR_TABLE_SIZE][4]; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (ctx->NewState) { + _mesa_update_state(ctx); + } + + switch (target) { + case GL_TEXTURE_1D: + table = &texUnit->Current1D->Palette; + break; + case GL_TEXTURE_2D: + table = &texUnit->Current2D->Palette; + break; + case GL_TEXTURE_3D: + table = &texUnit->Current3D->Palette; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); + return; + } + table = &texUnit->CurrentCubeMap->Palette; + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + break; + case GL_TEXTURE_COLOR_TABLE_SGI: + if (!ctx->Extensions.SGI_texture_color_table) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); + return; + } + table = &(texUnit->ColorTable); + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); + return; + } + + ASSERT(table); + + switch (table->Format) { + case GL_ALPHA: + if (table->Type == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = 0; + rgba[i][GCOMP] = 0; + rgba[i][BCOMP] = 0; + rgba[i][ACOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); + } + } + else { + const GLchan *tableUB = (const GLchan *) table->Table; + GLuint i; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = 0; + rgba[i][GCOMP] = 0; + rgba[i][BCOMP] = 0; + rgba[i][ACOMP] = tableUB[i]; + } + } + break; + case GL_LUMINANCE: + if (table->Type == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); + rgba[i][GCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); + rgba[i][BCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); + rgba[i][ACOMP] = CHAN_MAX; + } + } + else { + const GLchan *tableUB = (const GLchan *) table->Table; + GLuint i; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i]; + rgba[i][GCOMP] = tableUB[i]; + rgba[i][BCOMP] = tableUB[i]; + rgba[i][ACOMP] = CHAN_MAX; + } + } + break; + case GL_LUMINANCE_ALPHA: + if (table->Type == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF); + rgba[i][GCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF); + rgba[i][BCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF); + rgba[i][ACOMP] = IROUND_POS(tableF[i*2+1] * CHAN_MAXF); + } + } + else { + const GLchan *tableUB = (const GLchan *) table->Table; + GLuint i; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i*2+0]; + rgba[i][GCOMP] = tableUB[i*2+0]; + rgba[i][BCOMP] = tableUB[i*2+0]; + rgba[i][ACOMP] = tableUB[i*2+1]; + } + } + break; + case GL_INTENSITY: + if (table->Type == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); + rgba[i][GCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); + rgba[i][BCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); + rgba[i][ACOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); + } + } + else { + const GLchan *tableUB = (const GLchan *) table->Table; + GLuint i; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i]; + rgba[i][GCOMP] = tableUB[i]; + rgba[i][BCOMP] = tableUB[i]; + rgba[i][ACOMP] = tableUB[i]; + } + } + break; + case GL_RGB: + if (table->Type == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = IROUND_POS(tableF[i*3+0] * CHAN_MAXF); + rgba[i][GCOMP] = IROUND_POS(tableF[i*3+1] * CHAN_MAXF); + rgba[i][BCOMP] = IROUND_POS(tableF[i*3+2] * CHAN_MAXF); + rgba[i][ACOMP] = CHAN_MAX; + } + } + else { + const GLchan *tableUB = (const GLchan *) table->Table; + GLuint i; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i*3+0]; + rgba[i][GCOMP] = tableUB[i*3+1]; + rgba[i][BCOMP] = tableUB[i*3+2]; + rgba[i][ACOMP] = CHAN_MAX; + } + } + break; + case GL_RGBA: + if (table->Type == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = IROUND_POS(tableF[i*4+0] * CHAN_MAXF); + rgba[i][GCOMP] = IROUND_POS(tableF[i*4+1] * CHAN_MAXF); + rgba[i][BCOMP] = IROUND_POS(tableF[i*4+2] * CHAN_MAXF); + rgba[i][ACOMP] = IROUND_POS(tableF[i*4+3] * CHAN_MAXF); + } + } + else { + const GLchan *tableUB = (const GLchan *) table->Table; + GLuint i; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i*4+0]; + rgba[i][GCOMP] = tableUB[i*4+1]; + rgba[i][BCOMP] = tableUB[i*4+2]; + rgba[i][ACOMP] = tableUB[i*4+3]; + } + } + break; + default: + _mesa_problem(ctx, "bad table format in glGetColorTable"); + return; + } + + if (ctx->Pack.BufferObj->Name) { + /* pack color table into PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(1, &ctx->Pack, table->Size, 1, 1, + format, type, data)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetColorTable(invalid PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + ctx->Pack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetColorTable(PBO is mapped)"); + return; + } + data = ADD_POINTERS(buf, data); + } + + _mesa_pack_rgba_span_chan(ctx, table->Size, (const GLchan (*)[4]) rgba, + format, type, data, &ctx->Pack, GL_FALSE); + + if (ctx->Pack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + ctx->Pack.BufferObj); + } +} + + + +void GLAPIENTRY +_mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + switch (target) { + case GL_COLOR_TABLE_SGI: + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + ctx->Pixel.ColorTableScale[0] = params[0]; + ctx->Pixel.ColorTableScale[1] = params[1]; + ctx->Pixel.ColorTableScale[2] = params[2]; + ctx->Pixel.ColorTableScale[3] = params[3]; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + ctx->Pixel.ColorTableBias[0] = params[0]; + ctx->Pixel.ColorTableBias[1] = params[1]; + ctx->Pixel.ColorTableBias[2] = params[2]; + ctx->Pixel.ColorTableBias[3] = params[3]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); + return; + } + break; + case GL_TEXTURE_COLOR_TABLE_SGI: + if (!ctx->Extensions.SGI_texture_color_table) { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)"); + return; + } + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + ctx->Pixel.TextureColorTableScale[0] = params[0]; + ctx->Pixel.TextureColorTableScale[1] = params[1]; + ctx->Pixel.TextureColorTableScale[2] = params[2]; + ctx->Pixel.TextureColorTableScale[3] = params[3]; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + ctx->Pixel.TextureColorTableBias[0] = params[0]; + ctx->Pixel.TextureColorTableBias[1] = params[1]; + ctx->Pixel.TextureColorTableBias[2] = params[2]; + ctx->Pixel.TextureColorTableBias[3] = params[3]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); + return; + } + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + ctx->Pixel.PCCTscale[0] = params[0]; + ctx->Pixel.PCCTscale[1] = params[1]; + ctx->Pixel.PCCTscale[2] = params[2]; + ctx->Pixel.PCCTscale[3] = params[3]; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + ctx->Pixel.PCCTbias[0] = params[0]; + ctx->Pixel.PCCTbias[1] = params[1]; + ctx->Pixel.PCCTbias[2] = params[2]; + ctx->Pixel.PCCTbias[3] = params[3]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); + return; + } + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + ctx->Pixel.PCMCTscale[0] = params[0]; + ctx->Pixel.PCMCTscale[1] = params[1]; + ctx->Pixel.PCMCTscale[2] = params[2]; + ctx->Pixel.PCMCTscale[3] = params[3]; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + ctx->Pixel.PCMCTbias[0] = params[0]; + ctx->Pixel.PCMCTbias[1] = params[1]; + ctx->Pixel.PCMCTbias[2] = params[2]; + ctx->Pixel.PCMCTbias[3] = params[3]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); + return; + } + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)"); + return; + } + + ctx->NewState |= _NEW_PIXEL; +} + + + +void GLAPIENTRY +_mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + GLfloat fparams[4]; + if (pname == GL_COLOR_TABLE_SGI || + pname == GL_TEXTURE_COLOR_TABLE_SGI || + pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || + pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) { + /* four values */ + fparams[0] = (GLfloat) params[0]; + fparams[1] = (GLfloat) params[1]; + fparams[2] = (GLfloat) params[2]; + fparams[3] = (GLfloat) params[3]; + } + else { + /* one values */ + fparams[0] = (GLfloat) params[0]; + } + _mesa_ColorTableParameterfv(target, pname, fparams); +} + + + +void GLAPIENTRY +_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_color_table *table = NULL; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (target) { + case GL_TEXTURE_1D: + table = &texUnit->Current1D->Palette; + break; + case GL_TEXTURE_2D: + table = &texUnit->Current2D->Palette; + break; + case GL_TEXTURE_3D: + table = &texUnit->Current3D->Palette; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetColorTableParameterfv(target)"); + return; + } + table = &texUnit->CurrentCubeMap->Palette; + break; + case GL_PROXY_TEXTURE_1D: + table = &ctx->Texture.Proxy1D->Palette; + break; + case GL_PROXY_TEXTURE_2D: + table = &ctx->Texture.Proxy2D->Palette; + break; + case GL_PROXY_TEXTURE_3D: + table = &ctx->Texture.Proxy3D->Palette; + break; + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetColorTableParameterfv(target)"); + return; + } + table = &ctx->Texture.ProxyCubeMap->Palette; + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = ctx->Pixel.ColorTableScale[0]; + params[1] = ctx->Pixel.ColorTableScale[1]; + params[2] = ctx->Pixel.ColorTableScale[2]; + params[3] = ctx->Pixel.ColorTableScale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = ctx->Pixel.ColorTableBias[0]; + params[1] = ctx->Pixel.ColorTableBias[1]; + params[2] = ctx->Pixel.ColorTableBias[2]; + params[3] = ctx->Pixel.ColorTableBias[3]; + return; + } + break; + case GL_PROXY_COLOR_TABLE: + table = &ctx->ProxyColorTable; + break; + case GL_TEXTURE_COLOR_TABLE_SGI: + if (!ctx->Extensions.SGI_texture_color_table) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); + return; + } + table = &(texUnit->ColorTable); + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = ctx->Pixel.TextureColorTableScale[0]; + params[1] = ctx->Pixel.TextureColorTableScale[1]; + params[2] = ctx->Pixel.TextureColorTableScale[2]; + params[3] = ctx->Pixel.TextureColorTableScale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = ctx->Pixel.TextureColorTableBias[0]; + params[1] = ctx->Pixel.TextureColorTableBias[1]; + params[2] = ctx->Pixel.TextureColorTableBias[2]; + params[3] = ctx->Pixel.TextureColorTableBias[3]; + return; + } + break; + case GL_PROXY_TEXTURE_COLOR_TABLE_SGI: + if (!ctx->Extensions.SGI_texture_color_table) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); + return; + } + table = &(texUnit->ProxyColorTable); + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = ctx->Pixel.PCCTscale[0]; + params[1] = ctx->Pixel.PCCTscale[1]; + params[2] = ctx->Pixel.PCCTscale[2]; + params[3] = ctx->Pixel.PCCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = ctx->Pixel.PCCTbias[0]; + params[1] = ctx->Pixel.PCCTbias[1]; + params[2] = ctx->Pixel.PCCTbias[2]; + params[3] = ctx->Pixel.PCCTbias[3]; + return; + } + break; + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->ProxyPostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = ctx->Pixel.PCMCTscale[0]; + params[1] = ctx->Pixel.PCMCTscale[1]; + params[2] = ctx->Pixel.PCMCTscale[2]; + params[3] = ctx->Pixel.PCMCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = ctx->Pixel.PCMCTbias[0]; + params[1] = ctx->Pixel.PCMCTbias[1]; + params[2] = ctx->Pixel.PCMCTbias[2]; + params[3] = ctx->Pixel.PCMCTbias[3]; + return; + } + break; + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->ProxyPostColorMatrixColorTable; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)"); + return; + } + + assert(table); + + switch (pname) { + case GL_COLOR_TABLE_FORMAT: + *params = (GLfloat) table->IntFormat; + break; + case GL_COLOR_TABLE_WIDTH: + *params = (GLfloat) table->Size; + break; + case GL_COLOR_TABLE_RED_SIZE: + *params = (GLfloat) table->RedSize; + break; + case GL_COLOR_TABLE_GREEN_SIZE: + *params = (GLfloat) table->GreenSize; + break; + case GL_COLOR_TABLE_BLUE_SIZE: + *params = (GLfloat) table->BlueSize; + break; + case GL_COLOR_TABLE_ALPHA_SIZE: + *params = (GLfloat) table->AlphaSize; + break; + case GL_COLOR_TABLE_LUMINANCE_SIZE: + *params = (GLfloat) table->LuminanceSize; + break; + case GL_COLOR_TABLE_INTENSITY_SIZE: + *params = (GLfloat) table->IntensitySize; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(pname)" ); + return; + } +} + + + +void GLAPIENTRY +_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_color_table *table = NULL; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (target) { + case GL_TEXTURE_1D: + table = &texUnit->Current1D->Palette; + break; + case GL_TEXTURE_2D: + table = &texUnit->Current2D->Palette; + break; + case GL_TEXTURE_3D: + table = &texUnit->Current3D->Palette; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetColorTableParameteriv(target)"); + return; + } + table = &texUnit->CurrentCubeMap->Palette; + break; + case GL_PROXY_TEXTURE_1D: + table = &ctx->Texture.Proxy1D->Palette; + break; + case GL_PROXY_TEXTURE_2D: + table = &ctx->Texture.Proxy2D->Palette; + break; + case GL_PROXY_TEXTURE_3D: + table = &ctx->Texture.Proxy3D->Palette; + break; + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetColorTableParameteriv(target)"); + return; + } + table = &ctx->Texture.ProxyCubeMap->Palette; + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = (GLint) ctx->Pixel.ColorTableScale[0]; + params[1] = (GLint) ctx->Pixel.ColorTableScale[1]; + params[2] = (GLint) ctx->Pixel.ColorTableScale[2]; + params[3] = (GLint) ctx->Pixel.ColorTableScale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = (GLint) ctx->Pixel.ColorTableBias[0]; + params[1] = (GLint) ctx->Pixel.ColorTableBias[1]; + params[2] = (GLint) ctx->Pixel.ColorTableBias[2]; + params[3] = (GLint) ctx->Pixel.ColorTableBias[3]; + return; + } + break; + case GL_PROXY_COLOR_TABLE: + table = &ctx->ProxyColorTable; + break; + case GL_TEXTURE_COLOR_TABLE_SGI: + if (!ctx->Extensions.SGI_texture_color_table) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); + return; + } + table = &(texUnit->ColorTable); + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = (GLint) ctx->Pixel.TextureColorTableScale[0]; + params[1] = (GLint) ctx->Pixel.TextureColorTableScale[1]; + params[2] = (GLint) ctx->Pixel.TextureColorTableScale[2]; + params[3] = (GLint) ctx->Pixel.TextureColorTableScale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = (GLint) ctx->Pixel.TextureColorTableBias[0]; + params[1] = (GLint) ctx->Pixel.TextureColorTableBias[1]; + params[2] = (GLint) ctx->Pixel.TextureColorTableBias[2]; + params[3] = (GLint) ctx->Pixel.TextureColorTableBias[3]; + return; + } + break; + case GL_PROXY_TEXTURE_COLOR_TABLE_SGI: + if (!ctx->Extensions.SGI_texture_color_table) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); + return; + } + table = &(texUnit->ProxyColorTable); + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = (GLint) ctx->Pixel.PCCTscale[0]; + params[1] = (GLint) ctx->Pixel.PCCTscale[1]; + params[2] = (GLint) ctx->Pixel.PCCTscale[2]; + params[3] = (GLint) ctx->Pixel.PCCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = (GLint) ctx->Pixel.PCCTbias[0]; + params[1] = (GLint) ctx->Pixel.PCCTbias[1]; + params[2] = (GLint) ctx->Pixel.PCCTbias[2]; + params[3] = (GLint) ctx->Pixel.PCCTbias[3]; + return; + } + break; + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->ProxyPostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = (GLint) ctx->Pixel.PCMCTscale[0]; + params[1] = (GLint) ctx->Pixel.PCMCTscale[1]; + params[2] = (GLint) ctx->Pixel.PCMCTscale[2]; + params[3] = (GLint) ctx->Pixel.PCMCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = (GLint) ctx->Pixel.PCMCTbias[0]; + params[1] = (GLint) ctx->Pixel.PCMCTbias[1]; + params[2] = (GLint) ctx->Pixel.PCMCTbias[2]; + params[3] = (GLint) ctx->Pixel.PCMCTbias[3]; + return; + } + break; + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->ProxyPostColorMatrixColorTable; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)"); + return; + } + + assert(table); + + switch (pname) { + case GL_COLOR_TABLE_FORMAT: + *params = table->IntFormat; + break; + case GL_COLOR_TABLE_WIDTH: + *params = table->Size; + break; + case GL_COLOR_TABLE_RED_SIZE: + *params = table->RedSize; + break; + case GL_COLOR_TABLE_GREEN_SIZE: + *params = table->GreenSize; + break; + case GL_COLOR_TABLE_BLUE_SIZE: + *params = table->BlueSize; + break; + case GL_COLOR_TABLE_ALPHA_SIZE: + *params = table->AlphaSize; + break; + case GL_COLOR_TABLE_LUMINANCE_SIZE: + *params = table->LuminanceSize; + break; + case GL_COLOR_TABLE_INTENSITY_SIZE: + *params = table->IntensitySize; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(pname)" ); + return; + } +} + +/**********************************************************************/ +/***** Initialization *****/ +/**********************************************************************/ + + +void +_mesa_init_colortable( struct gl_color_table *p ) +{ + p->Type = CHAN_TYPE; + p->Table = NULL; + p->Size = 0; + p->IntFormat = GL_RGBA; +} + + + +void +_mesa_free_colortable_data( struct gl_color_table *p ) +{ + if (p->Table) { + FREE(p->Table); + p->Table = NULL; + } +} + + +/* + * Initialize all colortables for a context. + */ +void _mesa_init_colortables( GLcontext * ctx ) +{ + /* Color tables */ + _mesa_init_colortable(&ctx->ColorTable); + _mesa_init_colortable(&ctx->ProxyColorTable); + _mesa_init_colortable(&ctx->PostConvolutionColorTable); + _mesa_init_colortable(&ctx->ProxyPostConvolutionColorTable); + _mesa_init_colortable(&ctx->PostColorMatrixColorTable); + _mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable); +} + + +/* + * Free all colortable data for a context + */ +void _mesa_free_colortables_data( GLcontext *ctx ) +{ + _mesa_free_colortable_data(&ctx->ColorTable); + _mesa_free_colortable_data(&ctx->ProxyColorTable); + _mesa_free_colortable_data(&ctx->PostConvolutionColorTable); + _mesa_free_colortable_data(&ctx->ProxyPostConvolutionColorTable); + _mesa_free_colortable_data(&ctx->PostColorMatrixColorTable); + _mesa_free_colortable_data(&ctx->ProxyPostColorMatrixColorTable); +} diff --git a/reactos/dll/mesa32/src/main/colortab.h b/reactos/dll/mesa32/src/main/colortab.h new file mode 100644 index 00000000000..4bd16210a0b --- /dev/null +++ b/reactos/dll/mesa32/src/main/colortab.h @@ -0,0 +1,110 @@ +/** + * \file colortab.h + * Color tables. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * 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 COLORTAB_H +#define COLORTAB_H + + +#include "mtypes.h" + +#if _HAVE_FULL_GL + +extern void GLAPIENTRY +_mesa_ColorTable( GLenum target, GLenum internalformat, + GLsizei width, GLenum format, GLenum type, + const GLvoid *table ); + +extern void GLAPIENTRY +_mesa_ColorSubTable( GLenum target, GLsizei start, + GLsizei count, GLenum format, GLenum type, + const GLvoid *table ); + +extern void GLAPIENTRY +_mesa_CopyColorSubTable(GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width); + +extern void GLAPIENTRY +_mesa_CopyColorTable(GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width); + +extern void GLAPIENTRY +_mesa_GetColorTable( GLenum target, GLenum format, + GLenum type, GLvoid *table ); + +extern void GLAPIENTRY +_mesa_ColorTableParameterfv(GLenum target, GLenum pname, + const GLfloat *params); + +extern void GLAPIENTRY +_mesa_ColorTableParameteriv(GLenum target, GLenum pname, + const GLint *params); + +extern void GLAPIENTRY +_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ); + +extern void GLAPIENTRY +_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ); + + + +extern void +_mesa_init_colortable( struct gl_color_table *table ); + +extern void +_mesa_free_colortable_data( struct gl_color_table *table ); + +extern void +_mesa_init_colortables( GLcontext *ctx ); + +extern void +_mesa_free_colortables_data( GLcontext *ctx ); + +#else + +/** No-op */ +#define _mesa_init_colortable( p ) ((void) 0) + +/** No-op */ +#define _mesa_free_colortable_data( p ) ((void) 0) + +/** No-op */ +#define _mesa_init_colortables( p ) ((void)0) + +/** No-op */ +#define _mesa_free_colortables_data( p ) ((void)0) + +#endif + +#endif diff --git a/reactos/dll/mesa32/src/main/config.h b/reactos/dll/mesa32/src/main/config.h new file mode 100644 index 00000000000..de2bae9cb0d --- /dev/null +++ b/reactos/dll/mesa32/src/main/config.h @@ -0,0 +1,324 @@ +/** + * \file config.h + * Tunable configuration parameters. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 CONFIG_H +#define CONFIG_H + +/** + * \name OpenGL implementation limits + */ +/*@{*/ + +/** Maximum modelview matrix stack depth */ +#define MAX_MODELVIEW_STACK_DEPTH 32 + +/** Maximum projection matrix stack depth */ +#define MAX_PROJECTION_STACK_DEPTH 32 + +/** Maximum texture matrix stack depth */ +#define MAX_TEXTURE_STACK_DEPTH 10 + +/** Maximum color matrix stack depth */ +#define MAX_COLOR_STACK_DEPTH 4 + +/** Maximum attribute stack depth */ +#define MAX_ATTRIB_STACK_DEPTH 16 + +/** Maximum client attribute stack depth */ +#define MAX_CLIENT_ATTRIB_STACK_DEPTH 16 + +/** Maximum recursion depth of display list calls */ +#define MAX_LIST_NESTING 64 + +/** Maximum number of lights */ +#define MAX_LIGHTS 8 + +/** Maximum user-defined clipping planes */ +#define MAX_CLIP_PLANES 6 + +/** Maximum pixel map lookup table size */ +#define MAX_PIXEL_MAP_TABLE 256 + +/** Maximum number of auxillary color buffers */ +#define MAX_AUX_BUFFERS 4 + +/** Maximum order (degree) of curves */ +#ifdef AMIGA +# define MAX_EVAL_ORDER 12 +#else +# define MAX_EVAL_ORDER 30 +#endif + +/** Maximum Name stack depth */ +#define MAX_NAME_STACK_DEPTH 64 + +/** Minimum point size */ +#define MIN_POINT_SIZE 1.0 +/** Maximum point size */ +#define MAX_POINT_SIZE 20.0 +/** Point size granularity */ +#define POINT_SIZE_GRANULARITY 0.1 + +/** Minimum line width */ +#define MIN_LINE_WIDTH 1.0 +/** Maximum line width */ +#define MAX_LINE_WIDTH 10.0 +/** Line width granularity */ +#define LINE_WIDTH_GRANULARITY 0.1 + +/** Max texture palette / color table size */ +#define MAX_COLOR_TABLE_SIZE 256 + +/** Number of 1D/2D texture mipmap levels */ +#define MAX_TEXTURE_LEVELS 12 + +/** Number of 3D texture mipmap levels */ +#define MAX_3D_TEXTURE_LEVELS 9 + +/** Number of cube texture mipmap levels - GL_ARB_texture_cube_map */ +#define MAX_CUBE_TEXTURE_LEVELS 12 + +/** Maximum rectangular texture size - GL_NV_texture_rectangle */ +#define MAX_TEXTURE_RECT_SIZE 2048 + +/** Number of texture units - GL_ARB_multitexture */ +#define MAX_TEXTURE_UNITS 8 + +/*@}*/ + + +/** + * \name Separate numbers of texture coordinates and texture image units. + * + * These values will eventually replace most instances of MAX_TEXTURE_UNITS. + * We should always have MAX_TEXTURE_COORD_UNITS <= MAX_TEXTURE_IMAGE_UNITS. + * And, GL_MAX_TEXTURE_UNITS <= MAX_TEXTURE_COORD_UNITS. + */ +/*@{*/ +#define MAX_TEXTURE_COORD_UNITS 8 +#define MAX_TEXTURE_IMAGE_UNITS 8 +/*@}*/ + +/** + * Maximum viewport/image width. Must accomodate all texture sizes too. + */ +#define MAX_WIDTH 4096 +/** Maximum viewport/image height */ +#define MAX_HEIGHT 4096 + +/** Maxmimum size for CVA. May be overridden by the drivers. */ +#define MAX_ARRAY_LOCK_SIZE 3000 + +/** Subpixel precision for antialiasing, window coordinate snapping */ +#define SUB_PIXEL_BITS 4 + +/** Size of histogram tables */ +#define HISTOGRAM_TABLE_SIZE 256 + +/** Max convolution filter width */ +#define MAX_CONVOLUTION_WIDTH 9 +/** Max convolution filter height */ +#define MAX_CONVOLUTION_HEIGHT 9 + +/** For GL_ARB_texture_compression */ +#define MAX_COMPRESSED_TEXTURE_FORMATS 25 + +/** For GL_EXT_texture_filter_anisotropic */ +#define MAX_TEXTURE_MAX_ANISOTROPY 16.0 + +/** For GL_EXT_texture_lod_bias (typically MAX_TEXTURE_LEVELS - 1) */ +#define MAX_TEXTURE_LOD_BIAS 11.0 + +/** For GL_NV_vertex_program */ +/*@{*/ +#define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128 +#define MAX_NV_VERTEX_PROGRAM_TEMPS 12 +#define MAX_NV_VERTEX_PROGRAM_PARAMS 128 /* KW: power of two */ +#define MAX_NV_VERTEX_PROGRAM_INPUTS 16 +#define MAX_NV_VERTEX_PROGRAM_OUTPUTS 15 +/*@}*/ + +/** For GL_NV_fragment_program */ +/*@{*/ +#define MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS 128 +#define MAX_NV_FRAGMENT_PROGRAM_TEMPS 96 +#define MAX_NV_FRAGMENT_PROGRAM_PARAMS 64 +#define MAX_NV_FRAGMENT_PROGRAM_INPUTS 12 +#define MAX_NV_FRAGMENT_PROGRAM_OUTPUTS 3 +#define MAX_NV_FRAGMENT_PROGRAM_WRITE_ONLYS 2 +/*@}*/ + +/** For GL_ARB_vertex_program */ +/*@{*/ +#define MAX_VERTEX_PROGRAM_ADDRESS_REGS 1 +#define MAX_VERTEX_PROGRAM_ATTRIBS 16 +/*@}*/ + +/** For GL_ARB_fragment_program */ +/*@{*/ +#define MAX_FRAGMENT_PROGRAM_ADDRESS_REGS 1 +#define MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS 48 +#define MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS 24 +#define MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS 4 +/*@}*/ + +/** For any program target/extension */ +/*@{*/ +#define MAX_PROGRAM_LOCAL_PARAMS 128 /* KW: power of two */ +#define MAX_PROGRAM_MATRICES 8 +#define MAX_PROGRAM_MATRIX_STACK_DEPTH 4 +/*@}*/ + +/** For GL_ARB_fragment_shader */ +/*@{*/ +#define MAX_FRAGMENT_UNIFORM_COMPONENTS 64 +/*@}*/ + +/** For GL_ARB_vertex_shader */ +/*@{*/ +#define MAX_VERTEX_UNIFORM_COMPONENTS 512 +#define MAX_VARYING_FLOATS 32 +#define MAX_VERTEX_TEXTURE_IMAGE_UNITS 0 +#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS) +/*@}*/ + + +/** For GL_ARB_draw_buffers */ +/*@{*/ +#define MAX_DRAW_BUFFERS 1 +/*@}*/ + + +/** For GL_EXT_framebuffer_object */ +/*@{*/ +#define MAX_COLOR_ATTACHMENTS 8 +/*@}*/ + + + +/** + * \name Mesa-specific parameters + */ +/*@{*/ + + +/** + * If non-zero use GLdouble for walking triangle edges, for better accuracy. + */ +#define TRIANGLE_WALK_DOUBLE 0 + +/** + * Bits per accumulation buffer color component: 8, 16 or 32 + */ +#define ACCUM_BITS 16 + +/** + * Bits per depth buffer value. + * + * Any reasonable value up to 31 will work. 32 doesn't work because of integer + * overflow problems in the rasterizer code. + */ +#ifndef DEFAULT_SOFTWARE_DEPTH_BITS +#define DEFAULT_SOFTWARE_DEPTH_BITS 16 +#endif +/** Depth buffer data type */ +#if DEFAULT_SOFTWARE_DEPTH_BITS <= 16 +#define DEFAULT_SOFTWARE_DEPTH_TYPE GLushort +#else +#define DEFAULT_SOFTWARE_DEPTH_TYPE GLuint +#endif + + +/** + * Bits per stencil value: 8 + */ +#define STENCIL_BITS 8 + + +/** + * Bits per color channel: 8, 16 or 32 + */ +#ifndef CHAN_BITS +#define CHAN_BITS 8 +#endif + + +/* + * Color channel component order + * + * \note Changes will almost certainly cause problems at this time. + */ +#define RCOMP 0 +#define GCOMP 1 +#define BCOMP 2 +#define ACOMP 3 + + +/* + * Enable/disable features (blocks of code) by setting FEATURE_xyz to 0 or 1. + */ +#ifndef _HAVE_FULL_GL +#define _HAVE_FULL_GL 1 +#endif + +#define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL +#define FEATURE_ARB_vertex_program _HAVE_FULL_GL +#define FEATURE_ARB_fragment_program _HAVE_FULL_GL +#define FEATURE_ARB_occlusion_query _HAVE_FULL_GL +#define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL +#define FEATURE_MESA_program_debug _HAVE_FULL_GL +#define FEATURE_NV_fence _HAVE_FULL_GL +#define FEATURE_NV_fragment_program _HAVE_FULL_GL +#define FEATURE_NV_vertex_program _HAVE_FULL_GL +#define FEATURE_userclip _HAVE_FULL_GL +#define FEATURE_texgen _HAVE_FULL_GL +#define FEATURE_windowpos _HAVE_FULL_GL +#define FEATURE_ARB_vertex_shader _HAVE_FULL_GL +#define FEATURE_ARB_fragment_shader _HAVE_FULL_GL +#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader) +#define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects +#define FEATURE_ATI_fragment_shader _HAVE_FULL_GL +#define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL +/*@}*/ + + +/** + * Maximum number of temporary vertices required for clipping. + * + * Used in array_cache and tnl modules. + */ +#define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1) + + +/* XXX everything marked with OLD_RENDERBUFFER will be going away... */ +#define OLD_RENDERBUFFER 1 + + +#endif /* CONFIG_H */ diff --git a/reactos/dll/mesa32/src/main/context.c b/reactos/dll/mesa32/src/main/context.c new file mode 100644 index 00000000000..25a3f6a37d4 --- /dev/null +++ b/reactos/dll/mesa32/src/main/context.c @@ -0,0 +1,1750 @@ +/** + * \file context.c + * Mesa context/visual/framebuffer management functions. + * \author Brian Paul + */ + +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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. + */ + + +/** + * \mainpage Mesa Main Module + * + * \section MainIntroduction Introduction + * + * The Mesa Main module consists of all the files in the main/ directory. + * Among the features of this module are: + *
    + *
  • Structures to represent most GL state
  • + *
  • State set/get functions
  • + *
  • Display lists
  • + *
  • Texture unit, object and image handling
  • + *
  • Matrix and attribute stacks
  • + *
+ * + * Other modules are responsible for API dispatch, vertex transformation, + * point/line/triangle setup, rasterization, vertex array caching, + * vertex/fragment programs/shaders, etc. + * + * + * \section AboutDoxygen About Doxygen + * + * If you're viewing this information as Doxygen-generated HTML you'll + * see the documentation index at the top of this page. + * + * The first line lists the Mesa source code modules. + * The second line lists the indexes available for viewing the documentation + * for each module. + * + * Selecting the Main page link will display a summary of the module + * (this page). + * + * Selecting Data Structures will list all C structures. + * + * Selecting the File List link will list all the source files in + * the module. + * Selecting a filename will show a list of all functions defined in that file. + * + * Selecting the Data Fields link will display a list of all + * documented structure members. + * + * Selecting the Globals link will display a list + * of all functions, structures, global variables and macros in the module. + * + */ + + +#include "glheader.h" +#include "imports.h" +#include "accum.h" +#include "attrib.h" +#include "blend.h" +#include "buffers.h" +#include "bufferobj.h" +#include "colortab.h" +#include "context.h" +#include "debug.h" +#include "depth.h" +#include "dlist.h" +#include "eval.h" +#include "enums.h" +#include "extensions.h" +#include "fbobject.h" +#include "feedback.h" +#include "fog.h" +#include "get.h" +#include "glthread.h" +#include "glapioffsets.h" +#include "histogram.h" +#include "hint.h" +#include "hash.h" +#include "light.h" +#include "lines.h" +#include "macros.h" +#include "matrix.h" +#include "occlude.h" +#include "pixel.h" +#include "points.h" +#include "polygon.h" +#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program +#include "program.h" +#endif +#include "rastpos.h" +#include "simple_list.h" +#include "state.h" +#include "stencil.h" +#include "texcompress.h" +#include "teximage.h" +#include "texobj.h" +#include "texstate.h" +#include "mtypes.h" +#include "varray.h" +#include "version.h" +#include "vtxfmt.h" +#if _HAVE_FULL_GL +#include "math/m_translate.h" +#include "math/m_matrix.h" +#include "math/m_xform.h" +#include "math/mathmod.h" +#endif +#include "shaderobjects.h" + +#ifdef USE_SPARC_ASM +#include "sparc/sparc.h" +#endif + +#ifndef MESA_VERBOSE +int MESA_VERBOSE = 0; +#endif + +#ifndef MESA_DEBUG_FLAGS +int MESA_DEBUG_FLAGS = 0; +#endif + + +/* ubyte -> float conversion */ +GLfloat _mesa_ubyte_to_float_color_tab[256]; + +static void +free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ); + + +/**********************************************************************/ +/** \name OpenGL SI-style interface (new in Mesa 3.5) + * + * \if subset + * \note Most of these functions are never called in the Mesa subset. + * \endif + */ +/*@{*/ + +/** + * Destroy context callback. + * + * \param gc context. + * \return GL_TRUE on success, or GL_FALSE on failure. + * + * \ifnot subset + * Called by window system/device driver (via __GLexports::destroyCurrent) when + * the rendering context is to be destroyed. + * \endif + * + * Frees the context data and the context structure. + */ +GLboolean +_mesa_destroyContext(__GLcontext *gc) +{ + if (gc) { + _mesa_free_context_data(gc); + _mesa_free(gc); + } + return GL_TRUE; +} + +/** + * Unbind context callback. + * + * \param gc context. + * \return GL_TRUE on success, or GL_FALSE on failure. + * + * \ifnot subset + * Called by window system/device driver (via __GLexports::loseCurrent) + * when the rendering context is made non-current. + * \endif + * + * No-op + */ +GLboolean +_mesa_loseCurrent(__GLcontext *gc) +{ + /* XXX unbind context from thread */ + (void) gc; + return GL_TRUE; +} + +/** + * Bind context callback. + * + * \param gc context. + * \return GL_TRUE on success, or GL_FALSE on failure. + * + * \ifnot subset + * Called by window system/device driver (via __GLexports::makeCurrent) + * when the rendering context is made current. + * \endif + * + * No-op + */ +GLboolean +_mesa_makeCurrent(__GLcontext *gc) +{ + /* XXX bind context to thread */ + (void) gc; + return GL_TRUE; +} + +/** + * Share context callback. + * + * \param gc context. + * \param gcShare shared context. + * \return GL_TRUE on success, or GL_FALSE on failure. + * + * \ifnot subset + * Called by window system/device driver (via __GLexports::shareContext) + * \endif + * + * Update the shared context reference count, gl_shared_state::RefCount. + */ +GLboolean +_mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare) +{ + if (gc && gcShare && gc->Shared && gcShare->Shared) { + gc->Shared->RefCount--; + if (gc->Shared->RefCount == 0) { + free_shared_state(gc, gc->Shared); + } + gc->Shared = gcShare->Shared; + gc->Shared->RefCount++; + return GL_TRUE; + } + else { + return GL_FALSE; + } +} + + +#if _HAVE_FULL_GL +/** + * Copy context callback. + */ +GLboolean +_mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask) +{ + if (dst && src) { + _mesa_copy_context( src, dst, mask ); + return GL_TRUE; + } + else { + return GL_FALSE; + } +} +#endif + +/** No-op */ +GLboolean +_mesa_forceCurrent(__GLcontext *gc) +{ + (void) gc; + return GL_TRUE; +} + +/** + * Windows/buffer resizing notification callback. + * + * \param gc GL context. + * \return GL_TRUE on success, or GL_FALSE on failure. + */ +GLboolean +_mesa_notifyResize(__GLcontext *gc) +{ + GLint x, y; + GLuint width, height; + __GLdrawablePrivate *d = gc->imports.getDrawablePrivate(gc); + if (!d || !d->getDrawableSize) + return GL_FALSE; + d->getDrawableSize( d, &x, &y, &width, &height ); + /* update viewport, resize software buffers, etc. */ + return GL_TRUE; +} + +/** + * Window/buffer destruction notification callback. + * + * \param gc GL context. + * + * Called when the context's window/buffer is going to be destroyed. + * + * No-op + */ +void +_mesa_notifyDestroy(__GLcontext *gc) +{ + /* Unbind from it. */ + (void) gc; +} + +/** + * Swap buffers notification callback. + * + * \param gc GL context. + * + * Called by window system just before swapping buffers. + * We have to finish any pending rendering. + */ +void +_mesa_notifySwapBuffers(__GLcontext *gc) +{ + FLUSH_VERTICES( gc, 0 ); +} + +/** No-op */ +struct __GLdispatchStateRec * +_mesa_dispatchExec(__GLcontext *gc) +{ + (void) gc; + return NULL; +} + +/** No-op */ +void +_mesa_beginDispatchOverride(__GLcontext *gc) +{ + (void) gc; +} + +/** No-op */ +void +_mesa_endDispatchOverride(__GLcontext *gc) +{ + (void) gc; +} + +/** + * \ifnot subset + * Setup the exports. + * + * The window system will call these functions when it needs Mesa to do + * something. + * + * \note Device drivers should override these functions! For example, + * the Xlib driver should plug in the XMesa*-style functions into this + * structure. The XMesa-style functions should then call the _mesa_* + * version of these functions. This is an approximation to OO design + * (inheritance and virtual functions). + * \endif + * + * \if subset + * No-op. + * + * \endif + */ +static void +_mesa_init_default_exports(__GLexports *exports) +{ +#if _HAVE_FULL_GL + exports->destroyContext = _mesa_destroyContext; + exports->loseCurrent = _mesa_loseCurrent; + exports->makeCurrent = _mesa_makeCurrent; + exports->shareContext = _mesa_shareContext; + exports->copyContext = _mesa_copyContext; + exports->forceCurrent = _mesa_forceCurrent; + exports->notifyResize = _mesa_notifyResize; + exports->notifyDestroy = _mesa_notifyDestroy; + exports->notifySwapBuffers = _mesa_notifySwapBuffers; + exports->dispatchExec = _mesa_dispatchExec; + exports->beginDispatchOverride = _mesa_beginDispatchOverride; + exports->endDispatchOverride = _mesa_endDispatchOverride; +#else + (void) exports; +#endif +} + +/** + * Exported OpenGL SI interface. + */ +__GLcontext * +__glCoreCreateContext(__GLimports *imports, __GLcontextModes *modes) +{ + GLcontext *ctx; + + ctx = (GLcontext *) (*imports->calloc)(NULL, 1, sizeof(GLcontext)); + if (ctx == NULL) { + return NULL; + } + + /* XXX doesn't work at this time */ + _mesa_initialize_context(ctx, modes, NULL, NULL, NULL); + ctx->imports = *imports; + + return ctx; +} + +/** + * Exported OpenGL SI interface. + */ +void +__glCoreNopDispatch(void) +{ +#if 0 + /* SI */ + __gl_dispatch = __glNopDispatchState; +#else + /* Mesa */ + _glapi_set_dispatch(NULL); +#endif +} + +/*@}*/ + + +/**********************************************************************/ +/** \name GL Visual allocation/destruction */ +/**********************************************************************/ +/*@{*/ + +/** + * Allocates a GLvisual structure and initializes it via + * _mesa_initialize_visual(). + * + * \param rgbFlag GL_TRUE for RGB(A) mode, GL_FALSE for Color Index mode. + * \param dbFlag double buffering + * \param stereoFlag stereo buffer + * \param depthBits requested bits per depth buffer value. Any value in [0, 32] + * is acceptable but the actual depth type will be GLushort or GLuint as + * needed. + * \param stencilBits requested minimum bits per stencil buffer value + * \param accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits number of bits per color component in accum buffer. + * \param indexBits number of bits per pixel if \p rgbFlag is GL_FALSE + * \param redBits number of bits per color component in frame buffer for RGB(A) + * mode. We always use 8 in core Mesa though. + * \param greenBits same as above. + * \param blueBits same as above. + * \param alphaBits same as above. + * \param numSamples not really used. + * + * \return pointer to new GLvisual or NULL if requested parameters can't be + * met. + * + * \note Need to add params for level and numAuxBuffers (at least) + */ +GLvisual * +_mesa_create_visual( GLboolean rgbFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits, + GLint indexBits, + GLint depthBits, + GLint stencilBits, + GLint accumRedBits, + GLint accumGreenBits, + GLint accumBlueBits, + GLint accumAlphaBits, + GLint numSamples ) +{ + GLvisual *vis = (GLvisual *) CALLOC( sizeof(GLvisual) ); + if (vis) { + if (!_mesa_initialize_visual(vis, rgbFlag, dbFlag, stereoFlag, + redBits, greenBits, blueBits, alphaBits, + indexBits, depthBits, stencilBits, + accumRedBits, accumGreenBits, + accumBlueBits, accumAlphaBits, + numSamples)) { + FREE(vis); + return NULL; + } + } + return vis; +} + +/** + * Makes some sanity checks and fills in the fields of the + * GLvisual object with the given parameters. If the caller needs + * to set additional fields, he should just probably init the whole GLvisual + * object himself. + * \return GL_TRUE on success, or GL_FALSE on failure. + * + * \sa _mesa_create_visual() above for the parameter description. + */ +GLboolean +_mesa_initialize_visual( GLvisual *vis, + GLboolean rgbFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits, + GLint indexBits, + GLint depthBits, + GLint stencilBits, + GLint accumRedBits, + GLint accumGreenBits, + GLint accumBlueBits, + GLint accumAlphaBits, + GLint numSamples ) +{ + assert(vis); + + if (depthBits < 0 || depthBits > 32) { + return GL_FALSE; + } + if (stencilBits < 0 || stencilBits > STENCIL_BITS) { + return GL_FALSE; + } + if (accumRedBits < 0 || accumRedBits > ACCUM_BITS) { + return GL_FALSE; + } + if (accumGreenBits < 0 || accumGreenBits > ACCUM_BITS) { + return GL_FALSE; + } + if (accumBlueBits < 0 || accumBlueBits > ACCUM_BITS) { + return GL_FALSE; + } + if (accumAlphaBits < 0 || accumAlphaBits > ACCUM_BITS) { + return GL_FALSE; + } + + vis->rgbMode = rgbFlag; + vis->doubleBufferMode = dbFlag; + vis->stereoMode = stereoFlag; + + vis->redBits = redBits; + vis->greenBits = greenBits; + vis->blueBits = blueBits; + vis->alphaBits = alphaBits; + vis->rgbBits = redBits + greenBits + blueBits; + + vis->indexBits = indexBits; + vis->depthBits = depthBits; + vis->stencilBits = stencilBits; + + vis->accumRedBits = accumRedBits; + vis->accumGreenBits = accumGreenBits; + vis->accumBlueBits = accumBlueBits; + vis->accumAlphaBits = accumAlphaBits; + + vis->haveAccumBuffer = accumRedBits > 0; + vis->haveDepthBuffer = depthBits > 0; + vis->haveStencilBuffer = stencilBits > 0; + + vis->numAuxBuffers = 0; + vis->level = 0; + vis->pixmapMode = 0; + vis->sampleBuffers = numSamples > 0 ? 1 : 0; + vis->samples = numSamples; + + return GL_TRUE; +} + + +/** + * Destroy a visual and free its memory. + * + * \param vis visual. + * + * Frees the visual structure. + */ +void +_mesa_destroy_visual( GLvisual *vis ) +{ + FREE(vis); +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Context allocation, initialization, destroying + * + * The purpose of the most initialization functions here is to provide the + * default state values according to the OpenGL specification. + */ +/**********************************************************************/ +/*@{*/ + +/** + * One-time initialization mutex lock. + * + * \sa Used by one_time_init(). + */ +_glthread_DECLARE_STATIC_MUTEX(OneTimeLock); + +/** + * Calls all the various one-time-init functions in Mesa. + * + * While holding a global mutex lock, calls several initialization functions, + * and sets the glapi callbacks if the \c MESA_DEBUG environment variable is + * defined. + * + * \sa _mesa_init_lists(), _math_init(). + */ +static void +one_time_init( GLcontext *ctx ) +{ + static GLboolean alreadyCalled = GL_FALSE; + (void) ctx; + _glthread_LOCK_MUTEX(OneTimeLock); + if (!alreadyCalled) { + GLuint i; + + /* do some implementation tests */ + assert( sizeof(GLbyte) == 1 ); + assert( sizeof(GLubyte) == 1 ); + assert( sizeof(GLshort) == 2 ); + assert( sizeof(GLushort) == 2 ); + assert( sizeof(GLint) == 4 ); + assert( sizeof(GLuint) == 4 ); + + _mesa_init_lists(); + +#if _HAVE_FULL_GL + _math_init(); + + for (i = 0; i < 256; i++) { + _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F; + } +#endif + +#ifdef USE_SPARC_ASM + _mesa_init_sparc_glapi_relocs(); +#endif + if (_mesa_getenv("MESA_DEBUG")) { + _glapi_noop_enable_warnings(GL_TRUE); + _glapi_set_warning_func( (_glapi_warning_func) _mesa_warning ); + } + else { + _glapi_noop_enable_warnings(GL_FALSE); + } + +#if defined(DEBUG) && defined(__DATE__) && defined(__TIME__) + _mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n", + MESA_VERSION_STRING, __DATE__, __TIME__); +#endif + + alreadyCalled = GL_TRUE; + } + _glthread_UNLOCK_MUTEX(OneTimeLock); +} + + +/** + * 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. + */ +static GLboolean +alloc_shared_state( GLcontext *ctx ) +{ + struct gl_shared_state *ss = CALLOC_STRUCT(gl_shared_state); + if (!ss) + return GL_FALSE; + + ctx->Shared = ss; + + _glthread_INIT_MUTEX(ss->Mutex); + + ss->DisplayList = _mesa_NewHashTable(); + ss->TexObjects = _mesa_NewHashTable(); +#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program + ss->Programs = _mesa_NewHashTable(); +#endif + +#if FEATURE_ARB_vertex_program + ss->DefaultVertexProgram = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); + if (!ss->DefaultVertexProgram) + goto cleanup; +#endif +#if FEATURE_ARB_fragment_program + ss->DefaultFragmentProgram = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); + if (!ss->DefaultFragmentProgram) + goto cleanup; +#endif +#if FEATURE_ATI_fragment_shader + ss->DefaultFragmentShader = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_SHADER_ATI, 0); + if (!ss->DefaultFragmentShader) + goto cleanup; +#endif + + ss->BufferObjects = _mesa_NewHashTable(); + + ss->GL2Objects = _mesa_NewHashTable (); + + ss->Default1D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D); + if (!ss->Default1D) + goto cleanup; + + ss->Default2D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_2D); + if (!ss->Default2D) + goto cleanup; + + ss->Default3D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_3D); + if (!ss->Default3D) + goto cleanup; + + ss->DefaultCubeMap = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_CUBE_MAP_ARB); + if (!ss->DefaultCubeMap) + goto cleanup; + + ss->DefaultRect = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_RECTANGLE_NV); + if (!ss->DefaultRect) + goto cleanup; + + /* Effectively bind the default textures to all texture units */ + ss->Default1D->RefCount += MAX_TEXTURE_IMAGE_UNITS; + ss->Default2D->RefCount += MAX_TEXTURE_IMAGE_UNITS; + ss->Default3D->RefCount += MAX_TEXTURE_IMAGE_UNITS; + ss->DefaultCubeMap->RefCount += MAX_TEXTURE_IMAGE_UNITS; + ss->DefaultRect->RefCount += MAX_TEXTURE_IMAGE_UNITS; + +#if FEATURE_EXT_framebuffer_object + ss->FrameBuffers = _mesa_NewHashTable(); + if (!ss->FrameBuffers) + goto cleanup; + ss->RenderBuffers = _mesa_NewHashTable(); + if (!ss->RenderBuffers) + goto cleanup; +#endif + + + return GL_TRUE; + + cleanup: + /* Ran out of memory at some point. Free everything and return NULL */ + if (ss->DisplayList) + _mesa_DeleteHashTable(ss->DisplayList); + if (ss->TexObjects) + _mesa_DeleteHashTable(ss->TexObjects); +#if FEATURE_NV_vertex_program + if (ss->Programs) + _mesa_DeleteHashTable(ss->Programs); +#endif +#if FEATURE_ARB_vertex_program + if (ss->DefaultVertexProgram) + ctx->Driver.DeleteProgram(ctx, ss->DefaultVertexProgram); +#endif +#if FEATURE_ARB_fragment_program + if (ss->DefaultFragmentProgram) + ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentProgram); +#endif +#if FEATURE_ATI_fragment_shader + if (ss->DefaultFragmentShader) + ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentShader); +#endif +#if FEATURE_ARB_vertex_buffer_object + if (ss->BufferObjects) + _mesa_DeleteHashTable(ss->BufferObjects); +#endif + + if (ss->GL2Objects) + _mesa_DeleteHashTable (ss->GL2Objects); + +#if FEATURE_EXT_framebuffer_object + if (ss->FrameBuffers) + _mesa_DeleteHashTable(ss->FrameBuffers); + if (ss->RenderBuffers) + _mesa_DeleteHashTable(ss->RenderBuffers); +#endif + + if (ss->Default1D) + (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D); + if (ss->Default2D) + (*ctx->Driver.DeleteTexture)(ctx, ss->Default2D); + if (ss->Default3D) + (*ctx->Driver.DeleteTexture)(ctx, ss->Default3D); + if (ss->DefaultCubeMap) + (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap); + if (ss->DefaultRect) + (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect); + if (ss) + _mesa_free(ss); + return GL_FALSE; +} + +/** + * Deallocate a shared state context and all children structures. + * + * \param ctx GL context. + * \param ss 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( GLcontext *ctx, struct gl_shared_state *ss ) +{ + /* Free display lists */ + while (1) { + GLuint list = _mesa_HashFirstEntry(ss->DisplayList); + if (list) { + _mesa_destroy_list(ctx, list); + } + else { + break; + } + } + _mesa_DeleteHashTable(ss->DisplayList); + + /* Free texture objects */ + ASSERT(ctx->Driver.DeleteTexture); + /* the default textures */ + (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D); + (*ctx->Driver.DeleteTexture)(ctx, ss->Default2D); + (*ctx->Driver.DeleteTexture)(ctx, ss->Default3D); + (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap); + (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect); + /* all other textures */ + while (1) { + GLuint texName = _mesa_HashFirstEntry(ss->TexObjects); + if (texName) { + struct gl_texture_object *texObj = (struct gl_texture_object *) + _mesa_HashLookup(ss->TexObjects, texName); + ASSERT(texObj); + (*ctx->Driver.DeleteTexture)(ctx, texObj); + _mesa_HashRemove(ss->TexObjects, texName); + } + else { + break; + } + } + _mesa_DeleteHashTable(ss->TexObjects); + +#if FEATURE_NV_vertex_program + /* Free vertex programs */ + while (1) { + GLuint prog = _mesa_HashFirstEntry(ss->Programs); + if (prog) { + struct program *p = (struct program *) _mesa_HashLookup(ss->Programs, + prog); + ASSERT(p); + ctx->Driver.DeleteProgram(ctx, p); + _mesa_HashRemove(ss->Programs, prog); + } + else { + break; + } + } + _mesa_DeleteHashTable(ss->Programs); +#endif +#if FEATURE_ARB_vertex_program + _mesa_delete_program(ctx, ss->DefaultVertexProgram); +#endif +#if FEATURE_ARB_fragment_program + _mesa_delete_program(ctx, ss->DefaultFragmentProgram); +#endif +#if FEATURE_ATI_fragment_shader + _mesa_delete_program(ctx, ss->DefaultFragmentShader); +#endif + +#if FEATURE_ARB_vertex_buffer_object + _mesa_DeleteHashTable(ss->BufferObjects); +#endif + + _mesa_DeleteHashTable (ss->GL2Objects); + +#if FEATURE_EXT_framebuffer_object + _mesa_DeleteHashTable(ss->FrameBuffers); + _mesa_DeleteHashTable(ss->RenderBuffers); +#endif + + _glthread_DESTROY_MUTEX(ss->Mutex); + + FREE(ss); +} + + +/** + * Initialize fields of gl_current_attrib (aka ctx->Current.*) + */ +static void +_mesa_init_current( GLcontext *ctx ) +{ + GLuint i; + + /* Current group */ + for (i = 0; i < VERT_ATTRIB_MAX; i++) { + ASSIGN_4V( ctx->Current.Attrib[i], 0.0, 0.0, 0.0, 1.0 ); + } + /* special cases: */ + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 1.0, 0.0, 0.0, 1.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 1.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 1.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_FOG], 0.0, 0.0, 0.0, 0.0 ); + + ctx->Current.Index = 1; + ctx->Current.EdgeFlag = GL_TRUE; +} + + +/** + * Initialize fields of gl_constants (aka ctx->Const.*). + * Use defaults from config.h. The device drivers will often override + * some of these values (such as number of texture units). + */ +static void +_mesa_init_constants( GLcontext *ctx ) +{ + assert(ctx); + + assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS); + assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS); + + /* Constants, may be overriden (usually only reduced) by device drivers */ + ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS; + ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS; + ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS; + ctx->Const.MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE; + ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS; + ctx->Const.MaxTextureCoordUnits = MAX_TEXTURE_COORD_UNITS; + ctx->Const.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS; + ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY; + ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS; + ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE; + ctx->Const.SubPixelBits = SUB_PIXEL_BITS; + ctx->Const.MinPointSize = MIN_POINT_SIZE; + ctx->Const.MaxPointSize = MAX_POINT_SIZE; + ctx->Const.MinPointSizeAA = MIN_POINT_SIZE; + ctx->Const.MaxPointSizeAA = MAX_POINT_SIZE; + ctx->Const.PointSizeGranularity = (GLfloat) POINT_SIZE_GRANULARITY; + ctx->Const.MinLineWidth = MIN_LINE_WIDTH; + ctx->Const.MaxLineWidth = MAX_LINE_WIDTH; + ctx->Const.MinLineWidthAA = MIN_LINE_WIDTH; + ctx->Const.MaxLineWidthAA = MAX_LINE_WIDTH; + ctx->Const.LineWidthGranularity = (GLfloat) LINE_WIDTH_GRANULARITY; + ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE; + ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH; + ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT; + ctx->Const.MaxClipPlanes = MAX_CLIP_PLANES; + ctx->Const.MaxLights = MAX_LIGHTS; + ctx->Const.MaxShininess = 128.0; + ctx->Const.MaxSpotExponent = 128.0; + ctx->Const.MaxViewportWidth = MAX_WIDTH; + ctx->Const.MaxViewportHeight = MAX_HEIGHT; +#if FEATURE_ARB_vertex_program + ctx->Const.MaxVertexProgramInstructions = MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS; + ctx->Const.MaxVertexProgramAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS; + ctx->Const.MaxVertexProgramTemps = MAX_NV_VERTEX_PROGRAM_TEMPS; + ctx->Const.MaxVertexProgramLocalParams = MAX_NV_VERTEX_PROGRAM_PARAMS; + ctx->Const.MaxVertexProgramEnvParams = MAX_NV_VERTEX_PROGRAM_PARAMS;/*XXX*/ + ctx->Const.MaxVertexProgramAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS; +#endif +#if FEATURE_ARB_fragment_program + ctx->Const.MaxFragmentProgramInstructions = MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS; + ctx->Const.MaxFragmentProgramAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS; + ctx->Const.MaxFragmentProgramTemps = MAX_NV_FRAGMENT_PROGRAM_TEMPS; + ctx->Const.MaxFragmentProgramLocalParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS; + ctx->Const.MaxFragmentProgramEnvParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS;/*XXX*/ + ctx->Const.MaxFragmentProgramAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS; + ctx->Const.MaxFragmentProgramAluInstructions = MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS; + ctx->Const.MaxFragmentProgramTexInstructions = MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS; + ctx->Const.MaxFragmentProgramTexIndirections = MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS; +#endif + + ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES; + ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH; + + /* If we're running in the X server, do bounds checking to prevent + * segfaults and server crashes! + */ +#if defined(XFree86LOADER) && defined(IN_MODULE) + ctx->Const.CheckArrayBounds = GL_TRUE; +#else + ctx->Const.CheckArrayBounds = GL_FALSE; +#endif + + ctx->Const.MaxDrawBuffers = MAX_DRAW_BUFFERS; + + /* GL_OES_read_format */ + ctx->Const.ColorReadFormat = GL_RGBA; + ctx->Const.ColorReadType = GL_UNSIGNED_BYTE; + +#if FEATURE_EXT_framebuffer_object + ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS; + ctx->Const.MaxRenderbufferSize = MAX_WIDTH; +#endif + + /* sanity checks */ + ASSERT(ctx->Const.MaxTextureUnits == MAX2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits)); +} + + +/** + * Initialize the attribute groups in a GL context. + * + * \param ctx GL context. + * + * Initializes all the attributes, calling the respective init* + * functions for the more complex data structures. + */ +static GLboolean +init_attrib_groups( GLcontext *ctx ) +{ + assert(ctx); + + /* Constants */ + _mesa_init_constants( ctx ); + + /* Extensions */ + _mesa_init_extensions( ctx ); + + /* Attribute Groups */ + _mesa_init_accum( ctx ); + _mesa_init_attrib( ctx ); + _mesa_init_buffer_objects( ctx ); + _mesa_init_color( ctx ); + _mesa_init_colortables( ctx ); + _mesa_init_current( ctx ); + _mesa_init_depth( ctx ); + _mesa_init_debug( ctx ); + _mesa_init_display_list( ctx ); + _mesa_init_eval( ctx ); + _mesa_init_feedback( ctx ); + _mesa_init_fog( ctx ); + _mesa_init_histogram( ctx ); + _mesa_init_hint( ctx ); + _mesa_init_line( ctx ); + _mesa_init_lighting( ctx ); + _mesa_init_matrix( ctx ); + _mesa_init_multisample( ctx ); + _mesa_init_occlude( ctx ); + _mesa_init_pixel( ctx ); + _mesa_init_point( ctx ); + _mesa_init_polygon( ctx ); + _mesa_init_program( ctx ); + _mesa_init_rastpos( ctx ); + _mesa_init_scissor( ctx ); + _mesa_init_shaderobjects (ctx); + _mesa_init_stencil( ctx ); + _mesa_init_transform( ctx ); + _mesa_init_varray( ctx ); + _mesa_init_viewport( ctx ); + + if (!_mesa_init_texture( ctx )) + return GL_FALSE; + + _mesa_init_texture_s3tc( ctx ); + _mesa_init_texture_fxt1( ctx ); + + /* Miscellaneous */ + ctx->NewState = _NEW_ALL; + ctx->ErrorValue = (GLenum) GL_NO_ERROR; + ctx->_Facing = 0; +#if CHAN_TYPE == GL_FLOAT + ctx->ClampFragmentColors = GL_FALSE; /* XXX temporary */ +#else + ctx->ClampFragmentColors = GL_TRUE; +#endif + ctx->ClampVertexColors = GL_TRUE; + + return GL_TRUE; +} + + +/** + * This is the default function we plug into all dispatch table slots + * This helps prevents a segfault when someone calls a GL function without + * first checking if the extension's supported. + */ +static int +generic_nop(void) +{ + _mesa_problem(NULL, "User called no-op dispatch function (an unsupported extension function?)"); + return 0; +} + + +/** + * Allocate and initialize a new dispatch table. + */ +static struct _glapi_table * +alloc_dispatch_table(void) +{ + /* Find the larger of Mesa's dispatch table and libGL's dispatch table. + * In practice, this'll be the same for stand-alone Mesa. But for DRI + * Mesa we do this to accomodate different versions of libGL and various + * DRI drivers. + */ + GLint numEntries = MAX2(_glapi_get_dispatch_table_size(), + sizeof(struct _glapi_table) / sizeof(_glapi_proc)); + struct _glapi_table *table = + (struct _glapi_table *) _mesa_malloc(numEntries * sizeof(_glapi_proc)); + if (table) { + _glapi_proc *entry = (_glapi_proc *) table; + GLint i; + for (i = 0; i < numEntries; i++) { + entry[i] = (_glapi_proc) generic_nop; + } + } + return table; +} + + +/** + * Initialize a GLcontext struct (rendering context). + * + * This includes allocating all the other structs and arrays which hang off of + * the context by pointers. + * Note that the driver needs to pass in its dd_function_table here since + * we need to at least call driverFunctions->NewTextureObject to create the + * default texture objects. + * + * Called by _mesa_create_context(). + * + * Performs the imports and exports callback tables initialization, and + * miscellaneous one-time initializations. If no shared context is supplied one + * is allocated, and increase its reference count. Setups the GL API dispatch + * tables. Initialize the TNL module. Sets the maximum Z buffer depth. + * Finally queries the \c MESA_DEBUG and \c MESA_VERBOSE environment variables + * for debug flags. + * + * \param ctx the context to initialize + * \param visual describes the visual attributes for this context + * \param share_list points to context to share textures, display lists, + * etc with, or NULL + * \param driverFunctions table of device driver functions for this context + * to use + * \param driverContext pointer to driver-specific context data + */ +GLboolean +_mesa_initialize_context( GLcontext *ctx, + const GLvisual *visual, + GLcontext *share_list, + const struct dd_function_table *driverFunctions, + void *driverContext ) +{ + ASSERT(driverContext); + assert(driverFunctions->NewTextureObject); + assert(driverFunctions->FreeTexImageData); + + /* If the driver wants core Mesa to use special imports, it'll have to + * override these defaults. + */ + _mesa_init_default_imports( &(ctx->imports), driverContext ); + + /* initialize the exports (Mesa functions called by the window system) */ + _mesa_init_default_exports( &(ctx->exports) ); + + /* misc one-time initializations */ + one_time_init(ctx); + + ctx->Visual = *visual; + ctx->DrawBuffer = NULL; + ctx->ReadBuffer = NULL; + ctx->WinSysDrawBuffer = NULL; + ctx->WinSysReadBuffer = NULL; + + /* Plug in driver functions and context pointer here. + * This is important because when we call alloc_shared_state() below + * we'll call ctx->Driver.NewTextureObject() to create the default + * textures. + */ + ctx->Driver = *driverFunctions; + ctx->DriverCtx = driverContext; + + if (share_list) { + /* share state with another context */ + ctx->Shared = share_list->Shared; + } + else { + /* allocate new, unshared state */ + if (!alloc_shared_state( ctx )) { + return GL_FALSE; + } + } + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + ctx->Shared->RefCount++; + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + + if (!init_attrib_groups( ctx )) { + free_shared_state(ctx, ctx->Shared); + return GL_FALSE; + } + + /* setup the API dispatch tables */ + ctx->Exec = alloc_dispatch_table(); + ctx->Save = alloc_dispatch_table(); + if (!ctx->Exec || !ctx->Save) { + free_shared_state(ctx, ctx->Shared); + if (ctx->Exec) + _mesa_free(ctx->Exec); + } + _mesa_init_exec_table(ctx->Exec); + ctx->CurrentDispatch = ctx->Exec; +#if _HAVE_FULL_GL + _mesa_init_dlist_table(ctx->Save); + _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); + /* Neutral tnl module stuff */ + _mesa_init_exec_vtxfmt( ctx ); + ctx->TnlModule.Current = NULL; + ctx->TnlModule.SwapCount = 0; +#endif + + ctx->_MaintainTexEnvProgram = (_mesa_getenv("MESA_TEX_PROG") != NULL); + ctx->_MaintainTnlProgram = (_mesa_getenv("MESA_TNL_PROG") != NULL); + + return GL_TRUE; +} + + +/** + * Allocate and initialize a GLcontext structure. + * Note that the driver needs to pass in its dd_function_table here since + * we need to at least call driverFunctions->NewTextureObject to initialize + * the rendering context. + * + * \param visual a GLvisual pointer (we copy the struct contents) + * \param share_list another context to share display lists with or NULL + * \param driverFunctions points to the dd_function_table into which the + * driver has plugged in all its special functions. + * \param driverCtx points to the device driver's private context state + * + * \return pointer to a new __GLcontextRec or NULL if error. + */ +GLcontext * +_mesa_create_context( const GLvisual *visual, + GLcontext *share_list, + const struct dd_function_table *driverFunctions, + void *driverContext ) + +{ + GLcontext *ctx; + + ASSERT(visual); + ASSERT(driverContext); + + ctx = (GLcontext *) _mesa_calloc(sizeof(GLcontext)); + if (!ctx) + return NULL; + + if (_mesa_initialize_context(ctx, visual, share_list, + driverFunctions, driverContext)) { + return ctx; + } + else { + _mesa_free(ctx); + return NULL; + } +} + + +/** + * Free the data associated with the given context. + * + * But doesn't free the GLcontext struct itself. + * + * \sa _mesa_initialize_context() and init_attrib_groups(). + */ +void +_mesa_free_context_data( GLcontext *ctx ) +{ + /* if we're destroying the current context, unbind it first */ + if (ctx == _mesa_get_current_context()) { + _mesa_make_current(NULL, NULL, NULL); + } + + _mesa_free_lighting_data( ctx ); + _mesa_free_eval_data( ctx ); + _mesa_free_texture_data( ctx ); + _mesa_free_matrix_data( ctx ); + _mesa_free_viewport_data( ctx ); + _mesa_free_colortables_data( ctx ); + _mesa_free_program_data(ctx); + _mesa_free_occlude_data(ctx); + +#if FEATURE_ARB_vertex_buffer_object + _mesa_delete_buffer_object(ctx, ctx->Array.NullBufferObj); +#endif + + /* free dispatch tables */ + _mesa_free(ctx->Exec); + _mesa_free(ctx->Save); + + /* Shared context state (display lists, textures, etc) */ + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + ctx->Shared->RefCount--; + assert(ctx->Shared->RefCount >= 0); + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + if (ctx->Shared->RefCount == 0) { + /* free shared state */ + free_shared_state( ctx, ctx->Shared ); + } + + if (ctx->Extensions.String) + FREE((void *) ctx->Extensions.String); +} + + +/** + * Destroy a GLcontext structure. + * + * \param ctx GL context. + * + * Calls _mesa_free_context_data() and frees the GLcontext structure itself. + */ +void +_mesa_destroy_context( GLcontext *ctx ) +{ + if (ctx) { + _mesa_free_context_data(ctx); + FREE( (void *) ctx ); + } +} + + +#if _HAVE_FULL_GL +/** + * Copy attribute groups from one context to another. + * + * \param src source context + * \param dst destination context + * \param mask bitwise OR of GL_*_BIT flags + * + * According to the bits specified in \p mask, copies the corresponding + * attributes from \p src into \p dst. For many of the attributes a simple \c + * memcpy is not enough due to the existence of internal pointers in their data + * structures. + */ +void +_mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) +{ + if (mask & GL_ACCUM_BUFFER_BIT) { + /* OK to memcpy */ + dst->Accum = src->Accum; + } + if (mask & GL_COLOR_BUFFER_BIT) { + /* OK to memcpy */ + dst->Color = src->Color; + } + if (mask & GL_CURRENT_BIT) { + /* OK to memcpy */ + dst->Current = src->Current; + } + if (mask & GL_DEPTH_BUFFER_BIT) { + /* OK to memcpy */ + dst->Depth = src->Depth; + } + if (mask & GL_ENABLE_BIT) { + /* no op */ + } + if (mask & GL_EVAL_BIT) { + /* OK to memcpy */ + dst->Eval = src->Eval; + } + if (mask & GL_FOG_BIT) { + /* OK to memcpy */ + dst->Fog = src->Fog; + } + if (mask & GL_HINT_BIT) { + /* OK to memcpy */ + dst->Hint = src->Hint; + } + if (mask & GL_LIGHTING_BIT) { + GLuint i; + /* begin with memcpy */ + MEMCPY( &dst->Light, &src->Light, sizeof(struct gl_light) ); + /* fixup linked lists to prevent pointer insanity */ + make_empty_list( &(dst->Light.EnabledList) ); + for (i = 0; i < MAX_LIGHTS; i++) { + if (dst->Light.Light[i].Enabled) { + insert_at_tail(&(dst->Light.EnabledList), &(dst->Light.Light[i])); + } + } + } + if (mask & GL_LINE_BIT) { + /* OK to memcpy */ + dst->Line = src->Line; + } + if (mask & GL_LIST_BIT) { + /* OK to memcpy */ + dst->List = src->List; + } + if (mask & GL_PIXEL_MODE_BIT) { + /* OK to memcpy */ + dst->Pixel = src->Pixel; + } + if (mask & GL_POINT_BIT) { + /* OK to memcpy */ + dst->Point = src->Point; + } + if (mask & GL_POLYGON_BIT) { + /* OK to memcpy */ + dst->Polygon = src->Polygon; + } + if (mask & GL_POLYGON_STIPPLE_BIT) { + /* Use loop instead of MEMCPY due to problem with Portland Group's + * C compiler. Reported by John Stone. + */ + GLuint i; + for (i = 0; i < 32; i++) { + dst->PolygonStipple[i] = src->PolygonStipple[i]; + } + } + if (mask & GL_SCISSOR_BIT) { + /* OK to memcpy */ + dst->Scissor = src->Scissor; + } + if (mask & GL_STENCIL_BUFFER_BIT) { + /* OK to memcpy */ + dst->Stencil = src->Stencil; + } + if (mask & GL_TEXTURE_BIT) { + /* Cannot memcpy because of pointers */ + _mesa_copy_texture_state(src, dst); + } + if (mask & GL_TRANSFORM_BIT) { + /* OK to memcpy */ + dst->Transform = src->Transform; + } + if (mask & GL_VIEWPORT_BIT) { + /* Cannot use memcpy, because of pointers in GLmatrix _WindowMap */ + dst->Viewport.X = src->Viewport.X; + dst->Viewport.Y = src->Viewport.Y; + dst->Viewport.Width = src->Viewport.Width; + dst->Viewport.Height = src->Viewport.Height; + dst->Viewport.Near = src->Viewport.Near; + dst->Viewport.Far = src->Viewport.Far; + _math_matrix_copy(&dst->Viewport._WindowMap, &src->Viewport._WindowMap); + } + + /* XXX FIXME: Call callbacks? + */ + dst->NewState = _NEW_ALL; +} +#endif + + +/** + * Check if the given context can render into the given framebuffer + * by checking visual attributes. + * \return GL_TRUE if compatible, GL_FALSE otherwise. + */ +static GLboolean +check_compatible(const GLcontext *ctx, const GLframebuffer *buffer) +{ + const GLvisual *ctxvis = &ctx->Visual; + const GLvisual *bufvis = &buffer->Visual; + + if (ctxvis == bufvis) + return GL_TRUE; + + if (ctxvis->rgbMode != bufvis->rgbMode) + return GL_FALSE; + if (ctxvis->doubleBufferMode && !bufvis->doubleBufferMode) + return GL_FALSE; + if (ctxvis->stereoMode && !bufvis->stereoMode) + return GL_FALSE; + if (ctxvis->haveAccumBuffer && !bufvis->haveAccumBuffer) + return GL_FALSE; + if (ctxvis->haveDepthBuffer && !bufvis->haveDepthBuffer) + return GL_FALSE; + if (ctxvis->haveStencilBuffer && !bufvis->haveStencilBuffer) + return GL_FALSE; + if (ctxvis->redMask && ctxvis->redMask != bufvis->redMask) + return GL_FALSE; + if (ctxvis->greenMask && ctxvis->greenMask != bufvis->greenMask) + return GL_FALSE; + if (ctxvis->blueMask && ctxvis->blueMask != bufvis->blueMask) + return GL_FALSE; + if (ctxvis->depthBits && ctxvis->depthBits != bufvis->depthBits) + return GL_FALSE; + if (ctxvis->stencilBits && ctxvis->stencilBits != bufvis->stencilBits) + return GL_FALSE; + + return GL_TRUE; +} + + +/** + * Bind the given context to the given draw-buffer and read-buffer and + * make it the current context for this thread. + * + * \param newCtx new GL context. If NULL then there will be no current GL + * context. + * \param drawBuffer draw framebuffer. + * \param readBuffer read framebuffer. + * + * Check that the context's and framebuffer's visuals are compatible, returning + * immediately otherwise. Sets the glapi current context via + * _glapi_set_context(). If \p newCtx is not NULL, associates \p drawBuffer and + * \p readBuffer with it and calls dd_function_table::ResizeBuffers if the buffers size has changed. + * Calls dd_function_table::MakeCurrent callback if defined. + * + * When a context is bound by the first time and the \c MESA_INFO environment + * variable is set it calls print_info() as an aid for remote user + * troubleshooting. + */ +void +_mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, + GLframebuffer *readBuffer ) +{ + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(newCtx, "_mesa_make_current()\n"); + + /* Check that the context's and framebuffer's visuals are compatible. + */ + if (newCtx && drawBuffer && newCtx->DrawBuffer != drawBuffer) { + if (!check_compatible(newCtx, drawBuffer)) + return; + } + if (newCtx && readBuffer && newCtx->ReadBuffer != readBuffer) { + if (!check_compatible(newCtx, readBuffer)) + return; + } + +#if !defined(IN_DRI_DRIVER) + /* We call this function periodically (just here for now) in + * order to detect when multithreading has begun. In a DRI driver, this + * step is done by the driver loader (e.g., libGL). + */ + _glapi_check_multithread(); +#endif /* !defined(IN_DRI_DRIVER) */ + + _glapi_set_context((void *) newCtx); + ASSERT(_mesa_get_current_context() == newCtx); + + if (!newCtx) { + _glapi_set_dispatch(NULL); /* none current */ + } + else { + _glapi_set_dispatch(newCtx->CurrentDispatch); + + if (drawBuffer && readBuffer) { + /* TODO: check if newCtx and buffer's visual match??? */ + + ASSERT(drawBuffer->Name == 0); + ASSERT(readBuffer->Name == 0); + newCtx->WinSysDrawBuffer = drawBuffer; + newCtx->WinSysReadBuffer = readBuffer; + /* don't replace user-buffer bindings with window system buffer */ + if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) { + newCtx->DrawBuffer = drawBuffer; + newCtx->ReadBuffer = readBuffer; + } + + newCtx->NewState |= _NEW_BUFFERS; + +#if _HAVE_FULL_GL + if (!drawBuffer->Initialized) { + /* get initial window size */ + GLuint bufWidth, bufHeight; + /* ask device driver for size of the buffer */ + (*newCtx->Driver.GetBufferSize)(drawBuffer, &bufWidth, &bufHeight); + /* set initial buffer size */ + if (newCtx->Driver.ResizeBuffers) + newCtx->Driver.ResizeBuffers(newCtx, drawBuffer, + bufWidth, bufHeight); + drawBuffer->Initialized = GL_TRUE; + } + + if (readBuffer != drawBuffer && !readBuffer->Initialized) { + /* get initial window size */ + GLuint bufWidth, bufHeight; + /* ask device driver for size of the buffer */ + (*newCtx->Driver.GetBufferSize)(readBuffer, &bufWidth, &bufHeight); + /* set initial buffer size */ + if (newCtx->Driver.ResizeBuffers) + newCtx->Driver.ResizeBuffers(newCtx, readBuffer, + bufWidth, bufHeight); + readBuffer->Initialized = GL_TRUE; + } +#endif + if (newCtx->FirstTimeCurrent) { + /* set initial viewport and scissor size now */ + _mesa_set_viewport(newCtx, 0, 0, drawBuffer->Width, drawBuffer->Height); + newCtx->Scissor.Width = drawBuffer->Width; + newCtx->Scissor.Height = drawBuffer->Height; + } + } + + /* Alert the driver - usually passed on to the sw t&l module, + * but also used to detect threaded cases in the radeon codegen + * hw t&l module. + */ + if (newCtx->Driver.MakeCurrent) + newCtx->Driver.MakeCurrent( newCtx, drawBuffer, readBuffer ); + + /* We can use this to help debug user's problems. Tell them to set + * the MESA_INFO env variable before running their app. Then the + * first time each context is made current we'll print some useful + * information. + */ + if (newCtx->FirstTimeCurrent) { + if (_mesa_getenv("MESA_INFO")) { + _mesa_print_info(); + } + newCtx->FirstTimeCurrent = GL_FALSE; + } + } +} + + +/** + * Make context 'ctx' share the display lists, textures and programs + * that are associated with 'ctxToShare'. + * Any display lists, textures or programs associated with 'ctx' will + * be deleted if nobody else is sharing them. + */ +GLboolean +_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare) +{ + if (ctx && ctxToShare && ctx->Shared && ctxToShare->Shared) { + ctx->Shared->RefCount--; + if (ctx->Shared->RefCount == 0) { + free_shared_state(ctx, ctx->Shared); + } + ctx->Shared = ctxToShare->Shared; + ctx->Shared->RefCount++; + return GL_TRUE; + } + else { + return GL_FALSE; + } +} + + + +/** + * Get current context for the calling thread. + * + * \return pointer to the current GL context. + * + * Calls _glapi_get_context(). This isn't the fastest way to get the current + * context. If you need speed, see the #GET_CURRENT_CONTEXT macro in context.h. + */ +GLcontext * +_mesa_get_current_context( void ) +{ + return (GLcontext *) _glapi_get_context(); +} + +/** + * Get context's current API dispatch table. + * + * It'll either be the immediate-mode execute dispatcher or the display list + * compile dispatcher. + * + * \param ctx GL context. + * + * \return pointer to dispatch_table. + * + * Simply returns __GLcontextRec::CurrentDispatch. + */ +struct _glapi_table * +_mesa_get_dispatch(GLcontext *ctx) +{ + return ctx->CurrentDispatch; +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Miscellaneous functions */ +/**********************************************************************/ +/*@{*/ + +/** + * Record an error. + * + * \param ctx GL context. + * \param error error code. + * + * Records the given error code and call the driver's dd_function_table::Error + * function if defined. + * + * \sa + * This is called via _mesa_error(). + */ +void +_mesa_record_error( GLcontext *ctx, GLenum error ) +{ + if (!ctx) + return; + + if (ctx->ErrorValue == GL_NO_ERROR) { + ctx->ErrorValue = error; + } + + /* Call device driver's error handler, if any. This is used on the Mac. */ + if (ctx->Driver.Error) { + (*ctx->Driver.Error)( ctx ); + } +} + +/** + * Execute glFinish(). + * + * Calls the #ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH macro and the + * dd_function_table::Finish driver callback, if not NULL. + */ +void GLAPIENTRY +_mesa_Finish( void ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (ctx->Driver.Finish) { + (*ctx->Driver.Finish)( ctx ); + } +} + +/** + * Execute glFlush(). + * + * Calls the #ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH macro and the + * dd_function_table::Flush driver callback, if not NULL. + */ +void GLAPIENTRY +_mesa_Flush( void ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (ctx->Driver.Flush) { + (*ctx->Driver.Flush)( ctx ); + } +} + + +/*@}*/ diff --git a/reactos/dll/mesa32/src/main/context.h b/reactos/dll/mesa32/src/main/context.h new file mode 100644 index 00000000000..8b7e7c9952b --- /dev/null +++ b/reactos/dll/mesa32/src/main/context.h @@ -0,0 +1,340 @@ +/** + * \file context.h + * Mesa context/visual/framebuffer management functions. + * + * There are three Mesa data types which are meant to be used by device + * drivers: + * - GLcontext: this contains the Mesa rendering state + * - GLvisual: this describes the color buffer (RGB vs. ci), whether or not + * there's a depth buffer, stencil buffer, etc. + * - GLframebuffer: contains pointers to the depth buffer, stencil buffer, + * accum buffer and alpha buffers. + * + * These types should be encapsulated by corresponding device driver + * data types. See xmesa.h and xmesaP.h for an example. + * + * In OOP terms, GLcontext, GLvisual, and GLframebuffer are base classes + * which the device driver must derive from. + * + * The following functions create and destroy these data types. + */ + +/* + * 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 CONTEXT_H +#define CONTEXT_H + + +#include "glapi.h" +#include "imports.h" +#include "mtypes.h" + + +/**********************************************************************/ +/** \name Create/destroy a GLvisual. */ +/*@{*/ + +extern GLvisual * +_mesa_create_visual( GLboolean rgbFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits, + GLint indexBits, + GLint depthBits, + GLint stencilBits, + GLint accumRedBits, + GLint accumGreenBits, + GLint accumBlueBits, + GLint accumAlphaBits, + GLint numSamples ); + +extern GLboolean +_mesa_initialize_visual( GLvisual *v, + GLboolean rgbFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits, + GLint indexBits, + GLint depthBits, + GLint stencilBits, + GLint accumRedBits, + GLint accumGreenBits, + GLint accumBlueBits, + GLint accumAlphaBits, + GLint numSamples ); + +extern void +_mesa_destroy_visual( GLvisual *vis ); + +/*@}*/ + + +/**********************************************************************/ +/** \name Create/destroy a GLcontext. */ +/*@{*/ + +extern GLcontext * +_mesa_create_context( const GLvisual *visual, + GLcontext *share_list, + const struct dd_function_table *driverFunctions, + void *driverContext ); + +extern GLboolean +_mesa_initialize_context( GLcontext *ctx, + const GLvisual *visual, + GLcontext *share_list, + const struct dd_function_table *driverFunctions, + void *driverContext ); + +extern void +_mesa_free_context_data( GLcontext *ctx ); + +extern void +_mesa_destroy_context( GLcontext *ctx ); + + +extern void +_mesa_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); + + +extern void +_mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer, + GLframebuffer *readBuffer ); + +extern GLboolean +_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare); + +extern GLcontext * +_mesa_get_current_context(void); + +/*@}*/ + + +/**********************************************************************/ +/** \name OpenGL SI-style export functions. */ +/*@{*/ + +extern GLboolean +_mesa_destroyContext(__GLcontext *gc); + +extern GLboolean +_mesa_loseCurrent(__GLcontext *gc); + +extern GLboolean +_mesa_makeCurrent(__GLcontext *gc); + +extern GLboolean +_mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare); + +extern GLboolean +_mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask); + +extern GLboolean +_mesa_forceCurrent(__GLcontext *gc); + +extern GLboolean +_mesa_notifyResize(__GLcontext *gc); + +extern void +_mesa_notifyDestroy(__GLcontext *gc); + +extern void +_mesa_notifySwapBuffers(__GLcontext *gc); + +extern struct __GLdispatchStateRec * +_mesa_dispatchExec(__GLcontext *gc); + +extern void +_mesa_beginDispatchOverride(__GLcontext *gc); + +extern void +_mesa_endDispatchOverride(__GLcontext *gc); + +/*@}*/ + + +extern struct _glapi_table * +_mesa_get_dispatch(GLcontext *ctx); + + + +/**********************************************************************/ +/** \name Miscellaneous */ +/*@{*/ + +extern void +_mesa_record_error( GLcontext *ctx, GLenum error ); + + +extern void GLAPIENTRY +_mesa_Finish( void ); + +extern void GLAPIENTRY +_mesa_Flush( void ); + +/*@}*/ + + + +/**********************************************************************/ +/** \name Macros for contexts/flushing. */ +/*@{*/ + + +/** + * Flush vertices. + * + * \param ctx GL context. + * \param newstate new state. + * + * Checks if dd_function_table::NeedFlush is marked to flush stored vertices, + * and calls dd_function_table::FlushVertices if so. Marks + * __GLcontextRec::NewState with \p newstate. + */ +#define FLUSH_VERTICES(ctx, newstate) \ +do { \ + if (MESA_VERBOSE & VERBOSE_STATE) \ + _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", MESA_FUNCTION);\ + if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \ + ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \ + ctx->NewState |= newstate; \ +} while (0) + +/** + * Flush current state. + * + * \param ctx GL context. + * \param newstate new state. + * + * Checks if dd_function_table::NeedFlush is marked to flush current state, + * and calls dd_function_table::FlushVertices if so. Marks + * __GLcontextRec::NewState with \p newstate. + */ +#define FLUSH_CURRENT(ctx, newstate) \ +do { \ + if (MESA_VERBOSE & VERBOSE_STATE) \ + _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", MESA_FUNCTION); \ + if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \ + ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \ + ctx->NewState |= newstate; \ +} 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_BEGIN_END_WITH_RETVAL(ctx, retval) \ +do { \ + if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \ + _mesa_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_BEGIN_END(ctx) \ +do { \ + if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \ + _mesa_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_BEGIN_END_AND_FLUSH(ctx) \ +do { \ + ASSERT_OUTSIDE_BEGIN_END(ctx); \ + FLUSH_VERTICES(ctx, 0); \ +} 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_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \ +do { \ + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval); \ + FLUSH_VERTICES(ctx, 0); \ +} while (0) + + +/*@}*/ + + + +/** + * Macros to help evaluate current state conditions + */ + +/*@{*/ + +/** + * Is the secondary color needed? + */ +#define NEED_SECONDARY_COLOR(CTX) \ + (((CTX)->Light.Enabled && \ + (CTX)->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) \ + || (CTX)->Fog.ColorSumEnabled \ + || ((CTX)->VertexProgram._Enabled && \ + ((CTX)->VertexProgram.Current->InputsRead & VERT_BIT_COLOR1)) \ + || ((CTX)->FragmentProgram._Enabled && \ + ((CTX)->FragmentProgram.Current->InputsRead & FRAG_BIT_COL1)) \ + ) + + +/** + * Is two-sided lighting in effect? + */ +#define NEED_TWO_SIDED_LIGHTING(CTX) \ + (ctx->Light.Enabled && ctx->Light.Model.TwoSide) + + +/*@}*/ + + +#endif diff --git a/reactos/dll/mesa32/src/main/convolve.c b/reactos/dll/mesa32/src/main/convolve.c new file mode 100644 index 00000000000..6b97c7f56cd --- /dev/null +++ b/reactos/dll/mesa32/src/main/convolve.c @@ -0,0 +1,1527 @@ +/* + * 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. + */ + + +/* + * Image convolution functions. + * + * Notes: filter kernel elements are indexed by and as in + * the GL spec. + */ + + +#include "glheader.h" +#include "bufferobj.h" +#include "colormac.h" +#include "convolve.h" +#include "context.h" +#include "image.h" +#include "mtypes.h" +#include "pixel.h" +#include "state.h" + + +/* + * Given an internalFormat token passed to glConvolutionFilter + * or glSeparableFilter, return the corresponding base format. + * Return -1 if invalid token. + */ +static GLint +base_filter_format( GLenum format ) +{ + switch (format) { + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + return GL_ALPHA; + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + return GL_LUMINANCE; + 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 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: + return -1; /* error */ + } +} + + +void GLAPIENTRY +_mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) +{ + GLint baseFormat; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (target != GL_CONVOLUTION_1D) { + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(target)"); + return; + } + + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(internalFormat)"); + return; + } + + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter1D(width)"); + return; + } + + if (!_mesa_is_legal_format_and_type(ctx, format, type)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter1D(format or type)"); + return; + } + + if (format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + format == GL_INTENSITY || + type == GL_BITMAP) { + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(format or type)"); + return; + } + + ctx->Convolution1D.Format = format; + ctx->Convolution1D.InternalFormat = internalFormat; + ctx->Convolution1D.Width = width; + ctx->Convolution1D.Height = 1; + + if (ctx->Unpack.BufferObj->Name) { + /* unpack filter from PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(1, &ctx->Unpack, width, 1, 1, + format, type, image)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glConvolutionFilter1D(invalid PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, + ctx->Unpack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glConvolutionFilter1D(PBO is mapped)"); + return; + } + image = ADD_POINTERS(buf, image); + } + else if (!image) { + return; + } + + _mesa_unpack_color_span_float(ctx, width, GL_RGBA, + ctx->Convolution1D.Filter, + format, type, image, &ctx->Unpack, + 0); /* transferOps */ + + if (ctx->Unpack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + ctx->Unpack.BufferObj); + } + + _mesa_scale_and_bias_rgba(width, + (GLfloat (*)[4]) ctx->Convolution1D.Filter, + ctx->Pixel.ConvolutionFilterScale[0][0], + ctx->Pixel.ConvolutionFilterScale[0][1], + ctx->Pixel.ConvolutionFilterScale[0][2], + ctx->Pixel.ConvolutionFilterScale[0][3], + ctx->Pixel.ConvolutionFilterBias[0][0], + ctx->Pixel.ConvolutionFilterBias[0][1], + ctx->Pixel.ConvolutionFilterBias[0][2], + ctx->Pixel.ConvolutionFilterBias[0][3]); + + ctx->NewState |= _NEW_PIXEL; +} + + +void GLAPIENTRY +_mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) +{ + GLint baseFormat; + GLint i; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (target != GL_CONVOLUTION_2D) { + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(target)"); + return; + } + + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(internalFormat)"); + return; + } + + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(width)"); + return; + } + if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { + _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(height)"); + return; + } + + if (!_mesa_is_legal_format_and_type(ctx, format, type)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter2D(format or type)"); + return; + } + if (format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + format == GL_INTENSITY || + type == GL_BITMAP) { + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(format or type)"); + return; + } + + /* this should have been caught earlier */ + assert(_mesa_components_in_format(format)); + + ctx->Convolution2D.Format = format; + ctx->Convolution2D.InternalFormat = internalFormat; + ctx->Convolution2D.Width = width; + ctx->Convolution2D.Height = height; + + if (ctx->Unpack.BufferObj->Name) { + /* unpack filter from PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1, + format, type, image)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glConvolutionFilter2D(invalid PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, + ctx->Unpack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glConvolutionFilter2D(PBO is mapped)"); + return; + } + image = ADD_POINTERS(buf, image); + } + else if (!image) { + return; + } + + /* Unpack filter image. We always store filters in RGBA format. */ + for (i = 0; i < height; i++) { + const GLvoid *src = _mesa_image_address2d(&ctx->Unpack, image, width, + height, format, type, i, 0); + GLfloat *dst = ctx->Convolution2D.Filter + i * width * 4; + _mesa_unpack_color_span_float(ctx, width, GL_RGBA, dst, + format, type, src, &ctx->Unpack, + 0); /* transferOps */ + } + + if (ctx->Unpack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + ctx->Unpack.BufferObj); + } + + _mesa_scale_and_bias_rgba(width * height, + (GLfloat (*)[4]) ctx->Convolution2D.Filter, + ctx->Pixel.ConvolutionFilterScale[1][0], + ctx->Pixel.ConvolutionFilterScale[1][1], + ctx->Pixel.ConvolutionFilterScale[1][2], + ctx->Pixel.ConvolutionFilterScale[1][3], + ctx->Pixel.ConvolutionFilterBias[1][0], + ctx->Pixel.ConvolutionFilterBias[1][1], + ctx->Pixel.ConvolutionFilterBias[1][2], + ctx->Pixel.ConvolutionFilterBias[1][3]); + + ctx->NewState |= _NEW_PIXEL; +} + + +void GLAPIENTRY +_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint c; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + break; + case GL_CONVOLUTION_2D: + c = 1; + break; + case GL_SEPARABLE_2D: + c = 2; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_MODE: + if (param == (GLfloat) GL_REDUCE || + param == (GLfloat) GL_CONSTANT_BORDER || + param == (GLfloat) GL_REPLICATE_BORDER) { + ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(params)"); + return; + } + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(pname)"); + return; + } + + ctx->NewState |= _NEW_PIXEL; +} + + +void GLAPIENTRY +_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint c; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + break; + case GL_CONVOLUTION_2D: + c = 1; + break; + case GL_SEPARABLE_2D: + c = 2; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + COPY_4V(ctx->Pixel.ConvolutionBorderColor[c], params); + break; + case GL_CONVOLUTION_BORDER_MODE: + if (params[0] == (GLfloat) GL_REDUCE || + params[0] == (GLfloat) GL_CONSTANT_BORDER || + params[0] == (GLfloat) GL_REPLICATE_BORDER) { + ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(params)"); + return; + } + break; + case GL_CONVOLUTION_FILTER_SCALE: + COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); + break; + case GL_CONVOLUTION_FILTER_BIAS: + COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(pname)"); + return; + } + + ctx->NewState |= _NEW_PIXEL; +} + + +void GLAPIENTRY +_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint c; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + break; + case GL_CONVOLUTION_2D: + c = 1; + break; + case GL_SEPARABLE_2D: + c = 2; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_MODE: + if (param == (GLint) GL_REDUCE || + param == (GLint) GL_CONSTANT_BORDER || + param == (GLint) GL_REPLICATE_BORDER) { + ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(params)"); + return; + } + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(pname)"); + return; + } + + ctx->NewState |= _NEW_PIXEL; +} + + +void GLAPIENTRY +_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint c; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + break; + case GL_CONVOLUTION_2D: + c = 1; + break; + case GL_SEPARABLE_2D: + c = 2; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + ctx->Pixel.ConvolutionBorderColor[c][0] = INT_TO_FLOAT(params[0]); + ctx->Pixel.ConvolutionBorderColor[c][1] = INT_TO_FLOAT(params[1]); + ctx->Pixel.ConvolutionBorderColor[c][2] = INT_TO_FLOAT(params[2]); + ctx->Pixel.ConvolutionBorderColor[c][3] = INT_TO_FLOAT(params[3]); + break; + case GL_CONVOLUTION_BORDER_MODE: + if (params[0] == (GLint) GL_REDUCE || + params[0] == (GLint) GL_CONSTANT_BORDER || + params[0] == (GLint) GL_REPLICATE_BORDER) { + ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(params)"); + return; + } + break; + case GL_CONVOLUTION_FILTER_SCALE: + /* COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); */ + /* need cast to prevent compiler warnings */ + ctx->Pixel.ConvolutionFilterScale[c][0] = (GLfloat) params[0]; + ctx->Pixel.ConvolutionFilterScale[c][1] = (GLfloat) params[1]; + ctx->Pixel.ConvolutionFilterScale[c][2] = (GLfloat) params[2]; + ctx->Pixel.ConvolutionFilterScale[c][3] = (GLfloat) params[3]; + break; + case GL_CONVOLUTION_FILTER_BIAS: + /* COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); */ + /* need cast to prevent compiler warnings */ + ctx->Pixel.ConvolutionFilterBias[c][0] = (GLfloat) params[0]; + ctx->Pixel.ConvolutionFilterBias[c][1] = (GLfloat) params[1]; + ctx->Pixel.ConvolutionFilterBias[c][2] = (GLfloat) params[2]; + ctx->Pixel.ConvolutionFilterBias[c][3] = (GLfloat) params[3]; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(pname)"); + return; + } + + ctx->NewState |= _NEW_PIXEL; +} + + +void GLAPIENTRY +_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) +{ + GLint baseFormat; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (target != GL_CONVOLUTION_1D) { + _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(target)"); + return; + } + + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(internalFormat)"); + return; + } + + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter1D(width)"); + return; + } + + ctx->Driver.CopyConvolutionFilter1D( ctx, target, + internalFormat, x, y, width); +} + + +void GLAPIENTRY +_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height) +{ + GLint baseFormat; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (target != GL_CONVOLUTION_2D) { + _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(target)"); + return; + } + + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(internalFormat)"); + return; + } + + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(width)"); + return; + } + if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(height)"); + return; + } + + ctx->Driver.CopyConvolutionFilter2D( ctx, target, internalFormat, x, y, + width, height ); +} + + +void GLAPIENTRY +_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) +{ + const struct gl_convolution_attrib *filter; + GLuint row; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->NewState) { + _mesa_update_state(ctx); + } + + if (!_mesa_is_legal_format_and_type(ctx, format, type)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)"); + return; + } + + if (format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + format == GL_INTENSITY || + type == GL_BITMAP) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)"); + return; + } + + switch (target) { + case GL_CONVOLUTION_1D: + filter = &(ctx->Convolution1D); + break; + case GL_CONVOLUTION_2D: + filter = &(ctx->Convolution2D); + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(target)"); + return; + } + + if (ctx->Pack.BufferObj->Name) { + /* Pack the filter into a PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(2, &ctx->Pack, + filter->Width, filter->Height, + 1, format, type, image)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetConvolutionFilter(invalid PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + ctx->Pack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetConvolutionFilter(PBO is mapped)"); + return; + } + image = ADD_POINTERS(image, buf); + } + + for (row = 0; row < filter->Height; row++) { + GLvoid *dst = _mesa_image_address2d(&ctx->Pack, image, filter->Width, + filter->Height, format, type, + row, 0); + const GLfloat *src = filter->Filter + row * filter->Width * 4; + _mesa_pack_rgba_span_float(ctx, filter->Width, + (const GLfloat (*)[4]) src, + format, type, dst, &ctx->Pack, 0); + } + + if (ctx->Pack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + ctx->Pack.BufferObj); + } +} + + +void GLAPIENTRY +_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + const struct gl_convolution_attrib *conv; + GLuint c; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + conv = &ctx->Convolution1D; + break; + case GL_CONVOLUTION_2D: + c = 1; + conv = &ctx->Convolution2D; + break; + case GL_SEPARABLE_2D: + c = 2; + conv = &ctx->Separable2D; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + COPY_4V(params, ctx->Pixel.ConvolutionBorderColor[c]); + break; + case GL_CONVOLUTION_BORDER_MODE: + *params = (GLfloat) ctx->Pixel.ConvolutionBorderMode[c]; + break; + case GL_CONVOLUTION_FILTER_SCALE: + COPY_4V(params, ctx->Pixel.ConvolutionFilterScale[c]); + break; + case GL_CONVOLUTION_FILTER_BIAS: + COPY_4V(params, ctx->Pixel.ConvolutionFilterBias[c]); + break; + case GL_CONVOLUTION_FORMAT: + *params = (GLfloat) conv->Format; + break; + case GL_CONVOLUTION_WIDTH: + *params = (GLfloat) conv->Width; + break; + case GL_CONVOLUTION_HEIGHT: + *params = (GLfloat) conv->Height; + break; + case GL_MAX_CONVOLUTION_WIDTH: + *params = (GLfloat) ctx->Const.MaxConvolutionWidth; + break; + case GL_MAX_CONVOLUTION_HEIGHT: + *params = (GLfloat) ctx->Const.MaxConvolutionHeight; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(pname)"); + return; + } +} + + +void GLAPIENTRY +_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + const struct gl_convolution_attrib *conv; + GLuint c; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + conv = &ctx->Convolution1D; + break; + case GL_CONVOLUTION_2D: + c = 1; + conv = &ctx->Convolution2D; + break; + case GL_SEPARABLE_2D: + c = 2; + conv = &ctx->Separable2D; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + params[0] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][0]); + params[1] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][1]); + params[2] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][2]); + params[3] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][3]); + break; + case GL_CONVOLUTION_BORDER_MODE: + *params = (GLint) ctx->Pixel.ConvolutionBorderMode[c]; + break; + case GL_CONVOLUTION_FILTER_SCALE: + params[0] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][0]; + params[1] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][1]; + params[2] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][2]; + params[3] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][3]; + break; + case GL_CONVOLUTION_FILTER_BIAS: + params[0] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][0]; + params[1] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][1]; + params[2] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][2]; + params[3] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][3]; + break; + case GL_CONVOLUTION_FORMAT: + *params = (GLint) conv->Format; + break; + case GL_CONVOLUTION_WIDTH: + *params = (GLint) conv->Width; + break; + case GL_CONVOLUTION_HEIGHT: + *params = (GLint) conv->Height; + break; + case GL_MAX_CONVOLUTION_WIDTH: + *params = (GLint) ctx->Const.MaxConvolutionWidth; + break; + case GL_MAX_CONVOLUTION_HEIGHT: + *params = (GLint) ctx->Const.MaxConvolutionHeight; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(pname)"); + return; + } +} + + +void GLAPIENTRY +_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) +{ + const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; + const struct gl_convolution_attrib *filter; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->NewState) { + _mesa_update_state(ctx); + } + + if (target != GL_SEPARABLE_2D) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter(target)"); + return; + } + + if (!_mesa_is_legal_format_and_type(ctx, format, type)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)"); + return; + } + + if (format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + format == GL_INTENSITY || + type == GL_BITMAP) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)"); + return; + } + + filter = &ctx->Separable2D; + + if (ctx->Pack.BufferObj->Name) { + /* Pack filter into PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(1, &ctx->Pack, filter->Width, 1, 1, + format, type, row)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetSeparableFilter(invalid PBO access, width)"); + return; + } + if (!_mesa_validate_pbo_access(1, &ctx->Pack, filter->Height, 1, 1, + format, type, column)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetSeparableFilter(invalid PBO access, height)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + ctx->Pack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetSeparableFilter(PBO is mapped)"); + return; + } + row = ADD_POINTERS(buf, row); + column = ADD_POINTERS(buf, column); + } + + /* Row filter */ + if (row) { + GLvoid *dst = _mesa_image_address1d(&ctx->Pack, row, filter->Width, + format, type, 0); + _mesa_pack_rgba_span_float(ctx, filter->Width, + (const GLfloat (*)[4]) filter->Filter, + format, type, dst, &ctx->Pack, 0); + } + + /* Column filter */ + if (column) { + GLvoid *dst = _mesa_image_address1d(&ctx->Pack, column, filter->Height, + format, type, 0); + const GLfloat *src = filter->Filter + colStart; + _mesa_pack_rgba_span_float(ctx, filter->Height, + (const GLfloat (*)[4]) src, + format, type, dst, &ctx->Pack, 0); + } + + (void) span; /* unused at this time */ + + if (ctx->Pack.BufferObj->Name) { + /* Pack filter into PBO */ + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + ctx->Unpack.BufferObj); + } +} + + +void GLAPIENTRY +_mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) +{ + const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; + GLint baseFormat; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (target != GL_SEPARABLE_2D) { + _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(target)"); + return; + } + + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(internalFormat)"); + return; + } + + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + _mesa_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(width)"); + return; + } + if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { + _mesa_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(height)"); + return; + } + + if (!_mesa_is_legal_format_and_type(ctx, format, type)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSeparableFilter2D(format or type)"); + return; + } + + if (format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + format == GL_INTENSITY || + type == GL_BITMAP) { + _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(format or type)"); + return; + } + + ctx->Separable2D.Format = format; + ctx->Separable2D.InternalFormat = internalFormat; + ctx->Separable2D.Width = width; + ctx->Separable2D.Height = height; + + if (ctx->Unpack.BufferObj->Name) { + /* unpack filter from PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(1, &ctx->Unpack, width, 1, 1, + format, type, row)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glSeparableFilter2D(invalid PBO access, width)"); + return; + } + if (!_mesa_validate_pbo_access(1, &ctx->Unpack, height, 1, 1, + format, type, column)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glSeparableFilter2D(invalid PBO access, height)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, + ctx->Unpack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glSeparableFilter2D(PBO is mapped)"); + return; + } + row = ADD_POINTERS(buf, row); + column = ADD_POINTERS(buf, column); + } + + /* unpack row filter */ + if (row) { + _mesa_unpack_color_span_float(ctx, width, GL_RGBA, + ctx->Separable2D.Filter, + format, type, row, &ctx->Unpack, + 0); /* transferOps */ + + _mesa_scale_and_bias_rgba(width, + (GLfloat (*)[4]) ctx->Separable2D.Filter, + ctx->Pixel.ConvolutionFilterScale[2][0], + ctx->Pixel.ConvolutionFilterScale[2][1], + ctx->Pixel.ConvolutionFilterScale[2][2], + ctx->Pixel.ConvolutionFilterScale[2][3], + ctx->Pixel.ConvolutionFilterBias[2][0], + ctx->Pixel.ConvolutionFilterBias[2][1], + ctx->Pixel.ConvolutionFilterBias[2][2], + ctx->Pixel.ConvolutionFilterBias[2][3]); + } + + /* unpack column filter */ + if (column) { + _mesa_unpack_color_span_float(ctx, height, GL_RGBA, + &ctx->Separable2D.Filter[colStart], + format, type, column, &ctx->Unpack, + 0); /* transferOps */ + + _mesa_scale_and_bias_rgba(height, + (GLfloat (*)[4]) (ctx->Separable2D.Filter + colStart), + ctx->Pixel.ConvolutionFilterScale[2][0], + ctx->Pixel.ConvolutionFilterScale[2][1], + ctx->Pixel.ConvolutionFilterScale[2][2], + ctx->Pixel.ConvolutionFilterScale[2][3], + ctx->Pixel.ConvolutionFilterBias[2][0], + ctx->Pixel.ConvolutionFilterBias[2][1], + ctx->Pixel.ConvolutionFilterBias[2][2], + ctx->Pixel.ConvolutionFilterBias[2][3]); + } + + if (ctx->Unpack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + ctx->Unpack.BufferObj); + } + + ctx->NewState |= _NEW_PIXEL; +} + + +/**********************************************************************/ +/*** image convolution functions ***/ +/**********************************************************************/ + +static void +convolve_1d_reduce(GLint srcWidth, const GLfloat src[][4], + GLint filterWidth, const GLfloat filter[][4], + GLfloat dest[][4]) +{ + GLint dstWidth; + GLint i, n; + + if (filterWidth >= 1) + dstWidth = srcWidth - (filterWidth - 1); + else + dstWidth = srcWidth; + + if (dstWidth <= 0) + return; /* null result */ + + for (i = 0; i < dstWidth; i++) { + GLfloat sumR = 0.0; + GLfloat sumG = 0.0; + GLfloat sumB = 0.0; + GLfloat sumA = 0.0; + for (n = 0; n < filterWidth; n++) { + sumR += src[i + n][RCOMP] * filter[n][RCOMP]; + sumG += src[i + n][GCOMP] * filter[n][GCOMP]; + sumB += src[i + n][BCOMP] * filter[n][BCOMP]; + sumA += src[i + n][ACOMP] * filter[n][ACOMP]; + } + dest[i][RCOMP] = sumR; + dest[i][GCOMP] = sumG; + dest[i][BCOMP] = sumB; + dest[i][ACOMP] = sumA; + } +} + + +static void +convolve_1d_constant(GLint srcWidth, const GLfloat src[][4], + GLint filterWidth, const GLfloat filter[][4], + GLfloat dest[][4], + const GLfloat borderColor[4]) +{ + const GLint halfFilterWidth = filterWidth / 2; + GLint i, n; + + for (i = 0; i < srcWidth; i++) { + GLfloat sumR = 0.0; + GLfloat sumG = 0.0; + GLfloat sumB = 0.0; + GLfloat sumA = 0.0; + for (n = 0; n < filterWidth; n++) { + if (i + n < halfFilterWidth || i + n - halfFilterWidth >= srcWidth) { + sumR += borderColor[RCOMP] * filter[n][RCOMP]; + sumG += borderColor[GCOMP] * filter[n][GCOMP]; + sumB += borderColor[BCOMP] * filter[n][BCOMP]; + sumA += borderColor[ACOMP] * filter[n][ACOMP]; + } + else { + sumR += src[i + n - halfFilterWidth][RCOMP] * filter[n][RCOMP]; + sumG += src[i + n - halfFilterWidth][GCOMP] * filter[n][GCOMP]; + sumB += src[i + n - halfFilterWidth][BCOMP] * filter[n][BCOMP]; + sumA += src[i + n - halfFilterWidth][ACOMP] * filter[n][ACOMP]; + } + } + dest[i][RCOMP] = sumR; + dest[i][GCOMP] = sumG; + dest[i][BCOMP] = sumB; + dest[i][ACOMP] = sumA; + } +} + + +static void +convolve_1d_replicate(GLint srcWidth, const GLfloat src[][4], + GLint filterWidth, const GLfloat filter[][4], + GLfloat dest[][4]) +{ + const GLint halfFilterWidth = filterWidth / 2; + GLint i, n; + + for (i = 0; i < srcWidth; i++) { + GLfloat sumR = 0.0; + GLfloat sumG = 0.0; + GLfloat sumB = 0.0; + GLfloat sumA = 0.0; + for (n = 0; n < filterWidth; n++) { + if (i + n < halfFilterWidth) { + sumR += src[0][RCOMP] * filter[n][RCOMP]; + sumG += src[0][GCOMP] * filter[n][GCOMP]; + sumB += src[0][BCOMP] * filter[n][BCOMP]; + sumA += src[0][ACOMP] * filter[n][ACOMP]; + } + else if (i + n - halfFilterWidth >= srcWidth) { + sumR += src[srcWidth - 1][RCOMP] * filter[n][RCOMP]; + sumG += src[srcWidth - 1][GCOMP] * filter[n][GCOMP]; + sumB += src[srcWidth - 1][BCOMP] * filter[n][BCOMP]; + sumA += src[srcWidth - 1][ACOMP] * filter[n][ACOMP]; + } + else { + sumR += src[i + n - halfFilterWidth][RCOMP] * filter[n][RCOMP]; + sumG += src[i + n - halfFilterWidth][GCOMP] * filter[n][GCOMP]; + sumB += src[i + n - halfFilterWidth][BCOMP] * filter[n][BCOMP]; + sumA += src[i + n - halfFilterWidth][ACOMP] * filter[n][ACOMP]; + } + } + dest[i][RCOMP] = sumR; + dest[i][GCOMP] = sumG; + dest[i][BCOMP] = sumB; + dest[i][ACOMP] = sumA; + } +} + + +static void +convolve_2d_reduce(GLint srcWidth, GLint srcHeight, + const GLfloat src[][4], + GLint filterWidth, GLint filterHeight, + const GLfloat filter[][4], + GLfloat dest[][4]) +{ + GLint dstWidth, dstHeight; + GLint i, j, n, m; + + if (filterWidth >= 1) + dstWidth = srcWidth - (filterWidth - 1); + else + dstWidth = srcWidth; + + if (filterHeight >= 1) + dstHeight = srcHeight - (filterHeight - 1); + else + dstHeight = srcHeight; + + if (dstWidth <= 0 || dstHeight <= 0) + return; + + for (j = 0; j < dstHeight; j++) { + for (i = 0; i < dstWidth; i++) { + GLfloat sumR = 0.0; + GLfloat sumG = 0.0; + GLfloat sumB = 0.0; + GLfloat sumA = 0.0; + for (m = 0; m < filterHeight; m++) { + for (n = 0; n < filterWidth; n++) { + const GLint k = (j + m) * srcWidth + i + n; + const GLint f = m * filterWidth + n; + sumR += src[k][RCOMP] * filter[f][RCOMP]; + sumG += src[k][GCOMP] * filter[f][GCOMP]; + sumB += src[k][BCOMP] * filter[f][BCOMP]; + sumA += src[k][ACOMP] * filter[f][ACOMP]; + } + } + dest[j * dstWidth + i][RCOMP] = sumR; + dest[j * dstWidth + i][GCOMP] = sumG; + dest[j * dstWidth + i][BCOMP] = sumB; + dest[j * dstWidth + i][ACOMP] = sumA; + } + } +} + + +static void +convolve_2d_constant(GLint srcWidth, GLint srcHeight, + const GLfloat src[][4], + GLint filterWidth, GLint filterHeight, + const GLfloat filter[][4], + GLfloat dest[][4], + const GLfloat borderColor[4]) +{ + const GLint halfFilterWidth = filterWidth / 2; + const GLint halfFilterHeight = filterHeight / 2; + GLint i, j, n, m; + + for (j = 0; j < srcHeight; j++) { + for (i = 0; i < srcWidth; i++) { + GLfloat sumR = 0.0; + GLfloat sumG = 0.0; + GLfloat sumB = 0.0; + GLfloat sumA = 0.0; + for (m = 0; m < filterHeight; m++) { + for (n = 0; n < filterWidth; n++) { + const GLint f = m * filterWidth + n; + const GLint is = i + n - halfFilterWidth; + const GLint js = j + m - halfFilterHeight; + if (is < 0 || is >= srcWidth || + js < 0 || js >= srcHeight) { + sumR += borderColor[RCOMP] * filter[f][RCOMP]; + sumG += borderColor[GCOMP] * filter[f][GCOMP]; + sumB += borderColor[BCOMP] * filter[f][BCOMP]; + sumA += borderColor[ACOMP] * filter[f][ACOMP]; + } + else { + const GLint k = js * srcWidth + is; + sumR += src[k][RCOMP] * filter[f][RCOMP]; + sumG += src[k][GCOMP] * filter[f][GCOMP]; + sumB += src[k][BCOMP] * filter[f][BCOMP]; + sumA += src[k][ACOMP] * filter[f][ACOMP]; + } + } + } + dest[j * srcWidth + i][RCOMP] = sumR; + dest[j * srcWidth + i][GCOMP] = sumG; + dest[j * srcWidth + i][BCOMP] = sumB; + dest[j * srcWidth + i][ACOMP] = sumA; + } + } +} + + +static void +convolve_2d_replicate(GLint srcWidth, GLint srcHeight, + const GLfloat src[][4], + GLint filterWidth, GLint filterHeight, + const GLfloat filter[][4], + GLfloat dest[][4]) +{ + const GLint halfFilterWidth = filterWidth / 2; + const GLint halfFilterHeight = filterHeight / 2; + GLint i, j, n, m; + + for (j = 0; j < srcHeight; j++) { + for (i = 0; i < srcWidth; i++) { + GLfloat sumR = 0.0; + GLfloat sumG = 0.0; + GLfloat sumB = 0.0; + GLfloat sumA = 0.0; + for (m = 0; m < filterHeight; m++) { + for (n = 0; n < filterWidth; n++) { + const GLint f = m * filterWidth + n; + GLint is = i + n - halfFilterWidth; + GLint js = j + m - halfFilterHeight; + GLint k; + if (is < 0) + is = 0; + else if (is >= srcWidth) + is = srcWidth - 1; + if (js < 0) + js = 0; + else if (js >= srcHeight) + js = srcHeight - 1; + k = js * srcWidth + is; + sumR += src[k][RCOMP] * filter[f][RCOMP]; + sumG += src[k][GCOMP] * filter[f][GCOMP]; + sumB += src[k][BCOMP] * filter[f][BCOMP]; + sumA += src[k][ACOMP] * filter[f][ACOMP]; + } + } + dest[j * srcWidth + i][RCOMP] = sumR; + dest[j * srcWidth + i][GCOMP] = sumG; + dest[j * srcWidth + i][BCOMP] = sumB; + dest[j * srcWidth + i][ACOMP] = sumA; + } + } +} + + +static void +convolve_sep_reduce(GLint srcWidth, GLint srcHeight, + const GLfloat src[][4], + GLint filterWidth, GLint filterHeight, + const GLfloat rowFilt[][4], + const GLfloat colFilt[][4], + GLfloat dest[][4]) +{ + GLint dstWidth, dstHeight; + GLint i, j, n, m; + + if (filterWidth >= 1) + dstWidth = srcWidth - (filterWidth - 1); + else + dstWidth = srcWidth; + + if (filterHeight >= 1) + dstHeight = srcHeight - (filterHeight - 1); + else + dstHeight = srcHeight; + + if (dstWidth <= 0 || dstHeight <= 0) + return; + + for (j = 0; j < dstHeight; j++) { + for (i = 0; i < dstWidth; i++) { + GLfloat sumR = 0.0; + GLfloat sumG = 0.0; + GLfloat sumB = 0.0; + GLfloat sumA = 0.0; + for (m = 0; m < filterHeight; m++) { + for (n = 0; n < filterWidth; n++) { + GLint k = (j + m) * srcWidth + i + n; + sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; + sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; + sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; + sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; + } + } + dest[j * dstWidth + i][RCOMP] = sumR; + dest[j * dstWidth + i][GCOMP] = sumG; + dest[j * dstWidth + i][BCOMP] = sumB; + dest[j * dstWidth + i][ACOMP] = sumA; + } + } +} + + +static void +convolve_sep_constant(GLint srcWidth, GLint srcHeight, + const GLfloat src[][4], + GLint filterWidth, GLint filterHeight, + const GLfloat rowFilt[][4], + const GLfloat colFilt[][4], + GLfloat dest[][4], + const GLfloat borderColor[4]) +{ + const GLint halfFilterWidth = filterWidth / 2; + const GLint halfFilterHeight = filterHeight / 2; + GLint i, j, n, m; + + for (j = 0; j < srcHeight; j++) { + for (i = 0; i < srcWidth; i++) { + GLfloat sumR = 0.0; + GLfloat sumG = 0.0; + GLfloat sumB = 0.0; + GLfloat sumA = 0.0; + for (m = 0; m < filterHeight; m++) { + for (n = 0; n < filterWidth; n++) { + const GLint is = i + n - halfFilterWidth; + const GLint js = j + m - halfFilterHeight; + if (is < 0 || is >= srcWidth || + js < 0 || js >= srcHeight) { + sumR += borderColor[RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; + sumG += borderColor[GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; + sumB += borderColor[BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; + sumA += borderColor[ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; + } + else { + GLint k = js * srcWidth + is; + sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; + sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; + sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; + sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; + } + + } + } + dest[j * srcWidth + i][RCOMP] = sumR; + dest[j * srcWidth + i][GCOMP] = sumG; + dest[j * srcWidth + i][BCOMP] = sumB; + dest[j * srcWidth + i][ACOMP] = sumA; + } + } +} + + +static void +convolve_sep_replicate(GLint srcWidth, GLint srcHeight, + const GLfloat src[][4], + GLint filterWidth, GLint filterHeight, + const GLfloat rowFilt[][4], + const GLfloat colFilt[][4], + GLfloat dest[][4]) +{ + const GLint halfFilterWidth = filterWidth / 2; + const GLint halfFilterHeight = filterHeight / 2; + GLint i, j, n, m; + + for (j = 0; j < srcHeight; j++) { + for (i = 0; i < srcWidth; i++) { + GLfloat sumR = 0.0; + GLfloat sumG = 0.0; + GLfloat sumB = 0.0; + GLfloat sumA = 0.0; + for (m = 0; m < filterHeight; m++) { + for (n = 0; n < filterWidth; n++) { + GLint is = i + n - halfFilterWidth; + GLint js = j + m - halfFilterHeight; + GLint k; + if (is < 0) + is = 0; + else if (is >= srcWidth) + is = srcWidth - 1; + if (js < 0) + js = 0; + else if (js >= srcHeight) + js = srcHeight - 1; + k = js * srcWidth + is; + sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; + sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; + sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; + sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; + } + } + dest[j * srcWidth + i][RCOMP] = sumR; + dest[j * srcWidth + i][GCOMP] = sumG; + dest[j * srcWidth + i][BCOMP] = sumB; + dest[j * srcWidth + i][ACOMP] = sumA; + } + } +} + + + +void +_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width, + const GLfloat *srcImage, GLfloat *dstImage) +{ + switch (ctx->Pixel.ConvolutionBorderMode[0]) { + case GL_REDUCE: + convolve_1d_reduce(*width, (const GLfloat (*)[4]) srcImage, + ctx->Convolution1D.Width, + (const GLfloat (*)[4]) ctx->Convolution1D.Filter, + (GLfloat (*)[4]) dstImage); + *width = *width - (MAX2(ctx->Convolution1D.Width, 1) - 1); + break; + case GL_CONSTANT_BORDER: + convolve_1d_constant(*width, (const GLfloat (*)[4]) srcImage, + ctx->Convolution1D.Width, + (const GLfloat (*)[4]) ctx->Convolution1D.Filter, + (GLfloat (*)[4]) dstImage, + ctx->Pixel.ConvolutionBorderColor[0]); + break; + case GL_REPLICATE_BORDER: + convolve_1d_replicate(*width, (const GLfloat (*)[4]) srcImage, + ctx->Convolution1D.Width, + (const GLfloat (*)[4]) ctx->Convolution1D.Filter, + (GLfloat (*)[4]) dstImage); + break; + default: + ; + } +} + + +void +_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, + const GLfloat *srcImage, GLfloat *dstImage) +{ + switch (ctx->Pixel.ConvolutionBorderMode[1]) { + case GL_REDUCE: + convolve_2d_reduce(*width, *height, + (const GLfloat (*)[4]) srcImage, + ctx->Convolution2D.Width, + ctx->Convolution2D.Height, + (const GLfloat (*)[4]) ctx->Convolution2D.Filter, + (GLfloat (*)[4]) dstImage); + *width = *width - (MAX2(ctx->Convolution2D.Width, 1) - 1); + *height = *height - (MAX2(ctx->Convolution2D.Height, 1) - 1); + break; + case GL_CONSTANT_BORDER: + convolve_2d_constant(*width, *height, + (const GLfloat (*)[4]) srcImage, + ctx->Convolution2D.Width, + ctx->Convolution2D.Height, + (const GLfloat (*)[4]) ctx->Convolution2D.Filter, + (GLfloat (*)[4]) dstImage, + ctx->Pixel.ConvolutionBorderColor[1]); + break; + case GL_REPLICATE_BORDER: + convolve_2d_replicate(*width, *height, + (const GLfloat (*)[4]) srcImage, + ctx->Convolution2D.Width, + ctx->Convolution2D.Height, + (const GLfloat (*)[4])ctx->Convolution2D.Filter, + (GLfloat (*)[4]) dstImage); + break; + default: + ; + } +} + + +void +_mesa_convolve_sep_image(const GLcontext *ctx, + GLsizei *width, GLsizei *height, + const GLfloat *srcImage, GLfloat *dstImage) +{ + const GLfloat *rowFilter = ctx->Separable2D.Filter; + const GLfloat *colFilter = rowFilter + 4 * MAX_CONVOLUTION_WIDTH; + + switch (ctx->Pixel.ConvolutionBorderMode[2]) { + case GL_REDUCE: + convolve_sep_reduce(*width, *height, + (const GLfloat (*)[4]) srcImage, + ctx->Separable2D.Width, + ctx->Separable2D.Height, + (const GLfloat (*)[4]) rowFilter, + (const GLfloat (*)[4]) colFilter, + (GLfloat (*)[4]) dstImage); + *width = *width - (MAX2(ctx->Separable2D.Width, 1) - 1); + *height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1); + break; + case GL_CONSTANT_BORDER: + convolve_sep_constant(*width, *height, + (const GLfloat (*)[4]) srcImage, + ctx->Separable2D.Width, + ctx->Separable2D.Height, + (const GLfloat (*)[4]) rowFilter, + (const GLfloat (*)[4]) colFilter, + (GLfloat (*)[4]) dstImage, + ctx->Pixel.ConvolutionBorderColor[2]); + break; + case GL_REPLICATE_BORDER: + convolve_sep_replicate(*width, *height, + (const GLfloat (*)[4]) srcImage, + ctx->Separable2D.Width, + ctx->Separable2D.Height, + (const GLfloat (*)[4]) rowFilter, + (const GLfloat (*)[4]) colFilter, + (GLfloat (*)[4]) dstImage); + break; + default: + ; + } +} + + + +/* + * This function computes an image's size after convolution. + * If the convolution border mode is GL_REDUCE, the post-convolution + * image will be smaller than the original. + */ +void +_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions, + GLsizei *width, GLsizei *height) +{ + if (ctx->Pixel.Convolution1DEnabled + && dimensions == 1 + && ctx->Pixel.ConvolutionBorderMode[0] == GL_REDUCE) { + *width = *width - (MAX2(ctx->Convolution1D.Width, 1) - 1); + } + else if (ctx->Pixel.Convolution2DEnabled + && dimensions > 1 + && ctx->Pixel.ConvolutionBorderMode[1] == GL_REDUCE) { + *width = *width - (MAX2(ctx->Convolution2D.Width, 1) - 1); + *height = *height - (MAX2(ctx->Convolution2D.Height, 1) - 1); + } + else if (ctx->Pixel.Separable2DEnabled + && dimensions > 1 + && ctx->Pixel.ConvolutionBorderMode[2] == GL_REDUCE) { + *width = *width - (MAX2(ctx->Separable2D.Width, 1) - 1); + *height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1); + } +} diff --git a/reactos/dll/mesa32/src/main/convolve.h b/reactos/dll/mesa32/src/main/convolve.h new file mode 100644 index 00000000000..4505cdae01e --- /dev/null +++ b/reactos/dll/mesa32/src/main/convolve.h @@ -0,0 +1,114 @@ + +/* + * 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 CONVOLVE_H +#define CONVOLVE_H + + +#include "mtypes.h" + + +#if _HAVE_FULL_GL +extern void GLAPIENTRY +_mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, + GLenum format, GLenum type, const GLvoid *image); + +extern void GLAPIENTRY +_mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, + GLsizei height, GLenum format, GLenum type, + const GLvoid *image); + +extern void GLAPIENTRY +_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat params); + +extern void GLAPIENTRY +_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, + const GLfloat *params); + +extern void GLAPIENTRY +_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint params); + +extern void GLAPIENTRY +_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params); + +extern void GLAPIENTRY +_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width); + +extern void GLAPIENTRY +_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width, GLsizei height); + +extern void GLAPIENTRY +_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, + GLvoid *image); + +extern void GLAPIENTRY +_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params); + +extern void GLAPIENTRY +_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params); + +extern void GLAPIENTRY +_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, + GLvoid *row, GLvoid *column, GLvoid *span); + +extern void GLAPIENTRY +_mesa_SeparableFilter2D(GLenum target, GLenum internalformat, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *row, const GLvoid *column); + + + +extern void +_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width, + const GLfloat *srcImage, GLfloat *dstImage); + + +extern void +_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, + const GLfloat *srcImage, GLfloat *dstImage); + + +extern void +_mesa_convolve_sep_image(const GLcontext *ctx, + GLsizei *width, GLsizei *height, + const GLfloat *srcImage, GLfloat *dstImage); + + +extern void +_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions, + GLsizei *width, GLsizei *height); + +#else +#define _mesa_adjust_image_for_convolution(c, d, w, h) ((void)0) +#define _mesa_convolve_1d_image(c,w,s,d) ((void)0) +#define _mesa_convolve_2d_image(c,w,h,s,d) ((void)0) +#define _mesa_convolve_sep_image(c,w,h,s,d) ((void)0) +#endif + +#endif diff --git a/reactos/dll/mesa32/src/main/dd.h b/reactos/dll/mesa32/src/main/dd.h new file mode 100644 index 00000000000..e4c103c55e4 --- /dev/null +++ b/reactos/dll/mesa32/src/main/dd.h @@ -0,0 +1,1063 @@ +/** + * \file dd.h + * Device driver interfaces. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 DD_INCLUDED +#define DD_INCLUDED + +/* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */ + +struct gl_pixelstore_attrib; +struct mesa_display_list; + +/** + * Device driver function table. + * Core Mesa uses these function pointers to call into device drivers. + * Most of these functions directly correspond to OpenGL state commands. + * Core Mesa will call these functions after error checking has been done + * so that the drivers don't have to worry about error testing. + * + * Vertex transformation/clipping/lighting is patched into the T&L module. + * Rasterization functions are patched into the swrast module. + * + * Note: when new functions are added here, the drivers/common/driverfuncs.c + * file should be updated too!!! + */ +struct dd_function_table { + /** + * Return a string as needed by glGetString(). + * + * Only the GL_RENDERER token must be implemented. Otherwise, NULL can be + * returned. + */ + const GLubyte * (*GetString)( GLcontext *ctx, GLenum name ); + + /** + * Notify the driver after Mesa has made some internal state changes. + * + * This is in addition to any state change callbacks Mesa may already have + * made. + */ + void (*UpdateState)( GLcontext *ctx, GLuint new_state ); + + /** + * Get the width and height of the named buffer/window. + * + * Mesa uses this to determine when the driver's window size has changed. + */ + void (*GetBufferSize)( GLframebuffer *buffer, + GLuint *width, GLuint *height ); + + /** + * Resize the given framebuffer to the given size. + */ + void (*ResizeBuffers)( GLcontext *ctx, GLframebuffer *fb, + GLuint width, GLuint height); + + /** + * Called whenever an error is generated. + * + * __GLcontextRec::ErrorValue contains the error value. + */ + void (*Error)( GLcontext *ctx ); + + /** + * This is called whenever glFinish() is called. + */ + void (*Finish)( GLcontext *ctx ); + + /** + * This is called whenever glFlush() is called. + */ + void (*Flush)( GLcontext *ctx ); + + /** + * Clear the color/depth/stencil/accum buffer(s). + * + * \param mask a bitmask of the DD_*_BIT values defined above that indicates + * which buffers need to be cleared. + * \param all if true then clear the whole buffer, else clear only the + * region defined by (x, y, width, height). + * + * This function must obey the glColorMask(), glIndexMask() and + * glStencilMask() settings! + * Software Mesa can do masked clears if the device driver can't. + */ + void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all, + GLint x, GLint y, GLint width, GLint height ); + + + /** + * \name For hardware accumulation buffer + */ + /*@{*/ + /** + * Execute glAccum command within the given scissor region. + */ + void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value, + GLint xpos, GLint ypos, GLint width, GLint height ); + /*@}*/ + + + /** + * \name glDraw(), glRead(), glCopyPixels() and glBitmap() functions + */ + /*@{*/ + + /** + * This is called by glDrawPixels(). + * + * \p unpack describes how to unpack the source image data. + */ + void (*DrawPixels)( GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ); + + /** + * Called by glReadPixels(). + */ + void (*ReadPixels)( GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + GLvoid *dest ); + + /** + * Do a glCopyPixels(). + * + * This function must respect all rasterization state, glPixelTransfer(), + * glPixelZoom(), etc. + */ + void (*CopyPixels)( GLcontext *ctx, GLint srcx, GLint srcy, + GLsizei width, GLsizei height, + GLint dstx, GLint dsty, GLenum type ); + + /** + * This is called by glBitmap(). + * + * Works the same as dd_function_table::DrawPixels, above. + */ + void (*Bitmap)( GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ); + /*@}*/ + + + /** + * \name Texture image functions + */ + /*@{*/ + + /** + * Choose texture format. + * + * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback + * functions. The driver should examine \p internalFormat and return a + * pointer to an appropriate gl_texture_format. + */ + const struct gl_texture_format *(*ChooseTextureFormat)( GLcontext *ctx, + GLint internalFormat, GLenum srcFormat, GLenum srcType ); + + /** + * Called by glTexImage1D(). + * + * \param target user specified. + * \param format user specified. + * \param type user specified. + * \param pixels user specified. + * \param packing indicates the image packing of pixels. + * \param texObj is the target texture object. + * \param texImage is the target texture image. It will have the texture \p + * width, \p height, \p depth, \p border and \p internalFormat information. + * + * \p retainInternalCopy is returned by this function and indicates whether + * core Mesa should keep an internal copy of the texture image. + * + * Drivers should call a fallback routine from texstore.c if needed. + */ + void (*TexImage1D)( GLcontext *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 ); + + /** + * Called by glTexImage2D(). + * + * \sa dd_function_table::TexImage1D. + */ + void (*TexImage2D)( GLcontext *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 ); + + /** + * Called by glTexImage3D(). + * + * \sa dd_function_table::TexImage1D. + */ + void (*TexImage3D)( GLcontext *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 ); + + /** + * Called by glTexSubImage1D(). + * + * \param target user specified. + * \param level user specified. + * \param xoffset user specified. + * \param yoffset user specified. + * \param zoffset user specified. + * \param width user specified. + * \param height user specified. + * \param depth user specified. + * \param format user specified. + * \param type user specified. + * \param pixels user specified. + * \param packing indicates the image packing of pixels. + * \param texObj is the target texture object. + * \param texImage is the target texture image. It will have the texture \p + * width, \p height, \p border and \p internalFormat information. + * + * The driver should use a fallback routine from texstore.c if needed. + */ + void (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLsizei width, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + + /** + * Called by glTexSubImage2D(). + * + * \sa dd_function_table::TexSubImage1D. + */ + void (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + + /** + * Called by glTexSubImage3D(). + * + * \sa dd_function_table::TexSubImage1D. + */ + void (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei 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 ); + + /** + * Called by glGetTexImage(). + */ + void (*GetTexImage)( GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, GLvoid *pixels, + const struct gl_texture_object *texObj, + const struct gl_texture_image *texImage ); + + /** + * Called by glCopyTexImage1D(). + * + * Drivers should use a fallback routine from texstore.c if needed. + */ + void (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level, + GLenum internalFormat, GLint x, GLint y, + GLsizei width, GLint border ); + + /** + * Called by glCopyTexImage2D(). + * + * Drivers should use a fallback routine from texstore.c if needed. + */ + void (*CopyTexImage2D)( GLcontext *ctx, GLenum target, GLint level, + GLenum internalFormat, GLint x, GLint y, + GLsizei width, GLsizei height, GLint border ); + + /** + * Called by glCopyTexSubImage1D(). + * + * Drivers should use a fallback routine from texstore.c if needed. + */ + void (*CopyTexSubImage1D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, + GLint x, GLint y, GLsizei width ); + /** + * Called by glCopyTexSubImage2D(). + * + * Drivers should use a fallback routine from texstore.c if needed. + */ + void (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + /** + * Called by glCopyTexSubImage3D(). + * + * Drivers should use a fallback routine from texstore.c if needed. + */ + void (*CopyTexSubImage3D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + + /** + * Called by glTexImage[123]D when user specifies a proxy texture + * target. + * + * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails. + */ + GLboolean (*TestProxyTexImage)(GLcontext *ctx, GLenum target, + GLint level, GLint internalFormat, + GLenum format, GLenum type, + GLint width, GLint height, + GLint depth, GLint border); + /*@}*/ + + + /** + * \name Compressed texture functions + */ + /*@{*/ + + /** + * Called by glCompressedTexImage1D(). + * + * \param target user specified. + * \param format user specified. + * \param type user specified. + * \param pixels user specified. + * \param packing indicates the image packing of pixels. + * \param texObj is the target texture object. + * \param texImage is the target texture image. It will have the texture \p + * width, \p height, \p depth, \p border and \p internalFormat information. + * + * \a retainInternalCopy is returned by this function and indicates whether + * core Mesa should keep an internal copy of the texture image. + */ + void (*CompressedTexImage1D)( GLcontext *ctx, GLenum target, + GLint level, GLint internalFormat, + GLsizei width, GLint border, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + /** + * Called by glCompressedTexImage2D(). + * + * \sa dd_function_table::CompressedTexImage1D. + */ + void (*CompressedTexImage2D)( GLcontext *ctx, GLenum target, + GLint level, GLint internalFormat, + GLsizei width, GLsizei height, GLint border, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + /** + * Called by glCompressedTexImage3D(). + * + * \sa dd_function_table::CompressedTexImage3D. + */ + void (*CompressedTexImage3D)( GLcontext *ctx, GLenum target, + GLint level, GLint internalFormat, + GLsizei width, GLsizei height, GLsizei depth, + GLint border, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + + /** + * Called by glCompressedTexSubImage1D(). + * + * \param target user specified. + * \param level user specified. + * \param xoffset user specified. + * \param yoffset user specified. + * \param zoffset user specified. + * \param width user specified. + * \param height user specified. + * \param depth user specified. + * \param imageSize user specified. + * \param data user specified. + * \param texObj is the target texture object. + * \param texImage is the target texture image. It will have the texture \p + * width, \p height, \p depth, \p border and \p internalFormat information. + */ + void (*CompressedTexSubImage1D)(GLcontext *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); + /** + * Called by glCompressedTexSubImage2D(). + * + * \sa dd_function_table::CompressedTexImage3D. + */ + void (*CompressedTexSubImage2D)(GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLint height, + GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage); + /** + * Called by glCompressedTexSubImage3D(). + * + * \sa dd_function_table::CompressedTexImage3D. + */ + void (*CompressedTexSubImage3D)(GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLint height, GLint depth, + GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage); + + + /** + * Called by glGetCompressedTexImage. + */ + void (*GetCompressedTexImage)(GLcontext *ctx, GLenum target, GLint level, + GLvoid *img, + const struct gl_texture_object *texObj, + const struct gl_texture_image *texImage); + + /** + * Called to query number of bytes of storage needed to store the + * specified compressed texture. + */ + GLuint (*CompressedTextureSize)( GLcontext *ctx, GLsizei width, + GLsizei height, GLsizei depth, + GLenum format ); + /*@}*/ + + /** + * \name Texture object functions + */ + /*@{*/ + + /** + * Called by glBindTexture(). + */ + void (*BindTexture)( GLcontext *ctx, GLenum target, + struct gl_texture_object *tObj ); + + /** + * Called to allocate a new texture object. + * A new gl_texture_object should be returned. The driver should + * attach to it any device-specific info it needs. + */ + struct gl_texture_object * (*NewTextureObject)( GLcontext *ctx, GLuint name, + GLenum target ); + /** + * Called when a texture object is about to be deallocated. + * + * Driver should delete the gl_texture_object object and anything + * hanging off of it. + */ + void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj ); + + /** + * Called to allocate a new texture image object. + */ + struct gl_texture_image * (*NewTextureImage)( GLcontext *ctx ); + + /** + * Called to free tImage->Data. + */ + void (*FreeTexImageData)( GLcontext *ctx, struct gl_texture_image *tImage ); + + /** + * Note: no context argument. This function doesn't initially look + * like it belongs here, except that the driver is the only entity + * that knows for sure how the texture memory is allocated - via + * the above callbacks. There is then an argument that the driver + * knows what memcpy paths might be fast. Typically this is invoked with + * + * to -- a pointer into texture memory allocated by NewTextureImage() above. + * from -- a pointer into client memory or a mesa temporary. + * sz -- nr bytes to copy. + */ + void* (*TextureMemCpy)( void *to, const void *from, size_t sz ); + + /** + * Called by glAreTextureResident(). + */ + GLboolean (*IsTextureResident)( GLcontext *ctx, + struct gl_texture_object *t ); + + /** + * Called by glPrioritizeTextures(). + */ + void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t, + GLclampf priority ); + + /** + * Called by glActiveTextureARB() to set current texture unit. + */ + void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber ); + + /** + * Called when the texture's color lookup table is changed. + * + * If \p tObj is NULL then the shared texture palette + * gl_texture_object::Palette is to be updated. + */ + void (*UpdateTexturePalette)( GLcontext *ctx, + struct gl_texture_object *tObj ); + /*@}*/ + + + /** + * \name Imaging functionality + */ + /*@{*/ + void (*CopyColorTable)( GLcontext *ctx, + GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width ); + + void (*CopyColorSubTable)( GLcontext *ctx, + GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width ); + + void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target, + GLenum internalFormat, + GLint x, GLint y, GLsizei width ); + + void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target, + GLenum internalFormat, + GLint x, GLint y, + GLsizei width, GLsizei height ); + /*@}*/ + + + /** + * \name Vertex/fragment program functions + */ + /*@{*/ + /** Bind a vertex/fragment program */ + void (*BindProgram)(GLcontext *ctx, GLenum target, struct program *prog); + /** Allocate a new program */ + struct program * (*NewProgram)(GLcontext *ctx, GLenum target, GLuint id); + /** Delete a program */ + void (*DeleteProgram)(GLcontext *ctx, struct program *prog); + /** Notify driver that a program string has been specified. */ + void (*ProgramStringNotify)(GLcontext *ctx, GLenum target, + struct program *prog); + + + + /** Query if program can be loaded onto hardware */ + GLboolean (*IsProgramNative)(GLcontext *ctx, GLenum target, + struct program *prog); + + /*@}*/ + + + /** + * \name State-changing functions. + * + * \note drawing functions are above. + * + * These functions are called by their corresponding OpenGL API functions. + * They are \e also called by the gl_PopAttrib() function!!! + * May add more functions like these to the device driver in the future. + */ + /*@{*/ + /** Specify the alpha test function */ + void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLfloat ref); + /** Set the blend color */ + void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]); + /** Set the blend equation */ + void (*BlendEquationSeparate)(GLcontext *ctx, GLenum modeRGB, GLenum modeA); + /** Specify pixel arithmetic */ + void (*BlendFuncSeparate)(GLcontext *ctx, + GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA); + /** Specify clear values for the color buffers */ + void (*ClearColor)(GLcontext *ctx, const GLfloat color[4]); + /** Specify the clear value for the depth buffer */ + void (*ClearDepth)(GLcontext *ctx, GLclampd d); + /** Specify the clear value for the color index buffers */ + void (*ClearIndex)(GLcontext *ctx, GLuint index); + /** Specify the clear value for the stencil buffer */ + void (*ClearStencil)(GLcontext *ctx, GLint s); + /** Specify a plane against which all geometry is clipped */ + void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation ); + /** Enable and disable writing of frame buffer color components */ + void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask, + GLboolean bmask, GLboolean amask ); + /** Cause a material color to track the current color */ + void (*ColorMaterial)(GLcontext *ctx, GLenum face, GLenum mode); + /** Specify whether front- or back-facing facets can be culled */ + void (*CullFace)(GLcontext *ctx, GLenum mode); + /** Define front- and back-facing polygons */ + void (*FrontFace)(GLcontext *ctx, GLenum mode); + /** Specify the value used for depth buffer comparisons */ + void (*DepthFunc)(GLcontext *ctx, GLenum func); + /** Enable or disable writing into the depth buffer */ + void (*DepthMask)(GLcontext *ctx, GLboolean flag); + /** Specify mapping of depth values from NDC to window coordinates */ + void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval); + /** Specify the current buffer for writing */ + void (*DrawBuffer)( GLcontext *ctx, GLenum buffer ); + /** Specify the buffers for writing for fragment programs*/ + void (*DrawBuffers)( GLcontext *ctx, GLsizei n, const GLenum *buffers ); + /** Enable or disable server-side gl capabilities */ + void (*Enable)(GLcontext *ctx, GLenum cap, GLboolean state); + /** Specify fog parameters */ + void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); + /** Specify implementation-specific hints */ + void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode); + /** Control the writing of individual bits in the color index buffers */ + void (*IndexMask)(GLcontext *ctx, GLuint mask); + /** Set light source parameters */ + void (*Lightfv)(GLcontext *ctx, GLenum light, + GLenum pname, const GLfloat *params ); + /** Set the lighting model parameters */ + void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); + /** Specify the line stipple pattern */ + void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern ); + /** Specify the width of rasterized lines */ + void (*LineWidth)(GLcontext *ctx, GLfloat width); + /** Specify a logical pixel operation for color index rendering */ + void (*LogicOpcode)(GLcontext *ctx, GLenum opcode); + void (*PointParameterfv)(GLcontext *ctx, GLenum pname, + const GLfloat *params); + /** Specify the diameter of rasterized points */ + void (*PointSize)(GLcontext *ctx, GLfloat size); + /** Select a polygon rasterization mode */ + void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode); + /** Set the scale and units used to calculate depth values */ + void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units); + /** Set the polygon stippling pattern */ + void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask ); + /* Specifies the current buffer for reading */ + void (*ReadBuffer)( GLcontext *ctx, GLenum buffer ); + /** Set rasterization mode */ + void (*RenderMode)(GLcontext *ctx, GLenum mode ); + /** Define the scissor box */ + void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); + /** Select flat or smooth shading */ + void (*ShadeModel)(GLcontext *ctx, GLenum mode); + /** Set function and reference value for stencil testing */ + void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask); + /** Control the writing of individual bits in the stencil planes */ + void (*StencilMask)(GLcontext *ctx, GLuint mask); + /** Set stencil test actions */ + void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass); + /** Set active stencil face (GL_EXT_stencil_two_side) */ + void (*ActiveStencilFace)(GLcontext *ctx, GLuint face); + /** OpenGL 2.0 two-sided StencilFunc */ + void (*StencilFuncSeparate)(GLcontext *ctx, GLenum face, GLenum func, + GLint ref, GLuint mask); + /** OpenGL 2.0 two-sided StencilMask */ + void (*StencilMaskSeparate)(GLcontext *ctx, GLenum face, GLuint mask); + /** OpenGL 2.0 two-sided StencilOp */ + void (*StencilOpSeparate)(GLcontext *ctx, GLenum face, GLenum fail, + GLenum zfail, GLenum zpass); + /** Control the generation of texture coordinates */ + void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname, + const GLfloat *params); + /** Set texture environment parameters */ + void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname, + const GLfloat *param); + /** Set texture parameters */ + void (*TexParameter)(GLcontext *ctx, GLenum target, + struct gl_texture_object *texObj, + GLenum pname, const GLfloat *params); + void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat); + /** Set the viewport */ + void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); + /*@}*/ + + + /** + * \name Vertex array functions + * + * Called by the corresponding OpenGL functions. + */ + /*@{*/ + void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr); + void (*NormalPointer)(GLcontext *ctx, GLenum type, + GLsizei stride, const GLvoid *ptr); + void (*ColorPointer)(GLcontext *ctx, GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr); + void (*FogCoordPointer)(GLcontext *ctx, GLenum type, + GLsizei stride, const GLvoid *ptr); + void (*IndexPointer)(GLcontext *ctx, GLenum type, + GLsizei stride, const GLvoid *ptr); + void (*SecondaryColorPointer)(GLcontext *ctx, GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr); + void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr); + void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr); + void (*VertexAttribPointer)(GLcontext *ctx, GLuint index, GLint size, + GLenum type, GLsizei stride, const GLvoid *ptr); + void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count ); + void (*UnlockArraysEXT)( GLcontext *ctx ); + /*@}*/ + + + /** + * \name State-query functions + * + * Return GL_TRUE if query was completed, GL_FALSE otherwise. + */ + /*@{*/ + /** Return the value or values of a selected parameter */ + GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result); + /** Return the value or values of a selected parameter */ + GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result); + /** Return the value or values of a selected parameter */ + GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result); + /** Return the value or values of a selected parameter */ + GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result); + /** Return the value or values of a selected parameter */ + GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result); + /*@}*/ + + + /** + * \name Vertex/pixel buffer object functions + */ +#if FEATURE_ARB_vertex_buffer_object + /*@{*/ + void (*BindBuffer)( GLcontext *ctx, GLenum target, + struct gl_buffer_object *obj ); + + struct gl_buffer_object * (*NewBufferObject)( GLcontext *ctx, GLuint buffer, + GLenum target ); + + void (*DeleteBuffer)( GLcontext *ctx, struct gl_buffer_object *obj ); + + void (*BufferData)( GLcontext *ctx, GLenum target, GLsizeiptrARB size, + const GLvoid *data, GLenum usage, + struct gl_buffer_object *obj ); + + void (*BufferSubData)( GLcontext *ctx, GLenum target, GLintptrARB offset, + GLsizeiptrARB size, const GLvoid *data, + struct gl_buffer_object *obj ); + + void (*GetBufferSubData)( GLcontext *ctx, GLenum target, + GLintptrARB offset, GLsizeiptrARB size, + GLvoid *data, struct gl_buffer_object *obj ); + + void * (*MapBuffer)( GLcontext *ctx, GLenum target, GLenum access, + struct gl_buffer_object *obj ); + + GLboolean (*UnmapBuffer)( GLcontext *ctx, GLenum target, + struct gl_buffer_object *obj ); + /*@}*/ +#endif + + /** + * \name Functions for GL_EXT_framebuffer_object + */ +#if FEATURE_EXT_framebuffer_object + /*@{*/ + struct gl_framebuffer * (*NewFramebuffer)(GLcontext *ctx, GLuint name); + struct gl_renderbuffer * (*NewRenderbuffer)(GLcontext *ctx, GLuint name); + void (*FramebufferRenderbuffer)(GLcontext *ctx, + struct gl_renderbuffer_attachment *att, + struct gl_renderbuffer *rb); + void (*RenderbufferTexture)(GLcontext *ctx, + struct gl_renderbuffer_attachment *att, + struct gl_texture_object *texObj, + GLenum texTarget, GLuint level, GLuint zoffset); + /*@}*/ +#endif + + + /** + * \name Support for multiple T&L engines + */ + /*@{*/ + + /** + * Bitmask of state changes that require the current T&L module to be + * validated, using ValidateTnlModule() below. + */ + GLuint NeedValidate; + + /** + * Validate the current T&L module. + * + * This is called directly after UpdateState() when a state change that has + * occurred matches the dd_function_table::NeedValidate bitmask above. This + * ensures all computed values are up to date, thus allowing the driver to + * decide if the current T&L module needs to be swapped out. + * + * This must be non-NULL if a driver installs a custom T&L module and sets + * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise. + */ + void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state ); + + +#define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1 +#define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2 +#define PRIM_UNKNOWN GL_POLYGON+3 + + /** + * Set by the driver-supplied T&L engine. + * + * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd(). + */ + GLuint CurrentExecPrimitive; + + /** + * Current state of an in-progress compilation. + * + * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END, + * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above. + */ + GLuint CurrentSavePrimitive; + + +#define FLUSH_STORED_VERTICES 0x1 +#define FLUSH_UPDATE_CURRENT 0x2 + /** + * Set by the driver-supplied T&L engine whenever vertices are buffered + * between glBegin()/glEnd() objects or __GLcontextRec::Current is not + * updated. + * + * The dd_function_table::FlushVertices call below may be used to resolve + * these conditions. + */ + GLuint NeedFlush; + GLuint SaveNeedFlush; + + /** + * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if + * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered + * vertices, if FLUSH_UPDATE_CURRENT bit is set updates + * __GLcontextRec::Current and gl_light_attrib::Material + * + * Note that the default T&L engine never clears the + * FLUSH_UPDATE_CURRENT bit, even after performing the update. + */ + void (*FlushVertices)( GLcontext *ctx, GLuint flags ); + void (*SaveFlushVertices)( GLcontext *ctx ); + + /** + * Give the driver the opportunity to hook in its own vtxfmt for + * compiling optimized display lists. This is called on each valid + * glBegin() during list compilation. + */ + GLboolean (*NotifySaveBegin)( GLcontext *ctx, GLenum mode ); + + /** + * Notify driver that the special derived value _NeedEyeCoords has + * changed. + */ + void (*LightingSpaceChange)( GLcontext *ctx ); + + /** + * Let the T&L component know when the context becomes current. + */ + void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer, + GLframebuffer *readBuffer ); + + /** + * Called by glNewList(). + * + * Let the T&L component know what is going on with display lists + * in time to make changes to dispatch tables, etc. + */ + void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode ); + /** + * Called by glEndList(). + * + * \sa dd_function_table::NewList. + */ + void (*EndList)( GLcontext *ctx ); + + /** + * Called by glCallList(s). + * + * Notify the T&L component before and after calling a display list. + */ + void (*BeginCallList)( GLcontext *ctx, + struct mesa_display_list *dlist ); + /** + * Called by glEndCallList(). + * + * \sa dd_function_table::BeginCallList. + */ + void (*EndCallList)( GLcontext *ctx ); + +}; + + +/** + * Transform/Clip/Lighting interface + * + * Drivers present a reduced set of the functions possible in + * glBegin()/glEnd() objects. Core mesa provides translation stubs for the + * remaining functions to map down to these entry points. + * + * These are the initial values to be installed into dispatch by + * mesa. If the T&L driver wants to modify the dispatch table + * while installed, it must do so itself. It would be possible for + * the vertexformat to install it's own initial values for these + * functions, but this way there is an obvious list of what is + * expected of the driver. + * + * If the driver wants to hook in entry points other than those + * listed, it must restore them to their original values in + * the disable() callback, below. + */ +typedef struct { + /** + * \name Vertex + */ + /*@{*/ + void (GLAPIENTRYP ArrayElement)( GLint ); /* NOTE */ + void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Color3fv)( const GLfloat * ); + void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Color4fv)( const GLfloat * ); + void (GLAPIENTRYP EdgeFlag)( GLboolean ); + void (GLAPIENTRYP EdgeFlagv)( const GLboolean * ); + void (GLAPIENTRYP EvalCoord1f)( GLfloat ); /* NOTE */ + void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * ); /* NOTE */ + void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */ + void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * ); /* NOTE */ + void (GLAPIENTRYP EvalPoint1)( GLint ); /* NOTE */ + void (GLAPIENTRYP EvalPoint2)( GLint, GLint ); /* NOTE */ + void (GLAPIENTRYP FogCoordfEXT)( GLfloat ); + void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * ); + void (GLAPIENTRYP Indexf)( GLfloat ); + void (GLAPIENTRYP Indexfv)( const GLfloat * ); + void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */ + void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat ); + void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * ); + void (GLAPIENTRYP MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat ); + void (GLAPIENTRYP MultiTexCoord2fvARB)( GLenum, const GLfloat * ); + void (GLAPIENTRYP MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP MultiTexCoord3fvARB)( GLenum, const GLfloat * ); + void (GLAPIENTRYP MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP MultiTexCoord4fvARB)( GLenum, const GLfloat * ); + void (GLAPIENTRYP Normal3f)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Normal3fv)( const GLfloat * ); + void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * ); + void (GLAPIENTRYP TexCoord1f)( GLfloat ); + void (GLAPIENTRYP TexCoord1fv)( const GLfloat * ); + void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat ); + void (GLAPIENTRYP TexCoord2fv)( const GLfloat * ); + void (GLAPIENTRYP TexCoord3f)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP TexCoord3fv)( const GLfloat * ); + void (GLAPIENTRYP TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP TexCoord4fv)( const GLfloat * ); + void (GLAPIENTRYP Vertex2f)( GLfloat, GLfloat ); + void (GLAPIENTRYP Vertex2fv)( const GLfloat * ); + void (GLAPIENTRYP Vertex3f)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Vertex3fv)( const GLfloat * ); + void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Vertex4fv)( const GLfloat * ); + void (GLAPIENTRYP CallList)( GLuint ); /* NOTE */ + void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * ); /* NOTE */ + void (GLAPIENTRYP Begin)( GLenum ); + void (GLAPIENTRYP End)( void ); + void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x ); + void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y ); + void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z ); + void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); + void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x ); + void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y ); + void (GLAPIENTRYP VertexAttrib2fvARB)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib3fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z ); + void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); + void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v ); + /*@}*/ + + /* + */ + void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat ); + + /** + * \name Array + */ + /*@{*/ + void (GLAPIENTRYP DrawArrays)( GLenum mode, GLint start, GLsizei count ); + void (GLAPIENTRYP DrawElements)( GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices ); + void (GLAPIENTRYP DrawRangeElements)( GLenum mode, GLuint start, + GLuint end, GLsizei count, + GLenum type, const GLvoid *indices ); + /*@}*/ + + /** + * \name Eval + * + * If you don't support eval, fallback to the default vertex format + * on receiving an eval call and use the pipeline mechanism to + * provide partial T&L acceleration. + * + * Mesa will provide a set of helper functions to do eval within + * accelerated vertex formats, eventually... + */ + /*@{*/ + void (GLAPIENTRYP EvalMesh1)( GLenum mode, GLint i1, GLint i2 ); + void (GLAPIENTRYP EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); + /*@}*/ + +} GLvertexformat; + + +#endif /* DD_INCLUDED */ diff --git a/reactos/dll/mesa32/src/main/debug.c b/reactos/dll/mesa32/src/main/debug.c new file mode 100644 index 00000000000..edc32b1f94d --- /dev/null +++ b/reactos/dll/mesa32/src/main/debug.c @@ -0,0 +1,218 @@ +/* + * 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. + */ + +#include "mtypes.h" +#include "context.h" +#include "imports.h" +#include "debug.h" +#include "get.h" + +/** + * Primitive names + */ +const char *_mesa_prim_name[GL_POLYGON+4] = { + "GL_POINTS", + "GL_LINES", + "GL_LINE_LOOP", + "GL_LINE_STRIP", + "GL_TRIANGLES", + "GL_TRIANGLE_STRIP", + "GL_TRIANGLE_FAN", + "GL_QUADS", + "GL_QUAD_STRIP", + "GL_POLYGON", + "outside begin/end", + "inside unkown primitive", + "unknown state" +}; + +void +_mesa_print_state( const char *msg, GLuint state ) +{ + _mesa_debug(NULL, + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + msg, + state, + (state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "", + (state & _NEW_PROJECTION) ? "ctx->Projection, " : "", + (state & _NEW_TEXTURE_MATRIX) ? "ctx->TextureMatrix, " : "", + (state & _NEW_COLOR_MATRIX) ? "ctx->ColorMatrix, " : "", + (state & _NEW_ACCUM) ? "ctx->Accum, " : "", + (state & _NEW_COLOR) ? "ctx->Color, " : "", + (state & _NEW_DEPTH) ? "ctx->Depth, " : "", + (state & _NEW_EVAL) ? "ctx->Eval/EvalMap, " : "", + (state & _NEW_FOG) ? "ctx->Fog, " : "", + (state & _NEW_HINT) ? "ctx->Hint, " : "", + (state & _NEW_LIGHT) ? "ctx->Light, " : "", + (state & _NEW_LINE) ? "ctx->Line, " : "", + (state & _NEW_PIXEL) ? "ctx->Pixel, " : "", + (state & _NEW_POINT) ? "ctx->Point, " : "", + (state & _NEW_POLYGON) ? "ctx->Polygon, " : "", + (state & _NEW_POLYGONSTIPPLE) ? "ctx->PolygonStipple, " : "", + (state & _NEW_SCISSOR) ? "ctx->Scissor, " : "", + (state & _NEW_TEXTURE) ? "ctx->Texture, " : "", + (state & _NEW_TRANSFORM) ? "ctx->Transform, " : "", + (state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "", + (state & _NEW_PACKUNPACK) ? "ctx->Pack/Unpack, " : "", + (state & _NEW_ARRAY) ? "ctx->Array, " : "", + (state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "", + (state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : ""); +} + + + +void +_mesa_print_tri_caps( const char *name, GLuint flags ) +{ + _mesa_debug(NULL, + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + name, + flags, + (flags & DD_FLATSHADE) ? "flat-shade, " : "", + (flags & DD_SEPARATE_SPECULAR) ? "separate-specular, " : "", + (flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "", + (flags & DD_TRI_TWOSTENCIL) ? "tri-twostencil, " : "", + (flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : "", + (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "", + (flags & DD_TRI_OFFSET) ? "tri-offset, " : "", + (flags & DD_TRI_SMOOTH) ? "tri-smooth, " : "", + (flags & DD_LINE_SMOOTH) ? "line-smooth, " : "", + (flags & DD_LINE_STIPPLE) ? "line-stipple, " : "", + (flags & DD_LINE_WIDTH) ? "line-wide, " : "", + (flags & DD_POINT_SMOOTH) ? "point-smooth, " : "", + (flags & DD_POINT_SIZE) ? "point-size, " : "", + (flags & DD_POINT_ATTEN) ? "point-atten, " : "", + (flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : "" + ); +} + + +/** + * Print information about this Mesa version and build options. + */ +void _mesa_print_info( void ) +{ + _mesa_debug(NULL, "Mesa GL_VERSION = %s\n", + (char *) _mesa_GetString(GL_VERSION)); + _mesa_debug(NULL, "Mesa GL_RENDERER = %s\n", + (char *) _mesa_GetString(GL_RENDERER)); + _mesa_debug(NULL, "Mesa GL_VENDOR = %s\n", + (char *) _mesa_GetString(GL_VENDOR)); + _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", + (char *) _mesa_GetString(GL_EXTENSIONS)); +#if defined(THREADS) + _mesa_debug(NULL, "Mesa thread-safe: YES\n"); +#else + _mesa_debug(NULL, "Mesa thread-safe: NO\n"); +#endif +#if defined(USE_X86_ASM) + _mesa_debug(NULL, "Mesa x86-optimized: YES\n"); +#else + _mesa_debug(NULL, "Mesa x86-optimized: NO\n"); +#endif +#if defined(USE_SPARC_ASM) + _mesa_debug(NULL, "Mesa sparc-optimized: YES\n"); +#else + _mesa_debug(NULL, "Mesa sparc-optimized: NO\n"); +#endif +} + + +/** + * Set the debugging flags. + * + * \param debug debug string + * + * If compiled with debugging support then search for keywords in \p debug and + * enables the verbose debug output of the respective feature. + */ +static void add_debug_flags( const char *debug ) +{ +#ifdef MESA_DEBUG + if (_mesa_strstr(debug, "varray")) + MESA_VERBOSE |= VERBOSE_VARRAY; + + if (_mesa_strstr(debug, "tex")) + MESA_VERBOSE |= VERBOSE_TEXTURE; + + if (_mesa_strstr(debug, "imm")) + MESA_VERBOSE |= VERBOSE_IMMEDIATE; + + if (_mesa_strstr(debug, "pipe")) + MESA_VERBOSE |= VERBOSE_PIPELINE; + + if (_mesa_strstr(debug, "driver")) + MESA_VERBOSE |= VERBOSE_DRIVER; + + if (_mesa_strstr(debug, "state")) + MESA_VERBOSE |= VERBOSE_STATE; + + if (_mesa_strstr(debug, "api")) + MESA_VERBOSE |= VERBOSE_API; + + if (_mesa_strstr(debug, "list")) + MESA_VERBOSE |= VERBOSE_DISPLAY_LIST; + + if (_mesa_strstr(debug, "lighting")) + MESA_VERBOSE |= VERBOSE_LIGHTING; + + if (_mesa_strstr(debug, "disassem")) + MESA_VERBOSE |= VERBOSE_DISASSEM; + + /* Debug flag: + */ + if (_mesa_strstr(debug, "flush")) + MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH; +#else + (void) debug; +#endif +} + + +void +_mesa_init_debug( GLcontext *ctx ) +{ + char *c; + + /* For debug/development only */ + ctx->FirstTimeCurrent = GL_TRUE; + + /* Dither disable */ + ctx->NoDither = _mesa_getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE; + if (ctx->NoDither) { + if (_mesa_getenv("MESA_DEBUG")) { + _mesa_debug(ctx, "MESA_NO_DITHER set - dithering disabled\n"); + } + ctx->Color.DitherFlag = GL_FALSE; + } + + c = _mesa_getenv("MESA_DEBUG"); + if (c) + add_debug_flags(c); + + c = _mesa_getenv("MESA_VERBOSE"); + if (c) + add_debug_flags(c); +} + diff --git a/reactos/dll/mesa32/src/main/debug.h b/reactos/dll/mesa32/src/main/debug.h new file mode 100644 index 00000000000..94d99c384bd --- /dev/null +++ b/reactos/dll/mesa32/src/main/debug.h @@ -0,0 +1,60 @@ +/* + * 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. + */ + +/** + * \file debug.h + * Debugging functions. + * + * \if subset + * (No-op) + * + * \endif + */ + + +#ifndef _DEBUG_H +#define _DEBUG_H + +#if _HAVE_FULL_GL + +extern void _mesa_print_tri_caps( const char *name, GLuint flags ); +extern void _mesa_print_enable_flags( const char *msg, GLuint flags ); +extern void _mesa_print_state( const char *msg, GLuint state ); +extern void _mesa_print_info( void ); +extern void _mesa_init_debug( GLcontext *ctx ); + +#else + +/** No-op */ +#define _mesa_print_state( m, s ) ((void)0) + +/** No-op */ +#define _mesa_print_info() ((void)0) + +/** No-op */ +#define _mesa_init_debug( c ) ((void)0) + +#endif + +#endif diff --git a/reactos/dll/mesa32/src/main/depth.c b/reactos/dll/mesa32/src/main/depth.c new file mode 100644 index 00000000000..aca471a06c8 --- /dev/null +++ b/reactos/dll/mesa32/src/main/depth.c @@ -0,0 +1,189 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +#include "glheader.h" +#include "imports.h" +#include "context.h" +#include "depth.h" +#include "enums.h" +#include "hash.h" +#include "macros.h" +#include "mtypes.h" + + +/**********************************************************************/ +/***** API Functions *****/ +/**********************************************************************/ + + + +void GLAPIENTRY +_mesa_ClearDepth( GLclampd depth ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + depth = CLAMP( depth, 0.0, 1.0 ); + + if (ctx->Depth.Clear == depth) + return; + + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.Clear = depth; + if (ctx->Driver.ClearDepth) + (*ctx->Driver.ClearDepth)( ctx, ctx->Depth.Clear ); +} + + + +void GLAPIENTRY +_mesa_DepthFunc( GLenum func ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func)); + + switch (func) { + case GL_LESS: /* (default) pass if incoming z < stored z */ + case GL_GEQUAL: + case GL_LEQUAL: + case GL_GREATER: + case GL_NOTEQUAL: + case GL_EQUAL: + case GL_ALWAYS: + case GL_NEVER: + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glDepth.Func" ); + return; + } + + if (ctx->Depth.Func == func) + return; + + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.Func = func; + + if (ctx->Driver.DepthFunc) + ctx->Driver.DepthFunc( ctx, func ); +} + + + +void GLAPIENTRY +_mesa_DepthMask( GLboolean flag ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glDepthMask %d\n", flag); + + /* + * GL_TRUE indicates depth buffer writing is enabled (default) + * GL_FALSE indicates depth buffer writing is disabled + */ + if (ctx->Depth.Mask == flag) + return; + + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.Mask = flag; + + if (ctx->Driver.DepthMask) + ctx->Driver.DepthMask( ctx, flag ); +} + + + +/** + * Specified by the GL_EXT_depth_bounds_test extension. + */ +void GLAPIENTRY +_mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (zmin > zmax) { + _mesa_error(ctx, GL_INVALID_VALUE, "glDepthBoundsEXT(zmin > zmax)"); + return; + } + + zmin = CLAMP(zmin, 0.0, 1.0); + zmax = CLAMP(zmax, 0.0, 1.0); + + if (ctx->Depth.BoundsMin == zmin && ctx->Depth.BoundsMax == zmax) + return; + + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.BoundsMin = (GLfloat) zmin; + ctx->Depth.BoundsMax = (GLfloat) zmax; +} + + +/**********************************************************************/ +/***** Initialization *****/ +/**********************************************************************/ + + +/** + * Initialize the depth buffer attribute group in the given context. + */ +void _mesa_init_depth( GLcontext * ctx ) +{ + /* Depth buffer group */ + ctx->Depth.Test = GL_FALSE; + ctx->Depth.Clear = 1.0; + ctx->Depth.Func = GL_LESS; + ctx->Depth.Mask = GL_TRUE; + ctx->Depth.OcclusionTest = GL_FALSE; + + /* XXX this is now per-framebuffer state */ +#if 00 + /* Z buffer stuff */ + if (ctx->Visual.depthBits == 0) { + /* Special case. Even if we don't have a depth buffer we need + * good values for DepthMax for Z vertex transformation purposes + * and for per-fragment fog computation. + */ + ctx->DepthMax = (1 << 16) - 1; + ctx->DepthMaxF = (GLfloat) ctx->DepthMax; + } + else if (ctx->Visual.depthBits < 32) { + ctx->DepthMax = (1 << ctx->Visual.depthBits) - 1; + ctx->DepthMaxF = (GLfloat) ctx->DepthMax; + } + else { + /* Special case since shift values greater than or equal to the + * number of bits in the left hand expression's type are undefined. + */ + ctx->DepthMax = 0xffffffff; + ctx->DepthMaxF = (GLfloat) ctx->DepthMax; + } + ctx->MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */ +#endif +} diff --git a/reactos/dll/mesa32/src/main/depth.h b/reactos/dll/mesa32/src/main/depth.h new file mode 100644 index 00000000000..dcc0b4637a7 --- /dev/null +++ b/reactos/dll/mesa32/src/main/depth.h @@ -0,0 +1,62 @@ +/** + * \file depth.h + * Depth buffer operations. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 DEPTH_H +#define DEPTH_H + + +#include "mtypes.h" + + +#if _HAVE_FULL_GL + +extern void GLAPIENTRY +_mesa_ClearDepth( GLclampd depth ); + +extern void GLAPIENTRY +_mesa_DepthFunc( GLenum func ); + +extern void GLAPIENTRY +_mesa_DepthMask( GLboolean flag ); + +extern void GLAPIENTRY +_mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ); + +extern void +_mesa_init_depth( GLcontext * ctx ); + +#else + +/** No-op */ +#define _mesa_init_depth( c ) ((void)0) + +#endif + +#endif diff --git a/reactos/dll/mesa32/src/main/descrip.mms b/reactos/dll/mesa32/src/main/descrip.mms new file mode 100644 index 00000000000..ce298229c3e --- /dev/null +++ b/reactos/dll/mesa32/src/main/descrip.mms @@ -0,0 +1,210 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl +# Last revision : 10 May 2005 + +.first + define gl [---.include.gl] + define math [-.math] + define shader [-.shader] + +.include [---]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [---.include],[-.glapi],[-.shader] +LIBDIR = [---.lib] +CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short) + +SOURCES =accum.c \ + api_arrayelt.c \ + api_loopback.c \ + api_noop.c \ + api_validate.c \ + attrib.c \ + blend.c \ + bufferobj.c \ + buffers.c \ + clip.c \ + colortab.c \ + context.c \ + convolve.c \ + debug.c \ + depth.c \ + dispatch.c \ + dlist.c \ + drawpix.c \ + enable.c \ + enums.c \ + eval.c \ + execmem.c \ + extensions.c \ + fbobject.c \ + feedback.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 \ + mm.c \ + occlude.c \ + pixel.c \ + points.c \ + polygon.c \ + rastpos.c \ + renderbuffer.c \ + state.c \ + stencil.c \ + texcompress.c \ + texcompress_fxt1.c \ + texcompress_s3tc.c \ + texenvprogram.c \ + texformat.c \ + teximage.c \ + texobj.c \ + texrender.c \ + texstate.c \ + texstore.c \ + varray.c \ + vtxfmt.c + +OBJECTS=accum.obj,\ +api_arrayelt.obj,\ +api_loopback.obj,\ +api_noop.obj,\ +api_validate.obj,\ +attrib.obj,\ +blend.obj,\ +bufferobj.obj,\ +buffers.obj,\ +clip.obj,\ +colortab.obj,\ +context.obj,\ +convolve.obj,\ +debug.obj,\ +depth.obj,\ +dispatch.obj,\ +dlist.obj,\ +drawpix.obj,\ +enable.obj,\ +enums.obj,\ +eval.obj,\ +execmem.obj,\ +extensions.obj,\ +fbobject.obj,\ +feedback.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,\ +mm.obj,\ +occlude.obj,\ +pixel.obj,\ +points.obj,\ +polygon.obj,\ +rastpos.obj,\ +renderbuffer.obj,\ +state.obj,\ +stencil.obj,\ +texcompress.obj,\ +texcompress_fxt1.obj,\ +texcompress_s3tc.obj,\ +texenvprogram.obj,\ +texformat.obj,\ +teximage.obj,\ +texobj.obj,\ +texrender.obj,\ +texstate.obj,\ +texstore.obj,\ +varray.obj,\ +vtxfmt.obj + +##### RULES ##### + +VERSION=Mesa V3.4 + +##### TARGETS ##### +# Make the library +$(LIBDIR)$(GL_LIB) : $(OBJECTS) + @ $(MAKELIB) $(GL_LIB) $(OBJECTS) + @ rename $(GL_LIB)* $(LIBDIR) + +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 +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 +dispatch.obj : dispatch.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 +mm.obj: mm.c +occlude.obj : occlude.c +pixel.obj : pixel.c +points.obj : points.c +polygon.obj : polygon.c +rastpos.obj : rastpos.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 diff --git a/reactos/dll/mesa32/src/main/dispatch.c b/reactos/dll/mesa32/src/main/dispatch.c new file mode 100644 index 00000000000..05c1c36c0d2 --- /dev/null +++ b/reactos/dll/mesa32/src/main/dispatch.c @@ -0,0 +1,95 @@ +/* + * 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. + */ + + +/** + * \file dispatch.c + * + * This file generates all the gl* function entrypoints. This code is not + * used if optimized assembly stubs are available (e.g., using x86/glapi_x86.S + * on IA32 or sparc/glapi_sparc.S on SPARC). + * + * \note + * This file is also used to build the client-side libGL that loads DRI-based + * device drivers. At build-time it is symlinked to src/glx/x11. + * + * \author Brian Paul + */ + +#ifndef GLX_USE_APPLEGL + +#include "glheader.h" +#include "glapi.h" +#include "glapitable.h" +#include "glthread.h" + + +#if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) + +#if defined(WIN32) +#define KEYWORD1 GLAPI +#else +#define KEYWORD1 PUBLIC +#endif + +#define KEYWORD2 GLAPIENTRY + +#if defined(USE_MGL_NAMESPACE) +#define NAME(func) mgl##func +#else +#define NAME(func) gl##func +#endif + +#if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */ + +#define F stdout +#define DISPATCH(FUNC, ARGS, MESSAGE) \ + fprintf MESSAGE; \ + CALL_ ## FUNC(GET_DISPATCH(), ARGS); + +#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ + fprintf MESSAGE; \ + return CALL_ ## FUNC(GET_DISPATCH(), ARGS); + +#else + +#define DISPATCH(FUNC, ARGS, MESSAGE) \ + CALL_ ## FUNC(GET_DISPATCH(), ARGS); + +#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ + return CALL_ ## FUNC(GET_DISPATCH(), ARGS); + +#endif /* logging */ + + +#ifndef GLAPIENTRY +#define GLAPIENTRY +#endif + +#include "dispatch.h" +#include "glapitemp.h" + +#endif /* USE_X86_ASM */ + +#endif /* !GLX_USE_APPLEGL */ diff --git a/reactos/dll/mesa32/src/main/dlist.c b/reactos/dll/mesa32/src/main/dlist.c new file mode 100644 index 00000000000..7bd11c31af5 --- /dev/null +++ b/reactos/dll/mesa32/src/main/dlist.c @@ -0,0 +1,8434 @@ +/* + * 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. + */ + + +/** + * \file dlist.c + * Display lists management functions. + */ + +#include "glheader.h" +#include "imports.h" +#include "api_arrayelt.h" +#include "api_loopback.h" +#include "config.h" +#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program +#include "arbprogram.h" +#include "program.h" +#endif +#include "attrib.h" +#include "blend.h" +#include "buffers.h" +#if FEATURE_ARB_vertex_buffer_object +#include "bufferobj.h" +#endif +#include "clip.h" +#include "colormac.h" +#include "colortab.h" +#include "context.h" +#include "convolve.h" +#include "depth.h" +#include "dlist.h" +#include "enable.h" +#include "enums.h" +#include "eval.h" +#include "extensions.h" +#include "feedback.h" +#include "get.h" +#include "glapi.h" +#include "hash.h" +#include "histogram.h" +#include "image.h" +#include "light.h" +#include "lines.h" +#include "dlist.h" +#include "macros.h" +#include "matrix.h" +#include "occlude.h" +#include "pixel.h" +#include "points.h" +#include "polygon.h" +#include "state.h" +#include "texobj.h" +#include "teximage.h" +#include "texstate.h" +#include "mtypes.h" +#include "varray.h" +#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program +#include "nvprogram.h" +#include "program.h" +#endif +#if FEATURE_ATI_fragment_shader +#include "atifragshader.h" +#endif + +#include "math/m_matrix.h" +#include "math/m_xform.h" + +#include "dispatch.h" + + +/** + * 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_CLIP_PLANE, + OPCODE_COLOR_MASK, + 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_DRAW_BUFFER, + OPCODE_DRAW_PIXELS, + OPCODE_ENABLE, + 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_SGIX/SGIS_pixel_texture */ + OPCODE_PIXEL_TEXGEN_SGIX, + OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, + /* 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_PROGRAM_PARAMETER4F_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_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, + + /* 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_INDEX, + OPCODE_EDGEFLAG, + OPCODE_BEGIN, + OPCODE_END, + OPCODE_RECTF, + OPCODE_EVAL_C1, + OPCODE_EVAL_C2, + OPCODE_EVAL_P1, + OPCODE_EVAL_P2, + + + /* 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 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 */ +}; + + +/** + * 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 ]; + +void mesa_print_display_list( GLuint list ); + + +/**********************************************************************/ +/***** Private *****/ +/**********************************************************************/ + +/* + * Make an empty display list. This is used by glGenLists() to + * reserver display list IDs. + */ +static struct mesa_display_list *make_list( GLuint list, GLuint count ) +{ + struct mesa_display_list *dlist = CALLOC_STRUCT( mesa_display_list ); + dlist->id = list; + dlist->node = (Node *) MALLOC( sizeof(Node) * count ); + dlist->node[0].opcode = OPCODE_END_OF_LIST; + return dlist; +} + + + +/* + * Destroy all nodes in a display list. + * \param list - display list number + */ +void _mesa_destroy_list( GLcontext *ctx, GLuint list ) +{ + struct mesa_display_list *dlist; + Node *n, *block; + GLboolean done; + + if (list==0) + return; + + dlist = (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list); + if (!dlist) + return; + + n = block = dlist->node; + + done = block ? GL_FALSE : GL_TRUE; + while (!done) { + + /* check for extension opcodes first */ + + GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0; + if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { + ctx->ListExt.Opcode[i].Destroy(ctx, &n[1]); + n += ctx->ListExt.Opcode[i].Size; + } + else { + switch (n[0].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_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 ); + _mesa_HashRemove(ctx->Shared->DisplayList, list); +} + + + +/* + * Translate the nth element of list from type to GLuint. + */ +static GLuint 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 (GLuint) *(bptr+n); + case GL_UNSIGNED_BYTE: + ubptr = (GLubyte *) list; + return (GLuint) *(ubptr+n); + case GL_SHORT: + sptr = (GLshort *) list; + return (GLuint) *(sptr+n); + case GL_UNSIGNED_SHORT: + usptr = (GLushort *) list; + return (GLuint) *(usptr+n); + case GL_INT: + iptr = (GLint *) list; + return (GLuint) *(iptr+n); + case GL_UNSIGNED_INT: + uiptr = (GLuint *) list; + return (GLuint) *(uiptr+n); + case GL_FLOAT: + fptr = (GLfloat *) list; + return (GLuint) *(fptr+n); + case GL_2_BYTES: + ubptr = ((GLubyte *) list) + 2*n; + return (GLuint) *ubptr * 256 + (GLuint) *(ubptr+1); + case GL_3_BYTES: + ubptr = ((GLubyte *) list) + 3*n; + return (GLuint) *ubptr * 65536 + + (GLuint) *(ubptr+1) * 256 + + (GLuint) *(ubptr+2); + case GL_4_BYTES: + ubptr = ((GLubyte *) list) + 4*n; + return (GLuint) *ubptr * 16777216 + + (GLuint) *(ubptr+1) * 65536 + + (GLuint) *(ubptr+2) * 256 + + (GLuint) *(ubptr+3); + default: + return 0; + } +} + + + + +/**********************************************************************/ +/***** Public *****/ +/**********************************************************************/ + +/** + * Do one-time initialiazations for display lists. + */ +void +_mesa_init_lists( void ) +{ + static int init_flag = 0; + + if (init_flag==0) { + InstSize[OPCODE_ACCUM] = 3; + InstSize[OPCODE_ALPHA_FUNC] = 3; + InstSize[OPCODE_BIND_TEXTURE] = 3; + InstSize[OPCODE_BITMAP] = 8; + InstSize[OPCODE_BLEND_COLOR] = 5; + InstSize[OPCODE_BLEND_EQUATION] = 2; + InstSize[OPCODE_BLEND_EQUATION_SEPARATE] = 3; + InstSize[OPCODE_BLEND_FUNC_SEPARATE] = 5; + InstSize[OPCODE_CALL_LIST] = 2; + InstSize[OPCODE_CALL_LIST_OFFSET] = 3; + InstSize[OPCODE_CLEAR] = 2; + InstSize[OPCODE_CLEAR_ACCUM] = 5; + InstSize[OPCODE_CLEAR_COLOR] = 5; + InstSize[OPCODE_CLEAR_DEPTH] = 2; + InstSize[OPCODE_CLEAR_INDEX] = 2; + InstSize[OPCODE_CLEAR_STENCIL] = 2; + InstSize[OPCODE_CLIP_PLANE] = 6; + InstSize[OPCODE_COLOR_MASK] = 5; + InstSize[OPCODE_COLOR_MATERIAL] = 3; + InstSize[OPCODE_COLOR_TABLE] = 7; + InstSize[OPCODE_COLOR_TABLE_PARAMETER_FV] = 7; + InstSize[OPCODE_COLOR_TABLE_PARAMETER_IV] = 7; + InstSize[OPCODE_COLOR_SUB_TABLE] = 7; + InstSize[OPCODE_CONVOLUTION_FILTER_1D] = 7; + InstSize[OPCODE_CONVOLUTION_FILTER_2D] = 8; + InstSize[OPCODE_CONVOLUTION_PARAMETER_I] = 4; + InstSize[OPCODE_CONVOLUTION_PARAMETER_IV] = 7; + InstSize[OPCODE_CONVOLUTION_PARAMETER_F] = 4; + InstSize[OPCODE_CONVOLUTION_PARAMETER_FV] = 7; + InstSize[OPCODE_COPY_PIXELS] = 6; + InstSize[OPCODE_COPY_COLOR_SUB_TABLE] = 6; + InstSize[OPCODE_COPY_COLOR_TABLE] = 6; + InstSize[OPCODE_COPY_TEX_IMAGE1D] = 8; + InstSize[OPCODE_COPY_TEX_IMAGE2D] = 9; + InstSize[OPCODE_COPY_TEX_SUB_IMAGE1D] = 7; + InstSize[OPCODE_COPY_TEX_SUB_IMAGE2D] = 9; + InstSize[OPCODE_COPY_TEX_SUB_IMAGE3D] = 10; + InstSize[OPCODE_CULL_FACE] = 2; + InstSize[OPCODE_DEPTH_FUNC] = 2; + InstSize[OPCODE_DEPTH_MASK] = 2; + InstSize[OPCODE_DEPTH_RANGE] = 3; + InstSize[OPCODE_DISABLE] = 2; + InstSize[OPCODE_DRAW_BUFFER] = 2; + InstSize[OPCODE_DRAW_PIXELS] = 6; + InstSize[OPCODE_ENABLE] = 2; + InstSize[OPCODE_EVALMESH1] = 4; + InstSize[OPCODE_EVALMESH2] = 6; + InstSize[OPCODE_FOG] = 6; + InstSize[OPCODE_FRONT_FACE] = 2; + InstSize[OPCODE_FRUSTUM] = 7; + InstSize[OPCODE_HINT] = 3; + InstSize[OPCODE_HISTOGRAM] = 5; + InstSize[OPCODE_INDEX_MASK] = 2; + InstSize[OPCODE_INIT_NAMES] = 1; + InstSize[OPCODE_LIGHT] = 7; + InstSize[OPCODE_LIGHT_MODEL] = 6; + InstSize[OPCODE_LINE_STIPPLE] = 3; + InstSize[OPCODE_LINE_WIDTH] = 2; + InstSize[OPCODE_LIST_BASE] = 2; + InstSize[OPCODE_LOAD_IDENTITY] = 1; + InstSize[OPCODE_LOAD_MATRIX] = 17; + InstSize[OPCODE_LOAD_NAME] = 2; + InstSize[OPCODE_LOGIC_OP] = 2; + InstSize[OPCODE_MAP1] = 7; + InstSize[OPCODE_MAP2] = 11; + InstSize[OPCODE_MAPGRID1] = 4; + InstSize[OPCODE_MAPGRID2] = 7; + InstSize[OPCODE_MATRIX_MODE] = 2; + InstSize[OPCODE_MIN_MAX] = 4; + InstSize[OPCODE_MULT_MATRIX] = 17; + InstSize[OPCODE_ORTHO] = 7; + InstSize[OPCODE_PASSTHROUGH] = 2; + InstSize[OPCODE_PIXEL_MAP] = 4; + InstSize[OPCODE_PIXEL_TRANSFER] = 3; + InstSize[OPCODE_PIXEL_ZOOM] = 3; + InstSize[OPCODE_POINT_SIZE] = 2; + InstSize[OPCODE_POINT_PARAMETERS] = 5; + InstSize[OPCODE_POLYGON_MODE] = 3; + InstSize[OPCODE_POLYGON_STIPPLE] = 2; + InstSize[OPCODE_POLYGON_OFFSET] = 3; + InstSize[OPCODE_POP_ATTRIB] = 1; + InstSize[OPCODE_POP_MATRIX] = 1; + InstSize[OPCODE_POP_NAME] = 1; + InstSize[OPCODE_PRIORITIZE_TEXTURE] = 3; + InstSize[OPCODE_PUSH_ATTRIB] = 2; + InstSize[OPCODE_PUSH_MATRIX] = 1; + InstSize[OPCODE_PUSH_NAME] = 2; + InstSize[OPCODE_RASTER_POS] = 5; + InstSize[OPCODE_READ_BUFFER] = 2; + InstSize[OPCODE_RESET_HISTOGRAM] = 2; + InstSize[OPCODE_RESET_MIN_MAX] = 2; + InstSize[OPCODE_ROTATE] = 5; + InstSize[OPCODE_SCALE] = 4; + InstSize[OPCODE_SCISSOR] = 5; + InstSize[OPCODE_STENCIL_FUNC] = 4; + InstSize[OPCODE_STENCIL_MASK] = 2; + InstSize[OPCODE_STENCIL_OP] = 4; + InstSize[OPCODE_SHADE_MODEL] = 2; + InstSize[OPCODE_TEXENV] = 7; + InstSize[OPCODE_TEXGEN] = 7; + InstSize[OPCODE_TEXPARAMETER] = 7; + InstSize[OPCODE_TEX_IMAGE1D] = 9; + InstSize[OPCODE_TEX_IMAGE2D] = 10; + InstSize[OPCODE_TEX_IMAGE3D] = 11; + InstSize[OPCODE_TEX_SUB_IMAGE1D] = 8; + InstSize[OPCODE_TEX_SUB_IMAGE2D] = 10; + InstSize[OPCODE_TEX_SUB_IMAGE3D] = 12; + InstSize[OPCODE_TRANSLATE] = 4; + InstSize[OPCODE_VIEWPORT] = 5; + InstSize[OPCODE_WINDOW_POS] = 5; + InstSize[OPCODE_CONTINUE] = 2; + InstSize[OPCODE_ERROR] = 3; + InstSize[OPCODE_END_OF_LIST] = 1; + /* GL_SGIX/SGIS_pixel_texture */ + InstSize[OPCODE_PIXEL_TEXGEN_SGIX] = 2; + InstSize[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS] = 3; + /* GL_ARB_texture_compression */ + InstSize[OPCODE_COMPRESSED_TEX_IMAGE_1D] = 8; + InstSize[OPCODE_COMPRESSED_TEX_IMAGE_2D] = 9; + InstSize[OPCODE_COMPRESSED_TEX_IMAGE_3D] = 10; + InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D] = 8; + InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D] = 10; + InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D] = 12; + /* GL_ARB_multisample */ + InstSize[OPCODE_SAMPLE_COVERAGE] = 3; + /* GL_ARB_multitexture */ + InstSize[OPCODE_ACTIVE_TEXTURE] = 2; + /* GL_ARB_window_pos */ + InstSize[OPCODE_WINDOW_POS_ARB] = 4; + /* GL_NV_vertex_program */ + InstSize[OPCODE_BIND_PROGRAM_NV] = 3; + InstSize[OPCODE_EXECUTE_PROGRAM_NV] = 7; + InstSize[OPCODE_REQUEST_RESIDENT_PROGRAMS_NV] = 2; + InstSize[OPCODE_LOAD_PROGRAM_NV] = 5; + InstSize[OPCODE_PROGRAM_PARAMETER4F_NV] = 7; + InstSize[OPCODE_TRACK_MATRIX_NV] = 5; + /* GL_NV_fragment_program */ + InstSize[OPCODE_PROGRAM_LOCAL_PARAMETER_ARB] = 7; + InstSize[OPCODE_PROGRAM_NAMED_PARAMETER_NV] = 8; + /* GL_EXT_stencil_two_side */ + InstSize[OPCODE_ACTIVE_STENCIL_FACE_EXT] = 2; + /* GL_EXT_depth_bounds_test */ + InstSize[OPCODE_DEPTH_BOUNDS_EXT] = 3; +#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program + InstSize[OPCODE_PROGRAM_STRING_ARB] = 5; + InstSize[OPCODE_PROGRAM_ENV_PARAMETER_ARB] = 7; +#endif +#if FEATURE_ARB_occlusion_query + InstSize[OPCODE_BEGIN_QUERY_ARB] = 3; + InstSize[OPCODE_END_QUERY_ARB] = 2; +#endif + InstSize[OPCODE_DRAW_BUFFERS_ARB] = 2 + MAX_DRAW_BUFFERS; +#if FEATURE_ATI_fragment_shader + InstSize[OPCODE_BIND_FRAGMENT_SHADER_ATI] = 2; + InstSize[OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI] = 6; +#endif + /* OpenGL 2.0 */ + InstSize[OPCODE_STENCIL_FUNC_SEPARATE] = 5; + InstSize[OPCODE_STENCIL_MASK_SEPARATE] = 3; + InstSize[OPCODE_STENCIL_OP_SEPARATE] = 5; + + InstSize[OPCODE_ATTR_1F_NV] = 3; + InstSize[OPCODE_ATTR_2F_NV] = 4; + InstSize[OPCODE_ATTR_3F_NV] = 5; + InstSize[OPCODE_ATTR_4F_NV] = 6; + InstSize[OPCODE_ATTR_1F_ARB] = 3; + InstSize[OPCODE_ATTR_2F_ARB] = 4; + InstSize[OPCODE_ATTR_3F_ARB] = 5; + InstSize[OPCODE_ATTR_4F_ARB] = 6; + InstSize[OPCODE_MATERIAL] = 7; + InstSize[OPCODE_INDEX] = 2; + InstSize[OPCODE_EDGEFLAG] = 2; + InstSize[OPCODE_BEGIN] = 2; + InstSize[OPCODE_END] = 1; + InstSize[OPCODE_RECTF] = 5; + InstSize[OPCODE_EVAL_C1] = 2; + InstSize[OPCODE_EVAL_C2] = 3; + InstSize[OPCODE_EVAL_P1] = 2; + InstSize[OPCODE_EVAL_P2] = 3; + } + init_flag = 1; +} + + + +/** + * Wrapper for _mesa_unpack_image() that handles pixel buffer objects. + * \todo This won't suffice when the PBO is really in VRAM/GPU memory. + */ +static GLvoid * +unpack_image( GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *unpack ) +{ + if (unpack->BufferObj->Name == 0) { + /* no PBO */ + return _mesa_unpack_image(dimensions, width, height, depth, format, type, + pixels, unpack); + } + else if (_mesa_validate_pbo_access(dimensions, unpack, width, height, depth, + format, type, pixels)) { + const GLubyte *src = ADD_POINTERS(unpack->BufferObj->Data, pixels); + return _mesa_unpack_image(dimensions, width, height, depth, format, type, + src, unpack); + } + /* bad access! */ + return NULL; +} + + +/* + * Allocate space for a display list instruction. + * \param opcode - type of instruction + * argcount - size in bytes of data required. + * \return pointer to the usable data area (not including the internal + * opcode). + */ +void * +_mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz ) +{ + Node *n, *newblock; + GLuint count = 1 + (sz + sizeof(Node) - 1) / sizeof(Node); + +#ifdef DEBUG + if (opcode < (int) OPCODE_EXT_0) { + assert( count == InstSize[opcode] ); + } +#endif + + if (ctx->ListState.CurrentPos + count + 2 > BLOCK_SIZE) { + /* This block is full. Allocate a new block and chain to it */ + 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 += count; + + n[0].opcode = (OpCode) opcode; + + return (void *)&n[1]; +} + + +/** + * 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_alloc_opcode( GLcontext *ctx, + GLuint size, + void (*execute)( GLcontext *, void * ), + void (*destroy)( GLcontext *, void * ), + void (*print)( GLcontext *, 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; +} + + + +/* Mimic the old behaviour of alloc_instruction: + * - sz is in units of sizeof(Node) + * - return value a pointer to sizeof(Node) before the actual + * usable data area. + */ +#define ALLOC_INSTRUCTION(ctx, opcode, sz) \ + ((Node *)_mesa_alloc_instruction(ctx, opcode, sz*sizeof(Node)) - 1) + + + +/* + * 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); + GLvoid *image = _mesa_unpack_bitmap( width, height, pixels, &ctx->Unpack ); + 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 = image; + } + else if (image) { + FREE(image); + } + 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_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 )); + } +} + + +void GLAPIENTRY _mesa_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 begin/end state we're in: + */ + ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; + + if (ctx->ExecuteFlag) { + CALL_CallList(ctx->Exec, ( list )); + } +} + + +void GLAPIENTRY _mesa_save_CallLists( GLsizei n, 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;iDriver.CurrentSavePrimitive = PRIM_UNKNOWN; + + if (ctx->ExecuteFlag) { + CALL_CallLists(ctx->Exec, ( n, 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_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_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 (target == GL_PROXY_TEXTURE_1D || + target == GL_PROXY_TEXTURE_2D || + target == GL_PROXY_TEXTURE_3D || + target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) { + /* execute immediately */ + CALL_ColorTable(ctx->Exec, ( target, internalFormat, width, + format, type, table )); + } + else { + GLvoid *image = unpack_image(1, width, 1, 1, format, type, table, + &ctx->Unpack); + 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 = image; + } + else if (image) { + FREE(image); + } + 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_POST_COLOR_MATRIX_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_POST_COLOR_MATRIX_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); + GLvoid *image = unpack_image(1, count, 1, 1, format, type, table, + &ctx->Unpack); + 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 = image; + } + else if (image) { + FREE(image); + } + 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); + GLvoid *image = unpack_image(1, width, 1, 1, format, type, filter, + &ctx->Unpack); + 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 = image; + } + else if (image) { + FREE(image); + } + 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); + GLvoid *image = unpack_image(2, width, height, 1, format, type, filter, + &ctx->Unpack); + 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 = image; + } + else if (image) { + FREE(image); + } + 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_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); + GLvoid *image = unpack_image(2, width, height, 1, format, type, + pixels, &ctx->Unpack); + 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 = image; + } + else if (image) { + FREE(image); + } + 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 )); + } +} + + + +void GLAPIENTRY _mesa_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 )); + } +} + + +void GLAPIENTRY _mesa_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 ) +{ + save_Fogfv(pname, ¶m); +} + + +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; + 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 */ + ; + } + save_Fogfv(pname, p); +} + + +static void GLAPIENTRY save_Fogi(GLenum pname, GLint param ) +{ + save_Fogiv(pname, ¶m); +} + + +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 (OPCODE_LIGHT) { + 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 params ) +{ + save_Lightfv(light, pname, ¶ms); +} + + +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 ) +{ + save_Lightiv( light, pname, ¶m ); +} + + +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 ) +{ + save_LightModelfv(pname, ¶m); +} + + +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]; + break; + default: + /* Error will be caught later in gl_LightModelfv */ + ; + } + save_LightModelfv(pname, fparam); +} + + +static void GLAPIENTRY save_LightModeli( GLenum pname, GLint param ) +{ + save_LightModeliv(pname, ¶m); +} + + +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 list, 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) list; + (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;iExecuteFlag) { + 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 ) +{ + save_PointParameterfvEXT(pname, ¶m); +} + +static void GLAPIENTRY save_PointParameteriNV( GLenum pname, GLint param ) +{ + GLfloat p = (GLfloat) param; + save_PointParameterfvEXT(pname, &p); +} + +static void GLAPIENTRY save_PointParameterivNV( GLenum pname, const GLint *param ) +{ + GLfloat p = (GLfloat) param[0]; + save_PointParameterfvEXT(pname, &p); +} + + +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 )); + } +} + + +/* + * Polygon stipple must have been upacked already! + */ +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) { + void *data; + n[1].data = MALLOC( 32 * 4 ); + data = n[1].data; /* This needed for Acorn compiler */ + MEMCPY( data, pattern, 32 * 4 ); + } + 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;iExecuteFlag) { + 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_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION( ctx, OPCODE_SHADE_MODEL, 1 ); + if (n) { + n[1].e = mode; + } + if (ctx->ExecuteFlag) { + CALL_ShadeModel(ctx->Exec, ( 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_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 ) +{ + save_TexEnvfv( target, pname, ¶m ); +} + + +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.0; + 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 p = (GLfloat) param; + save_TexGenfv( coord, pname, &p ); +} + + +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 ) +{ + save_TexGenfv(coord, pname, ¶m); +} + + +static void GLAPIENTRY save_TexGeni( GLenum coord, GLenum pname, GLint param ) +{ + save_TexGeniv( coord, pname, ¶m ); +} + + +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 ) +{ + save_TexParameterfv(target, pname, ¶m); +} + + +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.0; + 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.0; + 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 { + GLvoid *image = unpack_image(1, width, 1, 1, format, type, + pixels, &ctx->Unpack); + 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 = image; + } + else if (image) { + FREE(image); + } + 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 { + GLvoid *image = unpack_image(2, width, height, 1, format, type, + pixels, &ctx->Unpack); + 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 = image; + } + else if (image) { + FREE(image); + } + 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; + GLvoid *image = unpack_image(3, width, height, depth, format, type, + pixels, &ctx->Unpack); + 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 = image; + } + else if (image) { + FREE(image); + } + 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; + GLvoid *image = unpack_image(1, width, 1, 1, format, type, + pixels, &ctx->Unpack); + 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 = image; + } + else if (image) { + FREE(image); + } + 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; + GLvoid *image = unpack_image(2, width, height, 1, format, type, + pixels, &ctx->Unpack); + 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 = image; + } + else if (image) { + FREE(image); + } + 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; + GLvoid *image = unpack_image(3, width, height, depth, format, type, + pixels, &ctx->Unpack); + 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 = image; + } + else if (image) { + FREE(image); + } + 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); +} + + +static void GLAPIENTRY +save_PixelTexGenSGIX(GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_SGIX, 1 ); + if (n) { + n[1].e = mode; + } + if (ctx->ExecuteFlag) { + CALL_PixelTexGenSGIX(ctx->Exec, ( mode )); + } +} + + +/* 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_SGIS_pixel_texture */ + +static void GLAPIENTRY +save_PixelTexGenParameteriSGIS(GLenum target, GLint value) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, 2 ); + if (n) { + n[1].e = target; + n[2].i = value; + } + if (ctx->ExecuteFlag) { + CALL_PixelTexGenParameteriSGIS(ctx->Exec, ( target, value )); + } +} + + +static void GLAPIENTRY +save_PixelTexGenParameterfSGIS(GLenum target, GLfloat value) +{ + save_PixelTexGenParameteriSGIS(target, (GLint) value); +} + + +static void GLAPIENTRY +save_PixelTexGenParameterivSGIS(GLenum target, const GLint *value) +{ + save_PixelTexGenParameteriSGIS(target, *value); +} + + +static void GLAPIENTRY +save_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) +{ + save_PixelTexGenParameteriSGIS(target, (GLint) *value); +} + + +/* + * 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 )); + } +} +#endif /* FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_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_ProgramParameter4fNV(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_PARAMETER4F_NV, 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_ProgramParameter4fNV(ctx->Exec, (target, index, x, y, z, w)); + } +} + + +static void GLAPIENTRY +save_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params) +{ + save_ProgramParameter4fNV(target, index, params[0], params[1], + params[2], params[3]); +} + + +static void GLAPIENTRY +save_ProgramParameter4dNV(GLenum target, GLuint index, + GLdouble x, GLdouble y, + GLdouble z, GLdouble w) +{ + save_ProgramParameter4fNV(target, index, (GLfloat) x, (GLfloat) y, + (GLfloat) z, (GLfloat) w); +} + + +static void GLAPIENTRY +save_ProgramParameter4dvNV(GLenum target, GLuint index, + const GLdouble *params) +{ + save_ProgramParameter4fNV(target, index, (GLfloat) params[0], + (GLfloat) params[1], (GLfloat) params[2], + (GLfloat) params[3]); +} + + +static void GLAPIENTRY +save_ProgramParameters4dvNV(GLenum target, GLuint index, + GLuint num, const GLdouble *params) +{ + GLuint i; + for (i = 0; i < num; i++) { + save_ProgramParameter4dvNV(target, index + i, params + 4 * i); + } +} + + +static void GLAPIENTRY +save_ProgramParameters4fvNV(GLenum target, GLuint index, + GLuint num, const GLfloat *params) +{ + GLuint i; + for (i = 0; i < num; i++) { + save_ProgramParameter4fvNV(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; + GLubyte *programCopy; + + programCopy = (GLubyte *) _mesa_malloc(len); + if (!programCopy) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); + return; + } + _mesa_memcpy(programCopy, program, len); + + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_PROGRAM_NV, 4 ); + if (n) { + 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; + GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint)); + if (!idCopy) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV"); + return; + } + _mesa_memcpy(idCopy, ids, num * sizeof(GLuint)); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION( ctx, OPCODE_TRACK_MATRIX_NV, 2 ); + if (n) { + 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_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; + GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len); + if (!nameCopy) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV"); + return; + } + _mesa_memcpy(nameCopy, name, len); + + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6 ); + if (n) { + 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; + GLubyte *programCopy; + + programCopy = (GLubyte *) _mesa_malloc(len); + if (!programCopy) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB"); + return; + } + _mesa_memcpy(programCopy, string, len); + + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_STRING_ARB, 4 ); + if (n) { + 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)); + } +} + + +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_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 */ + + +#ifdef FEATURE_ARB_occlusion_query + +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_ARB_occlusion_query */ + + +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)); + } +} + +#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 < VERT_ATTRIB_MAX); + 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 < VERT_ATTRIB_MAX); + 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 < VERT_ATTRIB_MAX); + 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 < VERT_ATTRIB_MAX); + 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 < VERT_ATTRIB_MAX); + 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 < VERT_ATTRIB_MAX); + 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 < VERT_ATTRIB_MAX); + 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 < VERT_ATTRIB_MAX); + 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 ) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + SAVE_FLUSH_VERTICES( ctx ); + n = ALLOC_INSTRUCTION( ctx, OPCODE_INDEX, 1 ); + if (n) { + n[1].f = x; + } + + ctx->ListState.ActiveIndex = 1; + ctx->ListState.CurrentIndex = x; + + if (ctx->ExecuteFlag) { + CALL_Indexi(ctx->Exec, ( (GLint) x )); + } +} + +static void GLAPIENTRY save_Indexfv( const GLfloat *v ) +{ + save_Indexf( v[0] ); +} + +static void GLAPIENTRY save_EdgeFlag( GLboolean x ) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + SAVE_FLUSH_VERTICES( ctx ); + n = ALLOC_INSTRUCTION( ctx, OPCODE_EDGEFLAG, 1 ); + if (n) { + n[1].b = x; + } + + ctx->ListState.ActiveEdgeFlag = 1; + ctx->ListState.CurrentEdgeFlag = x; + + if (ctx->ExecuteFlag) { + CALL_EdgeFlag(ctx->Exec, ( x )); + } +} + +static void GLAPIENTRY save_EdgeFlagv( const GLboolean *v ) +{ + save_EdgeFlag( v[0] ); +} + +static void GLAPIENTRY save_Materialfv( GLenum face, GLenum pname, const GLfloat *param ) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + int args, i; + + SAVE_FLUSH_VERTICES( ctx ); + + 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; + } + + 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]; + } + + { + GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0, NULL ); + for (i = 0 ; i < MAT_ATTRIB_MAX ; i++) + if (bitmask & (1<ListState.ActiveMaterialSize[i] = args; + COPY_SZ_4V( ctx->ListState.CurrentMaterial[i], args, param ); + } + } + + if (ctx->ExecuteFlag) { + CALL_Materialfv(ctx->Exec, ( face, pname, param )); + } +} + +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] ); +} + + +static void enum_error( void ) +{ + GET_CURRENT_CONTEXT( ctx ); + _mesa_error( ctx, GL_INVALID_ENUM, "VertexAttribfNV" ); +} + +/* First level for NV_vertex_program: + * + * Check for errors at compile time?. + */ +static void GLAPIENTRY save_VertexAttrib1fNV( GLuint index, GLfloat x ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr1fNV( index, x ); + else + enum_error(); +} + +static void GLAPIENTRY save_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr1fNV( index, v[0] ); + else + enum_error(); +} + +static void GLAPIENTRY save_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr2fNV( index, x, y ); + else + enum_error(); +} + +static void GLAPIENTRY save_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr2fNV( index, v[0], v[1] ); + else + enum_error(); +} + +static void GLAPIENTRY save_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, + GLfloat z ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr3fNV( index, x, y, z ); + else + enum_error(); +} + +static void GLAPIENTRY save_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr3fNV( index, v[0], v[1], v[2] ); + else + enum_error(); +} + +static void GLAPIENTRY save_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, + GLfloat z, GLfloat w ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr4fNV( index, x, y, z, w ); + else + enum_error(); +} + +static void GLAPIENTRY save_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr4fNV( index, v[0], v[1], v[2], v[3] ); + else + enum_error(); +} + + + + +static void GLAPIENTRY +save_VertexAttrib1fARB( GLuint index, GLfloat x ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr1fARB( index, x ); + else + enum_error(); +} + +static void GLAPIENTRY +save_VertexAttrib1fvARB( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr1fARB( index, v[0] ); + else + enum_error(); +} + +static void GLAPIENTRY +save_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr2fARB( index, x, y ); + else + enum_error(); +} + +static void GLAPIENTRY +save_VertexAttrib2fvARB( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr2fARB( index, v[0], v[1] ); + else + enum_error(); +} + +static void GLAPIENTRY +save_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr3fARB( index, x, y, z ); + else + enum_error(); +} + +static void GLAPIENTRY +save_VertexAttrib3fvARB( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr3fARB( index, v[0], v[1], v[2] ); + else + enum_error(); +} + +static void GLAPIENTRY +save_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr4fARB( index, x, y, z, w ); + else + enum_error(); +} + +static void GLAPIENTRY +save_VertexAttrib4fvARB( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + save_Attr4fARB( index, v[0], v[1], v[2], v[3] ); + else + enum_error(); +} + + + + + +/* KW: Compile commands + * + * Will appear in the list before the vertex buffer containing the + * command that provoked the error. I don't see this as a problem. + */ +void +_mesa_save_error( GLcontext *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; + } + /* execute already done */ +} + + +/* + * Compile an error into current display list. + */ +void +_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ) +{ + if (ctx->CompileFlag) + _mesa_save_error( ctx, error, s ); + + if (ctx->ExecuteFlag) + _mesa_error( ctx, error, s ); +} + + + +static GLboolean +islist(GLcontext *ctx, GLuint list) +{ + if (list > 0 && _mesa_HashLookup(ctx->Shared->DisplayList, 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 GLAPIENTRY +execute_list( GLcontext *ctx, GLuint list ) +{ + struct mesa_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 = (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list); + if (!dlist) + return; + + ctx->ListState.CallStack[ctx->ListState.CallDepth++] = dlist; + + if (ctx->Driver.BeginCallList) + ctx->Driver.BeginCallList( ctx, dlist ); + + n = dlist->node; + + done = GL_FALSE; + while (!done) { + OpCode opcode = n[0].opcode; + int i = (int)n[0].opcode - (int)OPCODE_EXT_0; + + if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { + /* this is a driver-extended opcode */ + ctx->ListExt.Opcode[i].Execute(ctx, &n[1]); + n += ctx->ListExt.Opcode[i].Size; + } + else { + switch (opcode) { + case OPCODE_ERROR: + _mesa_error( ctx, n[1].e, (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.CallDepthListState.CallDepth < MAX_LIST_NESTING) { + execute_list( ctx, ctx->List.ListBase + n[1].ui ); + } + break; + case OPCODE_CLEAR: + CALL_Clear(ctx->Exec, ( n[1].bf )); + 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_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_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_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: + CALL_PolygonStipple(ctx->Exec, ( (GLubyte *) n[1].data )); + 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_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_PIXEL_TEXGEN_SGIX: /* GL_SGIX_pixel_texture */ + CALL_PixelTexGenSGIX(ctx->Exec, ( n[1].e )); + break; + case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS: /* GL_SGIS_pixel_texture */ + CALL_PixelTexGenParameteriSGIS(ctx->Exec, ( n[1].e, n[2].i )); + 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_PROGRAM_PARAMETER4F_NV: + CALL_ProgramParameter4fNV(ctx->Exec, (n[1].e, n[2].ui, n[3].f, + n[4].f, n[5].f, n[6].f)); + 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; + 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_ARB_occlusion_query + 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_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_INDEX: + CALL_Indexi(ctx->Exec, (n[1].i)); + break; + case OPCODE_EDGEFLAG: + CALL_EdgeFlag(ctx->Exec, (n[1].b)); + 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; + + + + + case OPCODE_CONTINUE: + n = (Node *) n[1].next; + break; + case OPCODE_END_OF_LIST: + done = GL_TRUE; + break; + default: + { + char msg[1000]; + _mesa_sprintf(msg, "Error in execute_list: opcode=%d", (int) opcode); + _mesa_problem(ctx, 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.CallStack[ctx->ListState.CallDepth--] = NULL; +} + + + + + +/**********************************************************************/ +/* GL functions */ +/**********************************************************************/ + + + + +/* + * Test if a display list number is valid. + */ +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. + */ +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;iShared->Mutex); + + base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range); + if (base) { + /* reserve the list IDs by with empty/dummy lists */ + GLint i; + for (i=0; iShared->DisplayList, base+i, make_list(base+i, 1)); + } + } + + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + + return base; +} + + + +/* + * Begin a new display list. + */ +void GLAPIENTRY +_mesa_NewList( GLuint list, GLenum mode ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + + 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", list, + _mesa_lookup_enum_by_nr(mode)); + + if (list==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.CurrentListPtr) { + /* already compiling a display list */ + _mesa_error( ctx, GL_INVALID_OPERATION, "glNewList" ); + return; + } + + ctx->CompileFlag = GL_TRUE; + ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE); + + /* Allocate new display list */ + ctx->ListState.CurrentListNum = list; + ctx->ListState.CurrentList = make_list( list, BLOCK_SIZE ); + ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->node; + ctx->ListState.CurrentListPtr = ctx->ListState.CurrentBlock; + ctx->ListState.CurrentPos = 0; + + /* Reset acumulated list state: + */ + 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; + + ctx->ListState.ActiveIndex = 0; + ctx->ListState.ActiveEdgeFlag = 0; + + ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; + ctx->Driver.NewList( ctx, list, mode ); + + ctx->CurrentDispatch = ctx->Save; + _glapi_set_dispatch( ctx->CurrentDispatch ); +} + + + +/* + * End definition of current display list. + */ +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.CurrentListPtr) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glEndList" ); + return; + } + + (void) ALLOC_INSTRUCTION( ctx, OPCODE_END_OF_LIST, 0 ); + + /* Destroy old list, if any */ + _mesa_destroy_list(ctx, ctx->ListState.CurrentListNum); + /* Install the list */ + _mesa_HashInsert(ctx->Shared->DisplayList, ctx->ListState.CurrentListNum, ctx->ListState.CurrentList); + + + if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) + mesa_print_display_list(ctx->ListState.CurrentListNum); + + ctx->Driver.EndList( ctx ); + + ctx->ListState.CurrentList = NULL; + ctx->ListState.CurrentListNum = 0; + ctx->ListState.CurrentListPtr = 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); + GLuint list; + 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;iList.ListBase + 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. + */ +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_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + CALL_GetPixelTexGenParameterivSGIS(ctx->Exec, ( target, value)); +} + +static void GLAPIENTRY exec_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + CALL_GetPixelTexGenParameterfvSGIS(ctx->Exec, ( target, value)); +} + +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, GLint *first, + GLsizei *count, GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + CALL_MultiDrawArraysEXT(ctx->Exec, ( mode, first, count, primcount )); +} + +/* GL_EXT_multi_draw_arrays */ +static void GLAPIENTRY exec_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, + GLenum type, const GLvoid **indices, + GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + CALL_MultiDrawElementsEXT(ctx->Exec, (mode, count, type, indices, 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. + */ +void +_mesa_init_dlist_table( struct _glapi_table *table ) +{ + _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, _mesa_BlendFunc); /* loops-back to BlendFuncSeparate */ + SET_CallList(table, _mesa_save_CallList); + SET_CallLists(table, _mesa_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_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_DrawBuffer(table, save_DrawBuffer); + SET_DrawPixels(table, save_DrawPixels); + SET_Enable(table, save_Enable); + SET_EndList(table, _mesa_EndList); + SET_EvalMesh1(table, _mesa_save_EvalMesh1); + SET_EvalMesh2(table, _mesa_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_AreTexturesResidentEXT(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_GenTexturesEXT(table, exec_GenTextures); + SET_GetPointerv(table, exec_GetPointerv); + SET_IndexPointer(table, exec_IndexPointer); + SET_InterleavedArrays(table, exec_InterleavedArrays); + SET_IsTexture(table, exec_IsTexture); + SET_IsTextureEXT(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); + + /* 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_GetColorTableEXT(table, exec_GetColorTable); + SET_GetColorTableParameterfv(table, exec_GetColorTableParameterfv); + SET_GetColorTableParameterfvEXT(table, exec_GetColorTableParameterfv); + SET_GetColorTableParameteriv(table, exec_GetColorTableParameteriv); + SET_GetColorTableParameterivEXT(table, exec_GetColorTableParameteriv); + SET_GetConvolutionFilter(table, exec_GetConvolutionFilter); + SET_GetConvolutionFilterEXT(table, exec_GetConvolutionFilter); + SET_GetConvolutionParameterfv(table, exec_GetConvolutionParameterfv); + SET_GetConvolutionParameterfvEXT(table, exec_GetConvolutionParameterfv); + SET_GetConvolutionParameteriv(table, exec_GetConvolutionParameteriv); + SET_GetConvolutionParameterivEXT(table, exec_GetConvolutionParameteriv); + SET_GetHistogram(table, exec_GetHistogram); + SET_GetHistogramEXT(table, exec_GetHistogram); + SET_GetHistogramParameterfv(table, exec_GetHistogramParameterfv); + SET_GetHistogramParameterfvEXT(table, exec_GetHistogramParameterfv); + SET_GetHistogramParameteriv(table, exec_GetHistogramParameteriv); + SET_GetHistogramParameterivEXT(table, exec_GetHistogramParameteriv); + SET_GetMinmax(table, exec_GetMinmax); + SET_GetMinmaxEXT(table, exec_GetMinmax); + SET_GetMinmaxParameterfv(table, exec_GetMinmaxParameterfv); + SET_GetMinmaxParameterfvEXT(table, exec_GetMinmaxParameterfv); + SET_GetMinmaxParameteriv(table, exec_GetMinmaxParameteriv); + SET_GetMinmaxParameterivEXT(table, exec_GetMinmaxParameteriv); + SET_GetSeparableFilter(table, exec_GetSeparableFilter); + SET_GetSeparableFilterEXT(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 + + /* 15. GL_SGIX_pixel_texture */ + SET_PixelTexGenSGIX(table, save_PixelTexGenSGIX); + + /* 15. GL_SGIS_pixel_texture */ + SET_PixelTexGenParameteriSGIS(table, save_PixelTexGenParameteriSGIS); + SET_PixelTexGenParameterfSGIS(table, save_PixelTexGenParameterfSGIS); + SET_PixelTexGenParameterivSGIS(table, save_PixelTexGenParameterivSGIS); + SET_PixelTexGenParameterfvSGIS(table, save_PixelTexGenParameterfvSGIS); + SET_GetPixelTexGenParameterivSGIS(table, exec_GetPixelTexGenParameterivSGIS); + SET_GetPixelTexGenParameterfvSGIS(table, exec_GetPixelTexGenParameterfvSGIS); + + /* 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); + + /* 78. GL_EXT_paletted_texture */ +#if 0 + SET_ColorTableEXT(table, save_ColorTable); + SET_ColorSubTableEXT(table, save_ColorSubTable); +#endif + SET_GetColorTableEXT(table, exec_GetColorTable); + SET_GetColorTableParameterfvEXT(table, exec_GetColorTableParameterfv); + SET_GetColorTableParameterivEXT(table, exec_GetColorTableParameteriv); + + /* 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); + SET_MultiDrawElementsEXT(table, exec_MultiDrawElementsEXT); + + /* 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_IsProgram); + SET_LoadProgramNV(table, save_LoadProgramNV); + SET_ProgramParameter4dNV(table, save_ProgramParameter4dNV); + SET_ProgramParameter4dvNV(table, save_ProgramParameter4dvNV); + SET_ProgramParameter4fNV(table, save_ProgramParameter4fNV); + SET_ProgramParameter4fvNV(table, save_ProgramParameter4fvNV); + SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV); + SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV); + SET_TrackMatrixNV(table, save_TrackMatrixNV); + SET_VertexAttribPointerNV(table, _mesa_VertexAttribPointerNV); +#endif + + /* 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); + + /* ???. 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_IsProgram); + 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_ARB_occlusion_query + 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); + + /* 299. GL_EXT_blend_equation_separate */ + SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT); +} + + + +/*** + *** Debugging code + ***/ +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( GLcontext *ctx, GLuint list ) +{ + struct mesa_display_list *dlist; + Node *n; + GLboolean done; + + if (!CALL_IsList(GET_DISPATCH(), (list))) { + _mesa_printf("%u is not a display list ID\n", list); + return; + } + + dlist = (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list); + if (!dlist) + return; + + n = dlist->node; + + _mesa_printf("START-LIST %u, address %p\n", list, (void*)n ); + + done = n ? GL_FALSE : GL_TRUE; + while (!done) { + OpCode opcode = n[0].opcode; + GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0; + + if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { + /* this is a driver-extended opcode */ + ctx->ListExt.Opcode[i].Print(ctx, &n[1]); + n += ctx->ListExt.Opcode[i].Size; + } + else { + switch (opcode) { + case OPCODE_ACCUM: + _mesa_printf("accum %s %g\n", enum_string(n[1].e), n[2].f ); + break; + case OPCODE_BITMAP: + _mesa_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: + _mesa_printf("CallList %d\n", (int) n[1].ui ); + break; + case OPCODE_CALL_LIST_OFFSET: + _mesa_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: + _mesa_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: + _mesa_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: + _mesa_printf("Disable %s\n", enum_string(n[1].e)); + break; + case OPCODE_ENABLE: + _mesa_printf("Enable %s\n", enum_string(n[1].e)); + break; + case OPCODE_FRUSTUM: + _mesa_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: + _mesa_printf("LineStipple %d %x\n", n[1].i, (int) n[2].us ); + break; + case OPCODE_LOAD_IDENTITY: + _mesa_printf("LoadIdentity\n"); + break; + case OPCODE_LOAD_MATRIX: + _mesa_printf("LoadMatrix\n"); + _mesa_printf(" %8f %8f %8f %8f\n", + n[1].f, n[5].f, n[9].f, n[13].f); + _mesa_printf(" %8f %8f %8f %8f\n", + n[2].f, n[6].f, n[10].f, n[14].f); + _mesa_printf(" %8f %8f %8f %8f\n", + n[3].f, n[7].f, n[11].f, n[15].f); + _mesa_printf(" %8f %8f %8f %8f\n", + n[4].f, n[8].f, n[12].f, n[16].f); + break; + case OPCODE_MULT_MATRIX: + _mesa_printf("MultMatrix (or Rotate)\n"); + _mesa_printf(" %8f %8f %8f %8f\n", + n[1].f, n[5].f, n[9].f, n[13].f); + _mesa_printf(" %8f %8f %8f %8f\n", + n[2].f, n[6].f, n[10].f, n[14].f); + _mesa_printf(" %8f %8f %8f %8f\n", + n[3].f, n[7].f, n[11].f, n[15].f); + _mesa_printf(" %8f %8f %8f %8f\n", + n[4].f, n[8].f, n[12].f, n[16].f); + break; + case OPCODE_ORTHO: + _mesa_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: + _mesa_printf("PopAttrib\n"); + break; + case OPCODE_POP_MATRIX: + _mesa_printf("PopMatrix\n"); + break; + case OPCODE_POP_NAME: + _mesa_printf("PopName\n"); + break; + case OPCODE_PUSH_ATTRIB: + _mesa_printf("PushAttrib %x\n", n[1].bf ); + break; + case OPCODE_PUSH_MATRIX: + _mesa_printf("PushMatrix\n"); + break; + case OPCODE_PUSH_NAME: + _mesa_printf("PushName %d\n", (int) n[1].ui ); + break; + case OPCODE_RASTER_POS: + _mesa_printf("RasterPos %g %g %g %g\n", + n[1].f, n[2].f,n[3].f,n[4].f); + break; + case OPCODE_ROTATE: + _mesa_printf("Rotate %g %g %g %g\n", + n[1].f, n[2].f, n[3].f, n[4].f ); + break; + case OPCODE_SCALE: + _mesa_printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f ); + break; + case OPCODE_TRANSLATE: + _mesa_printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f ); + break; + case OPCODE_BIND_TEXTURE: + _mesa_printf("BindTexture %s %d\n", + _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui); + break; + case OPCODE_SHADE_MODEL: + _mesa_printf("ShadeModel %s\n", + _mesa_lookup_enum_by_nr(n[1].ui)); + break; + case OPCODE_MAP1: + _mesa_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: + _mesa_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: + _mesa_printf("MapGrid1 %d %.3f %.3f\n", + n[1].i, n[2].f, n[3].f); + break; + case OPCODE_MAPGRID2: + _mesa_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: + _mesa_printf("EvalMesh1 %d %d\n", n[1].i, n[2].i); + break; + case OPCODE_EVALMESH2: + _mesa_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: + _mesa_printf("ATTR_1F_NV attr %d: %f\n", + n[1].i, n[2].f); + break; + case OPCODE_ATTR_2F_NV: + _mesa_printf("ATTR_2F_NV attr %d: %f %f\n", + n[1].i, n[2].f, n[3].f); + break; + case OPCODE_ATTR_3F_NV: + _mesa_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: + _mesa_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: + _mesa_printf("ATTR_1F_ARB attr %d: %f\n", + n[1].i, n[2].f); + break; + case OPCODE_ATTR_2F_ARB: + _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n", + n[1].i, n[2].f, n[3].f); + break; + case OPCODE_ATTR_3F_ARB: + _mesa_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: + _mesa_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: + _mesa_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_INDEX: + _mesa_printf("INDEX: %f\n", n[1].f); + break; + case OPCODE_EDGEFLAG: + _mesa_printf("EDGEFLAG: %d\n", n[1].i); + break; + case OPCODE_BEGIN: + _mesa_printf("BEGIN %x\n", n[1].i); + break; + case OPCODE_END: + _mesa_printf("END\n"); + break; + case OPCODE_RECTF: + _mesa_printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f, n[4].f); + break; + case OPCODE_EVAL_C1: + _mesa_printf("EVAL_C1 %f\n", n[1].f); + break; + case OPCODE_EVAL_C2: + _mesa_printf("EVAL_C2 %f %f\n", n[1].f, n[2].f); + break; + case OPCODE_EVAL_P1: + _mesa_printf("EVAL_P1 %d\n", n[1].i); + break; + case OPCODE_EVAL_P2: + _mesa_printf("EVAL_P2 %d %d\n", n[1].i, n[2].i); + break; + + + + /* + * meta opcodes/commands + */ + case OPCODE_ERROR: + _mesa_printf("Error: %s %s\n", + enum_string(n[1].e), (const char *)n[2].data ); + break; + case OPCODE_CONTINUE: + _mesa_printf("DISPLAY-LIST-CONTINUE\n"); + n = (Node *) n[1].next; + break; + case OPCODE_END_OF_LIST: + _mesa_printf("END-LIST %u\n", list); + done = GL_TRUE; + break; + default: + if (opcode < 0 || opcode > OPCODE_END_OF_LIST) { + _mesa_printf("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n", + opcode, (void*) n); + return; + } + else { + _mesa_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 ) +{ + vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ + vfmt->Begin = save_Begin; + vfmt->CallList = _mesa_save_CallList; + vfmt->CallLists = _mesa_save_CallLists; + vfmt->Color3f = save_Color3f; + vfmt->Color3fv = save_Color3fv; + vfmt->Color4f = save_Color4f; + vfmt->Color4fv = save_Color4fv; + vfmt->EdgeFlag = save_EdgeFlag; + vfmt->EdgeFlagv = save_EdgeFlagv; + vfmt->End = save_End; + vfmt->EvalCoord1f = save_EvalCoord1f; + vfmt->EvalCoord1fv = save_EvalCoord1fv; + vfmt->EvalCoord2f = save_EvalCoord2f; + vfmt->EvalCoord2fv = save_EvalCoord2fv; + vfmt->EvalPoint1 = save_EvalPoint1; + vfmt->EvalPoint2 = save_EvalPoint2; + 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->EvalMesh1 = _mesa_save_EvalMesh1; + vfmt->EvalMesh2 = _mesa_save_EvalMesh2; + 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; +#endif +} + + + +void _mesa_init_display_list( GLcontext * ctx ) +{ + /* Display list */ + ctx->ListState.CallDepth = 0; + ctx->ExecuteFlag = GL_TRUE; + ctx->CompileFlag = GL_FALSE; + ctx->ListState.CurrentListPtr = NULL; + ctx->ListState.CurrentBlock = NULL; + ctx->ListState.CurrentListNum = 0; + ctx->ListState.CurrentPos = 0; + + /* Display List group */ + ctx->List.ListBase = 0; + + _mesa_save_vtxfmt_init( &ctx->ListState.ListVtxfmt ); +} diff --git a/reactos/dll/mesa32/src/main/dlist.h b/reactos/dll/mesa32/src/main/dlist.h new file mode 100644 index 00000000000..1a5b391e760 --- /dev/null +++ b/reactos/dll/mesa32/src/main/dlist.h @@ -0,0 +1,103 @@ +/** + * \file dlist.h + * Display lists management. + */ + +/* + * 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. + */ + + + +#ifndef DLIST_H +#define DLIST_H + + +#include "mtypes.h" + + +#if _HAVE_FULL_GL + +extern void _mesa_init_lists( void ); + +extern void _mesa_destroy_list( GLcontext *ctx, GLuint list ); + +extern void GLAPIENTRY _mesa_CallList( GLuint list ); + +extern void GLAPIENTRY _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); + +extern void GLAPIENTRY _mesa_DeleteLists( GLuint list, GLsizei range ); + +extern void GLAPIENTRY _mesa_EndList( void ); + +extern GLuint GLAPIENTRY _mesa_GenLists( GLsizei range ); + +extern GLboolean GLAPIENTRY _mesa_IsList( GLuint list ); + +extern void GLAPIENTRY _mesa_ListBase( GLuint base ); + +extern void GLAPIENTRY _mesa_NewList( GLuint list, GLenum mode ); + +extern void _mesa_init_dlist_table( struct _glapi_table *table ); + +extern void _mesa_save_error( GLcontext *ctx, GLenum error, const char *s ); + +extern void _mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ); + + +extern void *_mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz ); + +extern GLint _mesa_alloc_opcode( GLcontext *ctx, GLuint sz, + void (*execute)( GLcontext *, void * ), + void (*destroy)( GLcontext *, void * ), + void (*print)( GLcontext *, void * ) ); + +extern void GLAPIENTRY _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, + GLint j1, GLint j2 ); +extern void GLAPIENTRY _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ); +extern void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); +extern void GLAPIENTRY _mesa_save_CallList( GLuint list ); +extern void _mesa_init_display_list( GLcontext * ctx ); +extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt ); + + +#else + +/** No-op */ +#define _mesa_init_lists() ((void)0) + +/** No-op */ +#define _mesa_destroy_list(c,l) ((void)0) + +/** No-op */ +#define _mesa_init_dlist_table(t,ts) ((void)0) + +/** No-op */ +#define _mesa_init_display_list(c) ((void)0) + +/** No-op */ +#define _mesa_save_vtxfmt_init(v) ((void)0) + +#endif + +#endif diff --git a/reactos/dll/mesa32/src/main/drawpix.c b/reactos/dll/mesa32/src/main/drawpix.c new file mode 100644 index 00000000000..4f7e24a1ec4 --- /dev/null +++ b/reactos/dll/mesa32/src/main/drawpix.c @@ -0,0 +1,317 @@ +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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. + */ + +#include "glheader.h" +#include "imports.h" +#include "colormac.h" +#include "context.h" +#include "drawpix.h" +#include "feedback.h" +#include "macros.h" +#include "state.h" +#include "mtypes.h" + + +#if _HAVE_FULL_GL + +/* + * Execute glDrawPixels + */ +void GLAPIENTRY +_mesa_DrawPixels( GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid *pixels ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawPixels (invalid fragment program)"); + return; + } + + if (width < 0 || height < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glDrawPixels(width or height < 0" ); + return; + } + + if (ctx->NewState) { + _mesa_update_state(ctx); + } + + if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { + _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, + "glDrawPixels(incomplete framebuffer)" ); + return; + } + + if (!ctx->Current.RasterPosValid) { + return; + } + + if (ctx->RenderMode == GL_RENDER) { + /* Round, to satisfy conformance tests (matches SGI's OpenGL) */ + GLint x = IROUND(ctx->Current.RasterPos[0]); + GLint y = IROUND(ctx->Current.RasterPos[1]); + ctx->OcclusionResult = GL_TRUE; + ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type, + &ctx->Unpack, pixels); + } + else if (ctx->RenderMode == GL_FEEDBACK) { + /* Feedback the current raster pos info */ + FLUSH_CURRENT( ctx, 0 ); + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); + _mesa_feedback_vertex( ctx, + ctx->Current.RasterPos, + ctx->Current.RasterColor, + ctx->Current.RasterIndex, + ctx->Current.RasterTexCoords[0] ); + } + else { + ASSERT(ctx->RenderMode == GL_SELECT); + /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ + } +} + + +void GLAPIENTRY +_mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, + GLenum type ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyPixels (invalid fragment program)"); + return; + } + + if (width < 0 || height < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glCopyPixels(width or height < 0)" ); + return; + } + + if (ctx->NewState) { + _mesa_update_state(ctx); + } + + if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT || + ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { + _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, + "glCopyPixels(incomplete framebuffer)" ); + return; + } + + if (!ctx->Current.RasterPosValid) { + return; + } + + if (ctx->RenderMode == GL_RENDER) { + /* Round to satisfy conformance tests (matches SGI's OpenGL) */ + GLint destx = IROUND(ctx->Current.RasterPos[0]); + GLint desty = IROUND(ctx->Current.RasterPos[1]); + ctx->OcclusionResult = GL_TRUE; + ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty, + type ); + } + else if (ctx->RenderMode == GL_FEEDBACK) { + FLUSH_CURRENT( ctx, 0 ); + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN ); + _mesa_feedback_vertex( ctx, + ctx->Current.RasterPos, + ctx->Current.RasterColor, + ctx->Current.RasterIndex, + ctx->Current.RasterTexCoords[0] ); + } + else { + ASSERT(ctx->RenderMode == GL_SELECT); + /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ + } +} + +#endif /* _HAVE_FULL_GL */ + + + +void GLAPIENTRY +_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, GLvoid *pixels ) +{ + GET_CURRENT_CONTEXT(ctx); + const struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + 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 (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { + _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, + "glReadPixels(incomplete framebuffer)" ); + return; + } + + if (!rb) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(no readbuffer)"); + return; + } + + ctx->Driver.ReadPixels(ctx, x, y, width, height, + format, type, &ctx->Pack, pixels); +} + + + +void GLAPIENTRY +_mesa_Bitmap( GLsizei width, GLsizei height, + GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, + const GLubyte *bitmap ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBitmap (invalid fragment program)"); + return; + } + + if (width < 0 || height < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glBitmap(width or height < 0)" ); + return; + } + + if (!ctx->Current.RasterPosValid) { + return; /* do nothing */ + } + + if (ctx->NewState) { + _mesa_update_state(ctx); + } + + if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { + _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, + "glBitmap(incomplete framebuffer)"); + return; + } + + if (ctx->RenderMode == GL_RENDER) { + /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ + GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); + GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); + ctx->OcclusionResult = GL_TRUE; + ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); + } +#if _HAVE_FULL_GL + else if (ctx->RenderMode == GL_FEEDBACK) { + FLUSH_CURRENT(ctx, 0); + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN ); + _mesa_feedback_vertex( ctx, + ctx->Current.RasterPos, + ctx->Current.RasterColor, + ctx->Current.RasterIndex, + ctx->Current.RasterTexCoords[0] ); + } + else { + ASSERT(ctx->RenderMode == GL_SELECT); + /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ + } +#endif + + /* update raster position */ + ctx->Current.RasterPos[0] += xmove; + ctx->Current.RasterPos[1] += ymove; +} + + + +#if 0 /* experimental */ +/* + * Execute glDrawDepthPixelsMESA(). This function accepts both a color + * image and depth (Z) image. Rasterization produces fragments with + * color and Z taken from these images. This function is intended for + * Z-compositing. Normally, this operation requires two glDrawPixels + * calls with stencil testing. + */ +void GLAPIENTRY +_mesa_DrawDepthPixelsMESA( GLsizei width, GLsizei height, + GLenum colorFormat, GLenum colorType, + const GLvoid *colors, + GLenum depthType, const GLvoid *depths ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (width < 0 || height < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, + "glDrawDepthPixelsMESA(width or height < 0" ); + return; + } + + if (!ctx->Current.RasterPosValid) { + return; + } + + if (ctx->NewState) { + _mesa_update_state(ctx); + } + + if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { + _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, + "glDrawDepthPixelsMESA(incomplete framebuffer)"); + return; + } + + if (ctx->RenderMode == GL_RENDER) { + /* Round, to satisfy conformance tests (matches SGI's OpenGL) */ + GLint x = IROUND(ctx->Current.RasterPos[0]); + GLint y = IROUND(ctx->Current.RasterPos[1]); + ctx->OcclusionResult = GL_TRUE; + ctx->Driver.DrawDepthPixelsMESA(ctx, x, y, width, height, + colorFormat, colorType, colors, + depthType, depths, &ctx->Unpack); + } + else if (ctx->RenderMode == GL_FEEDBACK) { + /* Feedback the current raster pos info */ + FLUSH_CURRENT( ctx, 0 ); + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); + _mesa_feedback_vertex( ctx, + ctx->Current.RasterPos, + ctx->Current.RasterColor, + ctx->Current.RasterIndex, + ctx->Current.RasterTexCoords[0] ); + } + else { + ASSERT(ctx->RenderMode == GL_SELECT); + /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ + } +} + +#endif diff --git a/reactos/dll/mesa32/src/main/drawpix.h b/reactos/dll/mesa32/src/main/drawpix.h new file mode 100644 index 00000000000..2a2d7de8d81 --- /dev/null +++ b/reactos/dll/mesa32/src/main/drawpix.h @@ -0,0 +1,55 @@ + +/* + * 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 DRAWPIXELS_H +#define DRAWPIXELS_H + + +#include "mtypes.h" + + +extern void GLAPIENTRY +_mesa_DrawPixels( GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid *pixels ); + + +extern void GLAPIENTRY +_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, GLvoid *pixels ); + + +extern void GLAPIENTRY +_mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, + GLenum type ); + + +extern void GLAPIENTRY +_mesa_Bitmap( GLsizei width, GLsizei height, + GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, + const GLubyte *bitmap ); + + +#endif diff --git a/reactos/dll/mesa32/src/main/enable.c b/reactos/dll/mesa32/src/main/enable.c new file mode 100644 index 00000000000..67fd083ca82 --- /dev/null +++ b/reactos/dll/mesa32/src/main/enable.c @@ -0,0 +1,1456 @@ +/** + * \file enable.c + * Enable/disable/query GL capabilities. + */ + +/* + * 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. + */ + + +#include "glheader.h" +#include "context.h" +#include "enable.h" +#include "light.h" +#include "macros.h" +#include "simple_list.h" +#include "mtypes.h" +#include "enums.h" +#include "math/m_matrix.h" +#include "math/m_xform.h" + + + +#define CHECK_EXTENSION(EXTNAME, CAP) \ + if (!ctx->Extensions.EXTNAME) { \ + _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)", \ + state ? "Enable" : "Disable", CAP); \ + return; \ + } + + +static void +client_state( GLcontext *ctx, GLenum cap, GLboolean state ) +{ + GLuint flag; + GLuint *var; + + switch (cap) { + case GL_VERTEX_ARRAY: + var = &ctx->Array.Vertex.Enabled; + flag = _NEW_ARRAY_VERTEX; + break; + case GL_NORMAL_ARRAY: + var = &ctx->Array.Normal.Enabled; + flag = _NEW_ARRAY_NORMAL; + break; + case GL_COLOR_ARRAY: + var = &ctx->Array.Color.Enabled; + flag = _NEW_ARRAY_COLOR0; + break; + case GL_INDEX_ARRAY: + var = &ctx->Array.Index.Enabled; + flag = _NEW_ARRAY_INDEX; + break; + case GL_TEXTURE_COORD_ARRAY: + var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; + flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture); + break; + case GL_EDGE_FLAG_ARRAY: + var = &ctx->Array.EdgeFlag.Enabled; + flag = _NEW_ARRAY_EDGEFLAG; + break; + case GL_FOG_COORDINATE_ARRAY_EXT: + var = &ctx->Array.FogCoord.Enabled; + flag = _NEW_ARRAY_FOGCOORD; + break; + case GL_SECONDARY_COLOR_ARRAY_EXT: + var = &ctx->Array.SecondaryColor.Enabled; + flag = _NEW_ARRAY_COLOR1; + break; + +#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; + var = &ctx->Array.VertexAttrib[n].Enabled; + flag = _NEW_ARRAY_ATTRIB(n); + } + break; +#endif /* FEATURE_NV_vertex_program */ + + default: + _mesa_error( ctx, GL_INVALID_ENUM, + "glEnable/DisableClientState(0x%x)", cap); + return; + } + + if (*var == state) + return; + + FLUSH_VERTICES(ctx, _NEW_ARRAY); + ctx->Array.NewState |= flag; + *var = state; + + if (state) + ctx->Array._Enabled |= flag; + else + ctx->Array._Enabled &= ~flag; + + if (ctx->Driver.Enable) { + (*ctx->Driver.Enable)( ctx, cap, state ); + } +} + + +/** + * Enable GL capability. + * + * \param cap capability. + * + * \sa glEnable(). + * + * 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 capability. + * + * \sa glDisable(). + * + * 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) { \ + _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \ + state ? "Enable" : "Disable", CAP); \ + return; \ + } + +#define CHECK_EXTENSION2(EXT1, EXT2, CAP) \ + if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \ + _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \ + state ? "Enable" : "Disable", CAP); \ + return; \ + } + + + +/** + * Perform glEnable() and glDisable() calls. + * + * \param ctx GL context. + * \param cap capability. + * \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( GLcontext *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: + if (ctx->Color.BlendEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.BlendEnabled = state; + /* This is needed to support 1.1's RGB logic ops AND + * 1.0's blending logicops. + */ + ctx->Color._LogicOpEnabled = + (ctx->Color.ColorLogicOpEnabled || + (state && ctx->Color.BlendEquationRGB == GL_LOGIC_OP)); + 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_CULL_VERTEX_EXT: + CHECK_EXTENSION(EXT_cull_vertex, cap); + if (ctx->Transform.CullVertexFlag == state) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Transform.CullVertexFlag = state; + break; + + case GL_DEPTH_TEST: + if (state && ctx->DrawBuffer->Visual.depthBits == 0) { + _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); + return; + } + 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_HISTOGRAM: + CHECK_EXTENSION(EXT_histogram, cap); + if (ctx->Pixel.HistogramEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.HistogramEnabled = 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; + /* This is needed to support 1.1's RGB logic ops AND + * 1.0's blending logicops. + */ + ctx->Color._LogicOpEnabled = + (state || (ctx->Color.BlendEnabled && + ctx->Color.BlendEquationRGB == GL_LOGIC_OP)); + 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_MINMAX: + if (ctx->Pixel.MinMaxEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.MinMaxEnabled = 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 (state && ctx->DrawBuffer->Visual.stencilBits == 0) { + _mesa_warning(ctx, + "glEnable(GL_STENCIL_TEST) but no stencil buffer"); + return; + } + if (ctx->Stencil.Enabled==state) + return; + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.Enabled = state; + break; + case GL_TEXTURE_1D: { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE_1D_BIT; + if (state) + newenabled |= TEXTURE_1D_BIT; + if (!ctx->DrawBuffer->Visual.rgbMode + || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + break; + } + case GL_TEXTURE_2D: { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE_2D_BIT; + if (state) + newenabled |= TEXTURE_2D_BIT; + if (!ctx->DrawBuffer->Visual.rgbMode + || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + break; + } + case GL_TEXTURE_3D: { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE_3D_BIT; + if (state) + newenabled |= TEXTURE_3D_BIT; + if (!ctx->DrawBuffer->Visual.rgbMode + || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + break; + } + case GL_TEXTURE_GEN_Q: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + 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: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + 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: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + 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: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + 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; + } + + /* + * 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: + client_state( ctx, cap, state ); + return; + + /* GL_HP_occlusion_test */ + case GL_OCCLUSION_TEST_HP: + CHECK_EXTENSION(HP_occlusion_test, cap); + if (ctx->Depth.OcclusionTest == state) + return; + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.OcclusionTest = state; + if (state) + ctx->OcclusionResult = ctx->OcclusionResultSaved; + else + ctx->OcclusionResultSaved = ctx->OcclusionResult; + break; + + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + CHECK_EXTENSION(SGIS_pixel_texture, cap); + if (ctx->Pixel.PixelTextureEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PixelTextureEnabled = state; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + CHECK_EXTENSION(SGIX_pixel_texture, cap); + if (ctx->Pixel.PixelTextureEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PixelTextureEnabled = state; + break; + + /* GL_SGI_color_table */ + case GL_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table, cap); + if (ctx->Pixel.ColorTableEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.ColorTableEnabled = state; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table, cap); + if (ctx->Pixel.PostConvolutionColorTableEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostConvolutionColorTableEnabled = state; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table, cap); + if (ctx->Pixel.PostColorMatrixColorTableEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostColorMatrixColorTableEnabled = state; + break; + 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_EXT_convolution */ + case GL_CONVOLUTION_1D: + CHECK_EXTENSION(EXT_convolution, cap); + if (ctx->Pixel.Convolution1DEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.Convolution1DEnabled = state; + break; + case GL_CONVOLUTION_2D: + CHECK_EXTENSION(EXT_convolution, cap); + if (ctx->Pixel.Convolution2DEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.Convolution2DEnabled = state; + break; + case GL_SEPARABLE_2D: + CHECK_EXTENSION(EXT_convolution, cap); + if (ctx->Pixel.Separable2DEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.Separable2DEnabled = state; + break; + + /* GL_ARB_texture_cube_map */ + case GL_TEXTURE_CUBE_MAP_ARB: + { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE_CUBE_BIT; + CHECK_EXTENSION(ARB_texture_cube_map, cap); + if (state) + newenabled |= TEXTURE_CUBE_BIT; + if (!ctx->DrawBuffer->Visual.rgbMode + || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + } + break; + + /* GL_EXT_secondary_color */ + case GL_COLOR_SUM_EXT: + CHECK_EXTENSION(EXT_secondary_color, cap); + if (ctx->Fog.ColorSumEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.ColorSumEnabled = state; + break; + + /* GL_ARB_multisample */ + case GL_MULTISAMPLE_ARB: + CHECK_EXTENSION(ARB_multisample, cap); + if (ctx->Multisample.Enabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.Enabled = state; + break; + case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: + CHECK_EXTENSION(ARB_multisample, cap); + if (ctx->Multisample.SampleAlphaToCoverage == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.SampleAlphaToCoverage = state; + break; + case GL_SAMPLE_ALPHA_TO_ONE_ARB: + CHECK_EXTENSION(ARB_multisample, cap); + if (ctx->Multisample.SampleAlphaToOne == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.SampleAlphaToOne = state; + break; + case GL_SAMPLE_COVERAGE_ARB: + CHECK_EXTENSION(ARB_multisample, cap); + if (ctx->Multisample.SampleCoverage == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.SampleCoverage = state; + break; + case GL_SAMPLE_COVERAGE_INVERT_ARB: + CHECK_EXTENSION(ARB_multisample, cap); + 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 + case GL_VERTEX_PROGRAM_NV: + CHECK_EXTENSION2(NV_vertex_program, ARB_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_NV: + CHECK_EXTENSION2(NV_vertex_program, ARB_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_NV: + CHECK_EXTENSION2(NV_vertex_program, ARB_vertex_program, cap); + if (ctx->VertexProgram.TwoSideEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + ctx->VertexProgram.TwoSideEnabled = state; + break; + 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); + { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE_RECT_BIT; + CHECK_EXTENSION(NV_texture_rectangle, cap); + if (state) + newenabled |= TEXTURE_RECT_BIT; + if (!ctx->DrawBuffer->Visual.rgbMode + || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + } + 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->_TriangleCaps |= DD_TRI_TWOSTENCIL; + } else { + 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 (state && ctx->DrawBuffer->Visual.depthBits == 0) { + _mesa_warning(ctx, + "glEnable(GL_DEPTH_BOUNDS_TEST_EXT) but no depth buffer"); + return; + } + if (ctx->Depth.BoundsTest == state) + return; + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.BoundsTest = state; + break; + + /* GL_MESA_program_debug */ + case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: + CHECK_EXTENSION(MESA_program_debug, cap); + ctx->FragmentProgram.CallbackEnabled = state; + break; + case GL_VERTEX_PROGRAM_CALLBACK_MESA: + CHECK_EXTENSION(MESA_program_debug, cap); + ctx->VertexProgram.CallbackEnabled = 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 + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "%s(0x%x)", state ? "glEnable" : "glDisable", cap); + return; + } + + if (ctx->Driver.Enable) { + (*ctx->Driver.Enable)( ctx, cap, state ); + } +} + + +/** + * Enable GL capability. + * + * \param cap capability. + * + * \sa glEnable(). + * + * Get's the current context, assures that we're outside glBegin()/glEnd() and + * calls _mesa_set_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. + * + * \param cap capability. + * + * \sa glDisable(). + * + * Get's the current context, assures that we're outside glBegin()/glEnd() and + * calls _mesa_set_enable(). + */ +void GLAPIENTRY +_mesa_Disable( GLenum cap ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + _mesa_set_enable( ctx, cap, GL_FALSE ); +} + + +#undef CHECK_EXTENSION +#define CHECK_EXTENSION(EXTNAME) \ + if (!ctx->Extensions.EXTNAME) { \ + _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \ + return GL_FALSE; \ + } + + +/** + * Test whether a capability is enabled. + * + * \param cap capability. + * + * 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; + 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: + { + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->Enabled & TEXTURE_1D_BIT) ? GL_TRUE : GL_FALSE; + } + case GL_TEXTURE_2D: + { + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->Enabled & TEXTURE_2D_BIT) ? GL_TRUE : GL_FALSE; + } + case GL_TEXTURE_3D: + { + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->Enabled & TEXTURE_3D_BIT) ? GL_TRUE : GL_FALSE; + } + case GL_TEXTURE_GEN_Q: + { + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE; + } + case GL_TEXTURE_GEN_R: + { + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE; + } + case GL_TEXTURE_GEN_S: + { + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE; + } + case GL_TEXTURE_GEN_T: + { + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE; + } + + /* + * CLIENT STATE!!! + */ + case GL_VERTEX_ARRAY: + return (ctx->Array.Vertex.Enabled != 0); + case GL_NORMAL_ARRAY: + return (ctx->Array.Normal.Enabled != 0); + case GL_COLOR_ARRAY: + return (ctx->Array.Color.Enabled != 0); + case GL_INDEX_ARRAY: + return (ctx->Array.Index.Enabled != 0); + case GL_TEXTURE_COORD_ARRAY: + return (ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled != 0); + case GL_EDGE_FLAG_ARRAY: + return (ctx->Array.EdgeFlag.Enabled != 0); + case GL_FOG_COORDINATE_ARRAY_EXT: + CHECK_EXTENSION(EXT_fog_coord); + return (ctx->Array.FogCoord.Enabled != 0); + case GL_SECONDARY_COLOR_ARRAY_EXT: + CHECK_EXTENSION(EXT_secondary_color); + return (ctx->Array.SecondaryColor.Enabled != 0); + + /* GL_EXT_histogram */ + case GL_HISTOGRAM: + CHECK_EXTENSION(EXT_histogram); + return ctx->Pixel.HistogramEnabled; + case GL_MINMAX: + CHECK_EXTENSION(EXT_histogram); + return ctx->Pixel.MinMaxEnabled; + + /* GL_HP_occlusion_test */ + case GL_OCCLUSION_TEST_HP: + CHECK_EXTENSION(HP_occlusion_test); + return ctx->Depth.OcclusionTest; + + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + CHECK_EXTENSION(SGIS_pixel_texture); + return ctx->Pixel.PixelTextureEnabled; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + CHECK_EXTENSION(SGIX_pixel_texture); + return ctx->Pixel.PixelTextureEnabled; + + /* GL_SGI_color_table */ + case GL_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table); + return ctx->Pixel.ColorTableEnabled; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table); + return ctx->Pixel.PostConvolutionColorTableEnabled; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table); + return ctx->Pixel.PostColorMatrixColorTableEnabled; + + /* 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_EXT_convolution */ + case GL_CONVOLUTION_1D: + CHECK_EXTENSION(EXT_convolution); + return ctx->Pixel.Convolution1DEnabled; + case GL_CONVOLUTION_2D: + CHECK_EXTENSION(EXT_convolution); + return ctx->Pixel.Convolution2DEnabled; + case GL_SEPARABLE_2D: + CHECK_EXTENSION(EXT_convolution); + return ctx->Pixel.Separable2DEnabled; + + /* GL_ARB_texture_cube_map */ + case GL_TEXTURE_CUBE_MAP_ARB: + CHECK_EXTENSION(ARB_texture_cube_map); + { + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->Enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE; + } + + /* GL_ARB_multisample */ + case GL_MULTISAMPLE_ARB: + CHECK_EXTENSION(ARB_multisample); + return ctx->Multisample.Enabled; + case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: + CHECK_EXTENSION(ARB_multisample); + return ctx->Multisample.SampleAlphaToCoverage; + case GL_SAMPLE_ALPHA_TO_ONE_ARB: + CHECK_EXTENSION(ARB_multisample); + return ctx->Multisample.SampleAlphaToOne; + case GL_SAMPLE_COVERAGE_ARB: + CHECK_EXTENSION(ARB_multisample); + return ctx->Multisample.SampleCoverage; + case GL_SAMPLE_COVERAGE_INVERT_ARB: + CHECK_EXTENSION(ARB_multisample); + 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: + return ctx->Point.PointSprite; + +#if FEATURE_NV_vertex_program + case GL_VERTEX_PROGRAM_NV: + CHECK_EXTENSION(NV_vertex_program); + return ctx->VertexProgram.Enabled; + case GL_VERTEX_PROGRAM_POINT_SIZE_NV: + CHECK_EXTENSION(NV_vertex_program); + return ctx->VertexProgram.PointSizeEnabled; + case GL_VERTEX_PROGRAM_TWO_SIDE_NV: + CHECK_EXTENSION(NV_vertex_program); + return ctx->VertexProgram.TwoSideEnabled; + 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; + return (ctx->Array.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); + { + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->Enabled & TEXTURE_RECT_BIT) ? GL_TRUE : GL_FALSE; + } + + /* 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_MESA_program_debug */ + case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: + CHECK_EXTENSION(MESA_program_debug); + return ctx->FragmentProgram.CallbackEnabled; + case GL_VERTEX_PROGRAM_CALLBACK_MESA: + CHECK_EXTENSION(MESA_program_debug); + return ctx->VertexProgram.CallbackEnabled; +#if FEATURE_ATI_fragment_shader + case GL_FRAGMENT_SHADER_ATI: + CHECK_EXTENSION(ATI_fragment_shader); + return ctx->ATIFragmentShader.Enabled; +#endif /* FEATURE_ATI_fragment_shader */ + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap); + return GL_FALSE; + } +} diff --git a/reactos/dll/mesa32/src/main/enable.h b/reactos/dll/mesa32/src/main/enable.h new file mode 100644 index 00000000000..25c90b0275a --- /dev/null +++ b/reactos/dll/mesa32/src/main/enable.h @@ -0,0 +1,57 @@ +/** + * \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 "mtypes.h" + + +extern void +_mesa_set_enable( GLcontext* 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 GLAPIENTRY +_mesa_EnableClientState( GLenum cap ); + +extern void GLAPIENTRY +_mesa_DisableClientState( GLenum cap ); + + +#endif diff --git a/reactos/dll/mesa32/src/main/enums.c b/reactos/dll/mesa32/src/main/enums.c new file mode 100644 index 00000000000..837618cd74a --- /dev/null +++ b/reactos/dll/mesa32/src/main/enums.c @@ -0,0 +1,4570 @@ +/* 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 "glheader.h" +#include "enums.h" +#include "imports.h" + +typedef struct { + size_t offset; + int n; +} enum_elt; + +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_STENCIL_FACE_EXT\0" + "GL_ACTIVE_TEXTURE\0" + "GL_ACTIVE_TEXTURE_ARB\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_ALPHA16_EXT\0" + "GL_ALPHA4\0" + "GL_ALPHA4_EXT\0" + "GL_ALPHA8\0" + "GL_ALPHA8_EXT\0" + "GL_ALPHA_BIAS\0" + "GL_ALPHA_BITS\0" + "GL_ALPHA_SCALE\0" + "GL_ALPHA_TEST\0" + "GL_ALPHA_TEST_FUNC\0" + "GL_ALPHA_TEST_REF\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_ARB\0" + "GL_ARRAY_BUFFER_BINDING\0" + "GL_ARRAY_BUFFER_BINDING_ARB\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_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_RGB\0" + "GL_BLEND_EQUATION\0" + "GL_BLEND_EQUATION_ALPHA_EXT\0" + "GL_BLEND_EQUATION_EXT\0" + "GL_BLEND_EQUATION_RGB_EXT\0" + "GL_BLEND_SRC\0" + "GL_BLEND_SRC_ALPHA\0" + "GL_BLEND_SRC_RGB\0" + "GL_BLUE\0" + "GL_BLUE_BIAS\0" + "GL_BLUE_BITS\0" + "GL_BLUE_SCALE\0" + "GL_BOOL_ARB\0" + "GL_BOOL_VEC2_ARB\0" + "GL_BOOL_VEC3_ARB\0" + "GL_BOOL_VEC4_ARB\0" + "GL_BUFFER_ACCESS\0" + "GL_BUFFER_ACCESS_ARB\0" + "GL_BUFFER_MAPPED\0" + "GL_BUFFER_MAPPED_ARB\0" + "GL_BUFFER_MAP_POINTER\0" + "GL_BUFFER_MAP_POINTER_ARB\0" + "GL_BUFFER_SIZE\0" + "GL_BUFFER_SIZE_ARB\0" + "GL_BUFFER_USAGE\0" + "GL_BUFFER_USAGE_ARB\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_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_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_EXT\0" + "GL_COLOR_ATTACHMENT10_EXT\0" + "GL_COLOR_ATTACHMENT11_EXT\0" + "GL_COLOR_ATTACHMENT12_EXT\0" + "GL_COLOR_ATTACHMENT13_EXT\0" + "GL_COLOR_ATTACHMENT14_EXT\0" + "GL_COLOR_ATTACHMENT15_EXT\0" + "GL_COLOR_ATTACHMENT1_EXT\0" + "GL_COLOR_ATTACHMENT2_EXT\0" + "GL_COLOR_ATTACHMENT3_EXT\0" + "GL_COLOR_ATTACHMENT4_EXT\0" + "GL_COLOR_ATTACHMENT5_EXT\0" + "GL_COLOR_ATTACHMENT6_EXT\0" + "GL_COLOR_ATTACHMENT7_EXT\0" + "GL_COLOR_ATTACHMENT8_EXT\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_BIAS\0" + "GL_COLOR_TABLE_BLUE_SIZE\0" + "GL_COLOR_TABLE_BLUE_SIZE_EXT\0" + "GL_COLOR_TABLE_FORMAT\0" + "GL_COLOR_TABLE_FORMAT_EXT\0" + "GL_COLOR_TABLE_GREEN_SIZE\0" + "GL_COLOR_TABLE_GREEN_SIZE_EXT\0" + "GL_COLOR_TABLE_INTENSITY_SIZE\0" + "GL_COLOR_TABLE_INTENSITY_SIZE_EXT\0" + "GL_COLOR_TABLE_LUMINANCE_SIZE\0" + "GL_COLOR_TABLE_LUMINANCE_SIZE_EXT\0" + "GL_COLOR_TABLE_RED_SIZE\0" + "GL_COLOR_TABLE_RED_SIZE_EXT\0" + "GL_COLOR_TABLE_SCALE\0" + "GL_COLOR_TABLE_WIDTH\0" + "GL_COLOR_TABLE_WIDTH_EXT\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_R_TO_TEXTURE\0" + "GL_COMPARE_R_TO_TEXTURE_ARB\0" + "GL_COMPILE\0" + "GL_COMPILE_AND_EXECUTE\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_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_TEXTURE_FORMATS\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_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_ARB\0" + "GL_COORD_REPLACE_NV\0" + "GL_COPY\0" + "GL_COPY_INVERTED\0" + "GL_COPY_PIXEL_TOKEN\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_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_TEXTURE_COORDS\0" + "GL_CURRENT_SECONDARY_COLOR\0" + "GL_CURRENT_TEXTURE_COORDS\0" + "GL_CURRENT_VERTEX_ATTRIB_ARB\0" + "GL_CURRENT_WEIGHT_ARB\0" + "GL_CW\0" + "GL_DECAL\0" + "GL_DECR\0" + "GL_DECR_WRAP\0" + "GL_DECR_WRAP_EXT\0" + "GL_DEPTH\0" + "GL_DEPTH_ATTACHMENT_EXT\0" + "GL_DEPTH_BIAS\0" + "GL_DEPTH_BITS\0" + "GL_DEPTH_BOUNDS_EXT\0" + "GL_DEPTH_BOUNDS_TEST_EXT\0" + "GL_DEPTH_BUFFER_BIT\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_SGIX\0" + "GL_DEPTH_COMPONENT24\0" + "GL_DEPTH_COMPONENT24_ARB\0" + "GL_DEPTH_COMPONENT24_SGIX\0" + "GL_DEPTH_COMPONENT32\0" + "GL_DEPTH_COMPONENT32_ARB\0" + "GL_DEPTH_COMPONENT32_SGIX\0" + "GL_DEPTH_FUNC\0" + "GL_DEPTH_RANGE\0" + "GL_DEPTH_SCALE\0" + "GL_DEPTH_STENCIL_NV\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_ARB\0" + "GL_DRAW_BUFFER0_ATI\0" + "GL_DRAW_BUFFER10_ARB\0" + "GL_DRAW_BUFFER10_ATI\0" + "GL_DRAW_BUFFER11_ARB\0" + "GL_DRAW_BUFFER11_ATI\0" + "GL_DRAW_BUFFER12_ARB\0" + "GL_DRAW_BUFFER12_ATI\0" + "GL_DRAW_BUFFER13_ARB\0" + "GL_DRAW_BUFFER13_ATI\0" + "GL_DRAW_BUFFER14_ARB\0" + "GL_DRAW_BUFFER14_ATI\0" + "GL_DRAW_BUFFER15_ARB\0" + "GL_DRAW_BUFFER15_ATI\0" + "GL_DRAW_BUFFER1_ARB\0" + "GL_DRAW_BUFFER1_ATI\0" + "GL_DRAW_BUFFER2_ARB\0" + "GL_DRAW_BUFFER2_ATI\0" + "GL_DRAW_BUFFER3_ARB\0" + "GL_DRAW_BUFFER3_ATI\0" + "GL_DRAW_BUFFER4_ARB\0" + "GL_DRAW_BUFFER4_ATI\0" + "GL_DRAW_BUFFER5_ARB\0" + "GL_DRAW_BUFFER5_ATI\0" + "GL_DRAW_BUFFER6_ARB\0" + "GL_DRAW_BUFFER6_ATI\0" + "GL_DRAW_BUFFER7_ARB\0" + "GL_DRAW_BUFFER7_ATI\0" + "GL_DRAW_BUFFER8_ARB\0" + "GL_DRAW_BUFFER8_ATI\0" + "GL_DRAW_BUFFER9_ARB\0" + "GL_DRAW_BUFFER9_ATI\0" + "GL_DRAW_PIXEL_TOKEN\0" + "GL_DST_ALPHA\0" + "GL_DST_COLOR\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_ARB\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_FLAT\0" + "GL_FLOAT\0" + "GL_FLOAT_MAT2_ARB\0" + "GL_FLOAT_MAT3_ARB\0" + "GL_FLOAT_MAT4_ARB\0" + "GL_FLOAT_VEC2_ARB\0" + "GL_FLOAT_VEC3_ARB\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_SOURCE\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_ARB\0" + "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT\0" + "GL_FRAMEBUFFER_BINDING_EXT\0" + "GL_FRAMEBUFFER_COMPLETE_EXT\0" + "GL_FRAMEBUFFER_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT\0" + "GL_FRAMEBUFFER_STATUS_ERROR_EXT\0" + "GL_FRAMEBUFFER_UNSUPPORTED_EXT\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_REVERSE_SUBTRACT\0" + "GL_FUNC_REVERSE_SUBTRACT_EXT\0" + "GL_FUNC_SUBTRACT\0" + "GL_FUNC_SUBTRACT_EXT\0" + "GL_GENERATE_MIPMAP\0" + "GL_GENERATE_MIPMAP_HINT\0" + "GL_GENERATE_MIPMAP_HINT_SGIS\0" + "GL_GENERATE_MIPMAP_SGIS\0" + "GL_GEQUAL\0" + "GL_GREATER\0" + "GL_GREEN\0" + "GL_GREEN_BIAS\0" + "GL_GREEN_BITS\0" + "GL_GREEN_SCALE\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_OES\0" + "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES\0" + "GL_INCR\0" + "GL_INCR_WRAP\0" + "GL_INCR_WRAP_EXT\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_INT\0" + "GL_INTENSITY\0" + "GL_INTENSITY12\0" + "GL_INTENSITY12_EXT\0" + "GL_INTENSITY16\0" + "GL_INTENSITY16_EXT\0" + "GL_INTENSITY4\0" + "GL_INTENSITY4_EXT\0" + "GL_INTENSITY8\0" + "GL_INTENSITY8_EXT\0" + "GL_INTENSITY_EXT\0" + "GL_INTERPOLATE\0" + "GL_INTERPOLATE_ARB\0" + "GL_INTERPOLATE_EXT\0" + "GL_INT_VEC2_ARB\0" + "GL_INT_VEC3_ARB\0" + "GL_INT_VEC4_ARB\0" + "GL_INVALID_ENUM\0" + "GL_INVALID_FRAMEBUFFER_OPERATION_EXT\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_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_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_TOKEN\0" + "GL_LINE_WIDTH\0" + "GL_LINE_WIDTH_GRANULARITY\0" + "GL_LINE_WIDTH_RANGE\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_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_LUMINANCE16_ALPHA16\0" + "GL_LUMINANCE16_ALPHA16_EXT\0" + "GL_LUMINANCE16_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_LUMINANCE8_ALPHA8\0" + "GL_LUMINANCE8_ALPHA8_EXT\0" + "GL_LUMINANCE8_EXT\0" + "GL_LUMINANCE_ALPHA\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_STENCIL\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_POINTER_ARB\0" + "GL_MATRIX_INDEX_ARRAY_SIZE_ARB\0" + "GL_MATRIX_INDEX_ARRAY_STRIDE_ARB\0" + "GL_MATRIX_INDEX_ARRAY_TYPE_ARB\0" + "GL_MATRIX_MODE\0" + "GL_MATRIX_PALETTE_ARB\0" + "GL_MAX\0" + "GL_MAX_3D_TEXTURE_SIZE\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_PLANES\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_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_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_UNIFORM_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_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_TEX_INDIRECTIONS_ARB\0" + "GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB\0" + "GL_MAX_PROJECTION_STACK_DEPTH\0" + "GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB\0" + "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV\0" + "GL_MAX_RENDERBUFFER_SIZE_EXT\0" + "GL_MAX_SHININESS_NV\0" + "GL_MAX_SPOT_EXPONENT_NV\0" + "GL_MAX_TEXTURE_COORDS_ARB\0" + "GL_MAX_TEXTURE_IMAGE_UNITS_ARB\0" + "GL_MAX_TEXTURE_LOD_BIAS\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_VARYING_FLOATS_ARB\0" + "GL_MAX_VERTEX_ATTRIBS_ARB\0" + "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB\0" + "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB\0" + "GL_MAX_VERTEX_UNITS_ARB\0" + "GL_MAX_VIEWPORT_DIMS\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_MIN_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_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_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_NOTEQUAL\0" + "GL_NO_ERROR\0" + "GL_NUM_COMPRESSED_TEXTURE_FORMATS\0" + "GL_NUM_TEXTURE_COMPRESSED_FORMATS_ARB\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_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_BINDING_EXT\0" + "GL_PIXEL_PACK_BUFFER_EXT\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_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_ARB\0" + "GL_POINT_SPRITE_COORD_ORIGIN\0" + "GL_POINT_SPRITE_NV\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_PROGRAM_ADDRESS_REGISTERS_ARB\0" + "GL_PROGRAM_ALU_INSTRUCTIONS_ARB\0" + "GL_PROGRAM_ATTRIBS_ARB\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_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_STACK_DEPTH\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_EXT\0" + "GL_PROXY_TEXTURE_2D\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_ARB\0" + "GL_PROXY_TEXTURE_RECTANGLE_NV\0" + "GL_Q\0" + "GL_QUADRATIC_ATTENUATION\0" + "GL_QUADS\0" + "GL_QUAD_MESH_SUN\0" + "GL_QUAD_STRIP\0" + "GL_QUERY_COUNTER_BITS\0" + "GL_QUERY_COUNTER_BITS_ARB\0" + "GL_QUERY_RESULT\0" + "GL_QUERY_RESULT_ARB\0" + "GL_QUERY_RESULT_AVAILABLE\0" + "GL_QUERY_RESULT_AVAILABLE_ARB\0" + "GL_R\0" + "GL_R3_G3_B2\0" + "GL_RASTER_POSITION_UNCLIPPED_IBM\0" + "GL_READ_BUFFER\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_SCALE\0" + "GL_REFLECTION_MAP\0" + "GL_REFLECTION_MAP_ARB\0" + "GL_REFLECTION_MAP_NV\0" + "GL_RENDER\0" + "GL_RENDERBUFFER_BINDING_EXT\0" + "GL_RENDERBUFFER_EXT\0" + "GL_RENDERBUFFER_HEIGHT_EXT\0" + "GL_RENDERBUFFER_INTERNAL_FORMAT_EXT\0" + "GL_RENDERBUFFER_WIDTH_EXT\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_RETURN\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_RGB16_EXT\0" + "GL_RGB2_EXT\0" + "GL_RGB4\0" + "GL_RGB4_EXT\0" + "GL_RGB4_S3TC\0" + "GL_RGB5\0" + "GL_RGB5_A1\0" + "GL_RGB5_A1_EXT\0" + "GL_RGB5_EXT\0" + "GL_RGB8\0" + "GL_RGB8_EXT\0" + "GL_RGBA\0" + "GL_RGBA12\0" + "GL_RGBA12_EXT\0" + "GL_RGBA16\0" + "GL_RGBA16_EXT\0" + "GL_RGBA2\0" + "GL_RGBA2_EXT\0" + "GL_RGBA4\0" + "GL_RGBA4_DXT5_S3TC\0" + "GL_RGBA4_EXT\0" + "GL_RGBA4_S3TC\0" + "GL_RGBA8\0" + "GL_RGBA8_EXT\0" + "GL_RGBA_DXT5_S3TC\0" + "GL_RGBA_MODE\0" + "GL_RGBA_S3TC\0" + "GL_RGB_S3TC\0" + "GL_RGB_SCALE\0" + "GL_RGB_SCALE_ARB\0" + "GL_RGB_SCALE_EXT\0" + "GL_RIGHT\0" + "GL_S\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_SPECULAR_COLOR\0" + "GL_SEPARATE_SPECULAR_COLOR_EXT\0" + "GL_SET\0" + "GL_SHADER_OBJECT_ARB\0" + "GL_SHADE_MODEL\0" + "GL_SHADOW_AMBIENT_SGIX\0" + "GL_SHARED_TEXTURE_PALETTE_EXT\0" + "GL_SHININESS\0" + "GL_SHORT\0" + "GL_SINGLE_COLOR\0" + "GL_SINGLE_COLOR_EXT\0" + "GL_SLICE_ACCUM_SUN\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_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_EXT\0" + "GL_STENCIL_BITS\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_INDEX16_EXT\0" + "GL_STENCIL_INDEX1_EXT\0" + "GL_STENCIL_INDEX4_EXT\0" + "GL_STENCIL_INDEX8_EXT\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_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_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_2D\0" + "GL_TEXTURE_3D\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_2D\0" + "GL_TEXTURE_BINDING_3D\0" + "GL_TEXTURE_BINDING_CUBE_MAP\0" + "GL_TEXTURE_BINDING_CUBE_MAP_ARB\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_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_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_Y\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_X\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_Y\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_Z\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB\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_GEN_MODE\0" + "GL_TEXTURE_GEN_Q\0" + "GL_TEXTURE_GEN_R\0" + "GL_TEXTURE_GEN_S\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_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_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_STACK_DEPTH\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_S\0" + "GL_TEXTURE_WRAP_T\0" + "GL_TRACK_MATRIX_NV\0" + "GL_TRACK_MATRIX_TRANSFORM_NV\0" + "GL_TRANSFORM_BIT\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_TRIANGLE_FAN\0" + "GL_TRIANGLE_MESH_SUN\0" + "GL_TRIANGLE_STRIP\0" + "GL_TRUE\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_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_10_10_10_2\0" + "GL_UNSIGNED_INT_24_8_NV\0" + "GL_UNSIGNED_INT_2_10_10_10_REV\0" + "GL_UNSIGNED_INT_8_8_8_8\0" + "GL_UNSIGNED_INT_8_8_8_8_REV\0" + "GL_UNSIGNED_SHORT\0" + "GL_UNSIGNED_SHORT_1_5_5_5_REV\0" + "GL_UNSIGNED_SHORT_4_4_4_4\0" + "GL_UNSIGNED_SHORT_4_4_4_4_REV\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_V2F\0" + "GL_V3F\0" + "GL_VENDOR\0" + "GL_VERSION\0" + "GL_VERTEX_ARRAY\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_ARB\0" + "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB\0" + "GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB\0" + "GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB\0" + "GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB\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_ARB\0" + "GL_VERTEX_PROGRAM_POINT_SIZE_NV\0" + "GL_VERTEX_PROGRAM_TWO_SIDE_ARB\0" + "GL_VERTEX_PROGRAM_TWO_SIDE_NV\0" + "GL_VERTEX_SHADER_ARB\0" + "GL_VERTEX_STATE_PROGRAM_NV\0" + "GL_VIEWPORT\0" + "GL_VIEWPORT_BIT\0" + "GL_WEIGHT_ARRAY_ARB\0" + "GL_WEIGHT_ARRAY_BUFFER_BINDING\0" + "GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB\0" + "GL_WEIGHT_ARRAY_POINTER_ARB\0" + "GL_WEIGHT_ARRAY_SIZE_ARB\0" + "GL_WEIGHT_ARRAY_STRIDE_ARB\0" + "GL_WEIGHT_ARRAY_TYPE_ARB\0" + "GL_WEIGHT_SUM_UNITY_ARB\0" + "GL_WRAP_BORDER_SUN\0" + "GL_WRITE_ONLY\0" + "GL_WRITE_ONLY_ARB\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[1612] = +{ + { 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, 0x00008911 }, /* GL_ACTIVE_STENCIL_FACE_EXT */ + { 251, 0x000084E0 }, /* GL_ACTIVE_TEXTURE */ + { 269, 0x000084E0 }, /* GL_ACTIVE_TEXTURE_ARB */ + { 291, 0x000086A5 }, /* GL_ACTIVE_VERTEX_UNITS_ARB */ + { 318, 0x00000104 }, /* GL_ADD */ + { 325, 0x00008574 }, /* GL_ADD_SIGNED */ + { 339, 0x00008574 }, /* GL_ADD_SIGNED_ARB */ + { 357, 0x00008574 }, /* GL_ADD_SIGNED_EXT */ + { 375, 0x0000846E }, /* GL_ALIASED_LINE_WIDTH_RANGE */ + { 403, 0x0000846D }, /* GL_ALIASED_POINT_SIZE_RANGE */ + { 431, 0x000FFFFF }, /* GL_ALL_ATTRIB_BITS */ + { 450, 0xFFFFFFFF }, /* GL_ALL_CLIENT_ATTRIB_BITS */ + { 476, 0x00001906 }, /* GL_ALPHA */ + { 485, 0x0000803D }, /* GL_ALPHA12 */ + { 496, 0x0000803D }, /* GL_ALPHA12_EXT */ + { 511, 0x0000803E }, /* GL_ALPHA16 */ + { 522, 0x0000803E }, /* GL_ALPHA16_EXT */ + { 537, 0x0000803B }, /* GL_ALPHA4 */ + { 547, 0x0000803B }, /* GL_ALPHA4_EXT */ + { 561, 0x0000803C }, /* GL_ALPHA8 */ + { 571, 0x0000803C }, /* GL_ALPHA8_EXT */ + { 585, 0x00000D1D }, /* GL_ALPHA_BIAS */ + { 599, 0x00000D55 }, /* GL_ALPHA_BITS */ + { 613, 0x00000D1C }, /* GL_ALPHA_SCALE */ + { 628, 0x00000BC0 }, /* GL_ALPHA_TEST */ + { 642, 0x00000BC1 }, /* GL_ALPHA_TEST_FUNC */ + { 661, 0x00000BC2 }, /* GL_ALPHA_TEST_REF */ + { 679, 0x00000207 }, /* GL_ALWAYS */ + { 689, 0x00001200 }, /* GL_AMBIENT */ + { 700, 0x00001602 }, /* GL_AMBIENT_AND_DIFFUSE */ + { 723, 0x00001501 }, /* GL_AND */ + { 730, 0x00001504 }, /* GL_AND_INVERTED */ + { 746, 0x00001502 }, /* GL_AND_REVERSE */ + { 761, 0x00008892 }, /* GL_ARRAY_BUFFER */ + { 777, 0x00008892 }, /* GL_ARRAY_BUFFER_ARB */ + { 797, 0x00008894 }, /* GL_ARRAY_BUFFER_BINDING */ + { 821, 0x00008894 }, /* GL_ARRAY_BUFFER_BINDING_ARB */ + { 849, 0x00008645 }, /* GL_ATTRIB_ARRAY_POINTER_NV */ + { 876, 0x00008623 }, /* GL_ATTRIB_ARRAY_SIZE_NV */ + { 900, 0x00008624 }, /* GL_ATTRIB_ARRAY_STRIDE_NV */ + { 926, 0x00008625 }, /* GL_ATTRIB_ARRAY_TYPE_NV */ + { 950, 0x00000BB0 }, /* GL_ATTRIB_STACK_DEPTH */ + { 972, 0x00000D80 }, /* GL_AUTO_NORMAL */ + { 987, 0x00000409 }, /* GL_AUX0 */ + { 995, 0x0000040A }, /* GL_AUX1 */ + { 1003, 0x0000040B }, /* GL_AUX2 */ + { 1011, 0x0000040C }, /* GL_AUX3 */ + { 1019, 0x00000C00 }, /* GL_AUX_BUFFERS */ + { 1034, 0x00000405 }, /* GL_BACK */ + { 1042, 0x00000402 }, /* GL_BACK_LEFT */ + { 1055, 0x00000403 }, /* GL_BACK_RIGHT */ + { 1069, 0x000080E0 }, /* GL_BGR */ + { 1076, 0x000080E1 }, /* GL_BGRA */ + { 1084, 0x00001A00 }, /* GL_BITMAP */ + { 1094, 0x00000704 }, /* GL_BITMAP_TOKEN */ + { 1110, 0x00000BE2 }, /* GL_BLEND */ + { 1119, 0x00008005 }, /* GL_BLEND_COLOR */ + { 1134, 0x00008005 }, /* GL_BLEND_COLOR_EXT */ + { 1153, 0x00000BE0 }, /* GL_BLEND_DST */ + { 1166, 0x000080CA }, /* GL_BLEND_DST_ALPHA */ + { 1185, 0x000080C8 }, /* GL_BLEND_DST_RGB */ + { 1202, 0x00008009 }, /* GL_BLEND_EQUATION */ + { 1220, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA_EXT */ + { 1248, 0x00008009 }, /* GL_BLEND_EQUATION_EXT */ + { 1270, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_EXT */ + { 1296, 0x00000BE1 }, /* GL_BLEND_SRC */ + { 1309, 0x000080CB }, /* GL_BLEND_SRC_ALPHA */ + { 1328, 0x000080C9 }, /* GL_BLEND_SRC_RGB */ + { 1345, 0x00001905 }, /* GL_BLUE */ + { 1353, 0x00000D1B }, /* GL_BLUE_BIAS */ + { 1366, 0x00000D54 }, /* GL_BLUE_BITS */ + { 1379, 0x00000D1A }, /* GL_BLUE_SCALE */ + { 1393, 0x00008B56 }, /* GL_BOOL_ARB */ + { 1405, 0x00008B57 }, /* GL_BOOL_VEC2_ARB */ + { 1422, 0x00008B58 }, /* GL_BOOL_VEC3_ARB */ + { 1439, 0x00008B59 }, /* GL_BOOL_VEC4_ARB */ + { 1456, 0x000088BB }, /* GL_BUFFER_ACCESS */ + { 1473, 0x000088BB }, /* GL_BUFFER_ACCESS_ARB */ + { 1494, 0x000088BC }, /* GL_BUFFER_MAPPED */ + { 1511, 0x000088BC }, /* GL_BUFFER_MAPPED_ARB */ + { 1532, 0x000088BD }, /* GL_BUFFER_MAP_POINTER */ + { 1554, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_ARB */ + { 1580, 0x00008764 }, /* GL_BUFFER_SIZE */ + { 1595, 0x00008764 }, /* GL_BUFFER_SIZE_ARB */ + { 1614, 0x00008765 }, /* GL_BUFFER_USAGE */ + { 1630, 0x00008765 }, /* GL_BUFFER_USAGE_ARB */ + { 1650, 0x00001400 }, /* GL_BYTE */ + { 1658, 0x00002A24 }, /* GL_C3F_V3F */ + { 1669, 0x00002A26 }, /* GL_C4F_N3F_V3F */ + { 1684, 0x00002A22 }, /* GL_C4UB_V2F */ + { 1696, 0x00002A23 }, /* GL_C4UB_V3F */ + { 1708, 0x00000901 }, /* GL_CCW */ + { 1715, 0x00002900 }, /* GL_CLAMP */ + { 1724, 0x0000812D }, /* GL_CLAMP_TO_BORDER */ + { 1743, 0x0000812D }, /* GL_CLAMP_TO_BORDER_ARB */ + { 1766, 0x0000812D }, /* GL_CLAMP_TO_BORDER_SGIS */ + { 1790, 0x0000812F }, /* GL_CLAMP_TO_EDGE */ + { 1807, 0x0000812F }, /* GL_CLAMP_TO_EDGE_SGIS */ + { 1829, 0x00001500 }, /* GL_CLEAR */ + { 1838, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE */ + { 1863, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE_ARB */ + { 1892, 0xFFFFFFFF }, /* GL_CLIENT_ALL_ATTRIB_BITS */ + { 1918, 0x00000BB1 }, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ + { 1947, 0x00000001 }, /* GL_CLIENT_PIXEL_STORE_BIT */ + { 1973, 0x00000002 }, /* GL_CLIENT_VERTEX_ARRAY_BIT */ + { 2000, 0x00003000 }, /* GL_CLIP_PLANE0 */ + { 2015, 0x00003001 }, /* GL_CLIP_PLANE1 */ + { 2030, 0x00003002 }, /* GL_CLIP_PLANE2 */ + { 2045, 0x00003003 }, /* GL_CLIP_PLANE3 */ + { 2060, 0x00003004 }, /* GL_CLIP_PLANE4 */ + { 2075, 0x00003005 }, /* GL_CLIP_PLANE5 */ + { 2090, 0x000080F0 }, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ + { 2123, 0x00000A00 }, /* GL_COEFF */ + { 2132, 0x00001800 }, /* GL_COLOR */ + { 2141, 0x00008076 }, /* GL_COLOR_ARRAY */ + { 2156, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING */ + { 2186, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING_ARB */ + { 2220, 0x00008090 }, /* GL_COLOR_ARRAY_POINTER */ + { 2243, 0x00008081 }, /* GL_COLOR_ARRAY_SIZE */ + { 2263, 0x00008083 }, /* GL_COLOR_ARRAY_STRIDE */ + { 2285, 0x00008082 }, /* GL_COLOR_ARRAY_TYPE */ + { 2305, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_EXT */ + { 2330, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10_EXT */ + { 2356, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11_EXT */ + { 2382, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12_EXT */ + { 2408, 0x00008CED }, /* GL_COLOR_ATTACHMENT13_EXT */ + { 2434, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14_EXT */ + { 2460, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15_EXT */ + { 2486, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1_EXT */ + { 2511, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2_EXT */ + { 2536, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3_EXT */ + { 2561, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4_EXT */ + { 2586, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5_EXT */ + { 2611, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6_EXT */ + { 2636, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7_EXT */ + { 2661, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8_EXT */ + { 2686, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9_EXT */ + { 2711, 0x00004000 }, /* GL_COLOR_BUFFER_BIT */ + { 2731, 0x00000C22 }, /* GL_COLOR_CLEAR_VALUE */ + { 2752, 0x00001900 }, /* GL_COLOR_INDEX */ + { 2767, 0x00001603 }, /* GL_COLOR_INDEXES */ + { 2784, 0x00000BF2 }, /* GL_COLOR_LOGIC_OP */ + { 2802, 0x00000B57 }, /* GL_COLOR_MATERIAL */ + { 2820, 0x00000B55 }, /* GL_COLOR_MATERIAL_FACE */ + { 2843, 0x00000B56 }, /* GL_COLOR_MATERIAL_PARAMETER */ + { 2871, 0x000080B1 }, /* GL_COLOR_MATRIX */ + { 2887, 0x000080B1 }, /* GL_COLOR_MATRIX_SGI */ + { 2907, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH */ + { 2935, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH_SGI */ + { 2967, 0x00008458 }, /* GL_COLOR_SUM */ + { 2980, 0x00008458 }, /* GL_COLOR_SUM_ARB */ + { 2997, 0x000080D0 }, /* GL_COLOR_TABLE */ + { 3012, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE */ + { 3038, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_EXT */ + { 3068, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS */ + { 3088, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE */ + { 3113, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_EXT */ + { 3142, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT */ + { 3164, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_EXT */ + { 3190, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE */ + { 3216, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_EXT */ + { 3246, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE */ + { 3276, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_EXT */ + { 3310, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ + { 3340, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_EXT */ + { 3374, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE */ + { 3398, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_EXT */ + { 3426, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE */ + { 3447, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH */ + { 3468, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_EXT */ + { 3493, 0x00000C23 }, /* GL_COLOR_WRITEMASK */ + { 3512, 0x00008570 }, /* GL_COMBINE */ + { 3523, 0x00008503 }, /* GL_COMBINE4 */ + { 3535, 0x00008572 }, /* GL_COMBINE_ALPHA */ + { 3552, 0x00008572 }, /* GL_COMBINE_ALPHA_ARB */ + { 3573, 0x00008572 }, /* GL_COMBINE_ALPHA_EXT */ + { 3594, 0x00008570 }, /* GL_COMBINE_ARB */ + { 3609, 0x00008570 }, /* GL_COMBINE_EXT */ + { 3624, 0x00008571 }, /* GL_COMBINE_RGB */ + { 3639, 0x00008571 }, /* GL_COMBINE_RGB_ARB */ + { 3658, 0x00008571 }, /* GL_COMBINE_RGB_EXT */ + { 3677, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE */ + { 3701, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE_ARB */ + { 3729, 0x00001300 }, /* GL_COMPILE */ + { 3740, 0x00001301 }, /* GL_COMPILE_AND_EXECUTE */ + { 3763, 0x000084E9 }, /* GL_COMPRESSED_ALPHA */ + { 3783, 0x000084E9 }, /* GL_COMPRESSED_ALPHA_ARB */ + { 3807, 0x000084EC }, /* GL_COMPRESSED_INTENSITY */ + { 3831, 0x000084EC }, /* GL_COMPRESSED_INTENSITY_ARB */ + { 3859, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE */ + { 3883, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA */ + { 3913, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA_ARB */ + { 3947, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE_ARB */ + { 3975, 0x000084ED }, /* GL_COMPRESSED_RGB */ + { 3993, 0x000084EE }, /* GL_COMPRESSED_RGBA */ + { 4012, 0x000084EE }, /* GL_COMPRESSED_RGBA_ARB */ + { 4035, 0x000086B1 }, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ + { 4064, 0x000083F1 }, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ + { 4097, 0x000083F2 }, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ + { 4130, 0x000083F3 }, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ + { 4163, 0x000084ED }, /* GL_COMPRESSED_RGB_ARB */ + { 4185, 0x000086B0 }, /* GL_COMPRESSED_RGB_FXT1_3DFX */ + { 4213, 0x000083F0 }, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ + { 4245, 0x000086A3 }, /* GL_COMPRESSED_TEXTURE_FORMATS */ + { 4275, 0x00008576 }, /* GL_CONSTANT */ + { 4287, 0x00008003 }, /* GL_CONSTANT_ALPHA */ + { 4305, 0x00008003 }, /* GL_CONSTANT_ALPHA_EXT */ + { 4327, 0x00008576 }, /* GL_CONSTANT_ARB */ + { 4343, 0x00001207 }, /* GL_CONSTANT_ATTENUATION */ + { 4367, 0x00008151 }, /* GL_CONSTANT_BORDER_HP */ + { 4389, 0x00008001 }, /* GL_CONSTANT_COLOR */ + { 4407, 0x00008001 }, /* GL_CONSTANT_COLOR_EXT */ + { 4429, 0x00008576 }, /* GL_CONSTANT_EXT */ + { 4445, 0x00008010 }, /* GL_CONVOLUTION_1D */ + { 4463, 0x00008011 }, /* GL_CONVOLUTION_2D */ + { 4481, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */ + { 4509, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */ + { 4540, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */ + { 4567, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */ + { 4598, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */ + { 4625, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */ + { 4656, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */ + { 4684, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */ + { 4716, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */ + { 4738, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */ + { 4764, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */ + { 4786, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */ + { 4812, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */ + { 4833, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */ + { 4858, 0x00008862 }, /* GL_COORD_REPLACE_ARB */ + { 4879, 0x00008862 }, /* GL_COORD_REPLACE_NV */ + { 4899, 0x00001503 }, /* GL_COPY */ + { 4907, 0x0000150C }, /* GL_COPY_INVERTED */ + { 4924, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */ + { 4944, 0x00000B44 }, /* GL_CULL_FACE */ + { 4957, 0x00000B45 }, /* GL_CULL_FACE_MODE */ + { 4975, 0x000081AA }, /* GL_CULL_VERTEX_EXT */ + { 4994, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ + { 5026, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ + { 5061, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */ + { 5082, 0x00000001 }, /* GL_CURRENT_BIT */ + { 5097, 0x00000B00 }, /* GL_CURRENT_COLOR */ + { 5114, 0x00008453 }, /* GL_CURRENT_FOG_COORD */ + { 5135, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */ + { 5161, 0x00000B01 }, /* GL_CURRENT_INDEX */ + { 5178, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */ + { 5200, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */ + { 5228, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */ + { 5249, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ + { 5283, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */ + { 5316, 0x00000B02 }, /* GL_CURRENT_NORMAL */ + { 5334, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */ + { 5364, 0x00008865 }, /* GL_CURRENT_QUERY */ + { 5381, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */ + { 5402, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */ + { 5426, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */ + { 5453, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */ + { 5477, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */ + { 5504, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */ + { 5537, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ + { 5570, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */ + { 5597, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */ + { 5623, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */ + { 5652, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */ + { 5674, 0x00000900 }, /* GL_CW */ + { 5680, 0x00002101 }, /* GL_DECAL */ + { 5689, 0x00001E03 }, /* GL_DECR */ + { 5697, 0x00008508 }, /* GL_DECR_WRAP */ + { 5710, 0x00008508 }, /* GL_DECR_WRAP_EXT */ + { 5727, 0x00001801 }, /* GL_DEPTH */ + { 5736, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */ + { 5760, 0x00000D1F }, /* GL_DEPTH_BIAS */ + { 5774, 0x00000D56 }, /* GL_DEPTH_BITS */ + { 5788, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */ + { 5808, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */ + { 5833, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */ + { 5853, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */ + { 5871, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */ + { 5892, 0x00001902 }, /* GL_DEPTH_COMPONENT */ + { 5911, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */ + { 5932, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */ + { 5957, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */ + { 5983, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */ + { 6004, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */ + { 6029, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */ + { 6055, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */ + { 6076, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */ + { 6101, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */ + { 6127, 0x00000B74 }, /* GL_DEPTH_FUNC */ + { 6141, 0x00000B70 }, /* GL_DEPTH_RANGE */ + { 6156, 0x00000D1E }, /* GL_DEPTH_SCALE */ + { 6171, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */ + { 6191, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ + { 6219, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ + { 6247, 0x00000B71 }, /* GL_DEPTH_TEST */ + { 6261, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */ + { 6283, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */ + { 6309, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */ + { 6328, 0x00001201 }, /* GL_DIFFUSE */ + { 6339, 0x00000BD0 }, /* GL_DITHER */ + { 6349, 0x00000A02 }, /* GL_DOMAIN */ + { 6359, 0x00001100 }, /* GL_DONT_CARE */ + { 6372, 0x000086AE }, /* GL_DOT3_RGB */ + { 6384, 0x000086AF }, /* GL_DOT3_RGBA */ + { 6397, 0x000086AF }, /* GL_DOT3_RGBA_ARB */ + { 6414, 0x00008741 }, /* GL_DOT3_RGBA_EXT */ + { 6431, 0x000086AE }, /* GL_DOT3_RGB_ARB */ + { 6447, 0x00008740 }, /* GL_DOT3_RGB_EXT */ + { 6463, 0x0000140A }, /* GL_DOUBLE */ + { 6473, 0x00000C32 }, /* GL_DOUBLEBUFFER */ + { 6489, 0x00000C01 }, /* GL_DRAW_BUFFER */ + { 6504, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */ + { 6524, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */ + { 6544, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */ + { 6565, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */ + { 6586, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */ + { 6607, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */ + { 6628, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */ + { 6649, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */ + { 6670, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */ + { 6691, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */ + { 6712, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */ + { 6733, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */ + { 6754, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */ + { 6775, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */ + { 6796, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */ + { 6816, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */ + { 6836, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */ + { 6856, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */ + { 6876, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */ + { 6896, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */ + { 6916, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */ + { 6936, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */ + { 6956, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */ + { 6976, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */ + { 6996, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */ + { 7016, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */ + { 7036, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */ + { 7056, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */ + { 7076, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */ + { 7096, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */ + { 7116, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */ + { 7136, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */ + { 7156, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */ + { 7176, 0x00000304 }, /* GL_DST_ALPHA */ + { 7189, 0x00000306 }, /* GL_DST_COLOR */ + { 7202, 0x000088EA }, /* GL_DYNAMIC_COPY */ + { 7218, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */ + { 7238, 0x000088E8 }, /* GL_DYNAMIC_DRAW */ + { 7254, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */ + { 7274, 0x000088E9 }, /* GL_DYNAMIC_READ */ + { 7290, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */ + { 7310, 0x00000B43 }, /* GL_EDGE_FLAG */ + { 7323, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */ + { 7342, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ + { 7376, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */ + { 7414, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */ + { 7441, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */ + { 7467, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */ + { 7491, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER_ARB */ + { 7519, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ + { 7551, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */ + { 7587, 0x00001600 }, /* GL_EMISSION */ + { 7599, 0x00002000 }, /* GL_ENABLE_BIT */ + { 7613, 0x00000202 }, /* GL_EQUAL */ + { 7622, 0x00001509 }, /* GL_EQUIV */ + { 7631, 0x00010000 }, /* GL_EVAL_BIT */ + { 7643, 0x00000800 }, /* GL_EXP */ + { 7650, 0x00000801 }, /* GL_EXP2 */ + { 7658, 0x00001F03 }, /* GL_EXTENSIONS */ + { 7672, 0x00002400 }, /* GL_EYE_LINEAR */ + { 7686, 0x00002502 }, /* GL_EYE_PLANE */ + { 7699, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */ + { 7724, 0x0000855B }, /* GL_EYE_RADIAL_NV */ + { 7741, 0x00000000 }, /* GL_FALSE */ + { 7750, 0x00001101 }, /* GL_FASTEST */ + { 7761, 0x00001C01 }, /* GL_FEEDBACK */ + { 7773, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */ + { 7800, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */ + { 7824, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */ + { 7848, 0x00001B02 }, /* GL_FILL */ + { 7856, 0x00001D00 }, /* GL_FLAT */ + { 7864, 0x00001406 }, /* GL_FLOAT */ + { 7873, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ + { 7891, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ + { 7909, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ + { 7927, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ + { 7945, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ + { 7963, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ + { 7981, 0x00000B60 }, /* GL_FOG */ + { 7988, 0x00000080 }, /* GL_FOG_BIT */ + { 7999, 0x00000B66 }, /* GL_FOG_COLOR */ + { 8012, 0x00008451 }, /* GL_FOG_COORD */ + { 8025, 0x00008451 }, /* GL_FOG_COORDINATE */ + { 8043, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ + { 8067, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + { 8106, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ + { 8149, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + { 8181, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + { 8212, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + { 8241, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ + { 8266, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ + { 8285, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ + { 8319, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ + { 8346, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ + { 8372, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ + { 8396, 0x00008450 }, /* GL_FOG_COORD_SOURCE */ + { 8416, 0x00000B62 }, /* GL_FOG_DENSITY */ + { 8431, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ + { 8455, 0x00000B64 }, /* GL_FOG_END */ + { 8466, 0x00000C54 }, /* GL_FOG_HINT */ + { 8478, 0x00000B61 }, /* GL_FOG_INDEX */ + { 8491, 0x00000B65 }, /* GL_FOG_MODE */ + { 8503, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ + { 8522, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ + { 8547, 0x00000B63 }, /* GL_FOG_START */ + { 8560, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ + { 8578, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ + { 8602, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ + { 8625, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ + { 8667, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ + { 8709, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ + { 8758, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ + { 8810, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ + { 8854, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ + { 8881, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ + { 8909, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ + { 8928, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ + { 8969, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + { 9010, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ + { 9052, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + { 9103, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + { 9141, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ + { 9190, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ + { 9232, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + { 9264, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ + { 9295, 0x00000404 }, /* GL_FRONT */ + { 9304, 0x00000408 }, /* GL_FRONT_AND_BACK */ + { 9322, 0x00000B46 }, /* GL_FRONT_FACE */ + { 9336, 0x00000400 }, /* GL_FRONT_LEFT */ + { 9350, 0x00000401 }, /* GL_FRONT_RIGHT */ + { 9365, 0x00008006 }, /* GL_FUNC_ADD */ + { 9377, 0x00008006 }, /* GL_FUNC_ADD_EXT */ + { 9393, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ + { 9418, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ + { 9447, 0x0000800A }, /* GL_FUNC_SUBTRACT */ + { 9464, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ + { 9485, 0x00008191 }, /* GL_GENERATE_MIPMAP */ + { 9504, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ + { 9528, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ + { 9557, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ + { 9581, 0x00000206 }, /* GL_GEQUAL */ + { 9591, 0x00000204 }, /* GL_GREATER */ + { 9602, 0x00001904 }, /* GL_GREEN */ + { 9611, 0x00000D19 }, /* GL_GREEN_BIAS */ + { 9625, 0x00000D53 }, /* GL_GREEN_BITS */ + { 9639, 0x00000D18 }, /* GL_GREEN_SCALE */ + { 9654, 0x00008000 }, /* GL_HINT_BIT */ + { 9666, 0x00008024 }, /* GL_HISTOGRAM */ + { 9679, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ + { 9703, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ + { 9731, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ + { 9754, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ + { 9781, 0x00008024 }, /* GL_HISTOGRAM_EXT */ + { 9798, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ + { 9818, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ + { 9842, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ + { 9866, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ + { 9894, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + { 9922, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ + { 9954, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ + { 9976, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ + { 10002, 0x0000802D }, /* GL_HISTOGRAM_SINK */ + { 10020, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ + { 10042, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ + { 10061, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ + { 10084, 0x0000862A }, /* GL_IDENTITY_NV */ + { 10099, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ + { 10119, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + { 10159, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + { 10197, 0x00001E02 }, /* GL_INCR */ + { 10205, 0x00008507 }, /* GL_INCR_WRAP */ + { 10218, 0x00008507 }, /* GL_INCR_WRAP_EXT */ + { 10235, 0x00008077 }, /* GL_INDEX_ARRAY */ + { 10250, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + { 10280, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ + { 10314, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ + { 10337, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ + { 10359, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ + { 10379, 0x00000D51 }, /* GL_INDEX_BITS */ + { 10393, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ + { 10414, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ + { 10432, 0x00000C30 }, /* GL_INDEX_MODE */ + { 10446, 0x00000D13 }, /* GL_INDEX_OFFSET */ + { 10462, 0x00000D12 }, /* GL_INDEX_SHIFT */ + { 10477, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ + { 10496, 0x00001404 }, /* GL_INT */ + { 10503, 0x00008049 }, /* GL_INTENSITY */ + { 10516, 0x0000804C }, /* GL_INTENSITY12 */ + { 10531, 0x0000804C }, /* GL_INTENSITY12_EXT */ + { 10550, 0x0000804D }, /* GL_INTENSITY16 */ + { 10565, 0x0000804D }, /* GL_INTENSITY16_EXT */ + { 10584, 0x0000804A }, /* GL_INTENSITY4 */ + { 10598, 0x0000804A }, /* GL_INTENSITY4_EXT */ + { 10616, 0x0000804B }, /* GL_INTENSITY8 */ + { 10630, 0x0000804B }, /* GL_INTENSITY8_EXT */ + { 10648, 0x00008049 }, /* GL_INTENSITY_EXT */ + { 10665, 0x00008575 }, /* GL_INTERPOLATE */ + { 10680, 0x00008575 }, /* GL_INTERPOLATE_ARB */ + { 10699, 0x00008575 }, /* GL_INTERPOLATE_EXT */ + { 10718, 0x00008B53 }, /* GL_INT_VEC2_ARB */ + { 10734, 0x00008B54 }, /* GL_INT_VEC3_ARB */ + { 10750, 0x00008B55 }, /* GL_INT_VEC4_ARB */ + { 10766, 0x00000500 }, /* GL_INVALID_ENUM */ + { 10782, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ + { 10819, 0x00000502 }, /* GL_INVALID_OPERATION */ + { 10840, 0x00000501 }, /* GL_INVALID_VALUE */ + { 10857, 0x0000862B }, /* GL_INVERSE_NV */ + { 10871, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ + { 10895, 0x0000150A }, /* GL_INVERT */ + { 10905, 0x00001E00 }, /* GL_KEEP */ + { 10913, 0x00000406 }, /* GL_LEFT */ + { 10921, 0x00000203 }, /* GL_LEQUAL */ + { 10931, 0x00000201 }, /* GL_LESS */ + { 10939, 0x00004000 }, /* GL_LIGHT0 */ + { 10949, 0x00004001 }, /* GL_LIGHT1 */ + { 10959, 0x00004002 }, /* GL_LIGHT2 */ + { 10969, 0x00004003 }, /* GL_LIGHT3 */ + { 10979, 0x00004004 }, /* GL_LIGHT4 */ + { 10989, 0x00004005 }, /* GL_LIGHT5 */ + { 10999, 0x00004006 }, /* GL_LIGHT6 */ + { 11009, 0x00004007 }, /* GL_LIGHT7 */ + { 11019, 0x00000B50 }, /* GL_LIGHTING */ + { 11031, 0x00000040 }, /* GL_LIGHTING_BIT */ + { 11047, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ + { 11070, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + { 11099, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ + { 11132, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + { 11160, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ + { 11184, 0x00001B01 }, /* GL_LINE */ + { 11192, 0x00002601 }, /* GL_LINEAR */ + { 11202, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ + { 11224, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + { 11254, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + { 11285, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ + { 11309, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ + { 11334, 0x00000001 }, /* GL_LINES */ + { 11343, 0x00000004 }, /* GL_LINE_BIT */ + { 11355, 0x00000002 }, /* GL_LINE_LOOP */ + { 11368, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ + { 11388, 0x00000B20 }, /* GL_LINE_SMOOTH */ + { 11403, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ + { 11423, 0x00000B24 }, /* GL_LINE_STIPPLE */ + { 11439, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ + { 11463, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ + { 11486, 0x00000003 }, /* GL_LINE_STRIP */ + { 11500, 0x00000702 }, /* GL_LINE_TOKEN */ + { 11514, 0x00000B21 }, /* GL_LINE_WIDTH */ + { 11528, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ + { 11554, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ + { 11574, 0x00000B32 }, /* GL_LIST_BASE */ + { 11587, 0x00020000 }, /* GL_LIST_BIT */ + { 11599, 0x00000B33 }, /* GL_LIST_INDEX */ + { 11613, 0x00000B30 }, /* GL_LIST_MODE */ + { 11626, 0x00000101 }, /* GL_LOAD */ + { 11634, 0x00000BF1 }, /* GL_LOGIC_OP */ + { 11646, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ + { 11663, 0x00001909 }, /* GL_LUMINANCE */ + { 11676, 0x00008041 }, /* GL_LUMINANCE12 */ + { 11691, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ + { 11714, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ + { 11741, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ + { 11763, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ + { 11789, 0x00008041 }, /* GL_LUMINANCE12_EXT */ + { 11808, 0x00008042 }, /* GL_LUMINANCE16 */ + { 11823, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ + { 11846, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ + { 11873, 0x00008042 }, /* GL_LUMINANCE16_EXT */ + { 11892, 0x0000803F }, /* GL_LUMINANCE4 */ + { 11906, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ + { 11927, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ + { 11952, 0x0000803F }, /* GL_LUMINANCE4_EXT */ + { 11970, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ + { 11991, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ + { 12016, 0x00008040 }, /* GL_LUMINANCE8 */ + { 12030, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ + { 12051, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ + { 12076, 0x00008040 }, /* GL_LUMINANCE8_EXT */ + { 12094, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ + { 12113, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ + { 12129, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ + { 12149, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ + { 12171, 0x00000D91 }, /* GL_MAP1_INDEX */ + { 12185, 0x00000D92 }, /* GL_MAP1_NORMAL */ + { 12200, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ + { 12224, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ + { 12248, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ + { 12272, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ + { 12296, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ + { 12313, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ + { 12330, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + { 12358, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + { 12387, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + { 12416, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + { 12445, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + { 12474, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + { 12503, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + { 12532, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + { 12560, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + { 12588, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + { 12616, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + { 12644, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + { 12672, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + { 12700, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + { 12728, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + { 12756, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + { 12784, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ + { 12800, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ + { 12820, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ + { 12842, 0x00000DB1 }, /* GL_MAP2_INDEX */ + { 12856, 0x00000DB2 }, /* GL_MAP2_NORMAL */ + { 12871, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ + { 12895, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ + { 12919, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ + { 12943, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ + { 12967, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ + { 12984, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ + { 13001, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + { 13029, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + { 13058, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + { 13087, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + { 13116, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + { 13145, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + { 13174, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + { 13203, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + { 13231, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + { 13259, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + { 13287, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + { 13315, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + { 13343, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + { 13371, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ + { 13399, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + { 13427, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + { 13455, 0x00000D10 }, /* GL_MAP_COLOR */ + { 13468, 0x00000D11 }, /* GL_MAP_STENCIL */ + { 13483, 0x000088C0 }, /* GL_MATRIX0_ARB */ + { 13498, 0x00008630 }, /* GL_MATRIX0_NV */ + { 13512, 0x000088CA }, /* GL_MATRIX10_ARB */ + { 13528, 0x000088CB }, /* GL_MATRIX11_ARB */ + { 13544, 0x000088CC }, /* GL_MATRIX12_ARB */ + { 13560, 0x000088CD }, /* GL_MATRIX13_ARB */ + { 13576, 0x000088CE }, /* GL_MATRIX14_ARB */ + { 13592, 0x000088CF }, /* GL_MATRIX15_ARB */ + { 13608, 0x000088D0 }, /* GL_MATRIX16_ARB */ + { 13624, 0x000088D1 }, /* GL_MATRIX17_ARB */ + { 13640, 0x000088D2 }, /* GL_MATRIX18_ARB */ + { 13656, 0x000088D3 }, /* GL_MATRIX19_ARB */ + { 13672, 0x000088C1 }, /* GL_MATRIX1_ARB */ + { 13687, 0x00008631 }, /* GL_MATRIX1_NV */ + { 13701, 0x000088D4 }, /* GL_MATRIX20_ARB */ + { 13717, 0x000088D5 }, /* GL_MATRIX21_ARB */ + { 13733, 0x000088D6 }, /* GL_MATRIX22_ARB */ + { 13749, 0x000088D7 }, /* GL_MATRIX23_ARB */ + { 13765, 0x000088D8 }, /* GL_MATRIX24_ARB */ + { 13781, 0x000088D9 }, /* GL_MATRIX25_ARB */ + { 13797, 0x000088DA }, /* GL_MATRIX26_ARB */ + { 13813, 0x000088DB }, /* GL_MATRIX27_ARB */ + { 13829, 0x000088DC }, /* GL_MATRIX28_ARB */ + { 13845, 0x000088DD }, /* GL_MATRIX29_ARB */ + { 13861, 0x000088C2 }, /* GL_MATRIX2_ARB */ + { 13876, 0x00008632 }, /* GL_MATRIX2_NV */ + { 13890, 0x000088DE }, /* GL_MATRIX30_ARB */ + { 13906, 0x000088DF }, /* GL_MATRIX31_ARB */ + { 13922, 0x000088C3 }, /* GL_MATRIX3_ARB */ + { 13937, 0x00008633 }, /* GL_MATRIX3_NV */ + { 13951, 0x000088C4 }, /* GL_MATRIX4_ARB */ + { 13966, 0x00008634 }, /* GL_MATRIX4_NV */ + { 13980, 0x000088C5 }, /* GL_MATRIX5_ARB */ + { 13995, 0x00008635 }, /* GL_MATRIX5_NV */ + { 14009, 0x000088C6 }, /* GL_MATRIX6_ARB */ + { 14024, 0x00008636 }, /* GL_MATRIX6_NV */ + { 14038, 0x000088C7 }, /* GL_MATRIX7_ARB */ + { 14053, 0x00008637 }, /* GL_MATRIX7_NV */ + { 14067, 0x000088C8 }, /* GL_MATRIX8_ARB */ + { 14082, 0x000088C9 }, /* GL_MATRIX9_ARB */ + { 14097, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ + { 14123, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + { 14157, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + { 14188, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + { 14221, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + { 14252, 0x00000BA0 }, /* GL_MATRIX_MODE */ + { 14267, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ + { 14289, 0x00008008 }, /* GL_MAX */ + { 14296, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ + { 14319, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ + { 14345, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + { 14378, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + { 14404, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 14438, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ + { 14457, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ + { 14486, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + { 14518, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ + { 14554, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ + { 14594, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ + { 14620, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ + { 14650, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ + { 14675, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ + { 14704, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + { 14733, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ + { 14766, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ + { 14790, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ + { 14814, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ + { 14838, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ + { 14863, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ + { 14881, 0x00008008 }, /* GL_MAX_EXT */ + { 14892, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ + { 14931, 0x00000D31 }, /* GL_MAX_LIGHTS */ + { 14945, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ + { 14965, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + { 15003, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + { 15032, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ + { 15056, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ + { 15084, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ + { 15107, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 15144, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 15180, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + { 15207, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + { 15236, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + { 15270, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ + { 15306, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + { 15333, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + { 15365, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + { 15401, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + { 15430, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + { 15459, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ + { 15487, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + { 15525, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 15569, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 15612, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 15646, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 15685, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 15722, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 15760, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 15803, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 15846, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + { 15876, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + { 15907, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 15943, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 15979, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ + { 16009, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + { 16043, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ + { 16076, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ + { 16105, 0x00008504 }, /* GL_MAX_SHININESS_NV */ + { 16125, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ + { 16149, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ + { 16175, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ + { 16206, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ + { 16230, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + { 16264, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ + { 16284, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ + { 16311, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ + { 16332, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ + { 16357, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ + { 16382, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ + { 16417, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ + { 16443, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ + { 16469, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ + { 16507, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ + { 16544, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ + { 16568, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ + { 16589, 0x00008007 }, /* GL_MIN */ + { 16596, 0x0000802E }, /* GL_MINMAX */ + { 16606, 0x0000802E }, /* GL_MINMAX_EXT */ + { 16620, 0x0000802F }, /* GL_MINMAX_FORMAT */ + { 16637, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ + { 16658, 0x00008030 }, /* GL_MINMAX_SINK */ + { 16673, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ + { 16692, 0x00008007 }, /* GL_MIN_EXT */ + { 16703, 0x00008370 }, /* GL_MIRRORED_REPEAT */ + { 16722, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ + { 16745, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ + { 16768, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ + { 16788, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ + { 16808, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + { 16838, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ + { 16866, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + { 16894, 0x00001700 }, /* GL_MODELVIEW */ + { 16907, 0x00001700 }, /* GL_MODELVIEW0_ARB */ + { 16925, 0x0000872A }, /* GL_MODELVIEW10_ARB */ + { 16944, 0x0000872B }, /* GL_MODELVIEW11_ARB */ + { 16963, 0x0000872C }, /* GL_MODELVIEW12_ARB */ + { 16982, 0x0000872D }, /* GL_MODELVIEW13_ARB */ + { 17001, 0x0000872E }, /* GL_MODELVIEW14_ARB */ + { 17020, 0x0000872F }, /* GL_MODELVIEW15_ARB */ + { 17039, 0x00008730 }, /* GL_MODELVIEW16_ARB */ + { 17058, 0x00008731 }, /* GL_MODELVIEW17_ARB */ + { 17077, 0x00008732 }, /* GL_MODELVIEW18_ARB */ + { 17096, 0x00008733 }, /* GL_MODELVIEW19_ARB */ + { 17115, 0x0000850A }, /* GL_MODELVIEW1_ARB */ + { 17133, 0x00008734 }, /* GL_MODELVIEW20_ARB */ + { 17152, 0x00008735 }, /* GL_MODELVIEW21_ARB */ + { 17171, 0x00008736 }, /* GL_MODELVIEW22_ARB */ + { 17190, 0x00008737 }, /* GL_MODELVIEW23_ARB */ + { 17209, 0x00008738 }, /* GL_MODELVIEW24_ARB */ + { 17228, 0x00008739 }, /* GL_MODELVIEW25_ARB */ + { 17247, 0x0000873A }, /* GL_MODELVIEW26_ARB */ + { 17266, 0x0000873B }, /* GL_MODELVIEW27_ARB */ + { 17285, 0x0000873C }, /* GL_MODELVIEW28_ARB */ + { 17304, 0x0000873D }, /* GL_MODELVIEW29_ARB */ + { 17323, 0x00008722 }, /* GL_MODELVIEW2_ARB */ + { 17341, 0x0000873E }, /* GL_MODELVIEW30_ARB */ + { 17360, 0x0000873F }, /* GL_MODELVIEW31_ARB */ + { 17379, 0x00008723 }, /* GL_MODELVIEW3_ARB */ + { 17397, 0x00008724 }, /* GL_MODELVIEW4_ARB */ + { 17415, 0x00008725 }, /* GL_MODELVIEW5_ARB */ + { 17433, 0x00008726 }, /* GL_MODELVIEW6_ARB */ + { 17451, 0x00008727 }, /* GL_MODELVIEW7_ARB */ + { 17469, 0x00008728 }, /* GL_MODELVIEW8_ARB */ + { 17487, 0x00008729 }, /* GL_MODELVIEW9_ARB */ + { 17505, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ + { 17525, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ + { 17552, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ + { 17577, 0x00002100 }, /* GL_MODULATE */ + { 17589, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ + { 17609, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ + { 17636, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ + { 17661, 0x00000103 }, /* GL_MULT */ + { 17669, 0x0000809D }, /* GL_MULTISAMPLE */ + { 17684, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ + { 17704, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ + { 17723, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ + { 17742, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ + { 17766, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ + { 17789, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + { 17819, 0x00002A25 }, /* GL_N3F_V3F */ + { 17830, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ + { 17850, 0x0000150E }, /* GL_NAND */ + { 17858, 0x00002600 }, /* GL_NEAREST */ + { 17869, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + { 17900, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + { 17932, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ + { 17957, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ + { 17983, 0x00000200 }, /* GL_NEVER */ + { 17992, 0x00001102 }, /* GL_NICEST */ + { 18002, 0x00000000 }, /* GL_NONE */ + { 18010, 0x00001505 }, /* GL_NOOP */ + { 18018, 0x00001508 }, /* GL_NOR */ + { 18025, 0x00000BA1 }, /* GL_NORMALIZE */ + { 18038, 0x00008075 }, /* GL_NORMAL_ARRAY */ + { 18054, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + { 18085, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ + { 18120, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ + { 18144, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ + { 18167, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ + { 18188, 0x00008511 }, /* GL_NORMAL_MAP */ + { 18202, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ + { 18220, 0x00008511 }, /* GL_NORMAL_MAP_NV */ + { 18237, 0x00000205 }, /* GL_NOTEQUAL */ + { 18249, 0x00000000 }, /* GL_NO_ERROR */ + { 18261, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + { 18295, 0x000086A2 }, /* GL_NUM_TEXTURE_COMPRESSED_FORMATS_ARB */ + { 18333, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ + { 18365, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ + { 18407, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ + { 18437, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ + { 18477, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ + { 18508, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ + { 18537, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ + { 18565, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ + { 18595, 0x00002401 }, /* GL_OBJECT_LINEAR */ + { 18612, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ + { 18638, 0x00002501 }, /* GL_OBJECT_PLANE */ + { 18654, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ + { 18689, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ + { 18711, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ + { 18730, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ + { 18760, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ + { 18781, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ + { 18809, 0x00000001 }, /* GL_ONE */ + { 18816, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + { 18844, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ + { 18876, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ + { 18904, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ + { 18936, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ + { 18959, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ + { 18982, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ + { 19005, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ + { 19028, 0x00008598 }, /* GL_OPERAND0_ALPHA */ + { 19046, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ + { 19068, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ + { 19090, 0x00008590 }, /* GL_OPERAND0_RGB */ + { 19106, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ + { 19126, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ + { 19146, 0x00008599 }, /* GL_OPERAND1_ALPHA */ + { 19164, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ + { 19186, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ + { 19208, 0x00008591 }, /* GL_OPERAND1_RGB */ + { 19224, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ + { 19244, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ + { 19264, 0x0000859A }, /* GL_OPERAND2_ALPHA */ + { 19282, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ + { 19304, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ + { 19326, 0x00008592 }, /* GL_OPERAND2_RGB */ + { 19342, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ + { 19362, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ + { 19382, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ + { 19403, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ + { 19422, 0x00001507 }, /* GL_OR */ + { 19428, 0x00000A01 }, /* GL_ORDER */ + { 19437, 0x0000150D }, /* GL_OR_INVERTED */ + { 19452, 0x0000150B }, /* GL_OR_REVERSE */ + { 19466, 0x00000505 }, /* GL_OUT_OF_MEMORY */ + { 19483, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ + { 19501, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ + { 19522, 0x00008758 }, /* GL_PACK_INVERT_MESA */ + { 19542, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ + { 19560, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ + { 19579, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ + { 19599, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ + { 19619, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ + { 19637, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ + { 19656, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ + { 19681, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ + { 19705, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ + { 19726, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ + { 19748, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ + { 19770, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ + { 19795, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ + { 19819, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ + { 19840, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ + { 19862, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ + { 19884, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ + { 19906, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ + { 19937, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ + { 19957, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + { 19982, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ + { 20002, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + { 20027, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ + { 20047, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + { 20072, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ + { 20092, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + { 20117, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ + { 20137, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + { 20162, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ + { 20182, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + { 20207, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ + { 20227, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + { 20252, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ + { 20272, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + { 20297, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ + { 20317, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + { 20342, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ + { 20362, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + { 20387, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ + { 20405, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ + { 20438, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ + { 20463, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ + { 20498, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ + { 20525, 0x00001B00 }, /* GL_POINT */ + { 20534, 0x00000000 }, /* GL_POINTS */ + { 20544, 0x00000002 }, /* GL_POINT_BIT */ + { 20557, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ + { 20587, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ + { 20621, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ + { 20655, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ + { 20690, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ + { 20719, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ + { 20752, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ + { 20785, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ + { 20819, 0x00000B11 }, /* GL_POINT_SIZE */ + { 20833, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ + { 20859, 0x00008127 }, /* GL_POINT_SIZE_MAX */ + { 20877, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ + { 20899, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ + { 20921, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ + { 20944, 0x00008126 }, /* GL_POINT_SIZE_MIN */ + { 20962, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ + { 20984, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ + { 21006, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ + { 21029, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ + { 21049, 0x00000B10 }, /* GL_POINT_SMOOTH */ + { 21065, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ + { 21086, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ + { 21106, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ + { 21135, 0x00008861 }, /* GL_POINT_SPRITE_NV */ + { 21154, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ + { 21180, 0x00000701 }, /* GL_POINT_TOKEN */ + { 21195, 0x00000009 }, /* GL_POLYGON */ + { 21206, 0x00000008 }, /* GL_POLYGON_BIT */ + { 21221, 0x00000B40 }, /* GL_POLYGON_MODE */ + { 21237, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ + { 21260, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ + { 21285, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ + { 21308, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ + { 21331, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ + { 21355, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ + { 21379, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ + { 21397, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ + { 21420, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ + { 21439, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ + { 21462, 0x00000703 }, /* GL_POLYGON_TOKEN */ + { 21479, 0x00001203 }, /* GL_POSITION */ + { 21491, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + { 21523, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ + { 21559, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + { 21592, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ + { 21629, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + { 21660, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ + { 21695, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + { 21727, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ + { 21763, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + { 21796, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + { 21828, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ + { 21864, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + { 21897, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ + { 21934, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + { 21964, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ + { 21998, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + { 22029, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ + { 22064, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + { 22095, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ + { 22130, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + { 22162, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ + { 22198, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + { 22228, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ + { 22262, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + { 22293, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ + { 22328, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + { 22360, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + { 22391, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ + { 22426, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + { 22458, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ + { 22494, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ + { 22523, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ + { 22556, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ + { 22586, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ + { 22620, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + { 22659, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + { 22692, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + { 22732, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + { 22766, 0x00008578 }, /* GL_PREVIOUS */ + { 22778, 0x00008578 }, /* GL_PREVIOUS_ARB */ + { 22794, 0x00008578 }, /* GL_PREVIOUS_EXT */ + { 22810, 0x00008577 }, /* GL_PRIMARY_COLOR */ + { 22827, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ + { 22848, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ + { 22869, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 22902, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 22934, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ + { 22957, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ + { 22980, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ + { 23010, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ + { 23039, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ + { 23067, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ + { 23089, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + { 23117, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + { 23145, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ + { 23167, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ + { 23188, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 23228, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 23267, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 23297, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 23332, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 23365, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 23399, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 23438, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 23477, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ + { 23499, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ + { 23525, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ + { 23549, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ + { 23572, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ + { 23594, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ + { 23615, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ + { 23636, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ + { 23663, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 23695, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 23727, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + { 23762, 0x00001701 }, /* GL_PROJECTION */ + { 23776, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ + { 23797, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ + { 23823, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ + { 23844, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ + { 23863, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ + { 23886, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + { 23925, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + { 23963, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ + { 23983, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ + { 24007, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ + { 24027, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ + { 24051, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ + { 24071, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + { 24104, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ + { 24130, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ + { 24160, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + { 24191, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ + { 24221, 0x00002003 }, /* GL_Q */ + { 24226, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ + { 24251, 0x00000007 }, /* GL_QUADS */ + { 24260, 0x00008614 }, /* GL_QUAD_MESH_SUN */ + { 24277, 0x00000008 }, /* GL_QUAD_STRIP */ + { 24291, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ + { 24313, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ + { 24339, 0x00008866 }, /* GL_QUERY_RESULT */ + { 24355, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ + { 24375, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ + { 24401, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ + { 24431, 0x00002002 }, /* GL_R */ + { 24436, 0x00002A10 }, /* GL_R3_G3_B2 */ + { 24448, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + { 24481, 0x00000C02 }, /* GL_READ_BUFFER */ + { 24496, 0x000088B8 }, /* GL_READ_ONLY */ + { 24509, 0x000088B8 }, /* GL_READ_ONLY_ARB */ + { 24526, 0x000088BA }, /* GL_READ_WRITE */ + { 24540, 0x000088BA }, /* GL_READ_WRITE_ARB */ + { 24558, 0x00001903 }, /* GL_RED */ + { 24565, 0x00008016 }, /* GL_REDUCE */ + { 24575, 0x00008016 }, /* GL_REDUCE_EXT */ + { 24589, 0x00000D15 }, /* GL_RED_BIAS */ + { 24601, 0x00000D52 }, /* GL_RED_BITS */ + { 24613, 0x00000D14 }, /* GL_RED_SCALE */ + { 24626, 0x00008512 }, /* GL_REFLECTION_MAP */ + { 24644, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ + { 24666, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ + { 24687, 0x00001C00 }, /* GL_RENDER */ + { 24697, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ + { 24725, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ + { 24745, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ + { 24772, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ + { 24808, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ + { 24834, 0x00001F01 }, /* GL_RENDERER */ + { 24846, 0x00000C40 }, /* GL_RENDER_MODE */ + { 24861, 0x00002901 }, /* GL_REPEAT */ + { 24871, 0x00001E01 }, /* GL_REPLACE */ + { 24882, 0x00008062 }, /* GL_REPLACE_EXT */ + { 24897, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ + { 24920, 0x0000803A }, /* GL_RESCALE_NORMAL */ + { 24938, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ + { 24960, 0x00000102 }, /* GL_RETURN */ + { 24970, 0x00001907 }, /* GL_RGB */ + { 24977, 0x00008052 }, /* GL_RGB10 */ + { 24986, 0x00008059 }, /* GL_RGB10_A2 */ + { 24998, 0x00008059 }, /* GL_RGB10_A2_EXT */ + { 25014, 0x00008052 }, /* GL_RGB10_EXT */ + { 25027, 0x00008053 }, /* GL_RGB12 */ + { 25036, 0x00008053 }, /* GL_RGB12_EXT */ + { 25049, 0x00008054 }, /* GL_RGB16 */ + { 25058, 0x00008054 }, /* GL_RGB16_EXT */ + { 25071, 0x0000804E }, /* GL_RGB2_EXT */ + { 25083, 0x0000804F }, /* GL_RGB4 */ + { 25091, 0x0000804F }, /* GL_RGB4_EXT */ + { 25103, 0x000083A1 }, /* GL_RGB4_S3TC */ + { 25116, 0x00008050 }, /* GL_RGB5 */ + { 25124, 0x00008057 }, /* GL_RGB5_A1 */ + { 25135, 0x00008057 }, /* GL_RGB5_A1_EXT */ + { 25150, 0x00008050 }, /* GL_RGB5_EXT */ + { 25162, 0x00008051 }, /* GL_RGB8 */ + { 25170, 0x00008051 }, /* GL_RGB8_EXT */ + { 25182, 0x00001908 }, /* GL_RGBA */ + { 25190, 0x0000805A }, /* GL_RGBA12 */ + { 25200, 0x0000805A }, /* GL_RGBA12_EXT */ + { 25214, 0x0000805B }, /* GL_RGBA16 */ + { 25224, 0x0000805B }, /* GL_RGBA16_EXT */ + { 25238, 0x00008055 }, /* GL_RGBA2 */ + { 25247, 0x00008055 }, /* GL_RGBA2_EXT */ + { 25260, 0x00008056 }, /* GL_RGBA4 */ + { 25269, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ + { 25288, 0x00008056 }, /* GL_RGBA4_EXT */ + { 25301, 0x000083A3 }, /* GL_RGBA4_S3TC */ + { 25315, 0x00008058 }, /* GL_RGBA8 */ + { 25324, 0x00008058 }, /* GL_RGBA8_EXT */ + { 25337, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ + { 25355, 0x00000C31 }, /* GL_RGBA_MODE */ + { 25368, 0x000083A2 }, /* GL_RGBA_S3TC */ + { 25381, 0x000083A0 }, /* GL_RGB_S3TC */ + { 25393, 0x00008573 }, /* GL_RGB_SCALE */ + { 25406, 0x00008573 }, /* GL_RGB_SCALE_ARB */ + { 25423, 0x00008573 }, /* GL_RGB_SCALE_EXT */ + { 25440, 0x00000407 }, /* GL_RIGHT */ + { 25449, 0x00002000 }, /* GL_S */ + { 25454, 0x000080A9 }, /* GL_SAMPLES */ + { 25465, 0x000086B4 }, /* GL_SAMPLES_3DFX */ + { 25481, 0x000080A9 }, /* GL_SAMPLES_ARB */ + { 25496, 0x00008914 }, /* GL_SAMPLES_PASSED */ + { 25514, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ + { 25536, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + { 25564, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ + { 25596, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ + { 25619, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ + { 25646, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ + { 25664, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ + { 25687, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ + { 25709, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ + { 25728, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ + { 25751, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ + { 25777, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ + { 25807, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ + { 25832, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ + { 25861, 0x00080000 }, /* GL_SCISSOR_BIT */ + { 25876, 0x00000C10 }, /* GL_SCISSOR_BOX */ + { 25891, 0x00000C11 }, /* GL_SCISSOR_TEST */ + { 25907, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ + { 25932, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + { 25972, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ + { 26016, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + { 26049, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + { 26079, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + { 26111, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + { 26141, 0x00001C02 }, /* GL_SELECT */ + { 26151, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ + { 26179, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ + { 26204, 0x00008012 }, /* GL_SEPARABLE_2D */ + { 26220, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ + { 26247, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ + { 26278, 0x0000150F }, /* GL_SET */ + { 26285, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ + { 26306, 0x00000B54 }, /* GL_SHADE_MODEL */ + { 26321, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ + { 26344, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + { 26374, 0x00001601 }, /* GL_SHININESS */ + { 26387, 0x00001402 }, /* GL_SHORT */ + { 26396, 0x000081F9 }, /* GL_SINGLE_COLOR */ + { 26412, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ + { 26432, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ + { 26451, 0x00001D01 }, /* GL_SMOOTH */ + { 26461, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ + { 26494, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ + { 26521, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ + { 26554, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ + { 26581, 0x00008588 }, /* GL_SOURCE0_ALPHA */ + { 26598, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ + { 26619, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ + { 26640, 0x00008580 }, /* GL_SOURCE0_RGB */ + { 26655, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ + { 26674, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ + { 26693, 0x00008589 }, /* GL_SOURCE1_ALPHA */ + { 26710, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ + { 26731, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ + { 26752, 0x00008581 }, /* GL_SOURCE1_RGB */ + { 26767, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ + { 26786, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ + { 26805, 0x0000858A }, /* GL_SOURCE2_ALPHA */ + { 26822, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ + { 26843, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ + { 26864, 0x00008582 }, /* GL_SOURCE2_RGB */ + { 26879, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ + { 26898, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ + { 26917, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ + { 26937, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ + { 26955, 0x00001202 }, /* GL_SPECULAR */ + { 26967, 0x00002402 }, /* GL_SPHERE_MAP */ + { 26981, 0x00001206 }, /* GL_SPOT_CUTOFF */ + { 26996, 0x00001204 }, /* GL_SPOT_DIRECTION */ + { 27014, 0x00001205 }, /* GL_SPOT_EXPONENT */ + { 27031, 0x00008588 }, /* GL_SRC0_ALPHA */ + { 27045, 0x00008580 }, /* GL_SRC0_RGB */ + { 27057, 0x00008589 }, /* GL_SRC1_ALPHA */ + { 27071, 0x00008581 }, /* GL_SRC1_RGB */ + { 27083, 0x0000858A }, /* GL_SRC2_ALPHA */ + { 27097, 0x00008582 }, /* GL_SRC2_RGB */ + { 27109, 0x00000302 }, /* GL_SRC_ALPHA */ + { 27122, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ + { 27144, 0x00000300 }, /* GL_SRC_COLOR */ + { 27157, 0x00000503 }, /* GL_STACK_OVERFLOW */ + { 27175, 0x00000504 }, /* GL_STACK_UNDERFLOW */ + { 27194, 0x000088E6 }, /* GL_STATIC_COPY */ + { 27209, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ + { 27228, 0x000088E4 }, /* GL_STATIC_DRAW */ + { 27243, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ + { 27262, 0x000088E5 }, /* GL_STATIC_READ */ + { 27277, 0x000088E5 }, /* GL_STATIC_READ_ARB */ + { 27296, 0x00001802 }, /* GL_STENCIL */ + { 27307, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ + { 27333, 0x00000D57 }, /* GL_STENCIL_BITS */ + { 27349, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ + { 27371, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ + { 27394, 0x00000B94 }, /* GL_STENCIL_FAIL */ + { 27410, 0x00000B92 }, /* GL_STENCIL_FUNC */ + { 27426, 0x00001901 }, /* GL_STENCIL_INDEX */ + { 27443, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ + { 27466, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ + { 27488, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ + { 27510, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ + { 27532, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ + { 27553, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ + { 27580, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ + { 27607, 0x00000B97 }, /* GL_STENCIL_REF */ + { 27622, 0x00000B90 }, /* GL_STENCIL_TEST */ + { 27638, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + { 27667, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ + { 27689, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ + { 27710, 0x00000C33 }, /* GL_STEREO */ + { 27720, 0x000088E2 }, /* GL_STREAM_COPY */ + { 27735, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ + { 27754, 0x000088E0 }, /* GL_STREAM_DRAW */ + { 27769, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ + { 27788, 0x000088E1 }, /* GL_STREAM_READ */ + { 27803, 0x000088E1 }, /* GL_STREAM_READ_ARB */ + { 27822, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ + { 27839, 0x000084E7 }, /* GL_SUBTRACT */ + { 27851, 0x000084E7 }, /* GL_SUBTRACT_ARB */ + { 27867, 0x00002001 }, /* GL_T */ + { 27872, 0x00002A2A }, /* GL_T2F_C3F_V3F */ + { 27887, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ + { 27906, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ + { 27922, 0x00002A2B }, /* GL_T2F_N3F_V3F */ + { 27937, 0x00002A27 }, /* GL_T2F_V3F */ + { 27948, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ + { 27967, 0x00002A28 }, /* GL_T4F_V4F */ + { 27978, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ + { 28001, 0x00001702 }, /* GL_TEXTURE */ + { 28012, 0x000084C0 }, /* GL_TEXTURE0 */ + { 28024, 0x000084C0 }, /* GL_TEXTURE0_ARB */ + { 28040, 0x000084C1 }, /* GL_TEXTURE1 */ + { 28052, 0x000084CA }, /* GL_TEXTURE10 */ + { 28065, 0x000084CA }, /* GL_TEXTURE10_ARB */ + { 28082, 0x000084CB }, /* GL_TEXTURE11 */ + { 28095, 0x000084CB }, /* GL_TEXTURE11_ARB */ + { 28112, 0x000084CC }, /* GL_TEXTURE12 */ + { 28125, 0x000084CC }, /* GL_TEXTURE12_ARB */ + { 28142, 0x000084CD }, /* GL_TEXTURE13 */ + { 28155, 0x000084CD }, /* GL_TEXTURE13_ARB */ + { 28172, 0x000084CE }, /* GL_TEXTURE14 */ + { 28185, 0x000084CE }, /* GL_TEXTURE14_ARB */ + { 28202, 0x000084CF }, /* GL_TEXTURE15 */ + { 28215, 0x000084CF }, /* GL_TEXTURE15_ARB */ + { 28232, 0x000084D0 }, /* GL_TEXTURE16 */ + { 28245, 0x000084D0 }, /* GL_TEXTURE16_ARB */ + { 28262, 0x000084D1 }, /* GL_TEXTURE17 */ + { 28275, 0x000084D1 }, /* GL_TEXTURE17_ARB */ + { 28292, 0x000084D2 }, /* GL_TEXTURE18 */ + { 28305, 0x000084D2 }, /* GL_TEXTURE18_ARB */ + { 28322, 0x000084D3 }, /* GL_TEXTURE19 */ + { 28335, 0x000084D3 }, /* GL_TEXTURE19_ARB */ + { 28352, 0x000084C1 }, /* GL_TEXTURE1_ARB */ + { 28368, 0x000084C2 }, /* GL_TEXTURE2 */ + { 28380, 0x000084D4 }, /* GL_TEXTURE20 */ + { 28393, 0x000084D4 }, /* GL_TEXTURE20_ARB */ + { 28410, 0x000084D5 }, /* GL_TEXTURE21 */ + { 28423, 0x000084D5 }, /* GL_TEXTURE21_ARB */ + { 28440, 0x000084D6 }, /* GL_TEXTURE22 */ + { 28453, 0x000084D6 }, /* GL_TEXTURE22_ARB */ + { 28470, 0x000084D7 }, /* GL_TEXTURE23 */ + { 28483, 0x000084D7 }, /* GL_TEXTURE23_ARB */ + { 28500, 0x000084D8 }, /* GL_TEXTURE24 */ + { 28513, 0x000084D8 }, /* GL_TEXTURE24_ARB */ + { 28530, 0x000084D9 }, /* GL_TEXTURE25 */ + { 28543, 0x000084D9 }, /* GL_TEXTURE25_ARB */ + { 28560, 0x000084DA }, /* GL_TEXTURE26 */ + { 28573, 0x000084DA }, /* GL_TEXTURE26_ARB */ + { 28590, 0x000084DB }, /* GL_TEXTURE27 */ + { 28603, 0x000084DB }, /* GL_TEXTURE27_ARB */ + { 28620, 0x000084DC }, /* GL_TEXTURE28 */ + { 28633, 0x000084DC }, /* GL_TEXTURE28_ARB */ + { 28650, 0x000084DD }, /* GL_TEXTURE29 */ + { 28663, 0x000084DD }, /* GL_TEXTURE29_ARB */ + { 28680, 0x000084C2 }, /* GL_TEXTURE2_ARB */ + { 28696, 0x000084C3 }, /* GL_TEXTURE3 */ + { 28708, 0x000084DE }, /* GL_TEXTURE30 */ + { 28721, 0x000084DE }, /* GL_TEXTURE30_ARB */ + { 28738, 0x000084DF }, /* GL_TEXTURE31 */ + { 28751, 0x000084DF }, /* GL_TEXTURE31_ARB */ + { 28768, 0x000084C3 }, /* GL_TEXTURE3_ARB */ + { 28784, 0x000084C4 }, /* GL_TEXTURE4 */ + { 28796, 0x000084C4 }, /* GL_TEXTURE4_ARB */ + { 28812, 0x000084C5 }, /* GL_TEXTURE5 */ + { 28824, 0x000084C5 }, /* GL_TEXTURE5_ARB */ + { 28840, 0x000084C6 }, /* GL_TEXTURE6 */ + { 28852, 0x000084C6 }, /* GL_TEXTURE6_ARB */ + { 28868, 0x000084C7 }, /* GL_TEXTURE7 */ + { 28880, 0x000084C7 }, /* GL_TEXTURE7_ARB */ + { 28896, 0x000084C8 }, /* GL_TEXTURE8 */ + { 28908, 0x000084C8 }, /* GL_TEXTURE8_ARB */ + { 28924, 0x000084C9 }, /* GL_TEXTURE9 */ + { 28936, 0x000084C9 }, /* GL_TEXTURE9_ARB */ + { 28952, 0x00000DE0 }, /* GL_TEXTURE_1D */ + { 28966, 0x00000DE1 }, /* GL_TEXTURE_2D */ + { 28980, 0x0000806F }, /* GL_TEXTURE_3D */ + { 28994, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ + { 29016, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ + { 29042, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ + { 29064, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ + { 29086, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ + { 29108, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ + { 29130, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ + { 29158, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ + { 29190, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + { 29223, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ + { 29255, 0x00040000 }, /* GL_TEXTURE_BIT */ + { 29270, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ + { 29291, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ + { 29316, 0x00001005 }, /* GL_TEXTURE_BORDER */ + { 29334, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ + { 29358, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + { 29389, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + { 29419, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + { 29449, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + { 29484, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + { 29515, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 29553, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ + { 29580, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + { 29612, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + { 29646, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ + { 29670, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ + { 29698, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ + { 29722, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ + { 29750, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + { 29783, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ + { 29807, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ + { 29829, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ + { 29851, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ + { 29877, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ + { 29911, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + { 29944, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ + { 29981, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ + { 30009, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ + { 30041, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ + { 30064, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + { 30102, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ + { 30144, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + { 30175, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + { 30203, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + { 30233, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + { 30261, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ + { 30281, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ + { 30305, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + { 30336, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ + { 30371, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + { 30402, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ + { 30437, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + { 30468, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ + { 30503, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + { 30534, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ + { 30569, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + { 30600, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ + { 30635, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + { 30666, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ + { 30701, 0x00008071 }, /* GL_TEXTURE_DEPTH */ + { 30718, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ + { 30740, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ + { 30766, 0x00002300 }, /* GL_TEXTURE_ENV */ + { 30781, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ + { 30802, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ + { 30822, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ + { 30848, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ + { 30868, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ + { 30885, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ + { 30902, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ + { 30919, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ + { 30936, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ + { 30961, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ + { 30983, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ + { 31009, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ + { 31027, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ + { 31053, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ + { 31079, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ + { 31109, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ + { 31136, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ + { 31161, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ + { 31181, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ + { 31205, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + { 31232, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + { 31259, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + { 31286, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ + { 31312, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ + { 31342, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ + { 31364, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ + { 31382, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + { 31412, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + { 31440, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + { 31468, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + { 31496, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ + { 31517, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ + { 31536, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ + { 31558, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ + { 31577, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ + { 31597, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ + { 31622, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ + { 31646, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ + { 31666, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ + { 31690, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ + { 31710, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ + { 31733, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ + { 31758, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + { 31792, 0x00001000 }, /* GL_TEXTURE_WIDTH */ + { 31809, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ + { 31827, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ + { 31845, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ + { 31863, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ + { 31882, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + { 31911, 0x00001000 }, /* GL_TRANSFORM_BIT */ + { 31928, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ + { 31954, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ + { 31984, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + { 32016, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + { 32046, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ + { 32080, 0x0000862C }, /* GL_TRANSPOSE_NV */ + { 32096, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + { 32127, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ + { 32162, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + { 32190, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ + { 32222, 0x00000004 }, /* GL_TRIANGLES */ + { 32235, 0x00000006 }, /* GL_TRIANGLE_FAN */ + { 32251, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ + { 32272, 0x00000005 }, /* GL_TRIANGLE_STRIP */ + { 32290, 0x00000001 }, /* GL_TRUE */ + { 32298, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ + { 32318, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ + { 32341, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ + { 32361, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ + { 32382, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ + { 32404, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ + { 32426, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ + { 32446, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ + { 32467, 0x00001401 }, /* GL_UNSIGNED_BYTE */ + { 32484, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + { 32511, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ + { 32534, 0x00001405 }, /* GL_UNSIGNED_INT */ + { 32550, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ + { 32577, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ + { 32601, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + { 32632, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ + { 32656, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + { 32684, 0x00001403 }, /* GL_UNSIGNED_SHORT */ + { 32702, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + { 32732, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + { 32758, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + { 32788, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + { 32814, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ + { 32838, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + { 32866, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + { 32894, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ + { 32921, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + { 32953, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ + { 32984, 0x00002A20 }, /* GL_V2F */ + { 32991, 0x00002A21 }, /* GL_V3F */ + { 32998, 0x00001F00 }, /* GL_VENDOR */ + { 33008, 0x00001F02 }, /* GL_VERSION */ + { 33019, 0x00008074 }, /* GL_VERTEX_ARRAY */ + { 33035, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + { 33066, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ + { 33101, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ + { 33125, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ + { 33146, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ + { 33169, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ + { 33190, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + { 33217, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + { 33245, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + { 33273, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + { 33301, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + { 33329, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + { 33357, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + { 33385, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + { 33412, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + { 33439, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + { 33466, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + { 33493, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + { 33520, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + { 33547, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + { 33574, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + { 33601, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + { 33628, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + { 33666, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ + { 33708, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ + { 33743, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ + { 33781, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ + { 33816, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ + { 33848, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ + { 33882, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ + { 33914, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ + { 33934, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ + { 33956, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ + { 33985, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ + { 34006, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ + { 34039, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ + { 34071, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ + { 34102, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + { 34132, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ + { 34153, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ + { 34180, 0x00000BA2 }, /* GL_VIEWPORT */ + { 34192, 0x00000800 }, /* GL_VIEWPORT_BIT */ + { 34208, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ + { 34228, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + { 34259, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ + { 34294, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + { 34322, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + { 34347, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + { 34374, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + { 34399, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ + { 34423, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ + { 34442, 0x000088B9 }, /* GL_WRITE_ONLY */ + { 34456, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ + { 34474, 0x00001506 }, /* GL_XOR */ + { 34481, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ + { 34500, 0x00008757 }, /* GL_YCBCR_MESA */ + { 34514, 0x00000000 }, /* GL_ZERO */ + { 34522, 0x00000D16 }, /* GL_ZOOM_X */ + { 34532, 0x00000D17 }, /* GL_ZOOM_Y */ +}; + +static const unsigned reduced_enums[1232] = +{ + 26, /* GL_ALL_CLIENT_ATTRIB_BITS */ + 389, /* GL_FALSE */ + 561, /* GL_LINES */ + 563, /* GL_LINE_LOOP */ + 570, /* GL_LINE_STRIP */ + 1515, /* GL_TRIANGLES */ + 1518, /* GL_TRIANGLE_STRIP */ + 1516, /* GL_TRIANGLE_FAN */ + 1112, /* GL_QUADS */ + 1114, /* GL_QUAD_STRIP */ + 1002, /* GL_POLYGON */ + 1014, /* GL_POLYGON_STIPPLE_BIT */ + 968, /* GL_PIXEL_MODE_BIT */ + 548, /* GL_LIGHTING_BIT */ + 405, /* GL_FOG_BIT */ + 8, /* GL_ACCUM */ + 579, /* GL_LOAD */ + 1152, /* GL_RETURN */ + 841, /* GL_MULT */ + 19, /* GL_ADD */ + 857, /* GL_NEVER */ + 538, /* GL_LESS */ + 379, /* GL_EQUAL */ + 537, /* GL_LEQUAL */ + 467, /* GL_GREATER */ + 872, /* GL_NOTEQUAL */ + 466, /* GL_GEQUAL */ + 42, /* GL_ALWAYS */ + 1276, /* GL_SRC_COLOR */ + 901, /* GL_ONE_MINUS_SRC_COLOR */ + 1274, /* GL_SRC_ALPHA */ + 900, /* GL_ONE_MINUS_SRC_ALPHA */ + 359, /* GL_DST_ALPHA */ + 898, /* GL_ONE_MINUS_DST_ALPHA */ + 360, /* GL_DST_COLOR */ + 899, /* GL_ONE_MINUS_DST_COLOR */ + 1275, /* GL_SRC_ALPHA_SATURATE */ + 454, /* GL_FRONT_LEFT */ + 455, /* GL_FRONT_RIGHT */ + 64, /* GL_BACK_LEFT */ + 65, /* GL_BACK_RIGHT */ + 451, /* GL_FRONT */ + 63, /* GL_BACK */ + 536, /* GL_LEFT */ + 1192, /* GL_RIGHT */ + 452, /* GL_FRONT_AND_BACK */ + 58, /* GL_AUX0 */ + 59, /* GL_AUX1 */ + 60, /* GL_AUX2 */ + 61, /* GL_AUX3 */ + 528, /* GL_INVALID_ENUM */ + 531, /* GL_INVALID_VALUE */ + 530, /* GL_INVALID_OPERATION */ + 1277, /* GL_STACK_OVERFLOW */ + 1278, /* GL_STACK_UNDERFLOW */ + 926, /* GL_OUT_OF_MEMORY */ + 529, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ + 0, /* GL_2D */ + 2, /* GL_3D */ + 3, /* GL_3D_COLOR */ + 4, /* GL_3D_COLOR_TEXTURE */ + 6, /* GL_4D_COLOR_TEXTURE */ + 946, /* GL_PASS_THROUGH_TOKEN */ + 1001, /* GL_POINT_TOKEN */ + 571, /* GL_LINE_TOKEN */ + 1015, /* GL_POLYGON_TOKEN */ + 69, /* GL_BITMAP_TOKEN */ + 358, /* GL_DRAW_PIXEL_TOKEN */ + 248, /* GL_COPY_PIXEL_TOKEN */ + 564, /* GL_LINE_RESET_TOKEN */ + 382, /* GL_EXP */ + 383, /* GL_EXP2 */ + 279, /* GL_CW */ + 106, /* GL_CCW */ + 127, /* GL_COEFF */ + 923, /* GL_ORDER */ + 315, /* GL_DOMAIN */ + 256, /* GL_CURRENT_COLOR */ + 259, /* GL_CURRENT_INDEX */ + 265, /* GL_CURRENT_NORMAL */ + 276, /* GL_CURRENT_TEXTURE_COORDS */ + 269, /* GL_CURRENT_RASTER_COLOR */ + 271, /* GL_CURRENT_RASTER_INDEX */ + 274, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ + 272, /* GL_CURRENT_RASTER_POSITION */ + 273, /* GL_CURRENT_RASTER_POSITION_VALID */ + 270, /* GL_CURRENT_RASTER_DISTANCE */ + 995, /* GL_POINT_SMOOTH */ + 984, /* GL_POINT_SIZE */ + 994, /* GL_POINT_SIZE_RANGE */ + 985, /* GL_POINT_SIZE_GRANULARITY */ + 565, /* GL_LINE_SMOOTH */ + 572, /* GL_LINE_WIDTH */ + 574, /* GL_LINE_WIDTH_RANGE */ + 573, /* GL_LINE_WIDTH_GRANULARITY */ + 567, /* GL_LINE_STIPPLE */ + 568, /* GL_LINE_STIPPLE_PATTERN */ + 569, /* GL_LINE_STIPPLE_REPEAT */ + 578, /* GL_LIST_MODE */ + 732, /* GL_MAX_LIST_NESTING */ + 575, /* GL_LIST_BASE */ + 577, /* GL_LIST_INDEX */ + 1004, /* GL_POLYGON_MODE */ + 1011, /* GL_POLYGON_SMOOTH */ + 1013, /* GL_POLYGON_STIPPLE */ + 367, /* GL_EDGE_FLAG */ + 249, /* GL_CULL_FACE */ + 250, /* GL_CULL_FACE_MODE */ + 453, /* GL_FRONT_FACE */ + 547, /* GL_LIGHTING */ + 552, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + 553, /* GL_LIGHT_MODEL_TWO_SIDE */ + 549, /* GL_LIGHT_MODEL_AMBIENT */ + 1230, /* GL_SHADE_MODEL */ + 158, /* GL_COLOR_MATERIAL_FACE */ + 159, /* GL_COLOR_MATERIAL_PARAMETER */ + 157, /* GL_COLOR_MATERIAL */ + 404, /* GL_FOG */ + 426, /* GL_FOG_INDEX */ + 422, /* GL_FOG_DENSITY */ + 430, /* GL_FOG_START */ + 424, /* GL_FOG_END */ + 427, /* GL_FOG_MODE */ + 406, /* GL_FOG_COLOR */ + 304, /* GL_DEPTH_RANGE */ + 309, /* GL_DEPTH_TEST */ + 312, /* GL_DEPTH_WRITEMASK */ + 292, /* GL_DEPTH_CLEAR_VALUE */ + 303, /* GL_DEPTH_FUNC */ + 12, /* GL_ACCUM_CLEAR_VALUE */ + 1301, /* GL_STENCIL_TEST */ + 1289, /* GL_STENCIL_CLEAR_VALUE */ + 1291, /* GL_STENCIL_FUNC */ + 1303, /* GL_STENCIL_VALUE_MASK */ + 1290, /* GL_STENCIL_FAIL */ + 1298, /* GL_STENCIL_PASS_DEPTH_FAIL */ + 1299, /* GL_STENCIL_PASS_DEPTH_PASS */ + 1300, /* GL_STENCIL_REF */ + 1304, /* GL_STENCIL_WRITEMASK */ + 705, /* GL_MATRIX_MODE */ + 862, /* GL_NORMALIZE */ + 1593, /* GL_VIEWPORT */ + 836, /* GL_MODELVIEW_STACK_DEPTH */ + 1094, /* GL_PROJECTION_STACK_DEPTH */ + 1495, /* GL_TEXTURE_STACK_DEPTH */ + 834, /* GL_MODELVIEW_MATRIX */ + 1093, /* GL_PROJECTION_MATRIX */ + 1480, /* GL_TEXTURE_MATRIX */ + 56, /* GL_ATTRIB_STACK_DEPTH */ + 117, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ + 39, /* GL_ALPHA_TEST */ + 40, /* GL_ALPHA_TEST_FUNC */ + 41, /* GL_ALPHA_TEST_REF */ + 314, /* GL_DITHER */ + 73, /* GL_BLEND_DST */ + 80, /* GL_BLEND_SRC */ + 70, /* GL_BLEND */ + 581, /* GL_LOGIC_OP_MODE */ + 506, /* GL_INDEX_LOGIC_OP */ + 156, /* GL_COLOR_LOGIC_OP */ + 62, /* GL_AUX_BUFFERS */ + 325, /* GL_DRAW_BUFFER */ + 1124, /* GL_READ_BUFFER */ + 1213, /* GL_SCISSOR_BOX */ + 1214, /* GL_SCISSOR_TEST */ + 505, /* GL_INDEX_CLEAR_VALUE */ + 510, /* GL_INDEX_WRITEMASK */ + 153, /* GL_COLOR_CLEAR_VALUE */ + 185, /* GL_COLOR_WRITEMASK */ + 507, /* GL_INDEX_MODE */ + 1186, /* GL_RGBA_MODE */ + 324, /* GL_DOUBLEBUFFER */ + 1305, /* GL_STEREO */ + 1145, /* GL_RENDER_MODE */ + 947, /* GL_PERSPECTIVE_CORRECTION_HINT */ + 996, /* GL_POINT_SMOOTH_HINT */ + 566, /* GL_LINE_SMOOTH_HINT */ + 1012, /* GL_POLYGON_SMOOTH_HINT */ + 425, /* GL_FOG_HINT */ + 1461, /* GL_TEXTURE_GEN_S */ + 1462, /* GL_TEXTURE_GEN_T */ + 1460, /* GL_TEXTURE_GEN_R */ + 1459, /* GL_TEXTURE_GEN_Q */ + 960, /* GL_PIXEL_MAP_I_TO_I */ + 966, /* GL_PIXEL_MAP_S_TO_S */ + 962, /* GL_PIXEL_MAP_I_TO_R */ + 958, /* GL_PIXEL_MAP_I_TO_G */ + 956, /* GL_PIXEL_MAP_I_TO_B */ + 954, /* GL_PIXEL_MAP_I_TO_A */ + 964, /* GL_PIXEL_MAP_R_TO_R */ + 952, /* GL_PIXEL_MAP_G_TO_G */ + 950, /* GL_PIXEL_MAP_B_TO_B */ + 948, /* GL_PIXEL_MAP_A_TO_A */ + 961, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + 967, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + 963, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + 959, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + 957, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + 955, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + 965, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + 953, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + 951, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + 949, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + 1527, /* GL_UNPACK_SWAP_BYTES */ + 1522, /* GL_UNPACK_LSB_FIRST */ + 1523, /* GL_UNPACK_ROW_LENGTH */ + 1526, /* GL_UNPACK_SKIP_ROWS */ + 1525, /* GL_UNPACK_SKIP_PIXELS */ + 1520, /* GL_UNPACK_ALIGNMENT */ + 935, /* GL_PACK_SWAP_BYTES */ + 930, /* GL_PACK_LSB_FIRST */ + 931, /* GL_PACK_ROW_LENGTH */ + 934, /* GL_PACK_SKIP_ROWS */ + 933, /* GL_PACK_SKIP_PIXELS */ + 927, /* GL_PACK_ALIGNMENT */ + 658, /* GL_MAP_COLOR */ + 659, /* GL_MAP_STENCIL */ + 509, /* GL_INDEX_SHIFT */ + 508, /* GL_INDEX_OFFSET */ + 1134, /* GL_RED_SCALE */ + 1132, /* GL_RED_BIAS */ + 1610, /* GL_ZOOM_X */ + 1611, /* GL_ZOOM_Y */ + 471, /* GL_GREEN_SCALE */ + 469, /* GL_GREEN_BIAS */ + 86, /* GL_BLUE_SCALE */ + 84, /* GL_BLUE_BIAS */ + 38, /* GL_ALPHA_SCALE */ + 36, /* GL_ALPHA_BIAS */ + 305, /* GL_DEPTH_SCALE */ + 286, /* GL_DEPTH_BIAS */ + 728, /* GL_MAX_EVAL_ORDER */ + 731, /* GL_MAX_LIGHTS */ + 713, /* GL_MAX_CLIP_PLANES */ + 773, /* GL_MAX_TEXTURE_SIZE */ + 737, /* GL_MAX_PIXEL_MAP_TABLE */ + 709, /* GL_MAX_ATTRIB_STACK_DEPTH */ + 734, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + 735, /* GL_MAX_NAME_STACK_DEPTH */ + 763, /* GL_MAX_PROJECTION_STACK_DEPTH */ + 774, /* GL_MAX_TEXTURE_STACK_DEPTH */ + 784, /* GL_MAX_VIEWPORT_DIMS */ + 710, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + 1312, /* GL_SUBPIXEL_BITS */ + 504, /* GL_INDEX_BITS */ + 1133, /* GL_RED_BITS */ + 470, /* GL_GREEN_BITS */ + 85, /* GL_BLUE_BITS */ + 37, /* GL_ALPHA_BITS */ + 287, /* GL_DEPTH_BITS */ + 1287, /* GL_STENCIL_BITS */ + 14, /* GL_ACCUM_RED_BITS */ + 13, /* GL_ACCUM_GREEN_BITS */ + 10, /* GL_ACCUM_BLUE_BITS */ + 9, /* GL_ACCUM_ALPHA_BITS */ + 850, /* GL_NAME_STACK_DEPTH */ + 57, /* GL_AUTO_NORMAL */ + 604, /* GL_MAP1_COLOR_4 */ + 607, /* GL_MAP1_INDEX */ + 608, /* GL_MAP1_NORMAL */ + 609, /* GL_MAP1_TEXTURE_COORD_1 */ + 610, /* GL_MAP1_TEXTURE_COORD_2 */ + 611, /* GL_MAP1_TEXTURE_COORD_3 */ + 612, /* GL_MAP1_TEXTURE_COORD_4 */ + 613, /* GL_MAP1_VERTEX_3 */ + 614, /* GL_MAP1_VERTEX_4 */ + 631, /* GL_MAP2_COLOR_4 */ + 634, /* GL_MAP2_INDEX */ + 635, /* GL_MAP2_NORMAL */ + 636, /* GL_MAP2_TEXTURE_COORD_1 */ + 637, /* GL_MAP2_TEXTURE_COORD_2 */ + 638, /* GL_MAP2_TEXTURE_COORD_3 */ + 639, /* GL_MAP2_TEXTURE_COORD_4 */ + 640, /* GL_MAP2_VERTEX_3 */ + 641, /* GL_MAP2_VERTEX_4 */ + 605, /* GL_MAP1_GRID_DOMAIN */ + 606, /* GL_MAP1_GRID_SEGMENTS */ + 632, /* GL_MAP2_GRID_DOMAIN */ + 633, /* GL_MAP2_GRID_SEGMENTS */ + 1389, /* GL_TEXTURE_1D */ + 1390, /* GL_TEXTURE_2D */ + 392, /* GL_FEEDBACK_BUFFER_POINTER */ + 393, /* GL_FEEDBACK_BUFFER_SIZE */ + 394, /* GL_FEEDBACK_BUFFER_TYPE */ + 1223, /* GL_SELECTION_BUFFER_POINTER */ + 1224, /* GL_SELECTION_BUFFER_SIZE */ + 1498, /* GL_TEXTURE_WIDTH */ + 1466, /* GL_TEXTURE_HEIGHT */ + 1422, /* GL_TEXTURE_COMPONENTS */ + 1406, /* GL_TEXTURE_BORDER_COLOR */ + 1405, /* GL_TEXTURE_BORDER */ + 316, /* GL_DONT_CARE */ + 390, /* GL_FASTEST */ + 858, /* GL_NICEST */ + 43, /* GL_AMBIENT */ + 313, /* GL_DIFFUSE */ + 1263, /* GL_SPECULAR */ + 1016, /* GL_POSITION */ + 1266, /* GL_SPOT_DIRECTION */ + 1267, /* GL_SPOT_EXPONENT */ + 1265, /* GL_SPOT_CUTOFF */ + 223, /* GL_CONSTANT_ATTENUATION */ + 556, /* GL_LINEAR_ATTENUATION */ + 1111, /* GL_QUADRATIC_ATTENUATION */ + 198, /* GL_COMPILE */ + 199, /* GL_COMPILE_AND_EXECUTE */ + 101, /* GL_BYTE */ + 1528, /* GL_UNSIGNED_BYTE */ + 1234, /* GL_SHORT */ + 1537, /* GL_UNSIGNED_SHORT */ + 511, /* GL_INT */ + 1531, /* GL_UNSIGNED_INT */ + 397, /* GL_FLOAT */ + 1, /* GL_2_BYTES */ + 5, /* GL_3_BYTES */ + 7, /* GL_4_BYTES */ + 323, /* GL_DOUBLE */ + 113, /* GL_CLEAR */ + 45, /* GL_AND */ + 47, /* GL_AND_REVERSE */ + 246, /* GL_COPY */ + 46, /* GL_AND_INVERTED */ + 860, /* GL_NOOP */ + 1606, /* GL_XOR */ + 922, /* GL_OR */ + 861, /* GL_NOR */ + 380, /* GL_EQUIV */ + 534, /* GL_INVERT */ + 925, /* GL_OR_REVERSE */ + 247, /* GL_COPY_INVERTED */ + 924, /* GL_OR_INVERTED */ + 851, /* GL_NAND */ + 1228, /* GL_SET */ + 377, /* GL_EMISSION */ + 1233, /* GL_SHININESS */ + 44, /* GL_AMBIENT_AND_DIFFUSE */ + 155, /* GL_COLOR_INDEXES */ + 801, /* GL_MODELVIEW */ + 1092, /* GL_PROJECTION */ + 1324, /* GL_TEXTURE */ + 128, /* GL_COLOR */ + 284, /* GL_DEPTH */ + 1285, /* GL_STENCIL */ + 154, /* GL_COLOR_INDEX */ + 1292, /* GL_STENCIL_INDEX */ + 293, /* GL_DEPTH_COMPONENT */ + 1129, /* GL_RED */ + 468, /* GL_GREEN */ + 83, /* GL_BLUE */ + 27, /* GL_ALPHA */ + 1153, /* GL_RGB */ + 1172, /* GL_RGBA */ + 582, /* GL_LUMINANCE */ + 603, /* GL_LUMINANCE_ALPHA */ + 68, /* GL_BITMAP */ + 973, /* GL_POINT */ + 554, /* GL_LINE */ + 395, /* GL_FILL */ + 1138, /* GL_RENDER */ + 391, /* GL_FEEDBACK */ + 1222, /* GL_SELECT */ + 396, /* GL_FLAT */ + 1238, /* GL_SMOOTH */ + 535, /* GL_KEEP */ + 1147, /* GL_REPLACE */ + 495, /* GL_INCR */ + 281, /* GL_DECR */ + 1550, /* GL_VENDOR */ + 1144, /* GL_RENDERER */ + 1551, /* GL_VERSION */ + 384, /* GL_EXTENSIONS */ + 1193, /* GL_S */ + 1315, /* GL_T */ + 1121, /* GL_R */ + 1110, /* GL_Q */ + 837, /* GL_MODULATE */ + 280, /* GL_DECAL */ + 1456, /* GL_TEXTURE_ENV_MODE */ + 1455, /* GL_TEXTURE_ENV_COLOR */ + 1454, /* GL_TEXTURE_ENV */ + 385, /* GL_EYE_LINEAR */ + 884, /* GL_OBJECT_LINEAR */ + 1264, /* GL_SPHERE_MAP */ + 1458, /* GL_TEXTURE_GEN_MODE */ + 886, /* GL_OBJECT_PLANE */ + 386, /* GL_EYE_PLANE */ + 852, /* GL_NEAREST */ + 555, /* GL_LINEAR */ + 856, /* GL_NEAREST_MIPMAP_NEAREST */ + 560, /* GL_LINEAR_MIPMAP_NEAREST */ + 855, /* GL_NEAREST_MIPMAP_LINEAR */ + 559, /* GL_LINEAR_MIPMAP_LINEAR */ + 1479, /* GL_TEXTURE_MAG_FILTER */ + 1487, /* GL_TEXTURE_MIN_FILTER */ + 1500, /* GL_TEXTURE_WRAP_S */ + 1501, /* GL_TEXTURE_WRAP_T */ + 107, /* GL_CLAMP */ + 1146, /* GL_REPEAT */ + 1010, /* GL_POLYGON_OFFSET_UNITS */ + 1009, /* GL_POLYGON_OFFSET_POINT */ + 1008, /* GL_POLYGON_OFFSET_LINE */ + 1122, /* GL_R3_G3_B2 */ + 1548, /* GL_V2F */ + 1549, /* GL_V3F */ + 104, /* GL_C4UB_V2F */ + 105, /* GL_C4UB_V3F */ + 102, /* GL_C3F_V3F */ + 849, /* GL_N3F_V3F */ + 103, /* GL_C4F_N3F_V3F */ + 1320, /* GL_T2F_V3F */ + 1322, /* GL_T4F_V4F */ + 1318, /* GL_T2F_C4UB_V3F */ + 1316, /* GL_T2F_C3F_V3F */ + 1319, /* GL_T2F_N3F_V3F */ + 1317, /* GL_T2F_C4F_N3F_V3F */ + 1321, /* GL_T4F_C4F_N3F_V4F */ + 120, /* GL_CLIP_PLANE0 */ + 121, /* GL_CLIP_PLANE1 */ + 122, /* GL_CLIP_PLANE2 */ + 123, /* GL_CLIP_PLANE3 */ + 124, /* GL_CLIP_PLANE4 */ + 125, /* GL_CLIP_PLANE5 */ + 539, /* GL_LIGHT0 */ + 540, /* GL_LIGHT1 */ + 541, /* GL_LIGHT2 */ + 542, /* GL_LIGHT3 */ + 543, /* GL_LIGHT4 */ + 544, /* GL_LIGHT5 */ + 545, /* GL_LIGHT6 */ + 546, /* GL_LIGHT7 */ + 472, /* GL_HINT_BIT */ + 225, /* GL_CONSTANT_COLOR */ + 896, /* GL_ONE_MINUS_CONSTANT_COLOR */ + 220, /* GL_CONSTANT_ALPHA */ + 894, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + 71, /* GL_BLEND_COLOR */ + 456, /* GL_FUNC_ADD */ + 785, /* GL_MIN */ + 707, /* GL_MAX */ + 76, /* GL_BLEND_EQUATION */ + 460, /* GL_FUNC_SUBTRACT */ + 458, /* GL_FUNC_REVERSE_SUBTRACT */ + 228, /* GL_CONVOLUTION_1D */ + 229, /* GL_CONVOLUTION_2D */ + 1225, /* GL_SEPARABLE_2D */ + 232, /* GL_CONVOLUTION_BORDER_MODE */ + 236, /* GL_CONVOLUTION_FILTER_SCALE */ + 234, /* GL_CONVOLUTION_FILTER_BIAS */ + 1130, /* GL_REDUCE */ + 238, /* GL_CONVOLUTION_FORMAT */ + 242, /* GL_CONVOLUTION_WIDTH */ + 240, /* GL_CONVOLUTION_HEIGHT */ + 720, /* GL_MAX_CONVOLUTION_WIDTH */ + 718, /* GL_MAX_CONVOLUTION_HEIGHT */ + 1049, /* GL_POST_CONVOLUTION_RED_SCALE */ + 1045, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + 1040, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + 1036, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + 1047, /* GL_POST_CONVOLUTION_RED_BIAS */ + 1043, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + 1038, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + 1034, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + 473, /* GL_HISTOGRAM */ + 1096, /* GL_PROXY_HISTOGRAM */ + 489, /* GL_HISTOGRAM_WIDTH */ + 479, /* GL_HISTOGRAM_FORMAT */ + 485, /* GL_HISTOGRAM_RED_SIZE */ + 481, /* GL_HISTOGRAM_GREEN_SIZE */ + 476, /* GL_HISTOGRAM_BLUE_SIZE */ + 474, /* GL_HISTOGRAM_ALPHA_SIZE */ + 483, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + 487, /* GL_HISTOGRAM_SINK */ + 786, /* GL_MINMAX */ + 788, /* GL_MINMAX_FORMAT */ + 790, /* GL_MINMAX_SINK */ + 1323, /* GL_TABLE_TOO_LARGE_EXT */ + 1530, /* GL_UNSIGNED_BYTE_3_3_2 */ + 1539, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + 1541, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + 1535, /* GL_UNSIGNED_INT_8_8_8_8 */ + 1532, /* GL_UNSIGNED_INT_10_10_10_2 */ + 1007, /* GL_POLYGON_OFFSET_FILL */ + 1006, /* GL_POLYGON_OFFSET_FACTOR */ + 1005, /* GL_POLYGON_OFFSET_BIAS */ + 1150, /* GL_RESCALE_NORMAL */ + 32, /* GL_ALPHA4 */ + 34, /* GL_ALPHA8 */ + 28, /* GL_ALPHA12 */ + 30, /* GL_ALPHA16 */ + 593, /* GL_LUMINANCE4 */ + 599, /* GL_LUMINANCE8 */ + 583, /* GL_LUMINANCE12 */ + 589, /* GL_LUMINANCE16 */ + 594, /* GL_LUMINANCE4_ALPHA4 */ + 597, /* GL_LUMINANCE6_ALPHA2 */ + 600, /* GL_LUMINANCE8_ALPHA8 */ + 586, /* GL_LUMINANCE12_ALPHA4 */ + 584, /* GL_LUMINANCE12_ALPHA12 */ + 590, /* GL_LUMINANCE16_ALPHA16 */ + 512, /* GL_INTENSITY */ + 517, /* GL_INTENSITY4 */ + 519, /* GL_INTENSITY8 */ + 513, /* GL_INTENSITY12 */ + 515, /* GL_INTENSITY16 */ + 1162, /* GL_RGB2_EXT */ + 1163, /* GL_RGB4 */ + 1166, /* GL_RGB5 */ + 1170, /* GL_RGB8 */ + 1154, /* GL_RGB10 */ + 1158, /* GL_RGB12 */ + 1160, /* GL_RGB16 */ + 1177, /* GL_RGBA2 */ + 1179, /* GL_RGBA4 */ + 1167, /* GL_RGB5_A1 */ + 1183, /* GL_RGBA8 */ + 1155, /* GL_RGB10_A2 */ + 1173, /* GL_RGBA12 */ + 1175, /* GL_RGBA16 */ + 1492, /* GL_TEXTURE_RED_SIZE */ + 1464, /* GL_TEXTURE_GREEN_SIZE */ + 1403, /* GL_TEXTURE_BLUE_SIZE */ + 1392, /* GL_TEXTURE_ALPHA_SIZE */ + 1477, /* GL_TEXTURE_LUMINANCE_SIZE */ + 1468, /* GL_TEXTURE_INTENSITY_SIZE */ + 1148, /* GL_REPLACE_EXT */ + 1100, /* GL_PROXY_TEXTURE_1D */ + 1102, /* GL_PROXY_TEXTURE_2D */ + 1496, /* GL_TEXTURE_TOO_LARGE_EXT */ + 1489, /* GL_TEXTURE_PRIORITY */ + 1494, /* GL_TEXTURE_RESIDENT */ + 1395, /* GL_TEXTURE_BINDING_1D */ + 1396, /* GL_TEXTURE_BINDING_2D */ + 1397, /* GL_TEXTURE_BINDING_3D */ + 932, /* GL_PACK_SKIP_IMAGES */ + 928, /* GL_PACK_IMAGE_HEIGHT */ + 1524, /* GL_UNPACK_SKIP_IMAGES */ + 1521, /* GL_UNPACK_IMAGE_HEIGHT */ + 1391, /* GL_TEXTURE_3D */ + 1104, /* GL_PROXY_TEXTURE_3D */ + 1451, /* GL_TEXTURE_DEPTH */ + 1499, /* GL_TEXTURE_WRAP_R */ + 708, /* GL_MAX_3D_TEXTURE_SIZE */ + 1552, /* GL_VERTEX_ARRAY */ + 863, /* GL_NORMAL_ARRAY */ + 129, /* GL_COLOR_ARRAY */ + 498, /* GL_INDEX_ARRAY */ + 1430, /* GL_TEXTURE_COORD_ARRAY */ + 368, /* GL_EDGE_FLAG_ARRAY */ + 1556, /* GL_VERTEX_ARRAY_SIZE */ + 1558, /* GL_VERTEX_ARRAY_TYPE */ + 1557, /* GL_VERTEX_ARRAY_STRIDE */ + 868, /* GL_NORMAL_ARRAY_TYPE */ + 867, /* GL_NORMAL_ARRAY_STRIDE */ + 133, /* GL_COLOR_ARRAY_SIZE */ + 135, /* GL_COLOR_ARRAY_TYPE */ + 134, /* GL_COLOR_ARRAY_STRIDE */ + 503, /* GL_INDEX_ARRAY_TYPE */ + 502, /* GL_INDEX_ARRAY_STRIDE */ + 1434, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + 1436, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + 1435, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + 372, /* GL_EDGE_FLAG_ARRAY_STRIDE */ + 1555, /* GL_VERTEX_ARRAY_POINTER */ + 866, /* GL_NORMAL_ARRAY_POINTER */ + 132, /* GL_COLOR_ARRAY_POINTER */ + 501, /* GL_INDEX_ARRAY_POINTER */ + 1433, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + 371, /* GL_EDGE_FLAG_ARRAY_POINTER */ + 842, /* GL_MULTISAMPLE */ + 1199, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + 1201, /* GL_SAMPLE_ALPHA_TO_ONE */ + 1206, /* GL_SAMPLE_COVERAGE */ + 1203, /* GL_SAMPLE_BUFFERS */ + 1194, /* GL_SAMPLES */ + 1210, /* GL_SAMPLE_COVERAGE_VALUE */ + 1208, /* GL_SAMPLE_COVERAGE_INVERT */ + 160, /* GL_COLOR_MATRIX */ + 162, /* GL_COLOR_MATRIX_STACK_DEPTH */ + 715, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + 1032, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + 1028, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + 1023, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + 1019, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + 1030, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + 1026, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + 1021, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + 1017, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + 1413, /* GL_TEXTURE_COLOR_TABLE_SGI */ + 1105, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + 1415, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + 75, /* GL_BLEND_DST_RGB */ + 82, /* GL_BLEND_SRC_RGB */ + 74, /* GL_BLEND_DST_ALPHA */ + 81, /* GL_BLEND_SRC_ALPHA */ + 166, /* GL_COLOR_TABLE */ + 1042, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + 1025, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + 1095, /* GL_PROXY_COLOR_TABLE */ + 1099, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + 1098, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + 182, /* GL_COLOR_TABLE_SCALE */ + 169, /* GL_COLOR_TABLE_BIAS */ + 172, /* GL_COLOR_TABLE_FORMAT */ + 183, /* GL_COLOR_TABLE_WIDTH */ + 180, /* GL_COLOR_TABLE_RED_SIZE */ + 174, /* GL_COLOR_TABLE_GREEN_SIZE */ + 170, /* GL_COLOR_TABLE_BLUE_SIZE */ + 167, /* GL_COLOR_TABLE_ALPHA_SIZE */ + 178, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ + 176, /* GL_COLOR_TABLE_INTENSITY_SIZE */ + 66, /* GL_BGR */ + 67, /* GL_BGRA */ + 727, /* GL_MAX_ELEMENTS_VERTICES */ + 726, /* GL_MAX_ELEMENTS_INDICES */ + 1467, /* GL_TEXTURE_INDEX_SIZE_EXT */ + 126, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ + 990, /* GL_POINT_SIZE_MIN */ + 986, /* GL_POINT_SIZE_MAX */ + 980, /* GL_POINT_FADE_THRESHOLD_SIZE */ + 976, /* GL_POINT_DISTANCE_ATTENUATION */ + 108, /* GL_CLAMP_TO_BORDER */ + 111, /* GL_CLAMP_TO_EDGE */ + 1488, /* GL_TEXTURE_MIN_LOD */ + 1486, /* GL_TEXTURE_MAX_LOD */ + 1394, /* GL_TEXTURE_BASE_LEVEL */ + 1485, /* GL_TEXTURE_MAX_LEVEL */ + 492, /* GL_IGNORE_BORDER_HP */ + 224, /* GL_CONSTANT_BORDER_HP */ + 1149, /* GL_REPLICATE_BORDER_HP */ + 230, /* GL_CONVOLUTION_BORDER_COLOR */ + 891, /* GL_OCCLUSION_TEST_HP */ + 892, /* GL_OCCLUSION_TEST_RESULT_HP */ + 557, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + 1407, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + 1409, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + 1411, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + 1412, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1410, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + 1408, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + 711, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + 712, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1052, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + 1054, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + 1051, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + 1053, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + 1475, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + 1476, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + 1474, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + 462, /* GL_GENERATE_MIPMAP */ + 463, /* GL_GENERATE_MIPMAP_HINT */ + 428, /* GL_FOG_OFFSET_SGIX */ + 429, /* GL_FOG_OFFSET_VALUE_SGIX */ + 1421, /* GL_TEXTURE_COMPARE_SGIX */ + 1420, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + 1471, /* GL_TEXTURE_LEQUAL_R_SGIX */ + 1463, /* GL_TEXTURE_GEQUAL_R_SGIX */ + 294, /* GL_DEPTH_COMPONENT16 */ + 297, /* GL_DEPTH_COMPONENT24 */ + 300, /* GL_DEPTH_COMPONENT32 */ + 251, /* GL_CULL_VERTEX_EXT */ + 253, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ + 252, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ + 1603, /* GL_WRAP_BORDER_SUN */ + 1414, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + 550, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + 1235, /* GL_SINGLE_COLOR */ + 1226, /* GL_SEPARATE_SPECULAR_COLOR */ + 1232, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + 1529, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + 1542, /* GL_UNSIGNED_SHORT_5_6_5 */ + 1543, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + 1540, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + 1538, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + 1536, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + 1534, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + 1483, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + 1484, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + 1482, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + 793, /* GL_MIRRORED_REPEAT */ + 1188, /* GL_RGB_S3TC */ + 1165, /* GL_RGB4_S3TC */ + 1187, /* GL_RGBA_S3TC */ + 1182, /* GL_RGBA4_S3TC */ + 1185, /* GL_RGBA_DXT5_S3TC */ + 1180, /* GL_RGBA4_DXT5_S3TC */ + 217, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ + 212, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ + 213, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ + 214, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ + 854, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + 853, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + 558, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + 415, /* GL_FOG_COORDINATE_SOURCE */ + 407, /* GL_FOG_COORD */ + 431, /* GL_FRAGMENT_DEPTH */ + 257, /* GL_CURRENT_FOG_COORD */ + 414, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + 413, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + 412, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + 409, /* GL_FOG_COORDINATE_ARRAY */ + 164, /* GL_COLOR_SUM */ + 275, /* GL_CURRENT_SECONDARY_COLOR */ + 1219, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + 1221, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + 1220, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + 1218, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + 1215, /* GL_SECONDARY_COLOR_ARRAY */ + 24, /* GL_ALIASED_POINT_SIZE_RANGE */ + 23, /* GL_ALIASED_LINE_WIDTH_RANGE */ + 1325, /* GL_TEXTURE0 */ + 1327, /* GL_TEXTURE1 */ + 1349, /* GL_TEXTURE2 */ + 1371, /* GL_TEXTURE3 */ + 1377, /* GL_TEXTURE4 */ + 1379, /* GL_TEXTURE5 */ + 1381, /* GL_TEXTURE6 */ + 1383, /* GL_TEXTURE7 */ + 1385, /* GL_TEXTURE8 */ + 1387, /* GL_TEXTURE9 */ + 1328, /* GL_TEXTURE10 */ + 1330, /* GL_TEXTURE11 */ + 1332, /* GL_TEXTURE12 */ + 1334, /* GL_TEXTURE13 */ + 1336, /* GL_TEXTURE14 */ + 1338, /* GL_TEXTURE15 */ + 1340, /* GL_TEXTURE16 */ + 1342, /* GL_TEXTURE17 */ + 1344, /* GL_TEXTURE18 */ + 1346, /* GL_TEXTURE19 */ + 1350, /* GL_TEXTURE20 */ + 1352, /* GL_TEXTURE21 */ + 1354, /* GL_TEXTURE22 */ + 1356, /* GL_TEXTURE23 */ + 1358, /* GL_TEXTURE24 */ + 1360, /* GL_TEXTURE25 */ + 1362, /* GL_TEXTURE26 */ + 1364, /* GL_TEXTURE27 */ + 1366, /* GL_TEXTURE28 */ + 1368, /* GL_TEXTURE29 */ + 1372, /* GL_TEXTURE30 */ + 1374, /* GL_TEXTURE31 */ + 16, /* GL_ACTIVE_TEXTURE */ + 114, /* GL_CLIENT_ACTIVE_TEXTURE */ + 775, /* GL_MAX_TEXTURE_UNITS */ + 1508, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + 1511, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + 1513, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + 1505, /* GL_TRANSPOSE_COLOR_MATRIX */ + 1313, /* GL_SUBTRACT */ + 766, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ + 200, /* GL_COMPRESSED_ALPHA */ + 204, /* GL_COMPRESSED_LUMINANCE */ + 205, /* GL_COMPRESSED_LUMINANCE_ALPHA */ + 202, /* GL_COMPRESSED_INTENSITY */ + 208, /* GL_COMPRESSED_RGB */ + 209, /* GL_COMPRESSED_RGBA */ + 1428, /* GL_TEXTURE_COMPRESSION_HINT */ + 1490, /* GL_TEXTURE_RECTANGLE_ARB */ + 1400, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + 1108, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + 764, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + 306, /* GL_DEPTH_STENCIL_NV */ + 1533, /* GL_UNSIGNED_INT_24_8_NV */ + 771, /* GL_MAX_TEXTURE_LOD_BIAS */ + 1481, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + 772, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + 1457, /* GL_TEXTURE_FILTER_CONTROL */ + 1472, /* GL_TEXTURE_LOD_BIAS */ + 187, /* GL_COMBINE4 */ + 767, /* GL_MAX_SHININESS_NV */ + 768, /* GL_MAX_SPOT_EXPONENT_NV */ + 496, /* GL_INCR_WRAP */ + 282, /* GL_DECR_WRAP */ + 813, /* GL_MODELVIEW1_ARB */ + 869, /* GL_NORMAL_MAP */ + 1135, /* GL_REFLECTION_MAP */ + 1437, /* GL_TEXTURE_CUBE_MAP */ + 1398, /* GL_TEXTURE_BINDING_CUBE_MAP */ + 1445, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + 1439, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + 1447, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + 1441, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + 1449, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + 1443, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + 1106, /* GL_PROXY_TEXTURE_CUBE_MAP */ + 722, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + 848, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + 423, /* GL_FOG_DISTANCE_MODE_NV */ + 388, /* GL_EYE_RADIAL_NV */ + 387, /* GL_EYE_PLANE_ABSOLUTE_NV */ + 186, /* GL_COMBINE */ + 193, /* GL_COMBINE_RGB */ + 188, /* GL_COMBINE_ALPHA */ + 1189, /* GL_RGB_SCALE */ + 20, /* GL_ADD_SIGNED */ + 522, /* GL_INTERPOLATE */ + 219, /* GL_CONSTANT */ + 1058, /* GL_PRIMARY_COLOR */ + 1055, /* GL_PREVIOUS */ + 1246, /* GL_SOURCE0_RGB */ + 1252, /* GL_SOURCE1_RGB */ + 1258, /* GL_SOURCE2_RGB */ + 1262, /* GL_SOURCE3_RGB_NV */ + 1243, /* GL_SOURCE0_ALPHA */ + 1249, /* GL_SOURCE1_ALPHA */ + 1255, /* GL_SOURCE2_ALPHA */ + 1261, /* GL_SOURCE3_ALPHA_NV */ + 905, /* GL_OPERAND0_RGB */ + 911, /* GL_OPERAND1_RGB */ + 917, /* GL_OPERAND2_RGB */ + 921, /* GL_OPERAND3_RGB_NV */ + 902, /* GL_OPERAND0_ALPHA */ + 908, /* GL_OPERAND1_ALPHA */ + 914, /* GL_OPERAND2_ALPHA */ + 920, /* GL_OPERAND3_ALPHA_NV */ + 1607, /* GL_YCBCR_422_APPLE */ + 1544, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + 1546, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + 1237, /* GL_SLICE_ACCUM_SUN */ + 1113, /* GL_QUAD_MESH_SUN */ + 1517, /* GL_TRIANGLE_MESH_SUN */ + 1584, /* GL_VERTEX_PROGRAM_ARB */ + 1592, /* GL_VERTEX_STATE_PROGRAM_NV */ + 1577, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ + 1580, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ + 1581, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ + 1582, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ + 277, /* GL_CURRENT_VERTEX_ATTRIB_ARB */ + 1071, /* GL_PROGRAM_LENGTH_ARB */ + 1085, /* GL_PROGRAM_STRING_ARB */ + 835, /* GL_MODELVIEW_PROJECTION_NV */ + 491, /* GL_IDENTITY_NV */ + 532, /* GL_INVERSE_NV */ + 1510, /* GL_TRANSPOSE_NV */ + 533, /* GL_INVERSE_TRANSPOSE_NV */ + 750, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + 749, /* GL_MAX_PROGRAM_MATRICES_ARB */ + 661, /* GL_MATRIX0_NV */ + 673, /* GL_MATRIX1_NV */ + 685, /* GL_MATRIX2_NV */ + 689, /* GL_MATRIX3_NV */ + 691, /* GL_MATRIX4_NV */ + 693, /* GL_MATRIX5_NV */ + 695, /* GL_MATRIX6_NV */ + 697, /* GL_MATRIX7_NV */ + 263, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ + 260, /* GL_CURRENT_MATRIX_ARB */ + 1587, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ + 1589, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ + 1083, /* GL_PROGRAM_PARAMETER_NV */ + 1579, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ + 1087, /* GL_PROGRAM_TARGET_NV */ + 1084, /* GL_PROGRAM_RESIDENT_NV */ + 1502, /* GL_TRACK_MATRIX_NV */ + 1503, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + 1585, /* GL_VERTEX_PROGRAM_BINDING_NV */ + 1065, /* GL_PROGRAM_ERROR_POSITION_ARB */ + 291, /* GL_DEPTH_CLAMP_NV */ + 1559, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + 1566, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + 1567, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + 1568, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + 1569, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + 1570, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + 1571, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + 1572, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + 1573, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + 1574, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + 1560, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + 1561, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + 1562, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + 1563, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + 1564, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + 1565, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + 615, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + 622, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + 623, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + 624, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + 625, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + 626, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + 627, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + 628, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + 629, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + 630, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + 616, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + 617, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + 618, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + 619, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + 620, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + 621, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + 642, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + 649, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + 650, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + 651, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + 652, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + 653, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + 654, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + 1064, /* GL_PROGRAM_BINDING_ARB */ + 656, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + 657, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + 643, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + 644, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + 645, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + 646, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + 647, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + 648, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + 1426, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + 1423, /* GL_TEXTURE_COMPRESSED */ + 874, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + 218, /* GL_COMPRESSED_TEXTURE_FORMATS */ + 783, /* GL_MAX_VERTEX_UNITS_ARB */ + 18, /* GL_ACTIVE_VERTEX_UNITS_ARB */ + 1602, /* GL_WEIGHT_SUM_UNITY_ARB */ + 1583, /* GL_VERTEX_BLEND_ARB */ + 278, /* GL_CURRENT_WEIGHT_ARB */ + 1601, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + 1600, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + 1599, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + 1598, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + 1595, /* GL_WEIGHT_ARRAY_ARB */ + 317, /* GL_DOT3_RGB */ + 318, /* GL_DOT3_RGBA */ + 216, /* GL_COMPRESSED_RGB_FXT1_3DFX */ + 211, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ + 843, /* GL_MULTISAMPLE_3DFX */ + 1204, /* GL_SAMPLE_BUFFERS_3DFX */ + 1195, /* GL_SAMPLES_3DFX */ + 824, /* GL_MODELVIEW2_ARB */ + 827, /* GL_MODELVIEW3_ARB */ + 828, /* GL_MODELVIEW4_ARB */ + 829, /* GL_MODELVIEW5_ARB */ + 830, /* GL_MODELVIEW6_ARB */ + 831, /* GL_MODELVIEW7_ARB */ + 832, /* GL_MODELVIEW8_ARB */ + 833, /* GL_MODELVIEW9_ARB */ + 803, /* GL_MODELVIEW10_ARB */ + 804, /* GL_MODELVIEW11_ARB */ + 805, /* GL_MODELVIEW12_ARB */ + 806, /* GL_MODELVIEW13_ARB */ + 807, /* GL_MODELVIEW14_ARB */ + 808, /* GL_MODELVIEW15_ARB */ + 809, /* GL_MODELVIEW16_ARB */ + 810, /* GL_MODELVIEW17_ARB */ + 811, /* GL_MODELVIEW18_ARB */ + 812, /* GL_MODELVIEW19_ARB */ + 814, /* GL_MODELVIEW20_ARB */ + 815, /* GL_MODELVIEW21_ARB */ + 816, /* GL_MODELVIEW22_ARB */ + 817, /* GL_MODELVIEW23_ARB */ + 818, /* GL_MODELVIEW24_ARB */ + 819, /* GL_MODELVIEW25_ARB */ + 820, /* GL_MODELVIEW26_ARB */ + 821, /* GL_MODELVIEW27_ARB */ + 822, /* GL_MODELVIEW28_ARB */ + 823, /* GL_MODELVIEW29_ARB */ + 825, /* GL_MODELVIEW30_ARB */ + 826, /* GL_MODELVIEW31_ARB */ + 322, /* GL_DOT3_RGB_EXT */ + 320, /* GL_DOT3_RGBA_EXT */ + 797, /* GL_MIRROR_CLAMP_EXT */ + 800, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + 838, /* GL_MODULATE_ADD_ATI */ + 839, /* GL_MODULATE_SIGNED_ADD_ATI */ + 840, /* GL_MODULATE_SUBTRACT_ATI */ + 1608, /* GL_YCBCR_MESA */ + 929, /* GL_PACK_INVERT_MESA */ + 97, /* GL_BUFFER_SIZE */ + 99, /* GL_BUFFER_USAGE */ + 432, /* GL_FRAGMENT_PROGRAM_ARB */ + 1062, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 1090, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 1089, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + 1074, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 1080, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 1079, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 739, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 762, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 761, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + 752, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 758, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 757, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 724, /* GL_MAX_DRAW_BUFFERS_ARB */ + 326, /* GL_DRAW_BUFFER0_ARB */ + 340, /* GL_DRAW_BUFFER1_ARB */ + 342, /* GL_DRAW_BUFFER2_ARB */ + 344, /* GL_DRAW_BUFFER3_ARB */ + 346, /* GL_DRAW_BUFFER4_ARB */ + 348, /* GL_DRAW_BUFFER5_ARB */ + 350, /* GL_DRAW_BUFFER6_ARB */ + 352, /* GL_DRAW_BUFFER7_ARB */ + 354, /* GL_DRAW_BUFFER8_ARB */ + 356, /* GL_DRAW_BUFFER9_ARB */ + 328, /* GL_DRAW_BUFFER10_ARB */ + 330, /* GL_DRAW_BUFFER11_ARB */ + 332, /* GL_DRAW_BUFFER12_ARB */ + 334, /* GL_DRAW_BUFFER13_ARB */ + 336, /* GL_DRAW_BUFFER14_ARB */ + 338, /* GL_DRAW_BUFFER15_ARB */ + 77, /* GL_BLEND_EQUATION_ALPHA_EXT */ + 706, /* GL_MATRIX_PALETTE_ARB */ + 733, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + 736, /* GL_MAX_PALETTE_MATRICES_ARB */ + 266, /* GL_CURRENT_PALETTE_MATRIX_ARB */ + 700, /* GL_MATRIX_INDEX_ARRAY_ARB */ + 261, /* GL_CURRENT_MATRIX_INDEX_ARB */ + 702, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + 704, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + 703, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + 701, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + 1452, /* GL_TEXTURE_DEPTH_SIZE */ + 310, /* GL_DEPTH_TEXTURE_MODE */ + 1418, /* GL_TEXTURE_COMPARE_MODE */ + 1416, /* GL_TEXTURE_COMPARE_FUNC */ + 196, /* GL_COMPARE_R_TO_TEXTURE */ + 997, /* GL_POINT_SPRITE_ARB */ + 244, /* GL_COORD_REPLACE_ARB */ + 1000, /* GL_POINT_SPRITE_R_MODE_NV */ + 1115, /* GL_QUERY_COUNTER_BITS */ + 267, /* GL_CURRENT_QUERY */ + 1117, /* GL_QUERY_RESULT */ + 1119, /* GL_QUERY_RESULT_AVAILABLE */ + 780, /* GL_MAX_VERTEX_ATTRIBS_ARB */ + 1578, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ + 308, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ + 307, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ + 769, /* GL_MAX_TEXTURE_COORDS_ARB */ + 770, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ + 1067, /* GL_PROGRAM_ERROR_STRING_ARB */ + 1069, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + 1068, /* GL_PROGRAM_FORMAT_ARB */ + 1497, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + 289, /* GL_DEPTH_BOUNDS_TEST_EXT */ + 288, /* GL_DEPTH_BOUNDS_EXT */ + 48, /* GL_ARRAY_BUFFER */ + 373, /* GL_ELEMENT_ARRAY_BUFFER */ + 50, /* GL_ARRAY_BUFFER_BINDING */ + 375, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ + 1553, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + 864, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + 130, /* GL_COLOR_ARRAY_BUFFER_BINDING */ + 499, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + 1431, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + 369, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ + 1216, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + 410, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + 1596, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + 1575, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + 1070, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + 745, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + 1076, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 754, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 1088, /* GL_PROGRAM_TEMPORARIES_ARB */ + 760, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + 1078, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 756, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 1082, /* GL_PROGRAM_PARAMETERS_ARB */ + 759, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + 1077, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + 755, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + 1063, /* GL_PROGRAM_ATTRIBS_ARB */ + 740, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + 1075, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + 753, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + 1061, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + 738, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + 1073, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 751, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 746, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + 742, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + 1091, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + 1507, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + 1125, /* GL_READ_ONLY */ + 1604, /* GL_WRITE_ONLY */ + 1127, /* GL_READ_WRITE */ + 91, /* GL_BUFFER_ACCESS */ + 93, /* GL_BUFFER_MAPPED */ + 95, /* GL_BUFFER_MAP_POINTER */ + 660, /* GL_MATRIX0_ARB */ + 672, /* GL_MATRIX1_ARB */ + 684, /* GL_MATRIX2_ARB */ + 688, /* GL_MATRIX3_ARB */ + 690, /* GL_MATRIX4_ARB */ + 692, /* GL_MATRIX5_ARB */ + 694, /* GL_MATRIX6_ARB */ + 696, /* GL_MATRIX7_ARB */ + 698, /* GL_MATRIX8_ARB */ + 699, /* GL_MATRIX9_ARB */ + 662, /* GL_MATRIX10_ARB */ + 663, /* GL_MATRIX11_ARB */ + 664, /* GL_MATRIX12_ARB */ + 665, /* GL_MATRIX13_ARB */ + 666, /* GL_MATRIX14_ARB */ + 667, /* GL_MATRIX15_ARB */ + 668, /* GL_MATRIX16_ARB */ + 669, /* GL_MATRIX17_ARB */ + 670, /* GL_MATRIX18_ARB */ + 671, /* GL_MATRIX19_ARB */ + 674, /* GL_MATRIX20_ARB */ + 675, /* GL_MATRIX21_ARB */ + 676, /* GL_MATRIX22_ARB */ + 677, /* GL_MATRIX23_ARB */ + 678, /* GL_MATRIX24_ARB */ + 679, /* GL_MATRIX25_ARB */ + 680, /* GL_MATRIX26_ARB */ + 681, /* GL_MATRIX27_ARB */ + 682, /* GL_MATRIX28_ARB */ + 683, /* GL_MATRIX29_ARB */ + 686, /* GL_MATRIX30_ARB */ + 687, /* GL_MATRIX31_ARB */ + 1308, /* GL_STREAM_DRAW */ + 1310, /* GL_STREAM_READ */ + 1306, /* GL_STREAM_COPY */ + 1281, /* GL_STATIC_DRAW */ + 1283, /* GL_STATIC_READ */ + 1279, /* GL_STATIC_COPY */ + 363, /* GL_DYNAMIC_DRAW */ + 365, /* GL_DYNAMIC_READ */ + 361, /* GL_DYNAMIC_COPY */ + 970, /* GL_PIXEL_PACK_BUFFER_EXT */ + 972, /* GL_PIXEL_UNPACK_BUFFER_EXT */ + 969, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ + 971, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ + 743, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ + 741, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + 744, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + 748, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + 747, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + 1302, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + 15, /* GL_ACTIVE_STENCIL_FACE_EXT */ + 798, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + 1197, /* GL_SAMPLES_PASSED */ + 433, /* GL_FRAGMENT_SHADER_ARB */ + 1591, /* GL_VERTEX_SHADER_ARB */ + 1081, /* GL_PROGRAM_OBJECT_ARB */ + 1229, /* GL_SHADER_OBJECT_ARB */ + 730, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ + 782, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ + 779, /* GL_MAX_VARYING_FLOATS_ARB */ + 781, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ + 717, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ + 889, /* GL_OBJECT_TYPE_ARB */ + 888, /* GL_OBJECT_SUBTYPE_ARB */ + 401, /* GL_FLOAT_VEC2_ARB */ + 402, /* GL_FLOAT_VEC3_ARB */ + 403, /* GL_FLOAT_VEC4_ARB */ + 525, /* GL_INT_VEC2_ARB */ + 526, /* GL_INT_VEC3_ARB */ + 527, /* GL_INT_VEC4_ARB */ + 87, /* GL_BOOL_ARB */ + 88, /* GL_BOOL_VEC2_ARB */ + 89, /* GL_BOOL_VEC3_ARB */ + 90, /* GL_BOOL_VEC4_ARB */ + 398, /* GL_FLOAT_MAT2_ARB */ + 399, /* GL_FLOAT_MAT3_ARB */ + 400, /* GL_FLOAT_MAT4_ARB */ + 882, /* GL_OBJECT_DELETE_STATUS_ARB */ + 881, /* GL_OBJECT_COMPILE_STATUS_ARB */ + 885, /* GL_OBJECT_LINK_STATUS_ARB */ + 890, /* GL_OBJECT_VALIDATE_STATUS_ARB */ + 883, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ + 880, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ + 878, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ + 879, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ + 887, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ + 876, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ + 877, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ + 938, /* GL_PALETTE4_RGB8_OES */ + 940, /* GL_PALETTE4_RGBA8_OES */ + 936, /* GL_PALETTE4_R5_G6_B5_OES */ + 939, /* GL_PALETTE4_RGBA4_OES */ + 937, /* GL_PALETTE4_RGB5_A1_OES */ + 943, /* GL_PALETTE8_RGB8_OES */ + 945, /* GL_PALETTE8_RGBA8_OES */ + 941, /* GL_PALETTE8_R5_G6_B5_OES */ + 944, /* GL_PALETTE8_RGBA4_OES */ + 942, /* GL_PALETTE8_RGB5_A1_OES */ + 494, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + 493, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + 998, /* GL_POINT_SPRITE_COORD_ORIGIN */ + 439, /* GL_FRAMEBUFFER_BINDING_EXT */ + 1139, /* GL_RENDERBUFFER_BINDING_EXT */ + 435, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ + 434, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ + 438, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ + 437, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ + 436, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ + 440, /* GL_FRAMEBUFFER_COMPLETE_EXT */ + 442, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ + 447, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ + 445, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + 443, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + 446, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + 444, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ + 448, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ + 450, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ + 449, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + 714, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ + 136, /* GL_COLOR_ATTACHMENT0_EXT */ + 143, /* GL_COLOR_ATTACHMENT1_EXT */ + 144, /* GL_COLOR_ATTACHMENT2_EXT */ + 145, /* GL_COLOR_ATTACHMENT3_EXT */ + 146, /* GL_COLOR_ATTACHMENT4_EXT */ + 147, /* GL_COLOR_ATTACHMENT5_EXT */ + 148, /* GL_COLOR_ATTACHMENT6_EXT */ + 149, /* GL_COLOR_ATTACHMENT7_EXT */ + 150, /* GL_COLOR_ATTACHMENT8_EXT */ + 151, /* GL_COLOR_ATTACHMENT9_EXT */ + 137, /* GL_COLOR_ATTACHMENT10_EXT */ + 138, /* GL_COLOR_ATTACHMENT11_EXT */ + 139, /* GL_COLOR_ATTACHMENT12_EXT */ + 140, /* GL_COLOR_ATTACHMENT13_EXT */ + 141, /* GL_COLOR_ATTACHMENT14_EXT */ + 142, /* GL_COLOR_ATTACHMENT15_EXT */ + 285, /* GL_DEPTH_ATTACHMENT_EXT */ + 1286, /* GL_STENCIL_ATTACHMENT_EXT */ + 441, /* GL_FRAMEBUFFER_EXT */ + 1140, /* GL_RENDERBUFFER_EXT */ + 1143, /* GL_RENDERBUFFER_WIDTH_EXT */ + 1141, /* GL_RENDERBUFFER_HEIGHT_EXT */ + 1142, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ + 1297, /* GL_STENCIL_INDEX_EXT */ + 1294, /* GL_STENCIL_INDEX1_EXT */ + 1295, /* GL_STENCIL_INDEX4_EXT */ + 1296, /* GL_STENCIL_INDEX8_EXT */ + 1293, /* GL_STENCIL_INDEX16_EXT */ + 381, /* GL_EVAL_BIT */ + 1123, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + 576, /* GL_LIST_BIT */ + 1402, /* GL_TEXTURE_BIT */ + 1212, /* GL_SCISSOR_BIT */ + 25, /* GL_ALL_ATTRIB_BITS */ + 845, /* GL_MULTISAMPLE_BIT */ +}; + +#define Elements(x) sizeof(x)/sizeof(*x) + +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 _mesa_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 *)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_sprintf(token_tmp, "0x%x", nr); + return token_tmp; + } +} + +int _mesa_lookup_enum_by_name( const char *symbol ) +{ + enum_elt * f = NULL; + + if ( symbol != NULL ) { + f = (enum_elt *)bsearch( symbol, all_enums, Elements(all_enums), + sizeof( enum_elt ), (cfunc) compar_name ); + } + + return (f != NULL) ? f->n : -1; +} + + diff --git a/reactos/dll/mesa32/src/main/enums.h b/reactos/dll/mesa32/src/main/enums.h new file mode 100644 index 00000000000..7e8d4ee94fc --- /dev/null +++ b/reactos/dll/mesa32/src/main/enums.h @@ -0,0 +1,55 @@ +/** + * \file enums.h + * Enumeration name/number lookup functions. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * 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. + */ +/* $XFree86: xc/extras/Mesa/src/mesa/main/enums.h,v 1.2 2004/06/23 19:40:14 tsi Exp $ */ + +#ifndef _ENUMS_H_ +#define _ENUMS_H_ + + +#if defined(_HAVE_FULL_GL) && _HAVE_FULL_GL + +extern const char *_mesa_lookup_enum_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/reactos/dll/mesa32/src/main/eval.c b/reactos/dll/mesa32/src/main/eval.c new file mode 100644 index 00000000000..3f89f9c1eae --- /dev/null +++ b/reactos/dll/mesa32/src/main/eval.c @@ -0,0 +1,962 @@ + +/* + * 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. + */ + + +/* + * eval.c was written by + * Bernd Barsuhn (bdbarsuh@cip.informatik.uni-erlangen.de) and + * Volker Weiss (vrweiss@cip.informatik.uni-erlangen.de). + * + * My original implementation of evaluators was simplistic and didn't + * compute surface normal vectors properly. Bernd and Volker applied + * used more sophisticated methods to get better results. + * + * Thanks guys! + */ + + +#include "glheader.h" +#include "imports.h" +#include "colormac.h" +#include "context.h" +#include "eval.h" +#include "macros.h" +#include "mtypes.h" + + +/* + * Return the number of components per control point for any type of + * evaluator. Return 0 if bad target. + * See table 5.1 in the OpenGL 1.2 spec. + */ +GLuint _mesa_evaluator_components( GLenum target ) +{ + switch (target) { + case GL_MAP1_VERTEX_3: return 3; + case GL_MAP1_VERTEX_4: return 4; + case GL_MAP1_INDEX: return 1; + case GL_MAP1_COLOR_4: return 4; + case GL_MAP1_NORMAL: return 3; + case GL_MAP1_TEXTURE_COORD_1: return 1; + case GL_MAP1_TEXTURE_COORD_2: return 2; + case GL_MAP1_TEXTURE_COORD_3: return 3; + case GL_MAP1_TEXTURE_COORD_4: return 4; + case GL_MAP2_VERTEX_3: return 3; + case GL_MAP2_VERTEX_4: return 4; + case GL_MAP2_INDEX: return 1; + case GL_MAP2_COLOR_4: return 4; + case GL_MAP2_NORMAL: return 3; + case GL_MAP2_TEXTURE_COORD_1: return 1; + case GL_MAP2_TEXTURE_COORD_2: return 2; + case GL_MAP2_TEXTURE_COORD_3: return 3; + case GL_MAP2_TEXTURE_COORD_4: return 4; + default: break; + } + + /* XXX need to check for the vertex program extension + if (!ctx->Extensions.NV_vertex_program) + return 0; + */ + + if (target >= GL_MAP1_VERTEX_ATTRIB0_4_NV && + target <= GL_MAP1_VERTEX_ATTRIB15_4_NV) + return 4; + + if (target >= GL_MAP2_VERTEX_ATTRIB0_4_NV && + target <= GL_MAP2_VERTEX_ATTRIB15_4_NV) + return 4; + + return 0; +} + + +/* + * Return pointer to the gl_1d_map struct for the named target. + */ +static struct gl_1d_map * +get_1d_map( GLcontext *ctx, GLenum target ) +{ + switch (target) { + case GL_MAP1_VERTEX_3: + return &ctx->EvalMap.Map1Vertex3; + case GL_MAP1_VERTEX_4: + return &ctx->EvalMap.Map1Vertex4; + case GL_MAP1_INDEX: + return &ctx->EvalMap.Map1Index; + case GL_MAP1_COLOR_4: + return &ctx->EvalMap.Map1Color4; + case GL_MAP1_NORMAL: + return &ctx->EvalMap.Map1Normal; + case GL_MAP1_TEXTURE_COORD_1: + return &ctx->EvalMap.Map1Texture1; + case GL_MAP1_TEXTURE_COORD_2: + return &ctx->EvalMap.Map1Texture2; + case GL_MAP1_TEXTURE_COORD_3: + return &ctx->EvalMap.Map1Texture3; + case GL_MAP1_TEXTURE_COORD_4: + return &ctx->EvalMap.Map1Texture4; + 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: + if (!ctx->Extensions.NV_vertex_program) + return NULL; + return &ctx->EvalMap.Map1Attrib[target - GL_MAP1_VERTEX_ATTRIB0_4_NV]; + default: + return NULL; + } +} + + +/* + * Return pointer to the gl_2d_map struct for the named target. + */ +static struct gl_2d_map * +get_2d_map( GLcontext *ctx, GLenum target ) +{ + switch (target) { + case GL_MAP2_VERTEX_3: + return &ctx->EvalMap.Map2Vertex3; + case GL_MAP2_VERTEX_4: + return &ctx->EvalMap.Map2Vertex4; + case GL_MAP2_INDEX: + return &ctx->EvalMap.Map2Index; + case GL_MAP2_COLOR_4: + return &ctx->EvalMap.Map2Color4; + case GL_MAP2_NORMAL: + return &ctx->EvalMap.Map2Normal; + case GL_MAP2_TEXTURE_COORD_1: + return &ctx->EvalMap.Map2Texture1; + case GL_MAP2_TEXTURE_COORD_2: + return &ctx->EvalMap.Map2Texture2; + case GL_MAP2_TEXTURE_COORD_3: + return &ctx->EvalMap.Map2Texture3; + case GL_MAP2_TEXTURE_COORD_4: + return &ctx->EvalMap.Map2Texture4; + 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: + if (!ctx->Extensions.NV_vertex_program) + return NULL; + return &ctx->EvalMap.Map2Attrib[target - GL_MAP2_VERTEX_ATTRIB0_4_NV]; + default: + return NULL; + } +} + + +/**********************************************************************/ +/*** Copy and deallocate control points ***/ +/**********************************************************************/ + + +/* + * Copy 1-parametric evaluator control points from user-specified + * memory space to a buffer of contiguous control points. + * \param see glMap1f for details + * \return pointer to buffer of contiguous control points or NULL if out + * of memory. + */ +GLfloat *_mesa_copy_map_points1f( GLenum target, GLint ustride, GLint uorder, + const GLfloat *points ) +{ + GLfloat *buffer, *p; + GLint i, k, size = _mesa_evaluator_components(target); + + if (!points || !size) + return NULL; + + buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat)); + + if (buffer) + for (i = 0, p = buffer; i < uorder; i++, points += ustride) + for (k = 0; k < size; k++) + *p++ = points[k]; + + return buffer; +} + + + +/* + * Same as above but convert doubles to floats. + */ +GLfloat *_mesa_copy_map_points1d( GLenum target, GLint ustride, GLint uorder, + const GLdouble *points ) +{ + GLfloat *buffer, *p; + GLint i, k, size = _mesa_evaluator_components(target); + + if (!points || !size) + return NULL; + + buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat)); + + if (buffer) + for (i = 0, p = buffer; i < uorder; i++, points += ustride) + for (k = 0; k < size; k++) + *p++ = (GLfloat) points[k]; + + return buffer; +} + + + +/* + * Copy 2-parametric evaluator control points from user-specified + * memory space to a buffer of contiguous control points. + * Additional memory is allocated to be used by the horner and + * de Casteljau evaluation schemes. + * + * \param see glMap2f for details + * \return pointer to buffer of contiguous control points or NULL if out + * of memory. + */ +GLfloat *_mesa_copy_map_points2f( GLenum target, + GLint ustride, GLint uorder, + GLint vstride, GLint vorder, + const GLfloat *points ) +{ + GLfloat *buffer, *p; + GLint i, j, k, size, dsize, hsize; + GLint uinc; + + size = _mesa_evaluator_components(target); + + if (!points || size==0) { + return NULL; + } + + /* max(uorder, vorder) additional points are used in */ + /* horner evaluation and uorder*vorder additional */ + /* values are needed for de Casteljau */ + dsize = (uorder == 2 && vorder == 2)? 0 : uorder*vorder; + hsize = (uorder > vorder ? uorder : vorder)*size; + + if(hsize>dsize) + buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat)); + else + buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat)); + + /* compute the increment value for the u-loop */ + uinc = ustride - vorder*vstride; + + if (buffer) + for (i=0, p=buffer; i vorder ? uorder : vorder)*size; + + if(hsize>dsize) + buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat)); + else + buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat)); + + /* compute the increment value for the u-loop */ + uinc = ustride - vorder*vstride; + + if (buffer) + for (i=0, p=buffer; i MAX_EVAL_ORDER) { + _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(order)" ); + return; + } + if (!points) { + _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(points)" ); + return; + } + + k = _mesa_evaluator_components( target ); + if (k == 0) { + _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" ); + } + + if (ustride < k) { + _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(stride)" ); + return; + } + + if (ctx->Texture.CurrentUnit != 0) { + /* See OpenGL 1.2.1 spec, section F.2.13 */ + _mesa_error( ctx, GL_INVALID_OPERATION, "glMap2(ACTIVE_TEXTURE != 0)" ); + return; + } + + map = get_1d_map(ctx, target); + if (!map) { + _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" ); + return; + } + + /* make copy of the control points */ + if (type == GL_FLOAT) + pnts = _mesa_copy_map_points1f(target, ustride, uorder, (GLfloat*) points); + else + pnts = _mesa_copy_map_points1d(target, ustride, uorder, (GLdouble*) points); + + + FLUSH_VERTICES(ctx, _NEW_EVAL); + map->Order = uorder; + map->u1 = u1; + map->u2 = u2; + map->du = 1.0F / (u2 - u1); + if (map->Points) + FREE( map->Points ); + map->Points = pnts; +} + + + +void GLAPIENTRY +_mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, + GLint order, const GLfloat *points ) +{ + map1(target, u1, u2, stride, order, points, GL_FLOAT); +} + + +void GLAPIENTRY +_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, + GLint order, const GLdouble *points ) +{ + map1(target, (GLfloat) u1, (GLfloat) u2, stride, order, points, GL_DOUBLE); +} + + +static void +map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, + GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, + const GLvoid *points, GLenum type ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint k; + GLfloat *pnts; + struct gl_2d_map *map = NULL; + + ASSERT_OUTSIDE_BEGIN_END(ctx); + ASSERT(type == GL_FLOAT || type == GL_DOUBLE); + + if (u1==u2) { + _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" ); + return; + } + + if (v1==v2) { + _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(v1,v2)" ); + return; + } + + if (uorder<1 || uorder>MAX_EVAL_ORDER) { + _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(uorder)" ); + return; + } + + if (vorder<1 || vorder>MAX_EVAL_ORDER) { + _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vorder)" ); + return; + } + + k = _mesa_evaluator_components( target ); + if (k==0) { + _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" ); + } + + if (ustride < k) { + _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(ustride)" ); + return; + } + if (vstride < k) { + _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vstride)" ); + return; + } + + if (ctx->Texture.CurrentUnit != 0) { + /* See OpenGL 1.2.1 spec, section F.2.13 */ + _mesa_error( ctx, GL_INVALID_OPERATION, "glMap2(ACTIVE_TEXTURE != 0)" ); + return; + } + + map = get_2d_map(ctx, target); + if (!map) { + _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" ); + return; + } + + /* make copy of the control points */ + if (type == GL_FLOAT) + pnts = _mesa_copy_map_points2f(target, ustride, uorder, + vstride, vorder, (GLfloat*) points); + else + pnts = _mesa_copy_map_points2d(target, ustride, uorder, + vstride, vorder, (GLdouble*) points); + + + FLUSH_VERTICES(ctx, _NEW_EVAL); + map->Uorder = uorder; + map->u1 = u1; + map->u2 = u2; + map->du = 1.0F / (u2 - u1); + map->Vorder = vorder; + map->v1 = v1; + map->v2 = v2; + map->dv = 1.0F / (v2 - v1); + if (map->Points) + FREE( map->Points ); + map->Points = pnts; +} + + +void GLAPIENTRY +_mesa_Map2f( GLenum target, + GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, + GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, + const GLfloat *points) +{ + map2(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, + points, GL_FLOAT); +} + + +void GLAPIENTRY +_mesa_Map2d( GLenum target, + GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, + GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, + const GLdouble *points ) +{ + map2(target, (GLfloat) u1, (GLfloat) u2, ustride, uorder, + (GLfloat) v1, (GLfloat) v2, vstride, vorder, points, GL_DOUBLE); +} + + + +void GLAPIENTRY +_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_1d_map *map1d; + struct gl_2d_map *map2d; + GLint i, n; + GLfloat *data; + GLuint comps; + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + comps = _mesa_evaluator_components(target); + if (!comps) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" ); + return; + } + + map1d = get_1d_map(ctx, target); + map2d = get_2d_map(ctx, target); + ASSERT(map1d || map2d); + + switch (query) { + case GL_COEFF: + if (map1d) { + data = map1d->Points; + n = map1d->Order * comps; + } + else { + data = map2d->Points; + n = map2d->Uorder * map2d->Vorder * comps; + } + if (data) { + for (i=0;iOrder; + } + else { + v[0] = (GLdouble) map2d->Uorder; + v[1] = (GLdouble) map2d->Vorder; + } + break; + case GL_DOMAIN: + if (map1d) { + v[0] = (GLdouble) map1d->u1; + v[1] = (GLdouble) map1d->u2; + } + else { + v[0] = (GLdouble) map2d->u1; + v[1] = (GLdouble) map2d->u2; + v[2] = (GLdouble) map2d->v1; + v[3] = (GLdouble) map2d->v2; + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(query)" ); + } +} + + +void GLAPIENTRY +_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_1d_map *map1d; + struct gl_2d_map *map2d; + GLint i, n; + GLfloat *data; + GLuint comps; + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + comps = _mesa_evaluator_components(target); + if (!comps) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" ); + return; + } + + map1d = get_1d_map(ctx, target); + map2d = get_2d_map(ctx, target); + ASSERT(map1d || map2d); + + switch (query) { + case GL_COEFF: + if (map1d) { + data = map1d->Points; + n = map1d->Order * comps; + } + else { + data = map2d->Points; + n = map2d->Uorder * map2d->Vorder * comps; + } + if (data) { + for (i=0;iOrder; + } + else { + v[0] = (GLfloat) map2d->Uorder; + v[1] = (GLfloat) map2d->Vorder; + } + break; + case GL_DOMAIN: + if (map1d) { + v[0] = map1d->u1; + v[1] = map1d->u2; + } + else { + v[0] = map2d->u1; + v[1] = map2d->u2; + v[2] = map2d->v1; + v[3] = map2d->v2; + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(query)" ); + } +} + + +void GLAPIENTRY +_mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_1d_map *map1d; + struct gl_2d_map *map2d; + GLuint i, n; + GLfloat *data; + GLuint comps; + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + comps = _mesa_evaluator_components(target); + if (!comps) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" ); + return; + } + + map1d = get_1d_map(ctx, target); + map2d = get_2d_map(ctx, target); + ASSERT(map1d || map2d); + + switch (query) { + case GL_COEFF: + if (map1d) { + data = map1d->Points; + n = map1d->Order * comps; + } + else { + data = map2d->Points; + n = map2d->Uorder * map2d->Vorder * comps; + } + if (data) { + for (i=0;iOrder; + } + else { + v[0] = map2d->Uorder; + v[1] = map2d->Vorder; + } + break; + case GL_DOMAIN: + if (map1d) { + v[0] = IROUND(map1d->u1); + v[1] = IROUND(map1d->u2); + } + else { + v[0] = IROUND(map2d->u1); + v[1] = IROUND(map2d->u2); + v[2] = IROUND(map2d->v1); + v[3] = IROUND(map2d->v2); + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(query)" ); + } +} + + + +void GLAPIENTRY +_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (un<1) { + _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" ); + return; + } + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.MapGrid1un = un; + ctx->Eval.MapGrid1u1 = u1; + ctx->Eval.MapGrid1u2 = u2; + ctx->Eval.MapGrid1du = (u2 - u1) / (GLfloat) un; +} + + +void GLAPIENTRY +_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ) +{ + _mesa_MapGrid1f( un, (GLfloat) u1, (GLfloat) u2 ); +} + + +void GLAPIENTRY +_mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, + GLint vn, GLfloat v1, GLfloat v2 ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (un<1) { + _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" ); + return; + } + if (vn<1) { + _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(vn)" ); + return; + } + + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.MapGrid2un = un; + ctx->Eval.MapGrid2u1 = u1; + ctx->Eval.MapGrid2u2 = u2; + ctx->Eval.MapGrid2du = (u2 - u1) / (GLfloat) un; + ctx->Eval.MapGrid2vn = vn; + ctx->Eval.MapGrid2v1 = v1; + ctx->Eval.MapGrid2v2 = v2; + ctx->Eval.MapGrid2dv = (v2 - v1) / (GLfloat) vn; +} + + +void GLAPIENTRY +_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, + GLint vn, GLdouble v1, GLdouble v2 ) +{ + _mesa_MapGrid2f( un, (GLfloat) u1, (GLfloat) u2, + vn, (GLfloat) v1, (GLfloat) v2 ); +} + + + +/**********************************************************************/ +/***** Initialization *****/ +/**********************************************************************/ + +/** + * Initialize a 1-D evaluator map. + */ +static void +init_1d_map( struct gl_1d_map *map, int n, const float *initial ) +{ + map->Order = 1; + map->u1 = 0.0; + map->u2 = 1.0; + map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat)); + if (map->Points) { + GLint i; + for (i=0;iPoints[i] = initial[i]; + } +} + + +/** + * Initialize a 2-D evaluator map + */ +static void +init_2d_map( struct gl_2d_map *map, int n, const float *initial ) +{ + map->Uorder = 1; + map->Vorder = 1; + map->u1 = 0.0; + map->u2 = 1.0; + map->v1 = 0.0; + map->v2 = 1.0; + map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat)); + if (map->Points) { + GLint i; + for (i=0;iPoints[i] = initial[i]; + } +} + + +void _mesa_init_eval( GLcontext *ctx ) +{ + int i; + + /* Evaluators group */ + ctx->Eval.Map1Color4 = GL_FALSE; + ctx->Eval.Map1Index = GL_FALSE; + ctx->Eval.Map1Normal = GL_FALSE; + ctx->Eval.Map1TextureCoord1 = GL_FALSE; + ctx->Eval.Map1TextureCoord2 = GL_FALSE; + ctx->Eval.Map1TextureCoord3 = GL_FALSE; + ctx->Eval.Map1TextureCoord4 = GL_FALSE; + ctx->Eval.Map1Vertex3 = GL_FALSE; + ctx->Eval.Map1Vertex4 = GL_FALSE; + MEMSET(ctx->Eval.Map1Attrib, 0, sizeof(ctx->Eval.Map1Attrib)); + ctx->Eval.Map2Color4 = GL_FALSE; + ctx->Eval.Map2Index = GL_FALSE; + ctx->Eval.Map2Normal = GL_FALSE; + ctx->Eval.Map2TextureCoord1 = GL_FALSE; + ctx->Eval.Map2TextureCoord2 = GL_FALSE; + ctx->Eval.Map2TextureCoord3 = GL_FALSE; + ctx->Eval.Map2TextureCoord4 = GL_FALSE; + ctx->Eval.Map2Vertex3 = GL_FALSE; + ctx->Eval.Map2Vertex4 = GL_FALSE; + MEMSET(ctx->Eval.Map2Attrib, 0, sizeof(ctx->Eval.Map2Attrib)); + ctx->Eval.AutoNormal = GL_FALSE; + ctx->Eval.MapGrid1un = 1; + ctx->Eval.MapGrid1u1 = 0.0; + ctx->Eval.MapGrid1u2 = 1.0; + ctx->Eval.MapGrid2un = 1; + ctx->Eval.MapGrid2vn = 1; + ctx->Eval.MapGrid2u1 = 0.0; + ctx->Eval.MapGrid2u2 = 1.0; + ctx->Eval.MapGrid2v1 = 0.0; + ctx->Eval.MapGrid2v2 = 1.0; + + /* Evaluator data */ + { + static GLfloat vertex[4] = { 0.0, 0.0, 0.0, 1.0 }; + static GLfloat normal[3] = { 0.0, 0.0, 1.0 }; + static GLfloat index[1] = { 1.0 }; + static GLfloat color[4] = { 1.0, 1.0, 1.0, 1.0 }; + static GLfloat texcoord[4] = { 0.0, 0.0, 0.0, 1.0 }; + static GLfloat attrib[4] = { 0.0, 0.0, 0.0, 1.0 }; + + init_1d_map( &ctx->EvalMap.Map1Vertex3, 3, vertex ); + init_1d_map( &ctx->EvalMap.Map1Vertex4, 4, vertex ); + init_1d_map( &ctx->EvalMap.Map1Index, 1, index ); + init_1d_map( &ctx->EvalMap.Map1Color4, 4, color ); + init_1d_map( &ctx->EvalMap.Map1Normal, 3, normal ); + init_1d_map( &ctx->EvalMap.Map1Texture1, 1, texcoord ); + init_1d_map( &ctx->EvalMap.Map1Texture2, 2, texcoord ); + init_1d_map( &ctx->EvalMap.Map1Texture3, 3, texcoord ); + init_1d_map( &ctx->EvalMap.Map1Texture4, 4, texcoord ); + for (i = 0; i < 16; i++) + init_1d_map( ctx->EvalMap.Map1Attrib + i, 4, attrib ); + + init_2d_map( &ctx->EvalMap.Map2Vertex3, 3, vertex ); + init_2d_map( &ctx->EvalMap.Map2Vertex4, 4, vertex ); + init_2d_map( &ctx->EvalMap.Map2Index, 1, index ); + init_2d_map( &ctx->EvalMap.Map2Color4, 4, color ); + init_2d_map( &ctx->EvalMap.Map2Normal, 3, normal ); + init_2d_map( &ctx->EvalMap.Map2Texture1, 1, texcoord ); + init_2d_map( &ctx->EvalMap.Map2Texture2, 2, texcoord ); + init_2d_map( &ctx->EvalMap.Map2Texture3, 3, texcoord ); + init_2d_map( &ctx->EvalMap.Map2Texture4, 4, texcoord ); + for (i = 0; i < 16; i++) + init_2d_map( ctx->EvalMap.Map2Attrib + i, 4, attrib ); + } +} + + +void _mesa_free_eval_data( GLcontext *ctx ) +{ + int i; + + /* Free evaluator data */ + if (ctx->EvalMap.Map1Vertex3.Points) + FREE( ctx->EvalMap.Map1Vertex3.Points ); + if (ctx->EvalMap.Map1Vertex4.Points) + FREE( ctx->EvalMap.Map1Vertex4.Points ); + if (ctx->EvalMap.Map1Index.Points) + FREE( ctx->EvalMap.Map1Index.Points ); + if (ctx->EvalMap.Map1Color4.Points) + FREE( ctx->EvalMap.Map1Color4.Points ); + if (ctx->EvalMap.Map1Normal.Points) + FREE( ctx->EvalMap.Map1Normal.Points ); + if (ctx->EvalMap.Map1Texture1.Points) + FREE( ctx->EvalMap.Map1Texture1.Points ); + if (ctx->EvalMap.Map1Texture2.Points) + FREE( ctx->EvalMap.Map1Texture2.Points ); + if (ctx->EvalMap.Map1Texture3.Points) + FREE( ctx->EvalMap.Map1Texture3.Points ); + if (ctx->EvalMap.Map1Texture4.Points) + FREE( ctx->EvalMap.Map1Texture4.Points ); + for (i = 0; i < 16; i++) + FREE((ctx->EvalMap.Map1Attrib[i].Points)); + + if (ctx->EvalMap.Map2Vertex3.Points) + FREE( ctx->EvalMap.Map2Vertex3.Points ); + if (ctx->EvalMap.Map2Vertex4.Points) + FREE( ctx->EvalMap.Map2Vertex4.Points ); + if (ctx->EvalMap.Map2Index.Points) + FREE( ctx->EvalMap.Map2Index.Points ); + if (ctx->EvalMap.Map2Color4.Points) + FREE( ctx->EvalMap.Map2Color4.Points ); + if (ctx->EvalMap.Map2Normal.Points) + FREE( ctx->EvalMap.Map2Normal.Points ); + if (ctx->EvalMap.Map2Texture1.Points) + FREE( ctx->EvalMap.Map2Texture1.Points ); + if (ctx->EvalMap.Map2Texture2.Points) + FREE( ctx->EvalMap.Map2Texture2.Points ); + if (ctx->EvalMap.Map2Texture3.Points) + FREE( ctx->EvalMap.Map2Texture3.Points ); + if (ctx->EvalMap.Map2Texture4.Points) + FREE( ctx->EvalMap.Map2Texture4.Points ); + for (i = 0; i < 16; i++) + FREE((ctx->EvalMap.Map2Attrib[i].Points)); +} diff --git a/reactos/dll/mesa32/src/main/eval.h b/reactos/dll/mesa32/src/main/eval.h new file mode 100644 index 00000000000..b3ff0a96f82 --- /dev/null +++ b/reactos/dll/mesa32/src/main/eval.h @@ -0,0 +1,128 @@ +/** + * \file eval.h + * Eval operations. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * 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 EVAL_H +#define EVAL_H + + +#include "mtypes.h" + +#if _HAVE_FULL_GL + +extern void _mesa_init_eval( GLcontext *ctx ); +extern void _mesa_free_eval_data( GLcontext *ctx ); + + +extern GLuint _mesa_evaluator_components( GLenum target ); + + +extern void gl_free_control_points( GLcontext *ctx, + GLenum target, GLfloat *data ); + + +extern GLfloat *_mesa_copy_map_points1f( GLenum target, + GLint ustride, GLint uorder, + const GLfloat *points ); + +extern GLfloat *_mesa_copy_map_points1d( GLenum target, + GLint ustride, GLint uorder, + const GLdouble *points ); + +extern GLfloat *_mesa_copy_map_points2f( GLenum target, + GLint ustride, GLint uorder, + GLint vstride, GLint vorder, + const GLfloat *points ); + +extern GLfloat *_mesa_copy_map_points2d(GLenum target, + GLint ustride, GLint uorder, + GLint vstride, GLint vorder, + const GLdouble *points ); + + + +extern void GLAPIENTRY +_mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, + GLint order, const GLfloat *points ); + +extern void GLAPIENTRY +_mesa_Map2f( GLenum target, + GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, + GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, + const GLfloat *points ); + +extern void GLAPIENTRY +_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, + GLint order, const GLdouble *points ); + +extern void GLAPIENTRY +_mesa_Map2d( GLenum target, + GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, + GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, + const GLdouble *points ); + +extern void GLAPIENTRY +_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); + +extern void GLAPIENTRY +_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); + +extern void GLAPIENTRY +_mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, + GLint vn, GLfloat v1, GLfloat v2 ); + +extern void GLAPIENTRY +_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, + GLint vn, GLdouble v1, GLdouble v2 ); + +extern void GLAPIENTRY +_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ); + +extern void GLAPIENTRY +_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ); + +extern void GLAPIENTRY +_mesa_GetMapiv( GLenum target, GLenum query, GLint *v ); + +#else + +/** No-op */ +#define _mesa_init_eval( c ) ((void)0) + +/** No-op */ +#define _mesa_free_eval_data( c ) ((void)0) + +#endif + +#endif diff --git a/reactos/dll/mesa32/src/main/execmem.c b/reactos/dll/mesa32/src/main/execmem.c new file mode 100644 index 00000000000..a6b110ae7ea --- /dev/null +++ b/reactos/dll/mesa32/src/main/execmem.c @@ -0,0 +1,132 @@ +/* + * 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 exemem.c + * Functions for allocating executable memory. + * + * \author Keith Whitwell + */ + + +#include "imports.h" +#include "glthread.h" + + + +#if defined(__linux__) && !defined(XFree86Server) + +/* + * 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 +#include +#include "mm.h" + +#define EXEC_HEAP_SIZE (128*1024) + +_glthread_DECLARE_STATIC_MUTEX(exec_mutex); + +static memHeap_t *exec_heap = NULL; +static unsigned char *exec_mem = NULL; + + +static void +init_heap(void) +{ + if (!exec_heap) + exec_heap = mmInit( 0, EXEC_HEAP_SIZE ); + + if (!exec_mem) + exec_mem = (unsigned char *) mmap(0, EXEC_HEAP_SIZE, + PROT_EXEC | PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); +} + + +void * +_mesa_exec_malloc(GLuint size) +{ + PMemBlock block = NULL; + void *addr = NULL; + + _glthread_LOCK_MUTEX(exec_mutex); + + init_heap(); + + if (exec_heap) { + size = (size + 31) & ~31; + block = mmAllocMem( exec_heap, size, 32, 0 ); + } + + if (block) + addr = exec_mem + block->ofs; + + _glthread_UNLOCK_MUTEX(exec_mutex); + + return addr; +} + + +void +_mesa_exec_free(void *addr) +{ + _glthread_LOCK_MUTEX(exec_mutex); + + if (exec_heap) { + PMemBlock 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 _mesa_malloc( size ); +} + + +void +_mesa_exec_free(void *addr) +{ + _mesa_free(addr); +} + + +#endif diff --git a/reactos/dll/mesa32/src/main/extensions.c b/reactos/dll/mesa32/src/main/extensions.c new file mode 100644 index 00000000000..fae98416511 --- /dev/null +++ b/reactos/dll/mesa32/src/main/extensions.c @@ -0,0 +1,516 @@ +/* + * 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. + */ + + +#include "glheader.h" +#include "imports.h" +#include "context.h" +#include "extensions.h" +#include "simple_list.h" +#include "mtypes.h" + + +#define F(x) (int)(uintptr_t)&(((struct gl_extensions *)0)->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_depth_texture", F(ARB_depth_texture) }, + { OFF, "GL_ARB_draw_buffers", F(ARB_draw_buffers) }, + { OFF, "GL_ARB_fragment_program", F(ARB_fragment_program) }, + { OFF, "GL_ARB_fragment_shader", F(ARB_fragment_shader) }, + { OFF, "GL_MESAX_half_float_pixel", F(ARB_half_float_pixel) }, + { OFF, "GL_ARB_imaging", F(ARB_imaging) }, + { OFF, "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_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_shader_objects", F(ARB_shader_objects) }, + { OFF, "GL_ARB_shading_language_100", F(ARB_shading_language_100) }, + { OFF, "GL_ARB_shadow", F(ARB_shadow) }, + { OFF, "GL_ARB_shadow_ambient", F(SGIX_shadow_ambient) }, + { OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) }, + { OFF, "GL_ARB_texture_compression", F(ARB_texture_compression) }, + { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) }, + { OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) }, + { 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_non_power_of_two", F(ARB_texture_non_power_of_two)}, + { OFF, "GL_ARB_texture_rectangle", F(NV_texture_rectangle) }, + { ON, "GL_ARB_transpose_matrix", F(ARB_transpose_matrix) }, + { OFF, "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) }, + { 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) }, + { ON, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) }, + { OFF, "GL_EXT_cull_vertex", F(EXT_cull_vertex) }, + { ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) }, + { OFF, "GL_EXT_convolution", F(EXT_convolution) }, + { ON, "GL_EXT_copy_texture", F(EXT_copy_texture) }, + { OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) }, + { ON, "GL_EXT_draw_range_elements", F(EXT_draw_range_elements) }, + { OFF, "GL_EXT_framebuffer_object", F(EXT_framebuffer_object) }, + { OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) }, + { OFF, "GL_EXT_histogram", F(EXT_histogram) }, + { OFF, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) }, + { 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) }, + { ON, "GL_EXT_rescale_normal", F(EXT_rescale_normal) }, + { OFF, "GL_EXT_secondary_color", F(EXT_secondary_color) }, + { 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_compression_s3tc", F(EXT_texture_compression_s3tc) }, + { 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_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) }, + { ON, "GL_EXT_vertex_array", F(EXT_vertex_array) }, + { 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_ATI_blend_equation_separate", F(EXT_blend_equation_separate) }, + { 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_HP_occlusion_test", F(HP_occlusion_test) }, + { OFF, "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_packed_depth_stencil", F(MESA_packed_depth_stencil) }, + { OFF, "GL_MESA_program_debug", F(MESA_program_debug) }, + { OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) }, + { 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_fragment_program", F(NV_fragment_program) }, + { ON, "GL_NV_light_max_exponent", F(NV_light_max_exponent) }, + { OFF, "GL_NV_point_sprite", F(NV_point_sprite) }, + { OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) }, + { ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) }, + { OFF, "GL_NV_vertex_program", F(NV_vertex_program) }, + { OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) }, + { ON, "GL_OES_read_format", F(OES_read_format) }, + { OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) }, + { OFF, "GL_SGI_color_table", F(SGI_color_table) }, + { OFF, "GL_SGI_texture_color_table", F(SGI_texture_color_table) }, + { OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) }, + { OFF, "GL_SGIS_pixel_texture", F(SGIS_pixel_texture) }, + { 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) }, + { OFF, "GL_SGIX_depth_texture", F(SGIX_depth_texture) }, + { OFF, "GL_SGIX_pixel_texture", F(SGIX_pixel_texture) }, + { OFF, "GL_SGIX_shadow", F(SGIX_shadow) }, + { OFF, "GL_SGIX_shadow_ambient", F(SGIX_shadow_ambient) }, + { OFF, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) }, + { OFF, "GL_S3_s3tc", F(S3_s3tc) }, +}; + + + +/** + * 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(GLcontext *ctx) +{ + ctx->Extensions.ARB_depth_texture = GL_TRUE; + ctx->Extensions.ARB_draw_buffers = GL_TRUE; +#if FEATURE_ARB_fragment_program + ctx->Extensions.ARB_fragment_program = GL_TRUE; +#endif +#if 0 && FEATURE_ARB_fragment_shader + ctx->Extensions.ARB_fragment_shader = GL_TRUE; +#endif + /*ctx->Extensions.ARB_half_float_pixel = GL_TRUE;*/ + ctx->Extensions.ARB_imaging = GL_TRUE; + ctx->Extensions.ARB_multitexture = GL_TRUE; +#if FEATURE_ARB_occlusion_query + ctx->Extensions.ARB_occlusion_query = GL_TRUE; +#endif + ctx->Extensions.ARB_point_sprite = GL_TRUE; +#if 0 && FEATURE_ARB_shader_objects + ctx->Extensions.ARB_shader_objects = GL_TRUE; +#endif +#if 0 && FEATURE_ARB_shading_language_100 + ctx->Extensions.ARB_shading_language_100 = GL_TRUE; +#endif + ctx->Extensions.ARB_shadow = 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; +#if FEATURE_ARB_vertex_program + ctx->Extensions.ARB_vertex_program = GL_TRUE; +#endif +#if 0 && 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_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.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_convolution = GL_TRUE; + ctx->Extensions.EXT_depth_bounds_test = GL_TRUE; + ctx->Extensions.EXT_fog_coord = GL_TRUE; +#if FEATURE_EXT_framebuffer_object + ctx->Extensions.EXT_framebuffer_object = GL_TRUE; +#endif + ctx->Extensions.EXT_histogram = GL_TRUE; + ctx->Extensions.EXT_multi_draw_arrays = 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_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_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; + ctx->Extensions.HP_occlusion_test = GL_TRUE; + ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE; + ctx->Extensions.MESA_pack_invert = GL_TRUE; +#if FEATURE_MESA_program_debug + ctx->Extensions.MESA_program_debug = GL_TRUE; +#endif + ctx->Extensions.MESA_resize_buffers = GL_TRUE; + ctx->Extensions.MESA_ycbcr_texture = GL_TRUE; + ctx->Extensions.NV_blend_square = GL_TRUE; + /*ctx->Extensions.NV_light_max_exponent = GL_TRUE;*/ + ctx->Extensions.NV_point_sprite = 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 + ctx->Extensions.SGI_color_matrix = GL_TRUE; + ctx->Extensions.SGI_color_table = GL_TRUE; + ctx->Extensions.SGI_texture_color_table = GL_TRUE; + ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; + ctx->Extensions.SGIS_pixel_texture = GL_TRUE; + ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE; + ctx->Extensions.SGIX_depth_texture = GL_TRUE; + ctx->Extensions.SGIX_pixel_texture = GL_TRUE; + ctx->Extensions.SGIX_shadow = GL_TRUE; + ctx->Extensions.SGIX_shadow_ambient = GL_TRUE; +} + + +/** + * Enable GL_ARB_imaging and all the EXT extensions that are subsets of it. + */ +void +_mesa_enable_imaging_extensions(GLcontext *ctx) +{ + ctx->Extensions.ARB_imaging = GL_TRUE; + ctx->Extensions.EXT_blend_color = GL_TRUE; + ctx->Extensions.EXT_blend_minmax = GL_TRUE; + ctx->Extensions.EXT_blend_subtract = GL_TRUE; + ctx->Extensions.EXT_convolution = GL_TRUE; + ctx->Extensions.EXT_histogram = GL_TRUE; + ctx->Extensions.SGI_color_matrix = GL_TRUE; + ctx->Extensions.SGI_color_table = GL_TRUE; +} + + + +/** + * Enable all OpenGL 1.3 features and extensions. + * A convenience function to be called by drivers. + */ +void +_mesa_enable_1_3_extensions(GLcontext *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(GLcontext *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_logic_op = 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(GLcontext *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(GLcontext *ctx) +{ + ctx->Extensions.ARB_draw_buffers = GL_TRUE; +#if 0 && FEATURE_ARB_fragment_shader + ctx->Extensions.ARB_fragment_shader = GL_TRUE; +#endif + ctx->Extensions.ARB_point_sprite = GL_TRUE; + ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; +#if 0 && FEATURE_ARB_shader_objects + ctx->Extensions.ARB_shader_objects = GL_TRUE; +#endif +#if 0 && FEATURE_ARB_shading_language_100 + ctx->Extensions.ARB_shading_language_100 = GL_TRUE; +#endif + ctx->Extensions.EXT_stencil_two_side = GL_TRUE; +#if 0 && FEATURE_ARB_vertex_shader + ctx->Extensions.ARB_vertex_shader = GL_TRUE; +#endif +} + + + +/** + * Either enable or disable the named extension. + */ +static void +set_extension( GLcontext *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; + } + + for (i = 0 ; i < Elements(default_extensions) ; i++) { + if (_mesa_strcmp(default_extensions[i].name, name) == 0) { + if (default_extensions[i].flag_offset) { + GLboolean *enabled = base + default_extensions[i].flag_offset; + *enabled = state; + } + return; + } + } + _mesa_problem(ctx, "Trying to enable unknown extension: %s", name); +} + + +/** + * Enable the named extension. + * Typically called by drivers. + */ +void +_mesa_enable_extension( GLcontext *ctx, const char *name ) +{ + set_extension(ctx, name, GL_TRUE); +} + + +/** + * Disable the named extension. + * XXX is this really needed??? + */ +void +_mesa_disable_extension( GLcontext *ctx, const char *name ) +{ + set_extension(ctx, name, GL_FALSE); +} + + +/** + * Test if the named extension is enabled in this context. + */ +GLboolean +_mesa_extension_is_enabled( GLcontext *ctx, const char *name ) +{ + const GLboolean *base = (const GLboolean *) &ctx->Extensions; + GLuint i; + + for (i = 0 ; i < Elements(default_extensions) ; i++) { + if (_mesa_strcmp(default_extensions[i].name, name) == 0) { + if (!default_extensions[i].flag_offset) + return GL_TRUE; + return *(base + default_extensions[i].flag_offset); + } + } + return GL_FALSE; +} + + +/** + * 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( GLcontext *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. + */ +GLubyte * +_mesa_make_extension_string( GLcontext *ctx ) +{ + const GLboolean *base = (const GLboolean *) &ctx->Extensions; + GLuint extStrLen = 0; + GLubyte *s; + GLuint i; + + /* first, compute length of the extension string */ + for (i = 0 ; i < Elements(default_extensions) ; i++) { + if (!default_extensions[i].flag_offset || + *(base + default_extensions[i].flag_offset)) { + extStrLen += (GLuint)_mesa_strlen(default_extensions[i].name) + 1; + } + } + s = (GLubyte *) _mesa_malloc(extStrLen); + + /* second, build the extension string */ + extStrLen = 0; + for (i = 0 ; i < Elements(default_extensions) ; i++) { + if (!default_extensions[i].flag_offset || + *(base + default_extensions[i].flag_offset)) { + GLuint len = (GLuint)_mesa_strlen(default_extensions[i].name); + _mesa_memcpy(s + extStrLen, default_extensions[i].name, len); + extStrLen += len; + s[extStrLen] = (GLubyte) ' '; + extStrLen++; + } + } + ASSERT(extStrLen > 0); + + s[extStrLen - 1] = 0; + + return s; +} diff --git a/reactos/dll/mesa32/src/main/extensions.h b/reactos/dll/mesa32/src/main/extensions.h new file mode 100644 index 00000000000..9d843a8b6b6 --- /dev/null +++ b/reactos/dll/mesa32/src/main/extensions.h @@ -0,0 +1,84 @@ +/** + * \file extensions.h + * Extension handling. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * 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. + */ + + +#ifndef _EXTENSIONS_H_ +#define _EXTENSIONS_H_ + +#include "mtypes.h" + +#if _HAVE_FULL_GL + +extern void _mesa_enable_sw_extensions(GLcontext *ctx); + +extern void _mesa_enable_imaging_extensions(GLcontext *ctx); + +extern void _mesa_enable_1_3_extensions(GLcontext *ctx); + +extern void _mesa_enable_1_4_extensions(GLcontext *ctx); + +extern void _mesa_enable_1_5_extensions(GLcontext *ctx); + +extern void _mesa_enable_2_0_extensions(GLcontext *ctx); + +extern void _mesa_enable_extension(GLcontext *ctx, const char *name); + +extern void _mesa_disable_extension(GLcontext *ctx, const char *name); + +extern GLboolean _mesa_extension_is_enabled(GLcontext *ctx, const char *name); + +extern void _mesa_init_extensions(GLcontext *ctx); + +extern GLubyte *_mesa_make_extension_string(GLcontext *ctx); + +#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/reactos/dll/mesa32/src/main/fbobject.c b/reactos/dll/mesa32/src/main/fbobject.c new file mode 100644 index 00000000000..b16e13a2209 --- /dev/null +++ b/reactos/dll/mesa32/src/main/fbobject.c @@ -0,0 +1,1357 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +/* + * Authors: + * Brian Paul + */ + + +#include "context.h" +#include "fbobject.h" +#include "framebuffer.h" +#include "hash.h" +#include "renderbuffer.h" +#include "teximage.h" +#include "texstore.h" + + +/** + * Notes: + * + * None of the GL_EXT_framebuffer_object functions are compiled into + * display lists. + */ + + + +/* + * When glGenRender/FramebuffersEXT() is called we insert pointers to + * these placeholder objects into the hash table. + * Later, when the object ID is first bound, we replace the placeholder + * with the real frame/renderbuffer. + */ +static struct gl_framebuffer DummyFramebuffer; +static struct gl_renderbuffer DummyRenderbuffer; + + +#define IS_CUBE_FACE(TARGET) \ + ((TARGET) >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && \ + (TARGET) <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) + + +/** + * Helper routine for getting a gl_renderbuffer. + */ +static struct gl_renderbuffer * +lookup_renderbuffer(GLcontext *ctx, GLuint id) +{ + struct gl_renderbuffer *rb; + + if (id == 0) + return NULL; + + rb = (struct gl_renderbuffer *) + _mesa_HashLookup(ctx->Shared->RenderBuffers, id); + return rb; +} + + +/** + * Helper routine for getting a gl_framebuffer. + */ +static struct gl_framebuffer * +lookup_framebuffer(GLcontext *ctx, GLuint id) +{ + struct gl_framebuffer *fb; + + if (id == 0) + return NULL; + + fb = (struct gl_framebuffer *) + _mesa_HashLookup(ctx->Shared->FrameBuffers, id); + return fb; +} + + +/** + * Given a GL_*_ATTACHMENTn token, return a pointer to the corresponding + * gl_renderbuffer_attachment object. + */ +static struct gl_renderbuffer_attachment * +get_attachment(GLcontext *ctx, struct gl_framebuffer *fb, GLenum attachment) +{ + GLuint i; + + switch (attachment) { + case GL_COLOR_ATTACHMENT0_EXT: + case GL_COLOR_ATTACHMENT1_EXT: + case GL_COLOR_ATTACHMENT2_EXT: + case GL_COLOR_ATTACHMENT3_EXT: + case GL_COLOR_ATTACHMENT4_EXT: + case GL_COLOR_ATTACHMENT5_EXT: + case GL_COLOR_ATTACHMENT6_EXT: + case GL_COLOR_ATTACHMENT7_EXT: + case GL_COLOR_ATTACHMENT8_EXT: + case GL_COLOR_ATTACHMENT9_EXT: + case GL_COLOR_ATTACHMENT10_EXT: + case GL_COLOR_ATTACHMENT11_EXT: + case GL_COLOR_ATTACHMENT12_EXT: + case GL_COLOR_ATTACHMENT13_EXT: + case GL_COLOR_ATTACHMENT14_EXT: + case GL_COLOR_ATTACHMENT15_EXT: + i = attachment - GL_COLOR_ATTACHMENT0_EXT; + if (i >= ctx->Const.MaxColorAttachments) { + return NULL; + } + return &fb->Attachment[BUFFER_COLOR0 + i]; + case GL_DEPTH_ATTACHMENT_EXT: + return &fb->Attachment[BUFFER_DEPTH]; + case GL_STENCIL_ATTACHMENT_EXT: + return &fb->Attachment[BUFFER_STENCIL]; + default: + return NULL; + } +} + + +/** + * Remove any texture or renderbuffer attached to the given attachment + * point. Update reference counts, etc. + */ +void +_mesa_remove_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att) +{ + if (att->Type == GL_TEXTURE) { + ASSERT(att->Texture); + if (att->Renderbuffer) { + /* delete/remove the 'wrapper' renderbuffer */ + /* XXX do we really want to do this??? */ + att->Renderbuffer->Delete(att->Renderbuffer); + att->Renderbuffer = NULL; + } + att->Texture->RefCount--; + if (att->Texture->RefCount == 0) { + ctx->Driver.DeleteTexture(ctx, att->Texture); + } + att->Texture = NULL; + } + else if (att->Type == GL_RENDERBUFFER_EXT) { + ASSERT(att->Renderbuffer); + ASSERT(!att->Texture); + att->Renderbuffer->RefCount--; + if (att->Renderbuffer->RefCount == 0) { + att->Renderbuffer->Delete(att->Renderbuffer); + } + att->Renderbuffer = NULL; + } + att->Type = GL_NONE; + att->Complete = GL_TRUE; +} + + +/** + * Bind a texture object to an attachment point. + * The previous binding, if any, will be removed first. + */ +void +_mesa_set_texture_attachment(GLcontext *ctx, + struct gl_renderbuffer_attachment *att, + struct gl_texture_object *texObj, + GLenum texTarget, GLuint level, GLuint zoffset) +{ + _mesa_remove_attachment(ctx, att); + att->Type = GL_TEXTURE; + att->Texture = texObj; + att->TextureLevel = level; + if (IS_CUBE_FACE(texTarget)) { + att->CubeMapFace = texTarget - GL_TEXTURE_CUBE_MAP_POSITIVE_X; + } + else { + att->CubeMapFace = 0; + } + att->Zoffset = zoffset; + att->Complete = GL_FALSE; + + texObj->RefCount++; + + /* XXX when we attach to a texture, we should probably set the + * att->Renderbuffer pointer to a "wrapper renderbuffer" which + * makes the texture image look like renderbuffer. + */ +} + + +/** + * Bind a renderbuffer to an attachment point. + * The previous binding, if any, will be removed first. + */ +void +_mesa_set_renderbuffer_attachment(GLcontext *ctx, + struct gl_renderbuffer_attachment *att, + struct gl_renderbuffer *rb) +{ + _mesa_remove_attachment(ctx, att); + att->Type = GL_RENDERBUFFER_EXT; + att->Renderbuffer = rb; + att->Texture = NULL; /* just to be safe */ + att->Complete = GL_FALSE; + rb->RefCount++; +} + + +/** + * Fallback for ctx->Driver.FramebufferRenderbuffer() + * Sets a framebuffer attachment to a particular renderbuffer. + * The framebuffer in question is ctx->DrawBuffer. + * \sa _mesa_renderbuffer_texture + */ +void +_mesa_framebuffer_renderbuffer(GLcontext *ctx, + struct gl_renderbuffer_attachment *att, + struct gl_renderbuffer *rb) +{ + if (rb) { + _mesa_set_renderbuffer_attachment(ctx, att, rb); + } + else { + _mesa_remove_attachment(ctx, att); + } +} + + +/** + * Test if an attachment point is complete and update its Complete field. + * \param format if GL_COLOR, this is a color attachment point, + * if GL_DEPTH, this is a depth component attachment point, + * if GL_STENCIL, this is a stencil component attachment point. + */ +static void +test_attachment_completeness(const GLcontext *ctx, GLenum format, + struct gl_renderbuffer_attachment *att) +{ + assert(format == GL_COLOR || format == GL_DEPTH || format == GL_STENCIL); + + /* assume complete */ + att->Complete = GL_TRUE; + + /* Look for reasons why the attachment might be incomplete */ + if (att->Type == GL_TEXTURE) { + const struct gl_texture_object *texObj = att->Texture; + struct gl_texture_image *texImage; + + if (!texObj) { + att->Complete = GL_FALSE; + return; + } + + texImage = texObj->Image[att->CubeMapFace][att->TextureLevel]; + if (!texImage) { + att->Complete = GL_FALSE; + return; + } + if (texImage->Width < 1 || texImage->Height < 1) { + att->Complete = GL_FALSE; + return; + } + if (texObj->Target == GL_TEXTURE_3D && att->Zoffset >= texImage->Depth) { + att->Complete = GL_FALSE; + return; + } + + if (format == GL_COLOR) { + if (texImage->TexFormat->BaseFormat != GL_RGB && + texImage->TexFormat->BaseFormat != GL_RGBA) { + att->Complete = GL_FALSE; + return; + } + } + else if (format == GL_DEPTH) { + if (texImage->TexFormat->BaseFormat != GL_DEPTH_COMPONENT) { + att->Complete = GL_FALSE; + return; + } + } + else { + /* no such thing as stencil textures */ + att->Complete = GL_FALSE; + return; + } + } + else if (att->Type == GL_RENDERBUFFER_EXT) { + if (att->Renderbuffer->Width < 1 || att->Renderbuffer->Height < 1) { + att->Complete = GL_FALSE; + return; + } + if (format == GL_COLOR) { + if (att->Renderbuffer->_BaseFormat != GL_RGB && + att->Renderbuffer->_BaseFormat != GL_RGBA) { + att->Complete = GL_FALSE; + return; + } + } + else if (format == GL_DEPTH) { + if (att->Renderbuffer->_BaseFormat != GL_DEPTH_COMPONENT) { + att->Complete = GL_FALSE; + return; + } + } + else { + assert(format == GL_STENCIL); + if (att->Renderbuffer->_BaseFormat != GL_STENCIL_INDEX) { + att->Complete = GL_FALSE; + return; + } + } + } + else { + ASSERT(att->Type == GL_NONE); + /* complete */ + return; + } +} + + +/** + * Test if the given framebuffer object is complete and update its + * Status field with the results. + * Also update the framebuffer's Width and Height fields if the + * framebuffer is complete. + */ +void +_mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb) +{ + GLuint numImages, width = 0, height = 0; + GLenum intFormat = GL_NONE; + GLuint w = 0, h = 0; + GLint i; + + assert(fb->Name != 0); + + numImages = 0; + fb->Width = 0; + fb->Height = 0; + + /* Start at -2 to more easily loop over all attachment points */ + for (i = -2; i < (GLint) ctx->Const.MaxColorAttachments; i++) { + struct gl_renderbuffer_attachment *att; + GLenum f; + + if (i == -2) { + att = &fb->Attachment[BUFFER_DEPTH]; + test_attachment_completeness(ctx, GL_DEPTH, att); + if (!att->Complete) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT; + return; + } + } + else if (i == -1) { + att = &fb->Attachment[BUFFER_STENCIL]; + test_attachment_completeness(ctx, GL_STENCIL, att); + if (!att->Complete) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT; + return; + } + } + else { + att = &fb->Attachment[BUFFER_COLOR0 + i]; + test_attachment_completeness(ctx, GL_COLOR, att); + if (!att->Complete) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT; + return; + } + } + + if (att->Type == GL_TEXTURE) { + w = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Width; + h = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Height; + f = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Format; + numImages++; + if (f != GL_RGB && f != GL_RGBA && f != GL_DEPTH_COMPONENT) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT; + return; + } + } + else if (att->Type == GL_RENDERBUFFER_EXT) { + w = att->Renderbuffer->Width; + h = att->Renderbuffer->Height; + f = att->Renderbuffer->InternalFormat; + numImages++; + } + else { + assert(att->Type == GL_NONE); + continue; + } + + if (numImages == 1) { + /* set required width, height and format */ + width = w; + height = h; + if (i >= 0) + intFormat = f; + } + else { + /* check that width, height, format are same */ + if (w != width || h != height) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT; + return; + } + if (intFormat != GL_NONE && f != intFormat) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT; + return; + } + } + } + + /* Check that all DrawBuffers are present */ + for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) { + if (fb->ColorDrawBuffer[i] != GL_NONE) { + const struct gl_renderbuffer_attachment *att + = get_attachment(ctx, fb, fb->ColorDrawBuffer[i]); + assert(att); + if (att->Type == GL_NONE) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT; + return; + } + } + } + + /* Check that the ReadBuffer is present */ + if (fb->ColorReadBuffer != GL_NONE) { + const struct gl_renderbuffer_attachment *att + = get_attachment(ctx, fb, fb->ColorReadBuffer); + assert(att); + if (att->Type == GL_NONE) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT; + return; + } + } + + /* Check if any renderbuffer is attached more than once */ + for (i = 0; i < BUFFER_COUNT - 1; i++) { + struct gl_renderbuffer *rb_i = fb->Attachment[i].Renderbuffer; + if (rb_i) { + GLint j; + for (j = i + 1; j < BUFFER_COUNT; j++) { + struct gl_renderbuffer *rb_j = fb->Attachment[j].Renderbuffer; + if (rb_i == rb_j) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT; + return; + } + } + } + } + + + if (numImages == 0) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT; + return; + } + + /* + * If we get here, the framebuffer is complete! + */ + fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT; + fb->Width = w; + fb->Height = h; +} + + +GLboolean GLAPIENTRY +_mesa_IsRenderbufferEXT(GLuint renderbuffer) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + if (renderbuffer) { + struct gl_renderbuffer *rb = lookup_renderbuffer(ctx, renderbuffer); + if (rb != NULL && rb != &DummyRenderbuffer) + return GL_TRUE; + } + return GL_FALSE; +} + + +void GLAPIENTRY +_mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer) +{ + struct gl_renderbuffer *newRb, *oldRb; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target != GL_RENDERBUFFER_EXT) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glBindRenderbufferEXT(target)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + + if (renderbuffer) { + newRb = lookup_renderbuffer(ctx, renderbuffer); + if (newRb == &DummyRenderbuffer) { + /* ID was reserved, but no real renderbuffer object made yet */ + newRb = NULL; + } + if (!newRb) { + /* create new renderbuffer object */ + newRb = ctx->Driver.NewRenderbuffer(ctx, renderbuffer); + if (!newRb) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindRenderbufferEXT"); + return; + } + ASSERT(newRb->AllocStorage); + _mesa_HashInsert(ctx->Shared->RenderBuffers, renderbuffer, newRb); + } + newRb->RefCount++; + } + else { + newRb = NULL; + } + + oldRb = ctx->CurrentRenderbuffer; + if (oldRb) { + oldRb->RefCount--; + if (oldRb->RefCount == 0) { + oldRb->Delete(oldRb); + } + } + + ASSERT(newRb != &DummyRenderbuffer); + + ctx->CurrentRenderbuffer = newRb; +} + + +void GLAPIENTRY +_mesa_DeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers) +{ + GLint i; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + + for (i = 0; i < n; i++) { + if (renderbuffers[i] > 0) { + struct gl_renderbuffer *rb; + rb = lookup_renderbuffer(ctx, renderbuffers[i]); + if (rb) { + /* check if deleting currently bound renderbuffer object */ + if (rb == ctx->CurrentRenderbuffer) { + /* bind default */ + ASSERT(rb->RefCount >= 2); + _mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); + } + + /* remove from hash table immediately, to free the ID */ + _mesa_HashRemove(ctx->Shared->RenderBuffers, renderbuffers[i]); + + if (rb != &DummyRenderbuffer) { + /* But the object will not be freed until it's no longer + * bound in any context. + */ + rb->RefCount--; + if (rb->RefCount == 0) { + rb->Delete(rb); + } + } + } + } + } +} + + +void GLAPIENTRY +_mesa_GenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint first; + GLint i; + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGenRenderbuffersEXT(n)"); + return; + } + + if (!renderbuffers) + return; + + first = _mesa_HashFindFreeKeyBlock(ctx->Shared->RenderBuffers, n); + + for (i = 0; i < n; i++) { + GLuint name = first + i; + renderbuffers[i] = name; + /* insert dummy placeholder into hash table */ + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + _mesa_HashInsert(ctx->Shared->RenderBuffers, name, &DummyRenderbuffer); + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + } +} + + +/** + * Given an internal format token for a render buffer, return the + * corresponding base format. + * \return one of GL_RGB, GL_RGBA, GL_STENCIL_INDEX, GL_DEPTH_COMPONENT + * or zero if error. + */ +static GLenum +base_internal_format(GLcontext *ctx, GLenum internalFormat) +{ + 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: + return GL_RGB; + 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; + case GL_STENCIL_INDEX: + case GL_STENCIL_INDEX1_EXT: + case GL_STENCIL_INDEX4_EXT: + case GL_STENCIL_INDEX8_EXT: + case GL_STENCIL_INDEX16_EXT: + return GL_STENCIL_INDEX; + case GL_DEPTH_COMPONENT: + case GL_DEPTH_COMPONENT16: + case GL_DEPTH_COMPONENT24: + case GL_DEPTH_COMPONENT32: + return GL_DEPTH_COMPONENT; + /* XXX add floating point formats eventually */ + default: + return 0; + } +} + + +void GLAPIENTRY +_mesa_RenderbufferStorageEXT(GLenum target, GLenum internalFormat, + GLsizei width, GLsizei height) +{ + struct gl_renderbuffer *rb; + GLenum baseFormat; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target != GL_RENDERBUFFER_EXT) { + _mesa_error(ctx, GL_INVALID_ENUM, "glRenderbufferStorageEXT(target)"); + return; + } + + baseFormat = base_internal_format(ctx, internalFormat); + if (baseFormat == 0) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glRenderbufferStorageEXT(internalFormat)"); + return; + } + + if (width < 1 || width > ctx->Const.MaxRenderbufferSize) { + _mesa_error(ctx, GL_INVALID_VALUE, "glRenderbufferStorageEXT(width)"); + return; + } + + if (height < 1 || height > ctx->Const.MaxRenderbufferSize) { + _mesa_error(ctx, GL_INVALID_VALUE, "glRenderbufferStorageEXT(height)"); + return; + } + + rb = ctx->CurrentRenderbuffer; + + if (!rb) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glRenderbufferStorageEXT"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + + /* Now allocate the storage */ + ASSERT(rb->AllocStorage); + if (rb->AllocStorage(ctx, rb, internalFormat, width, height)) { + /* No error - check/set fields now */ + assert(rb->Width == width); + assert(rb->Height == height); + assert(rb->InternalFormat); + rb->_BaseFormat = baseFormat; + } + else { + /* Probably ran out of memory - clear the fields */ + rb->Width = 0; + rb->Height = 0; + rb->InternalFormat = GL_NONE; + rb->_BaseFormat = GL_NONE; + } + + /* + test_framebuffer_completeness(ctx, fb); + */ + /* XXX if this renderbuffer is attached anywhere, invalidate attachment + * points??? + */ +} + + +void GLAPIENTRY +_mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target != GL_RENDERBUFFER_EXT) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetRenderbufferParameterivEXT(target)"); + return; + } + + if (!ctx->CurrentRenderbuffer) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetRenderbufferParameterivEXT"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + + switch (pname) { + case GL_RENDERBUFFER_WIDTH_EXT: + *params = ctx->CurrentRenderbuffer->Width; + return; + case GL_RENDERBUFFER_HEIGHT_EXT: + *params = ctx->CurrentRenderbuffer->Height; + return; + case GL_RENDERBUFFER_INTERNAL_FORMAT_EXT: + *params = ctx->CurrentRenderbuffer->InternalFormat; + return; + case GL_RENDERBUFFER_RED_SIZE_EXT: + if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB || + ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) { + *params = ctx->CurrentRenderbuffer->ComponentSizes[0]; + } + else { + *params = 0; + } + break; + case GL_RENDERBUFFER_GREEN_SIZE_EXT: + if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB || + ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) { + *params = ctx->CurrentRenderbuffer->ComponentSizes[1]; + } + else { + *params = 0; + } + break; + case GL_RENDERBUFFER_BLUE_SIZE_EXT: + if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB || + ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) { + *params = ctx->CurrentRenderbuffer->ComponentSizes[2]; + } + else { + *params = 0; + } + break; + case GL_RENDERBUFFER_ALPHA_SIZE_EXT: + if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB || + ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) { + *params = ctx->CurrentRenderbuffer->ComponentSizes[3]; + } + else { + *params = 0; + } + break; + case GL_RENDERBUFFER_DEPTH_SIZE_EXT: + if (ctx->CurrentRenderbuffer->_BaseFormat == GL_DEPTH_COMPONENT) { + *params = ctx->CurrentRenderbuffer->ComponentSizes[0]; + } + else { + *params = 0; + } + break; + case GL_RENDERBUFFER_STENCIL_SIZE_EXT: + if (ctx->CurrentRenderbuffer->_BaseFormat == GL_STENCIL_INDEX) { + *params = ctx->CurrentRenderbuffer->ComponentSizes[0]; + } + else { + *params = 0; + } + break; + + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetRenderbufferParameterivEXT(target)"); + return; + } +} + + +GLboolean GLAPIENTRY +_mesa_IsFramebufferEXT(GLuint framebuffer) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + if (framebuffer) { + struct gl_framebuffer *rb = lookup_framebuffer(ctx, framebuffer); + if (rb != NULL && rb != &DummyFramebuffer) + return GL_TRUE; + } + return GL_FALSE; +} + + +void GLAPIENTRY +_mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) +{ + struct gl_framebuffer *newFb, *newReadFb, *oldFb; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target != GL_FRAMEBUFFER_EXT) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glBindFramebufferEXT(target)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + + if (framebuffer) { + /* Binding a user-created framebuffer object */ + newFb = lookup_framebuffer(ctx, framebuffer); + if (newFb == &DummyFramebuffer) { + /* ID was reserved, but no real framebuffer object made yet */ + newFb = NULL; + } + if (!newFb) { + /* create new framebuffer object */ + newFb = ctx->Driver.NewFramebuffer(ctx, framebuffer); + if (!newFb) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindFramebufferEXT"); + return; + } + _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, newFb); + } + newFb->RefCount++; + newReadFb = newFb; + } + else { + /* Binding the window system framebuffer (which was originally set + * with MakeCurrent). + */ + newFb = ctx->WinSysDrawBuffer; + newReadFb = ctx->WinSysReadBuffer; + } + + oldFb = ctx->DrawBuffer; + if (oldFb && oldFb->Name != 0) { + oldFb->RefCount--; + if (oldFb->RefCount == 0) { + oldFb->Delete(oldFb); + } + } + + ASSERT(newFb != &DummyFramebuffer); + + /* Note, we set both the GL_DRAW_BUFFER and GL_READ_BUFFER state: */ + ctx->DrawBuffer = newFb; + ctx->ReadBuffer = newReadFb; +} + + +void GLAPIENTRY +_mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers) +{ + GLint i; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + + for (i = 0; i < n; i++) { + if (framebuffers[i] > 0) { + struct gl_framebuffer *fb; + fb = lookup_framebuffer(ctx, framebuffers[i]); + if (fb) { + ASSERT(fb == &DummyFramebuffer || fb->Name == framebuffers[i]); + + /* check if deleting currently bound framebuffer object */ + if (fb == ctx->DrawBuffer) { + /* bind default */ + ASSERT(fb->RefCount >= 2); + _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + } + + /* remove from hash table immediately, to free the ID */ + _mesa_HashRemove(ctx->Shared->FrameBuffers, framebuffers[i]); + + if (fb != &DummyFramebuffer) { + /* But the object will not be freed until it's no longer + * bound in any context. + */ + fb->RefCount--; + if (fb->RefCount == 0) { + fb->Delete(fb); + } + } + } + } + } +} + + +void GLAPIENTRY +_mesa_GenFramebuffersEXT(GLsizei n, GLuint *framebuffers) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint first; + GLint i; + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGenFramebuffersEXT(n)"); + return; + } + + if (!framebuffers) + return; + + first = _mesa_HashFindFreeKeyBlock(ctx->Shared->FrameBuffers, n); + + for (i = 0; i < n; i++) { + GLuint name = first + i; + framebuffers[i] = name; + /* insert dummy placeholder into hash table */ + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + _mesa_HashInsert(ctx->Shared->FrameBuffers, name, &DummyFramebuffer); + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + } +} + + + +GLenum GLAPIENTRY +_mesa_CheckFramebufferStatusEXT(GLenum target) +{ + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); + + if (target != GL_FRAMEBUFFER_EXT) { + _mesa_error(ctx, GL_INVALID_ENUM, "glCheckFramebufferStatus(target)"); + return 0; /* formerly GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + } + + if (ctx->DrawBuffer->Name == 0) { + /* The window system / default framebuffer is always complete */ + return GL_FRAMEBUFFER_COMPLETE_EXT; + } + + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + + _mesa_test_framebuffer_completeness(ctx, ctx->DrawBuffer); + return ctx->DrawBuffer->_Status; +} + + + +/** + * Do error checking common to glFramebufferTexture1D/2D/3DEXT. + * \return GL_TRUE if any error, GL_FALSE otherwise + */ +static GLboolean +error_check_framebuffer_texture(GLcontext *ctx, GLuint dims, + GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, GLint level) +{ + ASSERT(dims >= 1 && dims <= 3); + + if (target != GL_FRAMEBUFFER_EXT) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glFramebufferTexture%dDEXT(target)", dims); + return GL_TRUE; + } + + /* check framebuffer binding */ + if (ctx->DrawBuffer->Name == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glFramebufferTexture%dDEXT", dims); + return GL_TRUE; + } + + /* only check textarget, level if texture ID is non-zero */ + if (texture) { + if ((dims == 1 && textarget != GL_TEXTURE_1D) || + (dims == 3 && textarget != GL_TEXTURE_3D) || + (dims == 2 && textarget != GL_TEXTURE_2D && + textarget != GL_TEXTURE_RECTANGLE_ARB && + !IS_CUBE_FACE(textarget))) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glFramebufferTexture%dDEXT(textarget)", dims); + return GL_TRUE; + } + + if ((level < 0) || level >= _mesa_max_texture_levels(ctx, textarget)) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glFramebufferTexture%dDEXT(level)", dims); + return GL_TRUE; + } + } + + return GL_FALSE; +} + + +void GLAPIENTRY +_mesa_FramebufferTexture1DEXT(GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, GLint level) +{ + struct gl_renderbuffer_attachment *att; + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (error_check_framebuffer_texture(ctx, 1, target, attachment, + textarget, texture, level)) + return; + + ASSERT(textarget == GL_TEXTURE_1D); + + att = get_attachment(ctx, ctx->DrawBuffer, attachment); + if (att == NULL) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glFramebufferTexture1DEXT(attachment)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + + if (texture) { + texObj = (struct gl_texture_object *) + _mesa_HashLookup(ctx->Shared->TexObjects, texture); + if (!texObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glFramebufferTexture1DEXT(texture)"); + return; + } + if (texObj->Target != textarget) { + _mesa_error(ctx, GL_INVALID_OPERATION, /* XXX correct error? */ + "glFramebufferTexture1DEXT(texture target)"); + return; + } + } + else { + /* remove texture attachment */ + texObj = NULL; + } + ctx->Driver.RenderbufferTexture(ctx, att, texObj, textarget, level, 0); +} + + +void GLAPIENTRY +_mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, GLint level) +{ + struct gl_renderbuffer_attachment *att; + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (error_check_framebuffer_texture(ctx, 2, target, attachment, + textarget, texture, level)) + return; + + ASSERT(textarget == GL_TEXTURE_2D || + textarget == GL_TEXTURE_RECTANGLE_ARB || + IS_CUBE_FACE(textarget)); + + att = get_attachment(ctx, ctx->DrawBuffer, attachment); + if (att == NULL) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glFramebufferTexture2DEXT(attachment)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + + if (texture) { + texObj = (struct gl_texture_object *) + _mesa_HashLookup(ctx->Shared->TexObjects, texture); + if (!texObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glFramebufferTexture2DEXT(texture)"); + return; + } + if ((texObj->Target == GL_TEXTURE_2D && textarget != GL_TEXTURE_2D) || + (texObj->Target == GL_TEXTURE_RECTANGLE_ARB + && textarget != GL_TEXTURE_RECTANGLE_ARB) || + (texObj->Target == GL_TEXTURE_CUBE_MAP + && !IS_CUBE_FACE(textarget))) { + _mesa_error(ctx, GL_INVALID_OPERATION, /* XXX correct error? */ + "glFramebufferTexture2DEXT(texture target)"); + return; + } + } + else { + /* remove texture attachment */ + texObj = NULL; + } + ctx->Driver.RenderbufferTexture(ctx, att, texObj, textarget, level, 0); +} + + +void GLAPIENTRY +_mesa_FramebufferTexture3DEXT(GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, + GLint level, GLint zoffset) +{ + struct gl_renderbuffer_attachment *att; + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (error_check_framebuffer_texture(ctx, 3, target, attachment, + textarget, texture, level)) + return; + + ASSERT(textarget == GL_TEXTURE_3D); + + att = get_attachment(ctx, ctx->DrawBuffer, attachment); + if (att == NULL) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glFramebufferTexture1DEXT(attachment)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + + if (texture) { + const GLint maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1); + texObj = (struct gl_texture_object *) + _mesa_HashLookup(ctx->Shared->TexObjects, texture); + if (!texObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glFramebufferTexture3DEXT(texture)"); + return; + } + if (texObj->Target != textarget) { + _mesa_error(ctx, GL_INVALID_OPERATION, /* XXX correct error? */ + "glFramebufferTexture3DEXT(texture target)"); + return; + } + if (zoffset < 0 || zoffset >= maxSize) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glFramebufferTexture3DEXT(zoffset)"); + return; + } + } + else { + /* remove texture attachment */ + texObj = NULL; + } + ctx->Driver.RenderbufferTexture(ctx, att, texObj, textarget, + level, zoffset); +} + + +void GLAPIENTRY +_mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, + GLenum renderbufferTarget, + GLuint renderbuffer) +{ + struct gl_renderbuffer_attachment *att; + struct gl_renderbuffer *rb; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target != GL_FRAMEBUFFER_EXT) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glFramebufferRenderbufferEXT(target)"); + return; + } + + if (renderbufferTarget != GL_RENDERBUFFER_EXT) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glFramebufferRenderbufferEXT(renderbufferTarget)"); + return; + } + + if (ctx->DrawBuffer->Name == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferRenderbufferEXT"); + return; + } + + att = get_attachment(ctx, ctx->DrawBuffer, attachment); + if (att == NULL) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glFramebufferRenderbufferEXT(attachment)"); + return; + } + + if (renderbuffer) { + rb = lookup_renderbuffer(ctx, renderbuffer); + if (!rb) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glFramebufferRenderbufferEXT(renderbuffer)"); + return; + } + } + else { + /* remove renderbuffer attachment */ + rb = NULL; + } + + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + + assert(ctx->Driver.FramebufferRenderbuffer); + ctx->Driver.FramebufferRenderbuffer(ctx, att, rb); +} + + +void GLAPIENTRY +_mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, + GLenum pname, GLint *params) +{ + const struct gl_renderbuffer_attachment *att; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target != GL_FRAMEBUFFER_EXT) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetFramebufferAttachmentParameterivEXT(target)"); + return; + } + + if (ctx->DrawBuffer->Name == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetFramebufferAttachmentParameterivEXT"); + return; + } + + att = get_attachment(ctx, ctx->DrawBuffer, attachment); + if (att == NULL) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetFramebufferAttachmentParameterivEXT(attachment)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + + switch (pname) { + case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT: + *params = att->Type; + return; + case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT: + if (att->Type == GL_RENDERBUFFER_EXT) { + *params = att->Renderbuffer->Name; + } + else if (att->Type == GL_TEXTURE) { + *params = att->Texture->Name; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetFramebufferAttachmentParameterivEXT(pname)"); + } + return; + case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT: + if (att->Type == GL_TEXTURE) { + *params = att->TextureLevel; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetFramebufferAttachmentParameterivEXT(pname)"); + } + return; + case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT: + if (att->Type == GL_TEXTURE) { + *params = GL_TEXTURE_CUBE_MAP_POSITIVE_X + att->CubeMapFace; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetFramebufferAttachmentParameterivEXT(pname)"); + } + return; + case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT: + if (att->Type == GL_TEXTURE) { + *params = att->Zoffset; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetFramebufferAttachmentParameterivEXT(pname)"); + } + return; + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetFramebufferAttachmentParameterivEXT(pname)"); + return; + } +} + + +void GLAPIENTRY +_mesa_GenerateMipmapEXT(GLenum target) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + + switch (target) { + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + case GL_TEXTURE_CUBE_MAP: + /* OK, legal value */ + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGenerateMipmapEXT(target)"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + + /* XXX this might not handle cube maps correctly */ + _mesa_generate_mipmap(ctx, target, texUnit, texObj); +} diff --git a/reactos/dll/mesa32/src/main/fbobject.h b/reactos/dll/mesa32/src/main/fbobject.h new file mode 100644 index 00000000000..2c86ef93726 --- /dev/null +++ b/reactos/dll/mesa32/src/main/fbobject.h @@ -0,0 +1,114 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 FBOBJECT_H +#define FBOBJECT_H + + +extern void +_mesa_remove_attachment(GLcontext *ctx, + struct gl_renderbuffer_attachment *att); + +extern void +_mesa_set_texture_attachment(GLcontext *ctx, + struct gl_renderbuffer_attachment *att, + struct gl_texture_object *texObj, + GLenum texTarget, GLuint level, GLuint zoffset); + +extern void +_mesa_set_renderbuffer_attachment(GLcontext *ctx, + struct gl_renderbuffer_attachment *att, + struct gl_renderbuffer *rb); + +extern void +_mesa_framebuffer_renderbuffer(GLcontext *ctx, + struct gl_renderbuffer_attachment *att, + struct gl_renderbuffer *rb); + +extern void +_mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb); + +extern GLboolean GLAPIENTRY +_mesa_IsRenderbufferEXT(GLuint renderbuffer); + +extern void GLAPIENTRY +_mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer); + +extern void GLAPIENTRY +_mesa_DeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers); + +extern void GLAPIENTRY +_mesa_GenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers); + +extern void GLAPIENTRY +_mesa_RenderbufferStorageEXT(GLenum target, GLenum internalformat, + GLsizei width, GLsizei height); + +extern void GLAPIENTRY +_mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, + GLint *params); + +extern GLboolean GLAPIENTRY +_mesa_IsFramebufferEXT(GLuint framebuffer); + +extern void GLAPIENTRY +_mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer); + +extern void GLAPIENTRY +_mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers); + +extern void GLAPIENTRY +_mesa_GenFramebuffersEXT(GLsizei n, GLuint *framebuffers); + +extern GLenum GLAPIENTRY +_mesa_CheckFramebufferStatusEXT(GLenum target); + +extern void GLAPIENTRY +_mesa_FramebufferTexture1DEXT(GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, GLint level); + +extern void GLAPIENTRY +_mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, GLint level); + +extern void GLAPIENTRY +_mesa_FramebufferTexture3DEXT(GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, + GLint level, GLint zoffset); + +extern void GLAPIENTRY +_mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer); + +extern void GLAPIENTRY +_mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, + GLenum pname, GLint *params); + +extern void GLAPIENTRY +_mesa_GenerateMipmapEXT(GLenum target); + + +#endif /* FBOBJECT_H */ diff --git a/reactos/dll/mesa32/src/main/feedback.c b/reactos/dll/mesa32/src/main/feedback.c new file mode 100644 index 00000000000..48c2ccbff30 --- /dev/null +++ b/reactos/dll/mesa32/src/main/feedback.c @@ -0,0 +1,541 @@ +/** + * \file feedback.c + * Selection and feedback modes functions. + */ + +/* + * 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. + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "enums.h" +#include "feedback.h" +#include "macros.h" +#include "mtypes.h" + + +#if _HAVE_FULL_GL + + +#define FB_3D 0x01 +#define FB_4D 0x02 +#define FB_INDEX 0x04 +#define FB_COLOR 0x08 +#define FB_TEXTURE 0X10 + + + +void GLAPIENTRY +_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->RenderMode==GL_FEEDBACK) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glFeedbackBuffer" ); + return; + } + if (size<0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(size<0)" ); + return; + } + if (!buffer) { + _mesa_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(buffer==NULL)" ); + ctx->Feedback.BufferSize = 0; + return; + } + + switch (type) { + case GL_2D: + ctx->Feedback._Mask = 0; + break; + case GL_3D: + ctx->Feedback._Mask = FB_3D; + break; + case GL_3D_COLOR: + ctx->Feedback._Mask = (FB_3D | + (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX)); + break; + case GL_3D_COLOR_TEXTURE: + ctx->Feedback._Mask = (FB_3D | + (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX) | + FB_TEXTURE); + break; + case GL_4D_COLOR_TEXTURE: + ctx->Feedback._Mask = (FB_3D | FB_4D | + (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX) | + FB_TEXTURE); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glFeedbackBuffer" ); + return; + } + + FLUSH_VERTICES(ctx, _NEW_RENDERMODE); /* Always flush */ + ctx->Feedback.Type = type; + ctx->Feedback.BufferSize = size; + ctx->Feedback.Buffer = buffer; + ctx->Feedback.Count = 0; /* Becaues of this. */ +} + + +void GLAPIENTRY +_mesa_PassThrough( GLfloat token ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->RenderMode==GL_FEEDBACK) { + FLUSH_VERTICES(ctx, 0); + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN ); + FEEDBACK_TOKEN( ctx, token ); + } +} + + + +/* + * Put a vertex into the feedback buffer. + */ +void _mesa_feedback_vertex( GLcontext *ctx, + const GLfloat win[4], + const GLfloat color[4], + GLfloat index, + const GLfloat texcoord[4] ) +{ +#if 0 + { + /* snap window x, y to fractional pixel position */ + const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1); + GLfixed x, y; + x = FloatToFixed(win[0]) & snapMask; + y = FloatToFixed(win[1]) & snapMask; + FEEDBACK_TOKEN(ctx, FixedToFloat(x)); + FEEDBACK_TOKEN(ctx, FixedToFloat(y) ); + } +#else + FEEDBACK_TOKEN( ctx, win[0] ); + FEEDBACK_TOKEN( ctx, win[1] ); +#endif + if (ctx->Feedback._Mask & FB_3D) { + FEEDBACK_TOKEN( ctx, win[2] ); + } + if (ctx->Feedback._Mask & FB_4D) { + FEEDBACK_TOKEN( ctx, win[3] ); + } + if (ctx->Feedback._Mask & FB_INDEX) { + FEEDBACK_TOKEN( ctx, (GLfloat) index ); + } + if (ctx->Feedback._Mask & FB_COLOR) { + FEEDBACK_TOKEN( ctx, color[0] ); + FEEDBACK_TOKEN( ctx, color[1] ); + FEEDBACK_TOKEN( ctx, color[2] ); + FEEDBACK_TOKEN( ctx, color[3] ); + } + if (ctx->Feedback._Mask & FB_TEXTURE) { + FEEDBACK_TOKEN( ctx, texcoord[0] ); + FEEDBACK_TOKEN( ctx, texcoord[1] ); + FEEDBACK_TOKEN( ctx, texcoord[2] ); + FEEDBACK_TOKEN( ctx, texcoord[3] ); + } +} + +#endif + + +/**********************************************************************/ +/** \name Selection */ +/*@{*/ + +/** + * Establish a buffer for selection mode values. + * + * \param size buffer size. + * \param buffer buffer. + * + * \sa glSelectBuffer(). + * + * \note this function can't be put in a display list. + * + * Verifies we're not in selection mode, flushes the vertices and initialize + * the fields in __GLcontextRec::Select with the given buffer. + */ +void GLAPIENTRY +_mesa_SelectBuffer( GLsizei size, GLuint *buffer ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->RenderMode==GL_SELECT) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glSelectBuffer" ); + return; /* KW: added return */ + } + + FLUSH_VERTICES(ctx, _NEW_RENDERMODE); + ctx->Select.Buffer = buffer; + ctx->Select.BufferSize = size; + ctx->Select.BufferCount = 0; + ctx->Select.HitFlag = GL_FALSE; + ctx->Select.HitMinZ = 1.0; + ctx->Select.HitMaxZ = 0.0; +} + + +/** + * Write a value of a record into the selection buffer. + * + * \param CTX GL context. + * \param V value. + * + * Verifies there is free space in the buffer to write the value and + * increments the pointer. + */ +#define WRITE_RECORD( CTX, V ) \ + if (CTX->Select.BufferCount < CTX->Select.BufferSize) { \ + CTX->Select.Buffer[CTX->Select.BufferCount] = (V); \ + } \ + CTX->Select.BufferCount++; + + +/** + * Update the hit flag and the maximum and minimum depth values. + * + * \param ctx GL context. + * \param z depth. + * + * Sets gl_selection::HitFlag and updates gl_selection::HitMinZ and + * gl_selection::HitMaxZ. + */ +void _mesa_update_hitflag( GLcontext *ctx, GLfloat z ) +{ + ctx->Select.HitFlag = GL_TRUE; + if (z < ctx->Select.HitMinZ) { + ctx->Select.HitMinZ = z; + } + if (z > ctx->Select.HitMaxZ) { + ctx->Select.HitMaxZ = z; + } +} + + +/** + * Write the hit record. + * + * \param ctx GL context. + * + * Write the hit record, i.e., the number of names in the stack, the minimum and + * maximum depth values and the number of names in the name stack at the time + * of the event. Resets the hit flag. + * + * \sa gl_selection. + */ +static void write_hit_record( GLcontext *ctx ) +{ + GLuint i; + GLuint zmin, zmax, zscale = (~0u); + + /* HitMinZ and HitMaxZ are in [0,1]. Multiply these values by */ + /* 2^32-1 and round to nearest unsigned integer. */ + + assert( ctx != NULL ); /* this line magically fixes a SunOS 5.x/gcc bug */ + zmin = (GLuint) ((GLfloat) zscale * ctx->Select.HitMinZ); + zmax = (GLuint) ((GLfloat) zscale * ctx->Select.HitMaxZ); + + WRITE_RECORD( ctx, ctx->Select.NameStackDepth ); + WRITE_RECORD( ctx, zmin ); + WRITE_RECORD( ctx, zmax ); + for (i = 0; i < ctx->Select.NameStackDepth; i++) { + WRITE_RECORD( ctx, ctx->Select.NameStack[i] ); + } + + ctx->Select.Hits++; + ctx->Select.HitFlag = GL_FALSE; + ctx->Select.HitMinZ = 1.0; + ctx->Select.HitMaxZ = -1.0; +} + + +/** + * Initialize the name stack. + * + * Verifies we are in select mode and resets the name stack depth and resets + * the hit record data in gl_selection. Marks new render mode in + * __GLcontextRec::NewState. + */ +void GLAPIENTRY +_mesa_InitNames( void ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + /* Record the hit before the HitFlag is wiped out again. */ + if (ctx->RenderMode == GL_SELECT) { + if (ctx->Select.HitFlag) { + write_hit_record( ctx ); + } + } + ctx->Select.NameStackDepth = 0; + ctx->Select.HitFlag = GL_FALSE; + ctx->Select.HitMinZ = 1.0; + ctx->Select.HitMaxZ = 0.0; + ctx->NewState |= _NEW_RENDERMODE; +} + + +/** + * Load the top-most name of the name stack. + * + * \param name name. + * + * Verifies we are in selection mode and that the name stack is not empty. + * Flushes vertices. If there is a hit flag writes it (via write_hit_record()), + * and replace the top-most name in the stack. + * + * sa __GLcontextRec::Select. + */ +void GLAPIENTRY +_mesa_LoadName( GLuint name ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->RenderMode != GL_SELECT) { + return; + } + if (ctx->Select.NameStackDepth == 0) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glLoadName" ); + return; + } + + FLUSH_VERTICES(ctx, _NEW_RENDERMODE); + + if (ctx->Select.HitFlag) { + write_hit_record( ctx ); + } + if (ctx->Select.NameStackDepth < MAX_NAME_STACK_DEPTH) { + ctx->Select.NameStack[ctx->Select.NameStackDepth-1] = name; + } + else { + ctx->Select.NameStack[MAX_NAME_STACK_DEPTH-1] = name; + } +} + + +/** + * Push a name into the name stack. + * + * \param name name. + * + * Verifies we are in selection mode and that the name stack is not full. + * Flushes vertices. If there is a hit flag writes it (via write_hit_record()), + * and adds the name to the top of the name stack. + * + * sa __GLcontextRec::Select. + */ +void GLAPIENTRY +_mesa_PushName( GLuint name ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->RenderMode != GL_SELECT) { + return; + } + + FLUSH_VERTICES(ctx, _NEW_RENDERMODE); + if (ctx->Select.HitFlag) { + write_hit_record( ctx ); + } + if (ctx->Select.NameStackDepth >= MAX_NAME_STACK_DEPTH) { + _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushName" ); + } + else + ctx->Select.NameStack[ctx->Select.NameStackDepth++] = name; +} + + +/** + * Pop a name into the name stack. + * + * Verifies we are in selection mode and that the name stack is not empty. + * Flushes vertices. If there is a hit flag writes it (via write_hit_record()), + * and removes top-most name in the name stack. + * + * sa __GLcontextRec::Select. + */ +void GLAPIENTRY +_mesa_PopName( void ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->RenderMode != GL_SELECT) { + return; + } + + FLUSH_VERTICES(ctx, _NEW_RENDERMODE); + if (ctx->Select.HitFlag) { + write_hit_record( ctx ); + } + if (ctx->Select.NameStackDepth == 0) { + _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopName" ); + } + else + ctx->Select.NameStackDepth--; +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Render Mode */ +/*@{*/ + +/** + * Set rasterization mode. + * + * \param mode rasterization mode. + * + * \note this function can't be put in a display list. + * + * \sa glRenderMode(). + * + * Flushes the vertices and do the necessary cleanup according to the previous + * rasterization mode, such as writing the hit record or resent the select + * buffer index when exiting the select mode. Updates + * __GLcontextRec::RenderMode and notifies the driver via the + * dd_function_table::RenderMode callback. + */ +GLint GLAPIENTRY +_mesa_RenderMode( GLenum mode ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint result; + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glRenderMode %s\n", _mesa_lookup_enum_by_nr(mode)); + + FLUSH_VERTICES(ctx, _NEW_RENDERMODE); + + switch (ctx->RenderMode) { + case GL_RENDER: + result = 0; + break; + case GL_SELECT: + if (ctx->Select.HitFlag) { + write_hit_record( ctx ); + } + if (ctx->Select.BufferCount > ctx->Select.BufferSize) { + /* overflow */ +#ifdef DEBUG + _mesa_warning(ctx, "Feedback buffer overflow"); +#endif + result = -1; + } + else { + result = ctx->Select.Hits; + } + ctx->Select.BufferCount = 0; + ctx->Select.Hits = 0; + ctx->Select.NameStackDepth = 0; + break; +#if _HAVE_FULL_GL + case GL_FEEDBACK: + if (ctx->Feedback.Count > ctx->Feedback.BufferSize) { + /* overflow */ + result = -1; + } + else { + result = ctx->Feedback.Count; + } + ctx->Feedback.Count = 0; + break; +#endif + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glRenderMode" ); + return 0; + } + + switch (mode) { + case GL_RENDER: + break; + case GL_SELECT: + if (ctx->Select.BufferSize==0) { + /* haven't called glSelectBuffer yet */ + _mesa_error( ctx, GL_INVALID_OPERATION, "glRenderMode" ); + } + break; +#if _HAVE_FULL_GL + case GL_FEEDBACK: + if (ctx->Feedback.BufferSize==0) { + /* haven't called glFeedbackBuffer yet */ + _mesa_error( ctx, GL_INVALID_OPERATION, "glRenderMode" ); + } + break; +#endif + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glRenderMode" ); + return 0; + } + + ctx->RenderMode = mode; + if (ctx->Driver.RenderMode) + ctx->Driver.RenderMode( ctx, mode ); + + return result; +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Initialization */ +/*@{*/ + +/** + * Initialize context feedback data. + */ +void _mesa_init_feedback( GLcontext * ctx ) +{ + /* Feedback */ + ctx->Feedback.Type = GL_2D; /* TODO: verify */ + ctx->Feedback.Buffer = NULL; + ctx->Feedback.BufferSize = 0; + ctx->Feedback.Count = 0; + + /* Selection/picking */ + ctx->Select.Buffer = NULL; + ctx->Select.BufferSize = 0; + ctx->Select.BufferCount = 0; + ctx->Select.Hits = 0; + ctx->Select.NameStackDepth = 0; + + /* Miscellaneous */ + ctx->RenderMode = GL_RENDER; +} + +/*@}*/ diff --git a/reactos/dll/mesa32/src/main/feedback.h b/reactos/dll/mesa32/src/main/feedback.h new file mode 100644 index 00000000000..6c448ad631b --- /dev/null +++ b/reactos/dll/mesa32/src/main/feedback.h @@ -0,0 +1,82 @@ +/** + * \file feedback.h + * Selection and feedback modes functions. + */ + +/* + * 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 FEEDBACK_H +#define FEEDBACK_H + + +#include "mtypes.h" + + +#define FEEDBACK_TOKEN( CTX, T ) \ + if (CTX->Feedback.Count < CTX->Feedback.BufferSize) { \ + CTX->Feedback.Buffer[CTX->Feedback.Count] = (GLfloat) (T); \ + } \ + CTX->Feedback.Count++; + + +extern void _mesa_init_feedback( GLcontext * ctx ); + +extern void _mesa_feedback_vertex( GLcontext *ctx, + const GLfloat win[4], + const GLfloat color[4], + GLfloat index, + const GLfloat texcoord[4] ); + + +extern void _mesa_update_hitflag( GLcontext *ctx, GLfloat z ); + + +extern void GLAPIENTRY +_mesa_PassThrough( GLfloat token ); + +extern void GLAPIENTRY +_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ); + +extern void GLAPIENTRY +_mesa_SelectBuffer( GLsizei size, GLuint *buffer ); + +extern void GLAPIENTRY +_mesa_InitNames( void ); + +extern void GLAPIENTRY +_mesa_LoadName( GLuint name ); + +extern void GLAPIENTRY +_mesa_PushName( GLuint name ); + +extern void GLAPIENTRY +_mesa_PopName( void ); + +extern GLint GLAPIENTRY +_mesa_RenderMode( GLenum mode ); + + +#endif diff --git a/reactos/dll/mesa32/src/main/fog.c b/reactos/dll/mesa32/src/main/fog.c new file mode 100644 index 00000000000..d3b8a923aae --- /dev/null +++ b/reactos/dll/mesa32/src/main/fog.c @@ -0,0 +1,177 @@ +/* + * 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. + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "fog.h" +#include "mtypes.h" + + + +void GLAPIENTRY +_mesa_Fogf(GLenum pname, GLfloat param) +{ + _mesa_Fogfv(pname, ¶m); +} + + +void GLAPIENTRY +_mesa_Fogi(GLenum pname, GLint param ) +{ + GLfloat fparam = (GLfloat) param; + _mesa_Fogfv(pname, &fparam); +} + + +void GLAPIENTRY +_mesa_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: + case GL_FOG_COORDINATE_SOURCE_EXT: + p[0] = (GLfloat) *params; + 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 _mesa_Fogfv */ + ; + } + _mesa_Fogfv(pname, p); +} + + +void GLAPIENTRY +_mesa_Fogfv( GLenum pname, const GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + GLenum m; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (pname) { + case GL_FOG_MODE: + m = (GLenum) (GLint) *params; + switch (m) { + case GL_LINEAR: + case GL_EXP: + case GL_EXP2: + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glFog" ); + return; + } + if (ctx->Fog.Mode == m) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.Mode = m; + break; + case GL_FOG_DENSITY: + if (*params<0.0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glFog" ); + return; + } + if (ctx->Fog.Density == *params) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.Density = *params; + break; + case GL_FOG_START: + if (ctx->Fog.Start == *params) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.Start = *params; + break; + case GL_FOG_END: + if (ctx->Fog.End == *params) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.End = *params; + break; + case GL_FOG_INDEX: + if (ctx->Fog.Index == *params) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.Index = *params; + break; + case GL_FOG_COLOR: + if (TEST_EQ_4V(ctx->Fog.Color, params)) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.Color[0] = CLAMP(params[0], 0.0F, 1.0F); + ctx->Fog.Color[1] = CLAMP(params[1], 0.0F, 1.0F); + ctx->Fog.Color[2] = CLAMP(params[2], 0.0F, 1.0F); + ctx->Fog.Color[3] = CLAMP(params[3], 0.0F, 1.0F); + break; + case GL_FOG_COORDINATE_SOURCE_EXT: { + GLenum p = (GLenum) (GLint) *params; + if (!ctx->Extensions.EXT_fog_coord || + (p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glFog"); + return; + } + if (ctx->Fog.FogCoordinateSource == p) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.FogCoordinateSource = p; + break; + } + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glFog" ); + return; + } + + if (ctx->Driver.Fogfv) { + (*ctx->Driver.Fogfv)( ctx, pname, params ); + } +} + + +/**********************************************************************/ +/***** Initialization *****/ +/**********************************************************************/ + +void _mesa_init_fog( GLcontext * ctx ) +{ + /* Fog group */ + ctx->Fog.Enabled = GL_FALSE; + ctx->Fog.Mode = GL_EXP; + ASSIGN_4V( ctx->Fog.Color, 0.0, 0.0, 0.0, 0.0 ); + ctx->Fog.Index = 0.0; + ctx->Fog.Density = 1.0; + ctx->Fog.Start = 0.0; + ctx->Fog.End = 1.0; + ctx->Fog.ColorSumEnabled = GL_FALSE; + ctx->Fog.FogCoordinateSource = GL_FRAGMENT_DEPTH_EXT; +} diff --git a/reactos/dll/mesa32/src/main/fog.h b/reactos/dll/mesa32/src/main/fog.h new file mode 100644 index 00000000000..a14d19cdb39 --- /dev/null +++ b/reactos/dll/mesa32/src/main/fog.h @@ -0,0 +1,66 @@ +/** + * \file fog.h + * Fog operations. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * 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 FOG_H +#define FOG_H + + +#include "mtypes.h" + + +#if _HAVE_FULL_GL + +extern void GLAPIENTRY +_mesa_Fogf(GLenum pname, GLfloat param); + +extern void GLAPIENTRY +_mesa_Fogi(GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_Fogfv(GLenum pname, const GLfloat *params ); + +extern void GLAPIENTRY +_mesa_Fogiv(GLenum pname, const GLint *params ); + +extern void _mesa_init_fog( GLcontext * ctx ); + +#else + +/** No-op */ +#define _mesa_init_fog( c ) ((void)0) + +#endif + +#endif diff --git a/reactos/dll/mesa32/src/main/framebuffer.c b/reactos/dll/mesa32/src/main/framebuffer.c new file mode 100644 index 00000000000..c3c9ca5ed2a --- /dev/null +++ b/reactos/dll/mesa32/src/main/framebuffer.c @@ -0,0 +1,527 @@ +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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. + */ + + +/** + * Functions for allocating/managing framebuffers and renderbuffers. + * Also, routines for reading/writing renderbuffer data as ubytes, + * ushorts, uints, etc. + */ + + +#include "glheader.h" +#include "imports.h" +#include "context.h" +#include "mtypes.h" +#include "fbobject.h" +#include "framebuffer.h" +#include "renderbuffer.h" + + + +/** + * Compute/set the _DepthMax field for the given framebuffer. + * This value depends on the Z buffer resolution. + */ +static void +compute_depth_max(struct gl_framebuffer *fb) +{ + if (fb->Visual.depthBits == 0) { + /* Special case. Even if we don't have a depth buffer we need + * good values for DepthMax for Z vertex transformation purposes + * and for per-fragment fog computation. + */ + fb->_DepthMax = (1 << 16) - 1; + } + else if (fb->Visual.depthBits < 32) { + fb->_DepthMax = (1 << fb->Visual.depthBits) - 1; + } + else { + /* Special case since shift values greater than or equal to the + * number of bits in the left hand expression's type are undefined. + */ + fb->_DepthMax = 0xffffffff; + } + fb->_DepthMaxF = (GLfloat) fb->_DepthMax; + fb->_MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */ +} + + +/** + * Create and initialize a gl_framebuffer object. + * This is intended for creating _window_system_ framebuffers, not generic + * framebuffer objects ala GL_EXT_framebuffer_object. + * + * \sa _mesa_new_framebuffer + */ +struct gl_framebuffer * +_mesa_create_framebuffer(const GLvisual *visual) +{ + struct gl_framebuffer *fb = CALLOC_STRUCT(gl_framebuffer); + assert(visual); + if (fb) { + _mesa_initialize_framebuffer(fb, visual); + } + return fb; +} + + +/** + * Allocate a new gl_framebuffer object. + * This is the default function for ctx->Driver.NewFramebuffer(). + * This is for allocating user-created framebuffers, not window-system + * framebuffers! + * \sa _mesa_create_framebuffer + */ +struct gl_framebuffer * +_mesa_new_framebuffer(GLcontext *ctx, GLuint name) +{ + struct gl_framebuffer *fb; + assert(name != 0); + fb = CALLOC_STRUCT(gl_framebuffer); + if (fb) { + fb->Name = name; + fb->RefCount = 1; + fb->Delete = _mesa_destroy_framebuffer; + fb->ColorDrawBuffer[0] = GL_COLOR_ATTACHMENT0_EXT; + fb->_ColorDrawBufferMask[0] = BUFFER_BIT_COLOR0; + fb->ColorReadBuffer = GL_COLOR_ATTACHMENT0_EXT; + fb->_ColorReadBufferMask = BUFFER_BIT_COLOR0; + fb->Delete = _mesa_destroy_framebuffer; + } + return fb; +} + + +/** + * Initialize a gl_framebuffer object. + * \sa _mesa_create_framebuffer + */ +void +_mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual *visual) +{ + assert(fb); + assert(visual); + + _mesa_bzero(fb, sizeof(struct gl_framebuffer)); + + /* save the visual */ + fb->Visual = *visual; + + /* Init glRead/DrawBuffer state */ + if (visual->doubleBufferMode) { + fb->ColorDrawBuffer[0] = GL_BACK; + fb->_ColorDrawBufferMask[0] = BUFFER_BIT_BACK_LEFT; + fb->ColorReadBuffer = GL_BACK; + fb->_ColorReadBufferMask = BUFFER_BIT_BACK_LEFT; + } + else { + fb->ColorDrawBuffer[0] = GL_FRONT; + fb->_ColorDrawBufferMask[0] = BUFFER_BIT_FRONT_LEFT; + fb->ColorReadBuffer = GL_FRONT; + fb->_ColorReadBufferMask = BUFFER_BIT_FRONT_LEFT; + } + + fb->Delete = _mesa_destroy_framebuffer; + fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT; + + compute_depth_max(fb); +} + + +/** + * 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) { + if (fb->Visual.rgbMode) { + 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); + } + else { + _mesa_add_color_index_renderbuffers(NULL, fb, + fb->Visual.indexBits, + 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.rgbMode); + 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.rgbMode); + assert(fb->Visual.numAuxBuffers > 0); + _mesa_add_aux_renderbuffers(NULL, fb, fb->Visual.redBits, + fb->Visual.numAuxBuffers); + } + +#if 1 + if (alpha) { + assert(fb->Visual.rgbMode); + assert(fb->Visual.alphaBits > 0); + _mesa_add_alpha_renderbuffers(NULL, fb, fb->Visual.alphaBits, + frontLeft, backLeft, + frontRight, backRight); + } +#endif + +#if 0 + if (multisample) { + /* maybe someday */ + } +#endif +} + + +/** + * Deallocate buffer and everything attached to it. + */ +void +_mesa_destroy_framebuffer(struct gl_framebuffer *buffer) +{ + if (buffer) { + _mesa_free_framebuffer_data(buffer); + FREE(buffer); + } +} + + +/** + * Free all the data hanging off the given gl_framebuffer, but don't free + * the gl_framebuffer object itself. + */ +void +_mesa_free_framebuffer_data(struct gl_framebuffer *fb) +{ + GLuint i; + + assert(fb); + + for (i = 0; i < BUFFER_COUNT; i++) { + struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; + if (att->Type == GL_RENDERBUFFER_EXT && att->Renderbuffer) { + struct gl_renderbuffer *rb = att->Renderbuffer; + rb->RefCount--; + if (rb->RefCount == 0) { + rb->Delete(rb); + } + } + att->Type = GL_NONE; + att->Renderbuffer = NULL; + } +} + + +/** + * Resize the given framebuffer's renderbuffers to the new width and height. + * This should only be used for window-system framebuffers, not + * user-created renderbuffers (i.e. made with GL_EXT_framebuffer_object). + * This will typically be called via ctx->Driver.ResizeBuffers() + */ +void +_mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, + GLuint width, GLuint height) +{ + GLuint i; + + /* For window system framebuffers, Name is zero */ + assert(fb->Name == 0); + + for (i = 0; i < BUFFER_COUNT; i++) { + struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; + if (att->Type == GL_RENDERBUFFER_EXT && att->Renderbuffer) { + struct gl_renderbuffer *rb = att->Renderbuffer; + /* only resize if size is changing */ + if (rb->Width != width || rb->Height != height) { + if (rb->AllocStorage(ctx, rb, rb->InternalFormat, width, height)) { + rb->Width = width; + rb->Height = height; + } + else { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "Resizing framebuffer"); + } + } + } + } + + fb->Width = width; + fb->Height = height; + + /* to update scissor / window bounds */ + ctx->NewState |= _NEW_BUFFERS; +} + + +/** + * Examine all the framebuffer's renderbuffers to update the Width/Height + * fields of the framebuffer. If we have renderbuffers with different + * sizes, set the framebuffer's width and height to zero. + * Note: this is only intended for user-created framebuffers, not + * window-system framebuffes. + */ +static void +update_framebuffer_size(struct gl_framebuffer *fb) +{ + GLboolean haveSize = GL_FALSE; + GLuint i; + + /* user-created framebuffers only */ + assert(fb->Name); + + for (i = 0; i < BUFFER_COUNT; i++) { + struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; + const struct gl_renderbuffer *rb = att->Renderbuffer; + if (rb) { + if (haveSize) { + if (rb->Width != fb->Width && rb->Height != fb->Height) { + /* size mismatch! */ + fb->Width = 0; + fb->Height = 0; + return; + } + } + else { + fb->Width = rb->Width; + fb->Height = rb->Height; + haveSize = GL_TRUE; + } + } + } +} + + +/** + * Update the context's current drawing buffer's Xmin, Xmax, Ymin, Ymax fields. + * These values are computed from the buffer's width and height and + * the scissor box, if it's enabled. + * \param ctx the GL context. + */ +void +_mesa_update_draw_buffer_bounds(GLcontext *ctx) +{ + struct gl_framebuffer *buffer = ctx->DrawBuffer; + + if (buffer->Name) { + /* user-created framebuffer size depends on the renderbuffers */ + update_framebuffer_size(buffer); + } + + buffer->_Xmin = 0; + buffer->_Ymin = 0; + buffer->_Xmax = buffer->Width; + buffer->_Ymax = buffer->Height; + + if (ctx->Scissor.Enabled) { + if (ctx->Scissor.X > buffer->_Xmin) { + buffer->_Xmin = ctx->Scissor.X; + } + if (ctx->Scissor.Y > buffer->_Ymin) { + buffer->_Ymin = ctx->Scissor.Y; + } + if (ctx->Scissor.X + ctx->Scissor.Width < buffer->_Xmax) { + buffer->_Xmax = ctx->Scissor.X + ctx->Scissor.Width; + } + if (ctx->Scissor.Y + ctx->Scissor.Height < buffer->_Ymax) { + buffer->_Ymax = ctx->Scissor.Y + ctx->Scissor.Height; + } + /* finally, check for empty region */ + if (buffer->_Xmin > buffer->_Xmax) { + buffer->_Xmin = buffer->_Xmax; + } + if (buffer->_Ymin > buffer->_Ymax) { + buffer->_Ymin = buffer->_Ymax; + } + } + + ASSERT(buffer->_Xmin <= buffer->_Xmax); + ASSERT(buffer->_Ymin <= buffer->_Ymax); +} + + +/** + * The glGet queries of the framebuffer red/green/blue size, stencil size, + * etc. are satisfied by the fields of ctx->DrawBuffer->Visual. These can + * change depending on the renderbuffer bindings. This function update's + * the given framebuffer's Visual from the current renderbuffer bindings. + * This is only intended for user-created framebuffers. + */ +void +_mesa_update_framebuffer_visual(struct gl_framebuffer *fb) +{ + GLuint i; + + assert(fb->Name != 0); + + _mesa_bzero(&fb->Visual, sizeof(fb->Visual)); + fb->Visual.rgbMode = GL_TRUE; + + /* find first RGB or CI renderbuffer */ + for (i = 0; i < BUFFER_COUNT; i++) { + if (fb->Attachment[i].Renderbuffer) { + const struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer; + if (rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB) { + fb->Visual.redBits = rb->ComponentSizes[0]; + fb->Visual.greenBits = rb->ComponentSizes[1]; + fb->Visual.blueBits = rb->ComponentSizes[2]; + fb->Visual.alphaBits = rb->ComponentSizes[3]; + fb->Visual.floatMode = GL_FALSE; + break; + } + else if (rb->_BaseFormat == GL_COLOR_INDEX) { + fb->Visual.indexBits = rb->ComponentSizes[0]; + fb->Visual.rgbMode = GL_FALSE; + break; + } + } + } + + if (fb->Attachment[BUFFER_DEPTH].Renderbuffer) { + fb->Visual.haveDepthBuffer = GL_TRUE; + fb->Visual.depthBits + = fb->Attachment[BUFFER_DEPTH].Renderbuffer->ComponentSizes[0]; + } + + if (fb->Attachment[BUFFER_STENCIL].Renderbuffer) { + fb->Visual.haveStencilBuffer = GL_TRUE; + fb->Visual.stencilBits + = fb->Attachment[BUFFER_STENCIL].Renderbuffer->ComponentSizes[0]; + } + + compute_depth_max(fb); +} + + +/** + * Given a framebuffer and a buffer bit (like BUFFER_BIT_FRONT_LEFT), return + * the corresponding renderbuffer. + */ +static struct gl_renderbuffer * +get_renderbuffer(struct gl_framebuffer *fb, GLuint bufferBit) +{ + GLuint index; + for (index = 0; index < BUFFER_COUNT; index++) { + if ((1 << index) == bufferBit) { + return fb->Attachment[index].Renderbuffer; + } + } + _mesa_problem(NULL, "Bad bufferBit in get_renderbuffer"); + return NULL; +} + + +/** + * Update state related to the current draw/read framebuffers. + * If the current framebuffer is user-created, make sure it's complete. + */ +void +_mesa_update_framebuffer(GLcontext *ctx) +{ + struct gl_framebuffer *fb = ctx->DrawBuffer; + GLuint output; + + /* Completeness only matters for user-created framebuffers */ + if (fb->Name != 0) { + _mesa_test_framebuffer_completeness(ctx, fb); + _mesa_update_framebuffer_visual(fb); + } + + /* + * Update the list of drawing renderbuffer pointers. + * Later, when we're rendering we'll loop from 0 to _NumColorDrawBuffers + * writing colors. We have a loop because glDrawBuffer(GL_FRONT_AND_BACK) + * can specify writing to two or four color buffers. + */ + for (output = 0; output < ctx->Const.MaxDrawBuffers; output++) { + GLuint bufferMask = fb->_ColorDrawBufferMask[output]; + GLuint count = 0; + GLuint bufferBit; + /* for each bit that's set in the bufferMask... */ + for (bufferBit = 1; bufferMask; bufferBit <<= 1) { + if (bufferBit & bufferMask) { + struct gl_renderbuffer *rb = get_renderbuffer(fb, bufferBit); + if (rb) { + fb->_ColorDrawBuffers[output][count] = rb; + fb->_ColorDrawBit[output][count] = bufferBit; + count++; + } + else { + /*_mesa_warning(ctx, "DrawBuffer names a missing buffer!");*/ + } + bufferMask &= ~bufferBit; + } + } + fb->_NumColorDrawBuffers[output] = count; + } + + /* + * Update the read renderbuffer pointer. + * Unlike the DrawBuffer, we can only read from one (or zero) color buffers. + */ + if (fb->_ColorReadBufferMask == 0x0) + fb->_ColorReadBuffer = NULL; /* legal! */ + else + fb->_ColorReadBuffer = get_renderbuffer(fb, fb->_ColorReadBufferMask); + + compute_depth_max(fb); +} diff --git a/reactos/dll/mesa32/src/main/framebuffer.h b/reactos/dll/mesa32/src/main/framebuffer.h new file mode 100644 index 00000000000..11b002877c9 --- /dev/null +++ b/reactos/dll/mesa32/src/main/framebuffer.h @@ -0,0 +1,67 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 FRAMEBUFFER_H +#define FRAMEBUFFER_H + + +extern struct gl_framebuffer * +_mesa_create_framebuffer(const GLvisual *visual); + +extern struct gl_framebuffer * +_mesa_new_framebuffer(GLcontext *ctx, GLuint name); + +extern void +_mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual *visual); + +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_destroy_framebuffer(struct gl_framebuffer *buffer); + +extern void +_mesa_free_framebuffer_data(struct gl_framebuffer *buffer); + +extern void +_mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *b, + GLuint width, GLuint height); + +extern void +_mesa_update_draw_buffer_bounds(GLcontext *ctx); + +extern void +_mesa_update_framebuffer_visual(struct gl_framebuffer *fb); + +extern void +_mesa_update_framebuffer(GLcontext *ctx); + +#endif /* FRAMEBUFFER_H */ diff --git a/reactos/dll/mesa32/src/main/get.c b/reactos/dll/mesa32/src/main/get.c new file mode 100644 index 00000000000..f5b98196746 --- /dev/null +++ b/reactos/dll/mesa32/src/main/get.c @@ -0,0 +1,5646 @@ + +/*** + *** NOTE!!! DO NOT EDIT THIS FILE!!! IT IS GENERATED BY get_gen.py + ***/ + +#include "glheader.h" +#include "context.h" +#include "enable.h" +#include "extensions.h" +#include "fbobject.h" +#include "get.h" +#include "macros.h" +#include "mtypes.h" +#include "state.h" +#include "texcompress.h" + + +#define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE ) + +#define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE ) + +#define ENUM_TO_BOOLEAN(E) ( (E) ? GL_TRUE : GL_FALSE ) +#define ENUM_TO_INT(E) ( (GLint) (E) ) +#define ENUM_TO_FLOAT(E) ( (GLfloat) (E) ) + +#define BOOLEAN_TO_INT(B) ( (GLint) (B) ) +#define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F ) + + +/* Check if named extension is enabled, if not generate error and return */ + +#define CHECK1(E1, str, PNAME) \ + if (!ctx->Extensions.E1) { \ + _mesa_error(ctx, GL_INVALID_VALUE, \ + "glGet" str "v(0x%x)", (int) PNAME); \ + return; \ + } + +#define CHECK2(E1, E2, str, PNAME) \ + if (!ctx->Extensions.E1 && !ctx->Extensions.E2) { \ + _mesa_error(ctx, GL_INVALID_VALUE, \ + "glGet" str "v(0x%x)", (int) PNAME); \ + return; \ + } + +#define CHECK_EXTENSION_B(EXTNAME, PNAME) \ + CHECK1(EXTNAME, "Boolean", PNAME ) + +#define CHECK_EXTENSION_I(EXTNAME, PNAME) \ + CHECK1(EXTNAME, "Integer", PNAME ) + +#define CHECK_EXTENSION_F(EXTNAME, PNAME) \ + CHECK1(EXTNAME, "Float", PNAME ) + + +/** + * Helper routine. + */ +static GLenum +pixel_texgen_mode(const GLcontext *ctx) +{ + if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_POSITION) { + if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { + return GL_RGBA; + } + else { + return GL_RGB; + } + } + else { + if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { + return GL_ALPHA; + } + else { + return GL_NONE; + } + } +} + +void GLAPIENTRY +_mesa_GetBooleanv( GLenum pname, GLboolean *params ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!params) + return; + + if (ctx->NewState) + _mesa_update_state(ctx); + + if (ctx->Driver.GetBooleanv && + ctx->Driver.GetBooleanv(ctx, pname, params)) + return; + + switch (pname) { + case GL_ACCUM_RED_BITS: + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumRedBits); + break; + case GL_ACCUM_GREEN_BITS: + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumGreenBits); + break; + case GL_ACCUM_BLUE_BITS: + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumBlueBits); + break; + case GL_ACCUM_ALPHA_BITS: + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumAlphaBits); + break; + case GL_ACCUM_CLEAR_VALUE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[0]); + params[1] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[1]); + params[2] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[2]); + params[3] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[3]); + break; + case GL_ALPHA_BIAS: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaBias); + break; + case GL_ALPHA_BITS: + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.alphaBits); + break; + case GL_ALPHA_SCALE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaScale); + break; + case GL_ALPHA_TEST: + params[0] = ctx->Color.AlphaEnabled; + break; + case GL_ALPHA_TEST_FUNC: + params[0] = ENUM_TO_BOOLEAN(ctx->Color.AlphaFunc); + break; + case GL_ALPHA_TEST_REF: + params[0] = FLOAT_TO_BOOLEAN(ctx->Color.AlphaRef); + break; + case GL_ATTRIB_STACK_DEPTH: + params[0] = INT_TO_BOOLEAN(ctx->AttribStackDepth); + break; + case GL_AUTO_NORMAL: + params[0] = ctx->Eval.AutoNormal; + break; + case GL_AUX_BUFFERS: + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.numAuxBuffers); + break; + case GL_BLEND: + params[0] = ctx->Color.BlendEnabled; + break; + case GL_BLEND_DST: + params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstRGB); + break; + case GL_BLEND_SRC: + params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcRGB); + break; + case GL_BLEND_SRC_RGB_EXT: + params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcRGB); + break; + case GL_BLEND_DST_RGB_EXT: + params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstRGB); + break; + case GL_BLEND_SRC_ALPHA_EXT: + params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcA); + break; + case GL_BLEND_DST_ALPHA_EXT: + params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstA); + break; + case GL_BLEND_EQUATION: + params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendEquationRGB ); + break; + case GL_BLEND_EQUATION_ALPHA_EXT: + params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendEquationA ); + break; + case GL_BLEND_COLOR_EXT: + params[0] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[0]); + params[1] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[1]); + params[2] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[2]); + params[3] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[3]); + break; + case GL_BLUE_BIAS: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueBias); + break; + case GL_BLUE_BITS: + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.blueBits); + break; + case GL_BLUE_SCALE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueScale); + break; + case GL_CLIENT_ATTRIB_STACK_DEPTH: + params[0] = INT_TO_BOOLEAN(ctx->ClientAttribStackDepth); + break; + case GL_CLIP_PLANE0: + params[0] = (ctx->Transform.ClipPlanesEnabled >> 0) & 1; + break; + case GL_CLIP_PLANE1: + params[0] = (ctx->Transform.ClipPlanesEnabled >> 1) & 1; + break; + case GL_CLIP_PLANE2: + params[0] = (ctx->Transform.ClipPlanesEnabled >> 2) & 1; + break; + case GL_CLIP_PLANE3: + params[0] = (ctx->Transform.ClipPlanesEnabled >> 3) & 1; + break; + case GL_CLIP_PLANE4: + params[0] = (ctx->Transform.ClipPlanesEnabled >> 4) & 1; + break; + case GL_CLIP_PLANE5: + params[0] = (ctx->Transform.ClipPlanesEnabled >> 5) & 1; + break; + case GL_COLOR_CLEAR_VALUE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[0]); + params[1] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[1]); + params[2] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[2]); + params[3] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[3]); + break; + case GL_COLOR_MATERIAL: + params[0] = ctx->Light.ColorMaterialEnabled; + break; + case GL_COLOR_MATERIAL_FACE: + params[0] = ENUM_TO_BOOLEAN(ctx->Light.ColorMaterialFace); + break; + case GL_COLOR_MATERIAL_PARAMETER: + params[0] = ENUM_TO_BOOLEAN(ctx->Light.ColorMaterialMode); + break; + case GL_COLOR_WRITEMASK: + params[0] = INT_TO_BOOLEAN(ctx->Color.ColorMask[RCOMP] ? 1 : 0); + params[1] = INT_TO_BOOLEAN(ctx->Color.ColorMask[GCOMP] ? 1 : 0); + params[2] = INT_TO_BOOLEAN(ctx->Color.ColorMask[BCOMP] ? 1 : 0); + params[3] = INT_TO_BOOLEAN(ctx->Color.ColorMask[ACOMP] ? 1 : 0); + break; + case GL_CULL_FACE: + params[0] = ctx->Polygon.CullFlag; + break; + case GL_CULL_FACE_MODE: + params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.CullFaceMode); + break; + case GL_CURRENT_COLOR: + { + FLUSH_CURRENT(ctx, 0); + params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); + params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); + params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); + params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); + } + break; + case GL_CURRENT_INDEX: + { + FLUSH_CURRENT(ctx, 0); + params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Index); + } + break; + case GL_CURRENT_NORMAL: + { + FLUSH_CURRENT(ctx, 0); + params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); + params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); + params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); + } + break; + case GL_CURRENT_RASTER_COLOR: + params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[0]); + params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[1]); + params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[2]); + params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[3]); + break; + case GL_CURRENT_RASTER_DISTANCE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterDistance); + break; + case GL_CURRENT_RASTER_INDEX: + params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterIndex); + break; + case GL_CURRENT_RASTER_POSITION: + params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[0]); + params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[1]); + params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[2]); + params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[3]); + break; + case GL_CURRENT_RASTER_TEXTURE_COORDS: + { + const GLuint texUnit = ctx->Texture.CurrentUnit; + params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][0]); + params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][1]); + params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][2]); + params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][3]); + } + break; + case GL_CURRENT_RASTER_POSITION_VALID: + params[0] = ctx->Current.RasterPosValid; + break; + case GL_CURRENT_TEXTURE_COORDS: + { + const GLuint texUnit = ctx->Texture.CurrentUnit; + params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]); + params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]); + params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]); + params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]); + } + break; + case GL_DEPTH_BIAS: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.DepthBias); + break; + case GL_DEPTH_BITS: + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.depthBits); + break; + case GL_DEPTH_CLEAR_VALUE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.Clear); + break; + case GL_DEPTH_FUNC: + params[0] = ENUM_TO_BOOLEAN(ctx->Depth.Func); + break; + case GL_DEPTH_RANGE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Viewport.Near); + params[1] = FLOAT_TO_BOOLEAN(ctx->Viewport.Far); + break; + case GL_DEPTH_SCALE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.DepthScale); + break; + case GL_DEPTH_TEST: + params[0] = ctx->Depth.Test; + break; + case GL_DEPTH_WRITEMASK: + params[0] = ctx->Depth.Mask; + break; + case GL_DITHER: + params[0] = ctx->Color.DitherFlag; + break; + case GL_DOUBLEBUFFER: + params[0] = ctx->DrawBuffer->Visual.doubleBufferMode; + break; + case GL_DRAW_BUFFER: + params[0] = ENUM_TO_BOOLEAN(ctx->Color.DrawBuffer[0]); + break; + case GL_EDGE_FLAG: + { + FLUSH_CURRENT(ctx, 0); + params[0] = ctx->Current.EdgeFlag; + } + break; + case GL_FEEDBACK_BUFFER_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Feedback.BufferSize); + break; + case GL_FEEDBACK_BUFFER_TYPE: + params[0] = ENUM_TO_BOOLEAN(ctx->Feedback.Type); + break; + case GL_FOG: + params[0] = ctx->Fog.Enabled; + break; + case GL_FOG_COLOR: + params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[0]); + params[1] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[1]); + params[2] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[2]); + params[3] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[3]); + break; + case GL_FOG_DENSITY: + params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Density); + break; + case GL_FOG_END: + params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.End); + break; + case GL_FOG_HINT: + params[0] = ENUM_TO_BOOLEAN(ctx->Hint.Fog); + break; + case GL_FOG_INDEX: + params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Index); + break; + case GL_FOG_MODE: + params[0] = ENUM_TO_BOOLEAN(ctx->Fog.Mode); + break; + case GL_FOG_START: + params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Start); + break; + case GL_FRONT_FACE: + params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.FrontFace); + break; + case GL_GREEN_BIAS: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenBias); + break; + case GL_GREEN_BITS: + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.greenBits); + break; + case GL_GREEN_SCALE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenScale); + break; + case GL_INDEX_BITS: + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.indexBits); + break; + case GL_INDEX_CLEAR_VALUE: + params[0] = INT_TO_BOOLEAN(ctx->Color.ClearIndex); + break; + case GL_INDEX_MODE: + params[0] = !ctx->DrawBuffer->Visual.rgbMode; + break; + case GL_INDEX_OFFSET: + params[0] = INT_TO_BOOLEAN(ctx->Pixel.IndexOffset); + break; + case GL_INDEX_SHIFT: + params[0] = INT_TO_BOOLEAN(ctx->Pixel.IndexShift); + break; + case GL_INDEX_WRITEMASK: + params[0] = INT_TO_BOOLEAN(ctx->Color.IndexMask); + break; + case GL_LIGHT0: + params[0] = ctx->Light.Light[0].Enabled; + break; + case GL_LIGHT1: + params[0] = ctx->Light.Light[1].Enabled; + break; + case GL_LIGHT2: + params[0] = ctx->Light.Light[2].Enabled; + break; + case GL_LIGHT3: + params[0] = ctx->Light.Light[3].Enabled; + break; + case GL_LIGHT4: + params[0] = ctx->Light.Light[4].Enabled; + break; + case GL_LIGHT5: + params[0] = ctx->Light.Light[5].Enabled; + break; + case GL_LIGHT6: + params[0] = ctx->Light.Light[6].Enabled; + break; + case GL_LIGHT7: + params[0] = ctx->Light.Light[7].Enabled; + break; + case GL_LIGHTING: + params[0] = ctx->Light.Enabled; + break; + case GL_LIGHT_MODEL_AMBIENT: + params[0] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[0]); + params[1] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[1]); + params[2] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[2]); + params[3] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[3]); + break; + case GL_LIGHT_MODEL_COLOR_CONTROL: + params[0] = ENUM_TO_BOOLEAN(ctx->Light.Model.ColorControl); + break; + case GL_LIGHT_MODEL_LOCAL_VIEWER: + params[0] = ctx->Light.Model.LocalViewer; + break; + case GL_LIGHT_MODEL_TWO_SIDE: + params[0] = ctx->Light.Model.TwoSide; + break; + case GL_LINE_SMOOTH: + params[0] = ctx->Line.SmoothFlag; + break; + case GL_LINE_SMOOTH_HINT: + params[0] = ENUM_TO_BOOLEAN(ctx->Hint.LineSmooth); + break; + case GL_LINE_STIPPLE: + params[0] = ctx->Line.StippleFlag; + break; + case GL_LINE_STIPPLE_PATTERN: + params[0] = INT_TO_BOOLEAN(ctx->Line.StipplePattern); + break; + case GL_LINE_STIPPLE_REPEAT: + params[0] = INT_TO_BOOLEAN(ctx->Line.StippleFactor); + break; + case GL_LINE_WIDTH: + params[0] = FLOAT_TO_BOOLEAN(ctx->Line.Width); + break; + case GL_LINE_WIDTH_GRANULARITY: + params[0] = FLOAT_TO_BOOLEAN(ctx->Const.LineWidthGranularity); + break; + case GL_LINE_WIDTH_RANGE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinLineWidthAA); + params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxLineWidthAA); + break; + case GL_ALIASED_LINE_WIDTH_RANGE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinLineWidth); + params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxLineWidth); + break; + case GL_LIST_BASE: + params[0] = INT_TO_BOOLEAN(ctx->List.ListBase); + break; + case GL_LIST_INDEX: + params[0] = INT_TO_BOOLEAN(ctx->ListState.CurrentListNum); + break; + case GL_LIST_MODE: + { + GLenum mode; + if (!ctx->CompileFlag) + mode = 0; + else if (ctx->ExecuteFlag) + mode = GL_COMPILE_AND_EXECUTE; + else + mode = GL_COMPILE; + params[0] = ENUM_TO_BOOLEAN(mode); + } + break; + case GL_INDEX_LOGIC_OP: + params[0] = ctx->Color.IndexLogicOpEnabled; + break; + case GL_COLOR_LOGIC_OP: + params[0] = ctx->Color.ColorLogicOpEnabled; + break; + case GL_LOGIC_OP_MODE: + params[0] = ENUM_TO_BOOLEAN(ctx->Color.LogicOp); + break; + case GL_MAP1_COLOR_4: + params[0] = ctx->Eval.Map1Color4; + break; + case GL_MAP1_GRID_DOMAIN: + params[0] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid1u1); + params[1] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid1u2); + break; + case GL_MAP1_GRID_SEGMENTS: + params[0] = INT_TO_BOOLEAN(ctx->Eval.MapGrid1un); + break; + case GL_MAP1_INDEX: + params[0] = ctx->Eval.Map1Index; + break; + case GL_MAP1_NORMAL: + params[0] = ctx->Eval.Map1Normal; + break; + case GL_MAP1_TEXTURE_COORD_1: + params[0] = ctx->Eval.Map1TextureCoord1; + break; + case GL_MAP1_TEXTURE_COORD_2: + params[0] = ctx->Eval.Map1TextureCoord2; + break; + case GL_MAP1_TEXTURE_COORD_3: + params[0] = ctx->Eval.Map1TextureCoord3; + break; + case GL_MAP1_TEXTURE_COORD_4: + params[0] = ctx->Eval.Map1TextureCoord4; + break; + case GL_MAP1_VERTEX_3: + params[0] = ctx->Eval.Map1Vertex3; + break; + case GL_MAP1_VERTEX_4: + params[0] = ctx->Eval.Map1Vertex4; + break; + case GL_MAP2_COLOR_4: + params[0] = ctx->Eval.Map2Color4; + break; + case GL_MAP2_GRID_DOMAIN: + params[0] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2u1); + params[1] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2u2); + params[2] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2v1); + params[3] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2v2); + break; + case GL_MAP2_GRID_SEGMENTS: + params[0] = INT_TO_BOOLEAN(ctx->Eval.MapGrid2un); + params[1] = INT_TO_BOOLEAN(ctx->Eval.MapGrid2vn); + break; + case GL_MAP2_INDEX: + params[0] = ctx->Eval.Map2Index; + break; + case GL_MAP2_NORMAL: + params[0] = ctx->Eval.Map2Normal; + break; + case GL_MAP2_TEXTURE_COORD_1: + params[0] = ctx->Eval.Map2TextureCoord1; + break; + case GL_MAP2_TEXTURE_COORD_2: + params[0] = ctx->Eval.Map2TextureCoord2; + break; + case GL_MAP2_TEXTURE_COORD_3: + params[0] = ctx->Eval.Map2TextureCoord3; + break; + case GL_MAP2_TEXTURE_COORD_4: + params[0] = ctx->Eval.Map2TextureCoord4; + break; + case GL_MAP2_VERTEX_3: + params[0] = ctx->Eval.Map2Vertex3; + break; + case GL_MAP2_VERTEX_4: + params[0] = ctx->Eval.Map2Vertex4; + break; + case GL_MAP_COLOR: + params[0] = ctx->Pixel.MapColorFlag; + break; + case GL_MAP_STENCIL: + params[0] = ctx->Pixel.MapStencilFlag; + break; + case GL_MATRIX_MODE: + params[0] = ENUM_TO_BOOLEAN(ctx->Transform.MatrixMode); + break; + case GL_MAX_ATTRIB_STACK_DEPTH: + params[0] = INT_TO_BOOLEAN(MAX_ATTRIB_STACK_DEPTH); + break; + case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: + params[0] = INT_TO_BOOLEAN(MAX_CLIENT_ATTRIB_STACK_DEPTH); + break; + case GL_MAX_CLIP_PLANES: + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxClipPlanes); + break; + case GL_MAX_ELEMENTS_VERTICES: + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayLockSize); + break; + case GL_MAX_ELEMENTS_INDICES: + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayLockSize); + break; + case GL_MAX_EVAL_ORDER: + params[0] = INT_TO_BOOLEAN(MAX_EVAL_ORDER); + break; + case GL_MAX_LIGHTS: + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxLights); + break; + case GL_MAX_LIST_NESTING: + params[0] = INT_TO_BOOLEAN(MAX_LIST_NESTING); + break; + case GL_MAX_MODELVIEW_STACK_DEPTH: + params[0] = INT_TO_BOOLEAN(MAX_MODELVIEW_STACK_DEPTH); + break; + case GL_MAX_NAME_STACK_DEPTH: + params[0] = INT_TO_BOOLEAN(MAX_NAME_STACK_DEPTH); + break; + case GL_MAX_PIXEL_MAP_TABLE: + params[0] = INT_TO_BOOLEAN(MAX_PIXEL_MAP_TABLE); + break; + case GL_MAX_PROJECTION_STACK_DEPTH: + params[0] = INT_TO_BOOLEAN(MAX_PROJECTION_STACK_DEPTH); + break; + case GL_MAX_TEXTURE_SIZE: + params[0] = INT_TO_BOOLEAN(1 << (ctx->Const.MaxTextureLevels - 1)); + break; + case GL_MAX_3D_TEXTURE_SIZE: + params[0] = INT_TO_BOOLEAN(1 << (ctx->Const.Max3DTextureLevels - 1)); + break; + case GL_MAX_TEXTURE_STACK_DEPTH: + params[0] = INT_TO_BOOLEAN(MAX_TEXTURE_STACK_DEPTH); + break; + case GL_MAX_VIEWPORT_DIMS: + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxViewportWidth); + params[1] = INT_TO_BOOLEAN(ctx->Const.MaxViewportHeight); + break; + case GL_MODELVIEW_MATRIX: + { + const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; + params[0] = FLOAT_TO_BOOLEAN(matrix[0]); + params[1] = FLOAT_TO_BOOLEAN(matrix[1]); + params[2] = FLOAT_TO_BOOLEAN(matrix[2]); + params[3] = FLOAT_TO_BOOLEAN(matrix[3]); + params[4] = FLOAT_TO_BOOLEAN(matrix[4]); + params[5] = FLOAT_TO_BOOLEAN(matrix[5]); + params[6] = FLOAT_TO_BOOLEAN(matrix[6]); + params[7] = FLOAT_TO_BOOLEAN(matrix[7]); + params[8] = FLOAT_TO_BOOLEAN(matrix[8]); + params[9] = FLOAT_TO_BOOLEAN(matrix[9]); + params[10] = FLOAT_TO_BOOLEAN(matrix[10]); + params[11] = FLOAT_TO_BOOLEAN(matrix[11]); + params[12] = FLOAT_TO_BOOLEAN(matrix[12]); + params[13] = FLOAT_TO_BOOLEAN(matrix[13]); + params[14] = FLOAT_TO_BOOLEAN(matrix[14]); + params[15] = FLOAT_TO_BOOLEAN(matrix[15]); + } + break; + case GL_MODELVIEW_STACK_DEPTH: + params[0] = INT_TO_BOOLEAN(ctx->ModelviewMatrixStack.Depth + 1); + break; + case GL_NAME_STACK_DEPTH: + params[0] = INT_TO_BOOLEAN(ctx->Select.NameStackDepth); + break; + case GL_NORMALIZE: + params[0] = ctx->Transform.Normalize; + break; + case GL_PACK_ALIGNMENT: + params[0] = INT_TO_BOOLEAN(ctx->Pack.Alignment); + break; + case GL_PACK_LSB_FIRST: + params[0] = ctx->Pack.LsbFirst; + break; + case GL_PACK_ROW_LENGTH: + params[0] = INT_TO_BOOLEAN(ctx->Pack.RowLength); + break; + case GL_PACK_SKIP_PIXELS: + params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipPixels); + break; + case GL_PACK_SKIP_ROWS: + params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipRows); + break; + case GL_PACK_SWAP_BYTES: + params[0] = ctx->Pack.SwapBytes; + break; + case GL_PACK_SKIP_IMAGES_EXT: + params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipImages); + break; + case GL_PACK_IMAGE_HEIGHT_EXT: + params[0] = INT_TO_BOOLEAN(ctx->Pack.ImageHeight); + break; + case GL_PACK_INVERT_MESA: + params[0] = ctx->Pack.Invert; + break; + case GL_PERSPECTIVE_CORRECTION_HINT: + params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PerspectiveCorrection); + break; + case GL_PIXEL_MAP_A_TO_A_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapAtoAsize); + break; + case GL_PIXEL_MAP_B_TO_B_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapBtoBsize); + break; + case GL_PIXEL_MAP_G_TO_G_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapGtoGsize); + break; + case GL_PIXEL_MAP_I_TO_A_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoAsize); + break; + case GL_PIXEL_MAP_I_TO_B_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoBsize); + break; + case GL_PIXEL_MAP_I_TO_G_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoGsize); + break; + case GL_PIXEL_MAP_I_TO_I_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoIsize); + break; + case GL_PIXEL_MAP_I_TO_R_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoRsize); + break; + case GL_PIXEL_MAP_R_TO_R_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapRtoRsize); + break; + case GL_PIXEL_MAP_S_TO_S_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapStoSsize); + break; + case GL_POINT_SIZE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Size); + break; + case GL_POINT_SIZE_GRANULARITY: + params[0] = FLOAT_TO_BOOLEAN(ctx->Const.PointSizeGranularity); + break; + case GL_POINT_SIZE_RANGE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinPointSizeAA); + params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxPointSizeAA); + break; + case GL_ALIASED_POINT_SIZE_RANGE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinPointSize); + params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxPointSize); + break; + case GL_POINT_SMOOTH: + params[0] = ctx->Point.SmoothFlag; + break; + case GL_POINT_SMOOTH_HINT: + params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PointSmooth); + break; + case GL_POINT_SIZE_MIN_EXT: + params[0] = FLOAT_TO_BOOLEAN(ctx->Point.MinSize); + break; + case GL_POINT_SIZE_MAX_EXT: + params[0] = FLOAT_TO_BOOLEAN(ctx->Point.MaxSize); + break; + case GL_POINT_FADE_THRESHOLD_SIZE_EXT: + params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Threshold); + break; + case GL_DISTANCE_ATTENUATION_EXT: + params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Params[0]); + params[1] = FLOAT_TO_BOOLEAN(ctx->Point.Params[1]); + params[2] = FLOAT_TO_BOOLEAN(ctx->Point.Params[2]); + break; + case GL_POLYGON_MODE: + params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.FrontMode); + params[1] = ENUM_TO_BOOLEAN(ctx->Polygon.BackMode); + break; + case GL_POLYGON_OFFSET_BIAS_EXT: + params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetUnits); + break; + case GL_POLYGON_OFFSET_FACTOR: + params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetFactor ); + break; + case GL_POLYGON_OFFSET_UNITS: + params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetUnits ); + break; + case GL_POLYGON_SMOOTH: + params[0] = ctx->Polygon.SmoothFlag; + break; + case GL_POLYGON_SMOOTH_HINT: + params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PolygonSmooth); + break; + case GL_POLYGON_STIPPLE: + params[0] = ctx->Polygon.StippleFlag; + break; + case GL_PROJECTION_MATRIX: + { + const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; + params[0] = FLOAT_TO_BOOLEAN(matrix[0]); + params[1] = FLOAT_TO_BOOLEAN(matrix[1]); + params[2] = FLOAT_TO_BOOLEAN(matrix[2]); + params[3] = FLOAT_TO_BOOLEAN(matrix[3]); + params[4] = FLOAT_TO_BOOLEAN(matrix[4]); + params[5] = FLOAT_TO_BOOLEAN(matrix[5]); + params[6] = FLOAT_TO_BOOLEAN(matrix[6]); + params[7] = FLOAT_TO_BOOLEAN(matrix[7]); + params[8] = FLOAT_TO_BOOLEAN(matrix[8]); + params[9] = FLOAT_TO_BOOLEAN(matrix[9]); + params[10] = FLOAT_TO_BOOLEAN(matrix[10]); + params[11] = FLOAT_TO_BOOLEAN(matrix[11]); + params[12] = FLOAT_TO_BOOLEAN(matrix[12]); + params[13] = FLOAT_TO_BOOLEAN(matrix[13]); + params[14] = FLOAT_TO_BOOLEAN(matrix[14]); + params[15] = FLOAT_TO_BOOLEAN(matrix[15]); + } + break; + case GL_PROJECTION_STACK_DEPTH: + params[0] = INT_TO_BOOLEAN(ctx->ProjectionMatrixStack.Depth + 1); + break; + case GL_READ_BUFFER: + params[0] = ENUM_TO_BOOLEAN(ctx->Pixel.ReadBuffer); + break; + case GL_RED_BIAS: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedBias); + break; + case GL_RED_BITS: + params[0] = INT_TO_BOOLEAN( ctx->DrawBuffer->Visual.redBits ); + break; + case GL_RED_SCALE: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedScale); + break; + case GL_RENDER_MODE: + params[0] = ENUM_TO_BOOLEAN(ctx->RenderMode); + break; + case GL_RESCALE_NORMAL: + params[0] = ctx->Transform.RescaleNormals; + break; + case GL_RGBA_MODE: + params[0] = ctx->DrawBuffer->Visual.rgbMode; + break; + case GL_SCISSOR_BOX: + params[0] = INT_TO_BOOLEAN(ctx->Scissor.X); + params[1] = INT_TO_BOOLEAN(ctx->Scissor.Y); + params[2] = INT_TO_BOOLEAN(ctx->Scissor.Width); + params[3] = INT_TO_BOOLEAN(ctx->Scissor.Height); + break; + case GL_SCISSOR_TEST: + params[0] = ctx->Scissor.Enabled; + break; + case GL_SELECTION_BUFFER_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Select.BufferSize); + break; + case GL_SHADE_MODEL: + params[0] = ENUM_TO_BOOLEAN(ctx->Light.ShadeModel); + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + params[0] = ctx->Texture.SharedPalette; + break; + case GL_STENCIL_BITS: + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.stencilBits); + break; + case GL_STENCIL_CLEAR_VALUE: + params[0] = INT_TO_BOOLEAN(ctx->Stencil.Clear); + break; + case GL_STENCIL_FAIL: + params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_FUNC: + params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_PASS_DEPTH_FAIL: + params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_PASS_DEPTH_PASS: + params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_REF: + params[0] = INT_TO_BOOLEAN(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_TEST: + params[0] = ctx->Stencil.Enabled; + break; + case GL_STENCIL_VALUE_MASK: + params[0] = INT_TO_BOOLEAN(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_WRITEMASK: + params[0] = INT_TO_BOOLEAN(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]); + break; + case GL_STEREO: + params[0] = ctx->DrawBuffer->Visual.stereoMode; + break; + case GL_SUBPIXEL_BITS: + params[0] = INT_TO_BOOLEAN(ctx->Const.SubPixelBits); + break; + case GL_TEXTURE_1D: + params[0] = _mesa_IsEnabled(GL_TEXTURE_1D); + break; + case GL_TEXTURE_2D: + params[0] = _mesa_IsEnabled(GL_TEXTURE_2D); + break; + case GL_TEXTURE_3D: + params[0] = _mesa_IsEnabled(GL_TEXTURE_3D); + break; + case GL_TEXTURE_BINDING_1D: + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name); + break; + case GL_TEXTURE_BINDING_2D: + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name); + break; + case GL_TEXTURE_BINDING_3D: + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name); + break; + case GL_TEXTURE_ENV_COLOR: + { + const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; + params[0] = FLOAT_TO_BOOLEAN(color[0]); + params[1] = FLOAT_TO_BOOLEAN(color[1]); + params[2] = FLOAT_TO_BOOLEAN(color[2]); + params[3] = FLOAT_TO_BOOLEAN(color[3]); + } + break; + case GL_TEXTURE_ENV_MODE: + params[0] = ENUM_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode); + break; + case GL_TEXTURE_GEN_S: + params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0); + break; + case GL_TEXTURE_GEN_T: + params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0); + break; + case GL_TEXTURE_GEN_R: + params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0); + break; + case GL_TEXTURE_GEN_Q: + params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0); + break; + case GL_TEXTURE_MATRIX: + { + const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; + params[0] = FLOAT_TO_BOOLEAN(matrix[0]); + params[1] = FLOAT_TO_BOOLEAN(matrix[1]); + params[2] = FLOAT_TO_BOOLEAN(matrix[2]); + params[3] = FLOAT_TO_BOOLEAN(matrix[3]); + params[4] = FLOAT_TO_BOOLEAN(matrix[4]); + params[5] = FLOAT_TO_BOOLEAN(matrix[5]); + params[6] = FLOAT_TO_BOOLEAN(matrix[6]); + params[7] = FLOAT_TO_BOOLEAN(matrix[7]); + params[8] = FLOAT_TO_BOOLEAN(matrix[8]); + params[9] = FLOAT_TO_BOOLEAN(matrix[9]); + params[10] = FLOAT_TO_BOOLEAN(matrix[10]); + params[11] = FLOAT_TO_BOOLEAN(matrix[11]); + params[12] = FLOAT_TO_BOOLEAN(matrix[12]); + params[13] = FLOAT_TO_BOOLEAN(matrix[13]); + params[14] = FLOAT_TO_BOOLEAN(matrix[14]); + params[15] = FLOAT_TO_BOOLEAN(matrix[15]); + } + break; + case GL_TEXTURE_STACK_DEPTH: + params[0] = INT_TO_BOOLEAN(ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1); + break; + case GL_UNPACK_ALIGNMENT: + params[0] = INT_TO_BOOLEAN(ctx->Unpack.Alignment); + break; + case GL_UNPACK_LSB_FIRST: + params[0] = ctx->Unpack.LsbFirst; + break; + case GL_UNPACK_ROW_LENGTH: + params[0] = INT_TO_BOOLEAN(ctx->Unpack.RowLength); + break; + case GL_UNPACK_SKIP_PIXELS: + params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipPixels); + break; + case GL_UNPACK_SKIP_ROWS: + params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipRows); + break; + case GL_UNPACK_SWAP_BYTES: + params[0] = ctx->Unpack.SwapBytes; + break; + case GL_UNPACK_SKIP_IMAGES_EXT: + params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipImages); + break; + case GL_UNPACK_IMAGE_HEIGHT_EXT: + params[0] = INT_TO_BOOLEAN(ctx->Unpack.ImageHeight); + break; + case GL_UNPACK_CLIENT_STORAGE_APPLE: + params[0] = ctx->Unpack.ClientStorage; + break; + case GL_VIEWPORT: + params[0] = INT_TO_BOOLEAN(ctx->Viewport.X); + params[1] = INT_TO_BOOLEAN(ctx->Viewport.Y); + params[2] = INT_TO_BOOLEAN(ctx->Viewport.Width); + params[3] = INT_TO_BOOLEAN(ctx->Viewport.Height); + break; + case GL_ZOOM_X: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.ZoomX); + break; + case GL_ZOOM_Y: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.ZoomY); + break; + case GL_VERTEX_ARRAY: + params[0] = ctx->Array.Vertex.Enabled; + break; + case GL_VERTEX_ARRAY_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Array.Vertex.Size); + break; + case GL_VERTEX_ARRAY_TYPE: + params[0] = ENUM_TO_BOOLEAN(ctx->Array.Vertex.Type); + break; + case GL_VERTEX_ARRAY_STRIDE: + params[0] = INT_TO_BOOLEAN(ctx->Array.Vertex.Stride); + break; + case GL_VERTEX_ARRAY_COUNT_EXT: + params[0] = INT_TO_BOOLEAN(0); + break; + case GL_NORMAL_ARRAY: + params[0] = ENUM_TO_BOOLEAN(ctx->Array.Normal.Enabled); + break; + case GL_NORMAL_ARRAY_TYPE: + params[0] = ENUM_TO_BOOLEAN(ctx->Array.Normal.Type); + break; + case GL_NORMAL_ARRAY_STRIDE: + params[0] = INT_TO_BOOLEAN(ctx->Array.Normal.Stride); + break; + case GL_NORMAL_ARRAY_COUNT_EXT: + params[0] = INT_TO_BOOLEAN(0); + break; + case GL_COLOR_ARRAY: + params[0] = ctx->Array.Color.Enabled; + break; + case GL_COLOR_ARRAY_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Array.Color.Size); + break; + case GL_COLOR_ARRAY_TYPE: + params[0] = ENUM_TO_BOOLEAN(ctx->Array.Color.Type); + break; + case GL_COLOR_ARRAY_STRIDE: + params[0] = INT_TO_BOOLEAN(ctx->Array.Color.Stride); + break; + case GL_COLOR_ARRAY_COUNT_EXT: + params[0] = INT_TO_BOOLEAN(0); + break; + case GL_INDEX_ARRAY: + params[0] = ctx->Array.Index.Enabled; + break; + case GL_INDEX_ARRAY_TYPE: + params[0] = ENUM_TO_BOOLEAN(ctx->Array.Index.Type); + break; + case GL_INDEX_ARRAY_STRIDE: + params[0] = INT_TO_BOOLEAN(ctx->Array.Index.Stride); + break; + case GL_INDEX_ARRAY_COUNT_EXT: + params[0] = INT_TO_BOOLEAN(0); + break; + case GL_TEXTURE_COORD_ARRAY: + params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; + break; + case GL_TEXTURE_COORD_ARRAY_SIZE: + params[0] = INT_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size); + break; + case GL_TEXTURE_COORD_ARRAY_TYPE: + params[0] = ENUM_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type); + break; + case GL_TEXTURE_COORD_ARRAY_STRIDE: + params[0] = INT_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride); + break; + case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: + params[0] = INT_TO_BOOLEAN(0); + break; + case GL_EDGE_FLAG_ARRAY: + params[0] = ctx->Array.EdgeFlag.Enabled; + break; + case GL_EDGE_FLAG_ARRAY_STRIDE: + params[0] = INT_TO_BOOLEAN(ctx->Array.EdgeFlag.Stride); + break; + case GL_EDGE_FLAG_ARRAY_COUNT_EXT: + params[0] = INT_TO_BOOLEAN(0); + break; + case GL_MAX_TEXTURE_UNITS_ARB: + CHECK_EXTENSION_B(ARB_multitexture, pname); + params[0] = INT_TO_BOOLEAN(MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits)); + break; + case GL_ACTIVE_TEXTURE_ARB: + CHECK_EXTENSION_B(ARB_multitexture, pname); + params[0] = INT_TO_BOOLEAN(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); + break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + CHECK_EXTENSION_B(ARB_multitexture, pname); + params[0] = INT_TO_BOOLEAN(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); + break; + case GL_TEXTURE_CUBE_MAP_ARB: + CHECK_EXTENSION_B(ARB_texture_cube_map, pname); + params[0] = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + break; + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + CHECK_EXTENSION_B(ARB_texture_cube_map, pname); + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name); + break; + case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: + CHECK_EXTENSION_B(ARB_texture_cube_map, pname); + params[0] = INT_TO_BOOLEAN((1 << (ctx->Const.MaxCubeTextureLevels - 1))); + break; + case GL_TEXTURE_COMPRESSION_HINT_ARB: + CHECK_EXTENSION_B(ARB_texture_compression, pname); + params[0] = INT_TO_BOOLEAN(ctx->Hint.TextureCompression); + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + CHECK_EXTENSION_B(ARB_texture_compression, pname); + params[0] = INT_TO_BOOLEAN(_mesa_get_compressed_formats(ctx, NULL)); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + CHECK_EXTENSION_B(ARB_texture_compression, pname); + { + GLint formats[100]; + GLuint i, n = _mesa_get_compressed_formats(ctx, formats); + ASSERT(n <= 100); + for (i = 0; i < n; i++) + params[i] = ENUM_TO_INT(formats[i]); + } + break; + case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: + CHECK_EXTENSION_B(EXT_compiled_vertex_array, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.LockFirst); + break; + case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: + CHECK_EXTENSION_B(EXT_compiled_vertex_array, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.LockCount); + break; + case GL_TRANSPOSE_COLOR_MATRIX_ARB: + { + const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; + params[0] = FLOAT_TO_BOOLEAN(matrix[0]); + params[1] = FLOAT_TO_BOOLEAN(matrix[4]); + params[2] = FLOAT_TO_BOOLEAN(matrix[8]); + params[3] = FLOAT_TO_BOOLEAN(matrix[12]); + params[4] = FLOAT_TO_BOOLEAN(matrix[1]); + params[5] = FLOAT_TO_BOOLEAN(matrix[5]); + params[6] = FLOAT_TO_BOOLEAN(matrix[9]); + params[7] = FLOAT_TO_BOOLEAN(matrix[13]); + params[8] = FLOAT_TO_BOOLEAN(matrix[2]); + params[9] = FLOAT_TO_BOOLEAN(matrix[6]); + params[10] = FLOAT_TO_BOOLEAN(matrix[10]); + params[11] = FLOAT_TO_BOOLEAN(matrix[14]); + params[12] = FLOAT_TO_BOOLEAN(matrix[3]); + params[13] = FLOAT_TO_BOOLEAN(matrix[7]); + params[14] = FLOAT_TO_BOOLEAN(matrix[11]); + params[15] = FLOAT_TO_BOOLEAN(matrix[15]); + } + break; + case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: + { + const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; + params[0] = FLOAT_TO_BOOLEAN(matrix[0]); + params[1] = FLOAT_TO_BOOLEAN(matrix[4]); + params[2] = FLOAT_TO_BOOLEAN(matrix[8]); + params[3] = FLOAT_TO_BOOLEAN(matrix[12]); + params[4] = FLOAT_TO_BOOLEAN(matrix[1]); + params[5] = FLOAT_TO_BOOLEAN(matrix[5]); + params[6] = FLOAT_TO_BOOLEAN(matrix[9]); + params[7] = FLOAT_TO_BOOLEAN(matrix[13]); + params[8] = FLOAT_TO_BOOLEAN(matrix[2]); + params[9] = FLOAT_TO_BOOLEAN(matrix[6]); + params[10] = FLOAT_TO_BOOLEAN(matrix[10]); + params[11] = FLOAT_TO_BOOLEAN(matrix[14]); + params[12] = FLOAT_TO_BOOLEAN(matrix[3]); + params[13] = FLOAT_TO_BOOLEAN(matrix[7]); + params[14] = FLOAT_TO_BOOLEAN(matrix[11]); + params[15] = FLOAT_TO_BOOLEAN(matrix[15]); + } + break; + case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: + { + const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; + params[0] = FLOAT_TO_BOOLEAN(matrix[0]); + params[1] = FLOAT_TO_BOOLEAN(matrix[4]); + params[2] = FLOAT_TO_BOOLEAN(matrix[8]); + params[3] = FLOAT_TO_BOOLEAN(matrix[12]); + params[4] = FLOAT_TO_BOOLEAN(matrix[1]); + params[5] = FLOAT_TO_BOOLEAN(matrix[5]); + params[6] = FLOAT_TO_BOOLEAN(matrix[9]); + params[7] = FLOAT_TO_BOOLEAN(matrix[13]); + params[8] = FLOAT_TO_BOOLEAN(matrix[2]); + params[9] = FLOAT_TO_BOOLEAN(matrix[6]); + params[10] = FLOAT_TO_BOOLEAN(matrix[10]); + params[11] = FLOAT_TO_BOOLEAN(matrix[14]); + params[12] = FLOAT_TO_BOOLEAN(matrix[3]); + params[13] = FLOAT_TO_BOOLEAN(matrix[7]); + params[14] = FLOAT_TO_BOOLEAN(matrix[11]); + params[15] = FLOAT_TO_BOOLEAN(matrix[15]); + } + break; + case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: + { + const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; + params[0] = FLOAT_TO_BOOLEAN(matrix[0]); + params[1] = FLOAT_TO_BOOLEAN(matrix[4]); + params[2] = FLOAT_TO_BOOLEAN(matrix[8]); + params[3] = FLOAT_TO_BOOLEAN(matrix[12]); + params[4] = FLOAT_TO_BOOLEAN(matrix[1]); + params[5] = FLOAT_TO_BOOLEAN(matrix[5]); + params[6] = FLOAT_TO_BOOLEAN(matrix[9]); + params[7] = FLOAT_TO_BOOLEAN(matrix[13]); + params[8] = FLOAT_TO_BOOLEAN(matrix[2]); + params[9] = FLOAT_TO_BOOLEAN(matrix[6]); + params[10] = FLOAT_TO_BOOLEAN(matrix[10]); + params[11] = FLOAT_TO_BOOLEAN(matrix[14]); + params[12] = FLOAT_TO_BOOLEAN(matrix[3]); + params[13] = FLOAT_TO_BOOLEAN(matrix[7]); + params[14] = FLOAT_TO_BOOLEAN(matrix[11]); + params[15] = FLOAT_TO_BOOLEAN(matrix[15]); + } + break; + case GL_OCCLUSION_TEST_HP: + CHECK_EXTENSION_B(HP_occlusion_test, pname); + params[0] = ctx->Depth.OcclusionTest; + break; + case GL_OCCLUSION_TEST_RESULT_HP: + CHECK_EXTENSION_B(HP_occlusion_test, pname); + { + FLUSH_VERTICES(ctx, _NEW_DEPTH); + if (ctx->Depth.OcclusionTest) + params[0] = ctx->OcclusionResult; + else + params[0] = ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + return; + } + break; + case GL_PIXEL_TEXTURE_SGIS: + CHECK_EXTENSION_B(SGIS_pixel_texture, pname); + params[0] = ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_SGIX: + CHECK_EXTENSION_B(SGIX_pixel_texture, pname); + params[0] = ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + CHECK_EXTENSION_B(SGIX_pixel_texture, pname); + params[0] = ENUM_TO_BOOLEAN(pixel_texgen_mode(ctx)); + break; + case GL_COLOR_MATRIX_SGI: + { + const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; + params[0] = FLOAT_TO_BOOLEAN(matrix[0]); + params[1] = FLOAT_TO_BOOLEAN(matrix[1]); + params[2] = FLOAT_TO_BOOLEAN(matrix[2]); + params[3] = FLOAT_TO_BOOLEAN(matrix[3]); + params[4] = FLOAT_TO_BOOLEAN(matrix[4]); + params[5] = FLOAT_TO_BOOLEAN(matrix[5]); + params[6] = FLOAT_TO_BOOLEAN(matrix[6]); + params[7] = FLOAT_TO_BOOLEAN(matrix[7]); + params[8] = FLOAT_TO_BOOLEAN(matrix[8]); + params[9] = FLOAT_TO_BOOLEAN(matrix[9]); + params[10] = FLOAT_TO_BOOLEAN(matrix[10]); + params[11] = FLOAT_TO_BOOLEAN(matrix[11]); + params[12] = FLOAT_TO_BOOLEAN(matrix[12]); + params[13] = FLOAT_TO_BOOLEAN(matrix[13]); + params[14] = FLOAT_TO_BOOLEAN(matrix[14]); + params[15] = FLOAT_TO_BOOLEAN(matrix[15]); + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + params[0] = INT_TO_BOOLEAN(ctx->ColorMatrixStack.Depth + 1); + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + params[0] = INT_TO_BOOLEAN(MAX_COLOR_STACK_DEPTH); + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[0]); + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[1]); + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[2]); + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[3]); + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[0]); + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[1]); + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[2]); + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[3]); + break; + case GL_CONVOLUTION_1D_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); + params[0] = ctx->Pixel.Convolution1DEnabled; + break; + case GL_CONVOLUTION_2D_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); + params[0] = ctx->Pixel.Convolution2DEnabled; + break; + case GL_SEPARABLE_2D_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); + params[0] = ctx->Pixel.Separable2DEnabled; + break; + case GL_POST_CONVOLUTION_RED_SCALE_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[0]); + break; + case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[1]); + break; + case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[2]); + break; + case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[3]); + break; + case GL_POST_CONVOLUTION_RED_BIAS_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[0]); + break; + case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[1]); + break; + case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[2]); + break; + case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); + params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[3]); + break; + case GL_HISTOGRAM: + CHECK_EXTENSION_B(EXT_histogram, pname); + params[0] = ctx->Pixel.HistogramEnabled; + break; + case GL_MINMAX: + CHECK_EXTENSION_B(EXT_histogram, pname); + params[0] = ctx->Pixel.MinMaxEnabled; + break; + case GL_COLOR_TABLE_SGI: + CHECK_EXTENSION_B(SGI_color_table, pname); + params[0] = ctx->Pixel.ColorTableEnabled; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + CHECK_EXTENSION_B(SGI_color_table, pname); + params[0] = ctx->Pixel.PostConvolutionColorTableEnabled; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + CHECK_EXTENSION_B(SGI_color_table, pname); + params[0] = ctx->Pixel.PostColorMatrixColorTableEnabled; + break; + case GL_TEXTURE_COLOR_TABLE_SGI: + CHECK_EXTENSION_B(SGI_texture_color_table, pname); + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled; + break; + case GL_COLOR_SUM_EXT: + CHECK_EXTENSION_B(EXT_secondary_color, pname); + params[0] = ctx->Fog.ColorSumEnabled; + break; + case GL_CURRENT_SECONDARY_COLOR_EXT: + CHECK_EXTENSION_B(EXT_secondary_color, pname); + { + FLUSH_CURRENT(ctx, 0); + params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); + params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); + params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); + params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]); + } + break; + case GL_SECONDARY_COLOR_ARRAY_EXT: + CHECK_EXTENSION_B(EXT_secondary_color, pname); + params[0] = ctx->Array.SecondaryColor.Enabled; + break; + case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: + CHECK_EXTENSION_B(EXT_secondary_color, pname); + params[0] = ENUM_TO_BOOLEAN(ctx->Array.SecondaryColor.Type); + break; + case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_B(EXT_secondary_color, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.SecondaryColor.Stride); + break; + case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: + CHECK_EXTENSION_B(EXT_secondary_color, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.SecondaryColor.Size); + break; + case GL_CURRENT_FOG_COORDINATE_EXT: + CHECK_EXTENSION_B(EXT_fog_coord, pname); + { + FLUSH_CURRENT(ctx, 0); + params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); + } + break; + case GL_FOG_COORDINATE_ARRAY_EXT: + CHECK_EXTENSION_B(EXT_fog_coord, pname); + params[0] = ctx->Array.FogCoord.Enabled; + break; + case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: + CHECK_EXTENSION_B(EXT_fog_coord, pname); + params[0] = ENUM_TO_BOOLEAN(ctx->Array.FogCoord.Type); + break; + case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_B(EXT_fog_coord, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.FogCoord.Stride); + break; + case GL_FOG_COORDINATE_SOURCE_EXT: + CHECK_EXTENSION_B(EXT_fog_coord, pname); + params[0] = ENUM_TO_BOOLEAN(ctx->Fog.FogCoordinateSource); + break; + case GL_MAX_TEXTURE_LOD_BIAS_EXT: + CHECK_EXTENSION_B(EXT_texture_lod_bias, pname); + params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxTextureLodBias); + break; + case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: + CHECK_EXTENSION_B(EXT_texture_filter_anisotropic, pname); + params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxTextureMaxAnisotropy); + break; + case GL_MULTISAMPLE_ARB: + CHECK_EXTENSION_B(ARB_multisample, pname); + params[0] = ctx->Multisample.Enabled; + break; + case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: + CHECK_EXTENSION_B(ARB_multisample, pname); + params[0] = ctx->Multisample.SampleAlphaToCoverage; + break; + case GL_SAMPLE_ALPHA_TO_ONE_ARB: + CHECK_EXTENSION_B(ARB_multisample, pname); + params[0] = ctx->Multisample.SampleAlphaToOne; + break; + case GL_SAMPLE_COVERAGE_ARB: + CHECK_EXTENSION_B(ARB_multisample, pname); + params[0] = ctx->Multisample.SampleCoverage; + break; + case GL_SAMPLE_COVERAGE_VALUE_ARB: + CHECK_EXTENSION_B(ARB_multisample, pname); + params[0] = FLOAT_TO_BOOLEAN(ctx->Multisample.SampleCoverageValue); + break; + case GL_SAMPLE_COVERAGE_INVERT_ARB: + CHECK_EXTENSION_B(ARB_multisample, pname); + params[0] = ctx->Multisample.SampleCoverageInvert; + break; + case GL_SAMPLE_BUFFERS_ARB: + CHECK_EXTENSION_B(ARB_multisample, pname); + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.sampleBuffers); + break; + case GL_SAMPLES_ARB: + CHECK_EXTENSION_B(ARB_multisample, pname); + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.samples); + break; + case GL_RASTER_POSITION_UNCLIPPED_IBM: + CHECK_EXTENSION_B(IBM_rasterpos_clip, pname); + params[0] = ctx->Transform.RasterPositionUnclipped; + break; + case GL_POINT_SPRITE_NV: + CHECK_EXTENSION_B(NV_point_sprite, pname); + params[0] = ctx->Point.PointSprite; + break; + case GL_POINT_SPRITE_R_MODE_NV: + CHECK_EXTENSION_B(NV_point_sprite, pname); + params[0] = ENUM_TO_BOOLEAN(ctx->Point.SpriteRMode); + break; + case GL_POINT_SPRITE_COORD_ORIGIN: + CHECK_EXTENSION_B(NV_point_sprite, pname); + params[0] = ENUM_TO_BOOLEAN(ctx->Point.SpriteOrigin); + break; + case GL_GENERATE_MIPMAP_HINT_SGIS: + CHECK_EXTENSION_B(SGIS_generate_mipmap, pname); + params[0] = ENUM_TO_BOOLEAN(ctx->Hint.GenerateMipmap); + break; + case GL_VERTEX_PROGRAM_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->VertexProgram.Enabled; + break; + case GL_VERTEX_PROGRAM_POINT_SIZE_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->VertexProgram.PointSizeEnabled; + break; + case GL_VERTEX_PROGRAM_TWO_SIDE_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->VertexProgram.TwoSideEnabled; + break; + case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxProgramMatrixStackDepth); + break; + case GL_MAX_TRACK_MATRICES_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxProgramMatrices); + break; + case GL_CURRENT_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->CurrentStack->Depth + 1; + break; + case GL_CURRENT_MATRIX_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + { + const GLfloat *matrix = ctx->CurrentStack->Top->m; + params[0] = FLOAT_TO_BOOLEAN(matrix[0]); + params[1] = FLOAT_TO_BOOLEAN(matrix[1]); + params[2] = FLOAT_TO_BOOLEAN(matrix[2]); + params[3] = FLOAT_TO_BOOLEAN(matrix[3]); + params[4] = FLOAT_TO_BOOLEAN(matrix[4]); + params[5] = FLOAT_TO_BOOLEAN(matrix[5]); + params[6] = FLOAT_TO_BOOLEAN(matrix[6]); + params[7] = FLOAT_TO_BOOLEAN(matrix[7]); + params[8] = FLOAT_TO_BOOLEAN(matrix[8]); + params[9] = FLOAT_TO_BOOLEAN(matrix[9]); + params[10] = FLOAT_TO_BOOLEAN(matrix[10]); + params[11] = FLOAT_TO_BOOLEAN(matrix[11]); + params[12] = FLOAT_TO_BOOLEAN(matrix[12]); + params[13] = FLOAT_TO_BOOLEAN(matrix[13]); + params[14] = FLOAT_TO_BOOLEAN(matrix[14]); + params[15] = FLOAT_TO_BOOLEAN(matrix[15]); + } + break; + case GL_VERTEX_PROGRAM_BINDING_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = INT_TO_BOOLEAN((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)); + break; + case GL_PROGRAM_ERROR_POSITION_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = INT_TO_BOOLEAN(ctx->Program.ErrorPos); + break; + case GL_VERTEX_ATTRIB_ARRAY0_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[0].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY1_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[1].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY2_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[2].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY3_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[3].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[4].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY5_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[5].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY6_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[6].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY7_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[7].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY8_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[8].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY9_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[9].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY10_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[10].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY11_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[11].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY12_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[12].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY13_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[13].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY14_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[14].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY15_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Array.VertexAttrib[15].Enabled; + break; + case GL_MAP1_VERTEX_ATTRIB0_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[0]; + break; + case GL_MAP1_VERTEX_ATTRIB1_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[1]; + break; + case GL_MAP1_VERTEX_ATTRIB2_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[2]; + break; + case GL_MAP1_VERTEX_ATTRIB3_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[3]; + break; + case GL_MAP1_VERTEX_ATTRIB4_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[4]; + break; + case GL_MAP1_VERTEX_ATTRIB5_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[5]; + break; + case GL_MAP1_VERTEX_ATTRIB6_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[6]; + break; + case GL_MAP1_VERTEX_ATTRIB7_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[7]; + break; + case GL_MAP1_VERTEX_ATTRIB8_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[8]; + break; + case GL_MAP1_VERTEX_ATTRIB9_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[9]; + break; + case GL_MAP1_VERTEX_ATTRIB10_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[10]; + break; + case GL_MAP1_VERTEX_ATTRIB11_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[11]; + break; + case GL_MAP1_VERTEX_ATTRIB12_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[12]; + break; + case GL_MAP1_VERTEX_ATTRIB13_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[13]; + break; + case GL_MAP1_VERTEX_ATTRIB14_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[14]; + break; + case GL_MAP1_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + params[0] = ctx->Eval.Map1Attrib[15]; + break; + case GL_FRAGMENT_PROGRAM_NV: + CHECK_EXTENSION_B(NV_fragment_program, pname); + params[0] = ctx->FragmentProgram.Enabled; + break; + case GL_MAX_TEXTURE_COORDS_NV: + CHECK_EXTENSION_B(NV_fragment_program, pname); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureCoordUnits); + break; + case GL_MAX_TEXTURE_IMAGE_UNITS_NV: + CHECK_EXTENSION_B(NV_fragment_program, pname); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureImageUnits); + break; + case GL_FRAGMENT_PROGRAM_BINDING_NV: + CHECK_EXTENSION_B(NV_fragment_program, pname); + params[0] = INT_TO_BOOLEAN(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0); + break; + case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: + CHECK_EXTENSION_B(NV_fragment_program, pname); + params[0] = INT_TO_BOOLEAN(MAX_NV_FRAGMENT_PROGRAM_PARAMS); + break; + case GL_TEXTURE_RECTANGLE_NV: + CHECK_EXTENSION_B(NV_texture_rectangle, pname); + params[0] = _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV); + break; + case GL_TEXTURE_BINDING_RECTANGLE_NV: + CHECK_EXTENSION_B(NV_texture_rectangle, pname); + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name); + break; + case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: + CHECK_EXTENSION_B(NV_texture_rectangle, pname); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureRectSize); + break; + case GL_STENCIL_TEST_TWO_SIDE_EXT: + CHECK_EXTENSION_B(EXT_stencil_two_side, pname); + params[0] = ctx->Stencil.TestTwoSide; + break; + case GL_ACTIVE_STENCIL_FACE_EXT: + CHECK_EXTENSION_B(EXT_stencil_two_side, pname); + params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); + break; + case GL_MAX_SHININESS_NV: + CHECK_EXTENSION_B(NV_light_max_exponent, pname); + params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxShininess); + break; + case GL_MAX_SPOT_EXPONENT_NV: + CHECK_EXTENSION_B(NV_light_max_exponent, pname); + params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxSpotExponent); + break; + case GL_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayBufferObj->Name); + break; + case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.Vertex.BufferObj->Name); + break; + case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.Normal.BufferObj->Name); + break; + case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.Color.BufferObj->Name); + break; + case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.Index.BufferObj->Name); + break; + case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name); + break; + case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.EdgeFlag.BufferObj->Name); + break; + case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.SecondaryColor.BufferObj->Name); + break; + case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.FogCoord.BufferObj->Name); + break; + case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->Array.ElementArrayBufferObj->Name); + break; + case GL_PIXEL_PACK_BUFFER_BINDING_EXT: + CHECK_EXTENSION_B(EXT_pixel_buffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->Pack.BufferObj->Name); + break; + case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: + CHECK_EXTENSION_B(EXT_pixel_buffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->Unpack.BufferObj->Name); + break; + case GL_MAX_VERTEX_ATTRIBS_ARB: + CHECK_EXTENSION_B(ARB_vertex_program, pname); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxVertexProgramAttribs); + break; + case GL_FRAGMENT_PROGRAM_ARB: + CHECK_EXTENSION_B(ARB_fragment_program, pname); + params[0] = ctx->FragmentProgram.Enabled; + break; + case GL_TRANSPOSE_CURRENT_MATRIX_ARB: + CHECK_EXTENSION_B(ARB_fragment_program, pname); + { + const GLfloat *matrix = ctx->CurrentStack->Top->m; + params[0] = FLOAT_TO_BOOLEAN(matrix[0]); + params[1] = FLOAT_TO_BOOLEAN(matrix[4]); + params[2] = FLOAT_TO_BOOLEAN(matrix[8]); + params[3] = FLOAT_TO_BOOLEAN(matrix[12]); + params[4] = FLOAT_TO_BOOLEAN(matrix[1]); + params[5] = FLOAT_TO_BOOLEAN(matrix[5]); + params[6] = FLOAT_TO_BOOLEAN(matrix[9]); + params[7] = FLOAT_TO_BOOLEAN(matrix[13]); + params[8] = FLOAT_TO_BOOLEAN(matrix[2]); + params[9] = FLOAT_TO_BOOLEAN(matrix[6]); + params[10] = FLOAT_TO_BOOLEAN(matrix[10]); + params[11] = FLOAT_TO_BOOLEAN(matrix[14]); + params[12] = FLOAT_TO_BOOLEAN(matrix[3]); + params[13] = FLOAT_TO_BOOLEAN(matrix[7]); + params[14] = FLOAT_TO_BOOLEAN(matrix[11]); + params[15] = FLOAT_TO_BOOLEAN(matrix[15]); + } + break; + case GL_DEPTH_BOUNDS_TEST_EXT: + CHECK_EXTENSION_B(EXT_depth_bounds_test, pname); + params[0] = ctx->Depth.BoundsTest; + break; + case GL_DEPTH_BOUNDS_EXT: + CHECK_EXTENSION_B(EXT_depth_bounds_test, pname); + params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMin); + params[1] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMax); + break; + case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: + CHECK_EXTENSION_B(MESA_program_debug, pname); + params[0] = ctx->FragmentProgram.CallbackEnabled; + break; + case GL_VERTEX_PROGRAM_CALLBACK_MESA: + CHECK_EXTENSION_B(MESA_program_debug, pname); + params[0] = ctx->VertexProgram.CallbackEnabled; + break; + case GL_FRAGMENT_PROGRAM_POSITION_MESA: + CHECK_EXTENSION_B(MESA_program_debug, pname); + params[0] = INT_TO_BOOLEAN(ctx->FragmentProgram.CurrentPosition); + break; + case GL_VERTEX_PROGRAM_POSITION_MESA: + CHECK_EXTENSION_B(MESA_program_debug, pname); + params[0] = INT_TO_BOOLEAN(ctx->VertexProgram.CurrentPosition); + break; + case GL_MAX_DRAW_BUFFERS_ARB: + CHECK_EXTENSION_B(ARB_draw_buffers, pname); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxDrawBuffers); + break; + case GL_DRAW_BUFFER0_ARB: + CHECK_EXTENSION_B(ARB_draw_buffers, pname); + params[0] = ENUM_TO_BOOLEAN(ctx->Color.DrawBuffer[0]); + break; + case GL_DRAW_BUFFER1_ARB: + CHECK_EXTENSION_B(ARB_draw_buffers, pname); + { + GLenum buffer; + if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); + return; + } + buffer = ctx->Color.DrawBuffer[1]; + params[0] = ENUM_TO_BOOLEAN(buffer); + } + break; + case GL_DRAW_BUFFER2_ARB: + CHECK_EXTENSION_B(ARB_draw_buffers, pname); + { + GLenum buffer; + if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); + return; + } + buffer = ctx->Color.DrawBuffer[2]; + params[0] = ENUM_TO_BOOLEAN(buffer); + } + break; + case GL_DRAW_BUFFER3_ARB: + CHECK_EXTENSION_B(ARB_draw_buffers, pname); + { + GLenum buffer; + if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); + return; + } + buffer = ctx->Color.DrawBuffer[3]; + params[0] = ENUM_TO_BOOLEAN(buffer); + } + break; + case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: + CHECK_EXTENSION_B(OES_read_format, pname); + params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadType); + break; + case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: + CHECK_EXTENSION_B(OES_read_format, pname); + params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadFormat); + break; + case GL_NUM_FRAGMENT_REGISTERS_ATI: + CHECK_EXTENSION_B(ATI_fragment_shader, pname); + params[0] = INT_TO_BOOLEAN(6); + break; + case GL_NUM_FRAGMENT_CONSTANTS_ATI: + CHECK_EXTENSION_B(ATI_fragment_shader, pname); + params[0] = INT_TO_BOOLEAN(8); + break; + case GL_NUM_PASSES_ATI: + CHECK_EXTENSION_B(ATI_fragment_shader, pname); + params[0] = INT_TO_BOOLEAN(2); + break; + case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: + CHECK_EXTENSION_B(ATI_fragment_shader, pname); + params[0] = INT_TO_BOOLEAN(8); + break; + case GL_NUM_INSTRUCTIONS_TOTAL_ATI: + CHECK_EXTENSION_B(ATI_fragment_shader, pname); + params[0] = INT_TO_BOOLEAN(16); + break; + case GL_COLOR_ALPHA_PAIRING_ATI: + CHECK_EXTENSION_B(ATI_fragment_shader, pname); + params[0] = GL_TRUE; + break; + case GL_NUM_LOOPBACK_COMPONENTS_ATI: + CHECK_EXTENSION_B(ATI_fragment_shader, pname); + params[0] = INT_TO_BOOLEAN(3); + break; + case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: + CHECK_EXTENSION_B(ATI_fragment_shader, pname); + params[0] = INT_TO_BOOLEAN(3); + break; + case GL_STENCIL_BACK_FUNC: + params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.Function[1]); + break; + case GL_STENCIL_BACK_VALUE_MASK: + params[0] = INT_TO_BOOLEAN(ctx->Stencil.ValueMask[1]); + break; + case GL_STENCIL_BACK_REF: + params[0] = INT_TO_BOOLEAN(ctx->Stencil.Ref[1]); + break; + case GL_STENCIL_BACK_FAIL: + params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.FailFunc[1]); + break; + case GL_STENCIL_BACK_PASS_DEPTH_FAIL: + params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZFailFunc[1]); + break; + case GL_STENCIL_BACK_PASS_DEPTH_PASS: + params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZPassFunc[1]); + break; + case GL_FRAMEBUFFER_BINDING_EXT: + CHECK_EXTENSION_B(EXT_framebuffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Name); + break; + case GL_RENDERBUFFER_BINDING_EXT: + CHECK_EXTENSION_B(EXT_framebuffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0); + break; + case GL_MAX_COLOR_ATTACHMENTS_EXT: + CHECK_EXTENSION_B(EXT_framebuffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxColorAttachments); + break; + case GL_MAX_RENDERBUFFER_SIZE_EXT: + CHECK_EXTENSION_B(EXT_framebuffer_object, pname); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxRenderbufferSize); + break; + case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: + CHECK_EXTENSION_B(ARB_fragment_shader, pname); + params[0] = INT_TO_BOOLEAN(MAX_FRAGMENT_UNIFORM_COMPONENTS); + break; + case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: + CHECK_EXTENSION_B(ARB_fragment_shader, pname); + params[0] = ENUM_TO_BOOLEAN(ctx->Hint.FragmentShaderDerivative); + break; + case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: + CHECK_EXTENSION_B(ARB_vertex_shader, pname); + params[0] = INT_TO_BOOLEAN(MAX_VERTEX_UNIFORM_COMPONENTS); + break; + case GL_MAX_VARYING_FLOATS_ARB: + CHECK_EXTENSION_B(ARB_vertex_shader, pname); + params[0] = INT_TO_BOOLEAN(MAX_VARYING_FLOATS); + break; + case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: + CHECK_EXTENSION_B(ARB_vertex_shader, pname); + params[0] = INT_TO_BOOLEAN(MAX_VERTEX_TEXTURE_IMAGE_UNITS); + break; + case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: + CHECK_EXTENSION_B(ARB_vertex_shader, pname); + params[0] = INT_TO_BOOLEAN(MAX_COMBINED_TEXTURE_IMAGE_UNITS); + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname); + } +} + +void GLAPIENTRY +_mesa_GetFloatv( GLenum pname, GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!params) + return; + + if (ctx->NewState) + _mesa_update_state(ctx); + + if (ctx->Driver.GetFloatv && + ctx->Driver.GetFloatv(ctx, pname, params)) + return; + + switch (pname) { + case GL_ACCUM_RED_BITS: + params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumRedBits); + break; + case GL_ACCUM_GREEN_BITS: + params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumGreenBits); + break; + case GL_ACCUM_BLUE_BITS: + params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumBlueBits); + break; + case GL_ACCUM_ALPHA_BITS: + params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumAlphaBits); + break; + case GL_ACCUM_CLEAR_VALUE: + params[0] = ctx->Accum.ClearColor[0]; + params[1] = ctx->Accum.ClearColor[1]; + params[2] = ctx->Accum.ClearColor[2]; + params[3] = ctx->Accum.ClearColor[3]; + break; + case GL_ALPHA_BIAS: + params[0] = ctx->Pixel.AlphaBias; + break; + case GL_ALPHA_BITS: + params[0] = (GLfloat)(ctx->DrawBuffer->Visual.alphaBits); + break; + case GL_ALPHA_SCALE: + params[0] = ctx->Pixel.AlphaScale; + break; + case GL_ALPHA_TEST: + params[0] = BOOLEAN_TO_FLOAT(ctx->Color.AlphaEnabled); + break; + case GL_ALPHA_TEST_FUNC: + params[0] = ENUM_TO_FLOAT(ctx->Color.AlphaFunc); + break; + case GL_ALPHA_TEST_REF: + params[0] = ctx->Color.AlphaRef; + break; + case GL_ATTRIB_STACK_DEPTH: + params[0] = (GLfloat)(ctx->AttribStackDepth); + break; + case GL_AUTO_NORMAL: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.AutoNormal); + break; + case GL_AUX_BUFFERS: + params[0] = (GLfloat)(ctx->DrawBuffer->Visual.numAuxBuffers); + break; + case GL_BLEND: + params[0] = BOOLEAN_TO_FLOAT(ctx->Color.BlendEnabled); + break; + case GL_BLEND_DST: + params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB); + break; + case GL_BLEND_SRC: + params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB); + break; + case GL_BLEND_SRC_RGB_EXT: + params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB); + break; + case GL_BLEND_DST_RGB_EXT: + params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB); + break; + case GL_BLEND_SRC_ALPHA_EXT: + params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcA); + break; + case GL_BLEND_DST_ALPHA_EXT: + params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstA); + break; + case GL_BLEND_EQUATION: + params[0] = ENUM_TO_FLOAT(ctx->Color.BlendEquationRGB ); + break; + case GL_BLEND_EQUATION_ALPHA_EXT: + params[0] = ENUM_TO_FLOAT(ctx->Color.BlendEquationA ); + break; + case GL_BLEND_COLOR_EXT: + params[0] = ctx->Color.BlendColor[0]; + params[1] = ctx->Color.BlendColor[1]; + params[2] = ctx->Color.BlendColor[2]; + params[3] = ctx->Color.BlendColor[3]; + break; + case GL_BLUE_BIAS: + params[0] = ctx->Pixel.BlueBias; + break; + case GL_BLUE_BITS: + params[0] = (GLfloat)(ctx->DrawBuffer->Visual.blueBits); + break; + case GL_BLUE_SCALE: + params[0] = ctx->Pixel.BlueScale; + break; + case GL_CLIENT_ATTRIB_STACK_DEPTH: + params[0] = (GLfloat)(ctx->ClientAttribStackDepth); + break; + case GL_CLIP_PLANE0: + params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 0) & 1); + break; + case GL_CLIP_PLANE1: + params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 1) & 1); + break; + case GL_CLIP_PLANE2: + params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 2) & 1); + break; + case GL_CLIP_PLANE3: + params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 3) & 1); + break; + case GL_CLIP_PLANE4: + params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 4) & 1); + break; + case GL_CLIP_PLANE5: + params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 5) & 1); + break; + case GL_COLOR_CLEAR_VALUE: + params[0] = ctx->Color.ClearColor[0]; + params[1] = ctx->Color.ClearColor[1]; + params[2] = ctx->Color.ClearColor[2]; + params[3] = ctx->Color.ClearColor[3]; + break; + case GL_COLOR_MATERIAL: + params[0] = BOOLEAN_TO_FLOAT(ctx->Light.ColorMaterialEnabled); + break; + case GL_COLOR_MATERIAL_FACE: + params[0] = ENUM_TO_FLOAT(ctx->Light.ColorMaterialFace); + break; + case GL_COLOR_MATERIAL_PARAMETER: + params[0] = ENUM_TO_FLOAT(ctx->Light.ColorMaterialMode); + break; + case GL_COLOR_WRITEMASK: + params[0] = (GLfloat)(ctx->Color.ColorMask[RCOMP] ? 1 : 0); + params[1] = (GLfloat)(ctx->Color.ColorMask[GCOMP] ? 1 : 0); + params[2] = (GLfloat)(ctx->Color.ColorMask[BCOMP] ? 1 : 0); + params[3] = (GLfloat)(ctx->Color.ColorMask[ACOMP] ? 1 : 0); + break; + case GL_CULL_FACE: + params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.CullFlag); + break; + case GL_CULL_FACE_MODE: + params[0] = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode); + break; + case GL_CURRENT_COLOR: + { + FLUSH_CURRENT(ctx, 0); + params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]; + params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]; + params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]; + params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]; + } + break; + case GL_CURRENT_INDEX: + { + FLUSH_CURRENT(ctx, 0); + params[0] = ctx->Current.Index; + } + break; + case GL_CURRENT_NORMAL: + { + FLUSH_CURRENT(ctx, 0); + params[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]; + params[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]; + params[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]; + } + break; + case GL_CURRENT_RASTER_COLOR: + params[0] = ctx->Current.RasterColor[0]; + params[1] = ctx->Current.RasterColor[1]; + params[2] = ctx->Current.RasterColor[2]; + params[3] = ctx->Current.RasterColor[3]; + break; + case GL_CURRENT_RASTER_DISTANCE: + params[0] = ctx->Current.RasterDistance; + break; + case GL_CURRENT_RASTER_INDEX: + params[0] = ctx->Current.RasterIndex; + break; + case GL_CURRENT_RASTER_POSITION: + params[0] = ctx->Current.RasterPos[0]; + params[1] = ctx->Current.RasterPos[1]; + params[2] = ctx->Current.RasterPos[2]; + params[3] = ctx->Current.RasterPos[3]; + break; + case GL_CURRENT_RASTER_TEXTURE_COORDS: + { + const GLuint texUnit = ctx->Texture.CurrentUnit; + params[0] = ctx->Current.RasterTexCoords[texUnit][0]; + params[1] = ctx->Current.RasterTexCoords[texUnit][1]; + params[2] = ctx->Current.RasterTexCoords[texUnit][2]; + params[3] = ctx->Current.RasterTexCoords[texUnit][3]; + } + break; + case GL_CURRENT_RASTER_POSITION_VALID: + params[0] = BOOLEAN_TO_FLOAT(ctx->Current.RasterPosValid); + break; + case GL_CURRENT_TEXTURE_COORDS: + { + const GLuint texUnit = ctx->Texture.CurrentUnit; + params[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]; + params[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]; + params[2] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]; + params[3] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]; + } + break; + case GL_DEPTH_BIAS: + params[0] = ctx->Pixel.DepthBias; + break; + case GL_DEPTH_BITS: + params[0] = (GLfloat)(ctx->DrawBuffer->Visual.depthBits); + break; + case GL_DEPTH_CLEAR_VALUE: + params[0] = ctx->Depth.Clear; + break; + case GL_DEPTH_FUNC: + params[0] = ENUM_TO_FLOAT(ctx->Depth.Func); + break; + case GL_DEPTH_RANGE: + params[0] = ctx->Viewport.Near; + params[1] = ctx->Viewport.Far; + break; + case GL_DEPTH_SCALE: + params[0] = ctx->Pixel.DepthScale; + break; + case GL_DEPTH_TEST: + params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.Test); + break; + case GL_DEPTH_WRITEMASK: + params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.Mask); + break; + case GL_DITHER: + params[0] = BOOLEAN_TO_FLOAT(ctx->Color.DitherFlag); + break; + case GL_DOUBLEBUFFER: + params[0] = BOOLEAN_TO_FLOAT(ctx->DrawBuffer->Visual.doubleBufferMode); + break; + case GL_DRAW_BUFFER: + params[0] = ENUM_TO_FLOAT(ctx->Color.DrawBuffer[0]); + break; + case GL_EDGE_FLAG: + { + FLUSH_CURRENT(ctx, 0); + params[0] = BOOLEAN_TO_FLOAT(ctx->Current.EdgeFlag); + } + break; + case GL_FEEDBACK_BUFFER_SIZE: + params[0] = (GLfloat)(ctx->Feedback.BufferSize); + break; + case GL_FEEDBACK_BUFFER_TYPE: + params[0] = ENUM_TO_FLOAT(ctx->Feedback.Type); + break; + case GL_FOG: + params[0] = BOOLEAN_TO_FLOAT(ctx->Fog.Enabled); + break; + case GL_FOG_COLOR: + params[0] = ctx->Fog.Color[0]; + params[1] = ctx->Fog.Color[1]; + params[2] = ctx->Fog.Color[2]; + params[3] = ctx->Fog.Color[3]; + break; + case GL_FOG_DENSITY: + params[0] = ctx->Fog.Density; + break; + case GL_FOG_END: + params[0] = ctx->Fog.End; + break; + case GL_FOG_HINT: + params[0] = ENUM_TO_FLOAT(ctx->Hint.Fog); + break; + case GL_FOG_INDEX: + params[0] = ctx->Fog.Index; + break; + case GL_FOG_MODE: + params[0] = ENUM_TO_FLOAT(ctx->Fog.Mode); + break; + case GL_FOG_START: + params[0] = ctx->Fog.Start; + break; + case GL_FRONT_FACE: + params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontFace); + break; + case GL_GREEN_BIAS: + params[0] = ctx->Pixel.GreenBias; + break; + case GL_GREEN_BITS: + params[0] = (GLfloat)(ctx->DrawBuffer->Visual.greenBits); + break; + case GL_GREEN_SCALE: + params[0] = ctx->Pixel.GreenScale; + break; + case GL_INDEX_BITS: + params[0] = (GLfloat)(ctx->DrawBuffer->Visual.indexBits); + break; + case GL_INDEX_CLEAR_VALUE: + params[0] = (GLfloat)(ctx->Color.ClearIndex); + break; + case GL_INDEX_MODE: + params[0] = BOOLEAN_TO_FLOAT(!ctx->DrawBuffer->Visual.rgbMode); + break; + case GL_INDEX_OFFSET: + params[0] = (GLfloat)(ctx->Pixel.IndexOffset); + break; + case GL_INDEX_SHIFT: + params[0] = (GLfloat)(ctx->Pixel.IndexShift); + break; + case GL_INDEX_WRITEMASK: + params[0] = (GLfloat)(ctx->Color.IndexMask); + break; + case GL_LIGHT0: + params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[0].Enabled); + break; + case GL_LIGHT1: + params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[1].Enabled); + break; + case GL_LIGHT2: + params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[2].Enabled); + break; + case GL_LIGHT3: + params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[3].Enabled); + break; + case GL_LIGHT4: + params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[4].Enabled); + break; + case GL_LIGHT5: + params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[5].Enabled); + break; + case GL_LIGHT6: + params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[6].Enabled); + break; + case GL_LIGHT7: + params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[7].Enabled); + break; + case GL_LIGHTING: + params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Enabled); + break; + case GL_LIGHT_MODEL_AMBIENT: + params[0] = ctx->Light.Model.Ambient[0]; + params[1] = ctx->Light.Model.Ambient[1]; + params[2] = ctx->Light.Model.Ambient[2]; + params[3] = ctx->Light.Model.Ambient[3]; + break; + case GL_LIGHT_MODEL_COLOR_CONTROL: + params[0] = ENUM_TO_FLOAT(ctx->Light.Model.ColorControl); + break; + case GL_LIGHT_MODEL_LOCAL_VIEWER: + params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Model.LocalViewer); + break; + case GL_LIGHT_MODEL_TWO_SIDE: + params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Model.TwoSide); + break; + case GL_LINE_SMOOTH: + params[0] = BOOLEAN_TO_FLOAT(ctx->Line.SmoothFlag); + break; + case GL_LINE_SMOOTH_HINT: + params[0] = ENUM_TO_FLOAT(ctx->Hint.LineSmooth); + break; + case GL_LINE_STIPPLE: + params[0] = BOOLEAN_TO_FLOAT(ctx->Line.StippleFlag); + break; + case GL_LINE_STIPPLE_PATTERN: + params[0] = (GLfloat)(ctx->Line.StipplePattern); + break; + case GL_LINE_STIPPLE_REPEAT: + params[0] = (GLfloat)(ctx->Line.StippleFactor); + break; + case GL_LINE_WIDTH: + params[0] = ctx->Line.Width; + break; + case GL_LINE_WIDTH_GRANULARITY: + params[0] = ctx->Const.LineWidthGranularity; + break; + case GL_LINE_WIDTH_RANGE: + params[0] = ctx->Const.MinLineWidthAA; + params[1] = ctx->Const.MaxLineWidthAA; + break; + case GL_ALIASED_LINE_WIDTH_RANGE: + params[0] = ctx->Const.MinLineWidth; + params[1] = ctx->Const.MaxLineWidth; + break; + case GL_LIST_BASE: + params[0] = (GLfloat)(ctx->List.ListBase); + break; + case GL_LIST_INDEX: + params[0] = (GLfloat)(ctx->ListState.CurrentListNum); + break; + case GL_LIST_MODE: + { + GLenum mode; + if (!ctx->CompileFlag) + mode = 0; + else if (ctx->ExecuteFlag) + mode = GL_COMPILE_AND_EXECUTE; + else + mode = GL_COMPILE; + params[0] = ENUM_TO_FLOAT(mode); + } + break; + case GL_INDEX_LOGIC_OP: + params[0] = BOOLEAN_TO_FLOAT(ctx->Color.IndexLogicOpEnabled); + break; + case GL_COLOR_LOGIC_OP: + params[0] = BOOLEAN_TO_FLOAT(ctx->Color.ColorLogicOpEnabled); + break; + case GL_LOGIC_OP_MODE: + params[0] = ENUM_TO_FLOAT(ctx->Color.LogicOp); + break; + case GL_MAP1_COLOR_4: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Color4); + break; + case GL_MAP1_GRID_DOMAIN: + params[0] = ctx->Eval.MapGrid1u1; + params[1] = ctx->Eval.MapGrid1u2; + break; + case GL_MAP1_GRID_SEGMENTS: + params[0] = (GLfloat)(ctx->Eval.MapGrid1un); + break; + case GL_MAP1_INDEX: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Index); + break; + case GL_MAP1_NORMAL: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Normal); + break; + case GL_MAP1_TEXTURE_COORD_1: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord1); + break; + case GL_MAP1_TEXTURE_COORD_2: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord2); + break; + case GL_MAP1_TEXTURE_COORD_3: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord3); + break; + case GL_MAP1_TEXTURE_COORD_4: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord4); + break; + case GL_MAP1_VERTEX_3: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Vertex3); + break; + case GL_MAP1_VERTEX_4: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Vertex4); + break; + case GL_MAP2_COLOR_4: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Color4); + break; + case GL_MAP2_GRID_DOMAIN: + params[0] = ctx->Eval.MapGrid2u1; + params[1] = ctx->Eval.MapGrid2u2; + params[2] = ctx->Eval.MapGrid2v1; + params[3] = ctx->Eval.MapGrid2v2; + break; + case GL_MAP2_GRID_SEGMENTS: + params[0] = (GLfloat)(ctx->Eval.MapGrid2un); + params[1] = (GLfloat)(ctx->Eval.MapGrid2vn); + break; + case GL_MAP2_INDEX: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Index); + break; + case GL_MAP2_NORMAL: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Normal); + break; + case GL_MAP2_TEXTURE_COORD_1: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord1); + break; + case GL_MAP2_TEXTURE_COORD_2: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord2); + break; + case GL_MAP2_TEXTURE_COORD_3: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord3); + break; + case GL_MAP2_TEXTURE_COORD_4: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord4); + break; + case GL_MAP2_VERTEX_3: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Vertex3); + break; + case GL_MAP2_VERTEX_4: + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Vertex4); + break; + case GL_MAP_COLOR: + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MapColorFlag); + break; + case GL_MAP_STENCIL: + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MapStencilFlag); + break; + case GL_MATRIX_MODE: + params[0] = ENUM_TO_FLOAT(ctx->Transform.MatrixMode); + break; + case GL_MAX_ATTRIB_STACK_DEPTH: + params[0] = (GLfloat)(MAX_ATTRIB_STACK_DEPTH); + break; + case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: + params[0] = (GLfloat)(MAX_CLIENT_ATTRIB_STACK_DEPTH); + break; + case GL_MAX_CLIP_PLANES: + params[0] = (GLfloat)(ctx->Const.MaxClipPlanes); + break; + case GL_MAX_ELEMENTS_VERTICES: + params[0] = (GLfloat)(ctx->Const.MaxArrayLockSize); + break; + case GL_MAX_ELEMENTS_INDICES: + params[0] = (GLfloat)(ctx->Const.MaxArrayLockSize); + break; + case GL_MAX_EVAL_ORDER: + params[0] = (GLfloat)(MAX_EVAL_ORDER); + break; + case GL_MAX_LIGHTS: + params[0] = (GLfloat)(ctx->Const.MaxLights); + break; + case GL_MAX_LIST_NESTING: + params[0] = (GLfloat)(MAX_LIST_NESTING); + break; + case GL_MAX_MODELVIEW_STACK_DEPTH: + params[0] = (GLfloat)(MAX_MODELVIEW_STACK_DEPTH); + break; + case GL_MAX_NAME_STACK_DEPTH: + params[0] = (GLfloat)(MAX_NAME_STACK_DEPTH); + break; + case GL_MAX_PIXEL_MAP_TABLE: + params[0] = (GLfloat)(MAX_PIXEL_MAP_TABLE); + break; + case GL_MAX_PROJECTION_STACK_DEPTH: + params[0] = (GLfloat)(MAX_PROJECTION_STACK_DEPTH); + break; + case GL_MAX_TEXTURE_SIZE: + params[0] = (GLfloat)(1 << (ctx->Const.MaxTextureLevels - 1)); + break; + case GL_MAX_3D_TEXTURE_SIZE: + params[0] = (GLfloat)(1 << (ctx->Const.Max3DTextureLevels - 1)); + break; + case GL_MAX_TEXTURE_STACK_DEPTH: + params[0] = (GLfloat)(MAX_TEXTURE_STACK_DEPTH); + break; + case GL_MAX_VIEWPORT_DIMS: + params[0] = (GLfloat)(ctx->Const.MaxViewportWidth); + params[1] = (GLfloat)(ctx->Const.MaxViewportHeight); + break; + case GL_MODELVIEW_MATRIX: + { + const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; + params[0] = matrix[0]; + params[1] = matrix[1]; + params[2] = matrix[2]; + params[3] = matrix[3]; + params[4] = matrix[4]; + params[5] = matrix[5]; + params[6] = matrix[6]; + params[7] = matrix[7]; + params[8] = matrix[8]; + params[9] = matrix[9]; + params[10] = matrix[10]; + params[11] = matrix[11]; + params[12] = matrix[12]; + params[13] = matrix[13]; + params[14] = matrix[14]; + params[15] = matrix[15]; + } + break; + case GL_MODELVIEW_STACK_DEPTH: + params[0] = (GLfloat)(ctx->ModelviewMatrixStack.Depth + 1); + break; + case GL_NAME_STACK_DEPTH: + params[0] = (GLfloat)(ctx->Select.NameStackDepth); + break; + case GL_NORMALIZE: + params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.Normalize); + break; + case GL_PACK_ALIGNMENT: + params[0] = (GLfloat)(ctx->Pack.Alignment); + break; + case GL_PACK_LSB_FIRST: + params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.LsbFirst); + break; + case GL_PACK_ROW_LENGTH: + params[0] = (GLfloat)(ctx->Pack.RowLength); + break; + case GL_PACK_SKIP_PIXELS: + params[0] = (GLfloat)(ctx->Pack.SkipPixels); + break; + case GL_PACK_SKIP_ROWS: + params[0] = (GLfloat)(ctx->Pack.SkipRows); + break; + case GL_PACK_SWAP_BYTES: + params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.SwapBytes); + break; + case GL_PACK_SKIP_IMAGES_EXT: + params[0] = (GLfloat)(ctx->Pack.SkipImages); + break; + case GL_PACK_IMAGE_HEIGHT_EXT: + params[0] = (GLfloat)(ctx->Pack.ImageHeight); + break; + case GL_PACK_INVERT_MESA: + params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.Invert); + break; + case GL_PERSPECTIVE_CORRECTION_HINT: + params[0] = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection); + break; + case GL_PIXEL_MAP_A_TO_A_SIZE: + params[0] = (GLfloat)(ctx->Pixel.MapAtoAsize); + break; + case GL_PIXEL_MAP_B_TO_B_SIZE: + params[0] = (GLfloat)(ctx->Pixel.MapBtoBsize); + break; + case GL_PIXEL_MAP_G_TO_G_SIZE: + params[0] = (GLfloat)(ctx->Pixel.MapGtoGsize); + break; + case GL_PIXEL_MAP_I_TO_A_SIZE: + params[0] = (GLfloat)(ctx->Pixel.MapItoAsize); + break; + case GL_PIXEL_MAP_I_TO_B_SIZE: + params[0] = (GLfloat)(ctx->Pixel.MapItoBsize); + break; + case GL_PIXEL_MAP_I_TO_G_SIZE: + params[0] = (GLfloat)(ctx->Pixel.MapItoGsize); + break; + case GL_PIXEL_MAP_I_TO_I_SIZE: + params[0] = (GLfloat)(ctx->Pixel.MapItoIsize); + break; + case GL_PIXEL_MAP_I_TO_R_SIZE: + params[0] = (GLfloat)(ctx->Pixel.MapItoRsize); + break; + case GL_PIXEL_MAP_R_TO_R_SIZE: + params[0] = (GLfloat)(ctx->Pixel.MapRtoRsize); + break; + case GL_PIXEL_MAP_S_TO_S_SIZE: + params[0] = (GLfloat)(ctx->Pixel.MapStoSsize); + break; + case GL_POINT_SIZE: + params[0] = ctx->Point.Size; + break; + case GL_POINT_SIZE_GRANULARITY: + params[0] = ctx->Const.PointSizeGranularity; + break; + case GL_POINT_SIZE_RANGE: + params[0] = ctx->Const.MinPointSizeAA; + params[1] = ctx->Const.MaxPointSizeAA; + break; + case GL_ALIASED_POINT_SIZE_RANGE: + params[0] = ctx->Const.MinPointSize; + params[1] = ctx->Const.MaxPointSize; + break; + case GL_POINT_SMOOTH: + params[0] = BOOLEAN_TO_FLOAT(ctx->Point.SmoothFlag); + break; + case GL_POINT_SMOOTH_HINT: + params[0] = ENUM_TO_FLOAT(ctx->Hint.PointSmooth); + break; + case GL_POINT_SIZE_MIN_EXT: + params[0] = ctx->Point.MinSize; + break; + case GL_POINT_SIZE_MAX_EXT: + params[0] = ctx->Point.MaxSize; + break; + case GL_POINT_FADE_THRESHOLD_SIZE_EXT: + params[0] = ctx->Point.Threshold; + break; + case GL_DISTANCE_ATTENUATION_EXT: + params[0] = ctx->Point.Params[0]; + params[1] = ctx->Point.Params[1]; + params[2] = ctx->Point.Params[2]; + break; + case GL_POLYGON_MODE: + params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontMode); + params[1] = ENUM_TO_FLOAT(ctx->Polygon.BackMode); + break; + case GL_POLYGON_OFFSET_BIAS_EXT: + params[0] = ctx->Polygon.OffsetUnits; + break; + case GL_POLYGON_OFFSET_FACTOR: + params[0] = ctx->Polygon.OffsetFactor ; + break; + case GL_POLYGON_OFFSET_UNITS: + params[0] = ctx->Polygon.OffsetUnits ; + break; + case GL_POLYGON_SMOOTH: + params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.SmoothFlag); + break; + case GL_POLYGON_SMOOTH_HINT: + params[0] = ENUM_TO_FLOAT(ctx->Hint.PolygonSmooth); + break; + case GL_POLYGON_STIPPLE: + params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.StippleFlag); + break; + case GL_PROJECTION_MATRIX: + { + const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; + params[0] = matrix[0]; + params[1] = matrix[1]; + params[2] = matrix[2]; + params[3] = matrix[3]; + params[4] = matrix[4]; + params[5] = matrix[5]; + params[6] = matrix[6]; + params[7] = matrix[7]; + params[8] = matrix[8]; + params[9] = matrix[9]; + params[10] = matrix[10]; + params[11] = matrix[11]; + params[12] = matrix[12]; + params[13] = matrix[13]; + params[14] = matrix[14]; + params[15] = matrix[15]; + } + break; + case GL_PROJECTION_STACK_DEPTH: + params[0] = (GLfloat)(ctx->ProjectionMatrixStack.Depth + 1); + break; + case GL_READ_BUFFER: + params[0] = ENUM_TO_FLOAT(ctx->Pixel.ReadBuffer); + break; + case GL_RED_BIAS: + params[0] = ctx->Pixel.RedBias; + break; + case GL_RED_BITS: + params[0] = (GLfloat)( ctx->DrawBuffer->Visual.redBits ); + break; + case GL_RED_SCALE: + params[0] = ctx->Pixel.RedScale; + break; + case GL_RENDER_MODE: + params[0] = ENUM_TO_FLOAT(ctx->RenderMode); + break; + case GL_RESCALE_NORMAL: + params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.RescaleNormals); + break; + case GL_RGBA_MODE: + params[0] = BOOLEAN_TO_FLOAT(ctx->DrawBuffer->Visual.rgbMode); + break; + case GL_SCISSOR_BOX: + params[0] = (GLfloat)(ctx->Scissor.X); + params[1] = (GLfloat)(ctx->Scissor.Y); + params[2] = (GLfloat)(ctx->Scissor.Width); + params[3] = (GLfloat)(ctx->Scissor.Height); + break; + case GL_SCISSOR_TEST: + params[0] = BOOLEAN_TO_FLOAT(ctx->Scissor.Enabled); + break; + case GL_SELECTION_BUFFER_SIZE: + params[0] = (GLfloat)(ctx->Select.BufferSize); + break; + case GL_SHADE_MODEL: + params[0] = ENUM_TO_FLOAT(ctx->Light.ShadeModel); + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.SharedPalette); + break; + case GL_STENCIL_BITS: + params[0] = (GLfloat)(ctx->DrawBuffer->Visual.stencilBits); + break; + case GL_STENCIL_CLEAR_VALUE: + params[0] = (GLfloat)(ctx->Stencil.Clear); + break; + case GL_STENCIL_FAIL: + params[0] = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_FUNC: + params[0] = ENUM_TO_FLOAT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_PASS_DEPTH_FAIL: + params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_PASS_DEPTH_PASS: + params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_REF: + params[0] = (GLfloat)(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_TEST: + params[0] = BOOLEAN_TO_FLOAT(ctx->Stencil.Enabled); + break; + case GL_STENCIL_VALUE_MASK: + params[0] = (GLfloat)(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_WRITEMASK: + params[0] = (GLfloat)(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]); + break; + case GL_STEREO: + params[0] = BOOLEAN_TO_FLOAT(ctx->DrawBuffer->Visual.stereoMode); + break; + case GL_SUBPIXEL_BITS: + params[0] = (GLfloat)(ctx->Const.SubPixelBits); + break; + case GL_TEXTURE_1D: + params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_1D)); + break; + case GL_TEXTURE_2D: + params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_2D)); + break; + case GL_TEXTURE_3D: + params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_3D)); + break; + case GL_TEXTURE_BINDING_1D: + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name); + break; + case GL_TEXTURE_BINDING_2D: + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name); + break; + case GL_TEXTURE_BINDING_3D: + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name); + break; + case GL_TEXTURE_ENV_COLOR: + { + const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; + params[0] = color[0]; + params[1] = color[1]; + params[2] = color[2]; + params[3] = color[3]; + } + break; + case GL_TEXTURE_ENV_MODE: + params[0] = ENUM_TO_FLOAT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode); + break; + case GL_TEXTURE_GEN_S: + params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); + break; + case GL_TEXTURE_GEN_T: + params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)); + break; + case GL_TEXTURE_GEN_R: + params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)); + break; + case GL_TEXTURE_GEN_Q: + params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)); + break; + case GL_TEXTURE_MATRIX: + { + const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; + params[0] = matrix[0]; + params[1] = matrix[1]; + params[2] = matrix[2]; + params[3] = matrix[3]; + params[4] = matrix[4]; + params[5] = matrix[5]; + params[6] = matrix[6]; + params[7] = matrix[7]; + params[8] = matrix[8]; + params[9] = matrix[9]; + params[10] = matrix[10]; + params[11] = matrix[11]; + params[12] = matrix[12]; + params[13] = matrix[13]; + params[14] = matrix[14]; + params[15] = matrix[15]; + } + break; + case GL_TEXTURE_STACK_DEPTH: + params[0] = (GLfloat)(ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1); + break; + case GL_UNPACK_ALIGNMENT: + params[0] = (GLfloat)(ctx->Unpack.Alignment); + break; + case GL_UNPACK_LSB_FIRST: + params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.LsbFirst); + break; + case GL_UNPACK_ROW_LENGTH: + params[0] = (GLfloat)(ctx->Unpack.RowLength); + break; + case GL_UNPACK_SKIP_PIXELS: + params[0] = (GLfloat)(ctx->Unpack.SkipPixels); + break; + case GL_UNPACK_SKIP_ROWS: + params[0] = (GLfloat)(ctx->Unpack.SkipRows); + break; + case GL_UNPACK_SWAP_BYTES: + params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.SwapBytes); + break; + case GL_UNPACK_SKIP_IMAGES_EXT: + params[0] = (GLfloat)(ctx->Unpack.SkipImages); + break; + case GL_UNPACK_IMAGE_HEIGHT_EXT: + params[0] = (GLfloat)(ctx->Unpack.ImageHeight); + break; + case GL_UNPACK_CLIENT_STORAGE_APPLE: + params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.ClientStorage); + break; + case GL_VIEWPORT: + params[0] = (GLfloat)(ctx->Viewport.X); + params[1] = (GLfloat)(ctx->Viewport.Y); + params[2] = (GLfloat)(ctx->Viewport.Width); + params[3] = (GLfloat)(ctx->Viewport.Height); + break; + case GL_ZOOM_X: + params[0] = ctx->Pixel.ZoomX; + break; + case GL_ZOOM_Y: + params[0] = ctx->Pixel.ZoomY; + break; + case GL_VERTEX_ARRAY: + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.Vertex.Enabled); + break; + case GL_VERTEX_ARRAY_SIZE: + params[0] = (GLfloat)(ctx->Array.Vertex.Size); + break; + case GL_VERTEX_ARRAY_TYPE: + params[0] = ENUM_TO_FLOAT(ctx->Array.Vertex.Type); + break; + case GL_VERTEX_ARRAY_STRIDE: + params[0] = (GLfloat)(ctx->Array.Vertex.Stride); + break; + case GL_VERTEX_ARRAY_COUNT_EXT: + params[0] = (GLfloat)(0); + break; + case GL_NORMAL_ARRAY: + params[0] = ENUM_TO_FLOAT(ctx->Array.Normal.Enabled); + break; + case GL_NORMAL_ARRAY_TYPE: + params[0] = ENUM_TO_FLOAT(ctx->Array.Normal.Type); + break; + case GL_NORMAL_ARRAY_STRIDE: + params[0] = (GLfloat)(ctx->Array.Normal.Stride); + break; + case GL_NORMAL_ARRAY_COUNT_EXT: + params[0] = (GLfloat)(0); + break; + case GL_COLOR_ARRAY: + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.Color.Enabled); + break; + case GL_COLOR_ARRAY_SIZE: + params[0] = (GLfloat)(ctx->Array.Color.Size); + break; + case GL_COLOR_ARRAY_TYPE: + params[0] = ENUM_TO_FLOAT(ctx->Array.Color.Type); + break; + case GL_COLOR_ARRAY_STRIDE: + params[0] = (GLfloat)(ctx->Array.Color.Stride); + break; + case GL_COLOR_ARRAY_COUNT_EXT: + params[0] = (GLfloat)(0); + break; + case GL_INDEX_ARRAY: + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.Index.Enabled); + break; + case GL_INDEX_ARRAY_TYPE: + params[0] = ENUM_TO_FLOAT(ctx->Array.Index.Type); + break; + case GL_INDEX_ARRAY_STRIDE: + params[0] = (GLfloat)(ctx->Array.Index.Stride); + break; + case GL_INDEX_ARRAY_COUNT_EXT: + params[0] = (GLfloat)(0); + break; + case GL_TEXTURE_COORD_ARRAY: + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled); + break; + case GL_TEXTURE_COORD_ARRAY_SIZE: + params[0] = (GLfloat)(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size); + break; + case GL_TEXTURE_COORD_ARRAY_TYPE: + params[0] = ENUM_TO_FLOAT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type); + break; + case GL_TEXTURE_COORD_ARRAY_STRIDE: + params[0] = (GLfloat)(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride); + break; + case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: + params[0] = (GLfloat)(0); + break; + case GL_EDGE_FLAG_ARRAY: + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.EdgeFlag.Enabled); + break; + case GL_EDGE_FLAG_ARRAY_STRIDE: + params[0] = (GLfloat)(ctx->Array.EdgeFlag.Stride); + break; + case GL_EDGE_FLAG_ARRAY_COUNT_EXT: + params[0] = (GLfloat)(0); + break; + case GL_MAX_TEXTURE_UNITS_ARB: + CHECK_EXTENSION_F(ARB_multitexture, pname); + params[0] = (GLfloat)(MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits)); + break; + case GL_ACTIVE_TEXTURE_ARB: + CHECK_EXTENSION_F(ARB_multitexture, pname); + params[0] = (GLfloat)(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); + break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + CHECK_EXTENSION_F(ARB_multitexture, pname); + params[0] = (GLfloat)(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); + break; + case GL_TEXTURE_CUBE_MAP_ARB: + CHECK_EXTENSION_F(ARB_texture_cube_map, pname); + params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)); + break; + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + CHECK_EXTENSION_F(ARB_texture_cube_map, pname); + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name); + break; + case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: + CHECK_EXTENSION_F(ARB_texture_cube_map, pname); + params[0] = (GLfloat)((1 << (ctx->Const.MaxCubeTextureLevels - 1))); + break; + case GL_TEXTURE_COMPRESSION_HINT_ARB: + CHECK_EXTENSION_F(ARB_texture_compression, pname); + params[0] = (GLfloat)(ctx->Hint.TextureCompression); + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + CHECK_EXTENSION_F(ARB_texture_compression, pname); + params[0] = (GLfloat)(_mesa_get_compressed_formats(ctx, NULL)); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + CHECK_EXTENSION_F(ARB_texture_compression, pname); + { + GLint formats[100]; + GLuint i, n = _mesa_get_compressed_formats(ctx, formats); + ASSERT(n <= 100); + for (i = 0; i < n; i++) + params[i] = ENUM_TO_INT(formats[i]); + } + break; + case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: + CHECK_EXTENSION_F(EXT_compiled_vertex_array, pname); + params[0] = (GLfloat)(ctx->Array.LockFirst); + break; + case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: + CHECK_EXTENSION_F(EXT_compiled_vertex_array, pname); + params[0] = (GLfloat)(ctx->Array.LockCount); + break; + case GL_TRANSPOSE_COLOR_MATRIX_ARB: + { + const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; + params[0] = matrix[0]; + params[1] = matrix[4]; + params[2] = matrix[8]; + params[3] = matrix[12]; + params[4] = matrix[1]; + params[5] = matrix[5]; + params[6] = matrix[9]; + params[7] = matrix[13]; + params[8] = matrix[2]; + params[9] = matrix[6]; + params[10] = matrix[10]; + params[11] = matrix[14]; + params[12] = matrix[3]; + params[13] = matrix[7]; + params[14] = matrix[11]; + params[15] = matrix[15]; + } + break; + case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: + { + const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; + params[0] = matrix[0]; + params[1] = matrix[4]; + params[2] = matrix[8]; + params[3] = matrix[12]; + params[4] = matrix[1]; + params[5] = matrix[5]; + params[6] = matrix[9]; + params[7] = matrix[13]; + params[8] = matrix[2]; + params[9] = matrix[6]; + params[10] = matrix[10]; + params[11] = matrix[14]; + params[12] = matrix[3]; + params[13] = matrix[7]; + params[14] = matrix[11]; + params[15] = matrix[15]; + } + break; + case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: + { + const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; + params[0] = matrix[0]; + params[1] = matrix[4]; + params[2] = matrix[8]; + params[3] = matrix[12]; + params[4] = matrix[1]; + params[5] = matrix[5]; + params[6] = matrix[9]; + params[7] = matrix[13]; + params[8] = matrix[2]; + params[9] = matrix[6]; + params[10] = matrix[10]; + params[11] = matrix[14]; + params[12] = matrix[3]; + params[13] = matrix[7]; + params[14] = matrix[11]; + params[15] = matrix[15]; + } + break; + case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: + { + const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; + params[0] = matrix[0]; + params[1] = matrix[4]; + params[2] = matrix[8]; + params[3] = matrix[12]; + params[4] = matrix[1]; + params[5] = matrix[5]; + params[6] = matrix[9]; + params[7] = matrix[13]; + params[8] = matrix[2]; + params[9] = matrix[6]; + params[10] = matrix[10]; + params[11] = matrix[14]; + params[12] = matrix[3]; + params[13] = matrix[7]; + params[14] = matrix[11]; + params[15] = matrix[15]; + } + break; + case GL_OCCLUSION_TEST_HP: + CHECK_EXTENSION_F(HP_occlusion_test, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.OcclusionTest); + break; + case GL_OCCLUSION_TEST_RESULT_HP: + CHECK_EXTENSION_F(HP_occlusion_test, pname); + { + FLUSH_VERTICES(ctx, _NEW_DEPTH); + if (ctx->Depth.OcclusionTest) + params[0] = ctx->OcclusionResult; + else + params[0] = ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + return; + } + break; + case GL_PIXEL_TEXTURE_SGIS: + CHECK_EXTENSION_F(SGIS_pixel_texture, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PixelTextureEnabled); + break; + case GL_PIXEL_TEX_GEN_SGIX: + CHECK_EXTENSION_F(SGIX_pixel_texture, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PixelTextureEnabled); + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + CHECK_EXTENSION_F(SGIX_pixel_texture, pname); + params[0] = ENUM_TO_FLOAT(pixel_texgen_mode(ctx)); + break; + case GL_COLOR_MATRIX_SGI: + { + const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; + params[0] = matrix[0]; + params[1] = matrix[1]; + params[2] = matrix[2]; + params[3] = matrix[3]; + params[4] = matrix[4]; + params[5] = matrix[5]; + params[6] = matrix[6]; + params[7] = matrix[7]; + params[8] = matrix[8]; + params[9] = matrix[9]; + params[10] = matrix[10]; + params[11] = matrix[11]; + params[12] = matrix[12]; + params[13] = matrix[13]; + params[14] = matrix[14]; + params[15] = matrix[15]; + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + params[0] = (GLfloat)(ctx->ColorMatrixStack.Depth + 1); + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + params[0] = (GLfloat)(MAX_COLOR_STACK_DEPTH); + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + params[0] = ctx->Pixel.PostColorMatrixScale[0]; + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + params[0] = ctx->Pixel.PostColorMatrixScale[1]; + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + params[0] = ctx->Pixel.PostColorMatrixScale[2]; + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + params[0] = ctx->Pixel.PostColorMatrixScale[3]; + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + params[0] = ctx->Pixel.PostColorMatrixBias[0]; + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + params[0] = ctx->Pixel.PostColorMatrixBias[1]; + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + params[0] = ctx->Pixel.PostColorMatrixBias[2]; + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + params[0] = ctx->Pixel.PostColorMatrixBias[3]; + break; + case GL_CONVOLUTION_1D_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Convolution1DEnabled); + break; + case GL_CONVOLUTION_2D_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Convolution2DEnabled); + break; + case GL_SEPARABLE_2D_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Separable2DEnabled); + break; + case GL_POST_CONVOLUTION_RED_SCALE_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); + params[0] = ctx->Pixel.PostConvolutionScale[0]; + break; + case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); + params[0] = ctx->Pixel.PostConvolutionScale[1]; + break; + case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); + params[0] = ctx->Pixel.PostConvolutionScale[2]; + break; + case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); + params[0] = ctx->Pixel.PostConvolutionScale[3]; + break; + case GL_POST_CONVOLUTION_RED_BIAS_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); + params[0] = ctx->Pixel.PostConvolutionBias[0]; + break; + case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); + params[0] = ctx->Pixel.PostConvolutionBias[1]; + break; + case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); + params[0] = ctx->Pixel.PostConvolutionBias[2]; + break; + case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); + params[0] = ctx->Pixel.PostConvolutionBias[3]; + break; + case GL_HISTOGRAM: + CHECK_EXTENSION_F(EXT_histogram, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.HistogramEnabled); + break; + case GL_MINMAX: + CHECK_EXTENSION_F(EXT_histogram, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MinMaxEnabled); + break; + case GL_COLOR_TABLE_SGI: + CHECK_EXTENSION_F(SGI_color_table, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled); + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + CHECK_EXTENSION_F(SGI_color_table, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PostConvolutionColorTableEnabled); + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + CHECK_EXTENSION_F(SGI_color_table, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PostColorMatrixColorTableEnabled); + break; + case GL_TEXTURE_COLOR_TABLE_SGI: + CHECK_EXTENSION_F(SGI_texture_color_table, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled); + break; + case GL_COLOR_SUM_EXT: + CHECK_EXTENSION_F(EXT_secondary_color, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Fog.ColorSumEnabled); + break; + case GL_CURRENT_SECONDARY_COLOR_EXT: + CHECK_EXTENSION_F(EXT_secondary_color, pname); + { + FLUSH_CURRENT(ctx, 0); + params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]; + params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]; + params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]; + params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]; + } + break; + case GL_SECONDARY_COLOR_ARRAY_EXT: + CHECK_EXTENSION_F(EXT_secondary_color, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.SecondaryColor.Enabled); + break; + case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: + CHECK_EXTENSION_F(EXT_secondary_color, pname); + params[0] = ENUM_TO_FLOAT(ctx->Array.SecondaryColor.Type); + break; + case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_F(EXT_secondary_color, pname); + params[0] = (GLfloat)(ctx->Array.SecondaryColor.Stride); + break; + case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: + CHECK_EXTENSION_F(EXT_secondary_color, pname); + params[0] = (GLfloat)(ctx->Array.SecondaryColor.Size); + break; + case GL_CURRENT_FOG_COORDINATE_EXT: + CHECK_EXTENSION_F(EXT_fog_coord, pname); + { + FLUSH_CURRENT(ctx, 0); + params[0] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; + } + break; + case GL_FOG_COORDINATE_ARRAY_EXT: + CHECK_EXTENSION_F(EXT_fog_coord, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.FogCoord.Enabled); + break; + case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: + CHECK_EXTENSION_F(EXT_fog_coord, pname); + params[0] = ENUM_TO_FLOAT(ctx->Array.FogCoord.Type); + break; + case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_F(EXT_fog_coord, pname); + params[0] = (GLfloat)(ctx->Array.FogCoord.Stride); + break; + case GL_FOG_COORDINATE_SOURCE_EXT: + CHECK_EXTENSION_F(EXT_fog_coord, pname); + params[0] = ENUM_TO_FLOAT(ctx->Fog.FogCoordinateSource); + break; + case GL_MAX_TEXTURE_LOD_BIAS_EXT: + CHECK_EXTENSION_F(EXT_texture_lod_bias, pname); + params[0] = ctx->Const.MaxTextureLodBias; + break; + case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: + CHECK_EXTENSION_F(EXT_texture_filter_anisotropic, pname); + params[0] = ctx->Const.MaxTextureMaxAnisotropy; + break; + case GL_MULTISAMPLE_ARB: + CHECK_EXTENSION_F(ARB_multisample, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.Enabled); + break; + case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: + CHECK_EXTENSION_F(ARB_multisample, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleAlphaToCoverage); + break; + case GL_SAMPLE_ALPHA_TO_ONE_ARB: + CHECK_EXTENSION_F(ARB_multisample, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleAlphaToOne); + break; + case GL_SAMPLE_COVERAGE_ARB: + CHECK_EXTENSION_F(ARB_multisample, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleCoverage); + break; + case GL_SAMPLE_COVERAGE_VALUE_ARB: + CHECK_EXTENSION_F(ARB_multisample, pname); + params[0] = ctx->Multisample.SampleCoverageValue; + break; + case GL_SAMPLE_COVERAGE_INVERT_ARB: + CHECK_EXTENSION_F(ARB_multisample, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleCoverageInvert); + break; + case GL_SAMPLE_BUFFERS_ARB: + CHECK_EXTENSION_F(ARB_multisample, pname); + params[0] = (GLfloat)(ctx->DrawBuffer->Visual.sampleBuffers); + break; + case GL_SAMPLES_ARB: + CHECK_EXTENSION_F(ARB_multisample, pname); + params[0] = (GLfloat)(ctx->DrawBuffer->Visual.samples); + break; + case GL_RASTER_POSITION_UNCLIPPED_IBM: + CHECK_EXTENSION_F(IBM_rasterpos_clip, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.RasterPositionUnclipped); + break; + case GL_POINT_SPRITE_NV: + CHECK_EXTENSION_F(NV_point_sprite, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Point.PointSprite); + break; + case GL_POINT_SPRITE_R_MODE_NV: + CHECK_EXTENSION_F(NV_point_sprite, pname); + params[0] = ENUM_TO_FLOAT(ctx->Point.SpriteRMode); + break; + case GL_POINT_SPRITE_COORD_ORIGIN: + CHECK_EXTENSION_F(NV_point_sprite, pname); + params[0] = ENUM_TO_FLOAT(ctx->Point.SpriteOrigin); + break; + case GL_GENERATE_MIPMAP_HINT_SGIS: + CHECK_EXTENSION_F(SGIS_generate_mipmap, pname); + params[0] = ENUM_TO_FLOAT(ctx->Hint.GenerateMipmap); + break; + case GL_VERTEX_PROGRAM_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.Enabled); + break; + case GL_VERTEX_PROGRAM_POINT_SIZE_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.PointSizeEnabled); + break; + case GL_VERTEX_PROGRAM_TWO_SIDE_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.TwoSideEnabled); + break; + case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = (GLfloat)(ctx->Const.MaxProgramMatrixStackDepth); + break; + case GL_MAX_TRACK_MATRICES_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = (GLfloat)(ctx->Const.MaxProgramMatrices); + break; + case GL_CURRENT_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->CurrentStack->Depth + 1); + break; + case GL_CURRENT_MATRIX_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + { + const GLfloat *matrix = ctx->CurrentStack->Top->m; + params[0] = matrix[0]; + params[1] = matrix[1]; + params[2] = matrix[2]; + params[3] = matrix[3]; + params[4] = matrix[4]; + params[5] = matrix[5]; + params[6] = matrix[6]; + params[7] = matrix[7]; + params[8] = matrix[8]; + params[9] = matrix[9]; + params[10] = matrix[10]; + params[11] = matrix[11]; + params[12] = matrix[12]; + params[13] = matrix[13]; + params[14] = matrix[14]; + params[15] = matrix[15]; + } + break; + case GL_VERTEX_PROGRAM_BINDING_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = (GLfloat)((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)); + break; + case GL_PROGRAM_ERROR_POSITION_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = (GLfloat)(ctx->Program.ErrorPos); + break; + case GL_VERTEX_ATTRIB_ARRAY0_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[0].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY1_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[1].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY2_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[2].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY3_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[3].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[4].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY5_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[5].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY6_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[6].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY7_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[7].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY8_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[8].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY9_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[9].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY10_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[10].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY11_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[11].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY12_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[12].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY13_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[13].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY14_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[14].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY15_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[15].Enabled); + break; + case GL_MAP1_VERTEX_ATTRIB0_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[0]); + break; + case GL_MAP1_VERTEX_ATTRIB1_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[1]); + break; + case GL_MAP1_VERTEX_ATTRIB2_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[2]); + break; + case GL_MAP1_VERTEX_ATTRIB3_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[3]); + break; + case GL_MAP1_VERTEX_ATTRIB4_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[4]); + break; + case GL_MAP1_VERTEX_ATTRIB5_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[5]); + break; + case GL_MAP1_VERTEX_ATTRIB6_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[6]); + break; + case GL_MAP1_VERTEX_ATTRIB7_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[7]); + break; + case GL_MAP1_VERTEX_ATTRIB8_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[8]); + break; + case GL_MAP1_VERTEX_ATTRIB9_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[9]); + break; + case GL_MAP1_VERTEX_ATTRIB10_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[10]); + break; + case GL_MAP1_VERTEX_ATTRIB11_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[11]); + break; + case GL_MAP1_VERTEX_ATTRIB12_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[12]); + break; + case GL_MAP1_VERTEX_ATTRIB13_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[13]); + break; + case GL_MAP1_VERTEX_ATTRIB14_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[14]); + break; + case GL_MAP1_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[15]); + break; + case GL_FRAGMENT_PROGRAM_NV: + CHECK_EXTENSION_F(NV_fragment_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.Enabled); + break; + case GL_MAX_TEXTURE_COORDS_NV: + CHECK_EXTENSION_F(NV_fragment_program, pname); + params[0] = (GLfloat)(ctx->Const.MaxTextureCoordUnits); + break; + case GL_MAX_TEXTURE_IMAGE_UNITS_NV: + CHECK_EXTENSION_F(NV_fragment_program, pname); + params[0] = (GLfloat)(ctx->Const.MaxTextureImageUnits); + break; + case GL_FRAGMENT_PROGRAM_BINDING_NV: + CHECK_EXTENSION_F(NV_fragment_program, pname); + params[0] = (GLfloat)(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0); + break; + case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: + CHECK_EXTENSION_F(NV_fragment_program, pname); + params[0] = (GLfloat)(MAX_NV_FRAGMENT_PROGRAM_PARAMS); + break; + case GL_TEXTURE_RECTANGLE_NV: + CHECK_EXTENSION_F(NV_texture_rectangle, pname); + params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)); + break; + case GL_TEXTURE_BINDING_RECTANGLE_NV: + CHECK_EXTENSION_F(NV_texture_rectangle, pname); + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name); + break; + case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: + CHECK_EXTENSION_F(NV_texture_rectangle, pname); + params[0] = (GLfloat)(ctx->Const.MaxTextureRectSize); + break; + case GL_STENCIL_TEST_TWO_SIDE_EXT: + CHECK_EXTENSION_F(EXT_stencil_two_side, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Stencil.TestTwoSide); + break; + case GL_ACTIVE_STENCIL_FACE_EXT: + CHECK_EXTENSION_F(EXT_stencil_two_side, pname); + params[0] = ENUM_TO_FLOAT(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); + break; + case GL_MAX_SHININESS_NV: + CHECK_EXTENSION_F(NV_light_max_exponent, pname); + params[0] = ctx->Const.MaxShininess; + break; + case GL_MAX_SPOT_EXPONENT_NV: + CHECK_EXTENSION_F(NV_light_max_exponent, pname); + params[0] = ctx->Const.MaxSpotExponent; + break; + case GL_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); + params[0] = (GLfloat)(ctx->Array.ArrayBufferObj->Name); + break; + case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); + params[0] = (GLfloat)(ctx->Array.Vertex.BufferObj->Name); + break; + case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); + params[0] = (GLfloat)(ctx->Array.Normal.BufferObj->Name); + break; + case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); + params[0] = (GLfloat)(ctx->Array.Color.BufferObj->Name); + break; + case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); + params[0] = (GLfloat)(ctx->Array.Index.BufferObj->Name); + break; + case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); + params[0] = (GLfloat)(ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name); + break; + case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); + params[0] = (GLfloat)(ctx->Array.EdgeFlag.BufferObj->Name); + break; + case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); + params[0] = (GLfloat)(ctx->Array.SecondaryColor.BufferObj->Name); + break; + case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); + params[0] = (GLfloat)(ctx->Array.FogCoord.BufferObj->Name); + break; + case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); + params[0] = (GLfloat)(ctx->Array.ElementArrayBufferObj->Name); + break; + case GL_PIXEL_PACK_BUFFER_BINDING_EXT: + CHECK_EXTENSION_F(EXT_pixel_buffer_object, pname); + params[0] = (GLfloat)(ctx->Pack.BufferObj->Name); + break; + case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: + CHECK_EXTENSION_F(EXT_pixel_buffer_object, pname); + params[0] = (GLfloat)(ctx->Unpack.BufferObj->Name); + break; + case GL_MAX_VERTEX_ATTRIBS_ARB: + CHECK_EXTENSION_F(ARB_vertex_program, pname); + params[0] = (GLfloat)(ctx->Const.MaxVertexProgramAttribs); + break; + case GL_FRAGMENT_PROGRAM_ARB: + CHECK_EXTENSION_F(ARB_fragment_program, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.Enabled); + break; + case GL_TRANSPOSE_CURRENT_MATRIX_ARB: + CHECK_EXTENSION_F(ARB_fragment_program, pname); + { + const GLfloat *matrix = ctx->CurrentStack->Top->m; + params[0] = matrix[0]; + params[1] = matrix[4]; + params[2] = matrix[8]; + params[3] = matrix[12]; + params[4] = matrix[1]; + params[5] = matrix[5]; + params[6] = matrix[9]; + params[7] = matrix[13]; + params[8] = matrix[2]; + params[9] = matrix[6]; + params[10] = matrix[10]; + params[11] = matrix[14]; + params[12] = matrix[3]; + params[13] = matrix[7]; + params[14] = matrix[11]; + params[15] = matrix[15]; + } + break; + case GL_DEPTH_BOUNDS_TEST_EXT: + CHECK_EXTENSION_F(EXT_depth_bounds_test, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.BoundsTest); + break; + case GL_DEPTH_BOUNDS_EXT: + CHECK_EXTENSION_F(EXT_depth_bounds_test, pname); + params[0] = ctx->Depth.BoundsMin; + params[1] = ctx->Depth.BoundsMax; + break; + case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: + CHECK_EXTENSION_F(MESA_program_debug, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.CallbackEnabled); + break; + case GL_VERTEX_PROGRAM_CALLBACK_MESA: + CHECK_EXTENSION_F(MESA_program_debug, pname); + params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.CallbackEnabled); + break; + case GL_FRAGMENT_PROGRAM_POSITION_MESA: + CHECK_EXTENSION_F(MESA_program_debug, pname); + params[0] = (GLfloat)(ctx->FragmentProgram.CurrentPosition); + break; + case GL_VERTEX_PROGRAM_POSITION_MESA: + CHECK_EXTENSION_F(MESA_program_debug, pname); + params[0] = (GLfloat)(ctx->VertexProgram.CurrentPosition); + break; + case GL_MAX_DRAW_BUFFERS_ARB: + CHECK_EXTENSION_F(ARB_draw_buffers, pname); + params[0] = (GLfloat)(ctx->Const.MaxDrawBuffers); + break; + case GL_DRAW_BUFFER0_ARB: + CHECK_EXTENSION_F(ARB_draw_buffers, pname); + params[0] = ENUM_TO_FLOAT(ctx->Color.DrawBuffer[0]); + break; + case GL_DRAW_BUFFER1_ARB: + CHECK_EXTENSION_F(ARB_draw_buffers, pname); + { + GLenum buffer; + if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); + return; + } + buffer = ctx->Color.DrawBuffer[1]; + params[0] = ENUM_TO_FLOAT(buffer); + } + break; + case GL_DRAW_BUFFER2_ARB: + CHECK_EXTENSION_F(ARB_draw_buffers, pname); + { + GLenum buffer; + if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); + return; + } + buffer = ctx->Color.DrawBuffer[2]; + params[0] = ENUM_TO_FLOAT(buffer); + } + break; + case GL_DRAW_BUFFER3_ARB: + CHECK_EXTENSION_F(ARB_draw_buffers, pname); + { + GLenum buffer; + if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); + return; + } + buffer = ctx->Color.DrawBuffer[3]; + params[0] = ENUM_TO_FLOAT(buffer); + } + break; + case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: + CHECK_EXTENSION_F(OES_read_format, pname); + params[0] = (GLfloat)(ctx->Const.ColorReadType); + break; + case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: + CHECK_EXTENSION_F(OES_read_format, pname); + params[0] = (GLfloat)(ctx->Const.ColorReadFormat); + break; + case GL_NUM_FRAGMENT_REGISTERS_ATI: + CHECK_EXTENSION_F(ATI_fragment_shader, pname); + params[0] = (GLfloat)(6); + break; + case GL_NUM_FRAGMENT_CONSTANTS_ATI: + CHECK_EXTENSION_F(ATI_fragment_shader, pname); + params[0] = (GLfloat)(8); + break; + case GL_NUM_PASSES_ATI: + CHECK_EXTENSION_F(ATI_fragment_shader, pname); + params[0] = (GLfloat)(2); + break; + case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: + CHECK_EXTENSION_F(ATI_fragment_shader, pname); + params[0] = (GLfloat)(8); + break; + case GL_NUM_INSTRUCTIONS_TOTAL_ATI: + CHECK_EXTENSION_F(ATI_fragment_shader, pname); + params[0] = (GLfloat)(16); + break; + case GL_COLOR_ALPHA_PAIRING_ATI: + CHECK_EXTENSION_F(ATI_fragment_shader, pname); + params[0] = BOOLEAN_TO_FLOAT(GL_TRUE); + break; + case GL_NUM_LOOPBACK_COMPONENTS_ATI: + CHECK_EXTENSION_F(ATI_fragment_shader, pname); + params[0] = (GLfloat)(3); + break; + case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: + CHECK_EXTENSION_F(ATI_fragment_shader, pname); + params[0] = (GLfloat)(3); + break; + case GL_STENCIL_BACK_FUNC: + params[0] = ENUM_TO_FLOAT(ctx->Stencil.Function[1]); + break; + case GL_STENCIL_BACK_VALUE_MASK: + params[0] = (GLfloat)(ctx->Stencil.ValueMask[1]); + break; + case GL_STENCIL_BACK_REF: + params[0] = (GLfloat)(ctx->Stencil.Ref[1]); + break; + case GL_STENCIL_BACK_FAIL: + params[0] = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[1]); + break; + case GL_STENCIL_BACK_PASS_DEPTH_FAIL: + params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[1]); + break; + case GL_STENCIL_BACK_PASS_DEPTH_PASS: + params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[1]); + break; + case GL_FRAMEBUFFER_BINDING_EXT: + CHECK_EXTENSION_F(EXT_framebuffer_object, pname); + params[0] = (GLfloat)(ctx->DrawBuffer->Name); + break; + case GL_RENDERBUFFER_BINDING_EXT: + CHECK_EXTENSION_F(EXT_framebuffer_object, pname); + params[0] = (GLfloat)(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0); + break; + case GL_MAX_COLOR_ATTACHMENTS_EXT: + CHECK_EXTENSION_F(EXT_framebuffer_object, pname); + params[0] = (GLfloat)(ctx->Const.MaxColorAttachments); + break; + case GL_MAX_RENDERBUFFER_SIZE_EXT: + CHECK_EXTENSION_F(EXT_framebuffer_object, pname); + params[0] = (GLfloat)(ctx->Const.MaxRenderbufferSize); + break; + case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: + CHECK_EXTENSION_F(ARB_fragment_shader, pname); + params[0] = (GLfloat)(MAX_FRAGMENT_UNIFORM_COMPONENTS); + break; + case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: + CHECK_EXTENSION_F(ARB_fragment_shader, pname); + params[0] = ENUM_TO_FLOAT(ctx->Hint.FragmentShaderDerivative); + break; + case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: + CHECK_EXTENSION_F(ARB_vertex_shader, pname); + params[0] = (GLfloat)(MAX_VERTEX_UNIFORM_COMPONENTS); + break; + case GL_MAX_VARYING_FLOATS_ARB: + CHECK_EXTENSION_F(ARB_vertex_shader, pname); + params[0] = (GLfloat)(MAX_VARYING_FLOATS); + break; + case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: + CHECK_EXTENSION_F(ARB_vertex_shader, pname); + params[0] = (GLfloat)(MAX_VERTEX_TEXTURE_IMAGE_UNITS); + break; + case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: + CHECK_EXTENSION_F(ARB_vertex_shader, pname); + params[0] = (GLfloat)(MAX_COMBINED_TEXTURE_IMAGE_UNITS); + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(pname=0x%x)", pname); + } +} + +void GLAPIENTRY +_mesa_GetIntegerv( GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!params) + return; + + if (ctx->NewState) + _mesa_update_state(ctx); + + if (ctx->Driver.GetIntegerv && + ctx->Driver.GetIntegerv(ctx, pname, params)) + return; + + switch (pname) { + case GL_ACCUM_RED_BITS: + params[0] = ctx->DrawBuffer->Visual.accumRedBits; + break; + case GL_ACCUM_GREEN_BITS: + params[0] = ctx->DrawBuffer->Visual.accumGreenBits; + break; + case GL_ACCUM_BLUE_BITS: + params[0] = ctx->DrawBuffer->Visual.accumBlueBits; + break; + case GL_ACCUM_ALPHA_BITS: + params[0] = ctx->DrawBuffer->Visual.accumAlphaBits; + break; + case GL_ACCUM_CLEAR_VALUE: + params[0] = FLOAT_TO_INT(ctx->Accum.ClearColor[0]); + params[1] = FLOAT_TO_INT(ctx->Accum.ClearColor[1]); + params[2] = FLOAT_TO_INT(ctx->Accum.ClearColor[2]); + params[3] = FLOAT_TO_INT(ctx->Accum.ClearColor[3]); + break; + case GL_ALPHA_BIAS: + params[0] = IROUND(ctx->Pixel.AlphaBias); + break; + case GL_ALPHA_BITS: + params[0] = ctx->DrawBuffer->Visual.alphaBits; + break; + case GL_ALPHA_SCALE: + params[0] = IROUND(ctx->Pixel.AlphaScale); + break; + case GL_ALPHA_TEST: + params[0] = BOOLEAN_TO_INT(ctx->Color.AlphaEnabled); + break; + case GL_ALPHA_TEST_FUNC: + params[0] = ENUM_TO_INT(ctx->Color.AlphaFunc); + break; + case GL_ALPHA_TEST_REF: + params[0] = FLOAT_TO_INT(ctx->Color.AlphaRef); + break; + case GL_ATTRIB_STACK_DEPTH: + params[0] = ctx->AttribStackDepth; + break; + case GL_AUTO_NORMAL: + params[0] = BOOLEAN_TO_INT(ctx->Eval.AutoNormal); + break; + case GL_AUX_BUFFERS: + params[0] = ctx->DrawBuffer->Visual.numAuxBuffers; + break; + case GL_BLEND: + params[0] = BOOLEAN_TO_INT(ctx->Color.BlendEnabled); + break; + case GL_BLEND_DST: + params[0] = ENUM_TO_INT(ctx->Color.BlendDstRGB); + break; + case GL_BLEND_SRC: + params[0] = ENUM_TO_INT(ctx->Color.BlendSrcRGB); + break; + case GL_BLEND_SRC_RGB_EXT: + params[0] = ENUM_TO_INT(ctx->Color.BlendSrcRGB); + break; + case GL_BLEND_DST_RGB_EXT: + params[0] = ENUM_TO_INT(ctx->Color.BlendDstRGB); + break; + case GL_BLEND_SRC_ALPHA_EXT: + params[0] = ENUM_TO_INT(ctx->Color.BlendSrcA); + break; + case GL_BLEND_DST_ALPHA_EXT: + params[0] = ENUM_TO_INT(ctx->Color.BlendDstA); + break; + case GL_BLEND_EQUATION: + params[0] = ENUM_TO_INT(ctx->Color.BlendEquationRGB ); + break; + case GL_BLEND_EQUATION_ALPHA_EXT: + params[0] = ENUM_TO_INT(ctx->Color.BlendEquationA ); + break; + case GL_BLEND_COLOR_EXT: + params[0] = FLOAT_TO_INT(ctx->Color.BlendColor[0]); + params[1] = FLOAT_TO_INT(ctx->Color.BlendColor[1]); + params[2] = FLOAT_TO_INT(ctx->Color.BlendColor[2]); + params[3] = FLOAT_TO_INT(ctx->Color.BlendColor[3]); + break; + case GL_BLUE_BIAS: + params[0] = IROUND(ctx->Pixel.BlueBias); + break; + case GL_BLUE_BITS: + params[0] = ctx->DrawBuffer->Visual.blueBits; + break; + case GL_BLUE_SCALE: + params[0] = IROUND(ctx->Pixel.BlueScale); + break; + case GL_CLIENT_ATTRIB_STACK_DEPTH: + params[0] = ctx->ClientAttribStackDepth; + break; + case GL_CLIP_PLANE0: + params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 0) & 1); + break; + case GL_CLIP_PLANE1: + params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 1) & 1); + break; + case GL_CLIP_PLANE2: + params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 2) & 1); + break; + case GL_CLIP_PLANE3: + params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 3) & 1); + break; + case GL_CLIP_PLANE4: + params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 4) & 1); + break; + case GL_CLIP_PLANE5: + params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 5) & 1); + break; + case GL_COLOR_CLEAR_VALUE: + params[0] = FLOAT_TO_INT(ctx->Color.ClearColor[0]); + params[1] = FLOAT_TO_INT(ctx->Color.ClearColor[1]); + params[2] = FLOAT_TO_INT(ctx->Color.ClearColor[2]); + params[3] = FLOAT_TO_INT(ctx->Color.ClearColor[3]); + break; + case GL_COLOR_MATERIAL: + params[0] = BOOLEAN_TO_INT(ctx->Light.ColorMaterialEnabled); + break; + case GL_COLOR_MATERIAL_FACE: + params[0] = ENUM_TO_INT(ctx->Light.ColorMaterialFace); + break; + case GL_COLOR_MATERIAL_PARAMETER: + params[0] = ENUM_TO_INT(ctx->Light.ColorMaterialMode); + break; + case GL_COLOR_WRITEMASK: + params[0] = ctx->Color.ColorMask[RCOMP] ? 1 : 0; + params[1] = ctx->Color.ColorMask[GCOMP] ? 1 : 0; + params[2] = ctx->Color.ColorMask[BCOMP] ? 1 : 0; + params[3] = ctx->Color.ColorMask[ACOMP] ? 1 : 0; + break; + case GL_CULL_FACE: + params[0] = BOOLEAN_TO_INT(ctx->Polygon.CullFlag); + break; + case GL_CULL_FACE_MODE: + params[0] = ENUM_TO_INT(ctx->Polygon.CullFaceMode); + break; + case GL_CURRENT_COLOR: + { + FLUSH_CURRENT(ctx, 0); + params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); + params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); + params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); + params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); + } + break; + case GL_CURRENT_INDEX: + { + FLUSH_CURRENT(ctx, 0); + params[0] = IROUND(ctx->Current.Index); + } + break; + case GL_CURRENT_NORMAL: + { + FLUSH_CURRENT(ctx, 0); + params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); + params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); + params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); + } + break; + case GL_CURRENT_RASTER_COLOR: + params[0] = FLOAT_TO_INT(ctx->Current.RasterColor[0]); + params[1] = FLOAT_TO_INT(ctx->Current.RasterColor[1]); + params[2] = FLOAT_TO_INT(ctx->Current.RasterColor[2]); + params[3] = FLOAT_TO_INT(ctx->Current.RasterColor[3]); + break; + case GL_CURRENT_RASTER_DISTANCE: + params[0] = IROUND(ctx->Current.RasterDistance); + break; + case GL_CURRENT_RASTER_INDEX: + params[0] = IROUND(ctx->Current.RasterIndex); + break; + case GL_CURRENT_RASTER_POSITION: + params[0] = IROUND(ctx->Current.RasterPos[0]); + params[1] = IROUND(ctx->Current.RasterPos[1]); + params[2] = IROUND(ctx->Current.RasterPos[2]); + params[3] = IROUND(ctx->Current.RasterPos[3]); + break; + case GL_CURRENT_RASTER_TEXTURE_COORDS: + { + const GLuint texUnit = ctx->Texture.CurrentUnit; + params[0] = IROUND(ctx->Current.RasterTexCoords[texUnit][0]); + params[1] = IROUND(ctx->Current.RasterTexCoords[texUnit][1]); + params[2] = IROUND(ctx->Current.RasterTexCoords[texUnit][2]); + params[3] = IROUND(ctx->Current.RasterTexCoords[texUnit][3]); + } + break; + case GL_CURRENT_RASTER_POSITION_VALID: + params[0] = BOOLEAN_TO_INT(ctx->Current.RasterPosValid); + break; + case GL_CURRENT_TEXTURE_COORDS: + { + const GLuint texUnit = ctx->Texture.CurrentUnit; + params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]); + params[1] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]); + params[2] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]); + params[3] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]); + } + break; + case GL_DEPTH_BIAS: + params[0] = IROUND(ctx->Pixel.DepthBias); + break; + case GL_DEPTH_BITS: + params[0] = ctx->DrawBuffer->Visual.depthBits; + break; + case GL_DEPTH_CLEAR_VALUE: + params[0] = IROUND(ctx->Depth.Clear); + break; + case GL_DEPTH_FUNC: + params[0] = ENUM_TO_INT(ctx->Depth.Func); + break; + case GL_DEPTH_RANGE: + params[0] = FLOAT_TO_INT(ctx->Viewport.Near); + params[1] = FLOAT_TO_INT(ctx->Viewport.Far); + break; + case GL_DEPTH_SCALE: + params[0] = IROUND(ctx->Pixel.DepthScale); + break; + case GL_DEPTH_TEST: + params[0] = BOOLEAN_TO_INT(ctx->Depth.Test); + break; + case GL_DEPTH_WRITEMASK: + params[0] = BOOLEAN_TO_INT(ctx->Depth.Mask); + break; + case GL_DITHER: + params[0] = BOOLEAN_TO_INT(ctx->Color.DitherFlag); + break; + case GL_DOUBLEBUFFER: + params[0] = BOOLEAN_TO_INT(ctx->DrawBuffer->Visual.doubleBufferMode); + break; + case GL_DRAW_BUFFER: + params[0] = ENUM_TO_INT(ctx->Color.DrawBuffer[0]); + break; + case GL_EDGE_FLAG: + { + FLUSH_CURRENT(ctx, 0); + params[0] = BOOLEAN_TO_INT(ctx->Current.EdgeFlag); + } + break; + case GL_FEEDBACK_BUFFER_SIZE: + params[0] = ctx->Feedback.BufferSize; + break; + case GL_FEEDBACK_BUFFER_TYPE: + params[0] = ENUM_TO_INT(ctx->Feedback.Type); + break; + case GL_FOG: + params[0] = BOOLEAN_TO_INT(ctx->Fog.Enabled); + break; + case GL_FOG_COLOR: + params[0] = FLOAT_TO_INT(ctx->Fog.Color[0]); + params[1] = FLOAT_TO_INT(ctx->Fog.Color[1]); + params[2] = FLOAT_TO_INT(ctx->Fog.Color[2]); + params[3] = FLOAT_TO_INT(ctx->Fog.Color[3]); + break; + case GL_FOG_DENSITY: + params[0] = IROUND(ctx->Fog.Density); + break; + case GL_FOG_END: + params[0] = IROUND(ctx->Fog.End); + break; + case GL_FOG_HINT: + params[0] = ENUM_TO_INT(ctx->Hint.Fog); + break; + case GL_FOG_INDEX: + params[0] = IROUND(ctx->Fog.Index); + break; + case GL_FOG_MODE: + params[0] = ENUM_TO_INT(ctx->Fog.Mode); + break; + case GL_FOG_START: + params[0] = IROUND(ctx->Fog.Start); + break; + case GL_FRONT_FACE: + params[0] = ENUM_TO_INT(ctx->Polygon.FrontFace); + break; + case GL_GREEN_BIAS: + params[0] = IROUND(ctx->Pixel.GreenBias); + break; + case GL_GREEN_BITS: + params[0] = ctx->DrawBuffer->Visual.greenBits; + break; + case GL_GREEN_SCALE: + params[0] = IROUND(ctx->Pixel.GreenScale); + break; + case GL_INDEX_BITS: + params[0] = ctx->DrawBuffer->Visual.indexBits; + break; + case GL_INDEX_CLEAR_VALUE: + params[0] = ctx->Color.ClearIndex; + break; + case GL_INDEX_MODE: + params[0] = BOOLEAN_TO_INT(!ctx->DrawBuffer->Visual.rgbMode); + break; + case GL_INDEX_OFFSET: + params[0] = ctx->Pixel.IndexOffset; + break; + case GL_INDEX_SHIFT: + params[0] = ctx->Pixel.IndexShift; + break; + case GL_INDEX_WRITEMASK: + params[0] = ctx->Color.IndexMask; + break; + case GL_LIGHT0: + params[0] = BOOLEAN_TO_INT(ctx->Light.Light[0].Enabled); + break; + case GL_LIGHT1: + params[0] = BOOLEAN_TO_INT(ctx->Light.Light[1].Enabled); + break; + case GL_LIGHT2: + params[0] = BOOLEAN_TO_INT(ctx->Light.Light[2].Enabled); + break; + case GL_LIGHT3: + params[0] = BOOLEAN_TO_INT(ctx->Light.Light[3].Enabled); + break; + case GL_LIGHT4: + params[0] = BOOLEAN_TO_INT(ctx->Light.Light[4].Enabled); + break; + case GL_LIGHT5: + params[0] = BOOLEAN_TO_INT(ctx->Light.Light[5].Enabled); + break; + case GL_LIGHT6: + params[0] = BOOLEAN_TO_INT(ctx->Light.Light[6].Enabled); + break; + case GL_LIGHT7: + params[0] = BOOLEAN_TO_INT(ctx->Light.Light[7].Enabled); + break; + case GL_LIGHTING: + params[0] = BOOLEAN_TO_INT(ctx->Light.Enabled); + break; + case GL_LIGHT_MODEL_AMBIENT: + params[0] = FLOAT_TO_INT(ctx->Light.Model.Ambient[0]); + params[1] = FLOAT_TO_INT(ctx->Light.Model.Ambient[1]); + params[2] = FLOAT_TO_INT(ctx->Light.Model.Ambient[2]); + params[3] = FLOAT_TO_INT(ctx->Light.Model.Ambient[3]); + break; + case GL_LIGHT_MODEL_COLOR_CONTROL: + params[0] = ENUM_TO_INT(ctx->Light.Model.ColorControl); + break; + case GL_LIGHT_MODEL_LOCAL_VIEWER: + params[0] = BOOLEAN_TO_INT(ctx->Light.Model.LocalViewer); + break; + case GL_LIGHT_MODEL_TWO_SIDE: + params[0] = BOOLEAN_TO_INT(ctx->Light.Model.TwoSide); + break; + case GL_LINE_SMOOTH: + params[0] = BOOLEAN_TO_INT(ctx->Line.SmoothFlag); + break; + case GL_LINE_SMOOTH_HINT: + params[0] = ENUM_TO_INT(ctx->Hint.LineSmooth); + break; + case GL_LINE_STIPPLE: + params[0] = BOOLEAN_TO_INT(ctx->Line.StippleFlag); + break; + case GL_LINE_STIPPLE_PATTERN: + params[0] = ctx->Line.StipplePattern; + break; + case GL_LINE_STIPPLE_REPEAT: + params[0] = ctx->Line.StippleFactor; + break; + case GL_LINE_WIDTH: + params[0] = IROUND(ctx->Line.Width); + break; + case GL_LINE_WIDTH_GRANULARITY: + params[0] = IROUND(ctx->Const.LineWidthGranularity); + break; + case GL_LINE_WIDTH_RANGE: + params[0] = IROUND(ctx->Const.MinLineWidthAA); + params[1] = IROUND(ctx->Const.MaxLineWidthAA); + break; + case GL_ALIASED_LINE_WIDTH_RANGE: + params[0] = IROUND(ctx->Const.MinLineWidth); + params[1] = IROUND(ctx->Const.MaxLineWidth); + break; + case GL_LIST_BASE: + params[0] = ctx->List.ListBase; + break; + case GL_LIST_INDEX: + params[0] = ctx->ListState.CurrentListNum; + break; + case GL_LIST_MODE: + { + GLenum mode; + if (!ctx->CompileFlag) + mode = 0; + else if (ctx->ExecuteFlag) + mode = GL_COMPILE_AND_EXECUTE; + else + mode = GL_COMPILE; + params[0] = ENUM_TO_INT(mode); + } + break; + case GL_INDEX_LOGIC_OP: + params[0] = BOOLEAN_TO_INT(ctx->Color.IndexLogicOpEnabled); + break; + case GL_COLOR_LOGIC_OP: + params[0] = BOOLEAN_TO_INT(ctx->Color.ColorLogicOpEnabled); + break; + case GL_LOGIC_OP_MODE: + params[0] = ENUM_TO_INT(ctx->Color.LogicOp); + break; + case GL_MAP1_COLOR_4: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Color4); + break; + case GL_MAP1_GRID_DOMAIN: + params[0] = IROUND(ctx->Eval.MapGrid1u1); + params[1] = IROUND(ctx->Eval.MapGrid1u2); + break; + case GL_MAP1_GRID_SEGMENTS: + params[0] = ctx->Eval.MapGrid1un; + break; + case GL_MAP1_INDEX: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Index); + break; + case GL_MAP1_NORMAL: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Normal); + break; + case GL_MAP1_TEXTURE_COORD_1: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord1); + break; + case GL_MAP1_TEXTURE_COORD_2: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord2); + break; + case GL_MAP1_TEXTURE_COORD_3: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord3); + break; + case GL_MAP1_TEXTURE_COORD_4: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord4); + break; + case GL_MAP1_VERTEX_3: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Vertex3); + break; + case GL_MAP1_VERTEX_4: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Vertex4); + break; + case GL_MAP2_COLOR_4: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Color4); + break; + case GL_MAP2_GRID_DOMAIN: + params[0] = IROUND(ctx->Eval.MapGrid2u1); + params[1] = IROUND(ctx->Eval.MapGrid2u2); + params[2] = IROUND(ctx->Eval.MapGrid2v1); + params[3] = IROUND(ctx->Eval.MapGrid2v2); + break; + case GL_MAP2_GRID_SEGMENTS: + params[0] = ctx->Eval.MapGrid2un; + params[1] = ctx->Eval.MapGrid2vn; + break; + case GL_MAP2_INDEX: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Index); + break; + case GL_MAP2_NORMAL: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Normal); + break; + case GL_MAP2_TEXTURE_COORD_1: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord1); + break; + case GL_MAP2_TEXTURE_COORD_2: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord2); + break; + case GL_MAP2_TEXTURE_COORD_3: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord3); + break; + case GL_MAP2_TEXTURE_COORD_4: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord4); + break; + case GL_MAP2_VERTEX_3: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Vertex3); + break; + case GL_MAP2_VERTEX_4: + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Vertex4); + break; + case GL_MAP_COLOR: + params[0] = BOOLEAN_TO_INT(ctx->Pixel.MapColorFlag); + break; + case GL_MAP_STENCIL: + params[0] = BOOLEAN_TO_INT(ctx->Pixel.MapStencilFlag); + break; + case GL_MATRIX_MODE: + params[0] = ENUM_TO_INT(ctx->Transform.MatrixMode); + break; + case GL_MAX_ATTRIB_STACK_DEPTH: + params[0] = MAX_ATTRIB_STACK_DEPTH; + break; + case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: + params[0] = MAX_CLIENT_ATTRIB_STACK_DEPTH; + break; + case GL_MAX_CLIP_PLANES: + params[0] = ctx->Const.MaxClipPlanes; + break; + case GL_MAX_ELEMENTS_VERTICES: + params[0] = ctx->Const.MaxArrayLockSize; + break; + case GL_MAX_ELEMENTS_INDICES: + params[0] = ctx->Const.MaxArrayLockSize; + break; + case GL_MAX_EVAL_ORDER: + params[0] = MAX_EVAL_ORDER; + break; + case GL_MAX_LIGHTS: + params[0] = ctx->Const.MaxLights; + break; + case GL_MAX_LIST_NESTING: + params[0] = MAX_LIST_NESTING; + break; + case GL_MAX_MODELVIEW_STACK_DEPTH: + params[0] = MAX_MODELVIEW_STACK_DEPTH; + break; + case GL_MAX_NAME_STACK_DEPTH: + params[0] = MAX_NAME_STACK_DEPTH; + break; + case GL_MAX_PIXEL_MAP_TABLE: + params[0] = MAX_PIXEL_MAP_TABLE; + break; + case GL_MAX_PROJECTION_STACK_DEPTH: + params[0] = MAX_PROJECTION_STACK_DEPTH; + break; + case GL_MAX_TEXTURE_SIZE: + params[0] = 1 << (ctx->Const.MaxTextureLevels - 1); + break; + case GL_MAX_3D_TEXTURE_SIZE: + params[0] = 1 << (ctx->Const.Max3DTextureLevels - 1); + break; + case GL_MAX_TEXTURE_STACK_DEPTH: + params[0] = MAX_TEXTURE_STACK_DEPTH; + break; + case GL_MAX_VIEWPORT_DIMS: + params[0] = ctx->Const.MaxViewportWidth; + params[1] = ctx->Const.MaxViewportHeight; + break; + case GL_MODELVIEW_MATRIX: + { + const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; + params[0] = IROUND(matrix[0]); + params[1] = IROUND(matrix[1]); + params[2] = IROUND(matrix[2]); + params[3] = IROUND(matrix[3]); + params[4] = IROUND(matrix[4]); + params[5] = IROUND(matrix[5]); + params[6] = IROUND(matrix[6]); + params[7] = IROUND(matrix[7]); + params[8] = IROUND(matrix[8]); + params[9] = IROUND(matrix[9]); + params[10] = IROUND(matrix[10]); + params[11] = IROUND(matrix[11]); + params[12] = IROUND(matrix[12]); + params[13] = IROUND(matrix[13]); + params[14] = IROUND(matrix[14]); + params[15] = IROUND(matrix[15]); + } + break; + case GL_MODELVIEW_STACK_DEPTH: + params[0] = ctx->ModelviewMatrixStack.Depth + 1; + break; + case GL_NAME_STACK_DEPTH: + params[0] = ctx->Select.NameStackDepth; + break; + case GL_NORMALIZE: + params[0] = BOOLEAN_TO_INT(ctx->Transform.Normalize); + break; + case GL_PACK_ALIGNMENT: + params[0] = ctx->Pack.Alignment; + break; + case GL_PACK_LSB_FIRST: + params[0] = BOOLEAN_TO_INT(ctx->Pack.LsbFirst); + break; + case GL_PACK_ROW_LENGTH: + params[0] = ctx->Pack.RowLength; + break; + case GL_PACK_SKIP_PIXELS: + params[0] = ctx->Pack.SkipPixels; + break; + case GL_PACK_SKIP_ROWS: + params[0] = ctx->Pack.SkipRows; + break; + case GL_PACK_SWAP_BYTES: + params[0] = BOOLEAN_TO_INT(ctx->Pack.SwapBytes); + break; + case GL_PACK_SKIP_IMAGES_EXT: + params[0] = ctx->Pack.SkipImages; + break; + case GL_PACK_IMAGE_HEIGHT_EXT: + params[0] = ctx->Pack.ImageHeight; + break; + case GL_PACK_INVERT_MESA: + params[0] = BOOLEAN_TO_INT(ctx->Pack.Invert); + break; + case GL_PERSPECTIVE_CORRECTION_HINT: + params[0] = ENUM_TO_INT(ctx->Hint.PerspectiveCorrection); + break; + case GL_PIXEL_MAP_A_TO_A_SIZE: + params[0] = ctx->Pixel.MapAtoAsize; + break; + case GL_PIXEL_MAP_B_TO_B_SIZE: + params[0] = ctx->Pixel.MapBtoBsize; + break; + case GL_PIXEL_MAP_G_TO_G_SIZE: + params[0] = ctx->Pixel.MapGtoGsize; + break; + case GL_PIXEL_MAP_I_TO_A_SIZE: + params[0] = ctx->Pixel.MapItoAsize; + break; + case GL_PIXEL_MAP_I_TO_B_SIZE: + params[0] = ctx->Pixel.MapItoBsize; + break; + case GL_PIXEL_MAP_I_TO_G_SIZE: + params[0] = ctx->Pixel.MapItoGsize; + break; + case GL_PIXEL_MAP_I_TO_I_SIZE: + params[0] = ctx->Pixel.MapItoIsize; + break; + case GL_PIXEL_MAP_I_TO_R_SIZE: + params[0] = ctx->Pixel.MapItoRsize; + break; + case GL_PIXEL_MAP_R_TO_R_SIZE: + params[0] = ctx->Pixel.MapRtoRsize; + break; + case GL_PIXEL_MAP_S_TO_S_SIZE: + params[0] = ctx->Pixel.MapStoSsize; + break; + case GL_POINT_SIZE: + params[0] = IROUND(ctx->Point.Size); + break; + case GL_POINT_SIZE_GRANULARITY: + params[0] = IROUND(ctx->Const.PointSizeGranularity); + break; + case GL_POINT_SIZE_RANGE: + params[0] = IROUND(ctx->Const.MinPointSizeAA); + params[1] = IROUND(ctx->Const.MaxPointSizeAA); + break; + case GL_ALIASED_POINT_SIZE_RANGE: + params[0] = IROUND(ctx->Const.MinPointSize); + params[1] = IROUND(ctx->Const.MaxPointSize); + break; + case GL_POINT_SMOOTH: + params[0] = BOOLEAN_TO_INT(ctx->Point.SmoothFlag); + break; + case GL_POINT_SMOOTH_HINT: + params[0] = ENUM_TO_INT(ctx->Hint.PointSmooth); + break; + case GL_POINT_SIZE_MIN_EXT: + params[0] = IROUND(ctx->Point.MinSize); + break; + case GL_POINT_SIZE_MAX_EXT: + params[0] = IROUND(ctx->Point.MaxSize); + break; + case GL_POINT_FADE_THRESHOLD_SIZE_EXT: + params[0] = IROUND(ctx->Point.Threshold); + break; + case GL_DISTANCE_ATTENUATION_EXT: + params[0] = IROUND(ctx->Point.Params[0]); + params[1] = IROUND(ctx->Point.Params[1]); + params[2] = IROUND(ctx->Point.Params[2]); + break; + case GL_POLYGON_MODE: + params[0] = ENUM_TO_INT(ctx->Polygon.FrontMode); + params[1] = ENUM_TO_INT(ctx->Polygon.BackMode); + break; + case GL_POLYGON_OFFSET_BIAS_EXT: + params[0] = IROUND(ctx->Polygon.OffsetUnits); + break; + case GL_POLYGON_OFFSET_FACTOR: + params[0] = IROUND(ctx->Polygon.OffsetFactor ); + break; + case GL_POLYGON_OFFSET_UNITS: + params[0] = IROUND(ctx->Polygon.OffsetUnits ); + break; + case GL_POLYGON_SMOOTH: + params[0] = BOOLEAN_TO_INT(ctx->Polygon.SmoothFlag); + break; + case GL_POLYGON_SMOOTH_HINT: + params[0] = ENUM_TO_INT(ctx->Hint.PolygonSmooth); + break; + case GL_POLYGON_STIPPLE: + params[0] = BOOLEAN_TO_INT(ctx->Polygon.StippleFlag); + break; + case GL_PROJECTION_MATRIX: + { + const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; + params[0] = IROUND(matrix[0]); + params[1] = IROUND(matrix[1]); + params[2] = IROUND(matrix[2]); + params[3] = IROUND(matrix[3]); + params[4] = IROUND(matrix[4]); + params[5] = IROUND(matrix[5]); + params[6] = IROUND(matrix[6]); + params[7] = IROUND(matrix[7]); + params[8] = IROUND(matrix[8]); + params[9] = IROUND(matrix[9]); + params[10] = IROUND(matrix[10]); + params[11] = IROUND(matrix[11]); + params[12] = IROUND(matrix[12]); + params[13] = IROUND(matrix[13]); + params[14] = IROUND(matrix[14]); + params[15] = IROUND(matrix[15]); + } + break; + case GL_PROJECTION_STACK_DEPTH: + params[0] = ctx->ProjectionMatrixStack.Depth + 1; + break; + case GL_READ_BUFFER: + params[0] = ENUM_TO_INT(ctx->Pixel.ReadBuffer); + break; + case GL_RED_BIAS: + params[0] = IROUND(ctx->Pixel.RedBias); + break; + case GL_RED_BITS: + params[0] = ctx->DrawBuffer->Visual.redBits ; + break; + case GL_RED_SCALE: + params[0] = IROUND(ctx->Pixel.RedScale); + break; + case GL_RENDER_MODE: + params[0] = ENUM_TO_INT(ctx->RenderMode); + break; + case GL_RESCALE_NORMAL: + params[0] = BOOLEAN_TO_INT(ctx->Transform.RescaleNormals); + break; + case GL_RGBA_MODE: + params[0] = BOOLEAN_TO_INT(ctx->DrawBuffer->Visual.rgbMode); + break; + case GL_SCISSOR_BOX: + params[0] = ctx->Scissor.X; + params[1] = ctx->Scissor.Y; + params[2] = ctx->Scissor.Width; + params[3] = ctx->Scissor.Height; + break; + case GL_SCISSOR_TEST: + params[0] = BOOLEAN_TO_INT(ctx->Scissor.Enabled); + break; + case GL_SELECTION_BUFFER_SIZE: + params[0] = ctx->Select.BufferSize; + break; + case GL_SHADE_MODEL: + params[0] = ENUM_TO_INT(ctx->Light.ShadeModel); + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + params[0] = BOOLEAN_TO_INT(ctx->Texture.SharedPalette); + break; + case GL_STENCIL_BITS: + params[0] = ctx->DrawBuffer->Visual.stencilBits; + break; + case GL_STENCIL_CLEAR_VALUE: + params[0] = ctx->Stencil.Clear; + break; + case GL_STENCIL_FAIL: + params[0] = ENUM_TO_INT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_FUNC: + params[0] = ENUM_TO_INT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_PASS_DEPTH_FAIL: + params[0] = ENUM_TO_INT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_PASS_DEPTH_PASS: + params[0] = ENUM_TO_INT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); + break; + case GL_STENCIL_REF: + params[0] = ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; + break; + case GL_STENCIL_TEST: + params[0] = BOOLEAN_TO_INT(ctx->Stencil.Enabled); + break; + case GL_STENCIL_VALUE_MASK: + params[0] = ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; + break; + case GL_STENCIL_WRITEMASK: + params[0] = ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]; + break; + case GL_STEREO: + params[0] = BOOLEAN_TO_INT(ctx->DrawBuffer->Visual.stereoMode); + break; + case GL_SUBPIXEL_BITS: + params[0] = ctx->Const.SubPixelBits; + break; + case GL_TEXTURE_1D: + params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_1D)); + break; + case GL_TEXTURE_2D: + params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_2D)); + break; + case GL_TEXTURE_3D: + params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_3D)); + break; + case GL_TEXTURE_BINDING_1D: + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name; + break; + case GL_TEXTURE_BINDING_2D: + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name; + break; + case GL_TEXTURE_BINDING_3D: + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name; + break; + case GL_TEXTURE_ENV_COLOR: + { + const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; + params[0] = FLOAT_TO_INT(color[0]); + params[1] = FLOAT_TO_INT(color[1]); + params[2] = FLOAT_TO_INT(color[2]); + params[3] = FLOAT_TO_INT(color[3]); + } + break; + case GL_TEXTURE_ENV_MODE: + params[0] = ENUM_TO_INT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode); + break; + case GL_TEXTURE_GEN_S: + params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); + break; + case GL_TEXTURE_GEN_T: + params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)); + break; + case GL_TEXTURE_GEN_R: + params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)); + break; + case GL_TEXTURE_GEN_Q: + params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)); + break; + case GL_TEXTURE_MATRIX: + { + const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; + params[0] = IROUND(matrix[0]); + params[1] = IROUND(matrix[1]); + params[2] = IROUND(matrix[2]); + params[3] = IROUND(matrix[3]); + params[4] = IROUND(matrix[4]); + params[5] = IROUND(matrix[5]); + params[6] = IROUND(matrix[6]); + params[7] = IROUND(matrix[7]); + params[8] = IROUND(matrix[8]); + params[9] = IROUND(matrix[9]); + params[10] = IROUND(matrix[10]); + params[11] = IROUND(matrix[11]); + params[12] = IROUND(matrix[12]); + params[13] = IROUND(matrix[13]); + params[14] = IROUND(matrix[14]); + params[15] = IROUND(matrix[15]); + } + break; + case GL_TEXTURE_STACK_DEPTH: + params[0] = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1; + break; + case GL_UNPACK_ALIGNMENT: + params[0] = ctx->Unpack.Alignment; + break; + case GL_UNPACK_LSB_FIRST: + params[0] = BOOLEAN_TO_INT(ctx->Unpack.LsbFirst); + break; + case GL_UNPACK_ROW_LENGTH: + params[0] = ctx->Unpack.RowLength; + break; + case GL_UNPACK_SKIP_PIXELS: + params[0] = ctx->Unpack.SkipPixels; + break; + case GL_UNPACK_SKIP_ROWS: + params[0] = ctx->Unpack.SkipRows; + break; + case GL_UNPACK_SWAP_BYTES: + params[0] = BOOLEAN_TO_INT(ctx->Unpack.SwapBytes); + break; + case GL_UNPACK_SKIP_IMAGES_EXT: + params[0] = ctx->Unpack.SkipImages; + break; + case GL_UNPACK_IMAGE_HEIGHT_EXT: + params[0] = ctx->Unpack.ImageHeight; + break; + case GL_UNPACK_CLIENT_STORAGE_APPLE: + params[0] = BOOLEAN_TO_INT(ctx->Unpack.ClientStorage); + break; + case GL_VIEWPORT: + params[0] = ctx->Viewport.X; + params[1] = ctx->Viewport.Y; + params[2] = ctx->Viewport.Width; + params[3] = ctx->Viewport.Height; + break; + case GL_ZOOM_X: + params[0] = IROUND(ctx->Pixel.ZoomX); + break; + case GL_ZOOM_Y: + params[0] = IROUND(ctx->Pixel.ZoomY); + break; + case GL_VERTEX_ARRAY: + params[0] = BOOLEAN_TO_INT(ctx->Array.Vertex.Enabled); + break; + case GL_VERTEX_ARRAY_SIZE: + params[0] = ctx->Array.Vertex.Size; + break; + case GL_VERTEX_ARRAY_TYPE: + params[0] = ENUM_TO_INT(ctx->Array.Vertex.Type); + break; + case GL_VERTEX_ARRAY_STRIDE: + params[0] = ctx->Array.Vertex.Stride; + break; + case GL_VERTEX_ARRAY_COUNT_EXT: + params[0] = 0; + break; + case GL_NORMAL_ARRAY: + params[0] = ENUM_TO_INT(ctx->Array.Normal.Enabled); + break; + case GL_NORMAL_ARRAY_TYPE: + params[0] = ENUM_TO_INT(ctx->Array.Normal.Type); + break; + case GL_NORMAL_ARRAY_STRIDE: + params[0] = ctx->Array.Normal.Stride; + break; + case GL_NORMAL_ARRAY_COUNT_EXT: + params[0] = 0; + break; + case GL_COLOR_ARRAY: + params[0] = BOOLEAN_TO_INT(ctx->Array.Color.Enabled); + break; + case GL_COLOR_ARRAY_SIZE: + params[0] = ctx->Array.Color.Size; + break; + case GL_COLOR_ARRAY_TYPE: + params[0] = ENUM_TO_INT(ctx->Array.Color.Type); + break; + case GL_COLOR_ARRAY_STRIDE: + params[0] = ctx->Array.Color.Stride; + break; + case GL_COLOR_ARRAY_COUNT_EXT: + params[0] = 0; + break; + case GL_INDEX_ARRAY: + params[0] = BOOLEAN_TO_INT(ctx->Array.Index.Enabled); + break; + case GL_INDEX_ARRAY_TYPE: + params[0] = ENUM_TO_INT(ctx->Array.Index.Type); + break; + case GL_INDEX_ARRAY_STRIDE: + params[0] = ctx->Array.Index.Stride; + break; + case GL_INDEX_ARRAY_COUNT_EXT: + params[0] = 0; + break; + case GL_TEXTURE_COORD_ARRAY: + params[0] = BOOLEAN_TO_INT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled); + break; + case GL_TEXTURE_COORD_ARRAY_SIZE: + params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size; + break; + case GL_TEXTURE_COORD_ARRAY_TYPE: + params[0] = ENUM_TO_INT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type); + break; + case GL_TEXTURE_COORD_ARRAY_STRIDE: + params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride; + break; + case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: + params[0] = 0; + break; + case GL_EDGE_FLAG_ARRAY: + params[0] = BOOLEAN_TO_INT(ctx->Array.EdgeFlag.Enabled); + break; + case GL_EDGE_FLAG_ARRAY_STRIDE: + params[0] = ctx->Array.EdgeFlag.Stride; + break; + case GL_EDGE_FLAG_ARRAY_COUNT_EXT: + params[0] = 0; + break; + case GL_MAX_TEXTURE_UNITS_ARB: + CHECK_EXTENSION_I(ARB_multitexture, pname); + params[0] = MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits); + break; + case GL_ACTIVE_TEXTURE_ARB: + CHECK_EXTENSION_I(ARB_multitexture, pname); + params[0] = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit; + break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + CHECK_EXTENSION_I(ARB_multitexture, pname); + params[0] = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + CHECK_EXTENSION_I(ARB_texture_cube_map, pname); + params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)); + break; + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + CHECK_EXTENSION_I(ARB_texture_cube_map, pname); + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name; + break; + case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: + CHECK_EXTENSION_I(ARB_texture_cube_map, pname); + params[0] = (1 << (ctx->Const.MaxCubeTextureLevels - 1)); + break; + case GL_TEXTURE_COMPRESSION_HINT_ARB: + CHECK_EXTENSION_I(ARB_texture_compression, pname); + params[0] = ctx->Hint.TextureCompression; + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + CHECK_EXTENSION_I(ARB_texture_compression, pname); + params[0] = _mesa_get_compressed_formats(ctx, NULL); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + CHECK_EXTENSION_I(ARB_texture_compression, pname); + { + GLint formats[100]; + GLuint i, n = _mesa_get_compressed_formats(ctx, formats); + ASSERT(n <= 100); + for (i = 0; i < n; i++) + params[i] = ENUM_TO_INT(formats[i]); + } + break; + case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: + CHECK_EXTENSION_I(EXT_compiled_vertex_array, pname); + params[0] = ctx->Array.LockFirst; + break; + case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: + CHECK_EXTENSION_I(EXT_compiled_vertex_array, pname); + params[0] = ctx->Array.LockCount; + break; + case GL_TRANSPOSE_COLOR_MATRIX_ARB: + { + const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; + params[0] = IROUND(matrix[0]); + params[1] = IROUND(matrix[4]); + params[2] = IROUND(matrix[8]); + params[3] = IROUND(matrix[12]); + params[4] = IROUND(matrix[1]); + params[5] = IROUND(matrix[5]); + params[6] = IROUND(matrix[9]); + params[7] = IROUND(matrix[13]); + params[8] = IROUND(matrix[2]); + params[9] = IROUND(matrix[6]); + params[10] = IROUND(matrix[10]); + params[11] = IROUND(matrix[14]); + params[12] = IROUND(matrix[3]); + params[13] = IROUND(matrix[7]); + params[14] = IROUND(matrix[11]); + params[15] = IROUND(matrix[15]); + } + break; + case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: + { + const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; + params[0] = IROUND(matrix[0]); + params[1] = IROUND(matrix[4]); + params[2] = IROUND(matrix[8]); + params[3] = IROUND(matrix[12]); + params[4] = IROUND(matrix[1]); + params[5] = IROUND(matrix[5]); + params[6] = IROUND(matrix[9]); + params[7] = IROUND(matrix[13]); + params[8] = IROUND(matrix[2]); + params[9] = IROUND(matrix[6]); + params[10] = IROUND(matrix[10]); + params[11] = IROUND(matrix[14]); + params[12] = IROUND(matrix[3]); + params[13] = IROUND(matrix[7]); + params[14] = IROUND(matrix[11]); + params[15] = IROUND(matrix[15]); + } + break; + case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: + { + const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; + params[0] = IROUND(matrix[0]); + params[1] = IROUND(matrix[4]); + params[2] = IROUND(matrix[8]); + params[3] = IROUND(matrix[12]); + params[4] = IROUND(matrix[1]); + params[5] = IROUND(matrix[5]); + params[6] = IROUND(matrix[9]); + params[7] = IROUND(matrix[13]); + params[8] = IROUND(matrix[2]); + params[9] = IROUND(matrix[6]); + params[10] = IROUND(matrix[10]); + params[11] = IROUND(matrix[14]); + params[12] = IROUND(matrix[3]); + params[13] = IROUND(matrix[7]); + params[14] = IROUND(matrix[11]); + params[15] = IROUND(matrix[15]); + } + break; + case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: + { + const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; + params[0] = IROUND(matrix[0]); + params[1] = IROUND(matrix[4]); + params[2] = IROUND(matrix[8]); + params[3] = IROUND(matrix[12]); + params[4] = IROUND(matrix[1]); + params[5] = IROUND(matrix[5]); + params[6] = IROUND(matrix[9]); + params[7] = IROUND(matrix[13]); + params[8] = IROUND(matrix[2]); + params[9] = IROUND(matrix[6]); + params[10] = IROUND(matrix[10]); + params[11] = IROUND(matrix[14]); + params[12] = IROUND(matrix[3]); + params[13] = IROUND(matrix[7]); + params[14] = IROUND(matrix[11]); + params[15] = IROUND(matrix[15]); + } + break; + case GL_OCCLUSION_TEST_HP: + CHECK_EXTENSION_I(HP_occlusion_test, pname); + params[0] = BOOLEAN_TO_INT(ctx->Depth.OcclusionTest); + break; + case GL_OCCLUSION_TEST_RESULT_HP: + CHECK_EXTENSION_I(HP_occlusion_test, pname); + { + FLUSH_VERTICES(ctx, _NEW_DEPTH); + if (ctx->Depth.OcclusionTest) + params[0] = ctx->OcclusionResult; + else + params[0] = ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + return; + } + break; + case GL_PIXEL_TEXTURE_SGIS: + CHECK_EXTENSION_I(SGIS_pixel_texture, pname); + params[0] = BOOLEAN_TO_INT(ctx->Pixel.PixelTextureEnabled); + break; + case GL_PIXEL_TEX_GEN_SGIX: + CHECK_EXTENSION_I(SGIX_pixel_texture, pname); + params[0] = BOOLEAN_TO_INT(ctx->Pixel.PixelTextureEnabled); + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + CHECK_EXTENSION_I(SGIX_pixel_texture, pname); + params[0] = ENUM_TO_INT(pixel_texgen_mode(ctx)); + break; + case GL_COLOR_MATRIX_SGI: + { + const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; + params[0] = IROUND(matrix[0]); + params[1] = IROUND(matrix[1]); + params[2] = IROUND(matrix[2]); + params[3] = IROUND(matrix[3]); + params[4] = IROUND(matrix[4]); + params[5] = IROUND(matrix[5]); + params[6] = IROUND(matrix[6]); + params[7] = IROUND(matrix[7]); + params[8] = IROUND(matrix[8]); + params[9] = IROUND(matrix[9]); + params[10] = IROUND(matrix[10]); + params[11] = IROUND(matrix[11]); + params[12] = IROUND(matrix[12]); + params[13] = IROUND(matrix[13]); + params[14] = IROUND(matrix[14]); + params[15] = IROUND(matrix[15]); + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + params[0] = ctx->ColorMatrixStack.Depth + 1; + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + params[0] = MAX_COLOR_STACK_DEPTH; + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[0]); + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[1]); + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[2]); + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[3]); + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[0]); + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[1]); + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[2]); + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[3]); + break; + case GL_CONVOLUTION_1D_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); + params[0] = BOOLEAN_TO_INT(ctx->Pixel.Convolution1DEnabled); + break; + case GL_CONVOLUTION_2D_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); + params[0] = BOOLEAN_TO_INT(ctx->Pixel.Convolution2DEnabled); + break; + case GL_SEPARABLE_2D_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); + params[0] = BOOLEAN_TO_INT(ctx->Pixel.Separable2DEnabled); + break; + case GL_POST_CONVOLUTION_RED_SCALE_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); + params[0] = IROUND(ctx->Pixel.PostConvolutionScale[0]); + break; + case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); + params[0] = IROUND(ctx->Pixel.PostConvolutionScale[1]); + break; + case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); + params[0] = IROUND(ctx->Pixel.PostConvolutionScale[2]); + break; + case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); + params[0] = IROUND(ctx->Pixel.PostConvolutionScale[3]); + break; + case GL_POST_CONVOLUTION_RED_BIAS_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); + params[0] = IROUND(ctx->Pixel.PostConvolutionBias[0]); + break; + case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); + params[0] = IROUND(ctx->Pixel.PostConvolutionBias[1]); + break; + case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); + params[0] = IROUND(ctx->Pixel.PostConvolutionBias[2]); + break; + case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); + params[0] = IROUND(ctx->Pixel.PostConvolutionBias[3]); + break; + case GL_HISTOGRAM: + CHECK_EXTENSION_I(EXT_histogram, pname); + params[0] = BOOLEAN_TO_INT(ctx->Pixel.HistogramEnabled); + break; + case GL_MINMAX: + CHECK_EXTENSION_I(EXT_histogram, pname); + params[0] = BOOLEAN_TO_INT(ctx->Pixel.MinMaxEnabled); + break; + case GL_COLOR_TABLE_SGI: + CHECK_EXTENSION_I(SGI_color_table, pname); + params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled); + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + CHECK_EXTENSION_I(SGI_color_table, pname); + params[0] = BOOLEAN_TO_INT(ctx->Pixel.PostConvolutionColorTableEnabled); + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + CHECK_EXTENSION_I(SGI_color_table, pname); + params[0] = BOOLEAN_TO_INT(ctx->Pixel.PostColorMatrixColorTableEnabled); + break; + case GL_TEXTURE_COLOR_TABLE_SGI: + CHECK_EXTENSION_I(SGI_texture_color_table, pname); + params[0] = BOOLEAN_TO_INT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled); + break; + case GL_COLOR_SUM_EXT: + CHECK_EXTENSION_I(EXT_secondary_color, pname); + params[0] = BOOLEAN_TO_INT(ctx->Fog.ColorSumEnabled); + break; + case GL_CURRENT_SECONDARY_COLOR_EXT: + CHECK_EXTENSION_I(EXT_secondary_color, pname); + { + FLUSH_CURRENT(ctx, 0); + params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); + params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); + params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); + params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]); + } + break; + case GL_SECONDARY_COLOR_ARRAY_EXT: + CHECK_EXTENSION_I(EXT_secondary_color, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.SecondaryColor.Enabled); + break; + case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: + CHECK_EXTENSION_I(EXT_secondary_color, pname); + params[0] = ENUM_TO_INT(ctx->Array.SecondaryColor.Type); + break; + case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_I(EXT_secondary_color, pname); + params[0] = ctx->Array.SecondaryColor.Stride; + break; + case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: + CHECK_EXTENSION_I(EXT_secondary_color, pname); + params[0] = ctx->Array.SecondaryColor.Size; + break; + case GL_CURRENT_FOG_COORDINATE_EXT: + CHECK_EXTENSION_I(EXT_fog_coord, pname); + { + FLUSH_CURRENT(ctx, 0); + params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); + } + break; + case GL_FOG_COORDINATE_ARRAY_EXT: + CHECK_EXTENSION_I(EXT_fog_coord, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.FogCoord.Enabled); + break; + case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: + CHECK_EXTENSION_I(EXT_fog_coord, pname); + params[0] = ENUM_TO_INT(ctx->Array.FogCoord.Type); + break; + case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_I(EXT_fog_coord, pname); + params[0] = ctx->Array.FogCoord.Stride; + break; + case GL_FOG_COORDINATE_SOURCE_EXT: + CHECK_EXTENSION_I(EXT_fog_coord, pname); + params[0] = ENUM_TO_INT(ctx->Fog.FogCoordinateSource); + break; + case GL_MAX_TEXTURE_LOD_BIAS_EXT: + CHECK_EXTENSION_I(EXT_texture_lod_bias, pname); + params[0] = IROUND(ctx->Const.MaxTextureLodBias); + break; + case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: + CHECK_EXTENSION_I(EXT_texture_filter_anisotropic, pname); + params[0] = IROUND(ctx->Const.MaxTextureMaxAnisotropy); + break; + case GL_MULTISAMPLE_ARB: + CHECK_EXTENSION_I(ARB_multisample, pname); + params[0] = BOOLEAN_TO_INT(ctx->Multisample.Enabled); + break; + case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: + CHECK_EXTENSION_I(ARB_multisample, pname); + params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleAlphaToCoverage); + break; + case GL_SAMPLE_ALPHA_TO_ONE_ARB: + CHECK_EXTENSION_I(ARB_multisample, pname); + params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleAlphaToOne); + break; + case GL_SAMPLE_COVERAGE_ARB: + CHECK_EXTENSION_I(ARB_multisample, pname); + params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleCoverage); + break; + case GL_SAMPLE_COVERAGE_VALUE_ARB: + CHECK_EXTENSION_I(ARB_multisample, pname); + params[0] = IROUND(ctx->Multisample.SampleCoverageValue); + break; + case GL_SAMPLE_COVERAGE_INVERT_ARB: + CHECK_EXTENSION_I(ARB_multisample, pname); + params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleCoverageInvert); + break; + case GL_SAMPLE_BUFFERS_ARB: + CHECK_EXTENSION_I(ARB_multisample, pname); + params[0] = ctx->DrawBuffer->Visual.sampleBuffers; + break; + case GL_SAMPLES_ARB: + CHECK_EXTENSION_I(ARB_multisample, pname); + params[0] = ctx->DrawBuffer->Visual.samples; + break; + case GL_RASTER_POSITION_UNCLIPPED_IBM: + CHECK_EXTENSION_I(IBM_rasterpos_clip, pname); + params[0] = BOOLEAN_TO_INT(ctx->Transform.RasterPositionUnclipped); + break; + case GL_POINT_SPRITE_NV: + CHECK_EXTENSION_I(NV_point_sprite, pname); + params[0] = BOOLEAN_TO_INT(ctx->Point.PointSprite); + break; + case GL_POINT_SPRITE_R_MODE_NV: + CHECK_EXTENSION_I(NV_point_sprite, pname); + params[0] = ENUM_TO_INT(ctx->Point.SpriteRMode); + break; + case GL_POINT_SPRITE_COORD_ORIGIN: + CHECK_EXTENSION_I(NV_point_sprite, pname); + params[0] = ENUM_TO_INT(ctx->Point.SpriteOrigin); + break; + case GL_GENERATE_MIPMAP_HINT_SGIS: + CHECK_EXTENSION_I(SGIS_generate_mipmap, pname); + params[0] = ENUM_TO_INT(ctx->Hint.GenerateMipmap); + break; + case GL_VERTEX_PROGRAM_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.Enabled); + break; + case GL_VERTEX_PROGRAM_POINT_SIZE_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.PointSizeEnabled); + break; + case GL_VERTEX_PROGRAM_TWO_SIDE_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.TwoSideEnabled); + break; + case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = ctx->Const.MaxProgramMatrixStackDepth; + break; + case GL_MAX_TRACK_MATRICES_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = ctx->Const.MaxProgramMatrices; + break; + case GL_CURRENT_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->CurrentStack->Depth + 1); + break; + case GL_CURRENT_MATRIX_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + { + const GLfloat *matrix = ctx->CurrentStack->Top->m; + params[0] = IROUND(matrix[0]); + params[1] = IROUND(matrix[1]); + params[2] = IROUND(matrix[2]); + params[3] = IROUND(matrix[3]); + params[4] = IROUND(matrix[4]); + params[5] = IROUND(matrix[5]); + params[6] = IROUND(matrix[6]); + params[7] = IROUND(matrix[7]); + params[8] = IROUND(matrix[8]); + params[9] = IROUND(matrix[9]); + params[10] = IROUND(matrix[10]); + params[11] = IROUND(matrix[11]); + params[12] = IROUND(matrix[12]); + params[13] = IROUND(matrix[13]); + params[14] = IROUND(matrix[14]); + params[15] = IROUND(matrix[15]); + } + break; + case GL_VERTEX_PROGRAM_BINDING_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = (ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0); + break; + case GL_PROGRAM_ERROR_POSITION_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = ctx->Program.ErrorPos; + break; + case GL_VERTEX_ATTRIB_ARRAY0_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[0].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY1_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[1].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY2_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[2].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY3_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[3].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[4].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY5_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[5].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY6_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[6].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY7_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[7].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY8_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[8].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY9_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[9].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY10_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[10].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY11_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[11].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY12_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[12].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY13_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[13].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY14_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[14].Enabled); + break; + case GL_VERTEX_ATTRIB_ARRAY15_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[15].Enabled); + break; + case GL_MAP1_VERTEX_ATTRIB0_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[0]); + break; + case GL_MAP1_VERTEX_ATTRIB1_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[1]); + break; + case GL_MAP1_VERTEX_ATTRIB2_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[2]); + break; + case GL_MAP1_VERTEX_ATTRIB3_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[3]); + break; + case GL_MAP1_VERTEX_ATTRIB4_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[4]); + break; + case GL_MAP1_VERTEX_ATTRIB5_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[5]); + break; + case GL_MAP1_VERTEX_ATTRIB6_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[6]); + break; + case GL_MAP1_VERTEX_ATTRIB7_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[7]); + break; + case GL_MAP1_VERTEX_ATTRIB8_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[8]); + break; + case GL_MAP1_VERTEX_ATTRIB9_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[9]); + break; + case GL_MAP1_VERTEX_ATTRIB10_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[10]); + break; + case GL_MAP1_VERTEX_ATTRIB11_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[11]); + break; + case GL_MAP1_VERTEX_ATTRIB12_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[12]); + break; + case GL_MAP1_VERTEX_ATTRIB13_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[13]); + break; + case GL_MAP1_VERTEX_ATTRIB14_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[14]); + break; + case GL_MAP1_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[15]); + break; + case GL_FRAGMENT_PROGRAM_NV: + CHECK_EXTENSION_I(NV_fragment_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.Enabled); + break; + case GL_MAX_TEXTURE_COORDS_NV: + CHECK_EXTENSION_I(NV_fragment_program, pname); + params[0] = ctx->Const.MaxTextureCoordUnits; + break; + case GL_MAX_TEXTURE_IMAGE_UNITS_NV: + CHECK_EXTENSION_I(NV_fragment_program, pname); + params[0] = ctx->Const.MaxTextureImageUnits; + break; + case GL_FRAGMENT_PROGRAM_BINDING_NV: + CHECK_EXTENSION_I(NV_fragment_program, pname); + params[0] = ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0; + break; + case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: + CHECK_EXTENSION_I(NV_fragment_program, pname); + params[0] = MAX_NV_FRAGMENT_PROGRAM_PARAMS; + break; + case GL_TEXTURE_RECTANGLE_NV: + CHECK_EXTENSION_I(NV_texture_rectangle, pname); + params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)); + break; + case GL_TEXTURE_BINDING_RECTANGLE_NV: + CHECK_EXTENSION_I(NV_texture_rectangle, pname); + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name; + break; + case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: + CHECK_EXTENSION_I(NV_texture_rectangle, pname); + params[0] = ctx->Const.MaxTextureRectSize; + break; + case GL_STENCIL_TEST_TWO_SIDE_EXT: + CHECK_EXTENSION_I(EXT_stencil_two_side, pname); + params[0] = BOOLEAN_TO_INT(ctx->Stencil.TestTwoSide); + break; + case GL_ACTIVE_STENCIL_FACE_EXT: + CHECK_EXTENSION_I(EXT_stencil_two_side, pname); + params[0] = ENUM_TO_INT(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); + break; + case GL_MAX_SHININESS_NV: + CHECK_EXTENSION_I(NV_light_max_exponent, pname); + params[0] = IROUND(ctx->Const.MaxShininess); + break; + case GL_MAX_SPOT_EXPONENT_NV: + CHECK_EXTENSION_I(NV_light_max_exponent, pname); + params[0] = IROUND(ctx->Const.MaxSpotExponent); + break; + case GL_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); + params[0] = ctx->Array.ArrayBufferObj->Name; + break; + case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); + params[0] = ctx->Array.Vertex.BufferObj->Name; + break; + case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); + params[0] = ctx->Array.Normal.BufferObj->Name; + break; + case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); + params[0] = ctx->Array.Color.BufferObj->Name; + break; + case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); + params[0] = ctx->Array.Index.BufferObj->Name; + break; + case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); + params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name; + break; + case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); + params[0] = ctx->Array.EdgeFlag.BufferObj->Name; + break; + case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); + params[0] = ctx->Array.SecondaryColor.BufferObj->Name; + break; + case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); + params[0] = ctx->Array.FogCoord.BufferObj->Name; + break; + case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: + CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); + params[0] = ctx->Array.ElementArrayBufferObj->Name; + break; + case GL_PIXEL_PACK_BUFFER_BINDING_EXT: + CHECK_EXTENSION_I(EXT_pixel_buffer_object, pname); + params[0] = ctx->Pack.BufferObj->Name; + break; + case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: + CHECK_EXTENSION_I(EXT_pixel_buffer_object, pname); + params[0] = ctx->Unpack.BufferObj->Name; + break; + case GL_MAX_VERTEX_ATTRIBS_ARB: + CHECK_EXTENSION_I(ARB_vertex_program, pname); + params[0] = ctx->Const.MaxVertexProgramAttribs; + break; + case GL_FRAGMENT_PROGRAM_ARB: + CHECK_EXTENSION_I(ARB_fragment_program, pname); + params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.Enabled); + break; + case GL_TRANSPOSE_CURRENT_MATRIX_ARB: + CHECK_EXTENSION_I(ARB_fragment_program, pname); + { + const GLfloat *matrix = ctx->CurrentStack->Top->m; + params[0] = IROUND(matrix[0]); + params[1] = IROUND(matrix[4]); + params[2] = IROUND(matrix[8]); + params[3] = IROUND(matrix[12]); + params[4] = IROUND(matrix[1]); + params[5] = IROUND(matrix[5]); + params[6] = IROUND(matrix[9]); + params[7] = IROUND(matrix[13]); + params[8] = IROUND(matrix[2]); + params[9] = IROUND(matrix[6]); + params[10] = IROUND(matrix[10]); + params[11] = IROUND(matrix[14]); + params[12] = IROUND(matrix[3]); + params[13] = IROUND(matrix[7]); + params[14] = IROUND(matrix[11]); + params[15] = IROUND(matrix[15]); + } + break; + case GL_DEPTH_BOUNDS_TEST_EXT: + CHECK_EXTENSION_I(EXT_depth_bounds_test, pname); + params[0] = BOOLEAN_TO_INT(ctx->Depth.BoundsTest); + break; + case GL_DEPTH_BOUNDS_EXT: + CHECK_EXTENSION_I(EXT_depth_bounds_test, pname); + params[0] = IROUND(ctx->Depth.BoundsMin); + params[1] = IROUND(ctx->Depth.BoundsMax); + break; + case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: + CHECK_EXTENSION_I(MESA_program_debug, pname); + params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.CallbackEnabled); + break; + case GL_VERTEX_PROGRAM_CALLBACK_MESA: + CHECK_EXTENSION_I(MESA_program_debug, pname); + params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.CallbackEnabled); + break; + case GL_FRAGMENT_PROGRAM_POSITION_MESA: + CHECK_EXTENSION_I(MESA_program_debug, pname); + params[0] = ctx->FragmentProgram.CurrentPosition; + break; + case GL_VERTEX_PROGRAM_POSITION_MESA: + CHECK_EXTENSION_I(MESA_program_debug, pname); + params[0] = ctx->VertexProgram.CurrentPosition; + break; + case GL_MAX_DRAW_BUFFERS_ARB: + CHECK_EXTENSION_I(ARB_draw_buffers, pname); + params[0] = ctx->Const.MaxDrawBuffers; + break; + case GL_DRAW_BUFFER0_ARB: + CHECK_EXTENSION_I(ARB_draw_buffers, pname); + params[0] = ENUM_TO_INT(ctx->Color.DrawBuffer[0]); + break; + case GL_DRAW_BUFFER1_ARB: + CHECK_EXTENSION_I(ARB_draw_buffers, pname); + { + GLenum buffer; + if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); + return; + } + buffer = ctx->Color.DrawBuffer[1]; + params[0] = ENUM_TO_INT(buffer); + } + break; + case GL_DRAW_BUFFER2_ARB: + CHECK_EXTENSION_I(ARB_draw_buffers, pname); + { + GLenum buffer; + if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); + return; + } + buffer = ctx->Color.DrawBuffer[2]; + params[0] = ENUM_TO_INT(buffer); + } + break; + case GL_DRAW_BUFFER3_ARB: + CHECK_EXTENSION_I(ARB_draw_buffers, pname); + { + GLenum buffer; + if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); + return; + } + buffer = ctx->Color.DrawBuffer[3]; + params[0] = ENUM_TO_INT(buffer); + } + break; + case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: + CHECK_EXTENSION_I(OES_read_format, pname); + params[0] = ctx->Const.ColorReadType; + break; + case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: + CHECK_EXTENSION_I(OES_read_format, pname); + params[0] = ctx->Const.ColorReadFormat; + break; + case GL_NUM_FRAGMENT_REGISTERS_ATI: + CHECK_EXTENSION_I(ATI_fragment_shader, pname); + params[0] = 6; + break; + case GL_NUM_FRAGMENT_CONSTANTS_ATI: + CHECK_EXTENSION_I(ATI_fragment_shader, pname); + params[0] = 8; + break; + case GL_NUM_PASSES_ATI: + CHECK_EXTENSION_I(ATI_fragment_shader, pname); + params[0] = 2; + break; + case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: + CHECK_EXTENSION_I(ATI_fragment_shader, pname); + params[0] = 8; + break; + case GL_NUM_INSTRUCTIONS_TOTAL_ATI: + CHECK_EXTENSION_I(ATI_fragment_shader, pname); + params[0] = 16; + break; + case GL_COLOR_ALPHA_PAIRING_ATI: + CHECK_EXTENSION_I(ATI_fragment_shader, pname); + params[0] = BOOLEAN_TO_INT(GL_TRUE); + break; + case GL_NUM_LOOPBACK_COMPONENTS_ATI: + CHECK_EXTENSION_I(ATI_fragment_shader, pname); + params[0] = 3; + break; + case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: + CHECK_EXTENSION_I(ATI_fragment_shader, pname); + params[0] = 3; + break; + case GL_STENCIL_BACK_FUNC: + params[0] = ENUM_TO_INT(ctx->Stencil.Function[1]); + break; + case GL_STENCIL_BACK_VALUE_MASK: + params[0] = ctx->Stencil.ValueMask[1]; + break; + case GL_STENCIL_BACK_REF: + params[0] = ctx->Stencil.Ref[1]; + break; + case GL_STENCIL_BACK_FAIL: + params[0] = ENUM_TO_INT(ctx->Stencil.FailFunc[1]); + break; + case GL_STENCIL_BACK_PASS_DEPTH_FAIL: + params[0] = ENUM_TO_INT(ctx->Stencil.ZFailFunc[1]); + break; + case GL_STENCIL_BACK_PASS_DEPTH_PASS: + params[0] = ENUM_TO_INT(ctx->Stencil.ZPassFunc[1]); + break; + case GL_FRAMEBUFFER_BINDING_EXT: + CHECK_EXTENSION_I(EXT_framebuffer_object, pname); + params[0] = ctx->DrawBuffer->Name; + break; + case GL_RENDERBUFFER_BINDING_EXT: + CHECK_EXTENSION_I(EXT_framebuffer_object, pname); + params[0] = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0; + break; + case GL_MAX_COLOR_ATTACHMENTS_EXT: + CHECK_EXTENSION_I(EXT_framebuffer_object, pname); + params[0] = ctx->Const.MaxColorAttachments; + break; + case GL_MAX_RENDERBUFFER_SIZE_EXT: + CHECK_EXTENSION_I(EXT_framebuffer_object, pname); + params[0] = ctx->Const.MaxRenderbufferSize; + break; + case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: + CHECK_EXTENSION_I(ARB_fragment_shader, pname); + params[0] = MAX_FRAGMENT_UNIFORM_COMPONENTS; + break; + case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: + CHECK_EXTENSION_I(ARB_fragment_shader, pname); + params[0] = ENUM_TO_INT(ctx->Hint.FragmentShaderDerivative); + break; + case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: + CHECK_EXTENSION_I(ARB_vertex_shader, pname); + params[0] = MAX_VERTEX_UNIFORM_COMPONENTS; + break; + case GL_MAX_VARYING_FLOATS_ARB: + CHECK_EXTENSION_I(ARB_vertex_shader, pname); + params[0] = MAX_VARYING_FLOATS; + break; + case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: + CHECK_EXTENSION_I(ARB_vertex_shader, pname); + params[0] = MAX_VERTEX_TEXTURE_IMAGE_UNITS; + break; + case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: + CHECK_EXTENSION_I(ARB_vertex_shader, pname); + params[0] = MAX_COMBINED_TEXTURE_IMAGE_UNITS; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname); + } +} + + +void GLAPIENTRY +_mesa_GetDoublev( GLenum pname, GLdouble *params ) +{ + const GLfloat magic = -1234.5F; + GLfloat values[16]; + GLuint i; + + if (!params) + return; + + /* Init temp array to magic numbers so we can figure out how many values + * are returned by the GetFloatv() call. + */ + for (i = 0; i < 16; i++) + values[i] = magic; + + _mesa_GetFloatv(pname, values); + + for (i = 0; i < 16 && values[i] != magic; i++) + params[i] = (GLdouble) values[i]; +} + diff --git a/reactos/dll/mesa32/src/main/get.h b/reactos/dll/mesa32/src/main/get.h new file mode 100644 index 00000000000..9b47b230a98 --- /dev/null +++ b/reactos/dll/mesa32/src/main/get.h @@ -0,0 +1,59 @@ +/** + * \file get.h + * State query functions. + */ + +/* + * 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 GET_H +#define GET_H + + +#include "mtypes.h" + + +extern void GLAPIENTRY +_mesa_GetBooleanv( GLenum pname, GLboolean *params ); + +extern void GLAPIENTRY +_mesa_GetDoublev( GLenum pname, GLdouble *params ); + +extern void GLAPIENTRY +_mesa_GetFloatv( GLenum pname, GLfloat *params ); + +extern void GLAPIENTRY +_mesa_GetIntegerv( GLenum pname, GLint *params ); + +extern void GLAPIENTRY +_mesa_GetPointerv( GLenum pname, GLvoid **params ); + +extern const GLubyte * GLAPIENTRY +_mesa_GetString( GLenum name ); + +extern GLenum GLAPIENTRY +_mesa_GetError( void ); + +#endif diff --git a/reactos/dll/mesa32/src/main/getstring.c b/reactos/dll/mesa32/src/main/getstring.c new file mode 100644 index 00000000000..5188a79c951 --- /dev/null +++ b/reactos/dll/mesa32/src/main/getstring.c @@ -0,0 +1,261 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "get.h" +#include "version.h" +#include "enums.h" +#include "extensions.h" + + +/** + * Query string-valued state. The return value should _not_ be freed by + * the caller. + * + * \param name the state variable to query. + * + * \sa glGetString(). + * + * Tries to get the string from dd_function_table::GetString, otherwise returns + * the hardcoded strings. + */ +const GLubyte * GLAPIENTRY +_mesa_GetString( GLenum name ) +{ + GET_CURRENT_CONTEXT(ctx); + static const char *vendor = "Brian Paul"; + static const char *renderer = "Mesa"; + static const char *version_1_2 = "1.2 Mesa " MESA_VERSION_STRING; + static const char *version_1_3 = "1.3 Mesa " MESA_VERSION_STRING; + static const char *version_1_4 = "1.4 Mesa " MESA_VERSION_STRING; + static const char *version_1_5 = "1.5 Mesa " MESA_VERSION_STRING; + static const char *version_2_0 = "1.5 Mesa " MESA_VERSION_STRING;/*XXX FIX*/ + + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL); + + /* this is a required driver function */ + assert(ctx->Driver.GetString); + { + /* Give the driver the chance to handle this query */ + const GLubyte *str = (*ctx->Driver.GetString)(ctx, name); + if (str) + return str; + } + + switch (name) { + case GL_VENDOR: + return (const GLubyte *) vendor; + case GL_RENDERER: + return (const GLubyte *) renderer; + case GL_VERSION: + if (ctx->Extensions.ARB_multisample && + ctx->Extensions.ARB_multitexture && + ctx->Extensions.ARB_texture_border_clamp && + ctx->Extensions.ARB_texture_compression && + ctx->Extensions.ARB_texture_cube_map && + ctx->Extensions.EXT_texture_env_add && + ctx->Extensions.ARB_texture_env_combine && + ctx->Extensions.ARB_texture_env_dot3) { + if (ctx->Extensions.ARB_depth_texture && + ctx->Extensions.ARB_shadow && + ctx->Extensions.ARB_texture_env_crossbar && + ctx->Extensions.ARB_texture_mirrored_repeat && + ctx->Extensions.ARB_window_pos && + ctx->Extensions.EXT_blend_color && + ctx->Extensions.EXT_blend_func_separate && + ctx->Extensions.EXT_blend_logic_op && + ctx->Extensions.EXT_blend_minmax && + ctx->Extensions.EXT_blend_subtract && + ctx->Extensions.EXT_fog_coord && + ctx->Extensions.EXT_multi_draw_arrays && + ctx->Extensions.EXT_point_parameters && /*aka ARB*/ + ctx->Extensions.EXT_secondary_color && + ctx->Extensions.EXT_stencil_wrap && + ctx->Extensions.EXT_texture_lod_bias && + ctx->Extensions.SGIS_generate_mipmap) { + if (ctx->Extensions.ARB_occlusion_query && + ctx->Extensions.ARB_vertex_buffer_object && + ctx->Extensions.EXT_shadow_funcs) { + if (ctx->Extensions.ARB_draw_buffers && + ctx->Extensions.ARB_point_sprite && + ctx->Extensions.ARB_texture_non_power_of_two && + ctx->Extensions.EXT_stencil_two_side) { + return (const GLubyte *) version_2_0; + } + else { + return (const GLubyte *) version_1_5; + } + } + else { + return (const GLubyte *) version_1_4; + } + } + else { + return (const GLubyte *) version_1_3; + } + } + else { + return (const GLubyte *) version_1_2; + } + case GL_EXTENSIONS: + if (!ctx->Extensions.String) + ctx->Extensions.String = _mesa_make_extension_string(ctx); + return (const GLubyte *) ctx->Extensions.String; +#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \ + FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program + case GL_PROGRAM_ERROR_STRING_NV: + if (ctx->Extensions.NV_fragment_program || + ctx->Extensions.ARB_fragment_program || + ctx->Extensions.NV_vertex_program || + ctx->Extensions.ARB_vertex_program) { + return (const GLubyte *) ctx->Program.ErrorString; + } + /* FALL-THROUGH */ +#endif + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" ); + return (const GLubyte *) 0; + } +} + + +/** + * Return pointer-valued state, such as a vertex array pointer. + * + * \param pname names state to be queried + * \param params returns the pointer value + * + * \sa glGetPointerv(). + * + * Tries to get the specified pointer via dd_function_table::GetPointerv, + * otherwise gets the specified pointer from the current context. + */ +void GLAPIENTRY +_mesa_GetPointerv( GLenum pname, GLvoid **params ) +{ + GET_CURRENT_CONTEXT(ctx); + const GLuint clientUnit = ctx->Array.ActiveTexture; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!params) + return; + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glGetPointerv %s\n", _mesa_lookup_enum_by_nr(pname)); + + if (ctx->Driver.GetPointerv + && (*ctx->Driver.GetPointerv)(ctx, pname, params)) + return; + + switch (pname) { + case GL_VERTEX_ARRAY_POINTER: + *params = (GLvoid *) ctx->Array.Vertex.Ptr; + break; + case GL_NORMAL_ARRAY_POINTER: + *params = (GLvoid *) ctx->Array.Normal.Ptr; + break; + case GL_COLOR_ARRAY_POINTER: + *params = (GLvoid *) ctx->Array.Color.Ptr; + break; + case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT: + *params = (GLvoid *) ctx->Array.SecondaryColor.Ptr; + break; + case GL_FOG_COORDINATE_ARRAY_POINTER_EXT: + *params = (GLvoid *) ctx->Array.FogCoord.Ptr; + break; + case GL_INDEX_ARRAY_POINTER: + *params = (GLvoid *) ctx->Array.Index.Ptr; + break; + case GL_TEXTURE_COORD_ARRAY_POINTER: + *params = (GLvoid *) ctx->Array.TexCoord[clientUnit].Ptr; + break; + case GL_EDGE_FLAG_ARRAY_POINTER: + *params = (GLvoid *) ctx->Array.EdgeFlag.Ptr; + break; + case GL_FEEDBACK_BUFFER_POINTER: + *params = ctx->Feedback.Buffer; + break; + case GL_SELECTION_BUFFER_POINTER: + *params = ctx->Select.Buffer; + break; +#if FEATURE_MESA_program_debug + case GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA: + if (!ctx->Extensions.MESA_program_debug) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); + return; + } + *params = *(GLvoid **) &ctx->FragmentProgram.Callback; + break; + case GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA: + if (!ctx->Extensions.MESA_program_debug) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); + return; + } + *params = ctx->FragmentProgram.CallbackData; + break; + case GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA: + if (!ctx->Extensions.MESA_program_debug) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); + return; + } + *params = *(GLvoid **) &ctx->VertexProgram.Callback; + break; + case GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA: + if (!ctx->Extensions.MESA_program_debug) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); + return; + } + *params = ctx->VertexProgram.CallbackData; + break; +#endif + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" ); + return; + } +} + + +/** + * Returns the current GL error code, or GL_NO_ERROR. + * \return current error code + * + * Returns __GLcontextRec::ErrorValue. + */ +GLenum GLAPIENTRY +_mesa_GetError( void ) +{ + GET_CURRENT_CONTEXT(ctx); + GLenum e = ctx->ErrorValue; + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glGetError <-- %s\n", _mesa_lookup_enum_by_nr(e)); + + ctx->ErrorValue = (GLenum) GL_NO_ERROR; + return e; +} diff --git a/reactos/dll/mesa32/src/main/glheader.h b/reactos/dll/mesa32/src/main/glheader.h new file mode 100644 index 00000000000..446a0218981 --- /dev/null +++ b/reactos/dll/mesa32/src/main/glheader.h @@ -0,0 +1,317 @@ +/** + * \file glheader.h + * Top-most include file. + * + * This is the top-most include file of the Mesa sources. + * It includes gl.h and all system headers which are needed. + * Other Mesa source files should \e not directly include any system + * headers. This allows Mesa to be integrated into XFree86 and + * allows system-dependent hacks/workarounds to be collected in one place. + * + * \note Actually, a lot of system-dependent stuff is now in imports.[ch]. + * + * If you touch this file, everything gets recompiled! + * + * This file should be included before any other header in the .c files. + * + * Put compiler/OS/assembly pragmas and macros here to avoid + * cluttering other source files. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 GLHEADER_H +#define GLHEADER_H + + +#if defined(XFree86LOADER) && defined(IN_MODULE) +#include "xf86_ansic.h" +#else +#include +#include +/* If we can use Compaq's Fast Math Library on Alpha */ +#if defined(__alpha__) && defined(CCPML) +#include +#else +#include +#endif +#include +#include +#include +#include +#if defined(__linux__) && defined(__i386__) +#include +#endif +#endif +#include +#include + + +/* Get typedefs for uintptr_t and friends */ +#if defined(_WIN32) && !defined(__MINGW32__) +#include +#if _MSC_VER == 1200 +typedef UINT_PTR uintptr_t; +#endif +#if defined(__MINGW32__) +#include +#endif +#else +#include +#endif + +#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP) +# define __WIN32__ +# define finite _finite +#endif + +#if defined(__WATCOMC__) +# define finite _finite +# pragma disable_message(201) /* Disable unreachable code warnings */ +#endif + + +#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP) +# if !defined(__GNUC__) /* mingw environment */ +# pragma warning( disable : 4068 ) /* unknown pragma */ +# pragma warning( disable : 4710 ) /* function 'foo' not inlined */ +# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */ +# pragma warning( disable : 4127 ) /* conditional expression is constant */ +# if defined(MESA_MINWARN) +# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ +# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ +# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ +# pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */ +# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ +# endif +# endif +# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ +# define WGLAPI __declspec(dllexport) +# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ +# define WGLAPI __declspec(dllimport) +# else /* for use with static link lib build of Win32 edition only */ +# define WGLAPI __declspec(dllimport) +# endif /* _STATIC_MESA support */ +#endif /* WIN32 / CYGWIN bracket */ + + +#ifndef __MINGW32__ +/* XXX why is this here? + * It should probaby be somewhere in src/mesa/drivers/windows/ + */ +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_WINGDI_H) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(BUILD_FOR_SNAP) +# define WGL_FONT_LINES 0 +# define WGL_FONT_POLYGONS 1 +#ifndef _GNU_H_WINDOWS32_FUNCTIONS +# ifdef UNICODE +# define wglUseFontBitmaps wglUseFontBitmapsW +# define wglUseFontOutlines wglUseFontOutlinesW +# else +# define wglUseFontBitmaps wglUseFontBitmapsA +# define wglUseFontOutlines wglUseFontOutlinesA +# endif /* !UNICODE */ +#endif /* _GNU_H_WINDOWS32_FUNCTIONS */ +typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; +typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; +typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR; +#if !defined(GLX_USE_MESA) +#include +#endif +#endif +#endif /* !__MINGW32__ */ + + +/* + * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN. + * Do not use them unless absolutely necessary! + * Try to use a runtime test instead. + * For now, only used by some DRI hardware drivers for color/texel packing. + */ +#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN +#if defined(__linux__) +#include +#define CPU_TO_LE32( x ) bswap_32( x ) +#else /*__linux__*/ +#define CPU_TO_LE32( x ) ( x ) /* fix me for non-Linux big-endian! */ +#endif /*__linux__*/ +#define MESA_BIG_ENDIAN 1 +#else +#define CPU_TO_LE32( x ) ( x ) +#define MESA_LITTLE_ENDIAN 1 +#endif +#define LE32_TO_CPU( x ) CPU_TO_LE32( x ) + + +#define GL_GLEXT_PROTOTYPES +#include "GL/gl.h" +#include "GL/glext.h" + + +#if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP) +#define CAPI _cdecl +#endif +#include + + +/* This is a macro on IRIX */ +#ifdef _P +#undef _P +#endif + + +/* Turn off macro checking systems used by other libraries */ +#ifdef CHECK +#undef CHECK +#endif + + +/* Create a macro so that asm functions can be linked into compilers other + * than GNU C + */ +#ifndef _ASMAPI +#if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/ +#define _ASMAPI __cdecl +#else +#define _ASMAPI +#endif +#ifdef PTR_DECL_IN_FRONT +#define _ASMAPIP * _ASMAPI +#else +#define _ASMAPIP _ASMAPI * +#endif +#endif + +#ifdef USE_X86_ASM +#define _NORMAPI _ASMAPI +#define _NORMAPIP _ASMAPIP +#else +#define _NORMAPI +#define _NORMAPIP * +#endif + + +/* Function inlining */ +#if defined(__GNUC__) +# define INLINE __inline__ +#elif defined(__MSC__) +# define INLINE __inline +#elif defined(_MSC_VER) +# define INLINE __inline +#elif defined(__ICL) +# define INLINE __inline +#elif defined(__INTEL_COMPILER) +# define INLINE inline +#elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) +# define INLINE __inline +#else +# define INLINE +#endif + + +/* If we build the library with gcc's -fvisibility=hidden flag, we'll + * use the PUBLIC macro to mark functions that are to be exported. + * + * We also need to define a USED attribute, so the optimizer doesn't + * inline a static function that we later use in an alias. - ajax + */ +#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 +# define PUBLIC __attribute__((visibility("default"))) +# define USED __attribute__((used)) +#else +# define PUBLIC +# define USED +#endif + + +/* Some compilers don't like some of Mesa's const usage */ +#ifdef NO_CONST +# define CONST +#else +# define CONST const +#endif + + +#if defined(BUILD_FOR_SNAP) && defined(CHECKED) +# define ASSERT(X) _CHECK(X) +#elif defined(DEBUG) +# define ASSERT(X) assert(X) +#else +# define ASSERT(X) +#endif + + +#if !defined __GNUC__ || __GNUC__ < 3 +# define __builtin_expect(x, y) x +#endif + +/* Windows does not have the ffs() function */ +#if defined(_WIN32) +static int INLINE +ffs(register int value) +{ + register int bit = 0; + if (value != 0) + { + if ((value & 0xffff) == 0) + { + bit += 16; + value >>= 16; + } + if ((value & 0xff) == 0) + { + bit += 8; + value >>= 8; + } + if ((value & 0xf) == 0) + { + bit += 4; + value >>= 4; + } + while ((value & 1) == 0) + { + bit++; + value >>= 1; + } + } + return bit; +} +#endif + + +/* The __FUNCTION__ gcc variable is generally only used for debugging. + * If we're not using gcc, define __FUNCTION__ as a cpp symbol here. + * Don't define it if using a newer Windows compiler. + */ +#if defined(__VMS) +#define __FUNCTION__ "VMS$NL:" +#elif !(defined(__GNUC__) && __GNUC__ >= 2) && !(defined(_MSC_VER) && _MSC_VER >= 1300) +#define __FUNCTION__ "unknown" +#endif + + +#include "config.h" + +#endif /* GLHEADER_H */ diff --git a/reactos/dll/mesa32/src/main/hash.c b/reactos/dll/mesa32/src/main/hash.c new file mode 100644 index 00000000000..74ab57df0ac --- /dev/null +++ b/reactos/dll/mesa32/src/main/hash.c @@ -0,0 +1,451 @@ +/** + * \file hash.c + * Generic hash table. + * + * Used for display lists, texture objects, vertex/fragment programs, + * buffer objects, etc. The hash functions are thread-safe. + * + * \note key=0 is illegal. + * + * \author Brian Paul + */ + +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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. + */ + + +#include "glheader.h" +#include "imports.h" +#include "glthread.h" +#include "hash.h" + + +#define TABLE_SIZE 1023 /**< Size of lookup table/array */ + +#define HASH_FUNC(K) ((K) % TABLE_SIZE) + + +/** + * An entry in the hash table. + * + * This struct is private to this file. + */ +struct HashEntry { + GLuint Key; /**< the entry's key */ + void *Data; /**< the entry's data */ + struct HashEntry *Next; /**< pointer to next entry */ +}; + +/** + * The hash table data structure. + * + * This is an opaque types (it's not defined in hash.h file). + */ +struct _mesa_HashTable { + struct HashEntry *Table[TABLE_SIZE]; /**< the lookup table */ + GLuint MaxKey; /**< highest key inserted so far */ + _glthread_Mutex Mutex; /**< mutual exclusion lock */ +}; + + +/** + * Create a new hash table. + * + * \return pointer to a new, empty hash table. + */ +struct _mesa_HashTable * +_mesa_NewHashTable(void) +{ + struct _mesa_HashTable *table = CALLOC_STRUCT(_mesa_HashTable); + if (table) { + _glthread_INIT_MUTEX(table->Mutex); + } + return table; +} + + + +/** + * Delete a hash table. + * Frees each entry on the hash table and then the hash table structure itself. + * Note that the caller should have already traversed the table and deleted + * the objects in the table (i.e. We don't free the entries' data pointer). + * + * \param table the hash table to delete. + */ +void +_mesa_DeleteHashTable(struct _mesa_HashTable *table) +{ + GLuint i; + assert(table); + for (i = 0; i < TABLE_SIZE; i++) { + struct HashEntry *entry = table->Table[i]; + while (entry) { + struct HashEntry *next = entry->Next; + FREE(entry); + entry = next; + } + } + _glthread_DESTROY_MUTEX(table->Mutex); + FREE(table); +} + + + +/** + * Lookup an entry in the hash table. + * + * \param table the hash table. + * \param key the key. + * + * \return pointer to user's data or NULL if key not in table + */ +void * +_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key) +{ + GLuint pos; + const struct HashEntry *entry; + + assert(table); + assert(key); + + pos = HASH_FUNC(key); + entry = table->Table[pos]; + while (entry) { + if (entry->Key == key) { + return entry->Data; + } + entry = entry->Next; + } + return NULL; +} + + + +/** + * Insert a key/pointer pair into the hash table. + * If an entry with this key already exists we'll replace the existing entry. + * + * \param table the hash table. + * \param key the key (not zero). + * \param data pointer to user data. + */ +void +_mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data) +{ + /* search for existing entry with this key */ + GLuint pos; + struct HashEntry *entry; + + assert(table); + assert(key); + + _glthread_LOCK_MUTEX(table->Mutex); + + if (key > table->MaxKey) + table->MaxKey = key; + + pos = HASH_FUNC(key); + entry = table->Table[pos]; + while (entry) { + if (entry->Key == key) { + /* replace entry's data */ + entry->Data = data; + _glthread_UNLOCK_MUTEX(table->Mutex); + return; + } + entry = entry->Next; + } + + /* alloc and insert new table entry */ + entry = MALLOC_STRUCT(HashEntry); + entry->Key = key; + entry->Data = data; + entry->Next = table->Table[pos]; + table->Table[pos] = entry; + + _glthread_UNLOCK_MUTEX(table->Mutex); +} + + + +/** + * Remove an entry from the hash table. + * + * \param table the hash table. + * \param key key of entry to remove. + * + * While holding the hash table's lock, searches the entry with the matching + * key and unlinks it. + */ +void +_mesa_HashRemove(struct _mesa_HashTable *table, GLuint key) +{ + GLuint pos; + struct HashEntry *entry, *prev; + + assert(table); + assert(key); + + _glthread_LOCK_MUTEX(table->Mutex); + + pos = HASH_FUNC(key); + prev = NULL; + entry = table->Table[pos]; + while (entry) { + if (entry->Key == key) { + /* found it! */ + if (prev) { + prev->Next = entry->Next; + } + else { + table->Table[pos] = entry->Next; + } + FREE(entry); + _glthread_UNLOCK_MUTEX(table->Mutex); + return; + } + prev = entry; + entry = entry->Next; + } + + _glthread_UNLOCK_MUTEX(table->Mutex); +} + + + +/** + * Get the key of the "first" entry in the hash table. + * + * This is used in the course of deleting all display lists when + * a context is destroyed. + * + * \param table the hash table + * + * \return key for the "first" entry in the hash table. + * + * While holding the lock, walks through all table positions until finding + * the first entry of the first non-empty one. + */ +GLuint +_mesa_HashFirstEntry(struct _mesa_HashTable *table) +{ + GLuint pos; + assert(table); + _glthread_LOCK_MUTEX(table->Mutex); + for (pos=0; pos < TABLE_SIZE; pos++) { + if (table->Table[pos]) { + _glthread_UNLOCK_MUTEX(table->Mutex); + return table->Table[pos]->Key; + } + } + _glthread_UNLOCK_MUTEX(table->Mutex); + return 0; +} + + +/** + * Given a hash table key, return the next key. This is used to walk + * over all entries in the table. Note that the keys returned during + * walking won't be in any particular order. + * \return next hash key or 0 if end of table. + */ +GLuint +_mesa_HashNextEntry(const struct _mesa_HashTable *table, GLuint key) +{ + const struct HashEntry *entry; + GLuint pos; + + assert(table); + assert(key); + + /* Find the entry with given key */ + pos = HASH_FUNC(key); + entry = table->Table[pos]; + while (entry) { + if (entry->Key == key) { + break; + } + entry = entry->Next; + } + + if (!entry) { + /* the key was not found, we can't find next entry */ + return 0; + } + + if (entry->Next) { + /* return next in linked list */ + return entry->Next->Key; + } + else { + /* look for next non-empty table slot */ + pos++; + while (pos < TABLE_SIZE) { + if (table->Table[pos]) { + return table->Table[pos]->Key; + } + pos++; + } + return 0; + } +} + + +/** + * Dump contents of hash table for debugging. + * + * \param table the hash table. + */ +void +_mesa_HashPrint(const struct _mesa_HashTable *table) +{ + GLuint i; + assert(table); + for (i=0;iTable[i]; + while (entry) { + _mesa_debug(NULL, "%u %p\n", entry->Key, entry->Data); + entry = entry->Next; + } + } +} + + + +/** + * Find a block of adjacent unused hash keys. + * + * \param table the hash table. + * \param numKeys number of keys needed. + * + * \return Starting key of free block or 0 if failure. + * + * If there are enough free keys between the maximum key existing in the table + * (_mesa_HashTable::MaxKey) and the maximum key possible, then simply return + * the adjacent key. Otherwise do a full search for a free key block in the + * allowable key range. + */ +GLuint +_mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys) +{ + GLuint maxKey = ~((GLuint) 0); + _glthread_LOCK_MUTEX(table->Mutex); + if (maxKey - numKeys > table->MaxKey) { + /* the quick solution */ + _glthread_UNLOCK_MUTEX(table->Mutex); + return table->MaxKey + 1; + } + else { + /* the slow solution */ + GLuint freeCount = 0; + GLuint freeStart = 1; + GLuint key; + for (key=1; key!=maxKey; key++) { + if (_mesa_HashLookup(table, key)) { + /* darn, this key is already in use */ + freeCount = 0; + freeStart = key+1; + } + else { + /* this key not in use, check if we've found enough */ + freeCount++; + if (freeCount == numKeys) { + _glthread_UNLOCK_MUTEX(table->Mutex); + return freeStart; + } + } + } + /* cannot allocate a block of numKeys consecutive keys */ + _glthread_UNLOCK_MUTEX(table->Mutex); + return 0; + } +} + + +#if 0 /* debug only */ + +/** + * Test walking over all the entries in a hash table. + */ +static void +test_hash_walking(void) +{ + struct _mesa_HashTable *t = _mesa_NewHashTable(); + const GLuint limit = 50000; + GLuint i; + + /* create some entries */ + for (i = 0; i < limit; i++) { + GLuint dummy; + GLuint k = (rand() % (limit * 10)) + 1; + while (_mesa_HashLookup(t, k)) { + /* id already in use, try another */ + k = (rand() % (limit * 10)) + 1; + } + _mesa_HashInsert(t, k, &dummy); + } + + /* walk over all entries */ + { + GLuint k = _mesa_HashFirstEntry(t); + GLuint count = 0; + while (k) { + GLuint knext = _mesa_HashNextEntry(t, k); + assert(knext != k); + _mesa_HashRemove(t, k); + count++; + k = knext; + } + assert(count == limit); + k = _mesa_HashFirstEntry(t); + assert(k==0); + } + + _mesa_DeleteHashTable(t); +} + + +void +_mesa_test_hash_functions(void) +{ + int a, b, c; + struct _mesa_HashTable *t; + + t = _mesa_NewHashTable(); + _mesa_HashInsert(t, 501, &a); + _mesa_HashInsert(t, 10, &c); + _mesa_HashInsert(t, 0xfffffff8, &b); + /*_mesa_HashPrint(t);*/ + + assert(_mesa_HashLookup(t,501)); + assert(!_mesa_HashLookup(t,1313)); + assert(_mesa_HashFindFreeKeyBlock(t, 100)); + + _mesa_DeleteHashTable(t); + + test_hash_walking(); +} + +#endif diff --git a/reactos/dll/mesa32/src/main/hash.h b/reactos/dll/mesa32/src/main/hash.h new file mode 100644 index 00000000000..3cbe668e9ae --- /dev/null +++ b/reactos/dll/mesa32/src/main/hash.h @@ -0,0 +1,59 @@ +/** + * \file hash.h + * Generic hash table. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 HASH_H +#define HASH_H + + +#include "glheader.h" + + +extern struct _mesa_HashTable *_mesa_NewHashTable(void); + +extern void _mesa_DeleteHashTable(struct _mesa_HashTable *table); + +extern void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key); + +extern void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data); + +extern void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key); + +extern GLuint _mesa_HashFirstEntry(struct _mesa_HashTable *table); + +extern GLuint _mesa_HashNextEntry(const struct _mesa_HashTable *table, GLuint key); + +extern void _mesa_HashPrint(const struct _mesa_HashTable *table); + +extern GLuint _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys); + +extern void _mesa_test_hash_functions(void); + + +#endif diff --git a/reactos/dll/mesa32/src/main/hint.c b/reactos/dll/mesa32/src/main/hint.c new file mode 100644 index 00000000000..dcfa9c7363f --- /dev/null +++ b/reactos/dll/mesa32/src/main/hint.c @@ -0,0 +1,153 @@ + +/* + * 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. + */ + + +#include "glheader.h" +#include "enums.h" +#include "context.h" +#include "hint.h" +#include "imports.h" + + + +void GLAPIENTRY +_mesa_Hint( GLenum target, GLenum mode ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glHint %s %d\n", + _mesa_lookup_enum_by_nr(target), mode); + + if (mode != GL_NICEST && mode != GL_FASTEST && mode != GL_DONT_CARE) { + _mesa_error(ctx, GL_INVALID_ENUM, "glHint(mode)"); + return; + } + + switch (target) { + case GL_FOG_HINT: + if (ctx->Hint.Fog == mode) + return; + FLUSH_VERTICES(ctx, _NEW_HINT); + ctx->Hint.Fog = mode; + break; + case GL_LINE_SMOOTH_HINT: + if (ctx->Hint.LineSmooth == mode) + return; + FLUSH_VERTICES(ctx, _NEW_HINT); + ctx->Hint.LineSmooth = mode; + break; + case GL_PERSPECTIVE_CORRECTION_HINT: + if (ctx->Hint.PerspectiveCorrection == mode) + return; + FLUSH_VERTICES(ctx, _NEW_HINT); + ctx->Hint.PerspectiveCorrection = mode; + break; + case GL_POINT_SMOOTH_HINT: + if (ctx->Hint.PointSmooth == mode) + return; + FLUSH_VERTICES(ctx, _NEW_HINT); + ctx->Hint.PointSmooth = mode; + break; + case GL_POLYGON_SMOOTH_HINT: + if (ctx->Hint.PolygonSmooth == mode) + return; + FLUSH_VERTICES(ctx, _NEW_HINT); + ctx->Hint.PolygonSmooth = mode; + break; + + /* GL_EXT_clip_volume_hint */ + case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: + if (ctx->Hint.ClipVolumeClipping == mode) + return; + FLUSH_VERTICES(ctx, _NEW_HINT); + ctx->Hint.ClipVolumeClipping = mode; + break; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (!ctx->Extensions.ARB_texture_compression) { + _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); + return; + } + if (ctx->Hint.TextureCompression == mode) + return; + FLUSH_VERTICES(ctx, _NEW_HINT); + ctx->Hint.TextureCompression = mode; + break; + + /* GL_SGIS_generate_mipmap */ + case GL_GENERATE_MIPMAP_HINT_SGIS: + if (!ctx->Extensions.SGIS_generate_mipmap) { + _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); + return; + } + if (ctx->Hint.GenerateMipmap == mode) + return; + FLUSH_VERTICES(ctx, _NEW_HINT); + ctx->Hint.GenerateMipmap = mode; + break; + + /* GL_ARB_fragment_shader */ + case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: + if (!ctx->Extensions.ARB_fragment_shader) { + _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); + return; + } + if (ctx->Hint.FragmentShaderDerivative == mode) + return; + FLUSH_VERTICES(ctx, _NEW_HINT); + ctx->Hint.FragmentShaderDerivative = mode; + break; + + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); + return; + } + + if (ctx->Driver.Hint) { + (*ctx->Driver.Hint)( ctx, target, mode ); + } +} + + +/**********************************************************************/ +/***** Initialization *****/ +/**********************************************************************/ + +void _mesa_init_hint( GLcontext * ctx ) +{ + /* Hint group */ + ctx->Hint.PerspectiveCorrection = GL_DONT_CARE; + ctx->Hint.PointSmooth = GL_DONT_CARE; + ctx->Hint.LineSmooth = GL_DONT_CARE; + ctx->Hint.PolygonSmooth = GL_DONT_CARE; + ctx->Hint.Fog = GL_DONT_CARE; + ctx->Hint.ClipVolumeClipping = GL_DONT_CARE; + ctx->Hint.TextureCompression = GL_DONT_CARE; + ctx->Hint.GenerateMipmap = GL_DONT_CARE; + ctx->Hint.FragmentShaderDerivative = GL_DONT_CARE; +} diff --git a/reactos/dll/mesa32/src/main/hint.h b/reactos/dll/mesa32/src/main/hint.h new file mode 100644 index 00000000000..bfc3887107d --- /dev/null +++ b/reactos/dll/mesa32/src/main/hint.h @@ -0,0 +1,57 @@ +/** + * \file hint.h + * Hints operations. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * 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 HINT_H +#define HINT_H + + +#include "mtypes.h" + +#if _HAVE_FULL_GL + +extern void GLAPIENTRY +_mesa_Hint( GLenum target, GLenum mode ); + +extern void +_mesa_init_hint( GLcontext * ctx ); + +#else + +/** No-op */ +#define _mesa_init_hint( c ) ((void) 0) + +#endif + +#endif diff --git a/reactos/dll/mesa32/src/main/histogram.c b/reactos/dll/mesa32/src/main/histogram.c new file mode 100644 index 00000000000..29aced0c7a7 --- /dev/null +++ b/reactos/dll/mesa32/src/main/histogram.c @@ -0,0 +1,1187 @@ +/* + * 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. + */ + + +#include "glheader.h" +#include "bufferobj.h" +#include "colormac.h" +#include "context.h" +#include "image.h" +#include "histogram.h" + + +/********************************************************************** + * Internal functions + */ + + +/* + * Update the min/max values from an array of fragment colors. + */ +void +_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) +{ + GLuint i; + for (i = 0; i < n; i++) { + /* update mins */ + if (rgba[i][RCOMP] < ctx->MinMax.Min[RCOMP]) + ctx->MinMax.Min[RCOMP] = rgba[i][RCOMP]; + if (rgba[i][GCOMP] < ctx->MinMax.Min[GCOMP]) + ctx->MinMax.Min[GCOMP] = rgba[i][GCOMP]; + if (rgba[i][BCOMP] < ctx->MinMax.Min[BCOMP]) + ctx->MinMax.Min[BCOMP] = rgba[i][BCOMP]; + if (rgba[i][ACOMP] < ctx->MinMax.Min[ACOMP]) + ctx->MinMax.Min[ACOMP] = rgba[i][ACOMP]; + + /* update maxs */ + if (rgba[i][RCOMP] > ctx->MinMax.Max[RCOMP]) + ctx->MinMax.Max[RCOMP] = rgba[i][RCOMP]; + if (rgba[i][GCOMP] > ctx->MinMax.Max[GCOMP]) + ctx->MinMax.Max[GCOMP] = rgba[i][GCOMP]; + if (rgba[i][BCOMP] > ctx->MinMax.Max[BCOMP]) + ctx->MinMax.Max[BCOMP] = rgba[i][BCOMP]; + if (rgba[i][ACOMP] > ctx->MinMax.Max[ACOMP]) + ctx->MinMax.Max[ACOMP] = rgba[i][ACOMP]; + } +} + + +/* + * Update the histogram values from an array of fragment colors. + */ +void +_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) +{ + const GLint max = ctx->Histogram.Width - 1; + GLfloat w = (GLfloat) max; + GLuint i; + + if (ctx->Histogram.Width == 0) + return; + + for (i = 0; i < n; i++) { + GLint ri = IROUND(rgba[i][RCOMP] * w); + GLint gi = IROUND(rgba[i][GCOMP] * w); + GLint bi = IROUND(rgba[i][BCOMP] * w); + GLint ai = IROUND(rgba[i][ACOMP] * w); + ri = CLAMP(ri, 0, max); + gi = CLAMP(gi, 0, max); + bi = CLAMP(bi, 0, max); + ai = CLAMP(ai, 0, max); + ctx->Histogram.Count[ri][RCOMP]++; + ctx->Histogram.Count[gi][GCOMP]++; + ctx->Histogram.Count[bi][BCOMP]++; + ctx->Histogram.Count[ai][ACOMP]++; + } +} + + +/* + * XXX the packed pixel formats haven't been tested. + */ +static void +pack_histogram( GLcontext *ctx, + GLuint n, CONST GLuint rgba[][4], + GLenum format, GLenum type, GLvoid *destination, + const struct gl_pixelstore_attrib *packing ) +{ + const GLint comps = _mesa_components_in_format(format); + GLuint luminance[MAX_WIDTH]; + + if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) { + GLuint i; + for (i = 0; i < n; i++) { + luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; + } + } + +#define PACK_MACRO(TYPE) \ + { \ + GLuint i; \ + switch (format) { \ + case GL_RED: \ + for (i=0;iSwapBytes) { + _mesa_swap2(dst, n * comps); + } + } + break; + case GL_SHORT: + { + GLshort *dst = (GLshort *) destination; + PACK_MACRO(GLshort); + if (packing->SwapBytes) { + _mesa_swap2((GLushort *) dst, n * comps); + } + } + break; + case GL_UNSIGNED_INT: + { + GLuint *dst = (GLuint *) destination; + PACK_MACRO(GLuint); + if (packing->SwapBytes) { + _mesa_swap4(dst, n * comps); + } + } + break; + case GL_INT: + { + GLint *dst = (GLint *) destination; + PACK_MACRO(GLint); + if (packing->SwapBytes) { + _mesa_swap4((GLuint *) dst, n * comps); + } + } + break; + case GL_FLOAT: + { + GLfloat *dst = (GLfloat *) destination; + PACK_MACRO(GLfloat); + if (packing->SwapBytes) { + _mesa_swap4((GLuint *) dst, n * comps); + } + } + break; + case GL_HALF_FLOAT_ARB: + { + /* temporarily store as GLuints */ + GLuint temp[4*HISTOGRAM_TABLE_SIZE]; + GLhalfARB *dst = (GLhalfARB *) destination; + GLuint i; + /* get GLuint values */ + PACK_MACRO(GLuint); + /* convert to GLhalf */ + for (i = 0; i < n * comps; i++) { + dst[i] = _mesa_float_to_half((GLfloat) temp[i]); + } + if (packing->SwapBytes) { + _mesa_swap2((GLushort *) dst, n * comps); + } + } + break; + case GL_UNSIGNED_BYTE_3_3_2: + if (format == GL_RGB) { + GLubyte *dst = (GLubyte *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][RCOMP] & 0x7) << 5) + | ((rgba[i][GCOMP] & 0x7) << 2) + | ((rgba[i][BCOMP] & 0x3) ); + } + } + else { + GLubyte *dst = (GLubyte *) destination; + GLuint i; + ASSERT(format == GL_BGR); + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][BCOMP] & 0x7) << 5) + | ((rgba[i][GCOMP] & 0x7) << 2) + | ((rgba[i][RCOMP] & 0x3) ); + } + } + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + if (format == GL_RGB) { + GLubyte *dst = (GLubyte *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][RCOMP] & 0x3) << 6) + | ((rgba[i][GCOMP] & 0x7) << 3) + | ((rgba[i][BCOMP] & 0x7) ); + } + } + else { + GLubyte *dst = (GLubyte *) destination; + GLuint i; + ASSERT(format == GL_BGR); + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][BCOMP] & 0x3) << 6) + | ((rgba[i][GCOMP] & 0x7) << 3) + | ((rgba[i][RCOMP] & 0x7) ); + } + } + break; + case GL_UNSIGNED_SHORT_5_6_5: + if (format == GL_RGB) { + GLushort *dst = (GLushort *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) + | ((rgba[i][GCOMP] & 0x3f) << 5) + | ((rgba[i][BCOMP] & 0x1f) ); + } + } + else { + GLushort *dst = (GLushort *) destination; + GLuint i; + ASSERT(format == GL_BGR); + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11) + | ((rgba[i][GCOMP] & 0x3f) << 5) + | ((rgba[i][RCOMP] & 0x1f) ); + } + } + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + if (format == GL_RGB) { + GLushort *dst = (GLushort *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11) + | ((rgba[i][GCOMP] & 0x3f) << 5) + | ((rgba[i][RCOMP] & 0x1f) ); + } + } + else { + GLushort *dst = (GLushort *) destination; + GLuint i; + ASSERT(format == GL_BGR); + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) + | ((rgba[i][GCOMP] & 0x3f) << 5) + | ((rgba[i][BCOMP] & 0x1f) ); + } + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + if (format == GL_RGBA) { + GLushort *dst = (GLushort *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][RCOMP] & 0xf) << 12) + | ((rgba[i][GCOMP] & 0xf) << 8) + | ((rgba[i][BCOMP] & 0xf) << 4) + | ((rgba[i][ACOMP] & 0xf) ); + } + } + else if (format == GL_BGRA) { + GLushort *dst = (GLushort *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][BCOMP] & 0xf) << 12) + | ((rgba[i][GCOMP] & 0xf) << 8) + | ((rgba[i][RCOMP] & 0xf) << 4) + | ((rgba[i][ACOMP] & 0xf) ); + } + } + else { + GLushort *dst = (GLushort *) destination; + GLuint i; + ASSERT(format == GL_ABGR_EXT); + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][ACOMP] & 0xf) << 12) + | ((rgba[i][BCOMP] & 0xf) << 8) + | ((rgba[i][GCOMP] & 0xf) << 4) + | ((rgba[i][RCOMP] & 0xf) ); + } + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + if (format == GL_RGBA) { + GLushort *dst = (GLushort *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][ACOMP] & 0xf) << 12) + | ((rgba[i][BCOMP] & 0xf) << 8) + | ((rgba[i][GCOMP] & 0xf) << 4) + | ((rgba[i][RCOMP] & 0xf) ); + } + } + else if (format == GL_BGRA) { + GLushort *dst = (GLushort *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][ACOMP] & 0xf) << 12) + | ((rgba[i][RCOMP] & 0xf) << 8) + | ((rgba[i][GCOMP] & 0xf) << 4) + | ((rgba[i][BCOMP] & 0xf) ); + } + } + else { + GLushort *dst = (GLushort *) destination; + GLuint i; + ASSERT(format == GL_ABGR_EXT); + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][RCOMP] & 0xf) << 12) + | ((rgba[i][GCOMP] & 0xf) << 8) + | ((rgba[i][BCOMP] & 0xf) << 4) + | ((rgba[i][ACOMP] & 0xf) ); + } + } + break; + case GL_UNSIGNED_SHORT_5_5_5_1: + if (format == GL_RGBA) { + GLushort *dst = (GLushort *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) + | ((rgba[i][GCOMP] & 0x1f) << 6) + | ((rgba[i][BCOMP] & 0x1f) << 1) + | ((rgba[i][ACOMP] & 0x1) ); + } + } + else if (format == GL_BGRA) { + GLushort *dst = (GLushort *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11) + | ((rgba[i][GCOMP] & 0x1f) << 6) + | ((rgba[i][RCOMP] & 0x1f) << 1) + | ((rgba[i][ACOMP] & 0x1) ); + } + } + else { + GLushort *dst = (GLushort *) destination; + GLuint i; + ASSERT(format == GL_ABGR_EXT); + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11) + | ((rgba[i][BCOMP] & 0x1f) << 6) + | ((rgba[i][GCOMP] & 0x1f) << 1) + | ((rgba[i][RCOMP] & 0x1) ); + } + } + break; + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + if (format == GL_RGBA) { + GLushort *dst = (GLushort *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11) + | ((rgba[i][BCOMP] & 0x1f) << 6) + | ((rgba[i][GCOMP] & 0x1f) << 1) + | ((rgba[i][RCOMP] & 0x1) ); + } + } + else if (format == GL_BGRA) { + GLushort *dst = (GLushort *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11) + | ((rgba[i][RCOMP] & 0x1f) << 6) + | ((rgba[i][GCOMP] & 0x1f) << 1) + | ((rgba[i][BCOMP] & 0x1) ); + } + } + else { + GLushort *dst = (GLushort *) destination; + GLuint i; + ASSERT(format == GL_ABGR_EXT); + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) + | ((rgba[i][GCOMP] & 0x1f) << 6) + | ((rgba[i][BCOMP] & 0x1f) << 1) + | ((rgba[i][ACOMP] & 0x1) ); + } + } + break; + case GL_UNSIGNED_INT_8_8_8_8: + if (format == GL_RGBA) { + GLuint *dst = (GLuint *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][RCOMP] & 0xff) << 24) + | ((rgba[i][GCOMP] & 0xff) << 16) + | ((rgba[i][BCOMP] & 0xff) << 8) + | ((rgba[i][ACOMP] & 0xff) ); + } + } + else if (format == GL_BGRA) { + GLuint *dst = (GLuint *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][BCOMP] & 0xff) << 24) + | ((rgba[i][GCOMP] & 0xff) << 16) + | ((rgba[i][RCOMP] & 0xff) << 8) + | ((rgba[i][ACOMP] & 0xff) ); + } + } + else { + GLuint *dst = (GLuint *) destination; + GLuint i; + ASSERT(format == GL_ABGR_EXT); + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][ACOMP] & 0xff) << 24) + | ((rgba[i][BCOMP] & 0xff) << 16) + | ((rgba[i][GCOMP] & 0xff) << 8) + | ((rgba[i][RCOMP] & 0xff) ); + } + } + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + if (format == GL_RGBA) { + GLuint *dst = (GLuint *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][ACOMP] & 0xff) << 24) + | ((rgba[i][BCOMP] & 0xff) << 16) + | ((rgba[i][GCOMP] & 0xff) << 8) + | ((rgba[i][RCOMP] & 0xff) ); + } + } + else if (format == GL_BGRA) { + GLuint *dst = (GLuint *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][ACOMP] & 0xff) << 24) + | ((rgba[i][RCOMP] & 0xff) << 16) + | ((rgba[i][GCOMP] & 0xff) << 8) + | ((rgba[i][BCOMP] & 0xff) ); + } + } + else { + GLuint *dst = (GLuint *) destination; + GLuint i; + ASSERT(format == GL_ABGR_EXT); + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][RCOMP] & 0xff) << 24) + | ((rgba[i][GCOMP] & 0xff) << 16) + | ((rgba[i][BCOMP] & 0xff) << 8) + | ((rgba[i][ACOMP] & 0xff) ); + } + } + break; + case GL_UNSIGNED_INT_10_10_10_2: + if (format == GL_RGBA) { + GLuint *dst = (GLuint *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][RCOMP] & 0x3ff) << 22) + | ((rgba[i][GCOMP] & 0x3ff) << 12) + | ((rgba[i][BCOMP] & 0x3ff) << 2) + | ((rgba[i][ACOMP] & 0x3) ); + } + } + else if (format == GL_BGRA) { + GLuint *dst = (GLuint *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][BCOMP] & 0x3ff) << 22) + | ((rgba[i][GCOMP] & 0x3ff) << 12) + | ((rgba[i][RCOMP] & 0x3ff) << 2) + | ((rgba[i][ACOMP] & 0x3) ); + } + } + else { + GLuint *dst = (GLuint *) destination; + GLuint i; + ASSERT(format == GL_ABGR_EXT); + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22) + | ((rgba[i][BCOMP] & 0x3ff) << 12) + | ((rgba[i][GCOMP] & 0x3ff) << 2) + | ((rgba[i][RCOMP] & 0x3) ); + } + } + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: + if (format == GL_RGBA) { + GLuint *dst = (GLuint *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22) + | ((rgba[i][BCOMP] & 0x3ff) << 12) + | ((rgba[i][GCOMP] & 0x3ff) << 2) + | ((rgba[i][RCOMP] & 0x3) ); + } + } + else if (format == GL_BGRA) { + GLuint *dst = (GLuint *) destination; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22) + | ((rgba[i][RCOMP] & 0x3ff) << 12) + | ((rgba[i][GCOMP] & 0x3ff) << 2) + | ((rgba[i][BCOMP] & 0x3) ); + } + } + else { + GLuint *dst = (GLuint *) destination; + GLuint i; + ASSERT(format == GL_ABGR_EXT); + for (i = 0; i < n; i++) { + dst[i] = ((rgba[i][RCOMP] & 0x3ff) << 22) + | ((rgba[i][GCOMP] & 0x3ff) << 12) + | ((rgba[i][BCOMP] & 0x3ff) << 2) + | ((rgba[i][ACOMP] & 0x3) ); + } + } + break; + default: + _mesa_problem(ctx, "Bad type in pack_histogram"); + } + +#undef PACK_MACRO +} + + +/* + * Given an internalFormat token passed to glHistogram or glMinMax, + * return the corresponding base format. + * Return -1 if invalid token. + */ +static GLint +base_histogram_format( GLenum format ) +{ + switch (format) { + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + return GL_ALPHA; + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + return GL_LUMINANCE; + 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_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 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: + return -1; /* error */ + } +} + + + +/********************************************************************** + * API functions + */ + + +void GLAPIENTRY +_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax"); + return; + } + + if (target != GL_MINMAX) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmax(target)"); + return; + } + + if (format != GL_RED && + format != GL_GREEN && + format != GL_BLUE && + format != GL_ALPHA && + format != GL_RGB && + format != GL_BGR && + format != GL_RGBA && + format != GL_BGRA && + format != GL_ABGR_EXT && + format != GL_LUMINANCE && + format != GL_LUMINANCE_ALPHA) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinMax(format)"); + } + + if (!_mesa_is_legal_format_and_type(ctx, format, type)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax(format or type)"); + return; + } + + if (ctx->Pack.BufferObj->Name) { + /* pack min/max values into a PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(1, &ctx->Pack, 2, 1, 1, + format, type, values)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetMinMax(invalid PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + ctx->Pack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION,"glGetMinMax(PBO is mapped)"); + return; + } + values = ADD_POINTERS(buf, values); + } + else if (!values) { + /* not an error */ + return; + } + + { + GLfloat minmax[2][4]; + minmax[0][RCOMP] = CLAMP(ctx->MinMax.Min[RCOMP], 0.0F, 1.0F); + minmax[0][GCOMP] = CLAMP(ctx->MinMax.Min[GCOMP], 0.0F, 1.0F); + minmax[0][BCOMP] = CLAMP(ctx->MinMax.Min[BCOMP], 0.0F, 1.0F); + minmax[0][ACOMP] = CLAMP(ctx->MinMax.Min[ACOMP], 0.0F, 1.0F); + minmax[1][RCOMP] = CLAMP(ctx->MinMax.Max[RCOMP], 0.0F, 1.0F); + minmax[1][GCOMP] = CLAMP(ctx->MinMax.Max[GCOMP], 0.0F, 1.0F); + minmax[1][BCOMP] = CLAMP(ctx->MinMax.Max[BCOMP], 0.0F, 1.0F); + minmax[1][ACOMP] = CLAMP(ctx->MinMax.Max[ACOMP], 0.0F, 1.0F); + _mesa_pack_rgba_span_float(ctx, 2, (CONST GLfloat (*)[4]) minmax, + format, type, values, &ctx->Pack, 0); + } + + if (ctx->Pack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + ctx->Pack.BufferObj); + } + + if (reset) { + _mesa_ResetMinmax(GL_MINMAX); + } +} + + +void GLAPIENTRY +_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram"); + return; + } + + if (target != GL_HISTOGRAM) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(target)"); + return; + } + + if (format != GL_RED && + format != GL_GREEN && + format != GL_BLUE && + format != GL_ALPHA && + format != GL_RGB && + format != GL_BGR && + format != GL_RGBA && + format != GL_BGRA && + format != GL_ABGR_EXT && + format != GL_LUMINANCE && + format != GL_LUMINANCE_ALPHA) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(format)"); + } + + if (!_mesa_is_legal_format_and_type(ctx, format, type)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram(format or type)"); + return; + } + + if (ctx->Pack.BufferObj->Name) { + /* pack min/max values into a PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(1, &ctx->Pack, ctx->Histogram.Width, 1, 1, + format, type, values)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetHistogram(invalid PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + ctx->Pack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx,GL_INVALID_OPERATION,"glGetHistogram(PBO is mapped)"); + return; + } + values = ADD_POINTERS(buf, values); + } + else if (!values) { + /* not an error */ + return; + } + + pack_histogram(ctx, ctx->Histogram.Width, + (CONST GLuint (*)[4]) ctx->Histogram.Count, + format, type, values, &ctx->Pack); + + if (ctx->Pack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + ctx->Pack.BufferObj); + } + + if (reset) { + GLuint i; + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } + } +} + + +void GLAPIENTRY +_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameterfv"); + return; + } + + if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(target)"); + return; + } + + switch (pname) { + case GL_HISTOGRAM_WIDTH: + *params = (GLfloat) ctx->Histogram.Width; + break; + case GL_HISTOGRAM_FORMAT: + *params = (GLfloat) ctx->Histogram.Format; + break; + case GL_HISTOGRAM_RED_SIZE: + *params = (GLfloat) ctx->Histogram.RedSize; + break; + case GL_HISTOGRAM_GREEN_SIZE: + *params = (GLfloat) ctx->Histogram.GreenSize; + break; + case GL_HISTOGRAM_BLUE_SIZE: + *params = (GLfloat) ctx->Histogram.BlueSize; + break; + case GL_HISTOGRAM_ALPHA_SIZE: + *params = (GLfloat) ctx->Histogram.AlphaSize; + break; + case GL_HISTOGRAM_LUMINANCE_SIZE: + *params = (GLfloat) ctx->Histogram.LuminanceSize; + break; + case GL_HISTOGRAM_SINK: + *params = (GLfloat) ctx->Histogram.Sink; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(pname)"); + } +} + + +void GLAPIENTRY +_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameteriv"); + return; + } + + if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(target)"); + return; + } + + switch (pname) { + case GL_HISTOGRAM_WIDTH: + *params = (GLint) ctx->Histogram.Width; + break; + case GL_HISTOGRAM_FORMAT: + *params = (GLint) ctx->Histogram.Format; + break; + case GL_HISTOGRAM_RED_SIZE: + *params = (GLint) ctx->Histogram.RedSize; + break; + case GL_HISTOGRAM_GREEN_SIZE: + *params = (GLint) ctx->Histogram.GreenSize; + break; + case GL_HISTOGRAM_BLUE_SIZE: + *params = (GLint) ctx->Histogram.BlueSize; + break; + case GL_HISTOGRAM_ALPHA_SIZE: + *params = (GLint) ctx->Histogram.AlphaSize; + break; + case GL_HISTOGRAM_LUMINANCE_SIZE: + *params = (GLint) ctx->Histogram.LuminanceSize; + break; + case GL_HISTOGRAM_SINK: + *params = (GLint) ctx->Histogram.Sink; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(pname)"); + } +} + + +void GLAPIENTRY +_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameterfv"); + return; + } + if (target != GL_MINMAX) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameterfv(target)"); + return; + } + if (pname == GL_MINMAX_FORMAT) { + *params = (GLfloat) ctx->MinMax.Format; + } + else if (pname == GL_MINMAX_SINK) { + *params = (GLfloat) ctx->MinMax.Sink; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameterfv(pname)"); + } +} + + +void GLAPIENTRY +_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameteriv"); + return; + } + if (target != GL_MINMAX) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameteriv(target)"); + return; + } + if (pname == GL_MINMAX_FORMAT) { + *params = (GLint) ctx->MinMax.Format; + } + else if (pname == GL_MINMAX_SINK) { + *params = (GLint) ctx->MinMax.Sink; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameteriv(pname)"); + } +} + + +void GLAPIENTRY +_mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) +{ + GLuint i; + GLboolean error = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */ + + if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glHistogram"); + return; + } + + if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { + _mesa_error(ctx, GL_INVALID_ENUM, "glHistogram(target)"); + return; + } + + if (width < 0 || width > HISTOGRAM_TABLE_SIZE) { + if (target == GL_PROXY_HISTOGRAM) { + error = GL_TRUE; + } + else { + if (width < 0) + _mesa_error(ctx, GL_INVALID_VALUE, "glHistogram(width)"); + else + _mesa_error(ctx, GL_TABLE_TOO_LARGE, "glHistogram(width)"); + return; + } + } + + if (width != 0 && _mesa_bitcount(width) != 1) { + if (target == GL_PROXY_HISTOGRAM) { + error = GL_TRUE; + } + else { + _mesa_error(ctx, GL_INVALID_VALUE, "glHistogram(width)"); + return; + } + } + + if (base_histogram_format(internalFormat) < 0) { + if (target == GL_PROXY_HISTOGRAM) { + error = GL_TRUE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glHistogram(internalFormat)"); + return; + } + } + + /* reset histograms */ + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } + + if (error) { + ctx->Histogram.Width = 0; + ctx->Histogram.Format = 0; + ctx->Histogram.RedSize = 0; + ctx->Histogram.GreenSize = 0; + ctx->Histogram.BlueSize = 0; + ctx->Histogram.AlphaSize = 0; + ctx->Histogram.LuminanceSize = 0; + } + else { + ctx->Histogram.Width = width; + ctx->Histogram.Format = internalFormat; + ctx->Histogram.Sink = sink; + ctx->Histogram.RedSize = 8 * sizeof(GLuint); + ctx->Histogram.GreenSize = 8 * sizeof(GLuint); + ctx->Histogram.BlueSize = 8 * sizeof(GLuint); + ctx->Histogram.AlphaSize = 8 * sizeof(GLuint); + ctx->Histogram.LuminanceSize = 8 * sizeof(GLuint); + } + + ctx->NewState |= _NEW_PIXEL; +} + + +void GLAPIENTRY +_mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glMinmax"); + return; + } + + if (target != GL_MINMAX) { + _mesa_error(ctx, GL_INVALID_ENUM, "glMinMax(target)"); + return; + } + + if (base_histogram_format(internalFormat) < 0) { + _mesa_error(ctx, GL_INVALID_ENUM, "glMinMax(internalFormat)"); + return; + } + + if (ctx->MinMax.Sink == sink) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->MinMax.Sink = sink; +} + + +void GLAPIENTRY +_mesa_ResetHistogram(GLenum target) +{ + GLuint i; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */ + + if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glResetHistogram"); + return; + } + + if (target != GL_HISTOGRAM) { + _mesa_error(ctx, GL_INVALID_ENUM, "glResetHistogram(target)"); + return; + } + + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } + + ctx->NewState |= _NEW_PIXEL; +} + + +void GLAPIENTRY +_mesa_ResetMinmax(GLenum target) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glResetMinmax"); + return; + } + + if (target != GL_MINMAX) { + _mesa_error(ctx, GL_INVALID_ENUM, "glResetMinMax(target)"); + return; + } + + ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000; + ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000; + ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; + ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; + ctx->NewState |= _NEW_PIXEL; +} + + + +/**********************************************************************/ +/***** Initialization *****/ +/**********************************************************************/ + +void _mesa_init_histogram( GLcontext * ctx ) +{ + int i; + + /* Histogram group */ + ctx->Histogram.Width = 0; + ctx->Histogram.Format = GL_RGBA; + ctx->Histogram.Sink = GL_FALSE; + ctx->Histogram.RedSize = 0; + ctx->Histogram.GreenSize = 0; + ctx->Histogram.BlueSize = 0; + ctx->Histogram.AlphaSize = 0; + ctx->Histogram.LuminanceSize = 0; + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } + + /* Min/Max group */ + ctx->MinMax.Format = GL_RGBA; + ctx->MinMax.Sink = GL_FALSE; + ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000; + ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000; + ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; + ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; +} diff --git a/reactos/dll/mesa32/src/main/histogram.h b/reactos/dll/mesa32/src/main/histogram.h new file mode 100644 index 00000000000..974447231dd --- /dev/null +++ b/reactos/dll/mesa32/src/main/histogram.h @@ -0,0 +1,89 @@ +/** + * \file histogram.h + * Histogram. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * 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. + */ + + +#ifndef HISTOGRAM_H +#define HISTOGRAM_H + +#include "glheader.h" +#include "mtypes.h" + +#if _HAVE_FULL_GL + +extern void GLAPIENTRY +_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values); + +extern void GLAPIENTRY +_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); + +extern void GLAPIENTRY +_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params); + +extern void GLAPIENTRY +_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params); + +extern void GLAPIENTRY +_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params); + +extern void GLAPIENTRY +_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params); + +extern void GLAPIENTRY +_mesa_Histogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); + +extern void GLAPIENTRY +_mesa_Minmax(GLenum target, GLenum internalformat, GLboolean sink); + +extern void GLAPIENTRY +_mesa_ResetHistogram(GLenum target); + +extern void GLAPIENTRY +_mesa_ResetMinmax(GLenum target); + +extern void +_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); + +extern void +_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); + +extern void _mesa_init_histogram( GLcontext * ctx ); + +#else + +/** No-op */ +#define _mesa_init_histogram( c ) ((void) 0) + +#endif + +#endif diff --git a/reactos/dll/mesa32/src/main/image.c b/reactos/dll/mesa32/src/main/image.c new file mode 100644 index 00000000000..12f8352c2d2 --- /dev/null +++ b/reactos/dll/mesa32/src/main/image.c @@ -0,0 +1,4201 @@ +/* + * 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. + */ + + +/** + * \file image.c + * Image handling. + */ + + +#include "glheader.h" +#include "bufferobj.h" +#include "colormac.h" +#include "context.h" +#include "image.h" +#include "imports.h" +#include "histogram.h" +#include "macros.h" +#include "pixel.h" +#include "mtypes.h" + + +/** 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 ) +{ + register GLuint i, a, b; + + for (i=0;i> 1) | + ((b & 0x20) >> 3) | + ((b & 0x40) >> 5) | + ((b & 0x80) >> 7); + p[i] = (GLubyte) a; + } +} + + +/** + * Flip the order of the 2 bytes in each word in the given array. + * + * \param p array. + * \param n number of words. + */ +void +_mesa_swap2( GLushort *p, GLuint n ) +{ + register GLuint i; + + for (i=0;i> 8) | ((p[i] << 8) & 0xff00); + } +} + + + +/* + * Flip the order of the 4 bytes in each word in the given array. + */ +void +_mesa_swap4( GLuint *p, GLuint n ) +{ + register GLuint i, a, b; + + for (i=0;i> 24) + | ((b >> 8) & 0xff00) + | ((b << 8) & 0xff0000) + | ((b << 24) & 0xff000000); + p[i] = a; + } +} + + +/** + * Get the size of a GL data type. + * + * \param type GL data type. + * + * \return the size, in bytes, of the given data type, 0 if a GL_BITMAP, or -1 + * if an invalid type enum. + */ +GLint _mesa_sizeof_type( GLenum type ) +{ + switch (type) { + case GL_BITMAP: + return 0; + case GL_UNSIGNED_BYTE: + return sizeof(GLubyte); + case GL_BYTE: + return sizeof(GLbyte); + case GL_UNSIGNED_SHORT: + return sizeof(GLushort); + case GL_SHORT: + return sizeof(GLshort); + case GL_UNSIGNED_INT: + return sizeof(GLuint); + case GL_INT: + return sizeof(GLint); + case GL_FLOAT: + return sizeof(GLfloat); + case GL_HALF_FLOAT_ARB: + return sizeof(GLhalfARB); + default: + return -1; + } +} + + +/** + * Same as _mesa_sizeof_type() but also accepting the packed pixel + * format data types. + */ +GLint _mesa_sizeof_packed_type( GLenum type ) +{ + switch (type) { + case GL_BITMAP: + return 0; + case GL_UNSIGNED_BYTE: + return sizeof(GLubyte); + case GL_BYTE: + return sizeof(GLbyte); + case GL_UNSIGNED_SHORT: + return sizeof(GLushort); + case GL_SHORT: + return sizeof(GLshort); + case GL_UNSIGNED_INT: + return sizeof(GLuint); + case GL_INT: + return sizeof(GLint); + case GL_HALF_FLOAT_ARB: + return sizeof(GLhalfARB); + case GL_FLOAT: + return sizeof(GLfloat); + case GL_UNSIGNED_BYTE_3_3_2: + return sizeof(GLubyte); + case GL_UNSIGNED_BYTE_2_3_3_REV: + return sizeof(GLubyte); + case GL_UNSIGNED_SHORT_5_6_5: + return sizeof(GLushort); + case GL_UNSIGNED_SHORT_5_6_5_REV: + return sizeof(GLushort); + case GL_UNSIGNED_SHORT_4_4_4_4: + return sizeof(GLushort); + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + return sizeof(GLushort); + case GL_UNSIGNED_SHORT_5_5_5_1: + return sizeof(GLushort); + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + return sizeof(GLushort); + case GL_UNSIGNED_INT_8_8_8_8: + return sizeof(GLuint); + case GL_UNSIGNED_INT_8_8_8_8_REV: + return sizeof(GLuint); + case GL_UNSIGNED_INT_10_10_10_2: + return sizeof(GLuint); + case GL_UNSIGNED_INT_2_10_10_10_REV: + return sizeof(GLuint); + case GL_UNSIGNED_SHORT_8_8_MESA: + case GL_UNSIGNED_SHORT_8_8_REV_MESA: + return sizeof(GLushort); + default: + return -1; + } +} + + +/** + * Get the number of components in a pixel format. + * + * \param format pixel format. + * + * \return the number of components in the given format, or -1 if a bad format. + */ +GLint _mesa_components_in_format( GLenum format ) +{ + switch (format) { + 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: + case GL_STENCIL_INDEX: + case GL_DEPTH_COMPONENT: + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + case GL_INTENSITY: + return 1; + case GL_LUMINANCE_ALPHA: + return 2; + case GL_RGB: + return 3; + case GL_RGBA: + return 4; + case GL_BGR: + return 3; + case GL_BGRA: + return 4; + case GL_ABGR_EXT: + return 4; + case GL_YCBCR_MESA: + return 2; + default: + return -1; + } +} + + +/** + * Get the bytes per pixel of pixel format type pair. + * + * \param format pixel format. + * \param type pixel type. + * + * \return bytes per pixel, or -1 if a bad format or type was given. + */ +GLint _mesa_bytes_per_pixel( GLenum format, GLenum type ) +{ + GLint comps = _mesa_components_in_format( format ); + if (comps < 0) + return -1; + + switch (type) { + case GL_BITMAP: + return 0; /* special case */ + case GL_BYTE: + case GL_UNSIGNED_BYTE: + return comps * sizeof(GLubyte); + case GL_SHORT: + case GL_UNSIGNED_SHORT: + return comps * sizeof(GLshort); + case GL_INT: + case GL_UNSIGNED_INT: + return comps * sizeof(GLint); + case GL_FLOAT: + return comps * sizeof(GLfloat); + case GL_HALF_FLOAT_ARB: + return comps * sizeof(GLhalfARB); + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + if (format == GL_RGB || format == GL_BGR) + return sizeof(GLubyte); + else + return -1; /* error */ + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + if (format == GL_RGB || format == GL_BGR) + return sizeof(GLushort); + else + return -1; /* error */ + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT) + return sizeof(GLushort); + else + return -1; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT) + return sizeof(GLuint); + else + return -1; + case GL_UNSIGNED_SHORT_8_8_MESA: + case GL_UNSIGNED_SHORT_8_8_REV_MESA: + if (format == GL_YCBCR_MESA) + return sizeof(GLushort); + else + return -1; + default: + return -1; + } +} + + +/** + * Test for a legal pixel format and type. + * + * \param format pixel format. + * \param type pixel type. + * + * \return GL_TRUE if the given pixel format and type are legal, or GL_FALSE + * otherwise. + */ +GLboolean +_mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type ) +{ + switch (format) { + case GL_COLOR_INDEX: + case GL_STENCIL_INDEX: + switch (type) { + case GL_BITMAP: + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + return GL_TRUE; + case GL_HALF_FLOAT_ARB: + return ctx->Extensions.ARB_half_float_pixel; + default: + return GL_FALSE; + } + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: +#if 0 /* not legal! see table 3.6 of the 1.5 spec */ + case GL_INTENSITY: +#endif + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_DEPTH_COMPONENT: + 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: + return GL_TRUE; + case GL_HALF_FLOAT_ARB: + return ctx->Extensions.ARB_half_float_pixel; + default: + return GL_FALSE; + } + case GL_RGB: + 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_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + return GL_TRUE; + case GL_HALF_FLOAT_ARB: + return ctx->Extensions.ARB_half_float_pixel; + default: + return GL_FALSE; + } + case GL_BGR: + 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: + return GL_TRUE; + case GL_HALF_FLOAT_ARB: + return ctx->Extensions.ARB_half_float_pixel; + default: + return GL_FALSE; + } + case GL_RGBA: + case GL_BGRA: + case GL_ABGR_EXT: + 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_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + return GL_TRUE; + case GL_HALF_FLOAT_ARB: + return ctx->Extensions.ARB_half_float_pixel; + default: + return GL_FALSE; + } + case GL_YCBCR_MESA: + if (type == GL_UNSIGNED_SHORT_8_8_MESA || + type == GL_UNSIGNED_SHORT_8_8_REV_MESA) + return GL_TRUE; + else + return GL_FALSE; + default: + ; /* fall-through */ + } + return GL_FALSE; +} + + +/** + * Return the address of a specific pixel in an image (1D, 2D or 3D). + * + * Pixel unpacking/packing parameters are observed according to \p packing. + * + * \param dimensions either 1, 2 or 3 to indicate dimensionality of image + * \param image starting address of image data + * \param width the image width + * \param height theimage height + * \param format the pixel format + * \param type the pixel data type + * \param packing the pixelstore attributes + * \param img which image in the volume (0 for 1D or 2D images) + * \param row row of pixel in the image (0 for 1D images) + * \param column column of pixel in the image + * + * \return address of pixel on success, or NULL on error. + * + * \sa gl_pixelstore_attrib. + */ +GLvoid * +_mesa_image_address( GLuint dimensions, + const struct gl_pixelstore_attrib *packing, + const GLvoid *image, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLint img, GLint row, GLint column ) +{ + GLint alignment; /* 1, 2 or 4 */ + GLint pixels_per_row; + GLint rows_per_image; + GLint skiprows; + GLint skippixels; + GLint skipimages; /* for 3-D volume images */ + GLubyte *pixel_addr; + + ASSERT(dimensions >= 1 && dimensions <= 3); + + alignment = packing->Alignment; + if (packing->RowLength > 0) { + pixels_per_row = packing->RowLength; + } + else { + pixels_per_row = width; + } + if (packing->ImageHeight > 0) { + rows_per_image = packing->ImageHeight; + } + else { + rows_per_image = height; + } + + skippixels = packing->SkipPixels; + /* Note: SKIP_ROWS _is_ used for 1D images */ + skiprows = packing->SkipRows; + /* Note: SKIP_IMAGES is only used for 3D images */ + skipimages = (dimensions == 3) ? packing->SkipImages : 0; + + if (type == GL_BITMAP) { + /* BITMAP data */ + GLint comp_per_pixel; /* components per pixel */ + GLint bytes_per_comp; /* bytes per component */ + GLint bytes_per_row; + GLint bytes_per_image; + + /* Compute bytes per component */ + bytes_per_comp = _mesa_sizeof_packed_type( type ); + if (bytes_per_comp < 0) { + return NULL; + } + + /* Compute number of components per pixel */ + comp_per_pixel = _mesa_components_in_format( format ); + if (comp_per_pixel < 0) { + return NULL; + } + + bytes_per_row = alignment + * CEILING( comp_per_pixel*pixels_per_row, 8*alignment ); + + bytes_per_image = bytes_per_row * rows_per_image; + + pixel_addr = (GLubyte *) image + + (skipimages + img) * bytes_per_image + + (skiprows + row) * bytes_per_row + + (skippixels + column) / 8; + } + else { + /* Non-BITMAP data */ + GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image; + GLint topOfImage; + + bytes_per_pixel = _mesa_bytes_per_pixel( format, type ); + + /* The pixel type and format should have been error checked earlier */ + assert(bytes_per_pixel > 0); + + bytes_per_row = pixels_per_row * bytes_per_pixel; + remainder = bytes_per_row % alignment; + if (remainder > 0) + bytes_per_row += (alignment - remainder); + + ASSERT(bytes_per_row % alignment == 0); + + bytes_per_image = bytes_per_row * rows_per_image; + + if (packing->Invert) { + /* set pixel_addr to the last row */ + topOfImage = bytes_per_row * (height - 1); + bytes_per_row = -bytes_per_row; + } + else { + topOfImage = 0; + } + + /* compute final pixel address */ + pixel_addr = (GLubyte *) image + + (skipimages + img) * bytes_per_image + + topOfImage + + (skiprows + row) * bytes_per_row + + (skippixels + column) * bytes_per_pixel; + } + + return (GLvoid *) pixel_addr; +} + + +GLvoid * +_mesa_image_address1d( const struct gl_pixelstore_attrib *packing, + const GLvoid *image, + GLsizei width, + GLenum format, GLenum type, + GLint column ) +{ + return _mesa_image_address(1, packing, image, width, 1, + format, type, 0, 0, column); +} + + +GLvoid * +_mesa_image_address2d( const struct gl_pixelstore_attrib *packing, + const GLvoid *image, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLint row, GLint column ) +{ + return _mesa_image_address(2, packing, image, width, height, + format, type, 0, row, column); +} + + +GLvoid * +_mesa_image_address3d( const struct gl_pixelstore_attrib *packing, + const GLvoid *image, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLint img, GLint row, GLint column ) +{ + return _mesa_image_address(3, packing, image, width, height, + format, type, img, row, column); +} + + + +/** + * Compute the stride between image rows. + * + * \param packing the pixelstore attributes + * \param width image width. + * \param format pixel format. + * \param type pixel data type. + * + * \return the stride in bytes for the given parameters. + * + * Computes the number of bytes per pixel and row and compensates for alignment. + * + * \sa gl_pixelstore_attrib. + */ +GLint +_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, + GLint width, GLenum format, GLenum type ) +{ + ASSERT(packing); + if (type == GL_BITMAP) { + /* BITMAP data */ + GLint bytes; + if (packing->RowLength == 0) { + bytes = (width + 7) / 8; + } + else { + bytes = (packing->RowLength + 7) / 8; + } + if (packing->Invert) { + /* negate the bytes per row (negative row stride) */ + bytes = -bytes; + } + return bytes; + } + else { + /* Non-BITMAP data */ + const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); + GLint bytesPerRow, remainder; + if (bytesPerPixel <= 0) + return -1; /* error */ + if (packing->RowLength == 0) { + bytesPerRow = bytesPerPixel * width; + } + else { + bytesPerRow = bytesPerPixel * packing->RowLength; + } + remainder = bytesPerRow % packing->Alignment; + if (remainder > 0) + bytesPerRow += (packing->Alignment - remainder); + if (packing->Invert) + bytesPerRow = -bytesPerRow; + return bytesPerRow; + } +} + + +#if _HAVE_FULL_GL + +/* + * Compute the stride between images in a 3D texture (in bytes) for the given + * pixel packing parameters and image width, format and type. + */ +GLint +_mesa_image_image_stride( const struct gl_pixelstore_attrib *packing, + GLint width, GLint height, + GLenum format, GLenum type ) +{ + ASSERT(packing); + ASSERT(type != GL_BITMAP); + + { + const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); + GLint bytesPerRow, bytesPerImage, remainder; + + if (bytesPerPixel <= 0) + return -1; /* error */ + if (packing->RowLength == 0) { + bytesPerRow = bytesPerPixel * width; + } + else { + bytesPerRow = bytesPerPixel * packing->RowLength; + } + remainder = bytesPerRow % packing->Alignment; + if (remainder > 0) + bytesPerRow += (packing->Alignment - remainder); + + if (packing->ImageHeight == 0) + bytesPerImage = bytesPerRow * height; + else + bytesPerImage = bytesPerRow * packing->ImageHeight; + + return bytesPerImage; + } +} + + +/* + * 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 == 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 == 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; + } + } + } + } + src += width_in_bytes; + } +} + + +/** + * Apply various pixel transfer operations to an array of RGBA pixels + * as indicated by the transferOps bitmask + */ +void +_mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLuint 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 ); + } + /* GL_COLOR_TABLE lookup */ + if (transferOps & IMAGE_COLOR_TABLE_BIT) { + _mesa_lookup_rgba_float(&ctx->ColorTable, n, rgba); + } + /* convolution */ + if (transferOps & IMAGE_CONVOLUTION_BIT) { + /* this has to be done in the calling code */ + _mesa_problem(ctx, "IMAGE_CONVOLUTION_BIT set in _mesa_apply_transfer_ops"); + } + /* GL_POST_CONVOLUTION_RED/GREEN/BLUE/ALPHA_SCALE/BIAS */ + if (transferOps & IMAGE_POST_CONVOLUTION_SCALE_BIAS) { + _mesa_scale_and_bias_rgba(n, rgba, + ctx->Pixel.PostConvolutionScale[RCOMP], + ctx->Pixel.PostConvolutionScale[GCOMP], + ctx->Pixel.PostConvolutionScale[BCOMP], + ctx->Pixel.PostConvolutionScale[ACOMP], + ctx->Pixel.PostConvolutionBias[RCOMP], + ctx->Pixel.PostConvolutionBias[GCOMP], + ctx->Pixel.PostConvolutionBias[BCOMP], + ctx->Pixel.PostConvolutionBias[ACOMP]); + } + /* GL_POST_CONVOLUTION_COLOR_TABLE lookup */ + if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) { + _mesa_lookup_rgba_float(&ctx->PostConvolutionColorTable, n, rgba); + } + /* color matrix transform */ + if (transferOps & IMAGE_COLOR_MATRIX_BIT) { + _mesa_transform_rgba(ctx, n, rgba); + } + /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ + if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) { + _mesa_lookup_rgba_float(&ctx->PostColorMatrixColorTable, n, rgba); + } + /* update histogram count */ + if (transferOps & IMAGE_HISTOGRAM_BIT) { + _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); + } + /* update min/max values */ + if (transferOps & IMAGE_MIN_MAX_BIT) { + _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) 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); + } + } +} + + + +/* + * Used to pack an array [][4] of RGBA float colors as specified + * by the dstFormat, dstType and dstPacking. Used by glReadPixels, + * glGetConvolutionFilter(), etc. + */ +void +_mesa_pack_rgba_span_float( GLcontext *ctx, + GLuint n, CONST GLfloat rgbaIn[][4], + GLenum dstFormat, GLenum dstType, + GLvoid *dstAddr, + const struct gl_pixelstore_attrib *dstPacking, + GLuint transferOps ) +{ + const GLint comps = _mesa_components_in_format(dstFormat); + GLfloat luminance[MAX_WIDTH]; + const GLfloat (*rgba)[4]; + GLuint i; + + if (transferOps) { + /* make copy of incoming data */ + DEFMARRAY(GLfloat, rgbaCopy, MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(rgbaCopy, return); /* mac 32k limitation */ + + _mesa_memcpy(rgbaCopy, rgbaIn, n * 4 * sizeof(GLfloat)); + _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgbaCopy); + rgba = (const GLfloat (*)[4]) rgbaCopy; + + if ((transferOps & IMAGE_MIN_MAX_BIT) && ctx->MinMax.Sink) { + UNDEFARRAY(rgbaCopy); /* mac 32k limitation */ + return; + } + UNDEFARRAY(rgbaCopy); /* mac 32k limitation */ + } + else { + /* use incoming data, not a copy */ + rgba = (const GLfloat (*)[4]) rgbaIn; + } + + if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) { + /* compute luminance values */ + if (ctx->ClampFragmentColors) { + 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;iSwapBytes) { + _mesa_swap2( (GLushort *) dst, n * comps); + } + } + break; + case GL_SHORT: + { + GLshort *dst = (GLshort *) dstAddr; + switch (dstFormat) { + case GL_RED: + for (i=0;iSwapBytes) { + _mesa_swap2( (GLushort *) dst, n * comps ); + } + } + break; + case GL_UNSIGNED_INT: + { + GLuint *dst = (GLuint *) dstAddr; + switch (dstFormat) { + case GL_RED: + for (i=0;iSwapBytes) { + _mesa_swap4( (GLuint *) dst, n * comps ); + } + } + break; + case GL_INT: + { + GLint *dst = (GLint *) dstAddr; + switch (dstFormat) { + case GL_RED: + for (i=0;iSwapBytes) { + _mesa_swap4( (GLuint *) dst, n * comps ); + } + } + break; + case GL_FLOAT: + { + GLfloat *dst = (GLfloat *) dstAddr; + switch (dstFormat) { + case GL_RED: + for (i=0;iSwapBytes) { + _mesa_swap4( (GLuint *) dst, n * comps ); + } + } + break; + case GL_HALF_FLOAT_ARB: + { + GLhalfARB *dst = (GLhalfARB *) dstAddr; + switch (dstFormat) { + case GL_RED: + for (i=0;iSwapBytes) { + _mesa_swap2( (GLushort *) dst, n * comps ); + } + } + break; + case GL_UNSIGNED_BYTE_3_3_2: + if (dstFormat == GL_RGB) { + GLubyte *dst = (GLubyte *) dstAddr; + for (i=0;iNewState & _NEW_PIXEL) == 0 || transferOps == 0); + + /* Test for optimized case first */ + if (transferOps == 0 && dstFormat == GL_RGBA && dstType == CHAN_TYPE) { + /* common simple case */ + MEMCPY(dstAddr, srcRgba, n * 4 * sizeof(GLchan)); + } + else if (transferOps == 0 && dstFormat == GL_RGB && dstType == CHAN_TYPE) { + /* common simple case */ + GLuint i; + GLchan *dest = (GLchan *) dstAddr; + for (i = 0; i < n; i++) { + dest[0] = srcRgba[i][RCOMP]; + dest[1] = srcRgba[i][GCOMP]; + dest[2] = srcRgba[i][BCOMP]; + dest += 3; + } + } + else if (transferOps == 0 && dstFormat == GL_RGBA && dstType == GL_UNSIGNED_BYTE) { + /* common simple case */ + GLuint i; + GLubyte *dest = (GLubyte *) dstAddr; + for (i = 0; i < n; i++) { + dest[0] = CHAN_TO_UBYTE(srcRgba[i][RCOMP]); + dest[1] = CHAN_TO_UBYTE(srcRgba[i][GCOMP]); + dest[2] = CHAN_TO_UBYTE(srcRgba[i][BCOMP]); + dest[3] = CHAN_TO_UBYTE(srcRgba[i][ACOMP]); + dest += 4; + } + } + else { + /* general solution */ + GLuint i; + DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(rgba, return); /* mac 32k limitation */ + + assert(n <= MAX_WIDTH); + /* convert color components to floating point */ + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = CHAN_TO_FLOAT(srcRgba[i][RCOMP]); + rgba[i][GCOMP] = CHAN_TO_FLOAT(srcRgba[i][GCOMP]); + rgba[i][BCOMP] = CHAN_TO_FLOAT(srcRgba[i][BCOMP]); + rgba[i][ACOMP] = CHAN_TO_FLOAT(srcRgba[i][ACOMP]); + } + _mesa_pack_rgba_span_float(ctx, n, (const GLfloat (*)[4]) rgba, + dstFormat, dstType, dstAddr, + dstPacking, transferOps); + UNDEFARRAY(rgba); /* mac 32k limitation */ + } +} + + +#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); + + 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); + + 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; + default: + _mesa_problem(NULL, "bad srcType in extract_uint_indexes"); + 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 redIndex, greenIndex, blueIndex, alphaIndex; + GLint stride; + GLint rComp, bComp, gComp, aComp; + + 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_RGB || + srcFormat == GL_BGR || + srcFormat == GL_RGBA || + srcFormat == GL_BGRA || + srcFormat == GL_ABGR_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); + + rComp = gComp = bComp = aComp = -1; + + switch (srcFormat) { + case GL_RED: + redIndex = 0; + greenIndex = blueIndex = alphaIndex = -1; + stride = 1; + break; + case GL_GREEN: + greenIndex = 0; + redIndex = blueIndex = alphaIndex = -1; + stride = 1; + break; + case GL_BLUE: + blueIndex = 0; + redIndex = greenIndex = alphaIndex = -1; + stride = 1; + break; + case GL_ALPHA: + redIndex = greenIndex = blueIndex = -1; + alphaIndex = 0; + stride = 1; + break; + case GL_LUMINANCE: + redIndex = greenIndex = blueIndex = 0; + alphaIndex = -1; + stride = 1; + break; + case GL_LUMINANCE_ALPHA: + redIndex = greenIndex = blueIndex = 0; + alphaIndex = 1; + stride = 2; + break; + case GL_INTENSITY: + redIndex = greenIndex = blueIndex = alphaIndex = 0; + stride = 1; + break; + case GL_RGB: + redIndex = 0; + greenIndex = 1; + blueIndex = 2; + alphaIndex = -1; + rComp = 0; + gComp = 1; + bComp = 2; + aComp = 3; + stride = 3; + break; + case GL_BGR: + redIndex = 2; + greenIndex = 1; + blueIndex = 0; + alphaIndex = -1; + rComp = 2; + gComp = 1; + bComp = 0; + aComp = 3; + stride = 3; + break; + case GL_RGBA: + redIndex = 0; + greenIndex = 1; + blueIndex = 2; + alphaIndex = 3; + rComp = 0; + gComp = 1; + bComp = 2; + aComp = 3; + stride = 4; + break; + case GL_BGRA: + redIndex = 2; + greenIndex = 1; + blueIndex = 0; + alphaIndex = 3; + rComp = 2; + gComp = 1; + bComp = 0; + aComp = 3; + stride = 4; + break; + case GL_ABGR_EXT: + redIndex = 3; + greenIndex = 2; + blueIndex = 1; + alphaIndex = 0; + rComp = 3; + gComp = 2; + bComp = 1; + aComp = 0; + stride = 4; + break; + default: + _mesa_problem(NULL, "bad srcFormat in extract float data"); + return; + } + + +#define PROCESS(INDEX, CHANNEL, DEFAULT, TYPE, CONVERSION) \ + if ((INDEX) < 0) { \ + GLuint i; \ + for (i = 0; i < n; i++) { \ + rgba[i][CHANNEL] = DEFAULT; \ + } \ + } \ + else if (swapBytes) { \ + const TYPE *s = (const TYPE *) src; \ + GLuint i; \ + for (i = 0; i < n; i++) { \ + TYPE value = s[INDEX]; \ + if (sizeof(TYPE) == 2) { \ + SWAP2BYTE(value); \ + } \ + else if (sizeof(TYPE) == 4) { \ + SWAP4BYTE(value); \ + } \ + rgba[i][CHANNEL] = (GLfloat) CONVERSION(value); \ + s += stride; \ + } \ + } \ + else { \ + const TYPE *s = (const TYPE *) src; \ + GLuint i; \ + for (i = 0; i < n; i++) { \ + rgba[i][CHANNEL] = (GLfloat) CONVERSION(s[INDEX]); \ + s += stride; \ + } \ + } + + switch (srcType) { + case GL_UNSIGNED_BYTE: + PROCESS(redIndex, RCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT); + PROCESS(greenIndex, GCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT); + PROCESS(blueIndex, BCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT); + PROCESS(alphaIndex, ACOMP, 1.0F, GLubyte, UBYTE_TO_FLOAT); + break; + case GL_BYTE: + PROCESS(redIndex, RCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT); + PROCESS(greenIndex, GCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT); + PROCESS(blueIndex, BCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT); + PROCESS(alphaIndex, ACOMP, 1.0F, GLbyte, BYTE_TO_FLOAT); + break; + case GL_UNSIGNED_SHORT: + PROCESS(redIndex, RCOMP, 0.0F, GLushort, USHORT_TO_FLOAT); + PROCESS(greenIndex, GCOMP, 0.0F, GLushort, USHORT_TO_FLOAT); + PROCESS(blueIndex, BCOMP, 0.0F, GLushort, USHORT_TO_FLOAT); + PROCESS(alphaIndex, ACOMP, 1.0F, GLushort, USHORT_TO_FLOAT); + break; + case GL_SHORT: + PROCESS(redIndex, RCOMP, 0.0F, GLshort, SHORT_TO_FLOAT); + PROCESS(greenIndex, GCOMP, 0.0F, GLshort, SHORT_TO_FLOAT); + PROCESS(blueIndex, BCOMP, 0.0F, GLshort, SHORT_TO_FLOAT); + PROCESS(alphaIndex, ACOMP, 1.0F, GLshort, SHORT_TO_FLOAT); + break; + case GL_UNSIGNED_INT: + PROCESS(redIndex, RCOMP, 0.0F, GLuint, UINT_TO_FLOAT); + PROCESS(greenIndex, GCOMP, 0.0F, GLuint, UINT_TO_FLOAT); + PROCESS(blueIndex, BCOMP, 0.0F, GLuint, UINT_TO_FLOAT); + PROCESS(alphaIndex, ACOMP, 1.0F, GLuint, UINT_TO_FLOAT); + break; + case GL_INT: + PROCESS(redIndex, RCOMP, 0.0F, GLint, INT_TO_FLOAT); + PROCESS(greenIndex, GCOMP, 0.0F, GLint, INT_TO_FLOAT); + PROCESS(blueIndex, BCOMP, 0.0F, GLint, INT_TO_FLOAT); + PROCESS(alphaIndex, ACOMP, 1.0F, GLint, INT_TO_FLOAT); + break; + case GL_FLOAT: + PROCESS(redIndex, RCOMP, 0.0F, GLfloat, (GLfloat)); + PROCESS(greenIndex, GCOMP, 0.0F, GLfloat, (GLfloat)); + PROCESS(blueIndex, BCOMP, 0.0F, GLfloat, (GLfloat)); + PROCESS(alphaIndex, ACOMP, 1.0F, GLfloat, (GLfloat)); + break; + case GL_HALF_FLOAT_ARB: + PROCESS(redIndex, RCOMP, 0.0F, GLhalfARB, _mesa_half_to_float); + PROCESS(greenIndex, GCOMP, 0.0F, GLhalfARB, _mesa_half_to_float); + PROCESS(blueIndex, BCOMP, 0.0F, GLhalfARB, _mesa_half_to_float); + PROCESS(alphaIndex, ACOMP, 1.0F, GLhalfARB, _mesa_half_to_float); + 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][rComp] = ((p >> 5) ) * (1.0F / 7.0F); + rgba[i][gComp] = ((p >> 2) & 0x7) * (1.0F / 7.0F); + rgba[i][bComp] = ((p ) & 0x3) * (1.0F / 3.0F); + rgba[i][aComp] = 1.0F; + } + } + 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][rComp] = ((p ) & 0x7) * (1.0F / 7.0F); + rgba[i][gComp] = ((p >> 3) & 0x7) * (1.0F / 7.0F); + rgba[i][bComp] = ((p >> 6) ) * (1.0F / 3.0F); + rgba[i][aComp] = 1.0F; + } + } + 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][rComp] = ((p >> 11) ) * (1.0F / 31.0F); + rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); + rgba[i][bComp] = ((p ) & 0x1f) * (1.0F / 31.0F); + rgba[i][aComp] = 1.0F; + } + } + else { + const GLushort *ussrc = (const GLushort *) src; + GLuint i; + for (i = 0; i < n; i ++) { + GLushort p = ussrc[i]; + rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F); + rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); + rgba[i][bComp] = ((p ) & 0x1f) * (1.0F / 31.0F); + rgba[i][aComp] = 1.0F; + } + } + 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][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F); + rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); + rgba[i][bComp] = ((p >> 11) ) * (1.0F / 31.0F); + rgba[i][aComp] = 1.0F; + } + } + else { + const GLushort *ussrc = (const GLushort *) src; + GLuint i; + for (i = 0; i < n; i ++) { + GLushort p = ussrc[i]; + rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F); + rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); + rgba[i][bComp] = ((p >> 11) ) * (1.0F / 31.0F); + rgba[i][aComp] = 1.0F; + } + } + 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][rComp] = ((p >> 12) ) * (1.0F / 15.0F); + rgba[i][gComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); + rgba[i][bComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); + rgba[i][aComp] = ((p ) & 0xf) * (1.0F / 15.0F); + } + } + else { + const GLushort *ussrc = (const GLushort *) src; + GLuint i; + for (i = 0; i < n; i ++) { + GLushort p = ussrc[i]; + rgba[i][rComp] = ((p >> 12) ) * (1.0F / 15.0F); + rgba[i][gComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); + rgba[i][bComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); + rgba[i][aComp] = ((p ) & 0xf) * (1.0F / 15.0F); + } + } + 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][rComp] = ((p ) & 0xf) * (1.0F / 15.0F); + rgba[i][gComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); + rgba[i][bComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); + rgba[i][aComp] = ((p >> 12) ) * (1.0F / 15.0F); + } + } + else { + const GLushort *ussrc = (const GLushort *) src; + GLuint i; + for (i = 0; i < n; i ++) { + GLushort p = ussrc[i]; + rgba[i][rComp] = ((p ) & 0xf) * (1.0F / 15.0F); + rgba[i][gComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); + rgba[i][bComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); + rgba[i][aComp] = ((p >> 12) ) * (1.0F / 15.0F); + } + } + 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][rComp] = ((p >> 11) ) * (1.0F / 31.0F); + rgba[i][gComp] = ((p >> 6) & 0x1f) * (1.0F / 31.0F); + rgba[i][bComp] = ((p >> 1) & 0x1f) * (1.0F / 31.0F); + rgba[i][aComp] = ((p ) & 0x1) * (1.0F / 1.0F); + } + } + else { + const GLushort *ussrc = (const GLushort *) src; + GLuint i; + for (i = 0; i < n; i ++) { + GLushort p = ussrc[i]; + rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F); + rgba[i][gComp] = ((p >> 6) & 0x1f) * (1.0F / 31.0F); + rgba[i][bComp] = ((p >> 1) & 0x1f) * (1.0F / 31.0F); + rgba[i][aComp] = ((p ) & 0x1) * (1.0F / 1.0F); + } + } + 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][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F); + rgba[i][gComp] = ((p >> 5) & 0x1f) * (1.0F / 31.0F); + rgba[i][bComp] = ((p >> 10) & 0x1f) * (1.0F / 31.0F); + rgba[i][aComp] = ((p >> 15) ) * (1.0F / 1.0F); + } + } + else { + const GLushort *ussrc = (const GLushort *) src; + GLuint i; + for (i = 0; i < n; i ++) { + GLushort p = ussrc[i]; + rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F); + rgba[i][gComp] = ((p >> 5) & 0x1f) * (1.0F / 31.0F); + rgba[i][bComp] = ((p >> 10) & 0x1f) * (1.0F / 31.0F); + rgba[i][aComp] = ((p >> 15) ) * (1.0F / 1.0F); + } + } + 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][rComp] = UBYTE_TO_FLOAT((p ) & 0xff); + rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); + rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); + rgba[i][aComp] = UBYTE_TO_FLOAT((p >> 24) ); + } + } + else { + const GLuint *uisrc = (const GLuint *) src; + GLuint i; + for (i = 0; i < n; i ++) { + GLuint p = uisrc[i]; + rgba[i][rComp] = UBYTE_TO_FLOAT((p >> 24) ); + rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); + rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); + rgba[i][aComp] = UBYTE_TO_FLOAT((p ) & 0xff); + } + } + 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][rComp] = UBYTE_TO_FLOAT((p >> 24) ); + rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); + rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); + rgba[i][aComp] = UBYTE_TO_FLOAT((p ) & 0xff); + } + } + else { + const GLuint *uisrc = (const GLuint *) src; + GLuint i; + for (i = 0; i < n; i ++) { + GLuint p = uisrc[i]; + rgba[i][rComp] = UBYTE_TO_FLOAT((p ) & 0xff); + rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); + rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); + rgba[i][aComp] = UBYTE_TO_FLOAT((p >> 24) ); + } + } + 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][rComp] = ((p >> 22) ) * (1.0F / 1023.0F); + rgba[i][gComp] = ((p >> 12) & 0x3ff) * (1.0F / 1023.0F); + rgba[i][bComp] = ((p >> 2) & 0x3ff) * (1.0F / 1023.0F); + rgba[i][aComp] = ((p ) & 0x3 ) * (1.0F / 3.0F); + } + } + else { + const GLuint *uisrc = (const GLuint *) src; + GLuint i; + for (i = 0; i < n; i ++) { + GLuint p = uisrc[i]; + rgba[i][rComp] = ((p >> 22) ) * (1.0F / 1023.0F); + rgba[i][gComp] = ((p >> 12) & 0x3ff) * (1.0F / 1023.0F); + rgba[i][bComp] = ((p >> 2) & 0x3ff) * (1.0F / 1023.0F); + rgba[i][aComp] = ((p ) & 0x3 ) * (1.0F / 3.0F); + } + } + 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][rComp] = ((p ) & 0x3ff) * (1.0F / 1023.0F); + rgba[i][gComp] = ((p >> 10) & 0x3ff) * (1.0F / 1023.0F); + rgba[i][bComp] = ((p >> 20) & 0x3ff) * (1.0F / 1023.0F); + rgba[i][aComp] = ((p >> 30) ) * (1.0F / 3.0F); + } + } + else { + const GLuint *uisrc = (const GLuint *) src; + GLuint i; + for (i = 0; i < n; i ++) { + GLuint p = uisrc[i]; + rgba[i][rComp] = ((p ) & 0x3ff) * (1.0F / 1023.0F); + rgba[i][gComp] = ((p >> 10) & 0x3ff) * (1.0F / 1023.0F); + rgba[i][bComp] = ((p >> 20) & 0x3ff) * (1.0F / 1023.0F); + rgba[i][aComp] = ((p >> 30) ) * (1.0F / 3.0F); + } + } + break; + default: + _mesa_problem(NULL, "bad srcType in extract float data"); + break; + } +} + + +/* + * 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( GLcontext *ctx, + GLuint n, GLenum dstFormat, GLchan dest[], + GLenum srcFormat, GLenum srcType, + const GLvoid *source, + const struct gl_pixelstore_attrib *srcPacking, + GLuint transferOps ) +{ + ASSERT(dstFormat == GL_ALPHA || + dstFormat == GL_LUMINANCE || + dstFormat == GL_LUMINANCE_ALPHA || + dstFormat == GL_INTENSITY || + 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_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 dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; + GLint dstLuminanceIndex, dstIntensityIndex; + DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(rgba, return); /* mac 32k limitation */ + + 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 + */ + assert(n <= MAX_WIDTH); + if (srcFormat == GL_COLOR_INDEX) { + GLuint indexes[MAX_WIDTH]; + extract_uint_indexes(n, indexes, srcFormat, srcType, source, + srcPacking); + + if (dstFormat == GL_COLOR_INDEX + && (transferOps & IMAGE_MAP_COLOR_BIT)) { + _mesa_map_ci(ctx, n, indexes); + } + if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { + _mesa_shift_and_offset_ci(ctx, n, indexes); + } + + if (dstFormat == GL_COLOR_INDEX) { + /* convert to GLchan and return */ + GLuint i; + for (i = 0; i < n; i++) { + dest[i] = (GLchan) (indexes[i] & 0xff); + } + UNDEFARRAY(rgba); /* mac 32k limitation */ + return; + } + else { + /* Convert indexes to RGBA */ + _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); + } + 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); + } + + /* Now determine which color channels we need to produce. + * And determine the dest index (offset) within each color tuple. + */ + switch (dstFormat) { + case GL_ALPHA: + dstAlphaIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = -1; + dstLuminanceIndex = dstIntensityIndex = -1; + break; + case GL_LUMINANCE: + dstLuminanceIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; + dstIntensityIndex = -1; + break; + case GL_LUMINANCE_ALPHA: + dstLuminanceIndex = 0; + dstAlphaIndex = 1; + dstRedIndex = dstGreenIndex = dstBlueIndex = -1; + dstIntensityIndex = -1; + break; + case GL_INTENSITY: + dstIntensityIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; + dstLuminanceIndex = -1; + break; + case GL_RGB: + dstRedIndex = 0; + dstGreenIndex = 1; + dstBlueIndex = 2; + dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1; + break; + case GL_RGBA: + dstRedIndex = 0; + dstGreenIndex = 1; + dstBlueIndex = 2; + dstAlphaIndex = 3; + dstLuminanceIndex = dstIntensityIndex = -1; + break; + default: + _mesa_problem(ctx, "bad dstFormat in _mesa_unpack_chan_span()"); + UNDEFARRAY(rgba); /* mac 32k limitation */ + return; + } + + + /* Now return the GLchan data in the requested dstFormat */ + + if (dstRedIndex >= 0) { + GLchan *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + CLAMPED_FLOAT_TO_CHAN(dst[dstRedIndex], rgba[i][RCOMP]); + dst += dstComponents; + } + } + + if (dstGreenIndex >= 0) { + GLchan *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + CLAMPED_FLOAT_TO_CHAN(dst[dstGreenIndex], rgba[i][GCOMP]); + dst += dstComponents; + } + } + + if (dstBlueIndex >= 0) { + GLchan *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + CLAMPED_FLOAT_TO_CHAN(dst[dstBlueIndex], rgba[i][BCOMP]); + dst += dstComponents; + } + } + + if (dstAlphaIndex >= 0) { + GLchan *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + CLAMPED_FLOAT_TO_CHAN(dst[dstAlphaIndex], rgba[i][ACOMP]); + dst += dstComponents; + } + } + + if (dstIntensityIndex >= 0) { + GLchan *dst = dest; + GLuint i; + assert(dstIntensityIndex == 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 (dstLuminanceIndex >= 0) { + GLchan *dst = dest; + GLuint i; + assert(dstLuminanceIndex == 0); + for (i = 0; i < n; i++) { + /* Luminance comes from red channel */ + CLAMPED_FLOAT_TO_CHAN(dst[0], rgba[i][RCOMP]); + dst += dstComponents; + } + } + UNDEFARRAY(rgba); /* mac 32k limitation */ + } +} + + +/** + * Same as _mesa_unpack_color_span_chan(), but return GLfloat data + * instead of GLchan. + */ +void +_mesa_unpack_color_span_float( GLcontext *ctx, + GLuint n, GLenum dstFormat, GLfloat dest[], + GLenum srcFormat, GLenum srcType, + const GLvoid *source, + const struct gl_pixelstore_attrib *srcPacking, + GLuint transferOps ) +{ + ASSERT(dstFormat == GL_ALPHA || + dstFormat == GL_LUMINANCE || + dstFormat == GL_LUMINANCE_ALPHA || + dstFormat == GL_INTENSITY || + 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_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); + + /* general solution, no special cases, yet */ + { + GLint dstComponents; + GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; + GLint dstLuminanceIndex, dstIntensityIndex; + DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(rgba, return); /* mac 32k limitation */ + + 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 + */ + assert(n <= MAX_WIDTH); + if (srcFormat == GL_COLOR_INDEX) { + GLuint indexes[MAX_WIDTH]; + extract_uint_indexes(n, indexes, srcFormat, srcType, source, + srcPacking); + + if (dstFormat == GL_COLOR_INDEX + && (transferOps & IMAGE_MAP_COLOR_BIT)) { + _mesa_map_ci(ctx, n, indexes); + } + if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { + _mesa_shift_and_offset_ci(ctx, n, indexes); + } + + if (dstFormat == GL_COLOR_INDEX) { + /* convert to GLchan and return */ + GLuint i; + for (i = 0; i < n; i++) { + dest[i] = (GLchan) (indexes[i] & 0xff); + } + UNDEFARRAY(rgba); /* mac 32k limitation */ + return; + } + else { + /* Convert indexes to RGBA */ + _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); + } + 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); + } + + /* Now determine which color channels we need to produce. + * And determine the dest index (offset) within each color tuple. + */ + switch (dstFormat) { + case GL_ALPHA: + dstAlphaIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = -1; + dstLuminanceIndex = dstIntensityIndex = -1; + break; + case GL_LUMINANCE: + dstLuminanceIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; + dstIntensityIndex = -1; + break; + case GL_LUMINANCE_ALPHA: + dstLuminanceIndex = 0; + dstAlphaIndex = 1; + dstRedIndex = dstGreenIndex = dstBlueIndex = -1; + dstIntensityIndex = -1; + break; + case GL_INTENSITY: + dstIntensityIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; + dstLuminanceIndex = -1; + break; + case GL_RGB: + dstRedIndex = 0; + dstGreenIndex = 1; + dstBlueIndex = 2; + dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1; + break; + case GL_RGBA: + dstRedIndex = 0; + dstGreenIndex = 1; + dstBlueIndex = 2; + dstAlphaIndex = 3; + dstLuminanceIndex = dstIntensityIndex = -1; + break; + default: + _mesa_problem(ctx, "bad dstFormat in _mesa_unpack_color_span_float()"); + UNDEFARRAY(rgba); /* mac 32k limitation */ + return; + } + + /* Now pack results in the requested dstFormat */ + if (dstRedIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstRedIndex] = rgba[i][RCOMP]; + dst += dstComponents; + } + } + + if (dstGreenIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstGreenIndex] = rgba[i][GCOMP]; + dst += dstComponents; + } + } + + if (dstBlueIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstBlueIndex] = rgba[i][BCOMP]; + dst += dstComponents; + } + } + + if (dstAlphaIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstAlphaIndex] = rgba[i][ACOMP]; + dst += dstComponents; + } + } + + if (dstIntensityIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + assert(dstIntensityIndex == 0); + assert(dstComponents == 1); + for (i = 0; i < n; i++) { + /* Intensity comes from red channel */ + dst[i] = rgba[i][RCOMP]; + } + } + + if (dstLuminanceIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + assert(dstLuminanceIndex == 0); + for (i = 0; i < n; i++) { + /* Luminance comes from red channel */ + dst[0] = rgba[i][RCOMP]; + dst += dstComponents; + } + } + UNDEFARRAY(rgba); /* mac 32k limitation */ + } +} + + +/* + * 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( const GLcontext *ctx, GLuint n, + GLenum dstType, GLvoid *dest, + GLenum srcType, const GLvoid *source, + const struct gl_pixelstore_attrib *srcPacking, + GLuint 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[MAX_WIDTH]; + assert(n <= MAX_WIDTH); + + extract_uint_indexes(n, indexes, GL_COLOR_INDEX, srcType, source, + srcPacking); + + if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { + /* shift and offset indexes */ + _mesa_shift_and_offset_ci(ctx, n, indexes); + } + if (transferOps & IMAGE_MAP_COLOR_BIT) { + /* Apply lookup table */ + _mesa_map_ci(ctx, 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"); + } + } +} + + +void +_mesa_pack_index_span( const GLcontext *ctx, GLuint n, + GLenum dstType, GLvoid *dest, const GLuint *source, + const struct gl_pixelstore_attrib *dstPacking, + GLuint transferOps ) +{ + GLuint indexes[MAX_WIDTH]; + + ASSERT(n <= MAX_WIDTH); + + 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)); + if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { + _mesa_shift_and_offset_ci( ctx, n, indexes); + } + if (transferOps & IMAGE_MAP_COLOR_BIT) { + _mesa_map_ci(ctx, 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"); + } +} + + +/* + * 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( const GLcontext *ctx, GLuint n, + GLenum dstType, GLvoid *dest, + GLenum srcType, const GLvoid *source, + const struct gl_pixelstore_attrib *srcPacking, + GLuint 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); + + /* only shift and offset apply to stencil */ + transferOps &= 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[MAX_WIDTH]; + assert(n <= MAX_WIDTH); + + extract_uint_indexes(n, indexes, GL_COLOR_INDEX, srcType, source, + srcPacking); + + if (transferOps) { + 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 */ + GLuint mask = ctx->Pixel.MapStoSsize - 1; + GLuint i; + for (i=0;iPixel.MapStoS[ 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"); + } + } +} + + +void +_mesa_pack_stencil_span( const GLcontext *ctx, GLuint n, + GLenum dstType, GLvoid *dest, const GLstencil *source, + const struct gl_pixelstore_attrib *dstPacking ) +{ + GLstencil stencil[MAX_WIDTH]; + + ASSERT(n <= MAX_WIDTH); + + if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset || + ctx->Pixel.MapStencilFlag) { + /* make a copy of input */ + MEMCPY(stencil, source, n * sizeof(GLstencil)); + if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { + _mesa_shift_and_offset_stencil( ctx, n, stencil ); + } + if (ctx->Pixel.MapStencilFlag) { + _mesa_map_stencil( ctx, n, stencil ); + } + source = stencil; + } + + switch (dstType) { + case GL_UNSIGNED_BYTE: + if (sizeof(GLstencil) == 8) { + MEMCPY( dest, source, n ); + } + else { + GLubyte *dst = (GLubyte *) dest; + GLuint i; + for (i=0;iSwapBytes) { + _mesa_swap2( (GLushort *) dst, n ); + } + } + break; + case GL_SHORT: + { + GLshort *dst = (GLshort *) dest; + GLuint i; + for (i=0;iSwapBytes) { + _mesa_swap2( (GLushort *) dst, n ); + } + } + break; + case GL_UNSIGNED_INT: + { + GLuint *dst = (GLuint *) dest; + GLuint i; + for (i=0;iSwapBytes) { + _mesa_swap4( (GLuint *) dst, n ); + } + } + break; + case GL_INT: + { + GLint *dst = (GLint *) dest; + GLuint i; + for (i=0;iSwapBytes) { + _mesa_swap4( (GLuint *) dst, n ); + } + } + break; + case GL_FLOAT: + { + GLfloat *dst = (GLfloat *) dest; + GLuint i; + for (i=0;iSwapBytes) { + _mesa_swap4( (GLuint *) dst, n ); + } + } + break; + case GL_HALF_FLOAT_ARB: + { + GLhalfARB *dst = (GLhalfARB *) dest; + GLuint i; + for (i=0;iSwapBytes) { + _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"); + } +} + + +void +_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest, + GLenum srcType, const GLvoid *source, + const struct gl_pixelstore_attrib *srcPacking ) +{ + (void) srcPacking; + + switch (srcType) { + case GL_BYTE: + { + GLuint i; + const GLubyte *src = (const GLubyte *) source; + for (i = 0; i < n; i++) { + dest[i] = BYTE_TO_FLOAT(src[i]); + } + } + break; + case GL_UNSIGNED_BYTE: + { + GLuint i; + const GLubyte *src = (const GLubyte *) source; + for (i = 0; i < n; i++) { + dest[i] = UBYTE_TO_FLOAT(src[i]); + } + } + break; + case GL_SHORT: + { + GLuint i; + const GLshort *src = (const GLshort *) source; + for (i = 0; i < n; i++) { + dest[i] = SHORT_TO_FLOAT(src[i]); + } + } + break; + case GL_UNSIGNED_SHORT: + { + GLuint i; + const GLushort *src = (const GLushort *) source; + for (i = 0; i < n; i++) { + dest[i] = USHORT_TO_FLOAT(src[i]); + } + } + break; + case GL_INT: + { + GLuint i; + const GLint *src = (const GLint *) source; + for (i = 0; i < n; i++) { + dest[i] = INT_TO_FLOAT(src[i]); + } + } + break; + case GL_UNSIGNED_INT: + { + GLuint i; + const GLuint *src = (const GLuint *) source; + for (i = 0; i < n; i++) { + dest[i] = UINT_TO_FLOAT(src[i]); + } + } + break; + case GL_FLOAT: + MEMCPY(dest, source, n * sizeof(GLfloat)); + break; + case GL_HALF_FLOAT_ARB: + { + GLuint i; + const GLhalfARB *src = (const GLhalfARB *) source; + for (i = 0; i < n; i++) { + dest[i] = _mesa_half_to_float(src[i]); + } + } + break; + default: + _mesa_problem(NULL, "bad type in _mesa_unpack_depth_span()"); + return; + } + + + /* apply depth scale and bias and clamp to [0,1] */ + if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) { + GLuint i; + for (i = 0; i < n; i++) { + GLfloat d = dest[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias; + dest[i] = CLAMP(d, 0.0F, 1.0F); + } + } +} + + +/* + * Pack an array of depth values. The values are floats in [0,1]. + */ +void +_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest, + GLenum dstType, const GLfloat *depthSpan, + const struct gl_pixelstore_attrib *dstPacking ) +{ + GLfloat depthCopy[MAX_WIDTH]; + const GLboolean bias_or_scale = ctx->Pixel.DepthBias != 0.0 || + ctx->Pixel.DepthScale != 1.0; + + ASSERT(n <= MAX_WIDTH); + + if (bias_or_scale) { + GLuint i; + for (i = 0; i < n; i++) { + GLfloat d; + d = depthSpan[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias; + depthCopy[i] = CLAMP(d, 0.0F, 1.0F); + } + 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++) { + dst[i] = FLOAT_TO_USHORT( 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"); + } +} + + +/** + * 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 (format == 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); + const GLint components = _mesa_components_in_format(format); + GLint bytesPerComp; + 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); + 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; + } +} + +#endif + + +/** + * Perform clipping for glDrawPixels. The image's window position + * and size, and the unpack skipPixels and skipRows are adjusted so + * that the image region is entirely within the window and scissor bounds. + * NOTE: this will only work when glPixelZoom is (1, 1). + * + * \return GL_TRUE if image is ready for drawing or + * GL_FALSE if image was completely clipped away (draw nothing) + */ +GLboolean +_mesa_clip_drawpixels(const GLcontext *ctx, + GLint *destX, GLint *destY, + GLsizei *width, GLsizei *height, + GLint *skipPixels, GLint *skipRows) +{ + const GLframebuffer *buffer = ctx->DrawBuffer; + + ASSERT(ctx->Pixel.ZoomX == 1.0F && ctx->Pixel.ZoomY == 1.0F); + + /* left clipping */ + if (*destX < buffer->_Xmin) { + *skipPixels += (buffer->_Xmin - *destX); + *width -= (buffer->_Xmin - *destX); + *destX = buffer->_Xmin; + } + /* right clipping */ + if (*destX + *width > buffer->_Xmax) + *width -= (*destX + *width - buffer->_Xmax); + + if (*width <= 0) + return GL_FALSE; + + /* bottom clipping */ + if (*destY < buffer->_Ymin) { + *skipRows += (buffer->_Ymin - *destY); + *height -= (buffer->_Ymin - *destY); + *destY = buffer->_Ymin; + } + /* top clipping */ + if (*destY + *height > buffer->_Ymax) + *height -= (*destY + *height - buffer->_Ymax); + + if (*height <= 0) + return GL_TRUE; + + return GL_TRUE; +} + + +/** + * Perform clipping for glReadPixels. The image's window position + * and size, and the pack skipPixels and skipRows are adjusted so + * that the image region is entirely within the window bounds. + * Note: this is different from _mesa_clip_drawpixels() in that the + * scissor box is ignored, and we use the bounds of the current "read" + * surface; + * + * \return GL_TRUE if image is ready for drawing or + * GL_FALSE if image was completely clipped away (draw nothing) + */ +GLboolean +_mesa_clip_readpixels(const GLcontext *ctx, + GLint *srcX, GLint *srcY, + GLsizei *width, GLsizei *height, + GLint *skipPixels, GLint *skipRows) +{ + const GLframebuffer *buffer = ctx->ReadBuffer; + + /* left clipping */ + if (*srcX < 0) { + *skipPixels += (0 - *srcX); + *width -= (0 - *srcX); + *srcX = 0; + } + /* right clipping */ + if (*srcX + *width > (GLsizei) buffer->Width) + *width -= (*srcX + *width - buffer->Width); + + if (*width <= 0) + return GL_FALSE; + + /* bottom clipping */ + if (*srcY < 0) { + *skipRows += (0 - *srcY); + *height -= (0 - *srcY); + *srcY = 0; + } + /* top clipping */ + if (*srcY + *height > (GLsizei) buffer->Height) + *height -= (*srcY + *height - buffer->Height); + + if (*height <= 0) + return GL_TRUE; + + return GL_TRUE; +} + diff --git a/reactos/dll/mesa32/src/main/image.h b/reactos/dll/mesa32/src/main/image.h new file mode 100644 index 00000000000..6b76fd8af06 --- /dev/null +++ b/reactos/dll/mesa32/src/main/image.h @@ -0,0 +1,217 @@ +/** + * \file image.h + * Image handling. + */ + +/* + * 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. + */ + + +#ifndef IMAGE_H +#define IMAGE_H + + +#include "mtypes.h" + + +extern void +_mesa_swap2( GLushort *p, GLuint n ); + +extern void +_mesa_swap4( GLuint *p, GLuint n ); + +extern GLint +_mesa_sizeof_type( GLenum type ); + +extern GLint +_mesa_sizeof_packed_type( GLenum type ); + +extern GLint +_mesa_components_in_format( GLenum format ); + +extern GLint +_mesa_bytes_per_pixel( GLenum format, GLenum type ); + +extern GLboolean +_mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type ); + + +extern GLvoid * +_mesa_image_address( GLuint dimensions, + const struct gl_pixelstore_attrib *packing, + const GLvoid *image, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLint img, GLint row, GLint column ); + +extern GLvoid * +_mesa_image_address1d( const struct gl_pixelstore_attrib *packing, + const GLvoid *image, + GLsizei width, + GLenum format, GLenum type, + GLint column ); + +extern GLvoid * +_mesa_image_address2d( const struct gl_pixelstore_attrib *packing, + const GLvoid *image, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLint row, GLint column ); + +extern GLvoid * +_mesa_image_address3d( const struct gl_pixelstore_attrib *packing, + const GLvoid *image, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLint img, GLint row, GLint column ); + + +extern GLint +_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, + GLint width, GLenum format, GLenum type ); + + +extern GLint +_mesa_image_image_stride( const struct gl_pixelstore_attrib *packing, + GLint width, GLint height, + GLenum format, GLenum type ); + +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_apply_rgba_transfer_ops(GLcontext *ctx, GLuint transferOps, + GLuint n, GLfloat rgba[][4]); + +extern void +_mesa_pack_rgba_span_float( GLcontext *ctx, + GLuint n, CONST GLfloat rgba[][4], + GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, + const struct gl_pixelstore_attrib *dstPacking, + GLuint transferOps ); + + +extern void +_mesa_pack_rgba_span_chan( GLcontext *ctx, + GLuint n, CONST GLchan rgba[][4], + GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, + const struct gl_pixelstore_attrib *dstPacking, + GLuint transferOps ); + + +extern void +_mesa_unpack_color_span_chan( GLcontext *ctx, + GLuint n, GLenum dstFormat, GLchan dest[], + GLenum srcFormat, GLenum srcType, + const GLvoid *source, + const struct gl_pixelstore_attrib *srcPacking, + GLuint transferOps ); + + +extern void +_mesa_unpack_color_span_float( GLcontext *ctx, + GLuint n, GLenum dstFormat, GLfloat dest[], + GLenum srcFormat, GLenum srcType, + const GLvoid *source, + const struct gl_pixelstore_attrib *srcPacking, + GLuint transferOps ); + + +extern void +_mesa_unpack_index_span( const GLcontext *ctx, GLuint n, + GLenum dstType, GLvoid *dest, + GLenum srcType, const GLvoid *source, + const struct gl_pixelstore_attrib *srcPacking, + GLuint transferOps ); + + +extern void +_mesa_pack_index_span( const GLcontext *ctx, GLuint n, + GLenum dstType, GLvoid *dest, const GLuint *source, + const struct gl_pixelstore_attrib *dstPacking, + GLuint transferOps ); + + +extern void +_mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, + GLenum dstType, GLvoid *dest, + GLenum srcType, const GLvoid *source, + const struct gl_pixelstore_attrib *srcPacking, + GLuint transferOps ); + +extern void +_mesa_pack_stencil_span( const GLcontext *ctx, GLuint n, + GLenum dstType, GLvoid *dest, const GLstencil *source, + const struct gl_pixelstore_attrib *dstPacking ); + + +extern void +_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest, + GLenum srcType, const GLvoid *source, + const struct gl_pixelstore_attrib *srcPacking ); + +extern void +_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest, + GLenum dstType, const GLfloat *depthSpan, + 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 ); + + +extern GLboolean +_mesa_clip_drawpixels(const GLcontext *ctx, + GLint *destX, GLint *destY, + GLsizei *width, GLsizei *height, + GLint *skipPixels, GLint *skipRows); + + +extern GLboolean +_mesa_clip_readpixels(const GLcontext *ctx, + GLint *destX, GLint *destY, + GLsizei *width, GLsizei *height, + GLint *skipPixels, GLint *skipRows); + + +#endif diff --git a/reactos/dll/mesa32/src/main/imports.c b/reactos/dll/mesa32/src/main/imports.c new file mode 100644 index 00000000000..fec0d338448 --- /dev/null +++ b/reactos/dll/mesa32/src/main/imports.c @@ -0,0 +1,1200 @@ +/** + * \file imports.c + * Standard C library function wrappers. + * + * Imports are services which the device driver or window system or + * operating system provides to the core renderer. The core renderer (Mesa) + * will call these functions in order to do memory allocation, simple I/O, + * etc. + * + * Some drivers will want to override/replace this file with something + * specialized, but that'll be rare. + * + * Eventually, I want to move roll the glheader.h file into this. + * + * The OpenGL SI's __GLimports structure allows per-context specification of + * replacements for the standard C lib functions. In practice that's probably + * never needed; compile-time replacements are far more likely. + * + * The _mesa_*() functions defined here don't in general take a context + * parameter. I guess we can change that someday, if need be. + * So for now, the __GLimports stuff really isn't used. + * + * \todo Functions still needed: + * - scanf + * - qsort + * - bsearch + * - rand and RAND_MAX + * + * \note When compiled into a XFree86 module these functions wrap around + * XFree86 own wrappers. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + + +#include "imports.h" +#include "context.h" +#include "version.h" + + +#define MAXSTRING 4000 /* for vsnprintf() */ + +#ifdef WIN32 +#define vsnprintf _vsnprintf +#elif defined(__IBMC__) || defined(__IBMCPP__) || ( defined(__VMS) && __CRTL_VER < 70312000 ) +extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg); +#ifdef __VMS +#include "vsnprintf.c" +#endif +#endif + + +/**********************************************************************/ +/** \name Memory */ +/*@{*/ + +/** Wrapper around either malloc() or xf86malloc() */ +void * +_mesa_malloc(size_t bytes) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86malloc(bytes); +#else + return malloc(bytes); +#endif +} + +/** Wrapper around either calloc() or xf86calloc() */ +void * +_mesa_calloc(size_t bytes) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86calloc(1, bytes); +#else + return calloc(1, bytes); +#endif +} + +/** Wrapper around either free() or xf86free() */ +void +_mesa_free(void *ptr) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + xf86free(ptr); +#else + free(ptr); +#endif +} + +/** + * Allocate aligned memory. + * + * \param bytes number of bytes to allocate. + * \param alignment alignment (must be greater than zero). + * + * Allocates extra memory to accommodate rounding up the address for + * alignment and to record the real malloc address. + * + * \sa _mesa_align_free(). + */ +void * +_mesa_align_malloc(size_t bytes, unsigned long alignment) +{ + uintptr_t ptr, buf; + + ASSERT( alignment > 0 ); + + ptr = (uintptr_t) _mesa_malloc(bytes + alignment + sizeof(void *)); + if (!ptr) + return NULL; + + buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1); + *(uintptr_t *)(buf - sizeof(void *)) = ptr; + +#ifdef DEBUG + /* mark the non-aligned area */ + while ( ptr < buf - sizeof(void *) ) { + *(unsigned long *)ptr = 0xcdcdcdcd; + ptr += sizeof(unsigned long); + } +#endif + + return (void *) buf; +} + +/** + * Same as _mesa_align_malloc(), but using _mesa_calloc() instead of + * _mesa_malloc() + */ +void * +_mesa_align_calloc(size_t bytes, unsigned long alignment) +{ + uintptr_t ptr, buf; + + ASSERT( alignment > 0 ); + + ptr = (uintptr_t) _mesa_calloc(bytes + alignment + sizeof(void *)); + if (!ptr) + return NULL; + + buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1); + *(uintptr_t *)(buf - sizeof(void *)) = ptr; + +#ifdef DEBUG + /* mark the non-aligned area */ + while ( ptr < buf - sizeof(void *) ) { + *(unsigned long *)ptr = 0xcdcdcdcd; + ptr += sizeof(unsigned long); + } +#endif + + return (void *)buf; +} + +/** + * Free memory which was allocated with either _mesa_align_malloc() + * or _mesa_align_calloc(). + * \param ptr pointer to the memory to be freed. + * The actual address to free is stored in the word immediately before the + * address the client sees. + */ +void +_mesa_align_free(void *ptr) +{ +#if 0 + _mesa_free( (void *)(*(unsigned long *)((unsigned long)ptr - sizeof(void *))) ); +#else + void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); + void *realAddr = *cubbyHole; + _mesa_free(realAddr); +#endif +} + +/** Reallocate memory */ +void * +_mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize) +{ + const size_t copySize = (oldSize < newSize) ? oldSize : newSize; + void *newBuffer = _mesa_malloc(newSize); + if (newBuffer && oldBuffer && copySize > 0) + _mesa_memcpy(newBuffer, oldBuffer, copySize); + if (oldBuffer) + _mesa_free(oldBuffer); + return newBuffer; +} + +/** memcpy wrapper */ +void * +_mesa_memcpy(void *dest, const void *src, size_t n) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86memcpy(dest, src, n); +#elif defined(SUNOS4) + return memcpy((char *) dest, (char *) src, (int) n); +#else + return memcpy(dest, src, n); +#endif +} + +/** Wrapper around either memset() or xf86memset() */ +void +_mesa_memset( void *dst, int val, size_t n ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + xf86memset( dst, val, n ); +#elif defined(SUNOS4) + memset( (char *) dst, (int) val, (int) n ); +#else + memset(dst, val, n); +#endif +} + +/** + * Fill memory with a constant 16bit word. + * \param dst destination pointer. + * \param val value. + * \param n number of words. + */ +void +_mesa_memset16( unsigned short *dst, unsigned short val, size_t n ) +{ + while (n-- > 0) + *dst++ = val; +} + +/** Wrapper around either memcpy() or xf86memcpy() or bzero() */ +void +_mesa_bzero( void *dst, size_t n ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + xf86memset( dst, 0, n ); +#elif defined(__FreeBSD__) + bzero( dst, n ); +#else + memset( dst, 0, n ); +#endif +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Math */ +/*@{*/ + +/** Wrapper around either sin() or xf86sin() */ +double +_mesa_sin(double a) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86sin(a); +#else + return sin(a); +#endif +} + +/** Wrapper around either cos() or xf86cos() */ +double +_mesa_cos(double a) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86cos(a); +#else + return cos(a); +#endif +} + +/** Wrapper around either sqrt() or xf86sqrt() */ +double +_mesa_sqrtd(double x) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86sqrt(x); +#else + return sqrt(x); +#endif +} + + +/* + * A High Speed, Low Precision Square Root + * by Paul Lalonde and Robert Dawson + * from "Graphics Gems", Academic Press, 1990 + * + * SPARC implementation of a fast square root by table + * lookup. + * SPARC floating point format is as follows: + * + * BIT 31 30 23 22 0 + * sign exponent mantissa + */ +static short sqrttab[0x100]; /* declare table of square roots */ + +static void init_sqrt_table(void) +{ +#if defined(USE_IEEE) && !defined(DEBUG) + unsigned short i; + fi_type fi; /* to access the bits of a float in C quickly */ + /* we use a union defined in glheader.h */ + + for(i=0; i<= 0x7f; i++) { + fi.i = 0; + + /* + * Build a float with the bit pattern i as mantissa + * and an exponent of 0, stored as 127 + */ + + fi.i = (i << 16) | (127 << 23); + fi.f = _mesa_sqrtd(fi.f); + + /* + * Take the square root then strip the first 7 bits of + * the mantissa into the table + */ + + sqrttab[i] = (fi.i & 0x7fffff) >> 16; + + /* + * Repeat the process, this time with an exponent of + * 1, stored as 128 + */ + + fi.i = 0; + fi.i = (i << 16) | (128 << 23); + fi.f = sqrt(fi.f); + sqrttab[i+0x80] = (fi.i & 0x7fffff) >> 16; + } +#else + (void) sqrttab; /* silence compiler warnings */ +#endif /*HAVE_FAST_MATH*/ +} + + +/** + * Single precision square root. + */ +float +_mesa_sqrtf( float x ) +{ +#if defined(USE_IEEE) && !defined(DEBUG) + fi_type num; + /* to access the bits of a float in C + * we use a union from glheader.h */ + + short e; /* the exponent */ + if (x == 0.0F) return 0.0F; /* check for square root of 0 */ + num.f = x; + e = (num.i >> 23) - 127; /* get the exponent - on a SPARC the */ + /* exponent is stored with 127 added */ + num.i &= 0x7fffff; /* leave only the mantissa */ + if (e & 0x01) num.i |= 0x800000; + /* the exponent is odd so we have to */ + /* look it up in the second half of */ + /* the lookup table, so we set the */ + /* high bit */ + e >>= 1; /* divide the exponent by two */ + /* note that in C the shift */ + /* operators are sign preserving */ + /* for signed operands */ + /* Do the table lookup, based on the quaternary mantissa, + * then reconstruct the result back into a float + */ + num.i = ((sqrttab[num.i >> 16]) << 16) | ((e + 127) << 23); + + return num.f; +#else + return (float) _mesa_sqrtd((double) x); +#endif +} + + +/** + inv_sqrt - A single precision 1/sqrt routine for IEEE format floats. + written by Josh Vanderhoof, based on newsgroup posts by James Van Buskirk + and Vesa Karvonen. +*/ +float +_mesa_inv_sqrtf(float n) +{ +#if defined(USE_IEEE) && !defined(DEBUG) + float r0, x0, y0; + float r1, x1, y1; + float r2, x2, y2; +#if 0 /* not used, see below -BP */ + float r3, x3, y3; +#endif + union { float f; unsigned int i; } u; + unsigned int magic; + + /* + Exponent part of the magic number - + + We want to: + 1. subtract the bias from the exponent, + 2. negate it + 3. divide by two (rounding towards -inf) + 4. add the bias back + + Which is the same as subtracting the exponent from 381 and dividing + by 2. + + floor(-(x - 127) / 2) + 127 = floor((381 - x) / 2) + */ + + magic = 381 << 23; + + /* + Significand part of magic number - + + With the current magic number, "(magic - u.i) >> 1" will give you: + + for 1 <= u.f <= 2: 1.25 - u.f / 4 + for 2 <= u.f <= 4: 1.00 - u.f / 8 + + This isn't a bad approximation of 1/sqrt. The maximum difference from + 1/sqrt will be around .06. After three Newton-Raphson iterations, the + maximum difference is less than 4.5e-8. (Which is actually close + enough to make the following bias academic...) + + To get a better approximation you can add a bias to the magic + number. For example, if you subtract 1/2 of the maximum difference in + the first approximation (.03), you will get the following function: + + for 1 <= u.f <= 2: 1.22 - u.f / 4 + for 2 <= u.f <= 3.76: 0.97 - u.f / 8 + for 3.76 <= u.f <= 4: 0.72 - u.f / 16 + (The 3.76 to 4 range is where the result is < .5.) + + This is the closest possible initial approximation, but with a maximum + error of 8e-11 after three NR iterations, it is still not perfect. If + you subtract 0.0332281 instead of .03, the maximum error will be + 2.5e-11 after three NR iterations, which should be about as close as + is possible. + + for 1 <= u.f <= 2: 1.2167719 - u.f / 4 + for 2 <= u.f <= 3.73: 0.9667719 - u.f / 8 + for 3.73 <= u.f <= 4: 0.7167719 - u.f / 16 + + */ + + magic -= (int)(0.0332281 * (1 << 25)); + + u.f = n; + u.i = (magic - u.i) >> 1; + + /* + Instead of Newton-Raphson, we use Goldschmidt's algorithm, which + allows more parallelism. From what I understand, the parallelism + comes at the cost of less precision, because it lets error + accumulate across iterations. + */ + x0 = 1.0f; + y0 = 0.5f * n; + r0 = u.f; + + x1 = x0 * r0; + y1 = y0 * r0 * r0; + r1 = 1.5f - y1; + + x2 = x1 * r1; + y2 = y1 * r1 * r1; + r2 = 1.5f - y2; + +#if 1 + return x2 * r2; /* we can stop here, and be conformant -BP */ +#else + x3 = x2 * r2; + y3 = y2 * r2 * r2; + r3 = 1.5f - y3; + + return x3 * r3; +#endif +#elif defined(XFree86LOADER) && defined(IN_MODULE) + return 1.0F / xf86sqrt(n); +#else + return (float) (1.0 / sqrt(n)); +#endif +} + + +/** + * Wrapper around either pow() or xf86pow(). + */ +double +_mesa_pow(double x, double y) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86pow(x, y); +#else + return pow(x, y); +#endif +} + + +/** + * Return number of bits set in given GLuint. + */ +unsigned int +_mesa_bitcount(unsigned int n) +{ + unsigned int bits; + for (bits = 0; n > 0; n = n >> 1) { + bits += (n & 1); + } + return bits; +} + + +/** + * Convert a 4-byte float to a 2-byte half float. + * Based on code from: + * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html + */ +GLhalfARB +_mesa_float_to_half(float val) +{ + const int flt = *((int *) (void *) &val); + const int flt_m = flt & 0x7fffff; + const int flt_e = (flt >> 23) & 0xff; + const int flt_s = (flt >> 31) & 0x1; + int s, e, m = 0; + GLhalfARB result; + + /* sign bit */ + s = flt_s; + + /* handle special cases */ + if ((flt_e == 0) && (flt_m == 0)) { + /* zero */ + /* m = 0; - already set */ + e = 0; + } + else if ((flt_e == 0) && (flt_m != 0)) { + /* denorm -- denorm float maps to 0 half */ + /* m = 0; - already set */ + e = 0; + } + else if ((flt_e == 0xff) && (flt_m == 0)) { + /* infinity */ + /* m = 0; - already set */ + e = 31; + } + else if ((flt_e == 0xff) && (flt_m != 0)) { + /* NaN */ + m = 1; + e = 31; + } + else { + /* regular number */ + const int new_exp = flt_e - 127; + if (new_exp < -24) { + /* this maps to 0 */ + /* m = 0; - already set */ + e = 0; + } + else if (new_exp < -14) { + /* this maps to a denorm */ + unsigned int exp_val = (unsigned int) (-14 - new_exp); /* 2^-exp_val*/ + e = 0; + switch (exp_val) { + case 0: + _mesa_warning(NULL, + "float_to_half: logical error in denorm creation!\n"); + /* m = 0; - already set */ + break; + case 1: m = 512 + (flt_m >> 14); break; + case 2: m = 256 + (flt_m >> 15); break; + case 3: m = 128 + (flt_m >> 16); break; + case 4: m = 64 + (flt_m >> 17); break; + case 5: m = 32 + (flt_m >> 18); break; + case 6: m = 16 + (flt_m >> 19); break; + case 7: m = 8 + (flt_m >> 20); break; + case 8: m = 4 + (flt_m >> 21); break; + case 9: m = 2 + (flt_m >> 22); break; + case 10: m = 1; break; + } + } + else if (new_exp > 15) { + /* map this value to infinity */ + /* m = 0; - already set */ + e = 31; + } + else { + /* regular */ + e = new_exp + 15; + m = flt_m >> 13; + } + } + + result = (s << 15) | (e << 10) | m; + return result; +} + + +/** + * Convert a 2-byte half float to a 4-byte float. + * Based on code from: + * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html + */ +float +_mesa_half_to_float(GLhalfARB val) +{ + /* XXX could also use a 64K-entry lookup table */ + const int m = val & 0x3ff; + const int e = (val >> 10) & 0x1f; + const int s = (val >> 15) & 0x1; + int flt_m, flt_e, flt_s, flt; + float result; + + /* sign bit */ + flt_s = s; + + /* handle special cases */ + if ((e == 0) && (m == 0)) { + /* zero */ + flt_m = 0; + flt_e = 0; + } + else if ((e == 0) && (m != 0)) { + /* denorm -- denorm half will fit in non-denorm single */ + const float half_denorm = 1.0f / 16384.0f; /* 2^-14 */ + float mantissa = ((float) (m)) / 1024.0f; + float sign = s ? -1.0f : 1.0f; + return sign * mantissa * half_denorm; + } + else if ((e == 31) && (m == 0)) { + /* infinity */ + flt_e = 0xff; + flt_m = 0; + } + else if ((e == 31) && (m != 0)) { + /* NaN */ + flt_e = 0xff; + flt_m = 1; + } + else { + /* regular */ + flt_e = e + 112; + flt_m = m << 13; + } + + flt = (flt_s << 31) | (flt_e << 23) | flt_m; + result = *((float *) (void *) &flt); + return result; +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Environment vars */ +/*@{*/ + +/** + * Wrapper for getenv(). + */ +char * +_mesa_getenv( const char *var ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86getenv(var); +#elif defined(_XBOX) + return NULL; +#else + return getenv(var); +#endif +} + +/*@}*/ + + +/**********************************************************************/ +/** \name String */ +/*@{*/ + +/** Wrapper around either strstr() or xf86strstr() */ +char * +_mesa_strstr( const char *haystack, const char *needle ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strstr(haystack, needle); +#else + return strstr(haystack, needle); +#endif +} + +/** Wrapper around either strncat() or xf86strncat() */ +char * +_mesa_strncat( char *dest, const char *src, size_t n ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strncat(dest, src, n); +#else + return strncat(dest, src, n); +#endif +} + +/** Wrapper around either strcpy() or xf86strcpy() */ +char * +_mesa_strcpy( char *dest, const char *src ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strcpy(dest, src); +#else + return strcpy(dest, src); +#endif +} + +/** Wrapper around either strncpy() or xf86strncpy() */ +char * +_mesa_strncpy( char *dest, const char *src, size_t n ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strncpy(dest, src, n); +#else + return strncpy(dest, src, n); +#endif +} + +/** Wrapper around either strlen() or xf86strlen() */ +size_t +_mesa_strlen( const char *s ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strlen(s); +#else + return strlen(s); +#endif +} + +/** Wrapper around either strcmp() or xf86strcmp() */ +int +_mesa_strcmp( const char *s1, const char *s2 ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strcmp(s1, s2); +#else + return strcmp(s1, s2); +#endif +} + +/** Wrapper around either strncmp() or xf86strncmp() */ +int +_mesa_strncmp( const char *s1, const char *s2, size_t n ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strncmp(s1, s2, n); +#else + return strncmp(s1, s2, n); +#endif +} + +/** Implemented using _mesa_malloc() and _mesa_strcpy */ +char * +_mesa_strdup( const char *s ) +{ + size_t l = _mesa_strlen(s); + char *s2 = (char *) _mesa_malloc(l + 1); + if (s2) + _mesa_strcpy(s2, s); + return s2; +} + +/** Wrapper around either atoi() or xf86atoi() */ +int +_mesa_atoi(const char *s) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86atoi(s); +#else + return atoi(s); +#endif +} + +/** Wrapper around either strtod() or xf86strtod() */ +double +_mesa_strtod( const char *s, char **end ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strtod(s, end); +#else + return strtod(s, end); +#endif +} + +/*@}*/ + + +/**********************************************************************/ +/** \name I/O */ +/*@{*/ + +/** Wrapper around either vsprintf() or xf86vsprintf() */ +int +_mesa_sprintf( char *str, const char *fmt, ... ) +{ + int r; + va_list args; + va_start( args, fmt ); + va_end( args ); +#if defined(XFree86LOADER) && defined(IN_MODULE) + r = xf86vsprintf( str, fmt, args ); +#else + r = vsprintf( str, fmt, args ); +#endif + return r; +} + +/** Wrapper around either printf() or xf86printf(), using vsprintf() for + * the formatting. */ +void +_mesa_printf( const char *fmtString, ... ) +{ + char s[MAXSTRING]; + va_list args; + va_start( args, fmtString ); + vsnprintf(s, MAXSTRING, fmtString, args); + va_end( args ); +#if defined(XFree86LOADER) && defined(IN_MODULE) + xf86printf("%s", s); +#else + fprintf(stderr,"%s", s); +#endif +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Diagnostics */ +/*@{*/ + +/** + * Display a warning. + * + * \param ctx GL context. + * \param fmtString printf() alike format string. + * + * If debugging is enabled (either at compile-time via the DEBUG macro, or + * run-time via the MESA_DEBUG environment variable), prints the warning to + * stderr, either via fprintf() or xf86printf(). + */ +void +_mesa_warning( GLcontext *ctx, const char *fmtString, ... ) +{ + GLboolean debug; + char str[MAXSTRING]; + va_list args; + (void) ctx; + va_start( args, fmtString ); + (void) vsnprintf( str, MAXSTRING, fmtString, args ); + va_end( args ); +#ifdef DEBUG + debug = GL_TRUE; /* always print warning */ +#else + debug = _mesa_getenv("MESA_DEBUG") ? GL_TRUE : GL_FALSE; +#endif + if (debug) { +#if defined(XFree86LOADER) && defined(IN_MODULE) + xf86fprintf(stderr, "Mesa warning: %s", str); +#else + fprintf(stderr, "Mesa warning: %s", str); +#endif + } +} + +/** + * This function is called when the Mesa user has stumbled into a code + * path which may not be implemented fully or correctly. + * + * \param ctx GL context. + * \param s problem description string. + * + * Prints the message to stderr, either via fprintf() or xf86fprintf(). + */ +void +_mesa_problem( const GLcontext *ctx, const char *fmtString, ... ) +{ + va_list args; + char str[MAXSTRING]; + (void) ctx; + + va_start( args, fmtString ); + vsnprintf( str, MAXSTRING, fmtString, args ); + va_end( args ); + +#if defined(XFree86LOADER) && defined(IN_MODULE) + xf86fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str); + xf86fprintf(stderr, "Please report at bugzilla.freedesktop.org\n"); +#else + fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str); + fprintf(stderr, "Please report at bugzilla.freedesktop.org\n"); +#endif +} + +/** + * Display an error message. + * + * If in debug mode, print error message. + * Also, record the error code by calling _mesa_record_error(). + * + * \param ctx the GL context. + * \param error the error value. + * \param fmtString printf() style format string, followed by optional args + * + * If debugging is enabled (either at compile-time via the DEBUG macro, or + * run-time via the MESA_DEBUG environment variable), interperts the error code and + * prints the error message via _mesa_debug(). + */ +void +_mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... ) +{ + const char *debugEnv; + GLboolean debug; + + debugEnv = _mesa_getenv("MESA_DEBUG"); + +#ifdef DEBUG + if (debugEnv && _mesa_strstr(debugEnv, "silent")) + debug = GL_FALSE; + else + debug = GL_TRUE; +#else + if (debugEnv) + debug = GL_TRUE; + else + debug = GL_FALSE; +#endif + + if (debug) { + va_list args; + char where[MAXSTRING]; + const char *errstr; + + va_start( args, fmtString ); + vsnprintf( where, MAXSTRING, fmtString, args ); + va_end( args ); + + switch (error) { + case GL_NO_ERROR: + errstr = "GL_NO_ERROR"; + break; + case GL_INVALID_VALUE: + errstr = "GL_INVALID_VALUE"; + break; + case GL_INVALID_ENUM: + errstr = "GL_INVALID_ENUM"; + break; + case GL_INVALID_OPERATION: + errstr = "GL_INVALID_OPERATION"; + break; + case GL_STACK_OVERFLOW: + errstr = "GL_STACK_OVERFLOW"; + break; + case GL_STACK_UNDERFLOW: + errstr = "GL_STACK_UNDERFLOW"; + break; + case GL_OUT_OF_MEMORY: + errstr = "GL_OUT_OF_MEMORY"; + break; + case GL_TABLE_TOO_LARGE: + errstr = "GL_TABLE_TOO_LARGE"; + break; + default: + errstr = "unknown"; + break; + } + _mesa_debug(ctx, "User error: %s in %s\n", errstr, where); + } + + _mesa_record_error(ctx, error); +} + +/** + * Report debug information. + * + * \param ctx GL context. + * \param fmtString printf() alike format string. + * + * Prints the message to stderr, either via fprintf() or xf86printf(). + */ +void +_mesa_debug( const GLcontext *ctx, const char *fmtString, ... ) +{ + char s[MAXSTRING]; + va_list args; + (void) ctx; + va_start(args, fmtString); + vsnprintf(s, MAXSTRING, fmtString, args); + va_end(args); +#if defined(XFree86LOADER) && defined(IN_MODULE) + xf86fprintf(stderr, "Mesa: %s", s); +#else + fprintf(stderr, "Mesa: %s", s); +#endif +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Default Imports Wrapper */ +/*@{*/ + +/** Wrapper around _mesa_malloc() */ +static void * +default_malloc(__GLcontext *gc, size_t size) +{ + (void) gc; + return _mesa_malloc(size); +} + +/** Wrapper around _mesa_malloc() */ +static void * +default_calloc(__GLcontext *gc, size_t numElem, size_t elemSize) +{ + (void) gc; + return _mesa_calloc(numElem * elemSize); +} + +/** Wrapper around either realloc() or xf86realloc() */ +static void * +default_realloc(__GLcontext *gc, void *oldAddr, size_t newSize) +{ + (void) gc; +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86realloc(oldAddr, newSize); +#else + return realloc(oldAddr, newSize); +#endif +} + +/** Wrapper around _mesa_free() */ +static void +default_free(__GLcontext *gc, void *addr) +{ + (void) gc; + _mesa_free(addr); +} + +/** Wrapper around _mesa_getenv() */ +static char * CAPI +default_getenv( __GLcontext *gc, const char *var ) +{ + (void) gc; + return _mesa_getenv(var); +} + +/** Wrapper around _mesa_warning() */ +static void +default_warning(__GLcontext *gc, char *str) +{ + _mesa_warning(gc, str); +} + +/** Wrapper around _mesa_problem() */ +static void +default_fatal(__GLcontext *gc, char *str) +{ + _mesa_problem(gc, str); + abort(); +} + +/** Wrapper around atoi() */ +static int CAPI +default_atoi(__GLcontext *gc, const char *str) +{ + (void) gc; + return atoi(str); +} + +/** Wrapper around vsprintf() */ +static int CAPI +default_sprintf(__GLcontext *gc, char *str, const char *fmt, ...) +{ + int r; + va_list args; + (void) gc; + va_start( args, fmt ); + r = vsprintf( str, fmt, args ); + va_end( args ); + return r; +} + +/** Wrapper around fopen() */ +static void * CAPI +default_fopen(__GLcontext *gc, const char *path, const char *mode) +{ + (void) gc; + return fopen(path, mode); +} + +/** Wrapper around fclose() */ +static int CAPI +default_fclose(__GLcontext *gc, void *stream) +{ + (void) gc; + return fclose((FILE *) stream); +} + +/** Wrapper around vfprintf() */ +static int CAPI +default_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...) +{ + int r; + va_list args; + (void) gc; + va_start( args, fmt ); + r = vfprintf( (FILE *) stream, fmt, args ); + va_end( args ); + return r; +} + +/** + * \todo this really is driver-specific and can't be here + */ +static __GLdrawablePrivate * +default_GetDrawablePrivate(__GLcontext *gc) +{ + (void) gc; + return NULL; +} + +/*@}*/ + + +/** + * Initialize a __GLimports object to point to the functions in this + * file. + * + * This is to be called from device drivers. + * + * Also, do some one-time initializations. + * + * \param imports the object to initialize. + * \param driverCtx pointer to device driver-specific data. + */ +void +_mesa_init_default_imports(__GLimports *imports, void *driverCtx) +{ + /* XXX maybe move this one-time init stuff into context.c */ + static GLboolean initialized = GL_FALSE; + if (!initialized) { + init_sqrt_table(); + +#if defined(_FPU_GETCW) && defined(_FPU_SETCW) + { + const char *debug = _mesa_getenv("MESA_DEBUG"); + if (debug && _mesa_strcmp(debug, "FP")==0) { + /* die on FP exceptions */ + fpu_control_t mask; + _FPU_GETCW(mask); + mask &= ~(_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM + | _FPU_MASK_OM | _FPU_MASK_UM); + _FPU_SETCW(mask); + } + } +#endif + initialized = GL_TRUE; + } + + imports->malloc = default_malloc; + imports->calloc = default_calloc; + imports->realloc = default_realloc; + imports->free = default_free; + imports->warning = default_warning; + imports->fatal = default_fatal; + imports->getenv = default_getenv; /* not used for now */ + imports->atoi = default_atoi; + imports->sprintf = default_sprintf; + imports->fopen = default_fopen; + imports->fclose = default_fclose; + imports->fprintf = default_fprintf; + imports->getDrawablePrivate = default_GetDrawablePrivate; + imports->other = driverCtx; +} diff --git a/reactos/dll/mesa32/src/main/imports.h b/reactos/dll/mesa32/src/main/imports.h new file mode 100644 index 00000000000..2ee66d9ac9b --- /dev/null +++ b/reactos/dll/mesa32/src/main/imports.h @@ -0,0 +1,778 @@ +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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 imports.h + * Standard C library function wrappers. + * + * This file provides wrappers for all the standard C library functions + * like malloc(), free(), printf(), getenv(), etc. + */ + + +#ifndef IMPORTS_H +#define IMPORTS_H + + +/* XXX some of the stuff in glheader.h should be moved into this file. + */ +#include "glheader.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +/**********************************************************************/ +/** \name General macros */ +/*@{*/ + +#ifndef NULL +#define NULL 0 +#endif + +/*@}*/ + + +/**********************************************************************/ +/** Memory macros */ +/*@{*/ + +/** Allocate \p BYTES bytes */ +#define MALLOC(BYTES) _mesa_malloc(BYTES) +/** Allocate and zero \p BYTES bytes */ +#define CALLOC(BYTES) _mesa_calloc(BYTES) +/** Allocate a structure of type \p T */ +#define MALLOC_STRUCT(T) (struct T *) _mesa_malloc(sizeof(struct T)) +/** Allocate and zero a structure of type \p T */ +#define CALLOC_STRUCT(T) (struct T *) _mesa_calloc(sizeof(struct T)) +/** Free memory */ +#define FREE(PTR) _mesa_free(PTR) + +/** Allocate \p BYTES aligned at \p N bytes */ +#define ALIGN_MALLOC(BYTES, N) _mesa_align_malloc(BYTES, N) +/** Allocate and zero \p BYTES bytes aligned at \p N bytes */ +#define ALIGN_CALLOC(BYTES, N) _mesa_align_calloc(BYTES, N) +/** Allocate a structure of type \p T aligned at \p N bytes */ +#define ALIGN_MALLOC_STRUCT(T, N) (struct T *) _mesa_align_malloc(sizeof(struct T), N) +/** Allocate and zero a structure of type \p T aligned at \p N bytes */ +#define ALIGN_CALLOC_STRUCT(T, N) (struct T *) _mesa_align_calloc(sizeof(struct T), N) +/** Free aligned memory */ +#define ALIGN_FREE(PTR) _mesa_align_free(PTR) + +/** Copy \p BYTES bytes from \p SRC into \p DST */ +#define MEMCPY( DST, SRC, BYTES) _mesa_memcpy(DST, SRC, BYTES) +/** Set \p N bytes in \p DST to \p VAL */ +#define MEMSET( DST, VAL, N ) _mesa_memset(DST, VAL, N) + +/*@}*/ + + +/* + * For GL_ARB_vertex_buffer_object we need to treat vertex array pointers + * as offsets into buffer stores. Since the vertex array pointer and + * buffer store pointer are both pointers and we need to add them, we use + * this macro. + * Both pointers/offsets are expressed in bytes. + */ +#define ADD_POINTERS(A, B) ( (GLubyte *) (A) + (uintptr_t) (B) ) + + +/**********************************************************************/ +/** \name [Pseudo] static array declaration. + * + * MACs and BeOS don't support static larger than 32kb, so ... + */ +/*@{*/ + +/** + * \def DEFARRAY + * Define a [static] unidimensional array + */ + +/** + * \def DEFMARRAY + * Define a [static] bi-dimensional array + */ + +/** + * \def DEFMNARRAY + * Define a [static] tri-dimensional array + */ + +/** + * \def CHECKARRAY + * Verifies a [static] array was properly allocated. + */ + +/** + * \def UNDEFARRAY + * Undefine (free) a [static] array. + */ + +#if defined(macintosh) && !defined(__MRC__) +/*extern char *AGLAlloc(int size);*/ +/*extern void AGLFree(char* ptr);*/ +# define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)_mesa_alloc(sizeof(TYPE)*(SIZE)) +# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])_mesa_alloc(sizeof(TYPE)*(SIZE1)*(SIZE2)) +# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE (*NAME)[SIZE2][SIZE3] = (TYPE(*)[SIZE2][SIZE3])_mesa_alloc(sizeof(TYPE)*(SIZE1)*(SIZE2)*(SIZE3)) +# define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0) +# define UNDEFARRAY(NAME) do {if ((NAME)) {_mesa_free((char*)NAME);} }while (0) +#elif defined(__BEOS__) +# define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)_mesa_malloc(sizeof(TYPE)*(SIZE)) +# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])_mesa_malloc(sizeof(TYPE)*(SIZE1)*(SIZE2)) +# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE (*NAME)[SIZE2][SIZE3] = (TYPE(*)[SIZE2][SIZE3])_mesa_malloc(sizeof(TYPE)*(SIZE1)*(SIZE2)*(SIZE3)) +# define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0) +# define UNDEFARRAY(NAME) do {if ((NAME)) {_mesa_free((char*)NAME);} }while (0) +#else +# define DEFARRAY(TYPE,NAME,SIZE) TYPE NAME[SIZE] +# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE NAME[SIZE1][SIZE2] +# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE NAME[SIZE1][SIZE2][SIZE3] +# define CHECKARRAY(NAME,CMD) do {} while(0) +# define UNDEFARRAY(NAME) +#endif + +/*@}*/ + + +/** + * Sometimes we treat GLfloats as GLints. On x86 systems, moving a float + * as a int (thereby using integer registers instead of FP registers) is + * a performance win. Typically, this can be done with ordinary casts. + * But with gcc's -fstrict-aliasing flag (which defaults to on in gcc 3.0) + * these casts generate warnings. + * The following union typedef is used to solve that. + */ +typedef union { GLfloat f; GLint i; } fi_type; + + + +/********************************************************************** + * Math macros + */ + +#define MAX_GLUSHORT 0xffff +#define MAX_GLUINT 0xffffffff + +#ifndef M_PI +#define M_PI (3.1415926536) +#endif + +#ifndef M_E +#define M_E (2.7182818284590452354) +#endif + + +/* XXX this is a bit of a hack needed for compilation within XFree86 */ +#ifndef FLT_MIN +#define FLT_MIN (1.0e-37) +#endif + +/* Degrees to radians conversion: */ +#define DEG2RAD (M_PI/180.0) + + +/*** + *** USE_IEEE: Determine if we're using IEEE floating point + ***/ +#if defined(__i386__) || defined(__386__) || defined(__sparc__) || \ + defined(__s390x__) || defined(__powerpc__) || \ + defined(__amd64__) || \ + defined(ia64) || defined(__ia64__) || \ + defined(__hppa__) || defined(hpux) || \ + defined(__mips) || defined(_MIPS_ARCH) || \ + defined(__arm__) || \ + defined(__sh__) || \ + (defined(__alpha__) && (defined(__IEEE_FLOAT) || !defined(VMS))) +#define USE_IEEE +#define IEEE_ONE 0x3f800000 +#endif + + +/*** + *** SQRTF: single-precision square root + ***/ +#if 0 /* _mesa_sqrtf() not accurate enough - temporarily disabled */ +# define SQRTF(X) _mesa_sqrtf(X) +#elif defined(XFree86LOADER) && defined(IN_MODULE) +# define SQRTF(X) (float) xf86sqrt((float) (X)) +#else +# define SQRTF(X) (float) sqrt((float) (X)) +#endif + + +/*** + *** INV_SQRTF: single-precision inverse square root + ***/ +#if 0 +#define INV_SQRTF(X) _mesa_inv_sqrt(X) +#else +#define INV_SQRTF(X) (1.0F / SQRTF(X)) /* this is faster on a P4 */ +#endif + + +/*** + *** LOG2: Log base 2 of float + ***/ +#ifdef USE_IEEE +#if 0 +/* This is pretty fast, but not accurate enough (only 2 fractional bits). + * Based on code from http://www.stereopsis.com/log2.html + */ +static INLINE GLfloat LOG2(GLfloat x) +{ + const GLfloat y = x * x * x * x; + const GLuint ix = *((GLuint *) &y); + const GLuint exp = (ix >> 23) & 0xFF; + const GLint log2 = ((GLint) exp) - 127; + return (GLfloat) log2 * (1.0 / 4.0); /* 4, because of x^4 above */ +} +#endif +/* Pretty fast, and accurate. + * Based on code from http://www.flipcode.com/totd/ + */ +static INLINE GLfloat LOG2(GLfloat val) +{ + fi_type num; + GLint log_2; + num.f = val; + log_2 = ((num.i >> 23) & 255) - 128; + num.i &= ~(255 << 23); + num.i += 127 << 23; + num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3; + return num.f + log_2; +} +#elif defined(XFree86LOADER) && defined(IN_MODULE) +#define LOG2(x) ((GLfloat) (xf86log(x) * 1.442695)) +#else +/* + * NOTE: log_base_2(x) = log(x) / log(2) + * NOTE: 1.442695 = 1/log(2). + */ +#define LOG2(x) ((GLfloat) (log(x) * 1.442695F)) +#endif + + +/*** + *** IS_INF_OR_NAN: test if float is infinite or NaN + ***/ +#ifdef USE_IEEE +static INLINE int IS_INF_OR_NAN( float x ) +{ + fi_type tmp; + tmp.f = x; + return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31); +} +#elif defined(isfinite) +#define IS_INF_OR_NAN(x) (!isfinite(x)) +#elif defined(finite) +#define IS_INF_OR_NAN(x) (!finite(x)) +#elif defined(__VMS) +#define IS_INF_OR_NAN(x) (!finite(x)) +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define IS_INF_OR_NAN(x) (!isfinite(x)) +#else +#define IS_INF_OR_NAN(x) (!finite(x)) +#endif + + +/*** + *** IS_NEGATIVE: test if float is negative + ***/ +#if defined(USE_IEEE) +static INLINE int GET_FLOAT_BITS( float x ) +{ + fi_type fi; + fi.f = x; + return fi.i; +} +#define IS_NEGATIVE(x) (GET_FLOAT_BITS(x) < 0) +#else +#define IS_NEGATIVE(x) (x < 0.0F) +#endif + + +/*** + *** DIFFERENT_SIGNS: test if two floats have opposite signs + ***/ +#if defined(USE_IEEE) +#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31)) +#else +/* Could just use (x*y<0) except for the flatshading requirements. + * Maybe there's a better way? + */ +#define DIFFERENT_SIGNS(x,y) ((x) * (y) <= 0.0F && (x) - (y) != 0.0F) +#endif + + +/*** + *** CEILF: ceiling of float + *** FLOORF: floor of float + *** FABSF: absolute value of float + *** EXPF: raise e to the value + *** LDEXPF: multiply value by an integral power of two + *** FREXPF: extract mantissa and exponent from value + ***/ +#if defined(XFree86LOADER) && defined(IN_MODULE) +#define CEILF(x) ((GLfloat) xf86ceil(x)) +#define FLOORF(x) ((GLfloat) xf86floor(x)) +#define FABSF(x) ((GLfloat) xf86fabs(x)) +#define EXPF(x) ((GLfloat) xf86exp(x)) +#define LDEXPF(x,y) ((GLfloat) xf86ldexp(x,y)) +#define FREXPF(x,y) ((GLfloat) xf86frexp(x,y)) +#elif defined(__gnu_linux__) +/* C99 functions */ +#define CEILF(x) ceilf(x) +#define FLOORF(x) floorf(x) +#define FABSF(x) fabsf(x) +#define EXPF(x) expf(x) +#define LDEXPF(x,y) ldexpf(x,y) +#define FREXPF(x,y) frexpf(x,y) +#else +#define CEILF(x) ((GLfloat) ceil(x)) +#define FLOORF(x) ((GLfloat) floor(x)) +#define FABSF(x) ((GLfloat) fabs(x)) +#define EXPF(x) ((GLfloat) exp(x)) +#define LDEXPF(x,y) ((GLfloat) ldexp(x,y)) +#define FREXPF(x,y) ((GLfloat) frexp(x,y)) +#endif + + +/*** + *** IROUND: return (as an integer) float rounded to nearest integer + ***/ +#if defined(USE_SPARC_ASM) && defined(__GNUC__) && defined(__sparc__) +static INLINE int iround(float f) +{ + int r; + __asm__ ("fstoi %1, %0" : "=f" (r) : "f" (f)); + return r; +} +#define IROUND(x) iround(x) +#elif defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) && \ + (!defined(__BEOS__) || (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))) +static INLINE int iround(float f) +{ + int r; + __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st"); + return r; +} +#define IROUND(x) iround(x) +#elif defined(USE_X86_ASM) && defined(__MSC__) && defined(__WIN32__) +static INLINE int iround(float f) +{ + int r; + _asm { + fld f + fistp r + } + return r; +} +#define IROUND(x) iround(x) +#elif defined(__WATCOMC__) && defined(__386__) +long iround(float f); +#pragma aux iround = \ + "push eax" \ + "fistp dword ptr [esp]" \ + "pop eax" \ + parm [8087] \ + value [eax] \ + modify exact [eax]; +#define IROUND(x) iround(x) +#else +#define IROUND(f) ((int) (((f) >= 0.0F) ? ((f) + 0.5F) : ((f) - 0.5F))) +#endif + + +/*** + *** IROUND_POS: return (as an integer) positive float rounded to nearest int + ***/ +#ifdef DEBUG +#define IROUND_POS(f) (assert((f) >= 0.0F), IROUND(f)) +#else +#define IROUND_POS(f) (IROUND(f)) +#endif + + +/*** + *** IFLOOR: return (as an integer) floor of float + ***/ +#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) +/* + * IEEE floor for computers that round to nearest or even. + * 'f' must be between -4194304 and 4194303. + * This floor operation is done by "(iround(f + .5) + iround(f - .5)) >> 1", + * but uses some IEEE specific tricks for better speed. + * Contributed by Josh Vanderhoof + */ +static INLINE int ifloor(float f) +{ + int ai, bi; + double af, bf; + af = (3 << 22) + 0.5 + (double)f; + bf = (3 << 22) + 0.5 - (double)f; + /* GCC generates an extra fstp/fld without this. */ + __asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st"); + __asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st"); + return (ai - bi) >> 1; +} +#define IFLOOR(x) ifloor(x) +#elif defined(USE_IEEE) +static INLINE int ifloor(float f) +{ + int ai, bi; + double af, bf; + fi_type u; + + af = (3 << 22) + 0.5 + (double)f; + bf = (3 << 22) + 0.5 - (double)f; + u.f = (float) af; ai = u.i; + u.f = (float) bf; bi = u.i; + return (ai - bi) >> 1; +} +#define IFLOOR(x) ifloor(x) +#else +static INLINE int ifloor(float f) +{ + int i = IROUND(f); + return (i > f) ? i - 1 : i; +} +#define IFLOOR(x) ifloor(x) +#endif + + +/*** + *** ICEIL: return (as an integer) ceiling of float + ***/ +#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) +/* + * IEEE ceil for computers that round to nearest or even. + * 'f' must be between -4194304 and 4194303. + * This ceil operation is done by "(iround(f + .5) + iround(f - .5) + 1) >> 1", + * but uses some IEEE specific tricks for better speed. + * Contributed by Josh Vanderhoof + */ +static INLINE int iceil(float f) +{ + int ai, bi; + double af, bf; + af = (3 << 22) + 0.5 + (double)f; + bf = (3 << 22) + 0.5 - (double)f; + /* GCC generates an extra fstp/fld without this. */ + __asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st"); + __asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st"); + return (ai - bi + 1) >> 1; +} +#define ICEIL(x) iceil(x) +#elif defined(USE_IEEE) +static INLINE int iceil(float f) +{ + int ai, bi; + double af, bf; + fi_type u; + af = (3 << 22) + 0.5 + (double)f; + bf = (3 << 22) + 0.5 - (double)f; + u.f = (float) af; ai = u.i; + u.f = (float) bf; bi = u.i; + return (ai - bi + 1) >> 1; +} +#define ICEIL(x) iceil(x) +#else +static INLINE int iceil(float f) +{ + int i = IROUND(f); + return (i < f) ? i + 1 : i; +} +#define ICEIL(x) iceil(x) +#endif + + +/*** + *** UNCLAMPED_FLOAT_TO_UBYTE: clamp float to [0,1] and map to ubyte in [0,255] + *** CLAMPED_FLOAT_TO_UBYTE: map float known to be in [0,1] to ubyte in [0,255] + ***/ +#if defined(USE_IEEE) && !defined(DEBUG) +#define IEEE_0996 0x3f7f0000 /* 0.996 or so */ +/* This function/macro is sensitive to precision. Test very carefully + * if you change it! + */ +#define UNCLAMPED_FLOAT_TO_UBYTE(UB, F) \ + do { \ + fi_type __tmp; \ + __tmp.f = (F); \ + if (__tmp.i < 0) \ + UB = (GLubyte) 0; \ + else if (__tmp.i >= IEEE_0996) \ + UB = (GLubyte) 255; \ + else { \ + __tmp.f = __tmp.f * (255.0F/256.0F) + 32768.0F; \ + UB = (GLubyte) __tmp.i; \ + } \ + } while (0) +#define CLAMPED_FLOAT_TO_UBYTE(UB, F) \ + do { \ + fi_type __tmp; \ + __tmp.f = (F) * (255.0F/256.0F) + 32768.0F; \ + UB = (GLubyte) __tmp.i; \ + } while (0) +#else +#define UNCLAMPED_FLOAT_TO_UBYTE(ub, f) \ + ub = ((GLubyte) IROUND(CLAMP((f), 0.0F, 1.0F) * 255.0F)) +#define CLAMPED_FLOAT_TO_UBYTE(ub, f) \ + ub = ((GLubyte) IROUND((f) * 255.0F)) +#endif + + +/*** + *** COPY_FLOAT: copy a float from src to dest. + ***/ +#define COPY_FLOAT( dst, src ) (dst) = (src) + + +/*** + *** START_FAST_MATH: Set x86 FPU to faster, 32-bit precision mode (and save + *** original mode to a temporary). + *** END_FAST_MATH: Restore x86 FPU to original mode. + ***/ +#if defined(__GNUC__) && defined(__i386__) +/* + * Set the x86 FPU control word to guarentee only 32 bits of precision + * are stored in registers. Allowing the FPU to store more introduces + * differences between situations where numbers are pulled out of memory + * vs. situations where the compiler is able to optimize register usage. + * + * In the worst case, we force the compiler to use a memory access to + * truncate the float, by specifying the 'volatile' keyword. + */ +/* Hardware default: All exceptions masked, extended double precision, + * round to nearest (IEEE compliant): + */ +#define DEFAULT_X86_FPU 0x037f +/* All exceptions masked, single precision, round to nearest: + */ +#define FAST_X86_FPU 0x003f +/* The fldcw instruction will cause any pending FP exceptions to be + * raised prior to entering the block, and we clear any pending + * exceptions before exiting the block. Hence, asm code has free + * reign over the FPU while in the fast math block. + */ +#if defined(NO_FAST_MATH) +#define START_FAST_MATH(x) \ +do { \ + static GLuint mask = DEFAULT_X86_FPU; \ + __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \ + __asm__ ( "fldcw %0" : : "m" (mask) ); \ +} while (0) +#else +#define START_FAST_MATH(x) \ +do { \ + static GLuint mask = FAST_X86_FPU; \ + __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \ + __asm__ ( "fldcw %0" : : "m" (mask) ); \ +} while (0) +#endif +/* Restore original FPU mode, and clear any exceptions that may have + * occurred in the FAST_MATH block. + */ +#define END_FAST_MATH(x) \ +do { \ + __asm__ ( "fnclex ; fldcw %0" : : "m" (*&(x)) ); \ +} while (0) + +#elif defined(__WATCOMC__) && defined(__386__) +#define DEFAULT_X86_FPU 0x037f /* See GCC comments above */ +#define FAST_X86_FPU 0x003f /* See GCC comments above */ +void _watcom_start_fast_math(unsigned short *x,unsigned short *mask); +#pragma aux _watcom_start_fast_math = \ + "fnstcw word ptr [eax]" \ + "fldcw word ptr [ecx]" \ + parm [eax] [ecx] \ + modify exact []; +void _watcom_end_fast_math(unsigned short *x); +#pragma aux _watcom_end_fast_math = \ + "fnclex" \ + "fldcw word ptr [eax]" \ + parm [eax] \ + modify exact []; +#if defined(NO_FAST_MATH) +#define START_FAST_MATH(x) \ +do { \ + static GLushort mask = DEFAULT_X86_FPU; \ + _watcom_start_fast_math(&x,&mask); \ +} while (0) +#else +#define START_FAST_MATH(x) \ +do { \ + static GLushort mask = FAST_X86_FPU; \ + _watcom_start_fast_math(&x,&mask); \ +} while (0) +#endif +#define END_FAST_MATH(x) _watcom_end_fast_math(&x) +#else +#define START_FAST_MATH(x) x = 0 +#define END_FAST_MATH(x) (void)(x) +#endif + + + +/********************************************************************** + * Functions + */ + +extern void * +_mesa_malloc( size_t bytes ); + +extern void * +_mesa_calloc( size_t bytes ); + +extern void +_mesa_free( void *ptr ); + +extern void * +_mesa_align_malloc( size_t bytes, unsigned long alignment ); + +extern void * +_mesa_align_calloc( size_t bytes, unsigned long alignment ); + +extern void +_mesa_align_free( void *ptr ); + +extern void * +_mesa_exec_malloc( GLuint size ); + +extern void +_mesa_exec_free( void *addr ); + +extern void * +_mesa_realloc( void *oldBuffer, size_t oldSize, size_t newSize ); + +extern void * +_mesa_memcpy( void *dest, const void *src, size_t n ); + +extern void +_mesa_memset( void *dst, int val, size_t n ); + +extern void +_mesa_memset16( unsigned short *dst, unsigned short val, size_t n ); + +extern void +_mesa_bzero( void *dst, size_t n ); + + +extern double +_mesa_sin(double a); + +extern double +_mesa_cos(double a); + +extern double +_mesa_sqrtd(double x); + +extern float +_mesa_sqrtf(float x); + +extern float +_mesa_inv_sqrtf(float x); + +extern double +_mesa_pow(double x, double y); + +extern float +_mesa_log2(float x); + +extern unsigned int +_mesa_bitcount(unsigned int n); + +extern GLhalfARB +_mesa_float_to_half(float f); + +extern float +_mesa_half_to_float(GLhalfARB h); + + +extern char * +_mesa_getenv( const char *var ); + +extern char * +_mesa_strstr( const char *haystack, const char *needle ); + +extern char * +_mesa_strncat( char *dest, const char *src, size_t n ); + +extern char * +_mesa_strcpy( char *dest, const char *src ); + +extern char * +_mesa_strncpy( char *dest, const char *src, size_t n ); + +extern size_t +_mesa_strlen( const char *s ); + +extern int +_mesa_strcmp( const char *s1, const char *s2 ); + +extern int +_mesa_strncmp( const char *s1, const char *s2, size_t n ); + +extern char * +_mesa_strdup( const char *s ); + +extern int +_mesa_atoi( const char *s ); + +extern double +_mesa_strtod( const char *s, char **end ); + +extern int +_mesa_sprintf( char *str, const char *fmt, ... ); + +extern void +_mesa_printf( const char *fmtString, ... ); + + +extern void +_mesa_warning( __GLcontext *gc, const char *fmtString, ... ); + +extern void +_mesa_problem( const __GLcontext *ctx, const char *fmtString, ... ); + +extern void +_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ); + +extern void +_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ); + + +extern void +_mesa_init_default_imports( __GLimports *imports, void *driverCtx ); + + +#ifdef __cplusplus +} +#endif + + +#endif /* IMPORTS_H */ diff --git a/reactos/dll/mesa32/src/main/light.c b/reactos/dll/mesa32/src/main/light.c new file mode 100644 index 00000000000..98934f39820 --- /dev/null +++ b/reactos/dll/mesa32/src/main/light.c @@ -0,0 +1,1313 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +#include "glheader.h" +#include "imports.h" +#include "context.h" +#include "enums.h" +#include "light.h" +#include "macros.h" +#include "simple_list.h" +#include "mtypes.h" +#include "math/m_matrix.h" + + +void GLAPIENTRY +_mesa_ShadeModel( GLenum mode ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode)); + + if (mode != GL_FLAT && mode != GL_SMOOTH) { + _mesa_error( ctx, GL_INVALID_ENUM, "glShadeModel" ); + return; + } + + if (ctx->Light.ShadeModel == mode) + return; + + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.ShadeModel = mode; + ctx->_TriangleCaps ^= DD_FLATSHADE; + if (ctx->Driver.ShadeModel) + (*ctx->Driver.ShadeModel)( ctx, mode ); +} + + +void GLAPIENTRY +_mesa_Lightf( GLenum light, GLenum pname, GLfloat param ) +{ + _mesa_Lightfv( light, pname, ¶m ); +} + + +void GLAPIENTRY +_mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i = (GLint) (light - GL_LIGHT0); + struct gl_light *l = &ctx->Light.Light[i]; + + if (i < 0 || i >= (GLint) ctx->Const.MaxLights) { + _mesa_error( ctx, GL_INVALID_ENUM, "glLight(light=0x%x)", light ); + return; + } + + switch (pname) { + case GL_AMBIENT: + if (TEST_EQ_4V(l->Ambient, params)) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + COPY_4V( l->Ambient, params ); + break; + case GL_DIFFUSE: + if (TEST_EQ_4V(l->Diffuse, params)) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + COPY_4V( l->Diffuse, params ); + break; + case GL_SPECULAR: + if (TEST_EQ_4V(l->Specular, params)) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + COPY_4V( l->Specular, params ); + break; + case GL_POSITION: { + GLfloat tmp[4]; + /* transform position by ModelView matrix */ + TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->m, params ); + if (TEST_EQ_4V(l->EyePosition, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + COPY_4V(l->EyePosition, tmp); + if (l->EyePosition[3] != 0.0F) + l->_Flags |= LIGHT_POSITIONAL; + else + l->_Flags &= ~LIGHT_POSITIONAL; + break; + } + case GL_SPOT_DIRECTION: { + GLfloat tmp[4]; + /* transform direction by inverse modelview */ + if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); + } + TRANSFORM_NORMAL( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); + if (TEST_EQ_3V(l->EyeDirection, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + COPY_3V(l->EyeDirection, tmp); + break; + } + case GL_SPOT_EXPONENT: + if (params[0]<0.0 || params[0]>ctx->Const.MaxSpotExponent) { + _mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); + return; + } + if (l->SpotExponent == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + l->SpotExponent = params[0]; + _mesa_invalidate_spot_exp_table( l ); + break; + case GL_SPOT_CUTOFF: + if ((params[0]<0.0 || params[0]>90.0) && params[0]!=180.0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); + return; + } + if (l->SpotCutoff == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + l->SpotCutoff = params[0]; + l->_CosCutoff = (GLfloat) _mesa_cos(params[0]*DEG2RAD); + if (l->_CosCutoff < 0) + l->_CosCutoff = 0; + if (l->SpotCutoff != 180.0F) + l->_Flags |= LIGHT_SPOT; + else + l->_Flags &= ~LIGHT_SPOT; + break; + case GL_CONSTANT_ATTENUATION: + if (params[0]<0.0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); + return; + } + if (l->ConstantAttenuation == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + l->ConstantAttenuation = params[0]; + break; + case GL_LINEAR_ATTENUATION: + if (params[0]<0.0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); + return; + } + if (l->LinearAttenuation == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + l->LinearAttenuation = params[0]; + break; + case GL_QUADRATIC_ATTENUATION: + if (params[0]<0.0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); + return; + } + if (l->QuadraticAttenuation == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + l->QuadraticAttenuation = params[0]; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glLight(pname=0x%x)", pname ); + return; + } + + if (ctx->Driver.Lightfv) + ctx->Driver.Lightfv( ctx, light, pname, params ); +} + + +void GLAPIENTRY +_mesa_Lighti( GLenum light, GLenum pname, GLint param ) +{ + _mesa_Lightiv( light, pname, ¶m ); +} + + +void GLAPIENTRY +_mesa_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 */ + ; + } + + _mesa_Lightfv( light, pname, fparam ); +} + + + +void GLAPIENTRY +_mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint l = (GLint) (light - GL_LIGHT0); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (l < 0 || l >= (GLint) ctx->Const.MaxLights) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetLightfv" ); + return; + } + + switch (pname) { + case GL_AMBIENT: + COPY_4V( params, ctx->Light.Light[l].Ambient ); + break; + case GL_DIFFUSE: + COPY_4V( params, ctx->Light.Light[l].Diffuse ); + break; + case GL_SPECULAR: + COPY_4V( params, ctx->Light.Light[l].Specular ); + break; + case GL_POSITION: + COPY_4V( params, ctx->Light.Light[l].EyePosition ); + break; + case GL_SPOT_DIRECTION: + COPY_3V( params, ctx->Light.Light[l].EyeDirection ); + break; + case GL_SPOT_EXPONENT: + params[0] = ctx->Light.Light[l].SpotExponent; + break; + case GL_SPOT_CUTOFF: + params[0] = ctx->Light.Light[l].SpotCutoff; + break; + case GL_CONSTANT_ATTENUATION: + params[0] = ctx->Light.Light[l].ConstantAttenuation; + break; + case GL_LINEAR_ATTENUATION: + params[0] = ctx->Light.Light[l].LinearAttenuation; + break; + case GL_QUADRATIC_ATTENUATION: + params[0] = ctx->Light.Light[l].QuadraticAttenuation; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetLightfv" ); + break; + } +} + + +void GLAPIENTRY +_mesa_GetLightiv( GLenum light, GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint l = (GLint) (light - GL_LIGHT0); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (l < 0 || l >= (GLint) ctx->Const.MaxLights) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetLightiv" ); + return; + } + + switch (pname) { + case GL_AMBIENT: + params[0] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[0]); + params[1] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[1]); + params[2] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[2]); + params[3] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[3]); + break; + case GL_DIFFUSE: + params[0] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[0]); + params[1] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[1]); + params[2] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[2]); + params[3] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[3]); + break; + case GL_SPECULAR: + params[0] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[0]); + params[1] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[1]); + params[2] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[2]); + params[3] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[3]); + break; + case GL_POSITION: + params[0] = (GLint) ctx->Light.Light[l].EyePosition[0]; + params[1] = (GLint) ctx->Light.Light[l].EyePosition[1]; + params[2] = (GLint) ctx->Light.Light[l].EyePosition[2]; + params[3] = (GLint) ctx->Light.Light[l].EyePosition[3]; + break; + case GL_SPOT_DIRECTION: + params[0] = (GLint) ctx->Light.Light[l].EyeDirection[0]; + params[1] = (GLint) ctx->Light.Light[l].EyeDirection[1]; + params[2] = (GLint) ctx->Light.Light[l].EyeDirection[2]; + break; + case GL_SPOT_EXPONENT: + params[0] = (GLint) ctx->Light.Light[l].SpotExponent; + break; + case GL_SPOT_CUTOFF: + params[0] = (GLint) ctx->Light.Light[l].SpotCutoff; + break; + case GL_CONSTANT_ATTENUATION: + params[0] = (GLint) ctx->Light.Light[l].ConstantAttenuation; + break; + case GL_LINEAR_ATTENUATION: + params[0] = (GLint) ctx->Light.Light[l].LinearAttenuation; + break; + case GL_QUADRATIC_ATTENUATION: + params[0] = (GLint) ctx->Light.Light[l].QuadraticAttenuation; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetLightiv" ); + break; + } +} + + + +/**********************************************************************/ +/*** Light Model ***/ +/**********************************************************************/ + + +void GLAPIENTRY +_mesa_LightModelfv( GLenum pname, const GLfloat *params ) +{ + GLenum newenum; + GLboolean newbool; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (pname) { + case GL_LIGHT_MODEL_AMBIENT: + if (TEST_EQ_4V( ctx->Light.Model.Ambient, params )) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + COPY_4V( ctx->Light.Model.Ambient, params ); + break; + case GL_LIGHT_MODEL_LOCAL_VIEWER: + newbool = (params[0]!=0.0); + if (ctx->Light.Model.LocalViewer == newbool) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.Model.LocalViewer = newbool; + break; + case GL_LIGHT_MODEL_TWO_SIDE: + newbool = (params[0]!=0.0); + if (ctx->Light.Model.TwoSide == newbool) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.Model.TwoSide = newbool; + + if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) + ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE; + else + ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE; + break; + case GL_LIGHT_MODEL_COLOR_CONTROL: + if (params[0] == (GLfloat) GL_SINGLE_COLOR) + newenum = GL_SINGLE_COLOR; + else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR) + newenum = GL_SEPARATE_SPECULAR_COLOR; + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(param=0x0%x)", + (GLint) params[0] ); + return; + } + if (ctx->Light.Model.ColorControl == newenum) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.Model.ColorControl = newenum; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(pname=0x%x)", pname ); + break; + } + + if (ctx->Driver.LightModelfv) + ctx->Driver.LightModelfv( ctx, pname, params ); +} + + +void GLAPIENTRY +_mesa_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]; + break; + default: + /* Error will be caught later in gl_LightModelfv */ + ; + } + _mesa_LightModelfv( pname, fparam ); +} + + +void GLAPIENTRY +_mesa_LightModeli( GLenum pname, GLint param ) +{ + _mesa_LightModeliv( pname, ¶m ); +} + + +void GLAPIENTRY +_mesa_LightModelf( GLenum pname, GLfloat param ) +{ + _mesa_LightModelfv( pname, ¶m ); +} + + + +/********** MATERIAL **********/ + + +/* + * Given a face and pname value (ala glColorMaterial), compute a bitmask + * of the targeted material values. + */ +GLuint +_mesa_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname, + GLuint legal, const char *where ) +{ + GLuint bitmask = 0; + + /* Make a bitmask indicating what material attribute(s) we're updating */ + switch (pname) { + case GL_EMISSION: + bitmask |= MAT_BIT_FRONT_EMISSION | MAT_BIT_BACK_EMISSION; + break; + case GL_AMBIENT: + bitmask |= MAT_BIT_FRONT_AMBIENT | MAT_BIT_BACK_AMBIENT; + break; + case GL_DIFFUSE: + bitmask |= MAT_BIT_FRONT_DIFFUSE | MAT_BIT_BACK_DIFFUSE; + break; + case GL_SPECULAR: + bitmask |= MAT_BIT_FRONT_SPECULAR | MAT_BIT_BACK_SPECULAR; + break; + case GL_SHININESS: + bitmask |= MAT_BIT_FRONT_SHININESS | MAT_BIT_BACK_SHININESS; + break; + case GL_AMBIENT_AND_DIFFUSE: + bitmask |= MAT_BIT_FRONT_AMBIENT | MAT_BIT_BACK_AMBIENT; + bitmask |= MAT_BIT_FRONT_DIFFUSE | MAT_BIT_BACK_DIFFUSE; + break; + case GL_COLOR_INDEXES: + bitmask |= MAT_BIT_FRONT_INDEXES | MAT_BIT_BACK_INDEXES; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, where ); + return 0; + } + + if (face==GL_FRONT) { + bitmask &= FRONT_MATERIAL_BITS; + } + else if (face==GL_BACK) { + bitmask &= BACK_MATERIAL_BITS; + } + else if (face != GL_FRONT_AND_BACK) { + _mesa_error( ctx, GL_INVALID_ENUM, where ); + return 0; + } + + if (bitmask & ~legal) { + _mesa_error( ctx, GL_INVALID_ENUM, where ); + return 0; + } + + return bitmask; +} + + + +/* Perform a straight copy between materials. + */ +void +_mesa_copy_materials( struct gl_material *dst, + const struct gl_material *src, + GLuint bitmask ) +{ + int i; + + for (i = 0 ; i < MAT_ATTRIB_MAX ; i++) + if (bitmask & (1<Attrib[i], src->Attrib[i] ); +} + + + +/* Update derived values following a change in ctx->Light.Material + */ +void +_mesa_update_material( GLcontext *ctx, GLuint bitmask ) +{ + struct gl_light *light, *list = &ctx->Light.EnabledList; + GLfloat (*mat)[4] = ctx->Light.Material.Attrib; + + if (MESA_VERBOSE&VERBOSE_IMMEDIATE) + _mesa_debug(ctx, "_mesa_update_material, mask 0x%x\n", bitmask); + + if (!bitmask) + return; + + /* update material ambience */ + if (bitmask & MAT_BIT_FRONT_AMBIENT) { + foreach (light, list) { + SCALE_3V( light->_MatAmbient[0], light->Ambient, + mat[MAT_ATTRIB_FRONT_AMBIENT]); + } + } + + if (bitmask & MAT_BIT_BACK_AMBIENT) { + foreach (light, list) { + SCALE_3V( light->_MatAmbient[1], light->Ambient, + mat[MAT_ATTRIB_BACK_AMBIENT]); + } + } + + /* update BaseColor = emission + scene's ambience * material's ambience */ + if (bitmask & (MAT_BIT_FRONT_EMISSION | MAT_BIT_FRONT_AMBIENT)) { + COPY_3V( ctx->Light._BaseColor[0], mat[MAT_ATTRIB_FRONT_EMISSION] ); + ACC_SCALE_3V( ctx->Light._BaseColor[0], mat[MAT_ATTRIB_FRONT_AMBIENT], + ctx->Light.Model.Ambient ); + } + + if (bitmask & (MAT_BIT_BACK_EMISSION | MAT_BIT_BACK_AMBIENT)) { + COPY_3V( ctx->Light._BaseColor[1], mat[MAT_ATTRIB_BACK_EMISSION] ); + ACC_SCALE_3V( ctx->Light._BaseColor[1], mat[MAT_ATTRIB_BACK_AMBIENT], + ctx->Light.Model.Ambient ); + } + + /* update material diffuse values */ + if (bitmask & MAT_BIT_FRONT_DIFFUSE) { + foreach (light, list) { + SCALE_3V( light->_MatDiffuse[0], light->Diffuse, + mat[MAT_ATTRIB_FRONT_DIFFUSE] ); + } + } + + if (bitmask & MAT_BIT_BACK_DIFFUSE) { + foreach (light, list) { + SCALE_3V( light->_MatDiffuse[1], light->Diffuse, + mat[MAT_ATTRIB_BACK_DIFFUSE] ); + } + } + + /* update material specular values */ + if (bitmask & MAT_BIT_FRONT_SPECULAR) { + foreach (light, list) { + SCALE_3V( light->_MatSpecular[0], light->Specular, + mat[MAT_ATTRIB_FRONT_SPECULAR]); + } + } + + if (bitmask & MAT_BIT_BACK_SPECULAR) { + foreach (light, list) { + SCALE_3V( light->_MatSpecular[1], light->Specular, + mat[MAT_ATTRIB_BACK_SPECULAR]); + } + } + + if (bitmask & MAT_BIT_FRONT_SHININESS) { + _mesa_invalidate_shine_table( ctx, 0 ); + } + + if (bitmask & MAT_BIT_BACK_SHININESS) { + _mesa_invalidate_shine_table( ctx, 1 ); + } +} + + +/* + * Update the current materials from the given rgba color + * according to the bitmask in ColorMaterialBitmask, which is + * set by glColorMaterial(). + */ +void +_mesa_update_color_material( GLcontext *ctx, const GLfloat color[4] ) +{ + GLuint bitmask = ctx->Light.ColorMaterialBitmask; + struct gl_material *mat = &ctx->Light.Material; + int i; + + for (i = 0 ; i < MAT_ATTRIB_MAX ; i++) + if (bitmask & (1<Attrib[i], color ); + + _mesa_update_material( ctx, bitmask ); +} + + +void GLAPIENTRY +_mesa_ColorMaterial( GLenum face, GLenum mode ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint bitmask; + GLuint legal = (MAT_BIT_FRONT_EMISSION | MAT_BIT_BACK_EMISSION | + MAT_BIT_FRONT_SPECULAR | MAT_BIT_BACK_SPECULAR | + MAT_BIT_FRONT_DIFFUSE | MAT_BIT_BACK_DIFFUSE | + MAT_BIT_FRONT_AMBIENT | MAT_BIT_BACK_AMBIENT); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE&VERBOSE_API) + _mesa_debug(ctx, "glColorMaterial %s %s\n", + _mesa_lookup_enum_by_nr(face), + _mesa_lookup_enum_by_nr(mode)); + + bitmask = _mesa_material_bitmask(ctx, face, mode, legal, "glColorMaterial"); + + if (ctx->Light.ColorMaterialBitmask == bitmask && + ctx->Light.ColorMaterialFace == face && + ctx->Light.ColorMaterialMode == mode) + return; + + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.ColorMaterialBitmask = bitmask; + ctx->Light.ColorMaterialFace = face; + ctx->Light.ColorMaterialMode = mode; + + if (ctx->Light.ColorMaterialEnabled) { + FLUSH_CURRENT( ctx, 0 ); + _mesa_update_color_material(ctx,ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); + } + + if (ctx->Driver.ColorMaterial) + (*ctx->Driver.ColorMaterial)( ctx, face, mode ); +} + + +void GLAPIENTRY +_mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint f; + GLfloat (*mat)[4] = ctx->Light.Material.Attrib; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */ + + FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */ + + if (face==GL_FRONT) { + f = 0; + } + else if (face==GL_BACK) { + f = 1; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(face)" ); + return; + } + + switch (pname) { + case GL_AMBIENT: + COPY_4FV( params, mat[MAT_ATTRIB_AMBIENT(f)] ); + break; + case GL_DIFFUSE: + COPY_4FV( params, mat[MAT_ATTRIB_DIFFUSE(f)] ); + break; + case GL_SPECULAR: + COPY_4FV( params, mat[MAT_ATTRIB_SPECULAR(f)] ); + break; + case GL_EMISSION: + COPY_4FV( params, mat[MAT_ATTRIB_EMISSION(f)] ); + break; + case GL_SHININESS: + *params = mat[MAT_ATTRIB_SHININESS(f)][0]; + break; + case GL_COLOR_INDEXES: + params[0] = mat[MAT_ATTRIB_INDEXES(f)][0]; + params[1] = mat[MAT_ATTRIB_INDEXES(f)][1]; + params[2] = mat[MAT_ATTRIB_INDEXES(f)][2]; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(pname)" ); + } +} + + +void GLAPIENTRY +_mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint f; + GLfloat (*mat)[4] = ctx->Light.Material.Attrib; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */ + + FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */ + + if (face==GL_FRONT) { + f = 0; + } + else if (face==GL_BACK) { + f = 1; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialiv(face)" ); + return; + } + switch (pname) { + case GL_AMBIENT: + params[0] = FLOAT_TO_INT( mat[MAT_ATTRIB_AMBIENT(f)][0] ); + params[1] = FLOAT_TO_INT( mat[MAT_ATTRIB_AMBIENT(f)][1] ); + params[2] = FLOAT_TO_INT( mat[MAT_ATTRIB_AMBIENT(f)][2] ); + params[3] = FLOAT_TO_INT( mat[MAT_ATTRIB_AMBIENT(f)][3] ); + break; + case GL_DIFFUSE: + params[0] = FLOAT_TO_INT( mat[MAT_ATTRIB_DIFFUSE(f)][0] ); + params[1] = FLOAT_TO_INT( mat[MAT_ATTRIB_DIFFUSE(f)][1] ); + params[2] = FLOAT_TO_INT( mat[MAT_ATTRIB_DIFFUSE(f)][2] ); + params[3] = FLOAT_TO_INT( mat[MAT_ATTRIB_DIFFUSE(f)][3] ); + break; + case GL_SPECULAR: + params[0] = FLOAT_TO_INT( mat[MAT_ATTRIB_SPECULAR(f)][0] ); + params[1] = FLOAT_TO_INT( mat[MAT_ATTRIB_SPECULAR(f)][1] ); + params[2] = FLOAT_TO_INT( mat[MAT_ATTRIB_SPECULAR(f)][2] ); + params[3] = FLOAT_TO_INT( mat[MAT_ATTRIB_SPECULAR(f)][3] ); + break; + case GL_EMISSION: + params[0] = FLOAT_TO_INT( mat[MAT_ATTRIB_EMISSION(f)][0] ); + params[1] = FLOAT_TO_INT( mat[MAT_ATTRIB_EMISSION(f)][1] ); + params[2] = FLOAT_TO_INT( mat[MAT_ATTRIB_EMISSION(f)][2] ); + params[3] = FLOAT_TO_INT( mat[MAT_ATTRIB_EMISSION(f)][3] ); + break; + case GL_SHININESS: + *params = IROUND( mat[MAT_ATTRIB_SHININESS(f)][0] ); + break; + case GL_COLOR_INDEXES: + params[0] = IROUND( mat[MAT_ATTRIB_INDEXES(f)][0] ); + params[1] = IROUND( mat[MAT_ATTRIB_INDEXES(f)][1] ); + params[2] = IROUND( mat[MAT_ATTRIB_INDEXES(f)][2] ); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(pname)" ); + } +} + + + +/**********************************************************************/ +/***** Lighting computation *****/ +/**********************************************************************/ + + +/* + * Notes: + * When two-sided lighting is enabled we compute the color (or index) + * for both the front and back side of the primitive. Then, when the + * orientation of the facet is later learned, we can determine which + * color (or index) to use for rendering. + * + * KW: We now know orientation in advance and only shade for + * the side or sides which are actually required. + * + * Variables: + * n = normal vector + * V = vertex position + * P = light source position + * Pe = (0,0,0,1) + * + * Precomputed: + * IF P[3]==0 THEN + * // light at infinity + * IF local_viewer THEN + * _VP_inf_norm = unit vector from V to P // Precompute + * ELSE + * // eye at infinity + * _h_inf_norm = Normalize( VP + <0,0,1> ) // Precompute + * ENDIF + * ENDIF + * + * Functions: + * Normalize( v ) = normalized vector v + * Magnitude( v ) = length of vector v + */ + + + +/* + * Whenever the spotlight exponent for a light changes we must call + * this function to recompute the exponent lookup table. + */ +void +_mesa_invalidate_spot_exp_table( struct gl_light *l ) +{ + l->_SpotExpTable[0][0] = -1; +} + + +static void +validate_spot_exp_table( struct gl_light *l ) +{ + GLint i; + GLdouble exponent = l->SpotExponent; + GLdouble tmp = 0; + GLint clamp = 0; + + l->_SpotExpTable[0][0] = 0.0; + + for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) { + if (clamp == 0) { + tmp = _mesa_pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent); + if (tmp < FLT_MIN * 100.0) { + tmp = 0.0; + clamp = 1; + } + } + l->_SpotExpTable[i][0] = (GLfloat) tmp; + } + for (i = 0; i < EXP_TABLE_SIZE - 1; i++) { + l->_SpotExpTable[i][1] = (l->_SpotExpTable[i+1][0] - + l->_SpotExpTable[i][0]); + } + l->_SpotExpTable[EXP_TABLE_SIZE-1][1] = 0.0; +} + + + +/* Calculate a new shine table. Doing this here saves a branch in + * lighting, and the cost of doing it early may be partially offset + * by keeping a MRU cache of shine tables for various shine values. + */ +void +_mesa_invalidate_shine_table( GLcontext *ctx, GLuint side ) +{ + ASSERT(side < 2); + if (ctx->_ShineTable[side]) + ctx->_ShineTable[side]->refcount--; + ctx->_ShineTable[side] = NULL; +} + + +static void +validate_shine_table( GLcontext *ctx, GLuint side, GLfloat shininess ) +{ + struct gl_shine_tab *list = ctx->_ShineTabList; + struct gl_shine_tab *s; + + ASSERT(side < 2); + + foreach(s, list) + if ( s->shininess == shininess ) + break; + + if (s == list) { + GLint j; + GLfloat *m; + + foreach(s, list) + if (s->refcount == 0) + break; + + m = s->tab; + m[0] = 0.0; + if (shininess == 0.0) { + for (j = 1 ; j <= SHINE_TABLE_SIZE ; j++) + m[j] = 1.0; + } + else { + for (j = 1 ; j < SHINE_TABLE_SIZE ; j++) { + GLdouble t, x = j / (GLfloat) (SHINE_TABLE_SIZE - 1); + if (x < 0.005) /* underflow check */ + x = 0.005; + t = _mesa_pow(x, shininess); + if (t > 1e-20) + m[j] = (GLfloat) t; + else + m[j] = 0.0; + } + m[SHINE_TABLE_SIZE] = 1.0; + } + + s->shininess = shininess; + } + + if (ctx->_ShineTable[side]) + ctx->_ShineTable[side]->refcount--; + + ctx->_ShineTable[side] = s; + move_to_tail( list, s ); + s->refcount++; +} + + +void +_mesa_validate_all_lighting_tables( GLcontext *ctx ) +{ + GLuint i; + GLfloat shininess; + + shininess = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS][0]; + if (!ctx->_ShineTable[0] || ctx->_ShineTable[0]->shininess != shininess) + validate_shine_table( ctx, 0, shininess ); + + shininess = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_SHININESS][0]; + if (!ctx->_ShineTable[1] || ctx->_ShineTable[1]->shininess != shininess) + validate_shine_table( ctx, 1, shininess ); + + for (i = 0 ; i < MAX_LIGHTS ; i++) + if (ctx->Light.Light[i]._SpotExpTable[0][0] == -1) + validate_spot_exp_table( &ctx->Light.Light[i] ); +} + + + +/* + * Examine current lighting parameters to determine if the optimized lighting + * function can be used. + * Also, precompute some lighting values such as the products of light + * source and material ambient, diffuse and specular coefficients. + */ +void +_mesa_update_lighting( GLcontext *ctx ) +{ + struct gl_light *light; + ctx->Light._NeedEyeCoords = 0; + ctx->Light._Flags = 0; + + if (!ctx->Light.Enabled) + return; + + foreach(light, &ctx->Light.EnabledList) { + ctx->Light._Flags |= light->_Flags; + } + + ctx->Light._NeedVertices = + ((ctx->Light._Flags & (LIGHT_POSITIONAL|LIGHT_SPOT)) || + ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR || + ctx->Light.Model.LocalViewer); + + ctx->Light._NeedEyeCoords = ((ctx->Light._Flags & LIGHT_POSITIONAL) || + ctx->Light.Model.LocalViewer); + + + + /* XXX: This test is overkill & needs to be fixed both for software and + * hardware t&l drivers. The above should be sufficient & should + * be tested to verify this. + */ + if (ctx->Light._NeedVertices) + ctx->Light._NeedEyeCoords = GL_TRUE; + + + /* Precompute some shading values. Although we reference + * Light.Material here, we can get away without flushing + * FLUSH_UPDATE_CURRENT, as when any outstanding material changes + * are flushed, they will update the derived state at that time. + */ + if (ctx->Visual.rgbMode) { + if (ctx->Light.Model.TwoSide) + _mesa_update_material( ctx, + MAT_BIT_FRONT_EMISSION | + MAT_BIT_FRONT_AMBIENT | + MAT_BIT_FRONT_DIFFUSE | + MAT_BIT_FRONT_SPECULAR | + MAT_BIT_BACK_EMISSION | + MAT_BIT_BACK_AMBIENT | + MAT_BIT_BACK_DIFFUSE | + MAT_BIT_BACK_SPECULAR); + else + _mesa_update_material( ctx, + MAT_BIT_FRONT_EMISSION | + MAT_BIT_FRONT_AMBIENT | + MAT_BIT_FRONT_DIFFUSE | + MAT_BIT_FRONT_SPECULAR); + } + else { + static const GLfloat ci[3] = { .30F, .59F, .11F }; + foreach(light, &ctx->Light.EnabledList) { + light->_dli = DOT3(ci, light->Diffuse); + light->_sli = DOT3(ci, light->Specular); + } + } +} + + +/* _NEW_MODELVIEW + * _NEW_LIGHT + * _TNL_NEW_NEED_EYE_COORDS + * + * Update on (_NEW_MODELVIEW | _NEW_LIGHT) when lighting is enabled. + * Also update on lighting space changes. + */ +static void +compute_light_positions( GLcontext *ctx ) +{ + struct gl_light *light; + static const GLfloat eye_z[3] = { 0, 0, 1 }; + + if (!ctx->Light.Enabled) + return; + + if (ctx->_NeedEyeCoords) { + COPY_3V( ctx->_EyeZDir, eye_z ); + } + else { + TRANSFORM_NORMAL( ctx->_EyeZDir, eye_z, ctx->ModelviewMatrixStack.Top->m ); + } + + foreach (light, &ctx->Light.EnabledList) { + + if (ctx->_NeedEyeCoords) { + COPY_4FV( light->_Position, light->EyePosition ); + } + else { + TRANSFORM_POINT( light->_Position, ctx->ModelviewMatrixStack.Top->inv, + light->EyePosition ); + } + + if (!(light->_Flags & LIGHT_POSITIONAL)) { + /* VP (VP) = Normalize( Position ) */ + COPY_3V( light->_VP_inf_norm, light->_Position ); + NORMALIZE_3FV( light->_VP_inf_norm ); + + if (!ctx->Light.Model.LocalViewer) { + /* _h_inf_norm = Normalize( V_to_P + <0,0,1> ) */ + ADD_3V( light->_h_inf_norm, light->_VP_inf_norm, ctx->_EyeZDir); + NORMALIZE_3FV( light->_h_inf_norm ); + } + light->_VP_inf_spot_attenuation = 1.0; + } + + if (light->_Flags & LIGHT_SPOT) { + if (ctx->_NeedEyeCoords) { + COPY_3V( light->_NormDirection, light->EyeDirection ); + } + else { + TRANSFORM_NORMAL( light->_NormDirection, + light->EyeDirection, + ctx->ModelviewMatrixStack.Top->m); + } + + NORMALIZE_3FV( light->_NormDirection ); + + if (!(light->_Flags & LIGHT_POSITIONAL)) { + GLfloat PV_dot_dir = - DOT3(light->_VP_inf_norm, + light->_NormDirection); + + if (PV_dot_dir > light->_CosCutoff) { + double x = PV_dot_dir * (EXP_TABLE_SIZE-1); + int k = (int) x; + light->_VP_inf_spot_attenuation = + (GLfloat) (light->_SpotExpTable[k][0] + + (x-k)*light->_SpotExpTable[k][1]); + } + else { + light->_VP_inf_spot_attenuation = 0; + } + } + } + } +} + + + +static void +update_modelview_scale( GLcontext *ctx ) +{ + ctx->_ModelViewInvScale = 1.0F; + if (!_math_matrix_is_length_preserving(ctx->ModelviewMatrixStack.Top)) { + const GLfloat *m = ctx->ModelviewMatrixStack.Top->inv; + GLfloat f = m[2] * m[2] + m[6] * m[6] + m[10] * m[10]; + if (f < 1e-12) f = 1.0; + if (ctx->_NeedEyeCoords) + ctx->_ModelViewInvScale = (GLfloat) INV_SQRTF(f); + else + ctx->_ModelViewInvScale = (GLfloat) SQRTF(f); + } +} + + +/* Bring uptodate any state that relies on _NeedEyeCoords. + */ +void +_mesa_update_tnl_spaces( GLcontext *ctx, GLuint new_state ) +{ + const GLuint oldneedeyecoords = ctx->_NeedEyeCoords; + + (void) new_state; + ctx->_NeedEyeCoords = 0; + + if (ctx->_ForceEyeCoords || + (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) || + ctx->Point._Attenuated || + ctx->Light._NeedEyeCoords) + ctx->_NeedEyeCoords = 1; + + if (ctx->Light.Enabled && + !_math_matrix_is_length_preserving(ctx->ModelviewMatrixStack.Top)) + ctx->_NeedEyeCoords = 1; + + + /* Check if the truth-value interpretations of the bitfields have + * changed: + */ + if (oldneedeyecoords != ctx->_NeedEyeCoords) { + /* Recalculate all state that depends on _NeedEyeCoords. + */ + update_modelview_scale(ctx); + compute_light_positions( ctx ); + + if (ctx->Driver.LightingSpaceChange) + ctx->Driver.LightingSpaceChange( ctx ); + } + else { + GLuint new_state = ctx->NewState; + + /* Recalculate that same state only if it has been invalidated + * by other statechanges. + */ + if (new_state & _NEW_MODELVIEW) + update_modelview_scale(ctx); + + if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW)) + compute_light_positions( ctx ); + } +} + + +/* Drivers may need this if the hardware tnl unit doesn't support the + * light-in-modelspace optimization. It's also useful for debugging. + */ +void +_mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag ) +{ + ctx->_ForceEyeCoords = !flag; + ctx->NewState |= _NEW_POINT; /* one of the bits from + * _MESA_NEW_NEED_EYE_COORDS. + */ +} + + + +/**********************************************************************/ +/***** Initialization *****/ +/**********************************************************************/ + +/** + * Initialize the n-th light data structure. + * + * \param l pointer to the gl_light structure to be initialized. + * \param n number of the light. + * \note The defaults for light 0 are different than the other lights. + */ +static void +init_light( struct gl_light *l, GLuint n ) +{ + make_empty_list( l ); + + ASSIGN_4V( l->Ambient, 0.0, 0.0, 0.0, 1.0 ); + if (n==0) { + ASSIGN_4V( l->Diffuse, 1.0, 1.0, 1.0, 1.0 ); + ASSIGN_4V( l->Specular, 1.0, 1.0, 1.0, 1.0 ); + } + else { + ASSIGN_4V( l->Diffuse, 0.0, 0.0, 0.0, 1.0 ); + ASSIGN_4V( l->Specular, 0.0, 0.0, 0.0, 1.0 ); + } + ASSIGN_4V( l->EyePosition, 0.0, 0.0, 1.0, 0.0 ); + ASSIGN_3V( l->EyeDirection, 0.0, 0.0, -1.0 ); + l->SpotExponent = 0.0; + _mesa_invalidate_spot_exp_table( l ); + l->SpotCutoff = 180.0; + l->_CosCutoff = 0.0; /* KW: -ve values not admitted */ + l->ConstantAttenuation = 1.0; + l->LinearAttenuation = 0.0; + l->QuadraticAttenuation = 0.0; + l->Enabled = GL_FALSE; +} + + +/** + * Initialize the light model data structure. + * + * \param lm pointer to the gl_lightmodel structure to be initialized. + */ +static void +init_lightmodel( struct gl_lightmodel *lm ) +{ + ASSIGN_4V( lm->Ambient, 0.2F, 0.2F, 0.2F, 1.0F ); + lm->LocalViewer = GL_FALSE; + lm->TwoSide = GL_FALSE; + lm->ColorControl = GL_SINGLE_COLOR; +} + + +/** + * Initialize the material data structure. + * + * \param m pointer to the gl_material structure to be initialized. + */ +static void +init_material( struct gl_material *m ) +{ + ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_AMBIENT], 0.2F, 0.2F, 0.2F, 1.0F ); + ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_DIFFUSE], 0.8F, 0.8F, 0.8F, 1.0F ); + ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_SPECULAR], 0.0F, 0.0F, 0.0F, 1.0F ); + ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_EMISSION], 0.0F, 0.0F, 0.0F, 1.0F ); + ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_SHININESS], 0.0F, 0.0F, 0.0F, 0.0F ); + ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_INDEXES], 0.0F, 1.0F, 1.0F, 0.0F ); + + ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_AMBIENT], 0.2F, 0.2F, 0.2F, 1.0F ); + ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_DIFFUSE], 0.8F, 0.8F, 0.8F, 1.0F ); + ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_SPECULAR], 0.0F, 0.0F, 0.0F, 1.0F ); + ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_EMISSION], 0.0F, 0.0F, 0.0F, 1.0F ); + ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_SHININESS], 0.0F, 0.0F, 0.0F, 0.0F ); + ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_INDEXES], 0.0F, 1.0F, 1.0F, 0.0F ); +} + + +void +_mesa_init_lighting( GLcontext *ctx ) +{ + GLuint i; + + /* Lighting group */ + for (i = 0; i < MAX_LIGHTS; i++) { + init_light( &ctx->Light.Light[i], i ); + } + make_empty_list( &ctx->Light.EnabledList ); + + init_lightmodel( &ctx->Light.Model ); + init_material( &ctx->Light.Material ); + ctx->Light.ShadeModel = GL_SMOOTH; + ctx->Light.Enabled = GL_FALSE; + ctx->Light.ColorMaterialFace = GL_FRONT_AND_BACK; + ctx->Light.ColorMaterialMode = GL_AMBIENT_AND_DIFFUSE; + ctx->Light.ColorMaterialBitmask = _mesa_material_bitmask( ctx, + GL_FRONT_AND_BACK, + GL_AMBIENT_AND_DIFFUSE, ~0, + NULL ); + + ctx->Light.ColorMaterialEnabled = GL_FALSE; + + /* Lighting miscellaneous */ + ctx->_ShineTabList = MALLOC_STRUCT( gl_shine_tab ); + make_empty_list( ctx->_ShineTabList ); + /* Allocate 10 (arbitrary) shininess lookup tables */ + for (i = 0 ; i < 10 ; i++) { + struct gl_shine_tab *s = MALLOC_STRUCT( gl_shine_tab ); + s->shininess = -1; + s->refcount = 0; + insert_at_tail( ctx->_ShineTabList, s ); + } + + /* Miscellaneous */ + ctx->Light._NeedEyeCoords = 0; + ctx->_NeedEyeCoords = 0; + ctx->_ModelViewInvScale = 1.0; +} + + +void +_mesa_free_lighting_data( GLcontext *ctx ) +{ + struct gl_shine_tab *s, *tmps; + + /* Free lighting shininess exponentiation table */ + foreach_s( s, tmps, ctx->_ShineTabList ) { + FREE( s ); + } + FREE( ctx->_ShineTabList ); +} diff --git a/reactos/dll/mesa32/src/main/light.h b/reactos/dll/mesa32/src/main/light.h new file mode 100644 index 00000000000..1f19019450f --- /dev/null +++ b/reactos/dll/mesa32/src/main/light.h @@ -0,0 +1,141 @@ +/** + * \file light.h + * Lighting. + */ + +/* + * 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 LIGHT_H +#define LIGHT_H + + +#include "mtypes.h" + +extern void GLAPIENTRY +_mesa_ShadeModel( GLenum mode ); + +#if _HAVE_FULL_GL +extern void GLAPIENTRY +_mesa_ColorMaterial( GLenum face, GLenum mode ); + +extern void GLAPIENTRY +_mesa_Lightf( GLenum light, GLenum pname, GLfloat param ); + +extern void GLAPIENTRY +_mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ); + +extern void GLAPIENTRY +_mesa_Lightiv( GLenum light, GLenum pname, const GLint *params ); + +extern void GLAPIENTRY +_mesa_Lighti( GLenum light, GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_LightModelf( GLenum pname, GLfloat param ); + +extern void GLAPIENTRY +_mesa_LightModelfv( GLenum pname, const GLfloat *params ); + +extern void GLAPIENTRY +_mesa_LightModeli( GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_LightModeliv( GLenum pname, const GLint *params ); + +extern void GLAPIENTRY +_mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params ); + +extern void GLAPIENTRY +_mesa_GetLightiv( GLenum light, GLenum pname, GLint *params ); + +extern void GLAPIENTRY +_mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ); + +extern void GLAPIENTRY +_mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ); + + +/* Lerp between adjacent values in the f(x) lookup table, giving a + * continuous function, with adequeate overall accuracy. (Though + * still pretty good compared to a straight lookup). + * Result should be a GLfloat. + */ +#define GET_SHINE_TAB_ENTRY( table, dp, result ) \ +do { \ + struct gl_shine_tab *_tab = table; \ + float f = (dp * (SHINE_TABLE_SIZE-1)); \ + int k = (int) f; \ + if (k > SHINE_TABLE_SIZE-2) \ + result = (GLfloat) _mesa_pow( dp, _tab->shininess ); \ + else \ + result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]); \ +} while (0) + + +extern GLuint _mesa_material_bitmask( GLcontext *ctx, + GLenum face, GLenum pname, + GLuint legal, + const char * ); + +extern void _mesa_invalidate_spot_exp_table( struct gl_light *l ); + +extern void _mesa_invalidate_shine_table( GLcontext *ctx, GLuint i ); + +extern void _mesa_validate_all_lighting_tables( GLcontext *ctx ); + +extern void _mesa_update_lighting( GLcontext *ctx ); + +extern void _mesa_update_tnl_spaces( GLcontext *ctx, GLuint new_state ); + +extern void _mesa_update_material( GLcontext *ctx, + GLuint bitmask ); + +extern void _mesa_copy_materials( struct gl_material *dst, + const struct gl_material *src, + GLuint bitmask ); + +extern void _mesa_update_color_material( GLcontext *ctx, + const GLfloat rgba[4] ); + +extern void _mesa_init_lighting( GLcontext *ctx ); + +extern void _mesa_free_lighting_data( GLcontext *ctx ); + +extern void _mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag ); + +#else +#define _mesa_update_color_material( c, r ) ((void)0) +#define _mesa_validate_all_lighting_tables( c ) ((void)0) +#define _mesa_invalidate_spot_exp_table( l ) ((void)0) +#define _mesa_material_bitmask( c, f, p, l, s ) 0 +#define _mesa_init_lighting( c ) ((void)0) +#define _mesa_free_lighting_data( c ) ((void)0) +#define _mesa_update_lighting( c ) ((void)0) +#define _mesa_update_tnl_spaces( c, n ) ((void)0) +#define GET_SHINE_TAB_ENTRY( table, dp, result ) ((result)=0) +#endif + +#endif diff --git a/reactos/dll/mesa32/src/main/lines.c b/reactos/dll/mesa32/src/main/lines.c new file mode 100644 index 00000000000..c30d9ac109e --- /dev/null +++ b/reactos/dll/mesa32/src/main/lines.c @@ -0,0 +1,134 @@ +/** + * \file lines.c + * Line operations. + */ + +/* + * 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. + */ + + +#include "glheader.h" +#include "context.h" +#include "depth.h" +#include "lines.h" +#include "macros.h" +#include "texstate.h" +#include "mtypes.h" + + +/** + * Set the line width. + * + * \param width line width in pixels. + * + * \sa glLineWidth(). + * + * Verifies the parameter and updates gl_line_attrib::Width. On a change, + * flushes the vertices, updates the clamped line width and marks the + * DD_LINE_WIDTH flag in __GLcontextRec::_TriangleCaps for the drivers if the + * width is different from one. Notifies the driver via the + * dd_function_table::LineWidth callback. + */ +void GLAPIENTRY +_mesa_LineWidth( GLfloat width ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (width<=0.0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glLineWidth" ); + return; + } + + if (ctx->Line.Width == width) + return; + + FLUSH_VERTICES(ctx, _NEW_LINE); + ctx->Line.Width = width; + ctx->Line._Width = CLAMP(width, + ctx->Const.MinLineWidth, + ctx->Const.MaxLineWidth); + + + if (width != 1.0) + ctx->_TriangleCaps |= DD_LINE_WIDTH; + else + ctx->_TriangleCaps &= ~DD_LINE_WIDTH; + + if (ctx->Driver.LineWidth) + (*ctx->Driver.LineWidth)(ctx, width); +} + + +/** + * Set the line stipple pattern. + * + * \param factor pattern scale factor. + * \param pattern bit pattern. + * + * \sa glLineStipple(). + * + * Updates gl_line_attrib::StippleFactor and gl_line_attrib::StipplePattern. On + * change flushes the vertices and notifies the driver via + * the dd_function_table::LineStipple callback. + */ +void GLAPIENTRY +_mesa_LineStipple( GLint factor, GLushort pattern ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + factor = CLAMP( factor, 1, 256 ); + + if (ctx->Line.StippleFactor == factor && + ctx->Line.StipplePattern == pattern) + return; + + FLUSH_VERTICES(ctx, _NEW_LINE); + ctx->Line.StippleFactor = factor; + ctx->Line.StipplePattern = pattern; + + if (ctx->Driver.LineStipple) + ctx->Driver.LineStipple( ctx, factor, pattern ); +} + + +/** + * Initialize the context line state. + * + * \param ctx GL context. + * + * Initializes __GLcontextRec::Line and line related constants in + * __GLcontextRec::Const. + */ +void GLAPIENTRY _mesa_init_line( GLcontext * ctx ) +{ + /* Line group */ + ctx->Line.SmoothFlag = GL_FALSE; + ctx->Line.StippleFlag = GL_FALSE; + ctx->Line.Width = 1.0; + ctx->Line._Width = 1.0; + ctx->Line.StipplePattern = 0xffff; + ctx->Line.StippleFactor = 1; +} diff --git a/reactos/dll/mesa32/src/main/lines.h b/reactos/dll/mesa32/src/main/lines.h new file mode 100644 index 00000000000..5a47e9858d5 --- /dev/null +++ b/reactos/dll/mesa32/src/main/lines.h @@ -0,0 +1,48 @@ +/** + * \file lines.h + * Line operations. + */ + +/* + * 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 LINES_H +#define LINES_H + + +#include "mtypes.h" + + +extern void GLAPIENTRY +_mesa_LineWidth( GLfloat width ); + +extern void GLAPIENTRY +_mesa_LineStipple( GLint factor, GLushort pattern ); + +extern void GLAPIENTRY +_mesa_init_line( GLcontext * ctx ); + +#endif diff --git a/reactos/dll/mesa32/src/main/macros.h b/reactos/dll/mesa32/src/main/macros.h new file mode 100644 index 00000000000..f13357d391b --- /dev/null +++ b/reactos/dll/mesa32/src/main/macros.h @@ -0,0 +1,657 @@ +/** + * \file macros.h + * A collection of useful macros. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.0 + * + * 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 MACROS_H +#define MACROS_H + +#include "imports.h" + + +/** + * \name Integer / float conversion for colors, normals, etc. + */ +/*@{*/ + +/** Convert GLubyte in [0,255] to GLfloat in [0.0,1.0] */ +extern GLfloat _mesa_ubyte_to_float_color_tab[256]; +#define UBYTE_TO_FLOAT(u) _mesa_ubyte_to_float_color_tab[(unsigned int)(u)] + +/** Convert GLfloat in [0.0,1.0] to GLubyte in [0,255] */ +#define FLOAT_TO_UBYTE(X) ((GLubyte) (GLint) ((X) * 255.0F)) + + +/** Convert GLbyte in [-128,127] to GLfloat in [-1.0,1.0] */ +#define BYTE_TO_FLOAT(B) ((2.0F * (B) + 1.0F) * (1.0F/255.0F)) + +/** Convert GLfloat in [-1.0,1.0] to GLbyte in [-128,127] */ +#define FLOAT_TO_BYTE(X) ( (((GLint) (255.0F * (X))) - 1) / 2 ) + + +/** Convert GLushort in [0,65536] to GLfloat in [0.0,1.0] */ +#define USHORT_TO_FLOAT(S) ((GLfloat) (S) * (1.0F / 65535.0F)) + +/** Convert GLfloat in [0.0,1.0] to GLushort in [0,65536] */ +#define FLOAT_TO_USHORT(X) ((GLushort) (GLint) ((X) * 65535.0F)) + +/** Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0] */ +#define SHORT_TO_FLOAT(S) ((2.0F * (S) + 1.0F) * (1.0F/65535.0F)) + +/** Convert GLfloat in [0.0,1.0] to GLshort in [-32768,32767] */ +#define FLOAT_TO_SHORT(X) ( (((GLint) (65535.0F * (X))) - 1) / 2 ) + + +/** Convert GLuint in [0,4294967295] to GLfloat in [0.0,1.0] */ +#define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0F)) + +/** Convert GLfloat in [0.0,1.0] to GLuint in [0,4294967295] */ +#define FLOAT_TO_UINT(X) ((GLuint) ((X) * 4294967295.0)) + + +/** Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0] */ +#define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0F)) + +/** Convert GLfloat in [-1.0,1.0] to GLint in [-2147483648,2147483647] */ +/* causes overflow: +#define FLOAT_TO_INT(X) ( (((GLint) (4294967294.0F * (X))) - 1) / 2 ) +*/ +/* a close approximation: */ +#define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) ) + + +#define BYTE_TO_UBYTE(b) ((GLubyte) ((b) < 0 ? 0 : (GLubyte) (b))) +#define SHORT_TO_UBYTE(s) ((GLubyte) ((s) < 0 ? 0 : (GLubyte) ((s) >> 7))) +#define USHORT_TO_UBYTE(s) ((GLubyte) ((s) >> 8)) +#define INT_TO_UBYTE(i) ((GLubyte) ((i) < 0 ? 0 : (GLubyte) ((i) >> 23))) +#define UINT_TO_UBYTE(i) ((GLubyte) ((i) >> 24)) + + +#define BYTE_TO_USHORT(b) ((b) < 0 ? 0 : ((GLushort) (((b) * 65535) / 255))) +#define UBYTE_TO_USHORT(b) (((GLushort) (b) << 8) | (GLushort) (b)) +#define SHORT_TO_USHORT(s) ((s) < 0 ? 0 : ((GLushort) (((s) * 65535 / 32767)))) +#define INT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 15))) +#define UINT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 16))) +#define UNCLAMPED_FLOAT_TO_USHORT(us, f) \ + us = ( (GLushort) IROUND( CLAMP((f), 0.0, 1.0) * 65535.0F) ) +#define CLAMPED_FLOAT_TO_USHORT(us, f) \ + us = ( (GLushort) IROUND( (f) * 65535.0F) ) + +/*@}*/ + + +/** Stepping a GLfloat pointer by a byte stride */ +#define STRIDE_F(p, i) (p = (GLfloat *)((GLubyte *)p + i)) +/** Stepping a GLuint pointer by a byte stride */ +#define STRIDE_UI(p, i) (p = (GLuint *)((GLubyte *)p + i)) +/** Stepping a GLubyte[4] pointer by a byte stride */ +#define STRIDE_4UB(p, i) (p = (GLubyte (*)[4])((GLubyte *)p + i)) +/** Stepping a GLfloat[4] pointer by a byte stride */ +#define STRIDE_4F(p, i) (p = (GLfloat (*)[4])((GLubyte *)p + i)) +/** Stepping a GLchan[4] pointer by a byte stride */ +#define STRIDE_4CHAN(p, i) (p = (GLchan (*)[4])((GLubyte *)p + i)) +/** Stepping a GLchan pointer by a byte stride */ +#define STRIDE_CHAN(p, i) (p = (GLchan *)((GLubyte *)p + i)) +/** Stepping a \p t pointer by a byte stride */ +#define STRIDE_T(p, t, i) (p = (t)((GLubyte *)p + i)) + + +/**********************************************************************/ +/** \name 4-element vector operations */ +/*@{*/ + +/** Zero */ +#define ZERO_4V( DST ) (DST)[0] = (DST)[1] = (DST)[2] = (DST)[3] = 0 + +/** Test for equality */ +#define TEST_EQ_4V(a,b) ((a)[0] == (b)[0] && \ + (a)[1] == (b)[1] && \ + (a)[2] == (b)[2] && \ + (a)[3] == (b)[3]) + +/** Test for equality (unsigned bytes) */ +#if defined(__i386__) +#define TEST_EQ_4UBV(DST, SRC) *((GLuint*)(DST)) == *((GLuint*)(SRC)) +#else +#define TEST_EQ_4UBV(DST, SRC) TEST_EQ_4V(DST, SRC) +#endif + +/** Copy a 4-element vector */ +#define COPY_4V( DST, SRC ) \ +do { \ + (DST)[0] = (SRC)[0]; \ + (DST)[1] = (SRC)[1]; \ + (DST)[2] = (SRC)[2]; \ + (DST)[3] = (SRC)[3]; \ +} while (0) + +/** Copy a 4-element vector with cast */ +#define COPY_4V_CAST( DST, SRC, CAST ) \ +do { \ + (DST)[0] = (CAST)(SRC)[0]; \ + (DST)[1] = (CAST)(SRC)[1]; \ + (DST)[2] = (CAST)(SRC)[2]; \ + (DST)[3] = (CAST)(SRC)[3]; \ +} while (0) + +/** Copy a 4-element unsigned byte vector */ +#if defined(__i386__) +#define COPY_4UBV(DST, SRC) \ +do { \ + *((GLuint*)(DST)) = *((GLuint*)(SRC)); \ +} while (0) +#else +/* The GLuint cast might fail if DST or SRC are not dword-aligned (RISC) */ +#define COPY_4UBV(DST, SRC) \ +do { \ + (DST)[0] = (SRC)[0]; \ + (DST)[1] = (SRC)[1]; \ + (DST)[2] = (SRC)[2]; \ + (DST)[3] = (SRC)[3]; \ +} while (0) +#endif + +/** Copy a 4-element float vector (Use COPY_FLOAT to avoid loading FPU) */ +#define COPY_4FV( DST, SRC ) \ +do { \ + COPY_FLOAT((DST)[0], (SRC)[0]); \ + COPY_FLOAT((DST)[1], (SRC)[1]); \ + COPY_FLOAT((DST)[2], (SRC)[2]); \ + COPY_FLOAT((DST)[3], (SRC)[3]); \ +} while (0) + + +/** Copy \p SZ elements into a 4-element vector */ +#define COPY_SZ_4V(DST, SZ, SRC) \ +do { \ + switch (SZ) { \ + case 4: (DST)[3] = (SRC)[3]; \ + case 3: (DST)[2] = (SRC)[2]; \ + case 2: (DST)[1] = (SRC)[1]; \ + case 1: (DST)[0] = (SRC)[0]; \ + } \ +} while(0) + +/** Copy \p SZ elements into a homegeneous (4-element) vector, giving + * default values to the remaining */ +#define COPY_CLEAN_4V(DST, SZ, SRC) \ +do { \ + ASSIGN_4V( DST, 0, 0, 0, 1 ); \ + COPY_SZ_4V( DST, SZ, SRC ); \ +} while (0) + +/** Subtraction */ +#define SUB_4V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] - (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] - (SRCB)[1]; \ + (DST)[2] = (SRCA)[2] - (SRCB)[2]; \ + (DST)[3] = (SRCA)[3] - (SRCB)[3]; \ +} while (0) + +/** Addition */ +#define ADD_4V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] + (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] + (SRCB)[1]; \ + (DST)[2] = (SRCA)[2] + (SRCB)[2]; \ + (DST)[3] = (SRCA)[3] + (SRCB)[3]; \ +} while (0) + +/** Element-wise multiplication */ +#define SCALE_4V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] * (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] * (SRCB)[1]; \ + (DST)[2] = (SRCA)[2] * (SRCB)[2]; \ + (DST)[3] = (SRCA)[3] * (SRCB)[3]; \ +} while (0) + +/** In-place addition */ +#define ACC_4V( DST, SRC ) \ +do { \ + (DST)[0] += (SRC)[0]; \ + (DST)[1] += (SRC)[1]; \ + (DST)[2] += (SRC)[2]; \ + (DST)[3] += (SRC)[3]; \ +} while (0) + +/** Element-wise multiplication and addition */ +#define ACC_SCALE_4V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] += (SRCA)[0] * (SRCB)[0]; \ + (DST)[1] += (SRCA)[1] * (SRCB)[1]; \ + (DST)[2] += (SRCA)[2] * (SRCB)[2]; \ + (DST)[3] += (SRCA)[3] * (SRCB)[3]; \ +} while (0) + +/** In-place scalar multiplication and addition */ +#define ACC_SCALE_SCALAR_4V( DST, S, SRCB ) \ +do { \ + (DST)[0] += S * (SRCB)[0]; \ + (DST)[1] += S * (SRCB)[1]; \ + (DST)[2] += S * (SRCB)[2]; \ + (DST)[3] += S * (SRCB)[3]; \ +} while (0) + +/** Scalar multiplication */ +#define SCALE_SCALAR_4V( DST, S, SRCB ) \ +do { \ + (DST)[0] = S * (SRCB)[0]; \ + (DST)[1] = S * (SRCB)[1]; \ + (DST)[2] = S * (SRCB)[2]; \ + (DST)[3] = S * (SRCB)[3]; \ +} while (0) + +/** In-place scalar multiplication */ +#define SELF_SCALE_SCALAR_4V( DST, S ) \ +do { \ + (DST)[0] *= S; \ + (DST)[1] *= S; \ + (DST)[2] *= S; \ + (DST)[3] *= S; \ +} while (0) + +/** Assignment */ +#define ASSIGN_4V( V, V0, V1, V2, V3 ) \ +do { \ + V[0] = V0; \ + V[1] = V1; \ + V[2] = V2; \ + V[3] = V3; \ +} while(0) + +/*@}*/ + + +/**********************************************************************/ +/** \name 3-element vector operations*/ +/*@{*/ + +/** Zero */ +#define ZERO_3V( DST ) (DST)[0] = (DST)[1] = (DST)[2] = 0 + +/** Test for equality */ +#define TEST_EQ_3V(a,b) \ + ((a)[0] == (b)[0] && \ + (a)[1] == (b)[1] && \ + (a)[2] == (b)[2]) + +/** Copy a 3-element vector */ +#define COPY_3V( DST, SRC ) \ +do { \ + (DST)[0] = (SRC)[0]; \ + (DST)[1] = (SRC)[1]; \ + (DST)[2] = (SRC)[2]; \ +} while (0) + +/** Copy a 3-element vector with cast */ +#define COPY_3V_CAST( DST, SRC, CAST ) \ +do { \ + (DST)[0] = (CAST)(SRC)[0]; \ + (DST)[1] = (CAST)(SRC)[1]; \ + (DST)[2] = (CAST)(SRC)[2]; \ +} while (0) + +/** Copy a 3-element float vector */ +#define COPY_3FV( DST, SRC ) \ +do { \ + const GLfloat *_tmp = (SRC); \ + (DST)[0] = _tmp[0]; \ + (DST)[1] = _tmp[1]; \ + (DST)[2] = _tmp[2]; \ +} while (0) + +/** Subtraction */ +#define SUB_3V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] - (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] - (SRCB)[1]; \ + (DST)[2] = (SRCA)[2] - (SRCB)[2]; \ +} while (0) + +/** Addition */ +#define ADD_3V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] + (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] + (SRCB)[1]; \ + (DST)[2] = (SRCA)[2] + (SRCB)[2]; \ +} while (0) + +/** In-place scalar multiplication */ +#define SCALE_3V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] * (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] * (SRCB)[1]; \ + (DST)[2] = (SRCA)[2] * (SRCB)[2]; \ +} while (0) + +/** In-place element-wise multiplication */ +#define SELF_SCALE_3V( DST, SRC ) \ +do { \ + (DST)[0] *= (SRC)[0]; \ + (DST)[1] *= (SRC)[1]; \ + (DST)[2] *= (SRC)[2]; \ +} while (0) + +/** In-place addition */ +#define ACC_3V( DST, SRC ) \ +do { \ + (DST)[0] += (SRC)[0]; \ + (DST)[1] += (SRC)[1]; \ + (DST)[2] += (SRC)[2]; \ +} while (0) + +/** Element-wise multiplication and addition */ +#define ACC_SCALE_3V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] += (SRCA)[0] * (SRCB)[0]; \ + (DST)[1] += (SRCA)[1] * (SRCB)[1]; \ + (DST)[2] += (SRCA)[2] * (SRCB)[2]; \ +} while (0) + +/** Scalar multiplication */ +#define SCALE_SCALAR_3V( DST, S, SRCB ) \ +do { \ + (DST)[0] = S * (SRCB)[0]; \ + (DST)[1] = S * (SRCB)[1]; \ + (DST)[2] = S * (SRCB)[2]; \ +} while (0) + +/** In-place scalar multiplication and addition */ +#define ACC_SCALE_SCALAR_3V( DST, S, SRCB ) \ +do { \ + (DST)[0] += S * (SRCB)[0]; \ + (DST)[1] += S * (SRCB)[1]; \ + (DST)[2] += S * (SRCB)[2]; \ +} while (0) + +/** In-place scalar multiplication */ +#define SELF_SCALE_SCALAR_3V( DST, S ) \ +do { \ + (DST)[0] *= S; \ + (DST)[1] *= S; \ + (DST)[2] *= S; \ +} while (0) + +/** In-place scalar addition */ +#define ACC_SCALAR_3V( DST, S ) \ +do { \ + (DST)[0] += S; \ + (DST)[1] += S; \ + (DST)[2] += S; \ +} while (0) + +/** Assignment */ +#define ASSIGN_3V( V, V0, V1, V2 ) \ +do { \ + V[0] = V0; \ + V[1] = V1; \ + V[2] = V2; \ +} while(0) + +/*@}*/ + + +/**********************************************************************/ +/** \name 2-element vector operations*/ +/*@{*/ + +/** Zero */ +#define ZERO_2V( DST ) (DST)[0] = (DST)[1] = 0 + +/** Copy a 2-element vector */ +#define COPY_2V( DST, SRC ) \ +do { \ + (DST)[0] = (SRC)[0]; \ + (DST)[1] = (SRC)[1]; \ +} while (0) + +/** Copy a 2-element vector with cast */ +#define COPY_2V_CAST( DST, SRC, CAST ) \ +do { \ + (DST)[0] = (CAST)(SRC)[0]; \ + (DST)[1] = (CAST)(SRC)[1]; \ +} while (0) + +/** Copy a 2-element float vector */ +#define COPY_2FV( DST, SRC ) \ +do { \ + const GLfloat *_tmp = (SRC); \ + (DST)[0] = _tmp[0]; \ + (DST)[1] = _tmp[1]; \ +} while (0) + +/** Subtraction */ +#define SUB_2V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] - (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] - (SRCB)[1]; \ +} while (0) + +/** Addition */ +#define ADD_2V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] + (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] + (SRCB)[1]; \ +} while (0) + +/** In-place scalar multiplication */ +#define SCALE_2V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] = (SRCA)[0] * (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] * (SRCB)[1]; \ +} while (0) + +/** In-place addition */ +#define ACC_2V( DST, SRC ) \ +do { \ + (DST)[0] += (SRC)[0]; \ + (DST)[1] += (SRC)[1]; \ +} while (0) + +/** Element-wise multiplication and addition */ +#define ACC_SCALE_2V( DST, SRCA, SRCB ) \ +do { \ + (DST)[0] += (SRCA)[0] * (SRCB)[0]; \ + (DST)[1] += (SRCA)[1] * (SRCB)[1]; \ +} while (0) + +/** Scalar multiplication */ +#define SCALE_SCALAR_2V( DST, S, SRCB ) \ +do { \ + (DST)[0] = S * (SRCB)[0]; \ + (DST)[1] = S * (SRCB)[1]; \ +} while (0) + +/** In-place scalar multiplication and addition */ +#define ACC_SCALE_SCALAR_2V( DST, S, SRCB ) \ +do { \ + (DST)[0] += S * (SRCB)[0]; \ + (DST)[1] += S * (SRCB)[1]; \ +} while (0) + +/** In-place scalar multiplication */ +#define SELF_SCALE_SCALAR_2V( DST, S ) \ +do { \ + (DST)[0] *= S; \ + (DST)[1] *= S; \ +} while (0) + +/** In-place scalar addition */ +#define ACC_SCALAR_2V( DST, S ) \ +do { \ + (DST)[0] += S; \ + (DST)[1] += S; \ +} while (0) + + + +/** + * Linear interpolation + * + * \note \p OUT argument is evaluated twice! + * \note Be wary of using *coord++ as an argument to any of these macros! + */ +#define LINTERP(T, OUT, IN) ((OUT) + (T) * ((IN) - (OUT))) + +/* Can do better with integer math + */ +#define INTERP_UB( t, dstub, outub, inub ) \ +do { \ + GLfloat inf = UBYTE_TO_FLOAT( inub ); \ + GLfloat outf = UBYTE_TO_FLOAT( outub ); \ + GLfloat dstf = LINTERP( t, outf, inf ); \ + UNCLAMPED_FLOAT_TO_UBYTE( dstub, dstf ); \ +} while (0) + +#define INTERP_CHAN( t, dstc, outc, inc ) \ +do { \ + GLfloat inf = CHAN_TO_FLOAT( inc ); \ + GLfloat outf = CHAN_TO_FLOAT( outc ); \ + GLfloat dstf = LINTERP( t, outf, inf ); \ + UNCLAMPED_FLOAT_TO_CHAN( dstc, dstf ); \ +} while (0) + +#define INTERP_UI( t, dstui, outui, inui ) \ + dstui = (GLuint) (GLint) LINTERP( (t), (GLfloat) (outui), (GLfloat) (inui) ) + +#define INTERP_F( t, dstf, outf, inf ) \ + dstf = LINTERP( t, outf, inf ) + +#define INTERP_4F( t, dst, out, in ) \ +do { \ + dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \ + dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \ + dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \ + dst[3] = LINTERP( (t), (out)[3], (in)[3] ); \ +} while (0) + +#define INTERP_3F( t, dst, out, in ) \ +do { \ + dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \ + dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \ + dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \ +} while (0) + +#define INTERP_4CHAN( t, dst, out, in ) \ +do { \ + INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \ + INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \ + INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \ + INTERP_CHAN( (t), (dst)[3], (out)[3], (in)[3] ); \ +} while (0) + +#define INTERP_3CHAN( t, dst, out, in ) \ +do { \ + INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \ + INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \ + INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \ +} while (0) + +#define INTERP_SZ( t, vec, to, out, in, sz ) \ +do { \ + switch (sz) { \ + case 4: vec[to][3] = LINTERP( (t), (vec)[out][3], (vec)[in][3] ); \ + case 3: vec[to][2] = LINTERP( (t), (vec)[out][2], (vec)[in][2] ); \ + case 2: vec[to][1] = LINTERP( (t), (vec)[out][1], (vec)[in][1] ); \ + case 1: vec[to][0] = LINTERP( (t), (vec)[out][0], (vec)[in][0] ); \ + } \ +} while(0) + + + +/** Assign scalers to short vectors */ +#define ASSIGN_2V( V, V0, V1 ) \ +do { \ + V[0] = V0; \ + V[1] = V1; \ +} while(0) + +/*@}*/ + + + +/** Clamp X to [MIN,MAX] */ +#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) ) + +/** Assign X to CLAMP(X, MIN, MAX) */ +#define CLAMP_SELF(x, mn, mx) \ + ( (x)<(mn) ? ((x) = (mn)) : ((x)>(mx) ? ((x)=(mx)) : (x)) ) + + + +/** Minimum of two values: */ +#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) ) + +/** Maximum of two values: */ +#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) ) + +/** Dot product of two 2-element vectors */ +#define DOT2( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] ) + +/** Dot product of two 3-element vectors */ +#define DOT3( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] + (a)[2]*(b)[2] ) + +/** Dot product of two 4-element vectors */ +#define DOT4( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] + \ + (a)[2]*(b)[2] + (a)[3]*(b)[3] ) + +/** Dot product of two 4-element vectors */ +#define DOT4V(v,a,b,c,d) (v[0]*(a) + v[1]*(b) + v[2]*(c) + v[3]*(d)) + + +/** Cross product of two 3-element vectors */ +#define CROSS3(n, u, v) \ +do { \ + (n)[0] = (u)[1]*(v)[2] - (u)[2]*(v)[1]; \ + (n)[1] = (u)[2]*(v)[0] - (u)[0]*(v)[2]; \ + (n)[2] = (u)[0]*(v)[1] - (u)[1]*(v)[0]; \ +} while (0) + + +/* Normalize a 3-element vector to unit length. */ +#define NORMALIZE_3FV( V ) \ +do { \ + GLfloat len = (GLfloat) LEN_SQUARED_3FV(V); \ + if (len) { \ + len = INV_SQRTF(len); \ + (V)[0] = (GLfloat) ((V)[0] * len); \ + (V)[1] = (GLfloat) ((V)[1] * len); \ + (V)[2] = (GLfloat) ((V)[2] * len); \ + } \ +} while(0) + +#define LEN_3FV( V ) (SQRTF((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2])) +#define LEN_2FV( V ) (SQRTF((V)[0]*(V)[0]+(V)[1]*(V)[1])) + +#define LEN_SQUARED_3FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2]) +#define LEN_SQUARED_2FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1]) + + +#endif diff --git a/reactos/dll/mesa32/src/main/matrix.c b/reactos/dll/mesa32/src/main/matrix.c new file mode 100644 index 00000000000..f4ec9735630 --- /dev/null +++ b/reactos/dll/mesa32/src/main/matrix.c @@ -0,0 +1,943 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 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" +#include "math/m_xform.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 + * __GLcontextRec::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 + * __GLcontextRec::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 + * __GLcontextRec::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: + ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit]; + break; + case GL_COLOR: + ctx->CurrentStack = &ctx->ColorMatrixStack; + 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 __GLcontextRec::NewState with the stack dirty + * flag. + */ +void GLAPIENTRY +_mesa_PushMatrix( void ) +{ + GET_CURRENT_CONTEXT(ctx); + struct 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 __GLcontextRec::NewState with the dirty + * stack flag. + */ +void GLAPIENTRY +_mesa_PopMatrix( void ) +{ + GET_CURRENT_CONTEXT(ctx); + struct 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 __GLcontextRec::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()"); + + _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 __GLcontextRec::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 + * __GLcontextRec::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 + * __GLcontextRec::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 + * __GLcontextRec::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 general scaling 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 + * __GLcontextRec::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 + +/** + * Set the viewport. + * + * \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. + * + * \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. + * + * Verifies the parameters, clamps them to the implementation dependent range + * and updates __GLcontextRec::Viewport. Computes the scale and bias values for + * the drivers and notifies the driver via the dd_function_table::Viewport + * callback. + */ +void +_mesa_set_viewport( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height ) +{ + const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF; + const GLfloat n = ctx->Viewport.Near; + const GLfloat f = ctx->Viewport.Far; + + ASSERT(depthMax > 0); + + 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 implementation dependent range */ + width = CLAMP( width, 1, ctx->Const.MaxViewportWidth ); + height = CLAMP( height, 1, ctx->Const.MaxViewportHeight ); + + /* Save viewport */ + ctx->Viewport.X = x; + ctx->Viewport.Width = width; + ctx->Viewport.Y = y; + ctx->Viewport.Height = height; + + /* XXX send transposed width/height to Driver.Viewport() below??? */ + if (ctx->_RotateMode) { + GLint tmp, tmps; + tmp = x; x = y; y = tmp; + tmps = width; width = height; height = tmps; + } + + /* 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, x, y, width, height, + n, f, depthMax); + + ctx->NewState |= _NEW_VIEWPORT; + + 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 ); + } +} + + +#if _HAVE_FULL_GL +void GLAPIENTRY +_mesa_DepthRange( GLclampd nearval, GLclampd farval ) +{ + /* + * nearval - specifies mapping of the near clipping plane to window + * coordinates, default is 0 + * farval - specifies mapping of the far clipping plane to window + * coordinates, default is 1 + * + * After clipping and div by w, z coords are in -1.0 to 1.0, + * corresponding to near and far clipping planes. glDepthRange + * specifies a linear mapping of the normalized z coords in + * this range to window z coords. + */ + GLfloat depthMax; + GLfloat n, f; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + depthMax = ctx->DrawBuffer->_DepthMaxF; + + if (MESA_VERBOSE&VERBOSE_API) + _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval); + + n = (GLfloat) CLAMP( nearval, 0.0, 1.0 ); + f = (GLfloat) CLAMP( farval, 0.0, 1.0 ); + + ctx->Viewport.Near = n; + ctx->Viewport.Far = f; + ctx->Viewport._WindowMap.m[MAT_SZ] = depthMax * ((f - n) / 2.0F); + ctx->Viewport._WindowMap.m[MAT_TZ] = depthMax * ((f - n) / 2.0F + n); + ctx->NewState |= _NEW_VIEWPORT; + + if (ctx->Driver.DepthRange) { + (*ctx->Driver.DepthRange)( ctx, nearval, farval ); + } +} +#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 __GLcontextRec::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 __GLcontextRec::Transform attributes. + */ +static void +update_projection( GLcontext *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 + * __GLcontextRec::_ModelProjectMatrix via _math_matrix_mul_matrix() and + * analyzes the resulting matrix via _math_matrix_analyse(). + */ +static void +calculate_model_project_matrix( GLcontext *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( GLcontext *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 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 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( GLcontext * 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); + init_matrix_stack(&ctx->ColorMatrixStack, MAX_COLOR_STACK_DEPTH, + _NEW_COLOR_MATRIX); + for (i = 0; i < MAX_TEXTURE_UNITS; i++) + init_matrix_stack(&ctx->TextureMatrixStack[i], MAX_TEXTURE_STACK_DEPTH, + _NEW_TEXTURE_MATRIX); + for (i = 0; i < MAX_PROGRAM_MATRICES; 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( GLcontext *ctx ) +{ + GLint i; + + free_matrix_stack(&ctx->ModelviewMatrixStack); + free_matrix_stack(&ctx->ProjectionMatrixStack); + free_matrix_stack(&ctx->ColorMatrixStack); + for (i = 0; i < MAX_TEXTURE_UNITS; i++) + free_matrix_stack(&ctx->TextureMatrixStack[i]); + for (i = 0; i < MAX_PROGRAM_MATRICES; 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( GLcontext *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;iTransform.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 ); +} + + +/** + * Initialize the context viewport attribute group. + * + * \param ctx GL context. + * + * \todo Move this to a new file with other 'viewport' routines. + */ +void _mesa_init_viewport( GLcontext *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 GL context. + * + * \todo Move this to a new file with other 'viewport' routines. + */ +void _mesa_free_viewport_data( GLcontext *ctx ) +{ + _math_matrix_dtr(&ctx->Viewport._WindowMap); +} + +/*@}*/ diff --git a/reactos/dll/mesa32/src/main/matrix.h b/reactos/dll/mesa32/src/main/matrix.h new file mode 100644 index 00000000000..38769867a75 --- /dev/null +++ b/reactos/dll/mesa32/src/main/matrix.h @@ -0,0 +1,131 @@ +/** + * \file matrix.h + * Matrix operations. + */ + +/* + * 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 MATRIX_H +#define MATRIX_H + + +#include "mtypes.h" + + +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 GLAPIENTRY +_mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ); + +extern void +_mesa_set_viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ); + +extern void GLAPIENTRY +_mesa_DepthRange( GLclampd nearval, GLclampd farval ); + + +extern void +_mesa_init_matrix( GLcontext * ctx ); + +extern void +_mesa_init_transform( GLcontext *ctx ); + +extern void +_mesa_init_viewport( GLcontext *ctx ); + +extern void +_mesa_free_matrix_data( GLcontext *ctx ); + +extern void +_mesa_free_viewport_data( GLcontext *ctx ); + +extern void +_mesa_update_modelview_project( GLcontext *ctx, GLuint newstate ); + + +#endif diff --git a/reactos/dll/mesa32/src/main/mm.c b/reactos/dll/mesa32/src/main/mm.c new file mode 100644 index 00000000000..e4c96821732 --- /dev/null +++ b/reactos/dll/mesa32/src/main/mm.c @@ -0,0 +1,220 @@ +/* + * 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 "mm.h" + + +void +mmDumpMemInfo(const memHeap_t *heap) +{ + const TMemBlock *p; + + fprintf(stderr, "Memory heap %p:\n", (void *)heap); + if (heap == 0) { + fprintf(stderr, " heap == 0\n"); + } else { + p = (TMemBlock *)heap; + while (p) { + fprintf(stderr, " Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size, + p->free ? '.':'U', + p->reserved ? 'R':'.'); + p = p->next; + } + } + fprintf(stderr, "End of memory blocks\n"); +} + +memHeap_t * +mmInit(int ofs, int size) +{ + PMemBlock blocks; + + if (size <= 0) { + return NULL; + } + blocks = (TMemBlock *) _mesa_calloc(sizeof(TMemBlock)); + if (blocks) { + blocks->ofs = ofs; + blocks->size = size; + blocks->free = 1; + return (memHeap_t *)blocks; + } + else { + return NULL; + } +} + + +static TMemBlock * +SliceBlock(TMemBlock *p, + int startofs, int size, + int reserved, int alignment) +{ + TMemBlock *newblock; + + /* break left */ + if (startofs > p->ofs) { + newblock = (TMemBlock*) _mesa_calloc(sizeof(TMemBlock)); + if (!newblock) + return NULL; + newblock->ofs = startofs; + newblock->size = p->size - (startofs - p->ofs); + newblock->free = 1; + newblock->next = p->next; + p->size -= newblock->size; + p->next = newblock; + p = newblock; + } + + /* break right */ + if (size < p->size) { + newblock = (TMemBlock*) _mesa_calloc(sizeof(TMemBlock)); + if (!newblock) + return NULL; + newblock->ofs = startofs + size; + newblock->size = p->size - size; + newblock->free = 1; + newblock->next = p->next; + p->size = size; + p->next = newblock; + } + + /* p = middle block */ + p->align = alignment; + p->free = 0; + p->reserved = reserved; + return p; +} + + +PMemBlock +mmAllocMem(memHeap_t *heap, int size, int align2, int startSearch) +{ + int mask,startofs,endofs; + TMemBlock *p; + + if (!heap || align2 < 0 || size <= 0) + return NULL; + mask = (1 << align2)-1; + startofs = 0; + p = (TMemBlock *)heap; + while (p) { + if ((p)->free) { + startofs = (p->ofs + mask) & ~mask; + if ( startofs < startSearch ) { + startofs = startSearch; + } + endofs = startofs+size; + if (endofs <= (p->ofs+p->size)) + break; + } + p = p->next; + } + if (!p) + return NULL; + p = SliceBlock(p,startofs,size,0,mask+1); + p->heap = heap; + return p; +} + + +PMemBlock +mmFindBlock(memHeap_t *heap, int start) +{ + TMemBlock *p = (TMemBlock *)heap; + + while (p) { + if (p->ofs == start && p->free) + return p; + + p = p->next; + } + + return NULL; +} + + +static INLINE int +Join2Blocks(TMemBlock *p) +{ + /* XXX there should be some assertions here */ + if (p->free && p->next && p->next->free) { + TMemBlock *q = p->next; + p->size += q->size; + p->next = q->next; + _mesa_free(q); + return 1; + } + return 0; +} + +int +mmFreeMem(PMemBlock b) +{ + TMemBlock *p,*prev; + + if (!b) + return 0; + if (!b->heap) { + fprintf(stderr, "no heap\n"); + return -1; + } + p = b->heap; + prev = NULL; + while (p && p != b) { + prev = p; + p = p->next; + } + if (!p || p->free || p->reserved) { + if (!p) + fprintf(stderr, "block not found in heap\n"); + else if (p->free) + fprintf(stderr, "block already free\n"); + else + fprintf(stderr, "block is reserved\n"); + return -1; + } + p->free = 1; + Join2Blocks(p); + if (prev) + Join2Blocks(prev); + return 0; +} + + +void +mmDestroy(memHeap_t *heap) +{ + TMemBlock *p; + + if (!heap) + return; + + p = (TMemBlock *) heap; + while (p) { + TMemBlock *next = p->next; + _mesa_free(p); + p = next; + } +} diff --git a/reactos/dll/mesa32/src/main/mm.h b/reactos/dll/mesa32/src/main/mm.h new file mode 100644 index 00000000000..33c986b4c7d --- /dev/null +++ b/reactos/dll/mesa32/src/main/mm.h @@ -0,0 +1,115 @@ +/* + * GLX Hardware Device Driver common code + * Copyright (C) 1999 Keith Whitwell + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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 + + +#include "imports.h" + + +struct mem_block_t { + struct mem_block_t *next; + struct mem_block_t *heap; + int ofs,size; + int align; + unsigned int free:1; + unsigned int reserved:1; +}; + +typedef struct mem_block_t TMemBlock; + +typedef struct mem_block_t *PMemBlock; + +/* a heap is just the first block in a chain */ +typedef struct mem_block_t memHeap_t; + + +/* XXX are these needed? */ +#if 0 +static INLINE int +mmBlockSize(PMemBlock b) +{ + return b->size; +} + +static INLINE int +mmOffset(PMemBlock b) +{ + return b->ofs; +} +#endif + + + +/** + * input: total size in bytes + * return: a heap pointer if OK, NULL if error + */ +extern memHeap_t *mmInit(int ofs, int 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 PMemBlock mmAllocMem(memHeap_t *heap, int size, int align2, + int startSearch); + +/** + * Free block starts at offset + * input: pointer to a block + * return: 0 if OK, -1 if error + */ +extern int mmFreeMem(PMemBlock b); + +/** + * Free block starts at offset + * input: pointer to a heap, start offset + * return: pointer to a block + */ +extern PMemBlock mmFindBlock(memHeap_t *heap, int start); + +/** + * destroy MM + */ +extern void mmDestroy(memHeap_t *mmInit); + +/** + * For debuging purpose. + */ +extern void mmDumpMemInfo(const memHeap_t *mmInit); + +#endif diff --git a/reactos/dll/mesa32/src/main/mtypes.h b/reactos/dll/mesa32/src/main/mtypes.h new file mode 100644 index 00000000000..2a0bbd94211 --- /dev/null +++ b/reactos/dll/mesa32/src/main/mtypes.h @@ -0,0 +1,2930 @@ +/** + * \file mtypes.h + * Main Mesa data structures. + * + * Please try to mark derived values with a leading underscore ('_'). + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 TYPES_H +#define TYPES_H + + +#include "glheader.h" +#include "config.h" /* Hardwired parameters */ +#include "glapitable.h" +#include "glthread.h" +#include "math/m_matrix.h" /* GLmatrix */ + + +/** + * Color channel data type. + */ +#if CHAN_BITS == 8 + typedef GLubyte GLchan; +#define CHAN_MAX 255 +#define CHAN_MAXF 255.0F +#define CHAN_TYPE GL_UNSIGNED_BYTE +#elif CHAN_BITS == 16 + typedef GLushort GLchan; +#define CHAN_MAX 65535 +#define CHAN_MAXF 65535.0F +#define CHAN_TYPE GL_UNSIGNED_SHORT +#elif CHAN_BITS == 32 + typedef GLfloat GLchan; +#define CHAN_MAX 1.0 +#define CHAN_MAXF 1.0F +#define CHAN_TYPE GL_FLOAT +#else +#error "illegal number of color channel bits" +#endif + + +#if ACCUM_BITS != 16 +/* Software accum done with GLshort at this time */ +# error "illegal number of accumulation bits" +#endif + + +/** + * Stencil buffer data type. + */ +#if STENCIL_BITS==8 + typedef GLubyte GLstencil; +# define STENCIL_MAX 0xff +#elif STENCIL_BITS==16 + typedef GLushort GLstencil; +# define STENCIL_MAX 0xffff +#else +# error "illegal number of stencil bits" +#endif + + +/** + * Used for storing intermediate depth buffer values. + * The actual depth/Z buffer might use 16 or 32-bit values. + * + * \note Must be 32-bits! + */ +typedef GLuint GLdepth; + + +/** + * Fixed point data type. + */ +typedef int GLfixed; +/* + * Fixed point arithmetic macros + */ +#ifndef FIXED_FRAC_BITS +#define FIXED_FRAC_BITS 11 +#endif + +#define FIXED_SHIFT FIXED_FRAC_BITS +#define FIXED_ONE (1 << FIXED_SHIFT) +#define FIXED_HALF (1 << (FIXED_SHIFT-1)) +#define FIXED_FRAC_MASK (FIXED_ONE - 1) +#define FIXED_INT_MASK (~FIXED_FRAC_MASK) +#define FIXED_EPSILON 1 +#define FIXED_SCALE ((float) FIXED_ONE) +#define FIXED_DBL_SCALE ((double) FIXED_ONE) +#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE)) +#define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE)) +#define IntToFixed(I) ((I) << FIXED_SHIFT) +#define FixedToInt(X) ((X) >> FIXED_SHIFT) +#define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT) +#define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK) +#define FixedFloor(X) ((X) & FIXED_INT_MASK) +#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE)) +#define PosFloatToFixed(X) FloatToFixed(X) +#define SignedFloatToFixed(X) FloatToFixed(X) + + + +/** + * \name Some forward type declarations + */ +/*@{*/ +struct _mesa_HashTable; +struct gl_pixelstore_attrib; +struct gl_texture_format; +struct gl_texture_image; +struct gl_texture_object; +typedef struct __GLcontextRec GLcontext; +typedef struct __GLcontextModesRec GLvisual; +typedef struct gl_framebuffer GLframebuffer; +/*@}*/ + + + +/** + * Indexes for vertex program attributes. + * GL_NV_vertex_program aliases generic attributes over the conventional + * attributes. In GL_ARB_vertex_program shader the aliasing is optional. + * In GL_ARB_vertex_shader / OpenGL 2.0 the aliasing is disallowed (the + * generic attributes are distinct/separate). + */ +enum +{ + VERT_ATTRIB_POS = 0, + VERT_ATTRIB_WEIGHT = 1, + VERT_ATTRIB_NORMAL = 2, + VERT_ATTRIB_COLOR0 = 3, + VERT_ATTRIB_COLOR1 = 4, + VERT_ATTRIB_FOG = 5, + VERT_ATTRIB_SIX = 6, + VERT_ATTRIB_SEVEN = 7, + VERT_ATTRIB_TEX0 = 8, + VERT_ATTRIB_TEX1 = 9, + VERT_ATTRIB_TEX2 = 10, + VERT_ATTRIB_TEX3 = 11, + VERT_ATTRIB_TEX4 = 12, + VERT_ATTRIB_TEX5 = 13, + VERT_ATTRIB_TEX6 = 14, + VERT_ATTRIB_TEX7 = 15, + VERT_ATTRIB_GENERIC0 = 16, + VERT_ATTRIB_GENERIC1 = 17, + VERT_ATTRIB_GENERIC2 = 18, + VERT_ATTRIB_GENERIC3 = 19, + VERT_ATTRIB_MAX = 16 +}; + +/** + * Bitflags for vertex attributes. + * These are used in bitfields in many places. + */ +/*@{*/ +#define VERT_BIT_POS (1 << VERT_ATTRIB_POS) +#define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT) +#define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL) +#define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0) +#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1) +#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG) +#define VERT_BIT_SIX (1 << VERT_ATTRIB_SIX) +#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN) +#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0) +#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1) +#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2) +#define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3) +#define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4) +#define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5) +#define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6) +#define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7) +#define VERT_BIT_GENERIC0 (1 << VERT_ATTRIB_GENERIC0) +#define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1) +#define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2) +#define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3) + +#define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u))) +#define VERT_BIT_GENERIC(g) (1 << (VERT_ATTRIB_GENERIC0 + (g))) +/*@}*/ + + +/** + * Indexes for vertex program result attributes + */ +#define VERT_RESULT_HPOS 0 +#define VERT_RESULT_COL0 1 +#define VERT_RESULT_COL1 2 +#define VERT_RESULT_BFC0 3 +#define VERT_RESULT_BFC1 4 +#define VERT_RESULT_FOGC 5 +#define VERT_RESULT_PSIZ 6 +#define VERT_RESULT_TEX0 7 +#define VERT_RESULT_TEX1 8 +#define VERT_RESULT_TEX2 9 +#define VERT_RESULT_TEX3 10 +#define VERT_RESULT_TEX4 11 +#define VERT_RESULT_TEX5 12 +#define VERT_RESULT_TEX6 13 +#define VERT_RESULT_TEX7 14 +#define VERT_RESULT_MAX 15 + + +/** + * Indexes for fragment program input attributes. + */ +enum +{ + FRAG_ATTRIB_WPOS = 0, + FRAG_ATTRIB_COL0 = 1, + FRAG_ATTRIB_COL1 = 2, + FRAG_ATTRIB_FOGC = 3, + FRAG_ATTRIB_TEX0 = 4, + FRAG_ATTRIB_TEX1 = 5, + FRAG_ATTRIB_TEX2 = 6, + FRAG_ATTRIB_TEX3 = 7, + FRAG_ATTRIB_TEX4 = 8, + FRAG_ATTRIB_TEX5 = 9, + FRAG_ATTRIB_TEX6 = 10, + FRAG_ATTRIB_TEX7 = 11 +}; + +/* + * Bitflags for fragment attributes. + */ +/*@{*/ +#define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS) +#define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0) +#define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1) +#define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC) +#define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0) +#define FRAG_BIT_TEX1 (1 << FRAG_ATTRIB_TEX1) +#define FRAG_BIT_TEX2 (1 << FRAG_ATTRIB_TEX2) +#define FRAG_BIT_TEX3 (1 << FRAG_ATTRIB_TEX3) +#define FRAG_BIT_TEX4 (1 << FRAG_ATTRIB_TEX4) +#define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5) +#define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6) +#define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7) + +#define FRAG_BITS_TEX_ANY (FRAG_BIT_TEX0| \ + FRAG_BIT_TEX1| \ + FRAG_BIT_TEX2| \ + FRAG_BIT_TEX3| \ + FRAG_BIT_TEX4| \ + FRAG_BIT_TEX5| \ + FRAG_BIT_TEX6| \ + FRAG_BIT_TEX7) +/*@}*/ + + +/** + * Indexes for all renderbuffers + */ +enum { + BUFFER_FRONT_LEFT = 0, /* the four standard color buffers */ + BUFFER_BACK_LEFT = 1, + BUFFER_FRONT_RIGHT = 2, + BUFFER_BACK_RIGHT = 3, + BUFFER_AUX0 = 4, /* optional aux buffer */ + BUFFER_AUX1 = 5, + BUFFER_AUX2 = 6, + BUFFER_AUX3 = 7, + BUFFER_DEPTH = 8, + BUFFER_STENCIL = 9, + BUFFER_ACCUM = 10, + BUFFER_COLOR0 = 11, /* generic renderbuffers */ + BUFFER_COLOR1 = 12, + BUFFER_COLOR2 = 13, + BUFFER_COLOR3 = 14, + BUFFER_COLOR4 = 15, + BUFFER_COLOR5 = 16, + BUFFER_COLOR6 = 17, + BUFFER_COLOR7 = 18, + BUFFER_COUNT = 19 +}; + +/** + * Bit flags for all renderbuffers + */ +#define BUFFER_BIT_FRONT_LEFT (1 << BUFFER_FRONT_LEFT) +#define BUFFER_BIT_BACK_LEFT (1 << BUFFER_BACK_LEFT) +#define BUFFER_BIT_FRONT_RIGHT (1 << BUFFER_FRONT_RIGHT) +#define BUFFER_BIT_BACK_RIGHT (1 << BUFFER_BACK_RIGHT) +#define BUFFER_BIT_AUX0 (1 << BUFFER_AUX0) +#define BUFFER_BIT_AUX1 (1 << BUFFER_AUX1) +#define BUFFER_BIT_AUX2 (1 << BUFFER_AUX2) +#define BUFFER_BIT_AUX3 (1 << BUFFER_AUX3) +#define BUFFER_BIT_DEPTH (1 << BUFFER_DEPTH) +#define BUFFER_BIT_STENCIL (1 << BUFFER_STENCIL) +#define BUFFER_BIT_ACCUM (1 << BUFFER_ACCUM) +#define BUFFER_BIT_COLOR0 (1 << BUFFER_COLOR0) +#define BUFFER_BIT_COLOR1 (1 << BUFFER_COLOR1) +#define BUFFER_BIT_COLOR2 (1 << BUFFER_COLOR2) +#define BUFFER_BIT_COLOR3 (1 << BUFFER_COLOR3) +#define BUFFER_BIT_COLOR4 (1 << BUFFER_COLOR4) +#define BUFFER_BIT_COLOR5 (1 << BUFFER_COLOR5) +#define BUFFER_BIT_COLOR6 (1 << BUFFER_COLOR6) +#define BUFFER_BIT_COLOR7 (1 << BUFFER_COLOR7) + + +/** + * Data structure for color tables + */ +struct gl_color_table +{ + GLenum Format; /**< GL_ALPHA, GL_RGB, GL_RGB, etc */ + GLenum IntFormat; + GLuint Size; /**< number of entries (rows) in table */ + GLvoid *Table; /**< points to data of */ + GLenum Type; /**< GL_UNSIGNED_BYTE or GL_FLOAT */ + GLubyte RedSize; + GLubyte GreenSize; + GLubyte BlueSize; + GLubyte AlphaSize; + GLubyte LuminanceSize; + GLubyte IntensitySize; +}; + + +/** + * \name Bit flags used for updating material values. + */ +/*@{*/ +#define MAT_ATTRIB_FRONT_AMBIENT 0 +#define MAT_ATTRIB_BACK_AMBIENT 1 +#define MAT_ATTRIB_FRONT_DIFFUSE 2 +#define MAT_ATTRIB_BACK_DIFFUSE 3 +#define MAT_ATTRIB_FRONT_SPECULAR 4 +#define MAT_ATTRIB_BACK_SPECULAR 5 +#define MAT_ATTRIB_FRONT_EMISSION 6 +#define MAT_ATTRIB_BACK_EMISSION 7 +#define MAT_ATTRIB_FRONT_SHININESS 8 +#define MAT_ATTRIB_BACK_SHININESS 9 +#define MAT_ATTRIB_FRONT_INDEXES 10 +#define MAT_ATTRIB_BACK_INDEXES 11 +#define MAT_ATTRIB_MAX 12 + +#define MAT_ATTRIB_AMBIENT(f) (MAT_ATTRIB_FRONT_AMBIENT+(f)) +#define MAT_ATTRIB_DIFFUSE(f) (MAT_ATTRIB_FRONT_DIFFUSE+(f)) +#define MAT_ATTRIB_SPECULAR(f) (MAT_ATTRIB_FRONT_SPECULAR+(f)) +#define MAT_ATTRIB_EMISSION(f) (MAT_ATTRIB_FRONT_EMISSION+(f)) +#define MAT_ATTRIB_SHININESS(f)(MAT_ATTRIB_FRONT_SHININESS+(f)) +#define MAT_ATTRIB_INDEXES(f) (MAT_ATTRIB_FRONT_INDEXES+(f)) + +#define MAT_INDEX_AMBIENT 0 +#define MAT_INDEX_DIFFUSE 1 +#define MAT_INDEX_SPECULAR 2 + +#define MAT_BIT_FRONT_AMBIENT (1< ) */ + GLfloat _NormDirection[4]; /**< normalized spotlight direction */ + GLfloat _VP_inf_spot_attenuation; + + GLfloat _SpotExpTable[EXP_TABLE_SIZE][2]; /**< to replace a pow() call */ + GLfloat _MatAmbient[2][3]; /**< material ambient * light ambient */ + GLfloat _MatDiffuse[2][3]; /**< material diffuse * light diffuse */ + GLfloat _MatSpecular[2][3]; /**< material spec * light specular */ + GLfloat _dli; /**< CI diffuse light intensity */ + GLfloat _sli; /**< CI specular light intensity */ + /*@}*/ +}; + + +/** + * Light model state. + */ +struct gl_lightmodel +{ + GLfloat Ambient[4]; /**< ambient color */ + GLboolean LocalViewer; /**< Local (or infinite) view point? */ + GLboolean TwoSide; /**< Two (or one) sided lighting? */ + GLenum ColorControl; /**< either GL_SINGLE_COLOR + * or GL_SEPARATE_SPECULAR_COLOR */ +}; + + +/** + * Material state. + */ +struct gl_material +{ + GLfloat Attrib[MAT_ATTRIB_MAX][4]; +}; + + +/** + * Accumulation buffer attribute group (GL_ACCUM_BUFFER_BIT) + */ +struct gl_accum_attrib +{ + GLfloat ClearColor[4]; /**< Accumulation buffer clear color */ +}; + + +/** + * Color buffer attribute group (GL_COLOR_BUFFER_BIT). + */ +struct gl_colorbuffer_attrib +{ + GLuint ClearIndex; /**< Index to use for glClear */ + GLclampf ClearColor[4]; /**< Color to use for glClear */ + + GLuint IndexMask; /**< Color index write mask */ + GLubyte ColorMask[4]; /**< Each flag is 0xff or 0x0 */ + + GLenum DrawBuffer[MAX_DRAW_BUFFERS]; /**< Which buffer to draw into */ + + /** + * \name alpha testing + */ + /*@{*/ + GLboolean AlphaEnabled; /**< Alpha test enabled flag */ + GLenum AlphaFunc; /**< Alpha test function */ + GLclampf AlphaRef; /**< Alpha reference value */ + /*@}*/ + + /** + * \name Blending + */ + /*@{*/ + GLboolean BlendEnabled; /**< Blending enabled flag */ + GLenum BlendSrcRGB; /**< Blending source operator */ + GLenum BlendDstRGB; /**< Blending destination operator */ + GLenum BlendSrcA; /**< GL_INGR_blend_func_separate */ + GLenum BlendDstA; /**< GL_INGR_blend_func_separate */ + GLenum BlendEquationRGB; /**< Blending equation */ + GLenum BlendEquationA; /**< GL_EXT_blend_equation_separate */ + GLfloat BlendColor[4]; /**< Blending color */ + /*@}*/ + + /** + * \name Logic op + */ + /*@{*/ + GLenum LogicOp; /**< Logic operator */ + GLboolean IndexLogicOpEnabled; /**< Color index logic op enabled flag */ + GLboolean ColorLogicOpEnabled; /**< RGBA logic op enabled flag */ + GLboolean _LogicOpEnabled; /**< RGBA logic op + EXT_blend_logic_op enabled flag */ + /*@}*/ + + GLboolean DitherFlag; /**< Dither enable flag */ +}; + + +/** + * Current attribute group (GL_CURRENT_BIT). + */ +struct gl_current_attrib +{ + /** + * \name Values valid only when FLUSH_VERTICES has been called. + */ + /*@{*/ + GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Current vertex attributes + * indexed by VERT_ATTRIB_* */ + GLfloat Index; /**< Current color index */ + GLboolean EdgeFlag; /**< Current edge flag */ + /*@}*/ + + /** + * \name Values are always valid. + * + * \note BTW, note how similar this set of attributes is to the SWvertex + * data type in the software rasterizer... + */ + /*@{*/ + GLfloat RasterPos[4]; /**< Current raster position */ + GLfloat RasterDistance; /**< Current raster distance */ + GLfloat RasterColor[4]; /**< Current raster color */ + GLfloat RasterSecondaryColor[4]; /**< Current raster secondary color */ + GLfloat RasterIndex; /**< Current raster index */ + GLfloat RasterTexCoords[MAX_TEXTURE_UNITS][4];/**< Current raster texcoords */ + GLboolean RasterPosValid; /**< Raster pos valid flag */ + /*@}*/ +}; + + +/** + * Depth buffer attribute group (GL_DEPTH_BUFFER_BIT). + */ +struct gl_depthbuffer_attrib +{ + GLenum Func; /**< Function for depth buffer compare */ + GLclampd Clear; /**< Value to clear depth buffer to */ + GLboolean Test; /**< Depth buffering enabled flag */ + GLboolean Mask; /**< Depth buffer writable? */ + GLboolean OcclusionTest; /**< GL_HP_occlusion_test */ + GLboolean BoundsTest; /**< GL_EXT_depth_bounds_test */ + GLfloat BoundsMin, BoundsMax;/**< GL_EXT_depth_bounds_test */ +}; + + +/** + * glEnable()/glDisable() attribute group (GL_ENABLE_BIT). + */ +struct gl_enable_attrib +{ + GLboolean AlphaTest; + GLboolean AutoNormal; + GLboolean Blend; + GLuint ClipPlanes; + GLboolean ColorMaterial; + GLboolean ColorTable; /* SGI_color_table */ + GLboolean PostColorMatrixColorTable; /* SGI_color_table */ + GLboolean PostConvolutionColorTable; /* SGI_color_table */ + GLboolean Convolution1D; + GLboolean Convolution2D; + GLboolean Separable2D; + GLboolean CullFace; + GLboolean DepthTest; + GLboolean Dither; + GLboolean Fog; + GLboolean Histogram; + GLboolean Light[MAX_LIGHTS]; + GLboolean Lighting; + GLboolean LineSmooth; + GLboolean LineStipple; + GLboolean IndexLogicOp; + GLboolean ColorLogicOp; + GLboolean Map1Color4; + GLboolean Map1Index; + GLboolean Map1Normal; + GLboolean Map1TextureCoord1; + GLboolean Map1TextureCoord2; + GLboolean Map1TextureCoord3; + GLboolean Map1TextureCoord4; + GLboolean Map1Vertex3; + GLboolean Map1Vertex4; + GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */ + GLboolean Map2Color4; + GLboolean Map2Index; + GLboolean Map2Normal; + GLboolean Map2TextureCoord1; + GLboolean Map2TextureCoord2; + GLboolean Map2TextureCoord3; + GLboolean Map2TextureCoord4; + GLboolean Map2Vertex3; + GLboolean Map2Vertex4; + GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */ + GLboolean MinMax; + GLboolean Normalize; + GLboolean PixelTexture; + GLboolean PointSmooth; + GLboolean PolygonOffsetPoint; + GLboolean PolygonOffsetLine; + GLboolean PolygonOffsetFill; + GLboolean PolygonSmooth; + GLboolean PolygonStipple; + GLboolean RescaleNormals; + GLboolean Scissor; + GLboolean Stencil; + GLboolean StencilTwoSide; /* GL_EXT_stencil_two_side */ + GLboolean MultisampleEnabled; /* GL_ARB_multisample */ + GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */ + GLboolean SampleAlphaToOne; /* GL_ARB_multisample */ + GLboolean SampleCoverage; /* GL_ARB_multisample */ + GLboolean SampleCoverageInvert; /* GL_ARB_multisample */ + GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */ + GLuint Texture[MAX_TEXTURE_IMAGE_UNITS]; + GLuint TexGen[MAX_TEXTURE_COORD_UNITS]; + /* SGI_texture_color_table */ + GLboolean TextureColorTable[MAX_TEXTURE_IMAGE_UNITS]; + /* GL_NV_vertex_program */ + GLboolean VertexProgram; + GLboolean VertexProgramPointSize; + GLboolean VertexProgramTwoSide; + /* GL_ARB_point_sprite / GL_NV_point_sprite */ + GLboolean PointSprite; + GLboolean FragmentShaderATI; +}; + + +/** + * Evaluator attribute group (GL_EVAL_BIT). + */ +struct gl_eval_attrib +{ + /** + * \name Enable bits + */ + /*@{*/ + GLboolean Map1Color4; + GLboolean Map1Index; + GLboolean Map1Normal; + GLboolean Map1TextureCoord1; + GLboolean Map1TextureCoord2; + GLboolean Map1TextureCoord3; + GLboolean Map1TextureCoord4; + GLboolean Map1Vertex3; + GLboolean Map1Vertex4; + GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */ + GLboolean Map2Color4; + GLboolean Map2Index; + GLboolean Map2Normal; + GLboolean Map2TextureCoord1; + GLboolean Map2TextureCoord2; + GLboolean Map2TextureCoord3; + GLboolean Map2TextureCoord4; + GLboolean Map2Vertex3; + GLboolean Map2Vertex4; + GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */ + GLboolean AutoNormal; + /*@}*/ + + /** + * \name Map Grid endpoints and divisions and calculated du values + */ + /*@{*/ + GLint MapGrid1un; + GLfloat MapGrid1u1, MapGrid1u2, MapGrid1du; + GLint MapGrid2un, MapGrid2vn; + GLfloat MapGrid2u1, MapGrid2u2, MapGrid2du; + GLfloat MapGrid2v1, MapGrid2v2, MapGrid2dv; + /*@}*/ +}; + + +/** + * Fog attribute group (GL_FOG_BIT). + */ +struct gl_fog_attrib +{ + GLboolean Enabled; /**< Fog enabled flag */ + GLfloat Color[4]; /**< Fog color */ + GLfloat Density; /**< Density >= 0.0 */ + GLfloat Start; /**< Start distance in eye coords */ + GLfloat End; /**< End distance in eye coords */ + GLfloat Index; /**< Fog index */ + GLenum Mode; /**< Fog mode */ + GLboolean ColorSumEnabled; + GLenum FogCoordinateSource; /**< GL_EXT_fog_coord */ +}; + + +/** + * Hint attribute group (GL_HINT_BIT). + * + * Values are always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE. + */ +struct gl_hint_attrib +{ + GLenum PerspectiveCorrection; + GLenum PointSmooth; + GLenum LineSmooth; + GLenum PolygonSmooth; + GLenum Fog; + GLenum ClipVolumeClipping; /**< GL_EXT_clip_volume_hint */ + GLenum TextureCompression; /**< GL_ARB_texture_compression */ + GLenum GenerateMipmap; /**< GL_SGIS_generate_mipmap */ + GLenum FragmentShaderDerivative; /**< GL_ARB_fragment_shader */ +}; + + +/** + * Histogram attributes. + */ +struct gl_histogram_attrib +{ + GLuint Width; /**< number of table entries */ + GLint Format; /**< GL_ALPHA, GL_RGB, etc */ + GLuint Count[HISTOGRAM_TABLE_SIZE][4]; /**< the histogram */ + GLboolean Sink; /**< terminate image transfer? */ + GLubyte RedSize; /**< Bits per counter */ + GLubyte GreenSize; + GLubyte BlueSize; + GLubyte AlphaSize; + GLubyte LuminanceSize; +}; + + +/** + * Color Min/max state. + */ +struct gl_minmax_attrib +{ + GLenum Format; + GLboolean Sink; + GLfloat Min[4], Max[4]; /**< RGBA */ +}; + + +/** + * Image convolution state. + */ +struct gl_convolution_attrib +{ + GLenum Format; + GLenum InternalFormat; + GLuint Width; + GLuint Height; + GLfloat Filter[MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_HEIGHT * 4]; +}; + + +/** + * Light state flags. + */ +/*@{*/ +#define LIGHT_SPOT 0x1 +#define LIGHT_LOCAL_VIEWER 0x2 +#define LIGHT_POSITIONAL 0x4 +#define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER) +/*@}*/ + + +/** + * Lighting attribute group (GL_LIGHT_BIT). + */ +struct gl_light_attrib +{ + struct gl_light Light[MAX_LIGHTS]; /**< Array of light sources */ + struct gl_lightmodel Model; /**< Lighting model */ + + /** + * Must flush FLUSH_VERTICES before referencing: + */ + /*@{*/ + struct gl_material Material; /**< Includes front & back values */ + /*@}*/ + + GLboolean Enabled; /**< Lighting enabled flag */ + GLenum ShadeModel; /**< GL_FLAT or GL_SMOOTH */ + GLenum ColorMaterialFace; /**< GL_FRONT, BACK or FRONT_AND_BACK */ + GLenum ColorMaterialMode; /**< GL_AMBIENT, GL_DIFFUSE, etc */ + GLuint ColorMaterialBitmask; /**< bitmask formed from Face and Mode */ + GLboolean ColorMaterialEnabled; + + struct gl_light EnabledList; /**< List sentinel */ + + /** + * Derived state for optimizations: + */ + /*@{*/ + GLboolean _NeedEyeCoords; + GLboolean _NeedVertices; /**< Use fast shader? */ + GLuint _Flags; /**< LIGHT_* flags, see above */ + GLfloat _BaseColor[2][3]; + /*@}*/ +}; + + +/** + * Line attribute group (GL_LINE_BIT). + */ +struct gl_line_attrib +{ + GLboolean SmoothFlag; /**< GL_LINE_SMOOTH enabled? */ + GLboolean StippleFlag; /**< GL_LINE_STIPPLE enabled? */ + GLushort StipplePattern; /**< Stipple pattern */ + GLint StippleFactor; /**< Stipple repeat factor */ + GLfloat Width; /**< Line width */ + GLfloat _Width; /**< Clamped Line width */ +}; + + +/** + * Display list attribute group (GL_LIST_BIT). + */ +struct gl_list_attrib +{ + GLuint ListBase; +}; + + +/** + * Used by device drivers to hook new commands into display lists. + */ +struct gl_list_instruction +{ + GLuint Size; + void (*Execute)( GLcontext *ctx, void *data ); + void (*Destroy)( GLcontext *ctx, void *data ); + void (*Print)( GLcontext *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; +}; + + +/** + * Multisample attribute group (GL_MULTISAMPLE_BIT). + */ +struct gl_multisample_attrib +{ + GLboolean Enabled; + GLboolean SampleAlphaToCoverage; + GLboolean SampleAlphaToOne; + GLboolean SampleCoverage; + GLfloat SampleCoverageValue; + GLboolean SampleCoverageInvert; +}; + + +/** + * Pixel attribute group (GL_PIXEL_MODE_BIT). + */ +struct gl_pixel_attrib +{ + GLenum ReadBuffer; /**< source buffer for glRead/CopyPixels() */ + GLfloat RedBias, RedScale; + GLfloat GreenBias, GreenScale; + GLfloat BlueBias, BlueScale; + GLfloat AlphaBias, AlphaScale; + GLfloat DepthBias, DepthScale; + GLint IndexShift, IndexOffset; + GLboolean MapColorFlag; + GLboolean MapStencilFlag; + GLfloat ZoomX, ZoomY; + /* XXX move these out of gl_pixel_attrib */ + GLint MapStoSsize; /**< Size of each pixel map */ + GLint MapItoIsize; + GLint MapItoRsize; + GLint MapItoGsize; + GLint MapItoBsize; + GLint MapItoAsize; + GLint MapRtoRsize; + GLint MapGtoGsize; + GLint MapBtoBsize; + GLint MapAtoAsize; + GLint MapStoS[MAX_PIXEL_MAP_TABLE]; /**< Pixel map tables */ + GLfloat MapItoI[MAX_PIXEL_MAP_TABLE]; + GLfloat MapItoR[MAX_PIXEL_MAP_TABLE]; + GLfloat MapItoG[MAX_PIXEL_MAP_TABLE]; + GLfloat MapItoB[MAX_PIXEL_MAP_TABLE]; + GLfloat MapItoA[MAX_PIXEL_MAP_TABLE]; + GLubyte MapItoR8[MAX_PIXEL_MAP_TABLE]; /**< converted to 8-bit color */ + GLubyte MapItoG8[MAX_PIXEL_MAP_TABLE]; + GLubyte MapItoB8[MAX_PIXEL_MAP_TABLE]; + GLubyte MapItoA8[MAX_PIXEL_MAP_TABLE]; + GLfloat MapRtoR[MAX_PIXEL_MAP_TABLE]; + GLfloat MapGtoG[MAX_PIXEL_MAP_TABLE]; + GLfloat MapBtoB[MAX_PIXEL_MAP_TABLE]; + GLfloat MapAtoA[MAX_PIXEL_MAP_TABLE]; + /** GL_EXT_histogram */ + GLboolean HistogramEnabled; + GLboolean MinMaxEnabled; + /** GL_SGIS_pixel_texture */ + GLboolean PixelTextureEnabled; + GLenum FragmentRgbSource; + GLenum FragmentAlphaSource; + /** GL_SGI_color_matrix */ + GLfloat PostColorMatrixScale[4]; /**< RGBA */ + GLfloat PostColorMatrixBias[4]; /**< RGBA */ + /** GL_SGI_color_table */ + GLfloat ColorTableScale[4]; + GLfloat ColorTableBias[4]; + GLboolean ColorTableEnabled; + GLfloat PCCTscale[4]; + GLfloat PCCTbias[4]; + GLboolean PostConvolutionColorTableEnabled; + GLfloat PCMCTscale[4]; + GLfloat PCMCTbias[4]; + GLboolean PostColorMatrixColorTableEnabled; + /** GL_SGI_texture_color_table */ + GLfloat TextureColorTableScale[4]; + GLfloat TextureColorTableBias[4]; + /** Convolution */ + GLboolean Convolution1DEnabled; + GLboolean Convolution2DEnabled; + GLboolean Separable2DEnabled; + GLfloat ConvolutionBorderColor[3][4]; + GLenum ConvolutionBorderMode[3]; + GLfloat ConvolutionFilterScale[3][4]; + GLfloat ConvolutionFilterBias[3][4]; + GLfloat PostConvolutionScale[4]; /**< RGBA */ + GLfloat PostConvolutionBias[4]; /**< RGBA */ +}; + + +/** + * Point attribute group (GL_POINT_BIT). + */ +struct gl_point_attrib +{ + GLboolean SmoothFlag; /**< True if GL_POINT_SMOOTH is enabled */ + GLfloat Size; /**< User-specified point size */ + GLfloat _Size; /**< Size clamped to Const.Min/MaxPointSize */ + GLfloat Params[3]; /**< GL_EXT_point_parameters */ + GLfloat MinSize, MaxSize; /**< GL_EXT_point_parameters */ + GLfloat Threshold; /**< GL_EXT_point_parameters */ + GLboolean _Attenuated; /**< True if Params != [1, 0, 0] */ + GLboolean PointSprite; /**< GL_NV_point_sprite / GL_NV_point_sprite */ + GLboolean CoordReplace[MAX_TEXTURE_UNITS]; /**< GL_NV/ARB_point_sprite */ + GLenum SpriteRMode; /**< GL_NV_point_sprite (only!) */ + GLenum SpriteOrigin; /**< GL_ARB_point_sprite */ +}; + + +/** + * Polygon attribute group (GL_POLYGON_BIT). + */ +struct gl_polygon_attrib +{ + GLenum FrontFace; /**< Either GL_CW or GL_CCW */ + GLenum FrontMode; /**< Either GL_POINT, GL_LINE or GL_FILL */ + GLenum BackMode; /**< Either GL_POINT, GL_LINE or GL_FILL */ + GLboolean _FrontBit; /**< 0=GL_CCW, 1=GL_CW */ + GLboolean CullFlag; /**< Culling on/off flag */ + GLboolean SmoothFlag; /**< True if GL_POLYGON_SMOOTH is enabled */ + GLboolean StippleFlag; /**< True if GL_POLYGON_STIPPLE is enabled */ + GLenum CullFaceMode; /**< Culling mode GL_FRONT or GL_BACK */ + GLfloat OffsetFactor; /**< Polygon offset factor, from user */ + GLfloat OffsetUnits; /**< Polygon offset units, from user */ + GLboolean OffsetPoint; /**< Offset in GL_POINT mode */ + GLboolean OffsetLine; /**< Offset in GL_LINE mode */ + GLboolean OffsetFill; /**< Offset in GL_FILL mode */ +}; + + +/** + * Scissor attributes (GL_SCISSOR_BIT). + */ +struct gl_scissor_attrib +{ + GLboolean Enabled; /**< Scissor test enabled? */ + GLint X, Y; /**< Lower left corner of box */ + GLsizei Width, Height; /**< Size of box */ +}; + + +/** + * Stencil attribute group (GL_STENCIL_BUFFER_BIT). + */ +struct gl_stencil_attrib +{ + GLboolean Enabled; /**< Enabled flag */ + GLboolean TestTwoSide; /**< GL_EXT_stencil_two_side */ + GLubyte ActiveFace; /**< GL_EXT_stencil_two_side (0 or 1) */ + GLenum Function[2]; /**< Stencil function */ + GLenum FailFunc[2]; /**< Fail function */ + GLenum ZPassFunc[2]; /**< Depth buffer pass function */ + GLenum ZFailFunc[2]; /**< Depth buffer fail function */ + GLstencil Ref[2]; /**< Reference value */ + GLstencil ValueMask[2]; /**< Value mask */ + GLstencil WriteMask[2]; /**< Write mask */ + GLstencil Clear; /**< Clear value */ +}; + + +#define NUM_TEXTURE_TARGETS 5 /* 1D, 2D, 3D, CUBE and RECT */ + +/** + * An index for each type of texture object + */ +/*@{*/ +#define TEXTURE_1D_INDEX 0 +#define TEXTURE_2D_INDEX 1 +#define TEXTURE_3D_INDEX 2 +#define TEXTURE_CUBE_INDEX 3 +#define TEXTURE_RECT_INDEX 4 +/*@}*/ + +/** + * Bit flags for each type of texture object + * Used for Texture.Unit[]._ReallyEnabled flags. + */ +/*@{*/ +#define TEXTURE_1D_BIT (1 << TEXTURE_1D_INDEX) +#define TEXTURE_2D_BIT (1 << TEXTURE_2D_INDEX) +#define TEXTURE_3D_BIT (1 << TEXTURE_3D_INDEX) +#define TEXTURE_CUBE_BIT (1 << TEXTURE_CUBE_INDEX) +#define TEXTURE_RECT_BIT (1 << TEXTURE_RECT_INDEX) +/*@}*/ + + +/** + * TexGenEnabled flags. + */ +/*@{*/ +#define S_BIT 1 +#define T_BIT 2 +#define R_BIT 4 +#define Q_BIT 8 +/*@}*/ + + +/** + * Bit flag versions of the corresponding GL_ constants. + */ +/*@{*/ +#define TEXGEN_SPHERE_MAP 0x1 +#define TEXGEN_OBJ_LINEAR 0x2 +#define TEXGEN_EYE_LINEAR 0x4 +#define TEXGEN_REFLECTION_MAP_NV 0x8 +#define TEXGEN_NORMAL_MAP_NV 0x10 + +#define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \ + TEXGEN_REFLECTION_MAP_NV | \ + TEXGEN_NORMAL_MAP_NV) +#define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \ + TEXGEN_REFLECTION_MAP_NV | \ + TEXGEN_NORMAL_MAP_NV | \ + TEXGEN_EYE_LINEAR) +/*@}*/ + + +/* A selection of state flags to make driver and module's lives easier. */ +#define ENABLE_TEXGEN0 0x1 +#define ENABLE_TEXGEN1 0x2 +#define ENABLE_TEXGEN2 0x4 +#define ENABLE_TEXGEN3 0x8 +#define ENABLE_TEXGEN4 0x10 +#define ENABLE_TEXGEN5 0x20 +#define ENABLE_TEXGEN6 0x40 +#define ENABLE_TEXGEN7 0x80 + +#define ENABLE_TEXMAT0 0x1 /* Ie. not the identity matrix */ +#define ENABLE_TEXMAT1 0x2 +#define ENABLE_TEXMAT2 0x4 +#define ENABLE_TEXMAT3 0x8 +#define ENABLE_TEXMAT4 0x10 +#define ENABLE_TEXMAT5 0x20 +#define ENABLE_TEXMAT6 0x40 +#define ENABLE_TEXMAT7 0x80 + +#define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i)) +#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i)) + + +/** + * Texel fetch function prototype. We use texel fetch functions to + * extract RGBA, color indexes and depth components out of 1D, 2D and 3D + * texture images. These functions help to isolate us from the gritty + * details of all the various texture image encodings. + * + * \param texImage texture image. + * \param col texel column. + * \param row texel row. + * \param img texel image level/layer. + * \param texelOut output texel (up to 4 GLchans) + */ +typedef void (*FetchTexelFuncC)( const struct gl_texture_image *texImage, + GLint col, GLint row, GLint img, + GLchan *texelOut ); + +/** + * As above, but returns floats. + * Used for depth component images and for upcoming signed/float + * texture images. + */ +typedef void (*FetchTexelFuncF)( const struct gl_texture_image *texImage, + GLint col, GLint row, GLint img, + GLfloat *texelOut ); + + +typedef void (*StoreTexelFunc)(struct gl_texture_image *texImage, + GLint col, GLint row, GLint img, + const void *texel); + +/** + * TexImage store function. This is called by the glTex[Sub]Image + * functions and is responsible for converting the user-specified texture + * image into a specific (hardware) image format. + */ +typedef GLboolean (*StoreTexImageFunc)(GLcontext *ctx, GLuint dims, + GLenum baseInternalFormat, + const struct gl_texture_format *dstFormat, + GLvoid *dstAddr, + GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, + GLint dstRowStride, GLint dstImageStride, + GLint srcWidth, GLint srcHeight, GLint srcDepth, + GLenum srcFormat, GLenum srcType, + const GLvoid *srcAddr, + const struct gl_pixelstore_attrib *srcPacking); + + + +/** + * Texture format record + */ +struct gl_texture_format +{ + GLint MesaFormat; /**< One of the MESA_FORMAT_* values */ + + GLenum BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_ALPHA, + * GL_LUMINANCE, GL_LUMINANCE_ALPHA, + * GL_INTENSITY, GL_COLOR_INDEX or + * GL_DEPTH_COMPONENT. + */ + GLenum DataType; /**< GL_FLOAT or GL_UNSIGNED_NORMALIZED_ARB */ + GLubyte RedBits; /**< Bits per texel component */ + GLubyte GreenBits; /**< These are just rough approximations for */ + GLubyte BlueBits; /**< compressed texture formats. */ + GLubyte AlphaBits; + GLubyte LuminanceBits; + GLubyte IntensityBits; + GLubyte IndexBits; + GLubyte DepthBits; + + GLuint TexelBytes; /**< Bytes per texel, 0 if compressed format */ + + StoreTexImageFunc StoreImage; + + /** + * \name Texel fetch function pointers + */ + /*@{*/ + FetchTexelFuncC FetchTexel1D; + FetchTexelFuncC FetchTexel2D; + FetchTexelFuncC FetchTexel3D; + FetchTexelFuncF FetchTexel1Df; + FetchTexelFuncF FetchTexel2Df; + FetchTexelFuncF FetchTexel3Df; + /*@}*/ + + StoreTexelFunc StoreTexel; +}; + + +/** + * Texture image state. Describes the dimensions of a texture image, + * the texel format and pointers to Texel Fetch functions. + */ +struct gl_texture_image +{ + GLenum Format; /**< Either GL_RGB, GL_RGBA, GL_ALPHA, + * GL_LUMINANCE, GL_LUMINANCE_ALPHA, + * GL_INTENSITY, GL_COLOR_INDEX or + * GL_DEPTH_COMPONENT only. + * Used for choosing TexEnv arithmetic. + */ + GLint IntFormat; /**< Internal format as given by the user */ + GLuint Border; /**< 0 or 1 */ + GLuint Width; /**< = 2^WidthLog2 + 2*Border */ + GLuint Height; /**< = 2^HeightLog2 + 2*Border */ + GLuint Depth; /**< = 2^DepthLog2 + 2*Border */ + GLuint RowStride; /**< == Width unless IsClientData and padded */ + GLuint Width2; /**< = Width - 2*Border */ + GLuint Height2; /**< = Height - 2*Border */ + GLuint Depth2; /**< = Depth - 2*Border */ + GLuint WidthLog2; /**< = log2(Width2) */ + GLuint HeightLog2; /**< = log2(Height2) */ + GLuint DepthLog2; /**< = log2(Depth2) */ + GLuint MaxLog2; /**< = MAX(WidthLog2, HeightLog2) */ + GLfloat WidthScale; /**< used for mipmap LOD computation */ + GLfloat HeightScale; /**< used for mipmap LOD computation */ + GLfloat DepthScale; /**< used for mipmap LOD computation */ + GLvoid *Data; /**< Image data, accessed via FetchTexel() */ + GLboolean IsClientData; /**< Data owned by client? */ + GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */ + + const struct gl_texture_format *TexFormat; + + struct gl_texture_object *TexObject; /**< Pointer back to parent object */ + + FetchTexelFuncC FetchTexelc; /**< GLchan texel fetch function pointer */ + FetchTexelFuncF FetchTexelf; /**< Float texel fetch function pointer */ + + GLboolean IsCompressed; /**< GL_ARB_texture_compression */ + GLuint CompressedSize; /**< GL_ARB_texture_compression */ + + /** + * \name For device driver: + */ + /*@{*/ + void *DriverData; /**< Arbitrary device driver data */ + /*@}*/ +}; + + +/** + * Indexes for cube map faces. + */ +/*@{*/ +#define FACE_POS_X 0 +#define FACE_NEG_X 1 +#define FACE_POS_Y 2 +#define FACE_NEG_Y 3 +#define FACE_POS_Z 4 +#define FACE_NEG_Z 5 +#define MAX_FACES 6 +/*@}*/ + + +/** + * Texture object state. Contains the array of mipmap images, border color, + * wrap modes, filter modes, shadow/texcompare state, and the per-texture + * color palette. + */ +struct gl_texture_object +{ + _glthread_Mutex Mutex; /**< for thread safety */ + GLint RefCount; /**< reference count */ + GLuint Name; /**< the user-visible texture object ID */ + GLenum Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */ + GLfloat Priority; /**< in [0,1] */ + GLfloat BorderColor[4]; /**< unclamped */ + GLchan _BorderChan[4]; /**< clamped, as GLchan */ + GLenum WrapS; /**< S-axis texture image wrap mode */ + GLenum WrapT; /**< T-axis texture image wrap mode */ + GLenum WrapR; /**< R-axis texture image wrap mode */ + GLenum MinFilter; /**< minification filter */ + GLenum MagFilter; /**< magnification filter */ + GLfloat MinLod; /**< min lambda, OpenGL 1.2 */ + GLfloat MaxLod; /**< max lambda, OpenGL 1.2 */ + GLfloat LodBias; /**< OpenGL 1.4 */ + GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */ + GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */ + GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ + GLboolean CompareFlag; /**< GL_SGIX_shadow */ + GLenum CompareOperator; /**< GL_SGIX_shadow */ + GLfloat ShadowAmbient; /**< GL_ARB_shadow_ambient */ + GLenum CompareMode; /**< GL_ARB_shadow */ + GLenum CompareFunc; /**< GL_ARB_shadow */ + GLenum DepthMode; /**< GL_ARB_depth_texture */ + GLint _MaxLevel; /**< actual max mipmap level (q in the spec) */ + GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - b in spec) */ + GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */ + GLboolean _IsPowerOfTwo; /**< Are all image dimensions powers of two? */ + GLboolean Complete; /**< Is texture object complete? */ + + /** Actual texture images, indexed by [cube face] and [mipmap level] */ + struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS]; + + /** GL_EXT_paletted_texture */ + struct gl_color_table Palette; + + + /** + * \name For device driver. + * Note: instead of attaching driver data to this pointer, it's preferable + * to instead use this struct as a base class for your own texture object + * class. Driver->NewTextureObject() can be used to implement the + * allocation. + */ + void *DriverData; /**< Arbitrary device driver data */ +}; + + +/** + * Texture combine environment state. + * + * \todo + * If GL_NV_texture_env_combine4 is ever supported, the arrays in this + * structure will need to be expanded for 4 elements. + */ +struct gl_tex_env_combine_state +{ + GLenum ModeRGB; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */ + GLenum ModeA; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */ + GLenum SourceRGB[3]; /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */ + GLenum SourceA[3]; /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */ + GLenum OperandRGB[3]; /**< SRC_COLOR, ONE_MINUS_SRC_COLOR, etc */ + GLenum OperandA[3]; /**< SRC_ALPHA, ONE_MINUS_SRC_ALPHA, etc */ + GLuint ScaleShiftRGB; /**< 0, 1 or 2 */ + GLuint ScaleShiftA; /**< 0, 1 or 2 */ + GLuint _NumArgsRGB; /**< Number of inputs used for the combine mode. */ + GLuint _NumArgsA; /**< Number of inputs used for the combine mode. */ +}; + + +/** + * Texture unit state. Contains enable flags, texture environment/function/ + * combiners, texgen state, pointers to current texture objects and + * post-filter color tables. + */ +struct gl_texture_unit +{ + GLuint Enabled; /**< bitmask of TEXTURE_*_BIT flags */ + GLuint _ReallyEnabled; /**< 0 or exactly one of TEXTURE_*_BIT flags */ + + GLenum EnvMode; /**< GL_MODULATE, GL_DECAL, GL_BLEND, etc. */ + GLfloat EnvColor[4]; + GLuint TexGenEnabled; /**< Bitwise-OR of [STRQ]_BIT values */ + /** \name Tex coord generation mode + * Either GL_OBJECT_LINEAR, GL_EYE_LINEAR or GL_SPHERE_MAP. */ + /*@{*/ + GLenum GenModeS; + GLenum GenModeT; + GLenum GenModeR; + GLenum GenModeQ; + /*@}*/ + GLuint _GenBitS; + GLuint _GenBitT; + GLuint _GenBitR; + GLuint _GenBitQ; + GLuint _GenFlags; /**< bitwise or of GenBit[STRQ] */ + GLfloat ObjectPlaneS[4]; + GLfloat ObjectPlaneT[4]; + GLfloat ObjectPlaneR[4]; + GLfloat ObjectPlaneQ[4]; + GLfloat EyePlaneS[4]; + GLfloat EyePlaneT[4]; + GLfloat EyePlaneR[4]; + GLfloat EyePlaneQ[4]; + GLfloat LodBias; /**< for biasing mipmap levels */ + + /** + * \name GL_EXT_texture_env_combine + */ + struct gl_tex_env_combine_state Combine; + + /** + * Derived state based on \c EnvMode and the \c BaseFormat of the + * currently enabled texture. + */ + struct gl_tex_env_combine_state _EnvMode; + + /** + * Currently enabled combiner state. This will point to either + * \c Combine or \c _EnvMode. + */ + struct gl_tex_env_combine_state *_CurrentCombine; + + struct gl_texture_object *Current1D; + struct gl_texture_object *Current2D; + struct gl_texture_object *Current3D; + struct gl_texture_object *CurrentCubeMap; /**< GL_ARB_texture_cube_map */ + struct gl_texture_object *CurrentRect; /**< GL_NV_texture_rectangle */ + + struct gl_texture_object *_Current; /**< Points to really enabled tex obj */ + + struct gl_texture_object Saved1D; /**< only used by glPush/PopAttrib */ + struct gl_texture_object Saved2D; + struct gl_texture_object Saved3D; + struct gl_texture_object SavedCubeMap; + struct gl_texture_object SavedRect; + + /* GL_SGI_texture_color_table */ + struct gl_color_table ColorTable; + struct gl_color_table ProxyColorTable; + GLboolean ColorTableEnabled; +}; + +struct texenvprog_cache { + GLuint hash; + void *key; + void *data; + struct texenvprog_cache *next; +}; + +/** + * Texture attribute group (GL_TEXTURE_BIT). + */ +struct gl_texture_attrib +{ + /** + * name multitexture + */ + /**@{*/ + GLuint CurrentUnit; /**< Active texture unit */ + GLuint _EnabledUnits; /**< one bit set for each really-enabled unit */ + GLuint _EnabledCoordUnits; /**< one bit per enabled coordinate unit */ + GLuint _GenFlags; /**< for texgen */ + GLuint _TexGenEnabled; + GLuint _TexMatEnabled; + /**@}*/ + + struct gl_texture_unit Unit[MAX_TEXTURE_UNITS]; + + struct gl_texture_object *Proxy1D; + struct gl_texture_object *Proxy2D; + struct gl_texture_object *Proxy3D; + struct gl_texture_object *ProxyCubeMap; + struct gl_texture_object *ProxyRect; + + /** GL_EXT_shared_texture_palette */ + GLboolean SharedPalette; + struct gl_color_table Palette; + + /** Cached texenv fragment programs */ + struct texenvprog_cache *env_fp_cache; +}; + + +/** + * Transformation attribute group (GL_TRANSFORM_BIT). + */ +struct gl_transform_attrib +{ + GLenum MatrixMode; /**< Matrix mode */ + GLfloat EyeUserPlane[MAX_CLIP_PLANES][4]; /**< User clip planes */ + GLfloat _ClipUserPlane[MAX_CLIP_PLANES][4]; /**< derived */ + GLuint ClipPlanesEnabled; /**< on/off bitmask */ + GLboolean Normalize; /**< Normalize all normals? */ + GLboolean RescaleNormals; /**< GL_EXT_rescale_normal */ + GLboolean RasterPositionUnclipped; /**< GL_IBM_rasterpos_clip */ + + GLboolean CullVertexFlag; /**< True if GL_CULL_VERTEX_EXT is enabled */ + GLfloat CullEyePos[4]; + GLfloat CullObjPos[4]; +}; + + +/** + * Viewport attribute group (GL_VIEWPORT_BIT). + */ +struct gl_viewport_attrib +{ + GLint X, Y; /**< position */ + GLsizei Width, Height; /**< size */ + GLfloat Near, Far; /**< Depth buffer range */ + GLmatrix _WindowMap; /**< Mapping transformation as a matrix. */ +}; + + +/** + * Node for the attribute stack. + */ +struct gl_attrib_node +{ + GLbitfield kind; + void *data; + struct gl_attrib_node *next; +}; + + +/** + * GL_ARB_vertex/pixel_buffer_object buffer object + */ +struct gl_buffer_object +{ + GLint RefCount; + GLuint Name; + GLenum Usage; + GLenum Access; + GLvoid *Pointer; /**< Only valid while buffer is mapped */ + GLsizeiptrARB Size; /**< Size of storage in bytes */ + GLubyte *Data; /**< Location of storage either in RAM or VRAM. */ + GLboolean OnCard; /**< Is buffer in VRAM? (hardware drivers) */ +}; + + + +/** + * Client pixel packing/unpacking attributes + */ +struct gl_pixelstore_attrib +{ + GLint Alignment; + GLint RowLength; + GLint SkipPixels; + GLint SkipRows; + GLint ImageHeight; /**< for GL_EXT_texture3D */ + GLint SkipImages; /**< for GL_EXT_texture3D */ + GLboolean SwapBytes; + GLboolean LsbFirst; + GLboolean ClientStorage; /**< GL_APPLE_client_storage */ + GLboolean Invert; /**< GL_MESA_pack_invert */ + struct gl_buffer_object *BufferObj; /**< GL_ARB_pixel_buffer_object */ +}; + + +#define CA_CLIENT_DATA 0x1 /**< Data not allocated by mesa */ + + +/** + * Client vertex array attributes + */ +struct gl_client_array +{ + GLint Size; /**< components per element (1,2,3,4) */ + GLenum Type; /**< datatype: GL_FLOAT, GL_INT, etc */ + GLsizei Stride; /**< user-specified stride */ + GLsizei StrideB; /**< actual stride in bytes */ + const GLubyte *Ptr; /**< Points to array data */ + GLuint Enabled; /**< one of the _NEW_ARRAY_ bits */ + GLboolean Normalized; /**< GL_ARB_vertex_program */ + + /**< GL_ARB_vertex_buffer_object */ + struct gl_buffer_object *BufferObj; + GLuint _MaxElement; + + GLuint Flags; +}; + + +/** + * Vertex array state + */ +struct gl_array_attrib +{ + struct gl_client_array Vertex; /**< client data descriptors */ + struct gl_client_array Normal; + struct gl_client_array Color; + struct gl_client_array SecondaryColor; + struct gl_client_array FogCoord; + struct gl_client_array Index; + struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS]; + struct gl_client_array EdgeFlag; + + struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX]; /**< GL_NV_vertex_program */ + + GLint ActiveTexture; /**< Client Active Texture */ + GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */ + GLuint LockCount; /**< GL_EXT_compiled_vertex_array */ + + GLuint _Enabled; /**< _NEW_ARRAY_* - bit set if array enabled */ + GLuint NewState; /**< _NEW_ARRAY_* */ + +#if FEATURE_ARB_vertex_buffer_object + struct gl_buffer_object *NullBufferObj; + struct gl_buffer_object *ArrayBufferObj; + struct gl_buffer_object *ElementArrayBufferObj; +#endif + GLuint _MaxElement; /* Min of all enabled array's maxes */ +}; + + +/** + * Feedback buffer state + */ +struct gl_feedback +{ + GLenum Type; + GLuint _Mask; /* FB_* bits */ + GLfloat *Buffer; + GLuint BufferSize; + GLuint Count; +}; + + +/** + * Selection buffer state + */ +struct gl_selection +{ + GLuint *Buffer; /**< selection buffer */ + GLuint BufferSize; /**< size of the selection buffer */ + GLuint BufferCount; /**< number of values in the selection buffer */ + GLuint Hits; /**< number of records in the selection buffer */ + GLuint NameStackDepth; /**< name stack depth */ + GLuint NameStack[MAX_NAME_STACK_DEPTH]; /**< name stack */ + GLboolean HitFlag; /**< hit flag */ + GLfloat HitMinZ; /**< minimum hit depth */ + GLfloat HitMaxZ; /**< maximum hit depth */ +}; + + +/** + * 1-D Evaluator control points + */ +struct gl_1d_map +{ + GLuint Order; /**< Number of control points */ + GLfloat u1, u2, du; /**< u1, u2, 1.0/(u2-u1) */ + GLfloat *Points; /**< Points to contiguous control points */ +}; + + +/** + * 2-D Evaluator control points + */ +struct gl_2d_map +{ + GLuint Uorder; /**< Number of control points in U dimension */ + GLuint Vorder; /**< Number of control points in V dimension */ + GLfloat u1, u2, du; + GLfloat v1, v2, dv; + GLfloat *Points; /**< Points to contiguous control points */ +}; + + +/** + * All evaluator control point state + */ +struct gl_evaluators +{ + /** + * \name 1-D maps + */ + /*@{*/ + struct gl_1d_map Map1Vertex3; + struct gl_1d_map Map1Vertex4; + struct gl_1d_map Map1Index; + struct gl_1d_map Map1Color4; + struct gl_1d_map Map1Normal; + struct gl_1d_map Map1Texture1; + struct gl_1d_map Map1Texture2; + struct gl_1d_map Map1Texture3; + struct gl_1d_map Map1Texture4; + struct gl_1d_map Map1Attrib[16]; /**< GL_NV_vertex_program */ + /*@}*/ + + /** + * \name 2-D maps + */ + /*@{*/ + struct gl_2d_map Map2Vertex3; + struct gl_2d_map Map2Vertex4; + struct gl_2d_map Map2Index; + struct gl_2d_map Map2Color4; + struct gl_2d_map Map2Normal; + struct gl_2d_map Map2Texture1; + struct gl_2d_map Map2Texture2; + struct gl_2d_map Map2Texture3; + struct gl_2d_map Map2Texture4; + struct gl_2d_map Map2Attrib[16]; /**< GL_NV_vertex_program */ + /*@}*/ +}; + + +/** + * NV_fragment_program runtime state + */ +struct fp_machine +{ + GLfloat Temporaries[MAX_NV_FRAGMENT_PROGRAM_TEMPS][4]; + GLfloat Inputs[MAX_NV_FRAGMENT_PROGRAM_INPUTS][4]; + GLfloat Outputs[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS][4]; + GLuint CondCodes[4]; +}; + +/** + * ATI_fragment_shader runtime state + */ +#define ATI_FS_INPUT_PRIMARY 0 +#define ATI_FS_INPUT_SECONDARY 1 + +/* 6 register sets - 2 inputs (primary, secondary) */ +struct atifs_machine +{ + GLfloat Registers[6][4]; + GLfloat PrevPassRegisters[6][4]; + GLfloat Inputs[2][4]; + GLuint pass; +}; + + +/** + * Names of the various vertex/fragment register files + */ +enum register_file +{ + PROGRAM_TEMPORARY, + PROGRAM_INPUT, + PROGRAM_OUTPUT, + PROGRAM_LOCAL_PARAM, + PROGRAM_ENV_PARAM, + PROGRAM_NAMED_PARAM, + PROGRAM_STATE_VAR, + PROGRAM_WRITE_ONLY, + PROGRAM_ADDRESS, + PROGRAM_UNDEFINED /* invalid value */ +}; + + +/** Vertex and fragment instructions */ +struct vp_instruction; +struct fp_instruction; +struct atifs_instruction; +struct program_parameter_list; + + +/** + * Base class for any kind of program object + */ +struct program +{ + GLuint Id; + GLubyte *String; /**< Null-terminated program text */ + GLint RefCount; + GLenum Target; + GLenum Format; /**< String encoding format */ + GLboolean Resident; + GLfloat LocalParams[MAX_PROGRAM_LOCAL_PARAMS][4]; + GLuint NumInstructions; /* GL_ARB_vertex/fragment_program */ + GLuint NumTemporaries; + GLuint NumParameters; + GLuint NumAttributes; + GLuint NumAddressRegs; +}; + + +/** Vertex program object */ +struct vertex_program +{ + struct program Base; /* base class */ + struct vp_instruction *Instructions; /* Compiled instructions */ + GLboolean IsNVProgram; /* GL_NV_vertex_program ? */ + GLboolean IsPositionInvariant; /* GL_NV_vertex_program1_1 */ + GLuint InputsRead; /* Bitmask of which input regs are read */ + GLuint OutputsWritten; /* Bitmask of which output regs are written to */ + struct program_parameter_list *Parameters; /**< array [NumParameters] */ + void *TnlData; /* should probably use Base.DriverData */ +}; + + +/** Fragment program object */ +struct fragment_program +{ + struct program Base; /**< base class */ + struct fp_instruction *Instructions; /**< Compiled instructions */ + GLuint InputsRead; /**< Bitmask of which input regs are read */ + GLuint OutputsWritten; /**< Bitmask of which output regs are written to */ + GLuint TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_INDEX bitmask */ + GLuint NumAluInstructions; /**< GL_ARB_fragment_program */ + GLuint NumTexInstructions; + GLuint NumTexIndirections; + GLenum FogOption; + struct program_parameter_list *Parameters; /**< array [NumParameters] */ + +#ifdef USE_TCC + char c_str[4096]; /* experimental... */ + int c_strlen; +#endif +}; + +struct ati_fragment_shader +{ + struct program Base; + struct atifs_instruction *Instructions; + GLfloat Constants[8][4]; + GLint NumPasses; + GLint cur_pass; +}; + +/** + * State common to vertex and fragment programs. + */ +struct gl_program_state +{ + GLint ErrorPos; /* GL_PROGRAM_ERROR_POSITION_NV */ + const char *ErrorString; /* GL_PROGRAM_ERROR_STRING_NV */ +}; + + +/** + * State vars for GL_ARB/GL_NV_vertex_program + */ +struct gl_vertex_program_state +{ + GLboolean Enabled; /**< GL_VERTEX_PROGRAM_NV */ + GLboolean _Enabled; /**< Really enabled? */ + GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_NV */ + GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + struct vertex_program *Current; /**< ptr to currently bound program */ + + GLenum TrackMatrix[MAX_NV_VERTEX_PROGRAM_PARAMS / 4]; + GLenum TrackMatrixTransform[MAX_NV_VERTEX_PROGRAM_PARAMS / 4]; + + GLfloat Parameters[MAX_NV_VERTEX_PROGRAM_PARAMS][4]; /* Env params */ + /* Only used during program execution (may be moved someday): */ + GLfloat Temporaries[MAX_NV_VERTEX_PROGRAM_TEMPS][4]; + GLfloat Inputs[MAX_NV_VERTEX_PROGRAM_INPUTS][4]; + GLuint InputsSize[MAX_NV_VERTEX_PROGRAM_INPUTS]; + GLfloat Outputs[MAX_NV_VERTEX_PROGRAM_OUTPUTS][4]; + GLint AddressReg[4]; + +#if FEATURE_MESA_program_debug + GLprogramcallbackMESA Callback; + GLvoid *CallbackData; + GLboolean CallbackEnabled; + GLuint CurrentPosition; +#endif +}; + + +/* + * State for GL_ARB/NV_fragment_program + */ +struct gl_fragment_program_state +{ + GLboolean Enabled; /* GL_VERTEX_PROGRAM_NV */ + GLboolean _Enabled; /* Really enabled? */ + GLboolean _Active; /* Really really enabled? */ + struct fragment_program *Current; /* ptr to currently bound program */ + struct fragment_program *_Current; /* ptr to currently active program */ + struct fp_machine Machine; /* machine state */ + GLfloat Parameters[MAX_NV_FRAGMENT_PROGRAM_PARAMS][4]; /* Env params */ + +#if FEATURE_MESA_program_debug + GLprogramcallbackMESA Callback; + GLvoid *CallbackData; + GLboolean CallbackEnabled; + GLuint CurrentPosition; +#endif +}; + +/* + * State for GL_fragment_shader + */ +struct gl_ati_fragment_shader_state +{ + GLboolean Enabled; + GLboolean _Enabled; + GLboolean Compiling; + struct atifs_machine Machine; /* machine state */ + struct ati_fragment_shader *Current; +}; + +/* + * State for GL_ARB_occlusion_query + */ +struct gl_occlusion_state +{ + GLboolean Active; + GLuint CurrentQueryObject; + GLuint PassedCounter; + struct _mesa_HashTable *QueryObjects; +}; + +/** + * gl2 unique interface identifier. + * Each gl2 interface has its own interface id used for object queries. + */ +enum gl2_uiid +{ + UIID_UNKNOWN, /* supported by all objects */ + UIID_GENERIC, /* generic object */ + UIID_CONTAINER, /* contains generic objects */ + UIID_SHADER, /* shader object */ + UIID_FRAGMENT_SHADER, /* fragment shader */ + UIID_VERTEX_SHADER, /* vertex shader */ + UIID_PROGRAM, /* program object */ + UIID_3DLABS_SHHANDLE /* encapsulates 3dlabs' ShHandle */ +}; + +struct gl2_unknown_intf +{ + GLvoid (* AddRef) (struct gl2_unknown_intf **); + GLvoid (* Release) (struct gl2_unknown_intf **); + struct gl2_unknown_intf **(* QueryInterface) (struct gl2_unknown_intf **, enum gl2_uiid uiid); +}; + +struct gl2_generic_intf +{ + struct gl2_unknown_intf _unknown; + GLvoid (* Delete) (struct gl2_generic_intf **); + GLenum (* GetType) (struct gl2_generic_intf **); + GLhandleARB (* GetName) (struct gl2_generic_intf **); + GLboolean (* GetDeleteStatus) (struct gl2_generic_intf **); + const GLcharARB *(* GetInfoLog) (struct gl2_generic_intf **); +}; + +struct gl2_container_intf +{ + struct gl2_generic_intf _generic; + GLboolean (* Attach) (struct gl2_container_intf **, struct gl2_generic_intf **); + GLboolean (* Detach) (struct gl2_container_intf **, struct gl2_generic_intf **); + GLsizei (* GetAttachedCount) (struct gl2_container_intf **); + struct gl2_generic_intf **(* GetAttached) (struct gl2_container_intf **, GLuint); +}; + +struct gl2_shader_intf +{ + struct gl2_generic_intf _generic; + GLenum (* GetSubType) (struct gl2_shader_intf **); + GLboolean (* GetCompileStatus) (struct gl2_shader_intf **); + GLvoid (* SetSource) (struct gl2_shader_intf **, GLcharARB *, GLint *, GLsizei); + const GLcharARB *(* GetSource) (struct gl2_shader_intf **); + GLvoid (* Compile) (struct gl2_shader_intf **); +}; + +struct gl2_program_intf +{ + struct gl2_container_intf _container; + GLboolean (* GetLinkStatus) (struct gl2_program_intf **); + GLboolean (* GetValidateStatus) (struct gl2_program_intf **); + GLvoid (* Link) (struct gl2_program_intf **); + GLvoid (* Validate) (struct gl2_program_intf **); +}; + +struct gl2_fragment_shader_intf +{ + struct gl2_shader_intf _shader; +}; + +struct gl2_vertex_shader_intf +{ + struct gl2_shader_intf _shader; +}; + +struct gl2_3dlabs_shhandle_intf +{ + struct gl2_unknown_intf _unknown; + GLvoid *(* GetShHandle) (struct gl2_3dlabs_shhandle_intf **); +}; + +struct gl_shader_objects_state +{ + struct gl2_program_intf **current_program; +}; + + +/** + * State which can be shared by multiple contexts: + */ +struct gl_shared_state +{ + _glthread_Mutex Mutex; /**< for thread safety */ + GLint RefCount; /**< Reference count */ + struct _mesa_HashTable *DisplayList; /**< Display lists hash table */ + struct _mesa_HashTable *TexObjects; /**< Texture objects hash table */ + + /** + * \name Default texture objects (shared by all multi-texture units) + */ + /*@{*/ + struct gl_texture_object *Default1D; + struct gl_texture_object *Default2D; + struct gl_texture_object *Default3D; + struct gl_texture_object *DefaultCubeMap; + struct gl_texture_object *DefaultRect; + /*@}*/ + + /** + * \name Vertex/fragment programs + */ + /*@{*/ + struct _mesa_HashTable *Programs; +#if FEATURE_ARB_vertex_program + struct program *DefaultVertexProgram; +#endif +#if FEATURE_ARB_fragment_program + struct program *DefaultFragmentProgram; +#endif +#if FEATURE_ATI_fragment_shader + struct program *DefaultFragmentShader; +#endif + /*@}*/ + +#if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object + struct _mesa_HashTable *BufferObjects; +#endif + + struct _mesa_HashTable *GL2Objects; + +#if FEATURE_EXT_framebuffer_object + struct _mesa_HashTable *RenderBuffers; + struct _mesa_HashTable *FrameBuffers; +#endif + + void *DriverData; /**< Device driver shared state */ +}; + + + + +/** + * A renderbuffer stores colors or depth values or stencil values. + * A framebuffer object will have a collection of these. + * Data are read/written to the buffer with a handful of Get/Put functions. + * + * Instances of this object are allocated with the Driver's NewRenderbuffer + * hook. Drivers will likely wrap this class inside a driver-specific + * class to simulate inheritance. + */ +struct gl_renderbuffer +{ + GLuint Name; + GLint RefCount; + GLuint Width, Height; + GLenum InternalFormat; /* The user-specified value */ + GLenum _BaseFormat; /* Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or */ + /* GL_STENCIL_INDEX. */ + GLenum DataType; /* Type of values passed to the Get/Put functions */ + GLubyte ComponentSizes[4]; /* bits per component or channel */ + GLvoid *Data; + + /* Used to wrap one renderbuffer around another: */ + struct gl_renderbuffer *Wrapped; + + /* Delete this renderbuffer */ + void (*Delete)(struct gl_renderbuffer *rb); + + /* Allocate new storage for this renderbuffer */ + GLboolean (*AllocStorage)(GLcontext *ctx, struct gl_renderbuffer *rb, + GLenum internalFormat, + GLuint width, GLuint height); + + /* Lock/Unlock are called before/after calling the Get/Put functions. + * Not sure this is the right place for these yet. + void (*Lock)(GLcontext *ctx, struct gl_renderbuffer *rb); + void (*Unlock)(GLcontext *ctx, struct gl_renderbuffer *rb); + */ + + /* Return a pointer to the element/pixel at (x,y). + * Should return NULL if the buffer memory can't be directly addressed. + */ + void *(*GetPointer)(GLcontext *ctx, struct gl_renderbuffer *rb, + GLint x, GLint y); + + /* Get/Read a row of values. + * The values will be of format _BaseFormat and type DataType. + */ + void (*GetRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, + GLint x, GLint y, void *values); + + /* Get/Read values at arbitrary locations. + * The values will be of format _BaseFormat and type DataType. + */ + void (*GetValues)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, + const GLint x[], const GLint y[], void *values); + + /* Put/Write a row of values. + * The values will be of format _BaseFormat and type DataType. + */ + void (*PutRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, + GLint x, GLint y, const void *values, const GLubyte *mask); + + /* Put/Write a row of RGB values. This is a special-case routine that's + * only used for RGBA renderbuffers when the source data is GL_RGB. That's + * a common case for glDrawPixels and some triangle routines. + * The values will be of format GL_RGB and type DataType. + */ + void (*PutRowRGB)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, + GLint x, GLint y, const void *values, const GLubyte *mask); + + + /* Put/Write a row of identical values. + * The values will be of format _BaseFormat and type DataType. + */ + void (*PutMonoRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, + GLint x, GLint y, const void *value, const GLubyte *mask); + + /* Put/Write values at arbitrary locations. + * The values will be of format _BaseFormat and type DataType. + */ + void (*PutValues)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, + const GLint x[], const GLint y[], const void *values, + const GLubyte *mask); + /* Put/Write identical values at arbitrary locations. + * The values will be of format _BaseFormat and type DataType. + */ + void (*PutMonoValues)(GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, const GLint x[], const GLint y[], + const void *value, const GLubyte *mask); +}; + + +/** + * A renderbuffer attachment point points to either a texture object + * (and specifies a mipmap level, cube face or 3D texture slice) or + * points to a renderbuffer. + */ +struct gl_renderbuffer_attachment +{ + GLenum Type; /* GL_NONE or GL_TEXTURE or GL_RENDERBUFFER_EXT */ + GLboolean Complete; + + /* IF Type == GL_RENDERBUFFER_EXT: */ + struct gl_renderbuffer *Renderbuffer; + + /* IF Type == GL_TEXTURE: */ + struct gl_texture_object *Texture; + GLuint TextureLevel; + GLuint CubeMapFace; /* 0 .. 5, for cube map textures */ + GLuint Zoffset; /* for 3D textures */ +}; + + +/** + * A framebuffer is a collection of renderbuffers (color, depth, stencil, etc). + * In C++ terms, think of this as a base class from which device drivers + * will make derived classes. + */ +struct gl_framebuffer +{ + GLuint Name; /* if zero, this is a window system framebuffer */ + GLint RefCount; + + GLvisual Visual; /**< The corresponding visual */ + + GLboolean Initialized; + + GLuint Width, Height; /**< size of frame buffer in pixels */ + + /** \name Drawing bounds (Intersection of buffer size and scissor box) */ + /*@{*/ + GLint _Xmin, _Xmax; /**< inclusive */ + GLint _Ymin, _Ymax; /**< exclusive */ + /*@}*/ + + /** \name Derived Z buffer stuff */ + /*@{*/ + GLuint _DepthMax; /**< Max depth buffer value */ + GLfloat _DepthMaxF; /**< Float max depth buffer value */ + GLfloat _MRD; /**< minimum resolvable difference in Z values */ + /*@}*/ + + GLenum _Status; /* One of the GL_FRAMEBUFFER_(IN)COMPLETE_* tokens */ + + /* Array of all renderbuffer attachments, indexed by BUFFER_* tokens. */ + struct gl_renderbuffer_attachment Attachment[BUFFER_COUNT]; + + /* In unextended OpenGL these vars are part of the GL_COLOR_BUFFER + * attribute group and GL_PIXEL attribute group, respectively. + */ + GLenum ColorDrawBuffer[MAX_DRAW_BUFFERS]; + GLenum ColorReadBuffer; + + /* These are computed from ColorDrawBuffer and ColorReadBuffer */ + GLuint _ColorDrawBufferMask[MAX_DRAW_BUFFERS]; /* Mask of BUFFER_BIT_* flags */ + GLuint _ColorReadBufferMask; /* Zero or one of BUFFER_BIT_ flags */ + + /* These are computed from _Draw/ReadBufferMask, above. */ + GLuint _NumColorDrawBuffers[MAX_DRAW_BUFFERS]; + struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS][4]; + struct gl_renderbuffer *_ColorReadBuffer; + +#if OLD_RENDERBUFFER + /* XXX THIS IS TEMPORARY */ + GLuint _ColorDrawBit[MAX_DRAW_BUFFERS][4]; +#endif + + /** Delete this framebuffer */ + void (*Delete)(struct gl_framebuffer *fb); +}; + + +/** + * Constants which may be overridden by device driver during context creation + * but are never changed after that. + */ +struct gl_constants +{ + GLint MaxTextureLevels; /**< Maximum number of allowed mipmap levels. */ + GLint Max3DTextureLevels; /**< Maximum number of allowed mipmap levels for 3D texture targets. */ + GLint MaxCubeTextureLevels; /**< Maximum number of allowed mipmap levels for GL_ARB_texture_cube_map */ + GLint MaxTextureRectSize; /* GL_NV_texture_rectangle */ + GLuint MaxTextureCoordUnits; + GLuint MaxTextureImageUnits; + GLuint MaxTextureUnits; /* = MAX(CoordUnits, ImageUnits) */ + GLfloat MaxTextureMaxAnisotropy; /* GL_EXT_texture_filter_anisotropic */ + GLfloat MaxTextureLodBias; /* GL_EXT_texture_lod_bias */ + GLuint MaxArrayLockSize; + GLint SubPixelBits; + GLfloat MinPointSize, MaxPointSize; /* aliased */ + GLfloat MinPointSizeAA, MaxPointSizeAA; /* antialiased */ + GLfloat PointSizeGranularity; + GLfloat MinLineWidth, MaxLineWidth; /* aliased */ + GLfloat MinLineWidthAA, MaxLineWidthAA; /* antialiased */ + GLfloat LineWidthGranularity; + GLuint MaxColorTableSize; + GLuint MaxConvolutionWidth; + GLuint MaxConvolutionHeight; + GLuint MaxClipPlanes; + GLuint MaxLights; + GLfloat MaxShininess; /* GL_NV_light_max_exponent */ + GLfloat MaxSpotExponent; /* GL_NV_light_max_exponent */ + GLuint MaxViewportWidth, MaxViewportHeight; + /* GL_ARB_vertex_program */ + GLuint MaxVertexProgramInstructions; + GLuint MaxVertexProgramAttribs; + GLuint MaxVertexProgramTemps; + GLuint MaxVertexProgramLocalParams; + GLuint MaxVertexProgramEnvParams; + GLuint MaxVertexProgramAddressRegs; + /* GL_ARB_fragment_program */ + GLuint MaxFragmentProgramInstructions; + GLuint MaxFragmentProgramAttribs; + GLuint MaxFragmentProgramTemps; + GLuint MaxFragmentProgramLocalParams; + GLuint MaxFragmentProgramEnvParams; + GLuint MaxFragmentProgramAddressRegs; + GLuint MaxFragmentProgramAluInstructions; + GLuint MaxFragmentProgramTexInstructions; + GLuint MaxFragmentProgramTexIndirections; + /* vertex or fragment program */ + GLuint MaxProgramMatrices; + GLuint MaxProgramMatrixStackDepth; + /* vertex array / buffer object bounds checking */ + GLboolean CheckArrayBounds; + /* GL_ARB_draw_buffers */ + GLuint MaxDrawBuffers; + /* GL_OES_read_format */ + GLenum ColorReadFormat; + GLenum ColorReadType; + /* GL_EXT_framebuffer_object */ + GLuint MaxColorAttachments; + GLuint MaxRenderbufferSize; +}; + + +/** + * Enable flag for each OpenGL extension. Different device drivers will + * enable different extensions at runtime. + */ +struct gl_extensions +{ + /** + * \name Flags to quickly test if certain extensions are available. + * + * Not every extension needs to have such a flag, but it's encouraged. + */ + /*@{*/ + GLboolean dummy; /* don't remove this! */ + GLboolean ARB_depth_texture; + GLboolean ARB_draw_buffers; + GLboolean ARB_fragment_program; + GLboolean ARB_fragment_shader; + GLboolean ARB_half_float_pixel; + GLboolean ARB_imaging; + GLboolean ARB_multisample; + GLboolean ARB_multitexture; + GLboolean ARB_occlusion_query; + GLboolean ARB_point_sprite; + GLboolean ARB_shader_objects; + GLboolean ARB_shading_language_100; + GLboolean ARB_shadow; + GLboolean ARB_texture_border_clamp; + GLboolean ARB_texture_compression; + GLboolean ARB_texture_cube_map; + GLboolean ARB_texture_env_combine; + GLboolean ARB_texture_env_crossbar; + GLboolean ARB_texture_env_dot3; + GLboolean ARB_texture_float; + GLboolean ARB_texture_mirrored_repeat; + GLboolean ARB_texture_non_power_of_two; + GLboolean ARB_transpose_matrix; + GLboolean ARB_vertex_buffer_object; + GLboolean ARB_vertex_program; + GLboolean ARB_vertex_shader; + GLboolean ARB_window_pos; + GLboolean EXT_abgr; + GLboolean EXT_bgra; + GLboolean EXT_blend_color; + GLboolean EXT_blend_equation_separate; + GLboolean EXT_blend_func_separate; + GLboolean EXT_blend_logic_op; + GLboolean EXT_blend_minmax; + GLboolean EXT_blend_subtract; + GLboolean EXT_clip_volume_hint; + GLboolean EXT_cull_vertex; + GLboolean EXT_convolution; + GLboolean EXT_compiled_vertex_array; + GLboolean EXT_copy_texture; + GLboolean EXT_depth_bounds_test; + GLboolean EXT_draw_range_elements; + GLboolean EXT_framebuffer_object; + GLboolean EXT_fog_coord; + GLboolean EXT_histogram; + GLboolean EXT_multi_draw_arrays; + GLboolean EXT_paletted_texture; + GLboolean EXT_packed_pixels; + GLboolean EXT_pixel_buffer_object; + GLboolean EXT_point_parameters; + GLboolean EXT_polygon_offset; + GLboolean EXT_rescale_normal; + GLboolean EXT_shadow_funcs; + GLboolean EXT_secondary_color; + GLboolean EXT_separate_specular_color; + GLboolean EXT_shared_texture_palette; + GLboolean EXT_stencil_wrap; + GLboolean EXT_stencil_two_side; + GLboolean EXT_subtexture; + GLboolean EXT_texture; + GLboolean EXT_texture_object; + GLboolean EXT_texture3D; + GLboolean EXT_texture_compression_s3tc; + GLboolean EXT_texture_env_add; + GLboolean EXT_texture_env_combine; + GLboolean EXT_texture_env_dot3; + GLboolean EXT_texture_filter_anisotropic; + GLboolean EXT_texture_lod_bias; + GLboolean EXT_texture_mirror_clamp; + GLboolean EXT_vertex_array; + GLboolean EXT_vertex_array_set; + /* vendor extensions */ + GLboolean APPLE_client_storage; + GLboolean APPLE_packed_pixels; + GLboolean ATI_texture_mirror_once; + GLboolean ATI_texture_env_combine3; + GLboolean ATI_fragment_shader; + GLboolean HP_occlusion_test; + GLboolean IBM_rasterpos_clip; + GLboolean IBM_multimode_draw_arrays; + GLboolean MESA_pack_invert; + GLboolean MESA_packed_depth_stencil; + GLboolean MESA_program_debug; + GLboolean MESA_resize_buffers; + GLboolean MESA_ycbcr_texture; + GLboolean NV_blend_square; + GLboolean NV_fragment_program; + GLboolean NV_light_max_exponent; + GLboolean NV_point_sprite; + GLboolean NV_texgen_reflection; + GLboolean NV_texture_rectangle; + GLboolean NV_vertex_program; + GLboolean NV_vertex_program1_1; + GLboolean OES_read_format; + GLboolean SGI_color_matrix; + GLboolean SGI_color_table; + GLboolean SGI_texture_color_table; + GLboolean SGIS_generate_mipmap; + GLboolean SGIS_pixel_texture; + GLboolean SGIS_texture_edge_clamp; + GLboolean SGIS_texture_lod; + GLboolean SGIX_depth_texture; + GLboolean SGIX_pixel_texture; + GLboolean SGIX_shadow; + GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */ + GLboolean TDFX_texture_compression_FXT1; + GLboolean S3_s3tc; + /*@}*/ + /* The extension string */ + const GLubyte *String; +}; + + +/** + * A stack of matrices (projection, modelview, color, texture, etc). + */ +struct matrix_stack +{ + GLmatrix *Top; /**< points into Stack */ + GLmatrix *Stack; /**< array [MaxDepth] of GLmatrix */ + GLuint Depth; /**< 0 <= Depth < MaxDepth */ + GLuint MaxDepth; /**< size of Stack[] array */ + GLuint DirtyFlag; /**< _NEW_MODELVIEW or _NEW_PROJECTION, for example */ +}; + + +/** + * \name Bits for image transfer operations + * + * \sa __GLcontextRec::ImageTransferState. + */ +/*@{*/ +#define IMAGE_SCALE_BIAS_BIT 0x1 +#define IMAGE_SHIFT_OFFSET_BIT 0x2 +#define IMAGE_MAP_COLOR_BIT 0x4 +#define IMAGE_COLOR_TABLE_BIT 0x8 +#define IMAGE_CONVOLUTION_BIT 0x10 +#define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20 +#define IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT 0x40 +#define IMAGE_COLOR_MATRIX_BIT 0x80 +#define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x100 +#define IMAGE_HISTOGRAM_BIT 0x200 +#define IMAGE_MIN_MAX_BIT 0x400 +#define IMAGE_CLAMP_BIT 0x800 /* extra */ + + +/** Pixel Transfer ops up to convolution */ +#define IMAGE_PRE_CONVOLUTION_BITS (IMAGE_SCALE_BIAS_BIT | \ + IMAGE_SHIFT_OFFSET_BIT | \ + IMAGE_MAP_COLOR_BIT | \ + IMAGE_COLOR_TABLE_BIT) + +/** Pixel transfer ops after convolution */ +#define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS | \ + IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT | \ + IMAGE_COLOR_MATRIX_BIT | \ + IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT |\ + IMAGE_HISTOGRAM_BIT | \ + IMAGE_MIN_MAX_BIT) +/*@}*/ + + +/** + * \name Bits to indicate what state has changed. + * + * 4 unused flags. + */ +/*@{*/ +#define _NEW_MODELVIEW 0x1 /**< __GLcontextRec::ModelView */ +#define _NEW_PROJECTION 0x2 /**< __GLcontextRec::Projection */ +#define _NEW_TEXTURE_MATRIX 0x4 /**< __GLcontextRec::TextureMatrix */ +#define _NEW_COLOR_MATRIX 0x8 /**< __GLcontextRec::ColorMatrix */ +#define _NEW_ACCUM 0x10 /**< __GLcontextRec::Accum */ +#define _NEW_COLOR 0x20 /**< __GLcontextRec::Color */ +#define _NEW_DEPTH 0x40 /**< __GLcontextRec::Depth */ +#define _NEW_EVAL 0x80 /**< __GLcontextRec::Eval, __GLcontextRec::EvalMap */ +#define _NEW_FOG 0x100 /**< __GLcontextRec::Fog */ +#define _NEW_HINT 0x200 /**< __GLcontextRec::Hint */ +#define _NEW_LIGHT 0x400 /**< __GLcontextRec::Light */ +#define _NEW_LINE 0x800 /**< __GLcontextRec::Line */ +#define _NEW_PIXEL 0x1000 /**< __GLcontextRec::Pixel */ +#define _NEW_POINT 0x2000 /**< __GLcontextRec::Point */ +#define _NEW_POLYGON 0x4000 /**< __GLcontextRec::Polygon */ +#define _NEW_POLYGONSTIPPLE 0x8000 /**< __GLcontextRec::PolygonStipple */ +#define _NEW_SCISSOR 0x10000 /**< __GLcontextRec::Scissor */ +#define _NEW_STENCIL 0x20000 /**< __GLcontextRec::Stencil */ +#define _NEW_TEXTURE 0x40000 /**< __GLcontextRec::Texture */ +#define _NEW_TRANSFORM 0x80000 /**< __GLcontextRec::Transform */ +#define _NEW_VIEWPORT 0x100000 /**< __GLcontextRec::Viewport */ +#define _NEW_PACKUNPACK 0x200000 /**< __GLcontextRec::Pack, __GLcontextRec::Unpack */ +#define _NEW_ARRAY 0x400000 /**< __GLcontextRec::Array */ +#define _NEW_RENDERMODE 0x800000 /**< __GLcontextRec::RenderMode, __GLcontextRec::Feedback, __GLcontextRec::Select */ +#define _NEW_BUFFERS 0x1000000 /**< __GLcontextRec::Visual, __GLcontextRec::DrawBuffer, */ +#define _NEW_MULTISAMPLE 0x2000000 /**< __GLcontextRec::Multisample */ +#define _NEW_TRACK_MATRIX 0x4000000 /**< __GLcontextRec::VertexProgram */ +#define _NEW_PROGRAM 0x8000000 /**< __GLcontextRec::VertexProgram */ +#define _NEW_ALL ~0 +/*@}*/ + + +/** + * \name Bits to track array state changes + * + * Also used to summarize array enabled. + */ +/*@{*/ +#define _NEW_ARRAY_VERTEX VERT_BIT_POS +#define _NEW_ARRAY_WEIGHT VERT_BIT_WEIGHT +#define _NEW_ARRAY_NORMAL VERT_BIT_NORMAL +#define _NEW_ARRAY_COLOR0 VERT_BIT_COLOR0 +#define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1 +#define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG +#define _NEW_ARRAY_INDEX VERT_BIT_SIX +#define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN +#define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0 +#define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1 +#define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2 +#define _NEW_ARRAY_TEXCOORD_3 VERT_BIT_TEX3 +#define _NEW_ARRAY_TEXCOORD_4 VERT_BIT_TEX4 +#define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5 +#define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6 +#define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7 +#define _NEW_ARRAY_ATTRIB_0 0x10000 /* start at bit 16 */ +#define _NEW_ARRAY_ALL 0xffffffff + + +#define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0 << (i)) +#define _NEW_ARRAY_ATTRIB(i) (_NEW_ARRAY_ATTRIB_0 << (i)) +/*@}*/ + + +/** + * \name A bunch of flags that we think might be useful to drivers. + * + * Set in the __GLcontextRec::_TriangleCaps bitfield. + */ +/*@{*/ +#define DD_FLATSHADE 0x1 +#define DD_SEPARATE_SPECULAR 0x2 +#define DD_TRI_CULL_FRONT_BACK 0x4 /* special case on some hw */ +#define DD_TRI_LIGHT_TWOSIDE 0x8 +#define DD_TRI_UNFILLED 0x10 +#define DD_TRI_SMOOTH 0x20 +#define DD_TRI_STIPPLE 0x40 +#define DD_TRI_OFFSET 0x80 +#define DD_LINE_SMOOTH 0x100 +#define DD_LINE_STIPPLE 0x200 +#define DD_LINE_WIDTH 0x400 +#define DD_POINT_SMOOTH 0x800 +#define DD_POINT_SIZE 0x1000 +#define DD_POINT_ATTEN 0x2000 +#define DD_TRI_TWOSTENCIL 0x4000 +/*@}*/ + + +/** + * \name Define the state changes under which each of these bits might change + */ +/*@{*/ +#define _DD_NEW_FLATSHADE _NEW_LIGHT +#define _DD_NEW_SEPARATE_SPECULAR (_NEW_LIGHT | _NEW_FOG | _NEW_PROGRAM) +#define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON +#define _DD_NEW_TRI_LIGHT_TWOSIDE _NEW_LIGHT +#define _DD_NEW_TRI_UNFILLED _NEW_POLYGON +#define _DD_NEW_TRI_SMOOTH _NEW_POLYGON +#define _DD_NEW_TRI_STIPPLE _NEW_POLYGON +#define _DD_NEW_TRI_OFFSET _NEW_POLYGON +#define _DD_NEW_LINE_SMOOTH _NEW_LINE +#define _DD_NEW_LINE_STIPPLE _NEW_LINE +#define _DD_NEW_LINE_WIDTH _NEW_LINE +#define _DD_NEW_POINT_SMOOTH _NEW_POINT +#define _DD_NEW_POINT_SIZE _NEW_POINT +#define _DD_NEW_POINT_ATTEN _NEW_POINT +/*@}*/ + + +#define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT | \ + _NEW_TEXTURE | \ + _NEW_POINT | \ + _NEW_MODELVIEW) + +#define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT | \ + _NEW_TEXTURE) + +#define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL | _NEW_COLOR_MATRIX) + + + + +/* + * Forward declaration of display list data types: + */ +union node; +typedef union node Node; + + +/* This has to be included here. */ +#include "dd.h" + + +#define NUM_VERTEX_FORMAT_ENTRIES (sizeof(GLvertexformat) / sizeof(void *)) + +/** + * Core Mesa's support for tnl modules: + */ +struct gl_tnl_module +{ + /** + * Vertex format to be lazily swapped into current dispatch. + */ + const GLvertexformat *Current; + + /** + * \name Record of functions swapped out. + * On restore, only need to swap these functions back in. + */ + /*@{*/ + struct { + _glapi_proc * location; + _glapi_proc function; + } Swapped[NUM_VERTEX_FORMAT_ENTRIES]; + GLuint SwapCount; + /*@}*/ +}; + +/* Strictly this is a tnl/ private concept, but it doesn't seem + * worthwhile adding a tnl private structure just to hold this one bit + * of information: + */ +#define MESA_DLIST_DANGLING_REFS 0x1 + +/* Provide a location where information about a display list can be + * collected. Could be extended with driverPrivate structures, + * etc. in the future. + */ +struct mesa_display_list +{ + Node *node; + GLuint id; + GLuint flags; +}; + + +/** + * State used during display list compilation and execution. + */ +struct mesa_list_state +{ + struct mesa_display_list *CallStack[MAX_LIST_NESTING]; + GLuint CallDepth; /**< Current recursion calling depth */ + + struct mesa_display_list *CurrentList; + Node *CurrentListPtr; /**< Head of list being compiled */ + GLuint CurrentListNum; /**< Number of the list being compiled */ + Node *CurrentBlock; /**< Pointer to current block of nodes */ + GLuint CurrentPos; /**< Index into current block of nodes */ + + GLvertexformat ListVtxfmt; + + GLubyte ActiveAttribSize[VERT_ATTRIB_MAX]; + GLfloat CurrentAttrib[VERT_ATTRIB_MAX][4]; + + GLubyte ActiveMaterialSize[MAT_ATTRIB_MAX]; + GLfloat CurrentMaterial[MAT_ATTRIB_MAX][4]; + + GLubyte ActiveIndex; + GLfloat CurrentIndex; + + GLubyte ActiveEdgeFlag; + GLboolean CurrentEdgeFlag; +}; + + +/** + * Mesa rendering context. + * + * This is the central context data structure for Mesa. Almost all + * OpenGL state is contained in this structure. + * Think of this as a base class from which device drivers will derive + * sub classes. + * + * The GLcontext typedef names this structure. + */ +struct __GLcontextRec +{ + /** + * \name OS related interfaces. + * + * These \b must be the first members of this structure, because they are + * exposed to the outside world (i.e. GLX extension). + */ + /*@{*/ + __GLimports imports; + __GLexports exports; + /*@}*/ + + /** State possibly shared with other contexts in the address space */ + struct gl_shared_state *Shared; + + /** \name API function pointer tables */ + /*@{*/ + struct _glapi_table *Save; /**< Display list save functions */ + struct _glapi_table *Exec; /**< Execute functions */ + struct _glapi_table *CurrentDispatch; /**< == Save or Exec !! */ + /*@}*/ + + GLvisual Visual; + GLframebuffer *DrawBuffer; /**< buffer for writing */ + GLframebuffer *ReadBuffer; /**< buffer for reading */ + GLframebuffer *WinSysDrawBuffer; /**< set with MakeCurrent */ + GLframebuffer *WinSysReadBuffer; /**< set with MakeCurrent */ + + /** + * Device driver function pointer table + */ + struct dd_function_table Driver; + + void *DriverCtx; /**< Points to device driver context/state */ + void *DriverMgrCtx; /**< Points to device driver manager (optional)*/ + + /** Core/Driver constants */ + struct gl_constants Const; + + /** \name The various 4x4 matrix stacks */ + /*@{*/ + struct matrix_stack ModelviewMatrixStack; + struct matrix_stack ProjectionMatrixStack; + struct matrix_stack ColorMatrixStack; + struct matrix_stack TextureMatrixStack[MAX_TEXTURE_COORD_UNITS]; + struct matrix_stack ProgramMatrixStack[MAX_PROGRAM_MATRICES]; + struct matrix_stack *CurrentStack; /**< Points to one of the above stacks */ + /*@}*/ + + /** Combined modelview and projection matrix */ + GLmatrix _ModelProjectMatrix; + + /** \name Display lists */ + struct mesa_list_state ListState; + + GLboolean ExecuteFlag; /**< Execute GL commands? */ + GLboolean CompileFlag; /**< Compile GL commands into display list? */ + + /** Extensions */ + struct gl_extensions Extensions; + + /** \name Renderer attribute stack */ + /*@{*/ + GLuint AttribStackDepth; + struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH]; + /*@}*/ + + /** \name Renderer attribute groups + * + * We define a struct for each attribute group to make pushing and popping + * attributes easy. Also it's a good organization. + */ + /*@{*/ + struct gl_accum_attrib Accum; /**< Accumulation buffer attributes */ + struct gl_colorbuffer_attrib Color; /**< Color buffers attributes */ + struct gl_current_attrib Current; /**< Current attributes */ + struct gl_depthbuffer_attrib Depth; /**< Depth buffer attributes */ + struct gl_eval_attrib Eval; /**< Eval attributes */ + struct gl_fog_attrib Fog; /**< Fog attributes */ + struct gl_hint_attrib Hint; /**< Hint attributes */ + struct gl_light_attrib Light; /**< Light attributes */ + struct gl_line_attrib Line; /**< Line attributes */ + struct gl_list_attrib List; /**< List attributes */ + struct gl_multisample_attrib Multisample; + struct gl_pixel_attrib Pixel; /**< Pixel attributes */ + struct gl_point_attrib Point; /**< Point attributes */ + struct gl_polygon_attrib Polygon; /**< Polygon attributes */ + GLuint PolygonStipple[32]; /**< Polygon stipple */ + struct gl_scissor_attrib Scissor; /**< Scissor attributes */ + struct gl_stencil_attrib Stencil; /**< Stencil buffer attributes */ + struct gl_texture_attrib Texture; /**< Texture attributes */ + struct gl_transform_attrib Transform; /**< Transformation attributes */ + struct gl_viewport_attrib Viewport; /**< Viewport attributes */ + /*@}*/ + + /** \name Client attribute stack */ + /*@{*/ + GLuint ClientAttribStackDepth; + struct gl_attrib_node *ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH]; + /*@}*/ + + /** \name Client attribute groups */ + /*@{*/ + struct gl_array_attrib Array; /**< Vertex arrays */ + struct gl_pixelstore_attrib Pack; /**< Pixel packing */ + struct gl_pixelstore_attrib Unpack; /**< Pixel unpacking */ + struct gl_pixelstore_attrib DefaultPacking; /**< Default params */ + /*@}*/ + + /** \name Other assorted state (not pushed/popped on attribute stack) */ + /*@{*/ + struct gl_histogram_attrib Histogram; + struct gl_minmax_attrib MinMax; + struct gl_convolution_attrib Convolution1D; + struct gl_convolution_attrib Convolution2D; + struct gl_convolution_attrib Separable2D; + + struct gl_evaluators EvalMap; /**< All evaluators */ + struct gl_feedback Feedback; /**< Feedback */ + struct gl_selection Select; /**< Selection */ + + struct gl_color_table ColorTable; /**< Pre-convolution */ + struct gl_color_table ProxyColorTable; /**< Pre-convolution */ + struct gl_color_table PostConvolutionColorTable; + struct gl_color_table ProxyPostConvolutionColorTable; + struct gl_color_table PostColorMatrixColorTable; + struct gl_color_table ProxyPostColorMatrixColorTable; + + struct gl_program_state Program; /**< for vertex or fragment progs */ + struct gl_vertex_program_state VertexProgram; /**< GL_NV_vertex_program */ + struct gl_fragment_program_state FragmentProgram; /**< GL_NV_fragment_program */ + struct gl_ati_fragment_shader_state ATIFragmentShader; /**< GL_ATI_fragment_shader */ + + struct fragment_program *_TexEnvProgram; /**< Texture state as fragment program */ + struct vertex_program *_TnlProgram; /**< Fixed func TNL state as vertex program */ + + GLboolean _MaintainTexEnvProgram; + GLboolean _MaintainTnlProgram; + + struct gl_occlusion_state Occlusion; /**< GL_ARB_occlusion_query */ + + struct gl_shader_objects_state ShaderObjects; /* GL_ARB_shader_objects */ + /*@}*/ + +#if FEATURE_EXT_framebuffer_object + /*struct gl_framebuffer *CurrentFramebuffer;*/ + struct gl_renderbuffer *CurrentRenderbuffer; +#endif + + GLenum ErrorValue; /**< Last error code */ + GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ + GLuint NewState; /**< bitwise-or of _NEW_* flags */ + + /** \name Derived state */ + /*@{*/ + GLuint _TriangleCaps; /**< bitwise-or of DD_* flags */ + GLuint _ImageTransferState;/**< bitwise-or of IMAGE_*_BIT flags */ + GLfloat _EyeZDir[3]; + GLfloat _ModelViewInvScale; + GLuint _NeedEyeCoords; + GLuint _ForceEyeCoords; + GLboolean _RotateMode; + GLenum _CurrentProgram; /* currently executing program */ + + struct gl_shine_tab *_ShineTable[2]; /**< Active shine tables */ + struct gl_shine_tab *_ShineTabList; /**< MRU list of inactive shine tables */ + /**@}*/ + + struct gl_list_extensions ListExt; /**< driver dlist extensions */ + + + GLboolean OcclusionResult; /**< for GL_HP_occlusion_test */ + GLboolean OcclusionResultSaved; /**< for GL_HP_occlusion_test */ + GLuint _Facing; /**< This is a hack for 2-sided stencil test. + * + * We don't have a better way to communicate this value from + * swrast_setup to swrast. */ + + /** \name Color clamping (tentative part of GL_ARB_color_clamp_control) */ + /*@{*/ + GLboolean ClampFragmentColors; + GLboolean ClampVertexColors; + /*@}*/ + + /** \name For debugging/development only */ + /*@{*/ + GLboolean FirstTimeCurrent; + /*@}*/ + + /** Dither disable via MESA_NO_DITHER env var */ + GLboolean NoDither; + + /** software compression/decompression supported or not */ + GLboolean Mesa_DXTn; + + /** Core tnl module support */ + struct gl_tnl_module TnlModule; + + /** + * \name Hooks for module contexts. + * + * These will eventually live in the driver or elsewhere. + */ + /*@{*/ + void *swrast_context; + void *swsetup_context; + void *swtnl_context; + void *swtnl_im; + void *acache_context; + void *aelt_context; + /*@}*/ +}; + + +/** The string names for GL_POINT, GL_LINE_LOOP, etc */ +extern const char *_mesa_prim_name[GL_POLYGON+4]; + + +#ifdef MESA_DEBUG +extern int MESA_VERBOSE; +extern int MESA_DEBUG_FLAGS; +# define MESA_FUNCTION __FUNCTION__ +#else +# define MESA_VERBOSE 0 +# define MESA_DEBUG_FLAGS 0 +# define MESA_FUNCTION "a function" +# ifndef NDEBUG +# define NDEBUG +# endif +#endif + + +enum _verbose +{ + VERBOSE_VARRAY = 0x0001, + VERBOSE_TEXTURE = 0x0002, + VERBOSE_IMMEDIATE = 0x0004, + VERBOSE_PIPELINE = 0x0008, + VERBOSE_DRIVER = 0x0010, + VERBOSE_STATE = 0x0020, + VERBOSE_API = 0x0040, + VERBOSE_DISPLAY_LIST = 0x0100, + VERBOSE_LIGHTING = 0x0200, + VERBOSE_PRIMS = 0x0400, + VERBOSE_VERTS = 0x0800, + VERBOSE_DISASSEM = 0x1000 +}; + + +enum _debug +{ + DEBUG_ALWAYS_FLUSH = 0x1 +}; + + + +#define Elements(x) sizeof(x)/sizeof(*(x)) + + +#endif /* TYPES_H */ diff --git a/reactos/dll/mesa32/src/main/occlude.c b/reactos/dll/mesa32/src/main/occlude.c new file mode 100644 index 00000000000..bc61a475d66 --- /dev/null +++ b/reactos/dll/mesa32/src/main/occlude.c @@ -0,0 +1,353 @@ +/* + * Mesa 3-D graphics library + * Version: 6.0.2 + * + * 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. + */ + + +/* + * Functions to implement the GL_ARB_occlusion_query extension. + */ + + +#include "glheader.h" +#include "context.h" +#include "hash.h" +#include "imports.h" +#include "occlude.h" +#include "mtypes.h" + + +struct occlusion_query +{ + GLenum Target; + GLuint Id; + GLuint PassedCounter; + GLboolean Active; +}; + + +/** + * Allocate a new occlusion query object. + * \param target - must be GL_SAMPLES_PASSED_ARB at this time + * \param id - the object's ID + * \return pointer to new occlusion_query object or NULL if out of memory. + */ +static struct occlusion_query * +new_query_object(GLenum target, GLuint id) +{ + struct occlusion_query *q = MALLOC_STRUCT(occlusion_query); + if (q) { + q->Target = target; + q->Id = id; + q->PassedCounter = 0; + q->Active = GL_FALSE; + } + return q; +} + + +/** + * Delete an occlusion query object. + */ +static void +delete_query_object(struct occlusion_query *q) +{ + FREE(q); +} + + +void GLAPIENTRY +_mesa_GenQueriesARB(GLsizei n, GLuint *ids) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint first; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGenQueriesARB(n < 0)"); + return; + } + + if (ctx->Occlusion.Active) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGenQueriesARB"); + return; + } + + first = _mesa_HashFindFreeKeyBlock(ctx->Occlusion.QueryObjects, n); + if (first) { + GLsizei i; + for (i = 0; i < n; i++) { + struct occlusion_query *q = new_query_object(GL_SAMPLES_PASSED_ARB, + first + i); + if (!q) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenQueriesARB"); + return; + } + ids[i] = first + i; + _mesa_HashInsert(ctx->Occlusion.QueryObjects, first + i, q); + } + } +} + + +void GLAPIENTRY +_mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteQueriesARB(n < 0)"); + return; + } + + if (ctx->Occlusion.Active) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteQueriesARB"); + return; + } + + for (i = 0; i < n; i++) { + if (ids[i] > 0) { + struct occlusion_query *q = (struct occlusion_query *) + _mesa_HashLookup(ctx->Occlusion.QueryObjects, ids[i]); + if (q) { + _mesa_HashRemove(ctx->Occlusion.QueryObjects, ids[i]); + delete_query_object(q); + } + } + } +} + + +GLboolean GLAPIENTRY +_mesa_IsQueryARB(GLuint id) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + if (id && _mesa_HashLookup(ctx->Occlusion.QueryObjects, id)) + return GL_TRUE; + else + return GL_FALSE; +} + + +void GLAPIENTRY +_mesa_BeginQueryARB(GLenum target, GLuint id) +{ + GET_CURRENT_CONTEXT(ctx); + struct occlusion_query *q; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + FLUSH_VERTICES(ctx, _NEW_DEPTH); + + if (target != GL_SAMPLES_PASSED_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)"); + return; + } + + if (id == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB(id==0)"); + return; + } + + if (ctx->Occlusion.CurrentQueryObject) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB(target)"); + return; + } + + q = (struct occlusion_query *) + _mesa_HashLookup(ctx->Occlusion.QueryObjects, id); + if (q && q->Active) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB"); + return; + } + else if (!q) { + q = new_query_object(target, id); + if (!q) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQueryARB"); + return; + } + _mesa_HashInsert(ctx->Occlusion.QueryObjects, id, q); + } + + q->Active = GL_TRUE; + q->PassedCounter = 0; + ctx->Occlusion.Active = GL_TRUE; + ctx->Occlusion.CurrentQueryObject = id; + ctx->Occlusion.PassedCounter = 0; +} + + +void GLAPIENTRY +_mesa_EndQueryARB(GLenum target) +{ + GET_CURRENT_CONTEXT(ctx); + struct occlusion_query *q = NULL; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + FLUSH_VERTICES(ctx, _NEW_DEPTH); + + if (target != GL_SAMPLES_PASSED_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)"); + return; + } + + if (ctx->Occlusion.CurrentQueryObject) + q = (struct occlusion_query *) + _mesa_HashLookup(ctx->Occlusion.QueryObjects, + ctx->Occlusion.CurrentQueryObject); + if (!q || !q->Active) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glEndQuery with no glBeginQuery"); + return; + } + + q->PassedCounter = ctx->Occlusion.PassedCounter; + q->Active = GL_FALSE; + ctx->Occlusion.Active = GL_FALSE; + ctx->Occlusion.CurrentQueryObject = 0; +} + + +void GLAPIENTRY +_mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target != GL_SAMPLES_PASSED_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryivARB(target)"); + return; + } + + switch (pname) { + case GL_QUERY_COUNTER_BITS_ARB: + *params = 8 * sizeof(GLuint); + break; + case GL_CURRENT_QUERY_ARB: + *params = ctx->Occlusion.CurrentQueryObject; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryivARB(pname)"); + return; + } +} + + +void GLAPIENTRY +_mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + struct occlusion_query *q = NULL; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (id) + q = (struct occlusion_query *) + _mesa_HashLookup(ctx->Occlusion.QueryObjects, id); + + if (!q || q->Active) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetQueryObjectivARB(id=%d)", id); + return; + } + + switch (pname) { + case GL_QUERY_RESULT_ARB: + *params = q->PassedCounter; + break; + case GL_QUERY_RESULT_AVAILABLE_ARB: + /* XXX revisit when we have a hardware implementation! */ + *params = GL_TRUE; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjectivARB(pname)"); + return; + } +} + + +void GLAPIENTRY +_mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params) +{ + GET_CURRENT_CONTEXT(ctx); + struct occlusion_query *q = NULL; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (id) + q = (struct occlusion_query *) + _mesa_HashLookup(ctx->Occlusion.QueryObjects, id); + if (!q || q->Active) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetQueryObjectuivARB(id=%d", id); + return; + } + + switch (pname) { + case GL_QUERY_RESULT_ARB: + *params = q->PassedCounter; + break; + case GL_QUERY_RESULT_AVAILABLE_ARB: + /* XXX revisit when we have a hardware implementation! */ + *params = GL_TRUE; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjectuivARB(pname)"); + return; + } +} + + + +/** + * Allocate/init the context state related to occlusion query objects. + */ +void +_mesa_init_occlude(GLcontext *ctx) +{ +#if FEATURE_ARB_occlusion_query + ctx->Occlusion.QueryObjects = _mesa_NewHashTable(); +#endif + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; +} + + +/** + * Free the context state related to occlusion query objects. + */ +void +_mesa_free_occlude_data(GLcontext *ctx) +{ + while (1) { + GLuint query = _mesa_HashFirstEntry(ctx->Occlusion.QueryObjects); + if (query) { + struct occlusion_query *q = (struct occlusion_query *) + _mesa_HashLookup(ctx->Occlusion.QueryObjects, query); + ASSERT(q); + delete_query_object(q); + _mesa_HashRemove(ctx->Occlusion.QueryObjects, query); + } + else { + break; + } + } + _mesa_DeleteHashTable(ctx->Occlusion.QueryObjects); +} diff --git a/reactos/dll/mesa32/src/main/occlude.h b/reactos/dll/mesa32/src/main/occlude.h new file mode 100644 index 00000000000..acf19101f14 --- /dev/null +++ b/reactos/dll/mesa32/src/main/occlude.h @@ -0,0 +1,61 @@ +/* + * Mesa 3-D graphics library + * Version: 6.0.2 + * + * 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 OCCLUDE_H +#define OCCLUDE_H + + +extern void +_mesa_init_occlude(GLcontext *ctx); + +extern void +_mesa_free_occlude_data(GLcontext *ctx); + +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_BeginQueryARB(GLenum target, GLuint id); + +extern void GLAPIENTRY +_mesa_EndQueryARB(GLenum target); + +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); + + +#endif /* OCCLUDE_H */ diff --git a/reactos/dll/mesa32/src/main/pixel.c b/reactos/dll/mesa32/src/main/pixel.c new file mode 100644 index 00000000000..e8912c70029 --- /dev/null +++ b/reactos/dll/mesa32/src/main/pixel.c @@ -0,0 +1,2119 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + +#include "glheader.h" +#include "bufferobj.h" +#include "colormac.h" +#include "context.h" +#include "image.h" +#include "macros.h" +#include "pixel.h" +#include "mtypes.h" + + +/**********************************************************************/ +/***** glPixelZoom *****/ +/**********************************************************************/ + + + +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; +} + + + +/**********************************************************************/ +/***** glPixelStore *****/ +/**********************************************************************/ + + +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 ); +} + + + +/**********************************************************************/ +/***** glPixelMap *****/ +/**********************************************************************/ + + +/** + * Helper routine used by the other _mesa_PixelMap() functions. + */ +static void +pixelmap(GLcontext *ctx, GLenum map, GLsizei mapsize, const GLfloat *values) +{ + GLint i; + switch (map) { + case GL_PIXEL_MAP_S_TO_S: + ctx->Pixel.MapStoSsize = mapsize; + for (i = 0; i < mapsize; i++) { + ctx->Pixel.MapStoS[i] = IROUND(values[i]); + } + break; + case GL_PIXEL_MAP_I_TO_I: + ctx->Pixel.MapItoIsize = mapsize; + for (i = 0; i < mapsize; i++) { + ctx->Pixel.MapItoI[i] = values[i]; + } + break; + case GL_PIXEL_MAP_I_TO_R: + ctx->Pixel.MapItoRsize = mapsize; + for (i = 0; i < mapsize; i++) { + GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); + ctx->Pixel.MapItoR[i] = val; + ctx->Pixel.MapItoR8[i] = (GLint) (val * 255.0F); + } + break; + case GL_PIXEL_MAP_I_TO_G: + ctx->Pixel.MapItoGsize = mapsize; + for (i = 0; i < mapsize; i++) { + GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); + ctx->Pixel.MapItoG[i] = val; + ctx->Pixel.MapItoG8[i] = (GLint) (val * 255.0F); + } + break; + case GL_PIXEL_MAP_I_TO_B: + ctx->Pixel.MapItoBsize = mapsize; + for (i = 0; i < mapsize; i++) { + GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); + ctx->Pixel.MapItoB[i] = val; + ctx->Pixel.MapItoB8[i] = (GLint) (val * 255.0F); + } + break; + case GL_PIXEL_MAP_I_TO_A: + ctx->Pixel.MapItoAsize = mapsize; + for (i = 0; i < mapsize; i++) { + GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); + ctx->Pixel.MapItoA[i] = val; + ctx->Pixel.MapItoA8[i] = (GLint) (val * 255.0F); + } + break; + case GL_PIXEL_MAP_R_TO_R: + ctx->Pixel.MapRtoRsize = mapsize; + for (i = 0; i < mapsize; i++) { + ctx->Pixel.MapRtoR[i] = CLAMP( values[i], 0.0F, 1.0F ); + } + break; + case GL_PIXEL_MAP_G_TO_G: + ctx->Pixel.MapGtoGsize = mapsize; + for (i = 0; i < mapsize; i++) { + ctx->Pixel.MapGtoG[i] = CLAMP( values[i], 0.0F, 1.0F ); + } + break; + case GL_PIXEL_MAP_B_TO_B: + ctx->Pixel.MapBtoBsize = mapsize; + for (i = 0; i < mapsize; i++) { + ctx->Pixel.MapBtoB[i] = CLAMP( values[i], 0.0F, 1.0F ); + } + break; + case GL_PIXEL_MAP_A_TO_A: + ctx->Pixel.MapAtoAsize = mapsize; + for (i = 0; i < mapsize; i++) { + ctx->Pixel.MapAtoA[i] = CLAMP( values[i], 0.0F, 1.0F ); + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glPixelMap(map)" ); + } +} + + +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_bitcount((GLuint) mapsize) != 1) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" ); + return; + } + } + + FLUSH_VERTICES(ctx, _NEW_PIXEL); + + if (ctx->Unpack.BufferObj->Name) { + /* unpack pixelmap from PBO */ + GLubyte *buf; + /* Note, need to use DefaultPacking and Unpack's buffer object */ + ctx->DefaultPacking.BufferObj = ctx->Unpack.BufferObj; + if (!_mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1, + GL_INTENSITY, GL_FLOAT, values)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glPixelMapfv(invalid PBO access)"); + return; + } + /* restore */ + ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, + ctx->Unpack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glPixelMapfv(PBO is mapped)"); + return; + } + values = (const GLfloat *) ADD_POINTERS(buf, values); + } + else if (!values) { + return; + } + + pixelmap(ctx, map, mapsize, values); + + if (ctx->Unpack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + ctx->Unpack.BufferObj); + } +} + + + +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_bitcount((GLuint) mapsize) != 1) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapuiv(mapsize)" ); + return; + } + } + + FLUSH_VERTICES(ctx, _NEW_PIXEL); + + if (ctx->Unpack.BufferObj->Name) { + /* unpack pixelmap from PBO */ + GLubyte *buf; + /* Note, need to use DefaultPacking and Unpack's buffer object */ + ctx->DefaultPacking.BufferObj = ctx->Unpack.BufferObj; + if (!_mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1, + GL_INTENSITY, GL_UNSIGNED_INT, values)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glPixelMapuiv(invalid PBO access)"); + return; + } + /* restore */ + ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, + ctx->Unpack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glPixelMapuiv(PBO is mapped)"); + return; + } + values = (const GLuint *) ADD_POINTERS(buf, values); + } + else if (!values) { + 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] ); + } + } + + if (ctx->Unpack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + ctx->Unpack.BufferObj); + } + + pixelmap(ctx, map, mapsize, fvalues); +} + + + +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_bitcount((GLuint) mapsize) != 1) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapuiv(mapsize)" ); + return; + } + } + + FLUSH_VERTICES(ctx, _NEW_PIXEL); + + if (ctx->Unpack.BufferObj->Name) { + /* unpack pixelmap from PBO */ + GLubyte *buf; + /* Note, need to use DefaultPacking and Unpack's buffer object */ + ctx->DefaultPacking.BufferObj = ctx->Unpack.BufferObj; + if (!_mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1, + GL_INTENSITY, GL_UNSIGNED_SHORT, + values)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glPixelMapusv(invalid PBO access)"); + return; + } + /* restore */ + ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, + ctx->Unpack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glPixelMapusv(PBO is mapped)"); + return; + } + values = (const GLushort *) ADD_POINTERS(buf, values); + } + else if (!values) { + 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] ); + } + } + + if (ctx->Unpack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + ctx->Unpack.BufferObj); + } + + pixelmap(ctx, map, mapsize, fvalues); +} + + +/** + * Return size of the named map. + */ +static GLuint +get_map_size(GLcontext *ctx, GLenum map) +{ + switch (map) { + case GL_PIXEL_MAP_I_TO_I: + return ctx->Pixel.MapItoIsize; + case GL_PIXEL_MAP_S_TO_S: + return ctx->Pixel.MapStoSsize; + case GL_PIXEL_MAP_I_TO_R: + return ctx->Pixel.MapItoRsize; + case GL_PIXEL_MAP_I_TO_G: + return ctx->Pixel.MapItoGsize; + case GL_PIXEL_MAP_I_TO_B: + return ctx->Pixel.MapItoBsize; + case GL_PIXEL_MAP_I_TO_A: + return ctx->Pixel.MapItoAsize; + case GL_PIXEL_MAP_R_TO_R: + return ctx->Pixel.MapRtoRsize; + case GL_PIXEL_MAP_G_TO_G: + return ctx->Pixel.MapGtoGsize; + case GL_PIXEL_MAP_B_TO_B: + return ctx->Pixel.MapBtoBsize; + case GL_PIXEL_MAP_A_TO_A: + return ctx->Pixel.MapAtoAsize; + default: + return 0; + } +} + + +void GLAPIENTRY +_mesa_GetPixelMapfv( GLenum map, GLfloat *values ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint mapsize, i; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + mapsize = get_map_size(ctx, map); + + if (ctx->Pack.BufferObj->Name) { + /* pack pixelmap into PBO */ + GLubyte *buf; + /* Note, need to use DefaultPacking and Pack's buffer object */ + ctx->DefaultPacking.BufferObj = ctx->Pack.BufferObj; + if (!_mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1, + GL_INTENSITY, GL_FLOAT, values)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetPixelMapfv(invalid PBO access)"); + return; + } + /* restore */ + ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + ctx->Pack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetPixelMapfv(PBO is mapped)"); + return; + } + values = (GLfloat *) ADD_POINTERS(buf, values); + } + else if (!values) { + return; + } + + switch (map) { + case GL_PIXEL_MAP_I_TO_I: + MEMCPY(values, ctx->Pixel.MapItoI, mapsize * sizeof(GLfloat)); + break; + case GL_PIXEL_MAP_S_TO_S: + for (i = 0; i < mapsize; i++) { + values[i] = (GLfloat) ctx->Pixel.MapStoS[i]; + } + break; + case GL_PIXEL_MAP_I_TO_R: + MEMCPY(values, ctx->Pixel.MapItoR, mapsize * sizeof(GLfloat)); + break; + case GL_PIXEL_MAP_I_TO_G: + MEMCPY(values, ctx->Pixel.MapItoG, mapsize * sizeof(GLfloat)); + break; + case GL_PIXEL_MAP_I_TO_B: + MEMCPY(values, ctx->Pixel.MapItoB, mapsize * sizeof(GLfloat)); + break; + case GL_PIXEL_MAP_I_TO_A: + MEMCPY(values, ctx->Pixel.MapItoA, mapsize * sizeof(GLfloat)); + break; + case GL_PIXEL_MAP_R_TO_R: + MEMCPY(values, ctx->Pixel.MapRtoR, mapsize * sizeof(GLfloat)); + break; + case GL_PIXEL_MAP_G_TO_G: + MEMCPY(values, ctx->Pixel.MapGtoG, mapsize * sizeof(GLfloat)); + break; + case GL_PIXEL_MAP_B_TO_B: + MEMCPY(values, ctx->Pixel.MapBtoB, mapsize * sizeof(GLfloat)); + break; + case GL_PIXEL_MAP_A_TO_A: + MEMCPY(values, ctx->Pixel.MapAtoA, mapsize * sizeof(GLfloat)); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" ); + } + + if (ctx->Pack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + ctx->Pack.BufferObj); + } +} + + +void GLAPIENTRY +_mesa_GetPixelMapuiv( GLenum map, GLuint *values ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint mapsize, i; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + mapsize = get_map_size(ctx, map); + + if (ctx->Pack.BufferObj->Name) { + /* pack pixelmap into PBO */ + GLubyte *buf; + /* Note, need to use DefaultPacking and Pack's buffer object */ + ctx->DefaultPacking.BufferObj = ctx->Pack.BufferObj; + if (!_mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1, + GL_INTENSITY, GL_UNSIGNED_INT, values)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetPixelMapuiv(invalid PBO access)"); + return; + } + /* restore */ + ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + ctx->Pack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetPixelMapuiv(PBO is mapped)"); + return; + } + values = (GLuint *) ADD_POINTERS(buf, values); + } + else if (!values) { + return; + } + + switch (map) { + case GL_PIXEL_MAP_I_TO_I: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoI[i] ); + } + break; + case GL_PIXEL_MAP_S_TO_S: + MEMCPY(values, ctx->Pixel.MapStoS, mapsize * sizeof(GLint)); + break; + case GL_PIXEL_MAP_I_TO_R: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoR[i] ); + } + break; + case GL_PIXEL_MAP_I_TO_G: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoG[i] ); + } + break; + case GL_PIXEL_MAP_I_TO_B: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoB[i] ); + } + break; + case GL_PIXEL_MAP_I_TO_A: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoA[i] ); + } + break; + case GL_PIXEL_MAP_R_TO_R: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_UINT( ctx->Pixel.MapRtoR[i] ); + } + break; + case GL_PIXEL_MAP_G_TO_G: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_UINT( ctx->Pixel.MapGtoG[i] ); + } + break; + case GL_PIXEL_MAP_B_TO_B: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_UINT( ctx->Pixel.MapBtoB[i] ); + } + break; + case GL_PIXEL_MAP_A_TO_A: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_UINT( ctx->Pixel.MapAtoA[i] ); + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" ); + } + + if (ctx->Pack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + ctx->Pack.BufferObj); + } +} + + +void GLAPIENTRY +_mesa_GetPixelMapusv( GLenum map, GLushort *values ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint mapsize, i; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + mapsize = get_map_size(ctx, map); + + if (ctx->Pack.BufferObj->Name) { + /* pack pixelmap into PBO */ + GLubyte *buf; + /* Note, need to use DefaultPacking and Pack's buffer object */ + ctx->DefaultPacking.BufferObj = ctx->Pack.BufferObj; + if (!_mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1, + GL_INTENSITY, GL_UNSIGNED_SHORT, + values)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetPixelMapusv(invalid PBO access)"); + return; + } + /* restore */ + ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + ctx->Pack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetPixelMapusv(PBO is mapped)"); + return; + } + values = (GLushort *) ADD_POINTERS(buf, values); + } + else if (!values) { + return; + } + + switch (map) { + case GL_PIXEL_MAP_I_TO_I: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_USHORT(ctx->Pixel.MapItoI[i]); + } + break; + case GL_PIXEL_MAP_S_TO_S: + for (i = 0; i < mapsize; i++) { + values[i] = (GLushort) ctx->Pixel.MapStoS[i]; + } + break; + case GL_PIXEL_MAP_I_TO_R: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoR[i] ); + } + break; + case GL_PIXEL_MAP_I_TO_G: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoG[i] ); + } + break; + case GL_PIXEL_MAP_I_TO_B: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoB[i] ); + } + break; + case GL_PIXEL_MAP_I_TO_A: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoA[i] ); + } + break; + case GL_PIXEL_MAP_R_TO_R: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapRtoR[i] ); + } + break; + case GL_PIXEL_MAP_G_TO_G: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapGtoG[i] ); + } + break; + case GL_PIXEL_MAP_B_TO_B: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapBtoB[i] ); + } + break; + case GL_PIXEL_MAP_A_TO_A: + for (i = 0; i < mapsize; i++) { + values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapAtoA[i] ); + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" ); + } + + if (ctx->Pack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + ctx->Pack.BufferObj); + } +} + + + +/**********************************************************************/ +/***** glPixelTransfer *****/ +/**********************************************************************/ + + +/* + * Implements glPixelTransfer[fi] whether called immediately or from a + * display list. + */ +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; + case GL_POST_COLOR_MATRIX_RED_SCALE: + if (ctx->Pixel.PostColorMatrixScale[0] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostColorMatrixScale[0] = param; + break; + case GL_POST_COLOR_MATRIX_RED_BIAS: + if (ctx->Pixel.PostColorMatrixBias[0] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostColorMatrixBias[0] = param; + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE: + if (ctx->Pixel.PostColorMatrixScale[1] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostColorMatrixScale[1] = param; + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS: + if (ctx->Pixel.PostColorMatrixBias[1] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostColorMatrixBias[1] = param; + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE: + if (ctx->Pixel.PostColorMatrixScale[2] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostColorMatrixScale[2] = param; + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS: + if (ctx->Pixel.PostColorMatrixBias[2] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostColorMatrixBias[2] = param; + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE: + if (ctx->Pixel.PostColorMatrixScale[3] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostColorMatrixScale[3] = param; + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS: + if (ctx->Pixel.PostColorMatrixBias[3] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostColorMatrixBias[3] = param; + break; + case GL_POST_CONVOLUTION_RED_SCALE: + if (ctx->Pixel.PostConvolutionScale[0] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostConvolutionScale[0] = param; + break; + case GL_POST_CONVOLUTION_RED_BIAS: + if (ctx->Pixel.PostConvolutionBias[0] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostConvolutionBias[0] = param; + break; + case GL_POST_CONVOLUTION_GREEN_SCALE: + if (ctx->Pixel.PostConvolutionScale[1] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostConvolutionScale[1] = param; + break; + case GL_POST_CONVOLUTION_GREEN_BIAS: + if (ctx->Pixel.PostConvolutionBias[1] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostConvolutionBias[1] = param; + break; + case GL_POST_CONVOLUTION_BLUE_SCALE: + if (ctx->Pixel.PostConvolutionScale[2] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostConvolutionScale[2] = param; + break; + case GL_POST_CONVOLUTION_BLUE_BIAS: + if (ctx->Pixel.PostConvolutionBias[2] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostConvolutionBias[2] = param; + break; + case GL_POST_CONVOLUTION_ALPHA_SCALE: + if (ctx->Pixel.PostConvolutionScale[2] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostConvolutionScale[2] = param; + break; + case GL_POST_CONVOLUTION_ALPHA_BIAS: + if (ctx->Pixel.PostConvolutionBias[2] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostConvolutionBias[2] = param; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" ); + return; + } +} + + +void GLAPIENTRY +_mesa_PixelTransferi( GLenum pname, GLint param ) +{ + _mesa_PixelTransferf( pname, (GLfloat) param ); +} + + + +/**********************************************************************/ +/***** Pixel processing functions ******/ +/**********************************************************************/ + +/* + * 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 GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) +{ + const GLfloat rscale = (GLfloat) (ctx->Pixel.MapRtoRsize - 1); + const GLfloat gscale = (GLfloat) (ctx->Pixel.MapGtoGsize - 1); + const GLfloat bscale = (GLfloat) (ctx->Pixel.MapBtoBsize - 1); + const GLfloat ascale = (GLfloat) (ctx->Pixel.MapAtoAsize - 1); + const GLfloat *rMap = ctx->Pixel.MapRtoR; + const GLfloat *gMap = ctx->Pixel.MapGtoG; + const GLfloat *bMap = ctx->Pixel.MapBtoB; + const GLfloat *aMap = ctx->Pixel.MapAtoA; + GLuint i; + for (i=0;iPixel.PostColorMatrixScale[0]; + const GLfloat rb = ctx->Pixel.PostColorMatrixBias[0]; + const GLfloat gs = ctx->Pixel.PostColorMatrixScale[1]; + const GLfloat gb = ctx->Pixel.PostColorMatrixBias[1]; + const GLfloat bs = ctx->Pixel.PostColorMatrixScale[2]; + const GLfloat bb = ctx->Pixel.PostColorMatrixBias[2]; + const GLfloat as = ctx->Pixel.PostColorMatrixScale[3]; + const GLfloat ab = ctx->Pixel.PostColorMatrixBias[3]; + const GLfloat *m = ctx->ColorMatrixStack.Top->m; + GLuint i; + for (i = 0; i < n; i++) { + const GLfloat r = rgba[i][RCOMP]; + const GLfloat g = rgba[i][GCOMP]; + const GLfloat b = rgba[i][BCOMP]; + const GLfloat a = rgba[i][ACOMP]; + rgba[i][RCOMP] = (m[0] * r + m[4] * g + m[ 8] * b + m[12] * a) * rs + rb; + rgba[i][GCOMP] = (m[1] * r + m[5] * g + m[ 9] * b + m[13] * a) * gs + gb; + rgba[i][BCOMP] = (m[2] * r + m[6] * g + m[10] * b + m[14] * a) * bs + bb; + rgba[i][ACOMP] = (m[3] * r + m[7] * g + m[11] * b + m[15] * a) * as + ab; + } +} + + +/** + * 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]) +{ + if (!table->Table || table->Size == 0) + return; + + switch (table->Format) { + case GL_INTENSITY: + /* replace RGBA with I */ + if (table->Type == GL_FLOAT) { + const GLint max = table->Size - 1; + const GLfloat scale = (GLfloat) max; + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint 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; + } + } + else { + const GLint max = table->Size - 1; + const GLfloat scale = (GLfloat) max; + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = IROUND(rgba[i][RCOMP] * scale); + GLfloat c = CHAN_TO_FLOAT(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 */ + if (table->Type == GL_FLOAT) { + const GLint max = table->Size - 1; + const GLfloat scale = (GLfloat) max; + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint 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] = c; + } + } + else { + const GLint max = table->Size - 1; + const GLfloat scale = (GLfloat) max; + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = IROUND(rgba[i][RCOMP] * scale); + GLfloat c = CHAN_TO_FLOAT(lut[CLAMP(j, 0, max)]); + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; + } + } + break; + case GL_ALPHA: + /* replace A with A */ + if (table->Type == GL_FLOAT) { + const GLint max = table->Size - 1; + const GLfloat scale = (GLfloat) max; + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = IROUND(rgba[i][ACOMP] * scale); + rgba[i][ACOMP] = lut[CLAMP(j, 0, max)]; + } + } + else { + const GLint max = table->Size - 1; + const GLfloat scale = (GLfloat) max; + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = IROUND(rgba[i][ACOMP] * scale); + rgba[i][ACOMP] = CHAN_TO_FLOAT(lut[CLAMP(j, 0, max)]); + } + } + break; + case GL_LUMINANCE_ALPHA: + /* replace RGBA with LLLA */ + if (table->Type == GL_FLOAT) { + const GLint max = table->Size - 1; + const GLfloat scale = (GLfloat) max; + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + 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;; + } + } + else { + const GLint max = table->Size - 1; + const GLfloat scale = (GLfloat) max; + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + 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 = CHAN_TO_FLOAT(lut[jL * 2 + 0]); + alpha = CHAN_TO_FLOAT(lut[jA * 2 + 1]); + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; + rgba[i][ACOMP] = alpha;; + } + } + break; + case GL_RGB: + /* replace RGB with RGB */ + if (table->Type == GL_FLOAT) { + const GLint max = table->Size - 1; + const GLfloat scale = (GLfloat) max; + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + 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]; + } + } + else { + const GLint max = table->Size - 1; + const GLfloat scale = (GLfloat) max; + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + 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] = CHAN_TO_FLOAT(lut[jR * 3 + 0]); + rgba[i][GCOMP] = CHAN_TO_FLOAT(lut[jG * 3 + 1]); + rgba[i][BCOMP] = CHAN_TO_FLOAT(lut[jB * 3 + 2]); + } + } + break; + case GL_RGBA: + /* replace RGBA with RGBA */ + if (table->Type == GL_FLOAT) { + const GLint max = table->Size - 1; + const GLfloat scale = (GLfloat) max; + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + 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]; + } + } + else { + const GLint max = table->Size - 1; + const GLfloat scale = (GLfloat) max; + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + 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] = CHAN_TO_FLOAT(lut[jR * 4 + 0]); + rgba[i][GCOMP] = CHAN_TO_FLOAT(lut[jG * 4 + 1]); + rgba[i][BCOMP] = CHAN_TO_FLOAT(lut[jB * 4 + 2]); + rgba[i][ACOMP] = CHAN_TO_FLOAT(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 GLchan RGBA colors. + */ +void +_mesa_lookup_rgba_chan(const struct gl_color_table *table, + GLuint n, GLchan rgba[][4]) +{ + if (!table->Table || table->Size == 0) + return; + + switch (table->Format) { + case GL_INTENSITY: + /* replace RGBA with I */ + if (table->Type == GL_FLOAT) { + const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale); + GLchan c; + CLAMPED_FLOAT_TO_CHAN(c, lut[j]); + rgba[i][RCOMP] = rgba[i][GCOMP] = + rgba[i][BCOMP] = rgba[i][ACOMP] = c; + } + } + else { +#if CHAN_TYPE == GL_UNSIGNED_BYTE + if (table->Size == 256) { + /* common case */ + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + const GLchan c = lut[rgba[i][RCOMP]]; + rgba[i][RCOMP] = rgba[i][GCOMP] = + rgba[i][BCOMP] = rgba[i][ACOMP] = c; + } + } + else +#endif + { + const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + 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->Type == GL_FLOAT) { + const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale); + GLchan c; + CLAMPED_FLOAT_TO_CHAN(c, lut[j]); + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; + } + } + else { +#if CHAN_TYPE == GL_UNSIGNED_BYTE + if (table->Size == 256) { + /* common case */ + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + const GLchan c = lut[rgba[i][RCOMP]]; + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; + } + } + else +#endif + { + const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + 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->Type == GL_FLOAT) { + const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = IROUND((GLfloat) rgba[i][ACOMP] * scale); + GLchan c; + CLAMPED_FLOAT_TO_CHAN(c, lut[j]); + rgba[i][ACOMP] = c; + } + } + else { +#if CHAN_TYPE == GL_UNSIGNED_BYTE + if (table->Size == 256) { + /* common case */ + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + rgba[i][ACOMP] = lut[rgba[i][ACOMP]]; + } + } + else +#endif + { + const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + 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->Type == GL_FLOAT) { + const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jL = IROUND((GLfloat) rgba[i][RCOMP] * scale); + GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale); + GLchan luminance, alpha; + CLAMPED_FLOAT_TO_CHAN(luminance, lut[jL * 2 + 0]); + CLAMPED_FLOAT_TO_CHAN(alpha, lut[jA * 2 + 1]); + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; + rgba[i][ACOMP] = alpha;; + } + } + else { +#if CHAN_TYPE == GL_UNSIGNED_BYTE + if (table->Size == 256) { + /* common case */ + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLchan l = lut[rgba[i][RCOMP] * 2 + 0]; + GLchan a = lut[rgba[i][ACOMP] * 2 + 1];; + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = l; + rgba[i][ACOMP] = a; + } + } + else +#endif + { + const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jL = IROUND((GLfloat) rgba[i][RCOMP] * scale); + GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale); + GLchan luminance = lut[jL * 2 + 0]; + GLchan alpha = lut[jA * 2 + 1]; + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; + rgba[i][ACOMP] = alpha; + } + } + } + break; + case GL_RGB: + /* replace RGB with RGB */ + if (table->Type == GL_FLOAT) { + const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + 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); + CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 3 + 0]); + CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 3 + 1]); + CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 3 + 2]); + } + } + else { +#if CHAN_TYPE == GL_UNSIGNED_BYTE + if (table->Size == 256) { + /* common case */ + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + 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 +#endif + { + const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + 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: + /* replace RGBA with RGBA */ + if (table->Type == GL_FLOAT) { + const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + 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]); + } + } + else { +#if CHAN_TYPE == GL_UNSIGNED_BYTE + if (table->Size == 256) { + /* common case */ + const GLchan *lut = (const GLchan *) table->Table; + GLuint i; + 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 +#endif + { + const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + 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; + } +} + + + +/* + * Apply color index shift and offset to an array of pixels. + */ +void +_mesa_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) +{ + GLint shift = ctx->Pixel.IndexShift; + GLint offset = ctx->Pixel.IndexOffset; + GLuint i; + if (shift > 0) { + for (i=0;i> shift) + offset; + } + } + else { + for (i=0;iPixel.MapItoIsize - 1; + GLuint i; + for (i = 0; i < n; i++) { + const GLuint j = index[i] & mask; + index[i] = IROUND(ctx->Pixel.MapItoI[j]); + } +} + + +/* + * Map color indexes to rgba values. + */ +void +_mesa_map_ci_to_rgba_chan( const GLcontext *ctx, GLuint n, + const GLuint index[], GLchan rgba[][4] ) +{ +#if CHAN_BITS == 8 + GLuint rmask = ctx->Pixel.MapItoRsize - 1; + GLuint gmask = ctx->Pixel.MapItoGsize - 1; + GLuint bmask = ctx->Pixel.MapItoBsize - 1; + GLuint amask = ctx->Pixel.MapItoAsize - 1; + const GLubyte *rMap = ctx->Pixel.MapItoR8; + const GLubyte *gMap = ctx->Pixel.MapItoG8; + const GLubyte *bMap = ctx->Pixel.MapItoB8; + const GLubyte *aMap = ctx->Pixel.MapItoA8; + GLuint i; + for (i=0;iPixel.MapItoRsize - 1; + GLuint gmask = ctx->Pixel.MapItoGsize - 1; + GLuint bmask = ctx->Pixel.MapItoBsize - 1; + GLuint amask = ctx->Pixel.MapItoAsize - 1; + const GLfloat *rMap = ctx->Pixel.MapItoR; + const GLfloat *gMap = ctx->Pixel.MapItoG; + const GLfloat *bMap = ctx->Pixel.MapItoB; + const GLfloat *aMap = ctx->Pixel.MapItoA; + GLuint i; + for (i=0;iPixel.MapItoRsize - 1; + GLuint gmask = ctx->Pixel.MapItoGsize - 1; + GLuint bmask = ctx->Pixel.MapItoBsize - 1; + GLuint amask = ctx->Pixel.MapItoAsize - 1; + const GLfloat *rMap = ctx->Pixel.MapItoR; + const GLfloat *gMap = ctx->Pixel.MapItoG; + const GLfloat *bMap = ctx->Pixel.MapItoB; + const GLfloat *aMap = ctx->Pixel.MapItoA; + GLuint i; + for (i=0;iPixel.MapItoRsize - 1; + GLuint gmask = ctx->Pixel.MapItoGsize - 1; + GLuint bmask = ctx->Pixel.MapItoBsize - 1; + GLuint amask = ctx->Pixel.MapItoAsize - 1; + const GLubyte *rMap = ctx->Pixel.MapItoR8; + const GLubyte *gMap = ctx->Pixel.MapItoG8; + const GLubyte *bMap = ctx->Pixel.MapItoB8; + const GLubyte *aMap = ctx->Pixel.MapItoA8; + GLuint i; + for (i=0;iPixel.MapItoRsize - 1; + GLuint gmask = ctx->Pixel.MapItoGsize - 1; + GLuint bmask = ctx->Pixel.MapItoBsize - 1; + GLuint amask = ctx->Pixel.MapItoAsize - 1; + const GLfloat *rMap = ctx->Pixel.MapItoR; + const GLfloat *gMap = ctx->Pixel.MapItoG; + const GLfloat *bMap = ctx->Pixel.MapItoB; + const GLfloat *aMap = ctx->Pixel.MapItoA; + GLuint i; + for (i=0;iPixel.IndexShift; + GLint offset = ctx->Pixel.IndexOffset; + if (shift > 0) { + for (i=0;i> shift) + offset; + } + } + else { + for (i=0;iPixel.MapStoSsize - 1; + GLuint i; + for (i=0;iPixel.MapStoS[ stencil[i] & mask ]; + } +} + + + +/* + * This function converts an array of GLchan colors to GLfloat colors. + * Most importantly, it undoes the non-uniform quantization of pixel + * values introduced when we convert shallow (< 8 bit) pixel values + * to GLubytes in the ctx->Driver.ReadRGBASpan() functions. + * This fixes a number of OpenGL conformance failures when running on + * 16bpp displays, for example. + */ +void +_mesa_chan_to_float_span(const GLcontext *ctx, GLuint n, + CONST GLchan rgba[][4], GLfloat rgbaf[][4]) +{ +#if CHAN_TYPE == GL_FLOAT + MEMCPY(rgbaf, rgba, n * 4 * sizeof(GLfloat)); +#else + const GLuint rShift = CHAN_BITS - ctx->Visual.redBits; + const GLuint gShift = CHAN_BITS - ctx->Visual.greenBits; + const GLuint bShift = CHAN_BITS - ctx->Visual.blueBits; + GLuint aShift; + const GLfloat rScale = 1.0F / (GLfloat) ((1 << ctx->Visual.redBits ) - 1); + const GLfloat gScale = 1.0F / (GLfloat) ((1 << ctx->Visual.greenBits) - 1); + const GLfloat bScale = 1.0F / (GLfloat) ((1 << ctx->Visual.blueBits ) - 1); + GLfloat aScale; + GLuint i; + + if (ctx->Visual.alphaBits > 0) { + aShift = CHAN_BITS - ctx->Visual.alphaBits; + aScale = 1.0F / (GLfloat) ((1 << ctx->Visual.alphaBits) - 1); + } + else { + aShift = 0; + aScale = 1.0F / CHAN_MAXF; + } + + for (i = 0; i < n; i++) { + const GLint r = rgba[i][RCOMP] >> rShift; + const GLint g = rgba[i][GCOMP] >> gShift; + const GLint b = rgba[i][BCOMP] >> bShift; + const GLint a = rgba[i][ACOMP] >> aShift; + rgbaf[i][RCOMP] = (GLfloat) r * rScale; + rgbaf[i][GCOMP] = (GLfloat) g * gScale; + rgbaf[i][BCOMP] = (GLfloat) b * bScale; + rgbaf[i][ACOMP] = (GLfloat) a * aScale; + } +#endif +} + +/**********************************************************************/ +/***** State Management *****/ +/**********************************************************************/ + +/* + * Return a bitmask of IMAGE_*_BIT flags which to indicate which + * pixel transfer operations are enabled. + */ +static void +update_image_transfer_state(GLcontext *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; + + if (ctx->Pixel.ColorTableEnabled) + mask |= IMAGE_COLOR_TABLE_BIT; + + if (ctx->Pixel.Convolution1DEnabled || + ctx->Pixel.Convolution2DEnabled || + ctx->Pixel.Separable2DEnabled) { + mask |= IMAGE_CONVOLUTION_BIT; + if (ctx->Pixel.PostConvolutionScale[0] != 1.0F || + ctx->Pixel.PostConvolutionScale[1] != 1.0F || + ctx->Pixel.PostConvolutionScale[2] != 1.0F || + ctx->Pixel.PostConvolutionScale[3] != 1.0F || + ctx->Pixel.PostConvolutionBias[0] != 0.0F || + ctx->Pixel.PostConvolutionBias[1] != 0.0F || + ctx->Pixel.PostConvolutionBias[2] != 0.0F || + ctx->Pixel.PostConvolutionBias[3] != 0.0F) { + mask |= IMAGE_POST_CONVOLUTION_SCALE_BIAS; + } + } + + if (ctx->Pixel.PostConvolutionColorTableEnabled) + mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT; + + if (ctx->ColorMatrixStack.Top->type != MATRIX_IDENTITY || + ctx->Pixel.PostColorMatrixScale[0] != 1.0F || + ctx->Pixel.PostColorMatrixBias[0] != 0.0F || + ctx->Pixel.PostColorMatrixScale[1] != 1.0F || + ctx->Pixel.PostColorMatrixBias[1] != 0.0F || + ctx->Pixel.PostColorMatrixScale[2] != 1.0F || + ctx->Pixel.PostColorMatrixBias[2] != 0.0F || + ctx->Pixel.PostColorMatrixScale[3] != 1.0F || + ctx->Pixel.PostColorMatrixBias[3] != 0.0F) + mask |= IMAGE_COLOR_MATRIX_BIT; + + if (ctx->Pixel.PostColorMatrixColorTableEnabled) + mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT; + + if (ctx->Pixel.HistogramEnabled) + mask |= IMAGE_HISTOGRAM_BIT; + + if (ctx->Pixel.MinMaxEnabled) + mask |= IMAGE_MIN_MAX_BIT; + + ctx->_ImageTransferState = mask; +} + + +void _mesa_update_pixel( GLcontext *ctx, GLuint new_state ) +{ + if (new_state & _NEW_COLOR_MATRIX) + _math_matrix_analyse( ctx->ColorMatrixStack.Top ); + + /* References ColorMatrix.type (derived above). + */ + if (new_state & _IMAGE_NEW_TRANSFER_STATE) + update_image_transfer_state(ctx); +} + + +/**********************************************************************/ +/***** Initialization *****/ +/**********************************************************************/ + + +/** + * Initialize the context's PIXEL attribute group. + */ +void +_mesa_init_pixel( GLcontext *ctx ) +{ + int i; + + /* 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; + ctx->Pixel.MapStoSsize = 1; + ctx->Pixel.MapItoIsize = 1; + ctx->Pixel.MapItoRsize = 1; + ctx->Pixel.MapItoGsize = 1; + ctx->Pixel.MapItoBsize = 1; + ctx->Pixel.MapItoAsize = 1; + ctx->Pixel.MapRtoRsize = 1; + ctx->Pixel.MapGtoGsize = 1; + ctx->Pixel.MapBtoBsize = 1; + ctx->Pixel.MapAtoAsize = 1; + ctx->Pixel.MapStoS[0] = 0; + ctx->Pixel.MapItoI[0] = 0.0; + ctx->Pixel.MapItoR[0] = 0.0; + ctx->Pixel.MapItoG[0] = 0.0; + ctx->Pixel.MapItoB[0] = 0.0; + ctx->Pixel.MapItoA[0] = 0.0; + ctx->Pixel.MapItoR8[0] = 0; + ctx->Pixel.MapItoG8[0] = 0; + ctx->Pixel.MapItoB8[0] = 0; + ctx->Pixel.MapItoA8[0] = 0; + ctx->Pixel.MapRtoR[0] = 0.0; + ctx->Pixel.MapGtoG[0] = 0.0; + ctx->Pixel.MapBtoB[0] = 0.0; + ctx->Pixel.MapAtoA[0] = 0.0; + ctx->Pixel.HistogramEnabled = GL_FALSE; + ctx->Pixel.MinMaxEnabled = GL_FALSE; + ctx->Pixel.PixelTextureEnabled = GL_FALSE; + ctx->Pixel.FragmentRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; + ctx->Pixel.FragmentAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; + ASSIGN_4V(ctx->Pixel.PostColorMatrixScale, 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.PostColorMatrixBias, 0.0, 0.0, 0.0, 0.0); + ASSIGN_4V(ctx->Pixel.ColorTableScale, 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.ColorTableBias, 0.0, 0.0, 0.0, 0.0); + ASSIGN_4V(ctx->Pixel.PCCTscale, 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.PCCTbias, 0.0, 0.0, 0.0, 0.0); + ASSIGN_4V(ctx->Pixel.PCMCTscale, 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.PCMCTbias, 0.0, 0.0, 0.0, 0.0); + ctx->Pixel.ColorTableEnabled = GL_FALSE; + ctx->Pixel.PostConvolutionColorTableEnabled = GL_FALSE; + ctx->Pixel.PostColorMatrixColorTableEnabled = GL_FALSE; + ctx->Pixel.Convolution1DEnabled = GL_FALSE; + ctx->Pixel.Convolution2DEnabled = GL_FALSE; + ctx->Pixel.Separable2DEnabled = GL_FALSE; + for (i = 0; i < 3; i++) { + ASSIGN_4V(ctx->Pixel.ConvolutionBorderColor[i], 0.0, 0.0, 0.0, 0.0); + ctx->Pixel.ConvolutionBorderMode[i] = GL_REDUCE; + ASSIGN_4V(ctx->Pixel.ConvolutionFilterScale[i], 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.ConvolutionFilterBias[i], 0.0, 0.0, 0.0, 0.0); + } + for (i = 0; i < MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_WIDTH * 4; i++) { + ctx->Convolution1D.Filter[i] = 0.0; + ctx->Convolution2D.Filter[i] = 0.0; + ctx->Separable2D.Filter[i] = 0.0; + } + ASSIGN_4V(ctx->Pixel.PostConvolutionScale, 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.PostConvolutionBias, 0.0, 0.0, 0.0, 0.0); + /* 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); + + /* 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 + ctx->Pack.BufferObj = ctx->Array.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 + ctx->Unpack.BufferObj = ctx->Array.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 + ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; +#endif + + if (ctx->Visual.doubleBufferMode) { + ctx->Pixel.ReadBuffer = GL_BACK; + } + else { + ctx->Pixel.ReadBuffer = GL_FRONT; + } + + /* Miscellaneous */ + ctx->_ImageTransferState = 0; +} diff --git a/reactos/dll/mesa32/src/main/pixel.h b/reactos/dll/mesa32/src/main/pixel.h new file mode 100644 index 00000000000..9eef0cff5af --- /dev/null +++ b/reactos/dll/mesa32/src/main/pixel.h @@ -0,0 +1,153 @@ +/** + * \file pixel.h + * Pixel operations. + */ + +/* + * 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. + */ + + +#ifndef PIXEL_H +#define PIXEL_H + + +#include "mtypes.h" + + +/** \name API functions */ +/*@{*/ + +extern void GLAPIENTRY +_mesa_GetPixelMapfv( GLenum map, GLfloat *values ); + +extern void GLAPIENTRY +_mesa_GetPixelMapuiv( GLenum map, GLuint *values ); + +extern void GLAPIENTRY +_mesa_GetPixelMapusv( GLenum map, GLushort *values ); + +extern void GLAPIENTRY +_mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values ); + +extern void GLAPIENTRY +_mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values ); + +extern void GLAPIENTRY +_mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ); + +extern void GLAPIENTRY +_mesa_PixelStoref( GLenum pname, GLfloat param ); + + +extern void GLAPIENTRY +_mesa_PixelStorei( GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_PixelTransferf( GLenum pname, GLfloat param ); + +extern void GLAPIENTRY +_mesa_PixelTransferi( GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ); + +/*@}*/ + + +/** \name Pixel processing functions */ +/*@{*/ + +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 GLcontext *ctx, GLuint n, GLfloat rgba[][4]); + + +extern void +_mesa_transform_rgba(const GLcontext *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_chan(const struct gl_color_table *table, + GLuint n, GLchan rgba[][4]); + + +extern void +_mesa_shift_and_offset_ci(const GLcontext *ctx, GLuint n, + GLuint indexes[]); + + +extern void +_mesa_map_ci(const GLcontext *ctx, GLuint n, GLuint index[]); + + +extern void +_mesa_map_ci_to_rgba_chan(const GLcontext *ctx, + GLuint n, const GLuint index[], + GLchan rgba[][4]); + + +extern void +_mesa_map_ci_to_rgba(const GLcontext *ctx, + GLuint n, const GLuint index[], GLfloat rgba[][4]); + + +extern void +_mesa_map_ci8_to_rgba(const GLcontext *ctx, + GLuint n, const GLubyte index[], + GLchan rgba[][4]); + + +extern void +_mesa_shift_and_offset_stencil(const GLcontext *ctx, GLuint n, + GLstencil indexes[]); + + +extern void +_mesa_map_stencil(const GLcontext *ctx, GLuint n, GLstencil index[]); + + +extern void +_mesa_chan_to_float_span(const GLcontext *ctx, GLuint n, + CONST GLchan rgba[][4], GLfloat rgbaf[][4]); + + +extern void +_mesa_update_pixel( GLcontext *ctx, GLuint newstate ); + +extern void +_mesa_init_pixel( GLcontext * ctx ); + +/*@}*/ + +#endif diff --git a/reactos/dll/mesa32/src/main/points.c b/reactos/dll/mesa32/src/main/points.c new file mode 100644 index 00000000000..aa36fb62877 --- /dev/null +++ b/reactos/dll/mesa32/src/main/points.c @@ -0,0 +1,294 @@ +/** + * \file points.c + * 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. + */ + + +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "points.h" +#include "texstate.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 + +/* + * Added by GL_NV_point_sprite + */ +void GLAPIENTRY +_mesa_PointParameteriNV( GLenum pname, GLint param ) +{ + const GLfloat value = (GLfloat) param; + _mesa_PointParameterfvEXT(pname, &value); +} + + +/* + * Added by GL_NV_point_sprite + */ +void GLAPIENTRY +_mesa_PointParameterivNV( GLenum pname, const GLint *params ) +{ + const GLfloat value = (GLfloat) params[0]; + _mesa_PointParameterfvEXT(pname, &value); +} + + + +/* + * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters. + */ +void GLAPIENTRY +_mesa_PointParameterfEXT( GLenum pname, GLfloat param) +{ + _mesa_PointParameterfvEXT(pname, ¶m); +} + + + +/* + * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters. + */ +void GLAPIENTRY +_mesa_PointParameterfvEXT( 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); + } + 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: + 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 + + + +/** + * Update derived point-related state. + */ +void +_mesa_update_point(GLcontext *ctx) +{ + /* clamp to user-specified limits now, clamp to ctx->Const.Min/Max + * limits during rasterization. + */ + ctx->Point._Size = CLAMP(ctx->Point.Size, + ctx->Point.MinSize, + ctx->Point.MaxSize); + + if (ctx->Point._Size == 1.0F) + ctx->_TriangleCaps &= ~DD_POINT_SIZE; + else + ctx->_TriangleCaps |= DD_POINT_SIZE; + + 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; +} + + + +/** + * Initialize the context point state. + * + * \param ctx GL context. + * + * Initializes __GLcontextRec::Point and point related constants in + * __GLcontextRec::Const. + */ +void +_mesa_init_point(GLcontext *ctx) +{ + GLuint i; + + ctx->Point.SmoothFlag = GL_FALSE; + ctx->Point.Size = 1.0; + 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 < MAX_TEXTURE_UNITS; i++) { + ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_ARB/NV_point_sprite */ + } +} diff --git a/reactos/dll/mesa32/src/main/points.h b/reactos/dll/mesa32/src/main/points.h new file mode 100644 index 00000000000..56acd9ee574 --- /dev/null +++ b/reactos/dll/mesa32/src/main/points.h @@ -0,0 +1,60 @@ +/** + * \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 "mtypes.h" + + +extern void GLAPIENTRY +_mesa_PointSize( GLfloat size ); + +extern void GLAPIENTRY +_mesa_PointParameteriNV( GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_PointParameterivNV( GLenum pname, const GLint *params ); + +extern void GLAPIENTRY +_mesa_PointParameterfEXT( GLenum pname, GLfloat param ); + +extern void GLAPIENTRY +_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params ); + +extern void +_mesa_update_point(GLcontext *ctx); + +extern void +_mesa_init_point( GLcontext * ctx ); + + +#endif diff --git a/reactos/dll/mesa32/src/main/polygon.c b/reactos/dll/mesa32/src/main/polygon.c new file mode 100644 index 00000000000..b771408cf36 --- /dev/null +++ b/reactos/dll/mesa32/src/main/polygon.c @@ -0,0 +1,383 @@ +/** + * \file polygon.c + * Polygon operations. + */ + +/* + * 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. + */ + + +#include "glheader.h" +#include "imports.h" +#include "bufferobj.h" +#include "context.h" +#include "image.h" +#include "enums.h" +#include "macros.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; + } + + ctx->_TriangleCaps &= ~DD_TRI_UNFILLED; + if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=GL_FILL) + 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(GLcontext *ctx, const GLubyte *pattern) +{ + if (ctx->Unpack.BufferObj->Name) { + /* Get/unpack the stipple pattern from a PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(2, &ctx->Unpack, 32, 32, 1, + GL_COLOR_INDEX, GL_BITMAP, pattern)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glPolygonStipple(bad PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, + ctx->Unpack.BufferObj); + if (!buf) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glPolygonStipple(PBO mapped)"); + return; + } + buf = ADD_POINTERS(buf, pattern); + _mesa_unpack_polygon_stipple(buf, ctx->PolygonStipple, &ctx->Unpack); + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + ctx->Unpack.BufferObj); + } + else { + /* Get/unpack the stipple pattern from user memory */ + _mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &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"); + + /* XXX someday we may put this code into a separate function and call + * it with ctx->Driver.GetPolygonStipple(). + */ + if (ctx->Pack.BufferObj->Name) { + /* Put/pack the stipple pattern into a PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(2, &ctx->Pack, 32, 32, 1, + GL_COLOR_INDEX, GL_BITMAP, dest)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetPolygonStipple(bad PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + ctx->Pack.BufferObj); + if (!buf) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetPolygonStipple(PBO mapped)"); + return; + } + buf = ADD_POINTERS(buf, dest); + _mesa_pack_polygon_stipple(ctx->PolygonStipple, buf, &ctx->Pack); + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + ctx->Pack.BufferObj); + } + else { + /* Put/pack the stipple pattern into user memory */ + _mesa_pack_polygon_stipple(ctx->PolygonStipple, dest, &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 State Management */ +/*@{*/ + +/* + * Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET + * in ctx->_TriangleCaps if needed. + */ +void _mesa_update_polygon( GLcontext *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; + + /* Any Polygon offsets enabled? */ + if (ctx->Polygon.OffsetPoint || + ctx->Polygon.OffsetLine || + ctx->Polygon.OffsetFill) { + ctx->_TriangleCaps |= DD_TRI_OFFSET; + } +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Initialization */ +/*@{*/ + +/** + * Initialize the context polygon state. + * + * \param ctx GL context. + * + * Initializes __GLcontextRec::Polygon and __GLcontextRec::PolygonStipple + * attribute groups. + */ +void _mesa_init_polygon( GLcontext * 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/reactos/dll/mesa32/src/main/polygon.h b/reactos/dll/mesa32/src/main/polygon.h new file mode 100644 index 00000000000..2550ed16877 --- /dev/null +++ b/reactos/dll/mesa32/src/main/polygon.h @@ -0,0 +1,69 @@ +/** + * \file polygon.h + * Polygon operations. + */ + +/* + * 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. + */ + + +#ifndef POLYGON_H +#define POLYGON_H + + +#include "mtypes.h" + + +extern void +_mesa_polygon_stipple(GLcontext *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_update_polygon( GLcontext *ctx ); + +extern void +_mesa_init_polygon( GLcontext * ctx ); + +#endif diff --git a/reactos/dll/mesa32/src/main/rastpos.c b/reactos/dll/mesa32/src/main/rastpos.c new file mode 100644 index 00000000000..507eb9f9843 --- /dev/null +++ b/reactos/dll/mesa32/src/main/rastpos.c @@ -0,0 +1,1001 @@ +/* + * 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. + */ + + +/** + * \file rastpos.c + * Raster position operations. + */ + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "feedback.h" +#include "light.h" +#include "macros.h" +#include "rastpos.h" +#include "state.h" +#include "simple_list.h" +#include "mtypes.h" + +#include "math/m_matrix.h" + + +/** + * Clip a point against the view volume. + * + * \param v vertex vector describing the point to clip. + * + * \return zero if outside view volume, or one if inside. + */ +static GLuint +viewclip_point( const GLfloat v[] ) +{ + if ( v[0] > v[3] || v[0] < -v[3] + || v[1] > v[3] || v[1] < -v[3] + || v[2] > v[3] || v[2] < -v[3] ) { + return 0; + } + else { + return 1; + } +} + + +/** + * Clip a point against the far/near Z clipping planes. + * + * \param v vertex vector describing the point to clip. + * + * \return zero if outside view volume, or one if inside. + */ +static GLuint +viewclip_point_z( const GLfloat v[] ) +{ + if (v[2] > v[3] || v[2] < -v[3] ) { + return 0; + } + else { + return 1; + } +} + + +/** + * Clip a point against the user clipping planes. + * + * \param ctx GL context. + * \param v vertex vector describing the point to clip. + * + * \return zero if the point was clipped, or one otherwise. + */ +static GLuint +userclip_point( GLcontext *ctx, const GLfloat v[] ) +{ + GLuint p; + + for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { + GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0] + + v[1] * ctx->Transform._ClipUserPlane[p][1] + + v[2] * ctx->Transform._ClipUserPlane[p][2] + + v[3] * ctx->Transform._ClipUserPlane[p][3]; + if (dot < 0.0F) { + return 0; + } + } + } + + return 1; +} + + +/** + * This has been split off to allow the normal shade routines to + * get a little closer to the vertex buffer, and to use the + * GLvector objects directly. + * \param ctx the context + * \param vertex vertex location + * \param normal normal vector + * \param Rcolor returned color + * \param Rspec returned specular color (if separate specular enabled) + * \param Rindex returned color index + */ +static void +shade_rastpos(GLcontext *ctx, + const GLfloat vertex[4], + const GLfloat normal[3], + GLfloat Rcolor[4], + GLfloat Rspec[4], + GLfloat *Rindex) +{ + GLfloat (*base)[3] = ctx->Light._BaseColor; + struct gl_light *light; + GLfloat diffuseColor[4], specularColor[4]; + GLfloat diffuse = 0, specular = 0; + + if (!ctx->_ShineTable[0] || !ctx->_ShineTable[1]) + _mesa_validate_all_lighting_tables( ctx ); + + COPY_3V(diffuseColor, base[0]); + diffuseColor[3] = CLAMP( + ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3], 0.0F, 1.0F ); + ASSIGN_4V(specularColor, 0.0, 0.0, 0.0, 0.0); + + foreach (light, &ctx->Light.EnabledList) { + GLfloat n_dot_h; + GLfloat attenuation = 1.0; + GLfloat VP[3]; + GLfloat n_dot_VP; + GLfloat *h; + GLfloat diffuseContrib[3], specularContrib[3]; + GLboolean normalized; + + if (!(light->_Flags & LIGHT_POSITIONAL)) { + COPY_3V(VP, light->_VP_inf_norm); + attenuation = light->_VP_inf_spot_attenuation; + } + else { + GLfloat d; + + SUB_3V(VP, light->_Position, vertex); + d = (GLfloat) LEN_3FV( VP ); + + if ( d > 1e-6) { + GLfloat invd = 1.0F / d; + SELF_SCALE_SCALAR_3V(VP, invd); + } + attenuation = 1.0F / (light->ConstantAttenuation + d * + (light->LinearAttenuation + d * + light->QuadraticAttenuation)); + + if (light->_Flags & LIGHT_SPOT) { + GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + + if (PV_dot_dir_CosCutoff) { + continue; + } + else { + double x = PV_dot_dir * (EXP_TABLE_SIZE-1); + int k = (int) x; + GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] + + (x-k)*light->_SpotExpTable[k][1]); + attenuation *= spot; + } + } + } + + if (attenuation < 1e-3) + continue; + + n_dot_VP = DOT3( normal, VP ); + + if (n_dot_VP < 0.0F) { + ACC_SCALE_SCALAR_3V(diffuseColor, attenuation, light->_MatAmbient[0]); + continue; + } + + COPY_3V(diffuseContrib, light->_MatAmbient[0]); + ACC_SCALE_SCALAR_3V(diffuseContrib, n_dot_VP, light->_MatDiffuse[0]); + diffuse += n_dot_VP * light->_dli * attenuation; + ASSIGN_3V(specularContrib, 0.0, 0.0, 0.0); + + { + if (ctx->Light.Model.LocalViewer) { + GLfloat v[3]; + COPY_3V(v, vertex); + NORMALIZE_3FV(v); + SUB_3V(VP, VP, v); + h = VP; + normalized = 0; + } + else if (light->_Flags & LIGHT_POSITIONAL) { + h = VP; + ACC_3V(h, ctx->_EyeZDir); + normalized = 0; + } + else { + h = light->_h_inf_norm; + normalized = 1; + } + + n_dot_h = DOT3(normal, h); + + if (n_dot_h > 0.0F) { + GLfloat (*mat)[4] = ctx->Light.Material.Attrib; + GLfloat spec_coef; + GLfloat shininess = mat[MAT_ATTRIB_FRONT_SHININESS][0]; + + if (!normalized) { + n_dot_h *= n_dot_h; + n_dot_h /= LEN_SQUARED_3FV( h ); + shininess *= .5; + } + + GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec_coef ); + + if (spec_coef > 1.0e-10) { + if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) { + ACC_SCALE_SCALAR_3V( specularContrib, spec_coef, + light->_MatSpecular[0]); + } + else { + ACC_SCALE_SCALAR_3V( diffuseContrib, spec_coef, + light->_MatSpecular[0]); + } + specular += spec_coef * light->_sli * attenuation; + } + } + } + + ACC_SCALE_SCALAR_3V( diffuseColor, attenuation, diffuseContrib ); + ACC_SCALE_SCALAR_3V( specularColor, attenuation, specularContrib ); + } + + if (ctx->Visual.rgbMode) { + Rcolor[0] = CLAMP(diffuseColor[0], 0.0F, 1.0F); + Rcolor[1] = CLAMP(diffuseColor[1], 0.0F, 1.0F); + Rcolor[2] = CLAMP(diffuseColor[2], 0.0F, 1.0F); + Rcolor[3] = CLAMP(diffuseColor[3], 0.0F, 1.0F); + Rspec[0] = CLAMP(specularColor[0], 0.0F, 1.0F); + Rspec[1] = CLAMP(specularColor[1], 0.0F, 1.0F); + Rspec[2] = CLAMP(specularColor[2], 0.0F, 1.0F); + Rspec[3] = CLAMP(specularColor[3], 0.0F, 1.0F); + } + else { + GLfloat *ind = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_INDEXES]; + GLfloat d_a = ind[MAT_INDEX_DIFFUSE] - ind[MAT_INDEX_AMBIENT]; + GLfloat s_a = ind[MAT_INDEX_SPECULAR] - ind[MAT_INDEX_AMBIENT]; + GLfloat i = (ind[MAT_INDEX_AMBIENT] + + diffuse * (1.0F-specular) * d_a + + specular * s_a); + if (i > ind[MAT_INDEX_SPECULAR]) { + i = ind[MAT_INDEX_SPECULAR]; + } + *Rindex = i; + } +} + + +/** + * Do texgen needed for glRasterPos. + * \param ctx rendering context + * \param vObj object-space vertex coordinate + * \param vEye eye-space vertex coordinate + * \param normal vertex normal + * \param unit texture unit number + * \param texcoord incoming texcoord and resulting texcoord + */ +static void +compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4], + const GLfloat normal[3], GLuint unit, GLfloat texcoord[4]) +{ + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + + /* always compute sphere map terms, just in case */ + GLfloat u[3], two_nu, rx, ry, rz, m, mInv; + COPY_3V(u, vEye); + NORMALIZE_3FV(u); + two_nu = 2.0F * DOT3(normal, u); + rx = u[0] - normal[0] * two_nu; + ry = u[1] - normal[1] * two_nu; + rz = u[2] - normal[2] * two_nu; + m = rx * rx + ry * ry + (rz + 1.0F) * (rz + 1.0F); + if (m > 0.0F) + mInv = 0.5F * _mesa_inv_sqrtf(m); + else + mInv = 0.0F; + + if (texUnit->TexGenEnabled & S_BIT) { + switch (texUnit->GenModeS) { + case GL_OBJECT_LINEAR: + texcoord[0] = DOT4(vObj, texUnit->ObjectPlaneS); + break; + case GL_EYE_LINEAR: + texcoord[0] = DOT4(vEye, texUnit->EyePlaneS); + break; + case GL_SPHERE_MAP: + texcoord[0] = rx * mInv + 0.5F; + break; + case GL_REFLECTION_MAP: + texcoord[0] = rx; + break; + case GL_NORMAL_MAP: + texcoord[0] = normal[0]; + break; + default: + _mesa_problem(ctx, "Bad S texgen in compute_texgen()"); + return; + } + } + + if (texUnit->TexGenEnabled & T_BIT) { + switch (texUnit->GenModeT) { + case GL_OBJECT_LINEAR: + texcoord[1] = DOT4(vObj, texUnit->ObjectPlaneT); + break; + case GL_EYE_LINEAR: + texcoord[1] = DOT4(vEye, texUnit->EyePlaneT); + break; + case GL_SPHERE_MAP: + texcoord[1] = ry * mInv + 0.5F; + break; + case GL_REFLECTION_MAP: + texcoord[1] = ry; + break; + case GL_NORMAL_MAP: + texcoord[1] = normal[1]; + break; + default: + _mesa_problem(ctx, "Bad T texgen in compute_texgen()"); + return; + } + } + + if (texUnit->TexGenEnabled & R_BIT) { + switch (texUnit->GenModeR) { + case GL_OBJECT_LINEAR: + texcoord[2] = DOT4(vObj, texUnit->ObjectPlaneR); + break; + case GL_EYE_LINEAR: + texcoord[2] = DOT4(vEye, texUnit->EyePlaneR); + break; + case GL_REFLECTION_MAP: + texcoord[2] = rz; + break; + case GL_NORMAL_MAP: + texcoord[2] = normal[2]; + break; + default: + _mesa_problem(ctx, "Bad R texgen in compute_texgen()"); + return; + } + } + + if (texUnit->TexGenEnabled & Q_BIT) { + switch (texUnit->GenModeQ) { + case GL_OBJECT_LINEAR: + texcoord[3] = DOT4(vObj, texUnit->ObjectPlaneQ); + break; + case GL_EYE_LINEAR: + texcoord[3] = DOT4(vEye, texUnit->EyePlaneQ); + break; + default: + _mesa_problem(ctx, "Bad Q texgen in compute_texgen()"); + return; + } + } +} + + + +/** + * Set the raster position for pixel operations. + * + * All glRasterPos command call this function to update the current + * raster position. + * + * \param ctx GL context. + * \param x x coordinate for the raster position. + * \param y y coordinate for the raster position. + * \param z z coordinate for the raster position. + * \param w w coordinate for the raster position. + * + * \sa Called by _mesa_RasterPos4f(). + * + * Flushes the vertices, transforms and clips the vertex coordinates, and + * finally sets the current raster position and associated data in + * __GLcontextRec::Current. When in selection mode calls + * _mesa_update_hitflag() with the current raster position. + */ +static void +raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); + + if (ctx->NewState) + _mesa_update_state( ctx ); + + if (ctx->VertexProgram._Enabled) { + /* XXX implement this */ + _mesa_problem(ctx, "Vertex programs not implemented for glRasterPos"); + return; + } + else { + GLfloat obj[4], eye[4], clip[4], ndc[3], d; + GLfloat *norm, eyenorm[3]; + GLfloat *objnorm = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; + + ASSIGN_4V( obj, x, y, z, w ); + /* apply modelview matrix: eye = MV * obj */ + TRANSFORM_POINT( eye, ctx->ModelviewMatrixStack.Top->m, obj ); + /* apply projection matrix: clip = Proj * eye */ + TRANSFORM_POINT( clip, ctx->ProjectionMatrixStack.Top->m, eye ); + + /* clip to view volume */ + if (ctx->Transform.RasterPositionUnclipped) { + /* GL_IBM_rasterpos_clip: only clip against Z */ + if (viewclip_point_z(clip) == 0) { + ctx->Current.RasterPosValid = GL_FALSE; + return; + } + } + else if (viewclip_point(clip) == 0) { + /* Normal OpenGL behaviour */ + ctx->Current.RasterPosValid = GL_FALSE; + return; + } + + /* clip to user clipping planes */ + if (ctx->Transform.ClipPlanesEnabled && !userclip_point(ctx, clip)) { + ctx->Current.RasterPosValid = GL_FALSE; + return; + } + + /* ndc = clip / W */ + d = (clip[3] == 0.0F) ? 1.0F : 1.0F / clip[3]; + ndc[0] = clip[0] * d; + ndc[1] = clip[1] * d; + ndc[2] = clip[2] * d; + /* wincoord = viewport_mapping(ndc) */ + ctx->Current.RasterPos[0] = (ndc[0] * ctx->Viewport._WindowMap.m[MAT_SX] + + ctx->Viewport._WindowMap.m[MAT_TX]); + ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport._WindowMap.m[MAT_SY] + + ctx->Viewport._WindowMap.m[MAT_TY]); + ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport._WindowMap.m[MAT_SZ] + + ctx->Viewport._WindowMap.m[MAT_TZ]) + / ctx->DrawBuffer->_DepthMaxF; + ctx->Current.RasterPos[3] = clip[3]; + + /* compute raster distance */ + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) + ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; + else + ctx->Current.RasterDistance = + SQRTF( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] ); + + /* compute transformed normal vector (for lighting or texgen) */ + if (ctx->_NeedEyeCoords) { + const GLfloat *inv = ctx->ModelviewMatrixStack.Top->inv; + TRANSFORM_NORMAL( eyenorm, objnorm, inv ); + norm = eyenorm; + } + else { + norm = objnorm; + } + + /* update raster color */ + if (ctx->Light.Enabled) { + /* lighting */ + shade_rastpos( ctx, obj, norm, + ctx->Current.RasterColor, + ctx->Current.RasterSecondaryColor, + &ctx->Current.RasterIndex ); + } + else { + /* use current color or index */ + if (ctx->Visual.rgbMode) { + COPY_4FV(ctx->Current.RasterColor, + ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); + COPY_4FV(ctx->Current.RasterSecondaryColor, + ctx->Current.Attrib[VERT_ATTRIB_COLOR1]); + } + else { + ctx->Current.RasterIndex = ctx->Current.Index; + } + } + + /* texture coords */ + { + GLuint u; + for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) { + GLfloat tc[4]; + COPY_4V(tc, ctx->Current.Attrib[VERT_ATTRIB_TEX0 + u]); + if (ctx->Texture.Unit[u].TexGenEnabled) { + compute_texgen(ctx, obj, eye, norm, u, tc); + } + TRANSFORM_POINT(ctx->Current.RasterTexCoords[u], + ctx->TextureMatrixStack[u].Top->m, tc); + } + } + + ctx->Current.RasterPosValid = GL_TRUE; + } + + if (ctx->RenderMode == GL_SELECT) { + _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); + } +} + + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos2d(GLdouble x, GLdouble y) +{ + _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos2f(GLfloat x, GLfloat y) +{ + _mesa_RasterPos4f(x, y, 0.0F, 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos2i(GLint x, GLint y) +{ + _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos2s(GLshort x, GLshort y) +{ + _mesa_RasterPos4f(x, y, 0.0F, 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) +{ + _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) +{ + _mesa_RasterPos4f(x, y, z, 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos3i(GLint x, GLint y, GLint z) +{ + _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z) +{ + _mesa_RasterPos4f(x, y, z, 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +/** Calls raster_pos4f() */ +void GLAPIENTRY +_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + GET_CURRENT_CONTEXT(ctx); + raster_pos4f(ctx, x, y, z, w); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w) +{ + _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) +{ + _mesa_RasterPos4f(x, y, z, w); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos2dv(const GLdouble *v) +{ + _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos2fv(const GLfloat *v) +{ + _mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos2iv(const GLint *v) +{ + _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos2sv(const GLshort *v) +{ + _mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos3dv(const GLdouble *v) +{ + _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos3fv(const GLfloat *v) +{ + _mesa_RasterPos4f(v[0], v[1], v[2], 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos3iv(const GLint *v) +{ + _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos3sv(const GLshort *v) +{ + _mesa_RasterPos4f(v[0], v[1], v[2], 1.0F); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos4dv(const GLdouble *v) +{ + _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos4fv(const GLfloat *v) +{ + _mesa_RasterPos4f(v[0], v[1], v[2], v[3]); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos4iv(const GLint *v) +{ + _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +/** Calls _mesa_RasterPos4f() */ +void GLAPIENTRY +_mesa_RasterPos4sv(const GLshort *v) +{ + _mesa_RasterPos4f(v[0], v[1], v[2], v[3]); +} + + +/**********************************************************************/ +/*** GL_ARB_window_pos / GL_MESA_window_pos ***/ +/**********************************************************************/ + +#if FEATURE_windowpos +/** + * 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 */ + if (ctx->Visual.rgbMode) { + 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); + } + else { + ctx->Current.RasterIndex = ctx->Current.Index; + } + + /* raster texcoord = current texcoord */ + { + GLuint texSet; + for (texSet = 0; texSet < ctx->Const.MaxTextureCoordUnits; texSet++) { + 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; +} + + +void GLAPIENTRY +_mesa_WindowPos2dMESA(GLdouble x, GLdouble y) +{ + window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos2fMESA(GLfloat x, GLfloat y) +{ + window_pos4f(x, y, 0.0F, 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos2iMESA(GLint x, GLint y) +{ + window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos2sMESA(GLshort x, GLshort y) +{ + window_pos4f(x, y, 0.0F, 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) +{ + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) +{ + window_pos4f(x, y, z, 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z) +{ + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) +{ + window_pos4f(x, y, z, 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +void GLAPIENTRY +_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + window_pos4f(x, y, z, w); +} + +void GLAPIENTRY +_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) +{ + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +void GLAPIENTRY +_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) +{ + window_pos4f(x, y, z, w); +} + +void GLAPIENTRY +_mesa_WindowPos2dvMESA(const GLdouble *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos2fvMESA(const GLfloat *v) +{ + window_pos4f(v[0], v[1], 0.0F, 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos2ivMESA(const GLint *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos2svMESA(const GLshort *v) +{ + window_pos4f(v[0], v[1], 0.0F, 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos3dvMESA(const GLdouble *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos3fvMESA(const GLfloat *v) +{ + window_pos4f(v[0], v[1], v[2], 1.0); +} + +void GLAPIENTRY +_mesa_WindowPos3ivMESA(const GLint *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos3svMESA(const GLshort *v) +{ + window_pos4f(v[0], v[1], v[2], 1.0F); +} + +void GLAPIENTRY +_mesa_WindowPos4dvMESA(const GLdouble *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +void GLAPIENTRY +_mesa_WindowPos4fvMESA(const GLfloat *v) +{ + window_pos4f(v[0], v[1], v[2], v[3]); +} + +void GLAPIENTRY +_mesa_WindowPos4ivMESA(const GLint *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +void GLAPIENTRY +_mesa_WindowPos4svMESA(const GLshort *v) +{ + window_pos4f(v[0], v[1], v[2], v[3]); +} + +#endif + +#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 + + +/**********************************************************************/ +/** \name Initialization */ +/**********************************************************************/ +/*@{*/ + +/** + * Initialize the context current raster position information. + * + * \param ctx GL context. + * + * Initialize the current raster position information in + * __GLcontextRec::Current, and adds the extension entry points to the + * dispatcher. + */ +void _mesa_init_rastpos( GLcontext * 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 ); + ctx->Current.RasterIndex = 1.0; + for (i=0; iCurrent.RasterTexCoords[i], 0.0, 0.0, 0.0, 1.0 ); + ctx->Current.RasterPosValid = GL_TRUE; +} + +/*@}*/ diff --git a/reactos/dll/mesa32/src/main/rastpos.h b/reactos/dll/mesa32/src/main/rastpos.h new file mode 100644 index 00000000000..363f86ad87b --- /dev/null +++ b/reactos/dll/mesa32/src/main/rastpos.h @@ -0,0 +1,193 @@ +/** + * \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 "glheader.h" + + +extern void GLAPIENTRY +_mesa_RasterPos2d(GLdouble x, GLdouble y); + +extern void GLAPIENTRY +_mesa_RasterPos2f(GLfloat x, GLfloat y); + +extern void GLAPIENTRY +_mesa_RasterPos2i(GLint x, GLint y); + +extern void GLAPIENTRY +_mesa_RasterPos2s(GLshort x, GLshort y); + +extern void GLAPIENTRY +_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z); + +extern void GLAPIENTRY +_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z); + +extern void GLAPIENTRY +_mesa_RasterPos3i(GLint x, GLint y, GLint z); + +extern void GLAPIENTRY +_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z); + +extern void GLAPIENTRY +_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w); + +extern void GLAPIENTRY +_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w); + +extern void GLAPIENTRY +_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w); + +extern void GLAPIENTRY +_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w); + +extern void GLAPIENTRY +_mesa_RasterPos2dv(const GLdouble *v); + +extern void GLAPIENTRY +_mesa_RasterPos2fv(const GLfloat *v); + +extern void GLAPIENTRY +_mesa_RasterPos2iv(const GLint *v); + +extern void GLAPIENTRY +_mesa_RasterPos2sv(const GLshort *v); + +extern void GLAPIENTRY +_mesa_RasterPos3dv(const GLdouble *v); + +extern void GLAPIENTRY +_mesa_RasterPos3fv(const GLfloat *v); + +extern void GLAPIENTRY +_mesa_RasterPos3iv(const GLint *v); + +extern void GLAPIENTRY +_mesa_RasterPos3sv(const GLshort *v); + +extern void GLAPIENTRY +_mesa_RasterPos4dv(const GLdouble *v); + +extern void GLAPIENTRY +_mesa_RasterPos4fv(const GLfloat *v); + +extern void GLAPIENTRY +_mesa_RasterPos4iv(const GLint *v); + +extern void GLAPIENTRY +_mesa_RasterPos4sv(const GLshort *v); + + +/**********************************************************************/ +/** \name GL_MESA_window_pos */ +/**********************************************************************/ +/*@{*/ + +extern void GLAPIENTRY +_mesa_WindowPos2dMESA(GLdouble x, GLdouble y); + +extern void GLAPIENTRY +_mesa_WindowPos2fMESA(GLfloat x, GLfloat y); + +extern void GLAPIENTRY +_mesa_WindowPos2iMESA(GLint x, GLint y); + +extern void GLAPIENTRY +_mesa_WindowPos2sMESA(GLshort x, GLshort y); + +extern void GLAPIENTRY +_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z); + +extern void GLAPIENTRY +_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z); + +extern void GLAPIENTRY +_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z); + +extern void GLAPIENTRY +_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z); + +extern void GLAPIENTRY +_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w); + +extern void GLAPIENTRY +_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w); + +extern void GLAPIENTRY +_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w); + +extern void GLAPIENTRY +_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w); + +extern void GLAPIENTRY +_mesa_WindowPos2dvMESA(const GLdouble *v); + +extern void GLAPIENTRY +_mesa_WindowPos2fvMESA(const GLfloat *v); + +extern void GLAPIENTRY +_mesa_WindowPos2ivMESA(const GLint *v); + +extern void GLAPIENTRY +_mesa_WindowPos2svMESA(const GLshort *v); + +extern void GLAPIENTRY +_mesa_WindowPos3dvMESA(const GLdouble *v); + +extern void GLAPIENTRY +_mesa_WindowPos3fvMESA(const GLfloat *v); + +extern void GLAPIENTRY +_mesa_WindowPos3ivMESA(const GLint *v); + +extern void GLAPIENTRY +_mesa_WindowPos3svMESA(const GLshort *v); + +extern void GLAPIENTRY +_mesa_WindowPos4dvMESA(const GLdouble *v); + +extern void GLAPIENTRY +_mesa_WindowPos4fvMESA(const GLfloat *v); + +extern void GLAPIENTRY +_mesa_WindowPos4ivMESA(const GLint *v); + +extern void GLAPIENTRY +_mesa_WindowPos4svMESA(const GLshort *v); + +extern void +_mesa_init_rastpos( GLcontext * ctx ); + +/*@}*/ + +#endif diff --git a/reactos/dll/mesa32/src/main/renderbuffer.c b/reactos/dll/mesa32/src/main/renderbuffer.c new file mode 100644 index 00000000000..42e94a31fe5 --- /dev/null +++ b/reactos/dll/mesa32/src/main/renderbuffer.c @@ -0,0 +1,1869 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +/** + * 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 "mtypes.h" +#include "fbobject.h" +#include "renderbuffer.h" + + +#define COLOR_INDEX32 0x424243 + + +/* + * 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 GLushort values. + * Typically stencil. + */ + +static void * +get_pointer_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, + GLint x, GLint y) +{ + if (!rb->Data) + return NULL; + ASSERT(rb->DataType == GL_UNSIGNED_BYTE); + return (GLubyte *) rb->Data + y * rb->Width + x; +} + + +static void +get_row_ubyte(GLcontext *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); + _mesa_memcpy(values, src, count * sizeof(GLubyte)); +} + + +static void +get_values_ubyte(GLcontext *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(GLcontext *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 { + _mesa_memcpy(dst, values, count * sizeof(GLubyte)); + } +} + + +static void +put_mono_row_ubyte(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *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); + _mesa_memcpy(values, src, count * sizeof(GLushort)); +} + + +static void +get_values_ushort(GLcontext *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(GLcontext *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 { + _mesa_memcpy(dst, src, count * sizeof(GLushort)); + } +} + + +static void +put_mono_row_ushort(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *ctx, struct gl_renderbuffer *rb, + GLint x, GLint y) +{ + if (!rb->Data) + return NULL; + ASSERT(rb->DataType == GL_UNSIGNED_INT); + return (GLuint *) rb->Data + y * rb->Width + x; +} + + +static void +get_row_uint(GLcontext *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); + _mesa_memcpy(values, src, count * sizeof(GLuint)); +} + + +static void +get_values_uint(GLcontext *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); + 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(GLcontext *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); + if (mask) { + GLuint i; + for (i = 0; i < count; i++) { + if (mask[i]) { + dst[i] = src[i]; + } + } + } + else { + _mesa_memcpy(dst, src, count * sizeof(GLuint)); + } +} + + +static void +put_mono_row_uint(GLcontext *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; + GLuint i; + ASSERT(rb->DataType == GL_UNSIGNED_INT); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + dst[i] = val; + } + } +} + + +static void +put_values_uint(GLcontext *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); + 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(GLcontext *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); + 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(GLcontext *ctx, struct gl_renderbuffer *rb, + GLint x, GLint y) +{ + /* 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(GLcontext *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->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(GLcontext *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 + 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(GLcontext *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->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(GLcontext *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->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(GLcontext *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->DataType == GL_UNSIGNED_BYTE); + if (!mask && val0 == val1 && val1 == val2) { + /* optimized case */ + _mesa_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(GLcontext *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->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(GLcontext *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->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(GLcontext *ctx, struct gl_renderbuffer *rb, + GLint x, GLint y) +{ + if (!rb->Data) + return NULL; + ASSERT(rb->DataType == GL_UNSIGNED_BYTE); + return (GLubyte *) rb->Data + 4 * (y * rb->Width + x); +} + + +static void +get_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, + GLint x, GLint y, void *values) +{ + const GLbyte *src = (const GLbyte *) rb->Data + 4 * (y * rb->Width + x); + ASSERT(rb->DataType == GL_UNSIGNED_BYTE); + _mesa_memcpy(values, src, 4 * count * sizeof(GLbyte)); +} + + +static void +get_values_ubyte4(GLcontext *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); + 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(GLcontext *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); + if (mask) { + GLuint i; + for (i = 0; i < count; i++) { + if (mask[i]) { + dst[i] = src[i]; + } + } + } + else { + _mesa_memcpy(dst, src, 4 * count * sizeof(GLubyte)); + } +} + + +static void +put_row_rgb_ubyte4(GLcontext *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); + 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(GLcontext *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); + if (!mask && val == 0) { + /* common case */ + _mesa_bzero(dst, 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(GLcontext *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); + 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(GLcontext *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); + 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(GLcontext *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(GLcontext *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); + _mesa_memcpy(values, src, 4 * count * sizeof(GLshort)); +} + + +static void +get_values_ushort4(GLcontext *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(GLcontext *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 { + _mesa_memcpy(dst, src, 4 * count * sizeof(GLushort)); + } +} + + +static void +put_row_rgb_ushort4(GLcontext *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 { + _mesa_memcpy(dst, src, 4 * count * sizeof(GLushort)); + } +} + + +static void +put_mono_row_ushort4(GLcontext *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 */ + _mesa_bzero(dst, 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(GLcontext *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(GLcontext *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. + */ +static GLboolean +soft_renderbuffer_storage(GLcontext *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->_BaseFormat = GL_RGB; + 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; + rb->ComponentSizes[0] = 8 * sizeof(GLubyte); + rb->ComponentSizes[1] = 8 * sizeof(GLubyte); + rb->ComponentSizes[2] = 8 * sizeof(GLubyte); + rb->ComponentSizes[3] = 0; + pixelSize = 3 * sizeof(GLchan); + break; + case GL_RGBA: + case GL_RGBA2: + case GL_RGBA4: + case GL_RGB5_A1: + case GL_RGBA8: + rb->_BaseFormat = GL_RGBA; + 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; + rb->ComponentSizes[0] = 8 * sizeof(GLubyte); + rb->ComponentSizes[1] = 8 * sizeof(GLubyte); + rb->ComponentSizes[2] = 8 * sizeof(GLubyte); + rb->ComponentSizes[3] = 8 * sizeof(GLubyte); + pixelSize = 4 * sizeof(GLubyte); + break; + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + rb->_BaseFormat = GL_RGBA; + rb->DataType = GL_UNSIGNED_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; + rb->ComponentSizes[0] = 8 * sizeof(GLushort); + rb->ComponentSizes[1] = 8 * sizeof(GLushort); + rb->ComponentSizes[2] = 8 * sizeof(GLushort); + rb->ComponentSizes[3] = 8 * sizeof(GLushort); + pixelSize = 4 * sizeof(GLushort); + break; +#if 00 + case ALPHA8: + rb->_BaseFormat = GL_RGBA; /* Yes, not GL_ALPHA! */ + 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; + rb->ComponentSizes[0] = 0; /*red*/ + rb->ComponentSizes[1] = 0; /*green*/ + rb->ComponentSizes[2] = 0; /*blue*/ + rb->ComponentSizes[3] = 8 * sizeof(GLubyte); + pixelSize = sizeof(GLubyte); + break; +#endif + case GL_STENCIL_INDEX: + case GL_STENCIL_INDEX1_EXT: + case GL_STENCIL_INDEX4_EXT: + case GL_STENCIL_INDEX8_EXT: + rb->_BaseFormat = GL_STENCIL_INDEX; + 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; + rb->ComponentSizes[0] = 8 * sizeof(GLubyte); + pixelSize = sizeof(GLubyte); + break; + case GL_STENCIL_INDEX16_EXT: + rb->_BaseFormat = GL_STENCIL_INDEX; + 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; + rb->ComponentSizes[0] = 8 * sizeof(GLushort); + pixelSize = sizeof(GLushort); + break; + case GL_DEPTH_COMPONENT: + case GL_DEPTH_COMPONENT16: + rb->_BaseFormat = GL_DEPTH_COMPONENT; + 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; + rb->ComponentSizes[0] = 8 * sizeof(GLushort); + pixelSize = sizeof(GLushort); + break; + case GL_DEPTH_COMPONENT24: + case GL_DEPTH_COMPONENT32: + rb->_BaseFormat = GL_DEPTH_COMPONENT; + 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->ComponentSizes[0] = 8 * sizeof(GLuint); + pixelSize = sizeof(GLuint); + break; + case GL_COLOR_INDEX8_EXT: + rb->_BaseFormat = GL_COLOR_INDEX; + 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; + rb->ComponentSizes[0] = 8 * sizeof(GLubyte); + pixelSize = sizeof(GLubyte); + break; + case GL_COLOR_INDEX16_EXT: + rb->_BaseFormat = GL_COLOR_INDEX; + 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; + rb->ComponentSizes[0] = 8 * sizeof(GLushort); + pixelSize = sizeof(GLushort); + break; + case COLOR_INDEX32: + rb->_BaseFormat = GL_COLOR_INDEX; + 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->ComponentSizes[0] = 8 * sizeof(GLuint); + pixelSize = sizeof(GLuint); + break; + default: + _mesa_problem(ctx, "Bad internalFormat in 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); + ASSERT(rb->ComponentSizes[0] > 0); + + /* free old buffer storage */ + if (rb->Data) + _mesa_free(rb->Data); + + /* allocate new buffer storage */ + rb->Data = _mesa_malloc(width * height * pixelSize); + if (rb->Data == NULL) { + rb->Width = 0; + rb->Height = 0; + _mesa_error(ctx, GL_OUT_OF_MEMORY, "software renderbuffer allocation"); + return GL_FALSE; + } + + rb->Width = width; + rb->Height = height; + rb->InternalFormat = internalFormat; + + 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(GLcontext *ctx, struct gl_renderbuffer *arb, + GLenum internalFormat, GLuint width, GLuint height) +{ + ASSERT(arb != arb->Wrapped); + + /* 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) { + _mesa_free(arb->Data); + } + + arb->Data = _mesa_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; + arb->InternalFormat = internalFormat; + + 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) { + _mesa_free(arb->Data); + } + ASSERT(arb->Wrapped); + ASSERT(arb != arb->Wrapped); + arb->Wrapped->Delete(arb->Wrapped); + arb->Wrapped = NULL; + _mesa_free(arb); +} + + +static void * +get_pointer_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, + GLint x, GLint y) +{ + return NULL; /* don't allow direct access! */ +} + + +static void +get_row_alpha8(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *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 { + _mesa_memset(dst, val, count); + } +} + + +static void +put_values_alpha8(GLcontext *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(GLcontext *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; + } + } +} + + + +/**********************************************************************/ +/**********************************************************************/ +/**********************************************************************/ + + +/** + * Default GetPointer routine. Always return NULL to indicate that + * direct buffer access is not supported. + */ +static void * +nop_get_pointer(GLcontext *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) +{ + rb->Name = name; + rb->RefCount = 1; + 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->_BaseFormat = GL_NONE; + rb->DataType = GL_NONE; + rb->ComponentSizes[0] = 0; + rb->ComponentSizes[1] = 0; + rb->ComponentSizes[2] = 0; + rb->ComponentSizes[3] = 0; + 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(GLcontext *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 framebuffer->Delete(). + */ +void +_mesa_delete_renderbuffer(struct gl_renderbuffer *rb) +{ + if (rb->Data) { + _mesa_free(rb->Data); + } + _mesa_free(rb); +} + + +/** + * Allocate a software-based renderbuffer. This is called via the + * ctx->Driver.NewRenderbuffer() function when the user creates a new + * renderbuffer. + */ +struct gl_renderbuffer * +_mesa_new_soft_renderbuffer(GLcontext *ctx, GLuint name) +{ + struct gl_renderbuffer *rb = _mesa_new_renderbuffer(ctx, name); + if (rb) { + rb->AllocStorage = soft_renderbuffer_storage; + /* Normally, one would setup the PutRow, GetRow, etc functions here. + * But we're doing that in the 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(GLcontext *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->InternalFormat = GL_RGBA8; + else + rb->InternalFormat = GL_RGB8; + } + else { + assert(rgbBits <= 16); + if (alphaBits) + rb->InternalFormat = GL_RGBA16; + else + rb->InternalFormat = GL_RGBA16; /* don't really have RGB16 yet */ + } + + rb->AllocStorage = soft_renderbuffer_storage; + _mesa_add_renderbuffer(fb, b, rb); + } + + return GL_TRUE; +} + + +/** + * Add software-based color index 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_index_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, + GLuint indexBits, + GLboolean frontLeft, GLboolean backLeft, + GLboolean frontRight, GLboolean backRight) +{ + GLuint b; + + if (indexBits > 8) { + _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 (indexBits <= 8) { + /* only support GLuint for now */ + /*rb->InternalFormat = GL_COLOR_INDEX8_EXT;*/ + rb->InternalFormat = COLOR_INDEX32; + } + else { + rb->InternalFormat = COLOR_INDEX32; + } + rb->AllocStorage = 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(GLcontext *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->_BaseFormat = arb->Wrapped->_BaseFormat; + 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; +} + + +/** + * 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(GLcontext *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->InternalFormat = GL_DEPTH_COMPONENT16; + } + else { + rb->InternalFormat = GL_DEPTH_COMPONENT32; + } + + rb->AllocStorage = 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(GLcontext *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; + } + + if (stencilBits <= 8) { + rb->InternalFormat = GL_STENCIL_INDEX8_EXT; + } + else { + /* not really supported (see s_stencil.c code) */ + rb->InternalFormat = GL_STENCIL_INDEX16_EXT; + } + + rb->AllocStorage = 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(GLcontext *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->InternalFormat = GL_RGBA16; + rb->AllocStorage = soft_renderbuffer_storage; + _mesa_add_renderbuffer(fb, BUFFER_ACCUM, 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! + * + * NOTE: color-index aux buffers not supported. + */ +GLboolean +_mesa_add_aux_renderbuffers(GLcontext *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 accum buffer"); + return GL_FALSE; + } + + if (colorBits <= 8) { + rb->InternalFormat = GL_RGBA8; + } + else { + rb->InternalFormat = GL_RGBA16; + } + + rb->AllocStorage = soft_renderbuffer_storage; + _mesa_add_renderbuffer(fb, BUFFER_AUX0 + i, rb); + } + return GL_TRUE; +} + + + +/** + * Attach a renderbuffer to a framebuffer. + */ +void +_mesa_add_renderbuffer(struct gl_framebuffer *fb, + GLuint bufferName, struct gl_renderbuffer *rb) +{ + assert(fb); + assert(rb); + /* there should be no previous renderbuffer on this attachment point! */ + assert(fb->Attachment[bufferName].Renderbuffer == NULL); + assert(bufferName < BUFFER_COUNT); + + /* 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; + fb->Attachment[bufferName].Renderbuffer = rb; +} diff --git a/reactos/dll/mesa32/src/main/renderbuffer.h b/reactos/dll/mesa32/src/main/renderbuffer.h new file mode 100644 index 00000000000..5c11de7c8a3 --- /dev/null +++ b/reactos/dll/mesa32/src/main/renderbuffer.h @@ -0,0 +1,84 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 + + +extern void +_mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name); + +extern struct gl_renderbuffer * +_mesa_new_renderbuffer(GLcontext *ctx, GLuint name); + +extern void +_mesa_delete_renderbuffer(struct gl_renderbuffer *rb); + + +extern struct gl_renderbuffer * +_mesa_new_soft_renderbuffer(GLcontext *ctx, GLuint name); + + +extern GLboolean +_mesa_add_color_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, + GLuint rgbBits, GLuint alphaBits, + GLboolean frontLeft, GLboolean backLeft, + GLboolean frontRight, GLboolean backRight); + +extern GLboolean +_mesa_add_color_index_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, + GLuint indexBits, + GLboolean frontLeft, GLboolean backLeft, + GLboolean frontRight, GLboolean backRight); + +extern GLboolean +_mesa_add_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, + GLuint alphaBits, + GLboolean frontLeft, GLboolean backLeft, + GLboolean frontRight, GLboolean backRight); + +extern GLboolean +_mesa_add_depth_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, + GLuint depthBits); + +extern GLboolean +_mesa_add_stencil_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, + GLuint stencilBits); + + +extern GLboolean +_mesa_add_accum_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, + GLuint redBits, GLuint greenBits, + GLuint blueBits, GLuint alphaBits); + +extern GLboolean +_mesa_add_aux_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, + GLuint bits, GLuint numBuffers); + +extern void +_mesa_add_renderbuffer(struct gl_framebuffer *fb, + GLuint bufferName, struct gl_renderbuffer *rb); + +#endif /* RENDERBUFFER_H */ diff --git a/reactos/dll/mesa32/src/main/simple_list.h b/reactos/dll/mesa32/src/main/simple_list.h new file mode 100644 index 00000000000..63475f6f740 --- /dev/null +++ b/reactos/dll/mesa32/src/main/simple_list.h @@ -0,0 +1,197 @@ +/** + * \file simple_list.h + * Simple macros for type-safe, intrusive lists. + * + * Intended to work with a list sentinal which is created as an empty + * list. Insert & delete are O(1). + * + * \author + * (C) 1997, Keith Whitwell + */ + +/* + * 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 _SIMPLE_LIST_H +#define _SIMPLE_LIST_H + +/** + * Remove an element from list. + * + * \param elem element to remove. + */ +#define remove_from_list(elem) \ +do { \ + (elem)->next->prev = (elem)->prev; \ + (elem)->prev->next = (elem)->next; \ +} while (0) + +/** + * Insert an element to the list head. + * + * \param list list. + * \param elem element to insert. + */ +#define insert_at_head(list, elem) \ +do { \ + (elem)->prev = list; \ + (elem)->next = (list)->next; \ + (list)->next->prev = elem; \ + (list)->next = elem; \ +} while(0) + +/** + * Insert an element to the list tail. + * + * \param list list. + * \param elem element to insert. + */ +#define insert_at_tail(list, elem) \ +do { \ + (elem)->next = list; \ + (elem)->prev = (list)->prev; \ + (list)->prev->next = elem; \ + (list)->prev = elem; \ +} while(0) + +/** + * Move an element to the list head. + * + * \param list list. + * \param elem element to move. + */ +#define move_to_head(list, elem) \ +do { \ + remove_from_list(elem); \ + insert_at_head(list, elem); \ +} while (0) + +/** + * Move an element to the list tail. + * + * \param list list. + * \param elem element to move. + */ +#define move_to_tail(list, elem) \ +do { \ + remove_from_list(elem); \ + insert_at_tail(list, elem); \ +} while (0) + +/** + * Make a empty list empty. + * + * \param sentinal list (sentinal element). + */ +#define make_empty_list(sentinal) \ +do { \ + (sentinal)->next = sentinal; \ + (sentinal)->prev = sentinal; \ +} while (0) + +/** + * Get list first element. + * + * \param list list. + * + * \return pointer to first element. + */ +#define first_elem(list) ((list)->next) + +/** + * Get list last element. + * + * \param list list. + * + * \return pointer to last element. + */ +#define last_elem(list) ((list)->prev) + +/** + * Get next element. + * + * \param elem element. + * + * \return pointer to next element. + */ +#define next_elem(elem) ((elem)->next) + +/** + * Get previous element. + * + * \param elem element. + * + * \return pointer to previous element. + */ +#define prev_elem(elem) ((elem)->prev) + +/** + * Test whether element is at end of the list. + * + * \param list list. + * \param elem element. + * + * \return non-zero if element is at end of list, or zero otherwise. + */ +#define at_end(list, elem) ((elem) == (list)) + +/** + * Test if a list is empty. + * + * \param list list. + * + * \return non-zero if list empty, or zero otherwise. + */ +#define is_empty_list(list) ((list)->next == (list)) + +/** + * Walk through the elements of a list. + * + * \param ptr pointer to the current element. + * \param list list. + * + * \note It should be followed by a { } block or a single statement, as in a \c + * for loop. + */ +#define foreach(ptr, list) \ + for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next ) + +/** + * Walk through the elements of a list. + * + * Same as #foreach but lets you unlink the current value during a list + * traversal. Useful for freeing a list, element by element. + * + * \param ptr pointer to the current element. + * \param t temporary pointer. + * \param list list. + * + * \note It should be followed by a { } block or a single statement, as in a \c + * for loop. + */ +#define foreach_s(ptr, t, list) \ + for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next) + +#endif diff --git a/reactos/dll/mesa32/src/main/state.c b/reactos/dll/mesa32/src/main/state.c new file mode 100644 index 00000000000..9ab2c5fb8a9 --- /dev/null +++ b/reactos/dll/mesa32/src/main/state.c @@ -0,0 +1,1040 @@ +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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 state.c + * State management. + * + * This file manages recalculation of derived values in the __GLcontextRec. + * Also, this is where we initialize the API dispatch table. + */ + +#include "glheader.h" +#include "accum.h" +#include "api_loopback.h" +#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program +#include "arbprogram.h" +#endif +#if FEATURE_ATI_fragment_shader +#include "atifragshader.h" +#endif +#include "attrib.h" +#include "blend.h" +#if FEATURE_ARB_vertex_buffer_object +#include "bufferobj.h" +#endif +#include "buffers.h" +#include "clip.h" +#include "colortab.h" +#include "context.h" +#include "convolve.h" +#include "depth.h" +#include "dlist.h" +#include "drawpix.h" +#include "enable.h" +#include "eval.h" +#include "get.h" +#include "feedback.h" +#include "fog.h" +#if FEATURE_EXT_framebuffer_object +#include "fbobject.h" +#endif +#include "framebuffer.h" +#include "hint.h" +#include "histogram.h" +#include "imports.h" +#include "light.h" +#include "lines.h" +#include "macros.h" +#include "matrix.h" +#if FEATURE_ARB_occlusion_query +#include "occlude.h" +#endif +#include "pixel.h" +#include "points.h" +#include "polygon.h" +#include "rastpos.h" +#include "state.h" +#include "stencil.h" +#include "teximage.h" +#include "texobj.h" +#include "texstate.h" +#include "mtypes.h" +#include "varray.h" +#if FEATURE_NV_vertex_program +#include "nvprogram.h" +#endif +#if FEATURE_NV_fragment_program +#include "nvfragprog.h" +#include "nvprogram.h" +#include "program.h" +#include "texenvprogram.h" +#endif +#if FEATURE_ARB_shader_objects +#include "shaderobjects.h" +#endif +#include "debug.h" +#include "dispatch.h" + + + +/** + * Initialize a dispatch table with pointers to Mesa's immediate-mode + * commands. + * + * Pointers to glBegin()/glEnd() object commands and a few others + * are provided via the GLvertexformat interface. + * + * \param ctx GL context to which \c exec belongs. + * \param exec dispatch table. + */ +void +_mesa_init_exec_table(struct _glapi_table *exec) +{ +#if _HAVE_FULL_GL + _mesa_loopback_init_api_table( exec ); +#endif + + /* load the dispatch slots we understand */ + SET_AlphaFunc(exec, _mesa_AlphaFunc); + SET_BlendFunc(exec, _mesa_BlendFunc); + SET_Clear(exec, _mesa_Clear); + SET_ClearColor(exec, _mesa_ClearColor); + SET_ClearStencil(exec, _mesa_ClearStencil); + SET_ColorMask(exec, _mesa_ColorMask); + SET_CullFace(exec, _mesa_CullFace); + SET_Disable(exec, _mesa_Disable); + SET_DrawBuffer(exec, _mesa_DrawBuffer); + SET_Enable(exec, _mesa_Enable); + SET_Finish(exec, _mesa_Finish); + SET_Flush(exec, _mesa_Flush); + SET_FrontFace(exec, _mesa_FrontFace); + SET_Frustum(exec, _mesa_Frustum); + SET_GetError(exec, _mesa_GetError); + SET_GetFloatv(exec, _mesa_GetFloatv); + SET_GetString(exec, _mesa_GetString); + SET_InitNames(exec, _mesa_InitNames); + SET_LineStipple(exec, _mesa_LineStipple); + SET_LineWidth(exec, _mesa_LineWidth); + SET_LoadIdentity(exec, _mesa_LoadIdentity); + SET_LoadMatrixf(exec, _mesa_LoadMatrixf); + SET_LoadName(exec, _mesa_LoadName); + SET_LogicOp(exec, _mesa_LogicOp); + SET_MatrixMode(exec, _mesa_MatrixMode); + SET_MultMatrixf(exec, _mesa_MultMatrixf); + SET_Ortho(exec, _mesa_Ortho); + SET_PixelStorei(exec, _mesa_PixelStorei); + SET_PopMatrix(exec, _mesa_PopMatrix); + SET_PopName(exec, _mesa_PopName); + SET_PushMatrix(exec, _mesa_PushMatrix); + SET_PushName(exec, _mesa_PushName); + SET_RasterPos2f(exec, _mesa_RasterPos2f); + SET_RasterPos2fv(exec, _mesa_RasterPos2fv); + SET_RasterPos2i(exec, _mesa_RasterPos2i); + SET_RasterPos2iv(exec, _mesa_RasterPos2iv); + SET_ReadBuffer(exec, _mesa_ReadBuffer); + SET_RenderMode(exec, _mesa_RenderMode); + SET_Rotatef(exec, _mesa_Rotatef); + SET_Scalef(exec, _mesa_Scalef); + SET_Scissor(exec, _mesa_Scissor); + SET_SelectBuffer(exec, _mesa_SelectBuffer); + SET_ShadeModel(exec, _mesa_ShadeModel); + SET_StencilFunc(exec, _mesa_StencilFunc); + SET_StencilMask(exec, _mesa_StencilMask); + SET_StencilOp(exec, _mesa_StencilOp); + SET_TexEnvfv(exec, _mesa_TexEnvfv); + SET_TexEnvi(exec, _mesa_TexEnvi); + SET_TexImage2D(exec, _mesa_TexImage2D); + SET_TexParameteri(exec, _mesa_TexParameteri); + SET_Translatef(exec, _mesa_Translatef); + SET_Viewport(exec, _mesa_Viewport); +#if _HAVE_FULL_GL + SET_Accum(exec, _mesa_Accum); + SET_Bitmap(exec, _mesa_Bitmap); + SET_CallList(exec, _mesa_CallList); + SET_CallLists(exec, _mesa_CallLists); + SET_ClearAccum(exec, _mesa_ClearAccum); + SET_ClearDepth(exec, _mesa_ClearDepth); + SET_ClearIndex(exec, _mesa_ClearIndex); + SET_ClipPlane(exec, _mesa_ClipPlane); + SET_ColorMaterial(exec, _mesa_ColorMaterial); + SET_CopyPixels(exec, _mesa_CopyPixels); + SET_CullParameterfvEXT(exec, _mesa_CullParameterfvEXT); + SET_CullParameterdvEXT(exec, _mesa_CullParameterdvEXT); + SET_DeleteLists(exec, _mesa_DeleteLists); + SET_DepthFunc(exec, _mesa_DepthFunc); + SET_DepthMask(exec, _mesa_DepthMask); + SET_DepthRange(exec, _mesa_DepthRange); + SET_DrawPixels(exec, _mesa_DrawPixels); + SET_EndList(exec, _mesa_EndList); + SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer); + SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT); + SET_Fogf(exec, _mesa_Fogf); + SET_Fogfv(exec, _mesa_Fogfv); + SET_Fogi(exec, _mesa_Fogi); + SET_Fogiv(exec, _mesa_Fogiv); + SET_GenLists(exec, _mesa_GenLists); + SET_GetClipPlane(exec, _mesa_GetClipPlane); + SET_GetBooleanv(exec, _mesa_GetBooleanv); + SET_GetDoublev(exec, _mesa_GetDoublev); + SET_GetIntegerv(exec, _mesa_GetIntegerv); + SET_GetLightfv(exec, _mesa_GetLightfv); + SET_GetLightiv(exec, _mesa_GetLightiv); + SET_GetMapdv(exec, _mesa_GetMapdv); + SET_GetMapfv(exec, _mesa_GetMapfv); + SET_GetMapiv(exec, _mesa_GetMapiv); + SET_GetMaterialfv(exec, _mesa_GetMaterialfv); + SET_GetMaterialiv(exec, _mesa_GetMaterialiv); + SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv); + SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv); + SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv); + SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple); + SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv); + SET_GetTexEnviv(exec, _mesa_GetTexEnviv); + SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv); + SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv); + SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv); + SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv); + SET_GetTexGendv(exec, _mesa_GetTexGendv); + SET_GetTexGenfv(exec, _mesa_GetTexGenfv); + SET_GetTexGeniv(exec, _mesa_GetTexGeniv); + SET_GetTexImage(exec, _mesa_GetTexImage); + SET_Hint(exec, _mesa_Hint); + SET_IndexMask(exec, _mesa_IndexMask); + SET_IsEnabled(exec, _mesa_IsEnabled); + SET_IsList(exec, _mesa_IsList); + SET_LightModelf(exec, _mesa_LightModelf); + SET_LightModelfv(exec, _mesa_LightModelfv); + SET_LightModeli(exec, _mesa_LightModeli); + SET_LightModeliv(exec, _mesa_LightModeliv); + SET_Lightf(exec, _mesa_Lightf); + SET_Lightfv(exec, _mesa_Lightfv); + SET_Lighti(exec, _mesa_Lighti); + SET_Lightiv(exec, _mesa_Lightiv); + SET_ListBase(exec, _mesa_ListBase); + SET_LoadMatrixd(exec, _mesa_LoadMatrixd); + SET_Map1d(exec, _mesa_Map1d); + SET_Map1f(exec, _mesa_Map1f); + SET_Map2d(exec, _mesa_Map2d); + SET_Map2f(exec, _mesa_Map2f); + SET_MapGrid1d(exec, _mesa_MapGrid1d); + SET_MapGrid1f(exec, _mesa_MapGrid1f); + SET_MapGrid2d(exec, _mesa_MapGrid2d); + SET_MapGrid2f(exec, _mesa_MapGrid2f); + SET_MultMatrixd(exec, _mesa_MultMatrixd); + SET_NewList(exec, _mesa_NewList); + SET_PassThrough(exec, _mesa_PassThrough); + SET_PixelMapfv(exec, _mesa_PixelMapfv); + SET_PixelMapuiv(exec, _mesa_PixelMapuiv); + SET_PixelMapusv(exec, _mesa_PixelMapusv); + SET_PixelStoref(exec, _mesa_PixelStoref); + SET_PixelTransferf(exec, _mesa_PixelTransferf); + SET_PixelTransferi(exec, _mesa_PixelTransferi); + SET_PixelZoom(exec, _mesa_PixelZoom); + SET_PointSize(exec, _mesa_PointSize); + SET_PolygonMode(exec, _mesa_PolygonMode); + SET_PolygonOffset(exec, _mesa_PolygonOffset); + SET_PolygonStipple(exec, _mesa_PolygonStipple); + SET_PopAttrib(exec, _mesa_PopAttrib); + SET_PushAttrib(exec, _mesa_PushAttrib); + SET_RasterPos2d(exec, _mesa_RasterPos2d); + SET_RasterPos2dv(exec, _mesa_RasterPos2dv); + SET_RasterPos2s(exec, _mesa_RasterPos2s); + SET_RasterPos2sv(exec, _mesa_RasterPos2sv); + SET_RasterPos3d(exec, _mesa_RasterPos3d); + SET_RasterPos3dv(exec, _mesa_RasterPos3dv); + SET_RasterPos3f(exec, _mesa_RasterPos3f); + SET_RasterPos3fv(exec, _mesa_RasterPos3fv); + SET_RasterPos3i(exec, _mesa_RasterPos3i); + SET_RasterPos3iv(exec, _mesa_RasterPos3iv); + SET_RasterPos3s(exec, _mesa_RasterPos3s); + SET_RasterPos3sv(exec, _mesa_RasterPos3sv); + SET_RasterPos4d(exec, _mesa_RasterPos4d); + SET_RasterPos4dv(exec, _mesa_RasterPos4dv); + SET_RasterPos4f(exec, _mesa_RasterPos4f); + SET_RasterPos4fv(exec, _mesa_RasterPos4fv); + SET_RasterPos4i(exec, _mesa_RasterPos4i); + SET_RasterPos4iv(exec, _mesa_RasterPos4iv); + SET_RasterPos4s(exec, _mesa_RasterPos4s); + SET_RasterPos4sv(exec, _mesa_RasterPos4sv); + SET_ReadPixels(exec, _mesa_ReadPixels); + SET_Rotated(exec, _mesa_Rotated); + SET_Scaled(exec, _mesa_Scaled); + SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT); + SET_TexEnvf(exec, _mesa_TexEnvf); + SET_TexEnviv(exec, _mesa_TexEnviv); + SET_TexGend(exec, _mesa_TexGend); + SET_TexGendv(exec, _mesa_TexGendv); + SET_TexGenf(exec, _mesa_TexGenf); + SET_TexGenfv(exec, _mesa_TexGenfv); + SET_TexGeni(exec, _mesa_TexGeni); + SET_TexGeniv(exec, _mesa_TexGeniv); + SET_TexImage1D(exec, _mesa_TexImage1D); + SET_TexParameterf(exec, _mesa_TexParameterf); + SET_TexParameterfv(exec, _mesa_TexParameterfv); + SET_TexParameteriv(exec, _mesa_TexParameteriv); + SET_Translated(exec, _mesa_Translated); +#endif + + /* 1.1 */ + SET_BindTexture(exec, _mesa_BindTexture); + SET_DeleteTextures(exec, _mesa_DeleteTextures); + SET_GenTextures(exec, _mesa_GenTextures); +#if _HAVE_FULL_GL + SET_AreTexturesResident(exec, _mesa_AreTexturesResident); + SET_AreTexturesResidentEXT(exec, _mesa_AreTexturesResident); + SET_ColorPointer(exec, _mesa_ColorPointer); + SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D); + SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D); + SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D); + SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D); + SET_DisableClientState(exec, _mesa_DisableClientState); + SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer); + SET_EnableClientState(exec, _mesa_EnableClientState); + SET_GenTexturesEXT(exec, _mesa_GenTextures); + SET_GetPointerv(exec, _mesa_GetPointerv); + SET_IndexPointer(exec, _mesa_IndexPointer); + SET_InterleavedArrays(exec, _mesa_InterleavedArrays); + SET_IsTexture(exec, _mesa_IsTexture); + SET_IsTextureEXT(exec, _mesa_IsTexture); + SET_NormalPointer(exec, _mesa_NormalPointer); + SET_PopClientAttrib(exec, _mesa_PopClientAttrib); + SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures); + SET_PushClientAttrib(exec, _mesa_PushClientAttrib); + SET_TexCoordPointer(exec, _mesa_TexCoordPointer); + SET_TexSubImage1D(exec, _mesa_TexSubImage1D); + SET_TexSubImage2D(exec, _mesa_TexSubImage2D); + SET_VertexPointer(exec, _mesa_VertexPointer); +#endif + + /* 1.2 */ +#if _HAVE_FULL_GL + SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D); + SET_TexImage3D(exec, _mesa_TexImage3D); + SET_TexSubImage3D(exec, _mesa_TexSubImage3D); +#endif + + /* OpenGL 1.2 GL_ARB_imaging */ +#if _HAVE_FULL_GL + SET_BlendColor(exec, _mesa_BlendColor); + SET_BlendEquation(exec, _mesa_BlendEquation); + SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT); + SET_ColorSubTable(exec, _mesa_ColorSubTable); + SET_ColorTable(exec, _mesa_ColorTable); + SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv); + SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv); + SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D); + SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D); + SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf); + SET_ConvolutionParameterfv(exec, _mesa_ConvolutionParameterfv); + SET_ConvolutionParameteri(exec, _mesa_ConvolutionParameteri); + SET_ConvolutionParameteriv(exec, _mesa_ConvolutionParameteriv); + SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable); + SET_CopyColorTable(exec, _mesa_CopyColorTable); + SET_CopyConvolutionFilter1D(exec, _mesa_CopyConvolutionFilter1D); + SET_CopyConvolutionFilter2D(exec, _mesa_CopyConvolutionFilter2D); + SET_GetColorTable(exec, _mesa_GetColorTable); + SET_GetColorTableEXT(exec, _mesa_GetColorTable); + SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv); + SET_GetColorTableParameterfvEXT(exec, _mesa_GetColorTableParameterfv); + SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv); + SET_GetColorTableParameterivEXT(exec, _mesa_GetColorTableParameteriv); + SET_GetConvolutionFilter(exec, _mesa_GetConvolutionFilter); + SET_GetConvolutionFilterEXT(exec, _mesa_GetConvolutionFilter); + SET_GetConvolutionParameterfv(exec, _mesa_GetConvolutionParameterfv); + SET_GetConvolutionParameterfvEXT(exec, _mesa_GetConvolutionParameterfv); + SET_GetConvolutionParameteriv(exec, _mesa_GetConvolutionParameteriv); + SET_GetConvolutionParameterivEXT(exec, _mesa_GetConvolutionParameteriv); + SET_GetHistogram(exec, _mesa_GetHistogram); + SET_GetHistogramEXT(exec, _mesa_GetHistogram); + SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv); + SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv); + SET_GetHistogramParameteriv(exec, _mesa_GetHistogramParameteriv); + SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv); + SET_GetMinmax(exec, _mesa_GetMinmax); + SET_GetMinmaxEXT(exec, _mesa_GetMinmax); + SET_GetMinmaxParameterfv(exec, _mesa_GetMinmaxParameterfv); + SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv); + SET_GetMinmaxParameteriv(exec, _mesa_GetMinmaxParameteriv); + SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv); + SET_GetSeparableFilter(exec, _mesa_GetSeparableFilter); + SET_GetSeparableFilterEXT(exec, _mesa_GetSeparableFilter); + SET_Histogram(exec, _mesa_Histogram); + SET_Minmax(exec, _mesa_Minmax); + SET_ResetHistogram(exec, _mesa_ResetHistogram); + SET_ResetMinmax(exec, _mesa_ResetMinmax); + SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D); +#endif + + /* OpenGL 2.0 */ + SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate); + SET_StencilMaskSeparate(exec, _mesa_StencilMaskSeparate); + SET_StencilOpSeparate(exec, _mesa_StencilOpSeparate); + + /* 2. GL_EXT_blend_color */ +#if 0 +/* SET_BlendColorEXT(exec, _mesa_BlendColorEXT); */ +#endif + + /* 3. GL_EXT_polygon_offset */ +#if _HAVE_FULL_GL + SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT); +#endif + + /* 6. GL_EXT_texture3d */ +#if 0 +/* SET_CopyTexSubImage3DEXT(exec, _mesa_CopyTexSubImage3D); */ +/* SET_TexImage3DEXT(exec, _mesa_TexImage3DEXT); */ +/* SET_TexSubImage3DEXT(exec, _mesa_TexSubImage3D); */ +#endif + + /* 11. GL_EXT_histogram */ +#if _HAVE_FULL_GL + SET_GetHistogramEXT(exec, _mesa_GetHistogram); + SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv); + SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv); + SET_GetMinmaxEXT(exec, _mesa_GetMinmax); + SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv); + SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv); +#endif + + /* ?. GL_SGIX_pixel_texture */ +#if _HAVE_FULL_GL + SET_PixelTexGenSGIX(exec, _mesa_PixelTexGenSGIX); +#endif + + /* 15. GL_SGIS_pixel_texture */ +#if _HAVE_FULL_GL + SET_PixelTexGenParameteriSGIS(exec, _mesa_PixelTexGenParameteriSGIS); + SET_PixelTexGenParameterivSGIS(exec, _mesa_PixelTexGenParameterivSGIS); + SET_PixelTexGenParameterfSGIS(exec, _mesa_PixelTexGenParameterfSGIS); + SET_PixelTexGenParameterfvSGIS(exec, _mesa_PixelTexGenParameterfvSGIS); + SET_GetPixelTexGenParameterivSGIS(exec, _mesa_GetPixelTexGenParameterivSGIS); + SET_GetPixelTexGenParameterfvSGIS(exec, _mesa_GetPixelTexGenParameterfvSGIS); +#endif + + /* 30. GL_EXT_vertex_array */ +#if _HAVE_FULL_GL + SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT); + SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT); + SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT); + SET_NormalPointerEXT(exec, _mesa_NormalPointerEXT); + SET_TexCoordPointerEXT(exec, _mesa_TexCoordPointerEXT); + SET_VertexPointerEXT(exec, _mesa_VertexPointerEXT); +#endif + + /* 37. GL_EXT_blend_minmax */ +#if 0 + SET_BlendEquationEXT(exec, _mesa_BlendEquationEXT); +#endif + + /* 54. GL_EXT_point_parameters */ +#if _HAVE_FULL_GL + SET_PointParameterfEXT(exec, _mesa_PointParameterfEXT); + SET_PointParameterfvEXT(exec, _mesa_PointParameterfvEXT); +#endif + + /* 78. GL_EXT_paletted_texture */ +#if 0 + SET_ColorTableEXT(exec, _mesa_ColorTableEXT); + SET_ColorSubTableEXT(exec, _mesa_ColorSubTableEXT); +#endif +#if _HAVE_FULL_GL + SET_GetColorTableEXT(exec, _mesa_GetColorTable); + SET_GetColorTableParameterfvEXT(exec, _mesa_GetColorTableParameterfv); + SET_GetColorTableParameterivEXT(exec, _mesa_GetColorTableParameteriv); +#endif + + /* 97. GL_EXT_compiled_vertex_array */ +#if _HAVE_FULL_GL + SET_LockArraysEXT(exec, _mesa_LockArraysEXT); + SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT); +#endif + + /* 148. GL_EXT_multi_draw_arrays */ +#if _HAVE_FULL_GL + SET_MultiDrawArraysEXT(exec, _mesa_MultiDrawArraysEXT); + SET_MultiDrawElementsEXT(exec, _mesa_MultiDrawElementsEXT); +#endif + + /* 173. GL_INGR_blend_func_separate */ +#if _HAVE_FULL_GL + SET_BlendFuncSeparateEXT(exec, _mesa_BlendFuncSeparateEXT); +#endif + + /* 196. GL_MESA_resize_buffers */ +#if _HAVE_FULL_GL + SET_ResizeBuffersMESA(exec, _mesa_ResizeBuffersMESA); +#endif + + /* 197. GL_MESA_window_pos */ +#if _HAVE_FULL_GL + SET_WindowPos2dMESA(exec, _mesa_WindowPos2dMESA); + SET_WindowPos2dvMESA(exec, _mesa_WindowPos2dvMESA); + SET_WindowPos2fMESA(exec, _mesa_WindowPos2fMESA); + SET_WindowPos2fvMESA(exec, _mesa_WindowPos2fvMESA); + SET_WindowPos2iMESA(exec, _mesa_WindowPos2iMESA); + SET_WindowPos2ivMESA(exec, _mesa_WindowPos2ivMESA); + SET_WindowPos2sMESA(exec, _mesa_WindowPos2sMESA); + SET_WindowPos2svMESA(exec, _mesa_WindowPos2svMESA); + SET_WindowPos3dMESA(exec, _mesa_WindowPos3dMESA); + SET_WindowPos3dvMESA(exec, _mesa_WindowPos3dvMESA); + SET_WindowPos3fMESA(exec, _mesa_WindowPos3fMESA); + SET_WindowPos3fvMESA(exec, _mesa_WindowPos3fvMESA); + SET_WindowPos3iMESA(exec, _mesa_WindowPos3iMESA); + SET_WindowPos3ivMESA(exec, _mesa_WindowPos3ivMESA); + SET_WindowPos3sMESA(exec, _mesa_WindowPos3sMESA); + SET_WindowPos3svMESA(exec, _mesa_WindowPos3svMESA); + SET_WindowPos4dMESA(exec, _mesa_WindowPos4dMESA); + SET_WindowPos4dvMESA(exec, _mesa_WindowPos4dvMESA); + SET_WindowPos4fMESA(exec, _mesa_WindowPos4fMESA); + SET_WindowPos4fvMESA(exec, _mesa_WindowPos4fvMESA); + SET_WindowPos4iMESA(exec, _mesa_WindowPos4iMESA); + SET_WindowPos4ivMESA(exec, _mesa_WindowPos4ivMESA); + SET_WindowPos4sMESA(exec, _mesa_WindowPos4sMESA); + SET_WindowPos4svMESA(exec, _mesa_WindowPos4svMESA); +#endif + + /* 200. GL_IBM_multimode_draw_arrays */ +#if _HAVE_FULL_GL + SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM); + SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM); +#endif + + /* 233. GL_NV_vertex_program */ +#if FEATURE_NV_vertex_program + SET_BindProgramNV(exec, _mesa_BindProgram); + SET_DeleteProgramsNV(exec, _mesa_DeletePrograms); + SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV); + SET_GenProgramsNV(exec, _mesa_GenPrograms); + SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV); + SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV); + SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV); + SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV); + SET_GetProgramivNV(exec, _mesa_GetProgramivNV); + SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV); + SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV); + SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV); + SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV); + SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV); + SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV); + SET_IsProgramNV(exec, _mesa_IsProgram); + SET_LoadProgramNV(exec, _mesa_LoadProgramNV); + SET_ProgramParameter4dNV(exec, _mesa_ProgramParameter4dNV); + SET_ProgramParameter4dvNV(exec, _mesa_ProgramParameter4dvNV); + SET_ProgramParameter4fNV(exec, _mesa_ProgramParameter4fNV); + SET_ProgramParameter4fvNV(exec, _mesa_ProgramParameter4fvNV); + SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV); + SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV); + SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV); + SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV); + /* glVertexAttrib*NV functions handled in api_loopback.c */ +#endif + + /* 282. GL_NV_fragment_program */ +#if FEATURE_NV_fragment_program + SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV); + SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV); + SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV); + SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV); + SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV); + SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV); + SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB); + SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB); + SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB); + SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB); + SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB); + SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB); +#endif + + /* 262. GL_NV_point_sprite */ +#if _HAVE_FULL_GL + SET_PointParameteriNV(exec, _mesa_PointParameteriNV); + SET_PointParameterivNV(exec, _mesa_PointParameterivNV); +#endif + + /* 268. GL_EXT_stencil_two_side */ +#if _HAVE_FULL_GL + SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT); +#endif + + /* ???. GL_EXT_depth_bounds_test */ + SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT); + + /* ARB 1. GL_ARB_multitexture */ +#if _HAVE_FULL_GL + SET_ActiveTextureARB(exec, _mesa_ActiveTextureARB); + SET_ClientActiveTextureARB(exec, _mesa_ClientActiveTextureARB); +#endif + + /* ARB 3. GL_ARB_transpose_matrix */ +#if _HAVE_FULL_GL + SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB); + SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB); + SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB); + SET_MultTransposeMatrixfARB(exec, _mesa_MultTransposeMatrixfARB); +#endif + + /* ARB 5. GL_ARB_multisample */ +#if _HAVE_FULL_GL + SET_SampleCoverageARB(exec, _mesa_SampleCoverageARB); +#endif + + /* ARB 12. GL_ARB_texture_compression */ +#if _HAVE_FULL_GL + SET_CompressedTexImage3DARB(exec, _mesa_CompressedTexImage3DARB); + SET_CompressedTexImage2DARB(exec, _mesa_CompressedTexImage2DARB); + SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB); + SET_CompressedTexSubImage3DARB(exec, _mesa_CompressedTexSubImage3DARB); + SET_CompressedTexSubImage2DARB(exec, _mesa_CompressedTexSubImage2DARB); + SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB); + SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB); +#endif + + /* ARB 14. GL_ARB_point_parameters */ + /* reuse EXT_point_parameters functions */ + + /* ARB 26. GL_ARB_vertex_program */ + /* ARB 27. GL_ARB_fragment_program */ +#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program + /* glVertexAttrib1sARB aliases glVertexAttrib1sNV */ + /* glVertexAttrib1fARB aliases glVertexAttrib1fNV */ + /* glVertexAttrib1dARB aliases glVertexAttrib1dNV */ + /* glVertexAttrib2sARB aliases glVertexAttrib2sNV */ + /* glVertexAttrib2fARB aliases glVertexAttrib2fNV */ + /* glVertexAttrib2dARB aliases glVertexAttrib2dNV */ + /* glVertexAttrib3sARB aliases glVertexAttrib3sNV */ + /* glVertexAttrib3fARB aliases glVertexAttrib3fNV */ + /* glVertexAttrib3dARB aliases glVertexAttrib3dNV */ + /* glVertexAttrib4sARB aliases glVertexAttrib4sNV */ + /* glVertexAttrib4fARB aliases glVertexAttrib4fNV */ + /* glVertexAttrib4dARB aliases glVertexAttrib4dNV */ + /* glVertexAttrib4NubARB aliases glVertexAttrib4NubNV */ + /* glVertexAttrib1svARB aliases glVertexAttrib1svNV */ + /* glVertexAttrib1fvARB aliases glVertexAttrib1fvNV */ + /* glVertexAttrib1dvARB aliases glVertexAttrib1dvNV */ + /* glVertexAttrib2svARB aliases glVertexAttrib2svNV */ + /* glVertexAttrib2fvARB aliases glVertexAttrib2fvNV */ + /* glVertexAttrib2dvARB aliases glVertexAttrib2dvNV */ + /* glVertexAttrib3svARB aliases glVertexAttrib3svNV */ + /* glVertexAttrib3fvARB aliases glVertexAttrib3fvNV */ + /* glVertexAttrib3dvARB aliases glVertexAttrib3dvNV */ + /* glVertexAttrib4svARB aliases glVertexAttrib4svNV */ + /* glVertexAttrib4fvARB aliases glVertexAttrib4fvNV */ + /* glVertexAttrib4dvARB aliases glVertexAttrib4dvNV */ + /* glVertexAttrib4NubvARB aliases glVertexAttrib4NubvNV */ + /* glVertexAttrib4bvARB handled in api_loopback.c */ + /* glVertexAttrib4ivARB handled in api_loopback.c */ + /* glVertexAttrib4ubvARB handled in api_loopback.c */ + /* glVertexAttrib4usvARB handled in api_loopback.c */ + /* glVertexAttrib4uivARB handled in api_loopback.c */ + /* glVertexAttrib4NbvARB handled in api_loopback.c */ + /* glVertexAttrib4NsvARB handled in api_loopback.c */ + /* glVertexAttrib4NivARB handled in api_loopback.c */ + /* glVertexAttrib4NusvARB handled in api_loopback.c */ + /* glVertexAttrib4NuivARB handled in api_loopback.c */ + SET_VertexAttribPointerARB(exec, _mesa_VertexAttribPointerARB); + SET_EnableVertexAttribArrayARB(exec, _mesa_EnableVertexAttribArrayARB); + SET_DisableVertexAttribArrayARB(exec, _mesa_DisableVertexAttribArrayARB); + SET_ProgramStringARB(exec, _mesa_ProgramStringARB); + /* glBindProgramARB aliases glBindProgramNV */ + /* glDeleteProgramsARB aliases glDeleteProgramsNV */ + /* glGenProgramsARB aliases glGenProgramsNV */ + /* glIsProgramARB aliases glIsProgramNV */ + SET_GetVertexAttribdvARB(exec, _mesa_GetVertexAttribdvARB); + SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB); + SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB); + /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */ + SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); + SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); + SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); + SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); + SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB); + SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB); + SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB); + SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB); + SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB); + SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB); + SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB); + SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB); + SET_GetProgramivARB(exec, _mesa_GetProgramivARB); + SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB); +#endif + + /* ARB 28. GL_ARB_vertex_buffer_object */ +#if FEATURE_ARB_vertex_buffer_object + SET_BindBufferARB(exec, _mesa_BindBufferARB); + SET_BufferDataARB(exec, _mesa_BufferDataARB); + SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB); + SET_DeleteBuffersARB(exec, _mesa_DeleteBuffersARB); + SET_GenBuffersARB(exec, _mesa_GenBuffersARB); + SET_GetBufferParameterivARB(exec, _mesa_GetBufferParameterivARB); + SET_GetBufferPointervARB(exec, _mesa_GetBufferPointervARB); + SET_GetBufferSubDataARB(exec, _mesa_GetBufferSubDataARB); + SET_IsBufferARB(exec, _mesa_IsBufferARB); + SET_MapBufferARB(exec, _mesa_MapBufferARB); + SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB); +#endif + + /* ARB 29. GL_ARB_occlusion_query */ +#if FEATURE_ARB_occlusion_query + SET_GenQueriesARB(exec, _mesa_GenQueriesARB); + SET_DeleteQueriesARB(exec, _mesa_DeleteQueriesARB); + SET_IsQueryARB(exec, _mesa_IsQueryARB); + SET_BeginQueryARB(exec, _mesa_BeginQueryARB); + SET_EndQueryARB(exec, _mesa_EndQueryARB); + SET_GetQueryivARB(exec, _mesa_GetQueryivARB); + SET_GetQueryObjectivARB(exec, _mesa_GetQueryObjectivARB); + SET_GetQueryObjectuivARB(exec, _mesa_GetQueryObjectuivARB); +#endif + + /* ARB 37. GL_ARB_draw_buffers */ + SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB); + +#if FEATURE_ARB_shader_objects + SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB); + SET_GetHandleARB(exec, _mesa_GetHandleARB); + SET_DetachObjectARB(exec, _mesa_DetachObjectARB); + SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB); + SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB); + SET_CompileShaderARB(exec, _mesa_CompileShaderARB); + SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB); + SET_AttachObjectARB(exec, _mesa_AttachObjectARB); + SET_LinkProgramARB(exec, _mesa_LinkProgramARB); + SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB); + SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB); + SET_Uniform1fARB(exec, _mesa_Uniform1fARB); + SET_Uniform2fARB(exec, _mesa_Uniform2fARB); + SET_Uniform3fARB(exec, _mesa_Uniform3fARB); + SET_Uniform4fARB(exec, _mesa_Uniform4fARB); + SET_Uniform1iARB(exec, _mesa_Uniform1iARB); + SET_Uniform2iARB(exec, _mesa_Uniform2iARB); + SET_Uniform3iARB(exec, _mesa_Uniform3iARB); + SET_Uniform4iARB(exec, _mesa_Uniform4iARB); + SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB); + SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB); + SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB); + SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB); + SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB); + SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB); + SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB); + SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB); + SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB); + SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB); + SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB); + SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB); + SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB); + SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB); + SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB); + SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB); + SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB); + SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB); + SET_GetUniformivARB(exec, _mesa_GetUniformivARB); + SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB); +#endif /* FEATURE_ARB_shader_objects */ + +#if FEATURE_ARB_vertex_shader + SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB); + SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB); + SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB); +#endif /* FEATURE_ARB_vertex_shader */ + + /* GL_ATI_fragment_shader */ +#if FEATURE_ATI_fragment_shader + SET_GenFragmentShadersATI(exec, _mesa_GenFragmentShadersATI); + SET_BindFragmentShaderATI(exec, _mesa_BindFragmentShaderATI); + SET_DeleteFragmentShaderATI(exec, _mesa_DeleteFragmentShaderATI); + SET_BeginFragmentShaderATI(exec, _mesa_BeginFragmentShaderATI); + SET_EndFragmentShaderATI(exec, _mesa_EndFragmentShaderATI); + SET_PassTexCoordATI(exec, _mesa_PassTexCoordATI); + SET_SampleMapATI(exec, _mesa_SampleMapATI); + SET_ColorFragmentOp1ATI(exec, _mesa_ColorFragmentOp1ATI); + SET_ColorFragmentOp2ATI(exec, _mesa_ColorFragmentOp2ATI); + SET_ColorFragmentOp3ATI(exec, _mesa_ColorFragmentOp3ATI); + SET_AlphaFragmentOp1ATI(exec, _mesa_AlphaFragmentOp1ATI); + SET_AlphaFragmentOp2ATI(exec, _mesa_AlphaFragmentOp2ATI); + SET_AlphaFragmentOp3ATI(exec, _mesa_AlphaFragmentOp3ATI); + SET_SetFragmentShaderConstantATI(exec, _mesa_SetFragmentShaderConstantATI); +#endif + +#if FEATURE_EXT_framebuffer_object + SET_IsRenderbufferEXT(exec, _mesa_IsRenderbufferEXT); + SET_BindRenderbufferEXT(exec, _mesa_BindRenderbufferEXT); + SET_DeleteRenderbuffersEXT(exec, _mesa_DeleteRenderbuffersEXT); + SET_GenRenderbuffersEXT(exec, _mesa_GenRenderbuffersEXT); + SET_RenderbufferStorageEXT(exec, _mesa_RenderbufferStorageEXT); + SET_GetRenderbufferParameterivEXT(exec, _mesa_GetRenderbufferParameterivEXT); + SET_IsFramebufferEXT(exec, _mesa_IsFramebufferEXT); + SET_BindFramebufferEXT(exec, _mesa_BindFramebufferEXT); + SET_DeleteFramebuffersEXT(exec, _mesa_DeleteFramebuffersEXT); + SET_GenFramebuffersEXT(exec, _mesa_GenFramebuffersEXT); + SET_CheckFramebufferStatusEXT(exec, _mesa_CheckFramebufferStatusEXT); + SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT); + SET_FramebufferTexture2DEXT(exec, _mesa_FramebufferTexture2DEXT); + SET_FramebufferTexture3DEXT(exec, _mesa_FramebufferTexture3DEXT); + SET_FramebufferRenderbufferEXT(exec, _mesa_FramebufferRenderbufferEXT); + SET_GetFramebufferAttachmentParameterivEXT(exec, _mesa_GetFramebufferAttachmentParameterivEXT); + SET_GenerateMipmapEXT(exec, _mesa_GenerateMipmapEXT); +#endif +} + + + +/**********************************************************************/ +/** \name State update logic */ +/*@{*/ + + +static void +update_separate_specular( GLcontext *ctx ) +{ + if (NEED_SECONDARY_COLOR(ctx)) + ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; + else + ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; +} + + +/** + * Update state dependent on vertex arrays. + */ +static void +update_arrays( GLcontext *ctx ) +{ + GLuint i, min; + + /* find min of _MaxElement values for all enabled arrays */ + + /* 0 */ + if (ctx->VertexProgram._Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled) { + min = ctx->Array.VertexAttrib[VERT_ATTRIB_POS]._MaxElement; + } + else if (ctx->Array.Vertex.Enabled) { + min = ctx->Array.Vertex._MaxElement; + } + else { + /* can't draw anything without vertex positions! */ + min = 0; + } + + /* 1 */ + if (ctx->VertexProgram._Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_WEIGHT].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_WEIGHT]._MaxElement); + } + /* no conventional vertex weight array */ + + /* 2 */ + if (ctx->VertexProgram._Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL]._MaxElement); + } + else if (ctx->Array.Normal.Enabled) { + min = MIN2(min, ctx->Array.Normal._MaxElement); + } + + /* 3 */ + if (ctx->VertexProgram._Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0]._MaxElement); + } + else if (ctx->Array.Color.Enabled) { + min = MIN2(min, ctx->Array.Color._MaxElement); + } + + /* 4 */ + if (ctx->VertexProgram._Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1]._MaxElement); + } + else if (ctx->Array.SecondaryColor.Enabled) { + min = MIN2(min, ctx->Array.SecondaryColor._MaxElement); + } + + /* 5 */ + if (ctx->VertexProgram._Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_FOG]._MaxElement); + } + else if (ctx->Array.FogCoord.Enabled) { + min = MIN2(min, ctx->Array.FogCoord._MaxElement); + } + + /* 6 */ + if (ctx->VertexProgram._Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_SIX].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SIX]._MaxElement); + } + + /* 7 */ + if (ctx->VertexProgram._Enabled + && ctx->Array.VertexAttrib[VERT_ATTRIB_SEVEN].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SEVEN]._MaxElement); + } + + /* 8..15 */ + for (i = VERT_ATTRIB_TEX0; i < VERT_ATTRIB_MAX; i++) { + if (ctx->VertexProgram._Enabled + && ctx->Array.VertexAttrib[i].Enabled) { + min = MIN2(min, ctx->Array.VertexAttrib[i]._MaxElement); + } + else if (i - VERT_ATTRIB_TEX0 < ctx->Const.MaxTextureCoordUnits + && ctx->Array.TexCoord[i - VERT_ATTRIB_TEX0].Enabled) { + min = MIN2(min, ctx->Array.TexCoord[i - VERT_ATTRIB_TEX0]._MaxElement); + } + } + + if (ctx->Array.Index.Enabled) { + min = MIN2(min, ctx->Array.Index._MaxElement); + } + + if (ctx->Array.EdgeFlag.Enabled) { + min = MIN2(min, ctx->Array.EdgeFlag._MaxElement); + } + + /* _MaxElement is one past the last legal array element */ + ctx->Array._MaxElement = min; +} + + +/** + * Update derived vertex/fragment program state. + */ +static void +update_program(GLcontext *ctx) +{ + /* For now, just set the _Enabled (really enabled) flags. + * In the future we may have to check other state to be sure we really + * have a runable program or shader. + */ + ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled + && ctx->VertexProgram.Current->Instructions; + ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled + && ctx->FragmentProgram.Current->Instructions; + ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled + && ctx->ATIFragmentShader.Current->Instructions; + + ctx->FragmentProgram._Current = ctx->FragmentProgram.Current; + ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled; + + if (ctx->_MaintainTexEnvProgram && !ctx->FragmentProgram._Enabled) { + if (!ctx->_TexEnvProgram) + ctx->_TexEnvProgram = (struct fragment_program *) + ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); + + ctx->FragmentProgram._Current = ctx->_TexEnvProgram; + ctx->FragmentProgram._Active = GL_TRUE; + } +} + + +/** + * If __GLcontextRec::NewState is non-zero then this function \b must be called + * before rendering any primitive. Basically, function pointers and + * miscellaneous flags are updated to reflect the current state of the state + * machine. + * + * 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_polygon(), + * _mesa_update_lighting() and _mesa_update_tnl_spaces(). + */ +void +_mesa_update_state( GLcontext *ctx ) +{ + GLuint new_state = ctx->NewState; + + if (MESA_VERBOSE & VERBOSE_STATE) + _mesa_print_state("_mesa_update_state", new_state); + + if (new_state & _NEW_PROGRAM) + update_program( 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 | _NEW_COLOR | _NEW_PIXEL)) + _mesa_update_framebuffer(ctx); + + if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) + _mesa_update_draw_buffer_bounds( ctx ); + + if (new_state & _NEW_POINT) + _mesa_update_point( ctx ); + + if (new_state & _NEW_POLYGON) + _mesa_update_polygon( ctx ); + + if (new_state & _NEW_LIGHT) + _mesa_update_lighting( ctx ); + + if (new_state & _IMAGE_NEW_TRANSFER_STATE) + _mesa_update_pixel( ctx, new_state ); + + if (new_state & _DD_NEW_SEPARATE_SPECULAR) + update_separate_specular( ctx ); + + if (new_state & (_NEW_ARRAY | _NEW_PROGRAM)) + update_arrays( ctx ); + + if (ctx->_MaintainTexEnvProgram) { + if (new_state & (_NEW_TEXTURE | _DD_NEW_SEPARATE_SPECULAR | _NEW_FOG)) + _mesa_UpdateTexEnvProgram(ctx); + } + + /* 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 ); + + /* + * 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; + ctx->NewState = 0; + ctx->Driver.UpdateState(ctx, new_state); + ctx->Array.NewState = 0; +} + +/*@}*/ diff --git a/reactos/dll/mesa32/src/main/state.h b/reactos/dll/mesa32/src/main/state.h new file mode 100644 index 00000000000..58cfcc41462 --- /dev/null +++ b/reactos/dll/mesa32/src/main/state.h @@ -0,0 +1,43 @@ +/** + * \file state.h + * State management. + */ + +/* + * 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. + */ + + +#ifndef STATE_H +#define STATE_H + +#include "mtypes.h" + +extern void +_mesa_init_exec_table(struct _glapi_table *exec); + +extern void +_mesa_update_state( GLcontext *ctx ); + + +#endif diff --git a/reactos/dll/mesa32/src/main/stencil.c b/reactos/dll/mesa32/src/main/stencil.c new file mode 100644 index 00000000000..dfda4aa8fda --- /dev/null +++ b/reactos/dll/mesa32/src/main/stencil.c @@ -0,0 +1,466 @@ +/** + * \file stencil.c + * Stencil operations. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +#include "glheader.h" +#include "imports.h" +#include "context.h" +#include "depth.h" +#include "macros.h" +#include "stencil.h" +#include "mtypes.h" +#include "enable.h" + + +/** + * 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 == (GLstencil) s) + return; + + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.Clear = (GLstencil) s; + + if (ctx->Driver.ClearStencil) { + (*ctx->Driver.ClearStencil)( ctx, s ); + } +} + + +/** + * 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 + * __GLcontextRec::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 face = ctx->Stencil.ActiveFace; + GLint maxref; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + 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: + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glStencilFunc" ); + return; + } + + maxref = (1 << STENCIL_BITS) - 1; + ref = (GLstencil) CLAMP( ref, 0, maxref ); + + if (ctx->Stencil.Function[face] == func && + ctx->Stencil.ValueMask[face] == (GLstencil) 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] = (GLstencil) mask; + + if (ctx->Driver.StencilFunc) { + (*ctx->Driver.StencilFunc)( ctx, 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 (ctx->Stencil.WriteMask[face] == (GLstencil) mask) + return; + + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.WriteMask[face] = (GLstencil) mask; + + if (ctx->Driver.StencilMask) { + (*ctx->Driver.StencilMask)( ctx, 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 the 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 + * __GLcontextRec::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); + + switch (fail) { + case GL_KEEP: + case GL_ZERO: + case GL_REPLACE: + case GL_INCR: + case GL_DECR: + case GL_INVERT: + break; + case GL_INCR_WRAP_EXT: + case GL_DECR_WRAP_EXT: + if (ctx->Extensions.EXT_stencil_wrap) { + break; + } + /* FALL-THROUGH */ + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); + return; + } + switch (zfail) { + case GL_KEEP: + case GL_ZERO: + case GL_REPLACE: + case GL_INCR: + case GL_DECR: + case GL_INVERT: + break; + case GL_INCR_WRAP_EXT: + case GL_DECR_WRAP_EXT: + if (ctx->Extensions.EXT_stencil_wrap) { + break; + } + /* FALL-THROUGH */ + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); + return; + } + switch (zpass) { + case GL_KEEP: + case GL_ZERO: + case GL_REPLACE: + case GL_INCR: + case GL_DECR: + case GL_INVERT: + break; + case GL_INCR_WRAP_EXT: + case GL_DECR_WRAP_EXT: + if (ctx->Extensions.EXT_stencil_wrap) { + break; + } + /* FALL-THROUGH */ + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); + return; + } + + 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; + + if (ctx->Driver.StencilOp) { + (*ctx->Driver.StencilOp)(ctx, 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 (face == GL_FRONT || face == GL_BACK) { + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.ActiveFace = (face == GL_FRONT) ? 0 : 1; + } + + if (ctx->Driver.ActiveStencilFace) { + (*ctx->Driver.ActiveStencilFace)( ctx, (GLuint) ctx->Stencil.ActiveFace ); + } +} +#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 fail, GLenum zfail, GLenum zpass) +{ + 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, "glStencilOpSeparate(face)"); + return; + } + + switch (fail) { + case GL_KEEP: + case GL_ZERO: + case GL_REPLACE: + case GL_INCR: + case GL_DECR: + case GL_INVERT: + break; + case GL_INCR_WRAP_EXT: + case GL_DECR_WRAP_EXT: + if (ctx->Extensions.EXT_stencil_wrap) { + break; + } + /* FALL-THROUGH */ + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(fail)"); + return; + } + switch (zfail) { + case GL_KEEP: + case GL_ZERO: + case GL_REPLACE: + case GL_INCR: + case GL_DECR: + case GL_INVERT: + break; + case GL_INCR_WRAP_EXT: + case GL_DECR_WRAP_EXT: + if (ctx->Extensions.EXT_stencil_wrap) { + break; + } + /* FALL-THROUGH */ + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zfail)"); + return; + } + switch (zpass) { + case GL_KEEP: + case GL_ZERO: + case GL_REPLACE: + case GL_INCR: + case GL_DECR: + case GL_INVERT: + break; + case GL_INCR_WRAP_EXT: + case GL_DECR_WRAP_EXT: + if (ctx->Extensions.EXT_stencil_wrap) { + break; + } + /* FALL-THROUGH */ + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zpass)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_STENCIL); + + if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { + ctx->Stencil.FailFunc[0] = fail; + ctx->Stencil.ZFailFunc[0] = zfail; + ctx->Stencil.ZPassFunc[0] = zpass; + } + if (face == GL_BACK || face == GL_FRONT_AND_BACK) { + ctx->Stencil.FailFunc[1] = fail; + ctx->Stencil.ZFailFunc[1] = zfail; + ctx->Stencil.ZPassFunc[1] = zpass; + } + + if (ctx->Driver.StencilOpSeparate) { + ctx->Driver.StencilOpSeparate(ctx, face, fail, zfail, zpass); + } +} + + +/* OpenGL 2.0 */ +void GLAPIENTRY +_mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) +{ + GET_CURRENT_CONTEXT(ctx); + GLint maxref; + 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; + } + + 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: + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(func)"); + return; + } + + maxref = (1 << STENCIL_BITS) - 1; + ref = (GLstencil) CLAMP(ref, 0, maxref); + + FLUSH_VERTICES(ctx, _NEW_STENCIL); + + if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { + ctx->Stencil.Function[0] = func; + ctx->Stencil.Ref[0] = ref; + ctx->Stencil.ValueMask[0] = (GLstencil) mask; + } + if (face == GL_BACK || face == GL_FRONT_AND_BACK) { + ctx->Stencil.Function[1] = func; + ctx->Stencil.Ref[1] = ref; + ctx->Stencil.ValueMask[1] = (GLstencil) 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_FRONT || face == GL_FRONT_AND_BACK) { + ctx->Stencil.WriteMask[0] = (GLstencil) mask; + } + if (face == GL_BACK || face == GL_FRONT_AND_BACK) { + ctx->Stencil.WriteMask[1] = (GLstencil) mask; + } + + if (ctx->Driver.StencilMaskSeparate) { + ctx->Driver.StencilMaskSeparate(ctx, face, mask); + } +} + + +/** + * Initialize the context stipple state. + * + * \param ctx GL context. + * + * Initializes __GLcontextRec::Stencil attribute group. + */ +void _mesa_init_stencil( GLcontext * ctx ) +{ + + /* Stencil group */ + ctx->Stencil.Enabled = GL_FALSE; + ctx->Stencil.TestTwoSide = GL_FALSE; + ctx->Stencil.ActiveFace = 0; /* 0 = GL_FRONT, 1 = GL_BACK */ + ctx->Stencil.Function[0] = GL_ALWAYS; + ctx->Stencil.Function[1] = GL_ALWAYS; + ctx->Stencil.FailFunc[0] = GL_KEEP; + ctx->Stencil.FailFunc[1] = GL_KEEP; + ctx->Stencil.ZPassFunc[0] = GL_KEEP; + ctx->Stencil.ZPassFunc[1] = GL_KEEP; + ctx->Stencil.ZFailFunc[0] = GL_KEEP; + ctx->Stencil.ZFailFunc[1] = GL_KEEP; + ctx->Stencil.Ref[0] = 0; + ctx->Stencil.Ref[1] = 0; + ctx->Stencil.ValueMask[0] = STENCIL_MAX; + ctx->Stencil.ValueMask[1] = STENCIL_MAX; + ctx->Stencil.WriteMask[0] = STENCIL_MAX; + ctx->Stencil.WriteMask[1] = STENCIL_MAX; + ctx->Stencil.Clear = 0; +} diff --git a/reactos/dll/mesa32/src/main/stencil.h b/reactos/dll/mesa32/src/main/stencil.h new file mode 100644 index 00000000000..ec2927cfd20 --- /dev/null +++ b/reactos/dll/mesa32/src/main/stencil.h @@ -0,0 +1,73 @@ +/** + * \file stencil.h + * Stencil operations. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 STENCIL_H +#define STENCIL_H + + +#include "mtypes.h" + + +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_StencilMaskSeparate(GLenum face, GLuint mask); + + +extern void +_mesa_init_stencil( GLcontext * ctx ); + +#endif diff --git a/reactos/dll/mesa32/src/main/texcompress.c b/reactos/dll/mesa32/src/main/texcompress.c new file mode 100644 index 00000000000..d18b1d0b418 --- /dev/null +++ b/reactos/dll/mesa32/src/main/texcompress.c @@ -0,0 +1,254 @@ +/* + * 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. + */ + + +/** + * \file texcompress.c + * Helper functions for texture compression. + */ + + +#include "glheader.h" +#include "imports.h" +#include "colormac.h" +#include "context.h" +#include "image.h" +#include "texcompress.h" +#include "texformat.h" +#include "texstore.h" + +/** + * Get the list of supported internal compression formats. + * + * \param ctx GL context. + * \param formats the resulting format list (may be NULL). + * + * \return number of formats. + */ +GLuint +_mesa_get_compressed_formats( GLcontext *ctx, GLint *formats ) +{ + GLuint n = 0; + if (ctx->Extensions.ARB_texture_compression) { + 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; + /* Skip this one because it has a restriction (all transparent + * pixels become black). See the texture compressions spec for + * a detailed explanation. This is what NVIDIA does. + 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 (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; + } + } + } + return n; +} + + + +/** + * Return number of bytes needed to store a texture of the given size + * using the specified compressed format. + * This is called via the ctx->Driver.CompressedTextureSize function, + * unless a device driver overrides it. + * + * \param width texture width in texels. + * \param height texture height in texels. + * \param depth texture depth in texels. + * \param format - one of the specific compressed texture formats + * + * \return size in bytes, or zero if bad format + */ +GLuint +_mesa_compressed_texture_size( GLcontext *ctx, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format ) +{ + GLuint size; + + ASSERT(depth == 1); + (void) depth; + + switch (format) { + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: + /* round up width to next multiple of 8, height to next multiple of 4 */ + width = (width + 7) & ~7; + height = (height + 3) & ~3; + /* 16 bytes per 8x4 tile of RGB[A] texels */ + size = width * height / 2; + /* Textures smaller than 8x4 will effectively be made into 8x4 and + * take 16 bytes. + */ + if (size < 16) + size = 16; + return size; + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + /* round up width, height to next multiple of 4 */ + width = (width + 3) & ~3; + height = (height + 3) & ~3; + /* 8 bytes per 4x4 tile of RGB[A] texels */ + size = width * height / 2; + /* Textures smaller than 4x4 will effectively be made into 4x4 and + * take 8 bytes. + */ + if (size < 8) + size = 8; + return size; + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + /* round up width, height to next multiple of 4 */ + width = (width + 3) & ~3; + height = (height + 3) & ~3; + /* 16 bytes per 4x4 tile of RGBA texels */ + size = width * height; /* simple! */ + /* Textures smaller than 4x4 will effectively be made into 4x4 and + * take 16 bytes. + */ + if (size < 16) + size = 16; + return size; + default: + _mesa_problem(ctx, "bad texformat in compressed_texture_size"); + return 0; + } +} + + +/* + * Compute the bytes per row in a compressed texture image. + * We use this for computing the destination address for sub-texture updates. + * \param format one of the specific texture compression formats + * \param width image width in pixels + * \return stride, in bytes, between rows for compressed image + */ +GLint +_mesa_compressed_row_stride(GLenum format, GLsizei width) +{ + GLint stride; + + switch (format) { + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: + stride = ((width + 7) / 8) * 16; /* 16 bytes per 8x4 tile */ + break; + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + stride = ((width + 3) / 4) * 8; /* 8 bytes per 4x4 tile */ + break; + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + stride = ((width + 3) / 4) * 16; /* 16 bytes per 4x4 tile */ + break; + default: + return 0; + } + + return stride; +} + + +/* + * Return the address of the pixel at (col, row, img) in a + * compressed texture image. + * \param col, row, img - image position (3D) + * \param format - compressed image format + * \param width - image width + * \param image - the image address + * \return address of pixel at (row, col) + */ +GLubyte * +_mesa_compressed_image_address(GLint col, GLint row, GLint img, + GLenum format, + GLsizei width, const GLubyte *image) +{ + GLubyte *addr; + + (void) img; + + /* We try to spot a "complete" subtexture "above" ROW, COL; + * this texture is given by appropriate rounding of WIDTH x ROW. + * Then we just add the amount left (usually on the left). + * + * Example for X*Y microtiles (Z bytes each) + * offset = Z * (((width + X - 1) / X) * (row / Y) + col / X); + */ + + switch (format) { + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: + addr = (GLubyte *) image + 16 * (((width + 7) / 8) * (row / 4) + col / 8); + break; + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + addr = (GLubyte *) image + 8 * (((width + 3) / 4) * (row / 4) + col / 4); + break; + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + addr = (GLubyte *) image + 16 * (((width + 3) / 4) * (row / 4) + col / 4); + break; + default: + return NULL; + } + + return addr; +} diff --git a/reactos/dll/mesa32/src/main/texcompress.h b/reactos/dll/mesa32/src/main/texcompress.h new file mode 100644 index 00000000000..50074145469 --- /dev/null +++ b/reactos/dll/mesa32/src/main/texcompress.h @@ -0,0 +1,65 @@ +/* + * 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 TEXCOMPRESS_H +#define TEXCOMPRESS_H + +#include "mtypes.h" + +#if _HAVE_FULL_GL +extern GLuint +_mesa_get_compressed_formats( GLcontext *ctx, GLint *formats ); + +extern GLuint +_mesa_compressed_texture_size( GLcontext *ctx, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format ); + +extern GLint +_mesa_compressed_row_stride(GLenum format, GLsizei width); + + +extern GLubyte * +_mesa_compressed_image_address(GLint col, GLint row, GLint img, + GLenum format, + GLsizei width, const GLubyte *image); + + +extern void +_mesa_init_texture_s3tc( GLcontext *ctx ); + +extern void +_mesa_init_texture_fxt1( GLcontext *ctx ); + + + +#else +#define _mesa_get_compressed_formats( c, f ) 0 +#define _mesa_compressed_texture_size( c, w, h, d, f ) 0 +#define _mesa_compressed_row_stride( f, w) 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 + +#endif /* TEXCOMPRESS_H */ diff --git a/reactos/dll/mesa32/src/main/texcompress_fxt1.c b/reactos/dll/mesa32/src/main/texcompress_fxt1.c new file mode 100644 index 00000000000..d5e2c790f60 --- /dev/null +++ b/reactos/dll/mesa32/src/main/texcompress_fxt1.c @@ -0,0 +1,1663 @@ +/* + * 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. + */ + + +/** + * \file texcompress_fxt1.c + * GL_EXT_texture_compression_fxt1 support. + */ + + +#include "glheader.h" +#include "imports.h" +#include "colormac.h" +#include "context.h" +#include "convolve.h" +#include "image.h" +#include "texcompress.h" +#include "texformat.h" +#include "texstore.h" + + +static GLint +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, GLubyte *rgba); + + +/** + * Called during context initialization. + */ +void +_mesa_init_texture_fxt1( GLcontext *ctx ) +{ + (void) ctx; +} + + +/** + * Called via TexFormat->StoreImage to store an RGB_FXT1 texture. + */ +static GLboolean +texstore_rgb_fxt1(STORE_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_texformat_rgb_fxt1); + ASSERT(dstXoffset % 8 == 0); + ASSERT(dstYoffset % 4 == 0); + ASSERT(dstZoffset == 0); + (void) dstZoffset; (void) dstImageStride; + + 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, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + if (!tempImage) + return GL_FALSE; /* out of memory */ + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + 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, + GL_COMPRESSED_RGB_FXT1_3DFX, + texWidth, (GLubyte *) dstAddr); + + fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride, + dst, dstRowStride); + + if (tempImage) + _mesa_free((void*) tempImage); + + return GL_TRUE; +} + + +/** + * Called via TexFormat->StoreImage to store an RGBA_FXT1 texture. + */ +static GLboolean +texstore_rgba_fxt1(STORE_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_texformat_rgba_fxt1); + ASSERT(dstXoffset % 8 == 0); + ASSERT(dstYoffset % 4 == 0); + ASSERT(dstZoffset == 0); + (void) dstZoffset; (void) dstImageStride; + + 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, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + if (!tempImage) + return GL_FALSE; /* out of memory */ + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + 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, + GL_COMPRESSED_RGBA_FXT1_3DFX, + texWidth, (GLubyte *) dstAddr); + + fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride, + dst, dstRowStride); + + if (tempImage) + _mesa_free((void*) tempImage); + + return GL_TRUE; +} + + +static void +fetch_texel_2d_rgba_fxt1( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + (void) k; + fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, texel); +} + + +static void +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]); +} + + +static void +fetch_texel_2d_rgb_fxt1( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + (void) k; + fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, texel); + texel[ACOMP] = 255; +} + + +static void +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; +} + + + +const struct gl_texture_format _mesa_texformat_rgb_fxt1 = { + MESA_FORMAT_RGB_FXT1, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 4, /*approx*/ /* RedBits */ + 4, /*approx*/ /* GreenBits */ + 4, /*approx*/ /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* TexelBytes */ + texstore_rgb_fxt1, /* StoreTexImageFunc */ + NULL, /*impossible*/ /* FetchTexel1D */ + fetch_texel_2d_rgb_fxt1, /* FetchTexel2D */ + NULL, /*impossible*/ /* FetchTexel3D */ + NULL, /*impossible*/ /* FetchTexel1Df */ + fetch_texel_2d_f_rgb_fxt1, /* FetchTexel2Df */ + NULL, /*impossible*/ /* FetchTexel3Df */ +}; + +const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { + MESA_FORMAT_RGBA_FXT1, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 4, /*approx*/ /* RedBits */ + 4, /*approx*/ /* GreenBits */ + 4, /*approx*/ /* BlueBits */ + 1, /*approx*/ /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* TexelBytes */ + texstore_rgba_fxt1, /* StoreTexImageFunc */ + NULL, /*impossible*/ /* FetchTexel1D */ + fetch_texel_2d_rgba_fxt1, /* FetchTexel2D */ + NULL, /*impossible*/ /* FetchTexel3D */ + NULL, /*impossible*/ /* FetchTexel1Df */ + fetch_texel_2d_f_rgba_fxt1, /* FetchTexel2Df */ + NULL, /*impossible*/ /* FetchTexel3Df */ +}; + + +/***************************************************************************\ + * 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 defined(__GNUC__) && !defined(__cplusplus) + +#define FX64_NATIVE 1 + +typedef unsigned long long Fx64; + +#define FX64_MOV32(a, b) a = b +#define FX64_OR32(a, b) a |= b +#define FX64_SHL(a, c) a <<= c + +#else /* !__GNUC__ */ + +#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 /* !__GNUC__ */ + + +#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 it's 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 + /* 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; + + /* 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; + } + sumL += sum; + } + 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; + } + sumR += sum; + } + + /* 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 GLint +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; + GLubyte *newSource = NULL; + + /* 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 = (GLubyte *) + _mesa_malloc(comps * newWidth * newHeight * sizeof(GLubyte *)); + _mesa_upscale_teximage2d(width, height, newWidth, newHeight, + comps, (const GLchan *) source, + srcRowStride, newSource); + source = newSource; + width = newWidth; + height = newHeight; + srcRowStride = comps * newWidth; + } + + 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; + } + + if (newSource != NULL) { + _mesa_free(newSource); + } + + return 0; +} + + +/***************************************************************************\ + * 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) +#define ZERO_4UBV(v) *((GLuint *)(v)) = 0 + + +static void +fxt1_decode_1HI (const GLubyte *code, GLint t, GLubyte *rgba) +{ + const GLuint *cc; + + t *= 3; + cc = (const GLuint *)(code + t / 8); + t = (cc[0] >> (t & 7)) & 7; + + if (t == 7) { + ZERO_4UBV(rgba); + } else { + cc = (const GLuint *)(code + 12); + if (t == 0) { + rgba[BCOMP] = UP5(CC_SEL(cc, 0)); + rgba[GCOMP] = UP5(CC_SEL(cc, 5)); + rgba[RCOMP] = UP5(CC_SEL(cc, 10)); + } else if (t == 6) { + rgba[BCOMP] = UP5(CC_SEL(cc, 15)); + rgba[GCOMP] = UP5(CC_SEL(cc, 20)); + rgba[RCOMP] = UP5(CC_SEL(cc, 25)); + } else { + rgba[BCOMP] = LERP(6, t, UP5(CC_SEL(cc, 0)), UP5(CC_SEL(cc, 15))); + rgba[GCOMP] = LERP(6, t, UP5(CC_SEL(cc, 5)), UP5(CC_SEL(cc, 20))); + rgba[RCOMP] = LERP(6, t, UP5(CC_SEL(cc, 10)), UP5(CC_SEL(cc, 25))); + } + rgba[ACOMP] = 255; + } +} + + +static void +fxt1_decode_1CHROMA (const GLubyte *code, GLint t, GLubyte *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] = UP5(kk); + rgba[GCOMP] = UP5(kk >> 5); + rgba[RCOMP] = UP5(kk >> 10); + rgba[ACOMP] = 255; +} + + +static void +fxt1_decode_1MIXED (const GLubyte *code, GLint t, GLubyte *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_4UBV(rgba); + } else { + if (t == 0) { + rgba[BCOMP] = UP5(col[0][BCOMP]); + rgba[GCOMP] = UP5(col[0][GCOMP]); + rgba[RCOMP] = UP5(col[0][RCOMP]); + } else if (t == 2) { + rgba[BCOMP] = UP5(col[1][BCOMP]); + rgba[GCOMP] = UP6(col[1][GCOMP], glsb); + rgba[RCOMP] = UP5(col[1][RCOMP]); + } else { + rgba[BCOMP] = (UP5(col[0][BCOMP]) + UP5(col[1][BCOMP])) / 2; + rgba[GCOMP] = (UP5(col[0][GCOMP]) + UP6(col[1][GCOMP], glsb)) / 2; + rgba[RCOMP] = (UP5(col[0][RCOMP]) + UP5(col[1][RCOMP])) / 2; + } + rgba[ACOMP] = 255; + } + } else { + /* alpha[0] == 0 */ + + if (t == 0) { + rgba[BCOMP] = UP5(col[0][BCOMP]); + rgba[GCOMP] = UP6(col[0][GCOMP], glsb ^ selb); + rgba[RCOMP] = UP5(col[0][RCOMP]); + } else if (t == 3) { + rgba[BCOMP] = UP5(col[1][BCOMP]); + rgba[GCOMP] = UP6(col[1][GCOMP], glsb); + rgba[RCOMP] = UP5(col[1][RCOMP]); + } else { + rgba[BCOMP] = LERP(3, t, UP5(col[0][BCOMP]), UP5(col[1][BCOMP])); + rgba[GCOMP] = LERP(3, t, UP6(col[0][GCOMP], glsb ^ selb), + UP6(col[1][GCOMP], glsb)); + rgba[RCOMP] = LERP(3, t, UP5(col[0][RCOMP]), UP5(col[1][RCOMP])); + } + rgba[ACOMP] = 255; + } +} + + +static void +fxt1_decode_1ALPHA (const GLubyte *code, GLint t, GLubyte *rgba) +{ + const GLuint *cc; + + 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) { + rgba[BCOMP] = UP5(col0[BCOMP]); + rgba[GCOMP] = UP5(col0[GCOMP]); + rgba[RCOMP] = UP5(col0[RCOMP]); + rgba[ACOMP] = UP5(col0[ACOMP]); + } else if (t == 3) { + rgba[BCOMP] = UP5(CC_SEL(cc, 79)); + rgba[GCOMP] = UP5(CC_SEL(cc, 84)); + rgba[RCOMP] = UP5(CC_SEL(cc, 89)); + rgba[ACOMP] = UP5(CC_SEL(cc, 114)); + } else { + rgba[BCOMP] = LERP(3, t, UP5(col0[BCOMP]), UP5(CC_SEL(cc, 79))); + rgba[GCOMP] = LERP(3, t, UP5(col0[GCOMP]), UP5(CC_SEL(cc, 84))); + rgba[RCOMP] = LERP(3, t, UP5(col0[RCOMP]), UP5(CC_SEL(cc, 89))); + rgba[ACOMP] = 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_4UBV(rgba); + } else { + GLuint kk; + cc = (const GLuint *)code; + rgba[ACOMP] = UP5(cc[3] >> (t * 5 + 13)); + t *= 15; + cc = (const GLuint *)(code + 8 + t / 8); + kk = cc[0] >> (t & 7); + rgba[BCOMP] = UP5(kk); + rgba[GCOMP] = UP5(kk >> 5); + rgba[RCOMP] = UP5(kk >> 10); + } + } +} + + +void +fxt1_decode_1 (const void *texture, GLint stride, /* in pixels */ + GLint i, GLint j, GLubyte *rgba) +{ + static void (*decode_1[]) (const GLubyte *, GLint, GLubyte *) = { + 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); +} diff --git a/reactos/dll/mesa32/src/main/texcompress_s3tc.c b/reactos/dll/mesa32/src/main/texcompress_s3tc.c new file mode 100644 index 00000000000..98e72fc6823 --- /dev/null +++ b/reactos/dll/mesa32/src/main/texcompress_s3tc.c @@ -0,0 +1,555 @@ +/* + * 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. + */ + + +/** + * \file texcompress_s3tc.c + * GL_EXT_texture_compression_s3tc support. + */ + +#ifndef USE_EXTERNAL_DXTN_LIB +#define USE_EXTERNAL_DXTN_LIB 0 +#endif + +#include "glheader.h" +#include "imports.h" +#include "colormac.h" +#include "context.h" +#include "convolve.h" +#include "image.h" +#include "texcompress.h" +#include "texformat.h" +#include "texstore.h" + +#if USE_EXTERNAL_DXTN_LIB +#ifdef __MINGW32__ +/* no dlopen */ +#define DXTN_EXT "dxtn.dll" +#define DXTN_PREFIX "" +#define dlopen(name, mode) LoadLibrary(name) +#define dlsym(hndl, proc) GetProcAddress(hndl, proc) +#define dlclose(hndl) FreeLibrary(hndl) +#elif defined(__DJGPP__) +/* has dlopen, but doesn't like the names */ +#include +#define DXTN_EXT "dxtn.dxe" +#define DXTN_PREFIX "_" +#else +/* happiness */ +#include +#define DXTN_EXT "libtxc_dxtn.so" +#define DXTN_PREFIX "" +#endif +#endif /* USE_EXTERNAL_DXTN_LIB */ + +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 GLubyte *srcPixData, GLenum destformat, GLubyte *dest, GLint dstRowStride); +dxtCompressTexFuncExt ext_tx_compress_dxtn = NULL; + +void *dxtlibhandle = NULL; + +void +_mesa_init_texture_s3tc( GLcontext *ctx ) +{ + /* called during context initialization */ + ctx->Mesa_DXTn = GL_FALSE; +#if USE_EXTERNAL_DXTN_LIB + if (!dxtlibhandle) { + dxtlibhandle = dlopen (DXTN_EXT, RTLD_LAZY | RTLD_GLOBAL); + if (!dxtlibhandle) { + _mesa_warning(ctx, "couldn't open " DXTN_EXT ", software DXTn " + "compression/decompression unavailable\n"); + } + else { + /* the fetch functions are not per context! Might be problematic... */ + fetch_ext_rgb_dxt1 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgb_dxt1"); + if (fetch_ext_rgb_dxt1 != NULL) { + fetch_ext_rgba_dxt1 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgba_dxt1"); + } + if (fetch_ext_rgba_dxt1 != NULL) { + fetch_ext_rgba_dxt3 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgba_dxt3"); + } + if (fetch_ext_rgba_dxt3 != NULL) { + fetch_ext_rgba_dxt5 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgba_dxt5"); + } + if (fetch_ext_rgba_dxt5 != NULL) { + ext_tx_compress_dxtn = (dxtCompressTexFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "tx_compress_dxtn"); + } + + if (ext_tx_compress_dxtn == NULL) { + _mesa_warning(ctx, "couldn't reference all symbols in " + DXTN_EXT ", software DXTn compression/decompression " + "unavailable\n"); + 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; + dlclose(dxtlibhandle); + dxtlibhandle = NULL; + } + } + } + if (dxtlibhandle) { + ctx->Mesa_DXTn = GL_TRUE; + _mesa_warning(ctx, "software DXTn compression/decompression available\n"); + } +#else + (void) ctx; +#endif +} + +/** + * Called via TexFormat->StoreImage to store an RGB_DXT1 texture. + */ +static GLboolean +texstore_rgb_dxt1(STORE_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_texformat_rgb_dxt1); + ASSERT(dstXoffset % 4 == 0); + ASSERT(dstYoffset % 4 == 0); + ASSERT(dstZoffset % 4 == 0); + (void) dstZoffset; (void) dstImageStride; + + 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, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + if (!tempImage) + return GL_FALSE; /* out of memory */ + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + 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, + GL_COMPRESSED_RGB_S3TC_DXT1_EXT, + 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_problem(ctx, "external dxt library not available"); + } + + if (tempImage) + _mesa_free((void *) tempImage); + + return GL_TRUE; +} + + +/** + * Called via TexFormat->StoreImage to store an RGBA_DXT1 texture. + */ +static GLboolean +texstore_rgba_dxt1(STORE_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_texformat_rgba_dxt1); + ASSERT(dstXoffset % 4 == 0); + ASSERT(dstYoffset % 4 == 0); + ASSERT(dstZoffset % 4 == 0); + (void) dstZoffset; (void) dstImageStride; + + 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, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + if (!tempImage) + return GL_FALSE; /* out of memory */ + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + 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, + GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, + 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_problem(ctx, "external dxt library not available"); + } + + if (tempImage) + _mesa_free((void*) tempImage); + + return GL_TRUE; +} + + +/** + * Called via TexFormat->StoreImage to store an RGBA_DXT3 texture. + */ +static GLboolean +texstore_rgba_dxt3(STORE_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_texformat_rgba_dxt3); + ASSERT(dstXoffset % 4 == 0); + ASSERT(dstYoffset % 4 == 0); + ASSERT(dstZoffset % 4 == 0); + (void) dstZoffset; (void) dstImageStride; + + 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, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + if (!tempImage) + return GL_FALSE; /* out of memory */ + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + 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, + GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, + 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_problem(ctx, "external dxt library not available"); + } + + if (tempImage) + _mesa_free((void *) tempImage); + + return GL_TRUE; +} + + +/** + * Called via TexFormat->StoreImage to store an RGBA_DXT5 texture. + */ +static GLboolean +texstore_rgba_dxt5(STORE_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_texformat_rgba_dxt5); + ASSERT(dstXoffset % 4 == 0); + ASSERT(dstYoffset % 4 == 0); + ASSERT(dstZoffset % 4 == 0); + (void) dstZoffset; (void) dstImageStride; + + 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, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + if (!tempImage) + return GL_FALSE; /* out of memory */ + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + 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, + GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, + 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_problem(ctx, "external dxt library not available"); + } + + if (tempImage) + _mesa_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\n"); +} + + +static void +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] = {0, 0, 0, 0}; + 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\n"); +} + + +static void +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] = {0, 0, 0, 0}; + 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\n"); +} + + +static void +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] = {0, 0, 0, 0}; + 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\n"); +} + + +static void +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] = {0, 0, 0, 0}; + 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]); +} + + +const struct gl_texture_format _mesa_texformat_rgb_dxt1 = { + MESA_FORMAT_RGB_DXT1, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 4, /*approx*/ /* RedBits */ + 4, /*approx*/ /* GreenBits */ + 4, /*approx*/ /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* TexelBytes */ + texstore_rgb_dxt1, /* StoreTexImageFunc */ + NULL, /*impossible*/ /* FetchTexel1D */ + fetch_texel_2d_rgb_dxt1, /* FetchTexel2D */ + NULL, /*impossible*/ /* FetchTexel3D */ + NULL, /*impossible*/ /* FetchTexel1Df */ + fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */ + NULL, /*impossible*/ /* FetchTexel3Df */ +}; + +const struct gl_texture_format _mesa_texformat_rgba_dxt1 = { + MESA_FORMAT_RGBA_DXT1, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 4, /*approx*/ /* RedBits */ + 4, /*approx*/ /* GreenBits */ + 4, /*approx*/ /* BlueBits */ + 1, /*approx*/ /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* TexelBytes */ + texstore_rgba_dxt1, /* StoreTexImageFunc */ + NULL, /*impossible*/ /* FetchTexel1D */ + fetch_texel_2d_rgba_dxt1, /* FetchTexel2D */ + NULL, /*impossible*/ /* FetchTexel3D */ + NULL, /*impossible*/ /* FetchTexel1Df */ + fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */ + NULL, /*impossible*/ /* FetchTexel3Df */ +}; + +const struct gl_texture_format _mesa_texformat_rgba_dxt3 = { + MESA_FORMAT_RGBA_DXT3, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 4, /*approx*/ /* RedBits */ + 4, /*approx*/ /* GreenBits */ + 4, /*approx*/ /* BlueBits */ + 4, /*approx*/ /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* TexelBytes */ + texstore_rgba_dxt3, /* StoreTexImageFunc */ + NULL, /*impossible*/ /* FetchTexel1D */ + fetch_texel_2d_rgba_dxt3, /* FetchTexel2D */ + NULL, /*impossible*/ /* FetchTexel3D */ + NULL, /*impossible*/ /* FetchTexel1Df */ + fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */ + NULL, /*impossible*/ /* FetchTexel3Df */ +}; + +const struct gl_texture_format _mesa_texformat_rgba_dxt5 = { + MESA_FORMAT_RGBA_DXT5, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 4,/*approx*/ /* RedBits */ + 4,/*approx*/ /* GreenBits */ + 4,/*approx*/ /* BlueBits */ + 4,/*approx*/ /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* TexelBytes */ + texstore_rgba_dxt5, /* StoreTexImageFunc */ + NULL, /*impossible*/ /* FetchTexel1D */ + fetch_texel_2d_rgba_dxt5, /* FetchTexel2D */ + NULL, /*impossible*/ /* FetchTexel3D */ + NULL, /*impossible*/ /* FetchTexel1Df */ + fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */ + NULL, /*impossible*/ /* FetchTexel3Df */ +}; diff --git a/reactos/dll/mesa32/src/main/texenvprogram.c b/reactos/dll/mesa32/src/main/texenvprogram.c new file mode 100644 index 00000000000..4cb97469a58 --- /dev/null +++ b/reactos/dll/mesa32/src/main/texenvprogram.c @@ -0,0 +1,1165 @@ +/************************************************************************** + * + * 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 "glheader.h" +#include "macros.h" +#include "enums.h" +#include "texenvprogram.h" + +#include "shader/program.h" +#include "shader/nvfragprog.h" +#include "shader/arbfragparse.h" + + +#define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM) + +struct mode_opt { + unsigned Source:4; + unsigned Operand:3; +}; + +struct state_key { + GLuint enabled_units; + unsigned separate_specular:1; + unsigned fog_enabled:1; + unsigned fog_mode:2; + + struct { + unsigned enabled:1; + unsigned source_index:3; + unsigned ScaleShiftRGB:2; + unsigned ScaleShiftA:2; + + unsigned NumArgsRGB:2; + unsigned ModeRGB:4; + struct mode_opt OptRGB[3]; + + unsigned NumArgsA:2; + unsigned ModeA:4; + struct mode_opt OptA[3]; + } unit[8]; +}; + +#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: 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_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; + default: return SRC_UNKNOWN; + } +} + +#define MODE_REPLACE 0 +#define MODE_MODULATE 1 +#define MODE_ADD 2 +#define MODE_ADD_SIGNED 3 +#define MODE_INTERPOLATE 4 +#define MODE_SUBTRACT 5 +#define MODE_DOT3_RGB 6 +#define MODE_DOT3_RGB_EXT 7 +#define MODE_DOT3_RGBA 8 +#define MODE_DOT3_RGBA_EXT 9 +#define MODE_MODULATE_ADD_ATI 10 +#define MODE_MODULATE_SIGNED_ADD_ATI 11 +#define MODE_MODULATE_SUBTRACT_ATI 12 +#define MODE_UNKNOWN 15 + +static GLuint translate_mode( GLenum mode ) +{ + switch (mode) { + case GL_REPLACE: return MODE_REPLACE; + case GL_MODULATE: return MODE_MODULATE; + case GL_ADD: return MODE_ADD; + case GL_ADD_SIGNED: 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; + default: return MODE_UNKNOWN; + } +} + +#define TEXTURE_UNKNOWN_INDEX 7 +static GLuint translate_tex_src_bit( GLuint bit ) +{ + switch (bit) { + case TEXTURE_1D_BIT: return TEXTURE_1D_INDEX; + case TEXTURE_2D_BIT: return TEXTURE_2D_INDEX; + case TEXTURE_RECT_BIT: return TEXTURE_RECT_INDEX; + case TEXTURE_3D_BIT: return TEXTURE_3D_INDEX; + case TEXTURE_CUBE_BIT: return TEXTURE_CUBE_INDEX; + default: return TEXTURE_UNKNOWN_INDEX; + } +} + +static struct state_key *make_state_key( GLcontext *ctx ) +{ + struct state_key *key = CALLOC_STRUCT(state_key); + GLuint i, j; + + for (i=0;iTexture.Unit[i]; + + if (!texUnit->_ReallyEnabled) + continue; + + key->unit[i].enabled = 1; + key->enabled_units |= (1<unit[i].source_index = + translate_tex_src_bit(texUnit->_ReallyEnabled); + + key->unit[i].NumArgsRGB = texUnit->_CurrentCombine->_NumArgsRGB; + key->unit[i].NumArgsA = texUnit->_CurrentCombine->_NumArgsA; + + key->unit[i].ModeRGB = + translate_mode(texUnit->_CurrentCombine->ModeRGB); + key->unit[i].ModeA = + translate_mode(texUnit->_CurrentCombine->ModeA); + + key->unit[i].ScaleShiftRGB = texUnit->_CurrentCombine->ScaleShiftRGB; + key->unit[i].ScaleShiftA = texUnit->_CurrentCombine->ScaleShiftRGB; + + for (j=0;j<3;j++) { + key->unit[i].OptRGB[j].Operand = + translate_operand(texUnit->_CurrentCombine->OperandRGB[j]); + key->unit[i].OptA[j].Operand = + translate_operand(texUnit->_CurrentCombine->OperandA[j]); + key->unit[i].OptRGB[j].Source = + translate_source(texUnit->_CurrentCombine->SourceRGB[j]); + key->unit[i].OptA[j].Source = + translate_source(texUnit->_CurrentCombine->SourceA[j]); + } + } + + if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) + key->separate_specular = 1; + + if (ctx->Fog.Enabled) { + key->fog_enabled = 1; + key->fog_mode = translate_fog_mode(ctx->Fog.Mode); + } + + return key; +} + +/* 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 abs:1; + GLuint negateabs:1; + GLuint swz:12; + GLuint pad:5; +}; + +const static struct ureg undef = { + ~0, + ~0, + 0, + 0, + 0, + 0, + 0 +}; + +#define X 0 +#define Y 1 +#define Z 2 +#define W 3 + +/* State used to build the fragment program: + */ +struct texenv_fragment_program { + struct fragment_program *program; + GLcontext *ctx; + struct state_key *state; + + GLuint alu_temps; /* Track texture indirections, see spec. */ + GLuint temps_output; /* Track texture indirections, see spec. */ + + GLuint temp_in_use; /* Tracks temporary regs which are in + * use. + */ + + + GLboolean error; + + struct ureg src_texture[MAX_TEXTURE_UNITS]; + /* Reg containing each texture unit's sampled texture color, + * 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.abs = 0; + reg.negateabs = 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 == 0xf; +} + + +static struct ureg get_temp( struct texenv_fragment_program *p ) +{ + int bit; + + /* First try and reuse temps which have been used already: + */ + bit = ffs( ~p->temp_in_use & p->alu_temps ); + + /* Then any unused temporary: + */ + if (!bit) + bit = ffs( ~p->temp_in_use ); + + if (!bit) { + _mesa_problem(NULL, "%s: out of temporaries\n", __FILE__); + exit(1); + } + + 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 availble 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 = ffs( ~p->temp_in_use & ~p->alu_temps & ~p->temps_output ); + + /* Then any unused temporary: + */ + if (!bit) + bit = ffs( ~p->temp_in_use ); + + if (!bit) { + _mesa_problem(NULL, "%s: out of temporaries\n", __FILE__); + exit(1); + } + + p->temp_in_use |= 1<<(bit-1); + return make_ureg(PROGRAM_TEMPORARY, (bit-1)); +} + + +static void release_temps( struct texenv_fragment_program *p ) +{ + GLuint max_temp = p->ctx->Const.MaxFragmentProgramTemps; + + /* 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<temps_output; +} + + +static struct ureg register_param6( struct texenv_fragment_program *p, + GLint s0, + GLint s1, + GLint s2, + GLint s3, + GLint s4, + GLint s5) +{ + GLint tokens[6]; + GLuint idx; + tokens[0] = s0; + tokens[1] = s1; + tokens[2] = s2; + tokens[3] = s3; + tokens[4] = s4; + tokens[5] = s5; + idx = _mesa_add_state_reference( p->program->Parameters, tokens ); + return make_ureg(PROGRAM_STATE_VAR, idx); +} + + +#define register_param1(p,s0) register_param6(p,s0,0,0,0,0,0) +#define register_param2(p,s0,s1) register_param6(p,s0,s1,0,0,0,0) +#define register_param3(p,s0,s1,s2) register_param6(p,s0,s1,s2,0,0,0) +#define register_param4(p,s0,s1,s2,s3) register_param6(p,s0,s1,s2,s3,0,0) + + +static struct ureg register_input( struct texenv_fragment_program *p, GLuint input ) +{ + p->program->InputsRead |= (1<File = ureg.file; + reg->Index = ureg.idx; + reg->Swizzle = ureg.swz; + reg->NegateBase = ureg.negatebase; + reg->Abs = ureg.abs; + reg->NegateAbs = ureg.negateabs; +} + +static void emit_dst( struct fp_dst_register *dst, + struct ureg ureg, GLuint mask ) +{ + dst->File = ureg.file; + dst->Index = ureg.idx; + dst->WriteMask = mask; + dst->CondMask = 0; + dst->CondSwizzle = 0; +} + +static struct fp_instruction * +emit_op(struct texenv_fragment_program *p, + GLuint op, + struct ureg dest, + GLuint mask, + GLuint saturate, + struct ureg src0, + struct ureg src1, + struct ureg src2 ) +{ + GLuint nr = p->program->Base.NumInstructions++; + struct fp_instruction *inst = &p->program->Instructions[nr]; + + memset(inst, 0, sizeof(*inst)); + inst->Opcode = op; + + emit_arg( &inst->SrcReg[0], src0 ); + emit_arg( &inst->SrcReg[1], src1 ); + emit_arg( &inst->SrcReg[2], src2 ); + + inst->Saturate = saturate; + + emit_dst( &inst->DstReg, dest, mask ); + + /* Accounting for indirection tracking: + */ + if (dest.file == PROGRAM_TEMPORARY) + p->temps_output |= 1 << dest.idx; + + return inst; +} + + +static struct ureg emit_arith( struct texenv_fragment_program *p, + GLuint op, + struct ureg dest, + GLuint mask, + GLuint 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->NumAluInstructions++; + return dest; +} + +static struct ureg emit_texld( struct texenv_fragment_program *p, + GLuint op, + struct ureg dest, + GLuint destmask, + GLuint tex_unit, + GLuint tex_idx, + struct ureg coord ) +{ + struct fp_instruction *inst = emit_op( p, op, + dest, destmask, + 0, /* don't saturate? */ + coord, /* arg 0? */ + undef, + undef); + + inst->TexSrcIdx = tex_idx; + inst->TexSrcUnit = tex_unit; + + p->program->NumTexInstructions++; + + /* Is this a texture indirection? + */ + if ((coord.file == PROGRAM_TEMPORARY && + (p->temps_output & (1<alu_temps & (1<program->NumTexIndirections++; + p->temps_output = 1<alu_temps = 0; + assert(0); /* KW: texture env crossbar */ + } + + 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; + values[0] = s0; + values[1] = s1; + values[2] = s2; + values[3] = s3; + idx = _mesa_add_unnamed_constant( p->program->Parameters, values ); + return make_ureg(PROGRAM_STATE_VAR, idx); +} + +#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->one = 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->one = register_scalar_const(p, 0.0); + return p->zero; +} + + + + + +static void program_error( struct texenv_fragment_program *p, const char *msg ) +{ + _mesa_problem(NULL, 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_PREVIOUS: + default: + if (is_undef(p->src_previous)) + return register_input(p, FRAG_ATTRIB_COL0); + else + return p->src_previous; + } +} + +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, FP_OPCODE_SUB, arg, mask, 0, one, src, undef); + + case OPR_SRC_ALPHA: + if (mask == WRITEMASK_W) + return src; + else + return swizzle1( src, 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, FP_OPCODE_SUB, arg, mask, 0, + one, swizzle1(src, W), undef); + case OPR_ZERO: + return get_zero(p); + case OPR_ONE: + return get_one(p); + case OPR_SRC_COLOR: + default: + return src; + } +} + +static GLboolean args_match( struct state_key *key, GLuint unit ) +{ + int i, nr = key->unit[unit].NumArgsRGB; + + for (i = 0 ; i < nr ; 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, + GLuint saturate, + GLuint unit, + GLuint nr, + GLuint mode, + struct mode_opt *opt) +{ + struct ureg src[3]; + struct ureg tmp, half; + int i; + + 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, FP_OPCODE_MOV, dest, mask, saturate, src[0], undef, undef ); + case MODE_MODULATE: + return emit_arith( p, FP_OPCODE_MUL, dest, mask, saturate, + src[0], src[1], undef ); + case MODE_ADD: + return emit_arith( p, FP_OPCODE_ADD, dest, mask, saturate, + src[0], src[1], undef ); + case MODE_ADD_SIGNED: + /* tmp = arg0 + arg1 + * result = tmp - .5 + */ + half = get_half(p); + emit_arith( p, FP_OPCODE_ADD, tmp, mask, 0, src[0], src[1], undef ); + emit_arith( p, FP_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, FP_OPCODE_LRP, dest, mask, saturate, src[2], src[0], src[1] ); + + case MODE_SUBTRACT: + return emit_arith( p, FP_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, FP_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, FP_OPCODE_MAD, tmp1, WRITEMASK_XYZW, 0, + two, src[1], neg1); + emit_arith( p, FP_OPCODE_DP3, dest, mask, saturate, tmp0, tmp1, undef); + return dest; + } + case MODE_MODULATE_ADD_ATI: + /* Arg0 * Arg2 + Arg1 */ + return emit_arith( p, FP_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, FP_OPCODE_MAD, tmp0, mask, 0, src[0], src[2], src[1] ); + emit_arith( p, FP_OPCODE_SUB, dest, mask, saturate, tmp0, half, undef ); + return dest; + } + case MODE_MODULATE_SUBTRACT_ATI: + /* Arg0 * Arg2 - Arg1 */ + emit_arith( p, FP_OPCODE_MAD, dest, mask, 0, src[0], src[2], negate(src[1]) ); + return dest; + default: + return src[0]; + } +} + + +static struct ureg emit_texenv( struct texenv_fragment_program *p, int unit ) +{ + struct state_key *key = p->state; + GLuint saturate = (unit < p->last_tex_stage); + GLuint rgb_shift, alpha_shift; + struct ureg out, shift; + struct ureg dest; + + if (!key->unit[unit].enabled) { + 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 this is the very last calculation, emit direct to output reg: + */ + if (key->separate_specular || + unit != p->last_tex_stage || + alpha_shift || + rgb_shift) + dest = get_temp( p ); + else + dest = make_ureg(PROGRAM_OUTPUT, FRAG_OUTPUT_COLR); + + /* 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, 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].ModeA == MODE_DOT3_RGBA) { + + out = emit_combine( p, dest, WRITEMASK_XYZW, 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, saturate, + unit, + key->unit[unit].NumArgsRGB, + key->unit[unit].ModeRGB, + key->unit[unit].OptRGB); + out = emit_combine( p, dest, WRITEMASK_W, saturate, + unit, + key->unit[unit].NumArgsA, + key->unit[unit].ModeA, + key->unit[unit].OptA); + } + + /* Deal with the final shift: + */ + if (alpha_shift || rgb_shift) { + if (rgb_shift == alpha_shift) { + shift = register_scalar_const(p, 1<src_texture[unit])) { + GLuint dim = p->state->unit[unit].source_index; + struct ureg texcoord = register_input(p, FRAG_ATTRIB_TEX0+unit); + struct ureg tmp = get_tex_temp( p ); + + if (dim == TEXTURE_UNKNOWN_INDEX) + program_error(p, "TexSrcBit"); + + /* TODO: Use D0_MASK_XY where possible. + */ + p->src_texture[unit] = emit_texld( p, FP_OPCODE_TXP, + tmp, WRITEMASK_XYZW, + unit, dim, texcoord ); + } +} + +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: + if (!p->state->unit[src - SRC_TEXTURE0].enabled) + return GL_FALSE; + load_texture(p, src - SRC_TEXTURE0); + break; + + default: + break; + } + + return GL_TRUE; +} + +static GLboolean load_texunit_sources( struct texenv_fragment_program *p, int unit ) +{ + struct state_key *key = p->state; + int i, nr = key->unit[unit].NumArgsRGB; + for (i = 0; i < nr; i++) { + if (!load_texenv_source( p, key->unit[unit].OptRGB[i].Source, unit) || + !load_texenv_source( p, key->unit[unit].OptA[i].Source, unit )) + return GL_FALSE; + } + return GL_TRUE; +} + +static void create_new_program(struct state_key *key, GLcontext *ctx, + struct fragment_program *program) +{ + struct texenv_fragment_program p; + GLuint unit; + struct ureg cf, out; + + _mesa_memset(&p, 0, sizeof(p)); + p.ctx = ctx; + p.state = key; + p.program = program; + + p.program->Instructions = MALLOC(sizeof(struct fp_instruction) * 100); + p.program->Base.NumInstructions = 0; + p.program->Base.Target = GL_FRAGMENT_PROGRAM_ARB; + p.program->NumTexIndirections = 1; /* correct? */ + p.program->NumTexInstructions = 0; + p.program->NumAluInstructions = 0; + p.program->Base.String = 0; + p.program->Base.NumInstructions = + p.program->Base.NumTemporaries = + p.program->Base.NumParameters = + p.program->Base.NumAttributes = p.program->Base.NumAddressRegs = 0; + p.program->Parameters = _mesa_new_parameter_list(); + + p.program->InputsRead = 0; + p.program->OutputsWritten = 1 << FRAG_OUTPUT_COLR; + + for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) + p.src_texture[unit] = undef; + + p.src_previous = undef; + p.last_tex_stage = 0; + release_temps(&p); + + if (key->enabled_units) { + /* First pass - to support texture_env_crossbar, first identify + * all referenced texture sources and emit texld instructions + * for each: + */ + for (unit = 0 ; unit < ctx->Const.MaxTextureUnits ; unit++) + if (key->unit[unit].enabled) { + if (load_texunit_sources( &p, unit )) + p.last_tex_stage = unit; + } + + /* Second pass - emit combine instructions to build final color: + */ + for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) + if (key->enabled_units & (1<separate_specular) { + /* Emit specular add. + */ + struct ureg s = register_input(&p, FRAG_ATTRIB_COL1); + emit_arith( &p, FP_OPCODE_ADD, out, WRITEMASK_XYZ, 0, cf, s, 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, FP_OPCODE_MOV, out, WRITEMASK_XYZW, 0, cf, undef, undef ); + } + + /* Finish up: + */ + emit_arith( &p, FP_OPCODE_END, undef, WRITEMASK_XYZW, 0, undef, undef, undef); + + if (key->fog_enabled) { + /* Pull fog mode from GLcontext, the value in the state key is + * a reduced value and not what is expected in FogOption + */ + p.program->FogOption = ctx->Fog.Mode; + } else + p.program->FogOption = GL_NONE; + + if (p.program->NumTexIndirections > ctx->Const.MaxFragmentProgramTexIndirections) + program_error(&p, "Exceeded max nr indirect texture lookups"); + + if (p.program->NumTexInstructions > ctx->Const.MaxFragmentProgramTexInstructions) + program_error(&p, "Exceeded max TEX instructions"); + + if (p.program->NumAluInstructions > ctx->Const.MaxFragmentProgramAluInstructions) + program_error(&p, "Exceeded max ALU instructions"); + + + /* Notify driver the fragment program has (actually) changed. + */ + if (ctx->Driver.ProgramStringNotify || DISASSEM) { + if (ctx->Driver.ProgramStringNotify) + ctx->Driver.ProgramStringNotify( ctx, GL_FRAGMENT_PROGRAM_ARB, + &p.program->Base ); + + if (DISASSEM) { + _mesa_debug_fp_inst(p.program->NumTexInstructions + p.program->NumAluInstructions, + p.program->Instructions); + _mesa_printf("\n"); + } + + } + +} + +static void *search_cache( struct texenvprog_cache *cache, + GLuint hash, + const void *key, + GLuint keysize) +{ + struct texenvprog_cache *c; + + for (c = cache; c; c = c->next) { + if (c->hash == hash && memcmp(c->key, key, keysize) == 0) + return c->data; + } + + return NULL; +} + +static void cache_item( struct texenvprog_cache **cache, + GLuint hash, + void *key, + void *data ) +{ + struct texenvprog_cache *c = MALLOC(sizeof(*c)); + c->hash = hash; + c->key = key; + c->data = data; + c->next = *cache; + *cache = c; +} + +static GLuint hash_key( struct state_key *key ) +{ + GLuint *ikey = (GLuint *)key; + GLuint hash = 0, i; + + /* I'm sure this can be improved on, but speed is important: + */ + for (i = 0; i < sizeof(*key)/sizeof(GLuint); i++) + hash ^= ikey[i]; + + return hash; +} + +void _mesa_UpdateTexEnvProgram( GLcontext *ctx ) +{ + struct state_key *key; + GLuint hash; + + if (ctx->FragmentProgram._Enabled) + return; + + key = make_state_key(ctx); + hash = hash_key(key); + + ctx->FragmentProgram._Current = ctx->_TexEnvProgram = + (struct fragment_program *) + search_cache(ctx->Texture.env_fp_cache, hash, key, sizeof(*key)); + + if (!ctx->_TexEnvProgram) { + if (0) _mesa_printf("Building new texenv proggy for key %x\n", hash); + + ctx->FragmentProgram._Current = ctx->_TexEnvProgram = + (struct fragment_program *) + ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); + + create_new_program(key, ctx, ctx->_TexEnvProgram); + + cache_item(&ctx->Texture.env_fp_cache, hash, key, ctx->_TexEnvProgram); + } else { + FREE(key); + if (0) _mesa_printf("Found existing texenv program for key %x\n", hash); + } + +} + +void _mesa_TexEnvProgramCacheDestroy( GLcontext *ctx ) +{ + struct texenvprog_cache *a, *tmp; + + for (a = ctx->Texture.env_fp_cache; a; a = tmp) { + tmp = a->next; + FREE(a->key); + FREE(a->data); + FREE(a); + } +} + diff --git a/reactos/dll/mesa32/src/main/texenvprogram.h b/reactos/dll/mesa32/src/main/texenvprogram.h new file mode 100644 index 00000000000..30c8cca3889 --- /dev/null +++ b/reactos/dll/mesa32/src/main/texenvprogram.h @@ -0,0 +1,40 @@ +/** + * \file texenvprogram.h + * Texture state management. + */ + +/* + * 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. + */ + + +#ifndef TEXENVPROGRAM_H +#define TEXENVPROGRAM_H + + +#include "mtypes.h" + +extern void _mesa_UpdateTexEnvProgram( GLcontext *ctx ); +extern void _mesa_TexEnvProgramCacheDestroy( GLcontext *ctx ); + +#endif diff --git a/reactos/dll/mesa32/src/main/texformat.c b/reactos/dll/mesa32/src/main/texformat.c new file mode 100644 index 00000000000..878a10bb7cb --- /dev/null +++ b/reactos/dll/mesa32/src/main/texformat.c @@ -0,0 +1,1314 @@ +/* + * 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 texformat.c + * Texture formats. + * + * \author Gareth Hughes + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "image.h" +#include "imports.h" +#include "mtypes.h" +#include "texformat.h" +#include "teximage.h" +#include "texstate.h" +#include "texstore.h" + + + +/* Texel fetch routines for all supported formats + */ +#define DIM 1 +#include "texformat_tmp.h" + +#define DIM 2 +#include "texformat_tmp.h" + +#define DIM 3 +#include "texformat_tmp.h" + +/** + * Null texel fetch function. + * + * Have to have this so the FetchTexel function pointer is never NULL. + */ +static void fetch_null_texel( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + (void) texImage; (void) i; (void) j; (void) k; + texel[RCOMP] = 0; + texel[GCOMP] = 0; + texel[BCOMP] = 0; + texel[ACOMP] = 0; + _mesa_warning(NULL, "fetch_null_texel() called!"); +} + +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) +{ + /* no-op */ +} + + + +/***************************************************************/ +/** \name Default GLchan-based formats */ +/*@{*/ + +const struct gl_texture_format _mesa_texformat_rgba = { + MESA_FORMAT_RGBA, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + CHAN_BITS, /* RedBits */ + CHAN_BITS, /* GreenBits */ + CHAN_BITS, /* BlueBits */ + CHAN_BITS, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 4 * sizeof(GLchan), /* TexelBytes */ + _mesa_texstore_rgba, /* StoreTexImageFunc */ + fetch_texel_1d_rgba, /* FetchTexel1D */ + fetch_texel_2d_rgba, /* FetchTexel2D */ + fetch_texel_3d_rgba, /* FetchTexel3D */ + fetch_texel_1d_f_rgba, /* FetchTexel1Df */ + fetch_texel_2d_f_rgba, /* FetchTexel2Df */ + fetch_texel_3d_f_rgba, /* FetchTexel3Df */ + store_texel_rgba /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_rgb = { + MESA_FORMAT_RGB, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + CHAN_BITS, /* RedBits */ + CHAN_BITS, /* GreenBits */ + CHAN_BITS, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 3 * sizeof(GLchan), /* TexelBytes */ + _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_rgb, /* FetchTexel1D */ + fetch_texel_2d_rgb, /* FetchTexel2D */ + fetch_texel_3d_rgb, /* FetchTexel3D */ + fetch_texel_1d_f_rgb, /* FetchTexel1Df */ + fetch_texel_2d_f_rgb, /* FetchTexel2Df */ + fetch_texel_3d_f_rgb, /* FetchTexel3Df */ + store_texel_rgb /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_alpha = { + MESA_FORMAT_ALPHA, /* MesaFormat */ + GL_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + CHAN_BITS, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + sizeof(GLchan), /* TexelBytes */ + _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_alpha, /* FetchTexel1D */ + fetch_texel_2d_alpha, /* FetchTexel2D */ + fetch_texel_3d_alpha, /* FetchTexel3D */ + fetch_texel_1d_f_alpha, /* FetchTexel1Df */ + fetch_texel_2d_f_alpha, /* FetchTexel2Df */ + fetch_texel_3d_f_alpha, /* FetchTexel3Df */ + store_texel_alpha /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_luminance = { + MESA_FORMAT_LUMINANCE, /* MesaFormat */ + GL_LUMINANCE, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + CHAN_BITS, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + sizeof(GLchan), /* TexelBytes */ + _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_luminance, /* FetchTexel1D */ + fetch_texel_2d_luminance, /* FetchTexel2D */ + fetch_texel_3d_luminance, /* FetchTexel3D */ + fetch_texel_1d_f_luminance, /* FetchTexel1Df */ + fetch_texel_2d_f_luminance, /* FetchTexel2Df */ + fetch_texel_3d_f_luminance, /* FetchTexel3Df */ + store_texel_luminance /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_luminance_alpha = { + MESA_FORMAT_LUMINANCE_ALPHA, /* MesaFormat */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + CHAN_BITS, /* AlphaBits */ + CHAN_BITS, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2 * sizeof(GLchan), /* TexelBytes */ + _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_luminance_alpha, /* FetchTexel1D */ + fetch_texel_2d_luminance_alpha, /* FetchTexel2D */ + fetch_texel_3d_luminance_alpha, /* FetchTexel3D */ + fetch_texel_1d_f_luminance_alpha, /* FetchTexel1Df */ + fetch_texel_2d_f_luminance_alpha, /* FetchTexel2Df */ + fetch_texel_3d_f_luminance_alpha, /* FetchTexel3Df */ + store_texel_luminance_alpha /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_intensity = { + MESA_FORMAT_INTENSITY, /* MesaFormat */ + GL_INTENSITY, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + CHAN_BITS, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + sizeof(GLchan), /* TexelBytes */ + _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_intensity, /* FetchTexel1D */ + fetch_texel_2d_intensity, /* FetchTexel2D */ + fetch_texel_3d_intensity, /* FetchTexel3D */ + fetch_texel_1d_f_intensity, /* FetchTexel1Df */ + fetch_texel_2d_f_intensity, /* FetchTexel2Df */ + fetch_texel_3d_f_intensity, /* FetchTexel3Df */ + store_texel_intensity /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_depth_component_float32 = { + MESA_FORMAT_DEPTH_COMPONENT_FLOAT32, /* MesaFormat */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + sizeof(GLfloat) * 8, /* DepthBits */ + sizeof(GLfloat), /* TexelBytes */ + _mesa_texstore_depth_component_float32,/* StoreTexImageFunc */ + fetch_null_texel, /* FetchTexel1D */ + fetch_null_texel, /* FetchTexel1D */ + fetch_null_texel, /* FetchTexel1D */ + fetch_texel_1d_f_depth_component_f32,/* FetchTexel1Df */ + fetch_texel_2d_f_depth_component_f32,/* FetchTexel2Df */ + fetch_texel_3d_f_depth_component_f32,/* FetchTexel3Df */ + store_texel_depth_component_f32 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_depth_component16 = { + MESA_FORMAT_DEPTH_COMPONENT16, /* MesaFormat */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + sizeof(GLushort) * 8, /* DepthBits */ + sizeof(GLushort), /* TexelBytes */ + _mesa_texstore_depth_component16, /* StoreTexImageFunc */ + fetch_null_texel, /* FetchTexel1D */ + fetch_null_texel, /* FetchTexel1D */ + fetch_null_texel, /* FetchTexel1D */ + fetch_texel_1d_f_depth_component16, /* FetchTexel1Df */ + fetch_texel_2d_f_depth_component16, /* FetchTexel2Df */ + fetch_texel_3d_f_depth_component16, /* FetchTexel3Df */ + store_texel_depth_component16 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_rgba_float32 = { + MESA_FORMAT_RGBA_FLOAT32, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 8 * sizeof(GLfloat), /* RedBits */ + 8 * sizeof(GLfloat), /* GreenBits */ + 8 * sizeof(GLfloat), /* BlueBits */ + 8 * sizeof(GLfloat), /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 4 * sizeof(GLfloat), /* TexelBytes */ + _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ + fetch_texel_1d_rgba_f32, /* FetchTexel1D */ + fetch_texel_2d_rgba_f32, /* FetchTexel1D */ + fetch_texel_3d_rgba_f32, /* FetchTexel1D */ + fetch_texel_1d_f_rgba_f32, /* FetchTexel1Df */ + fetch_texel_2d_f_rgba_f32, /* FetchTexel2Df */ + fetch_texel_3d_f_rgba_f32, /* FetchTexel3Df */ + store_texel_rgba_f32 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_rgba_float16 = { + MESA_FORMAT_RGBA_FLOAT16, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 8 * sizeof(GLhalfARB), /* RedBits */ + 8 * sizeof(GLhalfARB), /* GreenBits */ + 8 * sizeof(GLhalfARB), /* BlueBits */ + 8 * sizeof(GLhalfARB), /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 4 * sizeof(GLhalfARB), /* TexelBytes */ + _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ + fetch_texel_1d_rgba_f16, /* FetchTexel1D */ + fetch_texel_2d_rgba_f16, /* FetchTexel1D */ + fetch_texel_3d_rgba_f16, /* FetchTexel1D */ + fetch_texel_1d_f_rgba_f16, /* FetchTexel1Df */ + fetch_texel_2d_f_rgba_f16, /* FetchTexel2Df */ + fetch_texel_3d_f_rgba_f16, /* FetchTexel3Df */ + store_texel_rgba_f16 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_rgb_float32 = { + MESA_FORMAT_RGB_FLOAT32, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 8 * sizeof(GLfloat), /* RedBits */ + 8 * sizeof(GLfloat), /* GreenBits */ + 8 * sizeof(GLfloat), /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 3 * sizeof(GLfloat), /* TexelBytes */ + _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_rgb_f32, /* FetchTexel1D */ + fetch_texel_2d_rgb_f32, /* FetchTexel1D */ + fetch_texel_3d_rgb_f32, /* FetchTexel1D */ + fetch_texel_1d_f_rgb_f32, /* FetchTexel1Df */ + fetch_texel_2d_f_rgb_f32, /* FetchTexel2Df */ + fetch_texel_3d_f_rgb_f32, /* FetchTexel3Df */ + store_texel_rgb_f32 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_rgb_float16 = { + MESA_FORMAT_RGB_FLOAT16, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 8 * sizeof(GLhalfARB), /* RedBits */ + 8 * sizeof(GLhalfARB), /* GreenBits */ + 8 * sizeof(GLhalfARB), /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 3 * sizeof(GLhalfARB), /* TexelBytes */ + _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_rgb_f16, /* FetchTexel1D */ + fetch_texel_2d_rgb_f16, /* FetchTexel1D */ + fetch_texel_3d_rgb_f16, /* FetchTexel1D */ + fetch_texel_1d_f_rgb_f16, /* FetchTexel1Df */ + fetch_texel_2d_f_rgb_f16, /* FetchTexel2Df */ + fetch_texel_3d_f_rgb_f16, /* FetchTexel3Df */ + store_texel_rgb_f16 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_alpha_float32 = { + MESA_FORMAT_ALPHA_FLOAT32, /* MesaFormat */ + GL_ALPHA, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 8 * sizeof(GLfloat), /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 1 * sizeof(GLfloat), /* TexelBytes */ + _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_alpha_f32, /* FetchTexel1D */ + fetch_texel_2d_alpha_f32, /* FetchTexel1D */ + fetch_texel_3d_alpha_f32, /* FetchTexel1D */ + fetch_texel_1d_f_alpha_f32, /* FetchTexel1Df */ + fetch_texel_2d_f_alpha_f32, /* FetchTexel2Df */ + fetch_texel_3d_f_alpha_f32, /* FetchTexel3Df */ + store_texel_alpha_f32 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_alpha_float16 = { + MESA_FORMAT_ALPHA_FLOAT16, /* MesaFormat */ + GL_ALPHA, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 8 * sizeof(GLhalfARB), /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 1 * sizeof(GLhalfARB), /* TexelBytes */ + _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_alpha_f16, /* FetchTexel1D */ + fetch_texel_2d_alpha_f16, /* FetchTexel1D */ + fetch_texel_3d_alpha_f16, /* FetchTexel1D */ + fetch_texel_1d_f_alpha_f16, /* FetchTexel1Df */ + fetch_texel_2d_f_alpha_f16, /* FetchTexel2Df */ + fetch_texel_3d_f_alpha_f16, /* FetchTexel3Df */ + store_texel_alpha_f16 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_luminance_float32 = { + MESA_FORMAT_LUMINANCE_FLOAT32, /* MesaFormat */ + GL_LUMINANCE, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 8 * sizeof(GLfloat), /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 1 * sizeof(GLfloat), /* TexelBytes */ + _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_luminance_f32, /* FetchTexel1D */ + fetch_texel_2d_luminance_f32, /* FetchTexel2D */ + fetch_texel_3d_luminance_f32, /* FetchTexel3D */ + fetch_texel_1d_f_luminance_f32, /* FetchTexel1Df */ + fetch_texel_2d_f_luminance_f32, /* FetchTexel2Df */ + fetch_texel_3d_f_luminance_f32, /* FetchTexel3Df */ + store_texel_luminance_f32 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_luminance_float16 = { + MESA_FORMAT_LUMINANCE_FLOAT16, /* MesaFormat */ + GL_LUMINANCE, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 8 * sizeof(GLhalfARB), /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 1 * sizeof(GLhalfARB), /* TexelBytes */ + _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_luminance_f16, /* FetchTexel1D */ + fetch_texel_2d_luminance_f16, /* FetchTexel2D */ + fetch_texel_3d_luminance_f16, /* FetchTexel3D */ + fetch_texel_1d_f_luminance_f16, /* FetchTexel1Df */ + fetch_texel_2d_f_luminance_f16, /* FetchTexel2Df */ + fetch_texel_3d_f_luminance_f16, /* FetchTexel3Df */ + store_texel_luminance_f16 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, /* MesaFormat */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 8 * sizeof(GLfloat), /* AlphaBits */ + 8 * sizeof(GLfloat), /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2 * sizeof(GLfloat), /* TexelBytes */ + _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ + fetch_texel_1d_luminance_alpha_f32, /* FetchTexel1D */ + fetch_texel_2d_luminance_alpha_f32, /* FetchTexel2D */ + fetch_texel_3d_luminance_alpha_f32, /* FetchTexel3D */ + fetch_texel_1d_f_luminance_alpha_f32,/* FetchTexel1Df */ + fetch_texel_2d_f_luminance_alpha_f32,/* FetchTexel2Df */ + fetch_texel_3d_f_luminance_alpha_f32,/* FetchTexel3Df */ + store_texel_luminance_alpha_f32 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, /* MesaFormat */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 8 * sizeof(GLhalfARB), /* AlphaBits */ + 8 * sizeof(GLhalfARB), /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2 * sizeof(GLhalfARB), /* TexelBytes */ + _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ + fetch_texel_1d_luminance_alpha_f16, /* FetchTexel1D */ + fetch_texel_2d_luminance_alpha_f16, /* FetchTexel2D */ + fetch_texel_3d_luminance_alpha_f16, /* FetchTexel3D */ + fetch_texel_1d_f_luminance_alpha_f16,/* FetchTexel1Df */ + fetch_texel_2d_f_luminance_alpha_f16,/* FetchTexel2Df */ + fetch_texel_3d_f_luminance_alpha_f16,/* FetchTexel3Df */ + store_texel_luminance_alpha_f16 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_intensity_float32 = { + MESA_FORMAT_INTENSITY_FLOAT32, /* MesaFormat */ + GL_INTENSITY, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 8 * sizeof(GLfloat), /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 1 * sizeof(GLfloat), /* TexelBytes */ + _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_intensity_f32, /* FetchTexel1D */ + fetch_texel_2d_intensity_f32, /* FetchTexel2D */ + fetch_texel_3d_intensity_f32, /* FetchTexel3D */ + fetch_texel_1d_f_intensity_f32, /* FetchTexel1Df */ + fetch_texel_2d_f_intensity_f32, /* FetchTexel2Df */ + fetch_texel_3d_f_intensity_f32, /* FetchTexel3Df */ + store_texel_intensity_f32 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_intensity_float16 = { + MESA_FORMAT_INTENSITY_FLOAT16, /* MesaFormat */ + GL_INTENSITY, /* BaseFormat */ + GL_FLOAT, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 8 * sizeof(GLhalfARB), /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 1 * sizeof(GLhalfARB), /* TexelBytes */ + _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_intensity_f16, /* FetchTexel1D */ + fetch_texel_2d_intensity_f16, /* FetchTexel2D */ + fetch_texel_3d_intensity_f16, /* FetchTexel3D */ + fetch_texel_1d_f_intensity_f16, /* FetchTexel1Df */ + fetch_texel_2d_f_intensity_f16, /* FetchTexel2Df */ + fetch_texel_3d_f_intensity_f16, /* FetchTexel3Df */ + store_texel_intensity_f16 /* StoreTexel */ +}; + + +/*@}*/ + + +/***************************************************************/ +/** \name Hardware formats */ +/*@{*/ + +const struct gl_texture_format _mesa_texformat_rgba8888 = { + MESA_FORMAT_RGBA8888, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 8, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 4, /* TexelBytes */ + _mesa_texstore_rgba8888, /* StoreTexImageFunc */ + fetch_texel_1d_rgba8888, /* FetchTexel1D */ + fetch_texel_2d_rgba8888, /* FetchTexel2D */ + fetch_texel_3d_rgba8888, /* FetchTexel3D */ + fetch_texel_1d_f_rgba8888, /* FetchTexel1Df */ + fetch_texel_2d_f_rgba8888, /* FetchTexel2Df */ + fetch_texel_3d_f_rgba8888, /* FetchTexel3Df */ + store_texel_rgba8888 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_rgba8888_rev = { + MESA_FORMAT_RGBA8888_REV, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 8, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 4, /* TexelBytes */ + _mesa_texstore_rgba8888, /* StoreTexImageFunc */ + fetch_texel_1d_rgba8888_rev, /* FetchTexel1D */ + fetch_texel_2d_rgba8888_rev, /* FetchTexel2D */ + fetch_texel_3d_rgba8888_rev, /* FetchTexel3D */ + fetch_texel_1d_f_rgba8888_rev, /* FetchTexel1Df */ + fetch_texel_2d_f_rgba8888_rev, /* FetchTexel2Df */ + fetch_texel_3d_f_rgba8888_rev, /* FetchTexel3Df */ + store_texel_rgba8888_rev /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_argb8888 = { + MESA_FORMAT_ARGB8888, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 8, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 4, /* TexelBytes */ + _mesa_texstore_argb8888, /* StoreTexImageFunc */ + fetch_texel_1d_argb8888, /* FetchTexel1D */ + fetch_texel_2d_argb8888, /* FetchTexel2D */ + fetch_texel_3d_argb8888, /* FetchTexel3D */ + fetch_texel_1d_f_argb8888, /* FetchTexel1Df */ + fetch_texel_2d_f_argb8888, /* FetchTexel2Df */ + fetch_texel_3d_f_argb8888, /* FetchTexel3Df */ + store_texel_argb8888 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_argb8888_rev = { + MESA_FORMAT_ARGB8888_REV, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 8, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 4, /* TexelBytes */ + _mesa_texstore_argb8888, /* StoreTexImageFunc */ + fetch_texel_1d_argb8888_rev, /* FetchTexel1D */ + fetch_texel_2d_argb8888_rev, /* FetchTexel2D */ + fetch_texel_3d_argb8888_rev, /* FetchTexel3D */ + fetch_texel_1d_f_argb8888_rev, /* FetchTexel1Df */ + fetch_texel_2d_f_argb8888_rev, /* FetchTexel2Df */ + fetch_texel_3d_f_argb8888_rev, /* FetchTexel3Df */ + store_texel_argb8888_rev /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_rgb888 = { + MESA_FORMAT_RGB888, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 3, /* TexelBytes */ + _mesa_texstore_rgb888, /* StoreTexImageFunc */ + fetch_texel_1d_rgb888, /* FetchTexel1D */ + fetch_texel_2d_rgb888, /* FetchTexel2D */ + fetch_texel_3d_rgb888, /* FetchTexel3D */ + fetch_texel_1d_f_rgb888, /* FetchTexel1Df */ + fetch_texel_2d_f_rgb888, /* FetchTexel2Df */ + fetch_texel_3d_f_rgb888, /* FetchTexel3Df */ + store_texel_rgb888 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_bgr888 = { + MESA_FORMAT_BGR888, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 3, /* TexelBytes */ + _mesa_texstore_bgr888, /* StoreTexImageFunc */ + fetch_texel_1d_bgr888, /* FetchTexel1D */ + fetch_texel_2d_bgr888, /* FetchTexel2D */ + fetch_texel_3d_bgr888, /* FetchTexel3D */ + fetch_texel_1d_f_bgr888, /* FetchTexel1Df */ + fetch_texel_2d_f_bgr888, /* FetchTexel2Df */ + fetch_texel_3d_f_bgr888, /* FetchTexel3Df */ + store_texel_bgr888 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_rgb565 = { + MESA_FORMAT_RGB565, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 5, /* RedBits */ + 6, /* GreenBits */ + 5, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + _mesa_texstore_rgb565, /* StoreTexImageFunc */ + fetch_texel_1d_rgb565, /* FetchTexel1D */ + fetch_texel_2d_rgb565, /* FetchTexel2D */ + fetch_texel_3d_rgb565, /* FetchTexel3D */ + fetch_texel_1d_f_rgb565, /* FetchTexel1Df */ + fetch_texel_2d_f_rgb565, /* FetchTexel2Df */ + fetch_texel_3d_f_rgb565, /* FetchTexel3Df */ + store_texel_rgb565 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_rgb565_rev = { + MESA_FORMAT_RGB565_REV, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 5, /* RedBits */ + 6, /* GreenBits */ + 5, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + _mesa_texstore_rgb565, /* StoreTexImageFunc */ + fetch_texel_1d_rgb565_rev, /* FetchTexel1D */ + fetch_texel_2d_rgb565_rev, /* FetchTexel2D */ + fetch_texel_3d_rgb565_rev, /* FetchTexel3D */ + fetch_texel_1d_f_rgb565_rev, /* FetchTexel1Df */ + fetch_texel_2d_f_rgb565_rev, /* FetchTexel2Df */ + fetch_texel_3d_f_rgb565_rev, /* FetchTexel3Df */ + store_texel_rgb565_rev /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_argb4444 = { + MESA_FORMAT_ARGB4444, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 4, /* RedBits */ + 4, /* GreenBits */ + 4, /* BlueBits */ + 4, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + _mesa_texstore_argb4444, /* StoreTexImageFunc */ + fetch_texel_1d_argb4444, /* FetchTexel1D */ + fetch_texel_2d_argb4444, /* FetchTexel2D */ + fetch_texel_3d_argb4444, /* FetchTexel3D */ + fetch_texel_1d_f_argb4444, /* FetchTexel1Df */ + fetch_texel_2d_f_argb4444, /* FetchTexel2Df */ + fetch_texel_3d_f_argb4444, /* FetchTexel3Df */ + store_texel_argb4444 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_argb4444_rev = { + MESA_FORMAT_ARGB4444_REV, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 4, /* RedBits */ + 4, /* GreenBits */ + 4, /* BlueBits */ + 4, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + _mesa_texstore_argb4444, /* StoreTexImageFunc */ + fetch_texel_1d_argb4444_rev, /* FetchTexel1D */ + fetch_texel_2d_argb4444_rev, /* FetchTexel2D */ + fetch_texel_3d_argb4444_rev, /* FetchTexel3D */ + fetch_texel_1d_f_argb4444_rev, /* FetchTexel1Df */ + fetch_texel_2d_f_argb4444_rev, /* FetchTexel2Df */ + fetch_texel_3d_f_argb4444_rev, /* FetchTexel3Df */ + store_texel_argb4444_rev /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_argb1555 = { + MESA_FORMAT_ARGB1555, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 5, /* RedBits */ + 5, /* GreenBits */ + 5, /* BlueBits */ + 1, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + _mesa_texstore_argb1555, /* StoreTexImageFunc */ + fetch_texel_1d_argb1555, /* FetchTexel1D */ + fetch_texel_2d_argb1555, /* FetchTexel2D */ + fetch_texel_3d_argb1555, /* FetchTexel3D */ + fetch_texel_1d_f_argb1555, /* FetchTexel1Df */ + fetch_texel_2d_f_argb1555, /* FetchTexel2Df */ + fetch_texel_3d_f_argb1555, /* FetchTexel3Df */ + store_texel_argb1555 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_argb1555_rev = { + MESA_FORMAT_ARGB1555_REV, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 5, /* RedBits */ + 5, /* GreenBits */ + 5, /* BlueBits */ + 1, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + _mesa_texstore_argb1555, /* StoreTexImageFunc */ + fetch_texel_1d_argb1555_rev, /* FetchTexel1D */ + fetch_texel_2d_argb1555_rev, /* FetchTexel2D */ + fetch_texel_3d_argb1555_rev, /* FetchTexel3D */ + fetch_texel_1d_f_argb1555_rev, /* FetchTexel1Df */ + fetch_texel_2d_f_argb1555_rev, /* FetchTexel2Df */ + fetch_texel_3d_f_argb1555_rev, /* FetchTexel3Df */ + store_texel_argb1555_rev /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_al88 = { + MESA_FORMAT_AL88, /* MesaFormat */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 8, /* AlphaBits */ + 8, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + _mesa_texstore_al88, /* StoreTexImageFunc */ + fetch_texel_1d_al88, /* FetchTexel1D */ + fetch_texel_2d_al88, /* FetchTexel2D */ + fetch_texel_3d_al88, /* FetchTexel3D */ + fetch_texel_1d_f_al88, /* FetchTexel1Df */ + fetch_texel_2d_f_al88, /* FetchTexel2Df */ + fetch_texel_3d_f_al88, /* FetchTexel3Df */ + store_texel_al88 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_al88_rev = { + MESA_FORMAT_AL88_REV, /* MesaFormat */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 8, /* AlphaBits */ + 8, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + _mesa_texstore_al88, /* StoreTexImageFunc */ + fetch_texel_1d_al88_rev, /* FetchTexel1D */ + fetch_texel_2d_al88_rev, /* FetchTexel2D */ + fetch_texel_3d_al88_rev, /* FetchTexel3D */ + fetch_texel_1d_f_al88_rev, /* FetchTexel1Df */ + fetch_texel_2d_f_al88_rev, /* FetchTexel2Df */ + fetch_texel_3d_f_al88_rev, /* FetchTexel3Df */ + store_texel_al88_rev /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_rgb332 = { + MESA_FORMAT_RGB332, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 3, /* RedBits */ + 3, /* GreenBits */ + 2, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 1, /* TexelBytes */ + _mesa_texstore_rgb332, /* StoreTexImageFunc */ + fetch_texel_1d_rgb332, /* FetchTexel1D */ + fetch_texel_2d_rgb332, /* FetchTexel2D */ + fetch_texel_3d_rgb332, /* FetchTexel3D */ + fetch_texel_1d_f_rgb332, /* FetchTexel1Df */ + fetch_texel_2d_f_rgb332, /* FetchTexel2Df */ + fetch_texel_3d_f_rgb332, /* FetchTexel3Df */ + store_texel_rgb332 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_a8 = { + MESA_FORMAT_A8, /* MesaFormat */ + GL_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 8, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 1, /* TexelBytes */ + _mesa_texstore_a8, /* StoreTexImageFunc */ + fetch_texel_1d_a8, /* FetchTexel1D */ + fetch_texel_2d_a8, /* FetchTexel2D */ + fetch_texel_3d_a8, /* FetchTexel3D */ + fetch_texel_1d_f_a8, /* FetchTexel1Df */ + fetch_texel_2d_f_a8, /* FetchTexel2Df */ + fetch_texel_3d_f_a8, /* FetchTexel3Df */ + store_texel_a8 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_l8 = { + MESA_FORMAT_L8, /* MesaFormat */ + GL_LUMINANCE, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 8, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 1, /* TexelBytes */ + _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_l8, /* FetchTexel1D */ + fetch_texel_2d_l8, /* FetchTexel2D */ + fetch_texel_3d_l8, /* FetchTexel3D */ + fetch_texel_1d_f_l8, /* FetchTexel1Df */ + fetch_texel_2d_f_l8, /* FetchTexel2Df */ + fetch_texel_3d_f_l8, /* FetchTexel3Df */ + store_texel_l8 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_i8 = { + MESA_FORMAT_I8, /* MesaFormat */ + GL_INTENSITY, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 8, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 1, /* TexelBytes */ + _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ + fetch_texel_1d_i8, /* FetchTexel1D */ + fetch_texel_2d_i8, /* FetchTexel2D */ + fetch_texel_3d_i8, /* FetchTexel3D */ + fetch_texel_1d_f_i8, /* FetchTexel1Df */ + fetch_texel_2d_f_i8, /* FetchTexel2Df */ + fetch_texel_3d_f_i8, /* FetchTexel3Df */ + store_texel_i8 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_ci8 = { + MESA_FORMAT_CI8, /* MesaFormat */ + GL_COLOR_INDEX, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 8, /* IndexBits */ + 0, /* DepthBits */ + 1, /* TexelBytes */ + _mesa_texstore_ci8, /* StoreTexImageFunc */ + fetch_texel_1d_ci8, /* FetchTexel1D */ + fetch_texel_2d_ci8, /* FetchTexel2D */ + fetch_texel_3d_ci8, /* FetchTexel3D */ + fetch_texel_1d_f_ci8, /* FetchTexel1Df */ + fetch_texel_2d_f_ci8, /* FetchTexel2Df */ + fetch_texel_3d_f_ci8, /* FetchTexel3Df */ + store_texel_ci8 /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_ycbcr = { + MESA_FORMAT_YCBCR, /* MesaFormat */ + GL_YCBCR_MESA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + _mesa_texstore_ycbcr, /* StoreTexImageFunc */ + fetch_texel_1d_ycbcr, /* FetchTexel1D */ + fetch_texel_2d_ycbcr, /* FetchTexel2D */ + fetch_texel_3d_ycbcr, /* FetchTexel3D */ + fetch_texel_1d_f_ycbcr, /* FetchTexel1Df */ + fetch_texel_2d_f_ycbcr, /* FetchTexel2Df */ + fetch_texel_3d_f_ycbcr, /* FetchTexel3Df */ + store_texel_ycbcr /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_ycbcr_rev = { + MESA_FORMAT_YCBCR_REV, /* MesaFormat */ + GL_YCBCR_MESA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + _mesa_texstore_ycbcr, /* StoreTexImageFunc */ + fetch_texel_1d_ycbcr_rev, /* FetchTexel1D */ + fetch_texel_2d_ycbcr_rev, /* FetchTexel2D */ + fetch_texel_3d_ycbcr_rev, /* FetchTexel3D */ + fetch_texel_1d_f_ycbcr_rev, /* FetchTexel1Df */ + fetch_texel_2d_f_ycbcr_rev, /* FetchTexel2Df */ + fetch_texel_3d_f_ycbcr_rev, /* FetchTexel3Df */ + store_texel_ycbcr_rev /* StoreTexel */ +}; + +/*@}*/ + + +/***************************************************************/ +/** \name Null format (useful for proxy textures) */ +/*@{*/ + +const struct gl_texture_format _mesa_null_texformat = { + -1, /* MesaFormat */ + 0, /* BaseFormat */ + GL_NONE, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* TexelBytes */ + NULL, /* StoreTexImageFunc */ + fetch_null_texel, /* FetchTexel1D */ + fetch_null_texel, /* FetchTexel2D */ + fetch_null_texel, /* FetchTexel3D */ + fetch_null_texelf, /* FetchTexel1Df */ + fetch_null_texelf, /* FetchTexel2Df */ + fetch_null_texelf, /* FetchTexel3Df */ + store_null_texel /* StoreTexel */ +}; + +/*@}*/ + + +/** + * 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. + */ +const struct gl_texture_format * +_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, + GLenum format, GLenum type ) +{ + (void) format; + (void) type; + + switch (internalFormat) { + /* RGBA formats */ + case 4: + case GL_RGBA: + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + return &_mesa_texformat_rgba; + case GL_RGBA8: + return &_mesa_texformat_rgba8888; + case GL_RGB5_A1: + return &_mesa_texformat_argb1555; + case GL_RGBA2: + return &_mesa_texformat_argb4444_rev; /* just to test another format*/ + case GL_RGBA4: + return &_mesa_texformat_argb4444; + + /* RGB formats */ + case 3: + case GL_RGB: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + return &_mesa_texformat_rgb; + case GL_RGB8: + return &_mesa_texformat_rgb888; + case GL_R3_G3_B2: + return &_mesa_texformat_rgb332; + case GL_RGB4: + return &_mesa_texformat_rgb565_rev; /* just to test another format */ + case GL_RGB5: + return &_mesa_texformat_rgb565; + + /* Alpha formats */ + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA12: + case GL_ALPHA16: + return &_mesa_texformat_alpha; + case GL_ALPHA8: + return &_mesa_texformat_a8; + + /* Luminance formats */ + case 1: + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + return &_mesa_texformat_luminance; + case GL_LUMINANCE8: + return &_mesa_texformat_l8; + + /* Luminance/Alpha formats */ + case 2: + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE4_ALPHA4: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + return &_mesa_texformat_luminance_alpha; + case GL_LUMINANCE8_ALPHA8: + return &_mesa_texformat_al88; + + case GL_INTENSITY: + case GL_INTENSITY4: + case GL_INTENSITY12: + case GL_INTENSITY16: + return &_mesa_texformat_intensity; + case GL_INTENSITY8: + return &_mesa_texformat_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_texformat_ci8; + + default: + ; /* fallthrough */ + } + + if (ctx->Extensions.SGIX_depth_texture || + ctx->Extensions.ARB_depth_texture) { + switch (internalFormat) { + case GL_DEPTH_COMPONENT: + case GL_DEPTH_COMPONENT24_SGIX: + case GL_DEPTH_COMPONENT32_SGIX: + return &_mesa_texformat_depth_component_float32; + case GL_DEPTH_COMPONENT16_SGIX: + return &_mesa_texformat_depth_component16; + default: + ; /* fallthrough */ + } + } + + if (ctx->Extensions.ARB_texture_compression) { + switch (internalFormat) { + case GL_COMPRESSED_ALPHA_ARB: + return &_mesa_texformat_alpha; + case GL_COMPRESSED_LUMINANCE_ARB: + return &_mesa_texformat_luminance; + case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: + return &_mesa_texformat_luminance_alpha; + case GL_COMPRESSED_INTENSITY_ARB: + return &_mesa_texformat_intensity; + case GL_COMPRESSED_RGB_ARB: + if (ctx->Extensions.TDFX_texture_compression_FXT1) + return &_mesa_texformat_rgb_fxt1; + else if (ctx->Extensions.EXT_texture_compression_s3tc || + ctx->Extensions.S3_s3tc) + return &_mesa_texformat_rgb_dxt1; + else + return &_mesa_texformat_rgb; + case GL_COMPRESSED_RGBA_ARB: + if (ctx->Extensions.TDFX_texture_compression_FXT1) + return &_mesa_texformat_rgba_fxt1; + else if (ctx->Extensions.EXT_texture_compression_s3tc || + ctx->Extensions.S3_s3tc) + return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */ + else + return &_mesa_texformat_rgba; + default: + ; /* fallthrough */ + } + } + + if (ctx->Extensions.MESA_ycbcr_texture) { + if (internalFormat == GL_YCBCR_MESA) { + if (type == GL_UNSIGNED_SHORT_8_8_MESA) + return &_mesa_texformat_ycbcr; + else + return &_mesa_texformat_ycbcr_rev; + } + } + + if (ctx->Extensions.TDFX_texture_compression_FXT1) { + switch (internalFormat) { + case GL_COMPRESSED_RGB_FXT1_3DFX: + return &_mesa_texformat_rgb_fxt1; + case GL_COMPRESSED_RGBA_FXT1_3DFX: + return &_mesa_texformat_rgba_fxt1; + default: + ; /* fallthrough */ + } + } + + if (ctx->Extensions.EXT_texture_compression_s3tc) { + switch (internalFormat) { + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + return &_mesa_texformat_rgb_dxt1; + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + return &_mesa_texformat_rgba_dxt1; + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + return &_mesa_texformat_rgba_dxt3; + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + return &_mesa_texformat_rgba_dxt5; + default: + ; /* fallthrough */ + } + } + + if (ctx->Extensions.S3_s3tc) { + switch (internalFormat) { + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + return &_mesa_texformat_rgb_dxt1; + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + return &_mesa_texformat_rgba_dxt3; + default: + ; /* fallthrough */ + } + } + + if (ctx->Extensions.ARB_texture_float) { + switch (internalFormat) { + case GL_ALPHA16F_ARB: + return &_mesa_texformat_alpha_float16; + case GL_ALPHA32F_ARB: + return &_mesa_texformat_alpha_float32; + case GL_LUMINANCE16F_ARB: + return &_mesa_texformat_luminance_float16; + case GL_LUMINANCE32F_ARB: + return &_mesa_texformat_luminance_float32; + case GL_LUMINANCE_ALPHA16F_ARB: + return &_mesa_texformat_luminance_alpha_float16; + case GL_LUMINANCE_ALPHA32F_ARB: + return &_mesa_texformat_luminance_alpha_float32; + case GL_INTENSITY16F_ARB: + return &_mesa_texformat_intensity_float16; + case GL_INTENSITY32F_ARB: + return &_mesa_texformat_intensity_float32; + case GL_RGB16F_ARB: + return &_mesa_texformat_rgb_float16; + case GL_RGB32F_ARB: + return &_mesa_texformat_rgb_float32; + case GL_RGBA16F_ARB: + return &_mesa_texformat_rgba_float16; + case GL_RGBA32F_ARB: + return &_mesa_texformat_rgba_float32; + default: + ; /* fallthrough */ + } + } + + _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); + return NULL; +} diff --git a/reactos/dll/mesa32/src/main/texformat.h b/reactos/dll/mesa32/src/main/texformat.h new file mode 100644 index 00000000000..35522d62189 --- /dev/null +++ b/reactos/dll/mesa32/src/main/texformat.h @@ -0,0 +1,229 @@ +/* + * 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. + */ + + +/** + * \file texformat.h + * Texture formats definitions. + * + * \author Gareth Hughes + */ + + +#ifndef TEXFORMAT_H +#define TEXFORMAT_H + + +#include "mtypes.h" + + +/** + * Mesa internal texture image formats. + * All texture images are stored in one of these formats. + * + * NOTE: when you add a new format, be sure to update the do_row() + * function in texstore.c used for auto mipmap generation. + */ +enum _format { + /** + * \name Hardware-friendly formats. + * + * Drivers can override the default formats and convert texture images to + * one of these as required. The driver's + * dd_function_table::ChooseTextureFormat function will choose one of these + * formats. + * + * \note In the default case, some of these formats will be duplicates of + * the generic formats listed below. However, these formats guarantee their + * internal component sizes, while GLchan may vary between GLubyte, GLushort + * and GLfloat. + */ + /*@{*/ + /* 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_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_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_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 */ + /*@}*/ + + /** + * \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 Generic GLchan-based formats. + * + * Software-oriented texture formats. Texels are arrays of GLchan + * values so there are no byte order issues. + * + * \note Because these are based on the GLchan data type, one cannot assume + * 8 bits per channel with these formats. If you require GLubyte channels, + * use one of the hardware formats above. + */ + /*@{*/ + MESA_FORMAT_RGBA, + MESA_FORMAT_RGB, + MESA_FORMAT_ALPHA, + MESA_FORMAT_LUMINANCE, + MESA_FORMAT_LUMINANCE_ALPHA, + MESA_FORMAT_INTENSITY, + /*@}*/ + + /** + * Depth textures + */ + /*@{*/ + MESA_FORMAT_DEPTH_COMPONENT_FLOAT32, + MESA_FORMAT_DEPTH_COMPONENT16, + /*@}*/ + + /** + * \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 + /*@}*/ +}; + + +/** GLchan-valued formats */ +/*@{*/ +extern const struct gl_texture_format _mesa_texformat_rgba; +extern const struct gl_texture_format _mesa_texformat_rgb; +extern const struct gl_texture_format _mesa_texformat_alpha; +extern const struct gl_texture_format _mesa_texformat_luminance; +extern const struct gl_texture_format _mesa_texformat_luminance_alpha; +extern const struct gl_texture_format _mesa_texformat_intensity; +/*@}*/ + +/** Depth textures */ +/*@{*/ +extern const struct gl_texture_format _mesa_texformat_depth_component_float32; +extern const struct gl_texture_format _mesa_texformat_depth_component16; +/*@}*/ + +/** Floating point texture formats */ +/*@{*/ +extern const struct gl_texture_format _mesa_texformat_rgba_float32; +extern const struct gl_texture_format _mesa_texformat_rgba_float16; +extern const struct gl_texture_format _mesa_texformat_rgb_float32; +extern const struct gl_texture_format _mesa_texformat_rgb_float16; +extern const struct gl_texture_format _mesa_texformat_alpha_float32; +extern const struct gl_texture_format _mesa_texformat_alpha_float16; +extern const struct gl_texture_format _mesa_texformat_luminance_float32; +extern const struct gl_texture_format _mesa_texformat_luminance_float16; +extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float32; +extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float16; +extern const struct gl_texture_format _mesa_texformat_intensity_float32; +extern const struct gl_texture_format _mesa_texformat_intensity_float16; +/*@}*/ + +/** \name Assorted hardware-friendly formats */ +/*@{*/ +extern const struct gl_texture_format _mesa_texformat_rgba8888; +extern const struct gl_texture_format _mesa_texformat_rgba8888_rev; +extern const struct gl_texture_format _mesa_texformat_argb8888; +extern const struct gl_texture_format _mesa_texformat_argb8888_rev; +extern const struct gl_texture_format _mesa_texformat_rgb888; +extern const struct gl_texture_format _mesa_texformat_bgr888; +extern const struct gl_texture_format _mesa_texformat_rgb565; +extern const struct gl_texture_format _mesa_texformat_rgb565_rev; +extern const struct gl_texture_format _mesa_texformat_argb4444; +extern const struct gl_texture_format _mesa_texformat_argb4444_rev; +extern const struct gl_texture_format _mesa_texformat_argb1555; +extern const struct gl_texture_format _mesa_texformat_argb1555_rev; +extern const struct gl_texture_format _mesa_texformat_al88; +extern const struct gl_texture_format _mesa_texformat_al88_rev; +extern const struct gl_texture_format _mesa_texformat_rgb332; +extern const struct gl_texture_format _mesa_texformat_a8; +extern const struct gl_texture_format _mesa_texformat_l8; +extern const struct gl_texture_format _mesa_texformat_i8; +extern const struct gl_texture_format _mesa_texformat_ci8; + +/*@}*/ + +/** \name YCbCr formats */ +/*@{*/ +extern const struct gl_texture_format _mesa_texformat_ycbcr; +extern const struct gl_texture_format _mesa_texformat_ycbcr_rev; +/*@}*/ + +/** \name Compressed formats */ +/*@{*/ +extern const struct gl_texture_format _mesa_texformat_rgb_fxt1; +extern const struct gl_texture_format _mesa_texformat_rgba_fxt1; +extern const struct gl_texture_format _mesa_texformat_rgb_dxt1; +extern const struct gl_texture_format _mesa_texformat_rgba_dxt1; +extern const struct gl_texture_format _mesa_texformat_rgba_dxt3; +extern const struct gl_texture_format _mesa_texformat_rgba_dxt5; +/*@}*/ + +/** \name The null format */ +/*@{*/ +extern const struct gl_texture_format _mesa_null_texformat; +/*@}*/ + + +extern const struct gl_texture_format * +_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, + GLenum format, GLenum type ); + +#endif diff --git a/reactos/dll/mesa32/src/main/texformat_tmp.h b/reactos/dll/mesa32/src/main/texformat_tmp.h new file mode 100644 index 00000000000..20214520c75 --- /dev/null +++ b/reactos/dll/mesa32/src/main/texformat_tmp.h @@ -0,0 +1,1751 @@ +/* $XFree86$ */ +/* + * Mesa 3-D graphics library + * Version: 6.3.2 + * + * 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 texformat_tmp.h + * Texel fetch functions template. + * + * This template file is used by texformat.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. + * + * \sa texformat.c and FetchTexel. + * + * \author Gareth Hughes + * \author Brian Paul + */ + + +#if DIM == 1 + +#define CHAN_ADDR( t, i, j, k, sz ) \ + ((GLchan *)(t)->Data + (i) * (sz)) +#define UBYTE_ADDR( t, i, j, k, sz ) \ + ((GLubyte *)(t)->Data + (i) * (sz)) +#define USHORT_ADDR( t, i, j, k ) \ + ((GLushort *)(t)->Data + (i)) +#define UINT_ADDR( t, i, j, k ) \ + ((GLuint *)(t)->Data + (i)) +#define FLOAT_ADDR( t, i, j, k, sz ) \ + ((GLfloat *)(t)->Data + (i) * (sz)) +#define HALF_ADDR( t, i, j, k, sz ) \ + ((GLhalfARB *)(t)->Data + (i) * (sz)) + +#define FETCH(x) fetch_texel_1d_##x + +#elif DIM == 2 + +#define CHAN_ADDR( t, i, j, k, sz ) \ + ((GLchan *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)) +#define UBYTE_ADDR( t, i, j, k, sz ) \ + ((GLubyte *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)) +#define USHORT_ADDR( t, i, j, k ) \ + ((GLushort *)(t)->Data + ((t)->RowStride * (j) + (i))) +#define UINT_ADDR( t, i, j, k ) \ + ((GLuint *)(t)->Data + ((t)->RowStride * (j) + (i))) +#define FLOAT_ADDR( t, i, j, k, sz ) \ + ((GLfloat *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)) +#define HALF_ADDR( t, i, j, k, sz ) \ + ((GLhalfARB *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)) + +#define FETCH(x) fetch_texel_2d_##x + +#elif DIM == 3 + +#define CHAN_ADDR( t, i, j, k, sz ) \ + (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \ + (t)->RowStride + (i)) * (sz) +#define UBYTE_ADDR( t, i, j, k, sz ) \ + ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \ + (t)->RowStride + (i)) * (sz)) +#define USHORT_ADDR( t, i, j, k ) \ + ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \ + (t)->RowStride + (i))) +#define UINT_ADDR( t, i, j, k ) \ + ((GLuint *)(t)->Data + (((t)->Height * (k) + (j)) * \ + (t)->RowStride + (i))) +#define FLOAT_ADDR( t, i, j, k, sz ) \ + ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \ + (t)->RowStride + (i)) * (sz)) +#define HALF_ADDR( t, i, j, k, sz ) \ + ((GLhalfARB *)(t)->Data + (((t)->Height * (k) + (j)) * \ + (t)->RowStride + (i)) * (sz)) + +#define FETCH(x) fetch_texel_3d_##x + +#else +#error illegal number of texture dimensions +#endif + + +/* MESA_FORMAT_RGBA **********************************************************/ + +/* Fetch texel from 1D, 2D or 3D RGBA texture, returning 4 GLchans */ +static void FETCH(rgba)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLchan *src = CHAN_ADDR( texImage, i, j, k, 4 ); + COPY_CHAN4( texel, src ); +} + +/* Fetch texel from 1D, 2D or 3D RGBA texture, returning 4 GLfloats */ +static void FETCH(f_rgba)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLchan *src = CHAN_ADDR( texImage, i, j, k, 4 ); + texel[RCOMP] = CHAN_TO_FLOAT(src[0]); + texel[GCOMP] = CHAN_TO_FLOAT(src[1]); + texel[BCOMP] = CHAN_TO_FLOAT(src[2]); + texel[ACOMP] = CHAN_TO_FLOAT(src[3]); +} + +#if DIM == 3 +/* Store a GLchan RGBA texel */ +static void store_texel_rgba(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLchan *rgba = (const GLchan *) texel; + GLchan *dst = CHAN_ADDR(texImage, i, j, k, 4); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[BCOMP]; + dst[3] = rgba[ACOMP]; +} +#endif + +/* MESA_FORMAT_RGB ***********************************************************/ + +/* Fetch texel from 1D, 2D or 3D RGB texture, returning 4 GLchans */ +static void FETCH(rgb)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLchan *src = CHAN_ADDR( texImage, i, j, k, 3 ); + texel[RCOMP] = src[0]; + texel[GCOMP] = src[1]; + texel[BCOMP] = src[2]; + texel[ACOMP] = CHAN_MAX; +} + +/* Fetch texel from 1D, 2D or 3D RGB texture, returning 4 GLfloats */ +static void FETCH(f_rgb)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLchan *src = CHAN_ADDR( texImage, i, j, k, 3 ); + texel[RCOMP] = CHAN_TO_FLOAT(src[0]); + texel[GCOMP] = CHAN_TO_FLOAT(src[1]); + texel[BCOMP] = CHAN_TO_FLOAT(src[2]); + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_rgb(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLchan *rgba = (const GLchan *) texel; + GLchan *dst = CHAN_ADDR(texImage, i, j, k, 3); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[BCOMP]; +} +#endif + +/* MESA_FORMAT_ALPHA *********************************************************/ + +/* Fetch texel from 1D, 2D or 3D ALPHA texture, returning 4 GLchans */ +static void FETCH(alpha)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLchan *src = CHAN_ADDR( texImage, i, j, k, 1 ); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = 0; + texel[ACOMP] = src[0]; +} + +/* Fetch texel from 1D, 2D or 3D ALPHA texture, returning 4 GLfloats */ +static void FETCH(f_alpha)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLchan *src = CHAN_ADDR( texImage, i, j, k, 1 ); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = 0.0; + texel[ACOMP] = CHAN_TO_FLOAT(src[0]); +} + +#if DIM == 3 +static void store_texel_alpha(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLchan *rgba = (const GLchan *) texel; + GLchan *dst = CHAN_ADDR(texImage, i, j, k, 1); + dst[0] = rgba[ACOMP]; +} +#endif + +/* MESA_FORMAT_LUMINANCE *****************************************************/ + +/* Fetch texel from 1D, 2D or 3D LUMIN texture, returning 4 GLchans */ +static void FETCH(luminance)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLchan *src = CHAN_ADDR( texImage, i, j, k, 1 ); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = src[0]; + texel[ACOMP] = CHAN_MAX; +} + +/* Fetch texel from 1D, 2D or 3D LUMIN texture, returning 4 GLfloats */ +static void FETCH(f_luminance)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLchan *src = CHAN_ADDR( texImage, i, j, k, 1 ); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = CHAN_TO_FLOAT(src[0]); + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_luminance(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLchan *rgba = (const GLchan *) texel; + GLchan *dst = CHAN_ADDR(texImage, i, j, k, 1); + dst[0] = rgba[RCOMP]; +} +#endif + +/* MESA_FORMAT_LUMINANCE_ALPHA ***********************************************/ + +/* Fetch texel from 1D, 2D or 3D L_A texture, returning 4 GLchans */ +static void FETCH(luminance_alpha)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLchan *src = CHAN_ADDR( texImage, i, j, k, 2 ); + texel[RCOMP] = src[0]; + texel[GCOMP] = src[0]; + texel[BCOMP] = src[0]; + texel[ACOMP] = src[1]; +} + +/* Fetch texel from 1D, 2D or 3D L_A texture, returning 4 GLfloats */ +static void FETCH(f_luminance_alpha)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLchan *src = CHAN_ADDR( texImage, i, j, k, 2 ); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = CHAN_TO_FLOAT(src[0]); + texel[ACOMP] = CHAN_TO_FLOAT(src[1]); +} + +#if DIM == 3 +static void store_texel_luminance_alpha(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLchan *rgba = (const GLchan *) texel; + GLchan *dst = CHAN_ADDR(texImage, i, j, k, 2); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[ACOMP]; +} +#endif + +/* MESA_FORMAT_INTENSITY *****************************************************/ + +/* Fetch texel from 1D, 2D or 3D INT. texture, returning 4 GLchans */ +static void FETCH(intensity)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLchan *src = CHAN_ADDR( texImage, i, j, k, 1 ); + texel[RCOMP] = src[0]; + texel[GCOMP] = src[0]; + texel[BCOMP] = src[0]; + texel[ACOMP] = src[0]; +} + +/* Fetch texel from 1D, 2D or 3D INT. texture, returning 4 GLfloats */ +static void FETCH(f_intensity)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLchan *src = CHAN_ADDR( texImage, i, j, k, 1 ); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = + texel[ACOMP] = CHAN_TO_FLOAT(src[0]); +} + +#if DIM == 3 +static void store_texel_intensity(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLchan *rgba = (const GLchan *) texel; + GLchan *dst = CHAN_ADDR(texImage, i, j, k, 1); + dst[0] = rgba[RCOMP]; +} +#endif + + +/* MESA_FORMAT_DEPTH_COMPONENT_F32 *******************************************/ + +/* Fetch depth texel from 1D, 2D or 3D float32 DEPTH texture, + * returning 1 GLfloat. + * Note: no GLchan version of this function. + */ +static void FETCH(f_depth_component_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 ); + texel[0] = src[0]; +} + +#if DIM == 3 +static void store_texel_depth_component_f32(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *depth = (const GLfloat *) texel; + GLfloat *dst = FLOAT_ADDR(texImage, i, j, k, 1); + dst[0] = *depth; +} +#endif + + +/* MESA_FORMAT_DEPTH_COMPONENT16 *********************************************/ + +/* Fetch depth texel from 1D, 2D or 3D float32 DEPTH texture, + * returning 1 GLfloat. + * Note: no GLchan version of this function. + */ +static void FETCH(f_depth_component16)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort *src = USHORT_ADDR( texImage, i, j, k ); + texel[0] = src[0] * (1.0F / 65535.0F); +} + +#if DIM == 3 +static void store_texel_depth_component16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLushort *depth = (const GLushort *) texel; + GLushort *dst = USHORT_ADDR(texImage, i, j, k); + dst[0] = *depth; +} +#endif + + +/* MESA_FORMAT_RGBA_F32 ******************************************************/ + +/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLchans. + */ +static void FETCH(rgba_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 4 ); + UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]); + UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], src[1]); + UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], src[2]); + UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[3]); +} + +/* 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 = FLOAT_ADDR( 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 = FLOAT_ADDR(texImage, i, j, k, 1); + 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 GLchans. + */ +static void FETCH(rgba_f16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 4 ); + UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0])); + UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], _mesa_half_to_float(src[1])); + UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], _mesa_half_to_float(src[2])); + UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[3])); +} + +/* 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 = HALF_ADDR( 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 *depth = (const GLfloat *) texel; + GLhalfARB *dst = HALF_ADDR(texImage, i, j, k, 1); + dst[0] = _mesa_float_to_half(*depth); +} +#endif + +/* MESA_FORMAT_RGB_F32 *******************************************************/ + +/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture, + * returning 4 GLchans. + */ +static void FETCH(rgb_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 3 ); + UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]); + UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], src[1]); + UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], src[2]); + texel[ACOMP] = CHAN_MAX; +} + +/* 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 = FLOAT_ADDR( 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 *depth = (const GLfloat *) texel; + GLfloat *dst = FLOAT_ADDR(texImage, i, j, k, 1); + dst[0] = *depth; +} +#endif + + +/* MESA_FORAMT_RGB_F16 *******************************************************/ + +/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture, + * returning 4 GLchans. + */ +static void FETCH(rgb_f16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 3 ); + UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0])); + UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], _mesa_half_to_float(src[1])); + UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], _mesa_half_to_float(src[2])); + texel[ACOMP] = CHAN_MAX; +} + +/* 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 = HALF_ADDR( 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 *depth = (const GLfloat *) texel; + GLhalfARB *dst = HALF_ADDR(texImage, i, j, k, 1); + dst[0] = _mesa_float_to_half(*depth); +} +#endif + + +/* MESA_FORMAT_ALPHA_F32 *****************************************************/ + +/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture, + * returning 4 GLchans. + */ +static void FETCH(alpha_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 ); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = 0; + UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[0]); +} + +/* 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 = FLOAT_ADDR( 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 = FLOAT_ADDR(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 GLchans. + */ +static void FETCH(alpha_f16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 1 ); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = 0; + UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[0])); +} + +/* 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 = HALF_ADDR( 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 = HALF_ADDR(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 GLchans. + */ +static void FETCH(luminance_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 ); + UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]); + texel[GCOMP] = + texel[BCOMP] = texel[RCOMP]; + texel[ACOMP] = CHAN_MAX; +} + +/* 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 = FLOAT_ADDR( 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 = FLOAT_ADDR(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 GLchans. + */ +static void FETCH(luminance_f16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 1 ); + UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0])); + texel[GCOMP] = + texel[BCOMP] = texel[RCOMP]; + texel[ACOMP] = CHAN_MAX; +} + +/* 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 = HALF_ADDR( 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 = HALF_ADDR(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 GLchans. + */ +static void FETCH(luminance_alpha_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 2 ); + UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]); + texel[GCOMP] = + texel[BCOMP] = texel[RCOMP]; + UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[1]); +} + +/* 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 = FLOAT_ADDR( 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 = FLOAT_ADDR(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(luminance_alpha_f16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 2 ); + UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0])); + texel[GCOMP] = + texel[BCOMP] = texel[RCOMP]; + UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[1])); +} + +/* 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 = HALF_ADDR( 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 = HALF_ADDR(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 GLchans. + */ +static void FETCH(intensity_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 ); + UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]); + texel[GCOMP] = + texel[BCOMP] = + texel[ACOMP] = texel[RCOMP]; +} + +/* 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 = FLOAT_ADDR( 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 = FLOAT_ADDR(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 GLchans. + */ +static void FETCH(intensity_f16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 1 ); + UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0])); + texel[GCOMP] = + texel[BCOMP] = + texel[ACOMP] = texel[RCOMP]; +} + +/* 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 = HALF_ADDR( 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 = HALF_ADDR(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 GLchans */ +static void FETCH(rgba8888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLuint s = *UINT_ADDR( texImage, i, j, k ); + texel[RCOMP] = UBYTE_TO_CHAN( (s >> 24) ); + texel[GCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff ); + texel[BCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff ); + texel[ACOMP] = UBYTE_TO_CHAN( (s ) & 0xff ); +} + +/* 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 = *UINT_ADDR( texImage, i, j, k ); + 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 = UINT_ADDR(texImage, i, j, k); + *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(rgba8888_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLuint s = *UINT_ADDR( texImage, i, j, k ); + texel[RCOMP] = UBYTE_TO_CHAN( (s ) & 0xff ); + texel[GCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff ); + texel[BCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff ); + texel[ACOMP] = UBYTE_TO_CHAN( (s >> 24) ); +} + +/* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLfloats */ +static void FETCH(f_rgba8888_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLuint s = *UINT_ADDR( texImage, i, j, k ); + 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 = UINT_ADDR(texImage, i, j, k); + *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(argb8888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLuint s = *UINT_ADDR( texImage, i, j, k ); + texel[RCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff ); + texel[GCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff ); + texel[BCOMP] = UBYTE_TO_CHAN( (s ) & 0xff ); + texel[ACOMP] = UBYTE_TO_CHAN( (s >> 24) ); +} + +/* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLfloats */ +static void FETCH(f_argb8888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLuint s = *UINT_ADDR( texImage, i, j, k ); + 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 = UINT_ADDR(texImage, i, j, k); + *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 GLchans */ +static void FETCH(argb8888_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLuint s = *UINT_ADDR( texImage, i, j, k ); + texel[RCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff ); + texel[GCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff ); + texel[BCOMP] = UBYTE_TO_CHAN( (s >> 24) ); + texel[ACOMP] = UBYTE_TO_CHAN( (s ) & 0xff ); +} + +/* 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 = *UINT_ADDR( texImage, i, j, k ); + 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 = UINT_ADDR(texImage, i, j, k); + *dst = PACK_COLOR_8888(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); +} +#endif + + +/* MESA_FORMAT_RGB888 ********************************************************/ + +/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */ +static void FETCH(rgb888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 3 ); + texel[RCOMP] = UBYTE_TO_CHAN( src[2] ); + texel[GCOMP] = UBYTE_TO_CHAN( src[1] ); + texel[BCOMP] = UBYTE_TO_CHAN( src[0] ); + texel[ACOMP] = CHAN_MAX; +} + +/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLfloats */ +static void FETCH(f_rgb888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLubyte *src = UBYTE_ADDR( 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 = UBYTE_ADDR(texImage, i, j, k, 3); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[BCOMP]; +} +#endif + + +/* MESA_FORMAT_BGR888 ********************************************************/ + +/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */ +static void FETCH(bgr888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 3 ); + texel[RCOMP] = UBYTE_TO_CHAN( src[0] ); + texel[GCOMP] = UBYTE_TO_CHAN( src[1] ); + texel[BCOMP] = UBYTE_TO_CHAN( src[2] ); + texel[ACOMP] = CHAN_MAX; +} + +/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLfloats */ +static void FETCH(f_bgr888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLubyte *src = UBYTE_ADDR( 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 = UBYTE_ADDR(texImage, i, j, k, 3); + dst[0] = rgba[BCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[RCOMP]; +} +#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(rgb565)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLushort *src = USHORT_ADDR( texImage, i, j, k ); + const GLushort s = *src; + texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) ); + texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) | ((s >> 9) & 0x3) ); + texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); + texel[ACOMP] = CHAN_MAX; +} + +/* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLfloats */ +static void FETCH(f_rgb565)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort *src = USHORT_ADDR( texImage, i, j, k ); + const GLushort s = *src; + texel[RCOMP] = ((s >> 8) & 0xf8) * (1.0F / 248.0F); + texel[GCOMP] = ((s >> 3) & 0xfc) * (1.0F / 252.0F); + texel[BCOMP] = ((s << 3) & 0xf8) * (1.0F / 248.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 = USHORT_ADDR(texImage, i, j, k); + *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(rgb565_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLushort *src = USHORT_ADDR( texImage, i, j, k ); + const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */ + texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) ); + texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) | ((s >> 9) & 0x3) ); + texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); + texel[ACOMP] = CHAN_MAX; +} + +/* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLfloats */ +static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort *src = USHORT_ADDR( texImage, i, j, k ); + const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */ + texel[RCOMP] = ((s >> 8) & 0xf8) * (1.0F / 248.0F); + texel[GCOMP] = ((s >> 3) & 0xfc) * (1.0F / 252.0F); + texel[BCOMP] = ((s << 3) & 0xf8) * (1.0F / 248.0F); + 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 = USHORT_ADDR(texImage, i, j, k); + *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(argb4444)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLushort *src = USHORT_ADDR( texImage, i, j, k ); + const GLushort s = *src; + texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) | ((s >> 4) & 0xf0) ); + texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) | ((s ) & 0xf0) ); + texel[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) | ((s << 4) & 0xf0) ); + texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) | ((s >> 8) & 0xf0) ); +} + +/* Fetch texel from 1D, 2D or 3D argb4444 texture, return 4 GLfloats */ +static void FETCH(f_argb4444)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort *src = USHORT_ADDR( texImage, i, j, k ); + 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 = USHORT_ADDR(texImage, i, j, k); + *dst = PACK_COLOR_4444(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]); +} +#endif + + +/* MESA_FORMAT_ARGB4444_REV **************************************************/ + +/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */ +static void FETCH(argb4444_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLushort s = *USHORT_ADDR( texImage, i, j, k ); + texel[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) | ((s << 4) & 0xf0) ); + texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) | ((s >> 8) & 0xf0) ); + texel[BCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) | ((s >> 4) & 0xf0) ); + texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) | ((s ) & 0xf0) ); +} + +/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLfloats */ +static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort s = *USHORT_ADDR( texImage, i, j, k ); + 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 = USHORT_ADDR(texImage, i, j, k); + *dst = PACK_COLOR_4444(rgba[ACOMP], rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]); +} +#endif + + +/* MESA_FORMAT_ARGB1555 ******************************************************/ + +/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */ +static void FETCH(argb1555)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLushort *src = USHORT_ADDR( texImage, i, j, k ); + const GLushort s = *src; + texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 7) & 0xf8) | ((s >> 12) & 0x7) ); + texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 2) & 0xf8) | ((s >> 7) & 0x7) ); + texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); + texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 ); +} + +/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLfloats */ +static void FETCH(f_argb1555)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort *src = USHORT_ADDR( texImage, i, j, k ); + 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 ) & 0x1f) * (1.0F / 31.0F); + texel[ACOMP] = ((s >> 15) & 0x01); +} + +#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 = USHORT_ADDR(texImage, i, j, k); + *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(argb1555_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLushort *src = USHORT_ADDR( texImage, i, j, k ); + const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */ + texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 7) & 0xf8) | ((s >> 12) & 0x7) ); + texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 2) & 0xf8) | ((s >> 7) & 0x7) ); + texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); + texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 ); +} + +/* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLfloats */ +static void FETCH(f_argb1555_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort *src = USHORT_ADDR( texImage, i, j, k ); + const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */ + texel[RCOMP] = ((s >> 10) & 0x1f) * (1.0F / 31.0F); + texel[GCOMP] = ((s >> 5) & 0x1f) * (1.0F / 31.0F); + texel[BCOMP] = ((s ) & 0x1f) * (1.0F / 31.0F); + texel[ACOMP] = ((s >> 15) & 0x01); +} + +#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 = USHORT_ADDR(texImage, i, j, k); + *dst = PACK_COLOR_1555_REV(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); +} +#endif + + +/* MESA_FORMAT_AL88 **********************************************************/ + +/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */ +static void FETCH(al88)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLushort s = *USHORT_ADDR( texImage, i, j, k ); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = UBYTE_TO_CHAN( s & 0xff ); + texel[ACOMP] = UBYTE_TO_CHAN( s >> 8 ); +} + +/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLfloats */ +static void FETCH(f_al88)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort s = *USHORT_ADDR( texImage, i, j, k ); + 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 = USHORT_ADDR(texImage, i, j, k); + *dst = PACK_COLOR_88(rgba[ACOMP], rgba[RCOMP]); +} +#endif + + +/* MESA_FORMAT_AL88_REV ******************************************************/ + +/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */ +static void FETCH(al88_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLushort s = *USHORT_ADDR( texImage, i, j, k ); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = UBYTE_TO_CHAN( s >> 8 ); + texel[ACOMP] = UBYTE_TO_CHAN( s & 0xff ); +} + +/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLfloats */ +static void FETCH(f_al88_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort s = *USHORT_ADDR( texImage, i, j, k ); + 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 = USHORT_ADDR(texImage, i, j, k); + *dst = PACK_COLOR_88(rgba[RCOMP], rgba[ACOMP]); +} +#endif + + +/* MESA_FORMAT_RGB332 ********************************************************/ + +/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */ +static void FETCH(rgb332)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + static const GLubyte lut2to8[4] = {0, 85, 170, 255}; + static const GLubyte lut3to8[8] = {0, 36, 73, 109, 146, 182, 219, 255}; + const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); + const GLubyte s = *src; + texel[RCOMP] = UBYTE_TO_CHAN( lut3to8[(s >> 5) & 0x7] ); + texel[GCOMP] = UBYTE_TO_CHAN( lut3to8[(s >> 2) & 0x7] ); + texel[BCOMP] = UBYTE_TO_CHAN( lut2to8[(s ) & 0x3] ); + texel[ACOMP] = CHAN_MAX; +} + +/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLfloats */ +static void FETCH(f_rgb332)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); + const GLubyte s = *src; + texel[RCOMP] = ((s ) & 0xe0) * (1.0F / 224.0F); + texel[GCOMP] = ((s << 3) & 0xe0) * (1.0F / 224.0F); + texel[BCOMP] = ((s << 6) & 0xc0) * (1.0F / 192.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 = UBYTE_ADDR(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(a8)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = 0; + texel[ACOMP] = UBYTE_TO_CHAN( src[0] ); +} + +/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLfloats */ +static void FETCH(f_a8)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = 0.0; + 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 = UBYTE_ADDR(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(l8)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = UBYTE_TO_CHAN( src[0] ); + texel[ACOMP] = CHAN_MAX; +} + +/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLfloats */ +static void FETCH(f_l8)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLubyte *src = UBYTE_ADDR( 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 = UBYTE_ADDR(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(i8)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = + texel[ACOMP] = UBYTE_TO_CHAN( src[0] ); +} + +/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLfloats */ +static void FETCH(f_i8)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLubyte *src = UBYTE_ADDR( 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 = UBYTE_ADDR(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(ci8)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); + const struct gl_color_table *palette; + const GLchan *table; + 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 */ + ASSERT(palette->Type != GL_FLOAT); + table = (const GLchan *) palette->Table; + + /* Mask the index against size of palette to avoid going out of bounds */ + index = (*src) & (palette->Size - 1); + + switch (palette->Format) { + case GL_ALPHA: + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = 0; + texel[ACOMP] = table[index]; + return; + case GL_LUMINANCE: + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = table[index]; + texel[ACOMP] = CHAN_MAX; + break; + case GL_INTENSITY: + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = + texel[ACOMP] = table[index]; + return; + case GL_LUMINANCE_ALPHA: + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = table[index * 2 + 0]; + texel[ACOMP] = table[index * 2 + 1]; + return; + case GL_RGB: + texel[RCOMP] = table[index * 3 + 0]; + texel[GCOMP] = table[index * 3 + 1]; + texel[BCOMP] = table[index * 3 + 2]; + texel[ACOMP] = CHAN_MAX; + return; + 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]; + return; + default: + _mesa_problem(ctx, "Bad palette format in palette_sample"); + } +} + + +/* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a + * color table, and return 4 GLfloats. + */ +static void FETCH(f_ci8)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + GLchan rgba[4]; + /* Sample as GLchan */ + FETCH(ci8)(texImage, i, j, k, rgba); + /* and return as floats */ + 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 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 = UBYTE_ADDR(texImage, i, j, k, 1); + *dst = *index; +} +#endif + + +/* MESA_FORMAT_YCBCR *********************************************************/ + +/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLchans */ +/* We convert YCbCr to RGB here */ +/* XXX this may break if GLchan != GLubyte */ +static void FETCH(ycbcr)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLushort *src0 = USHORT_ADDR( texImage, (i & ~1), j, k ); /* 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 */ + GLint r, g, b; + if (i & 1) { + /* odd pixel: use y1,cr,cb */ + r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128)); + g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128)); + } + else { + /* even pixel: use y0,cr,cb */ + r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128)); + g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128)); + } + texel[RCOMP] = CLAMP(r, 0, CHAN_MAX); + texel[GCOMP] = CLAMP(g, 0, CHAN_MAX); + texel[BCOMP] = CLAMP(b, 0, CHAN_MAX); + texel[ACOMP] = CHAN_MAX; +} + +/* 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 = USHORT_ADDR( texImage, (i & ~1), j, k ); /* 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 */ + GLfloat r, g, b; + if (i & 1) { + /* odd pixel: use y1,cr,cb */ + r = (1.164 * (y1-16) + 1.596 * (cr-128)); + g = (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (1.164 * (y1-16) + 2.018 * (cb-128)); + } + else { + /* even pixel: use y0,cr,cb */ + r = (1.164 * (y0-16) + 1.596 * (cr-128)); + g = (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (1.164 * (y0-16) + 2.018 * (cb-128)); + } + /* XXX remove / 255 here by tweaking arithmetic above */ + r /= 255.0; + g /= 255.0; + b /= 255.0; + /* XXX should we really clamp??? */ + texel[RCOMP] = CLAMP(r, 0.0, 1.0); + texel[GCOMP] = CLAMP(g, 0.0, 1.0); + texel[BCOMP] = CLAMP(b, 0.0, 1.0); + 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) +{ + /* XXX to do */ +} +#endif + + +/* MESA_FORMAT_YCBCR_REV *****************************************************/ + +/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLchans */ +/* We convert YCbCr to RGB here */ +/* XXX this may break if GLchan != GLubyte */ +static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) +{ + const GLushort *src0 = USHORT_ADDR( texImage, (i & ~1), j, k ); /* 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 */ + GLint r, g, b; + if (i & 1) { + /* odd pixel: use y1,cr,cb */ + r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128)); + g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128)); + } + else { + /* even pixel: use y0,cr,cb */ + r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128)); + g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128)); + } + texel[RCOMP] = CLAMP(r, 0, CHAN_MAX); + texel[GCOMP] = CLAMP(g, 0, CHAN_MAX); + texel[BCOMP] = CLAMP(b, 0, CHAN_MAX); + texel[ACOMP] = CHAN_MAX; +} + +/* 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 = USHORT_ADDR( texImage, (i & ~1), j, k ); /* 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 */ + GLfloat r, g, b; + if (i & 1) { + /* odd pixel: use y1,cr,cb */ + r = (1.164 * (y1-16) + 1.596 * (cr-128)); + g = (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (1.164 * (y1-16) + 2.018 * (cb-128)); + } + else { + /* even pixel: use y0,cr,cb */ + r = (1.164 * (y0-16) + 1.596 * (cr-128)); + g = (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (1.164 * (y0-16) + 2.018 * (cb-128)); + } + /* XXX remove / 255 here by tweaking arithmetic above */ + r /= 255.0; + g /= 255.0; + b /= 255.0; + /* XXX should we really clamp??? */ + texel[RCOMP] = CLAMP(r, 0.0, 1.0); + texel[GCOMP] = CLAMP(g, 0.0, 1.0); + texel[BCOMP] = CLAMP(b, 0.0, 1.0); + 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) +{ + /* XXX to do */ +} +#endif + + + +#undef CHAN_ADDR +#undef UBYTE_ADDR +#undef USHORT_ADDR +#undef UINT_ADDR +#undef FLOAT_ADDR +#undef HALF_ADDR +#undef FETCH +#undef DIM diff --git a/reactos/dll/mesa32/src/main/teximage.c b/reactos/dll/mesa32/src/main/teximage.c new file mode 100644 index 00000000000..d4d023acda3 --- /dev/null +++ b/reactos/dll/mesa32/src/main/teximage.c @@ -0,0 +1,3330 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * 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. + */ + + +/** + * \file teximage.c + * Texture images manipulation functions. + * + * \note Mesa's native texture data type is GLchan. Native formats are + * GL_ALPHA, GL_LUMINANCE, GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, GL_RGBA, and + * GL_COLOR_INDEX. + * + * \note Device drivers are free to implement any internal format they want. + */ + + +#include "glheader.h" +#include "bufferobj.h" +#include "context.h" +#include "convolve.h" +#include "image.h" +#include "imports.h" +#include "macros.h" +#include "state.h" +#include "texcompress.h" +#include "texformat.h" +#include "teximage.h" +#include "texstate.h" +#include "texstore.h" +#include "mtypes.h" + + +/** + * 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); +} + + + + +#if 0 +static void PrintTexture(GLcontext *ctx, const struct gl_texture_image *img) +{ +#if CHAN_TYPE == GL_FLOAT + _mesa_problem(NULL, "PrintTexture doesn't support float channels"); +#else + GLuint i, j, c; + const GLchan *data = (const GLchan *) img->Data; + + if (!data) { + _mesa_printf("No texture data\n"); + return; + } + + switch (img->Format) { + case GL_ALPHA: + case GL_LUMINANCE: + case GL_INTENSITY: + case GL_COLOR_INDEX: + c = 1; + break; + case GL_LUMINANCE_ALPHA: + c = 2; + break; + case GL_RGB: + c = 3; + break; + case GL_RGBA: + c = 4; + break; + default: + _mesa_problem(NULL, "error in PrintTexture\n"); + return; + } + + for (i = 0; i < img->Height; i++) { + for (j = 0; j < img->Width; j++) { + if (c==1) + _mesa_printf("%02x ", data[0]); + else if (c==2) + _mesa_printf("%02x%02x ", data[0], data[1]); + else if (c==3) + _mesa_printf("%02x%02x%02x ", data[0], data[1], data[2]); + else if (c==4) + _mesa_printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); + data += (img->RowStride - img->Width) * c; + } + _mesa_printf("\n"); + } +#endif +} +#endif + + +/* + * 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. + */ +GLint +_mesa_base_tex_format( GLcontext *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.SGIX_depth_texture || + ctx->Extensions.ARB_depth_texture) { + switch (internalFormat) { + case GL_DEPTH_COMPONENT: + case GL_DEPTH_COMPONENT16_SGIX: + case GL_DEPTH_COMPONENT24_SGIX: + case GL_DEPTH_COMPONENT32_SGIX: + return GL_DEPTH_COMPONENT; + default: + ; /* fallthrough */ + } + } + + if (ctx->Extensions.ARB_texture_compression) { + 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 */ + } + } + + return -1; /* error */ +} + + +/** + * Test if the given image format is a color/RGBA format (i.e., not color + * index, depth, stencil, etc). + * \param format the image format value (may by an internal texture format) + * \return GL_TRUE if its a color/RGBA format, GL_FALSE otherwise. + */ +static GLboolean +is_color_format(GLenum format) +{ + switch (format) { + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + case 1: + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + 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: + case GL_INTENSITY: + case GL_INTENSITY4: + case GL_INTENSITY8: + case GL_INTENSITY12: + case GL_INTENSITY16: + case 3: + case GL_RGB: + case GL_BGR: + case GL_R3_G3_B2: + case GL_RGB4: + case GL_RGB5: + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + case 4: + case GL_ABGR_EXT: + case GL_RGBA: + case GL_BGRA: + case GL_RGBA2: + case GL_RGBA4: + case GL_RGB5_A1: + case GL_RGBA8: + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + /* float texture formats */ + case GL_ALPHA16F_ARB: + case GL_ALPHA32F_ARB: + case GL_LUMINANCE16F_ARB: + case GL_LUMINANCE32F_ARB: + case GL_LUMINANCE_ALPHA16F_ARB: + case GL_LUMINANCE_ALPHA32F_ARB: + case GL_INTENSITY16F_ARB: + case GL_INTENSITY32F_ARB: + case GL_RGB16F_ARB: + case GL_RGB32F_ARB: + case GL_RGBA16F_ARB: + case GL_RGBA32F_ARB: + /* compressed formats */ + case GL_COMPRESSED_ALPHA: + case GL_COMPRESSED_LUMINANCE: + case GL_COMPRESSED_LUMINANCE_ALPHA: + case GL_COMPRESSED_INTENSITY: + case GL_COMPRESSED_RGB: + case GL_COMPRESSED_RGBA: + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: + return GL_TRUE; + case GL_YCBCR_MESA: /* not considered to be RGB */ + default: + return GL_FALSE; + } +} + + +/** + * Test if the given image format is a color index format. + */ +static GLboolean +is_index_format(GLenum format) +{ + switch (format) { + 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_TRUE; + default: + return GL_FALSE; + } +} + + +/** + * Test if the given image format is a depth component format. + */ +static GLboolean +is_depth_format(GLenum format) +{ + switch (format) { + case GL_DEPTH_COMPONENT16_ARB: + case GL_DEPTH_COMPONENT24_ARB: + case GL_DEPTH_COMPONENT32_ARB: + case GL_DEPTH_COMPONENT: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + +/** + * Test if the given image format is a YCbCr format. + */ +static GLboolean +is_ycbcr_format(GLenum format) +{ + switch (format) { + case GL_YCBCR_MESA: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + +/** + * Test if it is a supported compressed format. + * + * \param internalFormat the internal format token provided by the user. + * + * \ret GL_TRUE if \p internalFormat is a supported compressed format, or + * GL_FALSE otherwise. + * + * Currently only GL_COMPRESSED_RGB_FXT1_3DFX and GL_COMPRESSED_RGBA_FXT1_3DFX + * are supported. + */ +static GLboolean +is_compressed_format(GLcontext *ctx, GLenum internalFormat) +{ + (void) ctx; + switch (internalFormat) { + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + +/** + * 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) +{ + ASSERT(tObj); + ASSERT(texImage); + switch (target) { + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + tObj->Image[0][level] = texImage; + break; + 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: + { + GLuint face = ((GLuint) target - + (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X); + tObj->Image[face][level] = texImage; + } + break; + case GL_TEXTURE_RECTANGLE_NV: + ASSERT(level == 0); + tObj->Image[0][level] = texImage; + break; + default: + _mesa_problem(NULL, "bad target in _mesa_set_tex_image()"); + return; + } + /* 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( GLcontext *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(GLcontext *ctx, + struct gl_texture_image *texImage) +{ + 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( GLcontext *ctx, struct gl_texture_image *texImage ) +{ + if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + ASSERT(texImage->Data == NULL); + 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. + */ +static GLboolean +is_proxy_target(GLenum target) +{ + 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); +} + + +/** + * 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(GLcontext *ctx, const struct gl_texture_unit *texUnit, + GLenum target) +{ + switch (target) { + case GL_TEXTURE_1D: + return texUnit->Current1D; + case GL_PROXY_TEXTURE_1D: + return ctx->Texture.Proxy1D; + case GL_TEXTURE_2D: + return texUnit->Current2D; + case GL_PROXY_TEXTURE_2D: + return ctx->Texture.Proxy2D; + case GL_TEXTURE_3D: + return texUnit->Current3D; + case GL_PROXY_TEXTURE_3D: + return ctx->Texture.Proxy3D; + 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->CurrentCubeMap : NULL; + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + return ctx->Extensions.ARB_texture_cube_map + ? ctx->Texture.ProxyCubeMap : NULL; + case GL_TEXTURE_RECTANGLE_NV: + return ctx->Extensions.NV_texture_rectangle + ? texUnit->CurrentRect : NULL; + case GL_PROXY_TEXTURE_RECTANGLE_NV: + return ctx->Extensions.NV_texture_rectangle + ? ctx->Texture.ProxyRect : NULL; + default: + _mesa_problem(NULL, "bad target in _mesa_select_tex_object()"); + return NULL; + } +} + + +/** + * Get the texture image struct which corresponds to target and level + * of the given texture unit. + * + * \param ctx GL context. + * \param texUnit texture unit. + * \param target texture target. + * \param level image level. + * + * \return pointer to the texture image structure on success, or NULL on failure. + * + * \sa gl_texture_unit. + */ +struct gl_texture_image * +_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, + GLenum target, GLint level) +{ + ASSERT(texUnit); + ASSERT(level < MAX_TEXTURE_LEVELS); + switch (target) { + case GL_TEXTURE_1D: + return texUnit->Current1D->Image[0][level]; + case GL_PROXY_TEXTURE_1D: + return ctx->Texture.Proxy1D->Image[0][level]; + case GL_TEXTURE_2D: + return texUnit->Current2D->Image[0][level]; + case GL_PROXY_TEXTURE_2D: + return ctx->Texture.Proxy2D->Image[0][level]; + case GL_TEXTURE_3D: + return texUnit->Current3D->Image[0][level]; + case GL_PROXY_TEXTURE_3D: + return ctx->Texture.Proxy3D->Image[0][level]; + 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: + if (ctx->Extensions.ARB_texture_cube_map) { + GLuint face = ((GLuint) target - + (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X); + return texUnit->CurrentCubeMap->Image[face][level]; + } + else + return NULL; + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.ARB_texture_cube_map) + return ctx->Texture.ProxyCubeMap->Image[0][level]; + else + return NULL; + case GL_TEXTURE_RECTANGLE_NV: + if (ctx->Extensions.NV_texture_rectangle) { + ASSERT(level == 0); + return texUnit->CurrentRect->Image[0][level]; + } + else { + return NULL; + } + case GL_PROXY_TEXTURE_RECTANGLE_NV: + if (ctx->Extensions.NV_texture_rectangle) { + ASSERT(level == 0); + return ctx->Texture.ProxyRect->Image[0][level]; + } + else { + return NULL; + } + default: + _mesa_problem(ctx, "bad target in _mesa_select_tex_image()"); + return NULL; + } +} + + +/** + * 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(GLcontext *ctx, const struct gl_texture_unit *texUnit, + GLenum target, GLint level) +{ + struct gl_texture_image *texImage; + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + if (!texImage) { + struct gl_texture_object *texObj; + texImage = ctx->Driver.NewTextureImage(ctx); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture image allocation"); + return NULL; + } + texObj = _mesa_select_tex_object(ctx, texUnit, target); + ASSERT(texObj); + _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(GLcontext *ctx, GLenum target, GLint level) +{ + struct gl_texture_image *texImage; + + if (level < 0 ) + return NULL; + + switch (target) { + case GL_PROXY_TEXTURE_1D: + if (level >= ctx->Const.MaxTextureLevels) + return NULL; + texImage = ctx->Texture.Proxy1D->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.Proxy1D->Image[0][level] = texImage; + /* Set the 'back' pointer */ + texImage->TexObject = ctx->Texture.Proxy1D; + } + return texImage; + case GL_PROXY_TEXTURE_2D: + if (level >= ctx->Const.MaxTextureLevels) + return NULL; + texImage = ctx->Texture.Proxy2D->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.Proxy2D->Image[0][level] = texImage; + /* Set the 'back' pointer */ + texImage->TexObject = ctx->Texture.Proxy2D; + } + return texImage; + case GL_PROXY_TEXTURE_3D: + if (level >= ctx->Const.Max3DTextureLevels) + return NULL; + texImage = ctx->Texture.Proxy3D->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.Proxy3D->Image[0][level] = texImage; + /* Set the 'back' pointer */ + texImage->TexObject = ctx->Texture.Proxy3D; + } + return texImage; + case GL_PROXY_TEXTURE_CUBE_MAP: + if (level >= ctx->Const.MaxCubeTextureLevels) + return NULL; + texImage = ctx->Texture.ProxyCubeMap->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.ProxyCubeMap->Image[0][level] = texImage; + /* Set the 'back' pointer */ + texImage->TexObject = ctx->Texture.ProxyCubeMap; + } + return texImage; + case GL_PROXY_TEXTURE_RECTANGLE_NV: + if (level > 0) + return NULL; + texImage = ctx->Texture.ProxyRect->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.ProxyRect->Image[0][level] = texImage; + /* Set the 'back' pointer */ + texImage->TexObject = ctx->Texture.ProxyRect; + } + return texImage; + default: + return NULL; + } +} + + +/** + * 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(GLcontext *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->Const.MaxCubeTextureLevels; + case GL_TEXTURE_RECTANGLE_NV: + case GL_PROXY_TEXTURE_RECTANGLE_NV: + return 1; + default: + return 0; /* bad target */ + } +} + + + +#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->Format = 0; + img->IntFormat = 0; + img->Border = 0; + img->Width = 0; + img->Height = 0; + img->Depth = 0; + img->RowStride = 0; + img->Width2 = 0; + img->Height2 = 0; + img->Depth2 = 0; + img->WidthLog2 = 0; + img->HeightLog2 = 0; + img->DepthLog2 = 0; + img->Data = NULL; + img->TexFormat = &_mesa_null_texformat; + img->FetchTexelc = NULL; + img->FetchTexelf = NULL; + img->IsCompressed = 0; + img->CompressedSize = 0; +} + + +/** + * Initialize basic fields of the gl_texture_image struct. + * + * \param ctx GL context. + * \param target texture target. + * \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. + * + * Fills in the fields of \p img with the given information. + * Note: width, height and depth include the border. + */ +void +_mesa_init_teximage_fields(GLcontext *ctx, GLenum target, + struct gl_texture_image *img, + GLsizei width, GLsizei height, GLsizei depth, + GLint border, GLenum internalFormat) +{ + ASSERT(img); + img->Format = _mesa_base_tex_format( ctx, internalFormat ); + ASSERT(img->Format > 0); + img->IntFormat = internalFormat; + img->Border = border; + img->Width = width; + img->Height = height; + img->Depth = depth; + img->RowStride = width; + img->WidthLog2 = logbase2(width - 2 * border); + if (height == 1) /* 1-D texture */ + img->HeightLog2 = 0; + else + img->HeightLog2 = logbase2(height - 2 * border); + if (depth == 1) /* 2-D texture */ + img->DepthLog2 = 0; + else + img->DepthLog2 = logbase2(depth - 2 * border); + img->Width2 = width - 2 * border; /*1 << img->WidthLog2;*/ + img->Height2 = height - 2 * border; /*1 << img->HeightLog2;*/ + img->Depth2 = depth - 2 * border; /*1 << img->DepthLog2;*/ + img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2); + img->IsCompressed = is_compressed_format(ctx, internalFormat); + if (img->IsCompressed) + img->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, width, + height, depth, internalFormat); + else + img->CompressedSize = 0; + + if ((width == 1 || _mesa_bitcount(width - 2 * border) == 1) && + (height == 1 || _mesa_bitcount(height - 2 * border) == 1) && + (depth == 1 || _mesa_bitcount(depth - 2 * border) == 1)) + img->_IsPowerOfTwo = GL_TRUE; + else + img->_IsPowerOfTwo = GL_FALSE; + + /* 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; + } +} + + +/** + * 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). + * + * \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(GLcontext *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 || + (!ctx->Extensions.ARB_texture_non_power_of_two && + _mesa_bitcount(width - 2 * border) != 1) || + level >= ctx->Const.MaxTextureLevels) { + /* bad width or level */ + return GL_FALSE; + } + return GL_TRUE; + case GL_PROXY_TEXTURE_2D: + maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); + if (width < 2 * border || width > 2 + maxSize || + (!ctx->Extensions.ARB_texture_non_power_of_two && + _mesa_bitcount(width - 2 * border) != 1) || + height < 2 * border || height > 2 + maxSize || + (!ctx->Extensions.ARB_texture_non_power_of_two && + _mesa_bitcount(height - 2 * border) != 1) || + level >= ctx->Const.MaxTextureLevels) { + /* bad width or height or level */ + return GL_FALSE; + } + return GL_TRUE; + case GL_PROXY_TEXTURE_3D: + maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1); + if (width < 2 * border || width > 2 + maxSize || + (!ctx->Extensions.ARB_texture_non_power_of_two && + _mesa_bitcount(width - 2 * border) != 1) || + height < 2 * border || height > 2 + maxSize || + (!ctx->Extensions.ARB_texture_non_power_of_two && + _mesa_bitcount(height - 2 * border) != 1) || + depth < 2 * border || depth > 2 + maxSize || + (!ctx->Extensions.ARB_texture_non_power_of_two && + _mesa_bitcount(depth - 2 * border) != 1) || + level >= ctx->Const.Max3DTextureLevels) { + /* bad width or height or depth or level */ + return GL_FALSE; + } + return GL_TRUE; + case GL_PROXY_TEXTURE_RECTANGLE_NV: + if (width < 1 || width > ctx->Const.MaxTextureRectSize || + height < 1 || height > ctx->Const.MaxTextureRectSize || + level != 0) { + /* bad width or height or level */ + 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 || + (!ctx->Extensions.ARB_texture_non_power_of_two && + _mesa_bitcount(width - 2 * border) != 1) || + height < 2 * border || height > 2 + maxSize || + (!ctx->Extensions.ARB_texture_non_power_of_two && + _mesa_bitcount(height - 2 * border) != 1) || + level >= ctx->Const.MaxCubeTextureLevels) { + /* bad width or height */ + return GL_FALSE; + } + return GL_TRUE; + default: + _mesa_problem(ctx, "Invalid target in _mesa_test_proxy_teximage"); + return GL_FALSE; + } +} + + +/** + * Test the glTexImage[123]D() parameters for errors. + * + * \param ctx GL context. + * \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 dimensions texture image dimensions (must be 1, 2 or 3). + * \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 + * __GLcontextRec::Const and the supported extensions, and according to the + * OpenGL specification. + */ +static GLboolean +texture_error_check( GLcontext *ctx, GLenum target, + GLint level, GLint internalFormat, + GLenum format, GLenum type, + GLuint dimensions, + GLint width, GLint height, + GLint depth, GLint border ) +{ + const GLboolean isProxy = is_proxy_target(target); + GLboolean sizeOK; + 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; + } + + /* Check target and call ctx->Driver.TestProxyTexImage() to check the + * level, width, height and depth. + */ + if (dimensions == 1) { + if (target == GL_PROXY_TEXTURE_1D || target == GL_TEXTURE_1D) { + sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_1D, + level, internalFormat, + format, type, + width, 1, 1, border); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" ); + return GL_TRUE; + } + } + else if (dimensions == 2) { + if (target == GL_PROXY_TEXTURE_2D || target == GL_TEXTURE_2D) { + sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_2D, + level, internalFormat, + format, type, + width, height, 1, border); + } + else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB || + (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); + return GL_TRUE; + } + sizeOK = (width == height) && + ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_CUBE_MAP_ARB, + level, internalFormat, format, type, + width, height, 1, border); + } + else if (target == GL_PROXY_TEXTURE_RECTANGLE_NV || + target == GL_TEXTURE_RECTANGLE_NV) { + if (!ctx->Extensions.NV_texture_rectangle) { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); + return GL_TRUE; + } + sizeOK = ctx->Driver.TestProxyTexImage(ctx, + GL_PROXY_TEXTURE_RECTANGLE_NV, + level, internalFormat, + format, type, + width, height, 1, border); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); + return GL_TRUE; + } + } + else if (dimensions == 3) { + if (target == GL_PROXY_TEXTURE_3D || target == GL_TEXTURE_3D) { + sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_3D, + level, internalFormat, + format, type, + width, height, depth, border); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" ); + return GL_TRUE; + } + } + else { + _mesa_problem( ctx, "bad dims in texture_error_check" ); + return GL_TRUE; + } + + 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=0x%x)", + dimensions, internalFormat); + } + return GL_TRUE; + } + + /* Check incoming image format and type */ + if (!_mesa_is_legal_format_and_type(ctx, format, type)) { + /* Yes, generate GL_INVALID_OPERATION, not GL_INVALID_ENUM, if there + * is a type/format mismatch. See 1.2 spec page 94, sec 3.6.4. + */ + if (!isProxy) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexImage%dD(format or type)", dimensions); + } + return GL_TRUE; + } + + /* make sure internal format and format basically agree */ + colorFormat = is_color_format(format); + indexFormat = is_index_format(format); + if ((is_color_format(internalFormat) && !colorFormat && !indexFormat) || + (is_index_format(internalFormat) && !indexFormat) || + (is_depth_format(internalFormat) != is_depth_format(format)) || + (is_ycbcr_format(internalFormat) != is_ycbcr_format(format))) { + if (!isProxy) + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexImage(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_sprintf(message, + "glTexImage%d(format/type YCBCR mismatch", dimensions); + _mesa_error(ctx, GL_INVALID_ENUM, 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_sprintf(message, + "glTexImage%d(format=GL_YCBCR_MESA and border=%d)", + dimensions, border); + _mesa_error(ctx, GL_INVALID_VALUE, message); + } + return GL_TRUE; + } + } + + /* additional checks for depth textures */ + if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT) { + /* Only 1D and 2D textures supported */ + if (target != GL_TEXTURE_1D && + target != GL_PROXY_TEXTURE_1D && + target != GL_TEXTURE_2D && + target != GL_PROXY_TEXTURE_2D) { + if (!isProxy) + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexImage(target/internalFormat)"); + return GL_TRUE; + } + } + + /* additional checks for compressed textures */ + if (is_compressed_format(ctx, internalFormat)) { + if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) { + /* OK */ + } + else if (ctx->Extensions.ARB_texture_cube_map && + (target == GL_PROXY_TEXTURE_CUBE_MAP || + (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) { + /* OK */ + } + else { + if (!isProxy) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexImage%d(target)", dimensions); + return GL_TRUE; + } + } + if (border != 0) { + if (!isProxy) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexImage%D(border!=0)", 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 + * __GLcontextRec::Const and the supported extensions, and according to the + * OpenGL specification. + */ +static GLboolean +subtexture_error_check( GLcontext *ctx, GLuint dimensions, + GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint width, GLint height, GLint depth, + GLenum format, GLenum type ) +{ + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_image *destTex; + + /* Check target */ + if (dimensions == 1) { + if (target != GL_TEXTURE_1D) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage1D(target)" ); + return GL_TRUE; + } + } + else if (dimensions == 2) { + if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <=GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); + return GL_TRUE; + } + } + else if (ctx->Extensions.NV_texture_rectangle && + target == GL_TEXTURE_RECTANGLE_NV) { + if (!ctx->Extensions.NV_texture_rectangle) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); + return GL_TRUE; + } + } + else if (target != GL_TEXTURE_2D) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); + return GL_TRUE; + } + } + else if (dimensions == 3) { + if (target != GL_TEXTURE_3D) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage3D(target)" ); + return GL_TRUE; + } + } + else { + _mesa_problem( ctx, "invalid dims in texture_error_check" ); + return GL_TRUE; + } + + /* Basic level check */ + if (level < 0 || level >= MAX_TEXTURE_LEVELS) { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage2D(level=%d)", level); + return GL_TRUE; + } + + 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; + } + + destTex = _mesa_select_tex_image(ctx, texUnit, target, level); + + 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_legal_format_and_type(ctx, format, type)) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexSubImage%dD(format or type)", dimensions); + return GL_TRUE; + } + + if (destTex->IsCompressed) { + const struct gl_texture_unit *texUnit; + const struct gl_texture_image *texImage; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + + if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) { + /* OK */ + } + else if (ctx->Extensions.ARB_texture_cube_map && + (target == GL_PROXY_TEXTURE_CUBE_MAP || + (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) { + /* OK */ + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexSubImage%D(target)", dimensions); + return GL_TRUE; + } + /* offset must be multiple of 4 */ + if ((xoffset & 3) || (yoffset & 3)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexSubImage%D(xoffset or yoffset)", dimensions); + return GL_TRUE; + } + /* size must be multiple of 4 or equal to whole texture size */ + if ((width & 3) && (GLuint) width != texImage->Width) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexSubImage%D(width)", dimensions); + return GL_TRUE; + } + if ((height & 3) && (GLuint) height != texImage->Height) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexSubImage%D(width)", dimensions); + 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 depth image depth 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 + * __GLcontextRec::Const and the supported extensions, and according to the + * OpenGL specification. + */ +static GLboolean +copytexture_error_check( GLcontext *ctx, GLuint dimensions, + GLenum target, GLint level, GLint internalFormat, + GLint width, GLint height, GLint border ) +{ + GLenum format, type; + GLboolean sizeOK; + + /* 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 border */ + if (border < 0 || border > 1 || + ((target == GL_TEXTURE_RECTANGLE_NV || + target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) { + return GL_TRUE; + } + + /* The format and type aren't really significant here, but we need to pass + * something to TestProxyTexImage(). + */ + format = _mesa_base_tex_format(ctx, internalFormat); + type = GL_FLOAT; + + /* Check target and call ctx->Driver.TestProxyTexImage() to check the + * level, width, height and depth. + */ + if (dimensions == 1) { + if (target == GL_TEXTURE_1D) { + sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_1D, + level, internalFormat, + format, type, + width, 1, 1, border); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage1D(target)" ); + return GL_TRUE; + } + } + else if (dimensions == 2) { + if (target == GL_TEXTURE_2D) { + sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_2D, + level, internalFormat, + format, type, + width, height, 1, border); + } + 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) { + _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); + return GL_TRUE; + } + sizeOK = (width == height) && + ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_CUBE_MAP_ARB, + level, internalFormat, format, type, + width, height, 1, border); + } + else if (target == GL_TEXTURE_RECTANGLE_NV) { + if (!ctx->Extensions.NV_texture_rectangle) { + _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); + return GL_TRUE; + } + sizeOK = ctx->Driver.TestProxyTexImage(ctx, + GL_PROXY_TEXTURE_RECTANGLE_NV, + level, internalFormat, + format, type, + width, height, 1, border); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); + return GL_TRUE; + } + } + else { + _mesa_problem(ctx, "invalid dimensions in copytexture_error_check"); + return GL_TRUE; + } + + 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_base_tex_format(ctx, internalFormat) < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexImage%dD(internalFormat)", dimensions); + return GL_TRUE; + } + + if (is_compressed_format(ctx, internalFormat)) { + if (target != GL_TEXTURE_2D) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glCopyTexImage%d(target)", dimensions); + return GL_TRUE; + } + if (border != 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexImage%D(border!=0)", dimensions); + return GL_TRUE; + } + } + + /* if we get here, the parameters are OK */ + 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 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. + * + * \return GL_TRUE if an error was detected, or GL_FALSE if no errors. + * + * Verifies each of the parameters against the constants specified in + * __GLcontextRec::Const and the supported extensions, and according to the + * OpenGL specification. + */ +static GLboolean +copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, + GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height ) +{ + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_image *teximage; + + /* Check target */ + if (dimensions == 1) { + if (target != GL_TEXTURE_1D) { + _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage1D(target)" ); + return GL_TRUE; + } + } + else if (dimensions == 2) { + if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); + return GL_TRUE; + } + } + else if (target == GL_TEXTURE_RECTANGLE_NV) { + if (!ctx->Extensions.NV_texture_rectangle) { + _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); + return GL_TRUE; + } + } + else if (target != GL_TEXTURE_2D) { + _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); + return GL_TRUE; + } + } + else if (dimensions == 3) { + if (target != GL_TEXTURE_3D) { + _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage3D(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; + } + + /* 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; + } + + teximage = _mesa_select_tex_image(ctx, texUnit, target, level); + if (!teximage) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexSubImage%dD(undefined texture level: %d)", + dimensions, level); + return GL_TRUE; + } + + 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; + } + } + + 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 (teximage->IsCompressed) { + if (target != GL_TEXTURE_2D) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glCopyTexSubImage%d(target)", dimensions); + return GL_TRUE; + } + /* offset must be multiple of 4 */ + if ((xoffset & 3) || (yoffset & 3)) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%D(xoffset or yoffset)", dimensions); + return GL_TRUE; + } + /* size must be multiple of 4 */ + if ((width & 3) != 0 && (GLuint) width != teximage->Width) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%D(width)", dimensions); + return GL_TRUE; + } + if ((height & 3) != 0 && (GLuint) height != teximage->Height) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%D(height)", dimensions); + return GL_TRUE; + } + } + + if (teximage->IntFormat == GL_YCBCR_MESA) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage2D"); + return GL_TRUE; + } + + /* if we get here, the parameters are OK */ + 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 ) +{ + const struct gl_texture_unit *texUnit; + const struct gl_texture_object *texObj; + const struct gl_texture_image *texImage; + GLint maxLevels = 0; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + texUnit = &(ctx->Texture.Unit[ctx->Texture.CurrentUnit]); + texObj = _mesa_select_tex_object(ctx, texUnit, target); + if (!texObj || is_proxy_target(target)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target)"); + return; + } + + maxLevels = _mesa_max_texture_levels(ctx, target); + ASSERT(maxLevels > 0); /* 0 indicates bad target, caught above */ + + if (level < 0 || level >= maxLevels) { + _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexImage(level)" ); + return; + } + + if (_mesa_sizeof_packed_type(type) <= 0) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexImage(type)" ); + return; + } + + if (_mesa_components_in_format(format) <= 0 || + format == GL_STENCIL_INDEX) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexImage(format)" ); + return; + } + + if (!ctx->Extensions.EXT_paletted_texture && is_index_format(format)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)"); + } + + if (!ctx->Extensions.SGIX_depth_texture && + !ctx->Extensions.ARB_depth_texture && is_depth_format(format)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)"); + } + + if (!ctx->Extensions.MESA_ycbcr_texture && is_ycbcr_format(format)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)"); + } + + if (!pixels) + return; + + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + if (!texImage) { + /* invalid mipmap level, not an error */ + return; + } + + /* Make sure the requested image format is compatible with the + * texture's format. We let the colorformat-indexformat go through, + * because the texelfetcher will dequantize to full rgba. + */ + if (is_color_format(format) + && !is_color_format(texImage->TexFormat->BaseFormat) + && !is_index_format(texImage->TexFormat->BaseFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); + return; + } + else if (is_index_format(format) + && !is_index_format(texImage->TexFormat->BaseFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); + return; + } + else if (is_depth_format(format) + && !is_depth_format(texImage->TexFormat->BaseFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); + return; + } + else if (is_ycbcr_format(format) + && !is_ycbcr_format(texImage->TexFormat->BaseFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); + return; + } + + /* typically, this will call _mesa_get_teximage() */ + ctx->Driver.GetTexImage(ctx, target, level, format, type, pixels, + texObj, texImage); +} + + + +/* + * 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 ) +{ + GLsizei postConvWidth = width; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (is_color_format(internalFormat)) { + _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); + } + + if (target == GL_TEXTURE_1D) { + /* non-proxy target */ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 1, postConvWidth, 1, 1, border)) { + return; /* error was recorded */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_get_tex_image(ctx, texUnit, target, level); + + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); + return; + } + else if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + ASSERT(texImage->Data == NULL); + clear_teximage_fields(texImage); /* not really needed, but helpful */ + _mesa_init_teximage_fields(ctx, target, texImage, + postConvWidth, 1, 1, + border, internalFormat); + + if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) + _mesa_update_state(ctx); + + ASSERT(ctx->Driver.TexImage1D); + + /* Give the texture to the driver! may be null! */ + (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat, + width, border, format, type, pixels, + &ctx->Unpack, texObj, texImage); + + ASSERT(texImage->TexFormat); + + /* If driver didn't explicitly set this, use the defaults */ + if (!texImage->FetchTexelc) + texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D; + if (!texImage->FetchTexelf) + texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df; + ASSERT(texImage->FetchTexelc); + ASSERT(texImage->FetchTexelf); + + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; + } + else if (target == GL_PROXY_TEXTURE_1D) { + /* Proxy texture: check for errors and update proxy state */ + struct gl_texture_image *texImage; + texImage = _mesa_get_proxy_tex_image(ctx, target, level); + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 1, postConvWidth, 1, 1, border)) { + /* when error, clear all proxy texture image parameters */ + if (texImage) + clear_teximage_fields(texImage); + } + else { + /* no error, set the tex image parameters */ + ASSERT(texImage); + _mesa_init_teximage_fields(ctx, target, texImage, + postConvWidth, 1, 1, + border, internalFormat); + texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, + internalFormat, format, type); + } + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" ); + return; + } +} + + +void GLAPIENTRY +_mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, + GLsizei width, GLsizei height, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ) +{ + GLsizei postConvWidth = width, postConvHeight = height; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (is_color_format(internalFormat)) { + _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, + &postConvHeight); + } + + if (target == GL_TEXTURE_2D || + (ctx->Extensions.ARB_texture_cube_map && + target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) || + (ctx->Extensions.NV_texture_rectangle && + target == GL_TEXTURE_RECTANGLE_NV)) { + /* non-proxy target */ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 2, postConvWidth, postConvHeight, + 1, border)) { + return; /* error was recorded */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_get_tex_image(ctx, texUnit, target, level); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); + return; + } + else if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + ASSERT(texImage->Data == NULL); + clear_teximage_fields(texImage); /* not really needed, but helpful */ + _mesa_init_teximage_fields(ctx, target, texImage, + postConvWidth, postConvHeight, 1, + border, internalFormat); + + if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) + _mesa_update_state(ctx); + + ASSERT(ctx->Driver.TexImage2D); + + /* Give the texture to the driver! may be null! */ + (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat, + width, height, border, format, type, pixels, + &ctx->Unpack, texObj, texImage); + + ASSERT(texImage->TexFormat); + + /* If driver didn't explicitly set these, use the defaults */ + if (!texImage->FetchTexelc) + texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D; + if (!texImage->FetchTexelf) + texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df; + ASSERT(texImage->FetchTexelc); + ASSERT(texImage->FetchTexelf); + + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; + } + else if (target == GL_PROXY_TEXTURE_2D || + (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB && + ctx->Extensions.ARB_texture_cube_map) || + (target == GL_PROXY_TEXTURE_RECTANGLE_NV && + ctx->Extensions.NV_texture_rectangle)) { + /* Proxy texture: check for errors and update proxy state */ + struct gl_texture_image *texImage; + texImage = _mesa_get_proxy_tex_image(ctx, target, level); + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 2, postConvWidth, postConvHeight, + 1, border)) { + /* when error, clear all proxy texture image parameters */ + if (texImage) + clear_teximage_fields(ctx->Texture.Proxy2D->Image[0][level]); + } + else { + /* no error, set the tex image parameters */ + _mesa_init_teximage_fields(ctx, target, texImage, + postConvWidth, postConvHeight, 1, + border, internalFormat); + texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, + internalFormat, format, type); + } + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" ); + return; + } +} + + +/* + * 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); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (target == GL_TEXTURE_3D) { + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + /* non-proxy target */ + + if (texture_error_check(ctx, target, level, (GLint) internalFormat, + format, type, 3, width, height, depth, border)) { + return; /* error was recorded */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_get_tex_image(ctx, texUnit, target, level); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); + return; + } + else if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + ASSERT(texImage->Data == NULL); + clear_teximage_fields(texImage); /* not really needed, but helpful */ + _mesa_init_teximage_fields(ctx, target, texImage, + width, height, depth, + border, internalFormat); + + if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) + _mesa_update_state(ctx); + + ASSERT(ctx->Driver.TexImage3D); + + /* Give the texture to the driver! may be null! */ + (*ctx->Driver.TexImage3D)(ctx, target, level, internalFormat, + width, height, depth, border, format, type, + pixels, &ctx->Unpack, texObj, texImage); + + ASSERT(texImage->TexFormat); + + /* If driver didn't explicitly set these, use the defaults */ + if (!texImage->FetchTexelc) + texImage->FetchTexelc = texImage->TexFormat->FetchTexel3D; + if (!texImage->FetchTexelf) + texImage->FetchTexelf = texImage->TexFormat->FetchTexel3Df; + ASSERT(texImage->FetchTexelc); + ASSERT(texImage->FetchTexelf); + + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; + } + else if (target == GL_PROXY_TEXTURE_3D) { + /* Proxy texture: check for errors and update proxy state */ + struct gl_texture_image *texImage; + texImage = _mesa_get_proxy_tex_image(ctx, target, level); + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 3, width, height, depth, border)) { + /* when error, clear all proxy texture image parameters */ + if (texImage) + clear_teximage_fields(texImage); + } + else { + /* no error, set the tex image parameters */ + _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, + border, internalFormat); + texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, + internalFormat, format, type); + } + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" ); + return; + } +} + + +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); +} + + + +void GLAPIENTRY +_mesa_TexSubImage1D( GLenum target, GLint level, + GLint xoffset, GLsizei width, + GLenum format, GLenum type, + const GLvoid *pixels ) +{ + GLsizei postConvWidth = width; + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) + _mesa_update_state(ctx); + + /* XXX should test internal format */ + if (is_color_format(format)) { + _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); + } + + if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, + postConvWidth, 1, 1, format, type)) { + return; /* error was detected */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + assert(texImage); + + if (width == 0) + return; /* no-op, not an error */ + + /* If we have a border, xoffset=-1 is legal. Bias by border width */ + xoffset += texImage->Border; + + ASSERT(ctx->Driver.TexSubImage1D); + (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width, + format, type, pixels, &ctx->Unpack, + texObj, texImage); + ctx->NewState |= _NEW_TEXTURE; +} + + +void GLAPIENTRY +_mesa_TexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ) +{ + GLsizei postConvWidth = width, postConvHeight = height; + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) + _mesa_update_state(ctx); + + /* XXX should test internal format */ + if (is_color_format(format)) { + _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, + &postConvHeight); + } + + if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, + postConvWidth, postConvHeight, 1, format, type)) { + return; /* error was detected */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + assert(texImage); + + if (width == 0 || height == 0) + return; /* no-op, not an error */ + + /* If we have a border, xoffset=-1 is legal. Bias by border width */ + xoffset += texImage->Border; + yoffset += texImage->Border; + + ASSERT(ctx->Driver.TexSubImage2D); + (*ctx->Driver.TexSubImage2D)(ctx, target, level, xoffset, yoffset, + width, height, format, type, pixels, + &ctx->Unpack, texObj, texImage); + ctx->NewState |= _NEW_TEXTURE; +} + + + +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 ) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) + _mesa_update_state(ctx); + + if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, + width, height, depth, format, type)) { + return; /* error was detected */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + assert(texImage); + + if (width == 0 || height == 0 || height == 0) + return; /* no-op, not an error */ + + /* If we have a border, xoffset=-1 is legal. Bias by border width */ + xoffset += texImage->Border; + yoffset += texImage->Border; + zoffset += texImage->Border; + + ASSERT(ctx->Driver.TexSubImage3D); + (*ctx->Driver.TexSubImage3D)(ctx, target, level, + xoffset, yoffset, zoffset, + width, height, depth, + format, type, pixels, + &ctx->Unpack, texObj, texImage ); + ctx->NewState |= _NEW_TEXTURE; +} + + + +void GLAPIENTRY +_mesa_CopyTexImage1D( GLenum target, GLint level, + GLenum internalFormat, + GLint x, GLint y, + GLsizei width, GLint border ) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLsizei postConvWidth = width; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) + _mesa_update_state(ctx); + + if (is_color_format(internalFormat)) { + _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); + } + + if (copytexture_error_check(ctx, 1, target, level, internalFormat, + postConvWidth, 1, border)) + return; + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_get_tex_image(ctx, texUnit, target, level); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D"); + return; + } + else if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + ASSERT(texImage->Data == NULL); + + clear_teximage_fields(texImage); /* not really needed, but helpful */ + _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, + border, internalFormat); + + + ASSERT(ctx->Driver.CopyTexImage1D); + (*ctx->Driver.CopyTexImage1D)(ctx, target, level, internalFormat, + x, y, width, border); + + ASSERT(texImage->TexFormat); + + /* If driver didn't explicitly set these, use the defaults */ + if (!texImage->FetchTexelc) + texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D; + if (!texImage->FetchTexelf) + texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df; + ASSERT(texImage->FetchTexelc); + ASSERT(texImage->FetchTexelf); + + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; +} + + + +void GLAPIENTRY +_mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, + GLint x, GLint y, GLsizei width, GLsizei height, + GLint border ) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLsizei postConvWidth = width, postConvHeight = height; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) + _mesa_update_state(ctx); + + if (is_color_format(internalFormat)) { + _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, + &postConvHeight); + } + + if (copytexture_error_check(ctx, 2, target, level, internalFormat, + postConvWidth, postConvHeight, border)) + return; + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_get_tex_image(ctx, texUnit, target, level); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D"); + return; + } + else if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + ASSERT(texImage->Data == NULL); + + clear_teximage_fields(texImage); /* not really needed, but helpful */ + _mesa_init_teximage_fields(ctx, target, texImage, + postConvWidth, postConvHeight, 1, + border, internalFormat); + + ASSERT(ctx->Driver.CopyTexImage2D); + (*ctx->Driver.CopyTexImage2D)(ctx, target, level, internalFormat, + x, y, width, height, border); + + ASSERT(texImage->TexFormat); + + /* If driver didn't explicitly set these, use the defaults */ + if (!texImage->FetchTexelc) + texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D; + if (!texImage->FetchTexelf) + texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df; + ASSERT(texImage->FetchTexelc); + ASSERT(texImage->FetchTexelf); + + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; +} + + + +void GLAPIENTRY +_mesa_CopyTexSubImage1D( GLenum target, GLint level, + GLint xoffset, GLint x, GLint y, GLsizei width ) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_image *texImage; + GLsizei postConvWidth = width; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) + _mesa_update_state(ctx); + + /* XXX should test internal format */ + _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); + + if (copytexsubimage_error_check(ctx, 1, target, level, + xoffset, 0, 0, postConvWidth, 1)) + return; + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + ASSERT(texImage); + + /* If we have a border, xoffset=-1 is legal. Bias by border width */ + xoffset += texImage->Border; + + ASSERT(ctx->Driver.CopyTexSubImage1D); + (*ctx->Driver.CopyTexSubImage1D)(ctx, target, level, xoffset, x, y, width); + ctx->NewState |= _NEW_TEXTURE; +} + + + +void GLAPIENTRY +_mesa_CopyTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, GLsizei width, GLsizei height ) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_image *texImage; + GLsizei postConvWidth = width, postConvHeight = height; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) + _mesa_update_state(ctx); + + /* XXX should test internal format */ + _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); + + if (copytexsubimage_error_check(ctx, 2, target, level, xoffset, yoffset, 0, + postConvWidth, postConvHeight)) + return; + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + ASSERT(texImage); + + /* If we have a border, xoffset=-1 is legal. Bias by border width */ + xoffset += texImage->Border; + yoffset += texImage->Border; + + ASSERT(ctx->Driver.CopyTexSubImage2D); + (*ctx->Driver.CopyTexSubImage2D)(ctx, target, level, + xoffset, yoffset, x, y, width, height); + ctx->NewState |= _NEW_TEXTURE; +} + + + +void GLAPIENTRY +_mesa_CopyTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint x, GLint y, GLsizei width, GLsizei height ) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_image *texImage; + GLsizei postConvWidth = width, postConvHeight = height; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) + _mesa_update_state(ctx); + + /* XXX should test internal format */ + _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); + + if (copytexsubimage_error_check(ctx, 3, target, level, xoffset, yoffset, + zoffset, postConvWidth, postConvHeight)) + return; + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + ASSERT(texImage); + + /* If we have a border, xoffset=-1 is legal. Bias by border width */ + xoffset += texImage->Border; + yoffset += texImage->Border; + zoffset += texImage->Border; + + ASSERT(ctx->Driver.CopyTexSubImage3D); + (*ctx->Driver.CopyTexSubImage3D)(ctx, target, level, + xoffset, yoffset, zoffset, + x, y, width, height); + ctx->NewState |= _NEW_TEXTURE; +} + + + + +/**********************************************************************/ +/****** Compressed Textures ******/ +/**********************************************************************/ + + +/** + * Error checking for glCompressedTexImage[123]D(). + * \return error code or GL_NO_ERROR. + */ +static GLenum +compressed_texture_error_check(GLcontext *ctx, GLint dimensions, + GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, + GLsizei imageSize) +{ + GLint expectedSize, maxLevels = 0, maxTextureSize; + + 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); + + if (!is_compressed_format(ctx, internalFormat)) + return GL_INVALID_ENUM; + + if (_mesa_base_tex_format(ctx, internalFormat) < 0) + return GL_INVALID_ENUM; + + if (border != 0) + return GL_INVALID_VALUE; + + /* + * XXX We should probably use the proxy texture error check function here. + */ + if (width < 1 || width > maxTextureSize || + (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(width) != 1)) + return GL_INVALID_VALUE; + + if ((height < 1 || height > maxTextureSize || + (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(height) != 1)) + && dimensions > 1) + return GL_INVALID_VALUE; + + if ((depth < 1 || depth > maxTextureSize || + (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(depth) != 1)) + && dimensions > 2) + 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; + + if (level < 0 || level >= maxLevels) + return GL_INVALID_VALUE; + + expectedSize = ctx->Driver.CompressedTextureSize(ctx, width, height, depth, + internalFormat); + if (expectedSize != imageSize) + 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(GLcontext *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; + (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); + + if (!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; + + /* XXX these tests are specific to the compressed format. + * this code should be generalized in some way. + */ + if ((xoffset & 3) != 0 || (yoffset & 3) != 0) + return GL_INVALID_VALUE; + + if ((width & 3) != 0 && width != 2 && width != 1) + return GL_INVALID_VALUE; + + if ((height & 3) != 0 && height != 2 && height != 1) + return GL_INVALID_VALUE; + + expectedSize = ctx->Driver.CompressedTextureSize(ctx, width, height, depth, + format); + if (expectedSize != imageSize) + return GL_INVALID_VALUE; + + return GL_NO_ERROR; +} + + + +void GLAPIENTRY +_mesa_CompressedTexImage1DARB(GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLint border, GLsizei imageSize, + const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (target == GL_TEXTURE_1D) { + /* non-proxy target */ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLenum error = compressed_texture_error_check(ctx, 1, target, level, + internalFormat, width, 1, 1, border, imageSize); + if (error) { + _mesa_error(ctx, error, "glCompressedTexImage1D"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_get_tex_image(ctx, texUnit, target, level); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1D"); + return; + } + else if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + ASSERT(texImage->Data == NULL); + + _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, + border, internalFormat); + + ASSERT(ctx->Driver.CompressedTexImage1D); + (*ctx->Driver.CompressedTexImage1D)(ctx, target, level, + internalFormat, width, border, + imageSize, data, + texObj, texImage); + + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; + } + else if (target == GL_PROXY_TEXTURE_1D) { + /* Proxy texture: check for errors and update proxy state */ + GLenum error = compressed_texture_error_check(ctx, 1, target, level, + internalFormat, width, 1, 1, border, imageSize); + if (!error) { + ASSERT(ctx->Driver.TestProxyTexImage); + error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, + internalFormat, GL_NONE, GL_NONE, + width, 1, 1, border); + } + if (error) { + /* if error, clear all proxy texture image parameters */ + struct gl_texture_image *texImage; + texImage = _mesa_get_proxy_tex_image(ctx, target, level); + if (texImage) + clear_teximage_fields(texImage); + } + else { + /* store the teximage parameters */ + struct gl_texture_unit *texUnit; + struct gl_texture_image *texImage; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, + border, internalFormat); + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage1D(target)"); + return; + } +} + + +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); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (target == GL_TEXTURE_2D || + (ctx->Extensions.ARB_texture_cube_map && + target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { + /* non-proxy target */ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLenum error = compressed_texture_error_check(ctx, 2, target, level, + internalFormat, width, height, 1, border, imageSize); + if (error) { + _mesa_error(ctx, error, "glCompressedTexImage2D"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_get_tex_image(ctx, texUnit, target, level); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); + return; + } + else if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + ASSERT(texImage->Data == NULL); + + _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, + border, internalFormat); + + ASSERT(ctx->Driver.CompressedTexImage2D); + (*ctx->Driver.CompressedTexImage2D)(ctx, target, level, + internalFormat, width, height, + border, imageSize, data, + texObj, texImage); + + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; + } + else if (target == GL_PROXY_TEXTURE_2D || + (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB && + ctx->Extensions.ARB_texture_cube_map)) { + /* Proxy texture: check for errors and update proxy state */ + GLenum error = compressed_texture_error_check(ctx, 2, target, level, + internalFormat, width, height, 1, border, imageSize); + if (!error) { + ASSERT(ctx->Driver.TestProxyTexImage); + error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, + internalFormat, GL_NONE, GL_NONE, + width, height, 1, border); + } + if (error) { + /* if error, clear all proxy texture image parameters */ + struct gl_texture_image *texImage; + texImage = _mesa_get_proxy_tex_image(ctx, target, level); + if (texImage) + clear_teximage_fields(texImage); + } + else { + /* store the teximage parameters */ + struct gl_texture_unit *texUnit; + struct gl_texture_image *texImage; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, + border, internalFormat); + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage2D(target)"); + return; + } +} + + +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); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (target == GL_TEXTURE_3D) { + /* non-proxy target */ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLenum error = compressed_texture_error_check(ctx, 3, target, level, + internalFormat, width, height, depth, border, imageSize); + if (error) { + _mesa_error(ctx, error, "glCompressedTexImage3D"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_get_tex_image(ctx, texUnit, target, level); + if (!texImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3D"); + return; + } + else if (texImage->Data) { + ctx->Driver.FreeTexImageData( ctx, texImage ); + } + ASSERT(texImage->Data == NULL); + + _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, + border, internalFormat); + + ASSERT(ctx->Driver.CompressedTexImage3D); + (*ctx->Driver.CompressedTexImage3D)(ctx, target, level, + internalFormat, + width, height, depth, + border, imageSize, data, + texObj, texImage); + + /* state update */ + texObj->Complete = GL_FALSE; + ctx->NewState |= _NEW_TEXTURE; + } + else if (target == GL_PROXY_TEXTURE_3D) { + /* Proxy texture: check for errors and update proxy state */ + GLenum error = compressed_texture_error_check(ctx, 3, target, level, + internalFormat, width, height, depth, border, imageSize); + if (!error) { + ASSERT(ctx->Driver.TestProxyTexImage); + error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, + internalFormat, GL_NONE, GL_NONE, + width, height, depth, border); + } + if (error) { + /* if error, clear all proxy texture image parameters */ + struct gl_texture_image *texImage; + texImage = _mesa_get_proxy_tex_image(ctx, target, level); + if (texImage) + clear_teximage_fields(texImage); + } + else { + /* store the teximage parameters */ + struct gl_texture_unit *texUnit; + struct gl_texture_image *texImage; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + _mesa_init_teximage_fields(ctx, target, texImage, width, height, + depth, border, internalFormat); + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage3D(target)"); + return; + } +} + + +void GLAPIENTRY +_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, + GLsizei width, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + struct gl_texture_unit *texUnit; + 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, 1, target, level, + xoffset, 0, 0, width, 1, 1, format, imageSize); + if (error) { + _mesa_error(ctx, error, "glCompressedTexSubImage1D"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + assert(texImage); + + if ((GLint) format != texImage->IntFormat) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCompressedTexSubImage1D(format)"); + return; + } + + if ((width == 1 || width == 2) && (GLuint) width != texImage->Width) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage1D(width)"); + return; + } + + if (width == 0) + return; /* no-op, not an error */ + + if (ctx->Driver.CompressedTexSubImage1D) { + (*ctx->Driver.CompressedTexSubImage1D)(ctx, target, level, + xoffset, width, + format, imageSize, data, + texObj, texImage); + } + ctx->NewState |= _NEW_TEXTURE; +} + + +void GLAPIENTRY +_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, + const GLvoid *data) +{ + struct gl_texture_unit *texUnit; + 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, 2, target, level, + xoffset, yoffset, 0, width, height, 1, format, imageSize); + if (error) { + /* XXX proxy target? */ + _mesa_error(ctx, error, "glCompressedTexSubImage2D"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + assert(texImage); + + if ((GLint) format != texImage->IntFormat) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCompressedTexSubImage2D(format)"); + return; + } + + if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) || + ((height == 1 || height == 2) && (GLuint) height != texImage->Height)) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage2D(size)"); + return; + } + + if (width == 0 || height == 0) + return; /* no-op, not an error */ + + if (ctx->Driver.CompressedTexSubImage2D) { + (*ctx->Driver.CompressedTexSubImage2D)(ctx, target, level, + xoffset, yoffset, width, height, + format, imageSize, data, + texObj, texImage); + } + ctx->NewState |= _NEW_TEXTURE; +} + + +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) +{ + struct gl_texture_unit *texUnit; + 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, 3, target, level, + xoffset, yoffset, zoffset, width, height, depth, format, imageSize); + if (error) { + _mesa_error(ctx, error, "glCompressedTexSubImage2D"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + assert(texImage); + + if ((GLint) format != texImage->IntFormat) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCompressedTexSubImage3D(format)"); + return; + } + + if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) || + ((height == 1 || height == 2) && (GLuint) height != texImage->Height) || + ((depth == 1 || depth == 2) && (GLuint) depth != texImage->Depth)) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage3D(size)"); + return; + } + + if (width == 0 || height == 0 || depth == 0) + return; /* no-op, not an error */ + + if (ctx->Driver.CompressedTexSubImage3D) { + (*ctx->Driver.CompressedTexSubImage3D)(ctx, target, level, + xoffset, yoffset, zoffset, + width, height, depth, + format, imageSize, data, + texObj, texImage); + } + ctx->NewState |= _NEW_TEXTURE; +} + + +void GLAPIENTRY +_mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) +{ + const struct gl_texture_unit *texUnit; + const struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLint maxLevels; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + if (!texObj) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB"); + return; + } + + maxLevels = _mesa_max_texture_levels(ctx, target); + ASSERT(maxLevels > 0); /* 0 indicates bad target, caught above */ + + if (level < 0 || level >= maxLevels) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)"); + return; + } + + if (is_proxy_target(target)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)"); + return; + } + + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + if (!texImage) { + /* probably invalid mipmap level */ + _mesa_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)"); + return; + } + + if (!texImage->IsCompressed) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetCompressedTexImageARB"); + return; + } + + /* this typically calls _mesa_get_compressed_teximage() */ + ctx->Driver.GetCompressedTexImage(ctx, target, level, img, texObj,texImage); +} diff --git a/reactos/dll/mesa32/src/main/teximage.h b/reactos/dll/mesa32/src/main/teximage.h new file mode 100644 index 00000000000..45c851e5c88 --- /dev/null +++ b/reactos/dll/mesa32/src/main/teximage.h @@ -0,0 +1,239 @@ +/** + * \file teximage.h + * Texture images manipulation functions. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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" + + +extern void * +_mesa_alloc_texmemory(GLsizei bytes); + +extern void +_mesa_free_texmemory(void *m); + + +/** \name Internal functions */ +/*@{*/ + +extern GLint +_mesa_base_tex_format( GLcontext *ctx, GLint internalFormat ); + + +extern struct gl_texture_image * +_mesa_new_texture_image( GLcontext *ctx ); + + +extern void +_mesa_delete_texture_image( GLcontext *ctx, struct gl_texture_image *teximage ); + + +extern void +_mesa_free_texture_image_data( GLcontext *ctx, + struct gl_texture_image *texImage ); + + +extern void +_mesa_init_teximage_fields(GLcontext *ctx, GLenum target, + struct gl_texture_image *img, + GLsizei width, GLsizei height, GLsizei depth, + GLint border, GLenum internalFormat); + + +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(GLcontext *ctx, const struct gl_texture_unit *texUnit, + GLenum target); + + +extern struct gl_texture_image * +_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, + GLenum target, GLint level); + + +extern struct gl_texture_image * +_mesa_get_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, + GLenum target, GLint level); + + +extern struct gl_texture_image * +_mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level); + + +extern GLint +_mesa_max_texture_levels(GLcontext *ctx, GLenum target); + + +extern GLboolean +_mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, + GLint internalFormat, GLenum format, GLenum type, + GLint width, GLint height, GLint depth, GLint border); + +/*@}*/ + + +/** \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_GetTexImage( GLenum target, GLint level, + GLenum format, GLenum type, GLvoid *pixels ); + + +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); + +extern void GLAPIENTRY +_mesa_GetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img); + +/*@}*/ + +#endif diff --git a/reactos/dll/mesa32/src/main/texobj.c b/reactos/dll/mesa32/src/main/texobj.c new file mode 100644 index 00000000000..5594cd9382b --- /dev/null +++ b/reactos/dll/mesa32/src/main/texobj.c @@ -0,0 +1,1000 @@ +/** + * \file texobj.c + * Texture object management. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +#include "glheader.h" +#include "colortab.h" +#include "context.h" +#include "enums.h" +#include "hash.h" +#include "imports.h" +#include "macros.h" +#include "teximage.h" +#include "texstate.h" +#include "texobj.h" +#include "mtypes.h" + + +/**********************************************************************/ +/** \name Internal functions */ +/*@{*/ + +/** + * 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( GLcontext *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); + + _mesa_bzero(obj, 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->CompareFlag = GL_FALSE; /* SGIX_shadow */ + obj->CompareOperator = GL_TEXTURE_LEQUAL_R_SGIX; /* SGIX_shadow */ + obj->CompareMode = GL_NONE; /* ARB_shadow */ + obj->CompareFunc = GL_LEQUAL; /* ARB_shadow */ + obj->DepthMode = GL_LUMINANCE; /* ARB_depth_texture */ + obj->ShadowAmbient = 0.0F; /* ARB/SGIX_shadow_ambient */ + _mesa_init_colortable(&obj->Palette); +} + + +/** + * Deallocate a texture object struct. It should have already been + * removed from the texture object pool. + * + * \param shared the shared GL state to which the object belongs. + * \param texOjb the texture object to delete. + */ +void +_mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) +{ + GLuint i, face; + + (void) ctx; + + _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 */ + _mesa_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->Name = src->Name; + dest->Priority = src->Priority; + dest->BorderColor[0] = src->BorderColor[0]; + dest->BorderColor[1] = src->BorderColor[1]; + dest->BorderColor[2] = src->BorderColor[2]; + dest->BorderColor[3] = src->BorderColor[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->CompareFlag = src->CompareFlag; + dest->CompareOperator = src->CompareOperator; + dest->ShadowAmbient = src->ShadowAmbient; + dest->CompareMode = src->CompareMode; + dest->CompareFunc = src->CompareFunc; + dest->DepthMode = src->DepthMode; + dest->_MaxLevel = src->_MaxLevel; + dest->_MaxLambda = src->_MaxLambda; + dest->GenerateMipmap = src->GenerateMipmap; + dest->Palette = src->Palette; + dest->Complete = src->Complete; + dest->_IsPowerOfTwo = src->_IsPowerOfTwo; +} + + +/** + * Report why a texture object is incomplete. + * + * \param t texture object. + * \param why string describing why it's incomplete. + * + * \note For debug purposes only. + */ +#if 0 +static void +incomplete(const struct gl_texture_object *t, const char *why) +{ + _mesa_printf("Texture Obj %d incomplete because: %s\n", t->Name, why); +} +#else +#define incomplete(t, why) +#endif + + +/** + * 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 GLcontext *ctx, + struct gl_texture_object *t ) +{ + const GLint baseLevel = t->BaseLevel; + GLint maxLog2 = 0, maxLevels = 0; + + t->Complete = GL_TRUE; /* be optimistic */ + t->_IsPowerOfTwo = GL_TRUE; /* may be set FALSE below */ + + /* Always need the base level image */ + if (!t->Image[0][baseLevel]) { + char s[100]; + sprintf(s, "obj %p (%d) Image[baseLevel=%d] == NULL", + (void *) t, t->Name, baseLevel); + incomplete(t, s); + t->Complete = GL_FALSE; + 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"); + t->Complete = GL_FALSE; + return; + } + + /* Compute _MaxLevel */ + if (t->Target == GL_TEXTURE_1D) { + maxLog2 = t->Image[0][baseLevel]->WidthLog2; + maxLevels = ctx->Const.MaxTextureLevels; + } + else if (t->Target == GL_TEXTURE_2D) { + 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) { + t->Complete = GL_FALSE; + incomplete(t, "Non-quare cubemap image"); + return; + } + } + } + + /* check for non power of two */ + if (!t->Image[0][baseLevel]->_IsPowerOfTwo) { + t->_IsPowerOfTwo = GL_FALSE; + } + + /* 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) { + t->Complete = GL_FALSE; + 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) { + t->Complete = GL_FALSE; + incomplete(t, "Format[i] != Format[baseLevel]"); + return; + } + if (t->Image[0][i]->Border != t->Image[0][baseLevel]->Border) { + t->Complete = GL_FALSE; + incomplete(t, "Border[i] != Border[baseLevel]"); + return; + } + } + } + + /* Test things which depend on number of texture image dimensions */ + if (t->Target == GL_TEXTURE_1D) { + /* 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]) { + t->Complete = GL_FALSE; + incomplete(t, "1D Image[0][i] == NULL"); + return; + } + if (t->Image[0][i]->Width2 != width ) { + t->Complete = GL_FALSE; + 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) { + /* 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]) { + t->Complete = GL_FALSE; + incomplete(t, "2D Image[0][i] == NULL"); + return; + } + if (t->Image[0][i]->Width2 != width) { + t->Complete = GL_FALSE; + incomplete(t, "2D Image[0][i] bad width"); + return; + } + if (t->Image[0][i]->Height2 != height) { + t->Complete = GL_FALSE; + 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"); + t->Complete = GL_FALSE; + return; + } + if (t->Image[0][i]->Format == GL_DEPTH_COMPONENT) { + t->Complete = GL_FALSE; + incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex"); + return; + } + if (t->Image[0][i]->Width2 != width) { + t->Complete = GL_FALSE; + incomplete(t, "3D Image[0][i] bad width"); + return; + } + if (t->Image[0][i]->Height2 != height) { + t->Complete = GL_FALSE; + incomplete(t, "3D Image[0][i] bad height"); + return; + } + if (t->Image[0][i]->Depth2 != depth) { + t->Complete = GL_FALSE; + 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]) { + t->Complete = GL_FALSE; + incomplete(t, "CubeMap Image[n][i] == NULL"); + return; + } + /* Don't support GL_DEPTH_COMPONENT for cube maps */ + if (t->Image[face][i]->Format == GL_DEPTH_COMPONENT) { + t->Complete = GL_FALSE; + 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) { + t->Complete = GL_FALSE; + 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"); + } + } +} + +/*@}*/ + + +/***********************************************************************/ +/** \name API functions */ +/*@{*/ + +/** + * Texture name generation lock. + * + * Used by _mesa_GenTextures() to guarantee that the generation and allocation + * of texture IDs is atomic. + */ +_glthread_DECLARE_STATIC_MUTEX(GenTexturesLock); + +/** + * 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(). + * + * While holding the GenTexturesLock lock, 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(GenTexturesLock); + + 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(GenTexturesLock); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTextures"); + return; + } + + /* insert into hash table */ + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + _mesa_HashInsert(ctx->Shared->TexObjects, texObj->Name, texObj); + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + + textures[i] = name; + } + + _glthread_UNLOCK_MUTEX(GenTexturesLock); +} + + +/** + * 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 = (struct gl_texture_object *) + _mesa_HashLookup(ctx->Shared->TexObjects, textures[i]); + if (delObj) { + /* First check if this texture is currently bound. + * If so, unbind it and decrement the reference count. + * XXX all RefCount accesses should be protected by a mutex. + */ + GLuint u; + for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) { + struct gl_texture_unit *unit = &ctx->Texture.Unit[u]; + if (delObj == unit->Current1D) { + unit->Current1D = ctx->Shared->Default1D; + ctx->Shared->Default1D->RefCount++; + delObj->RefCount--; + if (delObj == unit->_Current) + unit->_Current = unit->Current1D; + } + else if (delObj == unit->Current2D) { + unit->Current2D = ctx->Shared->Default2D; + ctx->Shared->Default2D->RefCount++; + delObj->RefCount--; + if (delObj == unit->_Current) + unit->_Current = unit->Current2D; + } + else if (delObj == unit->Current3D) { + unit->Current3D = ctx->Shared->Default3D; + ctx->Shared->Default3D->RefCount++; + delObj->RefCount--; + if (delObj == unit->_Current) + unit->_Current = unit->Current3D; + } + else if (delObj == unit->CurrentCubeMap) { + unit->CurrentCubeMap = ctx->Shared->DefaultCubeMap; + ctx->Shared->DefaultCubeMap->RefCount++; + delObj->RefCount--; + if (delObj == unit->_Current) + unit->_Current = unit->CurrentCubeMap; + } + else if (delObj == unit->CurrentRect) { + unit->CurrentRect = ctx->Shared->DefaultRect; + ctx->Shared->DefaultRect->RefCount++; + delObj->RefCount--; + if (delObj == unit->_Current) + unit->_Current = unit->CurrentRect; + } + } + 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); + + /* The actual texture object will not be freed until it's no + * longer bound in any context. + * XXX all RefCount accesses should be protected by a mutex. + */ + delObj->RefCount--; + if (delObj->RefCount == 0) { + ASSERT(delObj->Name != 0); /* Never delete default tex objs */ + ASSERT(ctx->Driver.DeleteTexture); + (*ctx->Driver.DeleteTexture)(ctx, delObj); + } + } + } + } +} + + +/** + * 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); + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + struct gl_texture_object *oldTexObj; + struct gl_texture_object *newTexObj = NULL; + 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); + + /* + * Get pointer to currently bound texture object (oldTexObj) + */ + switch (target) { + case GL_TEXTURE_1D: + oldTexObj = texUnit->Current1D; + break; + case GL_TEXTURE_2D: + oldTexObj = texUnit->Current2D; + break; + case GL_TEXTURE_3D: + oldTexObj = texUnit->Current3D; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); + return; + } + oldTexObj = texUnit->CurrentCubeMap; + break; + case GL_TEXTURE_RECTANGLE_NV: + if (!ctx->Extensions.NV_texture_rectangle) { + _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); + return; + } + oldTexObj = texUnit->CurrentRect; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); + return; + } + + if (oldTexObj->Name == texName) + /* XXX this might be wrong. If the texobj is in use by another + * context and a texobj parameter was changed, this might be our + * only chance to update this context's hardware state. + */ + return; /* rebinding the same texture- no change */ + + /* + * Get pointer to new texture object (newTexObj) + */ + if (texName == 0) { + /* newTexObj = a default texture object */ + switch (target) { + case GL_TEXTURE_1D: + newTexObj = ctx->Shared->Default1D; + break; + case GL_TEXTURE_2D: + newTexObj = ctx->Shared->Default2D; + break; + case GL_TEXTURE_3D: + newTexObj = ctx->Shared->Default3D; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + newTexObj = ctx->Shared->DefaultCubeMap; + break; + case GL_TEXTURE_RECTANGLE_NV: + newTexObj = ctx->Shared->DefaultRect; + break; + default: + ; /* Bad targets are caught above */ + } + } + else { + /* non-default texture object */ + const struct _mesa_HashTable *hash = ctx->Shared->TexObjects; + newTexObj = (struct gl_texture_object *) _mesa_HashLookup(hash, texName); + if (newTexObj) { + /* error checking */ + if (newTexObj->Target != 0 && newTexObj->Target != target) { + /* the named texture object's dimensions don't match the target */ + _mesa_error( ctx, GL_INVALID_OPERATION, + "glBindTexture(wrong dimensionality)" ); + return; + } + if (newTexObj->Target == 0 && target == GL_TEXTURE_RECTANGLE_NV) { + /* have to init wrap and filter state here - kind of klunky */ + newTexObj->WrapS = GL_CLAMP_TO_EDGE; + newTexObj->WrapT = GL_CLAMP_TO_EDGE; + newTexObj->WrapR = GL_CLAMP_TO_EDGE; + newTexObj->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, newTexObj, GL_TEXTURE_WRAP_S, fparam_wrap ); + (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_WRAP_T, fparam_wrap ); + (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_WRAP_R, fparam_wrap ); + (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_MIN_FILTER, fparam_filter ); + } + } + } + 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; + } + + /* XXX all RefCount accesses should be protected by a mutex. */ + newTexObj->RefCount++; + + /* do the actual binding, but first flush outstanding vertices: + */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + + switch (target) { + case GL_TEXTURE_1D: + texUnit->Current1D = newTexObj; + break; + case GL_TEXTURE_2D: + texUnit->Current2D = newTexObj; + break; + case GL_TEXTURE_3D: + texUnit->Current3D = newTexObj; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + texUnit->CurrentCubeMap = newTexObj; + break; + case GL_TEXTURE_RECTANGLE_NV: + texUnit->CurrentRect = newTexObj; + break; + default: + _mesa_problem(ctx, "bad target in BindTexture"); + return; + } + + /* Pass BindTexture call to device driver */ + if (ctx->Driver.BindTexture) + (*ctx->Driver.BindTexture)( ctx, target, newTexObj ); + + /* Decrement the reference count on the old texture and check if it's + * time to delete it. + */ + /* XXX all RefCount accesses should be protected by a mutex. */ + oldTexObj->RefCount--; + ASSERT(oldTexObj->RefCount >= 0); + if (oldTexObj->RefCount == 0) { + ASSERT(oldTexObj->Name != 0); + ASSERT(ctx->Driver.DeleteTexture); + (*ctx->Driver.DeleteTexture)( ctx, oldTexObj ); + } +} + + +/** + * 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 = (struct gl_texture_object *) + _mesa_HashLookup(ctx->Shared->TexObjects, texName[i]); + if (t) { + t->Priority = CLAMP( priorities[i], 0.0F, 1.0F ); + if (ctx->Driver.PrioritizeTexture) + ctx->Driver.PrioritizeTexture( ctx, t, t->Priority ); + } + } + } + + 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 = (struct gl_texture_object *) + _mesa_HashLookup(ctx->Shared->TexObjects, 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 = (struct gl_texture_object *) + _mesa_HashLookup(ctx->Shared->TexObjects, texture); + + /* IsTexture is true only after object has been bound once. */ + return t && t->Target; +} + +/*@}*/ diff --git a/reactos/dll/mesa32/src/main/texobj.h b/reactos/dll/mesa32/src/main/texobj.h new file mode 100644 index 00000000000..d00bf70a0d1 --- /dev/null +++ b/reactos/dll/mesa32/src/main/texobj.h @@ -0,0 +1,95 @@ +/** + * \file texobj.h + * Texture object management. + */ + +/* + * 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 TEXTOBJ_H +#define TEXTOBJ_H + + +#include "mtypes.h" + + +/** + * \name Internal functions + */ +/*@{*/ + +extern struct gl_texture_object * +_mesa_new_texture_object( GLcontext *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( GLcontext *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_test_texobj_completeness( const GLcontext *ctx, + struct gl_texture_object *obj ); + +/*@}*/ + + +/** + * \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/reactos/dll/mesa32/src/main/texrender.c b/reactos/dll/mesa32/src/main/texrender.c new file mode 100644 index 00000000000..92f3f7377db --- /dev/null +++ b/reactos/dll/mesa32/src/main/texrender.c @@ -0,0 +1,226 @@ + +#include "context.h" +#include "fbobject.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 Zoffset; +}; + + + +static void +texture_get_row(GLcontext *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; + GLchan *rgbaOut = (GLchan *) values; + GLuint i; + for (i = 0; i < count; i++) { + trb->TexImage->FetchTexelc(trb->TexImage, x + i, y, z, rgbaOut + 4 * i); + } +} + +static void +texture_get_values(GLcontext *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; + GLchan *rgbaOut = (GLchan *) values; + GLuint i; + for (i = 0; i < count; i++) { + trb->TexImage->FetchTexelc(trb->TexImage, x[i], y[i], z, + rgbaOut + 4 * i); + } +} + +static void +texture_put_row(GLcontext *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; + const GLchan *rgba = (const GLchan *) values; + GLuint i; + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + trb->Store(trb->TexImage, x + i, y, z, rgba); + } + rgba += 4; + } +} + +static void +texture_put_mono_row(GLcontext *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; + const GLchan *rgba = (const GLchan *) value; + GLuint i; + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + trb->Store(trb->TexImage, x + i, y, z, rgba); + } + } +} + +static void +texture_put_values(GLcontext *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; + const GLchan *rgba = (const GLchan *) values; + GLuint i; + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + trb->Store(trb->TexImage, x[i], y[i], z, rgba); + } + rgba += 4; + } +} + +static void +texture_put_mono_values(GLcontext *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; + const GLchan *rgba = (const GLchan *) value; + GLuint i; + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + trb->Store(trb->TexImage, x[i], y[i], z, rgba); + } + } +} + + +static void +delete_texture_wrapper(struct gl_renderbuffer *rb) +{ + _mesa_free(rb); +} + + +/** + * If a render buffer attachment specifies a texture image, we'll use + * this function to make a gl_renderbuffer wrapper around the texture image. + * This allows other parts of Mesa to access the texture image as if it + * was a renderbuffer. + */ +static void +wrap_texture(GLcontext *ctx, struct gl_renderbuffer_attachment *att) +{ + struct texture_renderbuffer *trb; + const GLuint name = 0; + + ASSERT(att->Type == GL_TEXTURE); + ASSERT(att->Renderbuffer == NULL); + /* + ASSERT(att->Complete); + */ + + trb = CALLOC_STRUCT(texture_renderbuffer); + if (!trb) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "wrap_texture"); + return; + } + + _mesa_init_renderbuffer(&trb->Base, name); + + trb->TexImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; + assert(trb->TexImage); + + trb->Store = trb->TexImage->TexFormat->StoreTexel; + assert(trb->Store); + + trb->Zoffset = att->Zoffset; + + trb->Base.Width = trb->TexImage->Width; + trb->Base.Height = trb->TexImage->Height; + trb->Base.InternalFormat = trb->TexImage->IntFormat; /* XXX fix? */ + trb->Base._BaseFormat = trb->TexImage->TexFormat->BaseFormat; +#if 0 + /* fix/avoid this assertion someday */ + assert(trb->Base._BaseFormat == GL_RGB || + trb->Base._BaseFormat == GL_RGBA || + trb->Base._BaseFormat == GL_DEPTH_COMPONENT); +#endif + trb->Base.DataType = GL_UNSIGNED_BYTE; /* XXX fix! */ + trb->Base.Data = trb->TexImage->Data; + + trb->Base.GetRow = texture_get_row; + trb->Base.GetValues = texture_get_values; + trb->Base.PutRow = texture_put_row; + trb->Base.PutMonoRow = texture_put_mono_row; + trb->Base.PutValues = texture_put_values; + trb->Base.PutMonoValues = texture_put_mono_values; + + trb->Base.Delete = delete_texture_wrapper; + trb->Base.AllocStorage = NULL; /* illegal! */ + + /* XXX fix these */ + if (trb->Base._BaseFormat == GL_DEPTH_COMPONENT) { + trb->Base.ComponentSizes[3] = trb->TexImage->TexFormat->DepthBits; + } + else { + trb->Base.ComponentSizes[0] = trb->TexImage->TexFormat->RedBits; + trb->Base.ComponentSizes[1] = trb->TexImage->TexFormat->GreenBits; + trb->Base.ComponentSizes[2] = trb->TexImage->TexFormat->BlueBits; + trb->Base.ComponentSizes[3] = trb->TexImage->TexFormat->AlphaBits; + } + + att->Renderbuffer = &(trb->Base); +} + + + +/** + * Software fallback for ctx->Driver.RenderbufferTexture. + * This is called via the glRenderbufferTexture1D/2D/3D() functions. + * If we're unbinding a texture, texObj will be NULL. + * The framebuffer of interest is ctx->DrawBuffer. + * \sa _mesa_framebuffer_renderbuffer + */ +void +_mesa_renderbuffer_texture(GLcontext *ctx, + struct gl_renderbuffer_attachment *att, + struct gl_texture_object *texObj, + GLenum texTarget, GLuint level, GLuint zoffset) +{ + if (texObj) { + _mesa_set_texture_attachment(ctx, att, texObj, + texTarget, level, zoffset); + + wrap_texture(ctx, att); + } + else { + _mesa_remove_attachment(ctx, att); + } +} diff --git a/reactos/dll/mesa32/src/main/texrender.h b/reactos/dll/mesa32/src/main/texrender.h new file mode 100644 index 00000000000..6d8bc964141 --- /dev/null +++ b/reactos/dll/mesa32/src/main/texrender.h @@ -0,0 +1,12 @@ +#ifndef TEXRENDER_H +#define TEXRENDER_H + + +extern void +_mesa_renderbuffer_texture(GLcontext *ctx, + struct gl_renderbuffer_attachment *att, + struct gl_texture_object *texObj, + GLenum texTarget, GLuint level, GLuint zoffset); + + +#endif /* TEXRENDER_H */ diff --git a/reactos/dll/mesa32/src/main/texstate.c b/reactos/dll/mesa32/src/main/texstate.c new file mode 100644 index 00000000000..8ac41a27729 --- /dev/null +++ b/reactos/dll/mesa32/src/main/texstate.c @@ -0,0 +1,3271 @@ +/* + * 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 texstate.c + * + * Texture state handling. + */ + +#include "glheader.h" +#include "colormac.h" +#include "colortab.h" +#include "context.h" +#include "enums.h" +#include "extensions.h" +#include "macros.h" +#include "nvfragprog.h" +#include "texobj.h" +#include "teximage.h" +#include "texstate.h" +#include "texenvprogram.h" +#include "mtypes.h" +#include "math/m_xform.h" +#include "math/m_matrix.h" + + + +#ifdef SPECIALCAST +/* Needed for an Amiga compiler */ +#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X)) +#define ENUM_TO_DOUBLE(X) ((GLdouble)(GLint)(X)) +#else +/* all other compilers */ +#define ENUM_TO_FLOAT(X) ((GLfloat)(X)) +#define ENUM_TO_DOUBLE(X) ((GLdouble)(X)) +#endif + +/** + * 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_TEXTURE, GL_PREVIOUS, GL_CONSTANT }, + { GL_SRC_COLOR, GL_SRC_COLOR, GL_SRC_ALPHA }, + { GL_SRC_ALPHA, GL_SRC_ALPHA, GL_SRC_ALPHA }, + 0, 0, + 2, 2 +}; + + +void +_mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) +{ + GLuint i; + + 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 (i = 0; i < src->Const.MaxTextureUnits; i++) { + dst->Texture.Unit[i].Enabled = src->Texture.Unit[i].Enabled; + dst->Texture.Unit[i].EnvMode = src->Texture.Unit[i].EnvMode; + COPY_4V(dst->Texture.Unit[i].EnvColor, src->Texture.Unit[i].EnvColor); + dst->Texture.Unit[i].TexGenEnabled = src->Texture.Unit[i].TexGenEnabled; + dst->Texture.Unit[i].GenModeS = src->Texture.Unit[i].GenModeS; + dst->Texture.Unit[i].GenModeT = src->Texture.Unit[i].GenModeT; + dst->Texture.Unit[i].GenModeR = src->Texture.Unit[i].GenModeR; + dst->Texture.Unit[i].GenModeQ = src->Texture.Unit[i].GenModeQ; + dst->Texture.Unit[i]._GenBitS = src->Texture.Unit[i]._GenBitS; + dst->Texture.Unit[i]._GenBitT = src->Texture.Unit[i]._GenBitT; + dst->Texture.Unit[i]._GenBitR = src->Texture.Unit[i]._GenBitR; + dst->Texture.Unit[i]._GenBitQ = src->Texture.Unit[i]._GenBitQ; + dst->Texture.Unit[i]._GenFlags = src->Texture.Unit[i]._GenFlags; + COPY_4V(dst->Texture.Unit[i].ObjectPlaneS, src->Texture.Unit[i].ObjectPlaneS); + COPY_4V(dst->Texture.Unit[i].ObjectPlaneT, src->Texture.Unit[i].ObjectPlaneT); + COPY_4V(dst->Texture.Unit[i].ObjectPlaneR, src->Texture.Unit[i].ObjectPlaneR); + COPY_4V(dst->Texture.Unit[i].ObjectPlaneQ, src->Texture.Unit[i].ObjectPlaneQ); + COPY_4V(dst->Texture.Unit[i].EyePlaneS, src->Texture.Unit[i].EyePlaneS); + COPY_4V(dst->Texture.Unit[i].EyePlaneT, src->Texture.Unit[i].EyePlaneT); + COPY_4V(dst->Texture.Unit[i].EyePlaneR, src->Texture.Unit[i].EyePlaneR); + COPY_4V(dst->Texture.Unit[i].EyePlaneQ, src->Texture.Unit[i].EyePlaneQ); + dst->Texture.Unit[i].LodBias = src->Texture.Unit[i].LodBias; + + /* GL_EXT_texture_env_combine */ + dst->Texture.Unit[i].Combine.ModeRGB = src->Texture.Unit[i].Combine.ModeRGB; + dst->Texture.Unit[i].Combine.ModeA = src->Texture.Unit[i].Combine.ModeA; + COPY_3V(dst->Texture.Unit[i].Combine.SourceRGB, src->Texture.Unit[i].Combine.SourceRGB); + COPY_3V(dst->Texture.Unit[i].Combine.SourceA, src->Texture.Unit[i].Combine.SourceA); + COPY_3V(dst->Texture.Unit[i].Combine.OperandRGB, src->Texture.Unit[i].Combine.OperandRGB); + COPY_3V(dst->Texture.Unit[i].Combine.OperandA, src->Texture.Unit[i].Combine.OperandA); + dst->Texture.Unit[i].Combine.ScaleShiftRGB = src->Texture.Unit[i].Combine.ScaleShiftRGB; + dst->Texture.Unit[i].Combine.ScaleShiftA = src->Texture.Unit[i].Combine.ScaleShiftA; + + /* texture object state */ + _mesa_copy_texture_object(dst->Texture.Unit[i].Current1D, + src->Texture.Unit[i].Current1D); + _mesa_copy_texture_object(dst->Texture.Unit[i].Current2D, + src->Texture.Unit[i].Current2D); + _mesa_copy_texture_object(dst->Texture.Unit[i].Current3D, + src->Texture.Unit[i].Current3D); + _mesa_copy_texture_object(dst->Texture.Unit[i].CurrentCubeMap, + src->Texture.Unit[i].CurrentCubeMap); + _mesa_copy_texture_object(dst->Texture.Unit[i].CurrentRect, + src->Texture.Unit[i].CurrentRect); + } +} + + +/* + * For debugging + */ +void +_mesa_print_texunit_state( GLcontext *ctx, GLuint unit ) +{ + const struct gl_texture_unit *texUnit = ctx->Texture.Unit + unit; + _mesa_printf("Texture Unit %d\n", unit); + _mesa_printf(" GL_TEXTURE_ENV_MODE = %s\n", _mesa_lookup_enum_by_nr(texUnit->EnvMode)); + _mesa_printf(" GL_COMBINE_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.ModeRGB)); + _mesa_printf(" GL_COMBINE_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.ModeA)); + _mesa_printf(" GL_SOURCE0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[0])); + _mesa_printf(" GL_SOURCE1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[1])); + _mesa_printf(" GL_SOURCE2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[2])); + _mesa_printf(" GL_SOURCE0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[0])); + _mesa_printf(" GL_SOURCE1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[1])); + _mesa_printf(" GL_SOURCE2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[2])); + _mesa_printf(" GL_OPERAND0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[0])); + _mesa_printf(" GL_OPERAND1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[1])); + _mesa_printf(" GL_OPERAND2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[2])); + _mesa_printf(" GL_OPERAND0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[0])); + _mesa_printf(" GL_OPERAND1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[1])); + _mesa_printf(" GL_OPERAND2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[2])); + _mesa_printf(" GL_RGB_SCALE = %d\n", 1 << texUnit->Combine.ScaleShiftRGB); + _mesa_printf(" GL_ALPHA_SCALE = %d\n", 1 << texUnit->Combine.ScaleShiftA); + _mesa_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_RGB: + case GL_YCBCR_MESA: + state->SourceA[0] = GL_PREVIOUS; + break; + + default: + _mesa_problem(NULL, "Invalid texBaseFormat in calculate_derived_texenv"); + return; + } + + 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_RGB: + case GL_YCBCR_MESA: + 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_RGB: + case GL_LUMINANCE_ALPHA: + case GL_RGBA: + case GL_YCBCR_MESA: + 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 in calculate_derived_texenv"); + return; + } + + state->ModeRGB = (state->SourceRGB[0] != GL_PREVIOUS) + ? mode_rgb : GL_REPLACE; + state->ModeA = (state->SourceA[0] != GL_PREVIOUS) + ? mode_a : GL_REPLACE; +} + + +void GLAPIENTRY +_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + ASSERT_OUTSIDE_BEGIN_END(ctx); + +#define TE_ERROR(errCode, msg, value) \ + _mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value)); + + if (target == GL_TEXTURE_ENV) { + switch (pname) { + case GL_TEXTURE_ENV_MODE: + { + const GLenum mode = (GLenum) (GLint) *param; + if (texUnit->EnvMode == mode) + return; + if (mode == GL_MODULATE || + mode == GL_BLEND || + mode == GL_DECAL || + mode == GL_REPLACE || + (mode == GL_ADD && ctx->Extensions.EXT_texture_env_add) || + (mode == GL_COMBINE && + (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine))) { + /* legal */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->EnvMode = mode; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + } + break; + case GL_TEXTURE_ENV_COLOR: + { + GLfloat tmp[4]; + tmp[0] = CLAMP( param[0], 0.0F, 1.0F ); + tmp[1] = CLAMP( param[1], 0.0F, 1.0F ); + tmp[2] = CLAMP( param[2], 0.0F, 1.0F ); + tmp[3] = CLAMP( param[3], 0.0F, 1.0F ); + if (TEST_EQ_4V(tmp, texUnit->EnvColor)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EnvColor, tmp); + } + break; + case GL_COMBINE_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const GLenum mode = (GLenum) (GLint) *param; + if (texUnit->Combine.ModeRGB == mode) + return; + switch (mode) { + case GL_REPLACE: + case GL_MODULATE: + case GL_ADD: + case GL_ADD_SIGNED: + case GL_INTERPOLATE: + /* OK */ + break; + case GL_SUBTRACT: + if (!ctx->Extensions.ARB_texture_env_combine) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + break; + case GL_DOT3_RGB_EXT: + case GL_DOT3_RGBA_EXT: + if (!ctx->Extensions.EXT_texture_env_dot3) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + break; + case GL_DOT3_RGB: + case GL_DOT3_RGBA: + if (!ctx->Extensions.ARB_texture_env_dot3) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + break; + case GL_MODULATE_ADD_ATI: + case GL_MODULATE_SIGNED_ADD_ATI: + case GL_MODULATE_SUBTRACT_ATI: + if (!ctx->Extensions.ATI_texture_env_combine3) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + break; + default: + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.ModeRGB = mode; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_COMBINE_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const GLenum mode = (GLenum) (GLint) *param; + if (texUnit->Combine.ModeA == mode) + return; + switch (mode) { + case GL_REPLACE: + case GL_MODULATE: + case GL_ADD: + case GL_ADD_SIGNED: + case GL_INTERPOLATE: + /* OK */ + break; + case GL_SUBTRACT: + if (!ctx->Extensions.ARB_texture_env_combine) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + break; + case GL_MODULATE_ADD_ATI: + case GL_MODULATE_SIGNED_ADD_ATI: + case GL_MODULATE_SUBTRACT_ATI: + if (!ctx->Extensions.ATI_texture_env_combine3) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + break; + default: + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.ModeA = mode; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + 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 GLenum source = (GLenum) (GLint) *param; + const GLuint s = pname - GL_SOURCE0_RGB; + if (texUnit->Combine.SourceRGB[s] == source) + return; + if (source == GL_TEXTURE || + source == GL_CONSTANT || + source == GL_PRIMARY_COLOR || + source == GL_PREVIOUS || + (ctx->Extensions.ARB_texture_env_crossbar && + source >= GL_TEXTURE0 && + source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) || + (ctx->Extensions.ATI_texture_env_combine3 && + (source == GL_ZERO || source == GL_ONE))) { + /* legal */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.SourceRGB[s] = source; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source); + return; + } + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + 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 GLenum source = (GLenum) (GLint) *param; + const GLuint s = pname - GL_SOURCE0_ALPHA; + if (texUnit->Combine.SourceA[s] == source) + return; + if (source == GL_TEXTURE || + source == GL_CONSTANT || + source == GL_PRIMARY_COLOR || + source == GL_PREVIOUS || + (ctx->Extensions.ARB_texture_env_crossbar && + source >= GL_TEXTURE0 && + source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) || + (ctx->Extensions.ATI_texture_env_combine3 && + (source == GL_ZERO || source == GL_ONE))) { + /* legal */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.SourceA[s] = source; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source); + return; + } + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_OPERAND0_RGB: + case GL_OPERAND1_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const GLenum operand = (GLenum) (GLint) *param; + const GLuint s = pname - GL_OPERAND0_RGB; + if (texUnit->Combine.OperandRGB[s] == operand) + return; + switch (operand) { + case GL_SRC_COLOR: + case GL_ONE_MINUS_SRC_COLOR: + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.OperandRGB[s] = operand; + break; + default: + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); + return; + } + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_OPERAND0_ALPHA: + case GL_OPERAND1_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const GLenum operand = (GLenum) (GLint) *param; + if (texUnit->Combine.OperandA[pname-GL_OPERAND0_ALPHA] == operand) + return; + switch (operand) { + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.OperandA[pname-GL_OPERAND0_ALPHA] = operand; + break; + default: + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); + return; + } + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_OPERAND2_RGB: + if (ctx->Extensions.ARB_texture_env_combine) { + const GLenum operand = (GLenum) (GLint) *param; + if (texUnit->Combine.OperandRGB[2] == operand) + return; + switch (operand) { + case GL_SRC_COLOR: /* ARB combine only */ + case GL_ONE_MINUS_SRC_COLOR: /* ARB combine only */ + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.OperandRGB[2] = operand; + break; + default: + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); + return; + } + } + else if (ctx->Extensions.EXT_texture_env_combine) { + const GLenum operand = (GLenum) (GLint) *param; + if (texUnit->Combine.OperandRGB[2] == operand) + return; + /* operand must be GL_SRC_ALPHA which is the initial value - thus + don't need to actually compare the operand to the possible value */ + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); + return; + } + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_OPERAND2_ALPHA: + if (ctx->Extensions.ARB_texture_env_combine) { + const GLenum operand = (GLenum) (GLint) *param; + if (texUnit->Combine.OperandA[2] == operand) + return; + switch (operand) { + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.OperandA[2] = operand; + break; + default: + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); + return; + } + } + else if (ctx->Extensions.EXT_texture_env_combine) { + const GLenum operand = (GLenum) (GLint) *param; + if (texUnit->Combine.OperandA[2] == operand) + return; + /* operand must be GL_SRC_ALPHA which is the initial value - thus + don't need to actually compare the operand to the possible value */ + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); + return; + } + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_RGB_SCALE: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + GLuint newshift; + if (*param == 1.0) { + newshift = 0; + } + else if (*param == 2.0) { + newshift = 1; + } + else if (*param == 4.0) { + newshift = 2; + } + else { + _mesa_error( ctx, GL_INVALID_VALUE, + "glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" ); + return; + } + if (texUnit->Combine.ScaleShiftRGB == newshift) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.ScaleShiftRGB = newshift; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_ALPHA_SCALE: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + GLuint newshift; + if (*param == 1.0) { + newshift = 0; + } + else if (*param == 2.0) { + newshift = 1; + } + else if (*param == 4.0) { + newshift = 2; + } + else { + _mesa_error( ctx, GL_INVALID_VALUE, + "glTexEnv(GL_ALPHA_SCALE not 1, 2 or 4)" ); + return; + } + if (texUnit->Combine.ScaleShiftA == newshift) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.ScaleShiftA = newshift; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + 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 ) +{ + _mesa_TexEnvfv( target, pname, ¶m ); +} + + + +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 ); +} + + +void GLAPIENTRY +_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target == GL_TEXTURE_ENV) { + switch (pname) { + case GL_TEXTURE_ENV_MODE: + *params = ENUM_TO_FLOAT(texUnit->EnvMode); + break; + case GL_TEXTURE_ENV_COLOR: + COPY_4FV( params, texUnit->EnvColor ); + break; + case GL_COMBINE_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) 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) { + *params = (GLfloat) texUnit->Combine.ModeA; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_SOURCE0_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) texUnit->Combine.SourceRGB[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_SOURCE1_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) texUnit->Combine.SourceRGB[1]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_SOURCE2_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) texUnit->Combine.SourceRGB[2]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_SOURCE0_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) texUnit->Combine.SourceA[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_SOURCE1_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) texUnit->Combine.SourceA[1]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_SOURCE2_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) texUnit->Combine.SourceA[2]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_OPERAND0_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) texUnit->Combine.OperandRGB[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_OPERAND1_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) texUnit->Combine.OperandRGB[1]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_OPERAND2_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) texUnit->Combine.OperandRGB[2]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_OPERAND0_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) texUnit->Combine.OperandA[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_OPERAND1_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) texUnit->Combine.OperandA[1]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_OPERAND2_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) texUnit->Combine.OperandA[2]; + } + 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) { + if (texUnit->Combine.ScaleShiftRGB == 0) + *params = 1.0; + else if (texUnit->Combine.ScaleShiftRGB == 1) + *params = 2.0; + else + *params = 4.0; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + return; + } + break; + case GL_ALPHA_SCALE: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + if (texUnit->Combine.ScaleShiftA == 0) + *params = 1.0; + else if (texUnit->Combine.ScaleShiftA == 1) + *params = 2.0; + else + *params = 4.0; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + return; + } + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname=0x%x)", pname); + } + } + 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 ) +{ + GET_CURRENT_CONTEXT(ctx); + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target == GL_TEXTURE_ENV) { + switch (pname) { + case GL_TEXTURE_ENV_MODE: + *params = (GLint) texUnit->EnvMode; + break; + case 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] ); + break; + case GL_COMBINE_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.ModeRGB; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_COMBINE_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.ModeA; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_SOURCE0_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.SourceRGB[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_SOURCE1_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.SourceRGB[1]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_SOURCE2_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.SourceRGB[2]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_SOURCE0_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.SourceA[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_SOURCE1_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.SourceA[1]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_SOURCE2_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.SourceA[2]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_OPERAND0_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.OperandRGB[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_OPERAND1_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.OperandRGB[1]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_OPERAND2_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.OperandRGB[2]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_OPERAND0_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.OperandA[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_OPERAND1_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.OperandA[1]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_OPERAND2_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.OperandA[2]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_RGB_SCALE: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + if (texUnit->Combine.ScaleShiftRGB == 0) + *params = 1; + else if (texUnit->Combine.ScaleShiftRGB == 1) + *params = 2; + else + *params = 4; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + return; + } + break; + case GL_ALPHA_SCALE: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + if (texUnit->Combine.ScaleShiftA == 0) + *params = 1; + else if (texUnit->Combine.ScaleShiftA == 1) + *params = 2; + else + *params = 4; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + return; + } + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname=0x%x)", + pname); + } + } + 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; + } +} + + + + +/**********************************************************************/ +/* Texture Parameters */ +/**********************************************************************/ + +static GLboolean +_mesa_validate_texture_wrap_mode(GLcontext * ctx, + GLenum target, GLenum eparam) +{ + const struct gl_extensions * const e = & ctx->Extensions; + + if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || + (eparam == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp)) { + /* any texture target */ + return GL_TRUE; + } + else if (target != GL_TEXTURE_RECTANGLE_NV && + (eparam == GL_REPEAT || + (eparam == GL_MIRRORED_REPEAT && + e->ARB_texture_mirrored_repeat) || + (eparam == GL_MIRROR_CLAMP_EXT && + (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) || + (eparam == GL_MIRROR_CLAMP_TO_EDGE_EXT && + (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) || + (eparam == GL_MIRROR_CLAMP_TO_BORDER_EXT && + (e->EXT_texture_mirror_clamp)))) { + /* non-rectangle texture */ + return GL_TRUE; + } + + _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return GL_FALSE; +} + + +void GLAPIENTRY +_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param ) +{ + _mesa_TexParameterfv(target, pname, ¶m); +} + + +void GLAPIENTRY +_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + GLenum eparam = (GLenum) (GLint) params[0]; + struct gl_texture_object *texObj; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexParameter %s %s %.1f(%s)...\n", + _mesa_lookup_enum_by_nr(target), + _mesa_lookup_enum_by_nr(pname), + *params, + _mesa_lookup_enum_by_nr(eparam)); + + + switch (target) { + case GL_TEXTURE_1D: + texObj = texUnit->Current1D; + break; + case GL_TEXTURE_2D: + texObj = texUnit->Current2D; + break; + case GL_TEXTURE_3D: + texObj = texUnit->Current3D; + break; + case GL_TEXTURE_CUBE_MAP: + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); + return; + } + texObj = texUnit->CurrentCubeMap; + break; + case GL_TEXTURE_RECTANGLE_NV: + if (!ctx->Extensions.NV_texture_rectangle) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); + return; + } + texObj = texUnit->CurrentRect; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); + return; + } + + switch (pname) { + case GL_TEXTURE_MIN_FILTER: + /* A small optimization */ + if (texObj->MinFilter == eparam) + return; + if (eparam==GL_NEAREST || eparam==GL_LINEAR) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->MinFilter = eparam; + } + else if ((eparam==GL_NEAREST_MIPMAP_NEAREST || + eparam==GL_LINEAR_MIPMAP_NEAREST || + eparam==GL_NEAREST_MIPMAP_LINEAR || + eparam==GL_LINEAR_MIPMAP_LINEAR) && + texObj->Target != GL_TEXTURE_RECTANGLE_NV) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->MinFilter = eparam; + } + else { + _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return; + } + break; + case GL_TEXTURE_MAG_FILTER: + /* A small optimization */ + if (texObj->MagFilter == eparam) + return; + + if (eparam==GL_NEAREST || eparam==GL_LINEAR) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->MagFilter = eparam; + } + else { + _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return; + } + break; + case GL_TEXTURE_WRAP_S: + if (texObj->WrapS == eparam) + return; + if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->WrapS = eparam; + } + else { + return; + } + break; + case GL_TEXTURE_WRAP_T: + if (texObj->WrapT == eparam) + return; + if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->WrapT = eparam; + } + else { + return; + } + break; + case GL_TEXTURE_WRAP_R: + if (texObj->WrapR == eparam) + return; + if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->WrapR = eparam; + } + else { + return; + } + break; + case GL_TEXTURE_BORDER_COLOR: + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->BorderColor[RCOMP] = params[0]; + texObj->BorderColor[GCOMP] = params[1]; + texObj->BorderColor[BCOMP] = params[2]; + texObj->BorderColor[ACOMP] = params[3]; + UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[RCOMP], params[0]); + UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[GCOMP], params[1]); + UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[BCOMP], params[2]); + UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[ACOMP], params[3]); + break; + case GL_TEXTURE_MIN_LOD: + if (texObj->MinLod == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->MinLod = params[0]; + break; + case GL_TEXTURE_MAX_LOD: + if (texObj->MaxLod == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->MaxLod = params[0]; + break; + case GL_TEXTURE_BASE_LEVEL: + if (params[0] < 0.0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return; + } + if (target == GL_TEXTURE_RECTANGLE_NV && params[0] != 0.0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return; + } + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->BaseLevel = (GLint) params[0]; + break; + case GL_TEXTURE_MAX_LEVEL: + if (params[0] < 0.0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return; + } + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->MaxLevel = (GLint) params[0]; + break; + case GL_TEXTURE_PRIORITY: + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->Priority = CLAMP( params[0], 0.0F, 1.0F ); + break; + case GL_TEXTURE_MAX_ANISOTROPY_EXT: + if (ctx->Extensions.EXT_texture_filter_anisotropic) { + if (params[0] < 1.0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return; + } + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + /* clamp to max, that's what NVIDIA does */ + texObj->MaxAnisotropy = MIN2(params[0], + ctx->Const.MaxTextureMaxAnisotropy); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)"); + return; + } + break; + case GL_TEXTURE_COMPARE_SGIX: + if (ctx->Extensions.SGIX_shadow) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->CompareFlag = params[0] ? GL_TRUE : GL_FALSE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_COMPARE_SGIX)"); + return; + } + break; + case GL_TEXTURE_COMPARE_OPERATOR_SGIX: + if (ctx->Extensions.SGIX_shadow) { + GLenum op = (GLenum) params[0]; + if (op == GL_TEXTURE_LEQUAL_R_SGIX || + op == GL_TEXTURE_GEQUAL_R_SGIX) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->CompareOperator = op; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)"); + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_COMPARE_OPERATOR_SGIX)"); + return; + } + break; + case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + if (ctx->Extensions.SGIX_shadow_ambient) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->ShadowAmbient = CLAMP(params[0], 0.0F, 1.0F); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_SHADOW_AMBIENT_SGIX)"); + return; + } + break; + case GL_GENERATE_MIPMAP_SGIS: + if (ctx->Extensions.SGIS_generate_mipmap) { + texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_GENERATE_MIPMAP_SGIS)"); + return; + } + break; + case GL_TEXTURE_COMPARE_MODE_ARB: + if (ctx->Extensions.ARB_shadow) { + const GLenum mode = (GLenum) params[0]; + if (mode == GL_NONE || mode == GL_COMPARE_R_TO_TEXTURE_ARB) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->CompareMode = mode; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(bad GL_TEXTURE_COMPARE_MODE_ARB: 0x%x)", mode); + return; + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_COMPARE_MODE_ARB)"); + return; + } + break; + case GL_TEXTURE_COMPARE_FUNC_ARB: + if (ctx->Extensions.ARB_shadow) { + const GLenum func = (GLenum) params[0]; + if (func == GL_LEQUAL || func == GL_GEQUAL) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->CompareFunc = func; + } + else if (ctx->Extensions.EXT_shadow_funcs && + (func == GL_EQUAL || + func == GL_NOTEQUAL || + func == GL_LESS || + func == GL_GREATER || + func == GL_ALWAYS || + func == GL_NEVER)) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->CompareFunc = func; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(bad GL_TEXTURE_COMPARE_FUNC_ARB)"); + return; + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_COMPARE_FUNC_ARB)"); + return; + } + break; + case GL_DEPTH_TEXTURE_MODE_ARB: + if (ctx->Extensions.ARB_depth_texture) { + const GLenum result = (GLenum) params[0]; + if (result == GL_LUMINANCE || result == GL_INTENSITY + || result == GL_ALPHA) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->DepthMode = result; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(bad GL_DEPTH_TEXTURE_MODE_ARB)"); + return; + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_DEPTH_TEXTURE_MODE_ARB)"); + return; + } + break; + 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_VERTICES(ctx, _NEW_TEXTURE); + texObj->LodBias = params[0]; + } + } + break; + + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=0x%x)", pname); + return; + } + + texObj->Complete = GL_FALSE; + + if (ctx->Driver.TexParameter) { + (*ctx->Driver.TexParameter)( ctx, target, texObj, pname, params ); + } +} + + +void GLAPIENTRY +_mesa_TexParameteri( GLenum target, GLenum pname, GLint param ) +{ + GLfloat fparam[4]; + if (pname == GL_TEXTURE_PRIORITY) + fparam[0] = INT_TO_FLOAT(param); + else + fparam[0] = (GLfloat) param; + fparam[1] = fparam[2] = fparam[3] = 0.0; + _mesa_TexParameterfv(target, pname, fparam); +} + + +void GLAPIENTRY +_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ) +{ + GLfloat fparam[4]; + if (pname == GL_TEXTURE_BORDER_COLOR) { + 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]); + } + else { + if (pname == GL_TEXTURE_PRIORITY) + fparam[0] = INT_TO_FLOAT(params[0]); + else + fparam[0] = (GLfloat) params[0]; + fparam[1] = fparam[2] = fparam[3] = 0.0F; + } + _mesa_TexParameterfv(target, pname, fparam); +} + + +void GLAPIENTRY +_mesa_GetTexLevelParameterfv( GLenum target, GLint level, + GLenum pname, GLfloat *params ) +{ + GLint iparam; + _mesa_GetTexLevelParameteriv( target, level, pname, &iparam ); + *params = (GLfloat) iparam; +} + + +static GLuint +tex_image_dimensions(GLcontext *ctx, GLenum target) +{ + switch (target) { + case GL_TEXTURE_1D: + case GL_PROXY_TEXTURE_1D: + return 1; + case GL_TEXTURE_2D: + case GL_PROXY_TEXTURE_2D: + return 2; + case GL_TEXTURE_3D: + case GL_PROXY_TEXTURE_3D: + return 3; + case GL_TEXTURE_CUBE_MAP: + 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 ? 2 : 0; + case GL_TEXTURE_RECTANGLE_NV: + case GL_PROXY_TEXTURE_RECTANGLE_NV: + return ctx->Extensions.NV_texture_rectangle ? 2 : 0; + default: + _mesa_problem(ctx, "bad target in _mesa_tex_target_dimensions()"); + return 0; + } +} + + +void GLAPIENTRY +_mesa_GetTexLevelParameteriv( GLenum target, GLint level, + GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + const struct gl_texture_image *img = NULL; + GLuint dimensions; + GLboolean isProxy; + GLint maxLevels; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + /* this will catch bad target values */ + dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */ + if (dimensions == 0) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)"); + return; + } + + switch (target) { + case GL_TEXTURE_1D: + case GL_PROXY_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_PROXY_TEXTURE_2D: + maxLevels = ctx->Const.MaxTextureLevels; + break; + case GL_TEXTURE_3D: + case GL_PROXY_TEXTURE_3D: + maxLevels = ctx->Const.Max3DTextureLevels; + break; + 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_PROXY_TEXTURE_CUBE_MAP: + maxLevels = ctx->Const.MaxCubeTextureLevels; + break; + case GL_TEXTURE_RECTANGLE_NV: + case GL_PROXY_TEXTURE_RECTANGLE_NV: + maxLevels = 1; + break; + default: + _mesa_problem(ctx, "switch in _mesa_GetTexLevelParameter"); + return; + } + + if (level < 0 || level >= maxLevels) { + _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" ); + return; + } + + img = _mesa_select_tex_image(ctx, texUnit, target, level); + if (!img || !img->TexFormat) { + /* undefined texture image */ + if (pname == GL_TEXTURE_COMPONENTS) + *params = 1; + else + *params = 0; + return; + } + + isProxy = (target == GL_PROXY_TEXTURE_1D) || + (target == GL_PROXY_TEXTURE_2D) || + (target == GL_PROXY_TEXTURE_3D) || + (target == GL_PROXY_TEXTURE_CUBE_MAP) || + (target == GL_PROXY_TEXTURE_RECTANGLE_NV); + + switch (pname) { + case GL_TEXTURE_WIDTH: + *params = img->Width; + return; + case GL_TEXTURE_HEIGHT: + *params = img->Height; + return; + case GL_TEXTURE_DEPTH: + *params = img->Depth; + return; + case GL_TEXTURE_INTERNAL_FORMAT: + *params = img->IntFormat; + return; + case GL_TEXTURE_BORDER: + *params = img->Border; + return; + case GL_TEXTURE_RED_SIZE: + if (img->Format == GL_RGB || img->Format == GL_RGBA) + *params = img->TexFormat->RedBits; + else + *params = 0; + return; + case GL_TEXTURE_GREEN_SIZE: + if (img->Format == GL_RGB || img->Format == GL_RGBA) + *params = img->TexFormat->GreenBits; + else + *params = 0; + return; + case GL_TEXTURE_BLUE_SIZE: + if (img->Format == GL_RGB || img->Format == GL_RGBA) + *params = img->TexFormat->BlueBits; + else + *params = 0; + return; + case GL_TEXTURE_ALPHA_SIZE: + if (img->Format == GL_ALPHA || img->Format == GL_LUMINANCE_ALPHA || + img->Format == GL_RGBA) + *params = img->TexFormat->AlphaBits; + else + *params = 0; + return; + case GL_TEXTURE_INTENSITY_SIZE: + if (img->Format != GL_INTENSITY) + *params = 0; + else if (img->TexFormat->IntensityBits > 0) + *params = img->TexFormat->IntensityBits; + else /* intensity probably stored as rgb texture */ + *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); + return; + case GL_TEXTURE_LUMINANCE_SIZE: + if (img->Format != GL_LUMINANCE && + img->Format != GL_LUMINANCE_ALPHA) + *params = 0; + else if (img->TexFormat->LuminanceBits > 0) + *params = img->TexFormat->LuminanceBits; + else /* luminance probably stored as rgb texture */ + *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); + return; + case GL_TEXTURE_INDEX_SIZE_EXT: + if (img->Format == GL_COLOR_INDEX) + *params = img->TexFormat->IndexBits; + else + *params = 0; + return; + case GL_TEXTURE_DEPTH_SIZE_ARB: + if (ctx->Extensions.SGIX_depth_texture || + ctx->Extensions.ARB_depth_texture) + *params = img->TexFormat->DepthBits; + else + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + return; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: + if (ctx->Extensions.ARB_texture_compression) { + if (img->IsCompressed && !isProxy) + *params = img->CompressedSize; + else + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetTexLevelParameter[if]v(pname)"); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + return; + case GL_TEXTURE_COMPRESSED: + if (ctx->Extensions.ARB_texture_compression) { + *params = (GLint) img->IsCompressed; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + return; + + /* GL_ARB_texture_float */ + case GL_TEXTURE_RED_TYPE_ARB: + if (ctx->Extensions.ARB_texture_float) { + *params = img->TexFormat->RedBits ? img->TexFormat->DataType : GL_NONE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + return; + case GL_TEXTURE_GREEN_TYPE_ARB: + if (ctx->Extensions.ARB_texture_float) { + *params = img->TexFormat->GreenBits ? img->TexFormat->DataType : GL_NONE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + return; + case GL_TEXTURE_BLUE_TYPE_ARB: + if (ctx->Extensions.ARB_texture_float) { + *params = img->TexFormat->BlueBits ? img->TexFormat->DataType : GL_NONE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + return; + case GL_TEXTURE_ALPHA_TYPE_ARB: + if (ctx->Extensions.ARB_texture_float) { + *params = img->TexFormat->AlphaBits ? img->TexFormat->DataType : GL_NONE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + return; + case GL_TEXTURE_LUMINANCE_TYPE_ARB: + if (ctx->Extensions.ARB_texture_float) { + *params = img->TexFormat->LuminanceBits ? img->TexFormat->DataType : GL_NONE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + return; + case GL_TEXTURE_INTENSITY_TYPE_ARB: + if (ctx->Extensions.ARB_texture_float) { + *params = img->TexFormat->IntensityBits ? img->TexFormat->DataType : GL_NONE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + return; + case GL_TEXTURE_DEPTH_TYPE_ARB: + if (ctx->Extensions.ARB_texture_float) { + *params = img->TexFormat->DepthBits ? img->TexFormat->DataType : GL_NONE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + return; + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } +} + + + +void GLAPIENTRY +_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_object *obj; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + obj = _mesa_select_tex_object(ctx, texUnit, target); + if (!obj) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)"); + return; + } + + switch (pname) { + case GL_TEXTURE_MAG_FILTER: + *params = ENUM_TO_FLOAT(obj->MagFilter); + return; + case GL_TEXTURE_MIN_FILTER: + *params = ENUM_TO_FLOAT(obj->MinFilter); + return; + case GL_TEXTURE_WRAP_S: + *params = ENUM_TO_FLOAT(obj->WrapS); + return; + case GL_TEXTURE_WRAP_T: + *params = ENUM_TO_FLOAT(obj->WrapT); + return; + case GL_TEXTURE_WRAP_R: + *params = ENUM_TO_FLOAT(obj->WrapR); + return; + case GL_TEXTURE_BORDER_COLOR: + params[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F); + params[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F); + params[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F); + params[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F); + return; + 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); + } + return; + case GL_TEXTURE_PRIORITY: + *params = obj->Priority; + return; + case GL_TEXTURE_MIN_LOD: + *params = obj->MinLod; + return; + case GL_TEXTURE_MAX_LOD: + *params = obj->MaxLod; + return; + case GL_TEXTURE_BASE_LEVEL: + *params = (GLfloat) obj->BaseLevel; + return; + case GL_TEXTURE_MAX_LEVEL: + *params = (GLfloat) obj->MaxLevel; + return; + case GL_TEXTURE_MAX_ANISOTROPY_EXT: + if (ctx->Extensions.EXT_texture_filter_anisotropic) { + *params = obj->MaxAnisotropy; + return; + } + break; + case GL_TEXTURE_COMPARE_SGIX: + if (ctx->Extensions.SGIX_shadow) { + *params = (GLfloat) obj->CompareFlag; + return; + } + break; + case GL_TEXTURE_COMPARE_OPERATOR_SGIX: + if (ctx->Extensions.SGIX_shadow) { + *params = (GLfloat) obj->CompareOperator; + return; + } + break; + case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + if (ctx->Extensions.SGIX_shadow_ambient) { + *params = obj->ShadowAmbient; + return; + } + break; + case GL_GENERATE_MIPMAP_SGIS: + if (ctx->Extensions.SGIS_generate_mipmap) { + *params = (GLfloat) obj->GenerateMipmap; + return; + } + break; + case GL_TEXTURE_COMPARE_MODE_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLfloat) obj->CompareMode; + return; + } + break; + case GL_TEXTURE_COMPARE_FUNC_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLfloat) obj->CompareFunc; + return; + } + break; + case GL_DEPTH_TEXTURE_MODE_ARB: + if (ctx->Extensions.ARB_depth_texture) { + *params = (GLfloat) obj->DepthMode; + return; + } + break; + case GL_TEXTURE_LOD_BIAS: + if (ctx->Extensions.EXT_texture_lod_bias) { + *params = obj->LodBias; + return; + } + break; + default: + ; /* silence warnings */ + } + /* If we get here, pname was an unrecognized enum */ + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname=0x%x)", + pname); +} + + +void GLAPIENTRY +_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_object *obj; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + obj = _mesa_select_tex_object(ctx, texUnit, target); + if (!obj) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)"); + return; + } + + switch (pname) { + case GL_TEXTURE_MAG_FILTER: + *params = (GLint) obj->MagFilter; + return; + case GL_TEXTURE_MIN_FILTER: + *params = (GLint) obj->MinFilter; + return; + case GL_TEXTURE_WRAP_S: + *params = (GLint) obj->WrapS; + return; + case GL_TEXTURE_WRAP_T: + *params = (GLint) obj->WrapT; + return; + case GL_TEXTURE_WRAP_R: + *params = (GLint) obj->WrapR; + return; + case GL_TEXTURE_BORDER_COLOR: + { + GLfloat b[4]; + b[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F); + b[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F); + b[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F); + b[3] = CLAMP(obj->BorderColor[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]); + } + return; + case GL_TEXTURE_RESIDENT: + { + GLboolean resident; + if (ctx->Driver.IsTextureResident) + resident = ctx->Driver.IsTextureResident(ctx, obj); + else + resident = GL_TRUE; + *params = (GLint) resident; + } + return; + case GL_TEXTURE_PRIORITY: + *params = FLOAT_TO_INT(obj->Priority); + return; + case GL_TEXTURE_MIN_LOD: + *params = (GLint) obj->MinLod; + return; + case GL_TEXTURE_MAX_LOD: + *params = (GLint) obj->MaxLod; + return; + case GL_TEXTURE_BASE_LEVEL: + *params = obj->BaseLevel; + return; + case GL_TEXTURE_MAX_LEVEL: + *params = obj->MaxLevel; + return; + case GL_TEXTURE_MAX_ANISOTROPY_EXT: + if (ctx->Extensions.EXT_texture_filter_anisotropic) { + *params = (GLint) obj->MaxAnisotropy; + return; + } + break; + case GL_TEXTURE_COMPARE_SGIX: + if (ctx->Extensions.SGIX_shadow) { + *params = (GLint) obj->CompareFlag; + return; + } + break; + case GL_TEXTURE_COMPARE_OPERATOR_SGIX: + if (ctx->Extensions.SGIX_shadow) { + *params = (GLint) obj->CompareOperator; + return; + } + break; + case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + if (ctx->Extensions.SGIX_shadow_ambient) { + *params = (GLint) FLOAT_TO_INT(obj->ShadowAmbient); + return; + } + break; + case GL_GENERATE_MIPMAP_SGIS: + if (ctx->Extensions.SGIS_generate_mipmap) { + *params = (GLint) obj->GenerateMipmap; + return; + } + break; + case GL_TEXTURE_COMPARE_MODE_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLint) obj->CompareMode; + return; + } + break; + case GL_TEXTURE_COMPARE_FUNC_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLint) obj->CompareFunc; + return; + } + break; + case GL_DEPTH_TEXTURE_MODE_ARB: + if (ctx->Extensions.ARB_depth_texture) { + *params = (GLint) obj->DepthMode; + return; + } + break; + case GL_TEXTURE_LOD_BIAS: + if (ctx->Extensions.EXT_texture_lod_bias) { + *params = (GLint) obj->LodBias; + return; + } + break; + default: + ; /* silence warnings */ + } + /* If we get here, pname was an unrecognized enum */ + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname=0x%x)", pname); +} + + + + +/**********************************************************************/ +/* Texture Coord Generation */ +/**********************************************************************/ + +#if FEATURE_texgen +void GLAPIENTRY +_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint tUnit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; + 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)); + + switch (coord) { + case GL_S: + if (pname==GL_TEXTURE_GEN_MODE) { + GLenum mode = (GLenum) (GLint) *params; + GLuint bits; + switch (mode) { + case GL_OBJECT_LINEAR: + bits = TEXGEN_OBJ_LINEAR; + break; + case GL_EYE_LINEAR: + bits = TEXGEN_EYE_LINEAR; + break; + case GL_REFLECTION_MAP_NV: + bits = TEXGEN_REFLECTION_MAP_NV; + break; + case GL_NORMAL_MAP_NV: + bits = TEXGEN_NORMAL_MAP_NV; + break; + case GL_SPHERE_MAP: + bits = TEXGEN_SPHERE_MAP; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); + return; + } + if (texUnit->GenModeS == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->GenModeS = mode; + texUnit->_GenBitS = bits; + } + else if (pname==GL_OBJECT_PLANE) { + if (TEST_EQ_4V(texUnit->ObjectPlaneS, params)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->ObjectPlaneS[0] = params[0]; + texUnit->ObjectPlaneS[1] = params[1]; + texUnit->ObjectPlaneS[2] = params[2]; + texUnit->ObjectPlaneS[3] = params[3]; + } + else if (pname==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(texUnit->EyePlaneS, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EyePlaneS, tmp); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); + return; + } + break; + case GL_T: + if (pname==GL_TEXTURE_GEN_MODE) { + GLenum mode = (GLenum) (GLint) *params; + GLuint bitt; + switch (mode) { + case GL_OBJECT_LINEAR: + bitt = TEXGEN_OBJ_LINEAR; + break; + case GL_EYE_LINEAR: + bitt = TEXGEN_EYE_LINEAR; + break; + case GL_REFLECTION_MAP_NV: + bitt = TEXGEN_REFLECTION_MAP_NV; + break; + case GL_NORMAL_MAP_NV: + bitt = TEXGEN_NORMAL_MAP_NV; + break; + case GL_SPHERE_MAP: + bitt = TEXGEN_SPHERE_MAP; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); + return; + } + if (texUnit->GenModeT == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->GenModeT = mode; + texUnit->_GenBitT = bitt; + } + else if (pname==GL_OBJECT_PLANE) { + if (TEST_EQ_4V(texUnit->ObjectPlaneT, params)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->ObjectPlaneT[0] = params[0]; + texUnit->ObjectPlaneT[1] = params[1]; + texUnit->ObjectPlaneT[2] = params[2]; + texUnit->ObjectPlaneT[3] = params[3]; + } + else if (pname==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(texUnit->EyePlaneT, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EyePlaneT, tmp); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); + return; + } + break; + case GL_R: + if (pname==GL_TEXTURE_GEN_MODE) { + GLenum mode = (GLenum) (GLint) *params; + GLuint bitr; + switch (mode) { + case GL_OBJECT_LINEAR: + bitr = TEXGEN_OBJ_LINEAR; + break; + case GL_REFLECTION_MAP_NV: + bitr = TEXGEN_REFLECTION_MAP_NV; + break; + case GL_NORMAL_MAP_NV: + bitr = TEXGEN_NORMAL_MAP_NV; + break; + case GL_EYE_LINEAR: + bitr = TEXGEN_EYE_LINEAR; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); + return; + } + if (texUnit->GenModeR == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->GenModeR = mode; + texUnit->_GenBitR = bitr; + } + else if (pname==GL_OBJECT_PLANE) { + if (TEST_EQ_4V(texUnit->ObjectPlaneR, params)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->ObjectPlaneR[0] = params[0]; + texUnit->ObjectPlaneR[1] = params[1]; + texUnit->ObjectPlaneR[2] = params[2]; + texUnit->ObjectPlaneR[3] = params[3]; + } + else if (pname==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(texUnit->EyePlaneR, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EyePlaneR, tmp); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); + return; + } + break; + case GL_Q: + if (pname==GL_TEXTURE_GEN_MODE) { + GLenum mode = (GLenum) (GLint) *params; + GLuint bitq; + switch (mode) { + case GL_OBJECT_LINEAR: + bitq = TEXGEN_OBJ_LINEAR; + break; + case GL_EYE_LINEAR: + bitq = TEXGEN_EYE_LINEAR; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); + return; + } + if (texUnit->GenModeQ == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->GenModeQ = mode; + texUnit->_GenBitQ = bitq; + } + else if (pname==GL_OBJECT_PLANE) { + if (TEST_EQ_4V(texUnit->ObjectPlaneQ, params)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->ObjectPlaneQ[0] = params[0]; + texUnit->ObjectPlaneQ[1] = params[1]; + texUnit->ObjectPlaneQ[2] = params[2]; + texUnit->ObjectPlaneQ[3] = params[3]; + } + else if (pname==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(texUnit->EyePlaneQ, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EyePlaneQ, tmp); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); + return; + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(coord)" ); + return; + } + + if (ctx->Driver.TexGen) + ctx->Driver.TexGen( ctx, coord, pname, params ); +} + + +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); +} + + +void GLAPIENTRY +_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) +{ + GLfloat p = (GLfloat) param; + _mesa_TexGenfv( coord, pname, &p ); +} + + +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 ) +{ + _mesa_TexGenfv(coord, pname, ¶m); +} + + +void GLAPIENTRY +_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) +{ + _mesa_TexGeniv( coord, pname, ¶m ); +} + + + +void GLAPIENTRY +_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint tUnit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (coord) { + case GL_S: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_DOUBLE(texUnit->GenModeS); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneS ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneS ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); + return; + } + break; + case GL_T: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_DOUBLE(texUnit->GenModeT); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneT ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneT ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); + return; + } + break; + case GL_R: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_DOUBLE(texUnit->GenModeR); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneR ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneR ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); + return; + } + break; + case GL_Q: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_DOUBLE(texUnit->GenModeQ); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneQ ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneQ ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); + return; + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)" ); + return; + } +} + + + +void GLAPIENTRY +_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint tUnit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (coord) { + case GL_S: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_FLOAT(texUnit->GenModeS); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneS ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneS ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); + return; + } + break; + case GL_T: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_FLOAT(texUnit->GenModeT); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneT ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneT ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); + return; + } + break; + case GL_R: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_FLOAT(texUnit->GenModeR); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneR ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneR ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); + return; + } + break; + case GL_Q: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_FLOAT(texUnit->GenModeQ); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneQ ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneQ ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); + return; + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)" ); + return; + } +} + + + +void GLAPIENTRY +_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint tUnit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (coord) { + case GL_S: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = texUnit->GenModeS; + } + else if (pname==GL_OBJECT_PLANE) { + params[0] = (GLint) texUnit->ObjectPlaneS[0]; + params[1] = (GLint) texUnit->ObjectPlaneS[1]; + params[2] = (GLint) texUnit->ObjectPlaneS[2]; + params[3] = (GLint) texUnit->ObjectPlaneS[3]; + } + else if (pname==GL_EYE_PLANE) { + params[0] = (GLint) texUnit->EyePlaneS[0]; + params[1] = (GLint) texUnit->EyePlaneS[1]; + params[2] = (GLint) texUnit->EyePlaneS[2]; + params[3] = (GLint) texUnit->EyePlaneS[3]; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); + return; + } + break; + case GL_T: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = texUnit->GenModeT; + } + else if (pname==GL_OBJECT_PLANE) { + params[0] = (GLint) texUnit->ObjectPlaneT[0]; + params[1] = (GLint) texUnit->ObjectPlaneT[1]; + params[2] = (GLint) texUnit->ObjectPlaneT[2]; + params[3] = (GLint) texUnit->ObjectPlaneT[3]; + } + else if (pname==GL_EYE_PLANE) { + params[0] = (GLint) texUnit->EyePlaneT[0]; + params[1] = (GLint) texUnit->EyePlaneT[1]; + params[2] = (GLint) texUnit->EyePlaneT[2]; + params[3] = (GLint) texUnit->EyePlaneT[3]; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); + return; + } + break; + case GL_R: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = texUnit->GenModeR; + } + else if (pname==GL_OBJECT_PLANE) { + params[0] = (GLint) texUnit->ObjectPlaneR[0]; + params[1] = (GLint) texUnit->ObjectPlaneR[1]; + params[2] = (GLint) texUnit->ObjectPlaneR[2]; + params[3] = (GLint) texUnit->ObjectPlaneR[3]; + } + else if (pname==GL_EYE_PLANE) { + params[0] = (GLint) texUnit->EyePlaneR[0]; + params[1] = (GLint) texUnit->EyePlaneR[1]; + params[2] = (GLint) texUnit->EyePlaneR[2]; + params[3] = (GLint) texUnit->EyePlaneR[3]; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); + return; + } + break; + case GL_Q: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = texUnit->GenModeQ; + } + else if (pname==GL_OBJECT_PLANE) { + params[0] = (GLint) texUnit->ObjectPlaneQ[0]; + params[1] = (GLint) texUnit->ObjectPlaneQ[1]; + params[2] = (GLint) texUnit->ObjectPlaneQ[2]; + params[3] = (GLint) texUnit->ObjectPlaneQ[3]; + } + else if (pname==GL_EYE_PLANE) { + params[0] = (GLint) texUnit->EyePlaneQ[0]; + params[1] = (GLint) texUnit->EyePlaneQ[1]; + params[2] = (GLint) texUnit->EyePlaneQ[2]; + params[3] = (GLint) texUnit->EyePlaneQ[3]; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); + return; + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)" ); + return; + } +} +#endif + +/* GL_ARB_multitexture */ +void GLAPIENTRY +_mesa_ActiveTextureARB( GLenum target ) +{ + GET_CURRENT_CONTEXT(ctx); + const GLuint texUnit = target - GL_TEXTURE0; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glActiveTexture %s\n", + _mesa_lookup_enum_by_nr(target)); + + /* Cater for texture unit 0 is first, therefore use >= */ + if (texUnit >= ctx->Const.MaxTextureUnits) { + _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(target)"); + 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]; + } + + if (ctx->Driver.ActiveTexture) { + (*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit ); + } +} + + +/* GL_ARB_multitexture */ +void GLAPIENTRY +_mesa_ClientActiveTextureARB( GLenum target ) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint texUnit = target - GL_TEXTURE0; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (texUnit > ctx->Const.MaxTextureUnits) { + _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(target)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_ARRAY); + ctx->Array.ActiveTexture = texUnit; +} + + + +/**********************************************************************/ +/* Pixel Texgen Extensions */ +/**********************************************************************/ + +void GLAPIENTRY +_mesa_PixelTexGenSGIX(GLenum mode) +{ + GLenum newRgbSource, newAlphaSource; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (mode) { + case GL_NONE: + newRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; + newAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; + break; + case GL_ALPHA: + newRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; + newAlphaSource = GL_CURRENT_RASTER_COLOR; + break; + case GL_RGB: + newRgbSource = GL_CURRENT_RASTER_COLOR; + newAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; + break; + case GL_RGBA: + newRgbSource = GL_CURRENT_RASTER_COLOR; + newAlphaSource = GL_CURRENT_RASTER_COLOR; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenSGIX(mode)"); + return; + } + + if (newRgbSource == ctx->Pixel.FragmentRgbSource && + newAlphaSource == ctx->Pixel.FragmentAlphaSource) + return; + + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.FragmentRgbSource = newRgbSource; + ctx->Pixel.FragmentAlphaSource = newAlphaSource; +} + + +void GLAPIENTRY +_mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value) +{ + _mesa_PixelTexGenParameteriSGIS(target, (GLint) value); +} + + +void GLAPIENTRY +_mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) +{ + _mesa_PixelTexGenParameteriSGIS(target, (GLint) *value); +} + + +void GLAPIENTRY +_mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (value != GL_CURRENT_RASTER_COLOR && value != GL_PIXEL_GROUP_COLOR_SGIS) { + _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(value)"); + return; + } + + switch (target) { + case GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS: + if (ctx->Pixel.FragmentRgbSource == (GLenum) value) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.FragmentRgbSource = (GLenum) value; + break; + case GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS: + if (ctx->Pixel.FragmentAlphaSource == (GLenum) value) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.FragmentAlphaSource = (GLenum) value; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(target)"); + return; + } +} + + +void GLAPIENTRY +_mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value) +{ + _mesa_PixelTexGenParameteriSGIS(target, *value); +} + + +void GLAPIENTRY +_mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) { + *value = (GLfloat) ctx->Pixel.FragmentRgbSource; + } + else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) { + *value = (GLfloat) ctx->Pixel.FragmentAlphaSource; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterfvSGIS(target)"); + } +} + + +void GLAPIENTRY +_mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) { + *value = (GLint) ctx->Pixel.FragmentRgbSource; + } + else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) { + *value = (GLint) ctx->Pixel.FragmentAlphaSource; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterivSGIS(target)"); + } +} + + + +/**********************************************************************/ +/***** 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( GLcontext *ctx ) +{ + GLuint i; + + ctx->Texture._TexMatEnabled = 0; + + for (i=0; i < ctx->Const.MaxTextureUnits; i++) { + if (_math_matrix_is_dirty(ctx->TextureMatrixStack[i].Top)) { + _math_matrix_analyse( ctx->TextureMatrixStack[i].Top ); + + if (ctx->Texture.Unit[i]._ReallyEnabled && + ctx->TextureMatrixStack[i].Top->type != MATRIX_IDENTITY) + ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i); + + if (ctx->Driver.TextureMatrix) + ctx->Driver.TextureMatrix( ctx, i, ctx->TextureMatrixStack[i].Top); + } + } +} + + + + +/** + * \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( GLcontext *ctx ) +{ + GLuint unit; + + ctx->NewState |= _NEW_TEXTURE; /* TODO: only set this if there are + * actual changes. + */ + + ctx->Texture._EnabledUnits = 0; + ctx->Texture._GenFlags = 0; + ctx->Texture._TexMatEnabled = 0; + ctx->Texture._TexGenEnabled = 0; + + /* Update texture unit state. + * XXX this loop should probably be broken into separate loops for + * texture coord units and texture image units. + */ + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint enableBits; + + texUnit->_Current = NULL; + texUnit->_ReallyEnabled = 0; + texUnit->_GenFlags = 0; + + /* Get the bitmask of texture enables */ + if (ctx->FragmentProgram._Enabled) { + enableBits = ctx->FragmentProgram.Current->TexturesUsed[unit]; + } + else { + if (!texUnit->Enabled) + continue; + enableBits = texUnit->Enabled; + } + + /* Look for the highest-priority texture target that's enabled and + * complete. That's the one we'll use for texturing. If we're using + * a fragment program we're guaranteed that bitcount(enabledBits) <= 1. + */ + if (enableBits & TEXTURE_CUBE_BIT) { + struct gl_texture_object *texObj = texUnit->CurrentCubeMap; + if (!texObj->Complete) { + _mesa_test_texobj_completeness(ctx, texObj); + } + if (texObj->Complete) { + texUnit->_ReallyEnabled = TEXTURE_CUBE_BIT; + texUnit->_Current = texObj; + } + } + + if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_3D_BIT)) { + struct gl_texture_object *texObj = texUnit->Current3D; + if (!texObj->Complete) { + _mesa_test_texobj_completeness(ctx, texObj); + } + if (texObj->Complete) { + texUnit->_ReallyEnabled = TEXTURE_3D_BIT; + texUnit->_Current = texObj; + } + } + + if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_RECT_BIT)) { + struct gl_texture_object *texObj = texUnit->CurrentRect; + if (!texObj->Complete) { + _mesa_test_texobj_completeness(ctx, texObj); + } + if (texObj->Complete) { + texUnit->_ReallyEnabled = TEXTURE_RECT_BIT; + texUnit->_Current = texObj; + } + } + + if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_2D_BIT)) { + struct gl_texture_object *texObj = texUnit->Current2D; + if (!texObj->Complete) { + _mesa_test_texobj_completeness(ctx, texObj); + } + if (texObj->Complete) { + texUnit->_ReallyEnabled = TEXTURE_2D_BIT; + texUnit->_Current = texObj; + } + } + + if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_1D_BIT)) { + struct gl_texture_object *texObj = texUnit->Current1D; + if (!texObj->Complete) { + _mesa_test_texobj_completeness(ctx, texObj); + } + if (texObj->Complete) { + texUnit->_ReallyEnabled = TEXTURE_1D_BIT; + texUnit->_Current = texObj; + } + } + + if (!texUnit->_ReallyEnabled) { + continue; + } + + if (texUnit->_ReallyEnabled) + ctx->Texture._EnabledUnits |= (1 << unit); + + if (texUnit->EnvMode == GL_COMBINE) { + texUnit->_CurrentCombine = & texUnit->Combine; + } + else { + GLenum format = texUnit->_Current->Image[0][0]->Format; + if (format == GL_COLOR_INDEX) { + format = GL_RGBA; /* a bit of a hack */ + } + else if (format == GL_DEPTH_COMPONENT) { + format = texUnit->_Current->DepthMode; + } + calculate_derived_texenv(&texUnit->_EnvMode, texUnit->EnvMode, format); + texUnit->_CurrentCombine = & texUnit->_EnvMode; + } + + switch (texUnit->_CurrentCombine->ModeRGB) { + case GL_REPLACE: + texUnit->_CurrentCombine->_NumArgsRGB = 1; + break; + case GL_MODULATE: + case GL_ADD: + case GL_ADD_SIGNED: + case GL_SUBTRACT: + case GL_DOT3_RGB: + case GL_DOT3_RGBA: + case GL_DOT3_RGB_EXT: + case GL_DOT3_RGBA_EXT: + texUnit->_CurrentCombine->_NumArgsRGB = 2; + break; + case GL_INTERPOLATE: + case GL_MODULATE_ADD_ATI: + case GL_MODULATE_SIGNED_ADD_ATI: + case GL_MODULATE_SUBTRACT_ATI: + texUnit->_CurrentCombine->_NumArgsRGB = 3; + break; + default: + texUnit->_CurrentCombine->_NumArgsRGB = 0; + _mesa_problem(ctx, "invalid RGB combine mode in update_texture_state"); + return; + } + + switch (texUnit->_CurrentCombine->ModeA) { + case GL_REPLACE: + texUnit->_CurrentCombine->_NumArgsA = 1; + break; + case GL_MODULATE: + case GL_ADD: + case GL_ADD_SIGNED: + case GL_SUBTRACT: + texUnit->_CurrentCombine->_NumArgsA = 2; + break; + case GL_INTERPOLATE: + case GL_MODULATE_ADD_ATI: + case GL_MODULATE_SIGNED_ADD_ATI: + case GL_MODULATE_SUBTRACT_ATI: + texUnit->_CurrentCombine->_NumArgsA = 3; + break; + default: + texUnit->_CurrentCombine->_NumArgsA = 0; + _mesa_problem(ctx, "invalid Alpha combine mode in update_texture_state"); + break; + } + + if (texUnit->TexGenEnabled) { + if (texUnit->TexGenEnabled & S_BIT) { + texUnit->_GenFlags |= texUnit->_GenBitS; + } + if (texUnit->TexGenEnabled & T_BIT) { + texUnit->_GenFlags |= texUnit->_GenBitT; + } + if (texUnit->TexGenEnabled & Q_BIT) { + texUnit->_GenFlags |= texUnit->_GenBitQ; + } + if (texUnit->TexGenEnabled & R_BIT) { + texUnit->_GenFlags |= texUnit->_GenBitR; + } + + ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit); + ctx->Texture._GenFlags |= texUnit->_GenFlags; + } + + if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) + ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit); + } + + ctx->Texture._EnabledCoordUnits = ctx->Texture._EnabledUnits; + /* Fragment programs may need texture coordinates but not the + * corresponding texture images. + */ + if (ctx->FragmentProgram._Enabled) { + ctx->Texture._EnabledCoordUnits |= + (ctx->FragmentProgram.Current->InputsRead >> FRAG_ATTRIB_TEX0); + } +} + + +void _mesa_update_texture( GLcontext *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( GLcontext *ctx ) +{ + ctx->Texture.Proxy1D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D); + if (!ctx->Texture.Proxy1D) + goto cleanup; + + ctx->Texture.Proxy2D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_2D); + if (!ctx->Texture.Proxy2D) + goto cleanup; + + ctx->Texture.Proxy3D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_3D); + if (!ctx->Texture.Proxy3D) + goto cleanup; + + ctx->Texture.ProxyCubeMap = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_CUBE_MAP_ARB); + if (!ctx->Texture.ProxyCubeMap) + goto cleanup; + + ctx->Texture.ProxyRect = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_RECTANGLE_NV); + if (!ctx->Texture.ProxyRect) + goto cleanup; + + return GL_TRUE; + + cleanup: + if (ctx->Texture.Proxy1D) + (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1D); + if (ctx->Texture.Proxy2D) + (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2D); + if (ctx->Texture.Proxy3D) + (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy3D); + if (ctx->Texture.ProxyCubeMap) + (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyCubeMap); + if (ctx->Texture.ProxyRect) + (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyRect); + return GL_FALSE; +} + + +/** + * Initialize a texture unit. + * + * \param ctx GL context. + * \param unit texture unit number to be initialized. + */ +static void +init_texture_unit( GLcontext *ctx, GLuint unit ) +{ + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + + 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->TexGenEnabled = 0; + texUnit->GenModeS = GL_EYE_LINEAR; + texUnit->GenModeT = GL_EYE_LINEAR; + texUnit->GenModeR = GL_EYE_LINEAR; + texUnit->GenModeQ = GL_EYE_LINEAR; + texUnit->_GenBitS = TEXGEN_EYE_LINEAR; + texUnit->_GenBitT = TEXGEN_EYE_LINEAR; + texUnit->_GenBitR = TEXGEN_EYE_LINEAR; + texUnit->_GenBitQ = TEXGEN_EYE_LINEAR; + + /* Yes, these plane coefficients are correct! */ + ASSIGN_4V( texUnit->ObjectPlaneS, 1.0, 0.0, 0.0, 0.0 ); + ASSIGN_4V( texUnit->ObjectPlaneT, 0.0, 1.0, 0.0, 0.0 ); + ASSIGN_4V( texUnit->ObjectPlaneR, 0.0, 0.0, 0.0, 0.0 ); + ASSIGN_4V( texUnit->ObjectPlaneQ, 0.0, 0.0, 0.0, 0.0 ); + ASSIGN_4V( texUnit->EyePlaneS, 1.0, 0.0, 0.0, 0.0 ); + ASSIGN_4V( texUnit->EyePlaneT, 0.0, 1.0, 0.0, 0.0 ); + ASSIGN_4V( texUnit->EyePlaneR, 0.0, 0.0, 0.0, 0.0 ); + ASSIGN_4V( texUnit->EyePlaneQ, 0.0, 0.0, 0.0, 0.0 ); + + texUnit->Current1D = ctx->Shared->Default1D; + texUnit->Current2D = ctx->Shared->Default2D; + texUnit->Current3D = ctx->Shared->Default3D; + texUnit->CurrentCubeMap = ctx->Shared->DefaultCubeMap; + texUnit->CurrentRect = ctx->Shared->DefaultRect; +} + + +GLboolean _mesa_init_texture( GLcontext * ctx ) +{ + int i; + + assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS); + assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS); + + /* Effectively bind the default textures to all texture units */ + ctx->Shared->Default1D->RefCount += MAX_TEXTURE_UNITS; + ctx->Shared->Default2D->RefCount += MAX_TEXTURE_UNITS; + ctx->Shared->Default3D->RefCount += MAX_TEXTURE_UNITS; + ctx->Shared->DefaultCubeMap->RefCount += MAX_TEXTURE_UNITS; + ctx->Shared->DefaultRect->RefCount += MAX_TEXTURE_UNITS; + + /* Texture group */ + ctx->Texture.CurrentUnit = 0; /* multitexture */ + ctx->Texture._EnabledUnits = 0; + for (i=0; iTexture.SharedPalette = GL_FALSE; + _mesa_init_colortable(&ctx->Texture.Palette); + + /* Allocate proxy textures */ + if (!alloc_proxy_textures( ctx )) + return GL_FALSE; + + return GL_TRUE; +} + +void _mesa_free_texture_data( GLcontext *ctx ) +{ + int i; + + /* Free proxy texture objects */ + (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1D ); + (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2D ); + (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy3D ); + (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyCubeMap ); + (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyRect ); + + for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) + _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable ); + + _mesa_TexEnvProgramCacheDestroy( ctx ); +} diff --git a/reactos/dll/mesa32/src/main/texstate.h b/reactos/dll/mesa32/src/main/texstate.h new file mode 100644 index 00000000000..7cc3d2c19ce --- /dev/null +++ b/reactos/dll/mesa32/src/main/texstate.h @@ -0,0 +1,192 @@ +/** + * \file texstate.h + * Texture state management. + */ + +/* + * 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. + */ + + +#ifndef TEXSTATE_H +#define TEXSTATE_H + + +#include "mtypes.h" + + +extern void +_mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ); + +extern void +_mesa_print_texunit_state( GLcontext *ctx, GLuint unit ); + + +/** + * \name Called from API + */ +/*@{*/ + +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_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); + +extern void GLAPIENTRY +_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); + +extern void GLAPIENTRY +_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ); + +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_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_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_TexGend( GLenum coord, GLenum pname, GLdouble param ); + +extern void GLAPIENTRY +_mesa_TexGendv( GLenum coord, GLenum pname, const GLdouble *params ); + +extern void GLAPIENTRY +_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ); + +extern void GLAPIENTRY +_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); + +extern void GLAPIENTRY +_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params ); + + +/* + * GL_ARB_multitexture + */ +extern void GLAPIENTRY +_mesa_ActiveTextureARB( GLenum target ); + +extern void GLAPIENTRY +_mesa_ClientActiveTextureARB( GLenum target ); + + +/* + * Pixel Texture Extensions + */ + +extern void GLAPIENTRY +_mesa_PixelTexGenSGIX(GLenum mode); + +extern void GLAPIENTRY +_mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value); + +#ifdef VMS +#define _mesa_PixelTexGenParameterfvSGIS _mesa_PixelTexGenParameterfv +#endif +extern void GLAPIENTRY +_mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value); + +extern void GLAPIENTRY +_mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value); + +#ifdef VMS +#define _mesa_PixelTexGenParameterivSGIS _mesa_PixelTexGenParameteriv +#endif +extern void GLAPIENTRY +_mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value); + +#ifdef VMS +#define _mesa_GetPixelTexGenParameterfvSGIS _mesa_GetPixelTexGenParameterfv +#endif +extern void GLAPIENTRY +_mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value); + +#ifdef VMS +#define _mesa_GetPixelTexGenParameterivSGIS _mesa_GetPixelTexGenParameteriv +#endif +extern void GLAPIENTRY +_mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value); + +/*@}*/ + + +/** + * \name Initialization, state maintenance + */ +/*@{*/ + +extern void +_mesa_update_texture( GLcontext *ctx, GLuint new_state ); + +extern GLboolean +_mesa_init_texture( GLcontext *ctx ); + +extern void +_mesa_free_texture_data( GLcontext *ctx ); + +/*@}*/ + +#endif diff --git a/reactos/dll/mesa32/src/main/texstore.c b/reactos/dll/mesa32/src/main/texstore.c new file mode 100644 index 00000000000..af1bbf57e0c --- /dev/null +++ b/reactos/dll/mesa32/src/main/texstore.c @@ -0,0 +1,4055 @@ +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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. + */ + +/* + * 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, convolution!, etc) + * + * These functions can handle most everything, including processing full + * images and sub-images. + */ + + +#include "glheader.h" +#include "bufferobj.h" +#include "colormac.h" +#include "context.h" +#include "convolve.h" +#include "image.h" +#include "macros.h" +#include "imports.h" +#include "texcompress.h" +#include "texformat.h" +#include "teximage.h" +#include "texstore.h" + + +static const GLint ZERO = 4, ONE = 5; + +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: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + +/** + * When promoting texture formats (see below) we need to compute the + * mapping of dest components back to source components. + * This function does that. + * \param logicalBaseFormat the logical format of the texture + * \param textureBaseFormat the final texture format + * \return map[4] the four mapping values + */ +static void +compute_component_mapping(GLenum logicalBaseFormat, GLenum textureBaseFormat, + GLubyte map[6]) +{ + map[ZERO] = ZERO; + map[ONE] = ONE; + + /* compute mapping from dest components back to src components */ + switch (textureBaseFormat) { + case GL_RGB: + case GL_RGBA: + switch (logicalBaseFormat) { + case GL_LUMINANCE: + map[0] = map[1] = map[2] = 0; + if (textureBaseFormat == GL_RGBA) + map[3] = ONE; + break; + case GL_ALPHA: + ASSERT(textureBaseFormat == GL_RGBA); + map[0] = map[1] = map[2] = ZERO; + map[3] = 0; + break; + case GL_INTENSITY: + map[0] = map[1] = map[2] = 0; + if (textureBaseFormat == GL_RGBA) + map[3] = 0; + break; + case GL_LUMINANCE_ALPHA: + ASSERT(textureBaseFormat == GL_RGBA); + map[0] = map[1] = map[2] = 0; + map[3] = 1; + break; + case GL_RGB: + ASSERT(textureBaseFormat == GL_RGBA); + map[0] = 0; + map[1] = 1; + map[2] = 2; + map[3] = ONE; + break; + case GL_RGBA: + ASSERT(textureBaseFormat == GL_RGBA); + map[0] = 0; + map[1] = 1; + map[2] = 2; + map[3] = 3; + break; + default: + _mesa_problem(NULL, "Unexpected logicalBaseFormat"); + map[0] = map[1] = map[2] = map[3] = 0; + } + break; + case GL_LUMINANCE_ALPHA: + switch (logicalBaseFormat) { + case GL_LUMINANCE: + map[0] = 0; + map[1] = ONE; + break; + case GL_ALPHA: + map[0] = ZERO; + map[1] = 0; + break; + case GL_INTENSITY: + map[0] = 0; + map[1] = 0; + break; + default: + _mesa_problem(NULL, "Unexpected logicalBaseFormat"); + map[0] = map[1] = 0; + } + break; + default: + _mesa_problem(NULL, "Unexpected logicalBaseFormat"); + map[0] = map[1] = 0; + break; + } +} + + +/** + * 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, 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(GLcontext *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; + GLfloat *tempImage; + + ASSERT(dims >= 1 && dims <= 3); + + ASSERT(logicalBaseFormat == GL_RGBA || + logicalBaseFormat == GL_RGB || + 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_LUMINANCE_ALPHA || + textureBaseFormat == GL_LUMINANCE || + textureBaseFormat == GL_ALPHA || + textureBaseFormat == GL_INTENSITY || + textureBaseFormat == GL_COLOR_INDEX || + textureBaseFormat == GL_DEPTH_COMPONENT); + + /* conventional color image */ + + if ((dims == 1 && ctx->Pixel.Convolution1DEnabled) || + (dims >= 2 && ctx->Pixel.Convolution2DEnabled) || + (dims >= 2 && ctx->Pixel.Separable2DEnabled)) { + /* need image convolution */ + const GLuint preConvTransferOps + = (transferOps & IMAGE_PRE_CONVOLUTION_BITS) | IMAGE_CLAMP_BIT; + const GLuint postConvTransferOps + = (transferOps & IMAGE_POST_CONVOLUTION_BITS) | IMAGE_CLAMP_BIT; + GLint img, row; + GLint convWidth, convHeight; + GLfloat *convImage; + + /* pre-convolution image buffer (3D) */ + tempImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth + * 4 * sizeof(GLfloat)); + if (!tempImage) + return NULL; + + /* post-convolution image buffer (2D) */ + convImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight + * 4 * sizeof(GLfloat)); + if (!convImage) { + _mesa_free(tempImage); + return NULL; + } + + /* loop over 3D image slices */ + for (img = 0; img < srcDepth; img++) { + GLfloat *dst = tempImage + img * (srcWidth * srcHeight * 4); + + /* unpack and do transfer ops up to convolution */ + for (row = 0; row < srcHeight; row++) { + const GLvoid *src = _mesa_image_address(dims, srcPacking, + srcAddr, srcWidth, srcHeight, + srcFormat, srcType, img, row, 0); + _mesa_unpack_color_span_float(ctx, srcWidth, GL_RGBA, dst, + srcFormat, srcType, src, + srcPacking, + preConvTransferOps); + dst += srcWidth * 4; + } + + /* do convolution */ + { + GLfloat *src = tempImage + img * (srcWidth * srcHeight * 4); + convWidth = srcWidth; + convHeight = srcHeight; + if (dims == 1) { + ASSERT(ctx->Pixel.Convolution1DEnabled); + _mesa_convolve_1d_image(ctx, &convWidth, src, convImage); + } + else { + if (ctx->Pixel.Convolution2DEnabled) { + _mesa_convolve_2d_image(ctx, &convWidth, &convHeight, + src, convImage); + } + else { + ASSERT(ctx->Pixel.Separable2DEnabled); + _mesa_convolve_sep_image(ctx, &convWidth, &convHeight, + src, convImage); + } + } + } + + /* do post-convolution transfer and pack into tempImage */ + { + const GLint logComponents + = _mesa_components_in_format(logicalBaseFormat); + const GLfloat *src = convImage; + GLfloat *dst = tempImage + img * (convWidth * convHeight * 4); + for (row = 0; row < convHeight; row++) { + _mesa_pack_rgba_span_float(ctx, convWidth, + (const GLfloat (*)[4]) src, + logicalBaseFormat, GL_FLOAT, + dst, &ctx->DefaultPacking, + postConvTransferOps); + src += convWidth * 4; + dst += convWidth * logComponents; + } + } + } /* loop over 3D image slices */ + + _mesa_free(convImage); + + /* might need these below */ + srcWidth = convWidth; + srcHeight = convHeight; + } + else { + /* no convolution */ + const GLint components = _mesa_components_in_format(logicalBaseFormat); + const GLint srcStride = _mesa_image_row_stride(srcPacking, + srcWidth, srcFormat, srcType); + GLfloat *dst; + GLint img, row; + + tempImage = (GLfloat *) _mesa_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 *) _mesa_malloc(srcWidth * srcHeight * srcDepth + * texComponents * sizeof(GLfloat)); + if (!newImage) { + _mesa_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]; + } + } + + _mesa_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, 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(GLcontext *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); + GLboolean freeSrcImage = GL_FALSE; + GLint img, row; + GLchan *tempImage, *dst; + + ASSERT(dims >= 1 && dims <= 3); + + ASSERT(logicalBaseFormat == GL_RGBA || + logicalBaseFormat == GL_RGB || + logicalBaseFormat == GL_LUMINANCE_ALPHA || + logicalBaseFormat == GL_LUMINANCE || + logicalBaseFormat == GL_ALPHA || + logicalBaseFormat == GL_INTENSITY); + + ASSERT(textureBaseFormat == GL_RGBA || + textureBaseFormat == GL_RGB || + textureBaseFormat == GL_LUMINANCE_ALPHA || + textureBaseFormat == GL_LUMINANCE || + textureBaseFormat == GL_ALPHA || + textureBaseFormat == GL_INTENSITY); + + if ((dims == 1 && ctx->Pixel.Convolution1DEnabled) || + (dims >= 2 && ctx->Pixel.Convolution2DEnabled) || + (dims >= 2 && ctx->Pixel.Separable2DEnabled)) { + /* get convolved image */ + GLfloat *convImage = make_temp_float_image(ctx, dims, + logicalBaseFormat, + logicalBaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, + srcAddr, srcPacking); + if (!convImage) + return NULL; + /* the convolved image is our new source image */ + srcAddr = convImage; + srcFormat = logicalBaseFormat; + srcType = GL_FLOAT; + srcPacking = &ctx->DefaultPacking; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + transferOps = 0; + freeSrcImage = GL_TRUE; + } + + /* unpack and transfer the source image */ + tempImage = (GLchan *) _mesa_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 we made a temporary image for convolution, free it here */ + if (freeSrcImage) { + _mesa_free((void *) srcAddr); + } + + 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 *) _mesa_malloc(srcWidth * srcHeight * srcDepth + * texComponents * sizeof(GLchan)); + if (!newImage) { + _mesa_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]; + } + } + + _mesa_free(tempImage); + tempImage = newImage; + } + + return tempImage; +} + + +/** + * Copy GLubyte pixels from to 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 + * \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) +{ + GLubyte tmp[8]; + GLint i; + + tmp[ZERO] = 0x0; + tmp[ONE] = 0xff; + + switch (dstComponents) { + case 4: + for (i = 0; i < count; i++) { + COPY_4UBV(tmp, src); + src += srcComponents; + dst[0] = tmp[map[0]]; + dst[1] = tmp[map[1]]; + dst[2] = tmp[map[2]]; + dst[3] = tmp[map[3]]; + dst += 4; + } + break; + case 3: + for (i = 0; i < count; i++) { + COPY_4UBV(tmp, src); + src += srcComponents; + dst[0] = tmp[map[0]]; + dst[1] = tmp[map[1]]; + dst[2] = tmp[map[2]]; + dst += 3; + } + break; + case 2: + for (i = 0; i < count; i++) { + COPY_4UBV(tmp, src); + src += srcComponents; + dst[0] = tmp[map[0]]; + dst[1] = tmp[map[1]]; + dst += 2; + } + break; + } +} + + +/** + * Transfer a GLubyte texture image with component swizzling. + */ +static void +_mesa_swizzle_ubyte_image(GLcontext *ctx, + GLuint dimensions, + GLenum srcFormat, + const GLubyte *dstmap, GLint dstComponents, + + GLvoid *dstAddr, + GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, + GLint dstRowStride, GLint dstImageStride, + + GLint srcWidth, GLint srcHeight, GLint srcDepth, + const GLvoid *srcAddr, + const struct gl_pixelstore_attrib *srcPacking ) +{ + GLint srcComponents = _mesa_components_in_format(srcFormat); + GLubyte srcmap[6], map[4]; + 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); + + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstComponents; + + compute_component_mapping(srcFormat, GL_RGBA, srcmap); + + for (i = 0; i < 4; i++) + map[i] = srcmap[dstmap[i]]; + + if (srcRowStride == srcWidth * srcComponents && + (srcImageStride == srcWidth * srcHeight * srcComponents || + srcDepth == 1)) { + swizzle_copy(dstImage, dstComponents, srcImage, srcComponents, map, + srcWidth * srcHeight * srcDepth); + } + else { + GLint img, row; + for (img = 0; img < srcDepth; img++) { + const GLubyte *srcRow = srcImage; + GLubyte *dstRow = dstImage; + for (row = 0; row < srcHeight; row++) { + swizzle_copy(dstRow, dstComponents, srcRow, srcComponents, map, srcWidth); + dstRow += dstRowStride; + srcRow += srcRowStride; + } + srcImage += srcImageStride; + dstImage += dstImageStride; + } + } +} + + +/** + * 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(GLcontext *ctx, + GLuint dimensions, + const struct gl_texture_format *dstFormat, + GLvoid *dstAddr, + GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, + GLint dstRowStride, GLint dstImageStride, + 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 GLint bytesPerRow = srcWidth * dstFormat->TexelBytes; + const GLint bytesPerImage = srcHeight * bytesPerRow; + const GLint bytesPerTexture = srcDepth * bytesPerImage; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->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; + } + } +} + + + +/** + * Store an image in any of the formats: + * _mesa_texformat_rgba + * _mesa_texformat_rgb + * _mesa_texformat_alpha + * _mesa_texformat_luminance + * _mesa_texformat_luminance_alpha + * _mesa_texformat_intensity + * + * \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 dstImageStride destination image layer stride, in bytes + * \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 + */ +GLboolean +_mesa_texstore_rgba(GLcontext *ctx, GLuint dims, + GLenum baseInternalFormat, + const struct gl_texture_format *dstFormat, + GLvoid *dstAddr, + GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, + GLint dstRowStride, GLint dstImageStride, + GLint srcWidth, GLint srcHeight, GLint srcDepth, + GLenum srcFormat, GLenum srcType, + const GLvoid *srcAddr, + const struct gl_pixelstore_attrib *srcPacking) +{ + const GLint components = _mesa_components_in_format(baseInternalFormat); + + ASSERT(dstFormat == &_mesa_texformat_rgba || + dstFormat == &_mesa_texformat_rgb || + dstFormat == &_mesa_texformat_alpha || + dstFormat == &_mesa_texformat_luminance || + dstFormat == &_mesa_texformat_luminance_alpha || + dstFormat == &_mesa_texformat_intensity); + ASSERT(baseInternalFormat == GL_RGBA || + baseInternalFormat == GL_RGB || + baseInternalFormat == GL_ALPHA || + baseInternalFormat == GL_LUMINANCE || + baseInternalFormat == GL_LUMINANCE_ALPHA || + baseInternalFormat == GL_INTENSITY); + ASSERT(dstFormat->TexelBytes == components * sizeof(GLchan)); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + baseInternalFormat == srcFormat && + srcType == CHAN_TYPE) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_rgb && + srcFormat == GL_RGBA && + srcType == CHAN_TYPE) { + /* extract RGB from RGBA */ + int img, row, col; + GLchan *dstImage = (GLchan *) (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + for (img = 0; img < srcDepth; img++) { + const GLint srcRowStride = _mesa_image_row_stride(srcPacking, + srcWidth, srcFormat, srcType); + GLchan *srcRow = (GLchan *) _mesa_image_address(dims, srcPacking, + srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); + GLchan *dstRow = dstImage; + for (row = 0; row < srcHeight; row++) { + for (col = 0; col < srcWidth; col++) { + dstRow[col * 3 + RCOMP] = srcRow[col * 4 + RCOMP]; + dstRow[col * 3 + GCOMP] = srcRow[col * 4 + GCOMP]; + dstRow[col * 3 + BCOMP] = srcRow[col * 4 + BCOMP]; + } + dstRow += dstRowStride; + srcRow = (GLchan *) ((GLubyte *) srcRow + srcRowStride); + } + dstImage += dstImageStride; + } + } + else { + /* general path */ + const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + baseInternalFormat, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLchan *src = tempImage; + GLint bytesPerRow; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + bytesPerRow = srcWidth * components * sizeof(GLchan); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + for (row = 0; row < srcHeight; row++) { + _mesa_memcpy(dstRow, src, bytesPerRow); + dstRow += dstRowStride; + src += srcWidth * components; + } + dstImage += dstImageStride; + } + + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} + + +/** + * Store a floating point depth component texture image. + */ +GLboolean +_mesa_texstore_depth_component_float32(STORE_PARAMS) +{ + (void) dims; + ASSERT(dstFormat == &_mesa_texformat_depth_component_float32); + ASSERT(dstFormat->TexelBytes == sizeof(GLfloat)); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + baseInternalFormat == GL_DEPTH_COMPONENT && + srcFormat == GL_DEPTH_COMPONENT && + srcType == GL_FLOAT) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row; + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + 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, (GLfloat *) dstRow, + srcType, src, srcPacking); + dstRow += dstRowStride; + } + dstImage += dstImageStride; + } + } + return GL_TRUE; +} + + +/** + * Store a 16-bit integer depth component texture image. + */ +GLboolean +_mesa_texstore_depth_component16(STORE_PARAMS) +{ + (void) dims; + ASSERT(dstFormat == &_mesa_texformat_depth_component16); + ASSERT(dstFormat->TexelBytes == sizeof(GLushort)); + + if (!ctx->_ImageTransferState && + !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, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row, col; + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + for (row = 0; row < srcHeight; row++) { + GLfloat depthTemp[MAX_WIDTH]; + 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, depthTemp, + srcType, src, srcPacking); + for (col = 0; col < srcWidth; col++) { + dst16[col] = (GLushort) (depthTemp[col] * 65535.0F); + } + dstRow += dstRowStride; + } + dstImage += dstImageStride; + } + } + return GL_TRUE; +} + + +/** + * Store an rgb565 or rgb565_rev texture image. + */ +GLboolean +_mesa_texstore_rgb565(STORE_PARAMS) +{ + ASSERT(dstFormat == &_mesa_texformat_rgb565 || + dstFormat == &_mesa_texformat_rgb565_rev); + ASSERT(dstFormat->TexelBytes == 2); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_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, dstImageStride, + 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 + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->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_texformat_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, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLchan *src = tempImage; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + for (row = 0; row < srcHeight; row++) { + GLushort *dstUS = (GLushort *) dstRow; + /* check for byteswapped format */ + if (dstFormat == &_mesa_texformat_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; + } + dstImage += dstImageStride; + } + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} + + +GLboolean +_mesa_texstore_rgba8888(STORE_PARAMS) +{ + const GLuint ui = 1; + const GLubyte littleEndian = *((const GLubyte *) &ui); + + (void)littleEndian; + ASSERT(dstFormat == &_mesa_texformat_rgba8888 || + dstFormat == &_mesa_texformat_rgba8888_rev); + ASSERT(dstFormat->TexelBytes == 4); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_rgba8888 && + baseInternalFormat == GL_RGBA && + ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8) || + (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8_REV))) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } +#if 0 + else if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + srcType == GL_UNSIGNED_BYTE && + dstFormat == &_mesa_texformat_rgba8888 && + littleEndian && + /* Three texture formats involved: srcFormat, + * baseInternalFormat and destFormat (GL_RGBA). Only two + * may differ. _mesa_swizzle_ubyte_image can't handle two + * propagations at once correctly. */ + (srcFormat == baseInternalFormat || + baseInternalFormat == GL_RGBA) && + can_swizzle(srcFormat)) { + GLubyte dstmap[4]; + + /* dstmap - how to swizzle from GL_RGBA to dst format: + * + * FIXME - add !litteEndian and _rev varients: + */ + dstmap[3] = 0; + dstmap[2] = 1; + dstmap[1] = 2; + dstmap[0] = 3; + + _mesa_swizzle_ubyte_image(ctx, dims, + srcFormat, + dstmap, 4, + dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageStride, + srcWidth, srcHeight, srcDepth, srcAddr, + srcPacking); + } +#endif + else { + /* general path */ + const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + baseInternalFormat, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLchan *src = tempImage; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + for (row = 0; row < srcHeight; row++) { + GLuint *dstUI = (GLuint *) dstRow; + if (dstFormat == &_mesa_texformat_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; + } + dstImage += dstImageStride; + } + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} + + +GLboolean +_mesa_texstore_argb8888(STORE_PARAMS) +{ + const GLuint ui = 1; + const GLubyte littleEndian = *((const GLubyte *) &ui); + + ASSERT(dstFormat == &_mesa_texformat_argb8888 || + dstFormat == &_mesa_texformat_argb8888_rev); + ASSERT(dstFormat->TexelBytes == 4); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_argb8888 && + 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, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_argb8888_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, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_argb8888 && + srcFormat == GL_RGB && + srcType == GL_UNSIGNED_BYTE) { + + int img, row, col; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + 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 = dstImage; + for (row = 0; row < srcHeight; row++) { + for (col = 0; col < srcWidth; col++) { + dstRow[col * 4 + 0] = srcRow[col * 3 + BCOMP]; + dstRow[col * 4 + 1] = srcRow[col * 3 + GCOMP]; + dstRow[col * 4 + 2] = srcRow[col * 3 + RCOMP]; + dstRow[col * 4 + 3] = 0xff; + } + dstRow += dstRowStride; + srcRow += srcRowStride; + } + dstImage += dstImageStride; + } + } + else if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_argb8888 && + srcFormat == GL_RGBA && + srcType == GL_UNSIGNED_BYTE) { + + int img, row, col; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + 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 = dstImage; + for (row = 0; row < srcHeight; row++) { + for (col = 0; col < srcWidth; col++) { + dstRow[col * 4 + 0] = srcRow[col * 4 + BCOMP]; + dstRow[col * 4 + 1] = srcRow[col * 4 + GCOMP]; + dstRow[col * 4 + 2] = srcRow[col * 4 + RCOMP]; + dstRow[col * 4 + 3] = srcRow[col * 4 + ACOMP]; + } + dstRow += dstRowStride; + srcRow += srcRowStride; + } + dstImage += dstImageStride; + } + } + else if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_argb8888 && + srcType == GL_UNSIGNED_BYTE && + littleEndian && + /* Three texture formats involved: srcFormat, + * baseInternalFormat and destFormat (GL_RGBA). Only two + * may differ. _mesa_swizzle_ubyte_image can't handle two + * propagations at once correctly. */ + (srcFormat == baseInternalFormat || + baseInternalFormat == GL_RGBA) && + can_swizzle(srcFormat)) { + + GLubyte dstmap[4]; + + /* dstmap - how to swizzle from GL_RGBA to dst format: + */ + dstmap[3] = 3; /* alpha */ + dstmap[2] = 0; /* red */ + dstmap[1] = 1; /* green */ + dstmap[0] = 2; /* blue */ + + _mesa_swizzle_ubyte_image(ctx, dims, + srcFormat, + dstmap, 4, + dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageStride, + srcWidth, srcHeight, srcDepth, srcAddr, + srcPacking); + } + else { + /* general path */ + const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + baseInternalFormat, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLchan *src = tempImage; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + for (row = 0; row < srcHeight; row++) { + GLuint *dstUI = (GLuint *) dstRow; + if (dstFormat == &_mesa_texformat_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 { + 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; + } + dstImage += dstImageStride; + } + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} + + +GLboolean +_mesa_texstore_rgb888(STORE_PARAMS) +{ + const GLuint ui = 1; + const GLubyte littleEndian = *((const GLubyte *) &ui); + + ASSERT(dstFormat == &_mesa_texformat_rgb888); + ASSERT(dstFormat->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, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + srcFormat == GL_RGBA && + srcType == GL_UNSIGNED_BYTE) { + /* extract RGB from RGBA */ + int img, row, col; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + 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 = dstImage; + 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; + } + dstImage += dstImageStride; + } + } + else { + /* general path */ + const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + baseInternalFormat, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLchan *src = (const GLchan *) tempImage; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + 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; + } + dstImage += dstImageStride; + } + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} + + +GLboolean +_mesa_texstore_bgr888(STORE_PARAMS) +{ + const GLuint ui = 1; + const GLubyte littleEndian = *((const GLubyte *) &ui); + + ASSERT(dstFormat == &_mesa_texformat_bgr888); + ASSERT(dstFormat->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, dstImageStride, + 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; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + 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 = dstImage; + 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; + } + dstImage += dstImageStride; + } + } + else { + /* general path */ + const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + baseInternalFormat, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLchan *src = (const GLchan *) tempImage; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + 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; + } + dstImage += dstImageStride; + } + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} + + +GLboolean +_mesa_texstore_argb4444(STORE_PARAMS) +{ + ASSERT(dstFormat == &_mesa_texformat_argb4444 || + dstFormat == &_mesa_texformat_argb4444_rev); + ASSERT(dstFormat->TexelBytes == 2); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_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, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + baseInternalFormat, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLchan *src = tempImage; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + for (row = 0; row < srcHeight; row++) { + GLushort *dstUS = (GLushort *) dstRow; + if (dstFormat == &_mesa_texformat_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; + } + dstImage += dstImageStride; + } + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} + + + +GLboolean +_mesa_texstore_argb1555(STORE_PARAMS) +{ + ASSERT(dstFormat == &_mesa_texformat_argb1555 || + dstFormat == &_mesa_texformat_argb1555_rev); + ASSERT(dstFormat->TexelBytes == 2); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_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, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + baseInternalFormat, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLchan *src =tempImage; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + for (row = 0; row < srcHeight; row++) { + GLushort *dstUS = (GLushort *) dstRow; + if (dstFormat == &_mesa_texformat_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; + } + dstImage += dstImageStride; + } + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} + + +GLboolean +_mesa_texstore_al88(STORE_PARAMS) +{ + const GLuint ui = 1; + const GLubyte littleEndian = *((const GLubyte *) &ui); + + ASSERT(dstFormat == &_mesa_texformat_al88 || + dstFormat == &_mesa_texformat_al88_rev); + ASSERT(dstFormat->TexelBytes == 2); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_al88 && + baseInternalFormat == GL_LUMINANCE_ALPHA && + srcFormat == GL_LUMINANCE_ALPHA && + srcType == GL_UNSIGNED_BYTE && + littleEndian) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + baseInternalFormat, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLchan *src = tempImage; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + for (row = 0; row < srcHeight; row++) { + GLushort *dstUS = (GLushort *) dstRow; + if (dstFormat == &_mesa_texformat_al88) { + 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; + } + dstImage += dstImageStride; + } + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} + + +GLboolean +_mesa_texstore_rgb332(STORE_PARAMS) +{ + ASSERT(dstFormat == &_mesa_texformat_rgb332); + ASSERT(dstFormat->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, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + baseInternalFormat, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLchan *src = tempImage; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + 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; + } + dstImage += dstImageStride; + } + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} + + +/** + * Texstore for _mesa_texformat_a8, _mesa_texformat_l8, _mesa_texformat_i8. + */ +GLboolean +_mesa_texstore_a8(STORE_PARAMS) +{ + ASSERT(dstFormat == &_mesa_texformat_a8 || + dstFormat == &_mesa_texformat_l8 || + dstFormat == &_mesa_texformat_i8); + ASSERT(dstFormat->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, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, + baseInternalFormat, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLchan *src = tempImage; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + for (row = 0; row < srcHeight; row++) { + for (col = 0; col < srcWidth; col++) { + dstRow[col] = CHAN_TO_UBYTE(src[col]); + } + dstRow += dstRowStride; + src += srcWidth; + } + dstImage += dstImageStride; + } + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} + + + +GLboolean +_mesa_texstore_ci8(STORE_PARAMS) +{ + (void) dims; (void) baseInternalFormat; + ASSERT(dstFormat == &_mesa_texformat_ci8); + ASSERT(dstFormat->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, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row; + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + 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; + } + dstImage += dstImageStride; + } + } + return GL_TRUE; +} + + +/** + * Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_rev. + */ +GLboolean +_mesa_texstore_ycbcr(STORE_PARAMS) +{ + const GLuint ui = 1; + const GLubyte littleEndian = *((const GLubyte *) &ui); + (void) ctx; (void) dims; (void) baseInternalFormat; + + ASSERT((dstFormat == &_mesa_texformat_ycbcr) || + (dstFormat == &_mesa_texformat_ycbcr_rev)); + ASSERT(dstFormat->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, dstImageStride, + 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_texformat_ycbcr_rev) ^ + !littleEndian) { + GLubyte *pImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row; + for (img = 0; img < srcDepth; img++) { + GLubyte *pRow = pImage; + for (row = 0; row < srcHeight; row++) { + _mesa_swap2((GLushort *) pRow, srcWidth); + pRow += dstRowStride; + } + pImage += dstImageStride; + } + } + 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 + */ +GLboolean +_mesa_texstore_rgba_float32(STORE_PARAMS) +{ + const GLint components = _mesa_components_in_format(baseInternalFormat); + + ASSERT(dstFormat == &_mesa_texformat_rgba_float32 || + dstFormat == &_mesa_texformat_rgb_float32 || + dstFormat == &_mesa_texformat_alpha_float32 || + dstFormat == &_mesa_texformat_luminance_float32 || + dstFormat == &_mesa_texformat_luminance_alpha_float32 || + dstFormat == &_mesa_texformat_intensity_float32); + ASSERT(baseInternalFormat == GL_RGBA || + baseInternalFormat == GL_RGB || + baseInternalFormat == GL_ALPHA || + baseInternalFormat == GL_LUMINANCE || + baseInternalFormat == GL_LUMINANCE_ALPHA || + baseInternalFormat == GL_INTENSITY); + ASSERT(dstFormat->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, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *src = tempImage; + GLint bytesPerRow; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + bytesPerRow = srcWidth * components * sizeof(GLfloat); + for (img = 0; img < srcDepth; img++) { + GLubyte *dst = dstImage; + for (row = 0; row < srcHeight; row++) { + _mesa_memcpy(dst, src, bytesPerRow); + dst += dstRowStride; + src += srcWidth * components; + } + dstImage += dstImageStride; + } + + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} + + +/** + * As above, but store 16-bit floats. + */ +GLboolean +_mesa_texstore_rgba_float16(STORE_PARAMS) +{ + const GLint components = _mesa_components_in_format(baseInternalFormat); + + ASSERT(dstFormat == &_mesa_texformat_rgba_float16 || + dstFormat == &_mesa_texformat_rgb_float16 || + dstFormat == &_mesa_texformat_alpha_float16 || + dstFormat == &_mesa_texformat_luminance_float16 || + dstFormat == &_mesa_texformat_luminance_alpha_float16 || + dstFormat == &_mesa_texformat_intensity_float16); + ASSERT(baseInternalFormat == GL_RGBA || + baseInternalFormat == GL_RGB || + baseInternalFormat == GL_ALPHA || + baseInternalFormat == GL_LUMINANCE || + baseInternalFormat == GL_LUMINANCE_ALPHA || + baseInternalFormat == GL_INTENSITY); + ASSERT(dstFormat->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, dstImageStride, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + dstFormat->BaseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *src = tempImage; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + 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; + } + dstImage += dstImageStride; + } + + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} + + + +/** + * 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(GLcontext *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 (unpack->BufferObj->Name == 0) { + /* 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(GLcontext *ctx, + GLsizei imageSize, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + const char *funcName) +{ + GLubyte *buf; + + if (packing->BufferObj->Name == 0) { + /* not using a PBO - return pointer unchanged */ + return pixels; + } + if ((const GLubyte *) pixels + imageSize > + (const GLubyte *)(uintptr_t) 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(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack) +{ + if (unpack->BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + unpack->BufferObj); + } +} + + +/* + * This is the software fallback for Driver.TexImage1D() + * and Driver.CopyTexImage1D(). + * \sa _mesa_store_teximage2d() + */ +void +_mesa_store_teximage1d(GLcontext *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) +{ + GLint postConvWidth = width; + GLint sizeInBytes; + (void) border; + + if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { + _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); + } + + /* choose the texture format */ + assert(ctx->Driver.ChooseTextureFormat); + texImage->TexFormat = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, + format, type); + assert(texImage->TexFormat); + texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D; + texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df; + + /* allocate memory */ + if (texImage->IsCompressed) + sizeInBytes = texImage->CompressedSize; + else + sizeInBytes = postConvWidth * texImage->TexFormat->TexelBytes; + 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, dstImageStride = 0; + GLboolean success; + ASSERT(texImage->TexFormat->StoreImage); + success = texImage->TexFormat->StoreImage(ctx, 1, texImage->Format, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, dstImageStride, + width, 1, 1, + format, type, pixels, packing); + if (!success) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); + } + } + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); + } + + _mesa_unmap_teximage_pbo(ctx, packing); +} + + +/** + * This is the software fallback for Driver.TexImage2D() + * and Driver.CopyTexImage2D(). + * We store the image in heap memory. We know nothing about on-board + * VRAM here. But since most DRI drivers rely on keeping a copy of all + * textures in main memory, this routine will typically be used by + * hardware drivers too. + * + * Reasons why a driver might override this function: + * - Special memory allocation needs (VRAM, AGP, etc) + * - Unusual row/image strides or padding + * - Special housekeeping + * - Using VRAM-based Pixel Buffer Objects + */ +void +_mesa_store_teximage2d(GLcontext *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) +{ + GLint postConvWidth = width, postConvHeight = height; + GLint texelBytes, sizeInBytes; + (void) border; + + if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { + _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, + &postConvHeight); + } + + /* choose the texture format */ + assert(ctx->Driver.ChooseTextureFormat); + texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, + internalFormat, format, type); + assert(texImage->TexFormat); + texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D; + texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df; + + texelBytes = texImage->TexFormat->TexelBytes; + + /* allocate memory */ + if (texImage->IsCompressed) + sizeInBytes = texImage->CompressedSize; + else + sizeInBytes = postConvWidth * postConvHeight * texelBytes; + 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, dstImageStride = 0; + GLboolean success; + if (texImage->IsCompressed) { + dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,width); + } + else { + dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes; + } + ASSERT(texImage->TexFormat->StoreImage); + success = texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, dstImageStride, + width, height, 1, + format, type, pixels, packing); + if (!success) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); + } + } + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); + } + + _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(GLcontext *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) +{ + GLint texelBytes, sizeInBytes; + (void) border; + + /* choose the texture format */ + assert(ctx->Driver.ChooseTextureFormat); + texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, + internalFormat, format, type); + assert(texImage->TexFormat); + texImage->FetchTexelc = texImage->TexFormat->FetchTexel3D; + texImage->FetchTexelf = texImage->TexFormat->FetchTexel3Df; + + texelBytes = texImage->TexFormat->TexelBytes; + + /* allocate memory */ + if (texImage->IsCompressed) + sizeInBytes = texImage->CompressedSize; + else + sizeInBytes = width * height * depth * texelBytes; + 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, dstImageStride; + GLboolean success; + if (texImage->IsCompressed) { + dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,width); + dstImageStride = 0; + } + else { + dstRowStride = width * texImage->TexFormat->TexelBytes; + dstImageStride = dstRowStride * height; + } + ASSERT(texImage->TexFormat->StoreImage); + success = texImage->TexFormat->StoreImage(ctx, 3, texImage->Format, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, dstImageStride, + width, height, depth, + format, type, pixels, packing); + if (!success) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); + } + } + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); + } + + _mesa_unmap_teximage_pbo(ctx, packing); +} + + + + +/* + * This is the software fallback for Driver.TexSubImage1D() + * and Driver.CopyTexSubImage1D(). + */ +void +_mesa_store_texsubimage1d(GLcontext *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) +{ + pixels = _mesa_validate_pbo_teximage(ctx, 1, width, 1, 1, format, type, + pixels, packing, "glTexSubImage1D"); + if (!pixels) + return; + + { + const GLint dstRowStride = 0, dstImageStride = 0; + GLboolean success; + ASSERT(texImage->TexFormat->StoreImage); + success = texImage->TexFormat->StoreImage(ctx, 1, texImage->Format, + texImage->TexFormat, + texImage->Data, + xoffset, 0, 0, /* offsets */ + dstRowStride, dstImageStride, + width, 1, 1, + format, type, pixels, packing); + if (!success) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D"); + } + } + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); + } + + _mesa_unmap_teximage_pbo(ctx, packing); +} + + + +/** + * This is the software fallback for Driver.TexSubImage2D() + * and Driver.CopyTexSubImage2D(). + */ +void +_mesa_store_texsubimage2d(GLcontext *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) +{ + pixels = _mesa_validate_pbo_teximage(ctx, 2, width, height, 1, format, type, + pixels, packing, "glTexSubImage2D"); + if (!pixels) + return; + + { + GLint dstRowStride = 0, dstImageStride = 0; + GLboolean success; + if (texImage->IsCompressed) { + dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + texImage->Width); + } + else { + dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes; + } + ASSERT(texImage->TexFormat->StoreImage); + success = texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, + texImage->TexFormat, + texImage->Data, + xoffset, yoffset, 0, + dstRowStride, dstImageStride, + width, height, 1, + format, type, pixels, packing); + if (!success) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D"); + } + } + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); + } + + _mesa_unmap_teximage_pbo(ctx, packing); +} + + +/* + * This is the software fallback for Driver.TexSubImage3D(). + * and Driver.CopyTexSubImage3D(). + */ +void +_mesa_store_texsubimage3d(GLcontext *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) +{ + pixels = _mesa_validate_pbo_teximage(ctx, 3, width, height, depth, format, + type, pixels, packing, + "glTexSubImage3D"); + if (!pixels) + return; + + { + GLint dstRowStride, dstImageStride; + GLboolean success; + if (texImage->IsCompressed) { + dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + texImage->Width); + dstImageStride = 0; /* XXX fix */ + } + else { + dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes; + dstImageStride = dstRowStride * texImage->Height; + } + ASSERT(texImage->TexFormat->StoreImage); + success = texImage->TexFormat->StoreImage(ctx, 3, texImage->Format, + texImage->TexFormat, + texImage->Data, + xoffset, yoffset, zoffset, + dstRowStride, dstImageStride, + width, height, depth, + format, type, pixels, packing); + if (!success) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage3D"); + } + } + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); + } + + _mesa_unmap_teximage_pbo(ctx, packing); +} + + +/* + * Fallback for Driver.CompressedTexImage1D() + */ +void +_mesa_store_compressed_teximage1d(GLcontext *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(GLcontext *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 */ + + /* choose the texture format */ + assert(ctx->Driver.ChooseTextureFormat); + texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, + internalFormat, 0, 0); + assert(texImage->TexFormat); + texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D; + texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df; + + /* 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 */ + ASSERT(texImage->CompressedSize == (GLuint) imageSize); + MEMCPY(texImage->Data, data, imageSize); + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); + } + + _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack); +} + + + +/* + * Fallback for Driver.CompressedTexImage3D() + */ +void +_mesa_store_compressed_teximage3d(GLcontext *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(GLcontext *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) +{ + /* this space intentionally left blank */ + (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(GLcontext *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; + (void) format; + + /* these should have been caught sooner */ + ASSERT((width & 3) == 0 || width == 2 || width == 1); + ASSERT((height & 3) == 0 || height == 2 || height == 1); + ASSERT((xoffset & 3) == 0); + ASSERT((yoffset & 3) == 0); + + data = _mesa_validate_pbo_compressed_teximage(ctx, imageSize, data, + &ctx->Unpack, + "glCompressedTexSubImage2D"); + if (!data) + return; + + srcRowStride = _mesa_compressed_row_stride(texImage->IntFormat, width); + src = (const GLubyte *) data; + + destRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + texImage->Width); + dest = _mesa_compressed_image_address(xoffset, yoffset, 0, + texImage->IntFormat, + texImage->Width, + (GLubyte*) texImage->Data); + + bytesPerRow = srcRowStride; + rows = height / 4; + + for (i = 0; i < rows; i++) { + MEMCPY(dest, src, bytesPerRow); + dest += destRowStride; + src += srcRowStride; + } + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); + } + + _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack); +} + + +/** + * Fallback for Driver.CompressedTexSubImage3D() + */ +void +_mesa_store_compressed_texsubimage3d(GLcontext *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) +{ + /* this space intentionally left blank */ + (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; +} + + +/* + * 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. + */ +static void +do_row(const struct gl_texture_format *format, 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; + + /* This assertion is no longer valid with non-power-of-2 textures + assert(srcWidth == dstWidth || srcWidth == 2 * dstWidth); + */ + + switch (format->MesaFormat) { + case MESA_FORMAT_RGBA: + { + GLuint i, j, k; + const GLchan (*rowA)[4] = (const GLchan (*)[4]) srcRowA; + const GLchan (*rowB)[4] = (const GLchan (*)[4]) srcRowB; + GLchan (*dst)[4] = (GLchan (*)[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; + } + } + return; + case MESA_FORMAT_RGB: + { + GLuint i, j, k; + const GLchan (*rowA)[3] = (const GLchan (*)[3]) srcRowA; + const GLchan (*rowB)[3] = (const GLchan (*)[3]) srcRowB; + GLchan (*dst)[3] = (GLchan (*)[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; + } + } + return; + case MESA_FORMAT_ALPHA: + case MESA_FORMAT_LUMINANCE: + case MESA_FORMAT_INTENSITY: + { + GLuint i, j, k; + const GLchan *rowA = (const GLchan *) srcRowA; + const GLchan *rowB = (const GLchan *) srcRowB; + GLchan *dst = (GLchan *) 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; + } + } + return; + case MESA_FORMAT_LUMINANCE_ALPHA: + { + GLuint i, j, k; + const GLchan (*rowA)[2] = (const GLchan (*)[2]) srcRowA; + const GLchan (*rowB)[2] = (const GLchan (*)[2]) srcRowB; + GLchan (*dst)[2] = (GLchan (*)[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; + } + } + return; + case MESA_FORMAT_DEPTH_COMPONENT_FLOAT32: + { + 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; + } + } + return; + case MESA_FORMAT_DEPTH_COMPONENT16: + { + 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; + } + } + return; + /* Begin hardware formats */ + case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_RGBA8888_REV: + case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_ARGB8888_REV: + { + 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; + } + } + return; + case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR888: + { + 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; + } + } + return; + case MESA_FORMAT_RGB565: + case MESA_FORMAT_RGB565_REV: + { + 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; + } + } + return; + case MESA_FORMAT_ARGB4444: + case MESA_FORMAT_ARGB4444_REV: + { + 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; + } + } + return; + case MESA_FORMAT_ARGB1555: + case MESA_FORMAT_ARGB1555_REV: /* XXX broken? */ + { + 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] & 0xf; + 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; + } + } + return; + case MESA_FORMAT_AL88: + case MESA_FORMAT_AL88_REV: + { + 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; + } + } + return; + case MESA_FORMAT_RGB332: + { + 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; + } + } + return; + case MESA_FORMAT_A8: + case MESA_FORMAT_L8: + case MESA_FORMAT_I8: + case MESA_FORMAT_CI8: + { + 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; + } + } + return; + case MESA_FORMAT_RGBA_FLOAT32: + { + 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; + } + } + return; + case MESA_FORMAT_RGBA_FLOAT16: + { + 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); + } + } + } + return; + case MESA_FORMAT_RGB_FLOAT32: + { + 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; + } + } + return; + case MESA_FORMAT_RGB_FLOAT16: + { + 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); + } + } + } + return; + case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: + { + 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; + } + } + return; + case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: + { + 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); + } + } + } + return; + case MESA_FORMAT_ALPHA_FLOAT32: + case MESA_FORMAT_LUMINANCE_FLOAT32: + case MESA_FORMAT_INTENSITY_FLOAT32: + { + 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; + } + } + return; + case MESA_FORMAT_ALPHA_FLOAT16: + case MESA_FORMAT_LUMINANCE_FLOAT16: + case MESA_FORMAT_INTENSITY_FLOAT16: + { + 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); + } + } + return; + + default: + _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(const struct gl_texture_format *format, GLint border, + GLint srcWidth, const GLubyte *srcPtr, + GLint dstWidth, GLubyte *dstPtr) +{ + const GLint bpt = format->TexelBytes; + 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(format, srcWidth - 2 * border, src, src, + dstWidth - 2 * border, dst); + + if (border) { + /* copy left-most pixel from source */ + 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(const struct gl_texture_format *format, GLint border, + GLint srcWidth, GLint srcHeight, const GLubyte *srcPtr, + GLint dstWidth, GLint dstHeight, GLubyte *dstPtr) +{ + const GLint bpt = format->TexelBytes; + const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ + const GLint dstWidthNB = dstWidth - 2 * border; + const GLint dstHeightNB = dstHeight - 2 * border; + const GLint srcRowStride = bpt * srcWidth; + const GLint dstRowStride = bpt * dstWidth; + const GLubyte *srcA, *srcB; + GLubyte *dst; + GLint row; + + /* Compute src and dst pointers, skipping any border */ + srcA = srcPtr + border * ((srcWidth + 1) * bpt); + if (srcHeight > 1) + srcB = srcA + srcRowStride; + else + srcB = srcA; + dst = dstPtr + border * ((dstWidth + 1) * bpt); + + for (row = 0; row < dstHeightNB; row++) { + do_row(format, srcWidthNB, srcA, srcB, + dstWidthNB, dst); + srcA += 2 * srcRowStride; + srcB += 2 * srcRowStride; + dst += dstRowStride; + } + + /* This is ugly but probably won't be used much */ + if (border > 0) { + /* fill in dest border */ + /* lower-left border pixel */ + 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(format, srcWidthNB, + srcPtr + bpt, + srcPtr + bpt, + dstWidthNB, dstPtr + bpt); + /* upper border */ + do_row(format, 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(format, 1, + srcPtr + (srcWidth * (row * 2 + 1)) * bpt, + srcPtr + (srcWidth * (row * 2 + 2)) * bpt, + 1, dstPtr + (dstWidth * row + 1) * bpt); + do_row(format, 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(const struct gl_texture_format *format, GLint border, + GLint srcWidth, GLint srcHeight, GLint srcDepth, + const GLubyte *srcPtr, + GLint dstWidth, GLint dstHeight, GLint dstDepth, + GLubyte *dstPtr) +{ + const GLint bpt = format->TexelBytes; + 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; + GLvoid *tmpRowA, *tmpRowB; + GLint img, row; + GLint bytesPerSrcImage, bytesPerDstImage; + GLint bytesPerSrcRow, bytesPerDstRow; + GLint srcImageOffset, srcRowOffset; + + (void) srcDepthNB; /* silence warnings */ + + /* Need two temporary row buffers */ + tmpRowA = _mesa_malloc(srcWidth * bpt); + if (!tmpRowA) + return; + tmpRowB = _mesa_malloc(srcWidth * bpt); + if (!tmpRowB) { + _mesa_free(tmpRowA); + return; + } + + 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. + */ + + /* + _mesa_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++) { + /* Average together two rows from first src image */ + do_row(format, srcWidthNB, srcImgARowA, srcImgARowB, + srcWidthNB, tmpRowA); + /* Average together two rows from second src image */ + do_row(format, srcWidthNB, srcImgBRowA, srcImgBRowB, + srcWidthNB, tmpRowB); + /* Average together the temp rows to make the final row */ + do_row(format, srcWidthNB, tmpRowA, tmpRowB, + dstWidthNB, dstImgRow); + /* advance to next rows */ + srcImgARowA += bytesPerSrcRow + srcRowOffset; + srcImgARowB += bytesPerSrcRow + srcRowOffset; + srcImgBRowA += bytesPerSrcRow + srcRowOffset; + srcImgBRowB += bytesPerSrcRow + srcRowOffset; + dstImgRow += bytesPerDstRow; + } + } + + _mesa_free(tmpRowA); + _mesa_free(tmpRowB); + + /* Luckily we can leverage the make_2d_mipmap() function here! */ + if (border > 0) { + /* do front border image */ + make_2d_mipmap(format, 1, srcWidth, srcHeight, srcPtr, + dstWidth, dstHeight, dstPtr); + /* do back border image */ + make_2d_mipmap(format, 1, srcWidth, srcHeight, + srcPtr + bytesPerSrcImage * (srcDepth - 1), + dstWidth, dstHeight, + dstPtr + bytesPerDstImage * (dstDepth - 1)); + /* 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(format, 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(format, 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(format, 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(format, 1, src, src + srcImageOffset, 1, dst); + } + } + } +} + + +/* + * For GL_SGIX_generate_mipmap: + * Generate a complete set of mipmaps from texObj's base-level image. + * Stop at texObj's MaxLevel or when we get to the 1x1 texture. + */ +void +_mesa_generate_mipmap(GLcontext *ctx, GLenum target, + const struct gl_texture_unit *texUnit, + struct gl_texture_object *texObj) +{ + const struct gl_texture_image *srcImage; + const struct gl_texture_format *convertFormat; + const GLubyte *srcData = NULL; + GLubyte *dstData = NULL; + GLint level, maxLevels; + + ASSERT(texObj); + /* XXX choose cube map face here??? */ + srcImage = texObj->Image[0][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 (srcImage->IsCompressed) { + /* setup for compressed textures */ + GLuint row; + GLint components, size; + GLchan *dst; + + assert(texObj->Target == GL_TEXTURE_2D); + + if (srcImage->Format == GL_RGB) { + convertFormat = &_mesa_texformat_rgb; + components = 3; + } + else if (srcImage->Format == GL_RGBA) { + convertFormat = &_mesa_texformat_rgba; + components = 4; + } + else { + _mesa_problem(ctx, "bad srcImage->Format in _mesa_generate_mipmaps"); + return; + } + + /* allocate storage for uncompressed GL_RGB or GL_RGBA images */ + size = _mesa_bytes_per_pixel(srcImage->Format, CHAN_TYPE) + * srcImage->Width * srcImage->Height * srcImage->Depth + 20; + /* 20 extra bytes, just be safe when calling last FetchTexel */ + srcData = (GLubyte *) _mesa_malloc(size); + if (!srcData) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); + return; + } + dstData = (GLubyte *) _mesa_malloc(size / 2); /* 1/4 would probably be OK */ + if (!dstData) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); + _mesa_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; + } + + 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, bytesPerTexel; + + /* get src image parameters */ + srcImage = _mesa_select_tex_image(ctx, texUnit, target, level); + ASSERT(srcImage); + srcWidth = srcImage->Width; + srcHeight = srcImage->Height; + srcDepth = srcImage->Depth; + border = srcImage->Border; + + /* compute next (level+1) image size */ + if (srcWidth - 2 * border > 1) { + dstWidth = (srcWidth - 2 * border) / 2 + 2 * border; + } + else { + dstWidth = srcWidth; /* can't go smaller */ + } + if (srcHeight - 2 * border > 1) { + dstHeight = (srcHeight - 2 * border) / 2 + 2 * border; + } + else { + dstHeight = srcHeight; /* can't go smaller */ + } + if (srcDepth - 2 * border > 1) { + dstDepth = (srcDepth - 2 * border) / 2 + 2 * border; + } + else { + dstDepth = srcDepth; /* can't go smaller */ + } + + if (dstWidth == srcWidth && + dstHeight == srcHeight && + dstDepth == srcDepth) { + /* all done */ + if (srcImage->IsCompressed) { + _mesa_free((void *) srcData); + _mesa_free(dstData); + } + return; + } + + /* get dest gl_texture_image */ + dstImage = _mesa_get_tex_image(ctx, texUnit, 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->IntFormat); + dstImage->DriverData = NULL; + dstImage->TexFormat = srcImage->TexFormat; + dstImage->FetchTexelc = srcImage->FetchTexelc; + dstImage->FetchTexelf = srcImage->FetchTexelf; + ASSERT(dstImage->TexFormat); + ASSERT(dstImage->FetchTexelc); + ASSERT(dstImage->FetchTexelf); + + /* Alloc new teximage data buffer. + * Setup src and dest data pointers. + */ + if (dstImage->IsCompressed) { + ASSERT(dstImage->CompressedSize > 0); /* set by init_teximage_fields*/ + dstImage->Data = _mesa_alloc_texmemory(dstImage->CompressedSize); + if (!dstImage->Data) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); + return; + } + /* srcData and dstData are already set */ + ASSERT(srcData); + ASSERT(dstData); + } + else { + bytesPerTexel = srcImage->TexFormat->TexelBytes; + ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0); + dstImage->Data = _mesa_alloc_texmemory(dstWidth * dstHeight + * dstDepth * bytesPerTexel); + if (!dstImage->Data) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); + return; + } + srcData = (const GLubyte *) srcImage->Data; + dstData = (GLubyte *) dstImage->Data; + } + + /* + * We use simple 2x2 averaging to compute the next mipmap level. + */ + switch (target) { + case GL_TEXTURE_1D: + make_1d_mipmap(convertFormat, 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(convertFormat, border, + srcWidth, srcHeight, srcData, + dstWidth, dstHeight, dstData); + break; + case GL_TEXTURE_3D: + make_3d_mipmap(convertFormat, border, + srcWidth, srcHeight, srcDepth, srcData, + dstWidth, dstHeight, dstDepth, dstData); + break; + case GL_TEXTURE_RECTANGLE_NV: + /* no mipmaps, do nothing */ + break; + default: + _mesa_problem(ctx, "bad dimensions in _mesa_generate_mipmaps"); + return; + } + + if (dstImage->IsCompressed) { + GLubyte *temp; + /* compress image from dstData into dstImage->Data */ + const GLenum srcFormat = convertFormat->BaseFormat; + GLint dstRowStride = _mesa_compressed_row_stride(srcImage->IntFormat, + dstWidth); + ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA); + dstImage->TexFormat->StoreImage(ctx, 2, dstImage->Format, + 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]; + } + } + } +} + + + +/** + * This is the software fallback for Driver.GetTexImage(). + * All error checking will have been done before this routine is called. + */ +void +_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, GLvoid *pixels, + const struct gl_texture_object *texObj, + const struct gl_texture_image *texImage) +{ + GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2; + + if (ctx->Pack.BufferObj->Name) { + /* pack texture image into a PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(dimensions, &ctx->Pack, texImage->Width, + texImage->Height, texImage->Depth, + format, type, pixels)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetTexImage(invalid PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + ctx->Pack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION,"glGetTexImage(PBO is mapped)"); + return; + } + pixels = ADD_POINTERS(buf, pixels); + } + else if (!pixels) { + /* not an error */ + return; + } + + { + const GLint width = texImage->Width; + const GLint height = texImage->Height; + const GLint depth = texImage->Depth; + GLint img, row; + for (img = 0; img < depth; img++) { + for (row = 0; row < height; row++) { + /* compute destination address in client memory */ + GLvoid *dest = _mesa_image_address( dimensions, &ctx->Pack, pixels, + width, height, format, type, + img, row, 0); + assert(dest); + + if (format == GL_COLOR_INDEX) { + GLuint indexRow[MAX_WIDTH]; + GLint col; + /* Can't use FetchTexel here because that returns RGBA */ + if (texImage->TexFormat->IndexBits == 8) { + const GLubyte *src = (const GLubyte *) texImage->Data; + for (col = 0; col < width; col++) { + indexRow[col] = src[texImage->Width * + (img * texImage->Height + row) + col]; + } + } + else if (texImage->TexFormat->IndexBits == 16) { + const GLushort *src = (const GLushort *) texImage->Data; + for (col = 0; col < width; col++) { + indexRow[col] = src[texImage->Width * + (img * texImage->Height + row) + col]; + } + } + else { + _mesa_problem(ctx, + "Color index problem in _mesa_GetTexImage"); + } + _mesa_pack_index_span(ctx, width, type, dest, + indexRow, &ctx->Pack, + 0 /* no image transfer */); + } + else if (format == GL_DEPTH_COMPONENT) { + GLfloat depthRow[MAX_WIDTH]; + GLint col; + 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); + } + else if (format == GL_YCBCR_MESA) { + /* No pixel transfer */ + const GLint rowstride = texImage->RowStride; + MEMCPY(dest, + (const GLushort *) texImage->Data + row * rowstride, + width * sizeof(GLushort)); + /* check for byte swapping */ + if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR + && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) || + (texImage->TexFormat->MesaFormat == 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); + } + } + else { + /* general case: convert row to RGBA format */ + GLfloat rgba[MAX_WIDTH][4]; + GLint col; + for (col = 0; col < width; col++) { + (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]); + } + _mesa_pack_rgba_span_float(ctx, width, + (const GLfloat (*)[4]) rgba, + format, type, dest, &ctx->Pack, + 0 /* no image transfer */); + } /* format */ + } /* row */ + } /* img */ + } + + if (ctx->Pack.BufferObj->Name) { + 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(GLcontext *ctx, GLenum target, GLint level, + GLvoid *img, + const struct gl_texture_object *texObj, + const struct gl_texture_image *texImage) +{ + if (ctx->Pack.BufferObj->Name) { + /* pack texture image into a PBO */ + GLubyte *buf; + if ((const GLubyte *) img + texImage->CompressedSize > + (const GLubyte *) ctx->Pack.BufferObj->Size) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetCompressedTexImage(invalid PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + ctx->Pack.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetCompressedTexImage(PBO is mapped)"); + return; + } + img = ADD_POINTERS(buf, img); + } + else if (!img) { + /* not an error */ + return; + } + + /* just memcpy, no pixelstore or pixel transfer */ + MEMCPY(img, texImage->Data, texImage->CompressedSize); + + if (ctx->Pack.BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + ctx->Pack.BufferObj); + } +} diff --git a/reactos/dll/mesa32/src/main/texstore.h b/reactos/dll/mesa32/src/main/texstore.h new file mode 100644 index 00000000000..0b91f20e3a0 --- /dev/null +++ b/reactos/dll/mesa32/src/main/texstore.h @@ -0,0 +1,261 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 texstore.h + * Texture image storage routines. + * + * \author Brian Paul + */ + + +#ifndef TEXSTORE_H +#define TEXSTORE_H + + +#include "mtypes.h" + +/* Macro just to save some typing */ +#define STORE_PARAMS \ + GLcontext *ctx, GLuint dims, \ + GLenum baseInternalFormat, \ + const struct gl_texture_format *dstFormat, \ + GLvoid *dstAddr, \ + GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \ + GLint dstRowStride, GLint dstImageStride, \ + GLint srcWidth, GLint srcHeight, GLint srcDepth, \ + GLenum srcFormat, GLenum srcType, \ + const GLvoid *srcAddr, \ + const struct gl_pixelstore_attrib *srcPacking + + +extern GLboolean _mesa_texstore_rgba(STORE_PARAMS); +extern GLboolean _mesa_texstore_color_index(STORE_PARAMS); +extern GLboolean _mesa_texstore_depth_component16(STORE_PARAMS); +extern GLboolean _mesa_texstore_depth_component_float32(STORE_PARAMS); +extern GLboolean _mesa_texstore_rgba8888(STORE_PARAMS); +extern GLboolean _mesa_texstore_argb8888(STORE_PARAMS); +extern GLboolean _mesa_texstore_rgb888(STORE_PARAMS); +extern GLboolean _mesa_texstore_bgr888(STORE_PARAMS); +extern GLboolean _mesa_texstore_rgb565(STORE_PARAMS); +extern GLboolean _mesa_texstore_rgb565_rev(STORE_PARAMS); +extern GLboolean _mesa_texstore_argb4444(STORE_PARAMS); +extern GLboolean _mesa_texstore_argb4444_rev(STORE_PARAMS); +extern GLboolean _mesa_texstore_argb1555(STORE_PARAMS); +extern GLboolean _mesa_texstore_argb1555_rev(STORE_PARAMS); +extern GLboolean _mesa_texstore_al88(STORE_PARAMS); +extern GLboolean _mesa_texstore_al88_rev(STORE_PARAMS); +extern GLboolean _mesa_texstore_rgb332(STORE_PARAMS); +extern GLboolean _mesa_texstore_a8(STORE_PARAMS); +extern GLboolean _mesa_texstore_ci8(STORE_PARAMS); +extern GLboolean _mesa_texstore_ycbcr(STORE_PARAMS); +extern GLboolean _mesa_texstore_rgba_float32(STORE_PARAMS); +extern GLboolean _mesa_texstore_rgba_float16(STORE_PARAMS); +extern GLboolean _mesa_texstore_rgb_fxt1(STORE_PARAMS); +extern GLboolean _mesa_texstore_rgba_fxt1(STORE_PARAMS); +extern GLboolean _mesa_texstore_rgb_dxt1(STORE_PARAMS); +extern GLboolean _mesa_texstore_rgba_dxt1(STORE_PARAMS); +extern GLboolean _mesa_texstore_rgba_dxt3(STORE_PARAMS); +extern GLboolean _mesa_texstore_rgba_dxt5(STORE_PARAMS); + + +extern GLchan * +_mesa_make_temp_chan_image(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *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(GLcontext *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 void +_mesa_generate_mipmap(GLcontext *ctx, GLenum target, + const struct gl_texture_unit *texUnit, + 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); + + +extern void +_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, GLvoid *pixels, + const struct gl_texture_object *texObj, + const struct gl_texture_image *texImage); + + +extern void +_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, + GLvoid *img, + const struct gl_texture_object *texObj, + const struct gl_texture_image *texImage); + +extern const GLvoid * +_mesa_validate_pbo_teximage(GLcontext *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(GLcontext *ctx, + GLsizei imageSize, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + const char *funcName); + +extern void +_mesa_unmap_teximage_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack); + + +#endif diff --git a/reactos/dll/mesa32/src/main/varray.c b/reactos/dll/mesa32/src/main/varray.c new file mode 100644 index 00000000000..6781b698150 --- /dev/null +++ b/reactos/dll/mesa32/src/main/varray.c @@ -0,0 +1,994 @@ +/* + * 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. + */ + + +#include "glheader.h" +#include "imports.h" +#include "bufferobj.h" +#include "context.h" +#include "enable.h" +#include "enums.h" +#include "dlist.h" +#include "texstate.h" +#include "mtypes.h" +#include "varray.h" +#include "dispatch.h" + +#ifndef GL_BOOLEAN +#define GL_BOOLEAN 0x9999 +#endif + + +/** + * Update the fields of a vertex array structure. + * We need to do a few special things for arrays that live in + * vertex buffer objects. + */ +static void +update_array(GLcontext *ctx, struct gl_client_array *array, + GLuint dirtyFlag, GLsizei elementSize, + GLint size, GLenum type, + GLsizei stride, GLboolean normalized, const GLvoid *ptr) +{ + array->Size = size; + array->Type = type; + array->Stride = stride; + array->StrideB = stride ? stride : elementSize; + array->Normalized = normalized; + array->Ptr = (const GLubyte *) ptr; +#if FEATURE_ARB_vertex_buffer_object + array->BufferObj->RefCount--; + if (array->BufferObj->RefCount <= 0) { + ASSERT(array->BufferObj->Name); + _mesa_remove_buffer_object( ctx, array->BufferObj ); + (*ctx->Driver.DeleteBuffer)( ctx, array->BufferObj ); + } + array->BufferObj = ctx->Array.ArrayBufferObj; + array->BufferObj->RefCount++; + /* Compute the index of the last array element that's inside the buffer. + * Later in glDrawArrays we'll check if start + count > _MaxElement to + * be sure we won't go out of bounds. + */ + if (ctx->Array.ArrayBufferObj->Name) + array->_MaxElement = ((GLsizeiptrARB) ctx->Array.ArrayBufferObj->Size + - (GLsizeiptrARB) array->Ptr) / array->StrideB; + else +#endif + array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */ + + ctx->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= dirtyFlag; +} + + +void GLAPIENTRY +_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) +{ + GLsizei elementSize; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (size < 2 || size > 4) { + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexPointer(size)" ); + return; + } + if (stride < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glVertexPointer(stride)" ); + return; + } + + if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) + _mesa_debug(ctx, "glVertexPointer( sz %d type %s stride %d )\n", size, + _mesa_lookup_enum_by_nr( type ), stride); + + /* always need to check that is legal */ + switch (type) { + case GL_SHORT: + elementSize = size * sizeof(GLshort); + break; + case GL_INT: + elementSize = size * sizeof(GLint); + break; + case GL_FLOAT: + elementSize = size * sizeof(GLfloat); + break; + case GL_DOUBLE: + elementSize = size * sizeof(GLdouble); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexPointer(type)" ); + return; + } + + update_array(ctx, &ctx->Array.Vertex, _NEW_ARRAY_VERTEX, + elementSize, size, type, stride, GL_FALSE, ptr); + + if (ctx->Driver.VertexPointer) + ctx->Driver.VertexPointer( ctx, size, type, stride, ptr ); +} + + +void GLAPIENTRY +_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) +{ + GLsizei elementSize; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (stride < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glNormalPointer(stride)" ); + return; + } + + if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) + _mesa_debug(ctx, "glNormalPointer( type %s stride %d )\n", + _mesa_lookup_enum_by_nr( type ), stride); + + switch (type) { + case GL_BYTE: + elementSize = 3 * sizeof(GLbyte); + break; + case GL_SHORT: + elementSize = 3 * sizeof(GLshort); + break; + case GL_INT: + elementSize = 3 * sizeof(GLint); + break; + case GL_FLOAT: + elementSize = 3 * sizeof(GLfloat); + break; + case GL_DOUBLE: + elementSize = 3 * sizeof(GLdouble); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glNormalPointer(type)" ); + return; + } + + update_array(ctx, &ctx->Array.Normal, _NEW_ARRAY_NORMAL, + elementSize, 3, type, stride, GL_FALSE, ptr); + + if (ctx->Driver.NormalPointer) + ctx->Driver.NormalPointer( ctx, type, stride, ptr ); +} + + +void GLAPIENTRY +_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) +{ + GLsizei elementSize; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (size < 3 || size > 4) { + _mesa_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" ); + return; + } + if (stride < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glColorPointer(stride)" ); + return; + } + + if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) + _mesa_debug(ctx, "glColorPointer( sz %d type %s stride %d )\n", size, + _mesa_lookup_enum_by_nr( type ), stride); + + switch (type) { + case GL_BYTE: + elementSize = size * sizeof(GLbyte); + break; + case GL_UNSIGNED_BYTE: + elementSize = size * sizeof(GLubyte); + break; + case GL_SHORT: + elementSize = size * sizeof(GLshort); + break; + case GL_UNSIGNED_SHORT: + elementSize = size * sizeof(GLushort); + break; + case GL_INT: + elementSize = size * sizeof(GLint); + break; + case GL_UNSIGNED_INT: + elementSize = size * sizeof(GLuint); + break; + case GL_FLOAT: + elementSize = size * sizeof(GLfloat); + break; + case GL_DOUBLE: + elementSize = size * sizeof(GLdouble); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glColorPointer(type)" ); + return; + } + + update_array(ctx, &ctx->Array.Color, _NEW_ARRAY_COLOR0, + elementSize, size, type, stride, GL_FALSE, ptr); + + if (ctx->Driver.ColorPointer) + ctx->Driver.ColorPointer( ctx, size, type, stride, ptr ); +} + + +void GLAPIENTRY +_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) +{ + GLint elementSize; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (stride < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glFogCoordPointer(stride)" ); + return; + } + + switch (type) { + case GL_FLOAT: + elementSize = sizeof(GLfloat); + break; + case GL_DOUBLE: + elementSize = sizeof(GLdouble); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glFogCoordPointer(type)" ); + return; + } + + update_array(ctx, &ctx->Array.FogCoord, _NEW_ARRAY_FOGCOORD, + elementSize, 1, type, stride, GL_FALSE, ptr); + + if (ctx->Driver.FogCoordPointer) + ctx->Driver.FogCoordPointer( ctx, type, stride, ptr ); +} + + +void GLAPIENTRY +_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) +{ + GLsizei elementSize; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (stride < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glIndexPointer(stride)" ); + return; + } + + switch (type) { + case GL_UNSIGNED_BYTE: + elementSize = sizeof(GLubyte); + break; + case GL_SHORT: + elementSize = sizeof(GLshort); + break; + case GL_INT: + elementSize = sizeof(GLint); + break; + case GL_FLOAT: + elementSize = sizeof(GLfloat); + break; + case GL_DOUBLE: + elementSize = sizeof(GLdouble); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glIndexPointer(type)" ); + return; + } + + update_array(ctx, &ctx->Array.Index, _NEW_ARRAY_INDEX, + elementSize, 1, type, stride, GL_FALSE, ptr); + + if (ctx->Driver.IndexPointer) + ctx->Driver.IndexPointer( ctx, type, stride, ptr ); +} + + +void GLAPIENTRY +_mesa_SecondaryColorPointerEXT(GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr) +{ + GLsizei elementSize; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (size != 3 && size != 4) { + _mesa_error( ctx, GL_INVALID_VALUE, "glSecondaryColorPointer(size)" ); + return; + } + if (stride < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glSecondaryColorPointer(stride)" ); + return; + } + + if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) + _mesa_debug(ctx, "glSecondaryColorPointer( sz %d type %s stride %d )\n", + size, _mesa_lookup_enum_by_nr( type ), stride); + + switch (type) { + case GL_BYTE: + elementSize = size * sizeof(GLbyte); + break; + case GL_UNSIGNED_BYTE: + elementSize = size * sizeof(GLubyte); + break; + case GL_SHORT: + elementSize = size * sizeof(GLshort); + break; + case GL_UNSIGNED_SHORT: + elementSize = size * sizeof(GLushort); + break; + case GL_INT: + elementSize = size * sizeof(GLint); + break; + case GL_UNSIGNED_INT: + elementSize = size * sizeof(GLuint); + break; + case GL_FLOAT: + elementSize = size * sizeof(GLfloat); + break; + case GL_DOUBLE: + elementSize = size * sizeof(GLdouble); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glSecondaryColorPointer(type)" ); + return; + } + + update_array(ctx, &ctx->Array.SecondaryColor, _NEW_ARRAY_COLOR1, + elementSize, size, type, stride, GL_FALSE, ptr); + + if (ctx->Driver.SecondaryColorPointer) + ctx->Driver.SecondaryColorPointer( ctx, size, type, stride, ptr ); +} + + +void GLAPIENTRY +_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr) +{ + GLint elementSize; + GET_CURRENT_CONTEXT(ctx); + const GLuint unit = ctx->Array.ActiveTexture; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (size < 1 || size > 4) { + _mesa_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(size)" ); + return; + } + if (stride < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(stride)" ); + return; + } + + if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) + _mesa_debug(ctx, "glTexCoordPointer(unit %u sz %d type %s stride %d)\n", + unit, size, _mesa_lookup_enum_by_nr( type ), stride); + + /* always need to check that is legal */ + switch (type) { + case GL_SHORT: + elementSize = size * sizeof(GLshort); + break; + case GL_INT: + elementSize = size * sizeof(GLint); + break; + case GL_FLOAT: + elementSize = size * sizeof(GLfloat); + break; + case GL_DOUBLE: + elementSize = size * sizeof(GLdouble); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexCoordPointer(type)" ); + return; + } + + update_array(ctx, &ctx->Array.TexCoord[unit], _NEW_ARRAY_TEXCOORD(unit), + elementSize, size, type, stride, GL_FALSE, ptr); + + if (ctx->Driver.TexCoordPointer) + ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr ); +} + + +void GLAPIENTRY +_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (stride < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glEdgeFlagPointer(stride)" ); + return; + } + + update_array(ctx, &ctx->Array.EdgeFlag, _NEW_ARRAY_EDGEFLAG, + sizeof(GLboolean), 1, GL_BOOLEAN, stride, GL_FALSE, ptr); + + if (ctx->Driver.EdgeFlagPointer) + ctx->Driver.EdgeFlagPointer( ctx, stride, ptr ); +} + + +#if FEATURE_NV_vertex_program +void GLAPIENTRY +_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr) +{ + GLsizei elementSize; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (index >= VERT_ATTRIB_MAX) { + _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(index)"); + return; + } + + if (size < 1 || size > 4) { + _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(size)"); + return; + } + + if (stride < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(stride)"); + return; + } + + if (type == GL_UNSIGNED_BYTE && size != 4) { + _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(size!=4)"); + return; + } + + /* check for valid 'type' and compute StrideB right away */ + switch (type) { + case GL_UNSIGNED_BYTE: + elementSize = size * sizeof(GLubyte); + break; + case GL_SHORT: + elementSize = size * sizeof(GLshort); + break; + case GL_FLOAT: + elementSize = size * sizeof(GLfloat); + break; + case GL_DOUBLE: + elementSize = size * sizeof(GLdouble); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttribPointerNV(type)" ); + return; + } + + update_array(ctx, &ctx->Array.VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), + elementSize, size, type, stride, GL_FALSE, ptr); + + if (ctx->Driver.VertexAttribPointer) + ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr ); +} +#endif + + +#if FEATURE_ARB_vertex_program +void GLAPIENTRY +_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, + GLboolean normalized, + GLsizei stride, const GLvoid *ptr) +{ + GLsizei elementSize; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (index >= ctx->Const.MaxVertexProgramAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(index)"); + return; + } + + if (size < 1 || size > 4) { + _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(size)"); + return; + } + + if (stride < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(stride)"); + return; + } + + if (type == GL_UNSIGNED_BYTE && size != 4) { + _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(size!=4)"); + return; + } + + /* check for valid 'type' and compute StrideB right away */ + /* NOTE: more types are supported here than in the NV extension */ + switch (type) { + case GL_BYTE: + elementSize = size * sizeof(GLbyte); + break; + case GL_UNSIGNED_BYTE: + elementSize = size * sizeof(GLubyte); + break; + case GL_SHORT: + elementSize = size * sizeof(GLshort); + break; + case GL_UNSIGNED_SHORT: + elementSize = size * sizeof(GLushort); + break; + case GL_INT: + elementSize = size * sizeof(GLint); + break; + case GL_UNSIGNED_INT: + elementSize = size * sizeof(GLuint); + break; + case GL_FLOAT: + elementSize = size * sizeof(GLfloat); + break; + case GL_DOUBLE: + elementSize = size * sizeof(GLdouble); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttribPointerARB(type)" ); + return; + } + + update_array(ctx, &ctx->Array.VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), + elementSize, size, type, stride, normalized, ptr); + + /* XXX fix + if (ctx->Driver.VertexAttribPointer) + ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr ); + */ +} +#endif + + +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 ); + + /* 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 && count > 0 && + count <= (GLint) ctx->Const.MaxArrayLockSize) { + ctx->Array.LockFirst = first; + ctx->Array.LockCount = count; + } + else { + ctx->Array.LockFirst = 0; + ctx->Array.LockCount = 0; + } + + ctx->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_ALL; + + if (ctx->Driver.LockArraysEXT) + ctx->Driver.LockArraysEXT( ctx, first, count ); +} + + +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"); + + ctx->Array.LockFirst = 0; + ctx->Array.LockCount = 0; + ctx->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_ALL; + + if (ctx->Driver.UnlockArraysEXT) + ctx->Driver.UnlockArraysEXT( ctx ); +} + + +/* GL_EXT_multi_draw_arrays */ +/* Somebody forgot to spec the first and count parameters as const! */ +void GLAPIENTRY +_mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, + 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_EXT_multi_draw_arrays */ +void GLAPIENTRY +_mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, + const GLvoid **indices, 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_DrawElements(ctx->Exec, (mode, count[i], type, indices[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] )); + } + } +} + + +/**********************************************************************/ +/***** Initialization *****/ +/**********************************************************************/ + +void +_mesa_init_varray( GLcontext * ctx ) +{ + GLuint i; + + /* Vertex arrays */ + ctx->Array.Vertex.Size = 4; + ctx->Array.Vertex.Type = GL_FLOAT; + ctx->Array.Vertex.Stride = 0; + ctx->Array.Vertex.StrideB = 0; + ctx->Array.Vertex.Ptr = NULL; + ctx->Array.Vertex.Enabled = GL_FALSE; + ctx->Array.Vertex.Flags = CA_CLIENT_DATA; + ctx->Array.Normal.Type = GL_FLOAT; + ctx->Array.Normal.Stride = 0; + ctx->Array.Normal.StrideB = 0; + ctx->Array.Normal.Ptr = NULL; + ctx->Array.Normal.Enabled = GL_FALSE; + ctx->Array.Normal.Flags = CA_CLIENT_DATA; + ctx->Array.Color.Size = 4; + ctx->Array.Color.Type = GL_FLOAT; + ctx->Array.Color.Stride = 0; + ctx->Array.Color.StrideB = 0; + ctx->Array.Color.Ptr = NULL; + ctx->Array.Color.Enabled = GL_FALSE; + ctx->Array.Color.Flags = CA_CLIENT_DATA; + ctx->Array.SecondaryColor.Size = 4; + ctx->Array.SecondaryColor.Type = GL_FLOAT; + ctx->Array.SecondaryColor.Stride = 0; + ctx->Array.SecondaryColor.StrideB = 0; + ctx->Array.SecondaryColor.Ptr = NULL; + ctx->Array.SecondaryColor.Enabled = GL_FALSE; + ctx->Array.SecondaryColor.Flags = CA_CLIENT_DATA; + ctx->Array.FogCoord.Size = 1; + ctx->Array.FogCoord.Type = GL_FLOAT; + ctx->Array.FogCoord.Stride = 0; + ctx->Array.FogCoord.StrideB = 0; + ctx->Array.FogCoord.Ptr = NULL; + ctx->Array.FogCoord.Enabled = GL_FALSE; + ctx->Array.FogCoord.Flags = CA_CLIENT_DATA; + ctx->Array.Index.Type = GL_FLOAT; + ctx->Array.Index.Stride = 0; + ctx->Array.Index.StrideB = 0; + ctx->Array.Index.Ptr = NULL; + ctx->Array.Index.Enabled = GL_FALSE; + ctx->Array.Index.Flags = CA_CLIENT_DATA; + for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + ctx->Array.TexCoord[i].Size = 4; + ctx->Array.TexCoord[i].Type = GL_FLOAT; + ctx->Array.TexCoord[i].Stride = 0; + ctx->Array.TexCoord[i].StrideB = 0; + ctx->Array.TexCoord[i].Ptr = NULL; + ctx->Array.TexCoord[i].Enabled = GL_FALSE; + ctx->Array.TexCoord[i].Flags = CA_CLIENT_DATA; + } + ctx->Array.EdgeFlag.Stride = 0; + ctx->Array.EdgeFlag.StrideB = 0; + ctx->Array.EdgeFlag.Ptr = NULL; + ctx->Array.EdgeFlag.Enabled = GL_FALSE; + ctx->Array.EdgeFlag.Flags = CA_CLIENT_DATA; + ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ + for (i = 0; i < VERT_ATTRIB_MAX; i++) { + ctx->Array.VertexAttrib[i].Size = 4; + ctx->Array.VertexAttrib[i].Type = GL_FLOAT; + ctx->Array.VertexAttrib[i].Stride = 0; + ctx->Array.VertexAttrib[i].StrideB = 0; + ctx->Array.VertexAttrib[i].Ptr = NULL; + ctx->Array.VertexAttrib[i].Enabled = GL_FALSE; + ctx->Array.VertexAttrib[i].Flags = CA_CLIENT_DATA; + } +} diff --git a/reactos/dll/mesa32/src/main/varray.h b/reactos/dll/mesa32/src/main/varray.h new file mode 100644 index 00000000000..3589735f684 --- /dev/null +++ b/reactos/dll/mesa32/src/main/varray.h @@ -0,0 +1,160 @@ +/** + * \file varray.h + * Vertex arrays. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * 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 VARRAY_H +#define VARRAY_H + + +#include "mtypes.h" + +#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_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); + + +extern void GLAPIENTRY +_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer); + + +extern void GLAPIENTRY +_mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, + GLsizei *count, GLsizei primcount ); + +extern void GLAPIENTRY +_mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, + const GLvoid **indices, GLsizei primcount ); + + +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 +_mesa_init_varray( GLcontext * ctx ); + +#else + +/** No-op */ +#define _mesa_init_varray( c ) ((void)0) + +#endif + +#endif diff --git a/reactos/dll/mesa32/src/main/version.h b/reactos/dll/mesa32/src/main/version.h new file mode 100644 index 00000000000..f2987b9f504 --- /dev/null +++ b/reactos/dll/mesa32/src/main/version.h @@ -0,0 +1,52 @@ +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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 VERSION_H +#define VERSION_H + + +/* Mesa version */ +#define MESA_MAJOR 6 +#define MESA_MINOR 4 +#define MESA_PATCH 0 +#define MESA_VERSION_STRING "6.4" + +/* To make version comparison easy */ +#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +#define MESA_VERSION_CODE MESA_VERSION(MESA_MAJOR, MESA_MINOR, MESA_PATCH) + + +/* OpenGL API version */ +#define OPENGL_MAJOR 1 +#define OPENGL_MINOR 5 +#define OPENGL_PATCH 0 +#define OPENGL_VERSION_STRING "1.5" + +/* To make version comparison easy */ +#define OPENGL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +#define OPENGL_VERSION_CODE OPENGL_VERSION(OPENGL_MAJOR, OPENGL_MINOR, OPENGL_PATCH) + + +#endif /* VERSION_H */ diff --git a/reactos/dll/mesa32/src/main/vsnprintf.c b/reactos/dll/mesa32/src/main/vsnprintf.c new file mode 100644 index 00000000000..ab6c740d772 --- /dev/null +++ b/reactos/dll/mesa32/src/main/vsnprintf.c @@ -0,0 +1,165 @@ +/* + * Revision 12: http://theos.com/~deraadt/snprintf.c + * + * Copyright (c) 1997 Theo de Raadt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __VMS +# include +#endif +#include +#include +#include +#include +#if __STDC__ +#include +#include +#else +#include +#endif +#include +#include +#include + +#ifndef roundup +#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) +#endif + +#ifdef __sgi +#define size_t ssize_t +#endif + +static int pgsize; +static char *curobj; +static int caught; +static sigjmp_buf bail; + +#define EXTRABYTES 2 /* XXX: why 2? you don't want to know */ + +static char * +msetup(str, n) + char *str; + size_t n; +{ + char *e; + + if (n == 0) + return NULL; + if (pgsize == 0) + pgsize = getpagesize(); + curobj = (char *)malloc(n + EXTRABYTES + pgsize * 2); + if (curobj == NULL) + return NULL; + e = curobj + n + EXTRABYTES; + e = (char *)roundup((unsigned long)e, pgsize); + if (mprotect(e, pgsize, PROT_NONE) == -1) { + free(curobj); + curobj = NULL; + return NULL; + } + e = e - n - EXTRABYTES; + *e = '\0'; + return (e); +} + +static void + mcatch( int a ) +{ + siglongjmp(bail, 1); +} + +static void +mcleanup(str, n, p) + char *str; + size_t n; + char *p; +{ + strncpy(str, p, n-1); + str[n-1] = '\0'; + if (mprotect((caddr_t)(p + n + EXTRABYTES), pgsize, + PROT_READ|PROT_WRITE|PROT_EXEC) == -1) + mprotect((caddr_t)(p + n + EXTRABYTES), pgsize, + PROT_READ|PROT_WRITE); + free(curobj); +} + +int +#if __STDC__ +vsnprintf(char *str, size_t n, char const *fmt, va_list ap) +#else +vsnprintf(str, n, fmt, ap) + char *str; + size_t n; + char *fmt; + char *ap; +#endif +{ + struct sigaction osa, nsa; + char *p; + int ret = n + 1; /* if we bail, indicated we overflowed */ + + memset(&nsa, 0, sizeof nsa); + nsa.sa_handler = mcatch; + sigemptyset(&nsa.sa_mask); + + p = msetup(str, n); + if (p == NULL) { + *str = '\0'; + return 0; + } + if (sigsetjmp(bail, 1) == 0) { + if (sigaction(SIGSEGV, &nsa, &osa) == -1) { + mcleanup(str, n, p); + return (0); + } + ret = vsprintf(p, fmt, ap); + } + mcleanup(str, n, p); + (void) sigaction(SIGSEGV, &osa, NULL); + return (ret); +} + +int +#if __STDC__ +snprintf(char *str, size_t n, char const *fmt, ...) +#else +snprintf(str, n, fmt, va_alist) + char *str; + size_t n; + char *fmt; + va_dcl +#endif +{ + va_list ap; +#if __STDC__ + va_start(ap, fmt); +#else + va_start(ap); +#endif + + return (vsnprintf(str, n, fmt, ap)); + va_end(ap); +} + + + diff --git a/reactos/dll/mesa32/src/main/vtxfmt.c b/reactos/dll/mesa32/src/main/vtxfmt.c new file mode 100644 index 00000000000..b3c63982911 --- /dev/null +++ b/reactos/dll/mesa32/src/main/vtxfmt.c @@ -0,0 +1,185 @@ +/* + * 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 + * Gareth Hughes + */ + +#include "glheader.h" +#include "api_loopback.h" +#include "context.h" +#include "imports.h" +#include "mtypes.h" +#include "state.h" +#include "vtxfmt.h" + + +/* The neutral vertex format. This wraps all tnl module functions, + * verifying that the currently-installed module is valid and then + * installing the function pointers in a lazy fashion. It records the + * function pointers that have been swapped out, which allows a fast + * restoration of the neutral module in almost all cases -- a typical + * app might only require 4-6 functions to be modified from the neutral + * baseline, and only restoring these is certainly preferable to doing + * the entire module's 60 or so function pointers. + */ + +#define PRE_LOOPBACK( FUNC ) \ +{ \ + GET_CURRENT_CONTEXT(ctx); \ + struct gl_tnl_module * const tnl = &(ctx->TnlModule); \ + const int tmp_offset = _gloffset_ ## FUNC ; \ + \ + ASSERT( tnl->Current ); \ + ASSERT( tnl->SwapCount < NUM_VERTEX_FORMAT_ENTRIES ); \ + ASSERT( tmp_offset >= 0 ); \ + \ + /* Save the swapped function's dispatch entry so it can be */ \ + /* restored later. */ \ + tnl->Swapped[tnl->SwapCount].location = & (((_glapi_proc *)ctx->Exec)[tmp_offset]); \ + tnl->Swapped[tnl->SwapCount].function = (_glapi_proc)TAG(FUNC); \ + tnl->SwapCount++; \ + \ + if ( 0 ) \ + _mesa_debug(ctx, " swapping gl" #FUNC"...\n" ); \ + \ + /* Install the tnl function pointer. */ \ + SET_ ## FUNC(ctx->Exec, tnl->Current->FUNC); \ +} + +#define TAG(x) neutral_##x +#include "vtxfmt_tmp.h" + + + +static void +install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) +{ + SET_ArrayElement(tab, vfmt->ArrayElement); + 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); + SET_EdgeFlagv(tab, vfmt->EdgeFlagv); + SET_EvalCoord1f(tab, vfmt->EvalCoord1f); + SET_EvalCoord1fv(tab, vfmt->EvalCoord1fv); + SET_EvalCoord2f(tab, vfmt->EvalCoord2f); + SET_EvalCoord2fv(tab, vfmt->EvalCoord2fv); + SET_EvalPoint1(tab, vfmt->EvalPoint1); + SET_EvalPoint2(tab, vfmt->EvalPoint2); + 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); + SET_CallList(tab, vfmt->CallList); + SET_CallLists(tab, vfmt->CallLists); + SET_Begin(tab, vfmt->Begin); + SET_End(tab, vfmt->End); + 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); + 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); + SET_Rectf(tab, vfmt->Rectf); + SET_DrawArrays(tab, vfmt->DrawArrays); + SET_DrawElements(tab, vfmt->DrawElements); + SET_DrawRangeElements(tab, vfmt->DrawRangeElements); + SET_EvalMesh1(tab, vfmt->EvalMesh1); + SET_EvalMesh2(tab, vfmt->EvalMesh2); + ASSERT(tab->EvalMesh2); +} + + +void _mesa_init_exec_vtxfmt( GLcontext *ctx ) +{ + install_vtxfmt( ctx->Exec, &neutral_vtxfmt ); + ctx->TnlModule.SwapCount = 0; +} + + +void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ) +{ + ctx->TnlModule.Current = vfmt; + _mesa_restore_exec_vtxfmt( ctx ); +} + + +void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ) +{ + install_vtxfmt( ctx->Save, vfmt ); +} + + +void _mesa_restore_exec_vtxfmt( GLcontext *ctx ) +{ + struct gl_tnl_module *tnl = &(ctx->TnlModule); + GLuint i; + + /* Restore the neutral tnl module wrapper. + */ + for ( i = 0 ; i < tnl->SwapCount ; i++ ) { + *(tnl->Swapped[i].location) = tnl->Swapped[i].function; + } + + tnl->SwapCount = 0; +} diff --git a/reactos/dll/mesa32/src/main/vtxfmt.h b/reactos/dll/mesa32/src/main/vtxfmt.h new file mode 100644 index 00000000000..76f108e0232 --- /dev/null +++ b/reactos/dll/mesa32/src/main/vtxfmt.h @@ -0,0 +1,43 @@ +/** + * \file vtxfmt.h + * + * \author Keith Whitwell + * \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_ + +extern void _mesa_init_exec_vtxfmt( GLcontext *ctx ); + +extern void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ); +extern void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ); + +extern void _mesa_restore_exec_vtxfmt( GLcontext *ctx ); + +#endif diff --git a/reactos/dll/mesa32/src/main/vtxfmt_tmp.h b/reactos/dll/mesa32/src/main/vtxfmt_tmp.h new file mode 100644 index 00000000000..2a0fdde4665 --- /dev/null +++ b/reactos/dll/mesa32/src/main/vtxfmt_tmp.h @@ -0,0 +1,537 @@ +/* + * 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: + * Gareth Hughes + */ + +#ifndef PRE_LOOPBACK +#define PRE_LOOPBACK( FUNC ) +#endif + +#include "dispatch.h" +#include "glapioffsets.h" + +static void GLAPIENTRY TAG(ArrayElement)( GLint i ) +{ + PRE_LOOPBACK( ArrayElement ); + CALL_ArrayElement(GET_DISPATCH(), ( i )); +} + +static void GLAPIENTRY TAG(Color3f)( GLfloat r, GLfloat g, GLfloat b ) +{ + PRE_LOOPBACK( Color3f ); + CALL_Color3f(GET_DISPATCH(), ( r, g, b )); +} + +static void GLAPIENTRY TAG(Color3fv)( const GLfloat *v ) +{ + PRE_LOOPBACK( Color3fv ); + CALL_Color3fv(GET_DISPATCH(), ( v )); +} + +static void GLAPIENTRY TAG(Color4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a ) +{ + PRE_LOOPBACK( Color4f ); + CALL_Color4f(GET_DISPATCH(), ( r, g, b, a )); +} + +static void GLAPIENTRY TAG(Color4fv)( const GLfloat *v ) +{ + PRE_LOOPBACK( Color4fv ); + CALL_Color4fv(GET_DISPATCH(), ( v )); +} + +static void GLAPIENTRY TAG(EdgeFlag)( GLboolean e ) +{ + PRE_LOOPBACK( EdgeFlag ); + CALL_EdgeFlag(GET_DISPATCH(), ( e )); +} + +static void GLAPIENTRY TAG(EdgeFlagv)( const GLboolean *v ) +{ + PRE_LOOPBACK( EdgeFlagv ); + CALL_EdgeFlagv(GET_DISPATCH(), ( v )); +} + +static void GLAPIENTRY TAG(EvalCoord1f)( GLfloat s ) +{ + PRE_LOOPBACK( EvalCoord1f ); + CALL_EvalCoord1f(GET_DISPATCH(), ( s )); +} + +static void GLAPIENTRY TAG(EvalCoord1fv)( const GLfloat *v ) +{ + PRE_LOOPBACK( EvalCoord1fv ); + CALL_EvalCoord1fv(GET_DISPATCH(), ( v )); +} + +static void GLAPIENTRY TAG(EvalCoord2f)( GLfloat s, GLfloat t ) +{ + PRE_LOOPBACK( EvalCoord2f ); + CALL_EvalCoord2f(GET_DISPATCH(), ( s, t )); +} + +static void GLAPIENTRY TAG(EvalCoord2fv)( const GLfloat *v ) +{ + PRE_LOOPBACK( EvalCoord2fv ); + CALL_EvalCoord2fv(GET_DISPATCH(), ( v )); +} + +static void GLAPIENTRY TAG(EvalPoint1)( GLint i ) +{ + PRE_LOOPBACK( EvalPoint1 ); + CALL_EvalPoint1(GET_DISPATCH(), ( i )); +} + +static void GLAPIENTRY TAG(EvalPoint2)( GLint i, GLint j ) +{ + PRE_LOOPBACK( EvalPoint2 ); + CALL_EvalPoint2(GET_DISPATCH(), ( i, j )); +} + +static void GLAPIENTRY TAG(FogCoordfEXT)( GLfloat f ) +{ + PRE_LOOPBACK( FogCoordfEXT ); + CALL_FogCoordfEXT(GET_DISPATCH(), ( f )); +} + +static void GLAPIENTRY TAG(FogCoordfvEXT)( const GLfloat *v ) +{ + PRE_LOOPBACK( FogCoordfvEXT ); + CALL_FogCoordfvEXT(GET_DISPATCH(), ( v )); +} + +static void GLAPIENTRY TAG(Indexf)( GLfloat f ) +{ + PRE_LOOPBACK( Indexf ); + CALL_Indexf(GET_DISPATCH(), ( f )); +} + +static void GLAPIENTRY TAG(Indexfv)( const GLfloat *v ) +{ + PRE_LOOPBACK( Indexfv ); + CALL_Indexfv(GET_DISPATCH(), ( v )); +} + +static void GLAPIENTRY TAG(Materialfv)( GLenum face, GLenum pname, const GLfloat *v ) +{ + PRE_LOOPBACK( Materialfv ); + CALL_Materialfv(GET_DISPATCH(), ( face, pname, v )); +} + +static void GLAPIENTRY TAG(MultiTexCoord1fARB)( GLenum target, GLfloat a ) +{ + PRE_LOOPBACK( MultiTexCoord1fARB ); + CALL_MultiTexCoord1fARB(GET_DISPATCH(), ( target, a )); +} + +static void GLAPIENTRY TAG(MultiTexCoord1fvARB)( GLenum target, const GLfloat *tc ) +{ + PRE_LOOPBACK( MultiTexCoord1fvARB ); + CALL_MultiTexCoord1fvARB(GET_DISPATCH(), ( target, tc )); +} + +static void GLAPIENTRY TAG(MultiTexCoord2fARB)( GLenum target, GLfloat s, GLfloat t ) +{ + PRE_LOOPBACK( MultiTexCoord2fARB ); + CALL_MultiTexCoord2fARB(GET_DISPATCH(), ( target, s, t )); +} + +static void GLAPIENTRY TAG(MultiTexCoord2fvARB)( GLenum target, const GLfloat *tc ) +{ + PRE_LOOPBACK( MultiTexCoord2fvARB ); + CALL_MultiTexCoord2fvARB(GET_DISPATCH(), ( target, tc )); +} + +static void GLAPIENTRY TAG(MultiTexCoord3fARB)( GLenum target, GLfloat s, + GLfloat t, GLfloat r ) +{ + PRE_LOOPBACK( MultiTexCoord3fARB ); + CALL_MultiTexCoord3fARB(GET_DISPATCH(), ( target, s, t, r )); +} + +static void GLAPIENTRY TAG(MultiTexCoord3fvARB)( GLenum target, const GLfloat *tc ) +{ + PRE_LOOPBACK( MultiTexCoord3fvARB ); + CALL_MultiTexCoord3fvARB(GET_DISPATCH(), ( target, tc )); +} + +static void GLAPIENTRY TAG(MultiTexCoord4fARB)( GLenum target, GLfloat s, + GLfloat t, GLfloat r, GLfloat q ) +{ + PRE_LOOPBACK( MultiTexCoord4fARB ); + CALL_MultiTexCoord4fARB(GET_DISPATCH(), ( target, s, t, r, q )); +} + +static void GLAPIENTRY TAG(MultiTexCoord4fvARB)( GLenum target, const GLfloat *tc ) +{ + PRE_LOOPBACK( MultiTexCoord4fvARB ); + CALL_MultiTexCoord4fvARB(GET_DISPATCH(), ( target, tc )); +} + +static void GLAPIENTRY TAG(Normal3f)( GLfloat x, GLfloat y, GLfloat z ) +{ + PRE_LOOPBACK( Normal3f ); + CALL_Normal3f(GET_DISPATCH(), ( x, y, z )); +} + +static void GLAPIENTRY TAG(Normal3fv)( const GLfloat *v ) +{ + PRE_LOOPBACK( Normal3fv ); + CALL_Normal3fv(GET_DISPATCH(), ( v )); +} + +static void GLAPIENTRY TAG(SecondaryColor3fEXT)( GLfloat r, GLfloat g, GLfloat b ) +{ + PRE_LOOPBACK( SecondaryColor3fEXT ); + CALL_SecondaryColor3fEXT(GET_DISPATCH(), ( r, g, b )); +} + +static void GLAPIENTRY TAG(SecondaryColor3fvEXT)( const GLfloat *v ) +{ + PRE_LOOPBACK( SecondaryColor3fvEXT ); + CALL_SecondaryColor3fvEXT(GET_DISPATCH(), ( v )); +} + +static void GLAPIENTRY TAG(TexCoord1f)( GLfloat s ) +{ + PRE_LOOPBACK( TexCoord1f ); + CALL_TexCoord1f(GET_DISPATCH(), ( s )); +} + +static void GLAPIENTRY TAG(TexCoord1fv)( const GLfloat *tc ) +{ + PRE_LOOPBACK( TexCoord1fv ); + CALL_TexCoord1fv(GET_DISPATCH(), ( tc )); +} + +static void GLAPIENTRY TAG(TexCoord2f)( GLfloat s, GLfloat t ) +{ + PRE_LOOPBACK( TexCoord2f ); + CALL_TexCoord2f(GET_DISPATCH(), ( s, t )); +} + +static void GLAPIENTRY TAG(TexCoord2fv)( const GLfloat *tc ) +{ + PRE_LOOPBACK( TexCoord2fv ); + CALL_TexCoord2fv(GET_DISPATCH(), ( tc )); +} + +static void GLAPIENTRY TAG(TexCoord3f)( GLfloat s, GLfloat t, GLfloat r ) +{ + PRE_LOOPBACK( TexCoord3f ); + CALL_TexCoord3f(GET_DISPATCH(), ( s, t, r )); +} + +static void GLAPIENTRY TAG(TexCoord3fv)( const GLfloat *tc ) +{ + PRE_LOOPBACK( TexCoord3fv ); + CALL_TexCoord3fv(GET_DISPATCH(), ( tc )); +} + +static void GLAPIENTRY TAG(TexCoord4f)( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) +{ + PRE_LOOPBACK( TexCoord4f ); + CALL_TexCoord4f(GET_DISPATCH(), ( s, t, r, q )); +} + +static void GLAPIENTRY TAG(TexCoord4fv)( const GLfloat *tc ) +{ + PRE_LOOPBACK( TexCoord4fv ); + CALL_TexCoord4fv(GET_DISPATCH(), ( tc )); +} + +static void GLAPIENTRY TAG(Vertex2f)( GLfloat x, GLfloat y ) +{ + PRE_LOOPBACK( Vertex2f ); + CALL_Vertex2f(GET_DISPATCH(), ( x, y )); +} + +static void GLAPIENTRY TAG(Vertex2fv)( const GLfloat *v ) +{ + PRE_LOOPBACK( Vertex2fv ); + CALL_Vertex2fv(GET_DISPATCH(), ( v )); +} + +static void GLAPIENTRY TAG(Vertex3f)( GLfloat x, GLfloat y, GLfloat z ) +{ + PRE_LOOPBACK( Vertex3f ); + CALL_Vertex3f(GET_DISPATCH(), ( x, y, z )); +} + +static void GLAPIENTRY TAG(Vertex3fv)( const GLfloat *v ) +{ + PRE_LOOPBACK( Vertex3fv ); + CALL_Vertex3fv(GET_DISPATCH(), ( v )); +} + +static void GLAPIENTRY TAG(Vertex4f)( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + PRE_LOOPBACK( Vertex4f ); + CALL_Vertex4f(GET_DISPATCH(), ( x, y, z, w )); +} + +static void GLAPIENTRY TAG(Vertex4fv)( const GLfloat *v ) +{ + PRE_LOOPBACK( Vertex4fv ); + CALL_Vertex4fv(GET_DISPATCH(), ( v )); +} + +static void GLAPIENTRY TAG(CallList)( GLuint i ) +{ + PRE_LOOPBACK( CallList ); + CALL_CallList(GET_DISPATCH(), ( i )); +} + +static void GLAPIENTRY TAG(CallLists)( GLsizei sz, GLenum type, const GLvoid *v ) +{ + PRE_LOOPBACK( CallLists ); + CALL_CallLists(GET_DISPATCH(), ( sz, type, v )); +} + +static void GLAPIENTRY TAG(Begin)( GLenum mode ) +{ + PRE_LOOPBACK( Begin ); + CALL_Begin(GET_DISPATCH(), ( mode )); +} + +static void GLAPIENTRY TAG(End)( void ) +{ + PRE_LOOPBACK( End ); + CALL_End(GET_DISPATCH(), ()); +} + +static void GLAPIENTRY TAG(Rectf)( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) +{ + PRE_LOOPBACK( Rectf ); + CALL_Rectf(GET_DISPATCH(), ( x1, y1, x2, y2 )); +} + +static void GLAPIENTRY TAG(DrawArrays)( GLenum mode, GLint start, GLsizei count ) +{ + PRE_LOOPBACK( DrawArrays ); + CALL_DrawArrays(GET_DISPATCH(), ( mode, start, count )); +} + +static void GLAPIENTRY TAG(DrawElements)( GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices ) +{ + PRE_LOOPBACK( DrawElements ); + CALL_DrawElements(GET_DISPATCH(), ( mode, count, type, indices )); +} + +static void GLAPIENTRY TAG(DrawRangeElements)( GLenum mode, GLuint start, + GLuint end, GLsizei count, + GLenum type, const GLvoid *indices ) +{ + PRE_LOOPBACK( DrawRangeElements ); + CALL_DrawRangeElements(GET_DISPATCH(), ( mode, start, end, count, type, indices )); +} + +static void GLAPIENTRY TAG(EvalMesh1)( GLenum mode, GLint i1, GLint i2 ) +{ + PRE_LOOPBACK( EvalMesh1 ); + CALL_EvalMesh1(GET_DISPATCH(), ( mode, i1, i2 )); +} + +static void GLAPIENTRY TAG(EvalMesh2)( GLenum mode, GLint i1, GLint i2, + GLint j1, GLint j2 ) +{ + PRE_LOOPBACK( EvalMesh2 ); + CALL_EvalMesh2(GET_DISPATCH(), ( mode, i1, i2, j1, j2 )); +} + +static void GLAPIENTRY TAG(VertexAttrib1fNV)( GLuint index, GLfloat x ) +{ + PRE_LOOPBACK( VertexAttrib1fNV ); + CALL_VertexAttrib1fNV(GET_DISPATCH(), ( index, x )); +} + +static void GLAPIENTRY TAG(VertexAttrib1fvNV)( GLuint index, const GLfloat *v ) +{ + PRE_LOOPBACK( VertexAttrib1fvNV ); + CALL_VertexAttrib1fvNV(GET_DISPATCH(), ( index, v )); +} + +static void GLAPIENTRY TAG(VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y ) +{ + PRE_LOOPBACK( VertexAttrib2fNV ); + CALL_VertexAttrib2fNV(GET_DISPATCH(), ( index, x, y )); +} + +static void GLAPIENTRY TAG(VertexAttrib2fvNV)( GLuint index, const GLfloat *v ) +{ + PRE_LOOPBACK( VertexAttrib2fvNV ); + CALL_VertexAttrib2fvNV(GET_DISPATCH(), ( index, v )); +} + +static void GLAPIENTRY TAG(VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z ) +{ + PRE_LOOPBACK( VertexAttrib3fNV ); + CALL_VertexAttrib3fNV(GET_DISPATCH(), ( index, x, y, z )); +} + +static void GLAPIENTRY TAG(VertexAttrib3fvNV)( GLuint index, const GLfloat *v ) +{ + PRE_LOOPBACK( VertexAttrib3fvNV ); + CALL_VertexAttrib3fvNV(GET_DISPATCH(), ( index, v )); +} + +static void GLAPIENTRY TAG(VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + PRE_LOOPBACK( VertexAttrib4fNV ); + CALL_VertexAttrib4fNV(GET_DISPATCH(), ( index, x, y, z, w )); +} + +static void GLAPIENTRY TAG(VertexAttrib4fvNV)( GLuint index, const GLfloat *v ) +{ + PRE_LOOPBACK( VertexAttrib4fvNV ); + CALL_VertexAttrib4fvNV(GET_DISPATCH(), ( index, v )); +} + + +static void GLAPIENTRY TAG(VertexAttrib1fARB)( GLuint index, GLfloat x ) +{ + PRE_LOOPBACK( VertexAttrib1fARB ); + CALL_VertexAttrib1fARB(GET_DISPATCH(), ( index, x )); +} + +static void GLAPIENTRY TAG(VertexAttrib1fvARB)( GLuint index, const GLfloat *v ) +{ + PRE_LOOPBACK( VertexAttrib1fvARB ); + CALL_VertexAttrib1fvARB(GET_DISPATCH(), ( index, v )); +} + +static void GLAPIENTRY TAG(VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y ) +{ + PRE_LOOPBACK( VertexAttrib2fARB ); + CALL_VertexAttrib2fARB(GET_DISPATCH(), ( index, x, y )); +} + +static void GLAPIENTRY TAG(VertexAttrib2fvARB)( GLuint index, const GLfloat *v ) +{ + PRE_LOOPBACK( VertexAttrib2fvARB ); + CALL_VertexAttrib2fvARB(GET_DISPATCH(), ( index, v )); +} + +static void GLAPIENTRY TAG(VertexAttrib3fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z ) +{ + PRE_LOOPBACK( VertexAttrib3fARB ); + CALL_VertexAttrib3fARB(GET_DISPATCH(), ( index, x, y, z )); +} + +static void GLAPIENTRY TAG(VertexAttrib3fvARB)( GLuint index, const GLfloat *v ) +{ + PRE_LOOPBACK( VertexAttrib3fvARB ); + CALL_VertexAttrib3fvARB(GET_DISPATCH(), ( index, v )); +} + +static void GLAPIENTRY TAG(VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + PRE_LOOPBACK( VertexAttrib4fARB ); + CALL_VertexAttrib4fARB(GET_DISPATCH(), ( index, x, y, z, w )); +} + +static void GLAPIENTRY TAG(VertexAttrib4fvARB)( GLuint index, const GLfloat *v ) +{ + PRE_LOOPBACK( VertexAttrib4fvARB ); + CALL_VertexAttrib4fvARB(GET_DISPATCH(), ( index, v )); +} + + +static GLvertexformat TAG(vtxfmt) = { + TAG(ArrayElement), + TAG(Color3f), + TAG(Color3fv), + TAG(Color4f), + TAG(Color4fv), + TAG(EdgeFlag), + TAG(EdgeFlagv), + TAG(EvalCoord1f), + TAG(EvalCoord1fv), + TAG(EvalCoord2f), + TAG(EvalCoord2fv), + TAG(EvalPoint1), + TAG(EvalPoint2), + TAG(FogCoordfEXT), + TAG(FogCoordfvEXT), + TAG(Indexf), + TAG(Indexfv), + TAG(Materialfv), + TAG(MultiTexCoord1fARB), + TAG(MultiTexCoord1fvARB), + TAG(MultiTexCoord2fARB), + TAG(MultiTexCoord2fvARB), + TAG(MultiTexCoord3fARB), + TAG(MultiTexCoord3fvARB), + TAG(MultiTexCoord4fARB), + TAG(MultiTexCoord4fvARB), + TAG(Normal3f), + TAG(Normal3fv), + TAG(SecondaryColor3fEXT), + TAG(SecondaryColor3fvEXT), + TAG(TexCoord1f), + TAG(TexCoord1fv), + TAG(TexCoord2f), + TAG(TexCoord2fv), + TAG(TexCoord3f), + TAG(TexCoord3fv), + TAG(TexCoord4f), + TAG(TexCoord4fv), + TAG(Vertex2f), + TAG(Vertex2fv), + TAG(Vertex3f), + TAG(Vertex3fv), + TAG(Vertex4f), + TAG(Vertex4fv), + TAG(CallList), + TAG(CallLists), + TAG(Begin), + TAG(End), + TAG(VertexAttrib1fNV), + TAG(VertexAttrib1fvNV), + TAG(VertexAttrib2fNV), + TAG(VertexAttrib2fvNV), + TAG(VertexAttrib3fNV), + TAG(VertexAttrib3fvNV), + TAG(VertexAttrib4fNV), + TAG(VertexAttrib4fvNV), + TAG(VertexAttrib1fARB), + TAG(VertexAttrib1fvARB), + TAG(VertexAttrib2fARB), + TAG(VertexAttrib2fvARB), + TAG(VertexAttrib3fARB), + TAG(VertexAttrib3fvARB), + TAG(VertexAttrib4fARB), + TAG(VertexAttrib4fvARB), + TAG(Rectf), + TAG(DrawArrays), + TAG(DrawElements), + TAG(DrawRangeElements), + TAG(EvalMesh1), + TAG(EvalMesh2) +}; + +#undef TAG +#undef PRE_LOOPBACK diff --git a/reactos/dll/mesa32/src/math/descrip.mms b/reactos/dll/mesa32/src/math/descrip.mms new file mode 100644 index 00000000000..86eaf0e467d --- /dev/null +++ b/reactos/dll/mesa32/src/math/descrip.mms @@ -0,0 +1,45 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl +# Last revision : 16 June 2003 + +.first + define gl [---.include.gl] + define math [-.math] + +.include [---]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [---.include],[-.main],[-.glapi] +LIBDIR = [---.lib] +CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short) + +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/reactos/dll/mesa32/src/math/m_clip_tmp.h b/reactos/dll/mesa32/src/math/m_clip_tmp.h new file mode 100644 index 00000000000..f3a589be051 --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_clip_tmp.h @@ -0,0 +1,243 @@ +/* + * Mesa 3-D graphics library + * Version: 6.2 + * + * 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. + */ + +/* + * New (3.1) transformation code written by Keith Whitwell. + */ + + +/* KW: a clever asm implementation would nestle integer versions + * of the outcode calculation underneath the division. Gcc won't + * do this, strangely enough, so I only do the divide in + * the case where the cliptest passes. This isn't essential, + * and an asm implementation needn't replicate that behaviour. + * + * \param clip_vec vector of incoming clip-space coords + * \param proj_vec vector of resultant NDC-space projected coords + * \param clipMask resulting array of clip flags + * \param orMask bitwise-OR of clipMask values + * \param andMask bitwise-AND of clipMask values + * \return proj_vec pointer + */ +static GLvector4f * _XFORMAPI TAG(cliptest_points4)( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ) +{ + const GLuint stride = clip_vec->stride; + const GLfloat *from = (GLfloat *)clip_vec->start; + const GLuint count = clip_vec->count; + GLuint c = 0; + GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start; + GLubyte tmpAndMask = *andMask; + GLubyte tmpOrMask = *orMask; + GLuint i; + STRIDE_LOOP { + const GLfloat cx = from[0]; + const GLfloat cy = from[1]; + const GLfloat cz = from[2]; + const GLfloat cw = from[3]; +#if defined(macintosh) || defined(__powerpc__) + /* on powerpc cliptest is 17% faster in this way. */ + GLuint mask; + mask = (((cw < cx) << CLIP_RIGHT_SHIFT)); + mask |= (((cw < -cx) << CLIP_LEFT_SHIFT)); + mask |= (((cw < cy) << CLIP_TOP_SHIFT)); + mask |= (((cw < -cy) << CLIP_BOTTOM_SHIFT)); + mask |= (((cw < cz) << CLIP_FAR_SHIFT)); + mask |= (((cw < -cz) << CLIP_NEAR_SHIFT)); +#else /* !defined(macintosh)) */ + GLubyte mask = 0; + if (-cx + cw < 0) mask |= CLIP_RIGHT_BIT; + if ( cx + cw < 0) mask |= CLIP_LEFT_BIT; + if (-cy + cw < 0) mask |= CLIP_TOP_BIT; + if ( cy + cw < 0) mask |= CLIP_BOTTOM_BIT; + if (-cz + cw < 0) mask |= CLIP_FAR_BIT; + if ( cz + cw < 0) mask |= CLIP_NEAR_BIT; +#endif /* defined(macintosh) */ + + clipMask[i] = mask; + if (mask) { + c++; + tmpAndMask &= mask; + tmpOrMask |= mask; + vProj[i][0] = 0; + vProj[i][1] = 0; + vProj[i][2] = 0; + vProj[i][3] = 1; + } else { + GLfloat oow = 1.0F / cw; + vProj[i][0] = cx * oow; + vProj[i][1] = cy * oow; + vProj[i][2] = cz * oow; + vProj[i][3] = oow; + } + } + + *orMask = tmpOrMask; + *andMask = (GLubyte) (c < count ? 0 : tmpAndMask); + + proj_vec->flags |= VEC_SIZE_4; + proj_vec->size = 4; + proj_vec->count = clip_vec->count; + return proj_vec; +} + + + +/* + * \param clip_vec vector of incoming clip-space coords + * \param proj_vec vector of resultant NDC-space projected coords + * \param clipMask resulting array of clip flags + * \param orMask bitwise-OR of clipMask values + * \param andMask bitwise-AND of clipMask values + * \return clip_vec pointer + */ +static GLvector4f * _XFORMAPI TAG(cliptest_np_points4)( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ) +{ + const GLuint stride = clip_vec->stride; + const GLuint count = clip_vec->count; + const GLfloat *from = (GLfloat *)clip_vec->start; + GLuint c = 0; + GLubyte tmpAndMask = *andMask; + GLubyte tmpOrMask = *orMask; + GLuint i; + (void) proj_vec; + STRIDE_LOOP { + const GLfloat cx = from[0]; + const GLfloat cy = from[1]; + const GLfloat cz = from[2]; + const GLfloat cw = from[3]; +#if defined(macintosh) || defined(__powerpc__) + /* on powerpc cliptest is 17% faster in this way. */ + GLuint mask; + mask = (((cw < cx) << CLIP_RIGHT_SHIFT)); + mask |= (((cw < -cx) << CLIP_LEFT_SHIFT)); + mask |= (((cw < cy) << CLIP_TOP_SHIFT)); + mask |= (((cw < -cy) << CLIP_BOTTOM_SHIFT)); + mask |= (((cw < cz) << CLIP_FAR_SHIFT)); + mask |= (((cw < -cz) << CLIP_NEAR_SHIFT)); +#else /* !defined(macintosh)) */ + GLubyte mask = 0; + if (-cx + cw < 0) mask |= CLIP_RIGHT_BIT; + if ( cx + cw < 0) mask |= CLIP_LEFT_BIT; + if (-cy + cw < 0) mask |= CLIP_TOP_BIT; + if ( cy + cw < 0) mask |= CLIP_BOTTOM_BIT; + if (-cz + cw < 0) mask |= CLIP_FAR_BIT; + if ( cz + cw < 0) mask |= CLIP_NEAR_BIT; +#endif /* defined(macintosh) */ + + clipMask[i] = mask; + if (mask) { + c++; + tmpAndMask &= mask; + tmpOrMask |= mask; + } + } + + *orMask = tmpOrMask; + *andMask = (GLubyte) (c < count ? 0 : tmpAndMask); + return clip_vec; +} + + +static GLvector4f * _XFORMAPI TAG(cliptest_points3)( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ) +{ + const GLuint stride = clip_vec->stride; + const GLuint count = clip_vec->count; + const GLfloat *from = (GLfloat *)clip_vec->start; + GLubyte tmpOrMask = *orMask; + GLubyte tmpAndMask = *andMask; + GLuint i; + (void) proj_vec; + STRIDE_LOOP { + const GLfloat cx = from[0], cy = from[1], cz = from[2]; + GLubyte mask = 0; + if (cx > 1.0) mask |= CLIP_RIGHT_BIT; + else if (cx < -1.0) mask |= CLIP_LEFT_BIT; + if (cy > 1.0) mask |= CLIP_TOP_BIT; + else if (cy < -1.0) mask |= CLIP_BOTTOM_BIT; + if (cz > 1.0) mask |= CLIP_FAR_BIT; + else if (cz < -1.0) mask |= CLIP_NEAR_BIT; + clipMask[i] = mask; + tmpOrMask |= mask; + tmpAndMask &= mask; + } + + *orMask = tmpOrMask; + *andMask = tmpAndMask; + return clip_vec; +} + + +static GLvector4f * _XFORMAPI TAG(cliptest_points2)( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ) +{ + const GLuint stride = clip_vec->stride; + const GLuint count = clip_vec->count; + const GLfloat *from = (GLfloat *)clip_vec->start; + GLubyte tmpOrMask = *orMask; + GLubyte tmpAndMask = *andMask; + GLuint i; + (void) proj_vec; + STRIDE_LOOP { + const GLfloat cx = from[0], cy = from[1]; + GLubyte mask = 0; + if (cx > 1.0) mask |= CLIP_RIGHT_BIT; + else if (cx < -1.0) mask |= CLIP_LEFT_BIT; + if (cy > 1.0) mask |= CLIP_TOP_BIT; + else if (cy < -1.0) mask |= CLIP_BOTTOM_BIT; + clipMask[i] = mask; + tmpOrMask |= mask; + tmpAndMask &= mask; + } + + *orMask = tmpOrMask; + *andMask = tmpAndMask; + return clip_vec; +} + + +static void TAG(init_c_cliptest)( void ) +{ + _mesa_clip_tab[4] = TAG(cliptest_points4); + _mesa_clip_tab[3] = TAG(cliptest_points3); + _mesa_clip_tab[2] = TAG(cliptest_points2); + + _mesa_clip_np_tab[4] = TAG(cliptest_np_points4); + _mesa_clip_np_tab[3] = TAG(cliptest_points3); + _mesa_clip_np_tab[2] = TAG(cliptest_points2); +} diff --git a/reactos/dll/mesa32/src/math/m_copy_tmp.h b/reactos/dll/mesa32/src/math/m_copy_tmp.h new file mode 100644 index 00000000000..07ab1f7b2aa --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_copy_tmp.h @@ -0,0 +1,86 @@ + +/* + * 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. + */ + +/* + * New (3.1) transformation code written by Keith Whitwell. + */ + + +#define COPY_FUNC( BITS ) \ +static void TAG2(copy, BITS)( GLvector4f *to, const GLvector4f *f ) \ +{ \ + GLfloat (*t)[4] = (GLfloat (*)[4])to->start; \ + GLfloat *from = f->start; \ + GLuint stride = f->stride; \ + GLuint count = to->count; \ + GLuint i; \ + \ + if (BITS) \ + STRIDE_LOOP { \ + if (BITS&1) t[i][0] = from[0]; \ + if (BITS&2) t[i][1] = from[1]; \ + if (BITS&4) t[i][2] = from[2]; \ + if (BITS&8) t[i][3] = from[3]; \ + } \ +} + +/* We got them all here: + */ +COPY_FUNC( 0x0 ) /* noop */ +COPY_FUNC( 0x1 ) +COPY_FUNC( 0x2 ) +COPY_FUNC( 0x3 ) +COPY_FUNC( 0x4 ) +COPY_FUNC( 0x5 ) +COPY_FUNC( 0x6 ) +COPY_FUNC( 0x7 ) +COPY_FUNC( 0x8 ) +COPY_FUNC( 0x9 ) +COPY_FUNC( 0xa ) +COPY_FUNC( 0xb ) +COPY_FUNC( 0xc ) +COPY_FUNC( 0xd ) +COPY_FUNC( 0xe ) +COPY_FUNC( 0xf ) + +static void TAG2(init_copy, 0)( void ) +{ + _mesa_copy_tab[0x0] = TAG2(copy, 0x0); + _mesa_copy_tab[0x1] = TAG2(copy, 0x1); + _mesa_copy_tab[0x2] = TAG2(copy, 0x2); + _mesa_copy_tab[0x3] = TAG2(copy, 0x3); + _mesa_copy_tab[0x4] = TAG2(copy, 0x4); + _mesa_copy_tab[0x5] = TAG2(copy, 0x5); + _mesa_copy_tab[0x6] = TAG2(copy, 0x6); + _mesa_copy_tab[0x7] = TAG2(copy, 0x7); + _mesa_copy_tab[0x8] = TAG2(copy, 0x8); + _mesa_copy_tab[0x9] = TAG2(copy, 0x9); + _mesa_copy_tab[0xa] = TAG2(copy, 0xa); + _mesa_copy_tab[0xb] = TAG2(copy, 0xb); + _mesa_copy_tab[0xc] = TAG2(copy, 0xc); + _mesa_copy_tab[0xd] = TAG2(copy, 0xd); + _mesa_copy_tab[0xe] = TAG2(copy, 0xe); + _mesa_copy_tab[0xf] = TAG2(copy, 0xf); +} diff --git a/reactos/dll/mesa32/src/math/m_debug.h b/reactos/dll/mesa32/src/math/m_debug.h new file mode 100644 index 00000000000..6476b6de28c --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_debug.h @@ -0,0 +1,42 @@ + +/* + * 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. + * + * Authors: + * Gareth Hughes + */ + +#ifndef __M_DEBUG_H__ +#define __M_DEBUG_H__ + +extern void _math_test_all_transform_functions( char *description ); +extern void _math_test_all_normal_transform_functions( char *description ); +extern void _math_test_all_cliptest_functions( char *description ); + +/* Deprecated? + */ +extern void _math_test_all_vertex_functions( char *description ); + +extern char *mesa_profile; + +#endif diff --git a/reactos/dll/mesa32/src/math/m_debug_clip.c b/reactos/dll/mesa32/src/math/m_debug_clip.c new file mode 100644 index 00000000000..ae8108b88a1 --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_debug_clip.c @@ -0,0 +1,371 @@ +/* + * Mesa 3-D graphics library + * Version: 6.1 + * + * 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. + * + * Authors: + * Gareth Hughes + */ + +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "imports.h" + +#include "m_matrix.h" +#include "m_xform.h" + +#include "m_debug.h" +#include "m_debug_util.h" + +#ifdef __UNIXOS2__ +/* The linker doesn't like empty files */ +static char dummy; +#endif + +#ifdef DEBUG /* This code only used for debugging */ + +static clip_func *clip_tab[2] = { + _mesa_clip_tab, + _mesa_clip_np_tab +}; +static char *cnames[2] = { + "_mesa_clip_tab", + "_mesa_clip_np_tab" +}; +#ifdef RUN_DEBUG_BENCHMARK +static char *cstrings[2] = { + "clip, perspective divide", + "clip, no divide" +}; +#endif + + +/* ============================================================= + * Reference cliptests + */ + +static GLvector4f *ref_cliptest_points4( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ) +{ + const GLuint stride = clip_vec->stride; + const GLuint count = clip_vec->count; + const GLfloat *from = (GLfloat *)clip_vec->start; + GLuint c = 0; + GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start; + GLubyte tmpAndMask = *andMask; + GLubyte tmpOrMask = *orMask; + GLuint i; + for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { + const GLfloat cx = from[0]; + const GLfloat cy = from[1]; + const GLfloat cz = from[2]; + const GLfloat cw = from[3]; + GLubyte mask = 0; + if ( -cx + cw < 0 ) mask |= CLIP_RIGHT_BIT; + if ( cx + cw < 0 ) mask |= CLIP_LEFT_BIT; + if ( -cy + cw < 0 ) mask |= CLIP_TOP_BIT; + if ( cy + cw < 0 ) mask |= CLIP_BOTTOM_BIT; + if ( -cz + cw < 0 ) mask |= CLIP_FAR_BIT; + if ( cz + cw < 0 ) mask |= CLIP_NEAR_BIT; + clipMask[i] = mask; + if ( mask ) { + c++; + tmpAndMask &= mask; + tmpOrMask |= mask; + vProj[i][0] = 0; + vProj[i][1] = 0; + vProj[i][2] = 0; + vProj[i][3] = 1; + } else { + GLfloat oow = 1.0F / cw; + vProj[i][0] = cx * oow; + vProj[i][1] = cy * oow; + vProj[i][2] = cz * oow; + vProj[i][3] = oow; + } + } + + *orMask = tmpOrMask; + *andMask = (GLubyte) (c < count ? 0 : tmpAndMask); + + proj_vec->flags |= VEC_SIZE_4; + proj_vec->size = 4; + proj_vec->count = clip_vec->count; + return proj_vec; +} + +/* Keep these here for now, even though we don't use them... + */ +static GLvector4f *ref_cliptest_points3( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ) +{ + const GLuint stride = clip_vec->stride; + const GLuint count = clip_vec->count; + const GLfloat *from = (GLfloat *)clip_vec->start; + + GLubyte tmpOrMask = *orMask; + GLubyte tmpAndMask = *andMask; + GLuint i; + for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { + const GLfloat cx = from[0], cy = from[1], cz = from[2]; + GLubyte mask = 0; + if ( cx > 1.0 ) mask |= CLIP_RIGHT_BIT; + else if ( cx < -1.0 ) mask |= CLIP_LEFT_BIT; + if ( cy > 1.0 ) mask |= CLIP_TOP_BIT; + else if ( cy < -1.0 ) mask |= CLIP_BOTTOM_BIT; + if ( cz > 1.0 ) mask |= CLIP_FAR_BIT; + else if ( cz < -1.0 ) mask |= CLIP_NEAR_BIT; + clipMask[i] = mask; + tmpOrMask |= mask; + tmpAndMask &= mask; + } + + *orMask = tmpOrMask; + *andMask = tmpAndMask; + return clip_vec; +} + +static GLvector4f * ref_cliptest_points2( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ) +{ + const GLuint stride = clip_vec->stride; + const GLuint count = clip_vec->count; + const GLfloat *from = (GLfloat *)clip_vec->start; + + GLubyte tmpOrMask = *orMask; + GLubyte tmpAndMask = *andMask; + GLuint i; + for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { + const GLfloat cx = from[0], cy = from[1]; + GLubyte mask = 0; + if ( cx > 1.0 ) mask |= CLIP_RIGHT_BIT; + else if ( cx < -1.0 ) mask |= CLIP_LEFT_BIT; + if ( cy > 1.0 ) mask |= CLIP_TOP_BIT; + else if ( cy < -1.0 ) mask |= CLIP_BOTTOM_BIT; + clipMask[i] = mask; + tmpOrMask |= mask; + tmpAndMask &= mask; + } + + *orMask = tmpOrMask; + *andMask = tmpAndMask; + return clip_vec; +} + +static clip_func ref_cliptest[5] = { + 0, + 0, + ref_cliptest_points2, + ref_cliptest_points3, + ref_cliptest_points4 +}; + + +/* ============================================================= + * Cliptest tests + */ + +ALIGN16(static GLfloat, s[TEST_COUNT][4]); +ALIGN16(static GLfloat, d[TEST_COUNT][4]); +ALIGN16(static GLfloat, r[TEST_COUNT][4]); + + +static int test_cliptest_function( clip_func func, int np, + int psize, long *cycles ) +{ + GLvector4f source[1], dest[1], ref[1]; + GLubyte dm[TEST_COUNT], dco, dca; + GLubyte rm[TEST_COUNT], rco, rca; + int i, j; +#ifdef RUN_DEBUG_BENCHMARK + int cycle_i; /* the counter for the benchmarks we run */ +#endif + + (void) cycles; + + if ( psize > 4 ) { + _mesa_problem( NULL, "test_cliptest_function called with psize > 4\n" ); + return 0; + } + + for ( i = 0 ; i < TEST_COUNT ; i++) { + ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 ); + ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 ); + for ( j = 0 ; j < psize ; j++ ) + s[i][j] = rnd(); + } + + source->data = (GLfloat(*)[4])s; + source->start = (GLfloat *)s; + source->count = TEST_COUNT; + source->stride = sizeof(s[0]); + source->size = 4; + source->flags = 0; + + dest->data = (GLfloat(*)[4])d; + dest->start = (GLfloat *)d; + dest->count = TEST_COUNT; + dest->stride = sizeof(float[4]); + dest->size = 0; + dest->flags = 0; + + ref->data = (GLfloat(*)[4])r; + ref->start = (GLfloat *)r; + ref->count = TEST_COUNT; + ref->stride = sizeof(float[4]); + ref->size = 0; + ref->flags = 0; + + dco = rco = 0; + dca = rca = CLIP_ALL_BITS; + + ref_cliptest[psize]( source, ref, rm, &rco, &rca ); + + if ( mesa_profile ) { + BEGIN_RACE( *cycles ); + func( source, dest, dm, &dco, &dca ); + END_RACE( *cycles ); + } + else { + func( source, dest, dm, &dco, &dca ); + } + + if ( dco != rco ) { + _mesa_printf( "\n-----------------------------\n" ); + _mesa_printf( "dco = 0x%02x rco = 0x%02x\n", dco, rco ); + return 0; + } + if ( dca != rca ) { + _mesa_printf( "\n-----------------------------\n" ); + _mesa_printf( "dca = 0x%02x rca = 0x%02x\n", dca, rca ); + return 0; + } + for ( i = 0 ; i < TEST_COUNT ; i++ ) { + if ( dm[i] != rm[i] ) { + _mesa_printf( "\n-----------------------------\n" ); + _mesa_printf( "(i = %i)\n", i ); + _mesa_printf( "dm = 0x%02x rm = 0x%02x\n", dm[i], rm[i] ); + return 0; + } + } + + /* Only verify output on projected points4 case. FIXME: Do we need + * to test other cases? + */ + if ( np || psize < 4 ) + return 1; + + for ( i = 0 ; i < TEST_COUNT ; i++ ) { + for ( j = 0 ; j < 4 ; j++ ) { + if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { + _mesa_printf( "\n-----------------------------\n" ); + _mesa_printf( "(i = %i, j = %i) dm = 0x%02x rm = 0x%02x\n", + i, j, dm[i], rm[i] ); + _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][0], r[i][0], r[i][0]-d[i][0], + MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); + _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][1], r[i][1], r[i][1]-d[i][1], + MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); + _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][2], r[i][2], r[i][2]-d[i][2], + MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); + _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][3], r[i][3], r[i][3]-d[i][3], + MAX_PRECISION - significand_match( d[i][3], r[i][3] ) ); + return 0; + } + } + } + + return 1; +} + +void _math_test_all_cliptest_functions( char *description ) +{ + int np, psize; + long benchmark_tab[2][4]; + static int first_time = 1; + + if ( first_time ) { + first_time = 0; + mesa_profile = _mesa_getenv( "MESA_PROFILE" ); + } + +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) { + if ( !counter_overhead ) { + INIT_COUNTER(); + _mesa_printf( "counter overhead: %ld cycles\n\n", counter_overhead ); + } + _mesa_printf( "cliptest results after hooking in %s functions:\n", description ); + } +#endif + +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) { + _mesa_printf( "\n\t" ); + for ( psize = 2 ; psize <= 4 ; psize++ ) { + _mesa_printf( " p%d\t", psize ); + } + _mesa_printf( "\n--------------------------------------------------------\n\t" ); + } +#endif + + for ( np = 0 ; np < 2 ; np++ ) { + for ( psize = 2 ; psize <= 4 ; psize++ ) { + clip_func func = clip_tab[np][psize]; + long *cycles = &(benchmark_tab[np][psize-1]); + + if ( test_cliptest_function( func, np, psize, cycles ) == 0 ) { + char buf[100]; + _mesa_sprintf( buf, "%s[%d] failed test (%s)", + cnames[np], psize, description ); + _mesa_problem( NULL, buf ); + } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) + _mesa_printf( " %li\t", benchmark_tab[np][psize-1] ); +#endif + } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) + _mesa_printf( " | [%s]\n\t", cstrings[np] ); +#endif + } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) + _mesa_printf( "\n" ); +#endif +} + + +#endif /* DEBUG */ diff --git a/reactos/dll/mesa32/src/math/m_debug_norm.c b/reactos/dll/mesa32/src/math/m_debug_norm.c new file mode 100644 index 00000000000..e4039985502 --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_debug_norm.c @@ -0,0 +1,384 @@ + +/* + * 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: + * Gareth Hughes + */ + +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "imports.h" + +#include "m_matrix.h" +#include "m_xform.h" + +#include "m_debug.h" +#include "m_debug_util.h" + + +#ifdef __UNIXOS2__ +/* The linker doesn't like empty files */ +static char dummy; +#endif + +#ifdef DEBUG /* This code only used for debugging */ + + +static int m_norm_identity[16] = { + ONE, NIL, NIL, NIL, + NIL, ONE, NIL, NIL, + NIL, NIL, ONE, NIL, + NIL, NIL, NIL, NIL +}; +static int m_norm_general[16] = { + VAR, VAR, VAR, NIL, + VAR, VAR, VAR, NIL, + VAR, VAR, VAR, NIL, + NIL, NIL, NIL, NIL +}; +static int m_norm_no_rot[16] = { + VAR, NIL, NIL, NIL, + NIL, VAR, NIL, NIL, + NIL, NIL, VAR, NIL, + NIL, NIL, NIL, NIL +}; +static int *norm_templates[8] = { + m_norm_no_rot, + m_norm_no_rot, + m_norm_no_rot, + m_norm_general, + m_norm_general, + m_norm_general, + m_norm_identity, + m_norm_identity +}; +static int norm_types[8] = { + NORM_TRANSFORM_NO_ROT, + NORM_TRANSFORM_NO_ROT | NORM_RESCALE, + NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE, + NORM_TRANSFORM, + NORM_TRANSFORM | NORM_RESCALE, + NORM_TRANSFORM | NORM_NORMALIZE, + NORM_RESCALE, + NORM_NORMALIZE +}; +static int norm_scale_types[8] = { /* rescale factor */ + NIL, /* NIL disables rescaling */ + VAR, + NIL, + NIL, + VAR, + NIL, + VAR, + NIL +}; +static int norm_normalize_types[8] = { /* normalizing ?? (no = 0) */ + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1 +}; +static char *norm_strings[8] = { + "NORM_TRANSFORM_NO_ROT", + "NORM_TRANSFORM_NO_ROT | NORM_RESCALE", + "NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE", + "NORM_TRANSFORM", + "NORM_TRANSFORM | NORM_RESCALE", + "NORM_TRANSFORM | NORM_NORMALIZE", + "NORM_RESCALE", + "NORM_NORMALIZE" +}; + + +/* ============================================================= + * Reference transformations + */ + +static void ref_norm_transform_rescale( const GLmatrix *mat, + GLfloat scale, + const GLvector4f *in, + const GLfloat *lengths, + GLvector4f *dest ) +{ + GLuint i; + const GLfloat *s = in->start; + const GLfloat *m = mat->inv; + GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start; + + (void) lengths; + + for ( i = 0 ; i < in->count ; i++ ) { + GLfloat t[3]; + + TRANSFORM_NORMAL( t, s, m ); + SCALE_SCALAR_3V( out[i], scale, t ); + + s = (GLfloat *)((char *)s + in->stride); + } +} + +static void ref_norm_transform_normalize( const GLmatrix *mat, + GLfloat scale, + const GLvector4f *in, + const GLfloat *lengths, + GLvector4f *dest ) +{ + GLuint i; + const GLfloat *s = in->start; + const GLfloat *m = mat->inv; + GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start; + + for ( i = 0 ; i < in->count ; i++ ) { + GLfloat t[3]; + + TRANSFORM_NORMAL( t, s, m ); + + if ( !lengths ) { + GLfloat len = LEN_SQUARED_3FV( t ); + if ( len > 1e-20 ) { + /* Hmmm, don't know how we could test the precalculated + * length case... + */ + scale = 1.0 / sqrt( len ); + SCALE_SCALAR_3V( out[i], scale, t ); + } else { + out[i][0] = out[i][1] = out[i][2] = 0; + } + } else { + scale = lengths[i];; + SCALE_SCALAR_3V( out[i], scale, t ); + } + + s = (GLfloat *)((char *)s + in->stride); + } +} + + +/* ============================================================= + * Normal transformation tests + */ + +static void init_matrix( GLfloat *m ) +{ + m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; + m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; + m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; + m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; +} + + +static int test_norm_function( normal_func func, int mtype, long *cycles ) +{ + GLvector4f source[1], dest[1], dest2[1], ref[1], ref2[1]; + GLmatrix mat[1]; + GLfloat s[TEST_COUNT][5], d[TEST_COUNT][4], r[TEST_COUNT][4]; + GLfloat d2[TEST_COUNT][4], r2[TEST_COUNT][4], length[TEST_COUNT]; + GLfloat scale; + GLfloat *m; + int i, j; +#ifdef RUN_DEBUG_BENCHMARK + int cycle_i; /* the counter for the benchmarks we run */ +#endif + + (void) cycles; + + mat->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); + mat->inv = m = mat->m; + + init_matrix( m ); + + scale = 1.0F + rnd () * norm_scale_types[mtype]; + + for ( i = 0 ; i < 4 ; i++ ) { + for ( j = 0 ; j < 4 ; j++ ) { + switch ( norm_templates[mtype][i * 4 + j] ) { + case NIL: + m[j * 4 + i] = 0.0; + break; + case ONE: + m[j * 4 + i] = 1.0; + break; + case NEG: + m[j * 4 + i] = -1.0; + break; + case VAR: + break; + default: + abort(); + } + } + } + + for ( i = 0 ; i < TEST_COUNT ; i++ ) { + ASSIGN_3V( d[i], 0.0, 0.0, 0.0 ); + ASSIGN_3V( s[i], 0.0, 0.0, 0.0 ); + ASSIGN_3V( d2[i], 0.0, 0.0, 0.0 ); + for ( j = 0 ; j < 3 ; j++ ) + s[i][j] = rnd(); + length[i] = 1 / sqrt( LEN_SQUARED_3FV( s[i] ) ); + } + + source->data = (GLfloat(*)[4]) s; + source->start = (GLfloat *) s; + source->count = TEST_COUNT; + source->stride = sizeof(s[0]); + source->flags = 0; + + dest->data = d; + dest->start = (GLfloat *) d; + dest->count = TEST_COUNT; + dest->stride = sizeof(float[4]); + dest->flags = 0; + + dest2->data = d2; + dest2->start = (GLfloat *) d2; + dest2->count = TEST_COUNT; + dest2->stride = sizeof(float[4]); + dest2->flags = 0; + + ref->data = r; + ref->start = (GLfloat *) r; + ref->count = TEST_COUNT; + ref->stride = sizeof(float[4]); + ref->flags = 0; + + ref2->data = r2; + ref2->start = (GLfloat *) r2; + ref2->count = TEST_COUNT; + ref2->stride = sizeof(float[4]); + ref2->flags = 0; + + if ( norm_normalize_types[mtype] == 0 ) { + ref_norm_transform_rescale( mat, scale, source, NULL, ref ); + } else { + ref_norm_transform_normalize( mat, scale, source, NULL, ref ); + ref_norm_transform_normalize( mat, scale, source, length, ref2 ); + } + + if ( mesa_profile ) { + BEGIN_RACE( *cycles ); + func( mat, scale, source, NULL, dest ); + END_RACE( *cycles ); + func( mat, scale, source, length, dest2 ); + } else { + func( mat, scale, source, NULL, dest ); + func( mat, scale, source, length, dest2 ); + } + + for ( i = 0 ; i < TEST_COUNT ; i++ ) { + for ( j = 0 ; j < 3 ; j++ ) { + if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { + _mesa_printf( "-----------------------------\n" ); + _mesa_printf( "(i = %i, j = %i)\n", i, j ); + _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + d[i][0], r[i][0], r[i][0]/d[i][0], + MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); + _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + d[i][1], r[i][1], r[i][1]/d[i][1], + MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); + _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + d[i][2], r[i][2], r[i][2]/d[i][2], + MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); + return 0; + } + + if ( norm_normalize_types[mtype] != 0 ) { + if ( significand_match( d2[i][j], r2[i][j] ) < REQUIRED_PRECISION ) { + _mesa_printf( "------------------- precalculated length case ------\n" ); + _mesa_printf( "(i = %i, j = %i)\n", i, j ); + _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + d2[i][0], r2[i][0], r2[i][0]/d2[i][0], + MAX_PRECISION - significand_match( d2[i][0], r2[i][0] ) ); + _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + d2[i][1], r2[i][1], r2[i][1]/d2[i][1], + MAX_PRECISION - significand_match( d2[i][1], r2[i][1] ) ); + _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + d2[i][2], r2[i][2], r2[i][2]/d2[i][2], + MAX_PRECISION - significand_match( d2[i][2], r2[i][2] ) ); + return 0; + } + } + } + } + + ALIGN_FREE( mat->m ); + return 1; +} + +void _math_test_all_normal_transform_functions( char *description ) +{ + int mtype; + long benchmark_tab[0xf]; + static int first_time = 1; + + if ( first_time ) { + first_time = 0; + mesa_profile = getenv( "MESA_PROFILE" ); + } + +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) { + if ( !counter_overhead ) { + INIT_COUNTER(); + _mesa_printf( "counter overhead: %ld cycles\n\n", counter_overhead ); + } + _mesa_printf( "normal transform results after hooking in %s functions:\n", + description ); + _mesa_printf( "\n-------------------------------------------------------\n" ); + } +#endif + + for ( mtype = 0 ; mtype < 8 ; mtype++ ) { + normal_func func = _mesa_normal_tab[norm_types[mtype]]; + long *cycles = &benchmark_tab[mtype]; + + if ( test_norm_function( func, mtype, cycles ) == 0 ) { + char buf[100]; + _mesa_sprintf( buf, "_mesa_normal_tab[0][%s] failed test (%s)", + norm_strings[mtype], description ); + _mesa_problem( NULL, buf ); + } + +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) { + _mesa_printf( " %li\t", benchmark_tab[mtype] ); + _mesa_printf( " | [%s]\n", norm_strings[mtype] ); + } +#endif + } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) { + _mesa_printf( "\n" ); + fflush( stdout ); + } +#endif +} + + +#endif /* DEBUG */ diff --git a/reactos/dll/mesa32/src/math/m_debug_util.h b/reactos/dll/mesa32/src/math/m_debug_util.h new file mode 100644 index 00000000000..1b7d742a80b --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_debug_util.h @@ -0,0 +1,320 @@ +/* + * 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. + * + * Authors: + * Gareth Hughes + */ + +#ifndef __M_DEBUG_UTIL_H__ +#define __M_DEBUG_UTIL_H__ + + +#ifdef DEBUG /* This code only used for debugging */ + + +/* Comment this out to deactivate the cycle counter. + * NOTE: it works only on CPUs which know the 'rdtsc' command (586 or higher) + * (hope, you don't try to debug Mesa on a 386 ;) + */ +#if defined(__GNUC__) && \ + ((defined(__i386__) && defined(USE_X86_ASM)) || \ + (defined(__sparc__) && defined(USE_SPARC_ASM))) +#define RUN_DEBUG_BENCHMARK +#endif + +#define TEST_COUNT 128 /* size of the tested vector array */ + +#define REQUIRED_PRECISION 10 /* allow 4 bits to miss */ +#define MAX_PRECISION 24 /* max. precision possible */ + + +#ifdef RUN_DEBUG_BENCHMARK +/* Overhead of profiling counter in cycles. Automatically adjusted to + * your machine at run time - counter initialization should give very + * consistent results. + */ +extern long counter_overhead; + +/* This is the value of the environment variable MESA_PROFILE, and is + * used to determine if we should benchmark the functions as well as + * verify their correctness. + */ +extern char *mesa_profile; + +/* Modify the the number of tests if you like. + * We take the minimum of all results, because every error should be + * positive (time used by other processes, task switches etc). + * It is assumed that all calculations are done in the cache. + */ + +#if defined(__i386__) + +#if 1 /* PPro, PII, PIII version */ + +/* Profiling on the P6 architecture requires a little more work, due to + * the internal out-of-order execution. We must perform a serializing + * 'cpuid' instruction before and after the 'rdtsc' instructions to make + * sure no other uops are executed when we sample the timestamp counter. + */ +#define INIT_COUNTER() \ + do { \ + int cycle_i; \ + counter_overhead = LONG_MAX; \ + for ( cycle_i = 0 ; cycle_i < 8 ; cycle_i++ ) { \ + long cycle_tmp1 = 0, cycle_tmp2 = 0; \ + __asm__ __volatile__ ( "push %%ebx \n" \ + "xor %%eax, %%eax \n" \ + "cpuid \n" \ + "rdtsc \n" \ + "mov %%eax, %0 \n" \ + "xor %%eax, %%eax \n" \ + "cpuid \n" \ + "pop %%ebx \n" \ + "push %%ebx \n" \ + "xor %%eax, %%eax \n" \ + "cpuid \n" \ + "rdtsc \n" \ + "mov %%eax, %1 \n" \ + "xor %%eax, %%eax \n" \ + "cpuid \n" \ + "pop %%ebx \n" \ + : "=m" (cycle_tmp1), "=m" (cycle_tmp2) \ + : : "eax", "ecx", "edx" ); \ + if ( counter_overhead > (cycle_tmp2 - cycle_tmp1) ) { \ + counter_overhead = cycle_tmp2 - cycle_tmp1; \ + } \ + } \ + } while (0) + +#define BEGIN_RACE(x) \ + x = LONG_MAX; \ + for ( cycle_i = 0 ; cycle_i < 10 ; cycle_i++ ) { \ + long cycle_tmp1 = 0, cycle_tmp2 = 0; \ + __asm__ __volatile__ ( "push %%ebx \n" \ + "xor %%eax, %%eax \n" \ + "cpuid \n" \ + "rdtsc \n" \ + "mov %%eax, %0 \n" \ + "xor %%eax, %%eax \n" \ + "cpuid \n" \ + "pop %%ebx \n" \ + : "=m" (cycle_tmp1) \ + : : "eax", "ecx", "edx" ); + +#define END_RACE(x) \ + __asm__ __volatile__ ( "push %%ebx \n" \ + "xor %%eax, %%eax \n" \ + "cpuid \n" \ + "rdtsc \n" \ + "mov %%eax, %0 \n" \ + "xor %%eax, %%eax \n" \ + "cpuid \n" \ + "pop %%ebx \n" \ + : "=m" (cycle_tmp2) \ + : : "eax", "ecx", "edx" ); \ + if ( x > (cycle_tmp2 - cycle_tmp1) ) { \ + x = cycle_tmp2 - cycle_tmp1; \ + } \ + } \ + x -= counter_overhead; + +#else /* PPlain, PMMX version */ + +/* To ensure accurate results, we stall the pipelines with the + * non-pairable 'cdq' instruction. This ensures all the code being + * profiled is complete when the 'rdtsc' instruction executes. + */ +#define INIT_COUNTER(x) \ + do { \ + int cycle_i; \ + x = LONG_MAX; \ + for ( cycle_i = 0 ; cycle_i < 32 ; cycle_i++ ) { \ + long cycle_tmp1, cycle_tmp2, dummy; \ + __asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp1) ); \ + __asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp2) ); \ + __asm__ ( "cdq" ); \ + __asm__ ( "cdq" ); \ + __asm__ ( "rdtsc" : "=a" (cycle_tmp1), "=d" (dummy) ); \ + __asm__ ( "cdq" ); \ + __asm__ ( "cdq" ); \ + __asm__ ( "rdtsc" : "=a" (cycle_tmp2), "=d" (dummy) ); \ + if ( x > (cycle_tmp2 - cycle_tmp1) ) \ + x = cycle_tmp2 - cycle_tmp1; \ + } \ + } while (0) + +#define BEGIN_RACE(x) \ + x = LONG_MAX; \ + for ( cycle_i = 0 ; cycle_i < 16 ; cycle_i++ ) { \ + long cycle_tmp1, cycle_tmp2, dummy; \ + __asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp1) ); \ + __asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp2) ); \ + __asm__ ( "cdq" ); \ + __asm__ ( "cdq" ); \ + __asm__ ( "rdtsc" : "=a" (cycle_tmp1), "=d" (dummy) ); + + +#define END_RACE(x) \ + __asm__ ( "cdq" ); \ + __asm__ ( "cdq" ); \ + __asm__ ( "rdtsc" : "=a" (cycle_tmp2), "=d" (dummy) ); \ + if ( x > (cycle_tmp2 - cycle_tmp1) ) \ + x = cycle_tmp2 - cycle_tmp1; \ + } \ + x -= counter_overhead; + +#endif + +#elif defined(__amd64__) + +#define rdtscll(val) do { \ + unsigned int a,d; \ + __asm__ volatile("rdtsc" : "=a" (a), "=d" (d)); \ + (val) = ((unsigned long)a) | (((unsigned long)d)<<32); \ +} while(0) + +/* Copied from i386 PIII version */ +#define INIT_COUNTER() \ + do { \ + int cycle_i; \ + counter_overhead = LONG_MAX; \ + for ( cycle_i = 0 ; cycle_i < 16 ; cycle_i++ ) { \ + unsigned long cycle_tmp1, cycle_tmp2; \ + rdtscll(cycle_tmp1); \ + rdtscll(cycle_tmp2); \ + if ( counter_overhead > (cycle_tmp2 - cycle_tmp1) ) { \ + counter_overhead = cycle_tmp2 - cycle_tmp1; \ + } \ + } \ + } while (0) + + +#define BEGIN_RACE(x) \ + x = LONG_MAX; \ + for ( cycle_i = 0 ; cycle_i < 10 ; cycle_i++ ) { \ + unsigned long cycle_tmp1, cycle_tmp2; \ + rdtscll(cycle_tmp1); \ + +#define END_RACE(x) \ + rdtscll(cycle_tmp2); \ + if ( x > (cycle_tmp2 - cycle_tmp1) ) { \ + x = cycle_tmp2 - cycle_tmp1; \ + } \ + } \ + x -= counter_overhead; + +#elif defined(__sparc__) + +#define INIT_COUNTER() \ + do { counter_overhead = 5; } while(0) + +#define BEGIN_RACE(x) \ +x = LONG_MAX; \ +for (cycle_i = 0; cycle_i <10; cycle_i++) { \ + register long cycle_tmp1 asm("l0"); \ + register long cycle_tmp2 asm("l1"); \ + /* rd %tick, %l0 */ \ + __asm__ __volatile__ (".word 0xa1410000" : "=r" (cycle_tmp1)); /* save timestamp */ + +#define END_RACE(x) \ + /* rd %tick, %l1 */ \ + __asm__ __volatile__ (".word 0xa3410000" : "=r" (cycle_tmp2)); \ + if (x > (cycle_tmp2-cycle_tmp1)) x = cycle_tmp2 - cycle_tmp1; \ +} \ +x -= counter_overhead; + +#else +#error Your processor is not supported for RUN_XFORM_BENCHMARK +#endif + +#else + +#define BEGIN_RACE(x) +#define END_RACE(x) + +#endif + + +/* ============================================================= + * Helper functions + */ + +static GLfloat rnd( void ) +{ + GLfloat f = (GLfloat)rand() / (GLfloat)RAND_MAX; + GLfloat gran = (GLfloat)(1 << 13); + + f = (GLfloat)(GLint)(f * gran) / gran; + + return f * 2.0 - 1.0; +} + +static int significand_match( GLfloat a, GLfloat b ) +{ + GLfloat d = a - b; + int a_ex, b_ex, d_ex; + + if ( d == 0.0F ) { + return MAX_PRECISION; /* Exact match */ + } + + if ( a == 0.0F || b == 0.0F ) { + /* It would probably be better to check if the + * non-zero number is denormalized and return + * the index of the highest set bit here. + */ + return 0; + } + + FREXPF( a, &a_ex ); + FREXPF( b, &b_ex ); + FREXPF( d, &d_ex ); + + if ( a_ex < b_ex ) { + return a_ex - d_ex; + } else { + return b_ex - d_ex; + } +} + +enum { NIL = 0, ONE = 1, NEG = -1, VAR = 2 }; + +/* Ensure our arrays are correctly aligned. + */ +#if defined(__GNUC__) +# define ALIGN16(type, array) type array __attribute__ ((aligned (16))) +#elif defined(__MSC__) +# define ALIGN16(type, array) type array __declspec(align(16)) /* GH: Does this work? */ +#elif defined(__WATCOMC__) +# define ALIGN16(type, array) /* Watcom does not support this */ +#elif defined(__xlC__) +# define ALIGN16(type, array) type __align (16) array +#else +# warning "ALIGN16 will not 16-byte align!\n" +# define ALIGN16 +#endif + + +#endif /* DEBUG */ + +#endif /* __M_DEBUG_UTIL_H__ */ diff --git a/reactos/dll/mesa32/src/math/m_debug_xform.c b/reactos/dll/mesa32/src/math/m_debug_xform.c new file mode 100644 index 00000000000..d8250f246ef --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_debug_xform.c @@ -0,0 +1,338 @@ +/* + * 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. + */ + +/* + * Updated for P6 architecture by Gareth Hughes. + */ + +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "imports.h" + +#include "m_matrix.h" +#include "m_xform.h" + +#include "m_debug.h" +#include "m_debug_util.h" + +#ifdef __UNIXOS2__ +/* The linker doesn't like empty files */ +static char dummy; +#endif + +#ifdef DEBUG /* This code only used for debugging */ + + +/* Overhead of profiling counter in cycles. Automatically adjusted to + * your machine at run time - counter initialization should give very + * consistent results. + */ +long counter_overhead = 0; + +/* This is the value of the environment variable MESA_PROFILE, and is + * used to determine if we should benchmark the functions as well as + * verify their correctness. + */ +char *mesa_profile = NULL; + + +static int m_general[16] = { + VAR, VAR, VAR, VAR, + VAR, VAR, VAR, VAR, + VAR, VAR, VAR, VAR, + VAR, VAR, VAR, VAR +}; +static int m_identity[16] = { + ONE, NIL, NIL, NIL, + NIL, ONE, NIL, NIL, + NIL, NIL, ONE, NIL, + NIL, NIL, NIL, ONE +}; +static int m_2d[16] = { + VAR, VAR, NIL, VAR, + VAR, VAR, NIL, VAR, + NIL, NIL, ONE, NIL, + NIL, NIL, NIL, ONE +}; +static int m_2d_no_rot[16] = { + VAR, NIL, NIL, VAR, + NIL, VAR, NIL, VAR, + NIL, NIL, ONE, NIL, + NIL, NIL, NIL, ONE +}; +static int m_3d[16] = { + VAR, VAR, VAR, VAR, + VAR, VAR, VAR, VAR, + VAR, VAR, VAR, VAR, + NIL, NIL, NIL, ONE +}; +static int m_3d_no_rot[16] = { + VAR, NIL, NIL, VAR, + NIL, VAR, NIL, VAR, + NIL, NIL, VAR, VAR, + NIL, NIL, NIL, ONE +}; +static int m_perspective[16] = { + VAR, NIL, VAR, NIL, + NIL, VAR, VAR, NIL, + NIL, NIL, VAR, VAR, + NIL, NIL, NEG, NIL +}; +static int *templates[7] = { + m_general, + m_identity, + m_3d_no_rot, + m_perspective, + m_2d, + m_2d_no_rot, + m_3d +}; +static enum GLmatrixtype mtypes[7] = { + MATRIX_GENERAL, + MATRIX_IDENTITY, + MATRIX_3D_NO_ROT, + MATRIX_PERSPECTIVE, + MATRIX_2D, + MATRIX_2D_NO_ROT, + MATRIX_3D +}; +static char *mstrings[7] = { + "MATRIX_GENERAL", + "MATRIX_IDENTITY", + "MATRIX_3D_NO_ROT", + "MATRIX_PERSPECTIVE", + "MATRIX_2D", + "MATRIX_2D_NO_ROT", + "MATRIX_3D" +}; + + +/* ============================================================= + * Reference transformations + */ + +static void ref_transform( GLvector4f *dst, + const GLmatrix *mat, + const GLvector4f *src ) +{ + GLuint i; + GLfloat *s = (GLfloat *)src->start; + GLfloat (*d)[4] = (GLfloat (*)[4])dst->start; + const GLfloat *m = mat->m; + + for ( i = 0 ; i < src->count ; i++ ) { + TRANSFORM_POINT( d[i], m, s ); + s = (GLfloat *)((char *)s + src->stride); + } +} + + +/* ============================================================= + * Vertex transformation tests + */ + +static void init_matrix( GLfloat *m ) +{ + m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; + m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; + m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; + m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; +} + +ALIGN16(static GLfloat, s[TEST_COUNT][4]); +ALIGN16(static GLfloat, d[TEST_COUNT][4]); +ALIGN16(static GLfloat, r[TEST_COUNT][4]); + +static int test_transform_function( transform_func func, int psize, + int mtype, unsigned long *cycles ) +{ + GLvector4f source[1], dest[1], ref[1]; + GLmatrix mat[1]; + GLfloat *m; + int i, j; +#ifdef RUN_DEBUG_BENCHMARK + int cycle_i; /* the counter for the benchmarks we run */ +#endif + + (void) cycles; + + if ( psize > 4 ) { + _mesa_problem( NULL, "test_transform_function called with psize > 4\n" ); + return 0; + } + + mat->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); + mat->type = mtypes[mtype]; + + m = mat->m; + ASSERT( ((long)m & 15) == 0 ); + + init_matrix( m ); + + for ( i = 0 ; i < 4 ; i++ ) { + for ( j = 0 ; j < 4 ; j++ ) { + switch ( templates[mtype][i * 4 + j] ) { + case NIL: + m[j * 4 + i] = 0.0; + break; + case ONE: + m[j * 4 + i] = 1.0; + break; + case NEG: + m[j * 4 + i] = -1.0; + break; + case VAR: + break; + default: + abort(); + } + } + } + + for ( i = 0 ; i < TEST_COUNT ; i++) { + ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 ); + ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 ); + for ( j = 0 ; j < psize ; j++ ) + s[i][j] = rnd(); + } + + source->data = (GLfloat(*)[4])s; + source->start = (GLfloat *)s; + source->count = TEST_COUNT; + source->stride = sizeof(s[0]); + source->size = 4; + source->flags = 0; + + dest->data = (GLfloat(*)[4])d; + dest->start = (GLfloat *)d; + dest->count = TEST_COUNT; + dest->stride = sizeof(float[4]); + dest->size = 0; + dest->flags = 0; + + ref->data = (GLfloat(*)[4])r; + ref->start = (GLfloat *)r; + ref->count = TEST_COUNT; + ref->stride = sizeof(float[4]); + ref->size = 0; + ref->flags = 0; + + ref_transform( ref, mat, source ); + + if ( mesa_profile ) { + BEGIN_RACE( *cycles ); + func( dest, mat->m, source ); + END_RACE( *cycles ); + } + else { + func( dest, mat->m, source ); + } + + for ( i = 0 ; i < TEST_COUNT ; i++ ) { + for ( j = 0 ; j < 4 ; j++ ) { + if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { + _mesa_printf("-----------------------------\n" ); + _mesa_printf("(i = %i, j = %i)\n", i, j ); + _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][0], r[i][0], r[i][0]-d[i][0], + MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); + _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][1], r[i][1], r[i][1]-d[i][1], + MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); + _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][2], r[i][2], r[i][2]-d[i][2], + MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); + _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][3], r[i][3], r[i][3]-d[i][3], + MAX_PRECISION - significand_match( d[i][3], r[i][3] ) ); + return 0; + } + } + } + + ALIGN_FREE( mat->m ); + return 1; +} + +void _math_test_all_transform_functions( char *description ) +{ + int psize, mtype; + unsigned long benchmark_tab[4][7]; + static int first_time = 1; + + if ( first_time ) { + first_time = 0; + mesa_profile = getenv( "MESA_PROFILE" ); + } + +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) { + if ( !counter_overhead ) { + INIT_COUNTER(); + _mesa_printf("counter overhead: %lu cycles\n\n", counter_overhead ); + } + _mesa_printf("transform results after hooking in %s functions:\n", description ); + } +#endif + +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) { + _mesa_printf("\n" ); + for ( psize = 1 ; psize <= 4 ; psize++ ) { + _mesa_printf(" p%d\t", psize ); + } + _mesa_printf("\n--------------------------------------------------------\n" ); + } +#endif + + for ( mtype = 0 ; mtype < 7 ; mtype++ ) { + for ( psize = 1 ; psize <= 4 ; psize++ ) { + transform_func func = _mesa_transform_tab[psize][mtypes[mtype]]; + unsigned long *cycles = &(benchmark_tab[psize-1][mtype]); + + if ( test_transform_function( func, psize, mtype, cycles ) == 0 ) { + char buf[100]; + _mesa_sprintf(buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", + psize, mstrings[mtype], description ); + _mesa_problem( NULL, buf ); + } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) + _mesa_printf(" %li\t", benchmark_tab[psize-1][mtype] ); +#endif + } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) + _mesa_printf(" | [%s]\n", mstrings[mtype] ); +#endif + } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) + _mesa_printf( "\n" ); +#endif +} + + +#endif /* DEBUG */ diff --git a/reactos/dll/mesa32/src/math/m_dotprod_tmp.h b/reactos/dll/mesa32/src/math/m_dotprod_tmp.h new file mode 100644 index 00000000000..03e65af6c1a --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_dotprod_tmp.h @@ -0,0 +1,102 @@ + +/* + * 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. + */ + +/* + * New (3.1) transformation code written by Keith Whitwell. + */ + + +/* Note - respects the stride of the output vector. + */ +static void TAG(dotprod_vec2)( GLfloat *out, + GLuint outstride, + const GLvector4f *coord_vec, + const GLfloat plane[4] ) +{ + GLuint stride = coord_vec->stride; + GLfloat *coord = coord_vec->start; + GLuint count = coord_vec->count; + + GLuint i; + + const GLfloat plane0 = plane[0], plane1 = plane[1], plane3 = plane[3]; + + for (i=0;istride; + GLfloat *coord = coord_vec->start; + GLuint count = coord_vec->count; + + GLuint i; + + const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2]; + const GLfloat plane3 = plane[3]; + + for (i=0;istride; + GLfloat *coord = coord_vec->start; + GLuint count = coord_vec->count; + GLuint i; + + const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2]; + const GLfloat plane3 = plane[3]; + + for (i=0;i= 2) { + bincoeff = (GLfloat) (order - 1); + s = 1.0F - t; + + for (k = 0; k < dim; k++) + out[k] = s * cp[k] + bincoeff * t * cp[dim + k]; + + for (i = 2, cp += 2 * dim, powert = t * t; i < order; + i++, powert *= t, cp += dim) { + bincoeff *= (GLfloat) (order - i); + bincoeff *= inv_tab[i]; + + for (k = 0; k < dim; k++) + out[k] = s * out[k] + bincoeff * powert * cp[k]; + } + } + else { /* order=1 -> constant curve */ + + for (k = 0; k < dim; k++) + out[k] = cp[k]; + } +} + +/* + * Tensor product Bezier surfaces + * + * Again the Horner scheme is used to compute a point on a + * TP Bezier surface. First a control polygon for a curve + * on the surface in one parameter direction is computed, + * then the point on the curve for the other parameter + * direction is evaluated. + * + * To store the curve control polygon additional storage + * for max(uorder,vorder) points is needed in the + * control net cn. + */ + +void +_math_horner_bezier_surf(GLfloat * cn, GLfloat * out, GLfloat u, GLfloat v, + GLuint dim, GLuint uorder, GLuint vorder) +{ + GLfloat *cp = cn + uorder * vorder * dim; + GLuint i, uinc = vorder * dim; + + if (vorder > uorder) { + if (uorder >= 2) { + GLfloat s, poweru, bincoeff; + GLuint j, k; + + /* Compute the control polygon for the surface-curve in u-direction */ + for (j = 0; j < vorder; j++) { + GLfloat *ucp = &cn[j * dim]; + + /* Each control point is the point for parameter u on a */ + /* curve defined by the control polygons in u-direction */ + bincoeff = (GLfloat) (uorder - 1); + s = 1.0F - u; + + for (k = 0; k < dim; k++) + cp[j * dim + k] = s * ucp[k] + bincoeff * u * ucp[uinc + k]; + + for (i = 2, ucp += 2 * uinc, poweru = u * u; i < uorder; + i++, poweru *= u, ucp += uinc) { + bincoeff *= (GLfloat) (uorder - i); + bincoeff *= inv_tab[i]; + + for (k = 0; k < dim; k++) + cp[j * dim + k] = + s * cp[j * dim + k] + bincoeff * poweru * ucp[k]; + } + } + + /* Evaluate curve point in v */ + _math_horner_bezier_curve(cp, out, v, dim, vorder); + } + else /* uorder=1 -> cn defines a curve in v */ + _math_horner_bezier_curve(cn, out, v, dim, vorder); + } + else { /* vorder <= uorder */ + + if (vorder > 1) { + GLuint i; + + /* Compute the control polygon for the surface-curve in u-direction */ + for (i = 0; i < uorder; i++, cn += uinc) { + /* For constant i all cn[i][j] (j=0..vorder) are located */ + /* on consecutive memory locations, so we can use */ + /* horner_bezier_curve to compute the control points */ + + _math_horner_bezier_curve(cn, &cp[i * dim], v, dim, vorder); + } + + /* Evaluate curve point in u */ + _math_horner_bezier_curve(cp, out, u, dim, uorder); + } + else /* vorder=1 -> cn defines a curve in u */ + _math_horner_bezier_curve(cn, out, u, dim, uorder); + } +} + +/* + * The direct de Casteljau algorithm is used when a point on the + * surface and the tangent directions spanning the tangent plane + * should be computed (this is needed to compute normals to the + * surface). In this case the de Casteljau algorithm approach is + * nicer because a point and the partial derivatives can be computed + * at the same time. To get the correct tangent length du and dv + * must be multiplied with the (u2-u1)/uorder-1 and (v2-v1)/vorder-1. + * Since only the directions are needed, this scaling step is omitted. + * + * De Casteljau needs additional storage for uorder*vorder + * values in the control net cn. + */ + +void +_math_de_casteljau_surf(GLfloat * cn, GLfloat * out, GLfloat * du, + GLfloat * dv, GLfloat u, GLfloat v, GLuint dim, + GLuint uorder, GLuint vorder) +{ + GLfloat *dcn = cn + uorder * vorder * dim; + GLfloat us = 1.0F - u, vs = 1.0F - v; + GLuint h, i, j, k; + GLuint minorder = uorder < vorder ? uorder : vorder; + GLuint uinc = vorder * dim; + GLuint dcuinc = vorder; + + /* Each component is evaluated separately to save buffer space */ + /* This does not drasticaly decrease the performance of the */ + /* algorithm. If additional storage for (uorder-1)*(vorder-1) */ + /* points would be available, the components could be accessed */ + /* in the innermost loop which could lead to less cache misses. */ + +#define CN(I,J,K) cn[(I)*uinc+(J)*dim+(K)] +#define DCN(I, J) dcn[(I)*dcuinc+(J)] + if (minorder < 3) { + if (uorder == vorder) { + for (k = 0; k < dim; k++) { + /* Derivative direction in u */ + du[k] = vs * (CN(1, 0, k) - CN(0, 0, k)) + + v * (CN(1, 1, k) - CN(0, 1, k)); + + /* Derivative direction in v */ + dv[k] = us * (CN(0, 1, k) - CN(0, 0, k)) + + u * (CN(1, 1, k) - CN(1, 0, k)); + + /* bilinear de Casteljau step */ + out[k] = us * (vs * CN(0, 0, k) + v * CN(0, 1, k)) + + u * (vs * CN(1, 0, k) + v * CN(1, 1, k)); + } + } + else if (minorder == uorder) { + for (k = 0; k < dim; k++) { + /* bilinear de Casteljau step */ + DCN(1, 0) = CN(1, 0, k) - CN(0, 0, k); + DCN(0, 0) = us * CN(0, 0, k) + u * CN(1, 0, k); + + for (j = 0; j < vorder - 1; j++) { + /* for the derivative in u */ + DCN(1, j + 1) = CN(1, j + 1, k) - CN(0, j + 1, k); + DCN(1, j) = vs * DCN(1, j) + v * DCN(1, j + 1); + + /* for the `point' */ + DCN(0, j + 1) = us * CN(0, j + 1, k) + u * CN(1, j + 1, k); + DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1); + } + + /* remaining linear de Casteljau steps until the second last step */ + for (h = minorder; h < vorder - 1; h++) + for (j = 0; j < vorder - h; j++) { + /* for the derivative in u */ + DCN(1, j) = vs * DCN(1, j) + v * DCN(1, j + 1); + + /* for the `point' */ + DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1); + } + + /* derivative direction in v */ + dv[k] = DCN(0, 1) - DCN(0, 0); + + /* derivative direction in u */ + du[k] = vs * DCN(1, 0) + v * DCN(1, 1); + + /* last linear de Casteljau step */ + out[k] = vs * DCN(0, 0) + v * DCN(0, 1); + } + } + else { /* minorder == vorder */ + + for (k = 0; k < dim; k++) { + /* bilinear de Casteljau step */ + DCN(0, 1) = CN(0, 1, k) - CN(0, 0, k); + DCN(0, 0) = vs * CN(0, 0, k) + v * CN(0, 1, k); + for (i = 0; i < uorder - 1; i++) { + /* for the derivative in v */ + DCN(i + 1, 1) = CN(i + 1, 1, k) - CN(i + 1, 0, k); + DCN(i, 1) = us * DCN(i, 1) + u * DCN(i + 1, 1); + + /* for the `point' */ + DCN(i + 1, 0) = vs * CN(i + 1, 0, k) + v * CN(i + 1, 1, k); + DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); + } + + /* remaining linear de Casteljau steps until the second last step */ + for (h = minorder; h < uorder - 1; h++) + for (i = 0; i < uorder - h; i++) { + /* for the derivative in v */ + DCN(i, 1) = us * DCN(i, 1) + u * DCN(i + 1, 1); + + /* for the `point' */ + DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); + } + + /* derivative direction in u */ + du[k] = DCN(1, 0) - DCN(0, 0); + + /* derivative direction in v */ + dv[k] = us * DCN(0, 1) + u * DCN(1, 1); + + /* last linear de Casteljau step */ + out[k] = us * DCN(0, 0) + u * DCN(1, 0); + } + } + } + else if (uorder == vorder) { + for (k = 0; k < dim; k++) { + /* first bilinear de Casteljau step */ + for (i = 0; i < uorder - 1; i++) { + DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k); + for (j = 0; j < vorder - 1; j++) { + DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k); + DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); + } + } + + /* remaining bilinear de Casteljau steps until the second last step */ + for (h = 2; h < minorder - 1; h++) + for (i = 0; i < uorder - h; i++) { + DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); + for (j = 0; j < vorder - h; j++) { + DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1); + DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); + } + } + + /* derivative direction in u */ + du[k] = vs * (DCN(1, 0) - DCN(0, 0)) + v * (DCN(1, 1) - DCN(0, 1)); + + /* derivative direction in v */ + dv[k] = us * (DCN(0, 1) - DCN(0, 0)) + u * (DCN(1, 1) - DCN(1, 0)); + + /* last bilinear de Casteljau step */ + out[k] = us * (vs * DCN(0, 0) + v * DCN(0, 1)) + + u * (vs * DCN(1, 0) + v * DCN(1, 1)); + } + } + else if (minorder == uorder) { + for (k = 0; k < dim; k++) { + /* first bilinear de Casteljau step */ + for (i = 0; i < uorder - 1; i++) { + DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k); + for (j = 0; j < vorder - 1; j++) { + DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k); + DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); + } + } + + /* remaining bilinear de Casteljau steps until the second last step */ + for (h = 2; h < minorder - 1; h++) + for (i = 0; i < uorder - h; i++) { + DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); + for (j = 0; j < vorder - h; j++) { + DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1); + DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); + } + } + + /* last bilinear de Casteljau step */ + DCN(2, 0) = DCN(1, 0) - DCN(0, 0); + DCN(0, 0) = us * DCN(0, 0) + u * DCN(1, 0); + for (j = 0; j < vorder - 1; j++) { + /* for the derivative in u */ + DCN(2, j + 1) = DCN(1, j + 1) - DCN(0, j + 1); + DCN(2, j) = vs * DCN(2, j) + v * DCN(2, j + 1); + + /* for the `point' */ + DCN(0, j + 1) = us * DCN(0, j + 1) + u * DCN(1, j + 1); + DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1); + } + + /* remaining linear de Casteljau steps until the second last step */ + for (h = minorder; h < vorder - 1; h++) + for (j = 0; j < vorder - h; j++) { + /* for the derivative in u */ + DCN(2, j) = vs * DCN(2, j) + v * DCN(2, j + 1); + + /* for the `point' */ + DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1); + } + + /* derivative direction in v */ + dv[k] = DCN(0, 1) - DCN(0, 0); + + /* derivative direction in u */ + du[k] = vs * DCN(2, 0) + v * DCN(2, 1); + + /* last linear de Casteljau step */ + out[k] = vs * DCN(0, 0) + v * DCN(0, 1); + } + } + else { /* minorder == vorder */ + + for (k = 0; k < dim; k++) { + /* first bilinear de Casteljau step */ + for (i = 0; i < uorder - 1; i++) { + DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k); + for (j = 0; j < vorder - 1; j++) { + DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k); + DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); + } + } + + /* remaining bilinear de Casteljau steps until the second last step */ + for (h = 2; h < minorder - 1; h++) + for (i = 0; i < uorder - h; i++) { + DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); + for (j = 0; j < vorder - h; j++) { + DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1); + DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); + } + } + + /* last bilinear de Casteljau step */ + DCN(0, 2) = DCN(0, 1) - DCN(0, 0); + DCN(0, 0) = vs * DCN(0, 0) + v * DCN(0, 1); + for (i = 0; i < uorder - 1; i++) { + /* for the derivative in v */ + DCN(i + 1, 2) = DCN(i + 1, 1) - DCN(i + 1, 0); + DCN(i, 2) = us * DCN(i, 2) + u * DCN(i + 1, 2); + + /* for the `point' */ + DCN(i + 1, 0) = vs * DCN(i + 1, 0) + v * DCN(i + 1, 1); + DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); + } + + /* remaining linear de Casteljau steps until the second last step */ + for (h = minorder; h < uorder - 1; h++) + for (i = 0; i < uorder - h; i++) { + /* for the derivative in v */ + DCN(i, 2) = us * DCN(i, 2) + u * DCN(i + 1, 2); + + /* for the `point' */ + DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); + } + + /* derivative direction in u */ + du[k] = DCN(1, 0) - DCN(0, 0); + + /* derivative direction in v */ + dv[k] = us * DCN(0, 2) + u * DCN(1, 2); + + /* last linear de Casteljau step */ + out[k] = us * DCN(0, 0) + u * DCN(1, 0); + } + } +#undef DCN +#undef CN +} + + +/* + * Do one-time initialization for evaluators. + */ +void +_math_init_eval(void) +{ + GLuint i; + + /* KW: precompute 1/x for useful x. + */ + for (i = 1; i < MAX_EVAL_ORDER; i++) + inv_tab[i] = 1.0F / i; +} diff --git a/reactos/dll/mesa32/src/math/m_eval.h b/reactos/dll/mesa32/src/math/m_eval.h new file mode 100644 index 00000000000..a23cbd402e6 --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_eval.h @@ -0,0 +1,103 @@ + +/* + * 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 _M_EVAL_H +#define _M_EVAL_H + +#include "glheader.h" + +void _math_init_eval( void ); + + +/* + * Horner scheme for Bezier curves + * + * Bezier curves can be computed via a Horner scheme. + * Horner is numerically less stable than the de Casteljau + * algorithm, but it is faster. For curves of degree n + * the complexity of Horner is O(n) and de Casteljau is O(n^2). + * Since stability is not important for displaying curve + * points I decided to use the Horner scheme. + * + * A cubic Bezier curve with control points b0, b1, b2, b3 can be + * written as + * + * (([3] [3] ) [3] ) [3] + * c(t) = (([0]*s*b0 + [1]*t*b1)*s + [2]*t^2*b2)*s + [3]*t^2*b3 + * + * [n] + * where s=1-t and the binomial coefficients [i]. These can + * be computed iteratively using the identity: + * + * [n] [n ] [n] + * [i] = (n-i+1)/i * [i-1] and [0] = 1 + */ + + +void +_math_horner_bezier_curve(const GLfloat *cp, GLfloat *out, GLfloat t, + GLuint dim, GLuint order); + + +/* + * Tensor product Bezier surfaces + * + * Again the Horner scheme is used to compute a point on a + * TP Bezier surface. First a control polygon for a curve + * on the surface in one parameter direction is computed, + * then the point on the curve for the other parameter + * direction is evaluated. + * + * To store the curve control polygon additional storage + * for max(uorder,vorder) points is needed in the + * control net cn. + */ + +void +_math_horner_bezier_surf(GLfloat *cn, GLfloat *out, GLfloat u, GLfloat v, + GLuint dim, GLuint uorder, GLuint vorder); + + +/* + * The direct de Casteljau algorithm is used when a point on the + * surface and the tangent directions spanning the tangent plane + * should be computed (this is needed to compute normals to the + * surface). In this case the de Casteljau algorithm approach is + * nicer because a point and the partial derivatives can be computed + * at the same time. To get the correct tangent length du and dv + * must be multiplied with the (u2-u1)/uorder-1 and (v2-v1)/vorder-1. + * Since only the directions are needed, this scaling step is omitted. + * + * De Casteljau needs additional storage for uorder*vorder + * values in the control net cn. + */ + +void +_math_de_casteljau_surf(GLfloat *cn, GLfloat *out, GLfloat *du, GLfloat *dv, + GLfloat u, GLfloat v, GLuint dim, + GLuint uorder, GLuint vorder); + + +#endif diff --git a/reactos/dll/mesa32/src/math/m_matrix.c b/reactos/dll/mesa32/src/math/m_matrix.c new file mode 100644 index 00000000000..408db9b9631 --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_matrix.c @@ -0,0 +1,1622 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 m_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 "macros.h" +#include "imports.h" + +#include "m_matrix.h" + + +/** + * \defgroup MatFlags MAT_FLAG_XXX-flags + * + * Bitmasks to indicate different kinds of 4x4 matrices in GLmatrix::flags + * It would be nice to make all these flags private to m_matrix.c + */ +/*@{*/ +#define MAT_FLAG_IDENTITY 0 /**< is an identity matrix flag. + * (Not actually used - the identity + * matrix is identified by the absense + * of all other flags.) + */ +#define MAT_FLAG_GENERAL 0x1 /**< is a general matrix flag */ +#define MAT_FLAG_ROTATION 0x2 /**< is a rotation matrix flag */ +#define MAT_FLAG_TRANSLATION 0x4 /**< is a translation matrix flag */ +#define MAT_FLAG_UNIFORM_SCALE 0x8 /**< is an uniform scaling matrix flag */ +#define MAT_FLAG_GENERAL_SCALE 0x10 /**< is a general scaling matrix flag */ +#define MAT_FLAG_GENERAL_3D 0x20 /**< general 3D matrix flag */ +#define MAT_FLAG_PERSPECTIVE 0x40 /**< is a perspective proj matrix flag */ +#define MAT_FLAG_SINGULAR 0x80 /**< is a singular matrix flag */ +#define MAT_DIRTY_TYPE 0x100 /**< matrix type is dirty */ +#define MAT_DIRTY_FLAGS 0x200 /**< matrix flags are dirty */ +#define MAT_DIRTY_INVERSE 0x400 /**< matrix inverse is dirty */ + +/** angle preserving matrix flags mask */ +#define MAT_FLAGS_ANGLE_PRESERVING (MAT_FLAG_ROTATION | \ + MAT_FLAG_TRANSLATION | \ + MAT_FLAG_UNIFORM_SCALE) + +/** geometry related matrix flags mask */ +#define MAT_FLAGS_GEOMETRY (MAT_FLAG_GENERAL | \ + MAT_FLAG_ROTATION | \ + MAT_FLAG_TRANSLATION | \ + MAT_FLAG_UNIFORM_SCALE | \ + MAT_FLAG_GENERAL_SCALE | \ + MAT_FLAG_GENERAL_3D | \ + MAT_FLAG_PERSPECTIVE | \ + MAT_FLAG_SINGULAR) + +/** length preserving matrix flags mask */ +#define MAT_FLAGS_LENGTH_PRESERVING (MAT_FLAG_ROTATION | \ + MAT_FLAG_TRANSLATION) + + +/** 3D (non-perspective) matrix flags mask */ +#define MAT_FLAGS_3D (MAT_FLAG_ROTATION | \ + MAT_FLAG_TRANSLATION | \ + MAT_FLAG_UNIFORM_SCALE | \ + MAT_FLAG_GENERAL_SCALE | \ + MAT_FLAG_GENERAL_3D) + +/** dirty matrix flags mask */ +#define MAT_DIRTY (MAT_DIRTY_TYPE | \ + MAT_DIRTY_FLAGS | \ + MAT_DIRTY_INVERSE) + +/*@}*/ + + +/** + * Test geometry related matrix flags. + * + * \param mat a pointer to a GLmatrix structure. + * \param a flags mask. + * + * \returns non-zero if all geometry related matrix flags are contained within + * the mask, or zero otherwise. + */ +#define TEST_MAT_FLAGS(mat, a) \ + ((MAT_FLAGS_GEOMETRY & (~(a)) & ((mat)->flags) ) == 0) + + + +/** + * Names of the corresponding GLmatrixtype values. + */ +static const char *types[] = { + "MATRIX_GENERAL", + "MATRIX_IDENTITY", + "MATRIX_3D_NO_ROT", + "MATRIX_PERSPECTIVE", + "MATRIX_2D", + "MATRIX_2D_NO_ROT", + "MATRIX_3D" +}; + + +/** + * Identity matrix. + */ +static GLfloat Identity[16] = { + 1.0, 0.0, 0.0, 0.0, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 +}; + + + +/**********************************************************************/ +/** \name Matrix multiplication */ +/*@{*/ + +#define A(row,col) a[(col<<2)+row] +#define B(row,col) b[(col<<2)+row] +#define P(row,col) product[(col<<2)+row] + +/** + * Perform a full 4x4 matrix multiplication. + * + * \param a matrix. + * \param b matrix. + * \param product will receive the product of \p a and \p b. + * + * \warning Is assumed that \p product != \p b. \p product == \p a is allowed. + * + * \note KW: 4*16 = 64 multiplications + * + * \author This \c matmul was contributed by Thomas Malik + */ +static void matmul4( GLfloat *product, const GLfloat *a, const GLfloat *b ) +{ + GLint i; + for (i = 0; i < 4; i++) { + const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3); + P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0); + P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1); + P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2); + P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3); + } +} + +/** + * Multiply two matrices known to occupy only the top three rows, such + * as typical model matrices, and orthogonal matrices. + * + * \param a matrix. + * \param b matrix. + * \param product will receive the product of \p a and \p b. + */ +static void matmul34( GLfloat *product, const GLfloat *a, const GLfloat *b ) +{ + GLint i; + for (i = 0; i < 3; i++) { + const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3); + P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0); + P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1); + P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2); + P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3; + } + P(3,0) = 0; + P(3,1) = 0; + P(3,2) = 0; + P(3,3) = 1; +} + +#undef A +#undef B +#undef P + +/** + * Multiply a matrix by an array of floats with known properties. + * + * \param mat pointer to a GLmatrix structure containing the left multiplication + * matrix, and that will receive the product result. + * \param m right multiplication matrix array. + * \param flags flags of the matrix \p m. + * + * Joins both flags and marks the type and inverse as dirty. Calls matmul34() + * if both matrices are 3D, or matmul4() otherwise. + */ +static void matrix_multf( GLmatrix *mat, const GLfloat *m, GLuint flags ) +{ + mat->flags |= (flags | MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE); + + if (TEST_MAT_FLAGS(mat, MAT_FLAGS_3D)) + matmul34( mat->m, mat->m, m ); + else + matmul4( mat->m, mat->m, m ); +} + +/** + * Matrix multiplication. + * + * \param dest destination matrix. + * \param a left matrix. + * \param b right matrix. + * + * Joins both flags and marks the type and inverse as dirty. Calls matmul34() + * if both matrices are 3D, or matmul4() otherwise. + */ +void +_math_matrix_mul_matrix( GLmatrix *dest, const GLmatrix *a, const GLmatrix *b ) +{ + dest->flags = (a->flags | + b->flags | + MAT_DIRTY_TYPE | + MAT_DIRTY_INVERSE); + + if (TEST_MAT_FLAGS(dest, MAT_FLAGS_3D)) + matmul34( dest->m, a->m, b->m ); + else + matmul4( dest->m, a->m, b->m ); +} + +/** + * Matrix multiplication. + * + * \param dest left and destination matrix. + * \param m right matrix array. + * + * Marks the matrix flags with general flag, and type and inverse dirty flags. + * Calls matmul4() for the multiplication. + */ +void +_math_matrix_mul_floats( GLmatrix *dest, const GLfloat *m ) +{ + dest->flags |= (MAT_FLAG_GENERAL | + MAT_DIRTY_TYPE | + MAT_DIRTY_INVERSE | + MAT_DIRTY_FLAGS); + + matmul4( dest->m, dest->m, m ); +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Matrix output */ +/*@{*/ + +/** + * Print a matrix array. + * + * \param m matrix array. + * + * Called by _math_matrix_print() to print a matrix or its inverse. + */ +static void print_matrix_floats( const GLfloat m[16] ) +{ + int i; + for (i=0;i<4;i++) { + _mesa_debug(NULL,"\t%f %f %f %f\n", m[i], m[4+i], m[8+i], m[12+i] ); + } +} + +/** + * Dumps the contents of a GLmatrix structure. + * + * \param m pointer to the GLmatrix structure. + */ +void +_math_matrix_print( const GLmatrix *m ) +{ + _mesa_debug(NULL, "Matrix type: %s, flags: %x\n", types[m->type], m->flags); + print_matrix_floats(m->m); + _mesa_debug(NULL, "Inverse: \n"); + if (m->inv) { + GLfloat prod[16]; + print_matrix_floats(m->inv); + matmul4(prod, m->m, m->inv); + _mesa_debug(NULL, "Mat * Inverse:\n"); + print_matrix_floats(prod); + } + else { + _mesa_debug(NULL, " - not available\n"); + } +} + +/*@}*/ + + +/** + * References an element of 4x4 matrix. + * + * \param m matrix array. + * \param c column of the desired element. + * \param r row of the desired element. + * + * \return value of the desired element. + * + * Calculate the linear storage index of the element and references it. + */ +#define MAT(m,r,c) (m)[(c)*4+(r)] + + +/**********************************************************************/ +/** \name Matrix inversion */ +/*@{*/ + +/** + * Swaps the values of two floating pointer variables. + * + * Used by invert_matrix_general() to swap the row pointers. + */ +#define SWAP_ROWS(a, b) { GLfloat *_tmp = a; (a)=(b); (b)=_tmp; } + +/** + * Compute inverse of 4x4 transformation matrix. + * + * \param mat pointer to a GLmatrix structure. The matrix inverse will be + * stored in the GLmatrix::inv attribute. + * + * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). + * + * \author + * Code contributed by Jacques Leroy jle@star.be + * + * Calculates the inverse matrix by performing the gaussian matrix reduction + * with partial pivoting followed by back/substitution with the loops manually + * unrolled. + */ +static GLboolean invert_matrix_general( GLmatrix *mat ) +{ + const GLfloat *m = mat->m; + GLfloat *out = mat->inv; + GLfloat wtmp[4][8]; + GLfloat m0, m1, m2, m3, s; + GLfloat *r0, *r1, *r2, *r3; + + r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3]; + + r0[0] = MAT(m,0,0), r0[1] = MAT(m,0,1), + r0[2] = MAT(m,0,2), r0[3] = MAT(m,0,3), + r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0, + + r1[0] = MAT(m,1,0), r1[1] = MAT(m,1,1), + r1[2] = MAT(m,1,2), r1[3] = MAT(m,1,3), + r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0, + + r2[0] = MAT(m,2,0), r2[1] = MAT(m,2,1), + r2[2] = MAT(m,2,2), r2[3] = MAT(m,2,3), + r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0, + + r3[0] = MAT(m,3,0), r3[1] = MAT(m,3,1), + r3[2] = MAT(m,3,2), r3[3] = MAT(m,3,3), + r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0; + + /* choose pivot - or die */ + if (fabs(r3[0])>fabs(r2[0])) SWAP_ROWS(r3, r2); + if (fabs(r2[0])>fabs(r1[0])) SWAP_ROWS(r2, r1); + if (fabs(r1[0])>fabs(r0[0])) SWAP_ROWS(r1, r0); + if (0.0 == r0[0]) return GL_FALSE; + + /* eliminate first variable */ + m1 = r1[0]/r0[0]; m2 = r2[0]/r0[0]; m3 = r3[0]/r0[0]; + s = r0[1]; r1[1] -= m1 * s; r2[1] -= m2 * s; r3[1] -= m3 * s; + s = r0[2]; r1[2] -= m1 * s; r2[2] -= m2 * s; r3[2] -= m3 * s; + s = r0[3]; r1[3] -= m1 * s; r2[3] -= m2 * s; r3[3] -= m3 * s; + s = r0[4]; + if (s != 0.0) { r1[4] -= m1 * s; r2[4] -= m2 * s; r3[4] -= m3 * s; } + s = r0[5]; + if (s != 0.0) { r1[5] -= m1 * s; r2[5] -= m2 * s; r3[5] -= m3 * s; } + s = r0[6]; + if (s != 0.0) { r1[6] -= m1 * s; r2[6] -= m2 * s; r3[6] -= m3 * s; } + s = r0[7]; + if (s != 0.0) { r1[7] -= m1 * s; r2[7] -= m2 * s; r3[7] -= m3 * s; } + + /* choose pivot - or die */ + if (fabs(r3[1])>fabs(r2[1])) SWAP_ROWS(r3, r2); + if (fabs(r2[1])>fabs(r1[1])) SWAP_ROWS(r2, r1); + if (0.0 == r1[1]) return GL_FALSE; + + /* eliminate second variable */ + m2 = r2[1]/r1[1]; m3 = r3[1]/r1[1]; + r2[2] -= m2 * r1[2]; r3[2] -= m3 * r1[2]; + r2[3] -= m2 * r1[3]; r3[3] -= m3 * r1[3]; + s = r1[4]; if (0.0 != s) { r2[4] -= m2 * s; r3[4] -= m3 * s; } + s = r1[5]; if (0.0 != s) { r2[5] -= m2 * s; r3[5] -= m3 * s; } + s = r1[6]; if (0.0 != s) { r2[6] -= m2 * s; r3[6] -= m3 * s; } + s = r1[7]; if (0.0 != s) { r2[7] -= m2 * s; r3[7] -= m3 * s; } + + /* choose pivot - or die */ + if (fabs(r3[2])>fabs(r2[2])) SWAP_ROWS(r3, r2); + if (0.0 == r2[2]) return GL_FALSE; + + /* eliminate third variable */ + m3 = r3[2]/r2[2]; + r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4], + r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6], + r3[7] -= m3 * r2[7]; + + /* last check */ + if (0.0 == r3[3]) return GL_FALSE; + + s = 1.0F/r3[3]; /* now back substitute row 3 */ + r3[4] *= s; r3[5] *= s; r3[6] *= s; r3[7] *= s; + + m2 = r2[3]; /* now back substitute row 2 */ + s = 1.0F/r2[2]; + r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2), + r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2); + m1 = r1[3]; + r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1, + r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1; + m0 = r0[3]; + r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0, + r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0; + + m1 = r1[2]; /* now back substitute row 1 */ + s = 1.0F/r1[1]; + r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1), + r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1); + m0 = r0[2]; + r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0, + r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0; + + m0 = r0[1]; /* now back substitute row 0 */ + s = 1.0F/r0[0]; + r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0), + r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0); + + MAT(out,0,0) = r0[4]; MAT(out,0,1) = r0[5], + MAT(out,0,2) = r0[6]; MAT(out,0,3) = r0[7], + MAT(out,1,0) = r1[4]; MAT(out,1,1) = r1[5], + MAT(out,1,2) = r1[6]; MAT(out,1,3) = r1[7], + MAT(out,2,0) = r2[4]; MAT(out,2,1) = r2[5], + MAT(out,2,2) = r2[6]; MAT(out,2,3) = r2[7], + MAT(out,3,0) = r3[4]; MAT(out,3,1) = r3[5], + MAT(out,3,2) = r3[6]; MAT(out,3,3) = r3[7]; + + return GL_TRUE; +} +#undef SWAP_ROWS + +/** + * Compute inverse of a general 3d transformation matrix. + * + * \param mat pointer to a GLmatrix structure. The matrix inverse will be + * stored in the GLmatrix::inv attribute. + * + * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). + * + * \author Adapted from graphics gems II. + * + * Calculates the inverse of the upper left by first calculating its + * determinant and multiplying it to the symmetric adjust matrix of each + * element. Finally deals with the translation part by transforming the + * original translation vector using by the calculated submatrix inverse. + */ +static GLboolean invert_matrix_3d_general( GLmatrix *mat ) +{ + const GLfloat *in = mat->m; + GLfloat *out = mat->inv; + GLfloat pos, neg, t; + GLfloat det; + + /* Calculate the determinant of upper left 3x3 submatrix and + * determine if the matrix is singular. + */ + pos = neg = 0.0; + t = MAT(in,0,0) * MAT(in,1,1) * MAT(in,2,2); + if (t >= 0.0) pos += t; else neg += t; + + t = MAT(in,1,0) * MAT(in,2,1) * MAT(in,0,2); + if (t >= 0.0) pos += t; else neg += t; + + t = MAT(in,2,0) * MAT(in,0,1) * MAT(in,1,2); + if (t >= 0.0) pos += t; else neg += t; + + t = -MAT(in,2,0) * MAT(in,1,1) * MAT(in,0,2); + if (t >= 0.0) pos += t; else neg += t; + + t = -MAT(in,1,0) * MAT(in,0,1) * MAT(in,2,2); + if (t >= 0.0) pos += t; else neg += t; + + t = -MAT(in,0,0) * MAT(in,2,1) * MAT(in,1,2); + if (t >= 0.0) pos += t; else neg += t; + + det = pos + neg; + + if (det*det < 1e-25) + return GL_FALSE; + + det = 1.0F / det; + MAT(out,0,0) = ( (MAT(in,1,1)*MAT(in,2,2) - MAT(in,2,1)*MAT(in,1,2) )*det); + MAT(out,0,1) = (- (MAT(in,0,1)*MAT(in,2,2) - MAT(in,2,1)*MAT(in,0,2) )*det); + MAT(out,0,2) = ( (MAT(in,0,1)*MAT(in,1,2) - MAT(in,1,1)*MAT(in,0,2) )*det); + MAT(out,1,0) = (- (MAT(in,1,0)*MAT(in,2,2) - MAT(in,2,0)*MAT(in,1,2) )*det); + MAT(out,1,1) = ( (MAT(in,0,0)*MAT(in,2,2) - MAT(in,2,0)*MAT(in,0,2) )*det); + MAT(out,1,2) = (- (MAT(in,0,0)*MAT(in,1,2) - MAT(in,1,0)*MAT(in,0,2) )*det); + MAT(out,2,0) = ( (MAT(in,1,0)*MAT(in,2,1) - MAT(in,2,0)*MAT(in,1,1) )*det); + MAT(out,2,1) = (- (MAT(in,0,0)*MAT(in,2,1) - MAT(in,2,0)*MAT(in,0,1) )*det); + MAT(out,2,2) = ( (MAT(in,0,0)*MAT(in,1,1) - MAT(in,1,0)*MAT(in,0,1) )*det); + + /* Do the translation part */ + MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0) + + MAT(in,1,3) * MAT(out,0,1) + + MAT(in,2,3) * MAT(out,0,2) ); + MAT(out,1,3) = - (MAT(in,0,3) * MAT(out,1,0) + + MAT(in,1,3) * MAT(out,1,1) + + MAT(in,2,3) * MAT(out,1,2) ); + MAT(out,2,3) = - (MAT(in,0,3) * MAT(out,2,0) + + MAT(in,1,3) * MAT(out,2,1) + + MAT(in,2,3) * MAT(out,2,2) ); + + return GL_TRUE; +} + +/** + * Compute inverse of a 3d transformation matrix. + * + * \param mat pointer to a GLmatrix structure. The matrix inverse will be + * stored in the GLmatrix::inv attribute. + * + * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). + * + * If the matrix is not an angle preserving matrix then calls + * invert_matrix_3d_general for the actual calculation. Otherwise calculates + * the inverse matrix analyzing and inverting each of the scaling, rotation and + * translation parts. + */ +static GLboolean invert_matrix_3d( GLmatrix *mat ) +{ + const GLfloat *in = mat->m; + GLfloat *out = mat->inv; + + if (!TEST_MAT_FLAGS(mat, MAT_FLAGS_ANGLE_PRESERVING)) { + return invert_matrix_3d_general( mat ); + } + + if (mat->flags & MAT_FLAG_UNIFORM_SCALE) { + GLfloat scale = (MAT(in,0,0) * MAT(in,0,0) + + MAT(in,0,1) * MAT(in,0,1) + + MAT(in,0,2) * MAT(in,0,2)); + + if (scale == 0.0) + return GL_FALSE; + + scale = 1.0F / scale; + + /* Transpose and scale the 3 by 3 upper-left submatrix. */ + MAT(out,0,0) = scale * MAT(in,0,0); + MAT(out,1,0) = scale * MAT(in,0,1); + MAT(out,2,0) = scale * MAT(in,0,2); + MAT(out,0,1) = scale * MAT(in,1,0); + MAT(out,1,1) = scale * MAT(in,1,1); + MAT(out,2,1) = scale * MAT(in,1,2); + MAT(out,0,2) = scale * MAT(in,2,0); + MAT(out,1,2) = scale * MAT(in,2,1); + MAT(out,2,2) = scale * MAT(in,2,2); + } + else if (mat->flags & MAT_FLAG_ROTATION) { + /* Transpose the 3 by 3 upper-left submatrix. */ + MAT(out,0,0) = MAT(in,0,0); + MAT(out,1,0) = MAT(in,0,1); + MAT(out,2,0) = MAT(in,0,2); + MAT(out,0,1) = MAT(in,1,0); + MAT(out,1,1) = MAT(in,1,1); + MAT(out,2,1) = MAT(in,1,2); + MAT(out,0,2) = MAT(in,2,0); + MAT(out,1,2) = MAT(in,2,1); + MAT(out,2,2) = MAT(in,2,2); + } + else { + /* pure translation */ + MEMCPY( out, Identity, sizeof(Identity) ); + MAT(out,0,3) = - MAT(in,0,3); + MAT(out,1,3) = - MAT(in,1,3); + MAT(out,2,3) = - MAT(in,2,3); + return GL_TRUE; + } + + if (mat->flags & MAT_FLAG_TRANSLATION) { + /* Do the translation part */ + MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0) + + MAT(in,1,3) * MAT(out,0,1) + + MAT(in,2,3) * MAT(out,0,2) ); + MAT(out,1,3) = - (MAT(in,0,3) * MAT(out,1,0) + + MAT(in,1,3) * MAT(out,1,1) + + MAT(in,2,3) * MAT(out,1,2) ); + MAT(out,2,3) = - (MAT(in,0,3) * MAT(out,2,0) + + MAT(in,1,3) * MAT(out,2,1) + + MAT(in,2,3) * MAT(out,2,2) ); + } + else { + MAT(out,0,3) = MAT(out,1,3) = MAT(out,2,3) = 0.0; + } + + return GL_TRUE; +} + +/** + * Compute inverse of an identity transformation matrix. + * + * \param mat pointer to a GLmatrix structure. The matrix inverse will be + * stored in the GLmatrix::inv attribute. + * + * \return always GL_TRUE. + * + * Simply copies Identity into GLmatrix::inv. + */ +static GLboolean invert_matrix_identity( GLmatrix *mat ) +{ + MEMCPY( mat->inv, Identity, sizeof(Identity) ); + return GL_TRUE; +} + +/** + * Compute inverse of a no-rotation 3d transformation matrix. + * + * \param mat pointer to a GLmatrix structure. The matrix inverse will be + * stored in the GLmatrix::inv attribute. + * + * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). + * + * Calculates the + */ +static GLboolean invert_matrix_3d_no_rot( GLmatrix *mat ) +{ + const GLfloat *in = mat->m; + GLfloat *out = mat->inv; + + if (MAT(in,0,0) == 0 || MAT(in,1,1) == 0 || MAT(in,2,2) == 0 ) + return GL_FALSE; + + MEMCPY( out, Identity, 16 * sizeof(GLfloat) ); + MAT(out,0,0) = 1.0F / MAT(in,0,0); + MAT(out,1,1) = 1.0F / MAT(in,1,1); + MAT(out,2,2) = 1.0F / MAT(in,2,2); + + if (mat->flags & MAT_FLAG_TRANSLATION) { + MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0)); + MAT(out,1,3) = - (MAT(in,1,3) * MAT(out,1,1)); + MAT(out,2,3) = - (MAT(in,2,3) * MAT(out,2,2)); + } + + return GL_TRUE; +} + +/** + * Compute inverse of a no-rotation 2d transformation matrix. + * + * \param mat pointer to a GLmatrix structure. The matrix inverse will be + * stored in the GLmatrix::inv attribute. + * + * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). + * + * Calculates the inverse matrix by applying the inverse scaling and + * translation to the identity matrix. + */ +static GLboolean invert_matrix_2d_no_rot( GLmatrix *mat ) +{ + const GLfloat *in = mat->m; + GLfloat *out = mat->inv; + + if (MAT(in,0,0) == 0 || MAT(in,1,1) == 0) + return GL_FALSE; + + MEMCPY( out, Identity, 16 * sizeof(GLfloat) ); + MAT(out,0,0) = 1.0F / MAT(in,0,0); + MAT(out,1,1) = 1.0F / MAT(in,1,1); + + if (mat->flags & MAT_FLAG_TRANSLATION) { + MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0)); + MAT(out,1,3) = - (MAT(in,1,3) * MAT(out,1,1)); + } + + return GL_TRUE; +} + +#if 0 +/* broken */ +static GLboolean invert_matrix_perspective( GLmatrix *mat ) +{ + const GLfloat *in = mat->m; + GLfloat *out = mat->inv; + + if (MAT(in,2,3) == 0) + return GL_FALSE; + + MEMCPY( out, Identity, 16 * sizeof(GLfloat) ); + + MAT(out,0,0) = 1.0F / MAT(in,0,0); + MAT(out,1,1) = 1.0F / MAT(in,1,1); + + MAT(out,0,3) = MAT(in,0,2); + MAT(out,1,3) = MAT(in,1,2); + + MAT(out,2,2) = 0; + MAT(out,2,3) = -1; + + MAT(out,3,2) = 1.0F / MAT(in,2,3); + MAT(out,3,3) = MAT(in,2,2) * MAT(out,3,2); + + return GL_TRUE; +} +#endif + +/** + * Matrix inversion function pointer type. + */ +typedef GLboolean (*inv_mat_func)( GLmatrix *mat ); + +/** + * Table of the matrix inversion functions according to the matrix type. + */ +static inv_mat_func inv_mat_tab[7] = { + invert_matrix_general, + invert_matrix_identity, + invert_matrix_3d_no_rot, +#if 0 + /* Don't use this function for now - it fails when the projection matrix + * is premultiplied by a translation (ala Chromium's tilesort SPU). + */ + invert_matrix_perspective, +#else + invert_matrix_general, +#endif + invert_matrix_3d, /* lazy! */ + invert_matrix_2d_no_rot, + invert_matrix_3d +}; + +/** + * Compute inverse of a transformation matrix. + * + * \param mat pointer to a GLmatrix structure. The matrix inverse will be + * stored in the GLmatrix::inv attribute. + * + * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). + * + * Calls the matrix inversion function in inv_mat_tab corresponding to the + * given matrix type. In case of failure, updates the MAT_FLAG_SINGULAR flag, + * and copies the identity matrix into GLmatrix::inv. + */ +static GLboolean matrix_invert( GLmatrix *mat ) +{ + if (inv_mat_tab[mat->type](mat)) { + mat->flags &= ~MAT_FLAG_SINGULAR; + return GL_TRUE; + } else { + mat->flags |= MAT_FLAG_SINGULAR; + MEMCPY( mat->inv, Identity, sizeof(Identity) ); + return GL_FALSE; + } +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Matrix generation */ +/*@{*/ + +/** + * Generate a 4x4 transformation matrix from glRotate parameters, and + * post-multiply the input matrix by it. + * + * \author + * This function was contributed by Erich Boleyn (erich@uruk.org). + * Optimizations contributed by Rudolf Opalla (rudi@khm.de). + */ +void +_math_matrix_rotate( GLmatrix *mat, + GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) +{ + GLfloat xx, yy, zz, xy, yz, zx, xs, ys, zs, one_c, s, c; + GLfloat m[16]; + GLboolean optimized; + + s = (GLfloat) sin( angle * DEG2RAD ); + c = (GLfloat) cos( angle * DEG2RAD ); + + MEMCPY(m, Identity, sizeof(GLfloat)*16); + optimized = GL_FALSE; + +#define M(row,col) m[col*4+row] + + if (x == 0.0F) { + if (y == 0.0F) { + if (z != 0.0F) { + optimized = GL_TRUE; + /* rotate only around z-axis */ + M(0,0) = c; + M(1,1) = c; + if (z < 0.0F) { + M(0,1) = s; + M(1,0) = -s; + } + else { + M(0,1) = -s; + M(1,0) = s; + } + } + } + else if (z == 0.0F) { + optimized = GL_TRUE; + /* rotate only around y-axis */ + M(0,0) = c; + M(2,2) = c; + if (y < 0.0F) { + M(0,2) = -s; + M(2,0) = s; + } + else { + M(0,2) = s; + M(2,0) = -s; + } + } + } + else if (y == 0.0F) { + if (z == 0.0F) { + optimized = GL_TRUE; + /* rotate only around x-axis */ + M(1,1) = c; + M(2,2) = c; + if (x < 0.0F) { + M(1,2) = s; + M(2,1) = -s; + } + else { + M(1,2) = -s; + M(2,1) = s; + } + } + } + + if (!optimized) { + const GLfloat mag = SQRTF(x * x + y * y + z * z); + + if (mag <= 1.0e-4) { + /* no rotation, leave mat as-is */ + return; + } + + x /= mag; + y /= mag; + z /= mag; + + + /* + * Arbitrary axis rotation matrix. + * + * This is composed of 5 matrices, Rz, Ry, T, Ry', Rz', multiplied + * like so: Rz * Ry * T * Ry' * Rz'. T is the final rotation + * (which is about the X-axis), and the two composite transforms + * Ry' * Rz' and Rz * Ry are (respectively) the rotations necessary + * from the arbitrary axis to the X-axis then back. They are + * all elementary rotations. + * + * Rz' is a rotation about the Z-axis, to bring the axis vector + * into the x-z plane. Then Ry' is applied, rotating about the + * Y-axis to bring the axis vector parallel with the X-axis. The + * rotation about the X-axis is then performed. Ry and Rz are + * simply the respective inverse transforms to bring the arbitrary + * axis back to it's original orientation. The first transforms + * Rz' and Ry' are considered inverses, since the data from the + * arbitrary axis gives you info on how to get to it, not how + * to get away from it, and an inverse must be applied. + * + * The basic calculation used is to recognize that the arbitrary + * axis vector (x, y, z), since it is of unit length, actually + * represents the sines and cosines of the angles to rotate the + * X-axis to the same orientation, with theta being the angle about + * Z and phi the angle about Y (in the order described above) + * as follows: + * + * cos ( theta ) = x / sqrt ( 1 - z^2 ) + * sin ( theta ) = y / sqrt ( 1 - z^2 ) + * + * cos ( phi ) = sqrt ( 1 - z^2 ) + * sin ( phi ) = z + * + * Note that cos ( phi ) can further be inserted to the above + * formulas: + * + * cos ( theta ) = x / cos ( phi ) + * sin ( theta ) = y / sin ( phi ) + * + * ...etc. Because of those relations and the standard trigonometric + * relations, it is pssible to reduce the transforms down to what + * is used below. It may be that any primary axis chosen will give the + * same results (modulo a sign convention) using thie method. + * + * Particularly nice is to notice that all divisions that might + * have caused trouble when parallel to certain planes or + * axis go away with care paid to reducing the expressions. + * After checking, it does perform correctly under all cases, since + * in all the cases of division where the denominator would have + * been zero, the numerator would have been zero as well, giving + * the expected result. + */ + + xx = x * x; + yy = y * y; + zz = z * z; + xy = x * y; + yz = y * z; + zx = z * x; + xs = x * s; + ys = y * s; + zs = z * s; + one_c = 1.0F - c; + + /* We already hold the identity-matrix so we can skip some statements */ + M(0,0) = (one_c * xx) + c; + M(0,1) = (one_c * xy) - zs; + M(0,2) = (one_c * zx) + ys; +/* M(0,3) = 0.0F; */ + + M(1,0) = (one_c * xy) + zs; + M(1,1) = (one_c * yy) + c; + M(1,2) = (one_c * yz) - xs; +/* M(1,3) = 0.0F; */ + + M(2,0) = (one_c * zx) - ys; + M(2,1) = (one_c * yz) + xs; + M(2,2) = (one_c * zz) + c; +/* M(2,3) = 0.0F; */ + +/* + M(3,0) = 0.0F; + M(3,1) = 0.0F; + M(3,2) = 0.0F; + M(3,3) = 1.0F; +*/ + } +#undef M + + matrix_multf( mat, m, MAT_FLAG_ROTATION ); +} + +/** + * Apply a perspective projection matrix. + * + * \param mat matrix to apply the projection. + * \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. + * + * Creates the projection matrix and multiplies it with \p mat, marking the + * MAT_FLAG_PERSPECTIVE flag. + */ +void +_math_matrix_frustum( GLmatrix *mat, + GLfloat left, GLfloat right, + GLfloat bottom, GLfloat top, + GLfloat nearval, GLfloat farval ) +{ + GLfloat x, y, a, b, c, d; + GLfloat m[16]; + + x = (2.0F*nearval) / (right-left); + y = (2.0F*nearval) / (top-bottom); + a = (right+left) / (right-left); + b = (top+bottom) / (top-bottom); + c = -(farval+nearval) / ( farval-nearval); + d = -(2.0F*farval*nearval) / (farval-nearval); /* error? */ + +#define M(row,col) m[col*4+row] + M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F; + M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F; + M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d; + M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F; +#undef M + + matrix_multf( mat, m, MAT_FLAG_PERSPECTIVE ); +} + +/** + * Apply an orthographic projection matrix. + * + * \param mat matrix to apply the projection. + * \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. + * + * Creates the projection matrix and multiplies it with \p mat, marking the + * MAT_FLAG_GENERAL_SCALE and MAT_FLAG_TRANSLATION flags. + */ +void +_math_matrix_ortho( GLmatrix *mat, + GLfloat left, GLfloat right, + GLfloat bottom, GLfloat top, + GLfloat nearval, GLfloat farval ) +{ + GLfloat m[16]; + +#define M(row,col) m[col*4+row] + M(0,0) = 2.0F / (right-left); + M(0,1) = 0.0F; + M(0,2) = 0.0F; + M(0,3) = -(right+left) / (right-left); + + M(1,0) = 0.0F; + M(1,1) = 2.0F / (top-bottom); + M(1,2) = 0.0F; + M(1,3) = -(top+bottom) / (top-bottom); + + M(2,0) = 0.0F; + M(2,1) = 0.0F; + M(2,2) = -2.0F / (farval-nearval); + M(2,3) = -(farval+nearval) / (farval-nearval); + + M(3,0) = 0.0F; + M(3,1) = 0.0F; + M(3,2) = 0.0F; + M(3,3) = 1.0F; +#undef M + + matrix_multf( mat, m, (MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION)); +} + +/** + * Multiply a matrix with a general scaling matrix. + * + * \param mat matrix. + * \param x x axis scale factor. + * \param y y axis scale factor. + * \param z z axis scale factor. + * + * Multiplies in-place the elements of \p mat by the scale factors. Checks if + * the scales factors are roughly the same, marking the MAT_FLAG_UNIFORM_SCALE + * flag, or MAT_FLAG_GENERAL_SCALE. Marks the MAT_DIRTY_TYPE and + * MAT_DIRTY_INVERSE dirty flags. + */ +void +_math_matrix_scale( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ) +{ + GLfloat *m = mat->m; + m[0] *= x; m[4] *= y; m[8] *= z; + m[1] *= x; m[5] *= y; m[9] *= z; + m[2] *= x; m[6] *= y; m[10] *= z; + m[3] *= x; m[7] *= y; m[11] *= z; + + if (fabs(x - y) < 1e-8 && fabs(x - z) < 1e-8) + mat->flags |= MAT_FLAG_UNIFORM_SCALE; + else + mat->flags |= MAT_FLAG_GENERAL_SCALE; + + mat->flags |= (MAT_DIRTY_TYPE | + MAT_DIRTY_INVERSE); +} + +/** + * Multiply a matrix with a translation matrix. + * + * \param mat matrix. + * \param x translation vector x coordinate. + * \param y translation vector y coordinate. + * \param z translation vector z coordinate. + * + * Adds the translation coordinates to the elements of \p mat in-place. Marks + * the MAT_FLAG_TRANSLATION flag, and the MAT_DIRTY_TYPE and MAT_DIRTY_INVERSE + * dirty flags. + */ +void +_math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ) +{ + GLfloat *m = mat->m; + m[12] = m[0] * x + m[4] * y + m[8] * z + m[12]; + m[13] = m[1] * x + m[5] * y + m[9] * z + m[13]; + m[14] = m[2] * x + m[6] * y + m[10] * z + m[14]; + m[15] = m[3] * x + m[7] * y + m[11] * z + m[15]; + + mat->flags |= (MAT_FLAG_TRANSLATION | + MAT_DIRTY_TYPE | + MAT_DIRTY_INVERSE); +} + + +/** + * Set matrix to do viewport and depthrange mapping. + * Transforms Normalized Device Coords to window/Z values. + */ +void +_math_matrix_viewport(GLmatrix *m, GLint x, GLint y, GLint width, GLint height, + GLfloat zNear, GLfloat zFar, GLfloat depthMax) +{ + m->m[MAT_SX] = (GLfloat) width / 2.0F; + m->m[MAT_TX] = m->m[MAT_SX] + x; + m->m[MAT_SY] = (GLfloat) height / 2.0F; + m->m[MAT_TY] = m->m[MAT_SY] + y; + m->m[MAT_SZ] = depthMax * ((zFar - zNear) / 2.0F); + m->m[MAT_TZ] = depthMax * ((zFar - zNear) / 2.0F + zNear); + m->flags = MAT_FLAG_GENERAL_SCALE | MAT_FLAG_TRANSLATION; + m->type = MATRIX_3D_NO_ROT; +} + + +/** + * Set a matrix to the identity matrix. + * + * \param mat matrix. + * + * Copies ::Identity into \p GLmatrix::m, and into GLmatrix::inv if not NULL. + * Sets the matrix type to identity, and clear the dirty flags. + */ +void +_math_matrix_set_identity( GLmatrix *mat ) +{ + MEMCPY( mat->m, Identity, 16*sizeof(GLfloat) ); + + if (mat->inv) + MEMCPY( mat->inv, Identity, 16*sizeof(GLfloat) ); + + mat->type = MATRIX_IDENTITY; + mat->flags &= ~(MAT_DIRTY_FLAGS| + MAT_DIRTY_TYPE| + MAT_DIRTY_INVERSE); +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Matrix analysis */ +/*@{*/ + +#define ZERO(x) (1<m; + GLuint mask = 0; + GLuint i; + + for (i = 0 ; i < 16 ; i++) { + if (m[i] == 0.0) mask |= (1<flags &= ~MAT_FLAGS_GEOMETRY; + + /* Check for translation - no-one really cares + */ + if ((mask & MASK_NO_TRX) != MASK_NO_TRX) + mat->flags |= MAT_FLAG_TRANSLATION; + + /* Do the real work + */ + if (mask == (GLuint) MASK_IDENTITY) { + mat->type = MATRIX_IDENTITY; + } + else if ((mask & MASK_2D_NO_ROT) == (GLuint) MASK_2D_NO_ROT) { + mat->type = MATRIX_2D_NO_ROT; + + if ((mask & MASK_NO_2D_SCALE) != MASK_NO_2D_SCALE) + mat->flags |= MAT_FLAG_GENERAL_SCALE; + } + else if ((mask & MASK_2D) == (GLuint) MASK_2D) { + GLfloat mm = DOT2(m, m); + GLfloat m4m4 = DOT2(m+4,m+4); + GLfloat mm4 = DOT2(m,m+4); + + mat->type = MATRIX_2D; + + /* Check for scale */ + if (SQ(mm-1) > SQ(1e-6) || + SQ(m4m4-1) > SQ(1e-6)) + mat->flags |= MAT_FLAG_GENERAL_SCALE; + + /* Check for rotation */ + if (SQ(mm4) > SQ(1e-6)) + mat->flags |= MAT_FLAG_GENERAL_3D; + else + mat->flags |= MAT_FLAG_ROTATION; + + } + else if ((mask & MASK_3D_NO_ROT) == (GLuint) MASK_3D_NO_ROT) { + mat->type = MATRIX_3D_NO_ROT; + + /* Check for scale */ + if (SQ(m[0]-m[5]) < SQ(1e-6) && + SQ(m[0]-m[10]) < SQ(1e-6)) { + if (SQ(m[0]-1.0) > SQ(1e-6)) { + mat->flags |= MAT_FLAG_UNIFORM_SCALE; + } + } + else { + mat->flags |= MAT_FLAG_GENERAL_SCALE; + } + } + else if ((mask & MASK_3D) == (GLuint) MASK_3D) { + GLfloat c1 = DOT3(m,m); + GLfloat c2 = DOT3(m+4,m+4); + GLfloat c3 = DOT3(m+8,m+8); + GLfloat d1 = DOT3(m, m+4); + GLfloat cp[3]; + + mat->type = MATRIX_3D; + + /* Check for scale */ + if (SQ(c1-c2) < SQ(1e-6) && SQ(c1-c3) < SQ(1e-6)) { + if (SQ(c1-1.0) > SQ(1e-6)) + mat->flags |= MAT_FLAG_UNIFORM_SCALE; + /* else no scale at all */ + } + else { + mat->flags |= MAT_FLAG_GENERAL_SCALE; + } + + /* Check for rotation */ + if (SQ(d1) < SQ(1e-6)) { + CROSS3( cp, m, m+4 ); + SUB_3V( cp, cp, (m+8) ); + if (LEN_SQUARED_3FV(cp) < SQ(1e-6)) + mat->flags |= MAT_FLAG_ROTATION; + else + mat->flags |= MAT_FLAG_GENERAL_3D; + } + else { + mat->flags |= MAT_FLAG_GENERAL_3D; /* shear, etc */ + } + } + else if ((mask & MASK_PERSPECTIVE) == MASK_PERSPECTIVE && m[11]==-1.0F) { + mat->type = MATRIX_PERSPECTIVE; + mat->flags |= MAT_FLAG_GENERAL; + } + else { + mat->type = MATRIX_GENERAL; + mat->flags |= MAT_FLAG_GENERAL; + } +} + +/** + * Analyze a matrix given that its flags are accurate. + * + * This is the more common operation, hopefully. + */ +static void analyse_from_flags( GLmatrix *mat ) +{ + const GLfloat *m = mat->m; + + if (TEST_MAT_FLAGS(mat, 0)) { + mat->type = MATRIX_IDENTITY; + } + else if (TEST_MAT_FLAGS(mat, (MAT_FLAG_TRANSLATION | + MAT_FLAG_UNIFORM_SCALE | + MAT_FLAG_GENERAL_SCALE))) { + if ( m[10]==1.0F && m[14]==0.0F ) { + mat->type = MATRIX_2D_NO_ROT; + } + else { + mat->type = MATRIX_3D_NO_ROT; + } + } + else if (TEST_MAT_FLAGS(mat, MAT_FLAGS_3D)) { + if ( m[ 8]==0.0F + && m[ 9]==0.0F + && m[2]==0.0F && m[6]==0.0F && m[10]==1.0F && m[14]==0.0F) { + mat->type = MATRIX_2D; + } + else { + mat->type = MATRIX_3D; + } + } + else if ( m[4]==0.0F && m[12]==0.0F + && m[1]==0.0F && m[13]==0.0F + && m[2]==0.0F && m[6]==0.0F + && m[3]==0.0F && m[7]==0.0F && m[11]==-1.0F && m[15]==0.0F) { + mat->type = MATRIX_PERSPECTIVE; + } + else { + mat->type = MATRIX_GENERAL; + } +} + +/** + * Analyze and update a matrix. + * + * \param mat matrix. + * + * If the matrix type is dirty then calls either analyse_from_scratch() or + * analyse_from_flags() to determine its type, according to whether the flags + * are dirty or not, respectively. If the matrix has an inverse and it's dirty + * then calls matrix_invert(). Finally clears the dirty flags. + */ +void +_math_matrix_analyse( GLmatrix *mat ) +{ + if (mat->flags & MAT_DIRTY_TYPE) { + if (mat->flags & MAT_DIRTY_FLAGS) + analyse_from_scratch( mat ); + else + analyse_from_flags( mat ); + } + + if (mat->inv && (mat->flags & MAT_DIRTY_INVERSE)) { + matrix_invert( mat ); + } + + mat->flags &= ~(MAT_DIRTY_FLAGS| + MAT_DIRTY_TYPE| + MAT_DIRTY_INVERSE); +} + +/*@}*/ + + +/** + * Test if the given matrix preserves vector lengths. + */ +GLboolean +_math_matrix_is_length_preserving( const GLmatrix *m ) +{ + return TEST_MAT_FLAGS( m, MAT_FLAGS_LENGTH_PRESERVING); +} + + +/** + * Test if the given matrix does any rotation. + * (or perhaps if the upper-left 3x3 is non-identity) + */ +GLboolean +_math_matrix_has_rotation( const GLmatrix *m ) +{ + if (m->flags & (MAT_FLAG_GENERAL | + MAT_FLAG_ROTATION | + MAT_FLAG_GENERAL_3D | + MAT_FLAG_PERSPECTIVE)) + return GL_TRUE; + else + return GL_FALSE; +} + + +GLboolean +_math_matrix_is_general_scale( const GLmatrix *m ) +{ + return (m->flags & MAT_FLAG_GENERAL_SCALE) ? GL_TRUE : GL_FALSE; +} + + +GLboolean +_math_matrix_is_dirty( const GLmatrix *m ) +{ + return (m->flags & MAT_DIRTY) ? GL_TRUE : GL_FALSE; +} + + +/**********************************************************************/ +/** \name Matrix setup */ +/*@{*/ + +/** + * Copy a matrix. + * + * \param to destination matrix. + * \param from source matrix. + * + * Copies all fields in GLmatrix, creating an inverse array if necessary. + */ +void +_math_matrix_copy( GLmatrix *to, const GLmatrix *from ) +{ + MEMCPY( to->m, from->m, sizeof(Identity) ); + to->flags = from->flags; + to->type = from->type; + + if (to->inv != 0) { + if (from->inv == 0) { + matrix_invert( to ); + } + else { + MEMCPY(to->inv, from->inv, sizeof(GLfloat)*16); + } + } +} + +/** + * Loads a matrix array into GLmatrix. + * + * \param m matrix array. + * \param mat matrix. + * + * Copies \p m into GLmatrix::m and marks the MAT_FLAG_GENERAL and MAT_DIRTY + * flags. + */ +void +_math_matrix_loadf( GLmatrix *mat, const GLfloat *m ) +{ + MEMCPY( mat->m, m, 16*sizeof(GLfloat) ); + mat->flags = (MAT_FLAG_GENERAL | MAT_DIRTY); +} + +/** + * Matrix constructor. + * + * \param m matrix. + * + * Initialize the GLmatrix fields. + */ +void +_math_matrix_ctr( GLmatrix *m ) +{ + m->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); + if (m->m) + MEMCPY( m->m, Identity, sizeof(Identity) ); + m->inv = NULL; + m->type = MATRIX_IDENTITY; + m->flags = 0; +} + +/** + * Matrix destructor. + * + * \param m matrix. + * + * Frees the data in a GLmatrix. + */ +void +_math_matrix_dtr( GLmatrix *m ) +{ + if (m->m) { + ALIGN_FREE( m->m ); + m->m = NULL; + } + if (m->inv) { + ALIGN_FREE( m->inv ); + m->inv = NULL; + } +} + +/** + * Allocate a matrix inverse. + * + * \param m matrix. + * + * Allocates the matrix inverse, GLmatrix::inv, and sets it to Identity. + */ +void +_math_matrix_alloc_inv( GLmatrix *m ) +{ + if (!m->inv) { + m->inv = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); + if (m->inv) + MEMCPY( m->inv, Identity, 16 * sizeof(GLfloat) ); + } +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Matrix transpose */ +/*@{*/ + +/** + * Transpose a GLfloat matrix. + * + * \param to destination array. + * \param from source array. + */ +void +_math_transposef( GLfloat to[16], const GLfloat from[16] ) +{ + to[0] = from[0]; + to[1] = from[4]; + to[2] = from[8]; + to[3] = from[12]; + to[4] = from[1]; + to[5] = from[5]; + to[6] = from[9]; + to[7] = from[13]; + to[8] = from[2]; + to[9] = from[6]; + to[10] = from[10]; + to[11] = from[14]; + to[12] = from[3]; + to[13] = from[7]; + to[14] = from[11]; + to[15] = from[15]; +} + +/** + * Transpose a GLdouble matrix. + * + * \param to destination array. + * \param from source array. + */ +void +_math_transposed( GLdouble to[16], const GLdouble from[16] ) +{ + to[0] = from[0]; + to[1] = from[4]; + to[2] = from[8]; + to[3] = from[12]; + to[4] = from[1]; + to[5] = from[5]; + to[6] = from[9]; + to[7] = from[13]; + to[8] = from[2]; + to[9] = from[6]; + to[10] = from[10]; + to[11] = from[14]; + to[12] = from[3]; + to[13] = from[7]; + to[14] = from[11]; + to[15] = from[15]; +} + +/** + * Transpose a GLdouble matrix and convert to GLfloat. + * + * \param to destination array. + * \param from source array. + */ +void +_math_transposefd( GLfloat to[16], const GLdouble from[16] ) +{ + to[0] = (GLfloat) from[0]; + to[1] = (GLfloat) from[4]; + to[2] = (GLfloat) from[8]; + to[3] = (GLfloat) from[12]; + to[4] = (GLfloat) from[1]; + to[5] = (GLfloat) from[5]; + to[6] = (GLfloat) from[9]; + to[7] = (GLfloat) from[13]; + to[8] = (GLfloat) from[2]; + to[9] = (GLfloat) from[6]; + to[10] = (GLfloat) from[10]; + to[11] = (GLfloat) from[14]; + to[12] = (GLfloat) from[3]; + to[13] = (GLfloat) from[7]; + to[14] = (GLfloat) from[11]; + to[15] = (GLfloat) from[15]; +} + +/*@}*/ + diff --git a/reactos/dll/mesa32/src/math/m_matrix.h b/reactos/dll/mesa32/src/math/m_matrix.h new file mode 100644 index 00000000000..e8303f3ac5c --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_matrix.h @@ -0,0 +1,195 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 math/m_matrix.h + * Defines basic structures for matrix-handling. + */ + +#ifndef _M_MATRIX_H +#define _M_MATRIX_H + + + +/** + * \name Symbolic names to some of the entries in the matrix + * + * These are handy for the viewport mapping, which is expressed as a matrix. + */ +/*@{*/ +#define MAT_SX 0 +#define MAT_SY 5 +#define MAT_SZ 10 +#define MAT_TX 12 +#define MAT_TY 13 +#define MAT_TZ 14 +/*@}*/ + + +/** + * Different kinds of 4x4 transformation matrices. + * We use these to select specific optimized vertex transformation routines. + */ +enum GLmatrixtype { + MATRIX_GENERAL, /**< general 4x4 matrix */ + MATRIX_IDENTITY, /**< identity matrix */ + MATRIX_3D_NO_ROT, /**< orthogonal projection and others... */ + MATRIX_PERSPECTIVE, /**< perspective projection matrix */ + MATRIX_2D, /**< 2-D transformation */ + MATRIX_2D_NO_ROT, /**< 2-D scale & translate only */ + MATRIX_3D /**< 3-D transformation */ +} ; + +/** + * Matrix type to represent 4x4 transformation matrices. + */ +typedef struct { + GLfloat *m; /**< 16 matrix elements (16-byte aligned) */ + GLfloat *inv; /**< optional 16-element inverse (16-byte aligned) */ + GLuint flags; /**< possible values determined by (of \link + * MatFlags MAT_FLAG_* flags\endlink) + */ + enum GLmatrixtype type; +} GLmatrix; + + + + +extern void +_math_matrix_ctr( GLmatrix *m ); + +extern void +_math_matrix_dtr( GLmatrix *m ); + +extern void +_math_matrix_alloc_inv( GLmatrix *m ); + +extern void +_math_matrix_mul_matrix( GLmatrix *dest, const GLmatrix *a, const GLmatrix *b ); + +extern void +_math_matrix_mul_floats( GLmatrix *dest, const GLfloat *b ); + +extern void +_math_matrix_loadf( GLmatrix *mat, const GLfloat *m ); + +extern void +_math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ); + +extern void +_math_matrix_rotate( GLmatrix *m, GLfloat angle, + GLfloat x, GLfloat y, GLfloat z ); + +extern void +_math_matrix_scale( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ); + +extern void +_math_matrix_ortho( GLmatrix *mat, + GLfloat left, GLfloat right, + GLfloat bottom, GLfloat top, + GLfloat nearval, GLfloat farval ); + +extern void +_math_matrix_frustum( GLmatrix *mat, + GLfloat left, GLfloat right, + GLfloat bottom, GLfloat top, + GLfloat nearval, GLfloat farval ); + +extern void +_math_matrix_viewport(GLmatrix *m, GLint x, GLint y, GLint width, GLint height, + GLfloat zNear, GLfloat zFar, GLfloat depthMax); + +extern void +_math_matrix_set_identity( GLmatrix *dest ); + +extern void +_math_matrix_copy( GLmatrix *to, const GLmatrix *from ); + +extern void +_math_matrix_analyse( GLmatrix *mat ); + +extern void +_math_matrix_print( const GLmatrix *m ); + +extern GLboolean +_math_matrix_is_length_preserving( const GLmatrix *m ); + +extern GLboolean +_math_matrix_has_rotation( const GLmatrix *m ); + +extern GLboolean +_math_matrix_is_general_scale( const GLmatrix *m ); + +extern GLboolean +_math_matrix_is_dirty( const GLmatrix *m ); + + +/** + * \name Related functions that don't actually operate on GLmatrix structs + */ +/*@{*/ + +extern void +_math_transposef( GLfloat to[16], const GLfloat from[16] ); + +extern void +_math_transposed( GLdouble to[16], const GLdouble from[16] ); + +extern void +_math_transposefd( GLfloat to[16], const GLdouble from[16] ); + + +/* + * Transform a point (column vector) by a matrix: Q = M * P + */ +#define TRANSFORM_POINT( Q, M, P ) \ + Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12] * P[3]; \ + Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13] * P[3]; \ + Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14] * P[3]; \ + Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15] * P[3]; + + +#define TRANSFORM_POINT3( Q, M, P ) \ + Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12]; \ + Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13]; \ + Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14]; \ + Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15]; + + +/* + * Transform a normal (row vector) by a matrix: [NX NY NZ] = N * MAT + */ +#define TRANSFORM_NORMAL( TO, N, MAT ) \ +do { \ + TO[0] = N[0] * MAT[0] + N[1] * MAT[1] + N[2] * MAT[2]; \ + TO[1] = N[0] * MAT[4] + N[1] * MAT[5] + N[2] * MAT[6]; \ + TO[2] = N[0] * MAT[8] + N[1] * MAT[9] + N[2] * MAT[10]; \ +} while (0) + + +/*@}*/ + + +#endif diff --git a/reactos/dll/mesa32/src/math/m_norm_tmp.h b/reactos/dll/mesa32/src/math/m_norm_tmp.h new file mode 100644 index 00000000000..a20cb05017d --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_norm_tmp.h @@ -0,0 +1,390 @@ + +/* + * 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. + */ + +/* + * New (3.1) transformation code written by Keith Whitwell. + */ + +/* Functions to tranform a vector of normals. This includes applying + * the transformation matrix, rescaling and normalization. + */ + +/* + * mat - the 4x4 transformation matrix + * scale - uniform scale factor of the transformation matrix (not always used) + * in - the source vector of normals + * lengths - length of each incoming normal (may be NULL) (a display list + * optimization) + * dest - the destination vector of normals + */ +static void _XFORMAPI +TAG(transform_normalize_normals)( const GLmatrix *mat, + GLfloat scale, + const GLvector4f *in, + const GLfloat *lengths, + GLvector4f *dest ) +{ + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; + const GLfloat *from = in->start; + const GLuint stride = in->stride; + const GLuint count = in->count; + const GLfloat *m = mat->inv; + GLfloat m0 = m[0], m4 = m[4], m8 = m[8]; + GLfloat m1 = m[1], m5 = m[5], m9 = m[9]; + GLfloat m2 = m[2], m6 = m[6], m10 = m[10]; + GLuint i; + + if (!lengths) { + STRIDE_LOOP { + GLfloat tx, ty, tz; + { + const GLfloat ux = from[0], uy = from[1], uz = from[2]; + tx = ux * m0 + uy * m1 + uz * m2; + ty = ux * m4 + uy * m5 + uz * m6; + tz = ux * m8 + uy * m9 + uz * m10; + } + { + GLdouble len = tx*tx + ty*ty + tz*tz; + if (len > 1e-20) { + GLfloat scale = INV_SQRTF(len); + out[i][0] = tx * scale; + out[i][1] = ty * scale; + out[i][2] = tz * scale; + } + else { + out[i][0] = out[i][1] = out[i][2] = 0; + } + } + } + } + else { + if (scale != 1.0) { + m0 *= scale, m4 *= scale, m8 *= scale; + m1 *= scale, m5 *= scale, m9 *= scale; + m2 *= scale, m6 *= scale, m10 *= scale; + } + + STRIDE_LOOP { + GLfloat tx, ty, tz; + { + const GLfloat ux = from[0], uy = from[1], uz = from[2]; + tx = ux * m0 + uy * m1 + uz * m2; + ty = ux * m4 + uy * m5 + uz * m6; + tz = ux * m8 + uy * m9 + uz * m10; + } + { + GLfloat len = lengths[i]; + out[i][0] = tx * len; + out[i][1] = ty * len; + out[i][2] = tz * len; + } + } + } + dest->count = in->count; +} + + +static void _XFORMAPI +TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat, + GLfloat scale, + const GLvector4f *in, + const GLfloat *lengths, + GLvector4f *dest ) +{ + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; + const GLfloat *from = in->start; + const GLuint stride = in->stride; + const GLuint count = in->count; + const GLfloat *m = mat->inv; + GLfloat m0 = m[0]; + GLfloat m5 = m[5]; + GLfloat m10 = m[10]; + GLuint i; + + if (!lengths) { + STRIDE_LOOP { + GLfloat tx, ty, tz; + { + const GLfloat ux = from[0], uy = from[1], uz = from[2]; + tx = ux * m0 ; + ty = uy * m5 ; + tz = uz * m10; + } + { + GLdouble len = tx*tx + ty*ty + tz*tz; + if (len > 1e-20) { + GLfloat scale = INV_SQRTF(len); + out[i][0] = tx * scale; + out[i][1] = ty * scale; + out[i][2] = tz * scale; + } + else { + out[i][0] = out[i][1] = out[i][2] = 0; + } + } + } + } + else { + m0 *= scale; + m5 *= scale; + m10 *= scale; + + STRIDE_LOOP { + GLfloat tx, ty, tz; + { + const GLfloat ux = from[0], uy = from[1], uz = from[2]; + tx = ux * m0 ; + ty = uy * m5 ; + tz = uz * m10; + } + { + GLfloat len = lengths[i]; + out[i][0] = tx * len; + out[i][1] = ty * len; + out[i][2] = tz * len; + } + } + } + dest->count = in->count; +} + + +static void _XFORMAPI +TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat, + GLfloat scale, + const GLvector4f *in, + const GLfloat *lengths, + GLvector4f *dest ) +{ + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; + const GLfloat *from = in->start; + const GLuint stride = in->stride; + const GLuint count = in->count; + const GLfloat *m = mat->inv; + const GLfloat m0 = scale*m[0]; + const GLfloat m5 = scale*m[5]; + const GLfloat m10 = scale*m[10]; + GLuint i; + + (void) lengths; + + STRIDE_LOOP { + GLfloat ux = from[0], uy = from[1], uz = from[2]; + out[i][0] = ux * m0; + out[i][1] = uy * m5; + out[i][2] = uz * m10; + } + dest->count = in->count; +} + + +static void _XFORMAPI +TAG(transform_rescale_normals)( const GLmatrix *mat, + GLfloat scale, + const GLvector4f *in, + const GLfloat *lengths, + GLvector4f *dest ) +{ + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; + const GLfloat *from = in->start; + const GLuint stride = in->stride; + const GLuint count = in->count; + /* Since we are unlikely to have < 3 vertices in the buffer, + * it makes sense to pre-multiply by scale. + */ + const GLfloat *m = mat->inv; + const GLfloat m0 = scale*m[0], m4 = scale*m[4], m8 = scale*m[8]; + const GLfloat m1 = scale*m[1], m5 = scale*m[5], m9 = scale*m[9]; + const GLfloat m2 = scale*m[2], m6 = scale*m[6], m10 = scale*m[10]; + GLuint i; + + (void) lengths; + + STRIDE_LOOP { + GLfloat ux = from[0], uy = from[1], uz = from[2]; + out[i][0] = ux * m0 + uy * m1 + uz * m2; + out[i][1] = ux * m4 + uy * m5 + uz * m6; + out[i][2] = ux * m8 + uy * m9 + uz * m10; + } + dest->count = in->count; +} + + +static void _XFORMAPI +TAG(transform_normals_no_rot)( const GLmatrix *mat, + GLfloat scale, + const GLvector4f *in, + const GLfloat *lengths, + GLvector4f *dest ) +{ + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; + const GLfloat *from = in->start; + const GLuint stride = in->stride; + const GLuint count = in->count; + const GLfloat *m = mat->inv; + const GLfloat m0 = m[0]; + const GLfloat m5 = m[5]; + const GLfloat m10 = m[10]; + GLuint i; + + (void) scale; + (void) lengths; + + STRIDE_LOOP { + GLfloat ux = from[0], uy = from[1], uz = from[2]; + out[i][0] = ux * m0; + out[i][1] = uy * m5; + out[i][2] = uz * m10; + } + dest->count = in->count; +} + + +static void _XFORMAPI +TAG(transform_normals)( const GLmatrix *mat, + GLfloat scale, + const GLvector4f *in, + const GLfloat *lengths, + GLvector4f *dest ) +{ + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; + const GLfloat *from = in->start; + const GLuint stride = in->stride; + const GLuint count = in->count; + const GLfloat *m = mat->inv; + const GLfloat m0 = m[0], m4 = m[4], m8 = m[8]; + const GLfloat m1 = m[1], m5 = m[5], m9 = m[9]; + const GLfloat m2 = m[2], m6 = m[6], m10 = m[10]; + GLuint i; + + (void) scale; + (void) lengths; + + STRIDE_LOOP { + GLfloat ux = from[0], uy = from[1], uz = from[2]; + out[i][0] = ux * m0 + uy * m1 + uz * m2; + out[i][1] = ux * m4 + uy * m5 + uz * m6; + out[i][2] = ux * m8 + uy * m9 + uz * m10; + } + dest->count = in->count; +} + + +static void _XFORMAPI +TAG(normalize_normals)( const GLmatrix *mat, + GLfloat scale, + const GLvector4f *in, + const GLfloat *lengths, + GLvector4f *dest ) +{ + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; + const GLfloat *from = in->start; + const GLuint stride = in->stride; + const GLuint count = in->count; + GLuint i; + + (void) mat; + (void) scale; + + if (lengths) { + STRIDE_LOOP { + const GLfloat x = from[0], y = from[1], z = from[2]; + GLfloat invlen = lengths[i]; + out[i][0] = x * invlen; + out[i][1] = y * invlen; + out[i][2] = z * invlen; + } + } + else { + STRIDE_LOOP { + const GLfloat x = from[0], y = from[1], z = from[2]; + GLdouble len = x * x + y * y + z * z; + if (len > 1e-50) { + len = INV_SQRTF(len); + out[i][0] = (GLfloat)(x * len); + out[i][1] = (GLfloat)(y * len); + out[i][2] = (GLfloat)(z * len); + } + else { + out[i][0] = x; + out[i][1] = y; + out[i][2] = z; + } + } + } + dest->count = in->count; +} + + +static void _XFORMAPI +TAG(rescale_normals)( const GLmatrix *mat, + GLfloat scale, + const GLvector4f *in, + const GLfloat *lengths, + GLvector4f *dest ) +{ + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; + const GLfloat *from = in->start; + const GLuint stride = in->stride; + const GLuint count = in->count; + GLuint i; + + (void) mat; + (void) lengths; + + STRIDE_LOOP { + SCALE_SCALAR_3V( out[i], scale, from ); + } + dest->count = in->count; +} + + +static void _XFORMAPI +TAG(init_c_norm_transform)( void ) +{ + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = + TAG(transform_normals_no_rot); + + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = + TAG(transform_rescale_normals_no_rot); + + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] = + TAG(transform_normalize_normals_no_rot); + + _mesa_normal_tab[NORM_TRANSFORM] = + TAG(transform_normals); + + _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = + TAG(transform_rescale_normals); + + _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] = + TAG(transform_normalize_normals); + + _mesa_normal_tab[NORM_RESCALE] = + TAG(rescale_normals); + + _mesa_normal_tab[NORM_NORMALIZE] = + TAG(normalize_normals); +} diff --git a/reactos/dll/mesa32/src/math/m_trans_tmp.h b/reactos/dll/mesa32/src/math/m_trans_tmp.h new file mode 100644 index 00000000000..c1f0f767436 --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_trans_tmp.h @@ -0,0 +1,287 @@ +/* + * 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. + */ + +/* + * New (3.1) transformation code written by Keith Whitwell. + */ + + +/* KW: This file also included by tnl/trans_elt.c to build code + * specific to the implementation of array-elements in the + * tnl module. + */ + + +#ifdef DEST_4F +static void DEST_4F( GLfloat (*t)[4], + CONST void *ptr, + GLuint stride, + ARGS ) +{ + const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; + const GLubyte *first = f; + GLuint i; + + (void) first; + (void) start; + for (i = DST_START ; i < n ; i++, NEXT_F) { + CHECK { + NEXT_F2; + if (SZ >= 1) t[i][0] = TRX_4F(f, 0); + if (SZ >= 2) t[i][1] = TRX_4F(f, 1); + if (SZ >= 3) t[i][2] = TRX_4F(f, 2); + if (SZ == 4) t[i][3] = TRX_4F(f, 3); else t[i][3] = 1.0; + } + } +} +#endif + + + +#ifdef DEST_4FC +static void DEST_4FC( GLfloat (*t)[4], + CONST void *ptr, + GLuint stride, + ARGS ) +{ + const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; + const GLubyte *first = f; + GLuint i; + + (void) first; + (void) start; + for (i = DST_START ; i < n ; i++, NEXT_F) { + CHECK { + NEXT_F2; + if (SZ >= 1) t[i][0] = TRX_4FC(f, 0); + if (SZ >= 2) t[i][1] = TRX_4FC(f, 1); + if (SZ >= 3) t[i][2] = TRX_4FC(f, 2); + if (SZ == 4) t[i][3] = TRX_4FC(f, 3); else t[i][3] = 1.0; + } + } +} +#endif + + +#ifdef DEST_3F +static void DEST_3F( GLfloat (*t)[3], + CONST void *ptr, + GLuint stride, + ARGS ) +{ + const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; + const GLubyte *first = f; + GLuint i; + (void) first; + (void) start; + for (i = DST_START ; i < n ; i++, NEXT_F) { + CHECK { + NEXT_F2; + t[i][0] = TRX_3F(f, 0); + t[i][1] = TRX_3F(f, 1); + t[i][2] = TRX_3F(f, 2); + } + } +} +#endif + +#ifdef DEST_1F +static void DEST_1F( GLfloat *t, + CONST void *ptr, + GLuint stride, + ARGS ) +{ + const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; + const GLubyte *first = f; + GLuint i; + (void) first; + (void) start; + for (i = DST_START ; i < n ; i++, NEXT_F) { + CHECK { + NEXT_F2; + t[i] = TRX_1F(f, 0); + } + } +} +#endif + +#ifdef DEST_4UB +static void DEST_4UB( GLubyte (*t)[4], + CONST void *ptr, + GLuint stride, + ARGS ) +{ + const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; + const GLubyte *first = f; + GLuint i; + (void) start; + (void) first; + for (i = DST_START ; i < n ; i++, NEXT_F) { + CHECK { + NEXT_F2; + if (SZ >= 1) TRX_UB(t[i][0], f, 0); + if (SZ >= 2) TRX_UB(t[i][1], f, 1); + if (SZ >= 3) TRX_UB(t[i][2], f, 2); + if (SZ == 4) TRX_UB(t[i][3], f, 3); else t[i][3] = 255; + } + } +} +#endif + + +#ifdef DEST_4US +static void DEST_4US( GLushort (*t)[4], + CONST void *ptr, + GLuint stride, + ARGS ) +{ + const GLubyte *f = (GLubyte *) ((GLubyte *) ptr + SRC_START * stride); + const GLubyte *first = f; + GLuint i; + (void) start; + (void) first; + for (i = DST_START ; i < n ; i++, NEXT_F) { + CHECK { + NEXT_F2; + if (SZ >= 1) TRX_US(t[i][0], f, 0); + if (SZ >= 2) TRX_US(t[i][1], f, 1); + if (SZ >= 3) TRX_US(t[i][2], f, 2); + if (SZ == 4) TRX_US(t[i][3], f, 3); else t[i][3] = 65535; + } + } +} +#endif + + +#ifdef DEST_1UB +static void DEST_1UB( GLubyte *t, + CONST void *ptr, + GLuint stride, + ARGS ) +{ + const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; + const GLubyte *first = f; + GLuint i; + (void) start; + (void) first; + for (i = DST_START ; i < n ; i++, NEXT_F) { + CHECK { + NEXT_F2; + TRX_UB(t[i], f, 0); + } + } +} +#endif + + +#ifdef DEST_1UI +static void DEST_1UI( GLuint *t, + CONST void *ptr, + GLuint stride, + ARGS ) +{ + const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; + const GLubyte *first = f; + GLuint i; + (void) start; + (void) first; + + for (i = DST_START ; i < n ; i++, NEXT_F) { + CHECK { + NEXT_F2; + t[i] = TRX_UI(f, 0); + } + } +} +#endif + + +static void INIT(void) +{ +#ifdef DEST_1UI + ASSERT(SZ == 1); + TAB(_1ui)[SRC_IDX] = DEST_1UI; +#endif +#ifdef DEST_1UB + ASSERT(SZ == 1); + TAB(_1ub)[SRC_IDX] = DEST_1UB; +#endif +#ifdef DEST_1F + ASSERT(SZ == 1); + TAB(_1f)[SRC_IDX] = DEST_1F; +#endif +#ifdef DEST_3F + ASSERT(SZ == 3); + TAB(_3f)[SRC_IDX] = DEST_3F; +#endif +#ifdef DEST_4UB + TAB(_4ub)[SZ][SRC_IDX] = DEST_4UB; +#endif +#ifdef DEST_4US + TAB(_4us)[SZ][SRC_IDX] = DEST_4US; +#endif +#ifdef DEST_4F + TAB(_4f)[SZ][SRC_IDX] = DEST_4F; +#endif +#ifdef DEST_4FC + TAB(_4fc)[SZ][SRC_IDX] = DEST_4FC; +#endif + +} + + +#ifdef INIT +#undef INIT +#endif +#ifdef DEST_1UI +#undef DEST_1UI +#endif +#ifdef DEST_1UB +#undef DEST_1UB +#endif +#ifdef DEST_4UB +#undef DEST_4UB +#endif +#ifdef DEST_4US +#undef DEST_4US +#endif +#ifdef DEST_3F +#undef DEST_3F +#endif +#ifdef DEST_4F +#undef DEST_4F +#endif +#ifdef DEST_4FC +#undef DEST_4FC +#endif +#ifdef DEST_1F +#undef DEST_1F +#endif +#ifdef SZ +#undef SZ +#endif +#ifdef TAG +#undef TAG +#endif + diff --git a/reactos/dll/mesa32/src/math/m_translate.c b/reactos/dll/mesa32/src/math/m_translate.c new file mode 100644 index 00000000000..1bce0f3a0ca --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_translate.c @@ -0,0 +1,718 @@ +/* + * 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. + */ + +/* + * New (3.1) transformation code written by Keith Whitwell. + */ + + +#include "glheader.h" +#include "mtypes.h" /* GLchan hack */ +#include "colormac.h" + +#include "m_translate.h" + + + +typedef void (*trans_1f_func)(GLfloat *to, + CONST void *ptr, + GLuint stride, + GLuint start, + GLuint n ); + +typedef void (*trans_1ui_func)(GLuint *to, + CONST void *ptr, + GLuint stride, + GLuint start, + GLuint n ); + +typedef void (*trans_1ub_func)(GLubyte *to, + CONST void *ptr, + GLuint stride, + GLuint start, + GLuint n ); + +typedef void (*trans_4ub_func)(GLubyte (*to)[4], + CONST void *ptr, + GLuint stride, + GLuint start, + GLuint n ); + +typedef void (*trans_4us_func)(GLushort (*to)[4], + CONST void *ptr, + GLuint stride, + GLuint start, + GLuint n ); + +typedef void (*trans_4f_func)(GLfloat (*to)[4], + CONST void *ptr, + GLuint stride, + GLuint start, + GLuint n ); + +typedef void (*trans_3f_func)(GLfloat (*to)[3], + CONST void *ptr, + GLuint stride, + GLuint start, + GLuint n ); + + + + +#define TYPE_IDX(t) ((t) & 0xf) +#define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */ + + +/* This macro is used on other systems, so undefine it for this module */ + +#undef CHECK + +static trans_1f_func _math_trans_1f_tab[MAX_TYPES]; +static trans_1ui_func _math_trans_1ui_tab[MAX_TYPES]; +static trans_1ub_func _math_trans_1ub_tab[MAX_TYPES]; +static trans_3f_func _math_trans_3f_tab[MAX_TYPES]; +static trans_4ub_func _math_trans_4ub_tab[5][MAX_TYPES]; +static trans_4us_func _math_trans_4us_tab[5][MAX_TYPES]; +static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; +static trans_4f_func _math_trans_4fc_tab[5][MAX_TYPES]; + + +#define PTR_ELT(ptr, elt) (((SRC *)ptr)[elt]) + + +#define TAB(x) _math_trans##x##_tab +#define ARGS GLuint start, GLuint n +#define SRC_START start +#define DST_START 0 +#define STRIDE stride +#define NEXT_F f += stride +#define NEXT_F2 +#define CHECK + + + + +/* GL_BYTE + */ +#define SRC GLbyte +#define SRC_IDX TYPE_IDX(GL_BYTE) +#define TRX_3F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_4F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_UB(ub, f,n) ub = BYTE_TO_UBYTE( PTR_ELT(f,n) ) +#define TRX_US(ch, f,n) ch = BYTE_TO_USHORT( PTR_ELT(f,n) ) +#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) + + +#define SZ 4 +#define INIT init_trans_4_GLbyte_raw +#define DEST_4F trans_4_GLbyte_4f_raw +#define DEST_4FC trans_4_GLbyte_4fc_raw +#define DEST_4UB trans_4_GLbyte_4ub_raw +#define DEST_4US trans_4_GLbyte_4us_raw +#include "m_trans_tmp.h" + +#define SZ 3 +#define INIT init_trans_3_GLbyte_raw +#define DEST_4F trans_3_GLbyte_4f_raw +#define DEST_4FC trans_3_GLbyte_4fc_raw +#define DEST_4UB trans_3_GLbyte_4ub_raw +#define DEST_4US trans_3_GLbyte_4us_raw +#define DEST_3F trans_3_GLbyte_3f_raw +#include "m_trans_tmp.h" + +#define SZ 2 +#define INIT init_trans_2_GLbyte_raw +#define DEST_4F trans_2_GLbyte_4f_raw +#define DEST_4FC trans_2_GLbyte_4fc_raw +#include "m_trans_tmp.h" + +#define SZ 1 +#define INIT init_trans_1_GLbyte_raw +#define DEST_4F trans_1_GLbyte_4f_raw +#define DEST_4FC trans_1_GLbyte_4fc_raw +#define DEST_1UB trans_1_GLbyte_1ub_raw +#define DEST_1UI trans_1_GLbyte_1ui_raw +#include "m_trans_tmp.h" + +#undef SRC +#undef TRX_3F +#undef TRX_4F +#undef TRX_4FC +#undef TRX_UB +#undef TRX_US +#undef TRX_UI +#undef SRC_IDX + + +/* GL_UNSIGNED_BYTE + */ +#define SRC GLubyte +#define SRC_IDX TYPE_IDX(GL_UNSIGNED_BYTE) +#define TRX_3F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) +#define TRX_4F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) +#define TRX_4FC(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) +#define TRX_UB(ub, f,n) ub = PTR_ELT(f,n) +#define TRX_US(us, f,n) us = UBYTE_TO_USHORT(PTR_ELT(f,n)) +#define TRX_UI(f,n) (GLuint)PTR_ELT(f,n) + +/* 4ub->4ub handled in special case below. + */ +#define SZ 4 +#define INIT init_trans_4_GLubyte_raw +#define DEST_4F trans_4_GLubyte_4f_raw +#define DEST_4FC trans_4_GLubyte_4fc_raw +#define DEST_4US trans_4_GLubyte_4us_raw +#include "m_trans_tmp.h" + + +#define SZ 3 +#define INIT init_trans_3_GLubyte_raw +#define DEST_4UB trans_3_GLubyte_4ub_raw +#define DEST_4US trans_3_GLubyte_4us_raw +#define DEST_3F trans_3_GLubyte_3f_raw +#define DEST_4F trans_3_GLubyte_4f_raw +#define DEST_4FC trans_3_GLubyte_4fc_raw +#include "m_trans_tmp.h" + + +#define SZ 1 +#define INIT init_trans_1_GLubyte_raw +#define DEST_1UI trans_1_GLubyte_1ui_raw +#define DEST_1UB trans_1_GLubyte_1ub_raw +#include "m_trans_tmp.h" + +#undef SRC +#undef SRC_IDX +#undef TRX_3F +#undef TRX_4F +#undef TRX_4FC +#undef TRX_UB +#undef TRX_US +#undef TRX_UI + + +/* GL_SHORT + */ +#define SRC GLshort +#define SRC_IDX TYPE_IDX(GL_SHORT) +#define TRX_3F(f,n) SHORT_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_UB(ub, f,n) ub = SHORT_TO_UBYTE(PTR_ELT(f,n)) +#define TRX_US(us, f,n) us = SHORT_TO_USHORT(PTR_ELT(f,n)) +#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) + + +#define SZ 4 +#define INIT init_trans_4_GLshort_raw +#define DEST_4F trans_4_GLshort_4f_raw +#define DEST_4FC trans_4_GLshort_4fc_raw +#define DEST_4UB trans_4_GLshort_4ub_raw +#define DEST_4US trans_4_GLshort_4us_raw +#include "m_trans_tmp.h" + +#define SZ 3 +#define INIT init_trans_3_GLshort_raw +#define DEST_4F trans_3_GLshort_4f_raw +#define DEST_4FC trans_3_GLshort_4fc_raw +#define DEST_4UB trans_3_GLshort_4ub_raw +#define DEST_4US trans_3_GLshort_4us_raw +#define DEST_3F trans_3_GLshort_3f_raw +#include "m_trans_tmp.h" + +#define SZ 2 +#define INIT init_trans_2_GLshort_raw +#define DEST_4F trans_2_GLshort_4f_raw +#define DEST_4FC trans_2_GLshort_4fc_raw +#include "m_trans_tmp.h" + +#define SZ 1 +#define INIT init_trans_1_GLshort_raw +#define DEST_4F trans_1_GLshort_4f_raw +#define DEST_4FC trans_1_GLshort_4fc_raw +#define DEST_1UB trans_1_GLshort_1ub_raw +#define DEST_1UI trans_1_GLshort_1ui_raw +#include "m_trans_tmp.h" + + +#undef SRC +#undef SRC_IDX +#undef TRX_3F +#undef TRX_4F +#undef TRX_4FC +#undef TRX_UB +#undef TRX_US +#undef TRX_UI + + +/* GL_UNSIGNED_SHORT + */ +#define SRC GLushort +#define SRC_IDX TYPE_IDX(GL_UNSIGNED_SHORT) +#define TRX_3F(f,n) USHORT_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_UB(ub,f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 8) +#define TRX_US(us,f,n) us = (GLushort) (PTR_ELT(f,n) >> 8) +#define TRX_UI(f,n) (GLuint) PTR_ELT(f,n) + + +#define SZ 4 +#define INIT init_trans_4_GLushort_raw +#define DEST_4F trans_4_GLushort_4f_raw +#define DEST_4FC trans_4_GLushort_4fc_raw +#define DEST_4UB trans_4_GLushort_4ub_raw +#define DEST_4US trans_4_GLushort_4us_raw +#include "m_trans_tmp.h" + +#define SZ 3 +#define INIT init_trans_3_GLushort_raw +#define DEST_4F trans_3_GLushort_4f_raw +#define DEST_4FC trans_3_GLushort_4fc_raw +#define DEST_4UB trans_3_GLushort_4ub_raw +#define DEST_4US trans_3_GLushort_4us_raw +#define DEST_3F trans_3_GLushort_3f_raw +#include "m_trans_tmp.h" + +#define SZ 2 +#define INIT init_trans_2_GLushort_raw +#define DEST_4F trans_2_GLushort_4f_raw +#define DEST_4FC trans_2_GLushort_4fc_raw +#include "m_trans_tmp.h" + +#define SZ 1 +#define INIT init_trans_1_GLushort_raw +#define DEST_4F trans_1_GLushort_4f_raw +#define DEST_4FC trans_1_GLushort_4fc_raw +#define DEST_1UB trans_1_GLushort_1ub_raw +#define DEST_1UI trans_1_GLushort_1ui_raw +#include "m_trans_tmp.h" + +#undef SRC +#undef SRC_IDX +#undef TRX_3F +#undef TRX_4F +#undef TRX_4FC +#undef TRX_UB +#undef TRX_US +#undef TRX_UI + + +/* GL_INT + */ +#define SRC GLint +#define SRC_IDX TYPE_IDX(GL_INT) +#define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_UB(ub, f,n) ub = INT_TO_UBYTE(PTR_ELT(f,n)) +#define TRX_US(us, f,n) us = INT_TO_USHORT(PTR_ELT(f,n)) +#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) + + +#define SZ 4 +#define INIT init_trans_4_GLint_raw +#define DEST_4F trans_4_GLint_4f_raw +#define DEST_4FC trans_4_GLint_4fc_raw +#define DEST_4UB trans_4_GLint_4ub_raw +#define DEST_4US trans_4_GLint_4us_raw +#include "m_trans_tmp.h" + +#define SZ 3 +#define INIT init_trans_3_GLint_raw +#define DEST_4F trans_3_GLint_4f_raw +#define DEST_4FC trans_3_GLint_4fc_raw +#define DEST_4UB trans_3_GLint_4ub_raw +#define DEST_4US trans_3_GLint_4us_raw +#define DEST_3F trans_3_GLint_3f_raw +#include "m_trans_tmp.h" + +#define SZ 2 +#define INIT init_trans_2_GLint_raw +#define DEST_4F trans_2_GLint_4f_raw +#define DEST_4FC trans_2_GLint_4fc_raw +#include "m_trans_tmp.h" + +#define SZ 1 +#define INIT init_trans_1_GLint_raw +#define DEST_4F trans_1_GLint_4f_raw +#define DEST_4FC trans_1_GLint_4fc_raw +#define DEST_1UB trans_1_GLint_1ub_raw +#define DEST_1UI trans_1_GLint_1ui_raw +#include "m_trans_tmp.h" + + +#undef SRC +#undef SRC_IDX +#undef TRX_3F +#undef TRX_4F +#undef TRX_4FC +#undef TRX_UB +#undef TRX_US +#undef TRX_UI + + +/* GL_UNSIGNED_INT + */ +#define SRC GLuint +#define SRC_IDX TYPE_IDX(GL_UNSIGNED_INT) +#define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_UB(ub, f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 24) +#define TRX_US(us, f,n) us = (GLshort) (PTR_ELT(f,n) >> 16) +#define TRX_UI(f,n) PTR_ELT(f,n) + + +#define SZ 4 +#define INIT init_trans_4_GLuint_raw +#define DEST_4F trans_4_GLuint_4f_raw +#define DEST_4FC trans_4_GLuint_4fc_raw +#define DEST_4UB trans_4_GLuint_4ub_raw +#define DEST_4US trans_4_GLuint_4us_raw +#include "m_trans_tmp.h" + +#define SZ 3 +#define INIT init_trans_3_GLuint_raw +#define DEST_4F trans_3_GLuint_4f_raw +#define DEST_4FC trans_3_GLuint_4fc_raw +#define DEST_4UB trans_3_GLuint_4ub_raw +#define DEST_4US trans_3_GLuint_4us_raw +#define DEST_3F trans_3_GLuint_3f_raw +#include "m_trans_tmp.h" + +#define SZ 2 +#define INIT init_trans_2_GLuint_raw +#define DEST_4F trans_2_GLuint_4f_raw +#define DEST_4FC trans_2_GLuint_4fc_raw +#include "m_trans_tmp.h" + +#define SZ 1 +#define INIT init_trans_1_GLuint_raw +#define DEST_4F trans_1_GLuint_4f_raw +#define DEST_4FC trans_1_GLuint_4fc_raw +#define DEST_1UB trans_1_GLuint_1ub_raw +#define DEST_1UI trans_1_GLuint_1ui_raw +#include "m_trans_tmp.h" + +#undef SRC +#undef SRC_IDX +#undef TRX_3F +#undef TRX_4F +#undef TRX_4FC +#undef TRX_UB +#undef TRX_US +#undef TRX_UI + + +/* GL_DOUBLE + */ +#define SRC GLdouble +#define SRC_IDX TYPE_IDX(GL_DOUBLE) +#define TRX_3F(f,n) (GLfloat) PTR_ELT(f,n) +#define TRX_4F(f,n) (GLfloat) PTR_ELT(f,n) +#define TRX_4FC(f,n) (GLfloat) PTR_ELT(f,n) +#define TRX_UB(ub,f,n) UNCLAMPED_FLOAT_TO_UBYTE(ub, PTR_ELT(f,n)) +#define TRX_US(us,f,n) UNCLAMPED_FLOAT_TO_USHORT(us, PTR_ELT(f,n)) +#define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n) +#define TRX_1F(f,n) (GLfloat) PTR_ELT(f,n) + + +#define SZ 4 +#define INIT init_trans_4_GLdouble_raw +#define DEST_4F trans_4_GLdouble_4f_raw +#define DEST_4FC trans_4_GLdouble_4fc_raw +#define DEST_4UB trans_4_GLdouble_4ub_raw +#define DEST_4US trans_4_GLdouble_4us_raw +#include "m_trans_tmp.h" + +#define SZ 3 +#define INIT init_trans_3_GLdouble_raw +#define DEST_4F trans_3_GLdouble_4f_raw +#define DEST_4FC trans_3_GLdouble_4fc_raw +#define DEST_4UB trans_3_GLdouble_4ub_raw +#define DEST_4US trans_3_GLdouble_4us_raw +#define DEST_3F trans_3_GLdouble_3f_raw +#include "m_trans_tmp.h" + +#define SZ 2 +#define INIT init_trans_2_GLdouble_raw +#define DEST_4F trans_2_GLdouble_4f_raw +#define DEST_4FC trans_2_GLdouble_4fc_raw +#include "m_trans_tmp.h" + +#define SZ 1 +#define INIT init_trans_1_GLdouble_raw +#define DEST_4F trans_1_GLdouble_4f_raw +#define DEST_4FC trans_1_GLdouble_4fc_raw +#define DEST_1UB trans_1_GLdouble_1ub_raw +#define DEST_1UI trans_1_GLdouble_1ui_raw +#define DEST_1F trans_1_GLdouble_1f_raw +#include "m_trans_tmp.h" + +#undef SRC +#undef SRC_IDX + +/* GL_FLOAT + */ +#define SRC GLfloat +#define SRC_IDX TYPE_IDX(GL_FLOAT) +#define SZ 4 +#define INIT init_trans_4_GLfloat_raw +#define DEST_4UB trans_4_GLfloat_4ub_raw +#define DEST_4US trans_4_GLfloat_4us_raw +#define DEST_4F trans_4_GLfloat_4f_raw +#define DEST_4FC trans_4_GLfloat_4fc_raw +#include "m_trans_tmp.h" + +#define SZ 3 +#define INIT init_trans_3_GLfloat_raw +#define DEST_4F trans_3_GLfloat_4f_raw +#define DEST_4FC trans_3_GLfloat_4fc_raw +#define DEST_4UB trans_3_GLfloat_4ub_raw +#define DEST_4US trans_3_GLfloat_4us_raw +#define DEST_3F trans_3_GLfloat_3f_raw +#include "m_trans_tmp.h" + +#define SZ 2 +#define INIT init_trans_2_GLfloat_raw +#define DEST_4F trans_2_GLfloat_4f_raw +#define DEST_4FC trans_2_GLfloat_4fc_raw +#include "m_trans_tmp.h" + +#define SZ 1 +#define INIT init_trans_1_GLfloat_raw +#define DEST_4F trans_1_GLfloat_4f_raw +#define DEST_4FC trans_1_GLfloat_4fc_raw +#define DEST_1UB trans_1_GLfloat_1ub_raw +#define DEST_1UI trans_1_GLfloat_1ui_raw +#define DEST_1F trans_1_GLfloat_1f_raw + +#include "m_trans_tmp.h" + +#undef SRC +#undef SRC_IDX +#undef TRX_3F +#undef TRX_4F +#undef TRX_4FC +#undef TRX_UB +#undef TRX_US +#undef TRX_UI + + +static void trans_4_GLubyte_4ub_raw(GLubyte (*t)[4], + CONST void *Ptr, + GLuint stride, + ARGS ) +{ + const GLubyte *f = (GLubyte *) Ptr + SRC_START * stride; + GLuint i; + + if (((((uintptr_t) f | (uintptr_t) stride)) & 3L) == 0L) { + /* Aligned. + */ + for (i = DST_START ; i < n ; i++, f += stride) { + COPY_4UBV( t[i], f ); + } + } else { + for (i = DST_START ; i < n ; i++, f += stride) { + t[i][0] = f[0]; + t[i][1] = f[1]; + t[i][2] = f[2]; + t[i][3] = f[3]; + } + } +} + + +static void init_translate_raw(void) +{ + MEMSET( TAB(_1ui), 0, sizeof(TAB(_1ui)) ); + MEMSET( TAB(_1ub), 0, sizeof(TAB(_1ub)) ); + MEMSET( TAB(_3f), 0, sizeof(TAB(_3f)) ); + MEMSET( TAB(_4ub), 0, sizeof(TAB(_4ub)) ); + MEMSET( TAB(_4us), 0, sizeof(TAB(_4us)) ); + MEMSET( TAB(_4f), 0, sizeof(TAB(_4f)) ); + MEMSET( TAB(_4fc), 0, sizeof(TAB(_4fc)) ); + + init_trans_4_GLbyte_raw(); + init_trans_3_GLbyte_raw(); + init_trans_2_GLbyte_raw(); + init_trans_1_GLbyte_raw(); + init_trans_1_GLubyte_raw(); + init_trans_3_GLubyte_raw(); + init_trans_4_GLubyte_raw(); + init_trans_4_GLshort_raw(); + init_trans_3_GLshort_raw(); + init_trans_2_GLshort_raw(); + init_trans_1_GLshort_raw(); + init_trans_4_GLushort_raw(); + init_trans_3_GLushort_raw(); + init_trans_2_GLushort_raw(); + init_trans_1_GLushort_raw(); + init_trans_4_GLint_raw(); + init_trans_3_GLint_raw(); + init_trans_2_GLint_raw(); + init_trans_1_GLint_raw(); + init_trans_4_GLuint_raw(); + init_trans_3_GLuint_raw(); + init_trans_2_GLuint_raw(); + init_trans_1_GLuint_raw(); + init_trans_4_GLdouble_raw(); + init_trans_3_GLdouble_raw(); + init_trans_2_GLdouble_raw(); + init_trans_1_GLdouble_raw(); + init_trans_4_GLfloat_raw(); + init_trans_3_GLfloat_raw(); + init_trans_2_GLfloat_raw(); + init_trans_1_GLfloat_raw(); + + TAB(_4ub)[4][TYPE_IDX(GL_UNSIGNED_BYTE)] = trans_4_GLubyte_4ub_raw; +} + + +#undef TAB +#ifdef CLASS +#undef CLASS +#endif +#undef ARGS +#undef CHECK +#undef SRC_START +#undef DST_START +#undef NEXT_F +#undef NEXT_F2 + + + + + +void _math_init_translate( void ) +{ + init_translate_raw(); +} + + + +void _math_trans_1f(GLfloat *to, + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ) +{ + _math_trans_1f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); +} + +void _math_trans_1ui(GLuint *to, + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ) +{ + _math_trans_1ui_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); +} + +void _math_trans_1ub(GLubyte *to, + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ) +{ + _math_trans_1ub_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); +} + + +void _math_trans_4ub(GLubyte (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ) +{ + _math_trans_4ub_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); +} + +void _math_trans_4chan( GLchan (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ) +{ +#if CHAN_TYPE == GL_UNSIGNED_BYTE + _math_trans_4ub( to, ptr, stride, type, size, start, n ); +#elif CHAN_TYPE == GL_UNSIGNED_SHORT + _math_trans_4us( to, ptr, stride, type, size, start, n ); +#elif CHAN_TYPE == GL_FLOAT + _math_trans_4fc( to, ptr, stride, type, size, start, n ); +#endif +} + +void _math_trans_4us(GLushort (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ) +{ + _math_trans_4us_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); +} + +void _math_trans_4f(GLfloat (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ) +{ + _math_trans_4f_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); +} + +void _math_trans_4fc(GLfloat (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ) +{ + _math_trans_4fc_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); +} + +void _math_trans_3f(GLfloat (*to)[3], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ) +{ + _math_trans_3f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); +} diff --git a/reactos/dll/mesa32/src/math/m_translate.h b/reactos/dll/mesa32/src/math/m_translate.h new file mode 100644 index 00000000000..527c7063d63 --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_translate.h @@ -0,0 +1,106 @@ + +/* + * 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 _M_TRANSLATE_H_ +#define _M_TRANSLATE_H_ + +#include "config.h" +#include "mtypes.h" /* hack for GLchan */ + + + +extern void _math_trans_1f(GLfloat *to, + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ); + +extern void _math_trans_1ui(GLuint *to, + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ); + +extern void _math_trans_1ub(GLubyte *to, + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ); + +extern void _math_trans_4ub(GLubyte (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ); + +extern void _math_trans_4chan( GLchan (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ); + +extern void _math_trans_4us(GLushort (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ); + +extern void _math_trans_4f(GLfloat (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ); + +extern void _math_trans_4fc(GLfloat (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ); + +extern void _math_trans_3f(GLfloat (*to)[3], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ); + +extern void _math_init_translate( void ); + + +#endif diff --git a/reactos/dll/mesa32/src/math/m_vector.c b/reactos/dll/mesa32/src/math/m_vector.c new file mode 100644 index 00000000000..3ad81d468b2 --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_vector.c @@ -0,0 +1,190 @@ + +/* + * 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. + */ + +/* + * New (3.1) transformation code written by Keith Whitwell. + */ + + +#include "glheader.h" +#include "imports.h" +#include "macros.h" +#include "imports.h" + +#include "m_vector.h" + + + +/* + * Given a vector [count][4] of floats, set all the [][elt] values + * to 0 (if elt = 0, 1, 2) or 1.0 (if elt = 3). + */ +void _mesa_vector4f_clean_elem( GLvector4f *vec, GLuint count, GLuint elt ) +{ + static const GLubyte elem_bits[4] = { + VEC_DIRTY_0, + VEC_DIRTY_1, + VEC_DIRTY_2, + VEC_DIRTY_3 + }; + static const GLfloat clean[4] = { 0, 0, 0, 1 }; + const GLfloat v = clean[elt]; + GLfloat (*data)[4] = (GLfloat (*)[4])vec->start; + GLuint i; + + for (i = 0 ; i < count ; i++) + data[i][elt] = v; + + vec->flags &= ~elem_bits[elt]; +} + +static const GLubyte size_bits[5] = { + 0, + VEC_SIZE_1, + VEC_SIZE_2, + VEC_SIZE_3, + VEC_SIZE_4, +}; + + + +/* + * Initialize GLvector objects. + * Input: v - the vector object to initialize. + * flags - bitwise-OR of VEC_* flags + * storage - pointer to storage for the vector's data + */ + + +void _mesa_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] ) +{ + v->stride = 4 * sizeof(GLfloat); + v->size = 2; /* may change: 2-4 for vertices and 1-4 for texcoords */ + v->data = storage; + v->start = (GLfloat *) storage; + v->count = 0; + v->flags = size_bits[4] | flags ; +} + + + + +/* + * Initialize GLvector objects and allocate storage. + * Input: v - the vector object + * sz - unused???? + * flags - bitwise-OR of VEC_* flags + * count - number of elements to allocate in vector + * alignment - desired memory alignment for the data (in bytes) + */ + + +void _mesa_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count, + GLuint alignment ) +{ + v->stride = 4 * sizeof(GLfloat); + v->size = 2; + v->storage = ALIGN_MALLOC( count * 4 * sizeof(GLfloat), alignment ); + v->start = (GLfloat *) v->storage; + v->data = (GLfloat (*)[4]) v->storage; + v->count = 0; + v->flags = size_bits[4] | flags | VEC_MALLOC ; +} + + + + +/* + * Vector deallocation. Free whatever memory is pointed to by the + * vector's storage field if the VEC_MALLOC flag is set. + * DO NOT free the GLvector object itself, though. + */ + + +void _mesa_vector4f_free( GLvector4f *v ) +{ + if (v->flags & VEC_MALLOC) { + ALIGN_FREE( v->storage ); + v->data = NULL; + v->start = NULL; + v->storage = NULL; + v->flags &= ~VEC_MALLOC; + } +} + + +/* + * For debugging + */ +void _mesa_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling ) +{ + GLfloat c[4] = { 0, 0, 0, 1 }; + const char *templates[5] = { + "%d:\t0, 0, 0, 1\n", + "%d:\t%f, 0, 0, 1\n", + "%d:\t%f, %f, 0, 1\n", + "%d:\t%f, %f, %f, 1\n", + "%d:\t%f, %f, %f, %f\n" + }; + + const char *t = templates[v->size]; + GLfloat *d = (GLfloat *)v->data; + GLuint j, i = 0, count; + + _mesa_printf("data-start\n"); + for ( ; d != v->start ; STRIDE_F(d, v->stride), i++) + _mesa_printf(t, i, d[0], d[1], d[2], d[3]); + + _mesa_printf("start-count(%u)\n", v->count); + count = i + v->count; + + if (culling) { + for ( ; i < count ; STRIDE_F(d, v->stride), i++) + if (cullmask[i]) + _mesa_printf(t, i, d[0], d[1], d[2], d[3]); + } + else { + for ( ; i < count ; STRIDE_F(d, v->stride), i++) + _mesa_printf(t, i, d[0], d[1], d[2], d[3]); + } + + for (j = v->size ; j < 4; j++) { + if ((v->flags & (1<data ; + i < count && d[j] == c[j] ; + i++, STRIDE_F(d, v->stride)) {}; + + if (i == count) + _mesa_printf(" --> ok\n"); + else + _mesa_printf(" --> Failed at %u ******\n", i); + } + } +} + + diff --git a/reactos/dll/mesa32/src/math/m_vector.h b/reactos/dll/mesa32/src/math/m_vector.h new file mode 100644 index 00000000000..222b47f6e19 --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_vector.h @@ -0,0 +1,95 @@ + +/* + * 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. + */ + +/* + * New (3.1) transformation code written by Keith Whitwell. + */ + + +#ifndef _M_VECTOR_H_ +#define _M_VECTOR_H_ + +#include "glheader.h" +#include "mtypes.h" /* hack for GLchan */ + + +#define VEC_DIRTY_0 0x1 +#define VEC_DIRTY_1 0x2 +#define VEC_DIRTY_2 0x4 +#define VEC_DIRTY_3 0x8 +#define VEC_MALLOC 0x10 /* storage field points to self-allocated mem*/ +#define VEC_NOT_WRITEABLE 0x40 /* writable elements to hold clipped data */ +#define VEC_BAD_STRIDE 0x100 /* matches tnl's prefered stride */ + + +#define VEC_SIZE_1 VEC_DIRTY_0 +#define VEC_SIZE_2 (VEC_DIRTY_0|VEC_DIRTY_1) +#define VEC_SIZE_3 (VEC_DIRTY_0|VEC_DIRTY_1|VEC_DIRTY_2) +#define VEC_SIZE_4 (VEC_DIRTY_0|VEC_DIRTY_1|VEC_DIRTY_2|VEC_DIRTY_3) + + + +/* Wrap all the information about vectors up in a struct. Has + * additional fields compared to the other vectors to help us track of + * different vertex sizes, and whether we need to clean columns out + * because they contain non-(0,0,0,1) values. + * + * The start field is used to reserve data for copied vertices at the + * end of _mesa_transform_vb, and avoids the need for a multiplication in + * the transformation routines. + */ +typedef struct { + GLfloat (*data)[4]; /* may be malloc'd or point to client data */ + GLfloat *start; /* points somewhere inside of */ + GLuint count; /* size of the vector (in elements) */ + GLuint stride; /* stride from one element to the next (in bytes) */ + GLuint size; /* 2-4 for vertices and 1-4 for texcoords */ + GLuint flags; /* which columns are dirty */ + void *storage; /* self-allocated storage */ +} GLvector4f; + + +extern void _mesa_vector4f_init( GLvector4f *v, GLuint flags, + GLfloat (*storage)[4] ); +extern void _mesa_vector4f_alloc( GLvector4f *v, GLuint flags, + GLuint count, GLuint alignment ); +extern void _mesa_vector4f_free( GLvector4f *v ); +extern void _mesa_vector4f_print( GLvector4f *v, GLubyte *, GLboolean ); +extern void _mesa_vector4f_clean_elem( GLvector4f *vec, GLuint nr, GLuint elt ); + + + + + +/* + * Given vector , return a pointer (cast to to the -th element. + * + * End up doing a lot of slow imuls if not careful. + */ +#define VEC_ELT( v, type, i ) \ + ( (type *) ( ((GLbyte *) ((v)->data)) + (i) * (v)->stride) ) + + +#endif diff --git a/reactos/dll/mesa32/src/math/m_xform.c b/reactos/dll/mesa32/src/math/m_xform.c new file mode 100644 index 00000000000..5366e34989c --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_xform.c @@ -0,0 +1,230 @@ +/* + * 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. + */ + + +/* + * Matrix/vertex/vector transformation stuff + * + * + * NOTES: + * 1. 4x4 transformation matrices are stored in memory in column major order. + * 2. Points/vertices are to be thought of as column vectors. + * 3. Transformation of a point p by a matrix M is: p' = M * p + */ + +#include "glheader.h" +#include "macros.h" + +#include "m_eval.h" +#include "m_matrix.h" +#include "m_translate.h" +#include "m_xform.h" +#include "mathmod.h" + + +#ifdef DEBUG +#include "m_debug.h" +#endif + +#ifdef USE_X86_ASM +#include "x86/common_x86_asm.h" +#endif + +#ifdef USE_X86_64_ASM +#include "x86-64/x86-64.h" +#endif + +#ifdef USE_SPARC_ASM +#include "sparc/sparc.h" +#endif + +#ifdef USE_PPC_ASM +#include "ppc/common_ppc_features.h" +#endif + +clip_func _mesa_clip_tab[5]; +clip_func _mesa_clip_np_tab[5]; +dotprod_func _mesa_dotprod_tab[5]; +vec_copy_func _mesa_copy_tab[0x10]; +normal_func _mesa_normal_tab[0xf]; +transform_func *_mesa_transform_tab[5]; + + +/* Raw data format used for: + * - Object-to-eye transform prior to culling, although this too + * could be culled under some circumstances. + * - Eye-to-clip transform (via the function above). + * - Cliptesting + * - And everything else too, if culling happens to be disabled. + * + * GH: It's used for everything now, as clipping/culling is done + * elsewhere (most often by the driver itself). + */ +#define TAG(x) x +#define TAG2(x,y) x##y +#define STRIDE_LOOP for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) +#define LOOP for ( i = 0 ; i < n ; i++ ) +#define ARGS +#include "m_xform_tmp.h" +#include "m_clip_tmp.h" +#include "m_norm_tmp.h" +#include "m_dotprod_tmp.h" +#include "m_copy_tmp.h" +#undef TAG +#undef TAG2 +#undef LOOP +#undef ARGS + + + + +GLvector4f *_mesa_project_points( GLvector4f *proj_vec, + const GLvector4f *clip_vec ) +{ + const GLuint stride = clip_vec->stride; + const GLfloat *from = (GLfloat *)clip_vec->start; + const GLuint count = clip_vec->count; + GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start; + GLuint i; + + for (i = 0 ; i < count ; i++, STRIDE_F(from, stride)) + { + GLfloat oow = 1.0F / from[3]; + vProj[i][3] = oow; + vProj[i][0] = from[0] * oow; + vProj[i][1] = from[1] * oow; + vProj[i][2] = from[2] * oow; + } + + proj_vec->flags |= VEC_SIZE_4; + proj_vec->size = 3; + proj_vec->count = clip_vec->count; + return proj_vec; +} + + + + + + +/* + * Transform a 4-element row vector (1x4 matrix) by a 4x4 matrix. This + * function is used for transforming clipping plane equations and spotlight + * directions. + * Mathematically, u = v * m. + * Input: v - input vector + * m - transformation matrix + * Output: u - transformed vector + */ +void _mesa_transform_vector( GLfloat u[4], const GLfloat v[4], const GLfloat m[16] ) +{ + GLfloat v0=v[0], v1=v[1], v2=v[2], v3=v[3]; +#define M(row,col) m[row + col*4] + u[0] = v0 * M(0,0) + v1 * M(1,0) + v2 * M(2,0) + v3 * M(3,0); + u[1] = v0 * M(0,1) + v1 * M(1,1) + v2 * M(2,1) + v3 * M(3,1); + u[2] = v0 * M(0,2) + v1 * M(1,2) + v2 * M(2,2) + v3 * M(3,2); + u[3] = v0 * M(0,3) + v1 * M(1,3) + v2 * M(2,3) + v3 * M(3,3); +#undef M +} + + +/* Useful for one-off point transformations, as in clipping. + * Note that because the matrix isn't analysed we do too many + * multiplies, and that the result is always 4-clean. + */ +void _mesa_transform_point_sz( GLfloat Q[4], const GLfloat M[16], + const GLfloat P[4], GLuint sz ) +{ + if (Q == P) + return; + + if (sz == 4) + { + Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12] * P[3]; + Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13] * P[3]; + Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14] * P[3]; + Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15] * P[3]; + } + else if (sz == 3) + { + Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12]; + Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13]; + Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14]; + Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15]; + } + else if (sz == 2) + { + Q[0] = M[0] * P[0] + M[4] * P[1] + M[12]; + Q[1] = M[1] * P[0] + M[5] * P[1] + M[13]; + Q[2] = M[2] * P[0] + M[6] * P[1] + M[14]; + Q[3] = M[3] * P[0] + M[7] * P[1] + M[15]; + } + else if (sz == 1) + { + Q[0] = M[0] * P[0] + M[12]; + Q[1] = M[1] * P[0] + M[13]; + Q[2] = M[2] * P[0] + M[14]; + Q[3] = M[3] * P[0] + M[15]; + } +} + + +/* + * This is called only once. It initializes several tables with pointers + * to optimized transformation functions. This is where we can test for + * AMD 3Dnow! capability, Intel SSE, etc. and hook in the right code. + */ +void +_math_init_transformation( void ) +{ + init_c_transformations(); + init_c_norm_transform(); + init_c_cliptest(); + init_copy0(); + init_dotprod(); + +#ifdef DEBUG + _math_test_all_transform_functions( "default" ); + _math_test_all_normal_transform_functions( "default" ); + _math_test_all_cliptest_functions( "default" ); +#endif + +#ifdef USE_X86_ASM + _mesa_init_all_x86_transform_asm(); +#elif defined( USE_SPARC_ASM ) + _mesa_init_all_sparc_transform_asm(); +#elif defined( USE_PPC_ASM ) + _mesa_init_all_ppc_transform_asm(); +#elif defined( USE_X86_64_ASM ) + _mesa_init_all_x86_64_transform_asm(); +#endif +} + +void +_math_init( void ) +{ + _math_init_transformation(); + _math_init_translate(); + _math_init_eval(); +} diff --git a/reactos/dll/mesa32/src/math/m_xform.h b/reactos/dll/mesa32/src/math/m_xform.h new file mode 100644 index 00000000000..63f1062fc85 --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_xform.h @@ -0,0 +1,185 @@ +/* + * 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 _M_XFORM_H +#define _M_XFORM_H + + +#include "glheader.h" +#include "config.h" +#include "math/m_vector.h" +#include "math/m_matrix.h" + +#ifdef USE_X86_ASM +#define _XFORMAPI _ASMAPI +#define _XFORMAPIP _ASMAPIP +#else +#define _XFORMAPI +#define _XFORMAPIP * +#endif + + +extern void +_mesa_transform_vector(GLfloat u[4], CONST GLfloat v[4], CONST GLfloat m[16]); + + +extern void +_math_init_transformation(void); + + +/* KW: Clip functions now do projective divide as well. The projected + * coordinates are very useful to us because they let us cull + * backfaces and eliminate vertices from lighting, fogging, etc + * calculations. Despite the fact that this divide could be done one + * day in hardware, we would still have a reason to want to do it here + * as long as those other calculations remain in software. + * + * Clipping is a convenient place to do the divide on x86 as it should be + * possible to overlap with integer outcode calculations. + * + * There are two cases where we wouldn't want to do the divide in cliptest: + * - When we aren't clipping. We still might want to cull backfaces + * so the divide should be done elsewhere. This currently never + * happens. + * + * - When culling isn't likely to help us, such as when the GL culling + * is disabled and we not lighting or are only lighting + * one-sided. In this situation, backface determination provides + * us with no useful information. A tricky case to detect is when + * all input data is already culled, although hopefully the + * application wouldn't turn on culling in such cases. + * + * We supply a buffer to hold the [x/w,y/w,z/w,1/w] values which + * are the result of the projection. This is only used in the + * 4-vector case - in other cases, we just use the clip coordinates + * as the projected coordinates - they are identical. + * + * This is doubly convenient because it means the Win[] array is now + * of the same stride as all the others, so I can now turn map_vertices + * into a straight-forward matrix transformation, with asm acceleration + * automatically available. + */ + +/* Vertex buffer clipping flags + */ +#define CLIP_RIGHT_SHIFT 0 +#define CLIP_LEFT_SHIFT 1 +#define CLIP_TOP_SHIFT 2 +#define CLIP_BOTTOM_SHIFT 3 +#define CLIP_NEAR_SHIFT 4 +#define CLIP_FAR_SHIFT 5 + +#define CLIP_RIGHT_BIT 0x01 +#define CLIP_LEFT_BIT 0x02 +#define CLIP_TOP_BIT 0x04 +#define CLIP_BOTTOM_BIT 0x08 +#define CLIP_NEAR_BIT 0x10 +#define CLIP_FAR_BIT 0x20 +#define CLIP_USER_BIT 0x40 +#define CLIP_CULL_BIT 0x80 +#define CLIP_ALL_BITS 0x3f + + +typedef GLvector4f * (_XFORMAPIP clip_func)( GLvector4f *vClip, + GLvector4f *vProj, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ); + +typedef void (*dotprod_func)( GLfloat *out, + GLuint out_stride, + CONST GLvector4f *coord_vec, + CONST GLfloat plane[4] ); + +typedef void (*vec_copy_func)( GLvector4f *to, + CONST GLvector4f *from ); + + + +/* + * Functions for transformation of normals in the VB. + */ +typedef void (_NORMAPIP normal_func)( CONST GLmatrix *mat, + GLfloat scale, + CONST GLvector4f *in, + CONST GLfloat lengths[], + GLvector4f *dest ); + + +/* Flags for selecting a normal transformation function. + */ +#define NORM_RESCALE 0x1 /* apply the scale factor */ +#define NORM_NORMALIZE 0x2 /* normalize */ +#define NORM_TRANSFORM 0x4 /* apply the transformation matrix */ +#define NORM_TRANSFORM_NO_ROT 0x8 /* apply the transformation matrix */ + + + + +/* KW: New versions of the transform function allow a mask array + * specifying that individual vector transform should be skipped + * when the mask byte is zero. This is always present as a + * parameter, to allow a unified interface. + */ +typedef void (_XFORMAPIP transform_func)( GLvector4f *to_vec, + CONST GLfloat m[16], + CONST GLvector4f *from_vec ); + + +extern GLvector4f *_mesa_project_points( GLvector4f *to, + CONST GLvector4f *from ); + +extern void _mesa_transform_bounds3( GLubyte *orMask, GLubyte *andMask, + CONST GLfloat m[16], + CONST GLfloat src[][3] ); + +extern void _mesa_transform_bounds2( GLubyte *orMask, GLubyte *andMask, + CONST GLfloat m[16], + CONST GLfloat src[][3] ); + + +extern dotprod_func _mesa_dotprod_tab[5]; +extern vec_copy_func _mesa_copy_tab[0x10]; +extern vec_copy_func _mesa_copy_clean_tab[5]; +extern clip_func _mesa_clip_tab[5]; +extern clip_func _mesa_clip_np_tab[5]; +extern normal_func _mesa_normal_tab[0xf]; + +/* Use of 2 layers of linked 1-dimensional arrays to reduce + * cost of lookup. + */ +extern transform_func *_mesa_transform_tab[5]; + + +extern void _mesa_transform_point_sz( GLfloat Q[4], CONST GLfloat M[16], + CONST GLfloat P[4], GLuint sz ); + + +#define TransformRaw( to, mat, from ) \ + ( _mesa_transform_tab[(from)->size][(mat)->type]( to, (mat)->m, from ), \ + (to) ) + + +#endif diff --git a/reactos/dll/mesa32/src/math/m_xform_tmp.h b/reactos/dll/mesa32/src/math/m_xform_tmp.h new file mode 100644 index 00000000000..e9383772562 --- /dev/null +++ b/reactos/dll/mesa32/src/math/m_xform_tmp.h @@ -0,0 +1,810 @@ + +/* + * 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. + */ + +/* + * New (3.1) transformation code written by Keith Whitwell. + */ + + +/*---------------------------------------------------------------------- + * Begin Keith's new code + * + *---------------------------------------------------------------------- + */ + +/* KW: Fixed stride, now measured in bytes as is the OpenGL array stride. + */ + +/* KW: These are now parameterized to produce two versions, one + * which transforms all incoming points, and a second which + * takes notice of a cullmask array, and only transforms + * unculled vertices. + */ + +/* KW: 1-vectors can sneak into the texture pipeline via the array + * interface. These functions are here because I want consistant + * treatment of the vertex sizes and a lazy strategy for + * cleaning unused parts of the vector, and so as not to exclude + * them from the vertex array interface. + * + * Under our current analysis of matrices, there is no way that + * the product of a matrix and a 1-vector can remain a 1-vector, + * with the exception of the identity transform. + */ + +/* KW: No longer zero-pad outgoing vectors. Now that external + * vectors can get into the pipeline we cannot ever assume + * that there is more to a vector than indicated by its + * size. + */ + +/* KW: Now uses clipmask and a flag to allow us to skip both/either + * cliped and/or culled vertices. + */ + +/* GH: Not any more -- it's easier (and faster) to just process the + * entire vector. Clipping and culling are handled further down + * the pipe, most often during or after the conversion to some + * driver-specific vertex format. + */ + +static void _XFORMAPI +TAG(transform_points1_general)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m12 = m[12]; + const GLfloat m1 = m[1], m13 = m[13]; + const GLfloat m2 = m[2], m14 = m[14]; + const GLfloat m3 = m[3], m15 = m[15]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0]; + to[i][0] = m0 * ox + m12; + to[i][1] = m1 * ox + m13; + to[i][2] = m2 * ox + m14; + to[i][3] = m3 * ox + m15; + } + to_vec->size = 4; + to_vec->flags |= VEC_SIZE_4; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points1_identity)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLuint count = from_vec->count; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint i; + (void) m; + if (to_vec == from_vec) return; + STRIDE_LOOP { + to[i][0] = from[0]; + } + to_vec->size = 1; + to_vec->flags |= VEC_SIZE_1; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points1_2d)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m1 = m[1]; + const GLfloat m12 = m[12], m13 = m[13]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0]; + to[i][0] = m0 * ox + m12; + to[i][1] = m1 * ox + m13; + } + to_vec->size = 2; + to_vec->flags |= VEC_SIZE_2; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m12 = m[12], m13 = m[13]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0]; + to[i][0] = m0 * ox + m12; + to[i][1] = m13; + } + to_vec->size = 2; + to_vec->flags |= VEC_SIZE_2; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points1_3d)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m1 = m[1], m2 = m[2]; + const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0]; + to[i][0] = m0 * ox + m12; + to[i][1] = m1 * ox + m13; + to[i][2] = m2 * ox + m14; + } + to_vec->size = 3; + to_vec->flags |= VEC_SIZE_3; + to_vec->count = from_vec->count; +} + + +static void _XFORMAPI +TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0]; + const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0]; + to[i][0] = m0 * ox + m12; + to[i][1] = m13; + to[i][2] = m14; + } + to_vec->size = 3; + to_vec->flags |= VEC_SIZE_3; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points1_perspective)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m14 = m[14]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0]; + to[i][0] = m0 * ox ; + to[i][1] = 0 ; + to[i][2] = m14; + to[i][3] = 0; + } + to_vec->size = 4; + to_vec->flags |= VEC_SIZE_4; + to_vec->count = from_vec->count; +} + + + + +/* 2-vectors, which are a lot more relevant than 1-vectors, are + * present early in the geometry pipeline and throughout the + * texture pipeline. + */ +static void _XFORMAPI +TAG(transform_points2_general)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m4 = m[4], m12 = m[12]; + const GLfloat m1 = m[1], m5 = m[5], m13 = m[13]; + const GLfloat m2 = m[2], m6 = m[6], m14 = m[14]; + const GLfloat m3 = m[3], m7 = m[7], m15 = m[15]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1]; + to[i][0] = m0 * ox + m4 * oy + m12; + to[i][1] = m1 * ox + m5 * oy + m13; + to[i][2] = m2 * ox + m6 * oy + m14; + to[i][3] = m3 * ox + m7 * oy + m15; + } + to_vec->size = 4; + to_vec->flags |= VEC_SIZE_4; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points2_identity)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + GLuint i; + (void) m; + if (to_vec == from_vec) return; + STRIDE_LOOP { + to[i][0] = from[0]; + to[i][1] = from[1]; + } + to_vec->size = 2; + to_vec->flags |= VEC_SIZE_2; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points2_2d)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5]; + const GLfloat m12 = m[12], m13 = m[13]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1]; + to[i][0] = m0 * ox + m4 * oy + m12; + to[i][1] = m1 * ox + m5 * oy + m13; + } + to_vec->size = 2; + to_vec->flags |= VEC_SIZE_2; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1]; + to[i][0] = m0 * ox + m12; + to[i][1] = m5 * oy + m13; + } + to_vec->size = 2; + to_vec->flags |= VEC_SIZE_2; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points2_3d)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5]; + const GLfloat m6 = m[6], m12 = m[12], m13 = m[13], m14 = m[14]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1]; + to[i][0] = m0 * ox + m4 * oy + m12; + to[i][1] = m1 * ox + m5 * oy + m13; + to[i][2] = m2 * ox + m6 * oy + m14; + } + to_vec->size = 3; + to_vec->flags |= VEC_SIZE_3; + to_vec->count = from_vec->count; +} + + +/* I would actually say this was a fairly important function, from + * a texture transformation point of view. + */ +static void _XFORMAPI +TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m5 = m[5]; + const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1]; + to[i][0] = m0 * ox + m12; + to[i][1] = m5 * oy + m13; + to[i][2] = m14; + } + if (m14 == 0) { + to_vec->size = 2; + to_vec->flags |= VEC_SIZE_2; + } else { + to_vec->size = 3; + to_vec->flags |= VEC_SIZE_3; + } + to_vec->count = from_vec->count; +} + + +static void _XFORMAPI +TAG(transform_points2_perspective)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m5 = m[5], m14 = m[14]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1]; + to[i][0] = m0 * ox ; + to[i][1] = m5 * oy ; + to[i][2] = m14; + to[i][3] = 0; + } + to_vec->size = 4; + to_vec->flags |= VEC_SIZE_4; + to_vec->count = from_vec->count; +} + + + +static void _XFORMAPI +TAG(transform_points3_general)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m4 = m[4], m8 = m[8], m12 = m[12]; + const GLfloat m1 = m[1], m5 = m[5], m9 = m[9], m13 = m[13]; + const GLfloat m2 = m[2], m6 = m[6], m10 = m[10], m14 = m[14]; + const GLfloat m3 = m[3], m7 = m[7], m11 = m[11], m15 = m[15]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1], oz = from[2]; + to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12; + to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13; + to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14; + to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15; + } + to_vec->size = 4; + to_vec->flags |= VEC_SIZE_4; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points3_identity)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + GLuint i; + (void) m; + if (to_vec == from_vec) return; + STRIDE_LOOP { + to[i][0] = from[0]; + to[i][1] = from[1]; + to[i][2] = from[2]; + } + to_vec->size = 3; + to_vec->flags |= VEC_SIZE_3; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points3_2d)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5]; + const GLfloat m12 = m[12], m13 = m[13]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1], oz = from[2]; + to[i][0] = m0 * ox + m4 * oy + m12 ; + to[i][1] = m1 * ox + m5 * oy + m13 ; + to[i][2] = + oz ; + } + to_vec->size = 3; + to_vec->flags |= VEC_SIZE_3; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1], oz = from[2]; + to[i][0] = m0 * ox + m12 ; + to[i][1] = m5 * oy + m13 ; + to[i][2] = + oz ; + } + to_vec->size = 3; + to_vec->flags |= VEC_SIZE_3; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points3_3d)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5]; + const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10]; + const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1], oz = from[2]; + to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 ; + to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 ; + to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 ; + } + to_vec->size = 3; + to_vec->flags |= VEC_SIZE_3; + to_vec->count = from_vec->count; +} + +/* previously known as ortho... + */ +static void _XFORMAPI +TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m5 = m[5]; + const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1], oz = from[2]; + to[i][0] = m0 * ox + m12 ; + to[i][1] = m5 * oy + m13 ; + to[i][2] = m10 * oz + m14 ; + } + to_vec->size = 3; + to_vec->flags |= VEC_SIZE_3; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points3_perspective)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9]; + const GLfloat m10 = m[10], m14 = m[14]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1], oz = from[2]; + to[i][0] = m0 * ox + m8 * oz ; + to[i][1] = m5 * oy + m9 * oz ; + to[i][2] = m10 * oz + m14 ; + to[i][3] = -oz ; + } + to_vec->size = 4; + to_vec->flags |= VEC_SIZE_4; + to_vec->count = from_vec->count; +} + + + +static void _XFORMAPI +TAG(transform_points4_general)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m4 = m[4], m8 = m[8], m12 = m[12]; + const GLfloat m1 = m[1], m5 = m[5], m9 = m[9], m13 = m[13]; + const GLfloat m2 = m[2], m6 = m[6], m10 = m[10], m14 = m[14]; + const GLfloat m3 = m[3], m7 = m[7], m11 = m[11], m15 = m[15]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; + to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 * ow; + to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 * ow; + to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow; + to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15 * ow; + } + to_vec->size = 4; + to_vec->flags |= VEC_SIZE_4; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points4_identity)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + GLuint i; + (void) m; + if (to_vec == from_vec) return; + STRIDE_LOOP { + to[i][0] = from[0]; + to[i][1] = from[1]; + to[i][2] = from[2]; + to[i][3] = from[3]; + } + to_vec->size = 4; + to_vec->flags |= VEC_SIZE_4; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points4_2d)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5]; + const GLfloat m12 = m[12], m13 = m[13]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; + to[i][0] = m0 * ox + m4 * oy + m12 * ow; + to[i][1] = m1 * ox + m5 * oy + m13 * ow; + to[i][2] = + oz ; + to[i][3] = ow; + } + to_vec->size = 4; + to_vec->flags |= VEC_SIZE_4; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; + to[i][0] = m0 * ox + m12 * ow; + to[i][1] = m5 * oy + m13 * ow; + to[i][2] = + oz ; + to[i][3] = ow; + } + to_vec->size = 4; + to_vec->flags |= VEC_SIZE_4; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points4_3d)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5]; + const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10]; + const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; + to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 * ow; + to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 * ow; + to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow; + to[i][3] = ow; + } + to_vec->size = 4; + to_vec->flags |= VEC_SIZE_4; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m5 = m[5]; + const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; + to[i][0] = m0 * ox + m12 * ow; + to[i][1] = m5 * oy + m13 * ow; + to[i][2] = m10 * oz + m14 * ow; + to[i][3] = ow; + } + to_vec->size = 4; + to_vec->flags |= VEC_SIZE_4; + to_vec->count = from_vec->count; +} + +static void _XFORMAPI +TAG(transform_points4_perspective)( GLvector4f *to_vec, + const GLfloat m[16], + const GLvector4f *from_vec ) +{ + const GLuint stride = from_vec->stride; + GLfloat *from = from_vec->start; + GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; + GLuint count = from_vec->count; + const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9]; + const GLfloat m10 = m[10], m14 = m[14]; + GLuint i; + STRIDE_LOOP { + const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; + to[i][0] = m0 * ox + m8 * oz ; + to[i][1] = m5 * oy + m9 * oz ; + to[i][2] = m10 * oz + m14 * ow ; + to[i][3] = -oz ; + } + to_vec->size = 4; + to_vec->flags |= VEC_SIZE_4; + to_vec->count = from_vec->count; +} + +static transform_func TAG(transform_tab_1)[7]; +static transform_func TAG(transform_tab_2)[7]; +static transform_func TAG(transform_tab_3)[7]; +static transform_func TAG(transform_tab_4)[7]; + +/* Similar functions could be called several times, with more highly + * optimized routines overwriting the arrays. This only occurs during + * startup. + */ +static void _XFORMAPI TAG(init_c_transformations)( void ) +{ +#define TAG_TAB _mesa_transform_tab +#define TAG_TAB_1 TAG(transform_tab_1) +#define TAG_TAB_2 TAG(transform_tab_2) +#define TAG_TAB_3 TAG(transform_tab_3) +#define TAG_TAB_4 TAG(transform_tab_4) + + TAG_TAB[1] = TAG_TAB_1; + TAG_TAB[2] = TAG_TAB_2; + TAG_TAB[3] = TAG_TAB_3; + TAG_TAB[4] = TAG_TAB_4; + + /* 1-D points (ie texcoords) */ + TAG_TAB_1[MATRIX_GENERAL] = TAG(transform_points1_general); + TAG_TAB_1[MATRIX_IDENTITY] = TAG(transform_points1_identity); + TAG_TAB_1[MATRIX_3D_NO_ROT] = TAG(transform_points1_3d_no_rot); + TAG_TAB_1[MATRIX_PERSPECTIVE] = TAG(transform_points1_perspective); + TAG_TAB_1[MATRIX_2D] = TAG(transform_points1_2d); + TAG_TAB_1[MATRIX_2D_NO_ROT] = TAG(transform_points1_2d_no_rot); + TAG_TAB_1[MATRIX_3D] = TAG(transform_points1_3d); + + /* 2-D points */ + TAG_TAB_2[MATRIX_GENERAL] = TAG(transform_points2_general); + TAG_TAB_2[MATRIX_IDENTITY] = TAG(transform_points2_identity); + TAG_TAB_2[MATRIX_3D_NO_ROT] = TAG(transform_points2_3d_no_rot); + TAG_TAB_2[MATRIX_PERSPECTIVE] = TAG(transform_points2_perspective); + TAG_TAB_2[MATRIX_2D] = TAG(transform_points2_2d); + TAG_TAB_2[MATRIX_2D_NO_ROT] = TAG(transform_points2_2d_no_rot); + TAG_TAB_2[MATRIX_3D] = TAG(transform_points2_3d); + + /* 3-D points */ + TAG_TAB_3[MATRIX_GENERAL] = TAG(transform_points3_general); + TAG_TAB_3[MATRIX_IDENTITY] = TAG(transform_points3_identity); + TAG_TAB_3[MATRIX_3D_NO_ROT] = TAG(transform_points3_3d_no_rot); + TAG_TAB_3[MATRIX_PERSPECTIVE] = TAG(transform_points3_perspective); + TAG_TAB_3[MATRIX_2D] = TAG(transform_points3_2d); + TAG_TAB_3[MATRIX_2D_NO_ROT] = TAG(transform_points3_2d_no_rot); + TAG_TAB_3[MATRIX_3D] = TAG(transform_points3_3d); + + /* 4-D points */ + TAG_TAB_4[MATRIX_GENERAL] = TAG(transform_points4_general); + TAG_TAB_4[MATRIX_IDENTITY] = TAG(transform_points4_identity); + TAG_TAB_4[MATRIX_3D_NO_ROT] = TAG(transform_points4_3d_no_rot); + TAG_TAB_4[MATRIX_PERSPECTIVE] = TAG(transform_points4_perspective); + TAG_TAB_4[MATRIX_2D] = TAG(transform_points4_2d); + TAG_TAB_4[MATRIX_2D_NO_ROT] = TAG(transform_points4_2d_no_rot); + TAG_TAB_4[MATRIX_3D] = TAG(transform_points4_3d); + +#undef TAG_TAB +#undef TAG_TAB_1 +#undef TAG_TAB_2 +#undef TAG_TAB_3 +#undef TAG_TAB_4 +} diff --git a/reactos/dll/mesa32/src/math/mathmod.h b/reactos/dll/mesa32/src/math/mathmod.h new file mode 100644 index 00000000000..6fbaaea94bc --- /dev/null +++ b/reactos/dll/mesa32/src/math/mathmod.h @@ -0,0 +1,41 @@ + +/* + * 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. + */ + + +/** + * \mainpage Mesa Math Module + * + * This module contains math-related utility functions for transforming + * vertices, translating arrays of numbers from one data type to another, + * evaluating curved surfaces, etc. + */ + + +#ifndef _MESA_MATH_H_ +#define _MESA_MATH_H_ + +extern void _math_init( void ); + +#endif diff --git a/reactos/dll/mesa32/src/ppc/common_ppc.c b/reactos/dll/mesa32/src/ppc/common_ppc.c new file mode 100644 index 00000000000..13526df78c9 --- /dev/null +++ b/reactos/dll/mesa32/src/ppc/common_ppc.c @@ -0,0 +1,88 @@ +/* + * (C) Copyright IBM Corporation 2004 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * 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 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. + */ + +/** + * \file common_ppc.c + * Check CPU capabilities & initialize optimized funtions for this particular + * processor. + * + * \author Ian Romanick + */ + +#include +#include +#include + +#ifdef USE_PPC_ASM +#include +#endif + +unsigned long _mesa_ppc_cpu_features = 0; + +/** + * Detect CPU features and install optimized transform and lighting routines. + * Currently, CPU features are only detected. The optimized routines have + * yet to be written. + * + * \bug + * This routine is highly specific to Linux kernel 2.6. I'm still waiting + * to hear back from the glibc folk on how to do this "right". + */ + +void _mesa_init_all_ppc_transform_asm( void ) +{ +#ifdef USE_PPC_ASM + const pid_t my_pid = getpid(); + char file_name[32]; + FILE * f; +#ifdef __powerpc64__ + Elf64_auxv_t v; +#else + Elf32_auxv_t v; +#endif + + sprintf( file_name, "/proc/%u/auxv", (unsigned) my_pid ); + f = fopen( file_name, "rb" ); + if ( f != NULL ) { + while( 1 ) { + ssize_t elem = fread( & v, sizeof( v ), 1, f ); + + if ( elem < 1 ) { + break; + } + + if ( v.a_type == AT_HWCAP ) { + _mesa_ppc_cpu_features = v.a_un.a_val; + break; + } + } + + fclose( f ); + } + +# ifndef USE_VMX_ASM + _mesa_ppc_cpu_features &= ~PPC_FEATURES_HAS_ALTIVEC; +# endif +#endif +} diff --git a/reactos/dll/mesa32/src/ppc/common_ppc_features.h b/reactos/dll/mesa32/src/ppc/common_ppc_features.h new file mode 100644 index 00000000000..4d46ca04c9d --- /dev/null +++ b/reactos/dll/mesa32/src/ppc/common_ppc_features.h @@ -0,0 +1,51 @@ +/* + * (C) Copyright IBM Corporation 2004 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * 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 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. + */ + +/** + * \file common_ppc_features.h + * Interface for determining which CPU features were detected. + * + * \author Ian Romanick + */ + +#ifndef COMMON_PPC_FEATURES_H +#define COMMON_PPC_FEATURES_H + +#ifdef USE_PPC_ASM +#include + +extern unsigned long _mesa_ppc_cpu_features; + + +/* The PPC_FEATURE_* values come from asm/cputable.h. Should we define + * versions of them here if that file does not exist? This will only + * matter once these code paths are supported on non-Linux platforms. + */ + +#define cpu_has_64 ((_mesa_ppc_cpu_features & PPC_FEATURE_64) != 0) +#define cpu_has_vmx ((_mesa_ppc_cpu_features & PPC_FEATURE_HAS_ALTIVEC) != 0) +#define cpu_has_fpu ((_mesa_ppc_cpu_features & PPC_FEATURE_HAS_FPU) != 0) + +#endif /* USE_PPC_ASM */ +#endif /* COMMON_PPC_FEATURES_H */ diff --git a/reactos/dll/mesa32/src/shader/arbfragparse.c b/reactos/dll/mesa32/src/shader/arbfragparse.c new file mode 100644 index 00000000000..725ae545803 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/arbfragparse.c @@ -0,0 +1,229 @@ +/* + * Mesa 3-D graphics library + * Version: 6.2 + * + * 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. + */ + +#define DEBUG_FP 0 + +/** + * \file arbfragparse.c + * ARB_fragment_program parser. + * \author Karl Rasche + */ + +#include "glheader.h" +#include "context.h" +#include "imports.h" +#include "macros.h" +#include "mtypes.h" +#include "program.h" +#include "arbprogparse.h" +#include "arbfragparse.h" + +void +_mesa_debug_fp_inst(GLint num, struct fp_instruction *fp) +{ + GLint a; + + static const char *opcode_string[] = { + "ABS", /* ARB_f_p only */ + "ADD", + "CMP", /* ARB_f_p only */ + "COS", + "DDX", /* NV_f_p only */ + "DDY", /* NV_f_p only */ + "DP3", + "DP4", + "DPH", /* ARB_f_p only */ + "DST", + "END", /* private opcode */ + "EX2", + "FLR", + "FRC", + "KIL", /* ARB_f_p only */ + "KIL_NV", /* NV_f_p only */ + "LG2", + "LIT", + "LRP", + "MAD", + "MAX", + "MIN", + "MOV", + "MUL", + "PK2H", /* NV_f_p only */ + "PK2US", /* NV_f_p only */ + "PK4B", /* NV_f_p only */ + "PK4UB", /* NV_f_p only */ + "POW", + "PRINT", /* Mesa only */ + "RCP", + "RFL", /* NV_f_p only */ + "RSQ", + "SCS", /* ARB_f_p only */ + "SEQ", /* NV_f_p only */ + "SFL", /* NV_f_p only */ + "SGE", /* NV_f_p only */ + "SGT", /* NV_f_p only */ + "SIN", + "SLE", /* NV_f_p only */ + "SLT", + "SNE", /* NV_f_p only */ + "STR", /* NV_f_p only */ + "SUB", + "SWZ", /* ARB_f_p only */ + "TEX", + "TXB", /* ARB_f_p only */ + "TXD", /* NV_f_p only */ + "TXP", /* ARB_f_p only */ + "TXP_NV", /* NV_f_p only */ + "UP2H", /* NV_f_p only */ + "UP2US", /* NV_f_p only */ + "UP4B", /* NV_f_p only */ + "UP4UB", /* NV_f_p only */ + "X2D", /* NV_f_p only - 2d mat mul */ + "XPD", /* ARB_f_p only - cross product */ + }; + + static const char *file_string[] = { + "TEMP", + "INPUT", + "OUTPUT", + "LOCAL", + "ENV", + "NAMED", + "STATE", + "WRITE_ONLY", + "ADDR" + }; + + static const char swz[] = "xyzw01??"; + + for (a=0; aInstructions = (struct fp_instruction *) _mesa_malloc ( + sizeof(struct fp_instruction) ); + program->Instructions[0].Opcode = FP_OPCODE_END; + return; + } + + /* copy the relvant contents of the arb_program struct into the + * fragment_program struct + */ + program->Base.String = ap.Base.String; + program->Base.NumInstructions = ap.Base.NumInstructions; + program->Base.NumTemporaries = ap.Base.NumTemporaries; + program->Base.NumParameters = ap.Base.NumParameters; + program->Base.NumAttributes = ap.Base.NumAttributes; + program->Base.NumAddressRegs = ap.Base.NumAddressRegs; + + program->InputsRead = ap.InputsRead; + program->OutputsWritten = ap.OutputsWritten; + for (a=0; aTexturesUsed[a] = ap.TexturesUsed[a]; + program->NumAluInstructions = ap.NumAluInstructions; + program->NumTexInstructions = ap.NumTexInstructions; + program->NumTexIndirections = ap.NumTexIndirections; + program->Parameters = ap.Parameters; + program->FogOption = ap.FogOption; + +#if DEBUG_FP + _mesa_debug_fp_inst(ap.Base.NumInstructions, ap.FPInstructions); +#endif + + program->Instructions = ap.FPInstructions; +} diff --git a/reactos/dll/mesa32/src/shader/arbfragparse.h b/reactos/dll/mesa32/src/shader/arbfragparse.h new file mode 100644 index 00000000000..0d3e69fa8ef --- /dev/null +++ b/reactos/dll/mesa32/src/shader/arbfragparse.h @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#ifndef ARBFRAGPARSE_H +#define ARBFRAGPARSE_H + +#include "mtypes.h" + +extern void +_mesa_parse_arb_fragment_program(GLcontext * ctx, GLenum target, + const GLubyte * str, GLsizei len, + struct fragment_program *program); + +extern void +_mesa_debug_fp_inst(GLint num, struct fp_instruction *fp); + + +#endif diff --git a/reactos/dll/mesa32/src/shader/arbprogparse.c b/reactos/dll/mesa32/src/shader/arbprogparse.c new file mode 100644 index 00000000000..e139072c303 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/arbprogparse.c @@ -0,0 +1,4130 @@ +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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. + */ + +#define DEBUG_PARSING 0 + +/** + * \file arbprogparse.c + * ARB_*_program parser core + * \author Karl Rasche + */ + +#include "mtypes.h" +#include "glheader.h" +#include "context.h" +#include "hash.h" +#include "imports.h" +#include "macros.h" +#include "program.h" +#include "nvvertprog.h" +#include "nvfragprog.h" +#include "arbprogparse.h" +#include "grammar_mesa.h" + +#include "dispatch.h" + +#ifndef __extension__ +#if !defined(__GNUC__) || (__GNUC__ < 2) || \ + ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 7)) +# define __extension__ +#endif +#endif + +/* TODO: + * Fragment Program Stuff: + * ----------------------------------------------------- + * + * - things from Michal's email + * + overflow on atoi + * + not-overflowing floats (don't use parse_integer..) + * + can remove range checking in arbparse.c + * + * - check all limits of number of various variables + * + parameters + * + * - test! test! test! + * + * Vertex Program Stuff: + * ----------------------------------------------------- + * - Optimize param array usage and count limits correctly, see spec, + * section 2.14.3.7 + * + Record if an array is reference absolutly or relatively (or both) + * + For absolute arrays, store a bitmap of accesses + * + For single parameters, store an access flag + * + After parsing, make a parameter cleanup and merging pass, where + * relative arrays are layed out first, followed by abs arrays, and + * finally single state. + * + Remap offsets for param src and dst registers + * + Now we can properly count parameter usage + * + * - Multiple state binding errors in param arrays (see spec, just before + * section 2.14.3.3) + * - grep for XXX + * + * Mesa Stuff + * ----------------------------------------------------- + * - User clipping planes vs. PositionInvariant + * - Is it sufficient to just multiply by the mvp to transform in the + * PositionInvariant case? Or do we need something more involved? + * + * - vp_src swizzle is GLubyte, fp_src swizzle is GLuint + * - fetch state listed in program_parameters list + * + WTF should this go??? + * + currently in nvvertexec.c and s_nvfragprog.c + * + * - allow for multiple address registers (and fetch address regs properly) + * + * Cosmetic Stuff + * ----------------------------------------------------- + * - remove any leftover unused grammer.c stuff (dict_ ?) + * - fix grammer.c error handling so its not static + * - #ifdef around stuff pertaining to extentions + * + * Outstanding Questions: + * ----------------------------------------------------- + * - ARB_matrix_palette / ARB_vertex_blend -- not supported + * what gets hacked off because of this: + * + VERTEX_ATTRIB_MATRIXINDEX + * + VERTEX_ATTRIB_WEIGHT + * + MATRIX_MODELVIEW + * + MATRIX_PALETTE + * + * - When can we fetch env/local params from their own register files, and + * when to we have to fetch them into the main state register file? + * (think arrays) + * + * Grammar Changes: + * ----------------------------------------------------- + */ + +/* Changes since moving the file to shader directory + +2004-III-4 ------------------------------------------------------------ +- added #include "grammar_mesa.h" +- removed grammar specific code part (it resides now in grammar.c) +- added GL_ARB_fragment_program_shadow tokens +- modified #include "arbparse_syn.h" +- major changes inside _mesa_parse_arb_program() +- check the program string for '\0' characters +- copy the program string to a one-byte-longer location to have + it null-terminated +- position invariance test (not writing to result.position) moved + to syntax part +*/ + +typedef GLubyte *production; + +/** + * This is the text describing the rules to parse the grammar + */ +__extension__ static char arb_grammar_text[] = +#include "arbprogram_syn.h" +; + +/** + * These should match up with the values defined in arbprogram.syn + */ + +/* + Changes: + - changed and merged V_* and F_* opcode values to OP_*. + - added GL_ARB_fragment_program_shadow specific tokens (michal) +*/ +#define REVISION 0x09 + +/* program type */ +#define FRAGMENT_PROGRAM 0x01 +#define VERTEX_PROGRAM 0x02 + +/* program section */ +#define OPTION 0x01 +#define INSTRUCTION 0x02 +#define DECLARATION 0x03 +#define END 0x04 + +/* GL_ARB_fragment_program option */ +#define ARB_PRECISION_HINT_FASTEST 0x00 +#define ARB_PRECISION_HINT_NICEST 0x01 +#define ARB_FOG_EXP 0x02 +#define ARB_FOG_EXP2 0x03 +#define ARB_FOG_LINEAR 0x04 + +/* GL_ARB_vertex_program option */ +#define ARB_POSITION_INVARIANT 0x05 + +/* GL_ARB_fragment_program_shadow option */ +#define ARB_FRAGMENT_PROGRAM_SHADOW 0x06 + +/* GL_ARB_draw_buffers option */ +#define ARB_DRAW_BUFFERS 0x07 + +/* GL_ARB_fragment_program instruction class */ +#define OP_ALU_INST 0x00 +#define OP_TEX_INST 0x01 + +/* GL_ARB_vertex_program instruction class */ +/* OP_ALU_INST */ + +/* GL_ARB_fragment_program instruction type */ +#define OP_ALU_VECTOR 0x00 +#define OP_ALU_SCALAR 0x01 +#define OP_ALU_BINSC 0x02 +#define OP_ALU_BIN 0x03 +#define OP_ALU_TRI 0x04 +#define OP_ALU_SWZ 0x05 +#define OP_TEX_SAMPLE 0x06 +#define OP_TEX_KIL 0x07 + +/* GL_ARB_vertex_program instruction type */ +#define OP_ALU_ARL 0x08 +/* OP_ALU_VECTOR */ +/* OP_ALU_SCALAR */ +/* OP_ALU_BINSC */ +/* OP_ALU_BIN */ +/* OP_ALU_TRI */ +/* OP_ALU_SWZ */ + +/* GL_ARB_fragment_program instruction code */ +#define OP_ABS 0x00 +#define OP_ABS_SAT 0x1B +#define OP_FLR 0x09 +#define OP_FLR_SAT 0x26 +#define OP_FRC 0x0A +#define OP_FRC_SAT 0x27 +#define OP_LIT 0x0C +#define OP_LIT_SAT 0x2A +#define OP_MOV 0x11 +#define OP_MOV_SAT 0x30 +#define OP_COS 0x1F +#define OP_COS_SAT 0x20 +#define OP_EX2 0x07 +#define OP_EX2_SAT 0x25 +#define OP_LG2 0x0B +#define OP_LG2_SAT 0x29 +#define OP_RCP 0x14 +#define OP_RCP_SAT 0x33 +#define OP_RSQ 0x15 +#define OP_RSQ_SAT 0x34 +#define OP_SIN 0x38 +#define OP_SIN_SAT 0x39 +#define OP_SCS 0x35 +#define OP_SCS_SAT 0x36 +#define OP_POW 0x13 +#define OP_POW_SAT 0x32 +#define OP_ADD 0x01 +#define OP_ADD_SAT 0x1C +#define OP_DP3 0x03 +#define OP_DP3_SAT 0x21 +#define OP_DP4 0x04 +#define OP_DP4_SAT 0x22 +#define OP_DPH 0x05 +#define OP_DPH_SAT 0x23 +#define OP_DST 0x06 +#define OP_DST_SAT 0x24 +#define OP_MAX 0x0F +#define OP_MAX_SAT 0x2E +#define OP_MIN 0x10 +#define OP_MIN_SAT 0x2F +#define OP_MUL 0x12 +#define OP_MUL_SAT 0x31 +#define OP_SGE 0x16 +#define OP_SGE_SAT 0x37 +#define OP_SLT 0x17 +#define OP_SLT_SAT 0x3A +#define OP_SUB 0x18 +#define OP_SUB_SAT 0x3B +#define OP_XPD 0x1A +#define OP_XPD_SAT 0x43 +#define OP_CMP 0x1D +#define OP_CMP_SAT 0x1E +#define OP_LRP 0x2B +#define OP_LRP_SAT 0x2C +#define OP_MAD 0x0E +#define OP_MAD_SAT 0x2D +#define OP_SWZ 0x19 +#define OP_SWZ_SAT 0x3C +#define OP_TEX 0x3D +#define OP_TEX_SAT 0x3E +#define OP_TXB 0x3F +#define OP_TXB_SAT 0x40 +#define OP_TXP 0x41 +#define OP_TXP_SAT 0x42 +#define OP_KIL 0x28 + +/* GL_ARB_vertex_program instruction code */ +#define OP_ARL 0x02 +/* OP_ABS */ +/* OP_FLR */ +/* OP_FRC */ +/* OP_LIT */ +/* OP_MOV */ +/* OP_EX2 */ +#define OP_EXP 0x08 +/* OP_LG2 */ +#define OP_LOG 0x0D +/* OP_RCP */ +/* OP_RSQ */ +/* OP_POW */ +/* OP_ADD */ +/* OP_DP3 */ +/* OP_DP4 */ +/* OP_DPH */ +/* OP_DST */ +/* OP_MAX */ +/* OP_MIN */ +/* OP_MUL */ +/* OP_SGE */ +/* OP_SLT */ +/* OP_SUB */ +/* OP_XPD */ +/* OP_MAD */ +/* OP_SWZ */ + +/* fragment attribute binding */ +#define FRAGMENT_ATTRIB_COLOR 0x01 +#define FRAGMENT_ATTRIB_TEXCOORD 0x02 +#define FRAGMENT_ATTRIB_FOGCOORD 0x03 +#define FRAGMENT_ATTRIB_POSITION 0x04 + +/* vertex attribute binding */ +#define VERTEX_ATTRIB_POSITION 0x01 +#define VERTEX_ATTRIB_WEIGHT 0x02 +#define VERTEX_ATTRIB_NORMAL 0x03 +#define VERTEX_ATTRIB_COLOR 0x04 +#define VERTEX_ATTRIB_FOGCOORD 0x05 +#define VERTEX_ATTRIB_TEXCOORD 0x06 +#define VERTEX_ATTRIB_MATRIXINDEX 0x07 +#define VERTEX_ATTRIB_GENERIC 0x08 + +/* fragment result binding */ +#define FRAGMENT_RESULT_COLOR 0x01 +#define FRAGMENT_RESULT_DEPTH 0x02 + +/* vertex result binding */ +#define VERTEX_RESULT_POSITION 0x01 +#define VERTEX_RESULT_COLOR 0x02 +#define VERTEX_RESULT_FOGCOORD 0x03 +#define VERTEX_RESULT_POINTSIZE 0x04 +#define VERTEX_RESULT_TEXCOORD 0x05 + +/* texture target */ +#define TEXTARGET_1D 0x01 +#define TEXTARGET_2D 0x02 +#define TEXTARGET_3D 0x03 +#define TEXTARGET_RECT 0x04 +#define TEXTARGET_CUBE 0x05 +/* GL_ARB_fragment_program_shadow */ +#define TEXTARGET_SHADOW1D 0x06 +#define TEXTARGET_SHADOW2D 0x07 +#define TEXTARGET_SHADOWRECT 0x08 + +/* face type */ +#define FACE_FRONT 0x00 +#define FACE_BACK 0x01 + +/* color type */ +#define COLOR_PRIMARY 0x00 +#define COLOR_SECONDARY 0x01 + +/* component */ +#define COMPONENT_X 0x00 +#define COMPONENT_Y 0x01 +#define COMPONENT_Z 0x02 +#define COMPONENT_W 0x03 +#define COMPONENT_0 0x04 +#define COMPONENT_1 0x05 + +/* array index type */ +#define ARRAY_INDEX_ABSOLUTE 0x00 +#define ARRAY_INDEX_RELATIVE 0x01 + +/* matrix name */ +#define MATRIX_MODELVIEW 0x01 +#define MATRIX_PROJECTION 0x02 +#define MATRIX_MVP 0x03 +#define MATRIX_TEXTURE 0x04 +#define MATRIX_PALETTE 0x05 +#define MATRIX_PROGRAM 0x06 + +/* matrix modifier */ +#define MATRIX_MODIFIER_IDENTITY 0x00 +#define MATRIX_MODIFIER_INVERSE 0x01 +#define MATRIX_MODIFIER_TRANSPOSE 0x02 +#define MATRIX_MODIFIER_INVTRANS 0x03 + +/* constant type */ +#define CONSTANT_SCALAR 0x01 +#define CONSTANT_VECTOR 0x02 + +/* program param type */ +#define PROGRAM_PARAM_ENV 0x01 +#define PROGRAM_PARAM_LOCAL 0x02 + +/* register type */ +#define REGISTER_ATTRIB 0x01 +#define REGISTER_PARAM 0x02 +#define REGISTER_RESULT 0x03 +#define REGISTER_ESTABLISHED_NAME 0x04 + +/* param binding */ +#define PARAM_NULL 0x00 +#define PARAM_ARRAY_ELEMENT 0x01 +#define PARAM_STATE_ELEMENT 0x02 +#define PARAM_PROGRAM_ELEMENT 0x03 +#define PARAM_PROGRAM_ELEMENTS 0x04 +#define PARAM_CONSTANT 0x05 + +/* param state property */ +#define STATE_MATERIAL_PARSER 0x01 +#define STATE_LIGHT_PARSER 0x02 +#define STATE_LIGHT_MODEL 0x03 +#define STATE_LIGHT_PROD 0x04 +#define STATE_FOG 0x05 +#define STATE_MATRIX_ROWS 0x06 +/* GL_ARB_fragment_program */ +#define STATE_TEX_ENV 0x07 +#define STATE_DEPTH 0x08 +/* GL_ARB_vertex_program */ +#define STATE_TEX_GEN 0x09 +#define STATE_CLIP_PLANE 0x0A +#define STATE_POINT 0x0B + +/* state material property */ +#define MATERIAL_AMBIENT 0x01 +#define MATERIAL_DIFFUSE 0x02 +#define MATERIAL_SPECULAR 0x03 +#define MATERIAL_EMISSION 0x04 +#define MATERIAL_SHININESS 0x05 + +/* state light property */ +#define LIGHT_AMBIENT 0x01 +#define LIGHT_DIFFUSE 0x02 +#define LIGHT_SPECULAR 0x03 +#define LIGHT_POSITION 0x04 +#define LIGHT_ATTENUATION 0x05 +#define LIGHT_HALF 0x06 +#define LIGHT_SPOT_DIRECTION 0x07 + +/* state light model property */ +#define LIGHT_MODEL_AMBIENT 0x01 +#define LIGHT_MODEL_SCENECOLOR 0x02 + +/* state light product property */ +#define LIGHT_PROD_AMBIENT 0x01 +#define LIGHT_PROD_DIFFUSE 0x02 +#define LIGHT_PROD_SPECULAR 0x03 + +/* state texture environment property */ +#define TEX_ENV_COLOR 0x01 + +/* state texture generation coord property */ +#define TEX_GEN_EYE 0x01 +#define TEX_GEN_OBJECT 0x02 + +/* state fog property */ +#define FOG_COLOR 0x01 +#define FOG_PARAMS 0x02 + +/* state depth property */ +#define DEPTH_RANGE 0x01 + +/* state point parameters property */ +#define POINT_SIZE 0x01 +#define POINT_ATTENUATION 0x02 + +/* declaration */ +#define ATTRIB 0x01 +#define PARAM 0x02 +#define TEMP 0x03 +#define OUTPUT 0x04 +#define ALIAS 0x05 +/* GL_ARB_vertex_program */ +#define ADDRESS 0x06 + +/*----------------------------------------------------------------------- + * From here on down is the semantic checking portion + * + */ + +/** + * Variable Table Handling functions + */ +typedef enum +{ + vt_none, + vt_address, + vt_attrib, + vt_param, + vt_temp, + vt_output, + vt_alias +} var_type; + + +/* + * Setting an explicit field for each of the binding properties is a bit wasteful + * of space, but it should be much more clear when reading later on.. + */ +struct var_cache +{ + GLubyte *name; + var_type type; + GLuint address_binding; /* The index of the address register we should + * be using */ + GLuint attrib_binding; /* For type vt_attrib, see nvfragprog.h for values */ + GLuint attrib_binding_idx; /* The index into the attrib register file corresponding + * to the state in attrib_binding */ + GLuint attrib_is_generic; /* If the attrib was specified through a generic + * vertex attrib */ + GLuint temp_binding; /* The index of the temp register we are to use */ + GLuint output_binding; /* For type vt_output, see nvfragprog.h for values */ + GLuint output_binding_idx; /* This is the index into the result register file + * corresponding to the bound result state */ + struct var_cache *alias_binding; /* For type vt_alias, points to the var_cache entry + * that this is aliased to */ + GLuint param_binding_type; /* {PROGRAM_STATE_VAR, PROGRAM_LOCAL_PARAM, + * PROGRAM_ENV_PARAM} */ + GLuint param_binding_begin; /* This is the offset into the program_parameter_list where + * the tokens representing our bound state (or constants) + * start */ + GLuint param_binding_length; /* This is how many entries in the 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 */ + struct var_cache *next; +}; + +static GLvoid +var_cache_create (struct var_cache **va) +{ + *va = (struct var_cache *) _mesa_malloc (sizeof (struct var_cache)); + if (*va) { + (**va).name = NULL; + (**va).type = vt_none; + (**va).attrib_binding = ~0; + (**va).attrib_is_generic = 0; + (**va).temp_binding = ~0; + (**va).output_binding = ~0; + (**va).output_binding_idx = ~0; + (**va).param_binding_type = ~0; + (**va).param_binding_begin = ~0; + (**va).param_binding_length = ~0; + (**va).alias_binding = NULL; + (**va).next = NULL; + } +} + +static GLvoid +var_cache_destroy (struct var_cache **va) +{ + if (*va) { + var_cache_destroy (&(**va).next); + _mesa_free (*va); + *va = NULL; + } +} + +static GLvoid +var_cache_append (struct var_cache **va, struct var_cache *nv) +{ + if (*va) + var_cache_append (&(**va).next, nv); + else + *va = nv; +} + +static struct var_cache * +var_cache_find (struct var_cache *va, GLubyte * name) +{ + /*struct var_cache *first = va;*/ + + while (va) { + if (!strcmp ( (const char*) name, (const char*) va->name)) { + if (va->type == vt_alias) + return va->alias_binding; + return va; + } + + va = va->next; + } + + return NULL; +} + +/** + * constructs an integer from 4 GLubytes in LE format + */ +static GLuint +parse_position (GLubyte ** inst) +{ + GLuint value; + + value = (GLuint) (*(*inst)++); + value += (GLuint) (*(*inst)++) * 0x100; + value += (GLuint) (*(*inst)++) * 0x10000; + value += (GLuint) (*(*inst)++) * 0x1000000; + + return value; +} + +/** + * This will, given a string, lookup the string as a variable name in the + * var cache. If the name is found, the var cache node corresponding to the + * var name is returned. If it is not found, a new entry is allocated + * + * \param I Points into the binary array where the string identifier begins + * \param found 1 if the string was found in the var_cache, 0 if it was allocated + * \return The location on the var_cache corresponding the the string starting at I + */ +static struct var_cache * +parse_string (GLubyte ** inst, struct var_cache **vc_head, + struct arb_program *Program, GLuint * found) +{ + GLubyte *i = *inst; + struct var_cache *va = NULL; + (void) Program; + + *inst += _mesa_strlen ((char *) i) + 1; + + va = var_cache_find (*vc_head, i); + + if (va) { + *found = 1; + return va; + } + + *found = 0; + var_cache_create (&va); + va->name = i; + + var_cache_append (vc_head, va); + + return va; +} + +static char * +parse_string_without_adding (GLubyte ** inst, struct arb_program *Program) +{ + GLubyte *i = *inst; + (void) Program; + + *inst += _mesa_strlen ((char *) i) + 1; + + return (char *) i; +} + +/** + * \return -1 if we parse '-', return 1 otherwise + */ +static GLint +parse_sign (GLubyte ** inst) +{ + /*return *(*inst)++ != '+'; */ + + if (**inst == '-') { + (*inst)++; + return -1; + } + else if (**inst == '+') { + (*inst)++; + return 1; + } + + return 1; +} + +/** + * parses and returns signed integer + */ +static GLint +parse_integer (GLubyte ** inst, struct arb_program *Program) +{ + GLint sign; + GLint value; + + /* check if *inst points to '+' or '-' + * if yes, grab the sign and increment *inst + */ + sign = parse_sign (inst); + + /* now check if *inst points to 0 + * if yes, increment the *inst and return the default value + */ + if (**inst == 0) { + (*inst)++; + return 0; + } + + /* parse the integer as you normally would do it */ + value = _mesa_atoi (parse_string_without_adding (inst, Program)); + + /* now, after terminating 0 there is a position + * to parse it - parse_position() + */ + Program->Position = parse_position (inst); + + return value * sign; +} + +/** + Accumulate this string of digits, and return them as + a large integer represented in floating point (for range). + If scale is not NULL, also accumulates a power-of-ten + integer scale factor that represents the number of digits + in the string. +*/ +static GLdouble +parse_float_string(GLubyte ** inst, struct arb_program *Program, GLdouble *scale) +{ + GLdouble value = 0.0; + GLdouble oscale = 1.0; + + if (**inst == 0) { /* this string of digits is empty-- do nothing */ + (*inst)++; + } + else { /* nonempty string-- parse out the digits */ + while (**inst >= '0' && **inst <= '9') { + GLubyte digit = *((*inst)++); + value = value * 10.0 + (GLint) (digit - '0'); + oscale *= 10.0; + } + assert(**inst == 0); /* integer string should end with 0 */ + (*inst)++; /* skip over terminating 0 */ + Program->Position = parse_position(inst); /* skip position (from integer) */ + } + if (scale) + *scale = oscale; + return value; +} + +/** + Parse an unsigned floating-point number from this stream of tokenized + characters. Example floating-point formats supported: + 12.34 + 12 + 0.34 + .34 + 12.34e-4 + */ +static GLfloat +parse_float (GLubyte ** inst, struct arb_program *Program) +{ + GLint exponent; + GLdouble whole, fraction, fracScale = 1.0; + + whole = parse_float_string(inst, Program, 0); + fraction = parse_float_string(inst, Program, &fracScale); + + /* Parse signed exponent */ + exponent = parse_integer(inst, Program); /* This is the exponent */ + + /* Assemble parts of floating-point number: */ + return (GLfloat) ((whole + fraction / fracScale) * + _mesa_pow(10.0, (GLfloat) exponent)); +} + + +/** + */ +static GLfloat +parse_signed_float (GLubyte ** inst, struct arb_program *Program) +{ + GLint sign = parse_sign (inst); + GLfloat value = parse_float (inst, Program); + return value * sign; +} + +/** + * This picks out a constant value from the parsed array. The constant vector is r + * returned in the *values array, which should be of length 4. + * + * \param values - The 4 component vector with the constant value in it + */ +static GLvoid +parse_constant (GLubyte ** inst, GLfloat *values, struct arb_program *Program, + GLboolean use) +{ + GLuint components, i; + + + switch (*(*inst)++) { + case CONSTANT_SCALAR: + if (use == GL_TRUE) { + values[0] = + values[1] = + values[2] = values[3] = parse_float (inst, Program); + } + else { + values[0] = + values[1] = + values[2] = values[3] = parse_signed_float (inst, Program); + } + + break; + case CONSTANT_VECTOR: + values[0] = values[1] = values[2] = 0; + values[3] = 1; + components = *(*inst)++; + for (i = 0; i < components; i++) { + values[i] = parse_signed_float (inst, Program); + } + break; + } +} + +/** + * \param offset The offset from the address register that we should + * address + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_relative_offset (GLcontext *ctx, GLubyte **inst, struct arb_program *Program, + GLint *offset) +{ + *offset = parse_integer(inst, Program); + return 0; +} + +/** + * \param color 0 if color type is primary, 1 if color type is secondary + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_color_type (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program, + GLint * color) +{ + (void) ctx; (void) Program; + *color = *(*inst)++ != COLOR_PRIMARY; + return 0; +} + +/** + * Get an integer corresponding to a generic vertex attribute. + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_generic_attrib_num(GLcontext *ctx, GLubyte ** inst, + struct arb_program *Program, GLuint *attrib) +{ + GLint i = parse_integer(inst, Program); + + if ((i < 0) || (i > MAX_VERTEX_PROGRAM_ATTRIBS)) + { + _mesa_set_program_error (ctx, Program->Position, + "Invalid generic vertex attribute index"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid generic vertex attribute index"); + + return 1; + } + + *attrib = (GLuint) i; + + return 0; +} + + +/** + * \param color The index of the color buffer to write into + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_output_color_num (GLcontext * ctx, GLubyte ** inst, + struct arb_program *Program, GLuint * color) +{ + GLint i = parse_integer (inst, Program); + + if ((i < 0) || (i >= (int)ctx->Const.MaxDrawBuffers)) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid draw buffer index"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid draw buffer index"); + return 1; + } + + *color = (GLuint) i; + return 0; +} + + +/** + * \param coord The texture unit index + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_texcoord_num (GLcontext * ctx, GLubyte ** inst, + struct arb_program *Program, GLuint * coord) +{ + GLint i = parse_integer (inst, Program); + + if ((i < 0) || (i >= (int)ctx->Const.MaxTextureUnits)) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid texture unit index"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid texture unit index"); + return 1; + } + + *coord = (GLuint) i; + return 0; +} + +/** + * \param coord The weight index + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_weight_num (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program, + GLint * coord) +{ + *coord = parse_integer (inst, Program); + + if ((*coord < 0) || (*coord >= 1)) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid weight index"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid weight index"); + return 1; + } + + return 0; +} + +/** + * \param coord The clip plane index + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_clipplane_num (GLcontext * ctx, GLubyte ** inst, + struct arb_program *Program, GLint * coord) +{ + *coord = parse_integer (inst, Program); + + if ((*coord < 0) || (*coord >= (GLint) ctx->Const.MaxClipPlanes)) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid clip plane index"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid clip plane index"); + return 1; + } + + return 0; +} + + +/** + * \return 0 on front face, 1 on back face + */ +static GLuint +parse_face_type (GLubyte ** inst) +{ + switch (*(*inst)++) { + case FACE_FRONT: + return 0; + + case FACE_BACK: + return 1; + } + return 0; +} + + +/** + * Given a matrix and a modifier token on the binary array, return tokens + * that _mesa_fetch_state() [program.c] can understand. + * + * \param matrix - the matrix we are talking about + * \param matrix_idx - the index of the matrix we have (for texture & program matricies) + * \param matrix_modifier - the matrix modifier (trans, inv, etc) + * \return 0 on sucess, 1 on failure + */ +static GLuint +parse_matrix (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program, + GLint * matrix, GLint * matrix_idx, GLint * matrix_modifier) +{ + GLubyte mat = *(*inst)++; + + *matrix_idx = 0; + + switch (mat) { + case MATRIX_MODELVIEW: + *matrix = STATE_MODELVIEW; + *matrix_idx = parse_integer (inst, Program); + if (*matrix_idx > 0) { + _mesa_set_program_error (ctx, Program->Position, + "ARB_vertex_blend not supported\n"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "ARB_vertex_blend not supported\n"); + return 1; + } + break; + + case MATRIX_PROJECTION: + *matrix = STATE_PROJECTION; + break; + + case MATRIX_MVP: + *matrix = STATE_MVP; + break; + + case MATRIX_TEXTURE: + *matrix = STATE_TEXTURE; + *matrix_idx = parse_integer (inst, Program); + if (*matrix_idx >= (GLint) ctx->Const.MaxTextureUnits) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid Texture Unit"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Invalid Texture Unit: %d", *matrix_idx); + return 1; + } + break; + + /* This is not currently supported (ARB_matrix_palette) */ + case MATRIX_PALETTE: + *matrix_idx = parse_integer (inst, Program); + _mesa_set_program_error (ctx, Program->Position, + "ARB_matrix_palette not supported\n"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "ARB_matrix_palette not supported\n"); + return 1; + break; + + case MATRIX_PROGRAM: + *matrix = STATE_PROGRAM; + *matrix_idx = parse_integer (inst, Program); + if (*matrix_idx >= (GLint) ctx->Const.MaxProgramMatrices) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid Program Matrix"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Invalid Program Matrix: %d", *matrix_idx); + return 1; + } + break; + } + + switch (*(*inst)++) { + case MATRIX_MODIFIER_IDENTITY: + *matrix_modifier = 0; + break; + case MATRIX_MODIFIER_INVERSE: + *matrix_modifier = STATE_MATRIX_INVERSE; + break; + case MATRIX_MODIFIER_TRANSPOSE: + *matrix_modifier = STATE_MATRIX_TRANSPOSE; + break; + case MATRIX_MODIFIER_INVTRANS: + *matrix_modifier = STATE_MATRIX_INVTRANS; + break; + } + + return 0; +} + + +/** + * This parses a state string (rather, the binary version of it) into + * a 6-token sequence as described in _mesa_fetch_state() [program.c] + * + * \param inst - the start in the binary arry to start working from + * \param state_tokens - the storage for the 6-token state description + * \return - 0 on sucess, 1 on error + */ +static GLuint +parse_state_single_item (GLcontext * ctx, GLubyte ** inst, + struct arb_program *Program, GLint * state_tokens) +{ + switch (*(*inst)++) { + case STATE_MATERIAL_PARSER: + state_tokens[0] = STATE_MATERIAL; + state_tokens[1] = parse_face_type (inst); + switch (*(*inst)++) { + case MATERIAL_AMBIENT: + state_tokens[2] = STATE_AMBIENT; + break; + case MATERIAL_DIFFUSE: + state_tokens[2] = STATE_DIFFUSE; + break; + case MATERIAL_SPECULAR: + state_tokens[2] = STATE_SPECULAR; + break; + case MATERIAL_EMISSION: + state_tokens[2] = STATE_EMISSION; + break; + case MATERIAL_SHININESS: + state_tokens[2] = STATE_SHININESS; + break; + } + break; + + case STATE_LIGHT_PARSER: + state_tokens[0] = STATE_LIGHT; + state_tokens[1] = parse_integer (inst, Program); + + /* Check the value of state_tokens[1] against the # of lights */ + if (state_tokens[1] >= (GLint) ctx->Const.MaxLights) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid Light Number"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Invalid Light Number: %d", state_tokens[1]); + return 1; + } + + switch (*(*inst)++) { + case LIGHT_AMBIENT: + state_tokens[2] = STATE_AMBIENT; + break; + case LIGHT_DIFFUSE: + state_tokens[2] = STATE_DIFFUSE; + break; + case LIGHT_SPECULAR: + state_tokens[2] = STATE_SPECULAR; + break; + case LIGHT_POSITION: + state_tokens[2] = STATE_POSITION; + break; + case LIGHT_ATTENUATION: + state_tokens[2] = STATE_ATTENUATION; + break; + case LIGHT_HALF: + state_tokens[2] = STATE_HALF; + break; + case LIGHT_SPOT_DIRECTION: + state_tokens[2] = STATE_SPOT_DIRECTION; + break; + } + break; + + case STATE_LIGHT_MODEL: + switch (*(*inst)++) { + case LIGHT_MODEL_AMBIENT: + state_tokens[0] = STATE_LIGHTMODEL_AMBIENT; + break; + case LIGHT_MODEL_SCENECOLOR: + state_tokens[0] = STATE_LIGHTMODEL_SCENECOLOR; + state_tokens[1] = parse_face_type (inst); + break; + } + break; + + case STATE_LIGHT_PROD: + state_tokens[0] = STATE_LIGHTPROD; + state_tokens[1] = parse_integer (inst, Program); + + /* Check the value of state_tokens[1] against the # of lights */ + if (state_tokens[1] >= (GLint) ctx->Const.MaxLights) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid Light Number"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Invalid Light Number: %d", state_tokens[1]); + return 1; + } + + state_tokens[2] = parse_face_type (inst); + switch (*(*inst)++) { + case LIGHT_PROD_AMBIENT: + state_tokens[3] = STATE_AMBIENT; + break; + case LIGHT_PROD_DIFFUSE: + state_tokens[3] = STATE_DIFFUSE; + break; + case LIGHT_PROD_SPECULAR: + state_tokens[3] = STATE_SPECULAR; + break; + } + break; + + + case STATE_FOG: + switch (*(*inst)++) { + case FOG_COLOR: + state_tokens[0] = STATE_FOG_COLOR; + break; + case FOG_PARAMS: + state_tokens[0] = STATE_FOG_PARAMS; + break; + } + break; + + case STATE_TEX_ENV: + state_tokens[1] = parse_integer (inst, Program); + switch (*(*inst)++) { + case TEX_ENV_COLOR: + state_tokens[0] = STATE_TEXENV_COLOR; + break; + } + break; + + case STATE_TEX_GEN: + { + GLuint type, coord; + + state_tokens[0] = STATE_TEXGEN; + /*state_tokens[1] = parse_integer (inst, Program);*/ /* Texture Unit */ + + if (parse_texcoord_num (ctx, inst, Program, &coord)) + return 1; + state_tokens[1] = coord; + + /* EYE or OBJECT */ + type = *(*inst++); + + /* 0 - s, 1 - t, 2 - r, 3 - q */ + coord = *(*inst++); + + if (type == TEX_GEN_EYE) { + switch (coord) { + case COMPONENT_X: + state_tokens[2] = STATE_TEXGEN_EYE_S; + break; + case COMPONENT_Y: + state_tokens[2] = STATE_TEXGEN_EYE_T; + break; + case COMPONENT_Z: + state_tokens[2] = STATE_TEXGEN_EYE_R; + break; + case COMPONENT_W: + state_tokens[2] = STATE_TEXGEN_EYE_Q; + break; + } + } + else { + switch (coord) { + case COMPONENT_X: + state_tokens[2] = STATE_TEXGEN_OBJECT_S; + break; + case COMPONENT_Y: + state_tokens[2] = STATE_TEXGEN_OBJECT_T; + break; + case COMPONENT_Z: + state_tokens[2] = STATE_TEXGEN_OBJECT_R; + break; + case COMPONENT_W: + state_tokens[2] = STATE_TEXGEN_OBJECT_Q; + break; + } + } + } + break; + + case STATE_DEPTH: + switch (*(*inst)++) { + case DEPTH_RANGE: + state_tokens[0] = STATE_DEPTH_RANGE; + break; + } + break; + + case STATE_CLIP_PLANE: + state_tokens[0] = STATE_CLIPPLANE; + state_tokens[1] = parse_integer (inst, Program); + if (parse_clipplane_num (ctx, inst, Program, &state_tokens[1])) + return 1; + break; + + case STATE_POINT: + switch (*(*inst++)) { + case POINT_SIZE: + state_tokens[0] = STATE_POINT_SIZE; + break; + + case POINT_ATTENUATION: + state_tokens[0] = STATE_POINT_ATTENUATION; + break; + } + break; + + /* XXX: I think this is the correct format for a matrix row */ + case STATE_MATRIX_ROWS: + state_tokens[0] = STATE_MATRIX; + if (parse_matrix + (ctx, inst, Program, &state_tokens[1], &state_tokens[2], + &state_tokens[5])) + return 1; + + state_tokens[3] = parse_integer (inst, Program); /* The first row to grab */ + + if ((**inst) != 0) { /* Either the last row, 0 */ + state_tokens[4] = parse_integer (inst, Program); + if (state_tokens[4] < state_tokens[3]) { + _mesa_set_program_error (ctx, Program->Position, + "Second matrix index less than the first"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Second matrix index (%d) less than the first (%d)", + state_tokens[4], state_tokens[3]); + return 1; + } + } + else { + state_tokens[4] = state_tokens[3]; + (*inst)++; + } + break; + } + + return 0; +} + +/** + * This parses a state string (rather, the binary version of it) into + * a 6-token similar for the state fetching code in program.c + * + * One might ask, why fetch these parameters into just like you fetch + * state when they are already stored in other places? + * + * Because of array offsets -> We can stick env/local parameters in the + * middle of a parameter array and then index someplace into the array + * when we execute. + * + * One optimization might be to only do this for the cases where the + * env/local parameters end up inside of an array, and leave the + * single parameters (or arrays of pure env/local pareameters) in their + * respective register files. + * + * For ENV parameters, the format is: + * state_tokens[0] = STATE_FRAGMENT_PROGRAM / STATE_VERTEX_PROGRAM + * state_tokens[1] = STATE_ENV + * state_tokens[2] = the parameter index + * + * for LOCAL parameters, the format is: + * state_tokens[0] = STATE_FRAGMENT_PROGRAM / STATE_VERTEX_PROGRAM + * state_tokens[1] = STATE_LOCAL + * state_tokens[2] = the parameter index + * + * \param inst - the start in the binary arry to start working from + * \param state_tokens - the storage for the 6-token state description + * \return - 0 on sucess, 1 on failure + */ +static GLuint +parse_program_single_item (GLcontext * ctx, GLubyte ** inst, + struct arb_program *Program, GLint * state_tokens) +{ + if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) + state_tokens[0] = STATE_FRAGMENT_PROGRAM; + else + state_tokens[0] = STATE_VERTEX_PROGRAM; + + + switch (*(*inst)++) { + case PROGRAM_PARAM_ENV: + state_tokens[1] = STATE_ENV; + state_tokens[2] = parse_integer (inst, Program); + + /* Check state_tokens[2] against the number of ENV parameters available */ + if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) && + (state_tokens[2] >= (GLint) ctx->Const.MaxFragmentProgramEnvParams)) + || + ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) && + (state_tokens[2] >= (GLint) ctx->Const.MaxVertexProgramEnvParams))) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid Program Env Parameter"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Invalid Program Env Parameter: %d", + state_tokens[2]); + return 1; + } + + break; + + case PROGRAM_PARAM_LOCAL: + state_tokens[1] = STATE_LOCAL; + state_tokens[2] = parse_integer (inst, Program); + + /* Check state_tokens[2] against the number of LOCAL parameters available */ + if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) && + (state_tokens[2] >= (GLint) ctx->Const.MaxFragmentProgramLocalParams)) + || + ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) && + (state_tokens[2] >= (GLint) ctx->Const.MaxVertexProgramLocalParams))) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid Program Local Parameter"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Invalid Program Local Parameter: %d", + state_tokens[2]); + return 1; + } + break; + } + + return 0; +} + +/** + * For ARB_vertex_program, programs are not allowed to use both an explicit + * vertex attribute and a generic vertex attribute corresponding to the same + * state. See section 2.14.3.1 of the GL_ARB_vertex_program spec. + * + * This will walk our var_cache and make sure that nobody does anything fishy. + * + * \return 0 on sucess, 1 on error + */ +static GLuint +generic_attrib_check(struct var_cache *vc_head) +{ + int a; + struct var_cache *curr; + GLboolean explicitAttrib[MAX_VERTEX_PROGRAM_ATTRIBS], + genericAttrib[MAX_VERTEX_PROGRAM_ATTRIBS]; + + for (a=0; atype == vt_attrib) { + if (curr->attrib_is_generic) + genericAttrib[ curr->attrib_binding_idx ] = GL_TRUE; + else + explicitAttrib[ curr->attrib_binding_idx ] = GL_TRUE; + } + + curr = curr->next; + } + + for (a=0; aBase.Target == GL_FRAGMENT_PROGRAM_ARB) { + switch (*(*inst)++) { + case FRAGMENT_ATTRIB_COLOR: + err = parse_color_type (ctx, inst, Program, &coord); + *binding = FRAG_ATTRIB_COL0 + coord; + *binding_idx = 1 + coord; + break; + + case FRAGMENT_ATTRIB_TEXCOORD: + err = parse_texcoord_num (ctx, inst, Program, &texcoord); + *binding = FRAG_ATTRIB_TEX0 + texcoord; + *binding_idx = 4 + texcoord; + break; + + case FRAGMENT_ATTRIB_FOGCOORD: + *binding = FRAG_ATTRIB_FOGC; + *binding_idx = 3; + break; + + case FRAGMENT_ATTRIB_POSITION: + *binding = FRAG_ATTRIB_WPOS; + *binding_idx = 0; + break; + + default: + err = 1; + break; + } + } + else { + switch (*(*inst)++) { + case VERTEX_ATTRIB_POSITION: + *binding = VERT_ATTRIB_POS; + *binding_idx = 0; + break; + + case VERTEX_ATTRIB_WEIGHT: + { + GLint weight; + + err = parse_weight_num (ctx, inst, Program, &weight); + *binding = VERT_ATTRIB_WEIGHT; + *binding_idx = 1; + } + _mesa_set_program_error (ctx, Program->Position, + "ARB_vertex_blend not supported\n"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "ARB_vertex_blend not supported\n"); + return 1; + break; + + case VERTEX_ATTRIB_NORMAL: + *binding = VERT_ATTRIB_NORMAL; + *binding_idx = 2; + break; + + case VERTEX_ATTRIB_COLOR: + { + GLint color; + + err = parse_color_type (ctx, inst, Program, &color); + if (color) { + *binding = VERT_ATTRIB_COLOR1; + *binding_idx = 4; + } + else { + *binding = VERT_ATTRIB_COLOR0; + *binding_idx = 3; + } + } + break; + + case VERTEX_ATTRIB_FOGCOORD: + *binding = VERT_ATTRIB_FOG; + *binding_idx = 5; + break; + + case VERTEX_ATTRIB_TEXCOORD: + { + GLuint unit; + + err = parse_texcoord_num (ctx, inst, Program, &unit); + *binding = VERT_ATTRIB_TEX0 + unit; + *binding_idx = 8 + unit; + } + break; + + /* It looks like we don't support this at all, atm */ + case VERTEX_ATTRIB_MATRIXINDEX: + parse_integer (inst, Program); + _mesa_set_program_error (ctx, Program->Position, + "ARB_palette_matrix not supported"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "ARB_palette_matrix not supported"); + return 1; + break; + + case VERTEX_ATTRIB_GENERIC: + { + GLuint attrib; + + if (!parse_generic_attrib_num(ctx, inst, Program, &attrib)) { + *is_generic = 1; + switch (attrib) { + case 0: + *binding = VERT_ATTRIB_POS; + break; + case 1: + *binding = VERT_ATTRIB_WEIGHT; + break; + case 2: + *binding = VERT_ATTRIB_NORMAL; + break; + case 3: + *binding = VERT_ATTRIB_COLOR0; + break; + case 4: + *binding = VERT_ATTRIB_COLOR1; + break; + case 5: + *binding = VERT_ATTRIB_FOG; + break; + case 6: + break; + case 7: + break; + default: + *binding = VERT_ATTRIB_TEX0 + (attrib-8); + break; + } + *binding_idx = attrib; + } + } + break; + + default: + err = 1; + break; + } + } + + /* Can this even happen? */ + if (err) { + _mesa_set_program_error (ctx, Program->Position, + "Bad attribute binding"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Bad attribute binding"); + } + + Program->InputsRead |= (1 << *binding_idx); + + return err; +} + +/** + * This translates between a binary token for an output variable type + * and the mesa token for the same thing. + * + * + * XXX: What is the 'name' for vertex program state? -> do we need it? + * I don't think we do; + * + * See nvfragprog.h for definitions + * + * \param inst - The parsed tokens + * \param binding - The name of the state we are binding too + * \param binding_idx - The index into the result register file that this is bound too + * + * See nvfragparse.c for the register file layout for fragment programs + * See nvvertparse.c for the register file layout for vertex programs + */ +static GLuint +parse_result_binding (GLcontext * ctx, GLubyte ** inst, GLuint * binding, + GLuint * binding_idx, struct arb_program *Program) +{ + GLuint b, out_color; + + switch (*(*inst)++) { + case FRAGMENT_RESULT_COLOR: + /* for frag programs, this is FRAGMENT_RESULT_COLOR */ + if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { + /* This gets result of the color buffer we're supposed to + * draw into + */ + parse_output_color_num(ctx, inst, Program, &out_color); + + *binding = FRAG_OUTPUT_COLR; + + /* XXX: We're ignoring the color buffer for now. */ + *binding_idx = 0; + } + /* for vtx programs, this is VERTEX_RESULT_POSITION */ + else { + *binding_idx = 0; + } + break; + + case FRAGMENT_RESULT_DEPTH: + /* for frag programs, this is FRAGMENT_RESULT_DEPTH */ + if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { + *binding = FRAG_OUTPUT_DEPR; + *binding_idx = 2; + } + /* for vtx programs, this is VERTEX_RESULT_COLOR */ + else { + GLint color_type; + GLuint face_type = parse_face_type(inst); + GLint color_type_ret = parse_color_type(ctx, inst, Program, &color_type); + + /* back face */ + if (face_type) { + if (color_type_ret) return 1; + + /* secondary color */ + if (color_type) { + *binding_idx = 4; + } + /* primary color */ + else { + *binding_idx = 3; + } + } + /* front face */ + else { + /* secondary color */ + if (color_type) { + *binding_idx = 2; + } + /* primary color */ + else { + *binding_idx = 1; + } + } + } + break; + + case VERTEX_RESULT_FOGCOORD: + *binding_idx = 5; + break; + + case VERTEX_RESULT_POINTSIZE: + *binding_idx = 6; + break; + + case VERTEX_RESULT_TEXCOORD: + if (parse_texcoord_num (ctx, inst, Program, &b)) + return 1; + *binding_idx = 7 + b; + break; + } + + Program->OutputsWritten |= (1 << *binding_idx); + + return 0; +} + +/** + * This handles the declaration of ATTRIB variables + * + * XXX: Still needs + * parse_vert_attrib_binding(), or something like that + * + * \return 0 on sucess, 1 on error + */ +static GLint +parse_attrib (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLuint found; + char *error_msg; + struct var_cache *attrib_var; + + attrib_var = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + if (found) { + error_msg = (char *) + _mesa_malloc (_mesa_strlen ((char *) attrib_var->name) + 40); + _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + attrib_var->name); + + _mesa_set_program_error (ctx, Program->Position, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); + + _mesa_free (error_msg); + return 1; + } + + attrib_var->type = vt_attrib; + + /* I think this is ok now - karl */ + /* XXX: */ + /*if (Program->type == GL_FRAGMENT_PROGRAM_ARB) */ + { + if (parse_attrib_binding + (ctx, inst, Program, &attrib_var->attrib_binding, + &attrib_var->attrib_binding_idx, &attrib_var->attrib_is_generic)) + return 1; + if (generic_attrib_check(*vc_head)) { + _mesa_set_program_error (ctx, Program->Position, + "Cannot use both a generic vertex attribute and a specific attribute of the same type"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Cannot use both a generic vertex attribute and a specific attribute of the same type"); + return 1; + } + + } + + Program->Base.NumAttributes++; + return 0; +} + +/** + * \param use -- TRUE if we're called when declaring implicit parameters, + * FALSE if we're declaraing variables. This has to do with + * if we get a signed or unsigned float for scalar constants + */ +static GLuint +parse_param_elements (GLcontext * ctx, GLubyte ** inst, + struct var_cache *param_var, + struct arb_program *Program, GLboolean use) +{ + GLint idx; + GLuint err; + GLint state_tokens[6]; + GLfloat const_values[4]; + + err = 0; + + switch (*(*inst)++) { + case PARAM_STATE_ELEMENT: + + if (parse_state_single_item (ctx, inst, Program, state_tokens)) + return 1; + + /* If we adding STATE_MATRIX that has multiple rows, we need to + * unroll it and call _mesa_add_state_reference() for each row + */ + if ((state_tokens[0] == STATE_MATRIX) + && (state_tokens[3] != state_tokens[4])) { + GLint row; + GLint first_row = state_tokens[3]; + GLint last_row = state_tokens[4]; + + for (row = first_row; row <= last_row; row++) { + state_tokens[3] = state_tokens[4] = row; + + idx = + _mesa_add_state_reference (Program->Parameters, + state_tokens); + if (param_var->param_binding_begin == ~0U) + param_var->param_binding_begin = idx; + param_var->param_binding_length++; + Program->Base.NumParameters++; + } + } + else { + idx = + _mesa_add_state_reference (Program->Parameters, state_tokens); + if (param_var->param_binding_begin == ~0U) + param_var->param_binding_begin = idx; + param_var->param_binding_length++; + Program->Base.NumParameters++; + } + break; + + case PARAM_PROGRAM_ELEMENT: + + if (parse_program_single_item (ctx, inst, Program, state_tokens)) + return 1; + idx = _mesa_add_state_reference (Program->Parameters, state_tokens); + if (param_var->param_binding_begin == ~0U) + param_var->param_binding_begin = idx; + param_var->param_binding_length++; + Program->Base.NumParameters++; + + /* Check if there is more: 0 -> we're done, else its an integer */ + if (**inst) { + GLuint out_of_range, new_idx; + GLuint start_idx = state_tokens[2] + 1; + GLuint end_idx = parse_integer (inst, Program); + + out_of_range = 0; + if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { + if (((state_tokens[1] == STATE_ENV) + && (end_idx >= ctx->Const.MaxFragmentProgramEnvParams)) + || ((state_tokens[1] == STATE_LOCAL) + && (end_idx >= + ctx->Const.MaxFragmentProgramLocalParams))) + out_of_range = 1; + } + else { + if (((state_tokens[1] == STATE_ENV) + && (end_idx >= ctx->Const.MaxVertexProgramEnvParams)) + || ((state_tokens[1] == STATE_LOCAL) + && (end_idx >= + ctx->Const.MaxVertexProgramLocalParams))) + out_of_range = 1; + } + if (out_of_range) { + _mesa_set_program_error (ctx, Program->Position, + "Invalid Program Parameter"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Invalid Program Parameter: %d", end_idx); + return 1; + } + + for (new_idx = start_idx; new_idx <= end_idx; new_idx++) { + state_tokens[2] = new_idx; + idx = + _mesa_add_state_reference (Program->Parameters, + state_tokens); + param_var->param_binding_length++; + Program->Base.NumParameters++; + } + } + else + { + (*inst)++; + } + break; + + case PARAM_CONSTANT: + parse_constant (inst, const_values, Program, use); + idx = + _mesa_add_named_constant (Program->Parameters, + (char *) param_var->name, const_values); + if (param_var->param_binding_begin == ~0U) + param_var->param_binding_begin = idx; + param_var->param_binding_length++; + Program->Base.NumParameters++; + break; + + default: + _mesa_set_program_error (ctx, Program->Position, + "Unexpected token in parse_param_elements()"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Unexpected token in parse_param_elements()"); + return 1; + } + + /* Make sure we haven't blown past our parameter limits */ + if (((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) && + (Program->Base.NumParameters >= + ctx->Const.MaxVertexProgramLocalParams)) + || ((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) + && (Program->Base.NumParameters >= + ctx->Const.MaxFragmentProgramLocalParams))) { + _mesa_set_program_error (ctx, Program->Position, + "Too many parameter variables"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Too many parameter variables"); + return 1; + } + + return err; +} + +/** + * This picks out PARAM program parameter bindings. + * + * XXX: This needs to be stressed & tested + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_param (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLuint found, err; + GLint specified_length; + char *error_msg; + struct var_cache *param_var; + + err = 0; + param_var = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + + if (found) { + error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) param_var->name) + 40); + _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + param_var->name); + + _mesa_set_program_error (ctx, Program->Position, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); + + _mesa_free (error_msg); + return 1; + } + + specified_length = parse_integer (inst, Program); + + if (specified_length < 0) { + _mesa_set_program_error (ctx, Program->Position, + "Negative parameter array length"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Negative parameter array length: %d", specified_length); + return 1; + } + + param_var->type = vt_param; + param_var->param_binding_length = 0; + + /* Right now, everything is shoved into the main state register file. + * + * In the future, it would be nice to leave things ENV/LOCAL params + * in their respective register files, if possible + */ + param_var->param_binding_type = PROGRAM_STATE_VAR; + + /* Remember to: + * * - add each guy to the parameter list + * * - increment the param_var->param_binding_len + * * - store the param_var->param_binding_begin for the first one + * * - compare the actual len to the specified len at the end + */ + while (**inst != PARAM_NULL) { + if (parse_param_elements (ctx, inst, param_var, Program, GL_FALSE)) + return 1; + } + + /* Test array length here! */ + if (specified_length) { + if (specified_length != (int)param_var->param_binding_length) { + _mesa_set_program_error (ctx, Program->Position, + "Declared parameter array lenght does not match parameter list"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Declared parameter array lenght does not match parameter list"); + } + } + + (*inst)++; + + return 0; +} + +/** + * + */ +static GLuint +parse_param_use (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, + struct arb_program *Program, struct var_cache **new_var) +{ + struct var_cache *param_var; + + /* First, insert a dummy entry into the var_cache */ + var_cache_create (¶m_var); + param_var->name = (GLubyte *) _mesa_strdup (" "); + param_var->type = vt_param; + + param_var->param_binding_length = 0; + /* Don't fill in binding_begin; We use the default value of -1 + * to tell if its already initialized, elsewhere. + * + * param_var->param_binding_begin = 0; + */ + param_var->param_binding_type = PROGRAM_STATE_VAR; + + var_cache_append (vc_head, param_var); + + /* Then fill it with juicy parameter goodness */ + if (parse_param_elements (ctx, inst, param_var, Program, GL_TRUE)) + return 1; + + *new_var = param_var; + + return 0; +} + + +/** + * This handles the declaration of TEMP variables + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_temp (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLuint found; + struct var_cache *temp_var; + char *error_msg; + + while (**inst != 0) { + temp_var = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + if (found) { + error_msg = (char *) + _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); + _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + temp_var->name); + + _mesa_set_program_error (ctx, Program->Position, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); + + _mesa_free (error_msg); + return 1; + } + + temp_var->type = vt_temp; + + if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) && + (Program->Base.NumTemporaries >= + ctx->Const.MaxFragmentProgramTemps)) + || ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) + && (Program->Base.NumTemporaries >= + ctx->Const.MaxVertexProgramTemps))) { + _mesa_set_program_error (ctx, Program->Position, + "Too many TEMP variables declared"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Too many TEMP variables declared"); + return 1; + } + + temp_var->temp_binding = Program->Base.NumTemporaries; + Program->Base.NumTemporaries++; + } + (*inst)++; + + return 0; +} + +/** + * This handles variables of the OUTPUT variety + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_output (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLuint found; + struct var_cache *output_var; + + output_var = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + if (found) { + char *error_msg; + error_msg = (char *) + _mesa_malloc (_mesa_strlen ((char *) output_var->name) + 40); + _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + output_var->name); + + _mesa_set_program_error (ctx, Program->Position, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); + + _mesa_free (error_msg); + return 1; + } + + output_var->type = vt_output; + return parse_result_binding (ctx, inst, &output_var->output_binding, + &output_var->output_binding_idx, Program); +} + +/** + * This handles variables of the ALIAS kind + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_alias (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLuint found; + struct var_cache *temp_var; + char *error_msg; + + + temp_var = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + + if (found) { + error_msg = (char *) + _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); + _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + temp_var->name); + + _mesa_set_program_error (ctx, Program->Position, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); + + _mesa_free (error_msg); + return 1; + } + + temp_var->type = vt_alias; + temp_var->alias_binding = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + + if (!found) + { + error_msg = (char *) + _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); + _mesa_sprintf (error_msg, "Alias value %s is not defined", + temp_var->alias_binding->name); + + _mesa_set_program_error (ctx, Program->Position, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); + + _mesa_free (error_msg); + return 1; + } + + return 0; +} + +/** + * This handles variables of the ADDRESS kind + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_address (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLuint found; + struct var_cache *temp_var; + char *error_msg; + + while (**inst != 0) { + temp_var = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + if (found) { + error_msg = (char *) + _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); + _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + temp_var->name); + + _mesa_set_program_error (ctx, Program->Position, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); + + _mesa_free (error_msg); + return 1; + } + + temp_var->type = vt_address; + + if (Program->Base.NumAddressRegs >= + ctx->Const.MaxVertexProgramAddressRegs) { + _mesa_set_program_error (ctx, Program->Position, + "Too many ADDRESS variables declared"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Too many ADDRESS variables declared"); + return 1; + } + + temp_var->address_binding = Program->Base.NumAddressRegs; + Program->Base.NumAddressRegs++; + } + (*inst)++; + + return 0; +} + +/** + * Parse a program declaration + * + * \return 0 on sucess, 1 on error + */ +static GLint +parse_declaration (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLint err = 0; + + switch (*(*inst)++) { + case ADDRESS: + err = parse_address (ctx, inst, vc_head, Program); + break; + + case ALIAS: + err = parse_alias (ctx, inst, vc_head, Program); + break; + + case ATTRIB: + err = parse_attrib (ctx, inst, vc_head, Program); + break; + + case OUTPUT: + err = parse_output (ctx, inst, vc_head, Program); + break; + + case PARAM: + err = parse_param (ctx, inst, vc_head, Program); + break; + + case TEMP: + err = parse_temp (ctx, inst, vc_head, Program); + break; + } + + return err; +} + +/** + * Handle the parsing out of a masked destination register + * + * If we are a vertex program, make sure we don't write to + * result.position of we have specified that the program is + * position invariant + * + * \param File - The register file we write to + * \param Index - The register index we write to + * \param WriteMask - The mask controlling which components we write (1->write) + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_masked_dst_reg (GLcontext * ctx, GLubyte ** inst, + struct var_cache **vc_head, struct arb_program *Program, + GLint * File, GLint * Index, GLint *WriteMask) +{ + GLuint result, tmp; + struct var_cache *dst; + + /* We either have a result register specified, or a + * variable that may or may not be writable + */ + switch (*(*inst)++) { + case REGISTER_RESULT: + if (parse_result_binding + (ctx, inst, &result, (GLuint *) Index, Program)) + return 1; + *File = PROGRAM_OUTPUT; + break; + + case REGISTER_ESTABLISHED_NAME: + dst = parse_string (inst, vc_head, Program, &result); + Program->Position = parse_position (inst); + + /* If the name has never been added to our symbol table, we're hosed */ + if (!result) { + _mesa_set_program_error (ctx, Program->Position, + "0: Undefined variable"); + _mesa_error (ctx, GL_INVALID_OPERATION, "0: Undefined variable: %s", + dst->name); + return 1; + } + + switch (dst->type) { + case vt_output: + *File = PROGRAM_OUTPUT; + *Index = dst->output_binding_idx; + break; + + case vt_temp: + *File = PROGRAM_TEMPORARY; + *Index = dst->temp_binding; + break; + + /* If the var type is not vt_output or vt_temp, no go */ + default: + _mesa_set_program_error (ctx, Program->Position, + "Destination register is read only"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Destination register is read only: %s", + dst->name); + return 1; + } + break; + + default: + _mesa_set_program_error (ctx, Program->Position, + "Unexpected opcode in parse_masked_dst_reg()"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Unexpected opcode in parse_masked_dst_reg()"); + return 1; + } + + + /* Position invariance test */ + /* This test is done now in syntax portion - when position invariance OPTION + is specified, "result.position" rule is disabled so there is no way + to write the position + */ + /*if ((Program->HintPositionInvariant) && (*File == PROGRAM_OUTPUT) && + (*Index == 0)) { + _mesa_set_program_error (ctx, Program->Position, + "Vertex program specified position invariance and wrote vertex position"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Vertex program specified position invariance and wrote vertex position"); + }*/ + + /* And then the mask. + * w,a -> bit 0 + * z,b -> bit 1 + * y,g -> bit 2 + * x,r -> bit 3 + * + * ==> Need to reverse the order of bits for this! + */ + tmp = (GLint) *(*inst)++; + *WriteMask = (((tmp>>3) & 0x1) | + ((tmp>>1) & 0x2) | + ((tmp<<1) & 0x4) | + ((tmp<<3) & 0x8)); + + return 0; +} + + +/** + * Handle the parsing of a address register + * + * \param Index - The register index we write to + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_address_reg (GLcontext * ctx, GLubyte ** inst, + struct var_cache **vc_head, + struct arb_program *Program, GLint * Index) +{ + struct var_cache *dst; + GLuint result; + (void) Index; + + dst = parse_string (inst, vc_head, Program, &result); + Program->Position = parse_position (inst); + + /* If the name has never been added to our symbol table, we're hosed */ + if (!result) { + _mesa_set_program_error (ctx, Program->Position, "Undefined variable"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Undefined variable: %s", + dst->name); + return 1; + } + + if (dst->type != vt_address) { + _mesa_set_program_error (ctx, Program->Position, + "Variable is not of type ADDRESS"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Variable: %s is not of type ADDRESS", dst->name); + return 1; + } + + return 0; +} + +#if 0 /* unused */ +/** + * Handle the parsing out of a masked address register + * + * \param Index - The register index we write to + * \param WriteMask - The mask controlling which components we write (1->write) + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_masked_address_reg (GLcontext * ctx, GLubyte ** inst, + struct var_cache **vc_head, + struct arb_program *Program, GLint * Index, + GLboolean * WriteMask) +{ + if (parse_address_reg (ctx, inst, vc_head, Program, Index)) + return 1; + + /* This should be 0x8 */ + (*inst)++; + + /* Writemask of .x is implied */ + WriteMask[0] = 1; + WriteMask[1] = WriteMask[2] = WriteMask[3] = 0; + + return 0; +} +#endif + +/** + * Parse out a swizzle mask. + * + * The values in the input stream are: + * COMPONENT_X -> x/r + * COMPONENT_Y -> y/g + * COMPONENT_Z-> z/b + * COMPONENT_W-> w/a + * + * The values in the output mask are: + * 0 -> x/r + * 1 -> y/g + * 2 -> z/b + * 3 -> w/a + * + * The len parameter allows us to grab 4 components for a vector + * swizzle, or just 1 component for a scalar src register selection + */ +static GLuint +parse_swizzle_mask (GLubyte ** inst, GLubyte * mask, GLint len) +{ + GLint a; + + for (a = 0; a < 4; a++) + mask[a] = a; + + for (a = 0; a < len; a++) { + switch (*(*inst)++) { + case COMPONENT_X: + mask[a] = 0; + break; + + case COMPONENT_Y: + mask[a] = 1; + break; + + case COMPONENT_Z: + mask[a] = 2; + break; + + case COMPONENT_W: + mask[a] = 3; + break; + } + } + + return 0; +} + +/** + */ +static GLuint +parse_extended_swizzle_mask(GLubyte **inst, GLubyte *mask, GLubyte *negate) +{ + GLint a; + GLubyte swz; + + *negate = 0x0; + for (a = 0; a < 4; a++) { + if (parse_sign (inst) == -1) + *negate |= (1 << a); + + swz = *(*inst)++; + + switch (swz) { + case COMPONENT_0: + mask[a] = SWIZZLE_ZERO; + break; + case COMPONENT_1: + mask[a] = SWIZZLE_ONE; + break; + case COMPONENT_X: + mask[a] = SWIZZLE_X; + break; + case COMPONENT_Y: + mask[a] = SWIZZLE_Y; + break; + case COMPONENT_Z: + mask[a] = SWIZZLE_Z; + break; + case COMPONENT_W: + mask[a] = SWIZZLE_W; + break; + + } +#if 0 + if (swz == 0) + mask[a] = SWIZZLE_ZERO; + else if (swz == 1) + mask[a] = SWIZZLE_ONE; + else + mask[a] = swz - 2; +#endif + + } + + return 0; +} + + +static GLuint +parse_src_reg (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, + struct arb_program *Program, GLint * File, GLint * Index, + GLboolean *IsRelOffset ) +{ + struct var_cache *src; + GLuint binding_state, binding_idx, is_generic, found; + GLint offset; + + *IsRelOffset = 0; + + /* And the binding for the src */ + switch (*(*inst)++) { + case REGISTER_ATTRIB: + if (parse_attrib_binding + (ctx, inst, Program, &binding_state, &binding_idx, &is_generic)) + return 1; + *File = PROGRAM_INPUT; + *Index = binding_idx; + + /* We need to insert a dummy variable into the var_cache so we can + * catch generic vertex attrib aliasing errors + */ + var_cache_create(&src); + src->type = vt_attrib; + src->name = (GLubyte *)_mesa_strdup("Dummy Attrib Variable"); + src->attrib_binding = binding_state; + src->attrib_binding_idx = binding_idx; + src->attrib_is_generic = is_generic; + var_cache_append(vc_head, src); + if (generic_attrib_check(*vc_head)) { + _mesa_set_program_error (ctx, Program->Position, + "Cannot use both a generic vertex attribute and a specific attribute of the same type"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Cannot use both a generic vertex attribute and a specific attribute of the same type"); + return 1; + } + break; + + case REGISTER_PARAM: + switch (**inst) { + case PARAM_ARRAY_ELEMENT: + (*inst)++; + src = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + + if (!found) { + _mesa_set_program_error (ctx, Program->Position, + "2: Undefined variable"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "2: Undefined variable: %s", src->name); + return 1; + } + + *File = src->param_binding_type; + + switch (*(*inst)++) { + case ARRAY_INDEX_ABSOLUTE: + offset = parse_integer (inst, Program); + + if ((offset < 0) + || (offset >= (int)src->param_binding_length)) { + _mesa_set_program_error (ctx, Program->Position, + "Index out of range"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Index %d out of range for %s", offset, + src->name); + return 1; + } + + *Index = src->param_binding_begin + offset; + break; + + case ARRAY_INDEX_RELATIVE: + { + GLint addr_reg_idx, rel_off; + + /* First, grab the address regiseter */ + if (parse_address_reg (ctx, inst, vc_head, Program, &addr_reg_idx)) + return 1; + + /* And the .x */ + ((*inst)++); + ((*inst)++); + ((*inst)++); + ((*inst)++); + + /* Then the relative offset */ + if (parse_relative_offset(ctx, inst, Program, &rel_off)) return 1; + + /* And store it properly */ + *Index = src->param_binding_begin + rel_off; + *IsRelOffset = 1; + } + break; + } + break; + + default: + + if (parse_param_use (ctx, inst, vc_head, Program, &src)) + return 1; + + *File = src->param_binding_type; + *Index = src->param_binding_begin; + break; + } + break; + + case REGISTER_ESTABLISHED_NAME: + + src = parse_string (inst, vc_head, Program, &found); + Program->Position = parse_position (inst); + + /* If the name has never been added to our symbol table, we're hosed */ + if (!found) { + _mesa_set_program_error (ctx, Program->Position, + "3: Undefined variable"); + _mesa_error (ctx, GL_INVALID_OPERATION, "3: Undefined variable: %s", + src->name); + return 1; + } + + switch (src->type) { + case vt_attrib: + *File = PROGRAM_INPUT; + *Index = src->attrib_binding_idx; + break; + + /* XXX: We have to handle offsets someplace in here! -- or are those above? */ + case vt_param: + *File = src->param_binding_type; + *Index = src->param_binding_begin; + break; + + case vt_temp: + *File = PROGRAM_TEMPORARY; + *Index = src->temp_binding; + break; + + /* If the var type is vt_output no go */ + default: + _mesa_set_program_error (ctx, Program->Position, + "destination register is read only"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "destination register is read only: %s", + src->name); + return 1; + } + break; + + default: + _mesa_set_program_error (ctx, Program->Position, + "Unknown token in parse_src_reg"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Unknown token in parse_src_reg"); + return 1; + } + + return 0; +} + +/** + */ +static GLuint +parse_fp_vector_src_reg (GLcontext * ctx, GLubyte ** inst, + struct var_cache **vc_head, struct arb_program *Program, + struct fp_src_register *reg ) +{ + + GLint File; + GLint Index; + GLboolean Negate; + GLubyte Swizzle[4]; + GLboolean IsRelOffset; + + /* Grab the sign */ + Negate = (parse_sign (inst) == -1) ? 0xf : 0x0; + + /* And the src reg */ + if (parse_src_reg (ctx, inst, vc_head, Program, &File, &Index, &IsRelOffset)) + return 1; + + /* finally, the swizzle */ + parse_swizzle_mask (inst, Swizzle, 4); + + reg->File = File; + reg->Index = Index; + reg->Abs = 0; /* NV only */ + reg->NegateAbs = 0; /* NV only */ + reg->NegateBase = Negate; + reg->Swizzle = (Swizzle[0] << 0 | + Swizzle[1] << 3 | + Swizzle[2] << 6 | + Swizzle[3] << 9); + + return 0; +} + + +static GLuint +parse_fp_dst_reg(GLcontext * ctx, GLubyte ** inst, + struct var_cache **vc_head, struct arb_program *Program, + struct fp_dst_register *reg ) +{ + GLint file, idx, mask; + + if (parse_masked_dst_reg (ctx, inst, vc_head, Program, &file, &idx, &mask)) + return 1; + + reg->CondMask = 0; /* NV only */ + reg->CondSwizzle = 0; /* NV only */ + reg->File = file; + reg->Index = idx; + reg->WriteMask = mask; + return 0; +} + + + +static GLuint +parse_fp_scalar_src_reg (GLcontext * ctx, GLubyte ** inst, + struct var_cache **vc_head, struct arb_program *Program, + struct fp_src_register *reg ) +{ + + GLint File; + GLint Index; + GLboolean Negate; + GLubyte Swizzle[4]; + GLboolean IsRelOffset; + + /* Grab the sign */ + Negate = (parse_sign (inst) == -1) ? 0x1 : 0x0; + + /* And the src reg */ + if (parse_src_reg (ctx, inst, vc_head, Program, &File, &Index, &IsRelOffset)) + return 1; + + /* finally, the swizzle */ + parse_swizzle_mask (inst, Swizzle, 1); + + reg->File = File; + reg->Index = Index; + reg->Abs = 0; /* NV only */ + reg->NegateAbs = 0; /* NV only */ + reg->NegateBase = Negate; + reg->Swizzle = (Swizzle[0] << 0); + + return 0; +} + + +/** + * This is a big mother that handles getting opcodes into the instruction + * and handling the src & dst registers for fragment program instructions + */ +static GLuint +parse_fp_instruction (GLcontext * ctx, GLubyte ** inst, + struct var_cache **vc_head, struct arb_program *Program, + struct fp_instruction *fp) +{ + GLint a; + GLuint texcoord; + GLubyte instClass, type, code; + GLboolean rel; + + /* No condition codes in ARB_fp */ + fp->UpdateCondRegister = 0; + + /* Record the position in the program string for debugging */ + fp->StringPos = Program->Position; + + fp->Data = NULL; + + fp->DstReg.File = 0xf; /* mark as undef */ + fp->SrcReg[0].File = 0xf; /* mark as undef */ + fp->SrcReg[1].File = 0xf; /* mark as undef */ + fp->SrcReg[2].File = 0xf; /* mark as undef */ + + /* OP_ALU_INST or OP_TEX_INST */ + instClass = *(*inst)++; + + /* OP_ALU_{VECTOR, SCALAR, BINSC, BIN, TRI, SWZ}, + * OP_TEX_{SAMPLE, KIL} + */ + type = *(*inst)++; + + /* The actual opcode name */ + code = *(*inst)++; + + /* Increment the correct count */ + switch (instClass) { + case OP_ALU_INST: + Program->NumAluInstructions++; + break; + case OP_TEX_INST: + Program->NumTexInstructions++; + break; + } + + fp->Saturate = 0; + fp->Precision = FLOAT32; + + fp->DstReg.CondMask = COND_TR; + + switch (type) { + case OP_ALU_VECTOR: + switch (code) { + case OP_ABS_SAT: + fp->Saturate = 1; + case OP_ABS: + fp->Opcode = FP_OPCODE_ABS; + break; + + case OP_FLR_SAT: + fp->Saturate = 1; + case OP_FLR: + fp->Opcode = FP_OPCODE_FLR; + break; + + case OP_FRC_SAT: + fp->Saturate = 1; + case OP_FRC: + fp->Opcode = FP_OPCODE_FRC; + break; + + case OP_LIT_SAT: + fp->Saturate = 1; + case OP_LIT: + fp->Opcode = FP_OPCODE_LIT; + break; + + case OP_MOV_SAT: + fp->Saturate = 1; + case OP_MOV: + fp->Opcode = FP_OPCODE_MOV; + break; + } + + if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) + return 1; + + if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) + return 1; + break; + + case OP_ALU_SCALAR: + switch (code) { + case OP_COS_SAT: + fp->Saturate = 1; + case OP_COS: + fp->Opcode = FP_OPCODE_COS; + break; + + case OP_EX2_SAT: + fp->Saturate = 1; + case OP_EX2: + fp->Opcode = FP_OPCODE_EX2; + break; + + case OP_LG2_SAT: + fp->Saturate = 1; + case OP_LG2: + fp->Opcode = FP_OPCODE_LG2; + break; + + case OP_RCP_SAT: + fp->Saturate = 1; + case OP_RCP: + fp->Opcode = FP_OPCODE_RCP; + break; + + case OP_RSQ_SAT: + fp->Saturate = 1; + case OP_RSQ: + fp->Opcode = FP_OPCODE_RSQ; + break; + + case OP_SIN_SAT: + fp->Saturate = 1; + case OP_SIN: + fp->Opcode = FP_OPCODE_SIN; + break; + + case OP_SCS_SAT: + fp->Saturate = 1; + case OP_SCS: + + fp->Opcode = FP_OPCODE_SCS; + break; + } + + if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) + return 1; + + if (parse_fp_scalar_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) + return 1; + break; + + case OP_ALU_BINSC: + switch (code) { + case OP_POW_SAT: + fp->Saturate = 1; + case OP_POW: + fp->Opcode = FP_OPCODE_POW; + break; + } + + if (parse_fp_dst_reg(ctx, inst, vc_head, Program, &fp->DstReg)) + return 1; + + for (a = 0; a < 2; a++) { + if (parse_fp_scalar_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) + return 1; + } + break; + + + case OP_ALU_BIN: + switch (code) { + case OP_ADD_SAT: + fp->Saturate = 1; + case OP_ADD: + fp->Opcode = FP_OPCODE_ADD; + break; + + case OP_DP3_SAT: + fp->Saturate = 1; + case OP_DP3: + fp->Opcode = FP_OPCODE_DP3; + break; + + case OP_DP4_SAT: + fp->Saturate = 1; + case OP_DP4: + fp->Opcode = FP_OPCODE_DP4; + break; + + case OP_DPH_SAT: + fp->Saturate = 1; + case OP_DPH: + fp->Opcode = FP_OPCODE_DPH; + break; + + case OP_DST_SAT: + fp->Saturate = 1; + case OP_DST: + fp->Opcode = FP_OPCODE_DST; + break; + + case OP_MAX_SAT: + fp->Saturate = 1; + case OP_MAX: + fp->Opcode = FP_OPCODE_MAX; + break; + + case OP_MIN_SAT: + fp->Saturate = 1; + case OP_MIN: + fp->Opcode = FP_OPCODE_MIN; + break; + + case OP_MUL_SAT: + fp->Saturate = 1; + case OP_MUL: + fp->Opcode = FP_OPCODE_MUL; + break; + + case OP_SGE_SAT: + fp->Saturate = 1; + case OP_SGE: + fp->Opcode = FP_OPCODE_SGE; + break; + + case OP_SLT_SAT: + fp->Saturate = 1; + case OP_SLT: + fp->Opcode = FP_OPCODE_SLT; + break; + + case OP_SUB_SAT: + fp->Saturate = 1; + case OP_SUB: + fp->Opcode = FP_OPCODE_SUB; + break; + + case OP_XPD_SAT: + fp->Saturate = 1; + case OP_XPD: + fp->Opcode = FP_OPCODE_XPD; + break; + } + + if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) + return 1; + for (a = 0; a < 2; a++) { + if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) + return 1; + } + break; + + case OP_ALU_TRI: + switch (code) { + case OP_CMP_SAT: + fp->Saturate = 1; + case OP_CMP: + fp->Opcode = FP_OPCODE_CMP; + break; + + case OP_LRP_SAT: + fp->Saturate = 1; + case OP_LRP: + fp->Opcode = FP_OPCODE_LRP; + break; + + case OP_MAD_SAT: + fp->Saturate = 1; + case OP_MAD: + fp->Opcode = FP_OPCODE_MAD; + break; + } + + if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) + return 1; + + for (a = 0; a < 3; a++) { + if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) + return 1; + } + break; + + case OP_ALU_SWZ: + switch (code) { + case OP_SWZ_SAT: + fp->Saturate = 1; + case OP_SWZ: + fp->Opcode = FP_OPCODE_SWZ; + break; + } + if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) + return 1; + + { + GLubyte Swizzle[4]; /* FP's swizzle mask is a GLubyte, while VP's is GLuint */ + GLubyte negateMask; + GLint File, Index; + + if (parse_src_reg(ctx, inst, vc_head, Program, &File, &Index, &rel)) + return 1; + parse_extended_swizzle_mask (inst, Swizzle, &negateMask); + fp->SrcReg[0].File = File; + fp->SrcReg[0].Index = Index; + fp->SrcReg[0].NegateBase = negateMask; + fp->SrcReg[0].Swizzle = (Swizzle[0] << 0 | + Swizzle[1] << 3 | + Swizzle[2] << 6 | + Swizzle[3] << 9); + } + break; + + case OP_TEX_SAMPLE: + switch (code) { + case OP_TEX_SAT: + fp->Saturate = 1; + case OP_TEX: + fp->Opcode = FP_OPCODE_TEX; + break; + + case OP_TXP_SAT: + fp->Saturate = 1; + case OP_TXP: + fp->Opcode = FP_OPCODE_TXP; + break; + + case OP_TXB_SAT: + fp->Saturate = 1; + case OP_TXB: + fp->Opcode = FP_OPCODE_TXB; + break; + } + + if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) + return 1; + + if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) + return 1; + + /* texImageUnit */ + if (parse_texcoord_num (ctx, inst, Program, &texcoord)) + return 1; + fp->TexSrcUnit = texcoord; + + /* texTarget */ + switch (*(*inst)++) { + case TEXTARGET_1D: + fp->TexSrcIdx = TEXTURE_1D_INDEX; + break; + case TEXTARGET_2D: + fp->TexSrcIdx = TEXTURE_2D_INDEX; + break; + case TEXTARGET_3D: + fp->TexSrcIdx = TEXTURE_3D_INDEX; + break; + case TEXTARGET_RECT: + fp->TexSrcIdx = TEXTURE_RECT_INDEX; + break; + case TEXTARGET_CUBE: + fp->TexSrcIdx = TEXTURE_CUBE_INDEX; + break; + case TEXTARGET_SHADOW1D: + case TEXTARGET_SHADOW2D: + case TEXTARGET_SHADOWRECT: + /* TODO ARB_fragment_program_shadow code */ + break; + } + Program->TexturesUsed[texcoord] |= (1<TexSrcIdx); + break; + + case OP_TEX_KIL: + if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) + return 1; + fp->Opcode = FP_OPCODE_KIL; + break; + } + + return 0; +} + +static GLuint +parse_vp_dst_reg(GLcontext * ctx, GLubyte ** inst, + struct var_cache **vc_head, struct arb_program *Program, + struct vp_dst_register *reg ) +{ + GLint file, idx, mask; + + if (parse_masked_dst_reg(ctx, inst, vc_head, Program, &file, &idx, &mask)) + return 1; + + reg->File = file; + reg->Index = idx; + reg->WriteMask = mask; + return 0; +} + +/** + * Handle the parsing out of a masked address register + * + * \param Index - The register index we write to + * \param WriteMask - The mask controlling which components we write (1->write) + * + * \return 0 on sucess, 1 on error + */ +static GLuint +parse_vp_address_reg (GLcontext * ctx, GLubyte ** inst, + struct var_cache **vc_head, + struct arb_program *Program, + struct vp_dst_register *reg) +{ + GLint idx; + + if (parse_address_reg (ctx, inst, vc_head, Program, &idx)) + return 1; + + /* This should be 0x8 */ + (*inst)++; + + reg->File = PROGRAM_ADDRESS; + reg->Index = idx; + + /* Writemask of .x is implied */ + reg->WriteMask = 0x1; + return 0; +} + +/** + */ +static GLuint +parse_vp_vector_src_reg (GLcontext * ctx, GLubyte ** inst, + struct var_cache **vc_head, struct arb_program *Program, + struct vp_src_register *reg ) +{ + + GLint File; + GLint Index; + GLboolean Negate; + GLubyte Swizzle[4]; + GLboolean IsRelOffset; + + /* Grab the sign */ + Negate = (parse_sign (inst) == -1) ? 0xf : 0x0; + + /* And the src reg */ + if (parse_src_reg (ctx, inst, vc_head, Program, &File, &Index, &IsRelOffset)) + return 1; + + /* finally, the swizzle */ + parse_swizzle_mask (inst, Swizzle, 4); + + reg->File = File; + reg->Index = Index; + reg->Swizzle = ((Swizzle[0] << 0) | + (Swizzle[1] << 3) | + (Swizzle[2] << 6) | + (Swizzle[3] << 9)); + reg->Negate = Negate; + reg->RelAddr = IsRelOffset; + return 0; +} + + +static GLuint +parse_vp_scalar_src_reg (GLcontext * ctx, GLubyte ** inst, + struct var_cache **vc_head, struct arb_program *Program, + struct vp_src_register *reg ) +{ + + GLint File; + GLint Index; + GLboolean Negate; + GLubyte Swizzle[4]; + GLboolean IsRelOffset; + + /* Grab the sign */ + Negate = (parse_sign (inst) == -1) ? 0x1 : 0x0; + + /* And the src reg */ + if (parse_src_reg (ctx, inst, vc_head, Program, &File, &Index, &IsRelOffset)) + return 1; + + /* finally, the swizzle */ + parse_swizzle_mask (inst, Swizzle, 1); + + reg->File = File; + reg->Index = Index; + reg->Swizzle = (Swizzle[0] << 0); + reg->Negate = Negate; + reg->RelAddr = IsRelOffset; + return 0; +} + + +/** + * This is a big mother that handles getting opcodes into the instruction + * and handling the src & dst registers for vertex program instructions + */ +static GLuint +parse_vp_instruction (GLcontext * ctx, GLubyte ** inst, + struct var_cache **vc_head, struct arb_program *Program, + struct vp_instruction *vp) +{ + GLint a; + GLubyte type, code; + + /* OP_ALU_{ARL, VECTOR, SCALAR, BINSC, BIN, TRI, SWZ} */ + type = *(*inst)++; + + /* The actual opcode name */ + code = *(*inst)++; + + /* Record the position in the program string for debugging */ + vp->StringPos = Program->Position; + vp->Data = NULL; + vp->SrcReg[0].RelAddr = vp->SrcReg[1].RelAddr = vp->SrcReg[2].RelAddr = 0; + vp->SrcReg[0].Swizzle = SWIZZLE_NOOP; + vp->SrcReg[1].Swizzle = SWIZZLE_NOOP; + vp->SrcReg[2].Swizzle = SWIZZLE_NOOP; + vp->SrcReg[3].Swizzle = SWIZZLE_NOOP; + vp->DstReg.WriteMask = 0xf; + + switch (type) { + /* XXX: */ + case OP_ALU_ARL: + vp->Opcode = VP_OPCODE_ARL; + + /* Remember to set SrcReg.RelAddr; */ + + /* Get the masked address register [dst] */ + if (parse_vp_address_reg(ctx, inst, vc_head, Program, &vp->DstReg)) + return 1; + + vp->DstReg.File = PROGRAM_ADDRESS; + + /* Get a scalar src register */ + if (parse_vp_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) + return 1; + + break; + + case OP_ALU_VECTOR: + switch (code) { + case OP_ABS: + vp->Opcode = VP_OPCODE_ABS; + break; + case OP_FLR: + vp->Opcode = VP_OPCODE_FLR; + break; + case OP_FRC: + vp->Opcode = VP_OPCODE_FRC; + break; + case OP_LIT: + vp->Opcode = VP_OPCODE_LIT; + break; + case OP_MOV: + vp->Opcode = VP_OPCODE_MOV; + break; + } + + if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) + return 1; + + if (parse_vp_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) + return 1; + break; + + case OP_ALU_SCALAR: + switch (code) { + case OP_EX2: + vp->Opcode = VP_OPCODE_EX2; + break; + case OP_EXP: + vp->Opcode = VP_OPCODE_EXP; + break; + case OP_LG2: + vp->Opcode = VP_OPCODE_LG2; + break; + case OP_LOG: + vp->Opcode = VP_OPCODE_LOG; + break; + case OP_RCP: + vp->Opcode = VP_OPCODE_RCP; + break; + case OP_RSQ: + vp->Opcode = VP_OPCODE_RSQ; + break; + } + if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) + return 1; + + if (parse_vp_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) + return 1; + break; + + case OP_ALU_BINSC: + switch (code) { + case OP_POW: + vp->Opcode = VP_OPCODE_POW; + break; + } + if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) + return 1; + + for (a = 0; a < 2; a++) { + if (parse_vp_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) + return 1; + } + break; + + case OP_ALU_BIN: + switch (code) { + case OP_ADD: + vp->Opcode = VP_OPCODE_ADD; + break; + case OP_DP3: + vp->Opcode = VP_OPCODE_DP3; + break; + case OP_DP4: + vp->Opcode = VP_OPCODE_DP4; + break; + case OP_DPH: + vp->Opcode = VP_OPCODE_DPH; + break; + case OP_DST: + vp->Opcode = VP_OPCODE_DST; + break; + case OP_MAX: + vp->Opcode = VP_OPCODE_MAX; + break; + case OP_MIN: + vp->Opcode = VP_OPCODE_MIN; + break; + case OP_MUL: + vp->Opcode = VP_OPCODE_MUL; + break; + case OP_SGE: + vp->Opcode = VP_OPCODE_SGE; + break; + case OP_SLT: + vp->Opcode = VP_OPCODE_SLT; + break; + case OP_SUB: + vp->Opcode = VP_OPCODE_SUB; + break; + case OP_XPD: + vp->Opcode = VP_OPCODE_XPD; + break; + } + if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) + return 1; + + for (a = 0; a < 2; a++) { + if (parse_vp_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) + return 1; + } + break; + + case OP_ALU_TRI: + switch (code) { + case OP_MAD: + vp->Opcode = VP_OPCODE_MAD; + break; + } + + if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) + return 1; + + for (a = 0; a < 3; a++) { + if (parse_vp_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) + return 1; + } + break; + + case OP_ALU_SWZ: + switch (code) { + case OP_SWZ: + vp->Opcode = VP_OPCODE_SWZ; + break; + } + { + GLubyte Swizzle[4]; /* FP's swizzle mask is a GLubyte, while VP's is GLuint */ + GLubyte Negate[4]; + GLboolean RelAddr; + GLint File, Index; + + if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) + return 1; + + if (parse_src_reg(ctx, inst, vc_head, Program, &File, &Index, &RelAddr)) + return 1; + parse_extended_swizzle_mask (inst, Swizzle, Negate); + vp->SrcReg[0].File = File; + vp->SrcReg[0].Index = Index; + vp->SrcReg[0].Negate = (Negate[0] << 0 | + Negate[1] << 1 | + Negate[2] << 2 | + Negate[3] << 3); + vp->SrcReg[0].Swizzle = (Swizzle[0] << 0 | + Swizzle[1] << 3 | + Swizzle[2] << 6 | + Swizzle[3] << 9); + vp->SrcReg[0].RelAddr = RelAddr; + } + break; + } + return 0; +} + +#if DEBUG_PARSING + +static GLvoid +print_state_token (GLint token) +{ + switch (token) { + case STATE_MATERIAL: + fprintf (stderr, "STATE_MATERIAL "); + break; + case STATE_LIGHT: + fprintf (stderr, "STATE_LIGHT "); + break; + + case STATE_LIGHTMODEL_AMBIENT: + fprintf (stderr, "STATE_AMBIENT "); + break; + + case STATE_LIGHTMODEL_SCENECOLOR: + fprintf (stderr, "STATE_SCENECOLOR "); + break; + + case STATE_LIGHTPROD: + fprintf (stderr, "STATE_LIGHTPROD "); + break; + + case STATE_TEXGEN: + fprintf (stderr, "STATE_TEXGEN "); + break; + + case STATE_FOG_COLOR: + fprintf (stderr, "STATE_FOG_COLOR "); + break; + + case STATE_FOG_PARAMS: + fprintf (stderr, "STATE_FOG_PARAMS "); + break; + + case STATE_CLIPPLANE: + fprintf (stderr, "STATE_CLIPPLANE "); + break; + + case STATE_POINT_SIZE: + fprintf (stderr, "STATE_POINT_SIZE "); + break; + + case STATE_POINT_ATTENUATION: + fprintf (stderr, "STATE_ATTENUATION "); + break; + + case STATE_MATRIX: + fprintf (stderr, "STATE_MATRIX "); + break; + + case STATE_MODELVIEW: + fprintf (stderr, "STATE_MODELVIEW "); + break; + + case STATE_PROJECTION: + fprintf (stderr, "STATE_PROJECTION "); + break; + + case STATE_MVP: + fprintf (stderr, "STATE_MVP "); + break; + + case STATE_TEXTURE: + fprintf (stderr, "STATE_TEXTURE "); + break; + + case STATE_PROGRAM: + fprintf (stderr, "STATE_PROGRAM "); + break; + + case STATE_MATRIX_INVERSE: + fprintf (stderr, "STATE_INVERSE "); + break; + + case STATE_MATRIX_TRANSPOSE: + fprintf (stderr, "STATE_TRANSPOSE "); + break; + + case STATE_MATRIX_INVTRANS: + fprintf (stderr, "STATE_INVTRANS "); + break; + + case STATE_AMBIENT: + fprintf (stderr, "STATE_AMBIENT "); + break; + + case STATE_DIFFUSE: + fprintf (stderr, "STATE_DIFFUSE "); + break; + + case STATE_SPECULAR: + fprintf (stderr, "STATE_SPECULAR "); + break; + + case STATE_EMISSION: + fprintf (stderr, "STATE_EMISSION "); + break; + + case STATE_SHININESS: + fprintf (stderr, "STATE_SHININESS "); + break; + + case STATE_HALF: + fprintf (stderr, "STATE_HALF "); + break; + + case STATE_POSITION: + fprintf (stderr, "STATE_POSITION "); + break; + + case STATE_ATTENUATION: + fprintf (stderr, "STATE_ATTENUATION "); + break; + + case STATE_SPOT_DIRECTION: + fprintf (stderr, "STATE_DIRECTION "); + break; + + case STATE_TEXGEN_EYE_S: + fprintf (stderr, "STATE_TEXGEN_EYE_S "); + break; + + case STATE_TEXGEN_EYE_T: + fprintf (stderr, "STATE_TEXGEN_EYE_T "); + break; + + case STATE_TEXGEN_EYE_R: + fprintf (stderr, "STATE_TEXGEN_EYE_R "); + break; + + case STATE_TEXGEN_EYE_Q: + fprintf (stderr, "STATE_TEXGEN_EYE_Q "); + break; + + case STATE_TEXGEN_OBJECT_S: + fprintf (stderr, "STATE_TEXGEN_EYE_S "); + break; + + case STATE_TEXGEN_OBJECT_T: + fprintf (stderr, "STATE_TEXGEN_OBJECT_T "); + break; + + case STATE_TEXGEN_OBJECT_R: + fprintf (stderr, "STATE_TEXGEN_OBJECT_R "); + break; + + case STATE_TEXGEN_OBJECT_Q: + fprintf (stderr, "STATE_TEXGEN_OBJECT_Q "); + break; + + case STATE_TEXENV_COLOR: + fprintf (stderr, "STATE_TEXENV_COLOR "); + break; + + case STATE_DEPTH_RANGE: + fprintf (stderr, "STATE_DEPTH_RANGE "); + break; + + case STATE_VERTEX_PROGRAM: + fprintf (stderr, "STATE_VERTEX_PROGRAM "); + break; + + case STATE_FRAGMENT_PROGRAM: + fprintf (stderr, "STATE_FRAGMENT_PROGRAM "); + break; + + case STATE_ENV: + fprintf (stderr, "STATE_ENV "); + break; + + case STATE_LOCAL: + fprintf (stderr, "STATE_LOCAL "); + break; + + } + fprintf (stderr, "[%d] ", token); +} + + +static GLvoid +debug_variables (GLcontext * ctx, struct var_cache *vc_head, + struct arb_program *Program) +{ + struct var_cache *vc; + GLint a, b; + + fprintf (stderr, "debug_variables, vc_head: %x\n", vc_head); + + /* First of all, print out the contents of the var_cache */ + vc = vc_head; + while (vc) { + fprintf (stderr, "[%x]\n", vc); + switch (vc->type) { + case vt_none: + fprintf (stderr, "UNDEFINED %s\n", vc->name); + break; + case vt_attrib: + fprintf (stderr, "ATTRIB %s\n", vc->name); + fprintf (stderr, " binding: 0x%x\n", vc->attrib_binding); + break; + case vt_param: + fprintf (stderr, "PARAM %s begin: %d len: %d\n", vc->name, + vc->param_binding_begin, vc->param_binding_length); + b = vc->param_binding_begin; + for (a = 0; a < vc->param_binding_length; a++) { + fprintf (stderr, "%s\n", + Program->Parameters->Parameters[a + b].Name); + if (Program->Parameters->Parameters[a + b].Type == STATE) { + print_state_token (Program->Parameters->Parameters[a + b]. + StateIndexes[0]); + print_state_token (Program->Parameters->Parameters[a + b]. + StateIndexes[1]); + print_state_token (Program->Parameters->Parameters[a + b]. + StateIndexes[2]); + print_state_token (Program->Parameters->Parameters[a + b]. + StateIndexes[3]); + print_state_token (Program->Parameters->Parameters[a + b]. + StateIndexes[4]); + print_state_token (Program->Parameters->Parameters[a + b]. + StateIndexes[5]); + } + else + fprintf (stderr, "%f %f %f %f\n", + Program->Parameters->Parameters[a + b].Values[0], + Program->Parameters->Parameters[a + b].Values[1], + Program->Parameters->Parameters[a + b].Values[2], + Program->Parameters->Parameters[a + b].Values[3]); + } + break; + case vt_temp: + fprintf (stderr, "TEMP %s\n", vc->name); + fprintf (stderr, " binding: 0x%x\n", vc->temp_binding); + break; + case vt_output: + fprintf (stderr, "OUTPUT %s\n", vc->name); + fprintf (stderr, " binding: 0x%x\n", vc->output_binding); + break; + case vt_alias: + fprintf (stderr, "ALIAS %s\n", vc->name); + fprintf (stderr, " binding: 0x%x (%s)\n", + vc->alias_binding, vc->alias_binding->name); + break; + } + vc = vc->next; + } +} + +#endif + + +/** + * The main loop for parsing a fragment or vertex program + * + * \return 0 on sucess, 1 on error + */ +static GLint +parse_arb_program (GLcontext * ctx, GLubyte * inst, struct var_cache **vc_head, + struct arb_program *Program) +{ + GLint err = 0; + + Program->MajorVersion = (GLuint) * inst++; + Program->MinorVersion = (GLuint) * inst++; + + while (*inst != END) { + switch (*inst++) { + + case OPTION: + switch (*inst++) { + case ARB_PRECISION_HINT_FASTEST: + Program->PrecisionOption = GL_FASTEST; + break; + + case ARB_PRECISION_HINT_NICEST: + Program->PrecisionOption = GL_NICEST; + break; + + case ARB_FOG_EXP: + Program->FogOption = GL_EXP; + break; + + case ARB_FOG_EXP2: + Program->FogOption = GL_EXP2; + break; + + case ARB_FOG_LINEAR: + Program->FogOption = GL_LINEAR; + break; + + case ARB_POSITION_INVARIANT: + if (Program->Base.Target == GL_VERTEX_PROGRAM_ARB) + Program->HintPositionInvariant = 1; + break; + + case ARB_FRAGMENT_PROGRAM_SHADOW: + if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { + /* TODO ARB_fragment_program_shadow code */ + } + break; + + case ARB_DRAW_BUFFERS: + if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { + /* do nothing for now */ + } + break; + } + break; + + case INSTRUCTION: + Program->Position = parse_position (&inst); + + if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { + + /* Check the instruction count + * XXX: Does END count as an instruction? + */ + if (Program->Base.NumInstructions+1 == MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS) { + _mesa_set_program_error (ctx, Program->Position, + "Max instruction count exceeded!"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Max instruction count exceeded!"); + } + + /* Realloc Program->FPInstructions */ + Program->FPInstructions = + (struct fp_instruction *) _mesa_realloc (Program->FPInstructions, + Program->Base.NumInstructions*sizeof(struct fp_instruction), + (Program->Base.NumInstructions+1)*sizeof (struct fp_instruction)); + + /* parse the current instruction */ + err = parse_fp_instruction (ctx, &inst, vc_head, Program, + &Program->FPInstructions[Program->Base.NumInstructions]); + + } + else { + /* Check the instruction count + * XXX: Does END count as an instruction? + */ + if (Program->Base.NumInstructions+1 == MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS) { + _mesa_set_program_error (ctx, Program->Position, + "Max instruction count exceeded!"); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Max instruction count exceeded!"); + } + + /* Realloc Program->VPInstructions */ + Program->VPInstructions = + (struct vp_instruction *) _mesa_realloc (Program->VPInstructions, + Program->Base.NumInstructions*sizeof(struct vp_instruction), + (Program->Base.NumInstructions +1)*sizeof(struct vp_instruction)); + + /* parse the current instruction */ + err = parse_vp_instruction (ctx, &inst, vc_head, Program, + &Program->VPInstructions[Program->Base.NumInstructions]); + } + + /* increment Program->Base.NumInstructions */ + Program->Base.NumInstructions++; + break; + + case DECLARATION: + err = parse_declaration (ctx, &inst, vc_head, Program); + break; + + default: + break; + } + + if (err) + break; + } + + /* Finally, tag on an OPCODE_END instruction */ + if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { + Program->FPInstructions = + (struct fp_instruction *) _mesa_realloc (Program->FPInstructions, + Program->Base.NumInstructions*sizeof(struct fp_instruction), + (Program->Base.NumInstructions+1)*sizeof(struct fp_instruction)); + + Program->FPInstructions[Program->Base.NumInstructions].Opcode = FP_OPCODE_END; + Program->FPInstructions[Program->Base.NumInstructions].Saturate = 0; + Program->FPInstructions[Program->Base.NumInstructions].DstReg.File = 0xf; + Program->FPInstructions[Program->Base.NumInstructions].SrcReg[0].File = 0xf; + Program->FPInstructions[Program->Base.NumInstructions].SrcReg[1].File = 0xf; + Program->FPInstructions[Program->Base.NumInstructions].SrcReg[2].File = 0xf; + /* YYY Wrong Position in program, whatever, at least not random -> crash + Program->Position = parse_position (&inst); + */ + Program->FPInstructions[Program->Base.NumInstructions].StringPos = Program->Position; + Program->FPInstructions[Program->Base.NumInstructions].Data = NULL; + } + else { + Program->VPInstructions = + (struct vp_instruction *) _mesa_realloc (Program->VPInstructions, + Program->Base.NumInstructions*sizeof(struct vp_instruction), + (Program->Base.NumInstructions+1)*sizeof(struct vp_instruction)); + + Program->VPInstructions[Program->Base.NumInstructions].Opcode = VP_OPCODE_END; + /* YYY Wrong Position in program, whatever, at least not random -> crash + Program->Position = parse_position (&inst); + */ + Program->VPInstructions[Program->Base.NumInstructions].StringPos = Program->Position; + Program->VPInstructions[Program->Base.NumInstructions].Data = NULL; + } + + /* increment Program->Base.NumInstructions */ + Program->Base.NumInstructions++; + + return err; +} + +/* XXX temporary */ +__extension__ static char core_grammar_text[] = +#include "grammar_syn.h" +; + +static int set_reg8 (GLcontext *ctx, grammar id, const byte *name, byte value) +{ + char error_msg[300]; + GLint error_pos; + + if (grammar_set_reg8 (id, name, value)) + return 0; + + grammar_get_last_error ((byte *) error_msg, 300, &error_pos); + _mesa_set_program_error (ctx, error_pos, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, "Grammar Register Error"); + return 1; +} + +static int extension_is_supported (const GLubyte *ext) +{ + const GLubyte *extensions = CALL_GetString(GET_DISPATCH(), (GL_EXTENSIONS)); + const GLubyte *end = extensions + _mesa_strlen ((const char *) extensions); + const GLint ext_len = (GLint)_mesa_strlen ((const char *) ext); + + while (extensions < end) + { + const GLubyte *name_end = (const GLubyte *) strchr ((const char *) extensions, ' '); + if (name_end == NULL) + name_end = end; + if (name_end - extensions == ext_len && _mesa_strncmp ((const char *) ext, + (const char *) extensions, ext_len) == 0) + return 1; + extensions = name_end + 1; + } + + return 0; +} + +static int enable_ext (GLcontext *ctx, grammar id, const byte *name, const byte *extname) +{ + if (extension_is_supported (extname)) + if (set_reg8 (ctx, id, name, 0x01)) + return 1; + return 0; +} + +/** + * This kicks everything off. + * + * \param ctx - The GL Context + * \param str - The program string + * \param len - The program string length + * \param Program - The arb_program struct to return all the parsed info in + * \return 0 on sucess, 1 on error + */ +GLuint +_mesa_parse_arb_program (GLcontext * ctx, const GLubyte * str, GLsizei len, + struct arb_program * program) +{ + GLint a, err, error_pos; + char error_msg[300]; + GLuint parsed_len; + struct var_cache *vc_head; + grammar arbprogram_syn_id; + GLubyte *parsed, *inst; + GLubyte *strz = NULL; + static int arbprogram_syn_is_ok = 0; /* XXX temporary */ + + /* Reset error state */ + _mesa_set_program_error(ctx, -1, NULL); + +#if DEBUG_PARSING + fprintf (stderr, "Loading grammar text!\n"); +#endif + + /* check if the arb_grammar_text (arbprogram.syn) is syntactically correct */ + if (!arbprogram_syn_is_ok) { + grammar grammar_syn_id; + GLint err; + GLuint parsed_len; + byte *parsed; + + grammar_syn_id = grammar_load_from_text ((byte *) core_grammar_text); + if (grammar_syn_id == 0) { + grammar_get_last_error ((byte *) error_msg, 300, &error_pos); + _mesa_set_program_error (ctx, error_pos, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Error loading grammar rule set"); + return 1; + } + + err = grammar_check (grammar_syn_id, (byte *) arb_grammar_text, &parsed, &parsed_len); + + /* NOTE: we cant destroy grammar_syn_id right here because grammar_destroy() can + reset the last error + */ + + if (err == 0) { + grammar_get_last_error ((byte *) error_msg, 300, &error_pos); + _mesa_set_program_error (ctx, error_pos, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, "Error loading grammar rule set"); + + grammar_destroy (grammar_syn_id); + return 1; + } + + grammar_destroy (grammar_syn_id); + + arbprogram_syn_is_ok = 1; + } + + /* create the grammar object */ + arbprogram_syn_id = grammar_load_from_text ((byte *) arb_grammar_text); + if (arbprogram_syn_id == 0) { + grammar_get_last_error ((GLubyte *) error_msg, 300, &error_pos); + _mesa_set_program_error (ctx, error_pos, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, + "Error loading grammer rule set"); + return 1; + } + + /* Set program_target register value */ + if (set_reg8 (ctx, arbprogram_syn_id, (byte *) "program_target", + program->Base.Target == GL_FRAGMENT_PROGRAM_ARB ? 0x10 : 0x20)) { + grammar_destroy (arbprogram_syn_id); + return 1; + } + + /* Enable all active extensions */ + if (enable_ext (ctx, arbprogram_syn_id, + (byte *) "vertex_blend", (byte *) "GL_ARB_vertex_blend") || + enable_ext (ctx, arbprogram_syn_id, + (byte *) "vertex_blend", (byte *) "GL_EXT_vertex_weighting") || + enable_ext (ctx, arbprogram_syn_id, + (byte *) "matrix_palette", (byte *) "GL_ARB_matrix_palette") || + enable_ext (ctx, arbprogram_syn_id, + (byte *) "point_parameters", (byte *) "GL_ARB_point_parameters") || + enable_ext (ctx, arbprogram_syn_id, + (byte *) "point_parameters", (byte *) "GL_EXT_point_parameters") || + enable_ext (ctx, arbprogram_syn_id, + (byte *) "secondary_color", (byte *) "GL_EXT_secondary_color") || + enable_ext (ctx, arbprogram_syn_id, + (byte *) "fog_coord", (byte *) "GL_EXT_fog_coord") || + enable_ext (ctx, arbprogram_syn_id, + (byte *) "texture_rectangle", (byte *) "GL_ARB_texture_rectangle") || + enable_ext (ctx, arbprogram_syn_id, + (byte *) "texture_rectangle", (byte *) "GL_EXT_texture_rectangle") || + enable_ext (ctx, arbprogram_syn_id, + (byte *) "texture_rectangle", (byte *) "GL_NV_texture_rectangle") || + enable_ext (ctx, arbprogram_syn_id, + (byte *) "fragment_program_shadow", (byte *) "GL_ARB_fragment_program_shadow") || + enable_ext (ctx, arbprogram_syn_id, + (byte *) "draw_buffers", (byte *) "GL_ARB_draw_buffers")) { + grammar_destroy (arbprogram_syn_id); + return 1; + } + + /* check for NULL character occurences */ + { + int i; + for (i = 0; i < len; i++) + if (str[i] == '\0') { + _mesa_set_program_error (ctx, i, "invalid character"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Lexical Error"); + + grammar_destroy (arbprogram_syn_id); + return 1; + } + } + + /* copy the program string to a null-terminated string */ + /* XXX should I check for NULL from malloc()? */ + strz = (GLubyte *) _mesa_malloc (len + 1); + _mesa_memcpy (strz, str, len); + strz[len] = '\0'; + +#if DEBUG_PARSING + printf ("Checking Grammar!\n"); +#endif + /* do a fast check on program string - initial production buffer is 4K */ + err = grammar_fast_check (arbprogram_syn_id, strz, &parsed, &parsed_len, 0x1000); + + /* Syntax parse error */ + if (err == 0) { + _mesa_free (strz); + grammar_get_last_error ((GLubyte *) error_msg, 300, &error_pos); + _mesa_set_program_error (ctx, error_pos, error_msg); + _mesa_error (ctx, GL_INVALID_OPERATION, "glProgramStringARB(syntax error)"); + + /* useful for debugging */ + if (0) { + int line, col; + char *s; + printf("Program: %s\n", (char *) strz); + printf("Error Pos: %d\n", ctx->Program.ErrorPos); + s = (char *) _mesa_find_line_column(strz, strz+ctx->Program.ErrorPos, &line, &col); + printf("line %d col %d: %s\n", line, col, s); + } + + grammar_destroy (arbprogram_syn_id); + return 1; + } + +#if DEBUG_PARSING + printf ("Destroying grammer dict [parse retval: %d]\n", err); +#endif + grammar_destroy (arbprogram_syn_id); + + /* Initialize the arb_program struct */ + program->Base.String = strz; + program->Base.NumInstructions = + program->Base.NumTemporaries = + program->Base.NumParameters = + program->Base.NumAttributes = program->Base.NumAddressRegs = 0; + program->Parameters = _mesa_new_parameter_list (); + program->InputsRead = 0; + program->OutputsWritten = 0; + program->Position = 0; + program->MajorVersion = program->MinorVersion = 0; + program->PrecisionOption = GL_DONT_CARE; + program->FogOption = GL_NONE; + program->HintPositionInvariant = GL_FALSE; + for (a = 0; a < MAX_TEXTURE_IMAGE_UNITS; a++) + program->TexturesUsed[a] = 0; + program->NumAluInstructions = + program->NumTexInstructions = + program->NumTexIndirections = 0; + + program->FPInstructions = NULL; + program->VPInstructions = NULL; + + vc_head = NULL; + err = 0; + + /* Start examining the tokens in the array */ + inst = parsed; + + /* Check the grammer rev */ + if (*inst++ != REVISION) { + _mesa_set_program_error (ctx, 0, "Grammar version mismatch"); + _mesa_error (ctx, GL_INVALID_OPERATION, "glProgramStringARB(Grammar verison mismatch)"); + err = 1; + } + else { + /* ignore program target */ + inst++; + + err = parse_arb_program (ctx, inst, &vc_head, program); +#if DEBUG_PARSING + fprintf (stderr, "Symantic analysis returns %d [1 is bad!]\n", err); +#endif + } + + /*debug_variables(ctx, vc_head, program); */ + + /* We're done with the parsed binary array */ + var_cache_destroy (&vc_head); + + _mesa_free (parsed); +#if DEBUG_PARSING + printf ("_mesa_parse_arb_program() done\n"); +#endif + return err; +} diff --git a/reactos/dll/mesa32/src/shader/arbprogparse.h b/reactos/dll/mesa32/src/shader/arbprogparse.h new file mode 100644 index 00000000000..52db0440447 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/arbprogparse.h @@ -0,0 +1,74 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 "context.h" +#include "mtypes.h" +#include "nvvertprog.h" +#include "nvfragprog.h" + +/** + * This is basically a union of the vertex_program and fragment_program + * structs that we can use to parse the program into + * + * XXX: this should go into mtypes.h? + */ +struct arb_program +{ + struct program Base; + struct program_parameter_list *Parameters; + GLuint InputsRead; + GLuint OutputsWritten; + + GLuint Position; /* Just used for error reporting while parsing */ + GLuint MajorVersion; + GLuint MinorVersion; + + /* ARB_vertex_program specifics */ + struct vp_instruction *VPInstructions; + + /* Options currently recognized by the parser */ + /* ARB_fp */ + GLenum PrecisionOption; /* GL_DONT_CARE, GL_NICEST or GL_FASTEST */ + GLenum FogOption; /* GL_NONE, GL_LINEAR, GL_EXP or GL_EXP2 */ + + /* ARB_fp & _vp */ + GLboolean HintPositionInvariant; + + /* ARB_fragment_program specifics */ + struct fp_instruction *FPInstructions; + GLuint TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; + GLuint NumAluInstructions; + GLuint NumTexInstructions; + GLuint NumTexIndirections; +}; + +extern GLuint +_mesa_parse_arb_program( GLcontext *ctx, const GLubyte *str, GLsizei len, + struct arb_program *Program ); + +#endif diff --git a/reactos/dll/mesa32/src/shader/arbprogram.c b/reactos/dll/mesa32/src/shader/arbprogram.c new file mode 100644 index 00000000000..43baab4b0fd --- /dev/null +++ b/reactos/dll/mesa32/src/shader/arbprogram.c @@ -0,0 +1,724 @@ +/* + * 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. + */ + +/** + * \file arbprogram.c + * ARB_vertex/fragment_program state management functions. + * \author Brian Paul + */ + + +#include "glheader.h" +#include "arbprogram.h" +#include "arbfragparse.h" +#include "arbvertparse.h" +#include "context.h" +#include "imports.h" +#include "macros.h" +#include "mtypes.h" +#include "nvprogram.h" +#include "nvfragparse.h" +#include "nvfragprog.h" +#include "nvvertparse.h" +#include "nvvertprog.h" + + +void GLAPIENTRY +_mesa_EnableVertexAttribArrayARB(GLuint index) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (index >= ctx->Const.MaxVertexProgramAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glEnableVertexAttribArrayARB(index)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_ARRAY); + ctx->Array.VertexAttrib[index].Enabled = GL_TRUE; + ctx->Array._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.MaxVertexProgramAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glEnableVertexAttribArrayARB(index)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_ARRAY); + ctx->Array.VertexAttrib[index].Enabled = GL_FALSE; + ctx->Array._Enabled &= ~_NEW_ARRAY_ATTRIB(index); + ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index); +} + + +void GLAPIENTRY +_mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params) +{ + GLfloat fparams[4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + _mesa_GetVertexAttribfvARB(index, pname, fparams); + if (ctx->ErrorValue == GL_NO_ERROR) { + if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { + COPY_4V(params, fparams); + } + else { + params[0] = fparams[0]; + } + } +} + + +void GLAPIENTRY +_mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (index == 0 || index >= MAX_VERTEX_PROGRAM_ATTRIBS) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribfvARB(index)"); + return; + } + + switch (pname) { + case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB: + params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Enabled; + break; + case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB: + params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Size; + break; + case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB: + params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Stride; + break; + case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB: + params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Type; + break; + case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB: + params[0] = ctx->Array.VertexAttrib[index].Normalized; + break; + case GL_CURRENT_VERTEX_ATTRIB_ARB: + FLUSH_CURRENT(ctx, 0); + /* XXX should read: + COPY_4V(params, ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]); + */ + COPY_4V(params, ctx->Current.Attrib[index]); + break; + case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB: + if (!ctx->Extensions.ARB_vertex_buffer_object) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribfvARB(pname)"); + return; + } + params[0] = (GLfloat) ctx->Array.VertexAttrib[index].BufferObj->Name; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribfvARB(pname)"); + return; + } +} + + +void GLAPIENTRY +_mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params) +{ + GLfloat fparams[4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + _mesa_GetVertexAttribfvARB(index, pname, fparams); + if (ctx->ErrorValue == GL_NO_ERROR) { + if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { + COPY_4V_CAST(params, fparams, GLint); /* float to int */ + } + else { + params[0] = (GLint) fparams[0]; + } + } +} + + +void GLAPIENTRY +_mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (index >= ctx->Const.MaxVertexProgramAttribs) { + _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; + } + + *pointer = (GLvoid *) ctx->Array.VertexAttrib[index].Ptr;; +} + + +void GLAPIENTRY +_mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, + const GLvoid *string) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + if (target == GL_VERTEX_PROGRAM_ARB + && ctx->Extensions.ARB_vertex_program) { + struct vertex_program *prog = ctx->VertexProgram.Current; + if (format != GL_PROGRAM_FORMAT_ASCII_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(format)"); + return; + } + _mesa_parse_arb_vertex_program(ctx, target, (const GLubyte *) string, + len, prog); + + if (ctx->Driver.ProgramStringNotify) + ctx->Driver.ProgramStringNotify( ctx, target, &prog->Base ); + } + else if (target == GL_FRAGMENT_PROGRAM_ARB + && ctx->Extensions.ARB_fragment_program) { + struct fragment_program *prog = ctx->FragmentProgram.Current; + if (format != GL_PROGRAM_FORMAT_ASCII_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(format)"); + return; + } + _mesa_parse_arb_fragment_program(ctx, target, (const GLubyte *) string, + len, prog); + + if (ctx->Driver.ProgramStringNotify) + ctx->Driver.ProgramStringNotify( ctx, target, &prog->Base ); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(target)"); + return; + } +} + + +void GLAPIENTRY +_mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index, + GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + _mesa_ProgramEnvParameter4fARB(target, index, (GLfloat) x, (GLfloat) y, + (GLfloat) z, (GLfloat) w); +} + + +void GLAPIENTRY +_mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index, + const GLdouble *params) +{ + _mesa_ProgramEnvParameter4fARB(target, index, (GLfloat) params[0], + (GLfloat) params[1], (GLfloat) params[2], + (GLfloat) params[3]); +} + + +void GLAPIENTRY +_mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index, + GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + if (target == GL_FRAGMENT_PROGRAM_ARB + && ctx->Extensions.ARB_fragment_program) { + if (index >= ctx->Const.MaxFragmentProgramEnvParams) { + _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter(index)"); + return; + } + ASSIGN_4V(ctx->FragmentProgram.Parameters[index], x, y, z, w); + } + else if (target == GL_VERTEX_PROGRAM_ARB + && ctx->Extensions.ARB_vertex_program) { + if (index >= ctx->Const.MaxVertexProgramEnvParams) { + _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter(index)"); + return; + } + ASSIGN_4V(ctx->VertexProgram.Parameters[index], x, y, z, w); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramEnvParameter(target)"); + return; + } +} + + +void GLAPIENTRY +_mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index, + const GLfloat *params) +{ + _mesa_ProgramEnvParameter4fARB(target, index, params[0], params[1], + params[2], params[3]); +} + + +void GLAPIENTRY +_mesa_GetProgramEnvParameterdvARB(GLenum target, GLuint index, + GLdouble *params) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat fparams[4]; + + _mesa_GetProgramEnvParameterfvARB(target, index, fparams); + if (ctx->ErrorValue == GL_NO_ERROR) { + params[0] = fparams[0]; + params[1] = fparams[1]; + params[2] = fparams[2]; + params[3] = fparams[3]; + } +} + + +void GLAPIENTRY +_mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index, + GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + if (!ctx->_CurrentProgram) + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target == GL_FRAGMENT_PROGRAM_ARB + && ctx->Extensions.ARB_fragment_program) { + if (index >= ctx->Const.MaxFragmentProgramEnvParams) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramEnvParameter(index)"); + return; + } + COPY_4V(params, ctx->FragmentProgram.Parameters[index]); + } + else if (target == GL_VERTEX_PROGRAM_ARB + && ctx->Extensions.ARB_vertex_program) { + if (index >= ctx->Const.MaxVertexProgramEnvParams) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramEnvParameter(index)"); + return; + } + COPY_4V(params, ctx->VertexProgram.Parameters[index]); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramEnvParameter(target)"); + return; + } +} + + +/** + * Note, this function is also used by the GL_NV_fragment_program extension. + */ +void GLAPIENTRY +_mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, + GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + GET_CURRENT_CONTEXT(ctx); + struct program *prog; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + if ((target == GL_FRAGMENT_PROGRAM_NV + && ctx->Extensions.NV_fragment_program) || + (target == GL_FRAGMENT_PROGRAM_ARB + && ctx->Extensions.ARB_fragment_program)) { + if (index >= ctx->Const.MaxFragmentProgramLocalParams) { + _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameterARB"); + return; + } + prog = &(ctx->FragmentProgram.Current->Base); + } + else if (target == GL_VERTEX_PROGRAM_ARB + && ctx->Extensions.ARB_vertex_program) { + if (index >= ctx->Const.MaxVertexProgramLocalParams) { + _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameterARB"); + return; + } + prog = &(ctx->VertexProgram.Current->Base); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramLocalParameterARB"); + return; + } + + ASSERT(index < MAX_PROGRAM_LOCAL_PARAMS); + prog->LocalParams[index][0] = x; + prog->LocalParams[index][1] = y; + prog->LocalParams[index][2] = z; + prog->LocalParams[index][3] = w; +} + + +/** + * Note, this function is also used by the GL_NV_fragment_program extension. + */ +void GLAPIENTRY +_mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index, + const GLfloat *params) +{ + _mesa_ProgramLocalParameter4fARB(target, index, params[0], params[1], + params[2], params[3]); +} + + +/** + * Note, this function is also used by the GL_NV_fragment_program extension. + */ +void GLAPIENTRY +_mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index, + GLdouble x, GLdouble y, + GLdouble z, GLdouble w) +{ + _mesa_ProgramLocalParameter4fARB(target, index, (GLfloat) x, (GLfloat) y, + (GLfloat) z, (GLfloat) w); +} + + +/** + * Note, this function is also used by the GL_NV_fragment_program extension. + */ +void GLAPIENTRY +_mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index, + const GLdouble *params) +{ + _mesa_ProgramLocalParameter4fARB(target, index, + (GLfloat) params[0], (GLfloat) params[1], + (GLfloat) params[2], (GLfloat) params[3]); +} + + +/** + * Note, this function is also used by the GL_NV_fragment_program extension. + */ +void GLAPIENTRY +_mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index, + GLfloat *params) +{ + const struct program *prog; + GLuint maxParams; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target == GL_VERTEX_PROGRAM_ARB + && ctx->Extensions.ARB_vertex_program) { + prog = &(ctx->VertexProgram.Current->Base); + maxParams = ctx->Const.MaxVertexProgramLocalParams; + } + else if (target == GL_FRAGMENT_PROGRAM_ARB + && ctx->Extensions.ARB_fragment_program) { + prog = &(ctx->FragmentProgram.Current->Base); + maxParams = ctx->Const.MaxFragmentProgramLocalParams; + } + else if (target == GL_FRAGMENT_PROGRAM_NV + && ctx->Extensions.NV_fragment_program) { + prog = &(ctx->FragmentProgram.Current->Base); + maxParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetProgramLocalParameterARB(target)"); + return; + } + + if (index >= maxParams) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetProgramLocalParameterARB(index)"); + return; + } + + ASSERT(prog); + ASSERT(index < MAX_PROGRAM_LOCAL_PARAMS); + COPY_4V(params, prog->LocalParams[index]); +} + + +/** + * Note, this function is also used by the GL_NV_fragment_program extension. + */ +void GLAPIENTRY +_mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index, + GLdouble *params) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat floatParams[4]; + _mesa_GetProgramLocalParameterfvARB(target, index, floatParams); + if (ctx->ErrorValue == GL_NO_ERROR) { + COPY_4V(params, floatParams); + } +} + + +void GLAPIENTRY +_mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) +{ + struct program *prog; + GET_CURRENT_CONTEXT(ctx); + + if (!ctx->_CurrentProgram) + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target == GL_VERTEX_PROGRAM_ARB + && ctx->Extensions.ARB_vertex_program) { + prog = &(ctx->VertexProgram.Current->Base); + } + else if (target == GL_FRAGMENT_PROGRAM_ARB + && ctx->Extensions.ARB_fragment_program) { + prog = &(ctx->FragmentProgram.Current->Base); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); + return; + } + + ASSERT(prog); + + switch (pname) { + case GL_PROGRAM_LENGTH_ARB: + *params = prog->String ? (GLint)_mesa_strlen((char *) prog->String) : 0; + break; + case GL_PROGRAM_FORMAT_ARB: + *params = prog->Format; + break; + case GL_PROGRAM_BINDING_ARB: + *params = prog->Id; + break; + case GL_PROGRAM_INSTRUCTIONS_ARB: + *params = prog->NumInstructions; + break; + case GL_MAX_PROGRAM_INSTRUCTIONS_ARB: + if (target == GL_VERTEX_PROGRAM_ARB) + *params = ctx->Const.MaxVertexProgramInstructions; + else + *params = ctx->Const.MaxFragmentProgramInstructions; + break; + case GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB: + *params = prog->NumInstructions; + break; + case GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB: + if (target == GL_VERTEX_PROGRAM_ARB) + *params = ctx->Const.MaxVertexProgramInstructions; + else + *params = ctx->Const.MaxFragmentProgramInstructions; + break; + case GL_PROGRAM_TEMPORARIES_ARB: + *params = prog->NumTemporaries; + break; + case GL_MAX_PROGRAM_TEMPORARIES_ARB: + if (target == GL_VERTEX_PROGRAM_ARB) + *params = ctx->Const.MaxVertexProgramTemps; + else + *params = ctx->Const.MaxFragmentProgramTemps; + break; + case GL_PROGRAM_NATIVE_TEMPORARIES_ARB: + /* XXX same as GL_PROGRAM_TEMPORARIES_ARB? */ + *params = prog->NumTemporaries; + break; + case GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB: + /* XXX same as GL_MAX_PROGRAM_TEMPORARIES_ARB? */ + if (target == GL_VERTEX_PROGRAM_ARB) + *params = ctx->Const.MaxVertexProgramTemps; + else + *params = ctx->Const.MaxFragmentProgramTemps; + break; + case GL_PROGRAM_PARAMETERS_ARB: + *params = prog->NumParameters; + break; + case GL_MAX_PROGRAM_PARAMETERS_ARB: + if (target == GL_VERTEX_PROGRAM_ARB) + *params = ctx->Const.MaxVertexProgramLocalParams; + else + *params = ctx->Const.MaxFragmentProgramLocalParams; + break; + case GL_PROGRAM_NATIVE_PARAMETERS_ARB: + /* XXX same as GL_MAX_PROGRAM_PARAMETERS_ARB? */ + *params = prog->NumParameters; + break; + case GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB: + /* XXX same as GL_MAX_PROGRAM_PARAMETERS_ARB? */ + if (target == GL_VERTEX_PROGRAM_ARB) + *params = ctx->Const.MaxVertexProgramLocalParams; + else + *params = ctx->Const.MaxFragmentProgramLocalParams; + break; + case GL_PROGRAM_ATTRIBS_ARB: + *params = prog->NumAttributes; + break; + case GL_MAX_PROGRAM_ATTRIBS_ARB: + if (target == GL_VERTEX_PROGRAM_ARB) + *params = ctx->Const.MaxVertexProgramAttribs; + else + *params = ctx->Const.MaxFragmentProgramAttribs; + break; + case GL_PROGRAM_NATIVE_ATTRIBS_ARB: + /* XXX same as GL_PROGRAM_ATTRIBS_ARB? */ + *params = prog->NumAttributes; + break; + case GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB: + /* XXX same as GL_MAX_PROGRAM_ATTRIBS_ARB? */ + if (target == GL_VERTEX_PROGRAM_ARB) + *params = ctx->Const.MaxVertexProgramAttribs; + else + *params = ctx->Const.MaxFragmentProgramAttribs; + break; + case GL_PROGRAM_ADDRESS_REGISTERS_ARB: + *params = prog->NumAddressRegs; + break; + case GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB: + if (target == GL_VERTEX_PROGRAM_ARB) + *params = ctx->Const.MaxVertexProgramAddressRegs; + else + *params = ctx->Const.MaxFragmentProgramAddressRegs; + break; + case GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: + /* XXX same as GL_PROGRAM_ADDRESS_REGISTERS_ARB? */ + *params = prog->NumAddressRegs; + break; + case GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: + /* XXX same as GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB? */ + if (target == GL_VERTEX_PROGRAM_ARB) + *params = ctx->Const.MaxVertexProgramAddressRegs; + else + *params = ctx->Const.MaxFragmentProgramAddressRegs; + break; + case GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB: + if (target == GL_VERTEX_PROGRAM_ARB) + *params = ctx->Const.MaxVertexProgramLocalParams; + else + *params = ctx->Const.MaxFragmentProgramLocalParams; + break; + case GL_MAX_PROGRAM_ENV_PARAMETERS_ARB: + if (target == GL_VERTEX_PROGRAM_ARB) + *params = ctx->Const.MaxVertexProgramEnvParams; + else + *params = ctx->Const.MaxFragmentProgramEnvParams; + break; + case GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB: + if (ctx->Driver.IsProgramNative) + *params = ctx->Driver.IsProgramNative( ctx, target, prog ); + else + *params = GL_TRUE; + break; + + /* + * The following apply to fragment programs only. + */ + case GL_PROGRAM_ALU_INSTRUCTIONS_ARB: + case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: + if (target != GL_FRAGMENT_PROGRAM_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); + return; + } + *params = ctx->FragmentProgram.Current->NumAluInstructions; + break; + case GL_PROGRAM_TEX_INSTRUCTIONS_ARB: + case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: + if (target != GL_FRAGMENT_PROGRAM_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); + return; + } + *params = ctx->FragmentProgram.Current->NumTexInstructions; + break; + case GL_PROGRAM_TEX_INDIRECTIONS_ARB: + case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: + if (target != GL_FRAGMENT_PROGRAM_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); + return; + } + *params = ctx->FragmentProgram.Current->NumTexIndirections; + break; + case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB: + case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: + if (target != GL_FRAGMENT_PROGRAM_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); + return; + } + *params = ctx->Const.MaxFragmentProgramAluInstructions; + break; + case GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB: + case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: + if (target != GL_FRAGMENT_PROGRAM_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); + return; + } + *params = ctx->Const.MaxFragmentProgramTexInstructions; + break; + case GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB: + case GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: + if (target != GL_FRAGMENT_PROGRAM_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); + return; + } + *params = ctx->Const.MaxFragmentProgramTexIndirections; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(pname)"); + return; + } +} + + +void GLAPIENTRY +_mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string) +{ + struct program *prog; + GET_CURRENT_CONTEXT(ctx); + + if (!ctx->_CurrentProgram) + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target == GL_VERTEX_PROGRAM_ARB) { + prog = &(ctx->VertexProgram.Current->Base); + } + else if (target == GL_FRAGMENT_PROGRAM_ARB) { + prog = &(ctx->FragmentProgram.Current->Base); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringARB(target)"); + return; + } + + ASSERT(prog); + + if (pname != GL_PROGRAM_STRING_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringARB(pname)"); + return; + } + + MEMCPY(string, prog->String, _mesa_strlen((char *) prog->String)); +} + diff --git a/reactos/dll/mesa32/src/shader/arbprogram.h b/reactos/dll/mesa32/src/shader/arbprogram.h new file mode 100644 index 00000000000..e1b99ab686f --- /dev/null +++ b/reactos/dll/mesa32/src/shader/arbprogram.h @@ -0,0 +1,128 @@ +/* + * 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. + */ + + +#ifndef ARBPROGRAM_H +#define ARBPROGRAM_H + + +extern void GLAPIENTRY +_mesa_EnableVertexAttribArrayARB(GLuint index); + + +extern void GLAPIENTRY +_mesa_DisableVertexAttribArrayARB(GLuint index); + + +extern void GLAPIENTRY +_mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params); + + +extern void GLAPIENTRY +_mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params); + + +extern void GLAPIENTRY +_mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params); + + +extern void GLAPIENTRY +_mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer); + + +extern void GLAPIENTRY +_mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, + const GLvoid *string); + + +extern void GLAPIENTRY +_mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index, + GLdouble x, GLdouble y, GLdouble z, GLdouble w); + + +extern void GLAPIENTRY +_mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index, + const GLdouble *params); + + +extern void GLAPIENTRY +_mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index, + GLfloat x, GLfloat y, GLfloat z, GLfloat w); + + +extern void GLAPIENTRY +_mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index, + const GLfloat *params); + + +extern void GLAPIENTRY +_mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index, + GLdouble x, GLdouble y, + GLdouble z, GLdouble w); + + +extern void GLAPIENTRY +_mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index, + const GLdouble *params); + + +extern void GLAPIENTRY +_mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, + GLfloat x, GLfloat y, GLfloat z, GLfloat w); + + +extern void GLAPIENTRY +_mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index, + const GLfloat *params); + + +extern void GLAPIENTRY +_mesa_GetProgramEnvParameterdvARB(GLenum target, GLuint index, + GLdouble *params); + + +extern void GLAPIENTRY +_mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index, + GLfloat *params); + + +extern void GLAPIENTRY +_mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index, + GLdouble *params); + + +extern void GLAPIENTRY +_mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index, + GLfloat *params); + + +extern void GLAPIENTRY +_mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params); + + +extern void GLAPIENTRY +_mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string); + + +#endif diff --git a/reactos/dll/mesa32/src/shader/arbprogram_syn.h b/reactos/dll/mesa32/src/shader/arbprogram_syn.h new file mode 100644 index 00000000000..c67afc67db9 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/arbprogram_syn.h @@ -0,0 +1,1327 @@ +".syntax program;\n" +".emtcode REVISION 0x09\n" +".emtcode FRAGMENT_PROGRAM 0x01\n" +".emtcode VERTEX_PROGRAM 0x02\n" +".emtcode OPTION 0x01\n" +".emtcode INSTRUCTION 0x02\n" +".emtcode DECLARATION 0x03\n" +".emtcode END 0x04\n" +".emtcode ARB_PRECISION_HINT_FASTEST 0x00\n" +".emtcode ARB_PRECISION_HINT_NICEST 0x01\n" +".emtcode ARB_FOG_EXP 0x02\n" +".emtcode ARB_FOG_EXP2 0x03\n" +".emtcode ARB_FOG_LINEAR 0x04\n" +".emtcode ARB_POSITION_INVARIANT 0x05\n" +".emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x06\n" +".emtcode ARB_DRAW_BUFFERS 0x07\n" +".emtcode OP_ALU_INST 0x00\n" +".emtcode OP_TEX_INST 0x01\n" +".emtcode OP_ALU_VECTOR 0x00\n" +".emtcode OP_ALU_SCALAR 0x01\n" +".emtcode OP_ALU_BINSC 0x02\n" +".emtcode OP_ALU_BIN 0x03\n" +".emtcode OP_ALU_TRI 0x04\n" +".emtcode OP_ALU_SWZ 0x05\n" +".emtcode OP_TEX_SAMPLE 0x06\n" +".emtcode OP_TEX_KIL 0x07\n" +".emtcode OP_ALU_ARL 0x08\n" +".emtcode OP_ABS 0x00\n" +".emtcode OP_ABS_SAT 0x1B\n" +".emtcode OP_FLR 0x09\n" +".emtcode OP_FLR_SAT 0x26\n" +".emtcode OP_FRC 0x0A\n" +".emtcode OP_FRC_SAT 0x27\n" +".emtcode OP_LIT 0x0C\n" +".emtcode OP_LIT_SAT 0x2A\n" +".emtcode OP_MOV 0x11\n" +".emtcode OP_MOV_SAT 0x30\n" +".emtcode OP_COS 0x1F\n" +".emtcode OP_COS_SAT 0x20\n" +".emtcode OP_EX2 0x07\n" +".emtcode OP_EX2_SAT 0x25\n" +".emtcode OP_LG2 0x0B\n" +".emtcode OP_LG2_SAT 0x29\n" +".emtcode OP_RCP 0x14\n" +".emtcode OP_RCP_SAT 0x33\n" +".emtcode OP_RSQ 0x15\n" +".emtcode OP_RSQ_SAT 0x34\n" +".emtcode OP_SIN 0x38\n" +".emtcode OP_SIN_SAT 0x39\n" +".emtcode OP_SCS 0x35\n" +".emtcode OP_SCS_SAT 0x36\n" +".emtcode OP_POW 0x13\n" +".emtcode OP_POW_SAT 0x32\n" +".emtcode OP_ADD 0x01\n" +".emtcode OP_ADD_SAT 0x1C\n" +".emtcode OP_DP3 0x03\n" +".emtcode OP_DP3_SAT 0x21\n" +".emtcode OP_DP4 0x04\n" +".emtcode OP_DP4_SAT 0x22\n" +".emtcode OP_DPH 0x05\n" +".emtcode OP_DPH_SAT 0x23\n" +".emtcode OP_DST 0x06\n" +".emtcode OP_DST_SAT 0x24\n" +".emtcode OP_MAX 0x0F\n" +".emtcode OP_MAX_SAT 0x2E\n" +".emtcode OP_MIN 0x10\n" +".emtcode OP_MIN_SAT 0x2F\n" +".emtcode OP_MUL 0x12\n" +".emtcode OP_MUL_SAT 0x31\n" +".emtcode OP_SGE 0x16\n" +".emtcode OP_SGE_SAT 0x37\n" +".emtcode OP_SLT 0x17\n" +".emtcode OP_SLT_SAT 0x3A\n" +".emtcode OP_SUB 0x18\n" +".emtcode OP_SUB_SAT 0x3B\n" +".emtcode OP_XPD 0x1A\n" +".emtcode OP_XPD_SAT 0x43\n" +".emtcode OP_CMP 0x1D\n" +".emtcode OP_CMP_SAT 0x1E\n" +".emtcode OP_LRP 0x2B\n" +".emtcode OP_LRP_SAT 0x2C\n" +".emtcode OP_MAD 0x0E\n" +".emtcode OP_MAD_SAT 0x2D\n" +".emtcode OP_SWZ 0x19\n" +".emtcode OP_SWZ_SAT 0x3C\n" +".emtcode OP_TEX 0x3D\n" +".emtcode OP_TEX_SAT 0x3E\n" +".emtcode OP_TXB 0x3F\n" +".emtcode OP_TXB_SAT 0x40\n" +".emtcode OP_TXP 0x41\n" +".emtcode OP_TXP_SAT 0x42\n" +".emtcode OP_KIL 0x28\n" +".emtcode OP_ARL 0x02\n" +".emtcode OP_EXP 0x08\n" +".emtcode OP_LOG 0x0D\n" +".emtcode FRAGMENT_ATTRIB_COLOR 0x01\n" +".emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02\n" +".emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03\n" +".emtcode FRAGMENT_ATTRIB_POSITION 0x04\n" +".emtcode VERTEX_ATTRIB_POSITION 0x01\n" +".emtcode VERTEX_ATTRIB_WEIGHT 0x02\n" +".emtcode VERTEX_ATTRIB_NORMAL 0x03\n" +".emtcode VERTEX_ATTRIB_COLOR 0x04\n" +".emtcode VERTEX_ATTRIB_FOGCOORD 0x05\n" +".emtcode VERTEX_ATTRIB_TEXCOORD 0x06\n" +".emtcode VERTEX_ATTRIB_MATRIXINDEX 0x07\n" +".emtcode VERTEX_ATTRIB_GENERIC 0x08\n" +".emtcode FRAGMENT_RESULT_COLOR 0x01\n" +".emtcode FRAGMENT_RESULT_DEPTH 0x02\n" +".emtcode VERTEX_RESULT_POSITION 0x01\n" +".emtcode VERTEX_RESULT_COLOR 0x02\n" +".emtcode VERTEX_RESULT_FOGCOORD 0x03\n" +".emtcode VERTEX_RESULT_POINTSIZE 0x04\n" +".emtcode VERTEX_RESULT_TEXCOORD 0x05\n" +".emtcode TEXTARGET_1D 0x01\n" +".emtcode TEXTARGET_2D 0x02\n" +".emtcode TEXTARGET_3D 0x03\n" +".emtcode TEXTARGET_RECT 0x04\n" +".emtcode TEXTARGET_CUBE 0x05\n" +".emtcode TEXTARGET_SHADOW1D 0x06\n" +".emtcode TEXTARGET_SHADOW2D 0x07\n" +".emtcode TEXTARGET_SHADOWRECT 0x08\n" +".emtcode FACE_FRONT 0x00\n" +".emtcode FACE_BACK 0x01\n" +".emtcode COLOR_PRIMARY 0x00\n" +".emtcode COLOR_SECONDARY 0x01\n" +".emtcode COMPONENT_X 0x00\n" +".emtcode COMPONENT_Y 0x01\n" +".emtcode COMPONENT_Z 0x02\n" +".emtcode COMPONENT_W 0x03\n" +".emtcode COMPONENT_0 0x04\n" +".emtcode COMPONENT_1 0x05\n" +".emtcode ARRAY_INDEX_ABSOLUTE 0x00\n" +".emtcode ARRAY_INDEX_RELATIVE 0x01\n" +".emtcode MATRIX_MODELVIEW 0x01\n" +".emtcode MATRIX_PROJECTION 0x02\n" +".emtcode MATRIX_MVP 0x03\n" +".emtcode MATRIX_TEXTURE 0x04\n" +".emtcode MATRIX_PALETTE 0x05\n" +".emtcode MATRIX_PROGRAM 0x06\n" +".emtcode MATRIX_MODIFIER_IDENTITY 0x00\n" +".emtcode MATRIX_MODIFIER_INVERSE 0x01\n" +".emtcode MATRIX_MODIFIER_TRANSPOSE 0x02\n" +".emtcode MATRIX_MODIFIER_INVTRANS 0x03\n" +".emtcode CONSTANT_SCALAR 0x01\n" +".emtcode CONSTANT_VECTOR 0x02\n" +".emtcode PROGRAM_PARAM_ENV 0x01\n" +".emtcode PROGRAM_PARAM_LOCAL 0x02\n" +".emtcode REGISTER_ATTRIB 0x01\n" +".emtcode REGISTER_PARAM 0x02\n" +".emtcode REGISTER_RESULT 0x03\n" +".emtcode REGISTER_ESTABLISHED_NAME 0x04\n" +".emtcode PARAM_NULL 0x00\n" +".emtcode PARAM_ARRAY_ELEMENT 0x01\n" +".emtcode PARAM_STATE_ELEMENT 0x02\n" +".emtcode PARAM_PROGRAM_ELEMENT 0x03\n" +".emtcode PARAM_PROGRAM_ELEMENTS 0x04\n" +".emtcode PARAM_CONSTANT 0x05\n" +".emtcode STATE_MATERIAL 0x01\n" +".emtcode STATE_LIGHT 0x02\n" +".emtcode STATE_LIGHT_MODEL 0x03\n" +".emtcode STATE_LIGHT_PROD 0x04\n" +".emtcode STATE_FOG 0x05\n" +".emtcode STATE_MATRIX_ROWS 0x06\n" +".emtcode STATE_TEX_ENV 0x07\n" +".emtcode STATE_DEPTH 0x08\n" +".emtcode STATE_TEX_GEN 0x09\n" +".emtcode STATE_CLIP_PLANE 0x0A\n" +".emtcode STATE_POINT 0x0B\n" +".emtcode MATERIAL_AMBIENT 0x01\n" +".emtcode MATERIAL_DIFFUSE 0x02\n" +".emtcode MATERIAL_SPECULAR 0x03\n" +".emtcode MATERIAL_EMISSION 0x04\n" +".emtcode MATERIAL_SHININESS 0x05\n" +".emtcode LIGHT_AMBIENT 0x01\n" +".emtcode LIGHT_DIFFUSE 0x02\n" +".emtcode LIGHT_SPECULAR 0x03\n" +".emtcode LIGHT_POSITION 0x04\n" +".emtcode LIGHT_ATTENUATION 0x05\n" +".emtcode LIGHT_HALF 0x06\n" +".emtcode LIGHT_SPOT_DIRECTION 0x07\n" +".emtcode LIGHT_MODEL_AMBIENT 0x01\n" +".emtcode LIGHT_MODEL_SCENECOLOR 0x02\n" +".emtcode LIGHT_PROD_AMBIENT 0x01\n" +".emtcode LIGHT_PROD_DIFFUSE 0x02\n" +".emtcode LIGHT_PROD_SPECULAR 0x03\n" +".emtcode TEX_ENV_COLOR 0x01\n" +".emtcode TEX_GEN_EYE 0x01\n" +".emtcode TEX_GEN_OBJECT 0x02\n" +".emtcode FOG_COLOR 0x01\n" +".emtcode FOG_PARAMS 0x02\n" +".emtcode DEPTH_RANGE 0x01\n" +".emtcode POINT_SIZE 0x01\n" +".emtcode POINT_ATTENUATION 0x02\n" +".emtcode ATTRIB 0x01\n" +".emtcode PARAM 0x02\n" +".emtcode TEMP 0x03\n" +".emtcode OUTPUT 0x04\n" +".emtcode ALIAS 0x05\n" +".emtcode ADDRESS 0x06\n" +".errtext UNKNOWN_PROGRAM_SIGNATURE \"1001: '$e_signature$': unknown program signature\"\n" +".errtext MISSING_END_OR_INVALID_STATEMENT \"1002: '$e_statement$': invalid statement\"\n" +".errtext CODE_AFTER_END \"1003: '$e_statement$': code after 'END' keyword\"\n" +".errtext INVALID_PROGRAM_OPTION \"1004: '$e_identifier$': invalid program option\"\n" +".errtext EXT_SWIZ_COMP_EXPECTED \"1005: extended swizzle component expected but '$e_token$' found\"\n" +".errtext TEX_TARGET_EXPECTED \"1006: texture target expected but '$e_token$' found\"\n" +".errtext TEXTURE_EXPECTED \"1007: 'texture' expected but '$e_identifier$' found\"\n" +".errtext SOURCE_REGISTER_EXPECTED \"1008: source register expected but '$e_token$' found\"\n" +".errtext DESTINATION_REGISTER_EXPECTED \"1009: destination register expected but '$e_token$' found\"\n" +".errtext INVALID_ADDRESS_COMPONENT \"1010: '$e_identifier$': invalid address component\"\n" +".errtext INVALID_ADDRESS_WRITEMASK \"1011: '$e_identifier$': invalid address writemask\"\n" +".errtext INVALID_COMPONENT \"1012: '$e_charordigit$': invalid component\"\n" +".errtext INVALID_SUFFIX \"1013: '$e_identifier$': invalid suffix\"\n" +".errtext INVALID_WRITEMASK \"1014: '$e_identifier$': invalid writemask\"\n" +".errtext FRAGMENT_EXPECTED \"1015: 'fragment' expected but '$e_identifier$' found\"\n" +".errtext VERTEX_EXPECTED \"1016: 'vertex' expected but '$e_identifier$' found\"\n" +".errtext INVALID_FRAGMENT_PROPERTY \"1017: '$e_identifier$': invalid fragment property\"\n" +".errtext INVALID_VERTEX_PROPERTY \"1018: '$e_identifier$': invalid vertex property\"\n" +".errtext INVALID_STATE_PROPERTY \"1019: '$e_identifier$': invalid state property\"\n" +".errtext INVALID_MATERIAL_PROPERTY \"1020: '$e_identifier$': invalid material property\"\n" +".errtext INVALID_LIGHT_PROPERTY \"1021: '$e_identifier$': invalid light property\"\n" +".errtext INVALID_SPOT_PROPERTY \"1022: '$e_identifier$': invalid spot property\"\n" +".errtext INVALID_LIGHTMODEL_PROPERTY \"1023: '$e_identifier$': invalid light model property\"\n" +".errtext INVALID_LIGHTPROD_PROPERTY \"1024: '$e_identifier$': invalid light product property\"\n" +".errtext INVALID_TEXENV_PROPERTY \"1025: '$e_identifier$': invalid texture environment property\"\n" +".errtext INVALID_TEXGEN_PROPERTY \"1026: '$e_identifier$': invalid texture generating property\"\n" +".errtext INVALID_TEXGEN_COORD \"1027: '$e_identifier$': invalid texture generating coord\"\n" +".errtext INVALID_FOG_PROPERTY \"1028: '$e_identifier$': invalid fog property\"\n" +".errtext INVALID_DEPTH_PROPERTY \"1029: '$e_identifier$': invalid depth property\"\n" +".errtext INVALID_CLIPPLANE_PROPERTY \"1030: '$e_identifier$': invalid clip plane property\"\n" +".errtext INVALID_POINT_PROPERTY \"1031: '$e_identifier$': invalid point property\"\n" +".errtext MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED \"1032: matrix row selector or modifier expected but '$e_token$' found\"\n" +".errtext INVALID_MATRIX_NAME \"1033: '$e_identifier$': invalid matrix name\"\n" +".errtext INVALID_PROGRAM_PROPERTY \"1034: '$e_identifier$': invalid program property\"\n" +".errtext RESULT_EXPECTED \"1035: 'result' expected but '$e_token$' found\"\n" +".errtext INVALID_RESULT_PROPERTY \"1036: '$e_identifier$': invalid result property\"\n" +".errtext INVALID_FACE_PROPERTY \"1037: '$e_identifier$': invalid face property\"\n" +".errtext INVALID_COLOR_PROPERTY \"1038: '$e_identifier$': invalid color property\"\n" +".errtext IDENTIFIER_EXPECTED \"1039: identifier expected but '$e_token$' found\"\n" +".errtext RESERVED_KEYWORD \"1040: use of reserved keyword as an identifier\"\n" +".errtext INTEGER_EXPECTED \"1041: integer value expected but '$e_token$' found\"\n" +".errtext MISSING_SEMICOLON \"1042: ';' expected but '$e_token$' found\"\n" +".errtext MISSING_COMMA \"1043: ',' expected but '$e_token$' found\"\n" +".errtext MISSING_LBRACKET \"1044: '[' expected but '$e_token$' found\"\n" +".errtext MISSING_RBRACKET \"1045: ']' expected but '$e_token$' found\"\n" +".errtext MISSING_DOT \"1046: '.' expected but '$e_token$' found\"\n" +".errtext MISSING_EQUAL \"1047: '=' expected but '$e_token$' found\"\n" +".errtext MISSING_LBRACE \"1048: '{' expected but '$e_token$' found\"\n" +".errtext MISSING_RBRACE \"1049: '}' expected but '$e_token$' found\"\n" +".errtext MISSING_DOTDOT \"1050: '..' expected but '$e_token$' found\"\n" +".errtext MISSING_FRACTION_OR_EXPONENT \"1051: missing fraction part or exponent\"\n" +".errtext MISSING_DOT_OR_EXPONENT \"1052: missing '.' or exponent\"\n" +".errtext EXPONENT_VALUE_EXPECTED \"1053: exponent value expected\"\n" +".errtext INTEGER_OUT_OF_RANGE \"1054: integer value out of range\"\n" +".errtext OPERATION_NEEDS_DESTINATION_VARIABLE \"1055: operation needs destination variable\"\n" +".errtext OPERATION_NEEDS_SOURCE_VARIABLE \"1056: operation needs source variable\"\n" +".errtext ADDRESS_REGISTER_EXPECTED \"1057: address register expected but '$e_token$' found\"\n" +".errtext ADDRESS_REGISTER_OR_INTEGER_EXPECTED \"1058: address register or integer literal expected but '$e_token$' found\"\n" +".regbyte vertex_blend 0x00\n" +".regbyte matrix_palette 0x00\n" +".regbyte point_parameters 0x00\n" +".regbyte secondary_color 0x00\n" +".regbyte fog_coord 0x00\n" +".regbyte texture_rectangle 0x00\n" +".regbyte fragment_program_shadow 0x00\n" +".regbyte draw_buffers 0x00\n" +".regbyte ARB_precision_hint_fastest 0x00\n" +".regbyte ARB_precision_hint_nicest 0x00\n" +".regbyte ARB_fog_exp 0x00\n" +".regbyte ARB_fog_exp2 0x00\n" +".regbyte ARB_fog_linear 0x00\n" +".regbyte ARB_position_invariant 0x00\n" +".regbyte ARB_fragment_program_shadow 0x00\n" +".regbyte ARB_draw_buffers 0x00\n" +".regbyte program_target 0x00\n" +"program\n" +" programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;\n" +"programs\n" +" .if (program_target == 0x10) frag_program_1_0 .emit FRAGMENT_PROGRAM .emit 0x01 .emit 0x00 .or\n" +" .if (program_target == 0x20) vert_program_1_0 .emit VERTEX_PROGRAM .emit 0x01 .emit 0x00;\n" +"frag_program_1_0\n" +" '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'f' .and 'p' .and '1' .and '.' .and '0' .and\n" +" optional_space .and fp_optionSequence .and fp_statementSequence .and\n" +" \"END\" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and\n" +" '\\0' .error CODE_AFTER_END;\n" +"vert_program_1_0\n" +" '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'v' .and 'p' .and '1' .and '.' .and '0' .and\n" +" optional_space .and vp_optionSequence .and vp_statementSequence .and\n" +" \"END\" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and\n" +" '\\0' .error CODE_AFTER_END;\n" +"fp_optionSequence\n" +" .loop fp_option;\n" +"vp_optionSequence\n" +" .loop vp_option;\n" +"fp_option\n" +" \"OPTION\" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and\n" +" fp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;\n" +"vp_option\n" +" \"OPTION\" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and\n" +" vp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;\n" +"fp_optionString\n" +" .if (ARB_precision_hint_nicest == 0x00) \"ARB_precision_hint_fastest\"\n" +" .emit ARB_PRECISION_HINT_FASTEST .load ARB_precision_hint_fastest 0x01 .or\n" +" .if (ARB_precision_hint_fastest == 0x00) \"ARB_precision_hint_nicest\"\n" +" .emit ARB_PRECISION_HINT_NICEST .load ARB_precision_hint_nicest 0x01 .or\n" +" fp_ARB_fog_exp .emit ARB_FOG_EXP .load ARB_fog_exp 0x01 .or\n" +" fp_ARB_fog_exp2 .emit ARB_FOG_EXP2 .load ARB_fog_exp2 0x01 .or\n" +" fp_ARB_fog_linear .emit ARB_FOG_LINEAR .load ARB_fog_linear 0x01 .or\n" +" .if (fragment_program_shadow != 0x00) \"ARB_fragment_program_shadow\"\n" +" .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01 .or\n" +" .if (draw_buffers != 0x00) \"ARB_draw_buffers\" .emit ARB_DRAW_BUFFERS\n" +" .load ARB_draw_buffers 0x01;\n" +"vp_optionString\n" +" \"ARB_position_invariant\" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;\n" +"fp_ARB_fog_exp\n" +" .if (ARB_fog_exp2 == 0x00) .true .and .if (ARB_fog_linear == 0x00) \"ARB_fog_exp\";\n" +"fp_ARB_fog_exp2\n" +" .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_linear == 0x00) \"ARB_fog_exp2\";\n" +"fp_ARB_fog_linear\n" +" .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_exp2 == 0x00) \"ARB_fog_linear\";\n" +"fp_statementSequence\n" +" .loop fp_statement;\n" +"vp_statementSequence\n" +" .loop vp_statement;\n" +"fp_statement\n" +" fp_statement_1 .or fp_statement_2;\n" +"vp_statement\n" +" vp_statement_1 .or vp_statement_2;\n" +"fp_statement_1\n" +" fp_instruction .emit INSTRUCTION .emit $ .and semicolon;\n" +"fp_statement_2\n" +" fp_namingStatement .emit DECLARATION .and semicolon;\n" +"vp_statement_1\n" +" vp_instruction .emit INSTRUCTION .emit $ .and semicolon;\n" +"vp_statement_2\n" +" vp_namingStatement .emit DECLARATION .and semicolon;\n" +"fp_instruction\n" +" ALUInstruction .emit OP_ALU_INST .or\n" +" TexInstruction .emit OP_TEX_INST;\n" +"vp_instruction\n" +" ARL_instruction .emit OP_ALU_ARL .or\n" +" vp_VECTORop_instruction .emit OP_ALU_VECTOR .or\n" +" vp_SCALARop_instruction .emit OP_ALU_SCALAR .or\n" +" vp_BINSCop_instruction .emit OP_ALU_BINSC .or\n" +" vp_BINop_instruction .emit OP_ALU_BIN .or\n" +" vp_TRIop_instruction .emit OP_ALU_TRI .or\n" +" vp_SWZ_instruction .emit OP_ALU_SWZ;\n" +"ALUInstruction\n" +" fp_VECTORop_instruction .emit OP_ALU_VECTOR .or\n" +" fp_SCALARop_instruction .emit OP_ALU_SCALAR .or\n" +" fp_BINSCop_instruction .emit OP_ALU_BINSC .or\n" +" fp_BINop_instruction .emit OP_ALU_BIN .or\n" +" fp_TRIop_instruction .emit OP_ALU_TRI .or\n" +" fp_SWZ_instruction .emit OP_ALU_SWZ;\n" +"TexInstruction\n" +" SAMPLE_instruction .emit OP_TEX_SAMPLE .or\n" +" KIL_instruction .emit OP_TEX_KIL;\n" +"ARL_instruction\n" +" \"ARL\" .emit OP_ARL .and space_dst .and maskedAddrReg .and comma .and vp_scalarSrcReg;\n" +"fp_VECTORop_instruction\n" +" fp_VECTORop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg;\n" +"vp_VECTORop_instruction\n" +" vp_VECTORop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg;\n" +"fp_VECTORop\n" +" \"ABS\" .emit OP_ABS .or \"ABS_SAT\" .emit OP_ABS_SAT .or\n" +" \"FLR\" .emit OP_FLR .or \"FLR_SAT\" .emit OP_FLR_SAT .or\n" +" \"FRC\" .emit OP_FRC .or \"FRC_SAT\" .emit OP_FRC_SAT .or\n" +" \"LIT\" .emit OP_LIT .or \"LIT_SAT\" .emit OP_LIT_SAT .or\n" +" \"MOV\" .emit OP_MOV .or \"MOV_SAT\" .emit OP_MOV_SAT;\n" +"vp_VECTORop\n" +" \"ABS\" .emit OP_ABS .or\n" +" \"FLR\" .emit OP_FLR .or\n" +" \"FRC\" .emit OP_FRC .or\n" +" \"LIT\" .emit OP_LIT .or\n" +" \"MOV\" .emit OP_MOV;\n" +"fp_SCALARop_instruction\n" +" fp_SCALARop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg;\n" +"vp_SCALARop_instruction\n" +" vp_SCALARop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg;\n" +"fp_SCALARop\n" +" \"COS\" .emit OP_COS .or \"COS_SAT\" .emit OP_COS_SAT .or\n" +" \"EX2\" .emit OP_EX2 .or \"EX2_SAT\" .emit OP_EX2_SAT .or\n" +" \"LG2\" .emit OP_LG2 .or \"LG2_SAT\" .emit OP_LG2_SAT .or\n" +" \"RCP\" .emit OP_RCP .or \"RCP_SAT\" .emit OP_RCP_SAT .or\n" +" \"RSQ\" .emit OP_RSQ .or \"RSQ_SAT\" .emit OP_RSQ_SAT .or\n" +" \"SIN\" .emit OP_SIN .or \"SIN_SAT\" .emit OP_SIN_SAT .or\n" +" \"SCS\" .emit OP_SCS .or \"SCS_SAT\" .emit OP_SCS_SAT;\n" +"vp_SCALARop\n" +" \"EX2\" .emit OP_EX2 .or\n" +" \"EXP\" .emit OP_EXP .or\n" +" \"LG2\" .emit OP_LG2 .or\n" +" \"LOG\" .emit OP_LOG .or\n" +" \"RCP\" .emit OP_RCP .or\n" +" \"RSQ\" .emit OP_RSQ;\n" +"fp_BINSCop_instruction\n" +" fp_BINSCop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg .and comma .and\n" +" fp_scalarSrcReg;\n" +"vp_BINSCop_instruction\n" +" vp_BINSCop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg .and comma .and\n" +" vp_scalarSrcReg;\n" +"fp_BINSCop\n" +" \"POW\" .emit OP_POW .or \"POW_SAT\" .emit OP_POW_SAT;\n" +"vp_BINSCop\n" +" \"POW\" .emit OP_POW;\n" +"fp_BINop_instruction\n" +" fp_BINop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n" +" vectorSrcReg;\n" +"vp_BINop_instruction\n" +" vp_BINop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and\n" +" swizzleSrcReg;\n" +"fp_BINop\n" +" \"ADD\" .emit OP_ADD .or \"ADD_SAT\" .emit OP_ADD_SAT .or\n" +" \"DP3\" .emit OP_DP3 .or \"DP3_SAT\" .emit OP_DP3_SAT .or\n" +" \"DP4\" .emit OP_DP4 .or \"DP4_SAT\" .emit OP_DP4_SAT .or\n" +" \"DPH\" .emit OP_DPH .or \"DPH_SAT\" .emit OP_DPH_SAT .or\n" +" \"DST\" .emit OP_DST .or \"DST_SAT\" .emit OP_DST_SAT .or\n" +" \"MAX\" .emit OP_MAX .or \"MAX_SAT\" .emit OP_MAX_SAT .or\n" +" \"MIN\" .emit OP_MIN .or \"MIN_SAT\" .emit OP_MIN_SAT .or\n" +" \"MUL\" .emit OP_MUL .or \"MUL_SAT\" .emit OP_MUL_SAT .or\n" +" \"SGE\" .emit OP_SGE .or \"SGE_SAT\" .emit OP_SGE_SAT .or\n" +" \"SLT\" .emit OP_SLT .or \"SLT_SAT\" .emit OP_SLT_SAT .or\n" +" \"SUB\" .emit OP_SUB .or \"SUB_SAT\" .emit OP_SUB_SAT .or\n" +" \"XPD\" .emit OP_XPD .or \"XPD_SAT\" .emit OP_XPD_SAT;\n" +"vp_BINop\n" +" \"ADD\" .emit OP_ADD .or\n" +" \"DP3\" .emit OP_DP3 .or\n" +" \"DP4\" .emit OP_DP4 .or\n" +" \"DPH\" .emit OP_DPH .or\n" +" \"DST\" .emit OP_DST .or\n" +" \"MAX\" .emit OP_MAX .or\n" +" \"MIN\" .emit OP_MIN .or\n" +" \"MUL\" .emit OP_MUL .or\n" +" \"SGE\" .emit OP_SGE .or\n" +" \"SLT\" .emit OP_SLT .or\n" +" \"SUB\" .emit OP_SUB .or\n" +" \"XPD\" .emit OP_XPD;\n" +"fp_TRIop_instruction\n" +" fp_TRIop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n" +" vectorSrcReg .and comma .and vectorSrcReg;\n" +"vp_TRIop_instruction\n" +" vp_TRIop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and\n" +" swizzleSrcReg .and comma .and swizzleSrcReg;\n" +"fp_TRIop\n" +" \"CMP\" .emit OP_CMP .or \"CMP_SAT\" .emit OP_CMP_SAT .or\n" +" \"LRP\" .emit OP_LRP .or \"LRP_SAT\" .emit OP_LRP_SAT .or\n" +" \"MAD\" .emit OP_MAD .or \"MAD_SAT\" .emit OP_MAD_SAT;\n" +"vp_TRIop\n" +" \"MAD\" .emit OP_MAD;\n" +"fp_SWZ_instruction\n" +" SWZop .and space_dst .and fp_maskedDstReg .and comma .and fp_srcReg .and comma .and\n" +" fp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;\n" +"vp_SWZ_instruction\n" +" \"SWZ\" .emit OP_SWZ .and space_dst .and vp_maskedDstReg .and comma .and vp_srcReg .and comma .and\n" +" vp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;\n" +"SWZop\n" +" \"SWZ\" .emit OP_SWZ .or \"SWZ_SAT\" .emit OP_SWZ_SAT;\n" +"SAMPLE_instruction\n" +" SAMPLEop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n" +" texImageUnit .and comma .and texTarget .error TEX_TARGET_EXPECTED;\n" +"SAMPLEop\n" +" \"TEX\" .emit OP_TEX .or \"TEX_SAT\" .emit OP_TEX_SAT .or\n" +" \"TXB\" .emit OP_TXB .or \"TXB_SAT\" .emit OP_TXB_SAT .or\n" +" \"TXP\" .emit OP_TXP .or \"TXP_SAT\" .emit OP_TXP_SAT;\n" +"KIL_instruction\n" +" \"KIL\" .emit OP_KIL .and space_src .and vectorSrcReg;\n" +"texImageUnit\n" +" \"texture\" .error TEXTURE_EXPECTED .and optTexImageUnitNum;\n" +"texTarget\n" +" \"1D\" .emit TEXTARGET_1D .or\n" +" \"2D\" .emit TEXTARGET_2D .or\n" +" \"3D\" .emit TEXTARGET_3D .or\n" +" .if (texture_rectangle != 0x00) \"RECT\" .emit TEXTARGET_RECT .or\n" +" \"CUBE\" .emit TEXTARGET_CUBE .or\n" +" .if (ARB_fragment_program_shadow != 0x00) shadowTarget;\n" +"shadowTarget\n" +" \"SHADOW1D\" .emit TEXTARGET_SHADOW1D .or\n" +" \"SHADOW2D\" .emit TEXTARGET_SHADOW2D .or\n" +" .if (texture_rectangle != 0x00) \"SHADOWRECT\" .emit TEXTARGET_SHADOWRECT;\n" +"optTexImageUnitNum\n" +" optTexImageUnitNum_1 .or .true .emit 0x00;\n" +"optTexImageUnitNum_1\n" +" lbracket_ne .and texImageUnitNum .and rbracket;\n" +"texImageUnitNum\n" +" integer;\n" +"fp_scalarSrcReg\n" +" optionalSign .and fp_srcReg .and fp_scalarSuffix;\n" +"vp_scalarSrcReg\n" +" optionalSign .and vp_srcReg .and vp_scalarSuffix;\n" +"swizzleSrcReg\n" +" optionalSign .and vp_srcReg .and swizzleSuffix;\n" +"vectorSrcReg\n" +" optionalSign .and fp_srcReg .and optionalSuffix;\n" +"fp_maskedDstReg\n" +" fp_dstReg .and fp_optionalMask;\n" +"vp_maskedDstReg\n" +" vp_dstReg .and vp_optionalMask;\n" +"maskedAddrReg\n" +" addrReg .error ADDRESS_REGISTER_EXPECTED .and addrWriteMask;\n" +"fp_extendedSwizzle\n" +" rgbaExtendedSwizzle .or xyzwExtendedSwizzle;\n" +"vp_extendedSwizzle\n" +" extSwizComp .and comma .and\n" +" extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" +" extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" +" extSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" +"xyzwExtendedSwizzle\n" +" xyzwExtSwizComp .and comma .and\n" +" xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" +" xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" +" xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" +"rgbaExtendedSwizzle\n" +" rgbaExtendedSwizzle_1 .or rgbaExtendedSwizzle_2 .or rgbaExtendedSwizzle_3 .or\n" +" rgbaExtendedSwizzle_4;\n" +"rgbaExtendedSwizzle_1\n" +" rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and\n" +" rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp;\n" +"rgbaExtendedSwizzle_2\n" +" rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and\n" +" rgbaExtSwizComp_alpha .and comma .and rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" +"rgbaExtendedSwizzle_3\n" +" rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_alpha .and comma .and\n" +" rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" +" rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" +"rgbaExtendedSwizzle_4\n" +" rgbaExtSwizComp_alpha .and comma .and \n" +"rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" +" rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" +" rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" +"xyzwExtSwizComp\n" +" optionalSign .and xyzwExtSwizSel;\n" +"rgbaExtSwizComp\n" +" optionalSign .and rgbaExtSwizSel;\n" +"rgbaExtSwizComp_digit\n" +" optionalSign .and rgbaExtSwizSel_digit;\n" +"rgbaExtSwizComp_alpha\n" +" optionalSign .and rgbaExtSwizSel_alpha;\n" +"extSwizComp\n" +" optionalSign .and extSwizSel;\n" +"xyzwExtSwizSel\n" +" \"0\" .emit COMPONENT_0 .or \"1\" .emit COMPONENT_1 .or xyzwComponent_single;\n" +"rgbaExtSwizSel\n" +" rgbaExtSwizSel_digit .or rgbaExtSwizSel_alpha;\n" +"rgbaExtSwizSel_digit\n" +" \"0\" .emit COMPONENT_0 .or \"1\" .emit COMPONENT_1;\n" +"rgbaExtSwizSel_alpha\n" +" rgbaComponent_single;\n" +"extSwizSel\n" +" \"0\" .emit COMPONENT_0 .or \"1\" .emit COMPONENT_1 .or vp_component_single;\n" +"fp_srcReg\n" +" fp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;\n" +"vp_srcReg\n" +" vp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;\n" +"fp_srcReg_1\n" +" fragmentAttribReg .emit REGISTER_ATTRIB .or\n" +" fp_progParamReg .emit REGISTER_PARAM .or\n" +" fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" +"vp_srcReg_1\n" +" vertexAttribReg .emit REGISTER_ATTRIB .or\n" +" vp_progParamReg .emit REGISTER_PARAM .or\n" +" vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" +"fp_dstReg\n" +" fp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;\n" +"vp_dstReg\n" +" vp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;\n" +"fp_dstReg_1\n" +" fragmentResultReg .emit REGISTER_RESULT .or\n" +" fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" +"vp_dstReg_1\n" +" vertexResultReg .emit REGISTER_RESULT .or\n" +" vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" +"fragmentAttribReg\n" +" fragAttribBinding;\n" +"vertexAttribReg\n" +" vtxAttribBinding;\n" +"fp_temporaryReg\n" +" fp_establishedName_no_error_on_identifier;\n" +"vp_temporaryReg\n" +" vp_establishedName_no_error_on_identifier;\n" +"fp_progParamReg\n" +" fp_paramSingleItemUse .or fp_progParamReg_1 .or fp_progParamSingle;\n" +"vp_progParamReg\n" +" vp_paramSingleItemUse .or vp_progParamReg_1 .or vp_progParamSingle;\n" +"fp_progParamReg_1\n" +" fp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayAbs .and\n" +" rbracket;\n" +"vp_progParamReg_1\n" +" vp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayMem .and\n" +" rbracket;\n" +"fp_progParamSingle\n" +" .false;\n" +"vp_progParamSingle\n" +" .false;\n" +"fp_progParamArray\n" +" fp_establishedName_no_error_on_identifier;\n" +"vp_progParamArray\n" +" vp_establishedName_no_error_on_identifier;\n" +"progParamArrayMem\n" +" progParamArrayAbs .or progParamArrayRel;\n" +"progParamArrayAbs\n" +" integer_ne .emit ARRAY_INDEX_ABSOLUTE;\n" +"progParamArrayRel\n" +" addrReg .error ADDRESS_REGISTER_OR_INTEGER_EXPECTED .emit ARRAY_INDEX_RELATIVE .and\n" +" addrComponent .and addrRegRelOffset;\n" +"addrRegRelOffset\n" +" addrRegRelOffset_1 .or addrRegRelOffset_2 .or .true .emit 0x00;\n" +"addrRegRelOffset_1\n" +" plus_ne .and addrRegPosOffset;\n" +"addrRegRelOffset_2\n" +" minus_ne .and addrRegNegOffset;\n" +"addrRegPosOffset\n" +" integer_0_63;\n" +"addrRegNegOffset\n" +" integer_0_64;\n" +"fragmentResultReg\n" +" fp_resultBinding;\n" +"vertexResultReg\n" +" vp_resultBinding;\n" +"addrReg\n" +" vp_establishedName_no_error_on_identifier;\n" +"addrComponent\n" +" dot .and \"x\" .error INVALID_ADDRESS_COMPONENT .emit COMPONENT_X .emit COMPONENT_X\n" +" .emit COMPONENT_X .emit COMPONENT_X;\n" +"addrWriteMask\n" +" dot .and \"x\" .error INVALID_ADDRESS_WRITEMASK .emit 0x08;\n" +"fp_scalarSuffix\n" +" dot .and fp_component_single .error INVALID_COMPONENT;\n" +"vp_scalarSuffix\n" +" dot .and vp_component_single .error INVALID_COMPONENT;\n" +"swizzleSuffix\n" +" swizzleSuffix_1 .or\n" +" .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;\n" +"swizzleSuffix_1\n" +" dot_ne .and swizzleSuffix_2 .error INVALID_SUFFIX;\n" +"swizzleSuffix_2\n" +" swizzleSuffix_3 .or swizzleSuffix_4;\n" +"swizzleSuffix_3\n" +" vp_component_multi .and vp_component_multi .and vp_component_multi .error INVALID_COMPONENT .and\n" +" vp_component_multi .error INVALID_COMPONENT;\n" +"swizzleSuffix_4\n" +" \"x\" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or\n" +" \"y\" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or\n" +" \"z\" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or\n" +" \"w\" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;\n" +"optionalSuffix\n" +" optionalSuffix_1 .or\n" +" .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;\n" +"optionalSuffix_1\n" +" dot_ne .and optionalSuffix_2 .error INVALID_SUFFIX;\n" +"optionalSuffix_2\n" +" optionalSuffix_3 .or optionalSuffix_4 .or optionalSuffix_5;\n" +"optionalSuffix_3\n" +" xyzwComponent_multi .and xyzwComponent_multi .and\n" +" xyzwComponent_multi .error INVALID_COMPONENT .and xyzwComponent_multi .error INVALID_COMPONENT;\n" +"optionalSuffix_4\n" +" rgbaComponent_multi .and rgbaComponent_multi .and\n" +" rgbaComponent_multi .error INVALID_COMPONENT .and rgbaComponent_multi .error INVALID_COMPONENT;\n" +"optionalSuffix_5\n" +" \"x\" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or\n" +" \"y\" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or\n" +" \"z\" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or\n" +" \"w\" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .or\n" +" \"r\" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or\n" +" \"g\" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or\n" +" \"b\" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or\n" +" \"a\" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;\n" +"fp_component_single\n" +" xyzwComponent_single .or rgbaComponent_single;\n" +"vp_component_multi\n" +" 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or\n" +" 'w' .emit COMPONENT_W;\n" +"vp_component_single\n" +" \"x\" .emit COMPONENT_X .or \"y\" .emit COMPONENT_Y .or \"z\" .emit COMPONENT_Z .or\n" +" \"w\" .emit COMPONENT_W;\n" +"xyzwComponent_multi\n" +" 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or\n" +" 'w' .emit COMPONENT_W;\n" +"xyzwComponent_single\n" +" \"x\" .emit COMPONENT_X .or \"y\" .emit COMPONENT_Y .or \"z\" .emit COMPONENT_Z .or\n" +" \"w\" .emit COMPONENT_W;\n" +"rgbaComponent_multi\n" +" 'r' .emit COMPONENT_X .or 'g' .emit COMPONENT_Y .or 'b' .emit COMPONENT_Z .or\n" +" 'a' .emit COMPONENT_W;\n" +"rgbaComponent_single\n" +" \"r\" .emit COMPONENT_X .or \"g\" .emit COMPONENT_Y .or \"b\" .emit COMPONENT_Z .or\n" +" \"a\" .emit COMPONENT_W;\n" +"fp_optionalMask\n" +" rgbaMask .or xyzwMask .or .true .emit 0x0F;\n" +"vp_optionalMask\n" +" xyzwMask .or .true .emit 0x0F;\n" +"xyzwMask\n" +" dot_ne .and xyzwMask_1 .error INVALID_WRITEMASK;\n" +"xyzwMask_1\n" +" \"xyzw\" .emit 0x0F .or \"xyz\" .emit 0x0E .or \"xyw\" .emit 0x0D .or \"xy\" .emit 0x0C .or\n" +" \"xzw\" .emit 0x0B .or \"xz\" .emit 0x0A .or \"xw\" .emit 0x09 .or \"x\" .emit 0x08 .or\n" +" \"yzw\" .emit 0x07 .or \"yz\" .emit 0x06 .or \"yw\" .emit 0x05 .or \"y\" .emit 0x04 .or\n" +" \"zw\" .emit 0x03 .or \"z\" .emit 0x02 .or \"w\" .emit 0x01;\n" +"rgbaMask\n" +" dot_ne .and rgbaMask_1;\n" +"rgbaMask_1\n" +" \"rgba\" .emit 0x0F .or \"rgb\" .emit 0x0E .or \"rga\" .emit 0x0D .or \"rg\" .emit 0x0C .or\n" +" \"rba\" .emit 0x0B .or \"rb\" .emit 0x0A .or \"ra\" .emit 0x09 .or \"r\" .emit 0x08 .or\n" +" \"gba\" .emit 0x07 .or \"gb\" .emit 0x06 .or \"ga\" .emit 0x05 .or \"g\" .emit 0x04 .or\n" +" \"ba\" .emit 0x03 .or \"b\" .emit 0x02 .or \"a\" .emit 0x01;\n" +"fp_namingStatement\n" +" fp_ATTRIB_statement .emit ATTRIB .or\n" +" fp_PARAM_statement .emit PARAM .or\n" +" fp_TEMP_statement .emit TEMP .or\n" +" fp_OUTPUT_statement .emit OUTPUT .or\n" +" fp_ALIAS_statement .emit ALIAS;\n" +"vp_namingStatement\n" +" vp_ATTRIB_statement .emit ATTRIB .or\n" +" vp_PARAM_statement .emit PARAM .or\n" +" vp_TEMP_statement .emit TEMP .or\n" +" ADDRESS_statement .emit ADDRESS .or\n" +" vp_OUTPUT_statement .emit OUTPUT .or\n" +" vp_ALIAS_statement .emit ALIAS;\n" +"fp_ATTRIB_statement\n" +" \"ATTRIB\" .and space .and fp_establishName .and equal .and\n" +" fragAttribBinding .error FRAGMENT_EXPECTED;\n" +"vp_ATTRIB_statement\n" +" \"ATTRIB\" .and space .and vp_establishName .and equal .and\n" +" vtxAttribBinding .error VERTEX_EXPECTED;\n" +"fragAttribBinding\n" +" \"fragment\" .and dot .and fragAttribItem .error INVALID_FRAGMENT_PROPERTY;\n" +"vtxAttribBinding\n" +" \"vertex\" .and dot .and vtxAttribItem .error INVALID_VERTEX_PROPERTY;\n" +"fragAttribItem\n" +" fragAttribItem_1 .emit FRAGMENT_ATTRIB_COLOR .or\n" +" fragAttribItem_2 .emit FRAGMENT_ATTRIB_TEXCOORD .or\n" +" .if (fog_coord != 0x00) \"fogcoord\" .emit FRAGMENT_ATTRIB_FOGCOORD .or\n" +" \"position\" .emit FRAGMENT_ATTRIB_POSITION;\n" +"fragAttribItem_1\n" +" \"color\" .and optColorType;\n" +"fragAttribItem_2\n" +" \"texcoord\" .and optTexCoordNum;\n" +"vtxAttribItem\n" +" \"position\" .emit VERTEX_ATTRIB_POSITION .or\n" +" .if (vertex_blend != 0x00) vtxAttribItem_1 .emit VERTEX_ATTRIB_WEIGHT .or\n" +" \"normal\" .emit VERTEX_ATTRIB_NORMAL .or\n" +" vtxAttribItem_2 .emit VERTEX_ATTRIB_COLOR .or\n" +" \"fogcoord\" .emit VERTEX_ATTRIB_FOGCOORD .or\n" +" vtxAttribItem_3 .emit VERTEX_ATTRIB_TEXCOORD .or\n" +" .if (matrix_palette != 0x00) vtxAttribItem_4 .emit VERTEX_ATTRIB_MATRIXINDEX .or\n" +" vtxAttribItem_5 .emit VERTEX_ATTRIB_GENERIC;\n" +"vtxAttribItem_1\n" +" \"weight\" .and vtxOptWeightNum;\n" +"vtxAttribItem_2\n" +" \"color\" .and optColorType;\n" +"vtxAttribItem_3\n" +" \"texcoord\" .and optTexCoordNum;\n" +"vtxAttribItem_4\n" +" \"matrixindex\" .and lbracket .and vtxWeightNum .and rbracket;\n" +"vtxAttribItem_5\n" +" \"attrib\" .and lbracket .and vtxAttribNum .and rbracket;\n" +"vtxAttribNum\n" +" integer;\n" +"vtxOptWeightNum\n" +" vtxOptWeightNum_1 .or .true .emit 0x00;\n" +"vtxOptWeightNum_1\n" +" lbracket_ne .and vtxWeightNum .and rbracket;\n" +"vtxWeightNum\n" +" integer;\n" +"fp_PARAM_statement\n" +" fp_PARAM_multipleStmt .or fp_PARAM_singleStmt;\n" +"vp_PARAM_statement\n" +" vp_PARAM_multipleStmt .or vp_PARAM_singleStmt;\n" +"fp_PARAM_singleStmt\n" +" \"PARAM\" .and space .and fp_establishName .and .true .emit 0x00 .and fp_paramSingleInit .and\n" +" .true .emit PARAM_NULL;\n" +"vp_PARAM_singleStmt\n" +" \"PARAM\" .and space .and vp_establishName .and .true .emit 0x00 .and vp_paramSingleInit .and\n" +" .true .emit PARAM_NULL;\n" +"fp_PARAM_multipleStmt\n" +" \"PARAM\" .and space .and fp_establishName .and lbracket_ne .and optArraySize .and rbracket .and\n" +" fp_paramMultipleInit .and .true .emit PARAM_NULL;\n" +"vp_PARAM_multipleStmt\n" +" \"PARAM\" .and space .and vp_establishName .and lbracket_ne .and optArraySize .and rbracket .and\n" +" vp_paramMultipleInit .and .true .emit PARAM_NULL;\n" +"optArraySize\n" +" optional_integer;\n" +"fp_paramSingleInit\n" +" equal .and fp_paramSingleItemDecl;\n" +"vp_paramSingleInit\n" +" equal .and vp_paramSingleItemDecl;\n" +"fp_paramMultipleInit\n" +" equal .and lbrace .and fp_paramMultInitList .and rbrace;\n" +"vp_paramMultipleInit\n" +" equal .and lbrace .and vp_paramMultInitList .and rbrace;\n" +"fp_paramMultInitList\n" +" fp_paramMultInitList_1 .or fp_paramMultipleItem;\n" +"vp_paramMultInitList\n" +" vp_paramMultInitList_1 .or vp_paramMultipleItem;\n" +"fp_paramMultInitList_1\n" +" fp_paramMultipleItem .and comma_ne .and fp_paramMultInitList;\n" +"vp_paramMultInitList_1\n" +" vp_paramMultipleItem .and comma_ne .and vp_paramMultInitList;\n" +"fp_paramSingleItemDecl\n" +" fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" +" programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" +" paramConstDecl .emit PARAM_CONSTANT;\n" +"vp_paramSingleItemDecl\n" +" vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" +" programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" +" paramConstDecl .emit PARAM_CONSTANT;\n" +"fp_paramSingleItemUse\n" +" fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" +" programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" +" paramConstUse .emit PARAM_CONSTANT;\n" +"vp_paramSingleItemUse\n" +" vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" +" programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" +" paramConstUse .emit PARAM_CONSTANT;\n" +"fp_paramMultipleItem\n" +" fp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or\n" +" programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or\n" +" paramConstDecl .emit PARAM_CONSTANT;\n" +"vp_paramMultipleItem\n" +" vp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or\n" +" programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or\n" +" paramConstDecl .emit PARAM_CONSTANT;\n" +"fp_stateMultipleItem\n" +" stateMultipleItem_1 .or fp_stateSingleItem;\n" +"vp_stateMultipleItem\n" +" stateMultipleItem_1 .or vp_stateSingleItem;\n" +"stateMultipleItem_1\n" +" \"state\" .and dot .and stateMatrixRows .emit STATE_MATRIX_ROWS;\n" +"fp_stateSingleItem\n" +" \"state\" .and dot .and fp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;\n" +"vp_stateSingleItem\n" +" \"state\" .and dot .and vp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;\n" +"fp_stateSingleItem_1\n" +" stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or\n" +" stateSingleItem_5 .or stateSingleItem_7 .or stateSingleItem_8 .or stateSingleItem_11;\n" +"vp_stateSingleItem_1\n" +" stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or\n" +" stateSingleItem_6 .or stateSingleItem_7 .or stateSingleItem_9 .or stateSingleItem_10 .or\n" +" stateSingleItem_11;\n" +"stateSingleItem_1\n" +" stateMaterialItem .emit STATE_MATERIAL;\n" +"stateSingleItem_2\n" +" stateLightItem .emit STATE_LIGHT;\n" +"stateSingleItem_3\n" +" stateLightModelItem .emit STATE_LIGHT_MODEL;\n" +"stateSingleItem_4\n" +" stateLightProdItem .emit STATE_LIGHT_PROD;\n" +"stateSingleItem_5\n" +" stateTexEnvItem .emit STATE_TEX_ENV;\n" +"stateSingleItem_6\n" +" stateTexGenItem .emit STATE_TEX_GEN;\n" +"stateSingleItem_7\n" +" stateFogItem .emit STATE_FOG;\n" +"stateSingleItem_8\n" +" stateDepthItem .emit STATE_DEPTH;\n" +"stateSingleItem_9\n" +" stateClipPlaneItem .emit STATE_CLIP_PLANE;\n" +"stateSingleItem_10\n" +" statePointItem .emit STATE_POINT;\n" +"stateSingleItem_11\n" +" stateMatrixRow .emit STATE_MATRIX_ROWS;\n" +"stateMaterialItem\n" +" \"material\" .and optFaceType .and dot .and stateMatProperty .error INVALID_MATERIAL_PROPERTY;\n" +"stateMatProperty\n" +" \"ambient\" .emit MATERIAL_AMBIENT .or\n" +" \"diffuse\" .emit MATERIAL_DIFFUSE .or\n" +" \"specular\" .emit MATERIAL_SPECULAR .or\n" +" \"emission\" .emit MATERIAL_EMISSION .or\n" +" \"shininess\" .emit MATERIAL_SHININESS;\n" +"stateLightItem\n" +" \"light\" .and lbracket .and stateLightNumber .and rbracket .and dot .and\n" +" stateLightProperty .error INVALID_LIGHT_PROPERTY;\n" +"stateLightProperty\n" +" \"ambient\" .emit LIGHT_AMBIENT .or\n" +" \"diffuse\" .emit LIGHT_DIFFUSE .or\n" +" \"specular\" .emit LIGHT_SPECULAR .or\n" +" \"position\" .emit LIGHT_POSITION .or\n" +" \"attenuation\" .emit LIGHT_ATTENUATION .or\n" +" stateLightProperty_1 .emit LIGHT_SPOT_DIRECTION .or\n" +" \"half\" .emit LIGHT_HALF;\n" +"stateLightProperty_1\n" +" \"spot\" .and dot .and stateSpotProperty .error INVALID_SPOT_PROPERTY;\n" +"stateSpotProperty\n" +" \"direction\";\n" +"stateLightModelItem\n" +" \"lightmodel\" .and stateLModProperty .error INVALID_LIGHTMODEL_PROPERTY;\n" +"stateLModProperty\n" +" stateLModProperty_1 .or stateLModProperty_2;\n" +"stateLModProperty_1\n" +" dot .and \"ambient\" .emit LIGHT_MODEL_AMBIENT;\n" +"stateLModProperty_2\n" +" stateLModProperty_3 .emit LIGHT_MODEL_SCENECOLOR;\n" +"stateLModProperty_3\n" +" optFaceType .and dot .and \"scenecolor\";\n" +"stateLightProdItem\n" +" \"lightprod\" .and lbracket .and stateLightNumber .and rbracket .and optFaceType .and dot .and\n" +" stateLProdProperty .error INVALID_LIGHTPROD_PROPERTY;\n" +"stateLProdProperty\n" +" \"ambient\" .emit LIGHT_PROD_AMBIENT .or\n" +" \"diffuse\" .emit LIGHT_PROD_DIFFUSE .or\n" +" \"specular\" .emit LIGHT_PROD_SPECULAR;\n" +"stateLightNumber\n" +" integer;\n" +"stateTexEnvItem\n" +" \"texenv\" .and optLegacyTexUnitNum .and dot .and\n" +" stateTexEnvProperty .error INVALID_TEXENV_PROPERTY;\n" +"stateTexEnvProperty\n" +" \"color\" .emit TEX_ENV_COLOR;\n" +"optLegacyTexUnitNum\n" +" lbracket_ne .and legacyTexUnitNum .and rbracket;\n" +"legacyTexUnitNum\n" +" integer;\n" +"stateTexGenItem\n" +" \"texgen\" .and optTexCoordNum .and dot .and stateTexGenType .error INVALID_TEXGEN_PROPERTY .and\n" +" dot .and stateTexGenCoord .error INVALID_TEXGEN_COORD;\n" +"stateTexGenType\n" +" \"eye\" .emit TEX_GEN_EYE .or\n" +" \"object\" .emit TEX_GEN_OBJECT;\n" +"stateTexGenCoord\n" +" \"s\" .emit COMPONENT_X .or\n" +" \"t\" .emit COMPONENT_Y .or\n" +" \"r\" .emit COMPONENT_Z .or\n" +" \"q\" .emit COMPONENT_W;\n" +"stateFogItem\n" +" \"fog\" .and dot .and stateFogProperty .error INVALID_FOG_PROPERTY;\n" +"stateFogProperty\n" +" \"color\" .emit FOG_COLOR .or\n" +" \"params\" .emit FOG_PARAMS;\n" +"stateDepthItem\n" +" \"depth\" .and dot .and stateDepthProperty .error INVALID_DEPTH_PROPERTY;\n" +"stateDepthProperty\n" +" \"range\" .emit DEPTH_RANGE;\n" +"stateClipPlaneItem\n" +" \"clip\" .and lbracket .and stateClipPlaneNum .and rbracket .and dot .and\n" +" \"plane\" .error INVALID_CLIPPLANE_PROPERTY;\n" +"stateClipPlaneNum\n" +" integer;\n" +"statePointItem\n" +" \"point\" .and dot .and statePointProperty .error INVALID_POINT_PROPERTY;\n" +"statePointProperty\n" +" \"size\" .emit POINT_SIZE .or\n" +" .if (point_parameters != 0x00) \"attenuation\" .emit POINT_ATTENUATION;\n" +"stateMatrixRow\n" +" stateMatrixItem .and dot .and \"row\" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and\n" +" lbracket .and stateMatrixRowNum .and rbracket .emit 0x0;\n" +"stateMatrixRows\n" +" stateMatrixItem .and optMatrixRows;\n" +"optMatrixRows\n" +" optMatrixRows_1 .or .true .emit 0x0 .emit '3' .emit 0x0 .emit $;\n" +"optMatrixRows_1\n" +" dot_ne .and \"row\" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and lbracket .and\n" +" stateMatrixRowNum .and dotdot .and stateMatrixRowNum .and rbracket;\n" +"stateMatrixItem\n" +" \"matrix\" .and dot .and stateMatrixName .error INVALID_MATRIX_NAME .and stateOptMatModifier;\n" +"stateOptMatModifier\n" +" stateOptMatModifier_1 .or .true .emit MATRIX_MODIFIER_IDENTITY;\n" +"stateOptMatModifier_1\n" +" dot_ne .and stateMatModifier;\n" +"stateMatModifier\n" +" \"inverse\" .emit MATRIX_MODIFIER_INVERSE .or\n" +" \"transpose\" .emit MATRIX_MODIFIER_TRANSPOSE .or\n" +" \"invtrans\" .emit MATRIX_MODIFIER_INVTRANS;\n" +"stateMatrixRowNum\n" +" integer_0_3;\n" +"stateMatrixName\n" +" stateMatrixName_1_1 .emit MATRIX_MODELVIEW .or\n" +" \"projection\" .emit MATRIX_PROJECTION .or\n" +" \"mvp\" .emit MATRIX_MVP .or\n" +" stateMatrixName_1_2 .emit MATRIX_TEXTURE .or\n" +" .if (matrix_palette != 0x00) stateMatrixName_1_3 .emit MATRIX_PALETTE .or\n" +" stateMatrixName_1_4 .emit MATRIX_PROGRAM;\n" +"stateMatrixName_1_1\n" +" \"modelview\" .and stateOptModMatNum;\n" +"stateMatrixName_1_2\n" +" \"texture\" .and optTexCoordNum;\n" +"stateMatrixName_1_3\n" +" \"palette\" .and lbracket .and statePaletteMatNum .and rbracket;\n" +"stateMatrixName_1_4\n" +" \"program\" .and lbracket .and stateProgramMatNum .and rbracket;\n" +"stateOptModMatNum\n" +" .if (vertex_blend != 0x00) stateOptModMatNum_1 .or\n" +" .true .emit 0x00;\n" +"stateOptModMatNum_1\n" +" lbracket_ne .and stateModMatNum .and rbracket;\n" +"stateModMatNum\n" +" integer;\n" +"optTexCoordNum\n" +" optTexCoordNum_1 .or .true .emit 0x00;\n" +"optTexCoordNum_1\n" +" lbracket_ne .and texCoordNum .and rbracket;\n" +"texCoordNum\n" +" integer;\n" +"statePaletteMatNum\n" +" integer;\n" +"stateProgramMatNum\n" +" integer;\n" +"programSingleItem\n" +" \"program\" .and dot .and programSingleItem_1 .error INVALID_PROGRAM_PROPERTY;\n" +"programSingleItem_1\n" +" progEnvParam .or progLocalParam;\n" +"programMultipleItem\n" +" \"program\" .and dot .and programMultipleItem_1 .error INVALID_PROGRAM_PROPERTY;\n" +"programMultipleItem_1\n" +" progEnvParams .or progLocalParams;\n" +"progEnvParams\n" +" \"env\" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNums .and rbracket;\n" +"progEnvParamNums\n" +" progEnvParamNums_1 .or progEnvParamNums_2;\n" +"progEnvParamNums_1\n" +" progEnvParamNum .and dotdot_ne .and progEnvParamNum;\n" +"progEnvParamNums_2\n" +" progEnvParamNum .and .true .emit 0x00;\n" +"progEnvParam\n" +" \"env\" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNum .and rbracket .emit 0x00;\n" +"progLocalParams\n" +" \"local\" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNums .and rbracket;\n" +"progLocalParamNums\n" +" progLocalParamNums_1 .or progLocalParamNums_2;\n" +"progLocalParamNums_1\n" +" progLocalParamNum .and dotdot_ne .and progLocalParamNum;\n" +"progLocalParamNums_2\n" +" progLocalParamNum .and .true .emit 0x00;\n" +"progLocalParam\n" +" \"local\" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNum .and rbracket .emit 0x00;\n" +"progEnvParamNum\n" +" integer;\n" +"progLocalParamNum\n" +" integer;\n" +"paramConstDecl\n" +" paramConstScalarDecl .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;\n" +"paramConstUse\n" +" paramConstScalarUse .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;\n" +"paramConstScalarDecl\n" +" signedFloatConstant;\n" +"paramConstScalarUse\n" +" floatConstant;\n" +"paramConstVector\n" +" paramConstVector_4 .emit 0x04 .or paramConstVector_3 .emit 0x03 .or\n" +" paramConstVector_2 .emit 0x02 .or paramConstVector_1 .emit 0x01;\n" +"paramConstVector_1\n" +" lbrace_ne .and signedFloatConstant .and rbrace;\n" +"paramConstVector_2\n" +" lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;\n" +"paramConstVector_3\n" +" lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and\n" +" signedFloatConstant .and rbrace;\n" +"paramConstVector_4\n" +" lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and\n" +" signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;\n" +"signedFloatConstant\n" +" optionalSign .and floatConstant;\n" +"floatConstant\n" +" float;\n" +"optionalSign\n" +" optional_sign_ne;\n" +"fp_TEMP_statement\n" +" \"TEMP\" .and space .and fp_varNameList .and .true .emit 0x00;\n" +"vp_TEMP_statement\n" +" \"TEMP\" .and space .and vp_varNameList .and .true .emit 0x00;\n" +"ADDRESS_statement\n" +" \"ADDRESS\" .and space .and vp_varNameList .and .true .emit 0x00;\n" +"fp_varNameList\n" +" fp_varNameList_1 .or fp_establishName;\n" +"vp_varNameList\n" +" vp_varNameList_1 .or vp_establishName;\n" +"fp_varNameList_1\n" +" fp_establishName .and comma_ne .and fp_varNameList;\n" +"vp_varNameList_1\n" +" vp_establishName .and comma_ne .and vp_varNameList;\n" +"fp_OUTPUT_statement\n" +" \"OUTPUT\" .and space .and fp_establishName .and equal .and\n" +" fp_resultBinding .error RESULT_EXPECTED;\n" +"vp_OUTPUT_statement\n" +" \"OUTPUT\" .and space .and vp_establishName .and equal .and\n" +" vp_resultBinding .error RESULT_EXPECTED;\n" +"fp_resultBinding\n" +" \"result\" .and dot .and fp_resultBinding_1 .error INVALID_RESULT_PROPERTY;\n" +"vp_resultBinding\n" +" \"result\" .and dot .and vp_resultBinding_1 .error INVALID_RESULT_PROPERTY;\n" +"fp_resultBinding_1\n" +" fp_resultBinding_2 .emit FRAGMENT_RESULT_COLOR .or\n" +" \"depth\" .emit FRAGMENT_RESULT_DEPTH;\n" +"fp_resultBinding_2\n" +" \"color\" .and optOutputColorNum;\n" +"vp_resultBinding_1\n" +" .if (ARB_position_invariant == 0x00) \"position\" .emit VERTEX_RESULT_POSITION .or\n" +" resultColBinding .emit VERTEX_RESULT_COLOR .or\n" +" \"fogcoord\" .emit VERTEX_RESULT_FOGCOORD .or\n" +" \"pointsize\" .emit VERTEX_RESULT_POINTSIZE .or\n" +" vp_resultBinding_2 .emit VERTEX_RESULT_TEXCOORD;\n" +"vp_resultBinding_2\n" +" \"texcoord\" .and optTexCoordNum;\n" +"optOutputColorNum\n" +" .if (ARB_draw_buffers != 0x00) optOutputColorNum_1 .or .true .emit 0x00;\n" +"optOutputColorNum_1\n" +" lbracket_ne .and outputColorNum .and rbracket;\n" +"outputColorNum\n" +" integer;\n" +"resultColBinding\n" +" \"color\" .and optFaceType .and optColorType;\n" +"optFaceType\n" +" FaceType .or .true .emit FACE_FRONT;\n" +"FaceType\n" +" dot_ne .and FaceProperty;\n" +"FaceProperty\n" +" \"front\" .emit FACE_FRONT .or \"back\" .emit FACE_BACK;\n" +"optColorType\n" +" ColorType .or .true .emit COLOR_PRIMARY;\n" +"ColorType\n" +" dot_ne .and ColorProperty;\n" +"ColorProperty\n" +" \"primary\" .emit COLOR_PRIMARY .or\n" +" .if (secondary_color != 0x00) \"secondary\" .emit COLOR_SECONDARY;\n" +"fp_ALIAS_statement\n" +" \"ALIAS\" .and fp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and fp_establishedName;\n" +"vp_ALIAS_statement\n" +" \"ALIAS\" .and vp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and vp_establishedName;\n" +"fp_ALIAS_statement_1\n" +" space .and fp_establishName;\n" +"vp_ALIAS_statement_1\n" +" space .and vp_establishName;\n" +"fp_establishName\n" +" fp_identifier;\n" +"vp_establishName\n" +" vp_identifier;\n" +"fp_establishedName\n" +" fp_identifier;\n" +"vp_establishedName\n" +" vp_identifier;\n" +"fp_establishedName_no_error_on_identifier\n" +" fp_identifier_ne;\n" +"vp_establishedName_no_error_on_identifier\n" +" vp_identifier_ne;\n" +"fp_identifier\n" +" fp_identifier_ne .error IDENTIFIER_EXPECTED;\n" +"vp_identifier\n" +" vp_identifier_ne .error IDENTIFIER_EXPECTED;\n" +"fp_identifier_ne\n" +" fp_not_reserved_identifier .and identifier_ne;\n" +"vp_identifier_ne\n" +" vp_not_reserved_identifier .and identifier_ne;\n" +"fp_not_reserved_identifier\n" +" fp_not_reserved_identifier_1 .or .true;\n" +"fp_not_reserved_identifier_1\n" +" fp_reserved_identifier .and .false .error RESERVED_KEYWORD;\n" +"vp_not_reserved_identifier\n" +" vp_not_reserved_identifier_1 .or .true;\n" +"vp_not_reserved_identifier_1\n" +" vp_reserved_identifier .and .false .error RESERVED_KEYWORD;\n" +"fp_reserved_identifier\n" +" \"ABS\" .or \"ABS_SAT\" .or \"ADD\" .or \"ADD_SAT\" .or \"ALIAS\" .or \"ATTRIB\" .or \"CMP\" .or \"CMP_SAT\" .or\n" +" \"COS\" .or \"COS_SAT\" .or \"DP3\" .or \"DP3_SAT\" .or \"DP4\" .or \"DP4_SAT\" .or \"DPH\" .or \"DPH_SAT\" .or\n" +" \"DST\" .or \"DST_SAT\" .or \"END\" .or \"EX2\" .or \"EX2_SAT\" .or \"FLR\" .or \"FLR_SAT\" .or \"FRC\" .or\n" +" \"FRC_SAT\" .or \"KIL\" .or \"LG2\" .or \"LG2_SAT\" .or \"LIT\" .or \"LIT_SAT\" .or \"LRP\" .or \"LRP_SAT\" .or\n" +" \"MAD\" .or \"MAD_SAT\" .or \"MAX\" .or \"MAX_SAT\" .or \"MIN\" .or \"MIN_SAT\" .or \"MOV\" .or \"MOV_SAT\" .or\n" +" \"MUL\" .or \"MUL_SAT\" .or \"OPTION\" .or \"OUTPUT\" .or \"PARAM\" .or \"POW\" .or \"POW_SAT\" .or \"RCP\" .or\n" +" \"RCP_SAT\" .or \"RSQ\" .or \"RSQ_SAT\" .or \"SIN\" .or \"SIN_SAT\" .or \"SCS\" .or \"SCS_SAT\" .or \"SGE\" .or\n" +" \"SGE_SAT\" .or \"SLT\" .or \"SLT_SAT\" .or \"SUB\" .or \"SUB_SAT\" .or \"SWZ\" .or \"SWZ_SAT\" .or \"TEMP\" .or\n" +" \"TEX\" .or \"TEX_SAT\" .or \"TXB\" .or \"TXB_SAT\" .or \"TXP\" .or \"TXP_SAT\" .or \"XPD\" .or \"XPD_SAT\" .or\n" +" \"fragment\" .or \"program\" .or \"result\" .or \"state\" .or \"texture\";\n" +"vp_reserved_identifier\n" +" \"ABS\" .or \"ADD\" .or \"ADDRESS\" .or \"ALIAS\" .or \"ARL\" .or \"ATTRIB\" .or \"DP3\" .or \"DP4\" .or\n" +" \"DPH\" .or \"DST\" .or \"END\" .or \"EX2\" .or \"EXP\" .or \"FLR\" .or \"FRC\" .or \"LG2\" .or \"LIT\" .or\n" +" \"LOG\" .or \"MAD\" .or \"MAX\" .or \"MIN\" .or \"MOV\" .or \"MUL\" .or \"OPTION\" .or \"OUTPUT\" .or\n" +" \"PARAM\" .or \"POW\" .or \"RCP\" .or \"RSQ\" .or \"SGE\" .or \"SLT\" .or \"SUB\" .or \"SWZ\" .or \"TEMP\" .or\n" +" \"XPD\" .or \"program\" .or \"result\" .or \"state\" .or \"vertex\";\n" +"integer\n" +" integer_ne .error INTEGER_EXPECTED;\n" +"zero\n" +" '0';\n" +"leading_zeroes\n" +" .loop zero;\n" +"no_digit\n" +" no_digit_1 .or .true;\n" +"no_digit_1\n" +" digit10 .and .false .error INTEGER_OUT_OF_RANGE;\n" +"all_zeroes\n" +" all_zeroes_1 .or no_digit_1;\n" +"all_zeroes_1\n" +" '0' .and .loop zero .and no_digit;\n" +"integer_0_3\n" +" integer_0_3_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;\n" +"integer_0_3_1\n" +" integer_0_3_2 .or all_zeroes .emit '0';\n" +"integer_0_3_2 \n" +" leading_zeroes .and '1'-'3' .emit * .and no_digit;\n" +"integer_0_63\n" +" integer_0_63_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;\n" +"integer_0_63_1\n" +" integer_0_63_2 .or integer_0_63_3 .or integer_0_63_4 .or integer_0_63_5 .or\n" +" all_zeroes .emit '0';\n" +"integer_0_63_2 \n" +" leading_zeroes .and '7'-'9' .emit * .and no_digit;\n" +"integer_0_63_3 \n" +" leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;\n" +"integer_0_63_4 \n" +" leading_zeroes .and '6' .emit * .and '0'-'3' .emit * .and no_digit;\n" +"integer_0_63_5 \n" +" leading_zeroes .and '1'-'6' .emit * .and no_digit;\n" +"integer_0_64\n" +" integer_0_64_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;\n" +"integer_0_64_1\n" +" integer_0_64_2 .or integer_0_64_3 .or integer_0_64_4 .or integer_0_64_5 .or\n" +" all_zeroes .emit '0';\n" +"integer_0_64_2 \n" +" leading_zeroes .and '7'-'9' .emit * .and no_digit;\n" +"integer_0_64_3 \n" +" leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;\n" +"integer_0_64_4 \n" +" leading_zeroes .and '6' .emit * .and '0'-'4' .emit * .and no_digit;\n" +"integer_0_64_5 \n" +" leading_zeroes .and '1'-'6' .emit * .and no_digit;\n" +"optional_space\n" +" space .or .true;\n" +"space_dst\n" +" space .error OPERATION_NEEDS_DESTINATION_VARIABLE;\n" +"space_src\n" +" space .error OPERATION_NEEDS_SOURCE_VARIABLE;\n" +"space\n" +" single_space .and .loop single_space;\n" +"single_space\n" +" white_char .or comment_block;\n" +"white_char\n" +" ' ' .or '\\t' .or '\\n' .or '\\r';\n" +"comment_block\n" +" '#' .and .loop comment_char .and new_line;\n" +"comment_char\n" +" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" +"new_line\n" +" '\\n' .or crlf .or '\\0';\n" +"crlf\n" +" '\\r' .and '\\n';\n" +"semicolon\n" +" optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;\n" +"comma\n" +" optional_space .and ',' .error MISSING_COMMA .and optional_space;\n" +"comma_ne\n" +" optional_space .and ',' .and optional_space;\n" +"lbracket\n" +" optional_space .and '[' .error MISSING_LBRACKET .and optional_space;\n" +"lbracket_ne\n" +" optional_space .and '[' .and optional_space;\n" +"rbracket\n" +" optional_space .and ']' .error MISSING_RBRACKET .and optional_space;\n" +"dot\n" +" optional_space .and '.' .error MISSING_DOT .and optional_space;\n" +"dot_ne\n" +" optional_space .and '.' .and optional_space;\n" +"equal\n" +" optional_space .and '=' .error MISSING_EQUAL .and optional_space;\n" +"lbrace\n" +" optional_space .and '{' .error MISSING_LBRACE .and optional_space;\n" +"lbrace_ne\n" +" optional_space .and '{' .and optional_space;\n" +"rbrace\n" +" optional_space .and '}' .error MISSING_RBRACE .and optional_space;\n" +"dotdot\n" +" optional_space .and '.' .and '.' .error MISSING_DOTDOT .and optional_space;\n" +"dotdot_ne\n" +" optional_space .and '.' .and '.' .and optional_space;\n" +"float\n" +" float_1 .or float_2 .or float_legacy;\n" +"float_1\n" +" '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;\n" +"float_2\n" +" integer_ne .and float_3;\n" +"float_3\n" +" float_4 .or float_5;\n" +"float_4\n" +" '.' .and optional_integer .and optional_exponent;\n" +"float_5\n" +" exponent .emit 0x00;\n" +"float_legacy\n" +" integer_ne .and .true .emit 0x00 .emit 0x00;\n" +"integer_ne\n" +" integer_ne_1 .and .true .emit 0x00 .emit $;\n" +"integer_ne_1\n" +" digit10 .emit * .and .loop digit10 .emit *;\n" +"optional_integer\n" +" integer_ne .or .true .emit 0x00;\n" +"optional_exponent\n" +" exponent .or .true .emit 0x00;\n" +"exponent\n" +" exponent_1 .and optional_sign_ne .and integer_ne .error EXPONENT_VALUE_EXPECTED;\n" +"exponent_1\n" +" 'e' .or 'E';\n" +"optional_sign_ne\n" +" minus_ne .or plus_ne .or .true;\n" +"plus_ne\n" +" optional_space .and '+' .and optional_space;\n" +"minus_ne\n" +" optional_space .and '-' .emit '-' .and optional_space;\n" +"identifier_ne\n" +" first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit 0x00 .emit $;\n" +"follow_idchar\n" +" first_idchar .or digit10;\n" +"first_idchar\n" +" 'a'-'z' .or 'A'-'Z' .or '_' .or '$';\n" +"digit10\n" +" '0'-'9';\n" +".string __string_filter;\n" +"__string_filter\n" +" .loop __identifier_char;\n" +"__identifier_char\n" +" 'a'-'z' .or 'A'-'Z' .or '_' .or '$' .or '0'-'9';\n" +"e_signature\n" +" e_signature_char .and .loop e_signature_char;\n" +"e_signature_char\n" +" '!' .or '.' .or 'A'-'Z' .or 'a'-'z' .or '0'-'9';\n" +"e_statement\n" +" .loop e_statement_not_term;\n" +"e_statement_not_term\n" +" '\\x3C'-'\\xFF' .or '\\x0E'-'\\x3A' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" +"e_identifier\n" +" e_identifier_first .and .loop e_identifier_next;\n" +"e_identifier_first\n" +" 'a'-'z' .or 'A'-'Z' .or '_' .or '$';\n" +"e_identifier_next\n" +" e_identifier_first .or '0'-'9';\n" +"e_token\n" +" e_identifier .or e_token_number .or '[' .or ']' .or '.' .or '{' .or '}' .or '=' .or '+' .or\n" +" '-' .or ',' .or ';';\n" +"e_token_number\n" +" e_token_digit .and .loop e_token_digit;\n" +"e_token_digit\n" +" '0'-'9';\n" +"e_charordigit\n" +" 'A'-'Z' .or 'a'-'z' .or '0'-'9';\n" +"" diff --git a/reactos/dll/mesa32/src/shader/arbvertparse.c b/reactos/dll/mesa32/src/shader/arbvertparse.c new file mode 100644 index 00000000000..92e3bb352e0 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/arbvertparse.c @@ -0,0 +1,204 @@ +/* + * Mesa 3-D graphics library + * Version: 6.2 + * + * 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. + */ + +#define DEBUG_VP 0 + +/** + * \file arbvertparse.c + * ARB_vertex_program parser. + * \author Karl Rasche + */ + +#include "glheader.h" +#include "context.h" +#include "arbvertparse.h" +#include "hash.h" +#include "imports.h" +#include "macros.h" +#include "mtypes.h" +#include "program.h" +#include "nvprogram.h" +#include "nvvertparse.h" +#include "nvvertprog.h" + +#include "arbprogparse.h" + + +/** + * XXX this is probably redundant. We've already got code like this + * in the nvvertparse.c file. Combine/clean-up someday. + */ +void _mesa_debug_vp_inst(GLint num, struct vp_instruction *vp) +{ + GLint a; + static const char *opcode_string[] = { + "ABS", + "ADD", + "ARL", + "DP3", + "DP4", + "DPH", + "DST", + "END", /* Placeholder */ + "EX2", /* ARB only */ + "EXP", + "FLR", /* ARB */ + "FRC", /* ARB */ + "LG2", /* ARB only */ + "LIT", + "LOG", + "MAD", + "MAX", + "MIN", + "MOV", + "MUL", + "POW", /* ARB only */ + "PRINT", /* Mesa only */ + "RCC", + "RCP", + "RSQ", + "SGE", + "SLT", + "SUB", + "SWZ", /* ARB only */ + "XPD" /* ARB only */ + }; + + static const char *file_string[] = { + "TEMP", + "INPUT", + "OUTPUT", + "LOCAL", + "ENV", + "NAMED", + "STATE", + "WRITE_ONLY", + "ADDR" + }; + + static const char swz[] = "xyzw01??"; + + for (a=0; aInstructions = (struct vp_instruction *) + _mesa_malloc ( sizeof(struct vp_instruction) ); + program->Instructions[0].Opcode = VP_OPCODE_END; + return; + } + + /* copy the relvant contents of the arb_program struct into the + * fragment_program struct + */ + program->Base.String = ap.Base.String; + program->Base.NumInstructions = ap.Base.NumInstructions; + program->Base.NumTemporaries = ap.Base.NumTemporaries; + program->Base.NumParameters = ap.Base.NumParameters; + program->Base.NumAttributes = ap.Base.NumAttributes; + program->Base.NumAddressRegs = ap.Base.NumAddressRegs; + + program->IsPositionInvariant = ap.HintPositionInvariant; + program->InputsRead = ap.InputsRead; + program->OutputsWritten = ap.OutputsWritten; + program->Parameters = ap.Parameters; + + program->Instructions = ap.VPInstructions; + +#if DEBUG_VP + _mesa_debug_vp_inst(ap.Base.NumInstructions, ap.VPInstructions); +#endif + +} diff --git a/reactos/dll/mesa32/src/shader/arbvertparse.h b/reactos/dll/mesa32/src/shader/arbvertparse.h new file mode 100644 index 00000000000..f2ac1570be0 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/arbvertparse.h @@ -0,0 +1,36 @@ +/* + * 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. + */ + +#ifndef ARBVERTPARSE_H +#define ARBVERTPARSE_H + +extern void +_mesa_parse_arb_vertex_program(GLcontext * ctx, GLenum target, + const GLubyte * str, GLsizei len, + struct vertex_program *program); + +extern void +_mesa_debug_vp_inst(GLint num, struct vp_instruction *vp); + +#endif diff --git a/reactos/dll/mesa32/src/shader/atifragshader.c b/reactos/dll/mesa32/src/shader/atifragshader.c new file mode 100644 index 00000000000..d8df8f518b6 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/atifragshader.c @@ -0,0 +1,439 @@ +/** + * \file atifragshader.c + * \author David Airlie + * Copyright (C) 2004 David Airlie 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 + * DAVID AIRLIE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION 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 "macros.h" +#include "enums.h" +#include "mtypes.h" +#include "atifragshader.h" + +#define MESA_DEBUG_ATI_FS 0 + +extern struct program _mesa_DummyProgram; + +static void +new_inst(struct ati_fragment_shader *prog) +{ + prog->Base.NumInstructions++; +} + +#if MESA_DEBUG_ATI_FS +static char * +create_dst_mod_str(GLuint mod) +{ + static char ret_str[1024]; + + _mesa_memset(ret_str, 0, 1024); + if (mod & GL_2X_BIT_ATI) + _mesa_strncat(ret_str, "|2X", 1024); + + if (mod & GL_4X_BIT_ATI) + _mesa_strncat(ret_str, "|4X", 1024); + + if (mod & GL_8X_BIT_ATI) + _mesa_strncat(ret_str, "|8X", 1024); + if (mod & GL_HALF_BIT_ATI) + _mesa_strncat(ret_str, "|HA", 1024); + if (mod & GL_QUARTER_BIT_ATI) + _mesa_strncat(ret_str, "|QU", 1024); + if (mod & GL_EIGHTH_BIT_ATI) + _mesa_strncat(ret_str, "|EI", 1024); + + if (mod & GL_SATURATE_BIT_ATI) + _mesa_strncat(ret_str, "|SAT", 1024); + + if (_mesa_strlen(ret_str) == 0) + _mesa_strncat(ret_str, "NONE", 1024); + return ret_str; +} + +static char *atifs_ops[] = {"ColorFragmentOp1ATI", "ColorFragmentOp2ATI", "ColorFragmentOp3ATI", + "AlphaFragmentOp1ATI", "AlphaFragmentOp2ATI", "AlphaFragmentOp3ATI" }; + +static void debug_op(GLint optype, GLuint arg_count, GLenum op, GLuint dst, + GLuint dstMask, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, + GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, + GLuint arg3Rep, GLuint arg3Mod) +{ + char *op_name; + + op_name = atifs_ops[(arg_count-1)+(optype?3:0)]; + + fprintf(stderr, "%s(%s, %s", op_name, _mesa_lookup_enum_by_nr(op), + _mesa_lookup_enum_by_nr(dst)); + if (!optype) + fprintf(stderr, ", %d", dstMask); + + fprintf(stderr, ", %s", create_dst_mod_str(dstMod)); + + fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg1), + _mesa_lookup_enum_by_nr(arg1Rep), arg1Mod); + if (arg_count>1) + fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg2), + _mesa_lookup_enum_by_nr(arg2Rep), arg2Mod); + if (arg_count>2) + fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg3), + _mesa_lookup_enum_by_nr(arg3Rep), arg3Mod); + + fprintf(stderr,")\n"); + +} +#endif + +GLuint GLAPIENTRY +_mesa_GenFragmentShadersATI(GLuint range) +{ + GLuint first; + GLuint i; + GET_CURRENT_CONTEXT(ctx); + + first = _mesa_HashFindFreeKeyBlock(ctx->Shared->Programs, range); + for (i = 0; i < range; i++) { + _mesa_HashInsert(ctx->Shared->Programs, first + i, &_mesa_DummyProgram); + } + + return first; +} + +void GLAPIENTRY +_mesa_BindFragmentShaderATI(GLuint id) +{ + struct program *prog; + GET_CURRENT_CONTEXT(ctx); + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + if (curProg->Base.Id == id) { + return; + } + + if (curProg->Base.Id != 0) { + curProg->Base.RefCount--; + if (curProg->Base.RefCount <= 0) { + _mesa_HashRemove(ctx->Shared->Programs, id); + } + } + + /* Go bind */ + if (id == 0) { + prog = ctx->Shared->DefaultFragmentShader; + } + else { + prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); + if (!prog || prog == &_mesa_DummyProgram) { + /* allocate a new program now */ + prog = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_SHADER_ATI, id); + if (!prog) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindFragmentShaderATI"); + return; + } + _mesa_HashInsert(ctx->Shared->Programs, id, prog); + } + + } + + /* do actual bind */ + ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) prog; + + ASSERT(ctx->ATIFragmentShader.Current); + if (prog) + prog->RefCount++; + + /*if (ctx->Driver.BindProgram) + ctx->Driver.BindProgram(ctx, target, prog); */ +} + +void GLAPIENTRY +_mesa_DeleteFragmentShaderATI(GLuint id) +{ + GET_CURRENT_CONTEXT(ctx); + + if (id != 0) { + struct program *prog = (struct program *) + _mesa_HashLookup(ctx->Shared->Programs, id); + if (prog == &_mesa_DummyProgram) { + _mesa_HashRemove(ctx->Shared->Programs, id); + } + else if (prog) { + if (ctx->ATIFragmentShader.Current && + ctx->ATIFragmentShader.Current->Base.Id == id) { + _mesa_BindFragmentShaderATI(0); + } + } +#if 0 + if (!prog->DeletePending) { + prog->DeletePending = GL_TRUE; + prog->RefCount--; + } + if (prog->RefCount <= 0) { + _mesa_HashRemove(ctx->Shared->Programs, id); + ctx->Driver.DeleteProgram(ctx, prog); + } +#else + /* The ID is immediately available for re-use now */ + _mesa_HashRemove(ctx->Shared->Programs, id); + prog->RefCount--; + if (prog->RefCount <= 0) { + ctx->Driver.DeleteProgram(ctx, prog); + } +#endif + } +} + +void GLAPIENTRY +_mesa_BeginFragmentShaderATI(void) +{ + GET_CURRENT_CONTEXT(ctx); + + /* malloc the instructions here - not sure if the best place but its + a start */ + ctx->ATIFragmentShader.Current->Instructions = + (struct atifs_instruction *) + _mesa_calloc(sizeof(struct atifs_instruction) * MAX_NUM_PASSES_ATI * + MAX_NUM_INSTRUCTIONS_PER_PASS_ATI * 2); + + ctx->ATIFragmentShader.Current->cur_pass = 0; + ctx->ATIFragmentShader.Compiling = 1; +} + +void GLAPIENTRY +_mesa_EndFragmentShaderATI(void) +{ + GET_CURRENT_CONTEXT(ctx); +#if MESA_DEBUG_ATI_FS + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + GLint i; +#endif + + ctx->ATIFragmentShader.Compiling = 0; + ctx->ATIFragmentShader.Current->NumPasses = ctx->ATIFragmentShader.Current->cur_pass; + ctx->ATIFragmentShader.Current->cur_pass=0; +#if MESA_DEBUG_ATI_FS + for (i = 0; i < curProg->Base.NumInstructions; i++) { + GLuint op0 = curProg->Instructions[i].Opcode[0]; + GLuint op1 = curProg->Instructions[i].Opcode[1]; + const char *op0_enum = op0 > 5 ? _mesa_lookup_enum_by_nr(op0) : "0"; + const char *op1_enum = op1 > 5 ? _mesa_lookup_enum_by_nr(op1) : "0"; + GLuint count0 = curProg->Instructions[i].ArgCount[0]; + GLuint count1 = curProg->Instructions[i].ArgCount[1]; + + fprintf(stderr, "%2d %04X %s %d %04X %s %d\n", i, op0, op0_enum, count0, + op1, op1_enum, count1); + } +#endif +} + +void GLAPIENTRY +_mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle) +{ + GET_CURRENT_CONTEXT(ctx); + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + GLint ci; + struct atifs_instruction *curI; + + if (ctx->ATIFragmentShader.Current->cur_pass==1) + ctx->ATIFragmentShader.Current->cur_pass=2; + + new_inst(curProg); + ci = curProg->Base.NumInstructions - 1; + /* some validation + if ((swizzle != GL_SWIZZLE_STR_ATI) || + (swizzle != GL_SWIZZLE_STQ_ATI) || + (swizzle != GL_SWIZZLE_STR_DR_ATI) || + (swizzle != GL_SWIZZLE_STQ_DQ_ATI)) + */ + + /* add the instructions */ + curI = &curProg->Instructions[ci]; + + curI->Opcode[0] = ATI_FRAGMENT_SHADER_PASS_OP; + curI->DstReg[0].Index = dst; + curI->SrcReg[0][0].Index = coord; + curI->DstReg[0].Swizzle = swizzle; + +#if MESA_DEBUG_ATI_FS + _mesa_debug(ctx, "%s(%s, %s, %s)\n", __FUNCTION__, + _mesa_lookup_enum_by_nr(dst), _mesa_lookup_enum_by_nr(coord), + _mesa_lookup_enum_by_nr(swizzle)); +#endif +} + +void GLAPIENTRY +_mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle) +{ + GET_CURRENT_CONTEXT(ctx); + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + GLint ci; + struct atifs_instruction *curI; + + if (ctx->ATIFragmentShader.Current->cur_pass==1) + ctx->ATIFragmentShader.Current->cur_pass=2; + + + new_inst(curProg); + + ci = curProg->Base.NumInstructions - 1; + /* add the instructions */ + curI = &curProg->Instructions[ci]; + + curI->Opcode[0] = ATI_FRAGMENT_SHADER_SAMPLE_OP; + curI->DstReg[0].Index = dst; + curI->DstReg[0].Swizzle = swizzle; + + curI->SrcReg[0][0].Index = interp; + +#if MESA_DEBUG_ATI_FS + _mesa_debug(ctx, "%s(%s, %s, %s)\n", __FUNCTION__, + _mesa_lookup_enum_by_nr(dst), _mesa_lookup_enum_by_nr(interp), + _mesa_lookup_enum_by_nr(swizzle)); +#endif +} + +static void +_mesa_FragmentOpXATI(GLint optype, GLuint arg_count, GLenum op, GLuint dst, + GLuint dstMask, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, + GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, + GLuint arg3Rep, GLuint arg3Mod) +{ + GET_CURRENT_CONTEXT(ctx); + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + GLint ci; + struct atifs_instruction *curI; + + if (ctx->ATIFragmentShader.Current->cur_pass==0) + ctx->ATIFragmentShader.Current->cur_pass=1; + + /* decide whether this is a new instruction or not ... all color instructions are new */ + if (optype == 0) + new_inst(curProg); + + ci = curProg->Base.NumInstructions - 1; + + /* add the instructions */ + curI = &curProg->Instructions[ci]; + + curI->Opcode[optype] = op; + + curI->SrcReg[optype][0].Index = arg1; + curI->SrcReg[optype][0].argRep = arg1Rep; + curI->SrcReg[optype][0].argMod = arg1Mod; + curI->ArgCount[optype] = arg_count; + + if (arg2) { + curI->SrcReg[optype][1].Index = arg2; + curI->SrcReg[optype][1].argRep = arg2Rep; + curI->SrcReg[optype][1].argMod = arg2Mod; + } + + if (arg3) { + curI->SrcReg[optype][2].Index = arg3; + curI->SrcReg[optype][2].argRep = arg3Rep; + curI->SrcReg[optype][2].argMod = arg3Mod; + } + + curI->DstReg[optype].Index = dst; + curI->DstReg[optype].dstMod = dstMod; + curI->DstReg[optype].dstMask = dstMask; + +#if MESA_DEBUG_ATI_FS + debug_op(optype, arg_count, op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod); +#endif + +} + +void GLAPIENTRY +_mesa_ColorFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMask, + GLuint dstMod, GLuint arg1, GLuint arg1Rep, + GLuint arg1Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 1, op, dst, dstMask, + dstMod, arg1, arg1Rep, arg1Mod, 0, 0, 0, 0, 0, 0); +} + +void GLAPIENTRY +_mesa_ColorFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMask, + GLuint dstMod, GLuint arg1, GLuint arg1Rep, + GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, + GLuint arg2Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 2, op, dst, dstMask, + dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, + arg2Mod, 0, 0, 0); +} + +void GLAPIENTRY +_mesa_ColorFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMask, + GLuint dstMod, GLuint arg1, GLuint arg1Rep, + GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, + GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, + GLuint arg3Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 3, op, dst, dstMask, + dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, + arg2Mod, arg3, arg3Rep, arg3Mod); +} + +void GLAPIENTRY +_mesa_AlphaFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 1, op, dst, 0, dstMod, + arg1, arg1Rep, arg1Mod, 0, 0, 0, 0, 0, 0); +} + +void GLAPIENTRY +_mesa_AlphaFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, + GLuint arg2Rep, GLuint arg2Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 2, op, dst, 0, dstMod, + arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, 0, 0, + 0); +} + +void GLAPIENTRY +_mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, + GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, + GLuint arg3Rep, GLuint arg3Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 3, op, dst, 0, dstMod, + arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, + arg3Rep, arg3Mod); +} + +void GLAPIENTRY +_mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint dstindex = dst - GL_CON_0_ATI; + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + + COPY_4V(curProg->Constants[dstindex], value); +} diff --git a/reactos/dll/mesa32/src/shader/atifragshader.h b/reactos/dll/mesa32/src/shader/atifragshader.h new file mode 100644 index 00000000000..82ac4746b6b --- /dev/null +++ b/reactos/dll/mesa32/src/shader/atifragshader.h @@ -0,0 +1,105 @@ +/* + * Mesa 3-D graphics library ATI Fragment Shader + * + * Copyright (C) 2004 David Airlie All Rights Reserved. + * + */ + +#ifndef ATIFRAGSHADER_H +#define ATIFRAGSHADER_H + +#define MAX_NUM_INSTRUCTIONS_PER_PASS_ATI 8 +#define MAX_NUM_PASSES_ATI 2 +#define MAX_NUM_FRAGMENT_REGISTERS_ATI 6 + +struct ati_fs_opcode_st +{ + GLenum opcode; + GLint num_src_args; +}; + +extern struct ati_fs_opcode_st ati_fs_opcodes[]; + +struct atifragshader_src_register +{ + GLuint Index; + GLuint argRep; + GLuint argMod; +}; + +struct atifragshader_dst_register +{ + GLuint Index; + GLuint dstMod; + GLuint dstMask; + GLuint Swizzle; +}; + +#define ATI_FRAGMENT_SHADER_COLOR_OP 0 +#define ATI_FRAGMENT_SHADER_ALPHA_OP 1 +#define ATI_FRAGMENT_SHADER_PASS_OP 2 +#define ATI_FRAGMENT_SHADER_SAMPLE_OP 3 + +/* two opcodes - one for color/one for alpha - also pass/sample */ +/* up to three source registers for most ops */ +struct atifs_instruction +{ + GLenum Opcode[2]; + GLuint ArgCount[2]; + struct atifragshader_src_register SrcReg[2][3]; + struct atifragshader_dst_register DstReg[2]; +}; + +extern GLuint GLAPIENTRY _mesa_GenFragmentShadersATI(GLuint range); + +extern void GLAPIENTRY _mesa_BindFragmentShaderATI(GLuint id); + +extern void GLAPIENTRY _mesa_DeleteFragmentShaderATI(GLuint id); + +extern void GLAPIENTRY _mesa_BeginFragmentShaderATI(void); + +extern void GLAPIENTRY _mesa_EndFragmentShaderATI(void); + +extern void GLAPIENTRY +_mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle); + +extern void GLAPIENTRY +_mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle); + +extern void GLAPIENTRY +_mesa_ColorFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMask, + GLuint dstMod, GLuint arg1, GLuint arg1Rep, + GLuint arg1Mod); + +extern void GLAPIENTRY +_mesa_ColorFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMask, + GLuint dstMod, GLuint arg1, GLuint arg1Rep, + GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, + GLuint arg2Mod); + +extern void GLAPIENTRY +_mesa_ColorFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMask, + GLuint dstMod, GLuint arg1, GLuint arg1Rep, + GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, + GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, + GLuint arg3Mod); + +extern void GLAPIENTRY +_mesa_AlphaFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod); + +extern void GLAPIENTRY +_mesa_AlphaFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, + GLuint arg2Rep, GLuint arg2Mod); + +extern void GLAPIENTRY +_mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, + GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, + GLuint arg3Rep, GLuint arg3Mod); + +extern void GLAPIENTRY +_mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value); + +#endif diff --git a/reactos/dll/mesa32/src/shader/descrip.mms b/reactos/dll/mesa32/src/shader/descrip.mms new file mode 100644 index 00000000000..e52479c9a69 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/descrip.mms @@ -0,0 +1,83 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl +# Last revision : 1 June 2005 + +.first + define gl [---.include.gl] + define math [-.math] + define swrast [-.swrast] + define array_cache [-.array_cache] + +.include [---]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [---.include],[.grammar],[-.main],[-.glapi],[.slang] +LIBDIR = [---.lib] +CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short) + +SOURCES = \ + atifragshader.c \ + arbfragparse.c \ + arbprogparse.c \ + arbprogram.c \ + arbvertparse.c \ + nvfragparse.c \ + nvprogram.c \ + nvvertexec.c \ + nvvertparse.c \ + program.c \ + shaderobjects.c \ + shaderobjects_3dlabs.c + +OBJECTS = \ + atifragshader.obj,\ + arbfragparse.obj,\ + arbprogparse.obj,\ + arbprogram.obj,\ + arbvertparse.obj,\ + nvfragparse.obj,\ + nvprogram.obj,\ + nvvertexec.obj,\ + nvvertparse.obj,\ + program.obj,\ + shaderobjects.obj,\ + shaderobjects_3dlabs.obj + + +##### RULES ##### + +VERSION=Mesa V3.4 + +##### TARGETS ##### +all : + $(MMS)$(MMSQUALIFIERS) $(LIBDIR)$(GL_LIB) + set def [.slang] + $(MMS)$(MMSQUALIFIERS) + set def [-.grammar] + $(MMS)$(MMSQUALIFIERS) + set def [-] + +# Make the library +$(LIBDIR)$(GL_LIB) : $(OBJECTS) + @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) + +clean : + purge + delete *.obj;* + +atifragshader.obj : atifragshader.c +arbfragparse.obj : arbfragparse.c +arbprogparse.obj : arbprogparse.c +arbprogram.obj : arbprogram.c +arbvertparse.obj : arbvertparse.c +nvfragparse.obj : nvfragparse.c +nvprogram.obj : nvprogram.c +nvvertexec.obj : nvvertexec.c +nvvertparse.obj : nvvertparse.c +program.obj : program.c +shaderobjects.obj : shaderobjects.c + cc$(CFLAGS)/nowarn shaderobjects.c +shaderobjects_3dlabs.obj : shaderobjects_3dlabs.c diff --git a/reactos/dll/mesa32/src/shader/grammar/descrip.mms b/reactos/dll/mesa32/src/shader/grammar/descrip.mms new file mode 100644 index 00000000000..b6736af15cc --- /dev/null +++ b/reactos/dll/mesa32/src/shader/grammar/descrip.mms @@ -0,0 +1,41 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl +# Last revision : 1 June 2005 + +.first + define gl [----.include.gl] + define math [--.math] + define swrast [--.swrast] + define array_cache [--.array_cache] + +.include [----]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [----.include],[],[--.main],[--.glapi],[-.slang] +LIBDIR = [----.lib] +CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short) + +SOURCES = grammar_mesa.c + +OBJECTS = grammar_mesa.obj + +##### RULES ##### + +VERSION=Mesa V3.4 + +##### TARGETS ##### +all : + $(MMS)$(MMSQUALIFIERS) $(LIBDIR)$(GL_LIB) + +# Make the library +$(LIBDIR)$(GL_LIB) : $(OBJECTS) + @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) + +clean : + purge + delete *.obj;* + +grammar_mesa.obj : grammar_mesa.c grammar.c diff --git a/reactos/dll/mesa32/src/shader/grammar/grammar.c b/reactos/dll/mesa32/src/shader/grammar/grammar.c new file mode 100644 index 00000000000..0b767c02cd3 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/grammar/grammar.c @@ -0,0 +1,3148 @@ +/* + * Mesa 3-D graphics library + * Version: 6.2 + * + * 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. + */ + +/** + * \file grammar.c + * syntax parsing engine + * \author Michal Krol + */ + +#ifndef GRAMMAR_PORT_BUILD +#error Do not build this file directly, build your grammar_XXX.c instead, which includes this file +#endif + +/* +*/ + +/* + INTRODUCTION + ------------ + + The task is to check the syntax of an input string. Input string is a stream of ASCII + characters terminated with a null-character ('\0'). Checking it using C language is + difficult and hard to implement without bugs. It is hard to maintain and make changes when + the syntax changes. + + This is because of a high redundancy of the C code. Large blocks of code are duplicated with + only small changes. Even use of macros does not solve the problem because macros cannot + erase the complexity of the problem. + + The resolution is to create a new language that will be highly oriented to our task. Once + we describe a particular syntax, we are done. We can then focus on the code that implements + the language. The size and complexity of it is relatively small than the code that directly + checks the syntax. + + First, we must implement our new language. Here, the language is implemented in C, but it + could also be implemented in any other language. The code is listed below. We must take + a good care that it is bug free. This is simple because the code is simple and clean. + + Next, we must describe the syntax of our new language in itself. Once created and checked + manually that it is correct, we can use it to check another scripts. + + Note that our new language loading code does not have to check the syntax. It is because we + assume that the script describing itself is correct, and other scripts can be syntactically + checked by the former script. The loading code must only do semantic checking which leads us to + simple resolving references. + + THE LANGUAGE + ------------ + + Here I will describe the syntax of the new language (further called "Synek"). It is mainly a + sequence of declarations terminated by a semicolon. The declaration consists of a symbol, + which is an identifier, and its definition. A definition is in turn a sequence of specifiers + connected with ".and" or ".or" operator. These operators cannot be mixed together in a one + definition. Specifier can be a symbol, string, character, character range or a special + keyword ".true" or ".false". + + On the very beginning of the script there is a declaration of a root symbol and is in the form: + .syntax ; + The must be on of the symbols in declaration sequence. The syntax is correct if + the root symbol evaluates to true. A symbol evaluates to true if the definition associated with + the symbol evaluates to true. Definition evaluation depends on the operator used to connect + specifiers in the definition. If ".and" operator is used, definition evaluates to true if and + only if all the specifiers evaluate to true. If ".or" operator is used, definition evalutes to + true if any of the specifiers evaluates to true. If definition contains only one specifier, + it is evaluated as if it was connected with ".true" keyword by ".and" operator. + + If specifier is a ".true" keyword, it always evaluates to true. + + If specifier is a ".false" keyword, it always evaluates to false. Specifier evaluates to false + when it does not evaluate to true. + + Character range specifier is in the form: + '' - '' + If specifier is a character range, it evaluates to true if character in the stream is greater + or equal to and less or equal to . In that situation + the stream pointer is advanced to point to next character in the stream. All C-style escape + sequences are supported although trigraph sequences are not. The comparisions are performed + on 8-bit unsigned integers. + + Character specifier is in the form: + '' + It evaluates to true if the following character range specifier evaluates to true: + '' - '' + + String specifier is in the form: + "" + Let N be the number of characters in . Let [i] designate i-th character in + . Then the string specifier evaluates to true if and only if for i in the range [0, N) + the following character specifier evaluates to true: + '[i]' + If [i] is a quotation mark, '[i]' is replaced with '\[i]'. + + Symbol specifier can be optionally preceded by a ".loop" keyword in the form: + .loop (1) + where is defined as follows: + ; (2) + Construction (1) is replaced by the following code: + + and declaration (2) is replaced by the following: + .or .true; + .and ; + ; + + Synek supports also a register mechanizm. User can, in its SYN file, declare a number of + registers that can be accessed in the syn body. Each reg has its name and a default value. + The register is one byte wide. The C code can change the default value by calling + grammar_set_reg8() with grammar id, register name and a new value. As we know, each rule is + a sequence of specifiers joined with .and or .or operator. And now each specifier can be + prefixed with a condition expression in a form ".if ( )" + where can be == or !=. If the condition evaluates to false, the specifier + evaluates to .false. Otherwise it evalutes to the specifier. + + ESCAPE SEQUENCES + ---------------- + + Synek supports all escape sequences in character specifiers. The mapping table is listed below. + All occurences of the characters in the first column are replaced with the corresponding + character in the second column. + + Escape sequence Represents + ------------------------------------------------------------------------------------------------ + \a Bell (alert) + \b Backspace + \f Formfeed + \n New line + \r Carriage return + \t Horizontal tab + \v Vertical tab + \' Single quotation mark + \" Double quotation mark + \\ Backslash + \? Literal question mark + \ooo ASCII character in octal notation + \xhhh ASCII character in hexadecimal notation + ------------------------------------------------------------------------------------------------ + + RAISING ERRORS + -------------- + + Any specifier can be followed by a special construction that is executed when the specifier + evaluates to false. The construction is in the form: + .error + is an identifier declared earlier by error text declaration. The declaration is + in the form: + .errtext "" + When specifier evaluates to false and this construction is present, parsing is stopped + immediately and is returned as a result of parsing. The error position is also + returned and it is meant as an offset from the beggining of the stream to the character that + was valid so far. Example: + + (**** syntax script ****) + + .syntax program; + .errtext MISSING_SEMICOLON "missing ';'" + program declaration .and .loop space .and ';' .error MISSING_SEMICOLON .and + .loop space .and '\0'; + declaration "declare" .and .loop space .and identifier; + space ' '; + + (**** sample code ****) + + declare foo , + + In the example above checking the sample code will result in error message "missing ';'" and + error position 12. The sample code is not correct. Note the presence of '\0' specifier to + assure that there is no code after semicolon - only spaces. + can optionally contain identifier surrounded by dollar signs $. In such a case, + the identifier and dollar signs are replaced by a string retrieved by invoking symbol with + the identifier name. The starting position is the error position. The lenght of the resulting + string is the position after invoking the symbol. + + PRODUCTION + ---------- + + Synek not only checks the syntax but it can also produce (emit) bytes associated with specifiers + that evaluate to true. That is, every specifier and optional error construction can be followed + by a number of emit constructions that are in the form: + .emit + can be a HEX number, identifier, a star * or a dollar $. HEX number is preceded by + 0x or 0X. If is an identifier, it must be earlier declared by emit code declaration + in the form: + .emtcode + + When given specifier evaluates to true, all emits associated with the specifier are output + in order they were declared. A star means that last-read character should be output instead + of constant value. Example: + + (**** syntax script ****) + + .syntax foobar; + .emtcode WORD_FOO 0x01 + .emtcode WORD_BAR 0x02 + foobar FOO .emit WORD_FOO .or BAR .emit WORD_BAR .or .true .emit 0x00; + FOO "foo" .and SPACE; + BAR "bar" .and SPACE; + SPACE ' ' .or '\0'; + + (**** sample text 1 ****) + + foo + + (**** sample text 2 ****) + + foobar + + For both samples the result will be one-element array. For first sample text it will be + value 1, for second - 0. Note that every text will be accepted because of presence of + .true as an alternative. + + Another example: + + (**** syntax script ****) + + .syntax declaration; + .emtcode VARIABLE 0x01 + declaration "declare" .and .loop space .and + identifier .emit VARIABLE .and (1) + .true .emit 0x00 .and (2) + .loop space .and ';'; + space ' ' .or '\t'; + identifier .loop id_char .emit *; (3) + id_char 'a'-'z' .or 'A'-'Z' .or '_'; + + (**** sample code ****) + + declare fubar; + + In specifier (1) symbol is followed by .emit VARIABLE. If it evaluates to + true, VARIABLE constant and then production of the symbol is output. Specifier (2) is used + to terminate the string with null to signal when the string ends. Specifier (3) outputs + all characters that make declared identifier. The result of sample code will be the + following array: + { 1, 'f', 'u', 'b', 'a', 'r', 0 } + + If .emit is followed by dollar $, it means that current position should be output. Current + position is a 32-bit unsigned integer distance from the very beginning of the parsed string to + first character consumed by the specifier associated with the .emit instruction. Current + position is stored in the output buffer in Little-Endian convention (the lowest byte comes + first). +*/ + +static void mem_free (void **); + +/* + internal error messages +*/ +static const byte *OUT_OF_MEMORY = (byte *) "internal error 1001: out of physical memory"; +static const byte *UNRESOLVED_REFERENCE = (byte *) "internal error 1002: unresolved reference '$'"; +static const byte *INVALID_GRAMMAR_ID = (byte *) "internal error 1003: invalid grammar object"; +static const byte *INVALID_REGISTER_NAME = (byte *) "internal error 1004: invalid register name: '$'"; +/*static const byte *DUPLICATE_IDENTIFIER = (byte *) "internal error 1005: identifier '$' already defined";*/ +static const byte *UNREFERENCED_IDENTIFIER =(byte *) "internal error 1006: unreferenced identifier '$'"; + +static const byte *error_message = NULL; /* points to one of the error messages above */ +static byte *error_param = NULL; /* this is inserted into error_message in place of $ */ +static int error_position = -1; + +static byte *unknown = (byte *) "???"; + +static void clear_last_error (void) +{ + /* reset error message */ + error_message = NULL; + + /* free error parameter - if error_param is a "???" don't free it - it's static */ + if (error_param != unknown) + mem_free ((void **) (void *) &error_param); + else + error_param = NULL; + + /* reset error position */ + error_position = -1; +} + +static void set_last_error (const byte *msg, byte *param, int pos) +{ + /* error message can be set only once */ + if (error_message != NULL) + { + mem_free ((void **) (void *) ¶m); + return; + } + + error_message = msg; + + /* if param is NULL, set error_param to unknown ("???") */ + /* note: do not try to strdup the "???" - it may be that we are here because of */ + /* out of memory error so strdup can fail */ + if (param != NULL) + error_param = param; + else + error_param = unknown; + + error_position = pos; +} + +/* + memory management routines +*/ +static void *mem_alloc (size_t size) +{ + void *ptr = grammar_alloc_malloc (size); + if (ptr == NULL) + set_last_error (OUT_OF_MEMORY, NULL, -1); + return ptr; +} + +static void *mem_copy (void *dst, const void *src, size_t size) +{ + return grammar_memory_copy (dst, src, size); +} + +static void mem_free (void **ptr) +{ + grammar_alloc_free (*ptr); + *ptr = NULL; +} + +static void *mem_realloc (void *ptr, size_t old_size, size_t new_size) +{ + void *ptr2 = grammar_alloc_realloc (ptr, old_size, new_size); + if (ptr2 == NULL) + set_last_error (OUT_OF_MEMORY, NULL, -1); + return ptr2; +} + +static byte *str_copy_n (byte *dst, const byte *src, size_t max_len) +{ + return grammar_string_copy_n (dst, src, max_len); +} + +static byte *str_duplicate (const byte *str) +{ + byte *new_str = grammar_string_duplicate (str); + if (new_str == NULL) + set_last_error (OUT_OF_MEMORY, NULL, -1); + return new_str; +} + +static int str_equal (const byte *str1, const byte *str2) +{ + return grammar_string_compare (str1, str2) == 0; +} + +static int str_equal_n (const byte *str1, const byte *str2, unsigned int n) +{ + return grammar_string_compare_n (str1, str2, n) == 0; +} + +static unsigned int str_length (const byte *str) +{ + return grammar_string_length (str); +} + +/* + useful macros +*/ +#define GRAMMAR_IMPLEMENT_LIST_APPEND(_Ty)\ + static void _Ty##_append (_Ty **x, _Ty *nx) {\ + while (*x) x = &(**x).next;\ + *x = nx;\ + } + +/* + string to byte map typedef +*/ +typedef struct map_byte_ +{ + byte *key; + byte data; + struct map_byte_ *next; +} map_byte; + +static void map_byte_create (map_byte **ma) +{ + *ma = (map_byte *) mem_alloc (sizeof (map_byte)); + if (*ma) + { + (**ma).key = NULL; + (**ma).data = '\0'; + (**ma).next = NULL; + } +} + +static void map_byte_destroy (map_byte **ma) +{ + if (*ma) + { + map_byte_destroy (&(**ma).next); + mem_free ((void **) &(**ma).key); + mem_free ((void **) ma); + } +} + +GRAMMAR_IMPLEMENT_LIST_APPEND(map_byte) + +/* + searches the map for the specified key, + returns pointer to the element with the specified key if it exists + returns NULL otherwise +*/ +static map_byte *map_byte_locate (map_byte **ma, const byte *key) +{ + while (*ma) + { + if (str_equal ((**ma).key, key)) + return *ma; + + ma = &(**ma).next; + } + + set_last_error (UNRESOLVED_REFERENCE, str_duplicate (key), -1); + return NULL; +} + +/* + searches the map for specified key, + if the key is matched, *data is filled with data associated with the key, + returns 0 if the key is matched, + returns 1 otherwise +*/ +static int map_byte_find (map_byte **ma, const byte *key, byte *data) +{ + map_byte *found = map_byte_locate (ma, key); + if (found != NULL) + { + *data = found->data; + + return 0; + } + + return 1; +} + +/* + regbyte context typedef + + Each regbyte consists of its name and a default value. These are static and created at + grammar script compile-time, for example the following line: + .regbyte vertex_blend 0x00 + adds a new regbyte named "vertex_blend" to the static list and initializes it to 0. + When the script is executed, this regbyte can be accessed by name for read and write. When a + particular regbyte is written, a new regbyte_ctx entry is added to the top of the regbyte_ctx + stack. The new entry contains information abot which regbyte it references and its new value. + When a given regbyte is accessed for read, the stack is searched top-down to find an + entry that references the regbyte. The first matching entry is used to return the current + value it holds. If no entry is found, the default value is returned. +*/ +typedef struct regbyte_ctx_ +{ + map_byte *m_regbyte; + byte m_current_value; + struct regbyte_ctx_ *m_prev; +} regbyte_ctx; + +static void regbyte_ctx_create (regbyte_ctx **re) +{ + *re = (regbyte_ctx *) mem_alloc (sizeof (regbyte_ctx)); + if (*re) + { + (**re).m_regbyte = NULL; + (**re).m_prev = NULL; + } +} + +static void regbyte_ctx_destroy (regbyte_ctx **re) +{ + if (*re) + { + mem_free ((void **) re); + } +} + +static byte regbyte_ctx_extract (regbyte_ctx **re, map_byte *reg) +{ + /* first lookup in the register stack */ + while (*re != NULL) + { + if ((**re).m_regbyte == reg) + return (**re).m_current_value; + + re = &(**re).m_prev; + } + + /* if not found - return the default value */ + return reg->data; +} + +/* + emit type typedef +*/ +typedef enum emit_type_ +{ + et_byte, /* explicit number */ + et_stream, /* eaten character */ + et_position /* current position */ +} emit_type; + +/* + emit destination typedef +*/ +typedef enum emit_dest_ +{ + ed_output, /* write to the output buffer */ + ed_regbyte /* write a particular regbyte */ +} emit_dest; + +/* + emit typedef +*/ +typedef struct emit_ +{ + emit_dest m_emit_dest; + emit_type m_emit_type; /* ed_output */ + byte m_byte; /* et_byte */ + map_byte *m_regbyte; /* ed_regbyte */ + byte *m_regname; /* ed_regbyte - temporary */ + struct emit_ *m_next; +} emit; + +static void emit_create (emit **em) +{ + *em = (emit *) mem_alloc (sizeof (emit)); + if (*em) + { + (**em).m_emit_dest = ed_output; + (**em).m_emit_type = et_byte; + (**em).m_byte = '\0'; + (**em).m_regbyte = NULL; + (**em).m_regname = NULL; + (**em).m_next = NULL; + } +} + +static void emit_destroy (emit **em) +{ + if (*em) + { + emit_destroy (&(**em).m_next); + mem_free ((void **) &(**em).m_regname); + mem_free ((void **) em); + } +} + +static unsigned int emit_size (emit *_E) +{ + unsigned int n = 0; + + while (_E != NULL) + { + if (_E->m_emit_dest == ed_output) + { + if (_E->m_emit_type == et_position) + n += 4; /* position is a 32-bit unsigned integer */ + else + n++; + } + _E = _E->m_next; + } + + return n; +} + +static int emit_push (emit *_E, byte *_P, byte c, unsigned int _Pos, regbyte_ctx **_Ctx) +{ + while (_E != NULL) + { + if (_E->m_emit_dest == ed_output) + { + if (_E->m_emit_type == et_byte) + *_P++ = _E->m_byte; + else if (_E->m_emit_type == et_stream) + *_P++ = c; + else /* _Em->type == et_position */ + { + *_P++ = (byte) (_Pos); + *_P++ = (byte) (_Pos >> 8); + *_P++ = (byte) (_Pos >> 16); + *_P++ = (byte) (_Pos >> 24); + } + } + else + { + regbyte_ctx *new_rbc; + regbyte_ctx_create (&new_rbc); + if (new_rbc == NULL) + return 1; + + new_rbc->m_prev = *_Ctx; + new_rbc->m_regbyte = _E->m_regbyte; + *_Ctx = new_rbc; + + if (_E->m_emit_type == et_byte) + new_rbc->m_current_value = _E->m_byte; + else if (_E->m_emit_type == et_stream) + new_rbc->m_current_value = c; + } + + _E = _E->m_next; + } + + return 0; +} + +/* + error typedef +*/ +typedef struct error_ +{ + byte *m_text; + byte *m_token_name; + struct rule_ *m_token; +} error; + +static void error_create (error **er) +{ + *er = (error *) mem_alloc (sizeof (error)); + if (*er) + { + (**er).m_text = NULL; + (**er).m_token_name = NULL; + (**er).m_token = NULL; + } +} + +static void error_destroy (error **er) +{ + if (*er) + { + mem_free ((void **) &(**er).m_text); + mem_free ((void **) &(**er).m_token_name); + mem_free ((void **) er); + } +} + +struct dict_; +static byte *error_get_token (error *, struct dict_ *, const byte *, unsigned int); + +/* + condition operand type typedef +*/ +typedef enum cond_oper_type_ +{ + cot_byte, /* constant 8-bit unsigned integer */ + cot_regbyte /* pointer to byte register containing the current value */ +} cond_oper_type; + +/* + condition operand typedef +*/ +typedef struct cond_oper_ +{ + cond_oper_type m_type; + byte m_byte; /* cot_byte */ + map_byte *m_regbyte; /* cot_regbyte */ + byte *m_regname; /* cot_regbyte - temporary */ +} cond_oper; + +/* + condition type typedef +*/ +typedef enum cond_type_ +{ + ct_equal, + ct_not_equal +} cond_type; + +/* + condition typedef +*/ +typedef struct cond_ +{ + cond_type m_type; + cond_oper m_operands[2]; +} cond; + +static void cond_create (cond **co) +{ + *co = (cond *) mem_alloc (sizeof (cond)); + if (*co) + { + (**co).m_operands[0].m_regname = NULL; + (**co).m_operands[1].m_regname = NULL; + } +} + +static void cond_destroy (cond **co) +{ + if (*co) + { + mem_free ((void **) &(**co).m_operands[0].m_regname); + mem_free ((void **) &(**co).m_operands[1].m_regname); + mem_free ((void **) co); + } +} + +/* + specifier type typedef +*/ +typedef enum spec_type_ +{ + st_false, + st_true, + st_byte, + st_byte_range, + st_string, + st_identifier, + st_identifier_loop, + st_debug +} spec_type; + +/* + specifier typedef +*/ +typedef struct spec_ +{ + spec_type m_spec_type; + byte m_byte[2]; /* st_byte, st_byte_range */ + byte *m_string; /* st_string */ + struct rule_ *m_rule; /* st_identifier, st_identifier_loop */ + emit *m_emits; + error *m_errtext; + cond *m_cond; + struct spec_ *next; +} spec; + +static void spec_create (spec **sp) +{ + *sp = (spec *) mem_alloc (sizeof (spec)); + if (*sp) + { + (**sp).m_spec_type = st_false; + (**sp).m_byte[0] = '\0'; + (**sp).m_byte[1] = '\0'; + (**sp).m_string = NULL; + (**sp).m_rule = NULL; + (**sp).m_emits = NULL; + (**sp).m_errtext = NULL; + (**sp).m_cond = NULL; + (**sp).next = NULL; + } +} + +static void spec_destroy (spec **sp) +{ + if (*sp) + { + spec_destroy (&(**sp).next); + emit_destroy (&(**sp).m_emits); + error_destroy (&(**sp).m_errtext); + mem_free ((void **) &(**sp).m_string); + cond_destroy (&(**sp).m_cond); + mem_free ((void **) sp); + } +} + +GRAMMAR_IMPLEMENT_LIST_APPEND(spec) + +/* + operator typedef +*/ +typedef enum oper_ +{ + op_none, + op_and, + op_or +} oper; + +/* + rule typedef +*/ +typedef struct rule_ +{ + oper m_oper; + spec *m_specs; + struct rule_ *next; + int m_referenced; +} rule; + +static void rule_create (rule **ru) +{ + *ru = (rule *) mem_alloc (sizeof (rule)); + if (*ru) + { + (**ru).m_oper = op_none; + (**ru).m_specs = NULL; + (**ru).next = NULL; + (**ru).m_referenced = 0; + } +} + +static void rule_destroy (rule **ru) +{ + if (*ru) + { + rule_destroy (&(**ru).next); + spec_destroy (&(**ru).m_specs); + mem_free ((void **) ru); + } +} + +GRAMMAR_IMPLEMENT_LIST_APPEND(rule) + +/* + returns unique grammar id +*/ +static grammar next_valid_grammar_id (void) +{ + static grammar id = 0; + + return ++id; +} + +/* + dictionary typedef +*/ +typedef struct dict_ +{ + rule *m_rulez; + rule *m_syntax; + rule *m_string; + map_byte *m_regbytes; + grammar m_id; + struct dict_ *next; +} dict; + +static void dict_create (dict **di) +{ + *di = (dict *) mem_alloc (sizeof (dict)); + if (*di) + { + (**di).m_rulez = NULL; + (**di).m_syntax = NULL; + (**di).m_string = NULL; + (**di).m_regbytes = NULL; + (**di).m_id = next_valid_grammar_id (); + (**di).next = NULL; + } +} + +static void dict_destroy (dict **di) +{ + if (*di) + { + rule_destroy (&(**di).m_rulez); + map_byte_destroy (&(**di).m_regbytes); + mem_free ((void **) di); + } +} + +GRAMMAR_IMPLEMENT_LIST_APPEND(dict) + +static void dict_find (dict **di, grammar key, dict **data) +{ + while (*di) + { + if ((**di).m_id == key) + { + *data = *di; + return; + } + + di = &(**di).next; + } + + *data = NULL; +} + +static dict *g_dicts = NULL; + +/* + byte array typedef +*/ +typedef struct barray_ +{ + byte *data; + unsigned int len; +} barray; + +static void barray_create (barray **ba) +{ + *ba = (barray *) mem_alloc (sizeof (barray)); + if (*ba) + { + (**ba).data = NULL; + (**ba).len = 0; + } +} + +static void barray_destroy (barray **ba) +{ + if (*ba) + { + mem_free ((void **) &(**ba).data); + mem_free ((void **) ba); + } +} + +/* + reallocates byte array to requested size, + returns 0 on success, + returns 1 otherwise +*/ +static int barray_resize (barray **ba, unsigned int nlen) +{ + byte *new_pointer; + + if (nlen == 0) + { + mem_free ((void **) &(**ba).data); + (**ba).data = NULL; + (**ba).len = 0; + + return 0; + } + else + { + new_pointer = (byte *) mem_realloc ((**ba).data, (**ba).len * sizeof (byte), + nlen * sizeof (byte)); + if (new_pointer) + { + (**ba).data = new_pointer; + (**ba).len = nlen; + + return 0; + } + } + + return 1; +} + +/* + adds byte array pointed by *nb to the end of array pointed by *ba, + returns 0 on success, + returns 1 otherwise +*/ +static int barray_append (barray **ba, barray **nb) +{ + const unsigned int len = (**ba).len; + + if (barray_resize (ba, (**ba).len + (**nb).len)) + return 1; + + mem_copy ((**ba).data + len, (**nb).data, (**nb).len); + + return 0; +} + +/* + adds emit chain pointed by em to the end of array pointed by *ba, + returns 0 on success, + returns 1 otherwise +*/ +static int barray_push (barray **ba, emit *em, byte c, unsigned int pos, regbyte_ctx **rbc) +{ + unsigned int count = emit_size (em); + + if (barray_resize (ba, (**ba).len + count)) + return 1; + + return emit_push (em, (**ba).data + ((**ba).len - count), c, pos, rbc); +} + +/* + byte pool typedef +*/ +typedef struct bytepool_ +{ + byte *_F; + unsigned int _Siz; +} bytepool; + +static void bytepool_destroy (bytepool **by) +{ + if (*by != NULL) + { + mem_free ((void **) &(**by)._F); + mem_free ((void **) by); + } +} + +static void bytepool_create (bytepool **by, int len) +{ + *by = (bytepool *) (mem_alloc (sizeof (bytepool))); + if (*by != NULL) + { + (**by)._F = (byte *) (mem_alloc (sizeof (byte) * len)); + (**by)._Siz = len; + + if ((**by)._F == NULL) + bytepool_destroy (by); + } +} + +static int bytepool_reserve (bytepool *by, unsigned int n) +{ + byte *_P; + + if (n <= by->_Siz) + return 0; + + /* byte pool can only grow and at least by doubling its size */ + n = n >= by->_Siz * 2 ? n : by->_Siz * 2; + + /* reallocate the memory and adjust pointers to the new memory location */ + _P = (byte *) (mem_realloc (by->_F, sizeof (byte) * by->_Siz, sizeof (byte) * n)); + if (_P != NULL) + { + by->_F = _P; + by->_Siz = n; + return 0; + } + + return 1; +} + +/* + string to string map typedef +*/ +typedef struct map_str_ +{ + byte *key; + byte *data; + struct map_str_ *next; +} map_str; + +static void map_str_create (map_str **ma) +{ + *ma = (map_str *) mem_alloc (sizeof (map_str)); + if (*ma) + { + (**ma).key = NULL; + (**ma).data = NULL; + (**ma).next = NULL; + } +} + +static void map_str_destroy (map_str **ma) +{ + if (*ma) + { + map_str_destroy (&(**ma).next); + mem_free ((void **) &(**ma).key); + mem_free ((void **) &(**ma).data); + mem_free ((void **) ma); + } +} + +GRAMMAR_IMPLEMENT_LIST_APPEND(map_str) + +/* + searches the map for specified key, + if the key is matched, *data is filled with data associated with the key, + returns 0 if the key is matched, + returns 1 otherwise +*/ +static int map_str_find (map_str **ma, const byte *key, byte **data) +{ + while (*ma) + { + if (str_equal ((**ma).key, key)) + { + *data = str_duplicate ((**ma).data); + if (*data == NULL) + return 1; + + return 0; + } + + ma = &(**ma).next; + } + + set_last_error (UNRESOLVED_REFERENCE, str_duplicate (key), -1); + return 1; +} + +/* + string to rule map typedef +*/ +typedef struct map_rule_ +{ + byte *key; + rule *data; + struct map_rule_ *next; +} map_rule; + +static void map_rule_create (map_rule **ma) +{ + *ma = (map_rule *) mem_alloc (sizeof (map_rule)); + if (*ma) + { + (**ma).key = NULL; + (**ma).data = NULL; + (**ma).next = NULL; + } +} + +static void map_rule_destroy (map_rule **ma) +{ + if (*ma) + { + map_rule_destroy (&(**ma).next); + mem_free ((void **) &(**ma).key); + mem_free ((void **) ma); + } +} + +GRAMMAR_IMPLEMENT_LIST_APPEND(map_rule) + +/* + searches the map for specified key, + if the key is matched, *data is filled with data associated with the key, + returns 0 if the is matched, + returns 1 otherwise +*/ +static int map_rule_find (map_rule **ma, const byte *key, rule **data) +{ + while (*ma) + { + if (str_equal ((**ma).key, key)) + { + *data = (**ma).data; + + return 0; + } + + ma = &(**ma).next; + } + + set_last_error (UNRESOLVED_REFERENCE, str_duplicate (key), -1); + return 1; +} + +/* + returns 1 if given character is a white space, + returns 0 otherwise +*/ +static int is_space (byte c) +{ + return c == ' ' || c == '\t' || c == '\n' || c == '\r'; +} + +/* + advances text pointer by 1 if character pointed by *text is a space, + returns 1 if a space has been eaten, + returns 0 otherwise +*/ +static int eat_space (const byte **text) +{ + if (is_space (**text)) + { + (*text)++; + + return 1; + } + + return 0; +} + +/* + returns 1 if text points to C-style comment start string, + returns 0 otherwise +*/ +static int is_comment_start (const byte *text) +{ + return text[0] == '/' && text[1] == '*'; +} + +/* + advances text pointer to first character after C-style comment block - if any, + returns 1 if C-style comment block has been encountered and eaten, + returns 0 otherwise +*/ +static int eat_comment (const byte **text) +{ + if (is_comment_start (*text)) + { + /* *text points to comment block - skip two characters to enter comment body */ + *text += 2; + /* skip any character except consecutive '*' and '/' */ + while (!((*text)[0] == '*' && (*text)[1] == '/')) + (*text)++; + /* skip those two terminating characters */ + *text += 2; + + return 1; + } + + return 0; +} + +/* + advances text pointer to first character that is neither space nor C-style comment block +*/ +static void eat_spaces (const byte **text) +{ + while (eat_space (text) || eat_comment (text)) + ; +} + +/* + resizes string pointed by *ptr to successfully add character c to the end of the string, + returns 0 on success, + returns 1 otherwise +*/ +static int string_grow (byte **ptr, unsigned int *len, byte c) +{ + /* reallocate the string in 16-byte increments */ + if ((*len & 0x0F) == 0x0F || *ptr == NULL) + { + byte *tmp = (byte *) mem_realloc (*ptr, ((*len + 1) & ~0x0F) * sizeof (byte), + ((*len + 1 + 0x10) & ~0x0F) * sizeof (byte)); + if (tmp == NULL) + return 1; + + *ptr = tmp; + } + + if (c) + { + /* append given character */ + (*ptr)[*len] = c; + (*len)++; + } + (*ptr)[*len] = '\0'; + + return 0; +} + +/* + returns 1 if given character is a valid identifier character a-z, A-Z, 0-9 or _ + returns 0 otherwise +*/ +static int is_identifier (byte c) +{ + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_'; +} + +/* + copies characters from *text to *id until non-identifier character is encountered, + assumes that *id points to NULL object - caller is responsible for later freeing the string, + text pointer is advanced to point past the copied identifier, + returns 0 if identifier was successfully copied, + returns 1 otherwise +*/ +static int get_identifier (const byte **text, byte **id) +{ + const byte *t = *text; + byte *p = NULL; + unsigned int len = 0; + + if (string_grow (&p, &len, '\0')) + return 1; + + /* loop while next character in buffer is valid for identifiers */ + while (is_identifier (*t)) + { + if (string_grow (&p, &len, *t++)) + { + mem_free ((void **) (void *) &p); + return 1; + } + } + + *text = t; + *id = p; + + return 0; +} + +/* + converts sequence of DEC digits pointed by *text until non-DEC digit is encountered, + advances text pointer past the converted sequence, + returns the converted value +*/ +static unsigned int dec_convert (const byte **text) +{ + unsigned int value = 0; + + while (**text >= '0' && **text <= '9') + { + value = value * 10 + **text - '0'; + (*text)++; + } + + return value; +} + +/* + returns 1 if given character is HEX digit 0-9, A-F or a-f, + returns 0 otherwise +*/ +static int is_hex (byte c) +{ + return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'); +} + +/* + returns value of passed character as if it was HEX digit +*/ +static unsigned int hex2dec (byte c) +{ + if (c >= '0' && c <= '9') + return c - '0'; + if (c >= 'A' && c <= 'F') + return c - 'A' + 10; + return c - 'a' + 10; +} + +/* + converts sequence of HEX digits pointed by *text until non-HEX digit is encountered, + advances text pointer past the converted sequence, + returns the converted value +*/ +static unsigned int hex_convert (const byte **text) +{ + unsigned int value = 0; + + while (is_hex (**text)) + { + value = value * 0x10 + hex2dec (**text); + (*text)++; + } + + return value; +} + +/* + returns 1 if given character is OCT digit 0-7, + returns 0 otherwise +*/ +static int is_oct (byte c) +{ + return c >= '0' && c <= '7'; +} + +/* + returns value of passed character as if it was OCT digit +*/ +static int oct2dec (byte c) +{ + return c - '0'; +} + +static byte get_escape_sequence (const byte **text) +{ + int value = 0; + + /* skip '\' character */ + (*text)++; + + switch (*(*text)++) + { + case '\'': + return '\''; + case '"': + return '\"'; + case '?': + return '\?'; + case '\\': + return '\\'; + case 'a': + return '\a'; + case 'b': + return '\b'; + case 'f': + return '\f'; + case 'n': + return '\n'; + case 'r': + return '\r'; + case 't': + return '\t'; + case 'v': + return '\v'; + case 'x': + return (byte) hex_convert (text); + } + + (*text)--; + if (is_oct (**text)) + { + value = oct2dec (*(*text)++); + if (is_oct (**text)) + { + value = value * 010 + oct2dec (*(*text)++); + if (is_oct (**text)) + value = value * 010 + oct2dec (*(*text)++); + } + } + + return (byte) value; +} + +/* + copies characters from *text to *str until " or ' character is encountered, + assumes that *str points to NULL object - caller is responsible for later freeing the string, + assumes that *text points to " or ' character that starts the string, + text pointer is advanced to point past the " or ' character, + returns 0 if string was successfully copied, + returns 1 otherwise +*/ +static int get_string (const byte **text, byte **str) +{ + const byte *t = *text; + byte *p = NULL; + unsigned int len = 0; + byte term_char; + + if (string_grow (&p, &len, '\0')) + return 1; + + /* read " or ' character that starts the string */ + term_char = *t++; + /* while next character is not the terminating character */ + while (*t && *t != term_char) + { + byte c; + + if (*t == '\\') + c = get_escape_sequence (&t); + else + c = *t++; + + if (string_grow (&p, &len, c)) + { + mem_free ((void **) (void *) &p); + return 1; + } + } + /* skip " or ' character that ends the string */ + t++; + + *text = t; + *str = p; + return 0; +} + +/* + gets emit code, the syntax is: + ".emtcode" " " " " (("0x" | "0X") ) | | + assumes that *text already points to , + returns 0 if emit code is successfully read, + returns 1 otherwise +*/ +static int get_emtcode (const byte **text, map_byte **ma) +{ + const byte *t = *text; + map_byte *m = NULL; + + map_byte_create (&m); + if (m == NULL) + return 1; + + if (get_identifier (&t, &m->key)) + { + map_byte_destroy (&m); + return 1; + } + eat_spaces (&t); + + if (*t == '\'') + { + byte *c; + + if (get_string (&t, &c)) + { + map_byte_destroy (&m); + return 1; + } + + m->data = (byte) c[0]; + mem_free ((void **) (void *) &c); + } + else if (t[0] == '0' && (t[1] == 'x' || t[1] == 'X')) + { + /* skip HEX "0x" or "0X" prefix */ + t += 2; + m->data = (byte) hex_convert (&t); + } + else + { + m->data = (byte) dec_convert (&t); + } + + eat_spaces (&t); + + *text = t; + *ma = m; + return 0; +} + +/* + gets regbyte declaration, the syntax is: + ".regbyte" " " " " (("0x" | "0X") ) | | + assumes that *text already points to , + returns 0 if regbyte is successfully read, + returns 1 otherwise +*/ +static int get_regbyte (const byte **text, map_byte **ma) +{ + /* pass it to the emtcode parser as it has the same syntax starting at */ + return get_emtcode (text, ma); +} + +/* + returns 0 on success, + returns 1 otherwise +*/ +static int get_errtext (const byte **text, map_str **ma) +{ + const byte *t = *text; + map_str *m = NULL; + + map_str_create (&m); + if (m == NULL) + return 1; + + if (get_identifier (&t, &m->key)) + { + map_str_destroy (&m); + return 1; + } + eat_spaces (&t); + + if (get_string (&t, &m->data)) + { + map_str_destroy (&m); + return 1; + } + eat_spaces (&t); + + *text = t; + *ma = m; + return 0; +} + +/* + returns 0 on success, + returns 1 otherwise, +*/ +static int get_error (const byte **text, error **er, map_str *maps) +{ + const byte *t = *text; + byte *temp = NULL; + + if (*t != '.') + return 0; + + t++; + if (get_identifier (&t, &temp)) + return 1; + eat_spaces (&t); + + if (!str_equal ((byte *) "error", temp)) + { + mem_free ((void **) (void *) &temp); + return 0; + } + + mem_free ((void **) (void *) &temp); + + error_create (er); + if (*er == NULL) + return 1; + + if (*t == '\"') + { + if (get_string (&t, &(**er).m_text)) + { + error_destroy (er); + return 1; + } + eat_spaces (&t); + } + else + { + if (get_identifier (&t, &temp)) + { + error_destroy (er); + return 1; + } + eat_spaces (&t); + + if (map_str_find (&maps, temp, &(**er).m_text)) + { + mem_free ((void **) (void *) &temp); + error_destroy (er); + return 1; + } + + mem_free ((void **) (void *) &temp); + } + + /* try to extract "token" from "...$token$..." */ + { + byte *processed = NULL; + unsigned int len = 0, i = 0; + + if (string_grow (&processed, &len, '\0')) + { + error_destroy (er); + return 1; + } + + while (i < str_length ((**er).m_text)) + { + /* check if the dollar sign is repeated - if so skip it */ + if ((**er).m_text[i] == '$' && (**er).m_text[i + 1] == '$') + { + if (string_grow (&processed, &len, '$')) + { + mem_free ((void **) (void *) &processed); + error_destroy (er); + return 1; + } + + i += 2; + } + else if ((**er).m_text[i] != '$') + { + if (string_grow (&processed, &len, (**er).m_text[i])) + { + mem_free ((void **) (void *) &processed); + error_destroy (er); + return 1; + } + + i++; + } + else + { + if (string_grow (&processed, &len, '$')) + { + mem_free ((void **) (void *) &processed); + error_destroy (er); + return 1; + } + + { + /* length of token being extracted */ + unsigned int tlen = 0; + + if (string_grow (&(**er).m_token_name, &tlen, '\0')) + { + mem_free ((void **) (void *) &processed); + error_destroy (er); + return 1; + } + + /* skip the dollar sign */ + i++; + + while ((**er).m_text[i] != '$') + { + if (string_grow (&(**er).m_token_name, &tlen, (**er).m_text[i])) + { + mem_free ((void **) (void *) &processed); + error_destroy (er); + return 1; + } + + i++; + } + + /* skip the dollar sign */ + i++; + } + } + } + + mem_free ((void **) &(**er).m_text); + (**er).m_text = processed; + } + + *text = t; + return 0; +} + +/* + returns 0 on success, + returns 1 otherwise, +*/ +static int get_emits (const byte **text, emit **em, map_byte *mapb) +{ + const byte *t = *text; + byte *temp = NULL; + emit *e = NULL; + emit_dest dest; + + if (*t != '.') + return 0; + + t++; + if (get_identifier (&t, &temp)) + return 1; + eat_spaces (&t); + + /* .emit */ + if (str_equal ((byte *) "emit", temp)) + dest = ed_output; + /* .load */ + else if (str_equal ((byte *) "load", temp)) + dest = ed_regbyte; + else + { + mem_free ((void **) (void *) &temp); + return 0; + } + + mem_free ((void **) (void *) &temp); + + emit_create (&e); + if (e == NULL) + return 1; + + e->m_emit_dest = dest; + + if (dest == ed_regbyte) + { + if (get_identifier (&t, &e->m_regname)) + { + emit_destroy (&e); + return 1; + } + eat_spaces (&t); + } + + /* 0xNN */ + if (*t == '0' && (t[1] == 'x' || t[1] == 'X')) + { + t += 2; + e->m_byte = (byte) hex_convert (&t); + + e->m_emit_type = et_byte; + } + /* NNN */ + else if (*t >= '0' && *t <= '9') + { + e->m_byte = (byte) dec_convert (&t); + + e->m_emit_type = et_byte; + } + /* * */ + else if (*t == '*') + { + t++; + + e->m_emit_type = et_stream; + } + /* $ */ + else if (*t == '$') + { + t++; + + e->m_emit_type = et_position; + } + /* 'c' */ + else if (*t == '\'') + { + if (get_string (&t, &temp)) + { + emit_destroy (&e); + return 1; + } + e->m_byte = (byte) temp[0]; + + mem_free ((void **) (void *) &temp); + + e->m_emit_type = et_byte; + } + else + { + if (get_identifier (&t, &temp)) + { + emit_destroy (&e); + return 1; + } + + if (map_byte_find (&mapb, temp, &e->m_byte)) + { + mem_free ((void **) (void *) &temp); + emit_destroy (&e); + return 1; + } + + mem_free ((void **) (void *) &temp); + + e->m_emit_type = et_byte; + } + + eat_spaces (&t); + + if (get_emits (&t, &e->m_next, mapb)) + { + emit_destroy (&e); + return 1; + } + + *text = t; + *em = e; + return 0; +} + +/* + returns 0 on success, + returns 1 otherwise, +*/ +static int get_spec (const byte **text, spec **sp, map_str *maps, map_byte *mapb) +{ + const byte *t = *text; + spec *s = NULL; + + spec_create (&s); + if (s == NULL) + return 1; + + /* first - read optional .if statement */ + if (*t == '.') + { + const byte *u = t; + byte *keyword = NULL; + + /* skip the dot */ + u++; + + if (get_identifier (&u, &keyword)) + { + spec_destroy (&s); + return 1; + } + + /* .if */ + if (str_equal ((byte *) "if", keyword)) + { + cond_create (&s->m_cond); + if (s->m_cond == NULL) + { + spec_destroy (&s); + return 1; + } + + /* skip the left paren */ + eat_spaces (&u); + u++; + + /* get the left operand */ + eat_spaces (&u); + if (get_identifier (&u, &s->m_cond->m_operands[0].m_regname)) + { + spec_destroy (&s); + return 1; + } + s->m_cond->m_operands[0].m_type = cot_regbyte; + + /* get the operator (!= or ==) */ + eat_spaces (&u); + if (*u == '!') + s->m_cond->m_type = ct_not_equal; + else + s->m_cond->m_type = ct_equal; + u += 2; + eat_spaces (&u); + + if (u[0] == '0' && (u[1] == 'x' || u[1] == 'X')) + { + /* skip the 0x prefix */ + u += 2; + + /* get the right operand */ + s->m_cond->m_operands[1].m_byte = hex_convert (&u); + s->m_cond->m_operands[1].m_type = cot_byte; + } + else /*if (*u >= '0' && *u <= '9')*/ + { + /* get the right operand */ + s->m_cond->m_operands[1].m_byte = dec_convert (&u); + s->m_cond->m_operands[1].m_type = cot_byte; + } + + /* skip the right paren */ + eat_spaces (&u); + u++; + + eat_spaces (&u); + + t = u; + } + + mem_free ((void **) (void *) &keyword); + } + + if (*t == '\'') + { + byte *temp = NULL; + + if (get_string (&t, &temp)) + { + spec_destroy (&s); + return 1; + } + eat_spaces (&t); + + if (*t == '-') + { + byte *temp2 = NULL; + + /* skip the '-' character */ + t++; + eat_spaces (&t); + + if (get_string (&t, &temp2)) + { + mem_free ((void **) (void *) &temp); + spec_destroy (&s); + return 1; + } + eat_spaces (&t); + + s->m_spec_type = st_byte_range; + s->m_byte[0] = *temp; + s->m_byte[1] = *temp2; + + mem_free ((void **) (void *) &temp2); + } + else + { + s->m_spec_type = st_byte; + *s->m_byte = *temp; + } + + mem_free ((void **) (void *) &temp); + } + else if (*t == '"') + { + if (get_string (&t, &s->m_string)) + { + spec_destroy (&s); + return 1; + } + eat_spaces (&t); + + s->m_spec_type = st_string; + } + else if (*t == '.') + { + byte *keyword = NULL; + + /* skip the dot */ + t++; + + if (get_identifier (&t, &keyword)) + { + spec_destroy (&s); + return 1; + } + eat_spaces (&t); + + /* .true */ + if (str_equal ((byte *) "true", keyword)) + { + s->m_spec_type = st_true; + } + /* .false */ + else if (str_equal ((byte *) "false", keyword)) + { + s->m_spec_type = st_false; + } + /* .debug */ + else if (str_equal ((byte *) "debug", keyword)) + { + s->m_spec_type = st_debug; + } + /* .loop */ + else if (str_equal ((byte *) "loop", keyword)) + { + if (get_identifier (&t, &s->m_string)) + { + mem_free ((void **) (void *) &keyword); + spec_destroy (&s); + return 1; + } + eat_spaces (&t); + + s->m_spec_type = st_identifier_loop; + } + mem_free ((void **) (void *) &keyword); + } + else + { + if (get_identifier (&t, &s->m_string)) + { + spec_destroy (&s); + return 1; + } + eat_spaces (&t); + + s->m_spec_type = st_identifier; + } + + if (get_error (&t, &s->m_errtext, maps)) + { + spec_destroy (&s); + return 1; + } + + if (get_emits (&t, &s->m_emits, mapb)) + { + spec_destroy (&s); + return 1; + } + + *text = t; + *sp = s; + return 0; +} + +/* + returns 0 on success, + returns 1 otherwise, +*/ +static int get_rule (const byte **text, rule **ru, map_str *maps, map_byte *mapb) +{ + const byte *t = *text; + rule *r = NULL; + + rule_create (&r); + if (r == NULL) + return 1; + + if (get_spec (&t, &r->m_specs, maps, mapb)) + { + rule_destroy (&r); + return 1; + } + + while (*t != ';') + { + byte *op = NULL; + spec *sp = NULL; + + /* skip the dot that precedes "and" or "or" */ + t++; + + /* read "and" or "or" keyword */ + if (get_identifier (&t, &op)) + { + rule_destroy (&r); + return 1; + } + eat_spaces (&t); + + if (r->m_oper == op_none) + { + /* .and */ + if (str_equal ((byte *) "and", op)) + r->m_oper = op_and; + /* .or */ + else + r->m_oper = op_or; + } + + mem_free ((void **) (void *) &op); + + if (get_spec (&t, &sp, maps, mapb)) + { + rule_destroy (&r); + return 1; + } + + spec_append (&r->m_specs, sp); + } + + /* skip the semicolon */ + t++; + eat_spaces (&t); + + *text = t; + *ru = r; + return 0; +} + +/* + returns 0 on success, + returns 1 otherwise, +*/ +static int update_dependency (map_rule *mapr, byte *symbol, rule **ru) +{ + if (map_rule_find (&mapr, symbol, ru)) + return 1; + + (**ru).m_referenced = 1; + + return 0; +} + +/* + returns 0 on success, + returns 1 otherwise, +*/ +static int update_dependencies (dict *di, map_rule *mapr, byte **syntax_symbol, + byte **string_symbol, map_byte *regbytes) +{ + rule *rulez = di->m_rulez; + + /* update dependecies for the root and lexer symbols */ + if (update_dependency (mapr, *syntax_symbol, &di->m_syntax) || + (*string_symbol != NULL && update_dependency (mapr, *string_symbol, &di->m_string))) + return 1; + + mem_free ((void **) syntax_symbol); + mem_free ((void **) string_symbol); + + /* update dependecies for the rest of the rules */ + while (rulez) + { + spec *sp = rulez->m_specs; + + /* iterate through all the specifiers */ + while (sp) + { + /* update dependency for identifier */ + if (sp->m_spec_type == st_identifier || sp->m_spec_type == st_identifier_loop) + { + if (update_dependency (mapr, sp->m_string, &sp->m_rule)) + return 1; + + mem_free ((void **) &sp->m_string); + } + + /* some errtexts reference to a rule */ + if (sp->m_errtext && sp->m_errtext->m_token_name) + { + if (update_dependency (mapr, sp->m_errtext->m_token_name, &sp->m_errtext->m_token)) + return 1; + + mem_free ((void **) &sp->m_errtext->m_token_name); + } + + /* update dependency for condition */ + if (sp->m_cond) + { + int i; + for (i = 0; i < 2; i++) + if (sp->m_cond->m_operands[i].m_type == cot_regbyte) + { + sp->m_cond->m_operands[i].m_regbyte = map_byte_locate (®bytes, + sp->m_cond->m_operands[i].m_regname); + + if (sp->m_cond->m_operands[i].m_regbyte == NULL) + return 1; + + mem_free ((void **) &sp->m_cond->m_operands[i].m_regname); + } + } + + /* update dependency for all .load instructions */ + if (sp->m_emits) + { + emit *em = sp->m_emits; + while (em != NULL) + { + if (em->m_emit_dest == ed_regbyte) + { + em->m_regbyte = map_byte_locate (®bytes, em->m_regname); + + if (em->m_regbyte == NULL) + return 1; + + mem_free ((void **) &em->m_regname); + } + + em = em->m_next; + } + } + + sp = sp->next; + } + + rulez = rulez->next; + } + + /* check for unreferenced symbols */ + rulez = di->m_rulez; + while (rulez != NULL) + { + if (!rulez->m_referenced) + { + map_rule *ma = mapr; + while (ma) + { + if (ma->data == rulez) + { + set_last_error (UNREFERENCED_IDENTIFIER, str_duplicate (ma->key), -1); + return 1; + } + ma = ma->next; + } + } + rulez = rulez->next; + } + + return 0; +} + +static int satisfies_condition (cond *co, regbyte_ctx *ctx) +{ + byte values[2]; + int i; + + if (co == NULL) + return 1; + + for (i = 0; i < 2; i++) + switch (co->m_operands[i].m_type) + { + case cot_byte: + values[i] = co->m_operands[i].m_byte; + break; + case cot_regbyte: + values[i] = regbyte_ctx_extract (&ctx, co->m_operands[i].m_regbyte); + break; + } + + switch (co->m_type) + { + case ct_equal: + return values[0] == values[1]; + case ct_not_equal: + return values[0] != values[1]; + } + + return 0; +} + +static void free_regbyte_ctx_stack (regbyte_ctx *top, regbyte_ctx *limit) +{ + while (top != limit) + { + regbyte_ctx *rbc = top->m_prev; + regbyte_ctx_destroy (&top); + top = rbc; + } +} + +typedef enum match_result_ +{ + mr_not_matched, /* the examined string does not match */ + mr_matched, /* the examined string matches */ + mr_error_raised, /* mr_not_matched + error has been raised */ + mr_dont_emit, /* used by identifier loops only */ + mr_internal_error /* an internal error has occured such as out of memory */ +} match_result; + +/* + This function does the main job. It parses the text and generates output data. +*/ +static match_result match (dict *di, const byte *text, unsigned int *index, rule *ru, barray **ba, + int filtering_string, regbyte_ctx **rbc) +{ + unsigned int ind = *index; + match_result status = mr_not_matched; + spec *sp = ru->m_specs; + regbyte_ctx *ctx = *rbc; + + /* for every specifier in the rule */ + while (sp) + { + unsigned int i, len, save_ind = ind; + barray *array = NULL; + + if (satisfies_condition (sp->m_cond, ctx)) + { + switch (sp->m_spec_type) + { + case st_identifier: + barray_create (&array); + if (array == NULL) + { + free_regbyte_ctx_stack (ctx, *rbc); + return mr_internal_error; + } + + status = match (di, text, &ind, sp->m_rule, &array, filtering_string, &ctx); + + if (status == mr_internal_error) + { + free_regbyte_ctx_stack (ctx, *rbc); + barray_destroy (&array); + return mr_internal_error; + } + break; + case st_string: + len = str_length (sp->m_string); + + /* prefilter the stream */ + if (!filtering_string && di->m_string) + { + barray *ba; + unsigned int filter_index = 0; + match_result result; + regbyte_ctx *null_ctx = NULL; + + barray_create (&ba); + if (ba == NULL) + { + free_regbyte_ctx_stack (ctx, *rbc); + return mr_internal_error; + } + + result = match (di, text + ind, &filter_index, di->m_string, &ba, 1, &null_ctx); + + if (result == mr_internal_error) + { + free_regbyte_ctx_stack (ctx, *rbc); + barray_destroy (&ba); + return mr_internal_error; + } + + if (result != mr_matched) + { + barray_destroy (&ba); + status = mr_not_matched; + break; + } + + barray_destroy (&ba); + + if (filter_index != len || !str_equal_n (sp->m_string, text + ind, len)) + { + status = mr_not_matched; + break; + } + + status = mr_matched; + ind += len; + } + else + { + status = mr_matched; + for (i = 0; status == mr_matched && i < len; i++) + if (text[ind + i] != sp->m_string[i]) + status = mr_not_matched; + + if (status == mr_matched) + ind += len; + } + break; + case st_byte: + status = text[ind] == *sp->m_byte ? mr_matched : mr_not_matched; + if (status == mr_matched) + ind++; + break; + case st_byte_range: + status = (text[ind] >= sp->m_byte[0] && text[ind] <= sp->m_byte[1]) ? + mr_matched : mr_not_matched; + if (status == mr_matched) + ind++; + break; + case st_true: + status = mr_matched; + break; + case st_false: + status = mr_not_matched; + break; + case st_debug: + status = ru->m_oper == op_and ? mr_matched : mr_not_matched; + break; + case st_identifier_loop: + barray_create (&array); + if (array == NULL) + { + free_regbyte_ctx_stack (ctx, *rbc); + return mr_internal_error; + } + + status = mr_dont_emit; + for (;;) + { + match_result result; + + save_ind = ind; + result = match (di, text, &ind, sp->m_rule, &array, filtering_string, &ctx); + + if (result == mr_error_raised) + { + status = result; + break; + } + else if (result == mr_matched) + { + if (barray_push (ba, sp->m_emits, text[ind - 1], save_ind, &ctx) || + barray_append (ba, &array)) + { + free_regbyte_ctx_stack (ctx, *rbc); + barray_destroy (&array); + return mr_internal_error; + } + barray_destroy (&array); + barray_create (&array); + if (array == NULL) + { + free_regbyte_ctx_stack (ctx, *rbc); + return mr_internal_error; + } + } + else if (result == mr_internal_error) + { + free_regbyte_ctx_stack (ctx, *rbc); + barray_destroy (&array); + return mr_internal_error; + } + else + break; + } + break; + } + } + else + { + status = mr_not_matched; + } + + if (status == mr_error_raised) + { + free_regbyte_ctx_stack (ctx, *rbc); + barray_destroy (&array); + + return mr_error_raised; + } + + if (ru->m_oper == op_and && status != mr_matched && status != mr_dont_emit) + { + free_regbyte_ctx_stack (ctx, *rbc); + barray_destroy (&array); + + if (sp->m_errtext) + { + set_last_error (sp->m_errtext->m_text, error_get_token (sp->m_errtext, di, text, + ind), ind); + + return mr_error_raised; + } + + return mr_not_matched; + } + + if (status == mr_matched) + { + if (sp->m_emits) + if (barray_push (ba, sp->m_emits, text[ind - 1], save_ind, &ctx)) + { + free_regbyte_ctx_stack (ctx, *rbc); + barray_destroy (&array); + return mr_internal_error; + } + + if (array) + if (barray_append (ba, &array)) + { + free_regbyte_ctx_stack (ctx, *rbc); + barray_destroy (&array); + return mr_internal_error; + } + } + + barray_destroy (&array); + + /* if the rule operator is a logical or, we pick up the first matching specifier */ + if (ru->m_oper == op_or && (status == mr_matched || status == mr_dont_emit)) + { + *index = ind; + *rbc = ctx; + return mr_matched; + } + + sp = sp->next; + } + + /* everything went fine - all specifiers match up */ + if (ru->m_oper == op_and && (status == mr_matched || status == mr_dont_emit)) + { + *index = ind; + *rbc = ctx; + return mr_matched; + } + + free_regbyte_ctx_stack (ctx, *rbc); + return mr_not_matched; +} + +static match_result fast_match (dict *di, const byte *text, unsigned int *index, rule *ru, int *_PP, bytepool *_BP, + int filtering_string, regbyte_ctx **rbc) +{ + unsigned int ind = *index; + int _P = filtering_string ? 0 : *_PP; + int _P2; + match_result status = mr_not_matched; + spec *sp = ru->m_specs; + regbyte_ctx *ctx = *rbc; + + /* for every specifier in the rule */ + while (sp) + { + unsigned int i, len, save_ind = ind; + + _P2 = _P + (sp->m_emits ? emit_size (sp->m_emits) : 0); + if (bytepool_reserve (_BP, _P2)) + { + free_regbyte_ctx_stack (ctx, *rbc); + return mr_internal_error; + } + + if (satisfies_condition (sp->m_cond, ctx)) + { + switch (sp->m_spec_type) + { + case st_identifier: + status = fast_match (di, text, &ind, sp->m_rule, &_P2, _BP, filtering_string, &ctx); + + if (status == mr_internal_error) + { + free_regbyte_ctx_stack (ctx, *rbc); + return mr_internal_error; + } + break; + case st_string: + len = str_length (sp->m_string); + + /* prefilter the stream */ + if (!filtering_string && di->m_string) + { + unsigned int filter_index = 0; + match_result result; + regbyte_ctx *null_ctx = NULL; + + result = fast_match (di, text + ind, &filter_index, di->m_string, NULL, _BP, 1, &null_ctx); + + if (result == mr_internal_error) + { + free_regbyte_ctx_stack (ctx, *rbc); + return mr_internal_error; + } + + if (result != mr_matched) + { + status = mr_not_matched; + break; + } + + if (filter_index != len || !str_equal_n (sp->m_string, text + ind, len)) + { + status = mr_not_matched; + break; + } + + status = mr_matched; + ind += len; + } + else + { + status = mr_matched; + for (i = 0; status == mr_matched && i < len; i++) + if (text[ind + i] != sp->m_string[i]) + status = mr_not_matched; + + if (status == mr_matched) + ind += len; + } + break; + case st_byte: + status = text[ind] == *sp->m_byte ? mr_matched : mr_not_matched; + if (status == mr_matched) + ind++; + break; + case st_byte_range: + status = (text[ind] >= sp->m_byte[0] && text[ind] <= sp->m_byte[1]) ? + mr_matched : mr_not_matched; + if (status == mr_matched) + ind++; + break; + case st_true: + status = mr_matched; + break; + case st_false: + status = mr_not_matched; + break; + case st_debug: + status = ru->m_oper == op_and ? mr_matched : mr_not_matched; + break; + case st_identifier_loop: + status = mr_dont_emit; + for (;;) + { + match_result result; + + save_ind = ind; + result = fast_match (di, text, &ind, sp->m_rule, &_P2, _BP, filtering_string, &ctx); + + if (result == mr_error_raised) + { + status = result; + break; + } + else if (result == mr_matched) + { + if (!filtering_string) + { + if (sp->m_emits != NULL) + { + if (emit_push (sp->m_emits, _BP->_F + _P, text[ind - 1], save_ind, &ctx)) + { + free_regbyte_ctx_stack (ctx, *rbc); + return mr_internal_error; + } + } + + _P = _P2; + _P2 += sp->m_emits ? emit_size (sp->m_emits) : 0; + if (bytepool_reserve (_BP, _P2)) + { + free_regbyte_ctx_stack (ctx, *rbc); + return mr_internal_error; + } + } + } + else if (result == mr_internal_error) + { + free_regbyte_ctx_stack (ctx, *rbc); + return mr_internal_error; + } + else + break; + } + break; + } + } + else + { + status = mr_not_matched; + } + + if (status == mr_error_raised) + { + free_regbyte_ctx_stack (ctx, *rbc); + + return mr_error_raised; + } + + if (ru->m_oper == op_and && status != mr_matched && status != mr_dont_emit) + { + free_regbyte_ctx_stack (ctx, *rbc); + + if (sp->m_errtext) + { + set_last_error (sp->m_errtext->m_text, error_get_token (sp->m_errtext, di, text, + ind), ind); + + return mr_error_raised; + } + + return mr_not_matched; + } + + if (status == mr_matched) + { + if (sp->m_emits != NULL) + if (emit_push (sp->m_emits, _BP->_F + _P, text[ind - 1], save_ind, &ctx)) + { + free_regbyte_ctx_stack (ctx, *rbc); + return mr_internal_error; + } + + _P = _P2; + } + + /* if the rule operator is a logical or, we pick up the first matching specifier */ + if (ru->m_oper == op_or && (status == mr_matched || status == mr_dont_emit)) + { + *index = ind; + *rbc = ctx; + if (!filtering_string) + *_PP = _P; + return mr_matched; + } + + sp = sp->next; + } + + /* everything went fine - all specifiers match up */ + if (ru->m_oper == op_and && (status == mr_matched || status == mr_dont_emit)) + { + *index = ind; + *rbc = ctx; + if (!filtering_string) + *_PP = _P; + return mr_matched; + } + + free_regbyte_ctx_stack (ctx, *rbc); + return mr_not_matched; +} + +static byte *error_get_token (error *er, dict *di, const byte *text, unsigned int ind) +{ + byte *str = NULL; + + if (er->m_token) + { + barray *ba; + unsigned int filter_index = 0; + regbyte_ctx *ctx = NULL; + + barray_create (&ba); + if (ba != NULL) + { + if (match (di, text + ind, &filter_index, er->m_token, &ba, 0, &ctx) == mr_matched && + filter_index) + { + str = (byte *) mem_alloc (filter_index + 1); + if (str != NULL) + { + str_copy_n (str, text + ind, filter_index); + str[filter_index] = '\0'; + } + } + barray_destroy (&ba); + } + } + + return str; +} + +typedef struct grammar_load_state_ +{ + dict *di; + byte *syntax_symbol; + byte *string_symbol; + map_str *maps; + map_byte *mapb; + map_rule *mapr; +} grammar_load_state; + +static void grammar_load_state_create (grammar_load_state **gr) +{ + *gr = (grammar_load_state *) mem_alloc (sizeof (grammar_load_state)); + if (*gr) + { + (**gr).di = NULL; + (**gr).syntax_symbol = NULL; + (**gr).string_symbol = NULL; + (**gr).maps = NULL; + (**gr).mapb = NULL; + (**gr).mapr = NULL; + } +} + +static void grammar_load_state_destroy (grammar_load_state **gr) +{ + if (*gr) + { + dict_destroy (&(**gr).di); + mem_free ((void **) &(**gr).syntax_symbol); + mem_free ((void **) &(**gr).string_symbol); + map_str_destroy (&(**gr).maps); + map_byte_destroy (&(**gr).mapb); + map_rule_destroy (&(**gr).mapr); + mem_free ((void **) gr); + } +} + +/* + the API +*/ + +grammar grammar_load_from_text (const byte *text) +{ + grammar_load_state *g = NULL; + grammar id = 0; + + clear_last_error (); + + grammar_load_state_create (&g); + if (g == NULL) + return 0; + + dict_create (&g->di); + if (g->di == NULL) + { + grammar_load_state_destroy (&g); + return 0; + } + + eat_spaces (&text); + + /* skip ".syntax" keyword */ + text += 7; + eat_spaces (&text); + + /* retrieve root symbol */ + if (get_identifier (&text, &g->syntax_symbol)) + { + grammar_load_state_destroy (&g); + return 0; + } + eat_spaces (&text); + + /* skip semicolon */ + text++; + eat_spaces (&text); + + while (*text) + { + byte *symbol = NULL; + int is_dot = *text == '.'; + + if (is_dot) + text++; + + if (get_identifier (&text, &symbol)) + { + grammar_load_state_destroy (&g); + return 0; + } + eat_spaces (&text); + + /* .emtcode */ + if (is_dot && str_equal (symbol, (byte *) "emtcode")) + { + map_byte *ma = NULL; + + mem_free ((void **) (void *) &symbol); + + if (get_emtcode (&text, &ma)) + { + grammar_load_state_destroy (&g); + return 0; + } + + map_byte_append (&g->mapb, ma); + } + /* .regbyte */ + else if (is_dot && str_equal (symbol, (byte *) "regbyte")) + { + map_byte *ma = NULL; + + mem_free ((void **) (void *) &symbol); + + if (get_regbyte (&text, &ma)) + { + grammar_load_state_destroy (&g); + return 0; + } + + map_byte_append (&g->di->m_regbytes, ma); + } + /* .errtext */ + else if (is_dot && str_equal (symbol, (byte *) "errtext")) + { + map_str *ma = NULL; + + mem_free ((void **) (void *) &symbol); + + if (get_errtext (&text, &ma)) + { + grammar_load_state_destroy (&g); + return 0; + } + + map_str_append (&g->maps, ma); + } + /* .string */ + else if (is_dot && str_equal (symbol, (byte *) "string")) + { + mem_free ((void **) (void *) &symbol); + + if (g->di->m_string != NULL) + { + grammar_load_state_destroy (&g); + return 0; + } + + if (get_identifier (&text, &g->string_symbol)) + { + grammar_load_state_destroy (&g); + return 0; + } + + /* skip semicolon */ + eat_spaces (&text); + text++; + eat_spaces (&text); + } + else + { + rule *ru = NULL; + map_rule *ma = NULL; + + if (get_rule (&text, &ru, g->maps, g->mapb)) + { + grammar_load_state_destroy (&g); + return 0; + } + + rule_append (&g->di->m_rulez, ru); + + /* if a rule consist of only one specifier, give it an ".and" operator */ + if (ru->m_oper == op_none) + ru->m_oper = op_and; + + map_rule_create (&ma); + if (ma == NULL) + { + grammar_load_state_destroy (&g); + return 0; + } + + ma->key = symbol; + ma->data = ru; + map_rule_append (&g->mapr, ma); + } + } + + if (update_dependencies (g->di, g->mapr, &g->syntax_symbol, &g->string_symbol, + g->di->m_regbytes)) + { + grammar_load_state_destroy (&g); + return 0; + } + + dict_append (&g_dicts, g->di); + id = g->di->m_id; + g->di = NULL; + + grammar_load_state_destroy (&g); + + return id; +} + +int grammar_set_reg8 (grammar id, const byte *name, byte value) +{ + dict *di = NULL; + map_byte *reg = NULL; + + clear_last_error (); + + dict_find (&g_dicts, id, &di); + if (di == NULL) + { + set_last_error (INVALID_GRAMMAR_ID, NULL, -1); + return 0; + } + + reg = map_byte_locate (&di->m_regbytes, name); + if (reg == NULL) + { + set_last_error (INVALID_REGISTER_NAME, str_duplicate (name), -1); + return 0; + } + + reg->data = value; + return 1; +} + +/* + internal checking function used by both grammar_check and grammar_fast_check functions +*/ +static int _grammar_check (grammar id, const byte *text, byte **prod, unsigned int *size, + unsigned int estimate_prod_size, int use_fast_path) +{ + dict *di = NULL; + unsigned int index = 0; + + clear_last_error (); + + dict_find (&g_dicts, id, &di); + if (di == NULL) + { + set_last_error (INVALID_GRAMMAR_ID, NULL, -1); + return 0; + } + + *prod = NULL; + *size = 0; + + if (use_fast_path) + { + regbyte_ctx *rbc = NULL; + bytepool *bp = NULL; + int _P = 0; + + bytepool_create (&bp, estimate_prod_size); + if (bp == NULL) + return 0; + + if (fast_match (di, text, &index, di->m_syntax, &_P, bp, 0, &rbc) != mr_matched) + { + bytepool_destroy (&bp); + free_regbyte_ctx_stack (rbc, NULL); + return 0; + } + + free_regbyte_ctx_stack (rbc, NULL); + + *prod = bp->_F; + *size = _P; + bp->_F = NULL; + bytepool_destroy (&bp); + } + else + { + regbyte_ctx *rbc = NULL; + barray *ba = NULL; + + barray_create (&ba); + if (ba == NULL) + return 0; + + if (match (di, text, &index, di->m_syntax, &ba, 0, &rbc) != mr_matched) + { + barray_destroy (&ba); + free_regbyte_ctx_stack (rbc, NULL); + return 0; + } + + free_regbyte_ctx_stack (rbc, NULL); + + *prod = (byte *) mem_alloc (ba->len * sizeof (byte)); + if (*prod == NULL) + { + barray_destroy (&ba); + return 0; + } + + mem_copy (*prod, ba->data, ba->len * sizeof (byte)); + *size = ba->len; + barray_destroy (&ba); + } + + return 1; +} + +int grammar_check (grammar id, const byte *text, byte **prod, unsigned int *size) +{ + return _grammar_check (id, text, prod, size, 0, 0); +} + +int grammar_fast_check (grammar id, const byte *text, byte **prod, unsigned int *size, + unsigned int estimate_prod_size) +{ + return _grammar_check (id, text, prod, size, estimate_prod_size, 1); +} + +int grammar_destroy (grammar id) +{ + dict **di = &g_dicts; + + clear_last_error (); + + while (*di != NULL) + { + if ((**di).m_id == id) + { + dict *tmp = *di; + *di = (**di).next; + dict_destroy (&tmp); + return 1; + } + + di = &(**di).next; + } + + set_last_error (INVALID_GRAMMAR_ID, NULL, -1); + return 0; +} + +static void append_character (const char x, byte *text, int *dots_made, int *len, int size) +{ + if (*dots_made == 0) + { + if (*len < size - 1) + { + text[(*len)++] = x; + text[*len] = '\0'; + } + else + { + int i; + for (i = 0; i < 3; i++) + if (--(*len) >= 0) + text[*len] = '.'; + *dots_made = 1; + } + } +} + +void grammar_get_last_error (byte *text, unsigned int size, int *pos) +{ + int len = 0, dots_made = 0; + const byte *p = error_message; + + *text = '\0'; + + if (p) + { + while (*p) + { + if (*p == '$') + { + const byte *r = error_param; + + while (*r) + { + append_character (*r++, text, &dots_made, &len, (int) size); + } + + p++; + } + else + { + append_character (*p++, text, &dots_made, &len, size); + } + } + } + + *pos = error_position; +} diff --git a/reactos/dll/mesa32/src/shader/grammar/grammar.h b/reactos/dll/mesa32/src/shader/grammar/grammar.h new file mode 100644 index 00000000000..591e38aefa6 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/grammar/grammar.h @@ -0,0 +1,103 @@ +/* + * Mesa 3-D graphics library + * Version: 6.2 + * + * 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 GRAMMAR_H +#define GRAMMAR_H + + +#ifndef GRAMMAR_PORT_INCLUDE +#error Do not include this file directly, include your grammar_XXX.h instead +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +void grammar_alloc_free (void *); +void *grammar_alloc_malloc (size_t); +void *grammar_alloc_realloc (void *, size_t, size_t); +void *grammar_memory_copy (void *, const void *, size_t); +int grammar_string_compare (const byte *, const byte *); +int grammar_string_compare_n (const byte *, const byte *, size_t); +byte *grammar_string_copy (byte *, const byte *); +byte *grammar_string_copy_n (byte *, const byte *, size_t); +byte *grammar_string_duplicate (const byte *); +unsigned int grammar_string_length (const byte *); + +/* + loads grammar script from null-terminated ASCII + returns unique grammar id to grammar object + returns 0 if an error occurs (call grammar_get_last_error to retrieve the error text) +*/ +grammar grammar_load_from_text (const byte *text); + +/* + sets a new to a register for grammar + returns 0 on error (call grammar_get_last_error to retrieve the error text) + returns 1 on success +*/ +int grammar_set_reg8 (grammar id, const byte *name, byte value); + +/* + this function is obsolete, use only for debugging purposes + + checks if a null-terminated matches given grammar + returns 0 on error (call grammar_get_last_error to retrieve the error text) + returns 1 on success, the points to newly allocated buffer with production and + is filled with the production size + call grammar_alloc_free to free the memory block pointed by +*/ +int grammar_check (grammar id, const byte *text, byte **prod, unsigned int *size); + +/* + does the same what grammar_check does but much more (approx. 4 times) faster + use this function instead of grammar_check + is a hint - the initial production buffer size will be of this size, + but if more room is needed it will be safely resized; set it to 0x1000 or so +*/ +int grammar_fast_check (grammar id, const byte *text, byte **prod, unsigned int *size, + unsigned int estimate_prod_size); + +/* + destroys grammar object identified by + returns 0 on error (call grammar_get_last_error to retrieve the error text) + returns 1 on success +*/ +int grammar_destroy (grammar id); + +/* + retrieves last grammar error reported either by grammar_load_from_text, grammar_check + or grammar_destroy + the user allocated buffer receives error description, points to error position, + is the size of the text buffer to fill in - it must be at least 4 bytes long, +*/ +void grammar_get_last_error (byte *text, unsigned int size, int *pos); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/reactos/dll/mesa32/src/shader/grammar/grammar_crt.c b/reactos/dll/mesa32/src/shader/grammar/grammar_crt.c new file mode 100755 index 00000000000..bdf2da9b2e2 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/grammar/grammar_crt.c @@ -0,0 +1,64 @@ +#include "grammar_crt.h" + +#define GRAMMAR_PORT_BUILD 1 +#include "grammar.c" +#undef GRAMMAR_PORT_BUILD + + +void grammar_alloc_free (void *ptr) +{ + free (ptr); +} + +void *grammar_alloc_malloc (unsigned int size) +{ + return malloc (size); +} + +void *grammar_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size) +{ + return realloc (ptr, size); +} + +void *grammar_memory_copy (void *dst, const void * src, unsigned int size) +{ + return memcpy (dst, src, size); +} + +int grammar_string_compare (const byte *str1, const byte *str2) +{ + return strcmp ((const char *) str1, (const char *) str2); +} + +int grammar_string_compare_n (const byte *str1, const byte *str2, unsigned int n) +{ + return strncmp ((const char *) str1, (const char *) str2, n); +} + +byte *grammar_string_copy (byte *dst, const byte *src) +{ + return (byte *) strcpy ((char *) dst, (const char *) src); +} + +byte *grammar_string_copy_n (byte *dst, const byte *src, unsigned int n) +{ + return (byte *) strncpy ((char *) dst, (const char *) src, n); +} + +unsigned int grammar_string_length (const byte *str) +{ + return strlen ((const char *) str); +} + +byte *grammar_string_duplicate (const byte *src) +{ + const unsigned int size = grammar_string_length (src); + byte *str = grammar_alloc_malloc (size + 1); + if (str != NULL) + { + grammar_memory_copy (str, src, size); + str[size] = '\0'; + } + return str; +} + diff --git a/reactos/dll/mesa32/src/shader/grammar/grammar_crt.h b/reactos/dll/mesa32/src/shader/grammar/grammar_crt.h new file mode 100755 index 00000000000..492711e96ae --- /dev/null +++ b/reactos/dll/mesa32/src/shader/grammar/grammar_crt.h @@ -0,0 +1,20 @@ +#ifndef GRAMMAR_CRT_H +#define GRAMMAR_CRT_H + + +#include +#include +#include + + +typedef unsigned long grammar; +typedef unsigned char byte; + + +#define GRAMMAR_PORT_INCLUDE 1 +#include "grammar.h" +#undef GRAMMAR_PORT_INCLUDE + + +#endif + diff --git a/reactos/dll/mesa32/src/shader/grammar/grammar_mesa.c b/reactos/dll/mesa32/src/shader/grammar/grammar_mesa.c new file mode 100644 index 00000000000..eb962505bfe --- /dev/null +++ b/reactos/dll/mesa32/src/shader/grammar/grammar_mesa.c @@ -0,0 +1,87 @@ +/* + * 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. + */ + +/** + * \file grammar_mesa.c + * mesa3d port to syntax parsing engine + * \author Michal Krol + */ + +#include "grammar_mesa.h" + +#define GRAMMAR_PORT_BUILD 1 +#include "grammar.c" +#undef GRAMMAR_PORT_BUILD + + +void grammar_alloc_free (void *ptr) +{ + _mesa_free (ptr); +} + +void *grammar_alloc_malloc (size_t size) +{ + return _mesa_malloc (size); +} + +void *grammar_alloc_realloc (void *ptr, size_t old_size, size_t size) +{ + return _mesa_realloc (ptr, old_size, size); +} + +void *grammar_memory_copy (void *dst, const void * src, size_t size) +{ + return _mesa_memcpy (dst, src, size); +} + +int grammar_string_compare (const byte *str1, const byte *str2) +{ + return _mesa_strcmp ((const char *) str1, (const char *) str2); +} + +int grammar_string_compare_n (const byte *str1, const byte *str2, size_t n) +{ + return _mesa_strncmp ((const char *) str1, (const char *) str2, n); +} + +byte *grammar_string_copy (byte *dst, const byte *src) +{ + return (byte *) _mesa_strcpy ((char *) dst, (const char *) src); +} + +byte *grammar_string_copy_n (byte *dst, const byte *src, size_t n) +{ + return (byte *) _mesa_strncpy ((char *) dst, (const char *) src, n); +} + +byte *grammar_string_duplicate (const byte *src) +{ + return (byte *) _mesa_strdup ((const char *) src); +} + +unsigned int grammar_string_length (const byte *str) +{ + return (unsigned int)_mesa_strlen ((const char *) str); +} + diff --git a/reactos/dll/mesa32/src/shader/grammar/grammar_mesa.h b/reactos/dll/mesa32/src/shader/grammar/grammar_mesa.h new file mode 100644 index 00000000000..c14033a9d45 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/grammar/grammar_mesa.h @@ -0,0 +1,43 @@ +/* + * 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 GRAMMAR_MESA_H +#define GRAMMAR_MESA_H + + +#include "imports.h" +/* NOTE: include Mesa 3-D specific headers here */ + + +typedef GLuint grammar; +typedef GLubyte byte; + + +#define GRAMMAR_PORT_INCLUDE 1 +#include "grammar.h" +#undef GRAMMAR_PORT_INCLUDE + + +#endif + diff --git a/reactos/dll/mesa32/src/shader/grammar/grammar_syn.h b/reactos/dll/mesa32/src/shader/grammar/grammar_syn.h new file mode 100644 index 00000000000..840a1ab62c2 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/grammar/grammar_syn.h @@ -0,0 +1,202 @@ +".syntax grammar;\n" +".emtcode DECLARATION_END 0\n" +".emtcode DECLARATION_EMITCODE 1\n" +".emtcode DECLARATION_ERRORTEXT 2\n" +".emtcode DECLARATION_REGBYTE 3\n" +".emtcode DECLARATION_LEXER 4\n" +".emtcode DECLARATION_RULE 5\n" +".emtcode SPECIFIER_END 0\n" +".emtcode SPECIFIER_AND_TAG 1\n" +".emtcode SPECIFIER_OR_TAG 2\n" +".emtcode SPECIFIER_CHARACTER_RANGE 3\n" +".emtcode SPECIFIER_CHARACTER 4\n" +".emtcode SPECIFIER_STRING 5\n" +".emtcode SPECIFIER_IDENTIFIER 6\n" +".emtcode SPECIFIER_TRUE 7\n" +".emtcode SPECIFIER_FALSE 8\n" +".emtcode SPECIFIER_DEBUG 9\n" +".emtcode IDENTIFIER_SIMPLE 0\n" +".emtcode IDENTIFIER_LOOP 1\n" +".emtcode ERROR_NOT_PRESENT 0\n" +".emtcode ERROR_PRESENT 1\n" +".emtcode EMIT_NULL 0\n" +".emtcode EMIT_INTEGER 1\n" +".emtcode EMIT_IDENTIFIER 2\n" +".emtcode EMIT_CHARACTER 3\n" +".emtcode EMIT_LAST_CHARACTER 4\n" +".emtcode EMIT_CURRENT_POSITION 5\n" +".errtext INVALID_GRAMMAR \"internal error 2001: invalid grammar script\"\n" +".errtext SYNTAX_EXPECTED \"internal error 2002: '.syntax' keyword expected\"\n" +".errtext IDENTIFIER_EXPECTED \"internal error 2003: identifier expected\"\n" +".errtext MISSING_SEMICOLON \"internal error 2004: missing ';'\"\n" +".errtext INTEGER_EXPECTED \"internal error 2005: integer value expected\"\n" +".errtext STRING_EXPECTED \"internal error 2006: string expected\"\n" +"grammar\n" +" grammar_1 .error INVALID_GRAMMAR;\n" +"grammar_1\n" +" optional_space .and \".syntax\" .error SYNTAX_EXPECTED .and space .and identifier .and\n" +" semicolon .and declaration_list .and optional_space .and '\\0' .emit DECLARATION_END;\n" +"optional_space\n" +" space .or .true;\n" +"space\n" +" single_space .and .loop single_space;\n" +"single_space\n" +" white_char .or comment_block;\n" +"white_char\n" +" ' ' .or '\\t' .or '\\n' .or '\\r';\n" +"comment_block\n" +" '/' .and '*' .and comment_rest;\n" +"comment_rest\n" +" .loop comment_char_no_star .and comment_rest_1;\n" +"comment_rest_1\n" +" comment_end .or comment_rest_2;\n" +"comment_rest_2\n" +" '*' .and comment_rest;\n" +"comment_char_no_star\n" +" '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n" +"comment_end\n" +" '*' .and '/';\n" +"identifier\n" +" identifier_ne .error IDENTIFIER_EXPECTED;\n" +"identifier_ne\n" +" first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit '\\0';\n" +"first_idchar\n" +" 'a'-'z' .or 'A'-'Z' .or '_';\n" +"follow_idchar\n" +" first_idchar .or digit_dec;\n" +"digit_dec\n" +" '0'-'9';\n" +"semicolon\n" +" optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;\n" +"declaration_list\n" +" declaration .and .loop declaration;\n" +"declaration\n" +" emitcode_definition .emit DECLARATION_EMITCODE .or\n" +" errortext_definition .emit DECLARATION_ERRORTEXT .or\n" +" regbyte_definition .emit DECLARATION_REGBYTE .or\n" +" lexer_definition .emit DECLARATION_LEXER .or\n" +" rule_definition .emit DECLARATION_RULE;\n" +"emitcode_definition\n" +" \".emtcode\" .and space .and identifier .and space .and integer .and space_or_null;\n" +"integer\n" +" integer_ne .error INTEGER_EXPECTED;\n" +"integer_ne\n" +" hex_integer .emit 0x10 .or dec_integer .emit 10;\n" +"hex_integer\n" +" hex_prefix .and digit_hex .emit * .and .loop digit_hex .emit * .and .true .emit '\\0';\n" +"hex_prefix\n" +" '0' .and hex_prefix_1;\n" +"hex_prefix_1\n" +" 'x' .or 'X';\n" +"digit_hex\n" +" '0'-'9' .or 'a'-'f' .or 'A'-'F';\n" +"dec_integer\n" +" digit_dec .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n" +"space_or_null\n" +" space .or '\\0';\n" +"errortext_definition\n" +" \".errtext\" .and space .and identifier .and space .and string .and space_or_null;\n" +"string\n" +" string_ne .error STRING_EXPECTED;\n" +"string_ne\n" +" '\"' .and .loop string_char_double_quotes .and '\"' .emit '\\0';\n" +"string_char_double_quotes\n" +" escape_sequence .or string_char .emit * .or '\\'' .emit *;\n" +"string_char\n" +" '\\x5D'-'\\xFF' .or '\\x28'-'\\x5B' .or '\\x23'-'\\x26' .or '\\x0E'-'\\x21' .or '\\x0B'-'\\x0C' .or\n" +" '\\x01'-'\\x09';\n" +"escape_sequence\n" +" '\\\\' .emit * .and escape_code;\n" +"escape_code\n" +" simple_escape_code .emit * .or hex_escape_code .or oct_escape_code;\n" +"simple_escape_code\n" +" '\\'' .or '\"' .or '?' .or '\\\\' .or 'a' .or 'b' .or 'f' .or 'n' .or 'r' .or 't' .or 'v';\n" +"hex_escape_code\n" +" 'x' .emit * .and digit_hex .emit * .and .loop digit_hex .emit *;\n" +"oct_escape_code\n" +" digit_oct .emit * .and optional_digit_oct .and optional_digit_oct;\n" +"digit_oct\n" +" '0'-'7';\n" +"optional_digit_oct\n" +" digit_oct .emit * .or .true;\n" +"regbyte_definition\n" +" \".regbyte\" .and space .and identifier .and space .and integer .and space_or_null;\n" +"lexer_definition\n" +" \".string\" .and space .and identifier .and semicolon;\n" +"rule_definition\n" +" identifier_ne .and space .and definition;\n" +"definition\n" +" specifier .and optional_specifiers_and_or .and semicolon .emit SPECIFIER_END;\n" +"optional_specifiers_and_or\n" +" and_specifiers .emit SPECIFIER_AND_TAG .or or_specifiers .emit SPECIFIER_OR_TAG .or .true;\n" +"specifier\n" +" specifier_condition .and optional_space .and specifier_rule;\n" +"specifier_condition\n" +" specifier_condition_1 .or .true;\n" +"specifier_condition_1\n" +" \".if\" .and optional_space .and '(' .and optional_space .and left_operand .and operator .and\n" +" right_operand .and optional_space .and ')';\n" +"left_operand\n" +" identifier;\n" +"operator\n" +" operator_1 .or operator_2;\n" +"operator_1\n" +" optional_space .and '!' .and '=' .and optional_space;\n" +"operator_2\n" +" optional_space .and '=' .and '=' .and optional_space;\n" +"right_operand\n" +" integer;\n" +"specifier_rule\n" +" specifier_rule_1 .and optional_error .and .loop emit .and .true .emit EMIT_NULL;\n" +"specifier_rule_1\n" +" character_range .emit SPECIFIER_CHARACTER_RANGE .or\n" +" character .emit SPECIFIER_CHARACTER .or\n" +" string_ne .emit SPECIFIER_STRING .or\n" +" \".true\" .emit SPECIFIER_TRUE .or\n" +" \".false\" .emit SPECIFIER_FALSE .or\n" +" \".debug\" .emit SPECIFIER_DEBUG .or\n" +" advanced_identifier .emit SPECIFIER_IDENTIFIER;\n" +"character\n" +" '\\'' .and string_char_single_quotes .and '\\'' .emit '\\0';\n" +"string_char_single_quotes\n" +" escape_sequence .or string_char .emit * .or '\"' .emit *;\n" +"character_range\n" +" character .and optional_space .and '-' .and optional_space .and character;\n" +"advanced_identifier\n" +" optional_loop .and identifier;\n" +"optional_loop\n" +" optional_loop_1 .emit IDENTIFIER_LOOP .or .true .emit IDENTIFIER_SIMPLE;\n" +"optional_loop_1\n" +" \".loop\" .and space;\n" +"optional_error\n" +" error .emit ERROR_PRESENT .or .true .emit ERROR_NOT_PRESENT;\n" +"error\n" +" space .and \".error\" .and space .and identifier;\n" +"emit\n" +" emit_output .or emit_regbyte;\n" +"emit_output\n" +" space .and \".emit\" .and space .and emit_param;\n" +"emit_param\n" +" integer_ne .emit EMIT_INTEGER .or\n" +" identifier_ne .emit EMIT_IDENTIFIER .or\n" +" character .emit EMIT_CHARACTER .or\n" +" '*' .emit EMIT_LAST_CHARACTER .or\n" +" '$' .emit EMIT_CURRENT_POSITION;\n" +"emit_regbyte\n" +" space .and \".load\" .and space .and identifier .and space .and emit_param;\n" +"and_specifiers\n" +" and_specifier .and .loop and_specifier;\n" +"or_specifiers\n" +" or_specifier .and .loop or_specifier;\n" +"and_specifier\n" +" space .and \".and\" .and space .and specifier;\n" +"or_specifier\n" +" space .and \".or\" .and space .and specifier;\n" +".string __string_filter;\n" +"__string_filter\n" +" __first_identifier_char .and .loop __next_identifier_char;\n" +"__first_identifier_char\n" +" 'a'-'z' .or 'A'-'Z' .or '_' .or '.';\n" +"__next_identifier_char\n" +" 'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';\n" +"" diff --git a/reactos/dll/mesa32/src/shader/nvfragparse.c b/reactos/dll/mesa32/src/shader/nvfragparse.c new file mode 100644 index 00000000000..cd1aa35bf0c --- /dev/null +++ b/reactos/dll/mesa32/src/shader/nvfragparse.c @@ -0,0 +1,1826 @@ +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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 "glheader.h" +#include "context.h" +#include "hash.h" +#include "imports.h" +#include "macros.h" +#include "mtypes.h" +#include "nvfragprog.h" +#include "nvfragparse.h" +#include "nvprogram.h" +#include "program.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 fp_opcode opcode; + GLuint inputs; + GLuint outputs; + GLuint suffixes; +}; + +static const struct instruction_pattern Instructions[] = { + { "ADD", FP_OPCODE_ADD, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "COS", FP_OPCODE_COS, INPUT_1S, OUTPUT_S, _R | _H | _C | _S }, + { "DDX", FP_OPCODE_DDX, INPUT_1V, OUTPUT_V, _R | _H | _C | _S }, + { "DDY", FP_OPCODE_DDY, INPUT_1V, OUTPUT_V, _R | _H | _C | _S }, + { "DP3", FP_OPCODE_DP3, INPUT_2V, OUTPUT_S, _R | _H | _X | _C | _S }, + { "DP4", FP_OPCODE_DP4, INPUT_2V, OUTPUT_S, _R | _H | _X | _C | _S }, + { "DST", FP_OPCODE_DP4, INPUT_2V, OUTPUT_V, _R | _H | _C | _S }, + { "EX2", FP_OPCODE_DP4, INPUT_1S, OUTPUT_S, _R | _H | _C | _S }, + { "FLR", FP_OPCODE_FLR, INPUT_1V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "FRC", FP_OPCODE_FRC, INPUT_1V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "KIL", FP_OPCODE_KIL_NV, INPUT_CC, OUTPUT_NONE, 0 }, + { "LG2", FP_OPCODE_LG2, INPUT_1S, OUTPUT_S, _R | _H | _C | _S }, + { "LIT", FP_OPCODE_LIT, INPUT_1V, OUTPUT_V, _R | _H | _C | _S }, + { "LRP", FP_OPCODE_LRP, INPUT_3V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "MAD", FP_OPCODE_MAD, INPUT_3V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "MAX", FP_OPCODE_MAX, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "MIN", FP_OPCODE_MIN, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "MOV", FP_OPCODE_MOV, INPUT_1V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "MUL", FP_OPCODE_MUL, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "PK2H", FP_OPCODE_PK2H, INPUT_1V, OUTPUT_S, 0 }, + { "PK2US", FP_OPCODE_PK2US, INPUT_1V, OUTPUT_S, 0 }, + { "PK4B", FP_OPCODE_PK4B, INPUT_1V, OUTPUT_S, 0 }, + { "PK4UB", FP_OPCODE_PK4UB, INPUT_1V, OUTPUT_S, 0 }, + { "POW", FP_OPCODE_POW, INPUT_2S, OUTPUT_S, _R | _H | _C | _S }, + { "RCP", FP_OPCODE_RCP, INPUT_1S, OUTPUT_S, _R | _H | _C | _S }, + { "RFL", FP_OPCODE_RFL, INPUT_2V, OUTPUT_V, _R | _H | _C | _S }, + { "RSQ", FP_OPCODE_RSQ, INPUT_1S, OUTPUT_S, _R | _H | _C | _S }, + { "SEQ", FP_OPCODE_SEQ, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "SFL", FP_OPCODE_SFL, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "SGE", FP_OPCODE_SGE, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "SGT", FP_OPCODE_SGT, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "SIN", FP_OPCODE_SIN, INPUT_1S, OUTPUT_S, _R | _H | _C | _S }, + { "SLE", FP_OPCODE_SLE, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "SLT", FP_OPCODE_SLT, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "SNE", FP_OPCODE_SNE, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "STR", FP_OPCODE_STR, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "SUB", FP_OPCODE_SUB, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, + { "TEX", FP_OPCODE_TEX, INPUT_1V_T, OUTPUT_V, _C | _S }, + { "TXD", FP_OPCODE_TXD, INPUT_3V_T, OUTPUT_V, _C | _S }, + { "TXP", FP_OPCODE_TXP_NV, INPUT_1V_T, OUTPUT_V, _C | _S }, + { "UP2H", FP_OPCODE_UP2H, INPUT_1S, OUTPUT_V, _C | _S }, + { "UP2US", FP_OPCODE_UP2US, INPUT_1S, OUTPUT_V, _C | _S }, + { "UP4B", FP_OPCODE_UP4B, INPUT_1S, OUTPUT_V, _C | _S }, + { "UP4UB", FP_OPCODE_UP4UB, INPUT_1S, OUTPUT_V, _C | _S }, + { "X2D", FP_OPCODE_X2D, INPUT_3V, OUTPUT_V, _R | _H | _C | _S }, + { "PRINT", FP_OPCODE_PRINT, INPUT_1V_S, OUTPUT_NONE, 0 }, + { NULL, (enum fp_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 { + GLcontext *ctx; + const GLubyte *start; /* start of program string */ + const GLubyte *pos; /* current position */ + const GLubyte *curLine; + struct fragment_program *program; /* current program */ + + struct 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); + _mesa_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]; \ + _mesa_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; + + for (inst = Instructions; inst->name; inst++) { + if (_mesa_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; + } + } + result.opcode = (enum fp_opcode) -1; + 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)_mesa_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 +}; + +static const char *OutputRegisters[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS + 1] = { + "COLR", "COLH", + /* These are only allows for register combiners */ + /* + "TEX0", "TEX1", "TEX2", "TEX3", + */ + "DEPR", 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_strtod((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 , 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 = _mesa_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; token[k] && k < 4; 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 fp_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_SWIZZLE(swz); + } + + 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 = _mesa_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 = _mesa_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 and look for match */ + if (!Parse_Token(parseState, token)) { + RETURN_ERROR; + } + for (j = 0; InputRegisters[j]; j++) { + if (_mesa_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]; + GLint j; + + /* 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 */ + for (j = 0; OutputRegisters[j]; j++) { + if (_mesa_strcmp((const char *) token, OutputRegisters[j]) == 0) { + static GLuint bothColors = (1 << FRAG_OUTPUT_COLR) | (1 << FRAG_OUTPUT_COLH); + *outputRegNum = j; + parseState->outputsWritten |= (1 << j); + if ((parseState->outputsWritten & bothColors) == bothColors) { + RETURN_ERROR1("Illegal to write to both o[COLR] and o[COLH]"); + } + break; + } + } + if (!OutputRegisters[j]) + 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 fp_dst_register *dstReg) +{ + GLubyte token[100]; + GLint idx; + + /* Dst reg can be R, H, o[n], RC or HC */ + if (!Peek_Token(parseState, token)) + RETURN_ERROR; + + if (_mesa_strcmp((const char *) token, "RC") == 0 || + _mesa_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): + * ::= + * | + * ::= "|" "|" + */ +static GLboolean +Parse_VectorSrc(struct parse_state *parseState, + struct fp_src_register *srcReg) +{ + GLfloat sign = 1.0F; + GLubyte token[100]; + GLint idx; + + /* + * 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; + srcReg->NegateAbs = (sign < 0.0F) ? GL_TRUE : GL_FALSE; + + if (Parse_String(parseState, "-")) + srcReg->NegateBase = GL_TRUE; + else if (Parse_String(parseState, "+")) + srcReg->NegateBase = GL_FALSE; + else + srcReg->NegateBase = GL_FALSE; + } + else { + srcReg->Abs = GL_FALSE; + srcReg->NegateAbs = GL_FALSE; + srcReg->NegateBase = (sign < 0.0F) ? GL_TRUE : GL_FALSE; + } + + /* 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 identier! */ + srcReg->File = PROGRAM_INPUT; + if (!Parse_FragReg(parseState, &idx)) + RETURN_ERROR; + srcReg->Index = idx; + } + else if (token[0] == 'p') { + /* XXX this might be an identier! */ + 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); + 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); + 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_SWIZZLE(swz); + } + + /* Finish absolute value */ + if (srcReg->Abs && !Parse_String(parseState, "|")) { + RETURN_ERROR1("Expected |"); + } + + return GL_TRUE; +} + + +static GLboolean +Parse_ScalarSrcReg(struct parse_state *parseState, + struct fp_src_register *srcReg) +{ + GLubyte token[100]; + GLfloat sign = 1.0F; + GLboolean needSuffix = GL_TRUE; + GLint idx; + + /* + * 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; + srcReg->NegateAbs = (sign < 0.0F) ? GL_TRUE : GL_FALSE; + + if (Parse_String(parseState, "-")) + srcReg->NegateBase = GL_TRUE; + else if (Parse_String(parseState, "+")) + srcReg->NegateBase = GL_FALSE; + else + srcReg->NegateBase = GL_FALSE; + } + else { + srcReg->Abs = GL_FALSE; + srcReg->NegateAbs = GL_FALSE; + srcReg->NegateBase = (sign < 0.0F) ? GL_TRUE : GL_FALSE; + } + + if (!Peek_Token(parseState, token)) + RETURN_ERROR; + + /* Src reg can be R, H 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); + 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); + 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 fp_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 = _mesa_malloc(len + 1); + + _mesa_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 { + /* File = 0 indicates no register to print */ + inst->SrcReg[0].File = PROGRAM_UNDEFINED; + } + + inst->SrcReg[0].Swizzle = SWIZZLE_NOOP; + inst->SrcReg[0].NegateBase = GL_FALSE; + inst->SrcReg[0].Abs = GL_FALSE; + inst->SrcReg[0].NegateAbs = GL_FALSE; + + return GL_TRUE; +} + + +static GLboolean +Parse_InstructionSequence(struct parse_state *parseState, + struct fp_instruction program[]) +{ + while (1) { + struct fp_instruction *inst = program + parseState->numInst; + struct instruction_pattern instMatch; + GLubyte token[100]; + + /* Initialize the instruction */ + inst->SrcReg[0].File = PROGRAM_UNDEFINED; + inst->SrcReg[1].File = PROGRAM_UNDEFINED; + inst->SrcReg[2].File = PROGRAM_UNDEFINED; + inst->DstReg.File = PROGRAM_UNDEFINED; + inst->DstReg.CondSwizzle = SWIZZLE_NOOP; + inst->Data = NULL; + + /* 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 = FP_OPCODE_END; + inst->StringPos = parseState->curLine - parseState->start; + assert(inst->StringPos >= 0); + 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 < 0) { + /* bad instruction name */ + RETURN_ERROR2("Unexpected token: ", token); + } + + inst->Opcode = instMatch.opcode; + inst->Precision = instMatch.suffixes & (_R | _H | _X); + inst->Saturate = (instMatch.suffixes & (_S)) ? GL_TRUE : GL_FALSE; + inst->UpdateCondRegister = (instMatch.suffixes & (_C)) ? GL_TRUE : GL_FALSE; + inst->StringPos = parseState->curLine - parseState->start; + assert(inst->StringPos >= 0); + + /* + * 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 == FP_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 == FP_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->TexSrcIdx = 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->TexSrcIdx = 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(GLcontext *ctx, GLenum dstTarget, + const GLubyte *str, GLsizei len, + struct fragment_program *program) +{ + struct parse_state parseState; + struct fp_instruction instBuffer[MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS]; + struct fp_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 */ + _mesa_bzero(&parseState, 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 (_mesa_strncmp((const char *) programString, "!!FP1.0", 7) == 0) { + target = GL_FRAGMENT_PROGRAM_NV; + parseState.pos = programString + 7; + } + else if (_mesa_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 = (struct fp_instruction *) + MALLOC(parseState.numInst * sizeof(struct fp_instruction)); + if (!newInst) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); + return; /* out of memory */ + } + MEMCPY(newInst, instBuffer, + parseState.numInst * sizeof(struct fp_instruction)); + + /* 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->Instructions) { + FREE(program->Instructions); + } + program->Instructions = newInst; + program->InputsRead = parseState.inputsRead; + program->OutputsWritten = parseState.outputsWritten; + for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) + program->TexturesUsed[u] = parseState.texturesUsed[u]; + + /* save program parameters */ + program->Parameters = parseState.parameters; + + /* allocate registers for declared program parameters */ +#if 00 + _mesa_assign_program_registers(&(program->SymbolTable)); +#endif + +#ifdef DEBUG_foo + _mesa_printf("--- glLoadProgramNV(%d) result ---\n", program->Base.Id); + _mesa_print_nv_fragment_program(program); + _mesa_printf("----------------------------------\n"); +#endif + } + else { + /* Error! */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV"); + /* NOTE: _mesa_set_program_error would have been called already */ + } +} + + +static void +PrintSrcReg(const struct fragment_program *program, + const struct fp_src_register *src) +{ + static const char comps[5] = "xyzw"; + + if (src->NegateAbs) { + _mesa_printf("-"); + } + if (src->Abs) { + _mesa_printf("|"); + } + if (src->NegateBase) { + _mesa_printf("-"); + } + if (src->File == PROGRAM_NAMED_PARAM) { + if (program->Parameters->Parameters[src->Index].Type == CONSTANT) { + _mesa_printf("{%g, %g, %g, %g}", + program->Parameters->ParameterValues[src->Index][0], + program->Parameters->ParameterValues[src->Index][1], + program->Parameters->ParameterValues[src->Index][2], + program->Parameters->ParameterValues[src->Index][3]); + } + else { + ASSERT(program->Parameters->Parameters[src->Index].Type + == NAMED_PARAMETER); + _mesa_printf("%s", program->Parameters->Parameters[src->Index].Name); + } + } + else if (src->File == PROGRAM_OUTPUT) { + _mesa_printf("o[%s]", OutputRegisters[src->Index]); + } + else if (src->File == PROGRAM_INPUT) { + _mesa_printf("f[%s]", InputRegisters[src->Index]); + } + else if (src->File == PROGRAM_LOCAL_PARAM) { + _mesa_printf("p[%d]", src->Index); + } + else if (src->File == PROGRAM_TEMPORARY) { + if (src->Index >= 32) + _mesa_printf("H%d", src->Index); + else + _mesa_printf("R%d", src->Index); + } + else if (src->File == PROGRAM_WRITE_ONLY) { + _mesa_printf("%cC", "HR"[src->Index]); + } + else { + _mesa_problem(NULL, "Invalid fragment register %d", src->Index); + return; + } + if (GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 1) && + GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 2) && + GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 3)) { + _mesa_printf(".%c", comps[GET_SWZ(src->Swizzle, 0)]); + } + else if (src->Swizzle != SWIZZLE_NOOP) { + _mesa_printf(".%c%c%c%c", + comps[GET_SWZ(src->Swizzle, 0)], + comps[GET_SWZ(src->Swizzle, 1)], + comps[GET_SWZ(src->Swizzle, 2)], + comps[GET_SWZ(src->Swizzle, 3)]); + } + if (src->Abs) { + _mesa_printf("|"); + } +} + +static void +PrintTextureSrc(const struct fp_instruction *inst) +{ + _mesa_printf("TEX%d, ", inst->TexSrcUnit); + switch (inst->TexSrcIdx) { + case TEXTURE_1D_INDEX: + _mesa_printf("1D"); + break; + case TEXTURE_2D_INDEX: + _mesa_printf("2D"); + break; + case TEXTURE_3D_INDEX: + _mesa_printf("3D"); + break; + case TEXTURE_RECT_INDEX: + _mesa_printf("RECT"); + break; + case TEXTURE_CUBE_INDEX: + _mesa_printf("CUBE"); + break; + default: + _mesa_problem(NULL, "Invalid textue target in PrintTextureSrc"); + } +} + +static void +PrintCondCode(const struct fp_dst_register *dst) +{ + static const char *comps = "xyzw"; + static const char *ccString[] = { + "??", "GT", "EQ", "LT", "UN", "GE", "LE", "NE", "TR", "FL", "??" + }; + + _mesa_printf("%s", ccString[dst->CondMask]); + if (GET_SWZ(dst->CondSwizzle, 0) == GET_SWZ(dst->CondSwizzle, 1) && + GET_SWZ(dst->CondSwizzle, 0) == GET_SWZ(dst->CondSwizzle, 2) && + GET_SWZ(dst->CondSwizzle, 0) == GET_SWZ(dst->CondSwizzle, 3)) { + _mesa_printf(".%c", comps[GET_SWZ(dst->CondSwizzle, 0)]); + } + else if (dst->CondSwizzle != SWIZZLE_NOOP) { + _mesa_printf(".%c%c%c%c", + comps[GET_SWZ(dst->CondSwizzle, 0)], + comps[GET_SWZ(dst->CondSwizzle, 1)], + comps[GET_SWZ(dst->CondSwizzle, 2)], + comps[GET_SWZ(dst->CondSwizzle, 3)]); + } +} + + +static void +PrintDstReg(const struct fp_dst_register *dst) +{ + if (dst->File == PROGRAM_OUTPUT) { + _mesa_printf("o[%s]", OutputRegisters[dst->Index]); + } + else if (dst->File == PROGRAM_TEMPORARY) { + if (dst->Index >= 32) + _mesa_printf("H%d", dst->Index); + else + _mesa_printf("R%d", dst->Index); + } + else if (dst->File == PROGRAM_LOCAL_PARAM) { + _mesa_printf("p[%d]", dst->Index); + } + else if (dst->File == PROGRAM_WRITE_ONLY) { + _mesa_printf("%cC", "HR"[dst->Index]); + } + else { + _mesa_printf("???"); + } + + if (dst->WriteMask != 0 && dst->WriteMask != 0xf) { + _mesa_printf("."); + if (dst->WriteMask & 0x1) + _mesa_printf("x"); + if (dst->WriteMask & 0x2) + _mesa_printf("y"); + if (dst->WriteMask & 0x4) + _mesa_printf("z"); + if (dst->WriteMask & 0x8) + _mesa_printf("w"); + } + + if (dst->CondMask != COND_TR || + dst->CondSwizzle != SWIZZLE_NOOP) { + _mesa_printf(" ("); + PrintCondCode(dst); + _mesa_printf(")"); + } +} + + +/** + * Print (unparse) the given vertex program. Just for debugging. + */ +void +_mesa_print_nv_fragment_program(const struct fragment_program *program) +{ + const struct fp_instruction *inst; + + for (inst = program->Instructions; inst->Opcode != FP_OPCODE_END; inst++) { + int i; + for (i = 0; Instructions[i].name; i++) { + if (inst->Opcode == Instructions[i].opcode) { + /* print instruction name */ + _mesa_printf("%s", Instructions[i].name); + if (inst->Precision == FLOAT16) + _mesa_printf("H"); + else if (inst->Precision == FIXED12) + _mesa_printf("X"); + if (inst->UpdateCondRegister) + _mesa_printf("C"); + if (inst->Saturate) + _mesa_printf("_SAT"); + _mesa_printf(" "); + + if (Instructions[i].inputs == INPUT_CC) { + PrintCondCode(&inst->DstReg); + } + else if (Instructions[i].outputs == OUTPUT_V || + Instructions[i].outputs == OUTPUT_S) { + /* print dest register */ + PrintDstReg(&inst->DstReg); + _mesa_printf(", "); + } + + /* print source register(s) */ + if (Instructions[i].inputs == INPUT_1V || + Instructions[i].inputs == INPUT_1S) { + PrintSrcReg(program, &inst->SrcReg[0]); + } + else if (Instructions[i].inputs == INPUT_2V || + Instructions[i].inputs == INPUT_2S) { + PrintSrcReg(program, &inst->SrcReg[0]); + _mesa_printf(", "); + PrintSrcReg(program, &inst->SrcReg[1]); + } + else if (Instructions[i].inputs == INPUT_3V) { + PrintSrcReg(program, &inst->SrcReg[0]); + _mesa_printf(", "); + PrintSrcReg(program, &inst->SrcReg[1]); + _mesa_printf(", "); + PrintSrcReg(program, &inst->SrcReg[2]); + } + else if (Instructions[i].inputs == INPUT_1V_T) { + PrintSrcReg(program, &inst->SrcReg[0]); + _mesa_printf(", "); + PrintTextureSrc(inst); + } + else if (Instructions[i].inputs == INPUT_3V_T) { + PrintSrcReg(program, &inst->SrcReg[0]); + _mesa_printf(", "); + PrintSrcReg(program, &inst->SrcReg[1]); + _mesa_printf(", "); + PrintSrcReg(program, &inst->SrcReg[2]); + _mesa_printf(", "); + PrintTextureSrc(inst); + } + _mesa_printf(";\n"); + break; + } + } + if (!Instructions[i].name) { + _mesa_printf("Invalid opcode %d\n", inst->Opcode); + } + } + _mesa_printf("END\n"); +} + + +const char * +_mesa_nv_fragment_input_register_name(GLuint i) +{ + ASSERT(i < MAX_NV_FRAGMENT_PROGRAM_INPUTS); + return InputRegisters[i]; +} + + +const char * +_mesa_nv_fragment_output_register_name(GLuint i) +{ + ASSERT(i < MAX_NV_FRAGMENT_PROGRAM_OUTPUTS); + return OutputRegisters[i]; +} diff --git a/reactos/dll/mesa32/src/shader/nvfragparse.h b/reactos/dll/mesa32/src/shader/nvfragparse.h new file mode 100644 index 00000000000..849a7fbc7d6 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/nvfragparse.h @@ -0,0 +1,52 @@ + +/* + * 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 + + +extern void +_mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum target, + const GLubyte *str, GLsizei len, + struct fragment_program *program); + + +extern void +_mesa_print_nv_fragment_program(const struct fragment_program *program); + + +extern const char * +_mesa_nv_fragment_input_register_name(GLuint i); + + +extern const char * +_mesa_nv_fragment_output_register_name(GLuint i); + + +#endif diff --git a/reactos/dll/mesa32/src/shader/nvfragprog.h b/reactos/dll/mesa32/src/shader/nvfragprog.h new file mode 100644 index 00000000000..a7149cfdb94 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/nvfragprog.h @@ -0,0 +1,168 @@ +/* + * 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. + */ + + +/* Private fragment program types and constants only used by files + * related to fragment programs. + * + * XXX TO-DO: Rename this file "fragprog.h" since it's not NV-specific. + */ + + +#ifndef NVFRAGPROG_H +#define NVFRAGPROG_H + +#include "config.h" +#include "mtypes.h" + +/* output registers */ +#define FRAG_OUTPUT_COLR 0 +#define FRAG_OUTPUT_COLH 1 +#define FRAG_OUTPUT_DEPR 2 + + +/* 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 then or equal to zero */ +#define COND_LE 6 /* less then 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 */ +#define FLOAT32 0x1 +#define FLOAT16 0x2 +#define FIXED12 0x4 + + +/* Fragment program instruction opcodes */ +enum fp_opcode { + FP_OPCODE_ABS, /* ARB_f_p only */ + FP_OPCODE_ADD, + FP_OPCODE_CMP, /* ARB_f_p only */ + FP_OPCODE_COS, + FP_OPCODE_DDX, /* NV_f_p only */ + FP_OPCODE_DDY, /* NV_f_p only */ + FP_OPCODE_DP3, + FP_OPCODE_DP4, + FP_OPCODE_DPH, /* ARB_f_p only */ + FP_OPCODE_DST, + FP_OPCODE_END, /* private opcode */ + FP_OPCODE_EX2, + FP_OPCODE_FLR, + FP_OPCODE_FRC, + FP_OPCODE_KIL, /* ARB_f_p only */ + FP_OPCODE_KIL_NV, /* NV_f_p only */ + FP_OPCODE_LG2, + FP_OPCODE_LIT, + FP_OPCODE_LRP, + FP_OPCODE_MAD, + FP_OPCODE_MAX, + FP_OPCODE_MIN, + FP_OPCODE_MOV, + FP_OPCODE_MUL, + FP_OPCODE_PK2H, /* NV_f_p only */ + FP_OPCODE_PK2US, /* NV_f_p only */ + FP_OPCODE_PK4B, /* NV_f_p only */ + FP_OPCODE_PK4UB, /* NV_f_p only */ + FP_OPCODE_POW, + FP_OPCODE_PRINT, /* Mesa only */ + FP_OPCODE_RCP, + FP_OPCODE_RFL, /* NV_f_p only */ + FP_OPCODE_RSQ, + FP_OPCODE_SCS, /* ARB_f_p only */ + FP_OPCODE_SEQ, /* NV_f_p only */ + FP_OPCODE_SFL, /* NV_f_p only */ + FP_OPCODE_SGE, /* NV_f_p only */ + FP_OPCODE_SGT, /* NV_f_p only */ + FP_OPCODE_SIN, + FP_OPCODE_SLE, /* NV_f_p only */ + FP_OPCODE_SLT, + FP_OPCODE_SNE, /* NV_f_p only */ + FP_OPCODE_STR, /* NV_f_p only */ + FP_OPCODE_SUB, + FP_OPCODE_SWZ, /* ARB_f_p only */ + FP_OPCODE_TEX, + FP_OPCODE_TXB, /* ARB_f_p only */ + FP_OPCODE_TXD, /* NV_f_p only */ + FP_OPCODE_TXP, /* ARB_f_p only */ + FP_OPCODE_TXP_NV, /* NV_f_p only */ + FP_OPCODE_UP2H, /* NV_f_p only */ + FP_OPCODE_UP2US, /* NV_f_p only */ + FP_OPCODE_UP4B, /* NV_f_p only */ + FP_OPCODE_UP4UB, /* NV_f_p only */ + FP_OPCODE_X2D, /* NV_f_p only - 2d mat mul */ + FP_OPCODE_XPD /* ARB_f_p only - cross product */ +}; + + +/* Instruction source register */ +struct fp_src_register +{ + GLuint File:4; + GLuint Index:8; + GLuint Swizzle:12; + GLuint NegateBase:4; /* ARB: negate/extended negate. + NV: negate before absolute value? */ + GLuint Abs:1; /* NV: take absolute value? */ + GLuint NegateAbs:1; /* NV: negate after absolute value? */ +}; + + +/* Instruction destination register */ +struct fp_dst_register +{ + GLuint File:4; + GLuint Index:8; + GLuint WriteMask:4; + GLuint CondMask:4; /* NV: enough bits? */ + GLuint CondSwizzle:12; /* NV: enough bits? */ +}; + + +/* Fragment program instruction */ +struct fp_instruction +{ + GLuint Opcode:6; + GLuint Saturate:1; + GLuint UpdateCondRegister:1; /* NV */ + GLuint Precision:2; /* NV: unused/unneeded? */ + GLuint TexSrcUnit:4; /* texture unit for TEX, TXD, TXP instructions */ + GLuint TexSrcIdx:3; /* TEXTURE_1D,2D,3D,CUBE,RECT_INDEX source target */ + +#if FEATURE_MESA_program_debug + GLint StringPos:15; /* enough bits? */ +#endif + + void *Data; /* some arbitrary data, only used for PRINT instruction now */ + struct fp_src_register SrcReg[3]; + struct fp_dst_register DstReg; +}; + + +#endif diff --git a/reactos/dll/mesa32/src/shader/nvprogram.c b/reactos/dll/mesa32/src/shader/nvprogram.c new file mode 100644 index 00000000000..4b893017649 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/nvprogram.c @@ -0,0 +1,869 @@ +/* + * 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. + */ + +/** + * \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 "glheader.h" +#include "context.h" +#include "hash.h" +#include "imports.h" +#include "macros.h" +#include "mtypes.h" +#include "nvfragparse.h" +#include "nvfragprog.h" +#include "nvvertexec.h" +#include "nvvertparse.h" +#include "nvvertprog.h" +#include "nvprogram.h" +#include "program.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 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 vertex_program *) + _mesa_HashLookup(ctx->Shared->Programs, id); + + if (!vprog || vprog->Base.Target != GL_VERTEX_STATE_PROGRAM_NV) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glExecuteProgramNV"); + return; + } + + _mesa_init_vp_per_vertex_registers(ctx); + _mesa_init_vp_per_primitive_registers(ctx); + COPY_4V(ctx->VertexProgram.Inputs[VERT_ATTRIB_POS], params); + _mesa_exec_vertex_program(ctx, vprog); +} + + +/** + * 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 program *prog; + if (ids[i] == 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV"); + return GL_FALSE; + } + prog = (const struct program *) + _mesa_HashLookup(ctx->Shared->Programs, 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 program *prog; + + if (ids[i] == 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(id)"); + return; + } + + prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, 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 program *prog; + GET_CURRENT_CONTEXT(ctx); + + if (!ctx->_CurrentProgram) + ASSERT_OUTSIDE_BEGIN_END(ctx); + + prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, 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)_mesa_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 program *prog; + GET_CURRENT_CONTEXT(ctx); + + if (!ctx->_CurrentProgram) + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (pname != GL_PROGRAM_STRING_NV) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringNV(pname)"); + return; + } + + prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); + if (!prog) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramStringNV"); + return; + } + + if (prog->String) { + MEMCPY(program, prog->String, _mesa_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) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (index == 0 || index >= MAX_NV_VERTEX_PROGRAM_INPUTS) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)"); + return; + } + + switch (pname) { + case GL_ATTRIB_ARRAY_SIZE_NV: + params[0] = ctx->Array.VertexAttrib[index].Size; + break; + case GL_ATTRIB_ARRAY_STRIDE_NV: + params[0] = ctx->Array.VertexAttrib[index].Stride; + break; + case GL_ATTRIB_ARRAY_TYPE_NV: + params[0] = ctx->Array.VertexAttrib[index].Type; + break; + case GL_CURRENT_ATTRIB_NV: + 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) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (index == 0 || index >= MAX_NV_VERTEX_PROGRAM_INPUTS) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)"); + return; + } + + switch (pname) { + case GL_ATTRIB_ARRAY_SIZE_NV: + params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Size; + break; + case GL_ATTRIB_ARRAY_STRIDE_NV: + params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Stride; + break; + case GL_ATTRIB_ARRAY_TYPE_NV: + params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Type; + break; + case GL_CURRENT_ATTRIB_NV: + 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) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (index == 0 || index >= MAX_NV_VERTEX_PROGRAM_INPUTS) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)"); + return; + } + + switch (pname) { + case GL_ATTRIB_ARRAY_SIZE_NV: + params[0] = ctx->Array.VertexAttrib[index].Size; + break; + case GL_ATTRIB_ARRAY_STRIDE_NV: + params[0] = ctx->Array.VertexAttrib[index].Stride; + break; + case GL_ATTRIB_ARRAY_TYPE_NV: + params[0] = ctx->Array.VertexAttrib[index].Type; + break; + case GL_CURRENT_ATTRIB_NV: + 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: + if (!ctx->Extensions.ARB_vertex_buffer_object) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV"); + return; + } + params[0] = ctx->Array.VertexAttrib[index].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.VertexAttrib[index].Ptr;; +} + + + +/** + * 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 program *prog; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (id == 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glLoadProgramNV(id)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, 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 vertex_program *vprog = (struct vertex_program *) prog; + if (!vprog || prog == &_mesa_DummyProgram) { + vprog = (struct 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); + } + _mesa_parse_nv_vertex_program(ctx, target, program, len, vprog); + } + else if (target == GL_FRAGMENT_PROGRAM_NV + && ctx->Extensions.NV_fragment_program) { + struct fragment_program *fprog = (struct fragment_program *) prog; + if (!fprog || prog == &_mesa_DummyProgram) { + fprog = (struct 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 { + _mesa_error(ctx, GL_INVALID_ENUM, "glLoadProgramNV(target)"); + } +} + + + +/** + * Set a program parameter register. + * \note Called from the GL API dispatcher. + */ +void GLAPIENTRY +_mesa_ProgramParameter4dNV(GLenum target, GLuint index, + GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + _mesa_ProgramParameter4fNV(target, index, + (GLfloat)x, (GLfloat)y, (GLfloat)z, (GLfloat)w); +} + + +/** + * Set a program parameter register. + * \note Called from the GL API dispatcher. + */ +void GLAPIENTRY +_mesa_ProgramParameter4dvNV(GLenum target, GLuint index, + const GLdouble *params) +{ + _mesa_ProgramParameter4fNV(target, index, + (GLfloat)params[0], (GLfloat)params[1], + (GLfloat)params[2], (GLfloat)params[3]); +} + + +/** + * Set a program parameter register. + * \note Called from the GL API dispatcher. + */ +void GLAPIENTRY +_mesa_ProgramParameter4fNV(GLenum target, GLuint index, + GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) { + if (index < MAX_NV_VERTEX_PROGRAM_PARAMS) { + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + ASSIGN_4V(ctx->VertexProgram.Parameters[index], x, y, z, w); + } + else { + _mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameterNV(index)"); + return; + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameterNV"); + return; + } +} + + +/** + * Set a program parameter register. + * \note Called from the GL API dispatcher. + */ +void GLAPIENTRY +_mesa_ProgramParameter4fvNV(GLenum target, GLuint index, + const GLfloat *params) +{ + _mesa_ProgramParameter4fNV(target, index, + params[0], params[1], params[2], params[3]); +} + + + +/** + * Set a sequence of program parameter registers. + * \note Called from the GL API dispatcher. + */ +void GLAPIENTRY +_mesa_ProgramParameters4dvNV(GLenum target, GLuint index, + GLuint num, const GLdouble *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) { + GLuint 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, + GLuint num, const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) { + GLuint 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 program *prog; + struct fragment_program *fragProg; + GLfloat *v; + + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, 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 fragment_program *) prog; + v = _mesa_lookup_parameter_value(fragProg->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 program *prog; + struct fragment_program *fragProg; + const GLfloat *v; + + GET_CURRENT_CONTEXT(ctx); + + if (!ctx->_CurrentProgram) + ASSERT_OUTSIDE_BEGIN_END(ctx); + + prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, 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 fragment_program *) prog; + v = _mesa_lookup_parameter_value(fragProg->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/reactos/dll/mesa32/src/shader/nvprogram.h b/reactos/dll/mesa32/src/shader/nvprogram.h new file mode 100644 index 00000000000..dcea7727e04 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/nvprogram.h @@ -0,0 +1,119 @@ +/* + * 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 + + +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_ProgramParameter4dNV(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); + +extern void GLAPIENTRY +_mesa_ProgramParameter4dvNV(GLenum target, GLuint index, const GLdouble *params); + +extern void GLAPIENTRY +_mesa_ProgramParameter4fNV(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + +extern void GLAPIENTRY +_mesa_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params); + +extern void GLAPIENTRY +_mesa_ProgramParameters4dvNV(GLenum target, GLuint index, GLuint num, const GLdouble *params); + +extern void GLAPIENTRY +_mesa_ProgramParameters4fvNV(GLenum target, GLuint index, GLuint 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); + + +#endif diff --git a/reactos/dll/mesa32/src/shader/nvvertexec.c b/reactos/dll/mesa32/src/shader/nvvertexec.c new file mode 100644 index 00000000000..725e3ec9cd5 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/nvvertexec.c @@ -0,0 +1,851 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 nvvertexec.c + * Code to execute vertex programs. + * \author Brian Paul + */ + +#include "glheader.h" +#include "context.h" +#include "imports.h" +#include "macros.h" +#include "mtypes.h" +#include "nvvertexec.h" +#include "nvvertprog.h" +#include "program.h" +#include "math/m_matrix.h" + + +static const GLfloat ZeroVec[4] = { 0.0F, 0.0F, 0.0F, 0.0F }; + + +/** + * Load/initialize the vertex program registers which need to be set + * per-vertex. + */ +void +_mesa_init_vp_per_vertex_registers(GLcontext *ctx) +{ + /* Input registers get initialized from the current vertex attribs */ + MEMCPY(ctx->VertexProgram.Inputs, ctx->Current.Attrib, + VERT_ATTRIB_MAX * 4 * sizeof(GLfloat)); + + if (ctx->VertexProgram.Current->IsNVProgram) { + GLuint i; + /* Output/result regs are initialized to [0,0,0,1] */ + for (i = 0; i < MAX_NV_VERTEX_PROGRAM_OUTPUTS; i++) { + ASSIGN_4V(ctx->VertexProgram.Outputs[i], 0.0F, 0.0F, 0.0F, 1.0F); + } + /* Temp regs are initialized to [0,0,0,0] */ + for (i = 0; i < MAX_NV_VERTEX_PROGRAM_TEMPS; i++) { + ASSIGN_4V(ctx->VertexProgram.Temporaries[i], 0.0F, 0.0F, 0.0F, 0.0F); + } + ASSIGN_4V(ctx->VertexProgram.AddressReg, 0, 0, 0, 0); + } +} + + + +/** + * 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 program parameter registers with tracked matrices (if NV program) + * or GL state values (if ARB program). + * This needs to be done per glBegin/glEnd, not per-vertex. + */ +void +_mesa_init_vp_per_primitive_registers(GLcontext *ctx) +{ + if (ctx->VertexProgram.Current->IsNVProgram) { + 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) { + mat = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top; + } + else if (ctx->VertexProgram.TrackMatrix[i] == GL_COLOR) { + mat = ctx->ColorMatrixStack.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 < MAX_PROGRAM_MATRICES); + 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 */ + 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); + } + } + } + else { + /* Using and ARB vertex program */ + if (ctx->VertexProgram.Current->Parameters) { + /* Grab the state GL state and put into registers */ + _mesa_load_state_parameters(ctx, + ctx->VertexProgram.Current->Parameters); + } + } +} + + + +/** + * For debugging. Dump the current vertex program machine registers. + */ +void +_mesa_dump_vp_state( const struct gl_vertex_program_state *state ) +{ + int i; + _mesa_printf("VertexIn:\n"); + for (i = 0; i < MAX_NV_VERTEX_PROGRAM_INPUTS; i++) { + _mesa_printf("%d: %f %f %f %f ", i, + state->Inputs[i][0], + state->Inputs[i][1], + state->Inputs[i][2], + state->Inputs[i][3]); + } + _mesa_printf("\n"); + + _mesa_printf("VertexOut:\n"); + for (i = 0; i < MAX_NV_VERTEX_PROGRAM_OUTPUTS; i++) { + _mesa_printf("%d: %f %f %f %f ", i, + state->Outputs[i][0], + state->Outputs[i][1], + state->Outputs[i][2], + state->Outputs[i][3]); + } + _mesa_printf("\n"); + + _mesa_printf("Registers:\n"); + for (i = 0; i < MAX_NV_VERTEX_PROGRAM_TEMPS; i++) { + _mesa_printf("%d: %f %f %f %f ", i, + state->Temporaries[i][0], + state->Temporaries[i][1], + state->Temporaries[i][2], + state->Temporaries[i][3]); + } + _mesa_printf("\n"); + + _mesa_printf("Parameters:\n"); + for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS; i++) { + _mesa_printf("%d: %f %f %f %f ", i, + state->Parameters[i][0], + state->Parameters[i][1], + state->Parameters[i][2], + state->Parameters[i][3]); + } + _mesa_printf("\n"); +} + + + +/** + * Return a pointer to the 4-element float vector specified by the given + * source register. + */ +static INLINE const GLfloat * +get_register_pointer( const struct vp_src_register *source, + const struct gl_vertex_program_state *state ) +{ + if (source->RelAddr) { + const GLint reg = source->Index + state->AddressReg[0]; + ASSERT( (source->File == PROGRAM_ENV_PARAM) || + (source->File == PROGRAM_STATE_VAR) ); + if (reg < 0 || reg > MAX_NV_VERTEX_PROGRAM_PARAMS) + return ZeroVec; + else if (source->File == PROGRAM_ENV_PARAM) + return state->Parameters[reg]; + else + return state->Current->Parameters->ParameterValues[reg]; + } + else { + switch (source->File) { + case PROGRAM_TEMPORARY: + ASSERT(source->Index < MAX_NV_VERTEX_PROGRAM_TEMPS); + return state->Temporaries[source->Index]; + case PROGRAM_INPUT: + ASSERT(source->Index < MAX_NV_VERTEX_PROGRAM_INPUTS); + return state->Inputs[source->Index]; + case PROGRAM_OUTPUT: + /* This is only needed for the PRINT instruction */ + ASSERT(source->Index < MAX_NV_VERTEX_PROGRAM_OUTPUTS); + return state->Outputs[source->Index]; + case PROGRAM_LOCAL_PARAM: + ASSERT(source->Index < MAX_PROGRAM_LOCAL_PARAMS); + return state->Current->Base.LocalParams[source->Index]; + case PROGRAM_ENV_PARAM: + ASSERT(source->Index < MAX_NV_VERTEX_PROGRAM_PARAMS); + return state->Parameters[source->Index]; + case PROGRAM_STATE_VAR: + ASSERT(source->Index < state->Current->Parameters->NumParameters); + return state->Current->Parameters->ParameterValues[source->Index]; + default: + _mesa_problem(NULL, + "Bad source register file in get_register_pointer"); + return NULL; + } + } + return NULL; +} + + +/** + * Fetch a 4-element float vector from the given source register. + * Apply swizzling and negating as needed. + */ +static INLINE void +fetch_vector4( const struct vp_src_register *source, + const struct gl_vertex_program_state *state, + GLfloat result[4] ) +{ + const GLfloat *src = get_register_pointer(source, state); + + if (source->Negate) { + 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)]; + } + else { + 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)]; + } +} + + + +/** + * As above, but only return result[0] element. + */ +static INLINE void +fetch_vector1( const struct vp_src_register *source, + const struct gl_vertex_program_state *state, + GLfloat result[4] ) +{ + const GLfloat *src = get_register_pointer(source, state); + + if (source->Negate) { + result[0] = -src[GET_SWZ(source->Swizzle, 0)]; + } + else { + result[0] = src[GET_SWZ(source->Swizzle, 0)]; + } +} + + +/** + * Store 4 floats into a register. + */ +static void +store_vector4( const struct vp_dst_register *dest, + struct gl_vertex_program_state *state, + const GLfloat value[4] ) +{ + GLfloat *dst; + switch (dest->File) { + case PROGRAM_TEMPORARY: + dst = state->Temporaries[dest->Index]; + break; + case PROGRAM_OUTPUT: + dst = state->Outputs[dest->Index]; + break; + case PROGRAM_ENV_PARAM: + { + /* a slight hack */ + GET_CURRENT_CONTEXT(ctx); + dst = ctx->VertexProgram.Parameters[dest->Index]; + } + break; + default: + _mesa_problem(NULL, "Invalid register file in store_vector4(file=%d)", + dest->File); + return; + } + + if (dest->WriteMask & WRITEMASK_X) + dst[0] = value[0]; + if (dest->WriteMask & WRITEMASK_Y) + dst[1] = value[1]; + if (dest->WriteMask & WRITEMASK_Z) + dst[2] = value[2]; + if (dest->WriteMask & WRITEMASK_W) + dst[3] = value[3]; +} + + +/** + * Set x to positive or negative infinity. + */ +#if defined(USE_IEEE) || defined(_WIN32) +#define SET_POS_INFINITY(x) ( *((GLuint *) (void *)&x) = 0x7F800000 ) +#define SET_NEG_INFINITY(x) ( *((GLuint *) (void *)&x) = 0xFF800000 ) +#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 + + +/** + * Execute the given vertex program + */ +void +_mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program) +{ + struct gl_vertex_program_state *state = &ctx->VertexProgram; + const struct vp_instruction *inst; + + ctx->_CurrentProgram = GL_VERTEX_PROGRAM_ARB; /* or NV, doesn't matter */ + + /* If the program is position invariant, multiply the input + * position and the MVP matrix and stick it into the output pos slot + */ + if (ctx->VertexProgram.Current->IsPositionInvariant) { + TRANSFORM_POINT( ctx->VertexProgram.Outputs[0], + ctx->_ModelProjectMatrix.m, + ctx->VertexProgram.Inputs[0]); + + /* XXX: This could go elsewhere */ + ctx->VertexProgram.Current->OutputsWritten |= 0x1; + } + for (inst = program->Instructions; ; inst++) { + + if (ctx->VertexProgram.CallbackEnabled && + ctx->VertexProgram.Callback) { + ctx->VertexProgram.CurrentPosition = inst->StringPos; + ctx->VertexProgram.Callback(program->Base.Target, + ctx->VertexProgram.CallbackData); + } + + switch (inst->Opcode) { + case VP_OPCODE_MOV: + { + GLfloat t[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + store_vector4( &inst->DstReg, state, t ); + } + break; + case VP_OPCODE_LIT: + { + const GLfloat epsilon = 1.0F / 256.0F; /* per NV spec */ + GLfloat t[4], lit[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + t[0] = MAX2(t[0], 0.0F); + t[1] = MAX2(t[1], 0.0F); + t[3] = CLAMP(t[3], -(128.0F - epsilon), (128.0F - epsilon)); + lit[0] = 1.0; + lit[1] = t[0]; + lit[2] = (t[0] > 0.0) ? (GLfloat) _mesa_pow(t[1], t[3]) : 0.0F; + lit[3] = 1.0; + store_vector4( &inst->DstReg, state, lit ); + } + break; + case VP_OPCODE_RCP: + { + GLfloat t[4]; + fetch_vector1( &inst->SrcReg[0], state, t ); + if (t[0] != 1.0F) + t[0] = 1.0F / t[0]; /* div by zero is infinity! */ + t[1] = t[2] = t[3] = t[0]; + store_vector4( &inst->DstReg, state, t ); + } + break; + case VP_OPCODE_RSQ: + { + GLfloat t[4]; + fetch_vector1( &inst->SrcReg[0], state, t ); + t[0] = INV_SQRTF(FABSF(t[0])); + t[1] = t[2] = t[3] = t[0]; + store_vector4( &inst->DstReg, state, t ); + } + break; + case VP_OPCODE_EXP: + { + GLfloat t[4], q[4], floor_t0; + fetch_vector1( &inst->SrcReg[0], state, t ); + floor_t0 = (float) floor(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 { +#ifdef USE_IEEE + GLint ii = (GLint) floor_t0; + ii = (ii < 23) + 0x3f800000; + SET_FLOAT_BITS(q[0], ii); + q[0] = *((GLfloat *) (void *)&ii); +#else + q[0] = (GLfloat) pow(2.0, floor_t0); +#endif + q[2] = (GLfloat) (q[0] * LOG2(q[1])); + } + q[1] = t[0] - floor_t0; + q[3] = 1.0F; + store_vector4( &inst->DstReg, state, q ); + } + break; + case VP_OPCODE_LOG: + { + GLfloat t[4], q[4], abs_t0; + fetch_vector1( &inst->SrcReg[0], state, t ); + abs_t0 = (GLfloat) fabs(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; + double mantissa = frexp(t[0], &exponent); + q[0] = (GLfloat) (exponent - 1); + q[1] = (GLfloat) (2.0 * mantissa); /* map [.5, 1) -> [1, 2) */ + q[2] = (GLfloat) (q[0] + LOG2(q[1])); + } + } + else { + SET_NEG_INFINITY(q[0]); + q[1] = 1.0F; + SET_NEG_INFINITY(q[2]); + } + q[3] = 1.0; + store_vector4( &inst->DstReg, state, q ); + } + break; + case VP_OPCODE_MUL: + { + GLfloat t[4], u[4], prod[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + fetch_vector4( &inst->SrcReg[1], state, u ); + prod[0] = t[0] * u[0]; + prod[1] = t[1] * u[1]; + prod[2] = t[2] * u[2]; + prod[3] = t[3] * u[3]; + store_vector4( &inst->DstReg, state, prod ); + } + break; + case VP_OPCODE_ADD: + { + GLfloat t[4], u[4], sum[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + fetch_vector4( &inst->SrcReg[1], state, u ); + sum[0] = t[0] + u[0]; + sum[1] = t[1] + u[1]; + sum[2] = t[2] + u[2]; + sum[3] = t[3] + u[3]; + store_vector4( &inst->DstReg, state, sum ); + } + break; + case VP_OPCODE_DP3: + { + GLfloat t[4], u[4], dot[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + fetch_vector4( &inst->SrcReg[1], state, u ); + dot[0] = t[0] * u[0] + t[1] * u[1] + t[2] * u[2]; + dot[1] = dot[2] = dot[3] = dot[0]; + store_vector4( &inst->DstReg, state, dot ); + } + break; + case VP_OPCODE_DP4: + { + GLfloat t[4], u[4], dot[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + fetch_vector4( &inst->SrcReg[1], state, u ); + dot[0] = t[0] * u[0] + t[1] * u[1] + t[2] * u[2] + t[3] * u[3]; + dot[1] = dot[2] = dot[3] = dot[0]; + store_vector4( &inst->DstReg, state, dot ); + } + break; + case VP_OPCODE_DST: + { + GLfloat t[4], u[4], dst[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + fetch_vector4( &inst->SrcReg[1], state, u ); + dst[0] = 1.0F; + dst[1] = t[1] * u[1]; + dst[2] = t[2]; + dst[3] = u[3]; + store_vector4( &inst->DstReg, state, dst ); + } + break; + case VP_OPCODE_MIN: + { + GLfloat t[4], u[4], min[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + fetch_vector4( &inst->SrcReg[1], state, u ); + min[0] = (t[0] < u[0]) ? t[0] : u[0]; + min[1] = (t[1] < u[1]) ? t[1] : u[1]; + min[2] = (t[2] < u[2]) ? t[2] : u[2]; + min[3] = (t[3] < u[3]) ? t[3] : u[3]; + store_vector4( &inst->DstReg, state, min ); + } + break; + case VP_OPCODE_MAX: + { + GLfloat t[4], u[4], max[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + fetch_vector4( &inst->SrcReg[1], state, u ); + max[0] = (t[0] > u[0]) ? t[0] : u[0]; + max[1] = (t[1] > u[1]) ? t[1] : u[1]; + max[2] = (t[2] > u[2]) ? t[2] : u[2]; + max[3] = (t[3] > u[3]) ? t[3] : u[3]; + store_vector4( &inst->DstReg, state, max ); + } + break; + case VP_OPCODE_SLT: + { + GLfloat t[4], u[4], slt[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + fetch_vector4( &inst->SrcReg[1], state, u ); + slt[0] = (t[0] < u[0]) ? 1.0F : 0.0F; + slt[1] = (t[1] < u[1]) ? 1.0F : 0.0F; + slt[2] = (t[2] < u[2]) ? 1.0F : 0.0F; + slt[3] = (t[3] < u[3]) ? 1.0F : 0.0F; + store_vector4( &inst->DstReg, state, slt ); + } + break; + case VP_OPCODE_SGE: + { + GLfloat t[4], u[4], sge[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + fetch_vector4( &inst->SrcReg[1], state, u ); + sge[0] = (t[0] >= u[0]) ? 1.0F : 0.0F; + sge[1] = (t[1] >= u[1]) ? 1.0F : 0.0F; + sge[2] = (t[2] >= u[2]) ? 1.0F : 0.0F; + sge[3] = (t[3] >= u[3]) ? 1.0F : 0.0F; + store_vector4( &inst->DstReg, state, sge ); + } + break; + case VP_OPCODE_MAD: + { + GLfloat t[4], u[4], v[4], sum[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + fetch_vector4( &inst->SrcReg[1], state, u ); + fetch_vector4( &inst->SrcReg[2], state, v ); + sum[0] = t[0] * u[0] + v[0]; + sum[1] = t[1] * u[1] + v[1]; + sum[2] = t[2] * u[2] + v[2]; + sum[3] = t[3] * u[3] + v[3]; + store_vector4( &inst->DstReg, state, sum ); + } + break; + case VP_OPCODE_ARL: + { + GLfloat t[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + state->AddressReg[0] = (GLint) floor(t[0]); + } + break; + case VP_OPCODE_DPH: + { + GLfloat t[4], u[4], dot[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + fetch_vector4( &inst->SrcReg[1], state, u ); + dot[0] = t[0] * u[0] + t[1] * u[1] + t[2] * u[2] + u[3]; + dot[1] = dot[2] = dot[3] = dot[0]; + store_vector4( &inst->DstReg, state, dot ); + } + break; + case VP_OPCODE_RCC: + { + GLfloat t[4], u; + fetch_vector1( &inst->SrcReg[0], state, t ); + if (t[0] == 1.0F) + u = 1.0F; + else + u = 1.0F / t[0]; + if (u > 0.0F) { + if (u > 1.884467e+019F) { + u = 1.884467e+019F; /* IEEE 32-bit binary value 0x5F800000 */ + } + else if (u < 5.42101e-020F) { + u = 5.42101e-020F; /* IEEE 32-bit binary value 0x1F800000 */ + } + } + else { + if (u < -1.884467e+019F) { + u = -1.884467e+019F; /* IEEE 32-bit binary value 0xDF800000 */ + } + else if (u > -5.42101e-020F) { + u = -5.42101e-020F; /* IEEE 32-bit binary value 0x9F800000 */ + } + } + t[0] = t[1] = t[2] = t[3] = u; + store_vector4( &inst->DstReg, state, t ); + } + break; + case VP_OPCODE_SUB: /* GL_NV_vertex_program1_1 */ + { + GLfloat t[4], u[4], sum[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + fetch_vector4( &inst->SrcReg[1], state, u ); + sum[0] = t[0] - u[0]; + sum[1] = t[1] - u[1]; + sum[2] = t[2] - u[2]; + sum[3] = t[3] - u[3]; + store_vector4( &inst->DstReg, state, sum ); + } + break; + case VP_OPCODE_ABS: /* GL_NV_vertex_program1_1 */ + { + GLfloat t[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + if (t[0] < 0.0) t[0] = -t[0]; + if (t[1] < 0.0) t[1] = -t[1]; + if (t[2] < 0.0) t[2] = -t[2]; + if (t[3] < 0.0) t[3] = -t[3]; + store_vector4( &inst->DstReg, state, t ); + } + break; + case VP_OPCODE_FLR: /* GL_ARB_vertex_program */ + { + GLfloat t[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + t[0] = FLOORF(t[0]); + t[1] = FLOORF(t[1]); + t[2] = FLOORF(t[2]); + t[3] = FLOORF(t[3]); + store_vector4( &inst->DstReg, state, t ); + } + break; + case VP_OPCODE_FRC: /* GL_ARB_vertex_program */ + { + GLfloat t[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + t[0] = t[0] - FLOORF(t[0]); + t[1] = t[1] - FLOORF(t[1]); + t[2] = t[2] - FLOORF(t[2]); + t[3] = t[3] - FLOORF(t[3]); + store_vector4( &inst->DstReg, state, t ); + } + break; + case VP_OPCODE_EX2: /* GL_ARB_vertex_program */ + { + GLfloat t[4]; + fetch_vector1( &inst->SrcReg[0], state, t ); + t[0] = t[1] = t[2] = t[3] = (GLfloat)_mesa_pow(2.0, t[0]); + store_vector4( &inst->DstReg, state, t ); + } + break; + case VP_OPCODE_LG2: /* GL_ARB_vertex_program */ + { + GLfloat t[4]; + fetch_vector1( &inst->SrcReg[0], state, t ); + t[0] = t[1] = t[2] = t[3] = LOG2(t[0]); + store_vector4( &inst->DstReg, state, t ); + } + break; + case VP_OPCODE_POW: /* GL_ARB_vertex_program */ + { + GLfloat t[4], u[4]; + fetch_vector1( &inst->SrcReg[0], state, t ); + fetch_vector1( &inst->SrcReg[1], state, u ); + t[0] = t[1] = t[2] = t[3] = (GLfloat)_mesa_pow(t[0], u[0]); + store_vector4( &inst->DstReg, state, t ); + } + break; + case VP_OPCODE_XPD: /* GL_ARB_vertex_program */ + { + GLfloat t[4], u[4], cross[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + fetch_vector4( &inst->SrcReg[1], state, u ); + cross[0] = t[1] * u[2] - t[2] * u[1]; + cross[1] = t[2] * u[0] - t[0] * u[2]; + cross[2] = t[0] * u[1] - t[1] * u[0]; + store_vector4( &inst->DstReg, state, cross ); + } + break; + case VP_OPCODE_SWZ: /* GL_ARB_vertex_program */ + { + const struct vp_src_register *source = &inst->SrcReg[0]; + const GLfloat *src = get_register_pointer(source, state); + GLfloat result[4]; + GLuint i; + + /* do extended swizzling here */ + for (i = 0; i < 3; i++) { + if (GET_SWZ(source->Swizzle, i) == SWIZZLE_ZERO) + result[i] = 0.0; + else if (GET_SWZ(source->Swizzle, i) == SWIZZLE_ONE) + result[i] = -1.0; + else + result[i] = -src[GET_SWZ(source->Swizzle, i)]; + if (source->Negate) + result[i] = -result[i]; + } + store_vector4( &inst->DstReg, state, result ); + } + break; + case VP_OPCODE_PRINT: + if (inst->SrcReg[0].File) { + GLfloat t[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + _mesa_printf("%s%g, %g, %g, %g\n", + (char *) inst->Data, t[0], t[1], t[2], t[3]); + } + else { + _mesa_printf("%s\n", (char *) inst->Data); + } + break; + case VP_OPCODE_END: + ctx->_CurrentProgram = 0; + return; + default: + /* bad instruction opcode */ + _mesa_problem(ctx, "Bad VP Opcode in _mesa_exec_vertex_program"); + ctx->_CurrentProgram = 0; + return; + } /* switch */ + } /* for */ + + ctx->_CurrentProgram = 0; +} + + + +/** +Thoughts on vertex program optimization: + +The obvious thing to do is to compile the vertex program into X86/SSE/3DNow! +assembly code. That will probably be a lot of work. + +Another approach might be to replace the vp_instruction->Opcode field with +a pointer to a specialized C function which executes the instruction. +In particular we can write functions which skip swizzling, negating, +masking, relative addressing, etc. when they're not needed. + +For example: + +void simple_add( struct vp_instruction *inst ) +{ + GLfloat *sum = machine->Registers[inst->DstReg.Register]; + GLfloat *a = machine->Registers[inst->SrcReg[0].Register]; + GLfloat *b = machine->Registers[inst->SrcReg[1].Register]; + sum[0] = a[0] + b[0]; + sum[1] = a[1] + b[1]; + sum[2] = a[2] + b[2]; + sum[3] = a[3] + b[3]; +} + +*/ + +/* + +KW: + +A first step would be to 'vectorize' the programs in the same way as +the normal transformation code in the tnl module. Thus each opcode +takes zero or more input vectors (registers) and produces one or more +output vectors. + +These operations would intially be coded in C, with machine-specific +assembly following, as is currently the case for matrix +transformations in the math/ directory. The preprocessing scheme for +selecting simpler operations Brian describes above would also work +here. + +This should give reasonable performance without excessive effort. + +*/ diff --git a/reactos/dll/mesa32/src/shader/nvvertexec.h b/reactos/dll/mesa32/src/shader/nvvertexec.h new file mode 100644 index 00000000000..cdf1bd588bf --- /dev/null +++ b/reactos/dll/mesa32/src/shader/nvvertexec.h @@ -0,0 +1,43 @@ +/* + * 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. + * + * Authors: + * Brian Paul + */ + +#ifndef NVVERTEXEC_H +#define NVVERTEXEC_H + +extern void +_mesa_init_vp_per_vertex_registers(GLcontext *ctx); + +extern void +_mesa_init_vp_per_primitive_registers(GLcontext *ctx); + +extern void +_mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program); + +extern void +_mesa_dump_vp_state( const struct gl_vertex_program_state *state ); + +#endif diff --git a/reactos/dll/mesa32/src/shader/nvvertparse.c b/reactos/dll/mesa32/src/shader/nvvertparse.c new file mode 100644 index 00000000000..33bc2004acd --- /dev/null +++ b/reactos/dll/mesa32/src/shader/nvvertparse.c @@ -0,0 +1,1603 @@ +/* + * 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. + */ + +/** + * \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 "glheader.h" +#include "context.h" +#include "hash.h" +#include "imports.h" +#include "macros.h" +#include "mtypes.h" +#include "nvprogram.h" +#include "nvvertparse.h" +#include "nvvertprog.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 { + GLcontext *ctx; + const GLubyte *start; + const GLubyte *pos; + const GLubyte *curLine; + GLboolean isStateProgram; + GLboolean isPositionInvariant; + GLboolean isVersion1_1; + GLuint inputsRead; + GLuint outputsWritten; + GLboolean anyProgRegsWritten; + 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); + _mesa_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]; \ + _mesa_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)_mesa_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", "BFC0", "BFC1", "FOGC", "PSIZ", + "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL +}; + +/* NOTE: the order here must match opcodes in nvvertprog.h */ +static const char *Opcodes[] = { + "MOV", "LIT", "RCP", "RSQ", "EXP", "LOG", "MUL", "ADD", "DP3", "DP4", + "DST", "MIN", "MAX", "SLT", "SGE", "MAD", "ARL", "DPH", "RCC", "SUB", + "ABS", "END", + /* GL_ARB_vertex_program */ + "FLR", "FRC", "EX2", "LG2", "POW", "XPD", "SWZ", + /* Mesa-specific */ + "PRINT", + 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 = _mesa_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 = _mesa_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 vp_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 = _mesa_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 (_mesa_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; + /* 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 = _mesa_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[] + */ +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 = _mesa_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 (_mesa_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 (_mesa_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 vp_dst_register *dstReg) +{ + GLubyte token[100]; + GLint idx; + + /* Dst reg can be R 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 vp_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 = GL_TRUE; + if (!Peek_Token(parseState, token)) + RETURN_ERROR; + } + else { + srcReg->Negate = GL_FALSE; + } + + /* Src reg can be R, 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 = MAKE_SWIZZLE4(0, 0, 0, 0); + else if (token[0] == 'y') + srcReg->Swizzle = MAKE_SWIZZLE4(1, 1, 1, 1); + else if (token[0] == 'z') + srcReg->Swizzle = MAKE_SWIZZLE4(2, 2, 2, 2); + else if (token[0] == 'w') + srcReg->Swizzle = MAKE_SWIZZLE4(3, 3, 3, 3); + else + RETURN_ERROR1("Expected x, y, z, or w"); + } + else { + /* 2, 3 or 4-component swizzle */ + GLint k; + 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 vp_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 = GL_TRUE; + (void) Parse_String(parseState, "-"); /* consume '-' */ + if (!Peek_Token(parseState, token)) + RETURN_ERROR; + } + else { + srcReg->Negate = GL_FALSE; + } + + /* Src reg can be R, 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 vp_instruction *inst, enum vp_opcode opcode) +{ + if (opcode == VP_OPCODE_ABS && !parseState->isVersion1_1) + RETURN_ERROR1("ABS illegal for vertex program 1.0"); + + inst->Opcode = opcode; + inst->StringPos = parseState->curLine - parseState->start; + + /* 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 vp_instruction *inst, enum vp_opcode opcode) +{ + if (opcode == VP_OPCODE_DPH && !parseState->isVersion1_1) + RETURN_ERROR1("DPH illegal for vertex program 1.0"); + if (opcode == VP_OPCODE_SUB && !parseState->isVersion1_1) + RETURN_ERROR1("SUB illegal for vertex program 1.0"); + + inst->Opcode = opcode; + inst->StringPos = parseState->curLine - parseState->start; + + /* 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 vp_instruction *inst, enum vp_opcode opcode) +{ + inst->Opcode = opcode; + inst->StringPos = parseState->curLine - parseState->start; + + /* 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 vp_instruction *inst, enum vp_opcode opcode) +{ + if (opcode == VP_OPCODE_RCC && !parseState->isVersion1_1) + RETURN_ERROR1("RCC illegal for vertex program 1.0"); + + inst->Opcode = opcode; + inst->StringPos = parseState->curLine - parseState->start; + + /* 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 vp_instruction *inst) +{ + inst->Opcode = VP_OPCODE_ARL; + inst->StringPos = parseState->curLine - parseState->start; + + /* 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 vp_instruction *inst) +{ + GLubyte token[100]; + + inst->Opcode = VP_OPCODE_END; + inst->StringPos = parseState->curLine - parseState->start; + + /* 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: + * + * ::= + * | ... + * | + * + * ::= "PRINT" + * | "PRINT" "," + * | "PRINT" "," + */ +static GLboolean +Parse_PrintInstruction(struct parse_state *parseState, struct vp_instruction *inst) +{ + const GLubyte *str; + GLubyte *msg; + GLuint len; + GLubyte token[100]; + struct vp_src_register *srcReg = &inst->SrcReg[0]; + GLint idx; + + inst->Opcode = VP_OPCODE_PRINT; + inst->StringPos = parseState->curLine - parseState->start; + + /* 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 = _mesa_malloc(len + 1); + + _mesa_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 = GL_FALSE; + srcReg->Swizzle = SWIZZLE_NOOP; + + /* Register can be R, 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 = 0; + } + + /* semicolon */ + if (!Parse_String(parseState, ";")) + RETURN_ERROR; + + return GL_TRUE; +} + + +static GLboolean +Parse_OptionSequence(struct parse_state *parseState, + struct vp_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 vp_instruction program[]) +{ + while (1) { + struct vp_instruction *inst = program + parseState->numInst; + + /* Initialize the instruction */ + inst->SrcReg[0].File = PROGRAM_UNDEFINED; + inst->SrcReg[1].File = PROGRAM_UNDEFINED; + inst->SrcReg[2].File = PROGRAM_UNDEFINED; + inst->DstReg.File = PROGRAM_UNDEFINED; + inst->Data = NULL; + + if (Parse_String(parseState, "MOV")) { + if (!Parse_UnaryOpInstruction(parseState, inst, VP_OPCODE_MOV)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "LIT")) { + if (!Parse_UnaryOpInstruction(parseState, inst, VP_OPCODE_LIT)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "ABS")) { + if (!Parse_UnaryOpInstruction(parseState, inst, VP_OPCODE_ABS)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "MUL")) { + if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_MUL)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "ADD")) { + if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_ADD)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "DP3")) { + if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_DP3)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "DP4")) { + if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_DP4)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "DST")) { + if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_DST)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "MIN")) { + if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_MIN)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "MAX")) { + if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_MAX)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "SLT")) { + if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_SLT)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "SGE")) { + if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_SGE)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "DPH")) { + if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_DPH)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "SUB")) { + if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_SUB)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "MAD")) { + if (!Parse_TriOpInstruction(parseState, inst, VP_OPCODE_MAD)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "RCP")) { + if (!Parse_ScalarInstruction(parseState, inst, VP_OPCODE_RCP)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "RSQ")) { + if (!Parse_ScalarInstruction(parseState, inst, VP_OPCODE_RSQ)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "EXP")) { + if (!Parse_ScalarInstruction(parseState, inst, VP_OPCODE_EXP)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "LOG")) { + if (!Parse_ScalarInstruction(parseState, inst, VP_OPCODE_LOG)) + RETURN_ERROR; + } + else if (Parse_String(parseState, "RCC")) { + if (!Parse_ScalarInstruction(parseState, inst, VP_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 vp_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(GLcontext *ctx, GLenum dstTarget, + const GLubyte *str, GLsizei len, + struct vertex_program *program) +{ + struct parse_state parseState; + struct vp_instruction instBuffer[MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS]; + struct vp_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; + + /* Reset error state */ + _mesa_set_program_error(ctx, -1, NULL); + + /* check the program header */ + if (_mesa_strncmp((const char *) programString, "!!VP1.0", 7) == 0) { + target = GL_VERTEX_PROGRAM_NV; + parseState.pos = programString + 7; + parseState.isStateProgram = GL_FALSE; + } + else if (_mesa_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 (_mesa_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)) { + /* 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)) { + /* 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 = (struct vp_instruction *) + MALLOC(parseState.numInst * sizeof(struct vp_instruction)); + if (!newInst) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); + FREE(programString); + return; /* out of memory */ + } + MEMCPY(newInst, instBuffer, + parseState.numInst * sizeof(struct vp_instruction)); + + /* 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->Instructions) { + FREE(program->Instructions); + } + program->Instructions = newInst; + program->InputsRead = parseState.inputsRead; + program->OutputsWritten = parseState.outputsWritten; + program->IsPositionInvariant = parseState.isPositionInvariant; + program->IsNVProgram = GL_TRUE; + +#ifdef DEBUG_foo + _mesa_printf("--- glLoadProgramNV result ---\n"); + _mesa_print_nv_vertex_program(program); + _mesa_printf("------------------------------\n"); +#endif + } + 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); + } +} + + +static void +PrintSrcReg(const struct vp_src_register *src) +{ + static const char comps[5] = "xyzw"; + if (src->Negate) + _mesa_printf("-"); + if (src->RelAddr) { + if (src->Index > 0) + _mesa_printf("c[A0.x + %d]", src->Index); + else if (src->Index < 0) + _mesa_printf("c[A0.x - %d]", -src->Index); + else + _mesa_printf("c[A0.x]"); + } + else if (src->File == PROGRAM_OUTPUT) { + _mesa_printf("o[%s]", OutputRegisters[src->Index]); + } + else if (src->File == PROGRAM_INPUT) { + _mesa_printf("v[%s]", InputRegisters[src->Index]); + } + else if (src->File == PROGRAM_ENV_PARAM) { + _mesa_printf("c[%d]", src->Index); + } + else { + ASSERT(src->File == PROGRAM_TEMPORARY); + _mesa_printf("R%d", src->Index); + } + + if (GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 1) && + GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 2) && + GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 3)) { + _mesa_printf(".%c", comps[GET_SWZ(src->Swizzle, 0)]); + } + else if (src->Swizzle != SWIZZLE_NOOP) { + _mesa_printf(".%c%c%c%c", + comps[GET_SWZ(src->Swizzle, 0)], + comps[GET_SWZ(src->Swizzle, 1)], + comps[GET_SWZ(src->Swizzle, 2)], + comps[GET_SWZ(src->Swizzle, 3)]); + } +} + + +static void +PrintDstReg(const struct vp_dst_register *dst) +{ + if (dst->File == PROGRAM_OUTPUT) { + _mesa_printf("o[%s]", OutputRegisters[dst->Index]); + } + else if (dst->File == PROGRAM_INPUT) { + _mesa_printf("v[%s]", InputRegisters[dst->Index]); + } + else if (dst->File == PROGRAM_ENV_PARAM) { + _mesa_printf("c[%d]", dst->Index); + } + else { + ASSERT(dst->File == PROGRAM_TEMPORARY); + _mesa_printf("R%d", dst->Index); + } + + if (dst->WriteMask != 0 && dst->WriteMask != 0xf) { + _mesa_printf("."); + if (dst->WriteMask & 0x1) + _mesa_printf("x"); + if (dst->WriteMask & 0x2) + _mesa_printf("y"); + if (dst->WriteMask & 0x4) + _mesa_printf("z"); + if (dst->WriteMask & 0x8) + _mesa_printf("w"); + } +} + + +/** + * Print a single NVIDIA vertex program instruction. + */ +void +_mesa_print_nv_vertex_instruction(const struct vp_instruction *inst) +{ + switch (inst->Opcode) { + case VP_OPCODE_MOV: + case VP_OPCODE_LIT: + case VP_OPCODE_RCP: + case VP_OPCODE_RSQ: + case VP_OPCODE_EXP: + case VP_OPCODE_LOG: + case VP_OPCODE_RCC: + case VP_OPCODE_ABS: + _mesa_printf("%s ", Opcodes[(int) inst->Opcode]); + PrintDstReg(&inst->DstReg); + _mesa_printf(", "); + PrintSrcReg(&inst->SrcReg[0]); + _mesa_printf(";\n"); + break; + case VP_OPCODE_MUL: + case VP_OPCODE_ADD: + case VP_OPCODE_DP3: + case VP_OPCODE_DP4: + case VP_OPCODE_DST: + case VP_OPCODE_MIN: + case VP_OPCODE_MAX: + case VP_OPCODE_SLT: + case VP_OPCODE_SGE: + case VP_OPCODE_DPH: + case VP_OPCODE_SUB: + _mesa_printf("%s ", Opcodes[(int) inst->Opcode]); + PrintDstReg(&inst->DstReg); + _mesa_printf(", "); + PrintSrcReg(&inst->SrcReg[0]); + _mesa_printf(", "); + PrintSrcReg(&inst->SrcReg[1]); + _mesa_printf(";\n"); + break; + case VP_OPCODE_MAD: + _mesa_printf("MAD "); + PrintDstReg(&inst->DstReg); + _mesa_printf(", "); + PrintSrcReg(&inst->SrcReg[0]); + _mesa_printf(", "); + PrintSrcReg(&inst->SrcReg[1]); + _mesa_printf(", "); + PrintSrcReg(&inst->SrcReg[2]); + _mesa_printf(";\n"); + break; + case VP_OPCODE_ARL: + _mesa_printf("ARL A0.x, "); + PrintSrcReg(&inst->SrcReg[0]); + _mesa_printf(";\n"); + break; + case VP_OPCODE_PRINT: + _mesa_printf("PRINT '%s'", inst->Data); + if (inst->SrcReg[0].File) { + _mesa_printf(", "); + PrintSrcReg(&inst->SrcReg[0]); + _mesa_printf(";\n"); + } + else { + _mesa_printf("\n"); + } + break; + case VP_OPCODE_END: + _mesa_printf("END\n"); + break; + default: + _mesa_printf("BAD INSTRUCTION\n"); + } +} + + +/** + * Print (unparse) the given vertex program. Just for debugging. + */ +void +_mesa_print_nv_vertex_program(const struct vertex_program *program) +{ + const struct vp_instruction *inst; + + for (inst = program->Instructions; ; inst++) { + _mesa_print_nv_vertex_instruction(inst); + if (inst->Opcode == VP_OPCODE_END) + return; + } +} + + +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/reactos/dll/mesa32/src/shader/nvvertparse.h b/reactos/dll/mesa32/src/shader/nvvertparse.h new file mode 100644 index 00000000000..205885f45c3 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/nvvertparse.h @@ -0,0 +1,50 @@ +/* + * 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 + + +extern void +_mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum target, + const GLubyte *str, GLsizei len, + struct vertex_program *program); + +extern void +_mesa_print_nv_vertex_instruction(const struct vp_instruction *inst); + +extern void +_mesa_print_nv_vertex_program(const struct 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/reactos/dll/mesa32/src/shader/nvvertprog.h b/reactos/dll/mesa32/src/shader/nvvertprog.h new file mode 100644 index 00000000000..b8dbe363134 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/nvvertprog.h @@ -0,0 +1,111 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3.1 + * + * 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. + */ + + +/* Private vertex program types and constants only used by files + * related to vertex programs. + * + * XXX TO-DO: Rename this file "vertprog.h" since it's not NV-specific. + */ + + +#ifndef NVVERTPROG_H +#define NVVERTPROG_H + + +/* Vertex program opcodes */ +enum vp_opcode +{ + VP_OPCODE_ABS, + VP_OPCODE_ADD, + VP_OPCODE_ARL, + VP_OPCODE_DP3, + VP_OPCODE_DP4, + VP_OPCODE_DPH, + VP_OPCODE_DST, + VP_OPCODE_END, /* Placeholder */ + VP_OPCODE_EX2, /* ARB only */ + VP_OPCODE_EXP, + VP_OPCODE_FLR, /* ARB */ + VP_OPCODE_FRC, /* ARB */ + VP_OPCODE_LG2, /* ARB only */ + VP_OPCODE_LIT, + VP_OPCODE_LOG, + VP_OPCODE_MAD, + VP_OPCODE_MAX, + VP_OPCODE_MIN, + VP_OPCODE_MOV, + VP_OPCODE_MUL, + VP_OPCODE_POW, /* ARB only */ + VP_OPCODE_PRINT, /* Mesa only */ + VP_OPCODE_RCC, + VP_OPCODE_RCP, + VP_OPCODE_RSQ, + VP_OPCODE_SGE, + VP_OPCODE_SLT, + VP_OPCODE_SUB, + VP_OPCODE_SWZ, /* ARB only */ + VP_OPCODE_XPD, /* ARB only */ + + VP_MAX_OPCODE +}; + + + +/* Instruction source register */ +struct vp_src_register +{ + GLuint File:4; /* one of the PROGRAM_* register file values */ + GLint Index:9; /* may be negative for relative addressing */ + GLuint Swizzle:12; + GLuint Negate:4; /* ARB requires component-wise negation. */ + GLuint RelAddr:1; + GLuint pad:2; +}; + + +/* Instruction destination register */ +struct vp_dst_register +{ + GLuint File:4; /* one of the PROGRAM_* register file values */ + GLuint Index:8; + GLuint WriteMask:4; + GLuint pad:16; +}; + + +/* Vertex program instruction */ +struct vp_instruction +{ + GLshort Opcode; +#if FEATURE_MESA_program_debug + GLshort StringPos; +#endif + void *Data; /* some arbitrary data, only used for PRINT instruction now */ + struct vp_src_register SrcReg[3]; + struct vp_dst_register DstReg; +}; + + +#endif /* VERTPROG_H */ diff --git a/reactos/dll/mesa32/src/shader/program.c b/reactos/dll/mesa32/src/shader/program.c new file mode 100644 index 00000000000..0ccc741dd0c --- /dev/null +++ b/reactos/dll/mesa32/src/shader/program.c @@ -0,0 +1,1405 @@ +/* + * Mesa 3-D graphics library + * Version: 6.2 + * + * 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. + */ + +/** + * \file program.c + * Vertex and fragment program support functions. + * \author Brian Paul + */ + + +#include "glheader.h" +#include "context.h" +#include "hash.h" +#include "imports.h" +#include "macros.h" +#include "mtypes.h" +#include "program.h" +#include "nvfragparse.h" +#include "nvfragprog.h" +#include "nvvertparse.h" +#include "nvvertprog.h" + + +/**********************************************************************/ +/* Utility functions */ +/**********************************************************************/ + + +/* A pointer to this dummy program is put into the hash table when + * glGenPrograms is called. + */ +struct program _mesa_DummyProgram; + + +/** + * Init context's vertex/fragment program state + */ +void +_mesa_init_program(GLcontext *ctx) +{ + GLuint i; + + ctx->Program.ErrorPos = -1; + ctx->Program.ErrorString = _mesa_strdup(""); + +#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program + ctx->VertexProgram.Enabled = GL_FALSE; + ctx->VertexProgram.PointSizeEnabled = GL_FALSE; + ctx->VertexProgram.TwoSideEnabled = GL_FALSE; + ctx->VertexProgram.Current = (struct vertex_program *) ctx->Shared->DefaultVertexProgram; + assert(ctx->VertexProgram.Current); + ctx->VertexProgram.Current->Base.RefCount++; + for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) { + ctx->VertexProgram.TrackMatrix[i] = GL_NONE; + ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV; + } +#endif + +#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program + ctx->FragmentProgram.Enabled = GL_FALSE; + ctx->FragmentProgram.Current = (struct fragment_program *) ctx->Shared->DefaultFragmentProgram; + assert(ctx->FragmentProgram.Current); + ctx->FragmentProgram.Current->Base.RefCount++; +#endif + +#if FEATURE_ATI_fragment_shader + ctx->ATIFragmentShader.Enabled = GL_FALSE; + ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) ctx->Shared->DefaultFragmentShader; + assert(ctx->ATIFragmentShader.Current); + ctx->ATIFragmentShader.Current->Base.RefCount++; +#endif +} + + +/** + * Free a context's vertex/fragment program state + */ +void +_mesa_free_program_data(GLcontext *ctx) +{ +#if FEATURE_NV_vertex_program + if (ctx->VertexProgram.Current) { + ctx->VertexProgram.Current->Base.RefCount--; + if (ctx->VertexProgram.Current->Base.RefCount <= 0) + ctx->Driver.DeleteProgram(ctx, &(ctx->VertexProgram.Current->Base)); + } +#endif +#if FEATURE_NV_fragment_program + if (ctx->FragmentProgram.Current) { + ctx->FragmentProgram.Current->Base.RefCount--; + if (ctx->FragmentProgram.Current->Base.RefCount <= 0) + ctx->Driver.DeleteProgram(ctx, &(ctx->FragmentProgram.Current->Base)); + } +#endif +#if FEATURE_ATI_fragment_shader + if (ctx->ATIFragmentShader.Current) { + ctx->ATIFragmentShader.Current->Base.RefCount--; + if (ctx->ATIFragmentShader.Current->Base.RefCount <= 0) + ctx->Driver.DeleteProgram(ctx, &(ctx->ATIFragmentShader.Current->Base)); + } +#endif + _mesa_free((void *) ctx->Program.ErrorString); +} + + + + +/** + * Set the vertex/fragment program error state (position and error string). + * This is generally called from within the parsers. + */ +void +_mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string) +{ + ctx->Program.ErrorPos = pos; + _mesa_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 + * _mesa_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 *) _mesa_malloc(len + 1); + _mesa_memcpy(s, lineStart, len); + s[len] = 0; + + return s; +} + + +/** + * Initialize a new vertex/fragment program object. + */ +static struct program * +_mesa_init_program_struct( GLcontext *ctx, struct program *prog, + GLenum target, GLuint id) +{ + (void) ctx; + if (prog) { + prog->Id = id; + prog->Target = target; + prog->Resident = GL_TRUE; + prog->RefCount = 1; + } + + return prog; +} + + +/** + * Initialize a new fragment program object. + */ +struct program * +_mesa_init_fragment_program( GLcontext *ctx, struct 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 program * +_mesa_init_vertex_program( GLcontext *ctx, struct 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 ATI fragment shader object. + */ +struct program * +_mesa_init_ati_fragment_shader( GLcontext *ctx, + struct ati_fragment_shader *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 program * +_mesa_new_program(GLcontext *ctx, GLenum target, GLuint id) +{ + switch (target) { + case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ + return _mesa_init_vertex_program( ctx, CALLOC_STRUCT(vertex_program), + target, id ); + case GL_FRAGMENT_PROGRAM_NV: + case GL_FRAGMENT_PROGRAM_ARB: + return _mesa_init_fragment_program( ctx, CALLOC_STRUCT(fragment_program), + target, id ); + case GL_FRAGMENT_SHADER_ATI: + return _mesa_init_ati_fragment_shader( ctx, CALLOC_STRUCT(ati_fragment_shader), + target, id ); + + default: + _mesa_problem(ctx, "bad target in _mesa_new_program"); + return NULL; + } +} + + +/** + * 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(GLcontext *ctx, struct program *prog) +{ + (void) ctx; + ASSERT(prog); + + if (prog->String) + _mesa_free(prog->String); + if (prog->Target == GL_VERTEX_PROGRAM_NV || + prog->Target == GL_VERTEX_STATE_PROGRAM_NV) { + struct vertex_program *vprog = (struct vertex_program *) prog; + if (vprog->Instructions) { + GLuint i; + for (i = 0; i < vprog->Base.NumInstructions; i++) { + if (vprog->Instructions[i].Data) + _mesa_free(vprog->Instructions[i].Data); + } + _mesa_free(vprog->Instructions); + } + if (vprog->Parameters) + _mesa_free_parameter_list(vprog->Parameters); + } + else if (prog->Target == GL_FRAGMENT_PROGRAM_NV || + prog->Target == GL_FRAGMENT_PROGRAM_ARB) { + struct fragment_program *fprog = (struct fragment_program *) prog; + if (fprog->Instructions) { + GLuint i; + for (i = 0; i < fprog->Base.NumInstructions; i++) { + if (fprog->Instructions[i].Data) + _mesa_free(fprog->Instructions[i].Data); + } + _mesa_free(fprog->Instructions); + } + if (fprog->Parameters) + _mesa_free_parameter_list(fprog->Parameters); + } + else if (prog->Target == GL_FRAGMENT_SHADER_ATI) { + struct ati_fragment_shader *atifs = (struct ati_fragment_shader *)prog; + if (atifs->Instructions) + _mesa_free(atifs->Instructions); + } + + _mesa_free(prog); +} + + + +/**********************************************************************/ +/* Program parameter functions */ +/**********************************************************************/ + +struct program_parameter_list * +_mesa_new_parameter_list(void) +{ + return (struct program_parameter_list *) + _mesa_calloc(sizeof(struct program_parameter_list)); +} + + +/** + * Free a parameter list and all its parameters + */ +void +_mesa_free_parameter_list(struct program_parameter_list *paramList) +{ + _mesa_free_parameters(paramList); + _mesa_free(paramList->Parameters); + if (paramList->ParameterValues) + ALIGN_FREE(paramList->ParameterValues); + _mesa_free(paramList); +} + + +/** + * Free all the parameters in the given list, but don't free the + * paramList structure itself. + */ +void +_mesa_free_parameters(struct program_parameter_list *paramList) +{ + GLuint i; + for (i = 0; i < paramList->NumParameters; i++) { + if (paramList->Parameters[i].Name) + _mesa_free((void *) paramList->Parameters[i].Name); + } + paramList->NumParameters = 0; +} + + +/** + * Helper function used by the functions below. + */ +static GLint +add_parameter(struct program_parameter_list *paramList, + const char *name, const GLfloat values[4], + enum parameter_type type) +{ + const GLuint n = paramList->NumParameters; + + if (n == paramList->Size) { + GLfloat (*tmp)[4]; + + paramList->Size *= 2; + if (!paramList->Size) + paramList->Size = 8; + + paramList->Parameters = (struct program_parameter *) + _mesa_realloc(paramList->Parameters, + n * sizeof(struct program_parameter), + paramList->Size * sizeof(struct program_parameter)); + + tmp = paramList->ParameterValues; + paramList->ParameterValues = ALIGN_MALLOC(paramList->Size * 4 * sizeof(GLfloat), 16); + if (tmp) { + _mesa_memcpy(paramList->ParameterValues, tmp, + n * 4 * sizeof(GLfloat)); + ALIGN_FREE(tmp); + } + } + + if (!paramList->Parameters || + !paramList->ParameterValues) { + /* out of memory */ + paramList->NumParameters = 0; + paramList->Size = 0; + return -1; + } + else { + paramList->NumParameters = n + 1; + + _mesa_memset(¶mList->Parameters[n], 0, + sizeof(struct program_parameter)); + + paramList->Parameters[n].Name = name ? _mesa_strdup(name) : NULL; + paramList->Parameters[n].Type = type; + if (values) + COPY_4V(paramList->ParameterValues[n], values); + return (GLint) n; + } +} + + +/** + * 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 program_parameter_list *paramList, + const char *name, const GLfloat values[4]) +{ + return add_parameter(paramList, name, values, NAMED_PARAMETER); +} + + +/** + * Add a new unnamed constant to the parameter list. + * \param paramList - the parameter list + * \param values - four float values + * \return index of the new parameter. + */ +GLint +_mesa_add_named_constant(struct program_parameter_list *paramList, + const char *name, const GLfloat values[4]) +{ + return add_parameter(paramList, name, values, CONSTANT); +} + + +/** + * Add a new unnamed constant to the parameter list. + * \param paramList - the parameter list + * \param values - four float values + * \return index of the new parameter. + */ +GLint +_mesa_add_unnamed_constant(struct program_parameter_list *paramList, + const GLfloat values[4]) +{ + return add_parameter(paramList, NULL, values, CONSTANT); +} + + +/** + * Add a new state reference to the parameter list. + * \param paramList - the parameter list + * \param state - an array of 6 state tokens + * + * \return index of the new parameter. + */ +GLint +_mesa_add_state_reference(struct program_parameter_list *paramList, + GLint *stateTokens) +{ + /* XXX Should we parse here and produce the parameter's + * list of STATE_* tokens here, or in the parser? + */ + GLint a, idx; + + idx = add_parameter(paramList, NULL, NULL, STATE); + + for (a=0; a<6; a++) + paramList->Parameters[idx].StateIndexes[a] = (enum state_index) stateTokens[a]; + + return idx; +} + + +/** + * Lookup a parameter value by name in the given parameter list. + * \return pointer to the float[4] values. + */ +GLfloat * +_mesa_lookup_parameter_value(struct program_parameter_list *paramList, + GLsizei nameLen, const char *name) +{ + GLuint i; + + if (!paramList) + return NULL; + + if (nameLen == -1) { + /* name is null-terminated */ + for (i = 0; i < paramList->NumParameters; i++) { + if (paramList->Parameters[i].Name && + _mesa_strcmp(paramList->Parameters[i].Name, name) == 0) + return paramList->ParameterValues[i]; + } + } + else { + /* name is not null-terminated, use nameLen */ + for (i = 0; i < paramList->NumParameters; i++) { + if (paramList->Parameters[i].Name && + _mesa_strncmp(paramList->Parameters[i].Name, name, nameLen) == 0 + && _mesa_strlen(paramList->Parameters[i].Name) == (size_t)nameLen) + return paramList->ParameterValues[i]; + } + } + return NULL; +} + + +/** + * Lookup a parameter index by name in the given parameter list. + * \return index of parameter in the list. + */ +GLint +_mesa_lookup_parameter_index(struct 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 && + _mesa_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 && + _mesa_strncmp(paramList->Parameters[i].Name, name, nameLen) == 0 + && _mesa_strlen(paramList->Parameters[i].Name) == (size_t)nameLen) + return i; + } + } + return -1; +} + + +/** + * Use the list of tokens in the state[] array to find global GL state + * and return it in . Usually, four values are returned in + * 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(GLcontext *ctx, const enum 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]; + /* state[2] is the material attribute */ + switch (state[2]) { + case STATE_AMBIENT: + if (face == 0) + COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT]); + else + COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_AMBIENT]); + return; + case STATE_DIFFUSE: + if (face == 0) + COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE]); + else + COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE]); + return; + case STATE_SPECULAR: + if (face == 0) + COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SPECULAR]); + else + COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_SPECULAR]); + return; + case STATE_EMISSION: + if (face == 0) + COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_EMISSION]); + else + COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_EMISSION]); + return; + case STATE_SHININESS: + if (face == 0) + value[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS][0]; + else + value[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_SHININESS][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].EyeDirection); + value[3] = ctx->Light.Light[ln]._CosCutoff; + return; + case STATE_HALF: + { + GLfloat eye_z[] = {0, 0, 1}; + + /* Compute infinite half angle vector: + * half-vector = light_position + (0, 0, 1) + * and then normalize. w = 0 + * + * light.EyePosition.w should be 0 for infinite lights. + */ + ADD_3V(value, eye_z, ctx->Light.Light[ln].EyePosition); + NORMALIZE_3FV(value); + value[3] = 0; + } + return; + case STATE_POSITION_NORMALIZED: + COPY_4V(value, ctx->Light.Light[ln].EyePosition); + NORMALIZE_3FV( value ); + 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_DIFFUSE+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_DIFFUSE+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].EyePlaneS); + return; + case STATE_TEXGEN_EYE_T: + COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneT); + return; + case STATE_TEXGEN_EYE_R: + COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneR); + return; + case STATE_TEXGEN_EYE_Q: + COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneQ); + return; + case STATE_TEXGEN_OBJECT_S: + COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneS); + return; + case STATE_TEXGEN_OBJECT_T: + COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneT); + return; + case STATE_TEXGEN_OBJECT_R: + COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneR); + return; + case STATE_TEXGEN_OBJECT_Q: + COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneQ); + 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] = 1.0F / (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_MATRIX: + { + /* state[1] = modelview, projection, texture, etc. */ + /* state[2] = which texture matrix or program matrix */ + /* state[3] = first column to fetch */ + /* state[4] = last column to fetch */ + /* state[5] = transpose, inverse or invtrans */ + + const GLmatrix *matrix; + const enum state_index mat = state[1]; + const GLuint index = (GLuint) state[2]; + const GLuint first = (GLuint) state[3]; + const GLuint last = (GLuint) state[4]; + const enum state_index modifier = state[5]; + const GLfloat *m; + GLuint row, i; + if (mat == STATE_MODELVIEW) { + matrix = ctx->ModelviewMatrixStack.Top; + } + else if (mat == STATE_PROJECTION) { + matrix = ctx->ProjectionMatrixStack.Top; + } + else if (mat == STATE_MVP) { + matrix = &ctx->_ModelProjectMatrix; + } + else if (mat == STATE_TEXTURE) { + matrix = ctx->TextureMatrixStack[index].Top; + } + else if (mat == STATE_PROGRAM) { + 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_analyse( (GLmatrix*) matrix ); + m = matrix->inv; + } + else { + m = matrix->m; + } + if (modifier == STATE_MATRIX_TRANSPOSE || + modifier == STATE_MATRIX_INVTRANS) { + for (i = 0, row = first; row <= last; 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 = first; row <= last; 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] = 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]); + break; + case STATE_LOCAL: + COPY_4V(value, ctx->FragmentProgram.Current->Base.LocalParams[idx]); + break; + 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]); + break; + case STATE_LOCAL: + COPY_4V(value, ctx->VertexProgram.Current->Base.LocalParams[idx]); + break; + default: + _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()"); + return; + } + } + return; + + case STATE_INTERNAL: + { + switch (state[1]) { + case STATE_NORMAL_SCALE: + ASSIGN_4V(value, ctx->_ModelViewInvScale, 0, 0, 1); + break; + default: + _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()"); + return; + } + } + return; + + default: + _mesa_problem(ctx, "Invalid state in _mesa_fetch_state"); + return; + } +} + + +/** + * 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. + * This would be called at glBegin time when using a fragment program. + */ +void +_mesa_load_state_parameters(GLcontext *ctx, + struct program_parameter_list *paramList) +{ + GLuint i; + + if (!paramList) + return; + + for (i = 0; i < paramList->NumParameters; i++) { + if (paramList->Parameters[i].Type == STATE) { + _mesa_fetch_state(ctx, + paramList->Parameters[i].StateIndexes, + paramList->ParameterValues[i]); + } + } +} + + + +/**********************************************************************/ +/* API functions */ +/**********************************************************************/ + + +/** + * Bind a program (make it current) + * \note Called from the GL API dispatcher by both glBindProgramNV + * and glBindProgramARB. + */ +void GLAPIENTRY +_mesa_BindProgram(GLenum target, GLuint id) +{ + struct program *prog; + 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) || + (target == GL_VERTEX_PROGRAM_ARB + && ctx->Extensions.ARB_vertex_program)) { + /*** Vertex program binding ***/ + struct vertex_program *curProg = ctx->VertexProgram.Current; + if (curProg->Base.Id == id) { + /* binding same program - no change */ + return; + } + if (curProg->Base.Id != 0) { + /* decrement refcount on previously bound vertex program */ + curProg->Base.RefCount--; + /* and delete if refcount goes below one */ + if (curProg->Base.RefCount <= 0) { + /* the program ID was already removed from the hash table */ + ctx->Driver.DeleteProgram(ctx, &(curProg->Base)); + } + } + } + else if ((target == GL_FRAGMENT_PROGRAM_NV + && ctx->Extensions.NV_fragment_program) || + (target == GL_FRAGMENT_PROGRAM_ARB + && ctx->Extensions.ARB_fragment_program)) { + /*** Fragment program binding ***/ + struct fragment_program *curProg = ctx->FragmentProgram.Current; + if (curProg->Base.Id == id) { + /* binding same program - no change */ + return; + } + if (curProg->Base.Id != 0) { + /* decrement refcount on previously bound fragment program */ + curProg->Base.RefCount--; + /* and delete if refcount goes below one */ + if (curProg->Base.RefCount <= 0) { + /* the program ID was already removed from the hash table */ + ctx->Driver.DeleteProgram(ctx, &(curProg->Base)); + } + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramNV/ARB(target)"); + return; + } + + /* NOTE: binding to a non-existant program is not an error. + * That's supposed to be caught in glBegin. + */ + if (id == 0) { + /* Bind default program */ + prog = NULL; + if (target == GL_VERTEX_PROGRAM_NV || target == GL_VERTEX_PROGRAM_ARB) + prog = ctx->Shared->DefaultVertexProgram; + else + prog = ctx->Shared->DefaultFragmentProgram; + } + else { + /* Bind user program */ + prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); + if (!prog || prog == &_mesa_DummyProgram) { + /* allocate a new program now */ + prog = ctx->Driver.NewProgram(ctx, target, id); + if (!prog) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV/ARB"); + return; + } + _mesa_HashInsert(ctx->Shared->Programs, id, prog); + } + else if (prog->Target != target) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindProgramNV/ARB(target mismatch)"); + return; + } + } + + /* bind now */ + if (target == GL_VERTEX_PROGRAM_NV || target == GL_VERTEX_PROGRAM_ARB) { + ctx->VertexProgram.Current = (struct vertex_program *) prog; + } + else if (target == GL_FRAGMENT_PROGRAM_NV || target == GL_FRAGMENT_PROGRAM_ARB) { + ctx->FragmentProgram.Current = (struct fragment_program *) prog; + } + + /* Never null pointers */ + ASSERT(ctx->VertexProgram.Current); + ASSERT(ctx->FragmentProgram.Current); + + if (prog) + prog->RefCount++; + + if (ctx->Driver.BindProgram) + ctx->Driver.BindProgram(ctx, target, prog); +} + + +/** + * Delete a list of programs. + * \note Not compiled into display lists. + * \note Called by both glDeleteProgramsNV and glDeleteProgramsARB. + */ +void GLAPIENTRY +_mesa_DeletePrograms(GLsizei n, const GLuint *ids) +{ + GLint i; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (n < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glDeleteProgramsNV" ); + return; + } + + for (i = 0; i < n; i++) { + if (ids[i] != 0) { + struct program *prog = (struct program *) + _mesa_HashLookup(ctx->Shared->Programs, ids[i]); + if (prog == &_mesa_DummyProgram) { + _mesa_HashRemove(ctx->Shared->Programs, ids[i]); + } + else if (prog) { + /* Unbind program if necessary */ + if (prog->Target == GL_VERTEX_PROGRAM_NV || + prog->Target == GL_VERTEX_STATE_PROGRAM_NV) { + if (ctx->VertexProgram.Current && + ctx->VertexProgram.Current->Base.Id == ids[i]) { + /* unbind this currently bound program */ + _mesa_BindProgram(prog->Target, 0); + } + } + else if (prog->Target == GL_FRAGMENT_PROGRAM_NV || + prog->Target == GL_FRAGMENT_PROGRAM_ARB) { + if (ctx->FragmentProgram.Current && + ctx->FragmentProgram.Current->Base.Id == ids[i]) { + /* unbind this currently bound program */ + _mesa_BindProgram(prog->Target, 0); + } + } + else { + _mesa_problem(ctx, "bad target in glDeleteProgramsNV"); + return; + } + /* The ID is immediately available for re-use now */ + _mesa_HashRemove(ctx->Shared->Programs, ids[i]); + prog->RefCount--; + if (prog->RefCount <= 0) { + ctx->Driver.DeleteProgram(ctx, prog); + } + } + } + } +} + + +/** + * Generate a list of new program identifiers. + * \note Not compiled into display lists. + * \note Called by both glGenProgramsNV and glGenProgramsARB. + */ +void GLAPIENTRY +_mesa_GenPrograms(GLsizei n, GLuint *ids) +{ + GLuint first; + GLuint i; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGenPrograms"); + return; + } + + if (!ids) + return; + + first = _mesa_HashFindFreeKeyBlock(ctx->Shared->Programs, n); + + /* Insert pointer to dummy program as placeholder */ + for (i = 0; i < (GLuint) n; i++) { + _mesa_HashInsert(ctx->Shared->Programs, first + i, &_mesa_DummyProgram); + } + + /* Return the program names */ + for (i = 0; i < (GLuint) n; i++) { + ids[i] = first + i; + } +} + + +/** + * Determine if id names a vertex or fragment program. + * \note Not compiled into display lists. + * \note Called from both glIsProgramNV and glIsProgramARB. + * \param id is the program identifier + * \return GL_TRUE if id is a program, else GL_FALSE. + */ +GLboolean GLAPIENTRY +_mesa_IsProgram(GLuint id) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + if (id == 0) + return GL_FALSE; + + if (_mesa_HashLookup(ctx->Shared->Programs, id)) + return GL_TRUE; + else + return GL_FALSE; +} + + + +/**********************************************************************/ +/* GL_MESA_program_debug extension */ +/**********************************************************************/ + + +/* XXX temporary */ +GLAPI void GLAPIENTRY +glProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, + GLvoid *data) +{ + _mesa_ProgramCallbackMESA(target, callback, data); +} + + +void +_mesa_ProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, + GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + + switch (target) { + case GL_FRAGMENT_PROGRAM_ARB: + if (!ctx->Extensions.ARB_fragment_program) { + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); + return; + } + ctx->FragmentProgram.Callback = callback; + ctx->FragmentProgram.CallbackData = data; + break; + case GL_FRAGMENT_PROGRAM_NV: + if (!ctx->Extensions.NV_fragment_program) { + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); + return; + } + ctx->FragmentProgram.Callback = callback; + ctx->FragmentProgram.CallbackData = data; + break; + case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ + if (!ctx->Extensions.ARB_vertex_program && + !ctx->Extensions.NV_vertex_program) { + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); + return; + } + ctx->VertexProgram.Callback = callback; + ctx->VertexProgram.CallbackData = data; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); + return; + } +} + + +/* XXX temporary */ +GLAPI void GLAPIENTRY +glGetProgramRegisterfvMESA(GLenum target, + GLsizei len, const GLubyte *registerName, + GLfloat *v) +{ + _mesa_GetProgramRegisterfvMESA(target, len, registerName, v); +} + + +void +_mesa_GetProgramRegisterfvMESA(GLenum target, + GLsizei len, const GLubyte *registerName, + GLfloat *v) +{ + char reg[1000]; + GET_CURRENT_CONTEXT(ctx); + + /* We _should_ be inside glBegin/glEnd */ +#if 0 + if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramRegisterfvMESA"); + return; + } +#endif + + /* make null-terminated copy of registerName */ + len = MIN2((unsigned int) len, sizeof(reg) - 1); + _mesa_memcpy(reg, registerName, len); + reg[len] = 0; + + switch (target) { + case GL_VERTEX_PROGRAM_NV: + if (!ctx->Extensions.ARB_vertex_program && + !ctx->Extensions.NV_vertex_program) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetProgramRegisterfvMESA(target)"); + return; + } + if (!ctx->VertexProgram._Enabled) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetProgramRegisterfvMESA"); + return; + } + /* GL_NV_vertex_program */ + if (reg[0] == 'R') { + /* Temp register */ + GLint i = _mesa_atoi(reg + 1); + if (i >= (GLint)ctx->Const.MaxVertexProgramTemps) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetProgramRegisterfvMESA(registerName)"); + return; + } + COPY_4V(v, ctx->VertexProgram.Temporaries[i]); + } + else if (reg[0] == 'v' && reg[1] == '[') { + /* Vertex Input attribute */ + GLuint i; + for (i = 0; i < ctx->Const.MaxVertexProgramAttribs; i++) { + const char *name = _mesa_nv_vertex_input_register_name(i); + char number[10]; + sprintf(number, "%d", i); + if (_mesa_strncmp(reg + 2, name, 4) == 0 || + _mesa_strncmp(reg + 2, number, _mesa_strlen(number)) == 0) { + COPY_4V(v, ctx->VertexProgram.Inputs[i]); + return; + } + } + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetProgramRegisterfvMESA(registerName)"); + return; + } + else if (reg[0] == 'o' && reg[1] == '[') { + /* Vertex output attribute */ + } + /* GL_ARB_vertex_program */ + else if (_mesa_strncmp(reg, "vertex.", 7) == 0) { + + } + else { + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetProgramRegisterfvMESA(registerName)"); + return; + } + break; + case GL_FRAGMENT_PROGRAM_ARB: + if (!ctx->Extensions.ARB_fragment_program) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetProgramRegisterfvMESA(target)"); + return; + } + if (!ctx->FragmentProgram._Enabled) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetProgramRegisterfvMESA"); + return; + } + /* XXX to do */ + break; + case GL_FRAGMENT_PROGRAM_NV: + if (!ctx->Extensions.NV_fragment_program) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetProgramRegisterfvMESA(target)"); + return; + } + if (!ctx->FragmentProgram._Enabled) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetProgramRegisterfvMESA"); + return; + } + if (reg[0] == 'R') { + /* Temp register */ + GLint i = _mesa_atoi(reg + 1); + if (i >= (GLint)ctx->Const.MaxFragmentProgramTemps) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetProgramRegisterfvMESA(registerName)"); + return; + } + COPY_4V(v, ctx->FragmentProgram.Machine.Temporaries[i]); + } + else if (reg[0] == 'f' && reg[1] == '[') { + /* Fragment input attribute */ + GLuint i; + for (i = 0; i < ctx->Const.MaxFragmentProgramAttribs; i++) { + const char *name = _mesa_nv_fragment_input_register_name(i); + if (_mesa_strncmp(reg + 2, name, 4) == 0) { + COPY_4V(v, ctx->FragmentProgram.Machine.Inputs[i]); + return; + } + } + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetProgramRegisterfvMESA(registerName)"); + return; + } + else if (_mesa_strcmp(reg, "o[COLR]") == 0) { + /* Fragment output color */ + COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_COLR]); + } + else if (_mesa_strcmp(reg, "o[COLH]") == 0) { + /* Fragment output color */ + COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_COLH]); + } + else if (_mesa_strcmp(reg, "o[DEPR]") == 0) { + /* Fragment output depth */ + COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_DEPR]); + } + else { + /* try user-defined identifiers */ + const GLfloat *value = _mesa_lookup_parameter_value( + ctx->FragmentProgram.Current->Parameters, -1, reg); + if (value) { + COPY_4V(v, value); + } + else { + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetProgramRegisterfvMESA(registerName)"); + return; + } + } + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetProgramRegisterfvMESA(target)"); + return; + } + +} diff --git a/reactos/dll/mesa32/src/shader/program.h b/reactos/dll/mesa32/src/shader/program.h new file mode 100644 index 00000000000..87590ceea9a --- /dev/null +++ b/reactos/dll/mesa32/src/shader/program.h @@ -0,0 +1,298 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 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 "mtypes.h" + + +/* for GL_ARB_v_p and GL_ARB_f_p SWZ instruction */ +#define SWIZZLE_X 0 +#define SWIZZLE_Y 1 +#define SWIZZLE_Z 2 +#define SWIZZLE_W 3 +#define SWIZZLE_ZERO 4 /* keep these values together: KW */ +#define SWIZZLE_ONE 5 /* keep these values together: KW */ + +#define MAKE_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<3) | ((c)<<6) | ((d)<<9)) +#define MAKE_SWIZZLE(x) MAKE_SWIZZLE4((x)[0], (x)[1], (x)[2], (x)[3]) +#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 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 + + +extern struct program _mesa_DummyProgram; + + +/* + * Internal functions + */ + +extern void +_mesa_init_program(GLcontext *ctx); + +extern void +_mesa_free_program_data(GLcontext *ctx); + +extern void +_mesa_set_program_error(GLcontext *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 program * +_mesa_init_vertex_program(GLcontext *ctx, + struct vertex_program *prog, + GLenum target, GLuint id); + +extern struct program * +_mesa_init_fragment_program(GLcontext *ctx, + struct fragment_program *prog, + GLenum target, GLuint id); + +extern struct program * +_mesa_init_ati_fragment_shader(GLcontext *ctx, + struct ati_fragment_shader *prog, + GLenum target, GLuint id ); + +extern struct program * +_mesa_new_program(GLcontext *ctx, GLenum target, GLuint id); + +extern void +_mesa_delete_program(GLcontext *ctx, struct program *prog); + + + +/* + * Used for describing GL state referenced from inside ARB vertex and + * fragment programs. + * A string such as "state.light[0].ambient" gets translated into a + * sequence of tokens such as [ STATE_LIGHT, 0, STATE_AMBIENT ]. + */ +enum state_index { + STATE_MATERIAL, + + STATE_LIGHT, + STATE_LIGHTMODEL_AMBIENT, + STATE_LIGHTMODEL_SCENECOLOR, + STATE_LIGHTPROD, + + STATE_TEXGEN, + + STATE_FOG_COLOR, + STATE_FOG_PARAMS, + + STATE_CLIPPLANE, + + STATE_POINT_SIZE, + STATE_POINT_ATTENUATION, + + STATE_MATRIX, + STATE_MODELVIEW, + STATE_PROJECTION, + STATE_MVP, + STATE_TEXTURE, + STATE_PROGRAM, + STATE_MATRIX_INVERSE, + STATE_MATRIX_TRANSPOSE, + STATE_MATRIX_INVTRANS, + + STATE_AMBIENT, + STATE_DIFFUSE, + STATE_SPECULAR, + STATE_EMISSION, + STATE_SHININESS, + STATE_HALF, + + STATE_POSITION, + STATE_ATTENUATION, + STATE_SPOT_DIRECTION, + + STATE_TEXGEN_EYE_S, + STATE_TEXGEN_EYE_T, + STATE_TEXGEN_EYE_R, + STATE_TEXGEN_EYE_Q, + STATE_TEXGEN_OBJECT_S, + STATE_TEXGEN_OBJECT_T, + STATE_TEXGEN_OBJECT_R, + STATE_TEXGEN_OBJECT_Q, + + STATE_TEXENV_COLOR, + + STATE_DEPTH_RANGE, + + STATE_VERTEX_PROGRAM, + STATE_FRAGMENT_PROGRAM, + + STATE_ENV, + STATE_LOCAL, + + STATE_INTERNAL, /* Mesa additions */ + STATE_NORMAL_SCALE, + STATE_POSITION_NORMALIZED +}; + + + +/* + * Named program parameters + * Used for NV_fragment_program "DEFINE"d constants and "DECLARE"d parameters, + * and ARB_fragment_program global state references. For the later, Name + * might be "state.light[0].diffuse", for example. + */ + +enum parameter_type +{ + NAMED_PARAMETER, + CONSTANT, + STATE +}; + + +struct program_parameter +{ + const char *Name; /* Null-terminated */ + enum parameter_type Type; + enum state_index StateIndexes[6]; /* Global state reference */ +}; + + +struct program_parameter_list +{ + GLuint Size; + GLuint NumParameters; + struct program_parameter *Parameters; + GLfloat (*ParameterValues)[4]; +}; + + +/* + * Program parameter functions + */ + +extern struct program_parameter_list * +_mesa_new_parameter_list(void); + +extern void +_mesa_free_parameter_list(struct program_parameter_list *paramList); + +extern void +_mesa_free_parameters(struct program_parameter_list *paramList); + +extern GLint +_mesa_add_named_parameter(struct program_parameter_list *paramList, + const char *name, const GLfloat values[4]); + +extern GLint +_mesa_add_named_constant(struct program_parameter_list *paramList, + const char *name, const GLfloat values[4]); + +extern GLint +_mesa_add_unnamed_constant(struct program_parameter_list *paramList, + const GLfloat values[4]); + +extern GLint +_mesa_add_state_reference(struct program_parameter_list *paramList, + GLint *stateTokens); + +extern GLfloat * +_mesa_lookup_parameter_value(struct program_parameter_list *paramList, + GLsizei nameLen, const char *name); + +extern GLint +_mesa_lookup_parameter_index(struct program_parameter_list *paramList, + GLsizei nameLen, const char *name); + +extern void +_mesa_load_state_parameters(GLcontext *ctx, + struct program_parameter_list *paramList); + + +/* + * API functions + */ + +extern void GLAPIENTRY +_mesa_BindProgram(GLenum target, GLuint id); + +extern void GLAPIENTRY +_mesa_DeletePrograms(GLsizei n, const GLuint *ids); + +extern void GLAPIENTRY +_mesa_GenPrograms(GLsizei n, GLuint *ids); + +extern GLboolean GLAPIENTRY +_mesa_IsProgram(GLuint id); + + + +/* + * GL_MESA_program_debug + */ + +extern void +_mesa_ProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, + GLvoid *data); + +extern void +_mesa_GetProgramRegisterfvMESA(GLenum target, GLsizei len, + const GLubyte *registerName, GLfloat *v); + + +#endif /* PROGRAM_H */ diff --git a/reactos/dll/mesa32/src/shader/shaderobjects.c b/reactos/dll/mesa32/src/shader/shaderobjects.c new file mode 100644 index 00000000000..ac8ff1af487 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/shaderobjects.c @@ -0,0 +1,1182 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 2004-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 shaderobjects.c + * ARB_shader_objects state management functions + * \author Michal Krol + */ + + +#include "glheader.h" +#include "shaderobjects.h" +#include "shaderobjects_3dlabs.h" +#include "context.h" +#include "macros.h" +#include "hash.h" + + +void GLAPIENTRY +_mesa_DeleteObjectARB (GLhandleARB obj) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_generic_intf **gen; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glDeleteObjectARB"); + return; + } + + gen = (struct gl2_generic_intf **) (**unk).QueryInterface (unk, UIID_GENERIC); + if (gen == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glDeleteObjectARB"); + return; + } + + (**gen).Delete (gen); + (**gen)._unknown.Release ((struct gl2_unknown_intf **) gen); +} + +GLhandleARB GLAPIENTRY +_mesa_GetHandleARB (GLenum pname) +{ + GET_CURRENT_CONTEXT(ctx); + + switch (pname) + { + case GL_PROGRAM_OBJECT_ARB: + if (ctx->ShaderObjects.current_program != NULL) + return (**ctx->ShaderObjects.current_program)._container._generic.GetName ( + (struct gl2_generic_intf **) ctx->ShaderObjects.current_program); + break; + } + + return 0; +} + +void GLAPIENTRY +_mesa_DetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unkc, **unka; + struct gl2_container_intf **con; + struct gl2_generic_intf **att; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unkc = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, containerObj); + unka = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, attachedObj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unkc == NULL || unka == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glDetachObjectARB"); + return; + } + + con = (struct gl2_container_intf **) (**unkc).QueryInterface (unkc, UIID_CONTAINER); + if (con == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glDetachObjectARB"); + return; + } + + att = (struct gl2_generic_intf **) (**unka).QueryInterface (unka, UIID_GENERIC); + if (att == NULL) + { + (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con); + _mesa_error (ctx, GL_INVALID_VALUE, "glDetachObjectARB"); + return; + } + + if ((**con).Detach (con, att) == GL_FALSE) + { + (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con); + (**att)._unknown.Release ((struct gl2_unknown_intf **) att); + return; + } + + (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con); + (**att)._unknown.Release ((struct gl2_unknown_intf **) att); +} + +GLhandleARB GLAPIENTRY +_mesa_CreateShaderObjectARB (GLenum shaderType) +{ + return _mesa_3dlabs_create_shader_object (shaderType); +} + +void GLAPIENTRY +_mesa_ShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, + const GLint *length) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_shader_intf **sha; + GLint *offsets; + GLsizei i; + GLcharARB *source; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, shaderObj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glShaderSourceARB"); + return; + } + + sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER); + if (sha == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "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 *) _mesa_malloc (count * sizeof (GLint)); + if (offsets == NULL) + { + (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha); + _mesa_error (ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB"); + return; + } + + for (i = 0; i < count; i++) + { + if (length == NULL || length[i] < 0) + offsets[i] = _mesa_strlen (string[i]); + else + offsets[i] = length[i]; + /* accumulate string lengths */ + if (i > 0) + offsets[i] += offsets[i - 1]; + } + + source = (GLcharARB *) _mesa_malloc ((offsets[count - 1] + 1) * sizeof (GLcharARB)); + if (source == NULL) + { + _mesa_free ((void *) offsets); + (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha); + _mesa_error (ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB"); + return; + } + + for (i = 0; i < count; i++) + { + GLint start = (i > 0) ? offsets[i - 1] : 0; + _mesa_memcpy (source + start, string[i], (offsets[i] - start) * sizeof (GLcharARB)); + } + source[offsets[count - 1]] = '\0'; + + (**sha).SetSource (sha, source, offsets, count); + (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha); +} + +void GLAPIENTRY +_mesa_CompileShaderARB (GLhandleARB shaderObj) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_shader_intf **sha; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, shaderObj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glCompileShaderARB"); + return; + } + + sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER); + if (sha == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glCompileShaderARB"); + return; + } + + (**sha).Compile (sha); + (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha); +} + +GLhandleARB GLAPIENTRY +_mesa_CreateProgramObjectARB (void) +{ + return _mesa_3dlabs_create_program_object (); +} + +void GLAPIENTRY +_mesa_AttachObjectARB (GLhandleARB containerObj, GLhandleARB obj) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unkc, **unka; + struct gl2_container_intf **con; + struct gl2_generic_intf **att; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unkc = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, containerObj); + unka = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unkc == NULL || unka == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glAttachObjectARB"); + return; + } + + con = (struct gl2_container_intf **) (**unkc).QueryInterface (unkc, UIID_CONTAINER); + if (con == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glAttachObjectARB"); + return; + } + + att = (struct gl2_generic_intf **) (**unka).QueryInterface (unka, UIID_GENERIC); + if (att == NULL) + { + (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con); + _mesa_error (ctx, GL_INVALID_VALUE, "glAttachObjectARB"); + return; + } + + if (!(**con).Attach (con, att)) + { + (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con); + (**att)._unknown.Release ((struct gl2_unknown_intf **) att); + return; + } + + (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con); + (**att)._unknown.Release ((struct gl2_unknown_intf **) att); +} + +void GLAPIENTRY +_mesa_LinkProgramARB (GLhandleARB programObj) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_program_intf **pro; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glLinkProgramARB"); + return; + } + + pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); + if (pro == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glLinkProgramARB"); + return; + } + + if (pro == ctx->ShaderObjects.current_program) + { + /* TODO re-install executable program */ + } + + (**pro).Link (pro); + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); +} + +void GLAPIENTRY +_mesa_UseProgramObjectARB (GLhandleARB programObj) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_program_intf **pro; + + if (programObj == 0) + { + pro = NULL; + } + else + { + struct gl2_unknown_intf **unk; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glUseProgramObjectARB"); + return; + } + + pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); + if (pro == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUseProgramObjectARB"); + return; + } + + if ((**pro).GetLinkStatus (pro) == GL_FALSE) + { + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); + _mesa_error (ctx, GL_INVALID_OPERATION, "glUseProgramObjectARB"); + return; + } + } + + if (ctx->ShaderObjects.current_program != NULL) + { + (**ctx->ShaderObjects.current_program)._container._generic._unknown.Release ( + (struct gl2_unknown_intf **) ctx->ShaderObjects.current_program); + } + + ctx->ShaderObjects.current_program = pro; +} + +void GLAPIENTRY +_mesa_ValidateProgramARB (GLhandleARB programObj) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_program_intf **pro; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glValidateProgramARB"); + return; + } + + pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); + if (pro == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glValidateProgramARB"); + return; + } + + (**pro).Validate (pro); + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); +} + +/* +Errors TODO + + The error INVALID_OPERATION is generated by the Uniform*ARB if the + number of values loaded results in exceeding the declared extent of a + uniform. + + The error INVALID_OPERATION is generated by the Uniform*ARB commands if + the size does not match the size of the uniform declared in the shader. + + The error INVALID_OPERATION is generated by the Uniform*ARB commands if + the type does not match the type of the uniform declared in the shader, + if the uniform is not of type Boolean. + + The error INVALID_OPERATION is generated by the Uniform*ARB commands if + does not exist for the program object currently in use. + + The error INVALID_OPERATION is generated if a uniform command other than + Uniform1i{v}ARB is used to load a sampler value. + + +*/ + +void GLAPIENTRY +_mesa_Uniform1fARB (GLint location, GLfloat v0) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1fARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform2fARB (GLint location, GLfloat v0, GLfloat v1) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2fARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3fARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4fARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform1iARB (GLint location, GLint v0) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1iARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform2iARB (GLint location, GLint v0, GLint v1) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2iARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform3iARB (GLint location, GLint v0, GLint v1, GLint v2) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3iARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4iARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform1fvARB (GLint location, GLsizei count, const GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1fvARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform2fvARB (GLint location, GLsizei count, const GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2fvARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform3fvARB (GLint location, GLsizei count, const GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3fvARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform4fvARB (GLint location, GLsizei count, const GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4fvARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform1ivARB (GLint location, GLsizei count, const GLint *value) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1ivARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform2ivARB (GLint location, GLsizei count, const GLint *value) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2ivARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform3ivARB (GLint location, GLsizei count, const GLint *value) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3ivARB"); + return; + } +} + +void GLAPIENTRY +_mesa_Uniform4ivARB (GLint location, GLsizei count, const GLint *value) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4ivARB"); + return; + } +} + +void GLAPIENTRY +_mesa_UniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniformMatrix2fvARB"); + return; + } +} + +void GLAPIENTRY +_mesa_UniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniformMatrix3fvARB"); + return; + } +} + +void GLAPIENTRY +_mesa_UniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ShaderObjects.current_program == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glUniformMatrix4fvARB"); + return; + } +} + +static GLboolean +_mesa_get_object_parameter (GLhandleARB obj, GLenum pname, GLvoid *params, GLboolean *integral, + GLint *size) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_generic_intf **gen; + struct gl2_shader_intf **sha; + struct gl2_program_intf **pro; + GLint *ipar = (GLint *) params; + /*GLfloat *fpar = (GLfloat *) params;*/ + GLboolean success = GL_TRUE; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glGetObjectParameterivARB"); + return GL_FALSE; + } + + gen = (struct gl2_generic_intf **) (**unk).QueryInterface (unk, UIID_GENERIC); + if (gen == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); + return GL_FALSE; + } + + sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER); + pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); + + /* set default values */ + *integral = GL_TRUE; /* indicates param type, TRUE: GLint, FALSE: GLfloat */ + *size = 1; /* param array size */ + + switch (pname) + { + case GL_OBJECT_TYPE_ARB: + *ipar = (**gen).GetType (gen); + break; + case GL_OBJECT_SUBTYPE_ARB: + if (sha != NULL) + *ipar = (**sha).GetSubType (sha); + else { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); + success = GL_FALSE; + } + break; + case GL_OBJECT_DELETE_STATUS_ARB: + *ipar = (**gen).GetDeleteStatus (gen); + break; + case GL_OBJECT_COMPILE_STATUS_ARB: + if (sha != NULL) + *ipar = (**sha).GetCompileStatus (sha); + else { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); + success = GL_FALSE; + } + break; + case GL_OBJECT_LINK_STATUS_ARB: + if (pro != NULL) + *ipar = (**pro).GetLinkStatus (pro); + else { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); + success = GL_FALSE; + } + break; + case GL_OBJECT_VALIDATE_STATUS_ARB: + if (pro != NULL) + *ipar = (**pro).GetValidateStatus (pro); + else { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); + success = GL_FALSE; + } + break; + case GL_OBJECT_INFO_LOG_LENGTH_ARB: + { + const GLcharARB *info = (**gen).GetInfoLog (gen); + if (info == NULL) + *ipar = 0; + else + *ipar = _mesa_strlen (info) + 1; + } + break; + case GL_OBJECT_ATTACHED_OBJECTS_ARB: + if (pro != NULL) + *ipar = (**pro)._container.GetAttachedCount ((struct gl2_container_intf **) pro); + else { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); + success = GL_FALSE; + } + break; + case GL_OBJECT_ACTIVE_UNIFORMS_ARB: + if (pro != NULL) + *ipar = 0; /* TODO */ + else { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); + success = GL_FALSE; + } + break; + case GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB: + if (pro != NULL) + *ipar = 0; /* TODO */ + else { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); + success = GL_FALSE; + } + break; + case GL_OBJECT_SHADER_SOURCE_LENGTH_ARB: + if (sha != NULL) { + const GLcharARB *src = (**sha).GetSource (sha); + if (src == NULL) + *ipar = 0; + else + *ipar = _mesa_strlen (src) + 1; + } else { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); + success = GL_FALSE; + } + break; + default: + _mesa_error (ctx, GL_INVALID_ENUM, "glGetObjectParameterivARB"); + success = GL_FALSE; + break; + } + + (**gen)._unknown.Release ((struct gl2_unknown_intf **) gen); + if (sha != NULL) + (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha); + if (pro != NULL) + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); + + return success; +} + +void GLAPIENTRY +_mesa_GetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params) +{ + GLboolean integral; + GLint size, i; + + assert (sizeof (GLfloat) == sizeof (GLint)); + + if (_mesa_get_object_parameter (obj, pname, (GLvoid *) params, &integral, &size) != GL_FALSE) + if (integral != GL_FALSE) + for (i = 0; i < size; i++) + params[i] = (GLfloat) ((GLint *) params)[i]; +} + +void GLAPIENTRY +_mesa_GetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params) +{ + GLboolean integral; + GLint size, i; + + assert (sizeof (GLfloat) == sizeof (GLint)); + + if (_mesa_get_object_parameter (obj, pname, (GLvoid *) params, &integral, &size) != GL_FALSE) + if (integral == GL_FALSE) + for (i = 0; i < size; i++) + params[i] = (GLint) ((GLfloat *) params)[i]; +} + +static void +_mesa_get_string (const GLcharARB *src, GLsizei maxLength, GLsizei *length, GLcharARB *str) +{ + GLsizei len; + + if (src == NULL) + src = ""; + + len = _mesa_strlen (src); + if (len > maxLength) + { + len = maxLength; + /* allocate space for null termination */ + if (len > 0) + len--; + } + + _mesa_memcpy (str, src, len * sizeof (GLcharARB)); + if (maxLength > 0) + str[len] = '\0'; + + if (length != NULL) + *length = len; +} + +void GLAPIENTRY +_mesa_GetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_generic_intf **gen; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glGetInfoLogARB"); + return; + } + + gen = (struct gl2_generic_intf **) (**unk).QueryInterface (unk, UIID_GENERIC); + if (gen == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetInfoLogARB"); + return; + } + + _mesa_get_string ((**gen).GetInfoLog (gen), maxLength, length, infoLog); + + (**gen)._unknown.Release ((struct gl2_unknown_intf **) gen); +} + +void GLAPIENTRY +_mesa_GetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_container_intf **con; + GLsizei cnt, i; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, containerObj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glGetAttachedObjectsARB"); + return; + } + + con = (struct gl2_container_intf **) (**unk).QueryInterface (unk, UIID_CONTAINER); + if (con == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetAttachedObjectsARB"); + return; + } + + cnt = (**con).GetAttachedCount (con); + if (cnt > maxCount) + cnt = maxCount; + + for (i = 0; i < cnt; i++) + { + struct gl2_generic_intf **x = (**con).GetAttached (con, i); + obj[i] = (**x).GetName (x); + (**x)._unknown.Release ((struct gl2_unknown_intf **) x); + } + + (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con); + + if (count != NULL) + *count = cnt; +} + +GLint GLAPIENTRY +_mesa_GetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_program_intf **pro; + GLint loc = -1; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glGetUniformLocationARB"); + return -1; + } + + pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); + if (pro == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformLocationARB"); + return -1; + } + + if ((**pro).GetLinkStatus (pro) == GL_FALSE) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformLocationARB"); + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); + return -1; + } + + /* TODO */ + + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); + return loc; +} + +void GLAPIENTRY +_mesa_GetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_program_intf **pro; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveUniformARB"); + return; + } + + pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); + if (pro == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetActiveUniformARB"); + return; + } + +/* if (index >= val (OBJECT_ACTIVE_ATTRIBUTES_ARB)) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveUniformARB"); + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); + return; + }*/ + + /* TODO */ + + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); +} + +void GLAPIENTRY +_mesa_GetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_program_intf **pro; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glGetUniformfvARB"); + return; + } + + pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); + if (pro == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformfvARB"); + return; + } + + if ((**pro).GetLinkStatus (pro) == GL_FALSE) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformfvARB"); + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); + return; + } + + /* TODO validate location (OPERATION) */ + + /* TODO */ + + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); +} + +void GLAPIENTRY +_mesa_GetUniformivARB (GLhandleARB programObj, GLint location, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_program_intf **pro; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glGetUniformivARB"); + return; + } + + pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); + if (pro == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformivARB"); + return; + } + + if ((**pro).GetLinkStatus (pro) == GL_FALSE) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformivARB"); + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); + return; + } + + /* TODO validate location (GL_INVALID_OPERATION) */ + + /* TODO */ + + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); +} + +void GLAPIENTRY +_mesa_GetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_shader_intf **sha; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glGetShaderSourceARB"); + return; + } + + sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER); + if (sha == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "glGetShaderSourceARB"); + return; + } + + _mesa_get_string ((**sha).GetSource (sha), maxLength, length, source); + + (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha); +} + +/* GL_ARB_vertex_shader */ + +void GLAPIENTRY +_mesa_BindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_program_intf **pro; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glBindAttribLocationARB"); + return; + } + + pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); + if (pro == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glBindAttribLocationARB"); + return; + } + + /* TODO */ + + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); +} + +void GLAPIENTRY +_mesa_GetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_program_intf **pro; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveAttribARB"); + return; + } + + pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); + if (pro == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveAttribARB"); + return; + } + + /* TODO */ + + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); +} + +GLint GLAPIENTRY +_mesa_GetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **unk; + struct gl2_program_intf **pro; + GLint loc = 0; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + if (unk == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glGetAttribLocationARB"); + return 0; + } + + pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); + if (pro == NULL) + { + _mesa_error (ctx, GL_INVALID_VALUE, "glGetAttribLocationARB"); + return 0; + } + + /* TODO */ + + (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); + return loc; +} + +void +_mesa_init_shaderobjects (GLcontext *ctx) +{ + ctx->ShaderObjects.current_program = NULL; + + _mesa_init_shaderobjects_3dlabs (ctx); +} + diff --git a/reactos/dll/mesa32/src/shader/shaderobjects.h b/reactos/dll/mesa32/src/shader/shaderobjects.h new file mode 100644 index 00000000000..7f0f0706a01 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/shaderobjects.h @@ -0,0 +1,168 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 2004-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 SHADEROBJECTS_H +#define SHADEROBJECTS_H + +#include "mtypes.h" + +#if FEATURE_ARB_shader_objects + +extern void GLAPIENTRY +_mesa_DeleteObjectARB(GLhandleARB obj); + +extern GLhandleARB GLAPIENTRY +_mesa_GetHandleARB(GLenum pname); + +extern void GLAPIENTRY +_mesa_DetachObjectARB (GLhandleARB, GLhandleARB); + +extern GLhandleARB GLAPIENTRY +_mesa_CreateShaderObjectARB (GLenum); + +extern void GLAPIENTRY +_mesa_ShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); + +extern void GLAPIENTRY +_mesa_CompileShaderARB (GLhandleARB); + +extern GLhandleARB GLAPIENTRY +_mesa_CreateProgramObjectARB (void); + +extern void GLAPIENTRY +_mesa_AttachObjectARB (GLhandleARB, GLhandleARB); + +extern void GLAPIENTRY +_mesa_LinkProgramARB (GLhandleARB); + +extern void GLAPIENTRY +_mesa_UseProgramObjectARB (GLhandleARB); + +extern void GLAPIENTRY +_mesa_ValidateProgramARB (GLhandleARB); + +extern void GLAPIENTRY +_mesa_Uniform1fARB (GLint, GLfloat); + +extern void GLAPIENTRY +_mesa_Uniform2fARB (GLint, GLfloat, GLfloat); + +extern void GLAPIENTRY +_mesa_Uniform3fARB (GLint, GLfloat, GLfloat, GLfloat); + +extern void GLAPIENTRY +_mesa_Uniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat); + +extern void GLAPIENTRY +_mesa_Uniform1iARB (GLint, GLint); + +extern void GLAPIENTRY +_mesa_Uniform2iARB (GLint, GLint, GLint); + +extern void GLAPIENTRY +_mesa_Uniform3iARB (GLint, GLint, GLint, GLint); + +extern void GLAPIENTRY +_mesa_Uniform4iARB (GLint, GLint, GLint, GLint, GLint); + +extern void GLAPIENTRY +_mesa_Uniform1fvARB (GLint, GLsizei, const GLfloat *); + +extern void GLAPIENTRY +_mesa_Uniform2fvARB (GLint, GLsizei, const GLfloat *); + +extern void GLAPIENTRY +_mesa_Uniform3fvARB (GLint, GLsizei, const GLfloat *); + +extern void GLAPIENTRY +_mesa_Uniform4fvARB (GLint, GLsizei, const GLfloat *); + +extern void GLAPIENTRY +_mesa_Uniform1ivARB (GLint, GLsizei, const GLint *); + +extern void GLAPIENTRY +_mesa_Uniform2ivARB (GLint, GLsizei, const GLint *); + +extern void GLAPIENTRY +_mesa_Uniform3ivARB (GLint, GLsizei, const GLint *); + +extern void GLAPIENTRY +_mesa_Uniform4ivARB (GLint, GLsizei, const GLint *); + +extern void GLAPIENTRY +_mesa_UniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *); + +extern void GLAPIENTRY +_mesa_UniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *); + +extern void GLAPIENTRY +_mesa_UniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *); + +extern void GLAPIENTRY +_mesa_GetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *); + +extern void GLAPIENTRY +_mesa_GetObjectParameterivARB (GLhandleARB, GLenum, GLint *); + +extern void GLAPIENTRY +_mesa_GetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); + +extern void GLAPIENTRY +_mesa_GetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); + +extern GLint GLAPIENTRY +_mesa_GetUniformLocationARB (GLhandleARB, const GLcharARB *); + +extern void GLAPIENTRY +_mesa_GetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); + +extern void GLAPIENTRY +_mesa_GetUniformfvARB (GLhandleARB, GLint, GLfloat *); + +extern void GLAPIENTRY +_mesa_GetUniformivARB (GLhandleARB, GLint, GLint *); + +extern void GLAPIENTRY +_mesa_GetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); + +#if FEATURE_ARB_vertex_shader + +extern void GLAPIENTRY +_mesa_BindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *); + +extern void GLAPIENTRY +_mesa_GetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); + +extern GLint GLAPIENTRY +_mesa_GetAttribLocationARB (GLhandleARB, const GLcharARB *); + +#endif + +extern void +_mesa_init_shaderobjects (GLcontext *ctx); + +#endif + +#endif + diff --git a/reactos/dll/mesa32/src/shader/shaderobjects_3dlabs.c b/reactos/dll/mesa32/src/shader/shaderobjects_3dlabs.c new file mode 100755 index 00000000000..112ff050607 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/shaderobjects_3dlabs.c @@ -0,0 +1,1052 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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 shaderobjects_3dlabs.c + * shader objects definitions for 3dlabs compiler + * \author Michal Krol + */ + +/* Set this to 1 when we are ready to use 3dlabs' front-end */ +#define USE_3DLABS_FRONTEND 0 + +#include "glheader.h" +#include "shaderobjects.h" +#include "shaderobjects_3dlabs.h" +#include "context.h" +#include "macros.h" +#include "hash.h" + +#if USE_3DLABS_FRONTEND +#include "slang_mesa.h" +#include "Public/ShaderLang.h" +#else +#include "slang_compile.h" +#endif + +struct gl2_unknown_obj +{ + GLuint reference_count; + void (* _destructor) (struct gl2_unknown_intf **); +}; + +struct gl2_unknown_impl +{ + struct gl2_unknown_intf *_vftbl; + struct gl2_unknown_obj _obj; +}; + +static void +_unknown_destructor (struct gl2_unknown_intf **intf) +{ +} + +static void +_unknown_AddRef (struct gl2_unknown_intf **intf) +{ + struct gl2_unknown_impl *impl = (struct gl2_unknown_impl *) intf; + + impl->_obj.reference_count++; +} + +static void +_unknown_Release (struct gl2_unknown_intf **intf) +{ + struct gl2_unknown_impl *impl = (struct gl2_unknown_impl *) intf; + + impl->_obj.reference_count--; + if (impl->_obj.reference_count == 0) + { + impl->_obj._destructor (intf); + _mesa_free ((void *) intf); + } +} + +static struct gl2_unknown_intf ** +_unknown_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) +{ + if (uiid == UIID_UNKNOWN) + { + (**intf).AddRef (intf); + return intf; + } + return NULL; +} + +static struct gl2_unknown_intf _unknown_vftbl = { + _unknown_AddRef, + _unknown_Release, + _unknown_QueryInterface +}; + +static void +_unknown_constructor (struct gl2_unknown_impl *impl) +{ + impl->_vftbl = &_unknown_vftbl; + impl->_obj.reference_count = 1; + impl->_obj._destructor = _unknown_destructor; +} + +struct gl2_unkinner_obj +{ + struct gl2_unknown_intf **unkouter; +}; + +struct gl2_unkinner_impl +{ + struct gl2_unknown_intf *_vftbl; + struct gl2_unkinner_obj _obj; +}; + +static void +_unkinner_destructor (struct gl2_unknown_intf **intf) +{ +} + +static void +_unkinner_AddRef (struct gl2_unknown_intf **intf) +{ + struct gl2_unkinner_impl *impl = (struct gl2_unkinner_impl *) intf; + + (**impl->_obj.unkouter).AddRef (impl->_obj.unkouter); +} + +static void +_unkinner_Release (struct gl2_unknown_intf **intf) +{ + struct gl2_unkinner_impl *impl = (struct gl2_unkinner_impl *) intf; + + (**impl->_obj.unkouter).Release (impl->_obj.unkouter); +} + +static struct gl2_unknown_intf ** +_unkinner_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) +{ + struct gl2_unkinner_impl *impl = (struct gl2_unkinner_impl *) intf; + + return (**impl->_obj.unkouter).QueryInterface (impl->_obj.unkouter, uiid); +} + +static struct gl2_unknown_intf _unkinner_vftbl = { + _unkinner_AddRef, + _unkinner_Release, + _unkinner_QueryInterface +}; + +static void +_unkinner_constructor (struct gl2_unkinner_impl *impl, struct gl2_unknown_intf **outer) +{ + impl->_vftbl = &_unkinner_vftbl; + impl->_obj.unkouter = outer; +} + +struct gl2_generic_obj +{ + struct gl2_unknown_obj _unknown; + GLhandleARB name; + GLboolean delete_status; + GLcharARB *info_log; +}; + +struct gl2_generic_impl +{ + struct gl2_generic_intf *_vftbl; + struct gl2_generic_obj _obj; +}; + +static void +_generic_destructor (struct gl2_unknown_intf **intf) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf; + + _mesa_free ((void *) impl->_obj.info_log); + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + _mesa_HashRemove (ctx->Shared->GL2Objects, impl->_obj.name); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); + + _unknown_destructor (intf); +} + +static struct gl2_unknown_intf ** +_generic_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) +{ + if (uiid == UIID_GENERIC) + { + (**intf).AddRef (intf); + return intf; + } + return _unknown_QueryInterface (intf, uiid); +} + +static void +_generic_Delete (struct gl2_generic_intf **intf) +{ + struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf; + + if (impl->_obj.delete_status == GL_FALSE) + { + impl->_obj.delete_status = GL_TRUE; + (**intf)._unknown.Release ((struct gl2_unknown_intf **) intf); + } +} + +static GLhandleARB +_generic_GetName (struct gl2_generic_intf **intf) +{ + struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf; + + return impl->_obj.name; +} + +static GLboolean +_generic_GetDeleteStatus (struct gl2_generic_intf **intf) +{ + struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf; + + return impl->_obj.delete_status; +} + +static const GLcharARB * +_generic_GetInfoLog (struct gl2_generic_intf **intf) +{ + struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf; + + return impl->_obj.info_log; +} + +static struct gl2_generic_intf _generic_vftbl = { + { + _unknown_AddRef, + _unknown_Release, + _generic_QueryInterface + }, + _generic_Delete, + NULL, /* abstract GetType */ + _generic_GetName, + _generic_GetDeleteStatus, + _generic_GetInfoLog +}; + +static void +_generic_constructor (struct gl2_generic_impl *impl) +{ + GET_CURRENT_CONTEXT(ctx); + + _unknown_constructor ((struct gl2_unknown_impl *) impl); + impl->_vftbl = &_generic_vftbl; + impl->_obj._unknown._destructor = _generic_destructor; + impl->_obj.delete_status = GL_FALSE; + impl->_obj.info_log = NULL; + + _glthread_LOCK_MUTEX (ctx->Shared->Mutex); + impl->_obj.name = _mesa_HashFindFreeKeyBlock (ctx->Shared->GL2Objects, 1); + _mesa_HashInsert (ctx->Shared->GL2Objects, impl->_obj.name, (void *) impl); + _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); +} + +struct gl2_container_obj +{ + struct gl2_generic_obj _generic; + struct gl2_generic_intf ***attached; + GLuint attached_count; +}; + +struct gl2_container_impl +{ + struct gl2_container_intf *_vftbl; + struct gl2_container_obj _obj; +}; + +static void +_container_destructor (struct gl2_unknown_intf **intf) +{ + struct gl2_container_impl *impl = (struct gl2_container_impl *) intf; + GLuint i; + + for (i = 0; i < impl->_obj.attached_count; i++) + { + struct gl2_generic_intf **x = impl->_obj.attached[i]; + (**x)._unknown.Release ((struct gl2_unknown_intf **) x); + } + + _generic_destructor (intf); +} + +static struct gl2_unknown_intf ** +_container_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) +{ + if (uiid == UIID_CONTAINER) + { + (**intf).AddRef (intf); + return intf; + } + return _generic_QueryInterface (intf, uiid); +} + +static GLboolean +_container_Attach (struct gl2_container_intf **intf, struct gl2_generic_intf **att) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_container_impl *impl = (struct gl2_container_impl *) intf; + GLuint i; + + for (i = 0; i < impl->_obj.attached_count; i++) + if (impl->_obj.attached[i] == att) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "_container_Attach"); + return GL_FALSE; + } + + impl->_obj.attached = (struct gl2_generic_intf ***) _mesa_realloc (impl->_obj.attached, + impl->_obj.attached_count * sizeof (*impl->_obj.attached), (impl->_obj.attached_count + 1) * + sizeof (*impl->_obj.attached)); + if (impl->_obj.attached == NULL) + return GL_FALSE; + + impl->_obj.attached[impl->_obj.attached_count] = att; + impl->_obj.attached_count++; + (**att)._unknown.AddRef ((struct gl2_unknown_intf **) att); + return GL_TRUE; +} + +static GLboolean +_container_Detach (struct gl2_container_intf **intf, struct gl2_generic_intf **att) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_container_impl *impl = (struct gl2_container_impl *) intf; + GLuint i, j; + + for (i = 0; i < impl->_obj.attached_count; i++) + if (impl->_obj.attached[i] == att) + { + for (j = i; j < impl->_obj.attached_count - 1; j++) + impl->_obj.attached[j] = impl->_obj.attached[j + 1]; + impl->_obj.attached = (struct gl2_generic_intf ***) _mesa_realloc (impl->_obj.attached, + impl->_obj.attached_count * sizeof (*impl->_obj.attached), + (impl->_obj.attached_count - 1) * sizeof (*impl->_obj.attached)); + impl->_obj.attached_count--; + (**att)._unknown.Release ((struct gl2_unknown_intf **) att); + return GL_TRUE; + } + + _mesa_error (ctx, GL_INVALID_OPERATION, "_container_Detach"); + return GL_FALSE; +} + +static GLsizei +_container_GetAttachedCount (struct gl2_container_intf **intf) +{ + struct gl2_container_impl *impl = (struct gl2_container_impl *) intf; + + return impl->_obj.attached_count; +} + +static struct gl2_generic_intf ** +_container_GetAttached (struct gl2_container_intf **intf, GLuint index) +{ + struct gl2_container_impl *impl = (struct gl2_container_impl *) intf; + + (**impl->_obj.attached[index])._unknown.AddRef ( + (struct gl2_unknown_intf **)impl->_obj.attached[index]); + return impl->_obj.attached[index]; +} + +static struct gl2_container_intf _container_vftbl = { + { + { + _unknown_AddRef, + _unknown_Release, + _container_QueryInterface + }, + _generic_Delete, + NULL, /* abstract GetType */ + _generic_GetName, + _generic_GetDeleteStatus, + _generic_GetInfoLog + }, + _container_Attach, + _container_Detach, + _container_GetAttachedCount, + _container_GetAttached +}; + +static void +_container_constructor (struct gl2_container_impl *impl) +{ + _generic_constructor ((struct gl2_generic_impl *) impl); + impl->_vftbl = &_container_vftbl; + impl->_obj._generic._unknown._destructor = _container_destructor; + impl->_obj.attached = NULL; + impl->_obj.attached_count = 0; +} + +struct gl2_3dlabs_shhandle_obj +{ + struct gl2_unkinner_obj _unknown; +#if USE_3DLABS_FRONTEND + ShHandle handle; +#endif +}; + +struct gl2_3dlabs_shhandle_impl +{ + struct gl2_3dlabs_shhandle_intf *_vftbl; + struct gl2_3dlabs_shhandle_obj _obj; +}; + +static void +_3dlabs_shhandle_destructor (struct gl2_unknown_intf **intf) +{ +#if USE_3DLABS_FRONTEND + struct gl2_3dlabs_shhandle_impl *impl = (struct gl2_3dlabs_shhandle_impl *) intf; + ShDestruct (impl->_obj.handle); +#endif + _unkinner_destructor (intf); +} + +static GLvoid * +_3dlabs_shhandle_GetShHandle (struct gl2_3dlabs_shhandle_intf **intf) +{ +#if USE_3DLABS_FRONTEND + struct gl2_3dlabs_shhandle_impl *impl = (struct gl2_3dlabs_shhandle_impl *) intf; + return impl->_obj.handle; +#else + return NULL; +#endif +} + +static struct gl2_3dlabs_shhandle_intf _3dlabs_shhandle_vftbl = { + { + _unkinner_AddRef, + _unkinner_Release, + _unkinner_QueryInterface + }, + _3dlabs_shhandle_GetShHandle +}; + +static void +_3dlabs_shhandle_constructor (struct gl2_3dlabs_shhandle_impl *impl, struct gl2_unknown_intf **outer) +{ + _unkinner_constructor ((struct gl2_unkinner_impl *) impl, outer); + impl->_vftbl = &_3dlabs_shhandle_vftbl; +#if USE_3DLABS_FRONTEND + impl->_obj.handle = NULL; +#endif +} + +struct gl2_shader_obj +{ + struct gl2_generic_obj _generic; + struct gl2_3dlabs_shhandle_impl _3dlabs_shhandle; + GLboolean compile_status; + GLcharARB *source; + GLint *offsets; + GLsizei offset_count; +}; + +struct gl2_shader_impl +{ + struct gl2_shader_intf *_vftbl; + struct gl2_shader_obj _obj; +}; + +static void +_shader_destructor (struct gl2_unknown_intf **intf) +{ + struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf; + + _mesa_free ((void *) impl->_obj.source); + _mesa_free ((void *) impl->_obj.offsets); + _3dlabs_shhandle_destructor ((struct gl2_unknown_intf **) &impl->_obj._3dlabs_shhandle._vftbl); + _generic_destructor (intf); +} + +static struct gl2_unknown_intf ** +_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) +{ +#if USE_3DLABS_FRONTEND + struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf; +#endif + + if (uiid == UIID_SHADER) + { + (**intf).AddRef (intf); + return intf; + } +#if USE_3DLABS_FRONTEND + if (uiid == UIID_3DLABS_SHHANDLE) + { + (**intf).AddRef (intf); + return (struct gl2_unknown_intf **) &impl->_obj._3dlabs_shhandle._vftbl; + } +#endif + return _generic_QueryInterface (intf, uiid); +} + +static GLenum +_shader_GetType (struct gl2_generic_intf **intf) +{ + return GL_SHADER_OBJECT_ARB; +} + +static GLboolean +_shader_GetCompileStatus (struct gl2_shader_intf **intf) +{ + struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf; + + return impl->_obj.compile_status; +} + +static GLvoid +_shader_SetSource (struct gl2_shader_intf **intf, GLcharARB *src, GLint *off, GLsizei cnt) +{ + struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf; + + _mesa_free ((void *) impl->_obj.source); + impl->_obj.source = src; + _mesa_free ((void *) impl->_obj.offsets); + impl->_obj.offsets = off; + impl->_obj.offset_count = cnt; +} + +static const GLcharARB * +_shader_GetSource (struct gl2_shader_intf **intf) +{ + struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf; + + return impl->_obj.source; +} + +static GLvoid +_shader_Compile (struct gl2_shader_intf **intf) +{ + struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf; +#if USE_3DLABS_FRONTEND + char **strings; + TBuiltInResource res; +#else + slang_translation_unit unit; + slang_unit_type type; + slang_info_log info_log; +#endif + + impl->_obj.compile_status = GL_FALSE; + _mesa_free ((void *) impl->_obj._generic.info_log); + impl->_obj._generic.info_log = NULL; + +#if USE_3DLABS_FRONTEND + /* 3dlabs compiler expects us to feed it with null-terminated string array, + we've got only one big string with offsets, so we must split it; but when + there's only one string to deal with, we pass its address directly */ + + if (impl->_obj.offset_count <= 1) + strings = &impl->_obj.source; + else + { + GLsizei i, offset = 0; + + strings = (char **) _mesa_malloc (impl->_obj.offset_count * sizeof (char *)); + if (strings == NULL) + return; + + for (i = 0; i < impl->_obj.offset_count; i++) + { + GLsizei size = impl->_obj.offsets[i] - offset; + + strings[i] = (char *) _mesa_malloc ((size + 1) * sizeof (char)); + if (strings[i] == NULL) + { + GLsizei j; + + for (j = 0; j < i; j++) + _mesa_free (strings[j]); + _mesa_free (strings); + return; + } + + _mesa_memcpy (strings[i], impl->_obj.source + offset, size * sizeof (char)); + strings[i][size] = '\0'; + offset = impl->_obj.offsets[i]; + } + } + + /* TODO set these fields to some REAL numbers */ + res.maxLights = 8; + res.maxClipPlanes = 6; + res.maxTextureUnits = 2; + res.maxTextureCoords = 2; + res.maxVertexAttribs = 8; + res.maxVertexUniformComponents = 64; + res.maxVaryingFloats = 8; + res.maxVertexTextureImageUnits = 2; + res.maxCombinedTextureImageUnits = 2; + res.maxTextureImageUnits = 2; + res.maxFragmentUniformComponents = 64; + res.maxDrawBuffers = 1; + + if (ShCompile (impl->_obj._3dlabs_shhandle._obj.handle, strings, impl->_obj.offset_count, + EShOptFull, &res, 0)) + impl->_obj.compile_status = GL_TRUE; + if (impl->_obj.offset_count > 1) + { + GLsizei i; + + for (i = 0; i < impl->_obj.offset_count; i++) + _mesa_free (strings[i]); + _mesa_free (strings); + } + + impl->_obj._generic.info_log = _mesa_strdup (ShGetInfoLog ( + impl->_obj._3dlabs_shhandle._obj.handle)); +#else + if (impl->_vftbl->GetSubType (intf) == GL_FRAGMENT_SHADER) + type = slang_unit_fragment_shader; + else + type = slang_unit_vertex_shader; + slang_info_log_construct (&info_log); + if (_slang_compile (impl->_obj.source, &unit, type, &info_log)) + { + impl->_obj.compile_status = GL_TRUE; + } + if (info_log.text != NULL) + impl->_obj._generic.info_log = _mesa_strdup (info_log.text); + else + impl->_obj._generic.info_log = _mesa_strdup (""); + slang_info_log_destruct (&info_log); +#endif +} + +static struct gl2_shader_intf _shader_vftbl = { + { + { + _unknown_AddRef, + _unknown_Release, + _shader_QueryInterface + }, + _generic_Delete, + _shader_GetType, + _generic_GetName, + _generic_GetDeleteStatus, + _generic_GetInfoLog + }, + NULL, /* abstract GetSubType */ + _shader_GetCompileStatus, + _shader_SetSource, + _shader_GetSource, + _shader_Compile +}; + +static void +_shader_constructor (struct gl2_shader_impl *impl) +{ + _generic_constructor ((struct gl2_generic_impl *) impl); + _3dlabs_shhandle_constructor (&impl->_obj._3dlabs_shhandle, (struct gl2_unknown_intf **) + &impl->_vftbl); + impl->_vftbl = &_shader_vftbl; + impl->_obj._generic._unknown._destructor = _shader_destructor; + impl->_obj.compile_status = GL_FALSE; + impl->_obj.source = NULL; + impl->_obj.offsets = NULL; + impl->_obj.offset_count = 0; +} + +struct gl2_program_obj +{ + struct gl2_container_obj _container; + GLboolean link_status; + GLboolean validate_status; +#if USE_3DLABS_FRONTEND + ShHandle linker; + ShHandle uniforms; +#endif +}; + +struct gl2_program_impl +{ + struct gl2_program_intf *_vftbl; + struct gl2_program_obj _obj; +}; + +static void +_program_destructor (struct gl2_unknown_intf **intf) +{ +#if USE_3DLABS_FRONTEND + struct gl2_program_impl *impl = (struct gl2_program_impl *) intf; + + ShDestruct (impl->_obj.linker); + ShDestruct (impl->_obj.uniforms); +#endif + _container_destructor (intf); +} + +static struct gl2_unknown_intf ** +_program_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) +{ + if (uiid == UIID_PROGRAM) + { + (**intf).AddRef (intf); + return intf; + } + return _container_QueryInterface (intf, uiid); +} + +static GLenum +_program_GetType (struct gl2_generic_intf **intf) +{ + return GL_PROGRAM_OBJECT_ARB; +} + +static GLboolean +_program_Attach (struct gl2_container_intf **intf, struct gl2_generic_intf **att) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl2_unknown_intf **sha; + + sha = (**att)._unknown.QueryInterface ((struct gl2_unknown_intf **) att, UIID_SHADER); + if (sha == NULL) + { + _mesa_error (ctx, GL_INVALID_OPERATION, "_program_Attach"); + return GL_FALSE; + } + + (**sha).Release (sha); + return _container_Attach (intf, att); +} + +static GLboolean +_program_GetLinkStatus (struct gl2_program_intf **intf) +{ + struct gl2_program_impl *impl = (struct gl2_program_impl *) intf; + + return impl->_obj.link_status; +} + +static GLboolean +_program_GetValidateStatus (struct gl2_program_intf **intf) +{ + struct gl2_program_impl *impl = (struct gl2_program_impl *) intf; + + return impl->_obj.validate_status; +} + +static GLvoid +_program_Link (struct gl2_program_intf **intf) +{ + struct gl2_program_impl *impl = (struct gl2_program_impl *) intf; +#if USE_3DLABS_FRONTEND + ShHandle *handles; + GLuint i; +#endif + + impl->_obj.link_status = GL_FALSE; + _mesa_free ((void *) impl->_obj._container._generic.info_log); + impl->_obj._container._generic.info_log = NULL; + +#if USE_3DLABS_FRONTEND + handles = (ShHandle *) _mesa_malloc (impl->_obj._container.attached_count * sizeof (ShHandle)); + if (handles == NULL) + return; + + for (i = 0; i < impl->_obj._container.attached_count; i++) + { + struct gl2_generic_intf **gen = impl->_obj._container.attached[i]; + struct gl2_3dlabs_shhandle_intf **sh; + + sh = (struct gl2_3dlabs_shhandle_intf **) (**gen)._unknown.QueryInterface ( + (struct gl2_unknown_intf **) gen, UIID_3DLABS_SHHANDLE); + if (sh != NULL) + { + handles[i] = (**sh).GetShHandle (sh); + (**sh)._unknown.Release ((struct gl2_unknown_intf **) sh); + } + else + { + _mesa_free (handles); + return; + } + } + + if (ShLink (impl->_obj.linker, handles, impl->_obj._container.attached_count, + impl->_obj.uniforms, NULL, NULL)) + impl->_obj.link_status = GL_TRUE; + + impl->_obj._container._generic.info_log = _mesa_strdup (ShGetInfoLog (impl->_obj.linker)); +#endif +} + +static GLvoid +_program_Validate (struct gl2_program_intf **intf) +{ + struct gl2_program_impl *impl = (struct gl2_program_impl *) intf; + + impl->_obj.validate_status = GL_FALSE; + _mesa_free ((void *) impl->_obj._container._generic.info_log); + impl->_obj._container._generic.info_log = NULL; + + /* TODO validate */ +} + +static struct gl2_program_intf _program_vftbl = { + { + { + { + _unknown_AddRef, + _unknown_Release, + _program_QueryInterface + }, + _generic_Delete, + _program_GetType, + _generic_GetName, + _generic_GetDeleteStatus, + _generic_GetInfoLog + }, + _program_Attach, + _container_Detach, + _container_GetAttachedCount, + _container_GetAttached + }, + _program_GetLinkStatus, + _program_GetValidateStatus, + _program_Link, + _program_Validate +}; + +static void +_program_constructor (struct gl2_program_impl *impl) +{ + _container_constructor ((struct gl2_container_impl *) impl); + impl->_vftbl = &_program_vftbl; + impl->_obj._container._generic._unknown._destructor = _program_destructor; + impl->_obj.link_status = GL_FALSE; + impl->_obj.validate_status = GL_FALSE; +#if USE_3DLABS_FRONTEND + impl->_obj.linker = ShConstructLinker (EShExVertexFragment, 0); + impl->_obj.uniforms = ShConstructUniformMap (); +#endif +} + +struct gl2_fragment_shader_obj +{ + struct gl2_shader_obj _shader; +}; + +struct gl2_fragment_shader_impl +{ + struct gl2_fragment_shader_intf *_vftbl; + struct gl2_fragment_shader_obj _obj; +}; + +static void +_fragment_shader_destructor (struct gl2_unknown_intf **intf) +{ + struct gl2_fragment_shader_impl *impl = (struct gl2_fragment_shader_impl *) intf; + + (void) impl; + /* TODO free fragment shader data */ + + _shader_destructor (intf); +} + +static struct gl2_unknown_intf ** +_fragment_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) +{ + if (uiid == UIID_FRAGMENT_SHADER) + { + (**intf).AddRef (intf); + return intf; + } + return _shader_QueryInterface (intf, uiid); +} + +static GLenum +_fragment_shader_GetSubType (struct gl2_shader_intf **intf) +{ + return GL_FRAGMENT_SHADER_ARB; +} + +static struct gl2_fragment_shader_intf _fragment_shader_vftbl = { + { + { + { + _unknown_AddRef, + _unknown_Release, + _fragment_shader_QueryInterface + }, + _generic_Delete, + _shader_GetType, + _generic_GetName, + _generic_GetDeleteStatus, + _generic_GetInfoLog + }, + _fragment_shader_GetSubType, + _shader_GetCompileStatus, + _shader_SetSource, + _shader_GetSource, + _shader_Compile + } +}; + +static void +_fragment_shader_constructor (struct gl2_fragment_shader_impl *impl) +{ + _shader_constructor ((struct gl2_shader_impl *) impl); + impl->_vftbl = &_fragment_shader_vftbl; + impl->_obj._shader._generic._unknown._destructor = _fragment_shader_destructor; +#if USE_3DLABS_FRONTEND + impl->_obj._shader._3dlabs_shhandle._obj.handle = ShConstructCompiler (EShLangFragment, 0); +#endif +} + +struct gl2_vertex_shader_obj +{ + struct gl2_shader_obj _shader; +}; + +struct gl2_vertex_shader_impl +{ + struct gl2_vertex_shader_intf *_vftbl; + struct gl2_vertex_shader_obj _obj; +}; + +static void +_vertex_shader_destructor (struct gl2_unknown_intf **intf) +{ + struct gl2_vertex_shader_impl *impl = (struct gl2_vertex_shader_impl *) intf; + + (void) impl; + /* TODO free vertex shader data */ + + _shader_destructor (intf); +} + +static struct gl2_unknown_intf ** +_vertex_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) +{ + if (uiid == UIID_VERTEX_SHADER) + { + (**intf).AddRef (intf); + return intf; + } + return _shader_QueryInterface (intf, uiid); +} + +static GLenum +_vertex_shader_GetSubType (struct gl2_shader_intf **intf) +{ + return GL_VERTEX_SHADER_ARB; +} + +static struct gl2_vertex_shader_intf _vertex_shader_vftbl = { + { + { + { + _unknown_AddRef, + _unknown_Release, + _vertex_shader_QueryInterface + }, + _generic_Delete, + _shader_GetType, + _generic_GetName, + _generic_GetDeleteStatus, + _generic_GetInfoLog + }, + _vertex_shader_GetSubType, + _shader_GetCompileStatus, + _shader_SetSource, + _shader_GetSource, + _shader_Compile + } +}; + +static void +_vertex_shader_constructor (struct gl2_vertex_shader_impl *impl) +{ + _shader_constructor ((struct gl2_shader_impl *) impl); + impl->_vftbl = &_vertex_shader_vftbl; + impl->_obj._shader._generic._unknown._destructor = _vertex_shader_destructor; +#if USE_3DLABS_FRONTEND + impl->_obj._shader._3dlabs_shhandle._obj.handle = ShConstructCompiler (EShLangVertex, 0); +#endif +} + +GLhandleARB +_mesa_3dlabs_create_shader_object (GLenum shaderType) +{ + switch (shaderType) + { + case GL_FRAGMENT_SHADER_ARB: + { + struct gl2_fragment_shader_impl *x = (struct gl2_fragment_shader_impl *) + _mesa_malloc (sizeof (struct gl2_fragment_shader_impl)); + + if (x != NULL) + { + _fragment_shader_constructor (x); + return x->_obj._shader._generic.name; + } + } + break; + case GL_VERTEX_SHADER_ARB: + { + struct gl2_vertex_shader_impl *x = (struct gl2_vertex_shader_impl *) + _mesa_malloc (sizeof (struct gl2_vertex_shader_impl)); + + if (x != NULL) + { + _vertex_shader_constructor (x); + return x->_obj._shader._generic.name; + } + } + break; + } + + return 0; +} + +GLhandleARB +_mesa_3dlabs_create_program_object (void) +{ + struct gl2_program_impl *x = (struct gl2_program_impl *) + _mesa_malloc (sizeof (struct gl2_program_impl)); + + if (x != NULL) + { + _program_constructor (x); + return x->_obj._container._generic.name; + } + + return 0; +} + +void +_mesa_init_shaderobjects_3dlabs (GLcontext *ctx) +{ +#if USE_3DLABS_FRONTEND + _glslang_3dlabs_InitProcess (); + _glslang_3dlabs_ShInitialize (); +#endif +} + diff --git a/reactos/dll/mesa32/src/shader/shaderobjects_3dlabs.h b/reactos/dll/mesa32/src/shader/shaderobjects_3dlabs.h new file mode 100755 index 00000000000..5deff2f6aeb --- /dev/null +++ b/reactos/dll/mesa32/src/shader/shaderobjects_3dlabs.h @@ -0,0 +1,40 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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 SHADEROBJECTS_3DLABS_H +#define SHADEROBJECTS_3DLABS_H + +#include "mtypes.h" + +extern GLhandleARB +_mesa_3dlabs_create_shader_object (GLenum); + +extern GLhandleARB +_mesa_3dlabs_create_program_object (void); + +extern void +_mesa_init_shaderobjects_3dlabs (GLcontext *ctx); + +#endif + diff --git a/reactos/dll/mesa32/src/shader/slang/descrip.mms b/reactos/dll/mesa32/src/shader/slang/descrip.mms new file mode 100644 index 00000000000..6f2b90296c5 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/descrip.mms @@ -0,0 +1,52 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl +# Last revision : 1 June 2005 + +.first + define gl [----.include.gl] + define math [--.math] + define swrast [--.swrast] + define array_cache [--.array_cache] + +.include [----]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [----.include],[--.main],[--.glapi],[-.slang],[-.grammar],[-] +LIBDIR = [----.lib] +CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short) + +SOURCES = \ + slang_compile.c,slang_preprocess.c + +OBJECTS = \ + slang_compile.obj,slang_preprocess.obj,slang_utility.obj,\ + slang_execute.obj,slang_assemble.obj,slang_assemble_conditional.obj,\ + slang_assemble_constructor.obj,slang_assemble_typeinfo.obj,\ + slang_storage.obj,slang_assemble_assignment.obj + +##### RULES ##### + +VERSION=Mesa V3.4 + +##### TARGETS ##### +# Make the library +$(LIBDIR)$(GL_LIB) : $(OBJECTS) + @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) + +clean : + purge + delete *.obj;* + +slang_compile.obj : slang_compile.c +slang_preprocess.obj : slang_preprocess.c +slang_utility.obj : slang_utility.c +slang_execute.obj : slang_execute.c +slang_assemble.obj : slang_assemble.c +slang_assemble_conditional.obj : slang_assemble_conditional.c +slang_assemble_constructor.obj : slang_assemble_constructor.c +slang_assemble_typeinfo.obj : slang_assemble_typeinfo.c +slang_storage.obj : slang_storage.c +slang_assemble_assignment.obj : slang_assemble_assignment.c diff --git a/reactos/dll/mesa32/src/shader/slang/library/gc_to_bin.c b/reactos/dll/mesa32/src/shader/slang/library/gc_to_bin.c new file mode 100755 index 00000000000..0362d791264 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/library/gc_to_bin.c @@ -0,0 +1,79 @@ +#include "../../grammar/grammar_crt.h" +#include "../../grammar/grammar_crt.c" +#include + +static const char *slang_shader_syn = +#include "slang_shader_syn.h" +; + +static void gc_to_bin (grammar id, const char *in, const char *out) +{ + FILE *f; + byte *source, *prod; + unsigned int size, i, line = 0; + + f = fopen (in, "r"); + if (f == NULL) + return; + fseek (f, 0, SEEK_END); + size = ftell (f); + fseek (f, 0, SEEK_SET); + source = (byte *) grammar_alloc_malloc (size + 1); + source[fread (source, 1, size, f)] = '\0'; + fclose (f); + + if (!grammar_fast_check (id, source, &prod, &size, 65536)) + { + grammar_alloc_free (source); + return; + } + + f = fopen (out, "w"); + for (i = 0; i < size; i++) + { + unsigned int a; + if (prod[i] < 10) + a = 1; + else if (prod[i] < 100) + a = 2; + else + a = 3; + if (i < size - 1) + a++; + if (line + a > 100) + { + fprintf (f, "\n"); + line = 0; + } + line += a; + fprintf (f, "%d", prod[i]); + if (i < size - 1) + fprintf (f, ","); + } + fclose (f); + grammar_alloc_free (prod); +} + +int main () +{ + grammar id; + + id = grammar_load_from_text ((const byte *) slang_shader_syn); + if (id == 0) + return 1; + + grammar_set_reg8 (id, (const byte *) "parsing_builtin", 1); + + grammar_set_reg8 (id, (const byte *) "shader_type", 1); + gc_to_bin (id, "slang_core.gc", "slang_core_gc_bin.h"); + gc_to_bin (id, "slang_common_builtin.gc", "slang_common_builtin_gc_bin.h"); + gc_to_bin (id, "slang_fragment_builtin.gc", "slang_fragment_builtin_gc_bin.h"); + + grammar_set_reg8 (id, (const byte *) "shader_type", 2); + gc_to_bin (id, "slang_vertex_builtin.gc", "slang_vertex_builtin_gc_bin.h"); + + grammar_destroy (id); + + return 0; +} + diff --git a/reactos/dll/mesa32/src/shader/slang/library/slang_common_builtin_gc.h b/reactos/dll/mesa32/src/shader/slang/library/slang_common_builtin_gc.h new file mode 100644 index 00000000000..cd9d9ac7d17 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/library/slang_common_builtin_gc.h @@ -0,0 +1,1410 @@ +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"const int gl_MaxLights = 8;\n" +"const int gl_MaxClipPlanes = 6;\n" +"const int gl_MaxTextureUnits = 2;\n" +"const int gl_MaxTextureCoords = 2;\n" +"const int gl_MaxVertexAttribs = 16;\n" +"const int gl_MaxVertexUniformComponents = 512;\n" +"const int gl_MaxVaryingFloats = 32;\n" +"const int gl_MaxVertexTextureImageUnits = 0;\n" +"const int gl_MaxCombinedTextureImageUnits = 2;\n" +"const int gl_MaxTextureImageUnits = 2;\n" +"const int gl_MaxFragmentUniformComponents = 64;\n" +"const int gl_MaxDrawBuffers = 1;\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"uniform mat4 gl_ModelViewMatrix;\n" +"uniform mat4 gl_ProjectionMatrix;\n" +"uniform mat4 gl_ModelViewProjectionMatrix;\n" +"uniform mat4 gl_TextureMatrix[gl_MaxTextureCoords];\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"uniform mat3 gl_NormalMatrix;\n" +"\n" +"\n" +"uniform mat4 gl_ModelViewMatrixInverse;\n" +"uniform mat4 gl_ProjectionMatrixInverse;\n" +"uniform mat4 gl_ModelViewProjectionMatrixInverse;\n" +"uniform mat4 gl_TextureMatrixInverse[gl_MaxTextureCoords];\n" +"\n" +"uniform mat4 gl_ModelViewMatrixTranspose;\n" +"uniform mat4 gl_ProjectionMatrixTranspose;\n" +"uniform mat4 gl_ModelViewProjectionMatrixTranspose;\n" +"uniform mat4 gl_TextureMatrixTranspose[gl_MaxTextureCoords];\n" +"\n" +"uniform mat4 gl_ModelViewMatrixInverseTranspose;\n" +"uniform mat4 gl_ProjectionMatrixInverseTranspose;\n" +"uniform mat4 gl_ModelViewProjectionMatrixInverseTranspose;\n" +"uniform mat4 gl_TextureMatrixInverseTranspose[gl_MaxTextureCoords];\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"uniform float gl_NormalScale;\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"struct gl_DepthRangeParameters {\n" +" float near;\n" +" float far;\n" +" float diff;\n" +"};\n" +"\n" +"uniform gl_DepthRangeParameters gl_DepthRange;\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"uniform vec4 gl_ClipPlane[gl_MaxClipPlanes];\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"struct gl_PointParameters {\n" +" float size;\n" +" float sizeMin;\n" +" float sizeMax;\n" +" float fadeThresholdSize;\n" +" float distanceConstantAttenuation;\n" +" float distanceLinearAttenuation;\n" +" float distanceQuadraticAttenuation;\n" +"};\n" +"\n" +"uniform gl_PointParameters gl_Point;\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"struct gl_MaterialParameters {\n" +" vec4 emission;\n" +" vec4 ambient;\n" +" vec4 diffuse;\n" +" vec4 specular;\n" +" float shininess;\n" +"};\n" +"\n" +"uniform gl_MaterialParameters gl_FrontMaterial;\n" +"uniform gl_MaterialParameters gl_BackMaterial;\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"struct gl_LightSourceParameters {\n" +" vec4 ambient;\n" +" vec4 diffuse;\n" +" vec4 specular;\n" +" vec4 position;\n" +" vec4 halfVector;\n" +" vec3 spotDirection;\n" +" float spotExponent;\n" +" float spotCutoff;\n" +"\n" +" float spotCosCutoff;\n" +"\n" +" float constantAttenuation;\n" +" float linearAttenuation;\n" +" float quadraticAttenuation;\n" +"};\n" +"\n" +"uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights];\n" +"\n" +"struct gl_LightModelParameters {\n" +" vec4 ambient;\n" +"};\n" +"\n" +"uniform gl_LightModelParameters gl_LightModel;\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"struct gl_LightModelProducts {\n" +" vec4 sceneColor;\n" +"};\n" +"\n" +"uniform gl_LightModelProducts gl_FrontLightModelProduct;\n" +"uniform gl_LightModelProducts gl_BackLightModelProduct;\n" +"\n" +"struct gl_LightProducts {\n" +" vec4 ambient;\n" +" vec4 diffuse;\n" +" vec4 specular;\n" +"};\n" +"\n" +"uniform gl_LightProducts gl_FrontLightProduct[gl_MaxLights];\n" +"uniform gl_LightProducts gl_BackLightProduct[gl_MaxLights];\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"uniform vec4 gl_TextureEnvColor[gl_MaxTextureImageUnits];\n" +"uniform vec4 gl_EyePlaneS[gl_MaxTextureCoords];\n" +"uniform vec4 gl_EyePlaneT[gl_MaxTextureCoords];\n" +"uniform vec4 gl_EyePlaneR[gl_MaxTextureCoords];\n" +"uniform vec4 gl_EyePlaneQ[gl_MaxTextureCoords];\n" +"uniform vec4 gl_ObjectPlaneS[gl_MaxTextureCoords];\n" +"uniform vec4 gl_ObjectPlaneT[gl_MaxTextureCoords];\n" +"uniform vec4 gl_ObjectPlaneR[gl_MaxTextureCoords];\n" +"uniform vec4 gl_ObjectPlaneQ[gl_MaxTextureCoords];\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"struct gl_FogParameters {\n" +" vec4 color;\n" +" float density;\n" +" float start;\n" +" float end;\n" +" float scale;\n" +"};\n" +"\n" +"uniform gl_FogParameters gl_Fog;\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float radians (float deg) {\n" +" return 3.141593 * deg / 180.0;\n" +"}\n" +"vec2 radians (vec2 deg) {\n" +" return vec2 (radians (deg.x), radians (deg.y));\n" +"}\n" +"vec3 radians (vec3 deg) {\n" +" return vec3 (radians (deg.x), radians (deg.y), radians (deg.z));\n" +"}\n" +"vec4 radians (vec4 deg) {\n" +" return vec4 (radians (deg.x), radians (deg.y), radians (deg.z), radians (deg.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float degrees (float rad) {\n" +" return 180.0 * rad / 3.141593;\n" +"}\n" +"vec2 degrees (vec2 rad) {\n" +" return vec2 (degrees (rad.x), degrees (rad.y));\n" +"}\n" +"vec3 degrees (vec3 rad) {\n" +" return vec3 (degrees (rad.x), degrees (rad.y), degrees (rad.z));\n" +"}\n" +"vec4 degrees (vec4 rad) {\n" +" return vec4 (degrees (rad.x), degrees (rad.y), degrees (rad.z), degrees (rad.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float sin (float angle) {\n" +" return 0.0;\n" +"}\n" +"vec2 sin (vec2 angle) {\n" +" return vec2 (sin (angle.x), sin (angle.y));\n" +"}\n" +"vec3 sin (vec3 angle) {\n" +" return vec3 (sin (angle.x), sin (angle.y), sin (angle.z));\n" +"}\n" +"vec4 sin (vec4 angle) {\n" +" return vec4 (sin (angle.x), sin (angle.y), sin (angle.z), sin (angle.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float cos (float angle) {\n" +" return sin (angle + 1.5708);\n" +"}\n" +"vec2 cos (vec2 angle) {\n" +" return vec2 (cos (angle.x), cos (angle.y));\n" +"}\n" +"vec3 cos (vec3 angle) {\n" +" return vec3 (cos (angle.x), cos (angle.y), cos (angle.z));\n" +"}\n" +"vec4 cos (vec4 angle) {\n" +" return vec4 (cos (angle.x), cos (angle.y), cos (angle.z), cos (angle.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float tan (float angle) {\n" +" return sin (angle) / cos (angle);\n" +"}\n" +"vec2 tan (vec2 angle) {\n" +" return vec2 (tan (angle.x), tan (angle.y));\n" +"}\n" +"vec3 tan (vec3 angle) {\n" +" return vec3 (tan (angle.x), tan (angle.y), tan (angle.z));\n" +"}\n" +"vec4 tan (vec4 angle) {\n" +" return vec4 (tan (angle.x), tan (angle.y), tan (angle.z), tan (angle.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float asin (float x) {\n" +" return 0.0;\n" +"}\n" +"vec2 asin (vec2 x) {\n" +" return vec2 (asin (x.x), asin (x.y));\n" +"}\n" +"vec3 asin (vec3 x) {\n" +" return vec3 (asin (x.x), asin (x.y), asin (x.z));\n" +"}\n" +"vec4 asin (vec4 x) {\n" +" return vec4 (asin (x.x), asin (x.y), asin (x.z), asin (x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float acos (float x) {\n" +" return 0.0;\n" +"}\n" +"vec2 acos (vec2 x) {\n" +" return vec2 (acos (x.x), acos (x.y));\n" +"}\n" +"vec3 acos (vec3 x) {\n" +" return vec3 (acos (x.x), acos (x.y), acos (x.z));\n" +"}\n" +"vec4 acos (vec4 x) {\n" +" return vec4 (acos (x.x), acos (x.y), acos (x.z), acos (x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float atan (float x, float y) {\n" +" return 0.0;\n" +"}\n" +"vec2 atan (vec2 x, vec2 y) {\n" +" return vec2 (atan (x.x, y.x), atan (x.y, y.y));\n" +"}\n" +"vec3 atan (vec3 x, vec3 y) {\n" +" return vec3 (atan (x.x, y.x), atan (x.y, y.y), atan (x.z, y.z));\n" +"}\n" +"vec4 atan (vec4 x, vec4 y) {\n" +" return vec4 (atan (x.x, y.x), atan (x.y, y.y), atan (x.z, y.z), atan (x.w, y.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float atan (float y_over_x) {\n" +" return 0.0;\n" +"}\n" +"vec2 atan (vec2 y_over_x) {\n" +" return vec2 (atan (y_over_x.x), atan (y_over_x.y));\n" +"}\n" +"vec3 atan (vec3 y_over_x) {\n" +" return vec3 (atan (y_over_x.x), atan (y_over_x.y), atan (y_over_x.z));\n" +"}\n" +"vec4 atan (vec4 y_over_x) {\n" +" return vec4 (atan (y_over_x.x), atan (y_over_x.y), atan (y_over_x.z), atan (y_over_x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float pow (float x, float y) {\n" +" return 0.0;\n" +"}\n" +"vec2 pow (vec2 x, vec2 y) {\n" +" return vec2 (pow (x.x, y.x), pow (x.y, y.y));\n" +"}\n" +"vec3 pow (vec3 x, vec3 y) {\n" +" return vec3 (pow (x.x, y.x), pow (x.y, y.y), pow (x.z, y.z));\n" +"}\n" +"vec4 pow (vec4 x, vec4 y) {\n" +" return vec4 (pow (x.x, y.x), pow (x.y, y.y), pow (x.z, y.z), pow (x.w, y.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float exp (float x) {\n" +" return pow (2.71828183, x);\n" +"}\n" +"vec2 exp (vec2 x) {\n" +" return vec2 (exp (x.x), exp (x.y));\n" +"}\n" +"vec3 exp (vec3 x) {\n" +" return vec3 (exp (x.x), exp (x.y), exp (x.z));\n" +"}\n" +"vec4 exp (vec4 x) {\n" +" return vec4 (exp (x.x), exp (x.y), exp (x.z), exp (x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float log (float x) {\n" +" return log2 (x) / log2 (2.71828183);\n" +"}\n" +"vec2 log (vec2 x) {\n" +" return vec2 (log (x.x), log (x.y));\n" +"}\n" +"vec3 log (vec3 x) {\n" +" return vec3 (log (x.x), log (x.y), log (x.z));\n" +"}\n" +"vec4 log (vec4 x) {\n" +" return vec4 (log (x.x), log (x.y), log (x.z), log (x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float exp2 (float x) {\n" +" return pow (2.0, x);\n" +"}\n" +"vec2 exp2 (vec2 x) {\n" +" return vec2 (exp2 (x.x), exp2 (x.y));\n" +"}\n" +"vec3 exp2 (vec3 x) {\n" +" return vec3 (exp2 (x.x), exp2 (x.y), exp2 (x.z));\n" +"}\n" +"vec4 exp2 (vec4 x) {\n" +" return vec4 (exp2 (x.x), exp2 (x.y), exp2 (x.z), exp2 (x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float log2 (float x) {\n" +" return 0.0;\n" +"}\n" +"vec2 log2 (vec2 x) {\n" +" return vec2 (log2 (x.x), log2 (x.y));\n" +"}\n" +"vec3 log2 (vec3 x) {\n" +" return vec3 (log2 (x.x), log2 (x.y), log2 (x.z));\n" +"}\n" +"vec4 log2 (vec4 x) {\n" +" return vec4 (log2 (x.x), log2 (x.y), log2 (x.z), log2 (x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float sqrt (float x) {\n" +" return pow (x, 0.5);\n" +"}\n" +"vec2 sqrt (vec2 x) {\n" +" return vec2 (sqrt (x.x), sqrt (x.y));\n" +"}\n" +"vec3 sqrt (vec3 x) {\n" +" return vec3 (sqrt (x.x), sqrt (x.y), sqrt (x.z));\n" +"}\n" +"vec4 sqrt (vec4 x) {\n" +" return vec4 (sqrt (x.x), sqrt (x.y), sqrt (x.z), sqrt (x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float inversesqrt (float x) {\n" +" return 1.0 / sqrt (x);\n" +"}\n" +"vec2 inversesqrt (vec2 x) {\n" +" return vec2 (inversesqrt (x.x), inversesqrt (x.y));\n" +"}\n" +"vec3 inversesqrt (vec3 x) {\n" +" return vec3 (inversesqrt (x.x), inversesqrt (x.y), inversesqrt (x.z));\n" +"}\n" +"vec4 inversesqrt (vec4 x) {\n" +" return vec4 (inversesqrt (x.x), inversesqrt (x.y), inversesqrt (x.z), inversesqrt (x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float abs (float x) {\n" +" return x >= 0.0 ? x : -x;\n" +"}\n" +"vec2 abs (vec2 x) {\n" +" return vec2 (abs (x.x), abs (x.y));\n" +"}\n" +"vec3 abs (vec3 x) {\n" +" return vec3 (abs (x.x), abs (x.y), abs (x.z));\n" +"}\n" +"vec4 abs (vec4 x) {\n" +" return vec4 (abs (x.x), abs (x.y), abs (x.z), abs (x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float sign (float x) {\n" +" return x > 0.0 ? 1.0 : x < 0.0 ? -1.0 : 0.0;\n" +"}\n" +"vec2 sign (vec2 x) {\n" +" return vec2 (sign (x.x), sign (x.y));\n" +"}\n" +"vec3 sign (vec3 x) {\n" +" return vec3 (sign (x.x), sign (x.y), sign (x.z));\n" +"}\n" +"vec4 sign (vec4 x) {\n" +" return vec4 (sign (x.x), sign (x.y), sign (x.z), sign (x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float floor (float x) {\n" +" return 0.0;\n" +"}\n" +"vec2 floor (vec2 x) {\n" +" return vec2 (floor (x.x), floor (x.y));\n" +"}\n" +"vec3 floor (vec3 x) {\n" +" return vec3 (floor (x.x), floor (x.y), floor (x.z));\n" +"}\n" +"vec4 floor (vec4 x) {\n" +" return vec4 (floor (x.x), floor (x.y), floor (x.z), floor (x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float ceil (float x) {\n" +" return 0.0;\n" +"}\n" +"vec2 ceil (vec2 x) {\n" +" return vec2 (ceil (x.x), ceil (x.y));\n" +"}\n" +"vec3 ceil (vec3 x) {\n" +" return vec3 (ceil (x.x), ceil (x.y), ceil (x.z));\n" +"}\n" +"vec4 ceil (vec4 x) {\n" +" return vec4 (ceil (x.x), ceil (x.y), ceil (x.z), ceil (x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float fract (float x) {\n" +" return x - floor (x);\n" +"}\n" +"vec2 fract (vec2 x) {\n" +" return vec2 (fract (x.x), fract (x.y));\n" +"}\n" +"vec3 fract (vec3 x) {\n" +" return vec3 (fract (x.x), fract (x.y), fract (x.z));\n" +"}\n" +"vec4 fract (vec4 x) {\n" +" return vec4 (fract (x.x), fract (x.y), fract (x.z), fract (x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float mod (float x, float y) {\n" +" return x - y * floor (x / y);\n" +"}\n" +"vec2 mod (vec2 x, float y) {\n" +" return vec2 (mod (x.x, y), mod (x.y, y));\n" +"}\n" +"vec3 mod (vec3 x, float y) {\n" +" return vec3 (mod (x.x, y), mod (x.y, y), mod (x.z, y));\n" +"}\n" +"vec4 mod (vec4 x, float y) {\n" +" return vec4 (mod (x.x, y), mod (x.y, y), mod (x.z, y), mod (x.w, y));\n" +"}\n" +"vec2 mod (vec2 x, vec2 y) {\n" +" return vec2 (mod (x.x, y.x), mod (x.y, y.y));\n" +"}\n" +"vec3 mod (vec3 x, vec3 y) {\n" +" return vec3 (mod (x.x, y.x), mod (x.y, y.y), mod (x.z, y.z));\n" +"}\n" +"vec4 mod (vec4 x, vec4 y) {\n" +" return vec4 (mod (x.x, y.x), mod (x.y, y.y), mod (x.z, y.z), mod (x.w, y.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float min (float x, float y) {\n" +" return y < x ? y : x;\n" +"}\n" +"vec2 min (vec2 x, float y) {\n" +" return vec2 (min (x.x, y), min (x.y, y));\n" +"}\n" +"vec3 min (vec3 x, float y) {\n" +" return vec3 (min (x.x, y), min (x.y, y), min (x.z, y));\n" +"}\n" +"vec4 min (vec4 x, float y) {\n" +" return vec4 (min (x.x, y), min (x.y, y), min (x.z, y), min (x.w, y));\n" +"}\n" +"vec2 min (vec2 x, vec2 y) {\n" +" return vec2 (min (x.x, y.x), min (x.y, y.y));\n" +"}\n" +"vec3 min (vec3 x, vec3 y) {\n" +" return vec3 (min (x.x, y.x), min (x.y, y.y), min (x.z, y.z));\n" +"}\n" +"vec4 min (vec4 x, vec4 y) {\n" +" return vec4 (min (x.x, y.x), min (x.y, y.y), min (x.z, y.z), min (x.w, y.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float max (float x, float y) {\n" +" return min (y, x);\n" +"}\n" +"vec2 max (vec2 x, float y) {\n" +" return vec2 (max (x.x, y), max (x.y, y));\n" +"}\n" +"vec3 max (vec3 x, float y) {\n" +" return vec3 (max (x.x, y), max (x.y, y), max (x.z, y));\n" +"}\n" +"vec4 max (vec4 x, float y) {\n" +" return vec4 (max (x.x, y), max (x.y, y), max (x.z, y), max (x.w, y));\n" +"}\n" +"vec2 max (vec2 x, vec2 y) {\n" +" return vec2 (max (x.x, y.x), max (x.y, y.y));\n" +"}\n" +"vec3 max (vec3 x, vec3 y) {\n" +" return vec3 (max (x.x, y.x), max (x.y, y.y), max (x.z, y.z));\n" +"}\n" +"vec4 max (vec4 x, vec4 y) {\n" +" return vec4 (max (x.x, y.x), max (x.y, y.y), max (x.z, y.z), max (x.w, y.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float clamp (float x, float minVal, float maxVal) {\n" +" return min (max (x, minVal), maxVal);\n" +"}\n" +"vec2 clamp (vec2 x, float minVal, float maxVal) {\n" +" return vec2 (clamp (x.x, minVal, maxVal), clamp (x.y, minVal, maxVal));\n" +"}\n" +"vec3 clamp (vec3 x, float minVal, float maxVal) {\n" +" return vec3 (clamp (x.x, minVal, maxVal), clamp (x.y, minVal, maxVal),\n" +" clamp (x.z, minVal, maxVal));\n" +"}\n" +"vec4 clamp (vec4 x, float minVal, float maxVal) {\n" +" return vec4 (clamp (x.x, minVal, maxVal), clamp (x.y, minVal, maxVal),\n" +" clamp (x.z, minVal, maxVal), clamp (x.w, minVal, maxVal));\n" +"}\n" +"vec2 clamp (vec2 x, vec2 minVal, vec2 maxVal) {\n" +" return vec2 (clamp (x.x, minVal.x, maxVal.x), clamp (x.y, minVal.y, maxVal.y));\n" +"}\n" +"vec3 clamp (vec3 x, vec3 minVal, vec3 maxVal) {\n" +" return vec3 (clamp (x.x, minVal.x, maxVal.x), clamp (x.y, minVal.y, maxVal.y),\n" +" clamp (x.z, minVal.z, maxVal.z));\n" +"}\n" +"vec4 clamp (vec4 x, vec4 minVal, vec4 maxVal) {\n" +" return vec4 (clamp (x.x, minVal.x, maxVal.y), clamp (x.y, minVal.y, maxVal.y),\n" +" clamp (x.z, minVal.z, maxVal.z), clamp (x.w, minVal.w, maxVal.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float mix (float x, float y, float a) {\n" +" return x * (1.0 - a) + y * a;\n" +"}\n" +"vec2 mix (vec2 x, vec2 y, float a) {\n" +" return vec2 (mix (x.x, y.x, a), mix (x.y, y.y, a));\n" +"}\n" +"vec3 mix (vec3 x, vec3 y, float a) {\n" +" return vec3 (mix (x.x, y.x, a), mix (x.y, y.y, a), mix (x.z, y.z, a));\n" +"}\n" +"vec4 mix (vec4 x, vec4 y, float a) {\n" +" return vec4 (mix (x.x, y.x, a), mix (x.y, y.y, a), mix (x.z, y.z, a), mix (x.w, y.w, a));\n" +"}\n" +"vec2 mix (vec2 x, vec2 y, vec2 a) {\n" +" return vec2 (mix (x.x, y.x, a.x), mix (x.y, y.y, a.y));\n" +"}\n" +"vec3 mix (vec3 x, vec3 y, vec3 a) {\n" +" return vec3 (mix (x.x, y.x, a.x), mix (x.y, y.y, a.y), mix (x.z, y.z, a.z));\n" +"}\n" +"vec4 mix (vec4 x, vec4 y, vec4 a) {\n" +" return vec4 (mix (x.x, y.x, a.x), mix (x.y, y.y, a.y), mix (x.z, y.z, a.z),\n" +" mix (x.w, y.w, a.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float step (float edge, float x) {\n" +" return x < edge ? 0.0 : 1.0;\n" +"}\n" +"vec2 step (float edge, vec2 x) {\n" +" return vec2 (step (edge, x.x), step (edge, x.y));\n" +"}\n" +"vec3 step (float edge, vec3 x) {\n" +" return vec3 (step (edge, x.x), step (edge, x.y), step (edge, x.z));\n" +"}\n" +"vec4 step (float edge, vec4 x) {\n" +" return vec4 (step (edge, x.x), step (edge, x.y), step (edge, x.z), step (edge, x.w));\n" +"}\n" +"vec2 step (vec2 edge, vec2 x) {\n" +" return vec2 (step (edge.x, x.x), step (edge.y, x.y));\n" +"}\n" +"vec3 step (vec3 edge, vec3 x) {\n" +" return vec3 (step (edge.x, x.x), step (edge.y, x.y), step (edge.z, x.z));\n" +"}\n" +"vec4 step (vec4 edge, vec4 x) {\n" +" return vec4 (step (edge.x, x.x), step (edge.y, x.y), step (edge.z, x.z), step (edge.w, x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float smoothstep (float edge0, float edge1, float x) {\n" +" const float t = clamp ((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n" +" return t * t * (3.0 - 2.0 * t);\n" +"}\n" +"vec2 smoothstep (float edge0, float edge1, vec2 x) {\n" +" return vec2 (smoothstep (edge0, edge1, x.x), smoothstep (edge0, edge1, x.y));\n" +"}\n" +"vec3 smoothstep (float edge0, float edge1, vec3 x) {\n" +" return vec3 (smoothstep (edge0, edge1, x.x), smoothstep (edge0, edge1, x.y),\n" +" smoothstep (edge0, edge1, x.z));\n" +"}\n" +"vec4 smoothstep (float edge0, float edge1, vec4 x) {\n" +" return vec4 (smoothstep (edge0, edge1, x.x), smoothstep (edge0, edge1, x.y),\n" +" smoothstep (edge0, edge1, x.z), smoothstep (edge0, edge1, x.w));\n" +"}\n" +"vec2 smoothstep (vec2 edge0, vec2 edge1, vec2 x) {\n" +" return vec2 (smoothstep (edge0.x, edge1.x, x.x), smoothstep (edge0.y, edge1.y, x.y));\n" +"}\n" +"vec3 smoothstep (vec3 edge0, vec3 edge1, vec3 x) {\n" +" return vec3 (smoothstep (edge0.x, edge1.x, x.x), smoothstep (edge0.y, edge1.y, x.y),\n" +" smoothstep (edge0.z, edge1.z, x.z));\n" +"}\n" +"vec4 smoothstep (vec4 edge0, vec4 edge1, vec4 x) {\n" +" return vec4 (smoothstep (edge0.x, edge1.x, x.x), smoothstep (edge0.y, edge1.y, x.y),\n" +" smoothstep (edge0.z, edge1.z, x.z), smoothstep (edge0.w, edge1.w, x.w));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float dot (float x, float y) {\n" +" return x * y;\n" +"}\n" +"float dot (vec2 x, vec2 y) {\n" +" return dot (x.x, y.x) + dot (x.y, y.y);\n" +"}\n" +"float dot (vec3 x, vec3 y) {\n" +" return dot (x.x, y.x) + dot (x.y, y.y) + dot (x.z, y.z);\n" +"}\n" +"float dot (vec4 x, vec4 y) {\n" +" return dot (x.x, y.x) + dot (x.y, y.y) + dot (x.z, y.z) + dot (x.w, y.w);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float length (float x) {\n" +" return sqrt (dot (x, x));\n" +"}\n" +"float length (vec2 x) {\n" +" return sqrt (dot (x, x));\n" +"}\n" +"float length (vec3 x) {\n" +" return sqrt (dot (x, x));\n" +"}\n" +"float length (vec4 x) {\n" +" return sqrt (dot (x, x));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float distance (float x, float y) {\n" +" return length (x - y);\n" +"}\n" +"float distance (vec2 x, vec2 y) {\n" +" return length (x - y);\n" +"}\n" +"float distance (vec3 x, vec3 y) {\n" +" return length (x - y);\n" +"}\n" +"float distance (vec4 x, vec4 y) {\n" +" return length (x - y);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec3 cross (vec3 x, vec3 y) {\n" +" return vec3 (x.y * y.z - y.y * x.z, x.z * y.x - y.z * x.x, x.x * y.y - y.x * x.y);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float normalize (float x) {\n" +" return 1.0;\n" +"}\n" +"vec2 normalize (vec2 x) {\n" +" return x / length (x);\n" +"}\n" +"vec3 normalize (vec3 x) {\n" +" return x / length (x);\n" +"}\n" +"vec4 normalize (vec4 x) {\n" +" return x / length (x);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float faceforward (float N, float I, float Nref) {\n" +" return dot (Nref, I) < 0.0 ? N : -N;\n" +"}\n" +"vec2 faceforward (vec2 N, vec2 I, vec2 Nref) {\n" +" return dot (Nref, I) < 0.0 ? N : -N;\n" +"}\n" +"vec3 faceforward (vec3 N, vec3 I, vec3 Nref) {\n" +" return dot (Nref, I) < 0.0 ? N : -N;\n" +"}\n" +"vec4 faceforward (vec4 N, vec4 I, vec4 Nref) {\n" +" return dot (Nref, I) < 0.0 ? N : -N;\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float reflect (float I, float N) {\n" +" return I - 2.0 * dot (N, I) * N;\n" +"}\n" +"vec2 reflect (vec2 I, vec2 N) {\n" +" return I - 2.0 * dot (N, I) * N;\n" +"}\n" +"vec3 reflect (vec3 I, vec3 N) {\n" +" return I - 2.0 * dot (N, I) * N;\n" +"}\n" +"vec4 reflect (vec4 I, vec4 N) {\n" +" return I - 2.0 * dot (N, I) * N;\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float refract (float I, float N, float eta) {\n" +" const float k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));\n" +" if (k < 0.0)\n" +" return 0.0;\n" +" return eta * I - (eta * dot (N, I) + sqrt (k)) * N;\n" +"}\n" +"vec2 refract (vec2 I, vec2 N, float eta) {\n" +" const float k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));\n" +" if (k < 0.0)\n" +" return vec2 (0.0);\n" +" return eta * I - (eta * dot (N, I) + sqrt (k)) * N;\n" +"}\n" +"vec3 refract (vec3 I, vec3 N, float eta) {\n" +" const float k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));\n" +" if (k < 0.0)\n" +" return vec3 (0.0);\n" +" return eta * I - (eta * dot (N, I) + sqrt (k)) * N;\n" +"}\n" +"vec4 refract (vec4 I, vec4 N, float eta) {\n" +" const float k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));\n" +" if (k < 0.0)\n" +" return vec4 (0.0);\n" +" return eta * I - (eta * dot (N, I) + sqrt (k)) * N;\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"mat2 matrixCompMult (mat2 x, mat2 y) {\n" +" return mat2 (\n" +" x[0].x * y[0].x, x[0].y * y[0].y,\n" +" x[1].x * y[1].x, x[1].y * y[1].y\n" +" );\n" +"}\n" +"mat3 matrixCompMult (mat3 x, mat3 y) {\n" +" return mat4 (\n" +" x[0].x * y[0].x, x[0].y * y[0].y, x[0].z * y[0].z,\n" +" x[1].x * y[1].x, x[1].y * y[1].y, x[1].z * y[1].z,\n" +" x[2].x * y[2].x, x[2].y * y[2].y, x[2].z * y[2].z\n" +" );\n" +"}\n" +"mat4 matrixCompMult (mat4 x, mat4 y) {\n" +" return mat4 (\n" +" x[0].x * y[0].x, x[0].y * y[0].y, x[0].z * y[0].z + x[0].w * y[0].w,\n" +" x[1].x * y[1].x, x[1].y * y[1].y, x[1].z * y[1].z + x[1].w * y[1].w,\n" +" x[2].x * y[2].x, x[2].y * y[2].y, x[2].z * y[2].z + x[2].w * y[2].w,\n" +" x[3].x * y[3].x, x[3].y * y[3].y, x[3].z * y[3].z + x[3].w * y[3].w\n" +" );\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"bvec2 lessThan (vec2 x, vec2 y) {\n" +" return bvec2 (x.x < y.x, x.y < y.y);\n" +"}\n" +"bvec3 lessThan (vec3 x, vec3 y) {\n" +" return bvec3 (x.x < y.x, x.y < y.y, x.z < y.z);\n" +"}\n" +"bvec4 lessThan (vec4 x, vec4 y) {\n" +" return bvec4 (x.x < y.x, x.y < y.y, x.z < y.z, x.w < y.w);\n" +"}\n" +"bvec2 lessThan (ivec2 x, ivec2 y) {\n" +" return bvec2 (x.x < y.x, x.y < y.y);\n" +"}\n" +"bvec3 lessThan (ivec3 x, ivec3 y) {\n" +" return bvec3 (x.x < y.x, x.y < y.y, x.z < y.z);\n" +"}\n" +"bvec4 lessThan (ivec4 x, ivec4 y) {\n" +" return bvec4 (x.x < y.x, x.y < y.y, x.z < y.z, x.w < y.w);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"bvec2 lessThanEqual (vec2 x, vec2 y) {\n" +" return bvec2 (x.x <= y.x, x.y <= y.y);\n" +"}\n" +"bvec3 lessThanEqual (vec3 x, vec3 y) {\n" +" return bvec3 (x.x <= y.x, x.y <= y.y, x.z <= y.z);\n" +"}\n" +"bvec4 lessThanEqual (vec4 x, vec4 y) {\n" +" return bvec4 (x.x <= y.x, x.y <= y.y, x.z <= y.z, x.w <= y.w);\n" +"}\n" +"bvec2 lessThanEqual (ivec2 x, ivec2 y) {\n" +" return bvec2 (x.x <= y.x, x.y <= y.y);\n" +"}\n" +"bvec3 lessThanEqual (ivec3 x, ivec3 y) {\n" +" return bvec3 (x.x <= y.x, x.y <= y.y, x.z <= y.z);\n" +"}\n" +"bvec4 lessThanEqual (ivec4 x, ivec4 y) {\n" +" return bvec4 (x.x <= y.x, x.y <= y.y, x.z <= y.z, x.w <= y.w);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"bvec2 greaterThan (vec2 x, vec2 y) {\n" +" return bvec2 (x.x > y.x, x.y > y.y);\n" +"}\n" +"bvec3 greaterThan (vec3 x, vec3 y) {\n" +" return bvec3 (x.x > y.x, x.y > y.y, x.z > y.z);\n" +"}\n" +"bvec4 greaterThan (vec4 x, vec4 y) {\n" +" return bvec4 (x.x > y.x, x.y > y.y, x.z > y.z, x.w > y.w);\n" +"}\n" +"bvec2 greaterThan (ivec2 x, ivec2 y) {\n" +" return bvec2 (x.x > y.x, x.y > y.y);\n" +"}\n" +"bvec3 greaterThan (ivec3 x, ivec3 y) {\n" +" return bvec3 (x.x > y.x, x.y > y.y, x.z > y.z);\n" +"}\n" +"bvec4 greaterThan (ivec4 x, ivec4 y) {\n" +" return bvec4 (x.x > y.x, x.y > y.y, x.z > y.z, x.w > y.w);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"bvec2 greaterThanEqual (vec2 x, vec2 y) {\n" +" return bvec2 (x.x >= y.x, x.y >= y.y);\n" +"}\n" +"bvec3 greaterThanEqual (vec3 x, vec3 y) {\n" +" return bvec3 (x.x >= y.x, x.y >= y.y, x.z >= y.z);\n" +"}\n" +"bvec4 greaterThanEqual (vec4 x, vec4 y) {\n" +" return bvec4 (x.x >= y.x, x.y >= y.y, x.z >= y.z, x.w >= y.w);\n" +"}\n" +"bvec2 greaterThanEqual (ivec2 x, ivec2 y) {\n" +" return bvec2 (x.x >= y.x, x.y >= y.y);\n" +"}\n" +"bvec3 greaterThanEqual (ivec3 x, ivec3 y) {\n" +" return bvec3 (x.x >= y.x, x.y >= y.y, x.z >= y.z);\n" +"}\n" +"bvec4 greaterThanEqual (ivec4 x, ivec4 y) {\n" +" return bvec4 (x.x >= y.x, x.y >= y.y, x.z >= y.z, x.w >= y.w);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"bvec2 equal (vec2 x, vec2 y) {\n" +" return bvec2 (x.x == y.x, x.y == y.y);\n" +"}\n" +"bvec3 equal (vec3 x, vec3 y) {\n" +" return bvec3 (x.x == y.x, x.y == y.y, x.z == y.z);\n" +"}\n" +"bvec4 equal (vec4 x, vec4 y) {\n" +" return bvec4 (x.x == y.x, x.y == y.y, x.z == y.z, x.w == y.w);\n" +"}\n" +"bvec2 equal (ivec2 x, ivec2 y) {\n" +" return bvec2 (x.x == y.x, x.y == y.y);\n" +"}\n" +"bvec3 equal (ivec3 x, ivec3 y) {\n" +" return bvec3 (x.x == y.x, x.y == y.y, x.z == y.z);\n" +"}\n" +"bvec4 equal (ivec4 x, ivec4 y) {\n" +" return bvec4 (x.x == y.x, x.y == y.y, x.z == y.z, x.w == y.w);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"bvec2 notEqual (vec2 x, vec2 y) {\n" +" return bvec2 (x.x != y.x, x.y != y.y);\n" +"}\n" +"bvec3 notEqual (vec3 x, vec3 y) {\n" +" return bvec3 (x.x != y.x, x.y != y.y, x.z != y.z);\n" +"}\n" +"bvec4 notEqual (vec4 x, vec4 y) {\n" +" return bvec4 (x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);\n" +"}\n" +"bvec2 notEqual (ivec2 x, ivec2 y) {\n" +" return bvec2 (x.x != y.x, x.y != y.y);\n" +"}\n" +"bvec3 notEqual (ivec3 x, ivec3 y) {\n" +" return bvec3 (x.x != y.x, x.y != y.y, x.z != y.z);\n" +"}\n" +"bvec4 notEqual (ivec4 x, ivec4 y) {\n" +" return bvec4 (x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"bool any (bvec2 x) {\n" +" return x.x || x.y;\n" +"}\n" +"bool any (bvec3 x) {\n" +" return x.x || x.y || x.z;\n" +"}\n" +"bool any (bvec4 x) {\n" +" return x.x || x.y || x.z || x.w;\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"bool all (bvec2 x) {\n" +" return x.x && x.y;\n" +"}\n" +"bool all (bvec3 x) {\n" +" return x.x && x.y && x.z;\n" +"}\n" +"bool all (bvec4 x) {\n" +" return x.x && x.y && x.z && x.w;\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"bvec2 not (bvec2 x) {\n" +" return bvec2 (!x.x, !x.y);\n" +"}\n" +"bvec3 not (bvec3 x) {\n" +" return bvec3 (!x.x, !x.y, !x.z);\n" +"}\n" +"bvec4 not (bvec4 x) {\n" +" return bvec4 (!x.x, !x.y, !x.z, !x.w);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 texture1D (sampler1D sampler, float coord) {\n" +" return vec4 (0.0);\n" +"}\n" +"vec4 texture1DProj (sampler1D sampler, vec2 coord) {\n" +" return texture1D (sampler, coord.s / coord.t);\n" +"}\n" +"vec4 texture1DProj (sampler1D sampler, vec4 coord) {\n" +" return texture1D (sampler, coord.s / coord.q);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 texture2D (sampler2D sampler, vec2 coord) {\n" +" return vec4 (0.0);\n" +"}\n" +"vec4 texture2DProj (sampler2D sampler, vec3 coord) {\n" +" return texture2D (sampler, vec2 (coord.s / coord.p, coord.t / coord.p));\n" +"}\n" +"vec4 texture2DProj (sampler2D sampler, vec4 coord) {\n" +" return texture2D (sampler, vec2 (coord.s / coord.q, coord.t / coord.q));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 texture3D (sampler3D sampler, vec3 coord) {\n" +" return vec4 (0.0);\n" +"}\n" +"vec4 texture3DProj (sampler3D sampler, vec4 coord) {\n" +" return texture3D (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 textureCube (samplerCube sampler, vec3 coord) {\n" +" return vec4 (0.0);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 shadow1D (sampler1DShadow sampler, vec3 coord) {\n" +" return vec4 (0.0);\n" +"}\n" +"\n" +"vec4 shadow2D (sampler2DShadow sampler, vec3 coord) {\n" +" return vec4 (0.0);\n" +"}\n" +"vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord) {\n" +" return shadow1D (sampler, vec3 (coord.s / coord.q, 0.0, coord.p / coord.q));\n" +"}\n" +"vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord) {\n" +" return shadow2D (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q));\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float noise1 (float x) {\n" +" return 0.0;\n" +"}\n" +"\n" +"float noise1 (vec2 x) {\n" +" return 0.0;\n" +"}\n" +"\n" +"float noise1 (vec3 x) {\n" +" return 0.0;\n" +"}\n" +"\n" +"float noise1 (vec4 x) {\n" +" return 0.0;\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec2 noise2 (float x) {\n" +" return vec2 (0.0);\n" +"}\n" +"\n" +"vec2 noise2 (vec2 x) {\n" +" return vec2 (0.0);\n" +"}\n" +"\n" +"vec2 noise2 (vec3 x) {\n" +" return vec2 (0.0);\n" +"}\n" +"\n" +"vec2 noise2 (vec4 x) {\n" +" return vec2 (0.0);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec3 noise3 (float x) {\n" +" return vec3 (0.0);\n" +"}\n" +"\n" +"vec3 noise3 (vec2 x) {\n" +" return vec3 (0.0);\n" +"}\n" +"\n" +"vec3 noise3 (vec3 x) {\n" +" return vec3 (0.0);\n" +"}\n" +"\n" +"vec3 noise3 (vec4 x) {\n" +" return vec3 (0.0);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 noise4 (float x) {\n" +" return vec4 (0.0);\n" +"}\n" +"\n" +"vec4 noise4 (vec2 x) {\n" +" return vec4 (0.0);\n" +"}\n" +"\n" +"vec4 noise4 (vec3 x) {\n" +" return vec4 (0.0);\n" +"}\n" +"\n" +"vec4 noise4 (vec4 x) {\n" +" return vec4 (0.0);\n" +"}\n" +"\n" diff --git a/reactos/dll/mesa32/src/shader/slang/library/slang_common_builtin_gc_bin.h b/reactos/dll/mesa32/src/shader/slang/library/slang_common_builtin_gc_bin.h new file mode 100755 index 00000000000..971229a920b --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/library/slang_common_builtin_gc_bin.h @@ -0,0 +1,943 @@ +2,2,2,1,5,1,103,108,95,77,97,120,76,105,103,104,116,115,0,2,16,10,56,0, +0,0,2,2,1,5,1,103,108,95,77,97,120,67,108,105,112,80,108,97,110,101,115,0, +2,16,10,54,0,0,0,2,2,1,5,1,103,108,95,77,97,120,84,101,120,116,117,114, +101,85,110,105,116,115,0,2,16,10,50,0,0,0,2,2,1,5,1,103,108,95,77,97, +120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,2,16,10,50,0,0,0,2,2, +1,5,1,103,108,95,77,97,120,86,101,114,116,101,120,65,116,116,114,105,98,115,0,2, +16,10,49,54,0,0,0,2,2,1,5,1,103,108,95,77,97,120,86,101,114,116,101,120, +85,110,105,102,111,114,109,67,111,109,112,111,110,101,110,116,115,0,2,16,10,53,49,50, +0,0,0,2,2,1,5,1,103,108,95,77,97,120,86,97,114,121,105,110,103,70,108,111, +97,116,115,0,2,16,10,51,50,0,0,0,2,2,1,5,1,103,108,95,77,97,120,86, +101,114,116,101,120,84,101,120,116,117,114,101,73,109,97,103,101,85,110,105,116,115,0,2, +16,8,48,0,0,0,2,2,1,5,1,103,108,95,77,97,120,67,111,109,98,105,110,101, +100,84,101,120,116,117,114,101,73,109,97,103,101,85,110,105,116,115,0,2,16,10,50,0, +0,0,2,2,1,5,1,103,108,95,77,97,120,84,101,120,116,117,114,101,73,109,97,103, +101,85,110,105,116,115,0,2,16,10,50,0,0,0,2,2,1,5,1,103,108,95,77,97, +120,70,114,97,103,109,101,110,116,85,110,105,102,111,114,109,67,111,109,112,111,110,101,110, +116,115,0,2,16,10,54,52,0,0,0,2,2,1,5,1,103,108,95,77,97,120,68,114, +97,119,66,117,102,102,101,114,115,0,2,16,10,49,0,0,0,2,2,4,15,1,103,108, +95,77,111,100,101,108,86,105,101,119,77,97,116,114,105,120,0,0,0,2,2,4,15,1, +103,108,95,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,0,0,0,2,2, +4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101,99,116,105,111, +110,77,97,116,114,105,120,0,0,0,2,2,4,15,1,103,108,95,84,101,120,116,117,114, +101,77,97,116,114,105,120,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67, +111,111,114,100,115,0,0,0,2,2,4,14,1,103,108,95,78,111,114,109,97,108,77,97, +116,114,105,120,0,0,0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119, +77,97,116,114,105,120,73,110,118,101,114,115,101,0,0,0,2,2,4,15,1,103,108,95, +80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,73,110,118,101,114,115,101,0, +0,0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101, +99,116,105,111,110,77,97,116,114,105,120,73,110,118,101,114,115,101,0,0,0,2,2,4, +15,1,103,108,95,84,101,120,116,117,114,101,77,97,116,114,105,120,73,110,118,101,114,115, +101,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0, +0,0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,77,97,116,114,105, +120,84,114,97,110,115,112,111,115,101,0,0,0,2,2,4,15,1,103,108,95,80,114,111, +106,101,99,116,105,111,110,77,97,116,114,105,120,84,114,97,110,115,112,111,115,101,0,0, +0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101,99, +116,105,111,110,77,97,116,114,105,120,84,114,97,110,115,112,111,115,101,0,0,0,2,2, +4,15,1,103,108,95,84,101,120,116,117,114,101,77,97,116,114,105,120,84,114,97,110,115, +112,111,115,101,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114, +100,115,0,0,0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,77,97, +116,114,105,120,73,110,118,101,114,115,101,84,114,97,110,115,112,111,115,101,0,0,0,2, +2,4,15,1,103,108,95,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,73, +110,118,101,114,115,101,84,114,97,110,115,112,111,115,101,0,0,0,2,2,4,15,1,103, +108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101,99,116,105,111,110,77,97,116, +114,105,120,73,110,118,101,114,115,101,84,114,97,110,115,112,111,115,101,0,0,0,2,2, +4,15,1,103,108,95,84,101,120,116,117,114,101,77,97,116,114,105,120,73,110,118,101,114, +115,101,84,114,97,110,115,112,111,115,101,0,3,18,103,108,95,77,97,120,84,101,120,116, +117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,9,1,103,108,95,78,111,114,109, +97,108,83,99,97,108,101,0,0,0,2,2,0,22,103,108,95,68,101,112,116,104,82,97, +110,103,101,80,97,114,97,109,101,116,101,114,115,0,9,110,101,97,114,0,0,0,1,9, +102,97,114,0,0,0,1,9,100,105,102,102,0,0,0,0,0,0,2,2,4,23,103,108, +95,68,101,112,116,104,82,97,110,103,101,80,97,114,97,109,101,116,101,114,115,0,1,103, +108,95,68,101,112,116,104,82,97,110,103,101,0,0,0,2,2,4,12,1,103,108,95,67, +108,105,112,80,108,97,110,101,0,3,18,103,108,95,77,97,120,67,108,105,112,80,108,97, +110,101,115,0,0,0,2,2,0,22,103,108,95,80,111,105,110,116,80,97,114,97,109,101, +116,101,114,115,0,9,115,105,122,101,0,0,0,1,9,115,105,122,101,77,105,110,0,0, +0,1,9,115,105,122,101,77,97,120,0,0,0,1,9,102,97,100,101,84,104,114,101,115, +104,111,108,100,83,105,122,101,0,0,0,1,9,100,105,115,116,97,110,99,101,67,111,110, +115,116,97,110,116,65,116,116,101,110,117,97,116,105,111,110,0,0,0,1,9,100,105,115, +116,97,110,99,101,76,105,110,101,97,114,65,116,116,101,110,117,97,116,105,111,110,0,0, +0,1,9,100,105,115,116,97,110,99,101,81,117,97,100,114,97,116,105,99,65,116,116,101, +110,117,97,116,105,111,110,0,0,0,0,0,0,2,2,4,23,103,108,95,80,111,105,110, +116,80,97,114,97,109,101,116,101,114,115,0,1,103,108,95,80,111,105,110,116,0,0,0, +2,2,0,22,103,108,95,77,97,116,101,114,105,97,108,80,97,114,97,109,101,116,101,114, +115,0,12,101,109,105,115,115,105,111,110,0,0,0,1,12,97,109,98,105,101,110,116,0, +0,0,1,12,100,105,102,102,117,115,101,0,0,0,1,12,115,112,101,99,117,108,97,114, +0,0,0,1,9,115,104,105,110,105,110,101,115,115,0,0,0,0,0,0,2,2,4,23, +103,108,95,77,97,116,101,114,105,97,108,80,97,114,97,109,101,116,101,114,115,0,1,103, +108,95,70,114,111,110,116,77,97,116,101,114,105,97,108,0,0,0,2,2,4,23,103,108, +95,77,97,116,101,114,105,97,108,80,97,114,97,109,101,116,101,114,115,0,1,103,108,95, +66,97,99,107,77,97,116,101,114,105,97,108,0,0,0,2,2,0,22,103,108,95,76,105, +103,104,116,83,111,117,114,99,101,80,97,114,97,109,101,116,101,114,115,0,12,97,109,98, +105,101,110,116,0,0,0,1,12,100,105,102,102,117,115,101,0,0,0,1,12,115,112,101, +99,117,108,97,114,0,0,0,1,12,112,111,115,105,116,105,111,110,0,0,0,1,12,104, +97,108,102,86,101,99,116,111,114,0,0,0,1,11,115,112,111,116,68,105,114,101,99,116, +105,111,110,0,0,0,1,9,115,112,111,116,69,120,112,111,110,101,110,116,0,0,0,1, +9,115,112,111,116,67,117,116,111,102,102,0,0,0,1,9,115,112,111,116,67,111,115,67, +117,116,111,102,102,0,0,0,1,9,99,111,110,115,116,97,110,116,65,116,116,101,110,117, +97,116,105,111,110,0,0,0,1,9,108,105,110,101,97,114,65,116,116,101,110,117,97,116, +105,111,110,0,0,0,1,9,113,117,97,100,114,97,116,105,99,65,116,116,101,110,117,97, +116,105,111,110,0,0,0,0,0,0,2,2,4,23,103,108,95,76,105,103,104,116,83,111, +117,114,99,101,80,97,114,97,109,101,116,101,114,115,0,1,103,108,95,76,105,103,104,116, +83,111,117,114,99,101,0,3,18,103,108,95,77,97,120,76,105,103,104,116,115,0,0,0, +2,2,0,22,103,108,95,76,105,103,104,116,77,111,100,101,108,80,97,114,97,109,101,116, +101,114,115,0,12,97,109,98,105,101,110,116,0,0,0,0,0,0,2,2,4,23,103,108, +95,76,105,103,104,116,77,111,100,101,108,80,97,114,97,109,101,116,101,114,115,0,1,103, +108,95,76,105,103,104,116,77,111,100,101,108,0,0,0,2,2,0,22,103,108,95,76,105, +103,104,116,77,111,100,101,108,80,114,111,100,117,99,116,115,0,12,115,99,101,110,101,67, +111,108,111,114,0,0,0,0,0,0,2,2,4,23,103,108,95,76,105,103,104,116,77,111, +100,101,108,80,114,111,100,117,99,116,115,0,1,103,108,95,70,114,111,110,116,76,105,103, +104,116,77,111,100,101,108,80,114,111,100,117,99,116,0,0,0,2,2,4,23,103,108,95, +76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99,116,115,0,1,103,108,95,66, +97,99,107,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99,116,0,0,0,2, +2,0,22,103,108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,12,97,109,98, +105,101,110,116,0,0,0,1,12,100,105,102,102,117,115,101,0,0,0,1,12,115,112,101, +99,117,108,97,114,0,0,0,0,0,0,2,2,4,23,103,108,95,76,105,103,104,116,80, +114,111,100,117,99,116,115,0,1,103,108,95,70,114,111,110,116,76,105,103,104,116,80,114, +111,100,117,99,116,0,3,18,103,108,95,77,97,120,76,105,103,104,116,115,0,0,0,2, +2,4,23,103,108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,1,103,108,95, +66,97,99,107,76,105,103,104,116,80,114,111,100,117,99,116,0,3,18,103,108,95,77,97, +120,76,105,103,104,116,115,0,0,0,2,2,4,12,1,103,108,95,84,101,120,116,117,114, +101,69,110,118,67,111,108,111,114,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114, +101,73,109,97,103,101,85,110,105,116,115,0,0,0,2,2,4,12,1,103,108,95,69,121, +101,80,108,97,110,101,83,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67, +111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,69,121,101,80,108,97,110,101, +84,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0, +0,0,2,2,4,12,1,103,108,95,69,121,101,80,108,97,110,101,82,0,3,18,103,108, +95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,12, +1,103,108,95,69,121,101,80,108,97,110,101,81,0,3,18,103,108,95,77,97,120,84,101, +120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,79,98, +106,101,99,116,80,108,97,110,101,83,0,3,18,103,108,95,77,97,120,84,101,120,116,117, +114,101,67,111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,79,98,106,101,99, +116,80,108,97,110,101,84,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67, +111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,79,98,106,101,99,116,80,108, +97,110,101,82,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114, +100,115,0,0,0,2,2,4,12,1,103,108,95,79,98,106,101,99,116,80,108,97,110,101, +81,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0, +0,0,2,2,0,22,103,108,95,70,111,103,80,97,114,97,109,101,116,101,114,115,0,12, +99,111,108,111,114,0,0,0,1,9,100,101,110,115,105,116,121,0,0,0,1,9,115,116, +97,114,116,0,0,0,1,9,101,110,100,0,0,0,1,9,115,99,97,108,101,0,0,0, +0,0,0,2,2,4,23,103,108,95,70,111,103,80,97,114,97,109,101,116,101,114,115,0, +1,103,108,95,70,111,103,0,0,0,1,0,9,0,114,97,100,105,97,110,115,0,1,0, +0,9,100,101,103,0,0,0,1,8,17,51,0,49,52,49,53,57,51,0,0,18,100,101, +103,0,48,17,49,56,48,0,48,0,0,49,0,0,1,0,10,0,114,97,100,105,97,110, +115,0,1,0,0,10,100,101,103,0,0,0,1,8,58,118,101,99,50,0,58,114,97,100, +105,97,110,115,0,18,100,101,103,0,59,120,0,0,0,0,58,114,97,100,105,97,110,115, +0,18,100,101,103,0,59,121,0,0,0,0,0,0,0,1,0,11,0,114,97,100,105,97, +110,115,0,1,0,0,11,100,101,103,0,0,0,1,8,58,118,101,99,51,0,58,114,97, +100,105,97,110,115,0,18,100,101,103,0,59,120,0,0,0,0,58,114,97,100,105,97,110, +115,0,18,100,101,103,0,59,121,0,0,0,0,58,114,97,100,105,97,110,115,0,18,100, +101,103,0,59,122,0,0,0,0,0,0,0,1,0,12,0,114,97,100,105,97,110,115,0, +1,0,0,12,100,101,103,0,0,0,1,8,58,118,101,99,52,0,58,114,97,100,105,97, +110,115,0,18,100,101,103,0,59,120,0,0,0,0,58,114,97,100,105,97,110,115,0,18, +100,101,103,0,59,121,0,0,0,0,58,114,97,100,105,97,110,115,0,18,100,101,103,0, +59,122,0,0,0,0,58,114,97,100,105,97,110,115,0,18,100,101,103,0,59,119,0,0, +0,0,0,0,0,1,0,9,0,100,101,103,114,101,101,115,0,1,0,0,9,114,97,100, +0,0,0,1,8,17,49,56,48,0,48,0,0,18,114,97,100,0,48,17,51,0,49,52, +49,53,57,51,0,0,49,0,0,1,0,10,0,100,101,103,114,101,101,115,0,1,0,0, +10,114,97,100,0,0,0,1,8,58,118,101,99,50,0,58,100,101,103,114,101,101,115,0, +18,114,97,100,0,59,120,0,0,0,0,58,100,101,103,114,101,101,115,0,18,114,97,100, +0,59,121,0,0,0,0,0,0,0,1,0,11,0,100,101,103,114,101,101,115,0,1,0, +0,11,114,97,100,0,0,0,1,8,58,118,101,99,51,0,58,100,101,103,114,101,101,115, +0,18,114,97,100,0,59,120,0,0,0,0,58,100,101,103,114,101,101,115,0,18,114,97, +100,0,59,121,0,0,0,0,58,100,101,103,114,101,101,115,0,18,114,97,100,0,59,122, +0,0,0,0,0,0,0,1,0,12,0,100,101,103,114,101,101,115,0,1,0,0,12,114, +97,100,0,0,0,1,8,58,118,101,99,52,0,58,100,101,103,114,101,101,115,0,18,114, +97,100,0,59,120,0,0,0,0,58,100,101,103,114,101,101,115,0,18,114,97,100,0,59, +121,0,0,0,0,58,100,101,103,114,101,101,115,0,18,114,97,100,0,59,122,0,0,0, +0,58,100,101,103,114,101,101,115,0,18,114,97,100,0,59,119,0,0,0,0,0,0,0, +1,0,9,0,115,105,110,0,1,0,0,9,97,110,103,108,101,0,0,0,1,8,17,48, +0,48,0,0,0,0,1,0,10,0,115,105,110,0,1,0,0,10,97,110,103,108,101,0, +0,0,1,8,58,118,101,99,50,0,58,115,105,110,0,18,97,110,103,108,101,0,59,120, +0,0,0,0,58,115,105,110,0,18,97,110,103,108,101,0,59,121,0,0,0,0,0,0, +0,1,0,11,0,115,105,110,0,1,0,0,11,97,110,103,108,101,0,0,0,1,8,58, +118,101,99,51,0,58,115,105,110,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58, +115,105,110,0,18,97,110,103,108,101,0,59,121,0,0,0,0,58,115,105,110,0,18,97, +110,103,108,101,0,59,122,0,0,0,0,0,0,0,1,0,12,0,115,105,110,0,1,0, +0,12,97,110,103,108,101,0,0,0,1,8,58,118,101,99,52,0,58,115,105,110,0,18, +97,110,103,108,101,0,59,120,0,0,0,0,58,115,105,110,0,18,97,110,103,108,101,0, +59,121,0,0,0,0,58,115,105,110,0,18,97,110,103,108,101,0,59,122,0,0,0,0, +58,115,105,110,0,18,97,110,103,108,101,0,59,119,0,0,0,0,0,0,0,1,0,9, +0,99,111,115,0,1,0,0,9,97,110,103,108,101,0,0,0,1,8,58,115,105,110,0, +18,97,110,103,108,101,0,17,49,0,53,55,48,56,0,0,46,0,0,0,0,1,0,10, +0,99,111,115,0,1,0,0,10,97,110,103,108,101,0,0,0,1,8,58,118,101,99,50, +0,58,99,111,115,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58,99,111,115,0, +18,97,110,103,108,101,0,59,121,0,0,0,0,0,0,0,1,0,11,0,99,111,115,0, +1,0,0,11,97,110,103,108,101,0,0,0,1,8,58,118,101,99,51,0,58,99,111,115, +0,18,97,110,103,108,101,0,59,120,0,0,0,0,58,99,111,115,0,18,97,110,103,108, +101,0,59,121,0,0,0,0,58,99,111,115,0,18,97,110,103,108,101,0,59,122,0,0, +0,0,0,0,0,1,0,12,0,99,111,115,0,1,0,0,12,97,110,103,108,101,0,0, +0,1,8,58,118,101,99,52,0,58,99,111,115,0,18,97,110,103,108,101,0,59,120,0, +0,0,0,58,99,111,115,0,18,97,110,103,108,101,0,59,121,0,0,0,0,58,99,111, +115,0,18,97,110,103,108,101,0,59,122,0,0,0,0,58,99,111,115,0,18,97,110,103, +108,101,0,59,119,0,0,0,0,0,0,0,1,0,9,0,116,97,110,0,1,0,0,9, +97,110,103,108,101,0,0,0,1,8,58,115,105,110,0,18,97,110,103,108,101,0,0,0, +58,99,111,115,0,18,97,110,103,108,101,0,0,0,49,0,0,1,0,10,0,116,97,110, +0,1,0,0,10,97,110,103,108,101,0,0,0,1,8,58,118,101,99,50,0,58,116,97, +110,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58,116,97,110,0,18,97,110,103, +108,101,0,59,121,0,0,0,0,0,0,0,1,0,11,0,116,97,110,0,1,0,0,11, +97,110,103,108,101,0,0,0,1,8,58,118,101,99,51,0,58,116,97,110,0,18,97,110, +103,108,101,0,59,120,0,0,0,0,58,116,97,110,0,18,97,110,103,108,101,0,59,121, +0,0,0,0,58,116,97,110,0,18,97,110,103,108,101,0,59,122,0,0,0,0,0,0, +0,1,0,12,0,116,97,110,0,1,0,0,12,97,110,103,108,101,0,0,0,1,8,58, +118,101,99,52,0,58,116,97,110,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58, +116,97,110,0,18,97,110,103,108,101,0,59,121,0,0,0,0,58,116,97,110,0,18,97, +110,103,108,101,0,59,122,0,0,0,0,58,116,97,110,0,18,97,110,103,108,101,0,59, +119,0,0,0,0,0,0,0,1,0,9,0,97,115,105,110,0,1,0,0,9,120,0,0, +0,1,8,17,48,0,48,0,0,0,0,1,0,10,0,97,115,105,110,0,1,0,0,10, +120,0,0,0,1,8,58,118,101,99,50,0,58,97,115,105,110,0,18,120,0,59,120,0, +0,0,0,58,97,115,105,110,0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11, +0,97,115,105,110,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,97, +115,105,110,0,18,120,0,59,120,0,0,0,0,58,97,115,105,110,0,18,120,0,59,121, +0,0,0,0,58,97,115,105,110,0,18,120,0,59,122,0,0,0,0,0,0,0,1,0, +12,0,97,115,105,110,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,58, +97,115,105,110,0,18,120,0,59,120,0,0,0,0,58,97,115,105,110,0,18,120,0,59, +121,0,0,0,0,58,97,115,105,110,0,18,120,0,59,122,0,0,0,0,58,97,115,105, +110,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0,97,99,111,115,0,1, +0,0,9,120,0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,10,0,97,99,111, +115,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,97,99,111,115,0, +18,120,0,59,120,0,0,0,0,58,97,99,111,115,0,18,120,0,59,121,0,0,0,0, +0,0,0,1,0,11,0,97,99,111,115,0,1,0,0,11,120,0,0,0,1,8,58,118, +101,99,51,0,58,97,99,111,115,0,18,120,0,59,120,0,0,0,0,58,97,99,111,115, +0,18,120,0,59,121,0,0,0,0,58,97,99,111,115,0,18,120,0,59,122,0,0,0, +0,0,0,0,1,0,12,0,97,99,111,115,0,1,0,0,12,120,0,0,0,1,8,58, +118,101,99,52,0,58,97,99,111,115,0,18,120,0,59,120,0,0,0,0,58,97,99,111, +115,0,18,120,0,59,121,0,0,0,0,58,97,99,111,115,0,18,120,0,59,122,0,0, +0,0,58,97,99,111,115,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0, +97,116,97,110,0,1,0,0,9,120,0,0,1,0,0,9,121,0,0,0,1,8,17,48, +0,48,0,0,0,0,1,0,10,0,97,116,97,110,0,1,0,0,10,120,0,0,1,0, +0,10,121,0,0,0,1,8,58,118,101,99,50,0,58,97,116,97,110,0,18,120,0,59, +120,0,0,18,121,0,59,120,0,0,0,0,58,97,116,97,110,0,18,120,0,59,121,0, +0,18,121,0,59,121,0,0,0,0,0,0,0,1,0,11,0,97,116,97,110,0,1,0, +0,11,120,0,0,1,0,0,11,121,0,0,0,1,8,58,118,101,99,51,0,58,97,116, +97,110,0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,0,0,58,97,116,97,110, +0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,0,0,58,97,116,97,110,0,18, +120,0,59,122,0,0,18,121,0,59,122,0,0,0,0,0,0,0,1,0,12,0,97,116, +97,110,0,1,0,0,12,120,0,0,1,0,0,12,121,0,0,0,1,8,58,118,101,99, +52,0,58,97,116,97,110,0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,0,0, +58,97,116,97,110,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,0,0,58,97, +116,97,110,0,18,120,0,59,122,0,0,18,121,0,59,122,0,0,0,0,58,97,116,97, +110,0,18,120,0,59,119,0,0,18,121,0,59,119,0,0,0,0,0,0,0,1,0,9, +0,97,116,97,110,0,1,0,0,9,121,95,111,118,101,114,95,120,0,0,0,1,8,17, +48,0,48,0,0,0,0,1,0,10,0,97,116,97,110,0,1,0,0,10,121,95,111,118, +101,114,95,120,0,0,0,1,8,58,118,101,99,50,0,58,97,116,97,110,0,18,121,95, +111,118,101,114,95,120,0,59,120,0,0,0,0,58,97,116,97,110,0,18,121,95,111,118, +101,114,95,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,97,116,97,110,0,1, +0,0,11,121,95,111,118,101,114,95,120,0,0,0,1,8,58,118,101,99,51,0,58,97, +116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,120,0,0,0,0,58,97,116,97, +110,0,18,121,95,111,118,101,114,95,120,0,59,121,0,0,0,0,58,97,116,97,110,0, +18,121,95,111,118,101,114,95,120,0,59,122,0,0,0,0,0,0,0,1,0,12,0,97, +116,97,110,0,1,0,0,12,121,95,111,118,101,114,95,120,0,0,0,1,8,58,118,101, +99,52,0,58,97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,120,0,0,0, +0,58,97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,121,0,0,0,0,58, +97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,122,0,0,0,0,58,97,116, +97,110,0,18,121,95,111,118,101,114,95,120,0,59,119,0,0,0,0,0,0,0,1,0, +9,0,112,111,119,0,1,0,0,9,120,0,0,1,0,0,9,121,0,0,0,1,8,17, +48,0,48,0,0,0,0,1,0,10,0,112,111,119,0,1,0,0,10,120,0,0,1,0, +0,10,121,0,0,0,1,8,58,118,101,99,50,0,58,112,111,119,0,18,120,0,59,120, +0,0,18,121,0,59,120,0,0,0,0,58,112,111,119,0,18,120,0,59,121,0,0,18, +121,0,59,121,0,0,0,0,0,0,0,1,0,11,0,112,111,119,0,1,0,0,11,120, +0,0,1,0,0,11,121,0,0,0,1,8,58,118,101,99,51,0,58,112,111,119,0,18, +120,0,59,120,0,0,18,121,0,59,120,0,0,0,0,58,112,111,119,0,18,120,0,59, +121,0,0,18,121,0,59,121,0,0,0,0,58,112,111,119,0,18,120,0,59,122,0,0, +18,121,0,59,122,0,0,0,0,0,0,0,1,0,12,0,112,111,119,0,1,0,0,12, +120,0,0,1,0,0,12,121,0,0,0,1,8,58,118,101,99,52,0,58,112,111,119,0, +18,120,0,59,120,0,0,18,121,0,59,120,0,0,0,0,58,112,111,119,0,18,120,0, +59,121,0,0,18,121,0,59,121,0,0,0,0,58,112,111,119,0,18,120,0,59,122,0, +0,18,121,0,59,122,0,0,0,0,58,112,111,119,0,18,120,0,59,119,0,0,18,121, +0,59,119,0,0,0,0,0,0,0,1,0,9,0,101,120,112,0,1,0,0,9,120,0, +0,0,1,8,58,112,111,119,0,17,50,0,55,49,56,50,56,49,56,51,0,0,0,18, +120,0,0,0,0,0,1,0,10,0,101,120,112,0,1,0,0,10,120,0,0,0,1,8, +58,118,101,99,50,0,58,101,120,112,0,18,120,0,59,120,0,0,0,0,58,101,120,112, +0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,101,120,112,0,1,0,0, +11,120,0,0,0,1,8,58,118,101,99,51,0,58,101,120,112,0,18,120,0,59,120,0, +0,0,0,58,101,120,112,0,18,120,0,59,121,0,0,0,0,58,101,120,112,0,18,120, +0,59,122,0,0,0,0,0,0,0,1,0,12,0,101,120,112,0,1,0,0,12,120,0, +0,0,1,8,58,118,101,99,52,0,58,101,120,112,0,18,120,0,59,120,0,0,0,0, +58,101,120,112,0,18,120,0,59,121,0,0,0,0,58,101,120,112,0,18,120,0,59,122, +0,0,0,0,58,101,120,112,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9, +0,108,111,103,0,1,0,0,9,120,0,0,0,1,8,58,108,111,103,50,0,18,120,0, +0,0,58,108,111,103,50,0,17,50,0,55,49,56,50,56,49,56,51,0,0,0,0,49, +0,0,1,0,10,0,108,111,103,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99, +50,0,58,108,111,103,0,18,120,0,59,120,0,0,0,0,58,108,111,103,0,18,120,0, +59,121,0,0,0,0,0,0,0,1,0,11,0,108,111,103,0,1,0,0,11,120,0,0, +0,1,8,58,118,101,99,51,0,58,108,111,103,0,18,120,0,59,120,0,0,0,0,58, +108,111,103,0,18,120,0,59,121,0,0,0,0,58,108,111,103,0,18,120,0,59,122,0, +0,0,0,0,0,0,1,0,12,0,108,111,103,0,1,0,0,12,120,0,0,0,1,8, +58,118,101,99,52,0,58,108,111,103,0,18,120,0,59,120,0,0,0,0,58,108,111,103, +0,18,120,0,59,121,0,0,0,0,58,108,111,103,0,18,120,0,59,122,0,0,0,0, +58,108,111,103,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0,101,120,112, +50,0,1,0,0,9,120,0,0,0,1,8,58,112,111,119,0,17,50,0,48,0,0,0, +18,120,0,0,0,0,0,1,0,10,0,101,120,112,50,0,1,0,0,10,120,0,0,0, +1,8,58,118,101,99,50,0,58,101,120,112,50,0,18,120,0,59,120,0,0,0,0,58, +101,120,112,50,0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,101,120,112, +50,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,101,120,112,50,0, +18,120,0,59,120,0,0,0,0,58,101,120,112,50,0,18,120,0,59,121,0,0,0,0, +58,101,120,112,50,0,18,120,0,59,122,0,0,0,0,0,0,0,1,0,12,0,101,120, +112,50,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,58,101,120,112,50, +0,18,120,0,59,120,0,0,0,0,58,101,120,112,50,0,18,120,0,59,121,0,0,0, +0,58,101,120,112,50,0,18,120,0,59,122,0,0,0,0,58,101,120,112,50,0,18,120, +0,59,119,0,0,0,0,0,0,0,1,0,9,0,108,111,103,50,0,1,0,0,9,120, +0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,10,0,108,111,103,50,0,1,0, +0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,108,111,103,50,0,18,120,0,59, +120,0,0,0,0,58,108,111,103,50,0,18,120,0,59,121,0,0,0,0,0,0,0,1, +0,11,0,108,111,103,50,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0, +58,108,111,103,50,0,18,120,0,59,120,0,0,0,0,58,108,111,103,50,0,18,120,0, +59,121,0,0,0,0,58,108,111,103,50,0,18,120,0,59,122,0,0,0,0,0,0,0, +1,0,12,0,108,111,103,50,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52, +0,58,108,111,103,50,0,18,120,0,59,120,0,0,0,0,58,108,111,103,50,0,18,120, +0,59,121,0,0,0,0,58,108,111,103,50,0,18,120,0,59,122,0,0,0,0,58,108, +111,103,50,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0,115,113,114,116, +0,1,0,0,9,120,0,0,0,1,8,58,112,111,119,0,18,120,0,0,17,48,0,53, +0,0,0,0,0,0,1,0,10,0,115,113,114,116,0,1,0,0,10,120,0,0,0,1, +8,58,118,101,99,50,0,58,115,113,114,116,0,18,120,0,59,120,0,0,0,0,58,115, +113,114,116,0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,115,113,114,116, +0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,115,113,114,116,0,18, +120,0,59,120,0,0,0,0,58,115,113,114,116,0,18,120,0,59,121,0,0,0,0,58, +115,113,114,116,0,18,120,0,59,122,0,0,0,0,0,0,0,1,0,12,0,115,113,114, +116,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,58,115,113,114,116,0, +18,120,0,59,120,0,0,0,0,58,115,113,114,116,0,18,120,0,59,121,0,0,0,0, +58,115,113,114,116,0,18,120,0,59,122,0,0,0,0,58,115,113,114,116,0,18,120,0, +59,119,0,0,0,0,0,0,0,1,0,9,0,105,110,118,101,114,115,101,115,113,114,116, +0,1,0,0,9,120,0,0,0,1,8,17,49,0,48,0,0,58,115,113,114,116,0,18, +120,0,0,0,49,0,0,1,0,10,0,105,110,118,101,114,115,101,115,113,114,116,0,1, +0,0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,105,110,118,101,114,115,101,115, +113,114,116,0,18,120,0,59,120,0,0,0,0,58,105,110,118,101,114,115,101,115,113,114, +116,0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,105,110,118,101,114,115, +101,115,113,114,116,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,105, +110,118,101,114,115,101,115,113,114,116,0,18,120,0,59,120,0,0,0,0,58,105,110,118, +101,114,115,101,115,113,114,116,0,18,120,0,59,121,0,0,0,0,58,105,110,118,101,114, +115,101,115,113,114,116,0,18,120,0,59,122,0,0,0,0,0,0,0,1,0,12,0,105, +110,118,101,114,115,101,115,113,114,116,0,1,0,0,12,120,0,0,0,1,8,58,118,101, +99,52,0,58,105,110,118,101,114,115,101,115,113,114,116,0,18,120,0,59,120,0,0,0, +0,58,105,110,118,101,114,115,101,115,113,114,116,0,18,120,0,59,121,0,0,0,0,58, +105,110,118,101,114,115,101,115,113,114,116,0,18,120,0,59,122,0,0,0,0,58,105,110, +118,101,114,115,101,115,113,114,116,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0, +9,0,97,98,115,0,1,0,0,9,120,0,0,0,1,8,18,120,0,17,48,0,48,0, +0,43,18,120,0,18,120,0,54,31,0,0,1,0,10,0,97,98,115,0,1,0,0,10, +120,0,0,0,1,8,58,118,101,99,50,0,58,97,98,115,0,18,120,0,59,120,0,0, +0,0,58,97,98,115,0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,97, +98,115,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,97,98,115,0, +18,120,0,59,120,0,0,0,0,58,97,98,115,0,18,120,0,59,121,0,0,0,0,58, +97,98,115,0,18,120,0,59,122,0,0,0,0,0,0,0,1,0,12,0,97,98,115,0, +1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,58,97,98,115,0,18,120,0, +59,120,0,0,0,0,58,97,98,115,0,18,120,0,59,121,0,0,0,0,58,97,98,115, +0,18,120,0,59,122,0,0,0,0,58,97,98,115,0,18,120,0,59,119,0,0,0,0, +0,0,0,1,0,9,0,115,105,103,110,0,1,0,0,9,120,0,0,0,1,8,18,120, +0,17,48,0,48,0,0,41,17,49,0,48,0,0,18,120,0,17,48,0,48,0,0,40, +17,49,0,48,0,0,54,17,48,0,48,0,0,31,31,0,0,1,0,10,0,115,105,103, +110,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,115,105,103,110,0, +18,120,0,59,120,0,0,0,0,58,115,105,103,110,0,18,120,0,59,121,0,0,0,0, +0,0,0,1,0,11,0,115,105,103,110,0,1,0,0,11,120,0,0,0,1,8,58,118, +101,99,51,0,58,115,105,103,110,0,18,120,0,59,120,0,0,0,0,58,115,105,103,110, +0,18,120,0,59,121,0,0,0,0,58,115,105,103,110,0,18,120,0,59,122,0,0,0, +0,0,0,0,1,0,12,0,115,105,103,110,0,1,0,0,12,120,0,0,0,1,8,58, +118,101,99,52,0,58,115,105,103,110,0,18,120,0,59,120,0,0,0,0,58,115,105,103, +110,0,18,120,0,59,121,0,0,0,0,58,115,105,103,110,0,18,120,0,59,122,0,0, +0,0,58,115,105,103,110,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0, +102,108,111,111,114,0,1,0,0,9,120,0,0,0,1,8,17,48,0,48,0,0,0,0, +1,0,10,0,102,108,111,111,114,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99, +50,0,58,102,108,111,111,114,0,18,120,0,59,120,0,0,0,0,58,102,108,111,111,114, +0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,102,108,111,111,114,0,1, +0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,102,108,111,111,114,0,18,120, +0,59,120,0,0,0,0,58,102,108,111,111,114,0,18,120,0,59,121,0,0,0,0,58, +102,108,111,111,114,0,18,120,0,59,122,0,0,0,0,0,0,0,1,0,12,0,102,108, +111,111,114,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,58,102,108,111, +111,114,0,18,120,0,59,120,0,0,0,0,58,102,108,111,111,114,0,18,120,0,59,121, +0,0,0,0,58,102,108,111,111,114,0,18,120,0,59,122,0,0,0,0,58,102,108,111, +111,114,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0,99,101,105,108,0, +1,0,0,9,120,0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,10,0,99,101, +105,108,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,99,101,105,108, +0,18,120,0,59,120,0,0,0,0,58,99,101,105,108,0,18,120,0,59,121,0,0,0, +0,0,0,0,1,0,11,0,99,101,105,108,0,1,0,0,11,120,0,0,0,1,8,58, +118,101,99,51,0,58,99,101,105,108,0,18,120,0,59,120,0,0,0,0,58,99,101,105, +108,0,18,120,0,59,121,0,0,0,0,58,99,101,105,108,0,18,120,0,59,122,0,0, +0,0,0,0,0,1,0,12,0,99,101,105,108,0,1,0,0,12,120,0,0,0,1,8, +58,118,101,99,52,0,58,99,101,105,108,0,18,120,0,59,120,0,0,0,0,58,99,101, +105,108,0,18,120,0,59,121,0,0,0,0,58,99,101,105,108,0,18,120,0,59,122,0, +0,0,0,58,99,101,105,108,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9, +0,102,114,97,99,116,0,1,0,0,9,120,0,0,0,1,8,18,120,0,58,102,108,111, +111,114,0,18,120,0,0,0,47,0,0,1,0,10,0,102,114,97,99,116,0,1,0,0, +10,120,0,0,0,1,8,58,118,101,99,50,0,58,102,114,97,99,116,0,18,120,0,59, +120,0,0,0,0,58,102,114,97,99,116,0,18,120,0,59,121,0,0,0,0,0,0,0, +1,0,11,0,102,114,97,99,116,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99, +51,0,58,102,114,97,99,116,0,18,120,0,59,120,0,0,0,0,58,102,114,97,99,116, +0,18,120,0,59,121,0,0,0,0,58,102,114,97,99,116,0,18,120,0,59,122,0,0, +0,0,0,0,0,1,0,12,0,102,114,97,99,116,0,1,0,0,12,120,0,0,0,1, +8,58,118,101,99,52,0,58,102,114,97,99,116,0,18,120,0,59,120,0,0,0,0,58, +102,114,97,99,116,0,18,120,0,59,121,0,0,0,0,58,102,114,97,99,116,0,18,120, +0,59,122,0,0,0,0,58,102,114,97,99,116,0,18,120,0,59,119,0,0,0,0,0, +0,0,1,0,9,0,109,111,100,0,1,0,0,9,120,0,0,1,0,0,9,121,0,0, +0,1,8,18,120,0,18,121,0,58,102,108,111,111,114,0,18,120,0,18,121,0,49,0, +0,48,47,0,0,1,0,10,0,109,111,100,0,1,0,0,10,120,0,0,1,0,0,9, +121,0,0,0,1,8,58,118,101,99,50,0,58,109,111,100,0,18,120,0,59,120,0,0, +18,121,0,0,0,0,58,109,111,100,0,18,120,0,59,121,0,0,18,121,0,0,0,0, +0,0,0,1,0,11,0,109,111,100,0,1,0,0,11,120,0,0,1,0,0,9,121,0, +0,0,1,8,58,118,101,99,51,0,58,109,111,100,0,18,120,0,59,120,0,0,18,121, +0,0,0,0,58,109,111,100,0,18,120,0,59,121,0,0,18,121,0,0,0,0,58,109, +111,100,0,18,120,0,59,122,0,0,18,121,0,0,0,0,0,0,0,1,0,12,0,109, +111,100,0,1,0,0,12,120,0,0,1,0,0,9,121,0,0,0,1,8,58,118,101,99, +52,0,58,109,111,100,0,18,120,0,59,120,0,0,18,121,0,0,0,0,58,109,111,100, +0,18,120,0,59,121,0,0,18,121,0,0,0,0,58,109,111,100,0,18,120,0,59,122, +0,0,18,121,0,0,0,0,58,109,111,100,0,18,120,0,59,119,0,0,18,121,0,0, +0,0,0,0,0,1,0,10,0,109,111,100,0,1,0,0,10,120,0,0,1,0,0,10, +121,0,0,0,1,8,58,118,101,99,50,0,58,109,111,100,0,18,120,0,59,120,0,0, +18,121,0,59,120,0,0,0,0,58,109,111,100,0,18,120,0,59,121,0,0,18,121,0, +59,121,0,0,0,0,0,0,0,1,0,11,0,109,111,100,0,1,0,0,11,120,0,0, +1,0,0,11,121,0,0,0,1,8,58,118,101,99,51,0,58,109,111,100,0,18,120,0, +59,120,0,0,18,121,0,59,120,0,0,0,0,58,109,111,100,0,18,120,0,59,121,0, +0,18,121,0,59,121,0,0,0,0,58,109,111,100,0,18,120,0,59,122,0,0,18,121, +0,59,122,0,0,0,0,0,0,0,1,0,12,0,109,111,100,0,1,0,0,12,120,0, +0,1,0,0,12,121,0,0,0,1,8,58,118,101,99,52,0,58,109,111,100,0,18,120, +0,59,120,0,0,18,121,0,59,120,0,0,0,0,58,109,111,100,0,18,120,0,59,121, +0,0,18,121,0,59,121,0,0,0,0,58,109,111,100,0,18,120,0,59,122,0,0,18, +121,0,59,122,0,0,0,0,58,109,111,100,0,18,120,0,59,119,0,0,18,121,0,59, +119,0,0,0,0,0,0,0,1,0,9,0,109,105,110,0,1,0,0,9,120,0,0,1, +0,0,9,121,0,0,0,1,8,18,121,0,18,120,0,40,18,121,0,18,120,0,31,0, +0,1,0,10,0,109,105,110,0,1,0,0,10,120,0,0,1,0,0,9,121,0,0,0, +1,8,58,118,101,99,50,0,58,109,105,110,0,18,120,0,59,120,0,0,18,121,0,0, +0,0,58,109,105,110,0,18,120,0,59,121,0,0,18,121,0,0,0,0,0,0,0,1, +0,11,0,109,105,110,0,1,0,0,11,120,0,0,1,0,0,9,121,0,0,0,1,8, +58,118,101,99,51,0,58,109,105,110,0,18,120,0,59,120,0,0,18,121,0,0,0,0, +58,109,105,110,0,18,120,0,59,121,0,0,18,121,0,0,0,0,58,109,105,110,0,18, +120,0,59,122,0,0,18,121,0,0,0,0,0,0,0,1,0,12,0,109,105,110,0,1, +0,0,12,120,0,0,1,0,0,9,121,0,0,0,1,8,58,118,101,99,52,0,58,109, +105,110,0,18,120,0,59,120,0,0,18,121,0,0,0,0,58,109,105,110,0,18,120,0, +59,121,0,0,18,121,0,0,0,0,58,109,105,110,0,18,120,0,59,122,0,0,18,121, +0,0,0,0,58,109,105,110,0,18,120,0,59,119,0,0,18,121,0,0,0,0,0,0, +0,1,0,10,0,109,105,110,0,1,0,0,10,120,0,0,1,0,0,10,121,0,0,0, +1,8,58,118,101,99,50,0,58,109,105,110,0,18,120,0,59,120,0,0,18,121,0,59, +120,0,0,0,0,58,109,105,110,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0, +0,0,0,0,0,1,0,11,0,109,105,110,0,1,0,0,11,120,0,0,1,0,0,11, +121,0,0,0,1,8,58,118,101,99,51,0,58,109,105,110,0,18,120,0,59,120,0,0, +18,121,0,59,120,0,0,0,0,58,109,105,110,0,18,120,0,59,121,0,0,18,121,0, +59,121,0,0,0,0,58,109,105,110,0,18,120,0,59,122,0,0,18,121,0,59,122,0, +0,0,0,0,0,0,1,0,12,0,109,105,110,0,1,0,0,12,120,0,0,1,0,0, +12,121,0,0,0,1,8,58,118,101,99,52,0,58,109,105,110,0,18,120,0,59,120,0, +0,18,121,0,59,120,0,0,0,0,58,109,105,110,0,18,120,0,59,121,0,0,18,121, +0,59,121,0,0,0,0,58,109,105,110,0,18,120,0,59,122,0,0,18,121,0,59,122, +0,0,0,0,58,109,105,110,0,18,120,0,59,119,0,0,18,121,0,59,119,0,0,0, +0,0,0,0,1,0,9,0,109,97,120,0,1,0,0,9,120,0,0,1,0,0,9,121, +0,0,0,1,8,58,109,105,110,0,18,121,0,0,18,120,0,0,0,0,0,1,0,10, +0,109,97,120,0,1,0,0,10,120,0,0,1,0,0,9,121,0,0,0,1,8,58,118, +101,99,50,0,58,109,97,120,0,18,120,0,59,120,0,0,18,121,0,0,0,0,58,109, +97,120,0,18,120,0,59,121,0,0,18,121,0,0,0,0,0,0,0,1,0,11,0,109, +97,120,0,1,0,0,11,120,0,0,1,0,0,9,121,0,0,0,1,8,58,118,101,99, +51,0,58,109,97,120,0,18,120,0,59,120,0,0,18,121,0,0,0,0,58,109,97,120, +0,18,120,0,59,121,0,0,18,121,0,0,0,0,58,109,97,120,0,18,120,0,59,122, +0,0,18,121,0,0,0,0,0,0,0,1,0,12,0,109,97,120,0,1,0,0,12,120, +0,0,1,0,0,9,121,0,0,0,1,8,58,118,101,99,52,0,58,109,97,120,0,18, +120,0,59,120,0,0,18,121,0,0,0,0,58,109,97,120,0,18,120,0,59,121,0,0, +18,121,0,0,0,0,58,109,97,120,0,18,120,0,59,122,0,0,18,121,0,0,0,0, +58,109,97,120,0,18,120,0,59,119,0,0,18,121,0,0,0,0,0,0,0,1,0,10, +0,109,97,120,0,1,0,0,10,120,0,0,1,0,0,10,121,0,0,0,1,8,58,118, +101,99,50,0,58,109,97,120,0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,0, +0,58,109,97,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,0,0,0,0, +0,1,0,11,0,109,97,120,0,1,0,0,11,120,0,0,1,0,0,11,121,0,0,0, +1,8,58,118,101,99,51,0,58,109,97,120,0,18,120,0,59,120,0,0,18,121,0,59, +120,0,0,0,0,58,109,97,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0, +0,0,58,109,97,120,0,18,120,0,59,122,0,0,18,121,0,59,122,0,0,0,0,0, +0,0,1,0,12,0,109,97,120,0,1,0,0,12,120,0,0,1,0,0,12,121,0,0, +0,1,8,58,118,101,99,52,0,58,109,97,120,0,18,120,0,59,120,0,0,18,121,0, +59,120,0,0,0,0,58,109,97,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0, +0,0,0,58,109,97,120,0,18,120,0,59,122,0,0,18,121,0,59,122,0,0,0,0, +58,109,97,120,0,18,120,0,59,119,0,0,18,121,0,59,119,0,0,0,0,0,0,0, +1,0,9,0,99,108,97,109,112,0,1,0,0,9,120,0,0,1,0,0,9,109,105,110, +86,97,108,0,0,1,0,0,9,109,97,120,86,97,108,0,0,0,1,8,58,109,105,110, +0,58,109,97,120,0,18,120,0,0,18,109,105,110,86,97,108,0,0,0,0,18,109,97, +120,86,97,108,0,0,0,0,0,1,0,10,0,99,108,97,109,112,0,1,0,0,10,120, +0,0,1,0,0,9,109,105,110,86,97,108,0,0,1,0,0,9,109,97,120,86,97,108, +0,0,0,1,8,58,118,101,99,50,0,58,99,108,97,109,112,0,18,120,0,59,120,0, +0,18,109,105,110,86,97,108,0,0,18,109,97,120,86,97,108,0,0,0,0,58,99,108, +97,109,112,0,18,120,0,59,121,0,0,18,109,105,110,86,97,108,0,0,18,109,97,120, +86,97,108,0,0,0,0,0,0,0,1,0,11,0,99,108,97,109,112,0,1,0,0,11, +120,0,0,1,0,0,9,109,105,110,86,97,108,0,0,1,0,0,9,109,97,120,86,97, +108,0,0,0,1,8,58,118,101,99,51,0,58,99,108,97,109,112,0,18,120,0,59,120, +0,0,18,109,105,110,86,97,108,0,0,18,109,97,120,86,97,108,0,0,0,0,58,99, +108,97,109,112,0,18,120,0,59,121,0,0,18,109,105,110,86,97,108,0,0,18,109,97, +120,86,97,108,0,0,0,0,58,99,108,97,109,112,0,18,120,0,59,122,0,0,18,109, +105,110,86,97,108,0,0,18,109,97,120,86,97,108,0,0,0,0,0,0,0,1,0,12, +0,99,108,97,109,112,0,1,0,0,12,120,0,0,1,0,0,9,109,105,110,86,97,108, +0,0,1,0,0,9,109,97,120,86,97,108,0,0,0,1,8,58,118,101,99,52,0,58, +99,108,97,109,112,0,18,120,0,59,120,0,0,18,109,105,110,86,97,108,0,0,18,109, +97,120,86,97,108,0,0,0,0,58,99,108,97,109,112,0,18,120,0,59,121,0,0,18, +109,105,110,86,97,108,0,0,18,109,97,120,86,97,108,0,0,0,0,58,99,108,97,109, +112,0,18,120,0,59,122,0,0,18,109,105,110,86,97,108,0,0,18,109,97,120,86,97, +108,0,0,0,0,58,99,108,97,109,112,0,18,120,0,59,119,0,0,18,109,105,110,86, +97,108,0,0,18,109,97,120,86,97,108,0,0,0,0,0,0,0,1,0,10,0,99,108, +97,109,112,0,1,0,0,10,120,0,0,1,0,0,10,109,105,110,86,97,108,0,0,1, +0,0,10,109,97,120,86,97,108,0,0,0,1,8,58,118,101,99,50,0,58,99,108,97, +109,112,0,18,120,0,59,120,0,0,18,109,105,110,86,97,108,0,59,120,0,0,18,109, +97,120,86,97,108,0,59,120,0,0,0,0,58,99,108,97,109,112,0,18,120,0,59,121, +0,0,18,109,105,110,86,97,108,0,59,121,0,0,18,109,97,120,86,97,108,0,59,121, +0,0,0,0,0,0,0,1,0,11,0,99,108,97,109,112,0,1,0,0,11,120,0,0, +1,0,0,11,109,105,110,86,97,108,0,0,1,0,0,11,109,97,120,86,97,108,0,0, +0,1,8,58,118,101,99,51,0,58,99,108,97,109,112,0,18,120,0,59,120,0,0,18, +109,105,110,86,97,108,0,59,120,0,0,18,109,97,120,86,97,108,0,59,120,0,0,0, +0,58,99,108,97,109,112,0,18,120,0,59,121,0,0,18,109,105,110,86,97,108,0,59, +121,0,0,18,109,97,120,86,97,108,0,59,121,0,0,0,0,58,99,108,97,109,112,0, +18,120,0,59,122,0,0,18,109,105,110,86,97,108,0,59,122,0,0,18,109,97,120,86, +97,108,0,59,122,0,0,0,0,0,0,0,1,0,12,0,99,108,97,109,112,0,1,0, +0,12,120,0,0,1,0,0,12,109,105,110,86,97,108,0,0,1,0,0,12,109,97,120, +86,97,108,0,0,0,1,8,58,118,101,99,52,0,58,99,108,97,109,112,0,18,120,0, +59,120,0,0,18,109,105,110,86,97,108,0,59,120,0,0,18,109,97,120,86,97,108,0, +59,121,0,0,0,0,58,99,108,97,109,112,0,18,120,0,59,121,0,0,18,109,105,110, +86,97,108,0,59,121,0,0,18,109,97,120,86,97,108,0,59,121,0,0,0,0,58,99, +108,97,109,112,0,18,120,0,59,122,0,0,18,109,105,110,86,97,108,0,59,122,0,0, +18,109,97,120,86,97,108,0,59,122,0,0,0,0,58,99,108,97,109,112,0,18,120,0, +59,119,0,0,18,109,105,110,86,97,108,0,59,119,0,0,18,109,97,120,86,97,108,0, +59,119,0,0,0,0,0,0,0,1,0,9,0,109,105,120,0,1,0,0,9,120,0,0, +1,0,0,9,121,0,0,1,0,0,9,97,0,0,0,1,8,18,120,0,17,49,0,48, +0,0,18,97,0,47,48,18,121,0,18,97,0,48,46,0,0,1,0,10,0,109,105,120, +0,1,0,0,10,120,0,0,1,0,0,10,121,0,0,1,0,0,9,97,0,0,0,1, +8,58,118,101,99,50,0,58,109,105,120,0,18,120,0,59,120,0,0,18,121,0,59,120, +0,0,18,97,0,0,0,0,58,109,105,120,0,18,120,0,59,121,0,0,18,121,0,59, +121,0,0,18,97,0,0,0,0,0,0,0,1,0,11,0,109,105,120,0,1,0,0,11, +120,0,0,1,0,0,11,121,0,0,1,0,0,9,97,0,0,0,1,8,58,118,101,99, +51,0,58,109,105,120,0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,18,97,0, +0,0,0,58,109,105,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,18,97, +0,0,0,0,58,109,105,120,0,18,120,0,59,122,0,0,18,121,0,59,122,0,0,18, +97,0,0,0,0,0,0,0,1,0,12,0,109,105,120,0,1,0,0,12,120,0,0,1, +0,0,12,121,0,0,1,0,0,9,97,0,0,0,1,8,58,118,101,99,52,0,58,109, +105,120,0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,18,97,0,0,0,0,58, +109,105,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,18,97,0,0,0,0, +58,109,105,120,0,18,120,0,59,122,0,0,18,121,0,59,122,0,0,18,97,0,0,0, +0,58,109,105,120,0,18,120,0,59,119,0,0,18,121,0,59,119,0,0,18,97,0,0, +0,0,0,0,0,1,0,10,0,109,105,120,0,1,0,0,10,120,0,0,1,0,0,10, +121,0,0,1,0,0,10,97,0,0,0,1,8,58,118,101,99,50,0,58,109,105,120,0, +18,120,0,59,120,0,0,18,121,0,59,120,0,0,18,97,0,59,120,0,0,0,0,58, +109,105,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,18,97,0,59,121,0, +0,0,0,0,0,0,1,0,11,0,109,105,120,0,1,0,0,11,120,0,0,1,0,0, +11,121,0,0,1,0,0,11,97,0,0,0,1,8,58,118,101,99,51,0,58,109,105,120, +0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,18,97,0,59,120,0,0,0,0, +58,109,105,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,18,97,0,59,121, +0,0,0,0,58,109,105,120,0,18,120,0,59,122,0,0,18,121,0,59,122,0,0,18, +97,0,59,122,0,0,0,0,0,0,0,1,0,12,0,109,105,120,0,1,0,0,12,120, +0,0,1,0,0,12,121,0,0,1,0,0,12,97,0,0,0,1,8,58,118,101,99,52, +0,58,109,105,120,0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,18,97,0,59, +120,0,0,0,0,58,109,105,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0, +18,97,0,59,121,0,0,0,0,58,109,105,120,0,18,120,0,59,122,0,0,18,121,0, +59,122,0,0,18,97,0,59,122,0,0,0,0,58,109,105,120,0,18,120,0,59,119,0, +0,18,121,0,59,119,0,0,18,97,0,59,119,0,0,0,0,0,0,0,1,0,9,0, +115,116,101,112,0,1,0,0,9,101,100,103,101,0,0,1,0,0,9,120,0,0,0,1, +8,18,120,0,18,101,100,103,101,0,40,17,48,0,48,0,0,17,49,0,48,0,0,31, +0,0,1,0,10,0,115,116,101,112,0,1,0,0,9,101,100,103,101,0,0,1,0,0, +10,120,0,0,0,1,8,58,118,101,99,50,0,58,115,116,101,112,0,18,101,100,103,101, +0,0,18,120,0,59,120,0,0,0,0,58,115,116,101,112,0,18,101,100,103,101,0,0, +18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,115,116,101,112,0,1,0,0, +9,101,100,103,101,0,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58, +115,116,101,112,0,18,101,100,103,101,0,0,18,120,0,59,120,0,0,0,0,58,115,116, +101,112,0,18,101,100,103,101,0,0,18,120,0,59,121,0,0,0,0,58,115,116,101,112, +0,18,101,100,103,101,0,0,18,120,0,59,122,0,0,0,0,0,0,0,1,0,12,0, +115,116,101,112,0,1,0,0,9,101,100,103,101,0,0,1,0,0,12,120,0,0,0,1, +8,58,118,101,99,52,0,58,115,116,101,112,0,18,101,100,103,101,0,0,18,120,0,59, +120,0,0,0,0,58,115,116,101,112,0,18,101,100,103,101,0,0,18,120,0,59,121,0, +0,0,0,58,115,116,101,112,0,18,101,100,103,101,0,0,18,120,0,59,122,0,0,0, +0,58,115,116,101,112,0,18,101,100,103,101,0,0,18,120,0,59,119,0,0,0,0,0, +0,0,1,0,10,0,115,116,101,112,0,1,0,0,10,101,100,103,101,0,0,1,0,0, +10,120,0,0,0,1,8,58,118,101,99,50,0,58,115,116,101,112,0,18,101,100,103,101, +0,59,120,0,0,18,120,0,59,120,0,0,0,0,58,115,116,101,112,0,18,101,100,103, +101,0,59,121,0,0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,115,116, +101,112,0,1,0,0,11,101,100,103,101,0,0,1,0,0,11,120,0,0,0,1,8,58, +118,101,99,51,0,58,115,116,101,112,0,18,101,100,103,101,0,59,120,0,0,18,120,0, +59,120,0,0,0,0,58,115,116,101,112,0,18,101,100,103,101,0,59,121,0,0,18,120, +0,59,121,0,0,0,0,58,115,116,101,112,0,18,101,100,103,101,0,59,122,0,0,18, +120,0,59,122,0,0,0,0,0,0,0,1,0,12,0,115,116,101,112,0,1,0,0,12, +101,100,103,101,0,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,58,115, +116,101,112,0,18,101,100,103,101,0,59,120,0,0,18,120,0,59,120,0,0,0,0,58, +115,116,101,112,0,18,101,100,103,101,0,59,121,0,0,18,120,0,59,121,0,0,0,0, +58,115,116,101,112,0,18,101,100,103,101,0,59,122,0,0,18,120,0,59,122,0,0,0, +0,58,115,116,101,112,0,18,101,100,103,101,0,59,119,0,0,18,120,0,59,119,0,0, +0,0,0,0,0,1,0,9,0,115,109,111,111,116,104,115,116,101,112,0,1,0,0,9, +101,100,103,101,48,0,0,1,0,0,9,101,100,103,101,49,0,0,1,0,0,9,120,0, +0,0,1,3,2,1,9,1,116,0,2,58,99,108,97,109,112,0,18,120,0,18,101,100, +103,101,48,0,47,18,101,100,103,101,49,0,18,101,100,103,101,48,0,47,49,0,17,48, +0,48,0,0,0,17,49,0,48,0,0,0,0,0,0,8,18,116,0,18,116,0,48,17, +51,0,48,0,0,17,50,0,48,0,0,18,116,0,48,47,48,0,0,1,0,10,0,115, +109,111,111,116,104,115,116,101,112,0,1,0,0,9,101,100,103,101,48,0,0,1,0,0, +9,101,100,103,101,49,0,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,50,0, +58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,0,18,101,100,103, +101,49,0,0,18,120,0,59,120,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112, +0,18,101,100,103,101,48,0,0,18,101,100,103,101,49,0,0,18,120,0,59,121,0,0, +0,0,0,0,0,1,0,11,0,115,109,111,111,116,104,115,116,101,112,0,1,0,0,9, +101,100,103,101,48,0,0,1,0,0,9,101,100,103,101,49,0,0,1,0,0,11,120,0, +0,0,1,8,58,118,101,99,51,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101, +100,103,101,48,0,0,18,101,100,103,101,49,0,0,18,120,0,59,120,0,0,0,0,58, +115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,0,18,101,100,103,101, +49,0,0,18,120,0,59,121,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112,0, +18,101,100,103,101,48,0,0,18,101,100,103,101,49,0,0,18,120,0,59,122,0,0,0, +0,0,0,0,1,0,12,0,115,109,111,111,116,104,115,116,101,112,0,1,0,0,9,101, +100,103,101,48,0,0,1,0,0,9,101,100,103,101,49,0,0,1,0,0,12,120,0,0, +0,1,8,58,118,101,99,52,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100, +103,101,48,0,0,18,101,100,103,101,49,0,0,18,120,0,59,120,0,0,0,0,58,115, +109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,0,18,101,100,103,101,49, +0,0,18,120,0,59,121,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112,0,18, +101,100,103,101,48,0,0,18,101,100,103,101,49,0,0,18,120,0,59,122,0,0,0,0, +58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,0,18,101,100,103, +101,49,0,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,10,0,115,109,111,111, +116,104,115,116,101,112,0,1,0,0,10,101,100,103,101,48,0,0,1,0,0,10,101,100, +103,101,49,0,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,115,109, +111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,59,120,0,0,18,101,100,103, +101,49,0,59,120,0,0,18,120,0,59,120,0,0,0,0,58,115,109,111,111,116,104,115, +116,101,112,0,18,101,100,103,101,48,0,59,121,0,0,18,101,100,103,101,49,0,59,121, +0,0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,115,109,111,111,116,104, +115,116,101,112,0,1,0,0,11,101,100,103,101,48,0,0,1,0,0,11,101,100,103,101, +49,0,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,115,109,111,111, +116,104,115,116,101,112,0,18,101,100,103,101,48,0,59,120,0,0,18,101,100,103,101,49, +0,59,120,0,0,18,120,0,59,120,0,0,0,0,58,115,109,111,111,116,104,115,116,101, +112,0,18,101,100,103,101,48,0,59,121,0,0,18,101,100,103,101,49,0,59,121,0,0, +18,120,0,59,121,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100, +103,101,48,0,59,122,0,0,18,101,100,103,101,49,0,59,122,0,0,18,120,0,59,122, +0,0,0,0,0,0,0,1,0,12,0,115,109,111,111,116,104,115,116,101,112,0,1,0, +0,12,101,100,103,101,48,0,0,1,0,0,12,101,100,103,101,49,0,0,1,0,0,12, +120,0,0,0,1,8,58,118,101,99,52,0,58,115,109,111,111,116,104,115,116,101,112,0, +18,101,100,103,101,48,0,59,120,0,0,18,101,100,103,101,49,0,59,120,0,0,18,120, +0,59,120,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101, +48,0,59,121,0,0,18,101,100,103,101,49,0,59,121,0,0,18,120,0,59,121,0,0, +0,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,59,122,0, +0,18,101,100,103,101,49,0,59,122,0,0,18,120,0,59,122,0,0,0,0,58,115,109, +111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,59,119,0,0,18,101,100,103, +101,49,0,59,119,0,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0,100, +111,116,0,1,0,0,9,120,0,0,1,0,0,9,121,0,0,0,1,8,18,120,0,18, +121,0,48,0,0,1,0,9,0,100,111,116,0,1,0,0,10,120,0,0,1,0,0,10, +121,0,0,0,1,8,58,100,111,116,0,18,120,0,59,120,0,0,18,121,0,59,120,0, +0,0,58,100,111,116,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,0,46,0, +0,1,0,9,0,100,111,116,0,1,0,0,11,120,0,0,1,0,0,11,121,0,0,0, +1,8,58,100,111,116,0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,0,58,100, +111,116,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,0,46,58,100,111,116,0, +18,120,0,59,122,0,0,18,121,0,59,122,0,0,0,46,0,0,1,0,9,0,100,111, +116,0,1,0,0,12,120,0,0,1,0,0,12,121,0,0,0,1,8,58,100,111,116,0, +18,120,0,59,120,0,0,18,121,0,59,120,0,0,0,58,100,111,116,0,18,120,0,59, +121,0,0,18,121,0,59,121,0,0,0,46,58,100,111,116,0,18,120,0,59,122,0,0, +18,121,0,59,122,0,0,0,46,58,100,111,116,0,18,120,0,59,119,0,0,18,121,0, +59,119,0,0,0,46,0,0,1,0,9,0,108,101,110,103,116,104,0,1,0,0,9,120, +0,0,0,1,8,58,115,113,114,116,0,58,100,111,116,0,18,120,0,0,18,120,0,0, +0,0,0,0,0,1,0,9,0,108,101,110,103,116,104,0,1,0,0,10,120,0,0,0, +1,8,58,115,113,114,116,0,58,100,111,116,0,18,120,0,0,18,120,0,0,0,0,0, +0,0,1,0,9,0,108,101,110,103,116,104,0,1,0,0,11,120,0,0,0,1,8,58, +115,113,114,116,0,58,100,111,116,0,18,120,0,0,18,120,0,0,0,0,0,0,0,1, +0,9,0,108,101,110,103,116,104,0,1,0,0,12,120,0,0,0,1,8,58,115,113,114, +116,0,58,100,111,116,0,18,120,0,0,18,120,0,0,0,0,0,0,0,1,0,9,0, +100,105,115,116,97,110,99,101,0,1,0,0,9,120,0,0,1,0,0,9,121,0,0,0, +1,8,58,108,101,110,103,116,104,0,18,120,0,18,121,0,47,0,0,0,0,1,0,9, +0,100,105,115,116,97,110,99,101,0,1,0,0,10,120,0,0,1,0,0,10,121,0,0, +0,1,8,58,108,101,110,103,116,104,0,18,120,0,18,121,0,47,0,0,0,0,1,0, +9,0,100,105,115,116,97,110,99,101,0,1,0,0,11,120,0,0,1,0,0,11,121,0, +0,0,1,8,58,108,101,110,103,116,104,0,18,120,0,18,121,0,47,0,0,0,0,1, +0,9,0,100,105,115,116,97,110,99,101,0,1,0,0,12,120,0,0,1,0,0,12,121, +0,0,0,1,8,58,108,101,110,103,116,104,0,18,120,0,18,121,0,47,0,0,0,0, +1,0,11,0,99,114,111,115,115,0,1,0,0,11,120,0,0,1,0,0,11,121,0,0, +0,1,8,58,118,101,99,51,0,18,120,0,59,121,0,18,121,0,59,122,0,48,18,121, +0,59,121,0,18,120,0,59,122,0,48,47,0,18,120,0,59,122,0,18,121,0,59,120, +0,48,18,121,0,59,122,0,18,120,0,59,120,0,48,47,0,18,120,0,59,120,0,18, +121,0,59,121,0,48,18,121,0,59,120,0,18,120,0,59,121,0,48,47,0,0,0,0, +1,0,9,0,110,111,114,109,97,108,105,122,101,0,1,0,0,9,120,0,0,0,1,8, +17,49,0,48,0,0,0,0,1,0,10,0,110,111,114,109,97,108,105,122,101,0,1,0, +0,10,120,0,0,0,1,8,18,120,0,58,108,101,110,103,116,104,0,18,120,0,0,0, +49,0,0,1,0,11,0,110,111,114,109,97,108,105,122,101,0,1,0,0,11,120,0,0, +0,1,8,18,120,0,58,108,101,110,103,116,104,0,18,120,0,0,0,49,0,0,1,0, +12,0,110,111,114,109,97,108,105,122,101,0,1,0,0,12,120,0,0,0,1,8,18,120, +0,58,108,101,110,103,116,104,0,18,120,0,0,0,49,0,0,1,0,9,0,102,97,99, +101,102,111,114,119,97,114,100,0,1,0,0,9,78,0,0,1,0,0,9,73,0,0,1, +0,0,9,78,114,101,102,0,0,0,1,8,58,100,111,116,0,18,78,114,101,102,0,0, +18,73,0,0,0,17,48,0,48,0,0,40,18,78,0,18,78,0,54,31,0,0,1,0, +10,0,102,97,99,101,102,111,114,119,97,114,100,0,1,0,0,10,78,0,0,1,0,0, +10,73,0,0,1,0,0,10,78,114,101,102,0,0,0,1,8,58,100,111,116,0,18,78, +114,101,102,0,0,18,73,0,0,0,17,48,0,48,0,0,40,18,78,0,18,78,0,54, +31,0,0,1,0,11,0,102,97,99,101,102,111,114,119,97,114,100,0,1,0,0,11,78, +0,0,1,0,0,11,73,0,0,1,0,0,11,78,114,101,102,0,0,0,1,8,58,100, +111,116,0,18,78,114,101,102,0,0,18,73,0,0,0,17,48,0,48,0,0,40,18,78, +0,18,78,0,54,31,0,0,1,0,12,0,102,97,99,101,102,111,114,119,97,114,100,0, +1,0,0,12,78,0,0,1,0,0,12,73,0,0,1,0,0,12,78,114,101,102,0,0, +0,1,8,58,100,111,116,0,18,78,114,101,102,0,0,18,73,0,0,0,17,48,0,48, +0,0,40,18,78,0,18,78,0,54,31,0,0,1,0,9,0,114,101,102,108,101,99,116, +0,1,0,0,9,73,0,0,1,0,0,9,78,0,0,0,1,8,18,73,0,17,50,0, +48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,18,78,0,48,47,0, +0,1,0,10,0,114,101,102,108,101,99,116,0,1,0,0,10,73,0,0,1,0,0,10, +78,0,0,0,1,8,18,73,0,17,50,0,48,0,0,58,100,111,116,0,18,78,0,0, +18,73,0,0,0,48,18,78,0,48,47,0,0,1,0,11,0,114,101,102,108,101,99,116, +0,1,0,0,11,73,0,0,1,0,0,11,78,0,0,0,1,8,18,73,0,17,50,0, +48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,18,78,0,48,47,0, +0,1,0,12,0,114,101,102,108,101,99,116,0,1,0,0,12,73,0,0,1,0,0,12, +78,0,0,0,1,8,18,73,0,17,50,0,48,0,0,58,100,111,116,0,18,78,0,0, +18,73,0,0,0,48,18,78,0,48,47,0,0,1,0,9,0,114,101,102,114,97,99,116, +0,1,0,0,9,73,0,0,1,0,0,9,78,0,0,1,0,0,9,101,116,97,0,0, +0,1,3,2,1,9,1,107,0,2,17,49,0,48,0,0,18,101,116,97,0,18,101,116, +97,0,48,17,49,0,48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,58, +100,111,116,0,18,78,0,0,18,73,0,0,0,48,47,48,47,0,0,10,18,107,0,17, +48,0,48,0,0,40,0,8,17,48,0,48,0,0,0,9,14,0,8,18,101,116,97,0, +18,73,0,48,18,101,116,97,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48, +58,115,113,114,116,0,18,107,0,0,0,46,18,78,0,48,47,0,0,1,0,10,0,114, +101,102,114,97,99,116,0,1,0,0,10,73,0,0,1,0,0,10,78,0,0,1,0,0, +9,101,116,97,0,0,0,1,3,2,1,9,1,107,0,2,17,49,0,48,0,0,18,101, +116,97,0,18,101,116,97,0,48,17,49,0,48,0,0,58,100,111,116,0,18,78,0,0, +18,73,0,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,47,48,47,0, +0,10,18,107,0,17,48,0,48,0,0,40,0,8,58,118,101,99,50,0,17,48,0,48, +0,0,0,0,0,9,14,0,8,18,101,116,97,0,18,73,0,48,18,101,116,97,0,58, +100,111,116,0,18,78,0,0,18,73,0,0,0,48,58,115,113,114,116,0,18,107,0,0, +0,46,18,78,0,48,47,0,0,1,0,11,0,114,101,102,114,97,99,116,0,1,0,0, +11,73,0,0,1,0,0,11,78,0,0,1,0,0,9,101,116,97,0,0,0,1,3,2, +1,9,1,107,0,2,17,49,0,48,0,0,18,101,116,97,0,18,101,116,97,0,48,17, +49,0,48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,58,100,111,116,0, +18,78,0,0,18,73,0,0,0,48,47,48,47,0,0,10,18,107,0,17,48,0,48,0, +0,40,0,8,58,118,101,99,51,0,17,48,0,48,0,0,0,0,0,9,14,0,8,18, +101,116,97,0,18,73,0,48,18,101,116,97,0,58,100,111,116,0,18,78,0,0,18,73, +0,0,0,48,58,115,113,114,116,0,18,107,0,0,0,46,18,78,0,48,47,0,0,1, +0,12,0,114,101,102,114,97,99,116,0,1,0,0,12,73,0,0,1,0,0,12,78,0, +0,1,0,0,9,101,116,97,0,0,0,1,3,2,1,9,1,107,0,2,17,49,0,48, +0,0,18,101,116,97,0,18,101,116,97,0,48,17,49,0,48,0,0,58,100,111,116,0, +18,78,0,0,18,73,0,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48, +47,48,47,0,0,10,18,107,0,17,48,0,48,0,0,40,0,8,58,118,101,99,52,0, +17,48,0,48,0,0,0,0,0,9,14,0,8,18,101,116,97,0,18,73,0,48,18,101, +116,97,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,58,115,113,114,116,0, +18,107,0,0,0,46,18,78,0,48,47,0,0,1,0,13,0,109,97,116,114,105,120,67, +111,109,112,77,117,108,116,0,1,0,0,13,120,0,0,1,0,0,13,121,0,0,0,1, +8,58,109,97,116,50,0,18,120,0,16,8,48,0,57,59,120,0,18,121,0,16,8,48, +0,57,59,120,0,48,0,18,120,0,16,8,48,0,57,59,121,0,18,121,0,16,8,48, +0,57,59,121,0,48,0,18,120,0,16,10,49,0,57,59,120,0,18,121,0,16,10,49, +0,57,59,120,0,48,0,18,120,0,16,10,49,0,57,59,121,0,18,121,0,16,10,49, +0,57,59,121,0,48,0,0,0,0,1,0,14,0,109,97,116,114,105,120,67,111,109,112, +77,117,108,116,0,1,0,0,14,120,0,0,1,0,0,14,121,0,0,0,1,8,58,109, +97,116,52,0,18,120,0,16,8,48,0,57,59,120,0,18,121,0,16,8,48,0,57,59, +120,0,48,0,18,120,0,16,8,48,0,57,59,121,0,18,121,0,16,8,48,0,57,59, +121,0,48,0,18,120,0,16,8,48,0,57,59,122,0,18,121,0,16,8,48,0,57,59, +122,0,48,0,18,120,0,16,10,49,0,57,59,120,0,18,121,0,16,10,49,0,57,59, +120,0,48,0,18,120,0,16,10,49,0,57,59,121,0,18,121,0,16,10,49,0,57,59, +121,0,48,0,18,120,0,16,10,49,0,57,59,122,0,18,121,0,16,10,49,0,57,59, +122,0,48,0,18,120,0,16,10,50,0,57,59,120,0,18,121,0,16,10,50,0,57,59, +120,0,48,0,18,120,0,16,10,50,0,57,59,121,0,18,121,0,16,10,50,0,57,59, +121,0,48,0,18,120,0,16,10,50,0,57,59,122,0,18,121,0,16,10,50,0,57,59, +122,0,48,0,0,0,0,1,0,15,0,109,97,116,114,105,120,67,111,109,112,77,117,108, +116,0,1,0,0,15,120,0,0,1,0,0,15,121,0,0,0,1,8,58,109,97,116,52, +0,18,120,0,16,8,48,0,57,59,120,0,18,121,0,16,8,48,0,57,59,120,0,48, +0,18,120,0,16,8,48,0,57,59,121,0,18,121,0,16,8,48,0,57,59,121,0,48, +0,18,120,0,16,8,48,0,57,59,122,0,18,121,0,16,8,48,0,57,59,122,0,48, +18,120,0,16,8,48,0,57,59,119,0,18,121,0,16,8,48,0,57,59,119,0,48,46, +0,18,120,0,16,10,49,0,57,59,120,0,18,121,0,16,10,49,0,57,59,120,0,48, +0,18,120,0,16,10,49,0,57,59,121,0,18,121,0,16,10,49,0,57,59,121,0,48, +0,18,120,0,16,10,49,0,57,59,122,0,18,121,0,16,10,49,0,57,59,122,0,48, +18,120,0,16,10,49,0,57,59,119,0,18,121,0,16,10,49,0,57,59,119,0,48,46, +0,18,120,0,16,10,50,0,57,59,120,0,18,121,0,16,10,50,0,57,59,120,0,48, +0,18,120,0,16,10,50,0,57,59,121,0,18,121,0,16,10,50,0,57,59,121,0,48, +0,18,120,0,16,10,50,0,57,59,122,0,18,121,0,16,10,50,0,57,59,122,0,48, +18,120,0,16,10,50,0,57,59,119,0,18,121,0,16,10,50,0,57,59,119,0,48,46, +0,18,120,0,16,10,51,0,57,59,120,0,18,121,0,16,10,51,0,57,59,120,0,48, +0,18,120,0,16,10,51,0,57,59,121,0,18,121,0,16,10,51,0,57,59,121,0,48, +0,18,120,0,16,10,51,0,57,59,122,0,18,121,0,16,10,51,0,57,59,122,0,48, +18,120,0,16,10,51,0,57,59,119,0,18,121,0,16,10,51,0,57,59,119,0,48,46, +0,0,0,0,1,0,2,0,108,101,115,115,84,104,97,110,0,1,0,0,10,120,0,0, +1,0,0,10,121,0,0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18, +121,0,59,120,0,40,0,18,120,0,59,121,0,18,121,0,59,121,0,40,0,0,0,0, +1,0,3,0,108,101,115,115,84,104,97,110,0,1,0,0,11,120,0,0,1,0,0,11, +121,0,0,0,1,8,58,98,118,101,99,51,0,18,120,0,59,120,0,18,121,0,59,120, +0,40,0,18,120,0,59,121,0,18,121,0,59,121,0,40,0,18,120,0,59,122,0,18, +121,0,59,122,0,40,0,0,0,0,1,0,4,0,108,101,115,115,84,104,97,110,0,1, +0,0,12,120,0,0,1,0,0,12,121,0,0,0,1,8,58,98,118,101,99,52,0,18, +120,0,59,120,0,18,121,0,59,120,0,40,0,18,120,0,59,121,0,18,121,0,59,121, +0,40,0,18,120,0,59,122,0,18,121,0,59,122,0,40,0,18,120,0,59,119,0,18, +121,0,59,119,0,40,0,0,0,0,1,0,2,0,108,101,115,115,84,104,97,110,0,1, +0,0,6,120,0,0,1,0,0,6,121,0,0,0,1,8,58,98,118,101,99,50,0,18, +120,0,59,120,0,18,121,0,59,120,0,40,0,18,120,0,59,121,0,18,121,0,59,121, +0,40,0,0,0,0,1,0,3,0,108,101,115,115,84,104,97,110,0,1,0,0,7,120, +0,0,1,0,0,7,121,0,0,0,1,8,58,98,118,101,99,51,0,18,120,0,59,120, +0,18,121,0,59,120,0,40,0,18,120,0,59,121,0,18,121,0,59,121,0,40,0,18, +120,0,59,122,0,18,121,0,59,122,0,40,0,0,0,0,1,0,4,0,108,101,115,115, +84,104,97,110,0,1,0,0,8,120,0,0,1,0,0,8,121,0,0,0,1,8,58,98, +118,101,99,52,0,18,120,0,59,120,0,18,121,0,59,120,0,40,0,18,120,0,59,121, +0,18,121,0,59,121,0,40,0,18,120,0,59,122,0,18,121,0,59,122,0,40,0,18, +120,0,59,119,0,18,121,0,59,119,0,40,0,0,0,0,1,0,2,0,108,101,115,115, +84,104,97,110,69,113,117,97,108,0,1,0,0,10,120,0,0,1,0,0,10,121,0,0, +0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18,121,0,59,120,0,42,0, +18,120,0,59,121,0,18,121,0,59,121,0,42,0,0,0,0,1,0,3,0,108,101,115, +115,84,104,97,110,69,113,117,97,108,0,1,0,0,11,120,0,0,1,0,0,11,121,0, +0,0,1,8,58,98,118,101,99,51,0,18,120,0,59,120,0,18,121,0,59,120,0,42, +0,18,120,0,59,121,0,18,121,0,59,121,0,42,0,18,120,0,59,122,0,18,121,0, +59,122,0,42,0,0,0,0,1,0,4,0,108,101,115,115,84,104,97,110,69,113,117,97, +108,0,1,0,0,12,120,0,0,1,0,0,12,121,0,0,0,1,8,58,98,118,101,99, +52,0,18,120,0,59,120,0,18,121,0,59,120,0,42,0,18,120,0,59,121,0,18,121, +0,59,121,0,42,0,18,120,0,59,122,0,18,121,0,59,122,0,42,0,18,120,0,59, +119,0,18,121,0,59,119,0,42,0,0,0,0,1,0,2,0,108,101,115,115,84,104,97, +110,69,113,117,97,108,0,1,0,0,6,120,0,0,1,0,0,6,121,0,0,0,1,8, +58,98,118,101,99,50,0,18,120,0,59,120,0,18,121,0,59,120,0,42,0,18,120,0, +59,121,0,18,121,0,59,121,0,42,0,0,0,0,1,0,3,0,108,101,115,115,84,104, +97,110,69,113,117,97,108,0,1,0,0,7,120,0,0,1,0,0,7,121,0,0,0,1, +8,58,98,118,101,99,51,0,18,120,0,59,120,0,18,121,0,59,120,0,42,0,18,120, +0,59,121,0,18,121,0,59,121,0,42,0,18,120,0,59,122,0,18,121,0,59,122,0, +42,0,0,0,0,1,0,4,0,108,101,115,115,84,104,97,110,69,113,117,97,108,0,1, +0,0,8,120,0,0,1,0,0,8,121,0,0,0,1,8,58,98,118,101,99,52,0,18, +120,0,59,120,0,18,121,0,59,120,0,42,0,18,120,0,59,121,0,18,121,0,59,121, +0,42,0,18,120,0,59,122,0,18,121,0,59,122,0,42,0,18,120,0,59,119,0,18, +121,0,59,119,0,42,0,0,0,0,1,0,2,0,103,114,101,97,116,101,114,84,104,97, +110,0,1,0,0,10,120,0,0,1,0,0,10,121,0,0,0,1,8,58,98,118,101,99, +50,0,18,120,0,59,120,0,18,121,0,59,120,0,41,0,18,120,0,59,121,0,18,121, +0,59,121,0,41,0,0,0,0,1,0,3,0,103,114,101,97,116,101,114,84,104,97,110, +0,1,0,0,11,120,0,0,1,0,0,11,121,0,0,0,1,8,58,98,118,101,99,51, +0,18,120,0,59,120,0,18,121,0,59,120,0,41,0,18,120,0,59,121,0,18,121,0, +59,121,0,41,0,18,120,0,59,122,0,18,121,0,59,122,0,41,0,0,0,0,1,0, +4,0,103,114,101,97,116,101,114,84,104,97,110,0,1,0,0,12,120,0,0,1,0,0, +12,121,0,0,0,1,8,58,98,118,101,99,52,0,18,120,0,59,120,0,18,121,0,59, +120,0,41,0,18,120,0,59,121,0,18,121,0,59,121,0,41,0,18,120,0,59,122,0, +18,121,0,59,122,0,41,0,18,120,0,59,119,0,18,121,0,59,119,0,41,0,0,0, +0,1,0,2,0,103,114,101,97,116,101,114,84,104,97,110,0,1,0,0,6,120,0,0, +1,0,0,6,121,0,0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18, +121,0,59,120,0,41,0,18,120,0,59,121,0,18,121,0,59,121,0,41,0,0,0,0, +1,0,3,0,103,114,101,97,116,101,114,84,104,97,110,0,1,0,0,7,120,0,0,1, +0,0,7,121,0,0,0,1,8,58,98,118,101,99,51,0,18,120,0,59,120,0,18,121, +0,59,120,0,41,0,18,120,0,59,121,0,18,121,0,59,121,0,41,0,18,120,0,59, +122,0,18,121,0,59,122,0,41,0,0,0,0,1,0,4,0,103,114,101,97,116,101,114, +84,104,97,110,0,1,0,0,8,120,0,0,1,0,0,8,121,0,0,0,1,8,58,98, +118,101,99,52,0,18,120,0,59,120,0,18,121,0,59,120,0,41,0,18,120,0,59,121, +0,18,121,0,59,121,0,41,0,18,120,0,59,122,0,18,121,0,59,122,0,41,0,18, +120,0,59,119,0,18,121,0,59,119,0,41,0,0,0,0,1,0,2,0,103,114,101,97, +116,101,114,84,104,97,110,69,113,117,97,108,0,1,0,0,10,120,0,0,1,0,0,10, +121,0,0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18,121,0,59,120, +0,43,0,18,120,0,59,121,0,18,121,0,59,121,0,43,0,0,0,0,1,0,3,0, +103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,0,1,0,0,11,120,0,0, +1,0,0,11,121,0,0,0,1,8,58,98,118,101,99,51,0,18,120,0,59,120,0,18, +121,0,59,120,0,43,0,18,120,0,59,121,0,18,121,0,59,121,0,43,0,18,120,0, +59,122,0,18,121,0,59,122,0,43,0,0,0,0,1,0,4,0,103,114,101,97,116,101, +114,84,104,97,110,69,113,117,97,108,0,1,0,0,12,120,0,0,1,0,0,12,121,0, +0,0,1,8,58,98,118,101,99,52,0,18,120,0,59,120,0,18,121,0,59,120,0,43, +0,18,120,0,59,121,0,18,121,0,59,121,0,43,0,18,120,0,59,122,0,18,121,0, +59,122,0,43,0,18,120,0,59,119,0,18,121,0,59,119,0,43,0,0,0,0,1,0, +2,0,103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,0,1,0,0,6,120, +0,0,1,0,0,6,121,0,0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120, +0,18,121,0,59,120,0,43,0,18,120,0,59,121,0,18,121,0,59,121,0,43,0,0, +0,0,1,0,3,0,103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,0,1, +0,0,7,120,0,0,1,0,0,7,121,0,0,0,1,8,58,98,118,101,99,51,0,18, +120,0,59,120,0,18,121,0,59,120,0,43,0,18,120,0,59,121,0,18,121,0,59,121, +0,43,0,18,120,0,59,122,0,18,121,0,59,122,0,43,0,0,0,0,1,0,4,0, +103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,0,1,0,0,8,120,0,0, +1,0,0,8,121,0,0,0,1,8,58,98,118,101,99,52,0,18,120,0,59,120,0,18, +121,0,59,120,0,43,0,18,120,0,59,121,0,18,121,0,59,121,0,43,0,18,120,0, +59,122,0,18,121,0,59,122,0,43,0,18,120,0,59,119,0,18,121,0,59,119,0,43, +0,0,0,0,1,0,2,0,101,113,117,97,108,0,1,0,0,10,120,0,0,1,0,0, +10,121,0,0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18,121,0,59, +120,0,38,0,18,120,0,59,121,0,18,121,0,59,121,0,38,0,0,0,0,1,0,3, +0,101,113,117,97,108,0,1,0,0,11,120,0,0,1,0,0,11,121,0,0,0,1,8, +58,98,118,101,99,51,0,18,120,0,59,120,0,18,121,0,59,120,0,38,0,18,120,0, +59,121,0,18,121,0,59,121,0,38,0,18,120,0,59,122,0,18,121,0,59,122,0,38, +0,0,0,0,1,0,4,0,101,113,117,97,108,0,1,0,0,12,120,0,0,1,0,0, +12,121,0,0,0,1,8,58,98,118,101,99,52,0,18,120,0,59,120,0,18,121,0,59, +120,0,38,0,18,120,0,59,121,0,18,121,0,59,121,0,38,0,18,120,0,59,122,0, +18,121,0,59,122,0,38,0,18,120,0,59,119,0,18,121,0,59,119,0,38,0,0,0, +0,1,0,2,0,101,113,117,97,108,0,1,0,0,6,120,0,0,1,0,0,6,121,0, +0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18,121,0,59,120,0,38, +0,18,120,0,59,121,0,18,121,0,59,121,0,38,0,0,0,0,1,0,3,0,101,113, +117,97,108,0,1,0,0,7,120,0,0,1,0,0,7,121,0,0,0,1,8,58,98,118, +101,99,51,0,18,120,0,59,120,0,18,121,0,59,120,0,38,0,18,120,0,59,121,0, +18,121,0,59,121,0,38,0,18,120,0,59,122,0,18,121,0,59,122,0,38,0,0,0, +0,1,0,4,0,101,113,117,97,108,0,1,0,0,8,120,0,0,1,0,0,8,121,0, +0,0,1,8,58,98,118,101,99,52,0,18,120,0,59,120,0,18,121,0,59,120,0,38, +0,18,120,0,59,121,0,18,121,0,59,121,0,38,0,18,120,0,59,122,0,18,121,0, +59,122,0,38,0,18,120,0,59,119,0,18,121,0,59,119,0,38,0,0,0,0,1,0, +2,0,110,111,116,69,113,117,97,108,0,1,0,0,10,120,0,0,1,0,0,10,121,0, +0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18,121,0,59,120,0,39, +0,18,120,0,59,121,0,18,121,0,59,121,0,39,0,0,0,0,1,0,3,0,110,111, +116,69,113,117,97,108,0,1,0,0,11,120,0,0,1,0,0,11,121,0,0,0,1,8, +58,98,118,101,99,51,0,18,120,0,59,120,0,18,121,0,59,120,0,39,0,18,120,0, +59,121,0,18,121,0,59,121,0,39,0,18,120,0,59,122,0,18,121,0,59,122,0,39, +0,0,0,0,1,0,4,0,110,111,116,69,113,117,97,108,0,1,0,0,12,120,0,0, +1,0,0,12,121,0,0,0,1,8,58,98,118,101,99,52,0,18,120,0,59,120,0,18, +121,0,59,120,0,39,0,18,120,0,59,121,0,18,121,0,59,121,0,39,0,18,120,0, +59,122,0,18,121,0,59,122,0,39,0,18,120,0,59,119,0,18,121,0,59,119,0,39, +0,0,0,0,1,0,2,0,110,111,116,69,113,117,97,108,0,1,0,0,6,120,0,0, +1,0,0,6,121,0,0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18, +121,0,59,120,0,39,0,18,120,0,59,121,0,18,121,0,59,121,0,39,0,0,0,0, +1,0,3,0,110,111,116,69,113,117,97,108,0,1,0,0,7,120,0,0,1,0,0,7, +121,0,0,0,1,8,58,98,118,101,99,51,0,18,120,0,59,120,0,18,121,0,59,120, +0,39,0,18,120,0,59,121,0,18,121,0,59,121,0,39,0,18,120,0,59,122,0,18, +121,0,59,122,0,39,0,0,0,0,1,0,4,0,110,111,116,69,113,117,97,108,0,1, +0,0,8,120,0,0,1,0,0,8,121,0,0,0,1,8,58,98,118,101,99,52,0,18, +120,0,59,120,0,18,121,0,59,120,0,39,0,18,120,0,59,121,0,18,121,0,59,121, +0,39,0,18,120,0,59,122,0,18,121,0,59,122,0,39,0,18,120,0,59,119,0,18, +121,0,59,119,0,39,0,0,0,0,1,0,1,0,97,110,121,0,1,0,0,2,120,0, +0,0,1,8,18,120,0,59,120,0,18,120,0,59,121,0,32,0,0,1,0,1,0,97, +110,121,0,1,0,0,3,120,0,0,0,1,8,18,120,0,59,120,0,18,120,0,59,121, +0,32,18,120,0,59,122,0,32,0,0,1,0,1,0,97,110,121,0,1,0,0,4,120, +0,0,0,1,8,18,120,0,59,120,0,18,120,0,59,121,0,32,18,120,0,59,122,0, +32,18,120,0,59,119,0,32,0,0,1,0,1,0,97,108,108,0,1,0,0,2,120,0, +0,0,1,8,18,120,0,59,120,0,18,120,0,59,121,0,34,0,0,1,0,1,0,97, +108,108,0,1,0,0,3,120,0,0,0,1,8,18,120,0,59,120,0,18,120,0,59,121, +0,34,18,120,0,59,122,0,34,0,0,1,0,1,0,97,108,108,0,1,0,0,4,120, +0,0,0,1,8,18,120,0,59,120,0,18,120,0,59,121,0,34,18,120,0,59,122,0, +34,18,120,0,59,119,0,34,0,0,1,0,2,0,110,111,116,0,1,0,0,2,120,0, +0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,56,0,18,120,0,59,121, +0,56,0,0,0,0,1,0,3,0,110,111,116,0,1,0,0,3,120,0,0,0,1,8, +58,98,118,101,99,51,0,18,120,0,59,120,0,56,0,18,120,0,59,121,0,56,0,18, +120,0,59,122,0,56,0,0,0,0,1,0,4,0,110,111,116,0,1,0,0,4,120,0, +0,0,1,8,58,98,118,101,99,52,0,18,120,0,59,120,0,56,0,18,120,0,59,121, +0,56,0,18,120,0,59,122,0,56,0,18,120,0,59,119,0,56,0,0,0,0,1,0, +12,0,116,101,120,116,117,114,101,49,68,0,1,0,0,16,115,97,109,112,108,101,114,0, +0,1,0,0,9,99,111,111,114,100,0,0,0,1,8,58,118,101,99,52,0,17,48,0, +48,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,80,114,111,106, +0,1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,10,99,111,111,114,100,0, +0,0,1,8,58,116,101,120,116,117,114,101,49,68,0,18,115,97,109,112,108,101,114,0, +0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,116,0,49,0,0, +0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,0,0,16, +115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58, +116,101,120,116,117,114,101,49,68,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111, +114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,0,1,0,12, +0,116,101,120,116,117,114,101,50,68,0,1,0,0,17,115,97,109,112,108,101,114,0,0, +1,0,0,10,99,111,111,114,100,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48, +0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114,111,106,0, +1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0, +0,1,8,58,116,101,120,116,117,114,101,50,68,0,18,115,97,109,112,108,101,114,0,0, +58,118,101,99,50,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59, +112,0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,112,0, +49,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114,111,106, +0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0, +0,0,1,8,58,116,101,120,116,117,114,101,50,68,0,18,115,97,109,112,108,101,114,0, +0,58,118,101,99,50,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0, +59,113,0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,113, +0,49,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,0,1,0, +0,18,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1, +8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,116,101,120, +116,117,114,101,51,68,80,114,111,106,0,1,0,0,18,115,97,109,112,108,101,114,0,0, +1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,116,101,120,116,117,114,101,51,68, +0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114,100,0, +59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,116, +0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,112,0,18, +99,111,111,114,100,0,59,113,0,49,0,0,0,0,0,0,1,0,12,0,116,101,120,116, +117,114,101,67,117,98,101,0,1,0,0,19,115,97,109,112,108,101,114,0,0,1,0,0, +11,99,111,111,114,100,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0,0, +0,0,0,1,0,12,0,115,104,97,100,111,119,49,68,0,1,0,0,20,115,97,109,112, +108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,8,58,118,101,99,52, +0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,115,104,97,100,111,119,50,68,0, +1,0,0,21,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0, +0,1,8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,115, +104,97,100,111,119,49,68,80,114,111,106,0,1,0,0,20,115,97,109,112,108,101,114,0, +0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,115,104,97,100,111,119,49,68, +0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114,100,0, +59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,17,48,0,48,0,0,0,18,99, +111,111,114,100,0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,0,0, +0,1,0,12,0,115,104,97,100,111,119,50,68,80,114,111,106,0,1,0,0,21,115,97, +109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,115,104, +97,100,111,119,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18, +99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111, +111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114, +100,0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,0,0,0,1,0, +9,0,110,111,105,115,101,49,0,1,0,0,9,120,0,0,0,1,8,17,48,0,48,0, +0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,10,120,0,0,0,1,8, +17,48,0,48,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,11,120, +0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0, +1,0,0,12,120,0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,10,0,110,111, +105,115,101,50,0,1,0,0,9,120,0,0,0,1,8,58,118,101,99,50,0,17,48,0, +48,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,10,120,0, +0,0,1,8,58,118,101,99,50,0,17,48,0,48,0,0,0,0,0,0,1,0,10,0, +110,111,105,115,101,50,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,50,0,17, +48,0,48,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,12, +120,0,0,0,1,8,58,118,101,99,50,0,17,48,0,48,0,0,0,0,0,0,1,0, +11,0,110,111,105,115,101,51,0,1,0,0,9,120,0,0,0,1,8,58,118,101,99,51, +0,17,48,0,48,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0, +0,10,120,0,0,0,1,8,58,118,101,99,51,0,17,48,0,48,0,0,0,0,0,0, +1,0,11,0,110,111,105,115,101,51,0,1,0,0,11,120,0,0,0,1,8,58,118,101, +99,51,0,17,48,0,48,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0, +1,0,0,12,120,0,0,0,1,8,58,118,101,99,51,0,17,48,0,48,0,0,0,0, +0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,9,120,0,0,0,1,8,58, +118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,110,111,105,115,101, +52,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0, +0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,11,120,0,0,0,1, +8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,110,111,105, +115,101,52,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48, +0,0,0,0,0,0,0 \ No newline at end of file diff --git a/reactos/dll/mesa32/src/shader/slang/library/slang_core_gc.h b/reactos/dll/mesa32/src/shader/slang/library/slang_core_gc.h new file mode 100644 index 00000000000..f838859bbcd --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/library/slang_core_gc.h @@ -0,0 +1,1565 @@ +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"int __constructor (const float _f) {\n" +" int _i;\n" +" __asm float_to_int _i, _f;\n" +" return _i;\n" +"}\n" +"\n" +"bool __constructor (const int _i) {\n" +" return _i != 0;\n" +"}\n" +"\n" +"bool __constructor (const float _f) {\n" +" return _f != 0.0;\n" +"}\n" +"\n" +"int __constructor (const bool _b) {\n" +" return _b ? 1 : 0;\n" +"}\n" +"\n" +"float __constructor (const bool _b) {\n" +" return _b ? 1.0 : 0.0;\n" +"}\n" +"\n" +"float __constructor (const int _i) {\n" +" float _f;\n" +" __asm int_to_float _f, _i;\n" +" return _f;\n" +"}\n" +"\n" +"bool __constructor (const bool _b) {\n" +" return _b;\n" +"}\n" +"\n" +"int __constructor (const int _i) {\n" +" return _i;\n" +"}\n" +"\n" +"float __constructor (const float _f) {\n" +" return _f;\n" +"}\n" +"\n" +"vec2 __constructor (const float _f) {\n" +" return vec2 (_f, _f);\n" +"}\n" +"\n" +"vec2 __constructor (const int _i) {\n" +" return vec2 (_i, _i);\n" +"}\n" +"\n" +"vec2 __constructor (const bool _b) {\n" +" return vec2 (_b, _b);\n" +"}\n" +"\n" +"vec3 __constructor (const float _f) {\n" +" return vec3 (_f, _f, _f);\n" +"}\n" +"\n" +"vec3 __constructor (const int _i) {\n" +" return vec3 (_i, _i, _i);\n" +"}\n" +"\n" +"vec3 __constructor (const bool _b) {\n" +" return vec3 (_b, _b, _b);\n" +"}\n" +"\n" +"vec4 __constructor (const float _f) {\n" +" return vec4 (_f, _f, _f, _f);\n" +"}\n" +"\n" +"vec4 __constructor (const int _i) {\n" +" return vec4 (_i, _i, _i, _i);\n" +"}\n" +"\n" +"vec4 __constructor (const bool _b) {\n" +" return vec4 (_b, _b, _b, _b);\n" +"}\n" +"\n" +"ivec2 __constructor (const int _i) {\n" +" return ivec2 (_i, _i);\n" +"}\n" +"\n" +"ivec2 __constructor (const float _f) {\n" +" return ivec2 (_f, _f);\n" +"}\n" +"\n" +"ivec2 __constructor (const bool _b) {\n" +" return ivec2 (_b, _b);\n" +"}\n" +"\n" +"ivec3 __constructor (const int _i) {\n" +" return ivec3 (_i, _i, _i);\n" +"}\n" +"\n" +"ivec3 __constructor (const float _f) {\n" +" return ivec3 (_f, _f, _f);\n" +"}\n" +"\n" +"ivec3 __constructor (const bool _b) {\n" +" return ivec3 (_b, _b, _b);\n" +"}\n" +"\n" +"ivec4 __constructor (const int _i) {\n" +" return ivec4 (_i, _i, _i, _i);\n" +"}\n" +"\n" +"ivec4 __constructor (const float _f) {\n" +" return ivec4 (_f, _f, _f, _f);\n" +"}\n" +"\n" +"ivec4 __constructor (const bool _b) {\n" +" return ivec4 (_b, _b, _b, _b);\n" +"}\n" +"\n" +"bvec2 __constructor (const bool _b) {\n" +" return bvec2 (_b, _b);\n" +"}\n" +"\n" +"bvec2 __constructor (const float _f) {\n" +" return bvec2 (_f, _f);\n" +"}\n" +"\n" +"bvec2 __constructor (const int _i) {\n" +" return bvec2 (_i, _i);\n" +"}\n" +"\n" +"bvec3 __constructor (const bool _b) {\n" +" return bvec3 (_b, _b, _b);\n" +"}\n" +"\n" +"bvec3 __constructor (const float _f) {\n" +" return bvec3 (_f, _f, _f);\n" +"}\n" +"\n" +"bvec3 __constructor (const int _i) {\n" +" return bvec3 (_i, _i, _i);\n" +"}\n" +"\n" +"bvec4 __constructor (const bool _b) {\n" +" return bvec4 (_b, _b, _b, _b);\n" +"}\n" +"\n" +"bvec4 __constructor (const float _f) {\n" +" return bvec4 (_f, _f, _f, _f);\n" +"}\n" +"\n" +"bvec4 __constructor (const int _i) {\n" +" return bvec4 (_i, _i, _i, _i);\n" +"}\n" +"\n" +"mat2 __constructor (const float _f) {\n" +" return mat2 (\n" +" _f, .0,\n" +" .0, _f\n" +" );\n" +"}\n" +"\n" +"mat2 __constructor (const int _i) {\n" +" return mat2 (\n" +" _i, .0,\n" +" .0, _i\n" +" );\n" +"}\n" +"\n" +"mat2 __constructor (const bool _b) {\n" +" return mat2 (\n" +" _b, .0,\n" +" .0, _b\n" +" );\n" +"}\n" +"\n" +"mat3 __constructor (const float _f) {\n" +" return mat3 (\n" +" _f, .0, .0,\n" +" .0, _f, .0,\n" +" .0, .0, _f\n" +" );\n" +"}\n" +"\n" +"mat3 __constructor (const int _i) {\n" +" return mat3 (\n" +" _i, .0, .0,\n" +" .0, _i, .0,\n" +" .0, .0, _i\n" +" );\n" +"}\n" +"\n" +"mat3 __constructor (const bool _b) {\n" +" return mat3 (\n" +" _b, .0, .0,\n" +" .0, _b, .0,\n" +" .0, .0, _b\n" +" );\n" +"}\n" +"\n" +"mat4 __constructor (const float _f) {\n" +" return mat4 (\n" +" _f, .0, .0, .0,\n" +" .0, _f, .0, .0,\n" +" .0, .0, _f, .0,\n" +" .0, .0, .0, _f\n" +" );\n" +"}\n" +"\n" +"mat4 __constructor (const int _i) {\n" +" return mat4 (\n" +" _i, .0, .0, .0,\n" +" .0, _i, .0, .0,\n" +" .0, .0, _i, .0,\n" +" .0, .0, .0, _i\n" +" );\n" +"}\n" +"\n" +"mat4 __constructor (const bool _b) {\n" +" return mat4 (\n" +" _b, .0, .0, .0,\n" +" .0, _b, .0, .0,\n" +" .0, .0, _b, .0,\n" +" .0, .0, .0, _b\n" +" );\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"void __operator += (inout float a, const float b) {\n" +" __asm float_add a, a, b;\n" +"}\n" +"\n" +"float __operator - (const float a) {\n" +" float c;\n" +" __asm float_negate c, a;\n" +" return c;\n" +"}\n" +"\n" +"void __operator -= (inout float a, const float b) {\n" +" a += -b;\n" +"}\n" +"\n" +"void __operator *= (inout float a, const float b) {\n" +" __asm float_multiply a, a, b;\n" +"}\n" +"\n" +"void __operator /= (inout float a, const float b) {\n" +" __asm float_divide a, a, b;\n" +"}\n" +"\n" +"float __operator + (const float a, const float b) {\n" +" float c;\n" +" c = a;\n" +" return c += b;\n" +"}\n" +"\n" +"void __operator += (inout int a, const int b) {\n" +" a = int (float (a) + float (b));\n" +"}\n" +"\n" +"int __operator - (const int a) {\n" +" return int (-float (a));\n" +"}\n" +"\n" +"void __operator -= (inout int a, const int b) {\n" +" a += -b;\n" +"}\n" +"\n" +"float __operator * (const float a, const float b) {\n" +" float c;\n" +" c = a;\n" +" return c *= b;\n" +"}\n" +"\n" +"void __operator *= (inout int a, const int b) {\n" +" a = int (float (a) * float (b));\n" +"}\n" +"\n" +"float __operator / (const float a, const float b) {\n" +" float c;\n" +" c = a;\n" +" return c /= b;\n" +"}\n" +"\n" +"void __operator /= (inout int a, const int b) {\n" +" a = int (float (a) / float (b));\n" +"}\n" +"\n" +"void __operator += (inout vec2 v, const vec2 u) {\n" +" v.x += u.x, v.y += u.y;\n" +"}\n" +"\n" +"void __operator -= (inout vec2 v, const vec2 u) {\n" +" v.x -= u.x, v.y -= u.y;\n" +"}\n" +"\n" +"void __operator *= (inout vec2 v, const vec2 u) {\n" +" v.x *= u.x, v.y *= u.y;\n" +"}\n" +"\n" +"void __operator /= (inout vec2 v, const vec2 u) {\n" +" v.x /= u.x, v.y /= u.y;\n" +"}\n" +"\n" +"void __operator += (inout vec3 v, const vec3 u) {\n" +" v.x += u.x, v.y += u.y, v.z += u.z;\n" +"}\n" +"\n" +"void __operator -= (inout vec3 v, const vec3 u) {\n" +" v.x -= u.x, v.y -= u.y, v.z -= u.z;\n" +"}\n" +"\n" +"void __operator *= (inout vec3 v, const vec3 u) {\n" +" v.x *= u.x, v.y *= u.y, v.z *= u.z;\n" +"}\n" +"\n" +"void __operator /= (inout vec3 v, const vec3 u) {\n" +" v.x /= u.x, v.y /= u.y, v.z /= u.z;\n" +"}\n" +"\n" +"void __operator += (inout vec4 v, const vec4 u) {\n" +" v.x += u.x, v.y += u.y, v.z += u.z, v.w += u.w;\n" +"}\n" +"\n" +"void __operator -= (inout vec4 v, const vec4 u) {\n" +" v.x -= u.x, v.y -= u.y, v.z -= u.z, v.w -= u.w;\n" +"}\n" +"\n" +"void __operator *= (inout vec4 v, const vec4 u) {\n" +" v.x *= u.x, v.y *= u.y, v.z *= u.z, v.w *= u.w;\n" +"}\n" +"\n" +"void __operator /= (inout vec4 v, const vec4 u) {\n" +" v.x /= u.x, v.y /= u.y, v.z /= u.z, v.w /= u.w;\n" +"}\n" +"\n" +"void __operator += (inout ivec2 v, const ivec2 u) {\n" +" v.x += u.x, v.y += u.y;\n" +"}\n" +"\n" +"void __operator -= (inout ivec2 v, const ivec2 u) {\n" +" v.x -= u.x, v.y -= u.y;\n" +"}\n" +"\n" +"void __operator *= (inout ivec2 v, const ivec2 u) {\n" +" v.x *= u.x, v.y *= u.y;\n" +"}\n" +"\n" +"void __operator /= (inout ivec2 v, const ivec2 u) {\n" +" v.x /= u.x, v.y /= u.y;\n" +"}\n" +"\n" +"void __operator += (inout ivec3 v, const ivec3 u) {\n" +" v.x += u.x, v.y += u.y, v.z += u.z;\n" +"}\n" +"\n" +"void __operator -= (inout ivec3 v, const ivec3 u) {\n" +" v.x -= u.x, v.y -= u.y, v.z -= u.z;\n" +"}\n" +"\n" +"void __operator *= (inout ivec3 v, const ivec3 u) {\n" +" v.x *= u.x, v.y *= u.y, v.z *= u.z;\n" +"}\n" +"\n" +"void __operator /= (inout ivec3 v, const ivec3 u) {\n" +" v.x /= u.x, v.y /= u.y, v.z /= u.z;\n" +"}\n" +"\n" +"void __operator += (inout ivec4 v, const ivec4 u) {\n" +" v.x += u.x, v.y += u.y, v.z += u.z, v.w += u.w;\n" +"}\n" +"\n" +"void __operator -= (inout ivec4 v, const ivec4 u) {\n" +" v.x -= u.x, v.y -= u.y, v.z -= u.z, v.w -= u.w;\n" +"}\n" +"\n" +"void __operator *= (inout ivec4 v, const ivec4 u) {\n" +" v.x *= u.x, v.y *= u.y, v.z *= u.z, v.w *= u.w;\n" +"}\n" +"\n" +"void __operator /= (inout ivec4 v, const ivec4 u) {\n" +" v.x /= u.x, v.y /= u.y, v.z /= u.z, v.w /= u.w;\n" +"}\n" +"\n" +"void __operator += (inout mat2 m, const mat2 n) {\n" +" m[0] += n[0], m[1] += n[1];\n" +"}\n" +"\n" +"void __operator -= (inout mat2 m, const mat2 n) {\n" +" m[0] -= n[0], m[1] -= n[1];\n" +"}\n" +"\n" +"vec2 __operator * (const mat2 m, const vec2 v) {\n" +" return vec2 (\n" +" v.x * m[0].x + v.y * m[1].x,\n" +" v.x * m[0].y + v.y * m[1].y\n" +" );\n" +"}\n" +"\n" +"mat2 __operator * (const mat2 m, const mat2 n) {\n" +" return mat2 (m * n[0], m * n[1]);\n" +"}\n" +"\n" +"void __operator *= (inout mat2 m, const mat2 n) {\n" +" m = m * n;\n" +"}\n" +"\n" +"void __operator /= (inout mat2 m, const mat2 n) {\n" +" m[0] /= n[0], m[1] /= n[1];\n" +"}\n" +"\n" +"void __operator += (inout mat3 m, const mat3 n) {\n" +" m[0] += n[0], m[1] += n[1], m[2] += n[2];\n" +"}\n" +"\n" +"void __operator -= (inout mat3 m, const mat3 n) {\n" +" m[0] -= n[0], m[1] -= n[1], m[2] -= n[2];\n" +"}\n" +"\n" +"vec3 __operator * (const mat3 m, const vec3 v) {\n" +" return vec3 (\n" +" v.x * m[0].x + v.y * m[1].x + v.z * m[2].x,\n" +" v.x * m[0].y + v.y * m[1].y + v.z * m[2].y,\n" +" v.x * m[0].z + v.y * m[1].z + v.z * m[2].z\n" +" );\n" +"}\n" +"\n" +"mat3 __operator * (const mat3 m, const mat3 n) {\n" +" return mat3 (m * n[0], m * n[1], m * n[2]);\n" +"}\n" +"\n" +"void __operator *= (inout mat3 m, const mat3 n) {\n" +" m = m * n;\n" +"}\n" +"\n" +"void __operator /= (inout mat3 m, const mat3 n) {\n" +" m[0] /= n[0], m[1] /= n[1], m[2] /= n[2];\n" +"}\n" +"\n" +"void __operator += (inout mat4 m, const mat4 n) {\n" +" m[0] += n[0], m[1] += n[1], m[2] += n[2], m[3] += n[3];\n" +"}\n" +"\n" +"void __operator -= (inout mat4 m, const mat4 n) {\n" +" m[0] -= n[0], m[1] -= n[1], m[2] -= n[2], m[3] -= n[3];\n" +"}\n" +"\n" +"vec4 __operator * (const mat4 m, const vec4 v) {\n" +" return vec4 (\n" +" v.x * m[0].x + v.y * m[1].x + v.z * m[2].x + v.w * m[3].x,\n" +" v.x * m[0].y + v.y * m[1].y + v.z * m[2].y + v.w * m[3].y,\n" +" v.x * m[0].z + v.y * m[1].z + v.z * m[2].z + v.w * m[3].z,\n" +" v.x * m[0].w + v.y * m[1].w + v.z * m[2].w + v.w * m[3].w\n" +" );\n" +"}\n" +"\n" +"mat4 __operator * (const mat4 m, const mat4 n) {\n" +" return mat4 (m * n[0], m * n[1], m * n[2], m * n[3]);\n" +"}\n" +"\n" +"void __operator *= (inout mat4 m, const mat4 n) {\n" +" m = m * n;\n" +"}\n" +"\n" +"void __operator /= (inout mat4 m, const mat4 n) {\n" +" m[0] /= n[0], m[1] /= n[1], m[2] /= n[2], m[3] /= n[3];\n" +"}\n" +"\n" +"void __operator += (inout vec2 v, const float a) {\n" +" v.x += a, v.y += a;\n" +"}\n" +"\n" +"void __operator -= (inout vec2 v, const float a) {\n" +" v.x -= a, v.y -= a;\n" +"}\n" +"\n" +"void __operator *= (inout vec2 v, const float a) {\n" +" v.x *= a, v.y *= a;\n" +"}\n" +"\n" +"void __operator /= (inout vec2 v, const float a) {\n" +" v.x /= a, v.y /= a;\n" +"}\n" +"\n" +"void __operator += (inout vec3 v, const float a) {\n" +" v.x += a, v.y += a, v.z += a;\n" +"}\n" +"\n" +"void __operator -= (inout vec3 v, const float a) {\n" +" v.x -= a, v.y -= a, v.z -= a;\n" +"}\n" +"\n" +"void __operator *= (inout vec3 v, const float a) {\n" +" v.x *= a, v.y *= a, v.z *= a;\n" +"}\n" +"\n" +"void __operator /= (inout vec3 v, const float a) {\n" +" v.x /= a, v.y /= a, v.z /= a;\n" +"}\n" +"\n" +"void __operator += (inout vec4 v, const float a) {\n" +" v.x += a, v.y += a, v.z += a, v.w += a;\n" +"}\n" +"\n" +"void __operator -= (inout vec4 v, const float a) {\n" +" v.x -= a, v.y -= a, v.z -= a, v.w -= a;\n" +"}\n" +"\n" +"void __operator *= (inout vec4 v, const float a) {\n" +" v.x *= a, v.y *= a, v.z *= a, v.w *= a;\n" +"}\n" +"\n" +"void __operator /= (inout vec4 v, const float a) {\n" +" v.x /= a, v.y /= a, v.z /= a, v.w /= a;\n" +"}\n" +"\n" +"void __operator += (inout mat2 m, const float a) {\n" +" m[0] += a, m[1] += a;\n" +"}\n" +"\n" +"void __operator -= (inout mat2 m, const float a) {\n" +" m[0] -= a, m[1] -= a;\n" +"}\n" +"\n" +"void __operator *= (inout mat2 m, const float a) {\n" +" m[0] *= a, m[1] *= a;\n" +"}\n" +"\n" +"void __operator /= (inout mat2 m, const float a) {\n" +" m[0] /= a, m[1] /= a;\n" +"}\n" +"\n" +"void __operator += (inout mat3 m, const float a) {\n" +" m[0] += a, m[1] += a, m[2] += a;\n" +"}\n" +"\n" +"void __operator -= (inout mat3 m, const float a) {\n" +" m[0] -= a, m[1] -= a, m[2] -= a;\n" +"}\n" +"\n" +"void __operator *= (inout mat3 m, const float a) {\n" +" m[0] *= a, m[1] *= a, m[2] *= a;\n" +"}\n" +"\n" +"void __operator /= (inout mat3 m, const float a) {\n" +" m[0] /= a, m[1] /= a, m[2] /= a;\n" +"}\n" +"\n" +"void __operator += (inout mat4 m, const float a) {\n" +" m[0] += a, m[1] += a, m[2] += a, m[3] += a;\n" +"}\n" +"\n" +"void __operator -= (inout mat4 m, const float a) {\n" +" m[0] -= a, m[1] -= a, m[2] -= a, m[3] -= a;\n" +"}\n" +"\n" +"void __operator *= (inout mat4 m, const float a) {\n" +" m[0] *= a, m[1] *= a, m[2] *= a, m[3] *= a;\n" +"}\n" +"\n" +"void __operator /= (inout mat4 m, const float a) {\n" +" m[0] /= a, m[1] /= a, m[2] /= a, m[3] /= a;\n" +"}\n" +"\n" +"vec2 __operator * (const vec2 v, const mat2 m) {\n" +" return vec2 (\n" +" v.x * m[0].x + v.y * m[0].y,\n" +" v.x * m[1].x + v.y * m[1].y\n" +" );\n" +"}\n" +"\n" +"void __operator *= (inout vec2 v, const mat2 m) {\n" +" v = v * m;\n" +"}\n" +"\n" +"vec3 __operator * (const vec3 v, const mat3 m) {\n" +" return vec3 (\n" +" v.x * m[0].x + v.y * m[0].y + v.z * m[0].z,\n" +" v.x * m[1].x + v.y * m[1].y + v.z * m[1].z,\n" +" v.x * m[2].x + v.y * m[2].y + v.z * m[2].z\n" +" );\n" +"}\n" +"\n" +"void __operator *= (inout vec3 v, const mat3 m) {\n" +" v = v * m;\n" +"}\n" +"\n" +"vec4 __operator * (const vec4 v, const mat4 m) {\n" +" return vec4 (\n" +" v.x * m[0].x + v.y * m[0].y + v.z * m[0].z + v.w * m[0].w,\n" +" v.x * m[1].x + v.y * m[1].y + v.z * m[1].z + v.w * m[1].w,\n" +" v.x * m[2].x + v.y * m[2].y + v.z * m[2].z + v.w * m[2].w,\n" +" v.x * m[3].x + v.y * m[3].y + v.z * m[3].z + v.w * m[3].w\n" +" );\n" +"}\n" +"\n" +"void __operator *= (inout vec4 v, const mat4 m) {\n" +" v = v * m;\n" +"}\n" +"\n" +"float __operator - (const float a, const float b) {\n" +" return a + -b;\n" +"}\n" +"\n" +"int __operator + (const int a, const int b) {\n" +" int c;\n" +" c = a;\n" +" return c += b;\n" +"}\n" +"\n" +"int __operator - (const int a, const int b) {\n" +" return a + -b;\n" +"}\n" +"\n" +"int __operator * (const int a, const int b) {\n" +" int c;\n" +" return (c = a) *= b;\n" +"}\n" +"\n" +"int __operator / (const int a, const int b) {\n" +" int c;\n" +" return (c = a) /= b;\n" +"}\n" +"\n" +"vec2 __operator + (const vec2 v, const vec2 u) {\n" +" return vec2 (v.x + u.x, v.y + u.y);\n" +"}\n" +"\n" +"vec2 __operator - (const vec2 v, const vec2 u) {\n" +" return vec2 (v.x - u.x, v.y - u.y);\n" +"}\n" +"\n" +"vec3 __operator + (const vec3 v, const vec3 u) {\n" +" return vec3 (v.x + u.x, v.y + u.y, v.z + u.z);\n" +"}\n" +"\n" +"vec3 __operator - (const vec3 v, const vec3 u) {\n" +" return vec3 (v.x - u.x, v.y - u.y, v.z - u.z);\n" +"}\n" +"\n" +"vec4 __operator + (const vec4 v, const vec4 u) {\n" +" return vec4 (v.x + u.x, v.y + u.y, v.z + u.z, v.w + u.w);\n" +"}\n" +"\n" +"vec4 __operator - (const vec4 v, const vec4 u) {\n" +" return vec4 (v.x - u.x, v.y - u.y, v.z - u.z, v.w - u.w);\n" +"}\n" +"\n" +"ivec2 __operator + (const ivec2 v, const ivec2 u) {\n" +" return ivec2 (v.x + u.x, v.y + u.y);\n" +"}\n" +"\n" +"ivec2 __operator - (const ivec2 v, const ivec2 u) {\n" +" return ivec2 (v.x - u.x, v.y - u.y);\n" +"}\n" +"\n" +"ivec3 __operator + (const ivec3 v, const ivec3 u) {\n" +" return ivec3 (v.x + u.x, v.y + u.y, v.z + u.z);\n" +"}\n" +"\n" +"ivec3 __operator - (const ivec3 v, const ivec3 u) {\n" +" return ivec3 (v.x - u.x, v.y - u.y, v.z - u.z);\n" +"}\n" +"\n" +"ivec4 __operator + (const ivec4 v, const ivec4 u) {\n" +" return ivec4 (v.x + u.x, v.y + u.y, v.z + u.z, v.w + u.w);\n" +"}\n" +"\n" +"ivec4 __operator - (const ivec4 v, const ivec4 u) {\n" +" return ivec4 (v.x - u.x, v.y - u.y, v.z - u.z, v.w - u.w);\n" +"}\n" +"\n" +"mat2 __operator + (const mat2 m, const mat2 n) {\n" +" return mat2 (m[0] + n[0], m[1] + n[1]);\n" +"}\n" +"\n" +"mat2 __operator - (const mat2 m, const mat2 n) {\n" +" return mat2 (m[0] - n[0], m[1] - n[1]);\n" +"}\n" +"\n" +"mat3 __operator + (const mat3 m, const mat3 n) {\n" +" return mat3 (m[0] + n[0], m[1] + n[1], m[2] + n[2]);\n" +"}\n" +"\n" +"mat3 __operator - (const mat3 m, const mat3 n) {\n" +" return mat3 (m[0] - n[0], m[1] - n[1], m[2] - n[2]);\n" +"}\n" +"\n" +"mat4 __operator + (const mat4 m, const mat4 n) {\n" +" return mat4 (m[0] + n[0], m[1] + n[1], m[2] + n[2], m[3] + n[3]);\n" +"}\n" +"\n" +"mat4 __operator - (const mat4 m, const mat4 n) {\n" +" return mat4 (m[0] - n[0], m[1] - n[1], m[2] - n[2], m[3] - n[3]);\n" +"}\n" +"\n" +"vec2 __operator + (const float a, const vec2 u) {\n" +" return vec2 (a + u.x, a + u.y);\n" +"}\n" +"\n" +"vec2 __operator + (const vec2 v, const float b) {\n" +" return vec2 (v.x + b, v.y + b);\n" +"}\n" +"\n" +"vec2 __operator - (const float a, const vec2 u) {\n" +" return vec2 (a - u.x, a - u.y);\n" +"}\n" +"\n" +"vec2 __operator - (const vec2 v, const float b) {\n" +" return vec2 (v.x - b, v.y - b);\n" +"}\n" +"\n" +"vec2 __operator * (const float a, const vec2 u) {\n" +" return vec2 (a * u.x, a * u.y);\n" +"}\n" +"\n" +"vec2 __operator * (const vec2 v, const float b) {\n" +" return vec2 (v.x * b, v.y * b);\n" +"}\n" +"\n" +"vec2 __operator / (const float a, const vec2 u) {\n" +" return vec2 (a / u.x, a / u.y);\n" +"}\n" +"\n" +"vec2 __operator / (const vec2 v, const float b) {\n" +" return vec2 (v.x / b, v.y / b);\n" +"}\n" +"\n" +"vec3 __operator + (const float a, const vec3 u) {\n" +" return vec3 (a + u.x, a + u.y, a + u.z);\n" +"}\n" +"\n" +"vec3 __operator + (const vec3 v, const float b) {\n" +" return vec3 (v.x + b, v.y + b, v.z + b);\n" +"}\n" +"\n" +"vec3 __operator - (const float a, const vec3 u) {\n" +" return vec3 (a - u.x, a - u.y, a - u.z);\n" +"}\n" +"\n" +"vec3 __operator - (const vec3 v, const float b) {\n" +" return vec3 (v.x - b, v.y - b, v.z - b);\n" +"}\n" +"\n" +"vec3 __operator * (const float a, const vec3 u) {\n" +" return vec3 (a * u.x, a * u.y, a * u.z);\n" +"}\n" +"\n" +"vec3 __operator * (const vec3 v, const float b) {\n" +" return vec3 (v.x * b, v.y * b, v.z * b);\n" +"}\n" +"\n" +"vec3 __operator / (const float a, const vec3 u) {\n" +" return vec3 (a / u.x, a / u.y, a / u.z);\n" +"}\n" +"\n" +"vec3 __operator / (const vec3 v, const float b) {\n" +" return vec3 (v.x / b, v.y / b, v.z / b);\n" +"}\n" +"\n" +"vec4 __operator + (const float a, const vec4 u) {\n" +" return vec4 (a + u.x, a + u.y, a + u.z, a + u.w);\n" +"}\n" +"\n" +"vec4 __operator + (const vec4 v, const float b) {\n" +" return vec4 (v.x + b, v.y + b, v.z + b, v.w + b);\n" +"}\n" +"\n" +"vec4 __operator - (const float a, const vec4 u) {\n" +" return vec4 (a - u.x, a - u.y, a - u.z, a - u.w);\n" +"}\n" +"\n" +"vec4 __operator - (const vec4 v, const float b) {\n" +" return vec4 (v.x - b, v.y - b, v.z - b, v.w - b);\n" +"}\n" +"\n" +"vec4 __operator * (const float a, const vec4 u) {\n" +" return vec4 (a * u.x, a * u.y, a * u.z, a * u.w);\n" +"}\n" +"\n" +"vec4 __operator * (const vec4 v, const float b) {\n" +" return vec4 (v.x * b, v.y * b, v.z * b, v.w * b);\n" +"}\n" +"\n" +"vec4 __operator / (const float a, const vec4 u) {\n" +" return vec4 (a / u.x, a / u.y, a / u.z, a / u.w);\n" +"}\n" +"\n" +"vec4 __operator / (const vec4 v, const float b) {\n" +" return vec4 (v.x / b, v.y / b, v.z / b, v.w / b);\n" +"}\n" +"\n" +"mat2 __operator + (const float a, const mat2 n) {\n" +" return mat2 (a + n[0], a + n[1]);\n" +"}\n" +"\n" +"mat2 __operator + (const mat2 m, const float b) {\n" +" return mat2 (m[0] + b, m[1] + b);\n" +"}\n" +"\n" +"mat2 __operator - (const float a, const mat2 n) {\n" +" return mat2 (a - n[0], a - n[1]);\n" +"}\n" +"\n" +"mat2 __operator - (const mat2 m, const float b) {\n" +" return mat2 (m[0] - b, m[1] - b);\n" +"}\n" +"\n" +"mat2 __operator * (const float a, const mat2 n) {\n" +" return mat2 (a * n[0], a * n[1]);\n" +"}\n" +"\n" +"mat2 __operator * (const mat2 m, const float b) {\n" +" return mat2 (m[0] * b, m[1] * b);\n" +"}\n" +"\n" +"mat2 __operator / (const float a, const mat2 n) {\n" +" return mat2 (a / n[0], a / n[1]);\n" +"}\n" +"\n" +"mat2 __operator / (const mat2 m, const float b) {\n" +" return mat2 (m[0] / b, m[1] / b);\n" +"}\n" +"\n" +"mat3 __operator + (const float a, const mat3 n) {\n" +" return mat3 (a + n[0], a + n[1], a + n[2]);\n" +"}\n" +"\n" +"mat3 __operator + (const mat3 m, const float b) {\n" +" return mat3 (m[0] + b, m[1] + b, m[2] + b);\n" +"}\n" +"\n" +"mat3 __operator - (const float a, const mat3 n) {\n" +" return mat3 (a - n[0], a - n[1], a - n[2]);\n" +"}\n" +"\n" +"mat3 __operator - (const mat3 m, const float b) {\n" +" return mat3 (m[0] - b, m[1] - b, m[2] - b);\n" +"}\n" +"\n" +"mat3 __operator * (const float a, const mat3 n) {\n" +" return mat3 (a * n[0], a * n[1], a * n[2]);\n" +"}\n" +"\n" +"mat3 __operator * (const mat3 m, const float b) {\n" +" return mat3 (m[0] * b, m[1] * b, m[2] * b);\n" +"}\n" +"\n" +"mat3 __operator / (const float a, const mat3 n) {\n" +" return mat3 (a / n[0], a / n[1], a / n[2]);\n" +"}\n" +"\n" +"mat3 __operator / (const mat3 m, const float b) {\n" +" return mat3 (m[0] / b, m[1] / b, m[2] / b);\n" +"}\n" +"\n" +"mat4 __operator + (const float a, const mat4 n) {\n" +" return mat4 (a + n[0], a + n[1], a + n[2], a + n[3]);\n" +"}\n" +"\n" +"mat4 __operator + (const mat4 m, const float b) {\n" +" return mat4 (m[0] + b, m[1] + b, m[2] + b, m[3] + b);\n" +"}\n" +"\n" +"mat4 __operator - (const float a, const mat4 n) {\n" +" return mat4 (a - n[0], a - n[1], a - n[2], a - n[3]);\n" +"}\n" +"\n" +"mat4 __operator - (const mat4 m, const float b) {\n" +" return mat4 (m[0] - b, m[1] - b, m[2] - b, m[3] - b);\n" +"}\n" +"\n" +"mat4 __operator * (const float a, const mat4 n) {\n" +" return mat4 (a * n[0], a * n[1], a * n[2], a * n[3]);\n" +"}\n" +"\n" +"mat4 __operator * (const mat4 m, const float b) {\n" +" return mat4 (m[0] * b, m[1] * b, m[2] * b, m[3] * b);\n" +"}\n" +"\n" +"mat4 __operator / (const float a, const mat4 n) {\n" +" return mat4 (a / n[0], a / n[1], a / n[2], a / n[3]);\n" +"}\n" +"\n" +"mat4 __operator / (const mat4 m, const float b) {\n" +" return mat4 (m[0] / b, m[1] / b, m[2] / b, m[3] / b);\n" +"}\n" +"\n" +"ivec2 __operator + (const int a, const ivec2 u) {\n" +" return ivec2 (a + u.x, a + u.y);\n" +"}\n" +"\n" +"ivec2 __operator + (const ivec2 v, const int b) {\n" +" return ivec2 (v.x + b, v.y + b);\n" +"}\n" +"\n" +"ivec2 __operator - (const int a, const ivec2 u) {\n" +" return ivec2 (a - u.x, a - u.y);\n" +"}\n" +"\n" +"ivec2 __operator - (const ivec2 v, const int b) {\n" +" return ivec2 (v.x - b, v.y - b);\n" +"}\n" +"\n" +"ivec2 __operator * (const int a, const ivec2 u) {\n" +" return ivec2 (a * u.x, a * u.y);\n" +"}\n" +"\n" +"ivec2 __operator * (const ivec2 v, const int b) {\n" +" return ivec2 (v.x * b, v.y * b);\n" +"}\n" +"\n" +"ivec2 __operator / (const int a, const ivec2 u) {\n" +" return ivec2 (a / u.x, a / u.y);\n" +"}\n" +"\n" +"ivec2 __operator / (const ivec2 v, const int b) {\n" +" return ivec2 (v.x / b, v.y / b);\n" +"}\n" +"\n" +"ivec3 __operator + (const int a, const ivec3 u) {\n" +" return ivec3 (a + u.x, a + u.y, a + u.z);\n" +"}\n" +"\n" +"ivec3 __operator + (const ivec3 v, const int b) {\n" +" return ivec3 (v.x + b, v.y + b, v.z + b);\n" +"}\n" +"\n" +"ivec3 __operator - (const int a, const ivec3 u) {\n" +" return ivec3 (a - u.x, a - u.y, a - u.z);\n" +"}\n" +"\n" +"ivec3 __operator - (const ivec3 v, const int b) {\n" +" return ivec3 (v.x - b, v.y - b, v.z - b);\n" +"}\n" +"\n" +"ivec3 __operator * (const int a, const ivec3 u) {\n" +" return ivec3 (a * u.x, a * u.y, a * u.z);\n" +"}\n" +"\n" +"ivec3 __operator * (const ivec3 v, const int b) {\n" +" return ivec3 (v.x * b, v.y * b, v.z * b);\n" +"}\n" +"\n" +"ivec3 __operator / (const int a, const ivec3 u) {\n" +" return ivec3 (a / u.x, a / u.y, a / u.z);\n" +"}\n" +"\n" +"ivec3 __operator / (const ivec3 v, const int b) {\n" +" return ivec3 (v.x / b, v.y / b, v.z / b);\n" +"}\n" +"\n" +"ivec4 __operator + (const int a, const ivec4 u) {\n" +" return ivec4 (a + u.x, a + u.y, a + u.z, a + u.w);\n" +"}\n" +"\n" +"ivec4 __operator + (const ivec4 v, const int b) {\n" +" return ivec4 (v.x + b, v.y + b, v.z + b, v.w + b);\n" +"}\n" +"\n" +"ivec4 __operator - (const int a, const ivec4 u) {\n" +" return ivec4 (a - u.x, a - u.y, a - u.z, a - u.w);\n" +"}\n" +"\n" +"ivec4 __operator - (const ivec4 v, const int b) {\n" +" return ivec4 (v.x - b, v.y - b, v.z - b, v.w - b);\n" +"}\n" +"\n" +"ivec4 __operator * (const int a, const ivec4 u) {\n" +" return ivec4 (a * u.x, a * u.y, a * u.z, a * u.w);\n" +"}\n" +"\n" +"ivec4 __operator * (const ivec4 v, const int b) {\n" +" return ivec4 (v.x * b, v.y * b, v.z * b, v.w * b);\n" +"}\n" +"\n" +"ivec4 __operator / (const int a, const ivec4 u) {\n" +" return ivec4 (a / u.x, a / u.y, a / u.z, a / u.w);\n" +"}\n" +"\n" +"ivec4 __operator / (const ivec4 v, const int b) {\n" +" return ivec4 (v.x / b, v.y / b, v.z / b, v.w / b);\n" +"}\n" +"\n" +"vec2 __operator * (const vec2 v, const vec2 u) {\n" +" return vec2 (v.x * u.x, v.y * u.y);\n" +"}\n" +"\n" +"vec3 __operator * (const vec3 v, const vec3 u) {\n" +" return vec3 (v.x * u.x, v.y * u.y, v.z * u.z);\n" +"}\n" +"\n" +"vec4 __operator * (const vec4 v, const vec4 u) {\n" +" return vec4 (v.x * u.x, v.y * u.y, v.z * u.z, v.w * u.w);\n" +"}\n" +"\n" +"ivec2 __operator * (const ivec2 v, const ivec2 u) {\n" +" return ivec2 (v.x * u.x, v.y * u.y);\n" +"}\n" +"\n" +"ivec3 __operator * (const ivec3 v, const ivec3 u) {\n" +" return ivec3 (v.x * u.x, v.y * u.y, v.z * u.z);\n" +"}\n" +"\n" +"ivec4 __operator * (const ivec4 v, const ivec4 u) {\n" +" return ivec4 (v.x * u.x, v.y * u.y, v.z * u.z, v.w * u.w);\n" +"}\n" +"\n" +"vec2 __operator / (const vec2 v, const vec2 u) {\n" +" return vec2 (v.x / u.x, v.y / u.y);\n" +"}\n" +"\n" +"vec3 __operator / (const vec3 v, const vec3 u) {\n" +" return vec3 (v.x / u.x, v.y / u.y, v.z / u.z);\n" +"}\n" +"\n" +"vec4 __operator / (const vec4 v, const vec4 u) {\n" +" return vec4 (v.x / u.x, v.y / u.y, v.z / u.z, v.w / u.w);\n" +"}\n" +"\n" +"ivec2 __operator / (const ivec2 v, const ivec2 u) {\n" +" return ivec2 (v.x / u.x, v.y / u.y);\n" +"}\n" +"\n" +"ivec3 __operator / (const ivec3 v, const ivec3 u) {\n" +" return ivec3 (v.x / u.x, v.y / u.y, v.z / u.z);\n" +"}\n" +"\n" +"ivec4 __operator / (const ivec4 v, const ivec4 u) {\n" +" return ivec4 (v.x / u.x, v.y / u.y, v.z / u.z, v.w / u.w);\n" +"}\n" +"\n" +"mat2 __operator / (const mat2 m, const mat2 n) {\n" +" return mat2 (m[0] / n[0], m[1] / n[1]);\n" +"}\n" +"\n" +"mat3 __operator / (const mat3 m, const mat3 n) {\n" +" return mat3 (m[0] / n[0], m[1] / n[1], m[2] / n[2]);\n" +"}\n" +"\n" +"mat4 __operator / (const mat4 m, const mat4 n) {\n" +" return mat4 (m[0] / n[0], m[1] / n[1], m[2] / n[2], m[3] / n[3]);\n" +"}\n" +"\n" +"vec2 __operator - (const vec2 v) {\n" +" return vec2 (-v.x, -v.y);\n" +"}\n" +"\n" +"vec3 __operator - (const vec3 v) {\n" +" return vec3 (-v.x, -v.y, -v.z);\n" +"}\n" +"\n" +"vec4 __operator - (const vec4 v) {\n" +" return vec4 (-v.x, -v.y, -v.z, -v.w);\n" +"}\n" +"\n" +"ivec2 __operator - (const ivec2 v) {\n" +" return ivec2 (-v.x, -v.y);\n" +"}\n" +"\n" +"ivec3 __operator - (const ivec3 v) {\n" +" return ivec3 (-v.x, -v.y, -v.z);\n" +"}\n" +"\n" +"ivec4 __operator - (const ivec4 v) {\n" +" return ivec4 (-v.x, -v.y, -v.z, -v.w);\n" +"}\n" +"\n" +"mat2 __operator - (const mat2 m) {\n" +" return mat2 (-m[0], -m[1]);\n" +"}\n" +"\n" +"mat3 __operator - (const mat3 m) {\n" +" return mat3 (-m[0], -m[1], -m[2]);\n" +"}\n" +"\n" +"mat4 __operator - (const mat4 m) {\n" +" return mat4 (-m[0], -m[1], -m[2], -m[3]);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"void __operator -- (inout float a) {\n" +" a -= 1.0;\n" +"}\n" +"\n" +"void __operator -- (inout int a) {\n" +" a -= 1;\n" +"}\n" +"\n" +"void __operator -- (inout vec2 v) {\n" +" --v.x, --v.y;\n" +"}\n" +"\n" +"void __operator -- (inout vec3 v) {\n" +" --v.x, --v.y, --v.z;\n" +"}\n" +"\n" +"void __operator -- (inout vec4 v) {\n" +" --v.x, --v.y, --v.z, --v.w;\n" +"}\n" +"\n" +"void __operator -- (inout ivec2 v) {\n" +" --v.x, --v.y;\n" +"}\n" +"\n" +"void __operator -- (inout ivec3 v) {\n" +" --v.x, --v.y, --v.z;\n" +"}\n" +"\n" +"void __operator -- (inout ivec4 v) {\n" +" --v.x, --v.y, --v.z, --v.w;\n" +"}\n" +"\n" +"void __operator -- (inout mat2 m) {\n" +" --m[0], --m[1];\n" +"}\n" +"\n" +"void __operator -- (inout mat3 m) {\n" +" --m[0], --m[1], --m[2];\n" +"}\n" +"\n" +"void __operator -- (inout mat4 m) {\n" +" --m[0], --m[1], --m[2], --m[3];\n" +"}\n" +"\n" +"void __operator ++ (inout float a) {\n" +" a += 1.0;\n" +"}\n" +"\n" +"void __operator ++ (inout int a) {\n" +" a += 1;\n" +"}\n" +"\n" +"void __operator ++ (inout vec2 v) {\n" +" ++v.x, ++v.y;\n" +"}\n" +"\n" +"void __operator ++ (inout vec3 v) {\n" +" ++v.x, ++v.y, ++v.z;\n" +"}\n" +"\n" +"void __operator ++ (inout vec4 v) {\n" +" ++v.x, ++v.y, ++v.z, ++v.w;\n" +"}\n" +"\n" +"void __operator ++ (inout ivec2 v) {\n" +" ++v.x, ++v.y;\n" +"}\n" +"\n" +"void __operator ++ (inout ivec3 v) {\n" +" ++v.x, ++v.y, ++v.z;\n" +"}\n" +"\n" +"void __operator ++ (inout ivec4 v) {\n" +" ++v.x, ++v.y, ++v.z, ++v.w;\n" +"}\n" +"\n" +"void __operator ++ (inout mat2 m) {\n" +" ++m[0], ++m[1];\n" +"}\n" +"\n" +"void __operator ++ (inout mat3 m) {\n" +" ++m[0], ++m[1], ++m[2];\n" +"}\n" +"\n" +"void __operator ++ (inout mat4 m) {\n" +" ++m[0], ++m[1], ++m[2], ++m[3];\n" +"}\n" +"\n" +"float __operator -- (inout float a, const int) {\n" +" float c;\n" +" c = a;\n" +" --a;\n" +" return c;\n" +"}\n" +"\n" +"int __operator -- (inout int a, const int) {\n" +" int c;\n" +" c = a;\n" +" --a;\n" +" return c;\n" +"}\n" +"\n" +"vec2 __operator -- (inout vec2 v, const int) {\n" +" return vec2 (v.x--, v.y--);\n" +"}\n" +"\n" +"vec3 __operator -- (inout vec3 v, const int) {\n" +" return vec3 (v.x--, v.y--, v.z--);\n" +"}\n" +"\n" +"vec4 __operator -- (inout vec4 v, const int) {\n" +" return vec4 (v.x--, v.y--, v.z--, v.w--);\n" +"}\n" +"\n" +"ivec2 __operator -- (inout ivec2 v, const int) {\n" +" return ivec2 (v.x--, v.y--);\n" +"}\n" +"\n" +"ivec3 __operator -- (inout ivec3 v, const int) {\n" +" return ivec3 (v.x--, v.y--, v.z--);\n" +"}\n" +"\n" +"ivec4 __operator -- (inout ivec4 v, const int) {\n" +" return ivec4 (v.x--, v.y--, v.z--, v.w--);\n" +"}\n" +"\n" +"mat2 __operator -- (inout mat2 m, const int) {\n" +" return mat2 (m[0]--, m[1]--);\n" +"}\n" +"\n" +"mat3 __operator -- (inout mat3 m, const int) {\n" +" return mat3 (m[0]--, m[1]--, m[2]--);\n" +"}\n" +"\n" +"mat4 __operator -- (inout mat4 m, const int) {\n" +" return mat4 (m[0]--, m[1]--, m[2]--, m[3]--);\n" +"}\n" +"\n" +"float __operator ++ (inout float a, const int) {\n" +" float c;\n" +" c = a;\n" +" ++a;\n" +" return c;\n" +"}\n" +"\n" +"int __operator ++ (inout int a, const int) {\n" +" int c;\n" +" c = a;\n" +" ++a;\n" +" return c;\n" +"}\n" +"\n" +"vec2 __operator ++ (inout vec2 v, const int) {\n" +" return vec2 (v.x++, v.y++);\n" +"}\n" +"\n" +"vec3 __operator ++ (inout vec3 v, const int) {\n" +" return vec3 (v.x++, v.y++, v.z++);\n" +"}\n" +"\n" +"vec4 __operator ++ (inout vec4 v, const int) {\n" +" return vec4 (v.x++, v.y++, v.z++, v.w++);\n" +"}\n" +"\n" +"ivec2 __operator ++ (inout ivec2 v, const int) {\n" +" return ivec2 (v.x++, v.y++);\n" +"}\n" +"\n" +"ivec3 __operator ++ (inout ivec3 v, const int) {\n" +" return ivec3 (v.x++, v.y++, v.z++);\n" +"}\n" +"\n" +"ivec4 __operator ++ (inout ivec4 v, const int) {\n" +" return ivec4 (v.x++, v.y++, v.z++, v.w++);\n" +"}\n" +"\n" +"mat2 __operator ++ (inout mat2 m, const int) {\n" +" return mat2 (m[0]++, m[1]++);\n" +"}\n" +"\n" +"mat3 __operator ++ (inout mat3 m, const int) {\n" +" return mat3 (m[0]++, m[1]++, m[2]++);\n" +"}\n" +"\n" +"mat4 __operator ++ (inout mat4 m, const int) {\n" +" return mat4 (m[0]++, m[1]++, m[2]++, m[3]++);\n" +"}\n" +"\n" +"bool __operator < (const float a, const float b) {\n" +" bool c;\n" +" __asm float_less c, a, b;\n" +" return c;\n" +"}\n" +"\n" +"bool __operator < (const int a, const int b) {\n" +" return float (a) < float (b);\n" +"}\n" +"\n" +"bool __operator > (const float a, const float b) {\n" +" return b < a;\n" +"}\n" +"\n" +"bool __operator > (const int a, const int b) {\n" +" return b < a;\n" +"}\n" +"\n" +"bool __operator >= (const float a, const float b) {\n" +" return a > b || a == b;\n" +"}\n" +"\n" +"bool __operator >= (const int a, const int b) {\n" +" return a > b || a == b;\n" +"}\n" +"\n" +"bool __operator <= (const float a, const float b) {\n" +" return a < b || a == b;\n" +"}\n" +"\n" +"bool __operator <= (const int a, const int b) {\n" +" return a < b || a == b;\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"bool __operator ^^ (const bool a, const bool b) {\n" +" return a != b;\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"bool __operator ! (const bool a) {\n" +" return a == false;\n" +"}\n" +"\n" diff --git a/reactos/dll/mesa32/src/shader/slang/library/slang_core_gc_bin.h b/reactos/dll/mesa32/src/shader/slang/library/slang_core_gc_bin.h new file mode 100755 index 00000000000..ac53ceea877 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/library/slang_core_gc_bin.h @@ -0,0 +1,490 @@ +2,1,0,5,1,1,1,0,9,95,102,0,0,0,1,3,2,0,5,1,95,105,0,0,0,4,102,108,111,97,116,95,116,111,95,105,110, +116,0,18,95,105,0,0,18,95,102,0,0,0,8,18,95,105,0,0,0,1,0,1,1,1,1,0,5,95,105,0,0,0,1,8,18,95,105,0, +16,8,48,0,39,0,0,1,0,1,1,1,1,0,9,95,102,0,0,0,1,8,18,95,102,0,17,48,0,48,0,0,39,0,0,1,0,5,1,1,1,0,1, +95,98,0,0,0,1,8,18,95,98,0,16,10,49,0,16,8,48,0,31,0,0,1,0,9,1,1,1,0,1,95,98,0,0,0,1,8,18,95,98,0, +17,49,0,48,0,0,17,48,0,48,0,0,31,0,0,1,0,9,1,1,1,0,5,95,105,0,0,0,1,3,2,0,9,1,95,102,0,0,0,4,105, +110,116,95,116,111,95,102,108,111,97,116,0,18,95,102,0,0,18,95,105,0,0,0,8,18,95,102,0,0,0,1,0,1,1, +1,1,0,1,95,98,0,0,0,1,8,18,95,98,0,0,0,1,0,5,1,1,1,0,5,95,105,0,0,0,1,8,18,95,105,0,0,0,1,0,9,1,1,1, +0,9,95,102,0,0,0,1,8,18,95,102,0,0,0,1,0,10,1,1,1,0,9,95,102,0,0,0,1,8,58,118,101,99,50,0,18,95,102, +0,0,18,95,102,0,0,0,0,0,1,0,10,1,1,1,0,5,95,105,0,0,0,1,8,58,118,101,99,50,0,18,95,105,0,0,18,95, +105,0,0,0,0,0,1,0,10,1,1,1,0,1,95,98,0,0,0,1,8,58,118,101,99,50,0,18,95,98,0,0,18,95,98,0,0,0,0,0,1, +0,11,1,1,1,0,9,95,102,0,0,0,1,8,58,118,101,99,51,0,18,95,102,0,0,18,95,102,0,0,18,95,102,0,0,0,0,0, +1,0,11,1,1,1,0,5,95,105,0,0,0,1,8,58,118,101,99,51,0,18,95,105,0,0,18,95,105,0,0,18,95,105,0,0,0,0, +0,1,0,11,1,1,1,0,1,95,98,0,0,0,1,8,58,118,101,99,51,0,18,95,98,0,0,18,95,98,0,0,18,95,98,0,0,0,0,0, +1,0,12,1,1,1,0,9,95,102,0,0,0,1,8,58,118,101,99,52,0,18,95,102,0,0,18,95,102,0,0,18,95,102,0,0,18, +95,102,0,0,0,0,0,1,0,12,1,1,1,0,5,95,105,0,0,0,1,8,58,118,101,99,52,0,18,95,105,0,0,18,95,105,0,0, +18,95,105,0,0,18,95,105,0,0,0,0,0,1,0,12,1,1,1,0,1,95,98,0,0,0,1,8,58,118,101,99,52,0,18,95,98,0,0, +18,95,98,0,0,18,95,98,0,0,18,95,98,0,0,0,0,0,1,0,6,1,1,1,0,5,95,105,0,0,0,1,8,58,105,118,101,99,50, +0,18,95,105,0,0,18,95,105,0,0,0,0,0,1,0,6,1,1,1,0,9,95,102,0,0,0,1,8,58,105,118,101,99,50,0,18,95, +102,0,0,18,95,102,0,0,0,0,0,1,0,6,1,1,1,0,1,95,98,0,0,0,1,8,58,105,118,101,99,50,0,18,95,98,0,0,18, +95,98,0,0,0,0,0,1,0,7,1,1,1,0,5,95,105,0,0,0,1,8,58,105,118,101,99,51,0,18,95,105,0,0,18,95,105,0,0, +18,95,105,0,0,0,0,0,1,0,7,1,1,1,0,9,95,102,0,0,0,1,8,58,105,118,101,99,51,0,18,95,102,0,0,18,95,102, +0,0,18,95,102,0,0,0,0,0,1,0,7,1,1,1,0,1,95,98,0,0,0,1,8,58,105,118,101,99,51,0,18,95,98,0,0,18,95, +98,0,0,18,95,98,0,0,0,0,0,1,0,8,1,1,1,0,5,95,105,0,0,0,1,8,58,105,118,101,99,52,0,18,95,105,0,0,18, +95,105,0,0,18,95,105,0,0,18,95,105,0,0,0,0,0,1,0,8,1,1,1,0,9,95,102,0,0,0,1,8,58,105,118,101,99,52, +0,18,95,102,0,0,18,95,102,0,0,18,95,102,0,0,18,95,102,0,0,0,0,0,1,0,8,1,1,1,0,1,95,98,0,0,0,1,8,58, +105,118,101,99,52,0,18,95,98,0,0,18,95,98,0,0,18,95,98,0,0,18,95,98,0,0,0,0,0,1,0,2,1,1,1,0,1,95,98, +0,0,0,1,8,58,98,118,101,99,50,0,18,95,98,0,0,18,95,98,0,0,0,0,0,1,0,2,1,1,1,0,9,95,102,0,0,0,1,8,58, +98,118,101,99,50,0,18,95,102,0,0,18,95,102,0,0,0,0,0,1,0,2,1,1,1,0,5,95,105,0,0,0,1,8,58,98,118,101, +99,50,0,18,95,105,0,0,18,95,105,0,0,0,0,0,1,0,3,1,1,1,0,1,95,98,0,0,0,1,8,58,98,118,101,99,51,0,18, +95,98,0,0,18,95,98,0,0,18,95,98,0,0,0,0,0,1,0,3,1,1,1,0,9,95,102,0,0,0,1,8,58,98,118,101,99,51,0,18, +95,102,0,0,18,95,102,0,0,18,95,102,0,0,0,0,0,1,0,3,1,1,1,0,5,95,105,0,0,0,1,8,58,98,118,101,99,51,0, +18,95,105,0,0,18,95,105,0,0,18,95,105,0,0,0,0,0,1,0,4,1,1,1,0,1,95,98,0,0,0,1,8,58,98,118,101,99,52, +0,18,95,98,0,0,18,95,98,0,0,18,95,98,0,0,18,95,98,0,0,0,0,0,1,0,4,1,1,1,0,9,95,102,0,0,0,1,8,58,98, +118,101,99,52,0,18,95,102,0,0,18,95,102,0,0,18,95,102,0,0,18,95,102,0,0,0,0,0,1,0,4,1,1,1,0,5,95, +105,0,0,0,1,8,58,98,118,101,99,52,0,18,95,105,0,0,18,95,105,0,0,18,95,105,0,0,18,95,105,0,0,0,0,0,1, +0,13,1,1,1,0,9,95,102,0,0,0,1,8,58,109,97,116,50,0,18,95,102,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95, +102,0,0,0,0,0,1,0,13,1,1,1,0,5,95,105,0,0,0,1,8,58,109,97,116,50,0,18,95,105,0,0,17,0,48,0,0,0,17,0, +48,0,0,0,18,95,105,0,0,0,0,0,1,0,13,1,1,1,0,1,95,98,0,0,0,1,8,58,109,97,116,50,0,18,95,98,0,0,17,0, +48,0,0,0,17,0,48,0,0,0,18,95,98,0,0,0,0,0,1,0,14,1,1,1,0,9,95,102,0,0,0,1,8,58,109,97,116,51,0,18, +95,102,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,102,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0, +48,0,0,0,18,95,102,0,0,0,0,0,1,0,14,1,1,1,0,5,95,105,0,0,0,1,8,58,109,97,116,51,0,18,95,105,0,0,17, +0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,105,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18, +95,105,0,0,0,0,0,1,0,14,1,1,1,0,1,95,98,0,0,0,1,8,58,109,97,116,51,0,18,95,98,0,0,17,0,48,0,0,0,17, +0,48,0,0,0,17,0,48,0,0,0,18,95,98,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,98,0,0,0,0,0, +1,0,15,1,1,1,0,9,95,102,0,0,0,1,8,58,109,97,116,52,0,18,95,102,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0, +48,0,0,0,17,0,48,0,0,0,18,95,102,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95, +102,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,102,0,0,0,0,0,1,0,15,1,1,1,0, +5,95,105,0,0,0,1,8,58,109,97,116,52,0,18,95,105,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0, +48,0,0,0,18,95,105,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,105,0,0,17,0, +48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,105,0,0,0,0,0,1,0,15,1,1,1,0,1,95,98,0,0,0, +1,8,58,109,97,116,52,0,18,95,98,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95, +98,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,98,0,0,17,0,48,0,0,0,17,0,48,0, +0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,98,0,0,0,0,0,1,0,0,2,2,1,0,2,9,97,0,0,1,1,0,9,98,0,0,0,1,4, +102,108,111,97,116,95,97,100,100,0,18,97,0,0,18,97,0,0,18,98,0,0,0,0,1,0,9,2,30,1,1,0,9,97,0,0,0,1, +3,2,0,9,1,99,0,0,0,4,102,108,111,97,116,95,110,101,103,97,116,101,0,18,99,0,0,18,97,0,0,0,8,18,99,0, +0,0,1,0,0,2,3,1,0,2,9,97,0,0,1,1,0,9,98,0,0,0,1,9,18,97,0,18,98,0,54,21,0,0,1,0,0,2,4,1,0,2,9,97,0, +0,1,1,0,9,98,0,0,0,1,4,102,108,111,97,116,95,109,117,108,116,105,112,108,121,0,18,97,0,0,18,97,0,0, +18,98,0,0,0,0,1,0,0,2,5,1,0,2,9,97,0,0,1,1,0,9,98,0,0,0,1,4,102,108,111,97,116,95,100,105,118,105, +100,101,0,18,97,0,0,18,97,0,0,18,98,0,0,0,0,1,0,9,2,29,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,9,1, +99,0,0,0,9,18,99,0,18,97,0,20,0,8,18,99,0,18,98,0,21,0,0,1,0,0,2,2,1,0,2,5,97,0,0,1,1,0,5,98,0,0,0, +1,9,18,97,0,58,105,110,116,0,58,102,108,111,97,116,0,18,97,0,0,0,58,102,108,111,97,116,0,18,98,0,0, +0,46,0,0,20,0,0,1,0,5,2,30,1,1,0,5,97,0,0,0,1,8,58,105,110,116,0,58,102,108,111,97,116,0,18,97,0,0, +0,54,0,0,0,0,1,0,0,2,3,1,0,2,5,97,0,0,1,1,0,5,98,0,0,0,1,9,18,97,0,18,98,0,54,21,0,0,1,0,9,2,24,1,1, +0,9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,9,1,99,0,0,0,9,18,99,0,18,97,0,20,0,8,18,99,0,18,98,0,23,0,0,1, +0,0,2,4,1,0,2,5,97,0,0,1,1,0,5,98,0,0,0,1,9,18,97,0,58,105,110,116,0,58,102,108,111,97,116,0,18,97, +0,0,0,58,102,108,111,97,116,0,18,98,0,0,0,48,0,0,20,0,0,1,0,9,2,25,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0, +1,3,2,0,9,1,99,0,0,0,9,18,99,0,18,97,0,20,0,8,18,99,0,18,98,0,24,0,0,1,0,0,2,5,1,0,2,5,97,0,0,1,1,0, +5,98,0,0,0,1,9,18,97,0,58,105,110,116,0,58,102,108,111,97,116,0,18,97,0,0,0,58,102,108,111,97,116,0, +18,98,0,0,0,49,0,0,20,0,0,1,0,0,2,2,1,0,2,10,118,0,0,1,1,0,10,117,0,0,0,1,9,18,118,0,59,120,0,18, +117,0,59,120,0,21,18,118,0,59,121,0,18,117,0,59,121,0,21,19,0,0,1,0,0,2,3,1,0,2,10,118,0,0,1,1,0,10, +117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,22,18,118,0,59,121,0,18,117,0,59,121,0,22,19,0,0, +1,0,0,2,4,1,0,2,10,118,0,0,1,1,0,10,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,23,18,118,0, +59,121,0,18,117,0,59,121,0,23,19,0,0,1,0,0,2,5,1,0,2,10,118,0,0,1,1,0,10,117,0,0,0,1,9,18,118,0,59, +120,0,18,117,0,59,120,0,24,18,118,0,59,121,0,18,117,0,59,121,0,24,19,0,0,1,0,0,2,2,1,0,2,11,118,0,0, +1,1,0,11,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,21,18,118,0,59,121,0,18,117,0,59,121,0, +21,19,18,118,0,59,122,0,18,117,0,59,122,0,21,19,0,0,1,0,0,2,3,1,0,2,11,118,0,0,1,1,0,11,117,0,0,0,1, +9,18,118,0,59,120,0,18,117,0,59,120,0,22,18,118,0,59,121,0,18,117,0,59,121,0,22,19,18,118,0,59,122, +0,18,117,0,59,122,0,22,19,0,0,1,0,0,2,4,1,0,2,11,118,0,0,1,1,0,11,117,0,0,0,1,9,18,118,0,59,120,0, +18,117,0,59,120,0,23,18,118,0,59,121,0,18,117,0,59,121,0,23,19,18,118,0,59,122,0,18,117,0,59,122,0, +23,19,0,0,1,0,0,2,5,1,0,2,11,118,0,0,1,1,0,11,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,24, +18,118,0,59,121,0,18,117,0,59,121,0,24,19,18,118,0,59,122,0,18,117,0,59,122,0,24,19,0,0,1,0,0,2,2,1, +0,2,12,118,0,0,1,1,0,12,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,21,18,118,0,59,121,0,18, +117,0,59,121,0,21,19,18,118,0,59,122,0,18,117,0,59,122,0,21,19,18,118,0,59,119,0,18,117,0,59,119,0, +21,19,0,0,1,0,0,2,3,1,0,2,12,118,0,0,1,1,0,12,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,22, +18,118,0,59,121,0,18,117,0,59,121,0,22,19,18,118,0,59,122,0,18,117,0,59,122,0,22,19,18,118,0,59,119, +0,18,117,0,59,119,0,22,19,0,0,1,0,0,2,4,1,0,2,12,118,0,0,1,1,0,12,117,0,0,0,1,9,18,118,0,59,120,0, +18,117,0,59,120,0,23,18,118,0,59,121,0,18,117,0,59,121,0,23,19,18,118,0,59,122,0,18,117,0,59,122,0, +23,19,18,118,0,59,119,0,18,117,0,59,119,0,23,19,0,0,1,0,0,2,5,1,0,2,12,118,0,0,1,1,0,12,117,0,0,0,1, +9,18,118,0,59,120,0,18,117,0,59,120,0,24,18,118,0,59,121,0,18,117,0,59,121,0,24,19,18,118,0,59,122, +0,18,117,0,59,122,0,24,19,18,118,0,59,119,0,18,117,0,59,119,0,24,19,0,0,1,0,0,2,2,1,0,2,6,118,0,0,1, +1,0,6,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,21,18,118,0,59,121,0,18,117,0,59,121,0,21, +19,0,0,1,0,0,2,3,1,0,2,6,118,0,0,1,1,0,6,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,22,18, +118,0,59,121,0,18,117,0,59,121,0,22,19,0,0,1,0,0,2,4,1,0,2,6,118,0,0,1,1,0,6,117,0,0,0,1,9,18,118,0, +59,120,0,18,117,0,59,120,0,23,18,118,0,59,121,0,18,117,0,59,121,0,23,19,0,0,1,0,0,2,5,1,0,2,6,118,0, +0,1,1,0,6,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,24,18,118,0,59,121,0,18,117,0,59,121,0, +24,19,0,0,1,0,0,2,2,1,0,2,7,118,0,0,1,1,0,7,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,21,18, +118,0,59,121,0,18,117,0,59,121,0,21,19,18,118,0,59,122,0,18,117,0,59,122,0,21,19,0,0,1,0,0,2,3,1,0, +2,7,118,0,0,1,1,0,7,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,22,18,118,0,59,121,0,18,117,0, +59,121,0,22,19,18,118,0,59,122,0,18,117,0,59,122,0,22,19,0,0,1,0,0,2,4,1,0,2,7,118,0,0,1,1,0,7,117, +0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,23,18,118,0,59,121,0,18,117,0,59,121,0,23,19,18,118,0, +59,122,0,18,117,0,59,122,0,23,19,0,0,1,0,0,2,5,1,0,2,7,118,0,0,1,1,0,7,117,0,0,0,1,9,18,118,0,59, +120,0,18,117,0,59,120,0,24,18,118,0,59,121,0,18,117,0,59,121,0,24,19,18,118,0,59,122,0,18,117,0,59, +122,0,24,19,0,0,1,0,0,2,2,1,0,2,8,118,0,0,1,1,0,8,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0, +21,18,118,0,59,121,0,18,117,0,59,121,0,21,19,18,118,0,59,122,0,18,117,0,59,122,0,21,19,18,118,0,59, +119,0,18,117,0,59,119,0,21,19,0,0,1,0,0,2,3,1,0,2,8,118,0,0,1,1,0,8,117,0,0,0,1,9,18,118,0,59,120,0, +18,117,0,59,120,0,22,18,118,0,59,121,0,18,117,0,59,121,0,22,19,18,118,0,59,122,0,18,117,0,59,122,0, +22,19,18,118,0,59,119,0,18,117,0,59,119,0,22,19,0,0,1,0,0,2,4,1,0,2,8,118,0,0,1,1,0,8,117,0,0,0,1,9, +18,118,0,59,120,0,18,117,0,59,120,0,23,18,118,0,59,121,0,18,117,0,59,121,0,23,19,18,118,0,59,122,0, +18,117,0,59,122,0,23,19,18,118,0,59,119,0,18,117,0,59,119,0,23,19,0,0,1,0,0,2,5,1,0,2,8,118,0,0,1,1, +0,8,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,24,18,118,0,59,121,0,18,117,0,59,121,0,24,19, +18,118,0,59,122,0,18,117,0,59,122,0,24,19,18,118,0,59,119,0,18,117,0,59,119,0,24,19,0,0,1,0,0,2,2,1, +0,2,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,21,18,109,0,16,10, +49,0,57,18,110,0,16,10,49,0,57,21,19,0,0,1,0,0,2,3,1,0,2,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,109,0, +16,8,48,0,57,18,110,0,16,8,48,0,57,22,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,22,19,0,0,1,0, +10,2,24,1,1,0,13,109,0,0,1,1,0,10,118,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,18,109,0,16,8, +48,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,120,0,48,46,0,18,118,0,59,120,0,18, +109,0,16,8,48,0,57,59,121,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,121,0,48,46,0,0,0,0,1,0, +13,2,24,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,8,58,109,97,116,50,0,18,109,0,18,110,0,16,8,48,0,57, +48,0,18,109,0,18,110,0,16,10,49,0,57,48,0,0,0,0,1,0,0,2,4,1,0,2,13,109,0,0,1,1,0,13,110,0,0,0,1,9, +18,109,0,18,109,0,18,110,0,48,20,0,0,1,0,0,2,5,1,0,2,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,109,0,16, +8,48,0,57,18,110,0,16,8,48,0,57,24,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,24,19,0,0,1,0,0,2, +2,1,0,2,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,21,18,109,0, +16,10,49,0,57,18,110,0,16,10,49,0,57,21,19,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,21,19,0,0, +1,0,0,2,3,1,0,2,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,22,18, +109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,22,19,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,22, +19,0,0,1,0,11,2,24,1,1,0,14,109,0,0,1,1,0,11,118,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,18, +109,0,16,8,48,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,120,0,48,46,18,118,0,59, +122,0,18,109,0,16,10,50,0,57,59,120,0,48,46,0,18,118,0,59,120,0,18,109,0,16,8,48,0,57,59,121,0,48, +18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,121,0,48,46,18,118,0,59,122,0,18,109,0,16,10,50,0,57,59, +121,0,48,46,0,18,118,0,59,120,0,18,109,0,16,8,48,0,57,59,122,0,48,18,118,0,59,121,0,18,109,0,16,10, +49,0,57,59,122,0,48,46,18,118,0,59,122,0,18,109,0,16,10,50,0,57,59,122,0,48,46,0,0,0,0,1,0,14,2,24, +1,1,0,14,109,0,0,1,1,0,14,110,0,0,0,1,8,58,109,97,116,51,0,18,109,0,18,110,0,16,8,48,0,57,48,0,18, +109,0,18,110,0,16,10,49,0,57,48,0,18,109,0,18,110,0,16,10,50,0,57,48,0,0,0,0,1,0,0,2,4,1,0,2,14,109, +0,0,1,1,0,14,110,0,0,0,1,9,18,109,0,18,109,0,18,110,0,48,20,0,0,1,0,0,2,5,1,0,2,14,109,0,0,1,1,0,14, +110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,24,18,109,0,16,10,49,0,57,18,110,0,16,10, +49,0,57,24,19,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,24,19,0,0,1,0,0,2,2,1,0,2,15,109,0,0,1, +1,0,15,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,21,18,109,0,16,10,49,0,57,18,110,0, +16,10,49,0,57,21,19,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,21,19,18,109,0,16,10,51,0,57,18, +110,0,16,10,51,0,57,21,19,0,0,1,0,0,2,3,1,0,2,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18,109,0,16,8,48,0, +57,18,110,0,16,8,48,0,57,22,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,22,19,18,109,0,16,10,50,0, +57,18,110,0,16,10,50,0,57,22,19,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,22,19,0,0,1,0,12,2,24, +1,1,0,15,109,0,0,1,1,0,12,118,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,109,0,16,8,48,0,57, +59,120,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,120,0,48,46,18,118,0,59,122,0,18,109,0,16, +10,50,0,57,59,120,0,48,46,18,118,0,59,119,0,18,109,0,16,10,51,0,57,59,120,0,48,46,0,18,118,0,59,120, +0,18,109,0,16,8,48,0,57,59,121,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,121,0,48,46,18,118, +0,59,122,0,18,109,0,16,10,50,0,57,59,121,0,48,46,18,118,0,59,119,0,18,109,0,16,10,51,0,57,59,121,0, +48,46,0,18,118,0,59,120,0,18,109,0,16,8,48,0,57,59,122,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0, +57,59,122,0,48,46,18,118,0,59,122,0,18,109,0,16,10,50,0,57,59,122,0,48,46,18,118,0,59,119,0,18,109, +0,16,10,51,0,57,59,122,0,48,46,0,18,118,0,59,120,0,18,109,0,16,8,48,0,57,59,119,0,48,18,118,0,59, +121,0,18,109,0,16,10,49,0,57,59,119,0,48,46,18,118,0,59,122,0,18,109,0,16,10,50,0,57,59,119,0,48,46, +18,118,0,59,119,0,18,109,0,16,10,51,0,57,59,119,0,48,46,0,0,0,0,1,0,15,2,24,1,1,0,15,109,0,0,1,1,0, +15,110,0,0,0,1,8,58,109,97,116,52,0,18,109,0,18,110,0,16,8,48,0,57,48,0,18,109,0,18,110,0,16,10,49, +0,57,48,0,18,109,0,18,110,0,16,10,50,0,57,48,0,18,109,0,18,110,0,16,10,51,0,57,48,0,0,0,0,1,0,0,2,4, +1,0,2,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18,109,0,18,109,0,18,110,0,48,20,0,0,1,0,0,2,5,1,0,2,15,109, +0,0,1,1,0,15,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,24,18,109,0,16,10,49,0,57,18, +110,0,16,10,49,0,57,24,19,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,24,19,18,109,0,16,10,51,0, +57,18,110,0,16,10,51,0,57,24,19,0,0,1,0,0,2,2,1,0,2,10,118,0,0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120, +0,18,97,0,21,18,118,0,59,121,0,18,97,0,21,19,0,0,1,0,0,2,3,1,0,2,10,118,0,0,1,1,0,9,97,0,0,0,1,9,18, +118,0,59,120,0,18,97,0,22,18,118,0,59,121,0,18,97,0,22,19,0,0,1,0,0,2,4,1,0,2,10,118,0,0,1,1,0,9,97, +0,0,0,1,9,18,118,0,59,120,0,18,97,0,23,18,118,0,59,121,0,18,97,0,23,19,0,0,1,0,0,2,5,1,0,2,10,118,0, +0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0,18,97,0,24,18,118,0,59,121,0,18,97,0,24,19,0,0,1,0,0,2,2,1, +0,2,11,118,0,0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0,18,97,0,21,18,118,0,59,121,0,18,97,0,21,19,18, +118,0,59,122,0,18,97,0,21,19,0,0,1,0,0,2,3,1,0,2,11,118,0,0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0, +18,97,0,22,18,118,0,59,121,0,18,97,0,22,19,18,118,0,59,122,0,18,97,0,22,19,0,0,1,0,0,2,4,1,0,2,11, +118,0,0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0,18,97,0,23,18,118,0,59,121,0,18,97,0,23,19,18,118,0, +59,122,0,18,97,0,23,19,0,0,1,0,0,2,5,1,0,2,11,118,0,0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0,18,97, +0,24,18,118,0,59,121,0,18,97,0,24,19,18,118,0,59,122,0,18,97,0,24,19,0,0,1,0,0,2,2,1,0,2,12,118,0,0, +1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0,18,97,0,21,18,118,0,59,121,0,18,97,0,21,19,18,118,0,59,122,0, +18,97,0,21,19,18,118,0,59,119,0,18,97,0,21,19,0,0,1,0,0,2,3,1,0,2,12,118,0,0,1,1,0,9,97,0,0,0,1,9, +18,118,0,59,120,0,18,97,0,22,18,118,0,59,121,0,18,97,0,22,19,18,118,0,59,122,0,18,97,0,22,19,18,118, +0,59,119,0,18,97,0,22,19,0,0,1,0,0,2,4,1,0,2,12,118,0,0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0,18, +97,0,23,18,118,0,59,121,0,18,97,0,23,19,18,118,0,59,122,0,18,97,0,23,19,18,118,0,59,119,0,18,97,0, +23,19,0,0,1,0,0,2,5,1,0,2,12,118,0,0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0,18,97,0,24,18,118,0,59, +121,0,18,97,0,24,19,18,118,0,59,122,0,18,97,0,24,19,18,118,0,59,119,0,18,97,0,24,19,0,0,1,0,0,2,2,1, +0,2,13,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,21,18,109,0,16,10,49,0,57,18,97,0, +21,19,0,0,1,0,0,2,3,1,0,2,13,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,22,18,109,0, +16,10,49,0,57,18,97,0,22,19,0,0,1,0,0,2,4,1,0,2,13,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0, +57,18,97,0,23,18,109,0,16,10,49,0,57,18,97,0,23,19,0,0,1,0,0,2,5,1,0,2,13,109,0,0,1,1,0,9,97,0,0,0, +1,9,18,109,0,16,8,48,0,57,18,97,0,24,18,109,0,16,10,49,0,57,18,97,0,24,19,0,0,1,0,0,2,2,1,0,2,14, +109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,21,18,109,0,16,10,49,0,57,18,97,0,21,19, +18,109,0,16,10,50,0,57,18,97,0,21,19,0,0,1,0,0,2,3,1,0,2,14,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0, +16,8,48,0,57,18,97,0,22,18,109,0,16,10,49,0,57,18,97,0,22,19,18,109,0,16,10,50,0,57,18,97,0,22,19,0, +0,1,0,0,2,4,1,0,2,14,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,23,18,109,0,16,10, +49,0,57,18,97,0,23,19,18,109,0,16,10,50,0,57,18,97,0,23,19,0,0,1,0,0,2,5,1,0,2,14,109,0,0,1,1,0,9, +97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,24,18,109,0,16,10,49,0,57,18,97,0,24,19,18,109,0,16,10, +50,0,57,18,97,0,24,19,0,0,1,0,0,2,2,1,0,2,15,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18, +97,0,21,18,109,0,16,10,49,0,57,18,97,0,21,19,18,109,0,16,10,50,0,57,18,97,0,21,19,18,109,0,16,10,51, +0,57,18,97,0,21,19,0,0,1,0,0,2,3,1,0,2,15,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97, +0,22,18,109,0,16,10,49,0,57,18,97,0,22,19,18,109,0,16,10,50,0,57,18,97,0,22,19,18,109,0,16,10,51,0, +57,18,97,0,22,19,0,0,1,0,0,2,4,1,0,2,15,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0, +23,18,109,0,16,10,49,0,57,18,97,0,23,19,18,109,0,16,10,50,0,57,18,97,0,23,19,18,109,0,16,10,51,0,57, +18,97,0,23,19,0,0,1,0,0,2,5,1,0,2,15,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,24, +18,109,0,16,10,49,0,57,18,97,0,24,19,18,109,0,16,10,50,0,57,18,97,0,24,19,18,109,0,16,10,51,0,57,18, +97,0,24,19,0,0,1,0,10,2,24,1,1,0,10,118,0,0,1,1,0,13,109,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59, +120,0,18,109,0,16,8,48,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,8,48,0,57,59,121,0,48,46,0,18, +118,0,59,120,0,18,109,0,16,10,49,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,121,0, +48,46,0,0,0,0,1,0,0,2,4,1,0,2,10,118,0,0,1,1,0,13,109,0,0,0,1,9,18,118,0,18,118,0,18,109,0,48,20,0, +0,1,0,11,2,24,1,1,0,11,118,0,0,1,1,0,14,109,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,18,109,0, +16,8,48,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,8,48,0,57,59,121,0,48,46,18,118,0,59,122,0, +18,109,0,16,8,48,0,57,59,122,0,48,46,0,18,118,0,59,120,0,18,109,0,16,10,49,0,57,59,120,0,48,18,118, +0,59,121,0,18,109,0,16,10,49,0,57,59,121,0,48,46,18,118,0,59,122,0,18,109,0,16,10,49,0,57,59,122,0, +48,46,0,18,118,0,59,120,0,18,109,0,16,10,50,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,10,50,0, +57,59,121,0,48,46,18,118,0,59,122,0,18,109,0,16,10,50,0,57,59,122,0,48,46,0,0,0,0,1,0,0,2,4,1,0,2, +11,118,0,0,1,1,0,14,109,0,0,0,1,9,18,118,0,18,118,0,18,109,0,48,20,0,0,1,0,12,2,24,1,1,0,12,118,0,0, +1,1,0,15,109,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,109,0,16,8,48,0,57,59,120,0,48,18, +118,0,59,121,0,18,109,0,16,8,48,0,57,59,121,0,48,46,18,118,0,59,122,0,18,109,0,16,8,48,0,57,59,122, +0,48,46,18,118,0,59,119,0,18,109,0,16,8,48,0,57,59,119,0,48,46,0,18,118,0,59,120,0,18,109,0,16,10, +49,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,121,0,48,46,18,118,0,59,122,0,18, +109,0,16,10,49,0,57,59,122,0,48,46,18,118,0,59,119,0,18,109,0,16,10,49,0,57,59,119,0,48,46,0,18,118, +0,59,120,0,18,109,0,16,10,50,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,10,50,0,57,59,121,0,48, +46,18,118,0,59,122,0,18,109,0,16,10,50,0,57,59,122,0,48,46,18,118,0,59,119,0,18,109,0,16,10,50,0,57, +59,119,0,48,46,0,18,118,0,59,120,0,18,109,0,16,10,51,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16, +10,51,0,57,59,121,0,48,46,18,118,0,59,122,0,18,109,0,16,10,51,0,57,59,122,0,48,46,18,118,0,59,119,0, +18,109,0,16,10,51,0,57,59,119,0,48,46,0,0,0,0,1,0,0,2,4,1,0,2,12,118,0,0,1,1,0,15,109,0,0,0,1,9,18, +118,0,18,118,0,18,109,0,48,20,0,0,1,0,9,2,30,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,8,18,97,0,18,98,0,54, +46,0,0,1,0,5,2,29,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,3,2,0,5,1,99,0,0,0,9,18,99,0,18,97,0,20,0,8,18, +99,0,18,98,0,21,0,0,1,0,5,2,30,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,8,18,97,0,18,98,0,54,46,0,0,1,0,5, +2,24,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,3,2,0,5,1,99,0,0,0,8,18,99,0,18,97,0,20,18,98,0,23,0,0,1,0,5, +2,25,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,3,2,0,5,1,99,0,0,0,8,18,99,0,18,97,0,20,18,98,0,24,0,0,1,0, +10,2,29,1,1,0,10,118,0,0,1,1,0,10,117,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59, +120,0,46,0,18,118,0,59,121,0,18,117,0,59,121,0,46,0,0,0,0,1,0,10,2,30,1,1,0,10,118,0,0,1,1,0,10,117, +0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59,120,0,47,0,18,118,0,59,121,0,18,117,0,59, +121,0,47,0,0,0,0,1,0,11,2,29,1,1,0,11,118,0,0,1,1,0,11,117,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59, +120,0,18,117,0,59,120,0,46,0,18,118,0,59,121,0,18,117,0,59,121,0,46,0,18,118,0,59,122,0,18,117,0,59, +122,0,46,0,0,0,0,1,0,11,2,30,1,1,0,11,118,0,0,1,1,0,11,117,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59, +120,0,18,117,0,59,120,0,47,0,18,118,0,59,121,0,18,117,0,59,121,0,47,0,18,118,0,59,122,0,18,117,0,59, +122,0,47,0,0,0,0,1,0,12,2,29,1,1,0,12,118,0,0,1,1,0,12,117,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59, +120,0,18,117,0,59,120,0,46,0,18,118,0,59,121,0,18,117,0,59,121,0,46,0,18,118,0,59,122,0,18,117,0,59, +122,0,46,0,18,118,0,59,119,0,18,117,0,59,119,0,46,0,0,0,0,1,0,12,2,30,1,1,0,12,118,0,0,1,1,0,12,117, +0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,47,0,18,118,0,59,121,0,18,117,0,59, +121,0,47,0,18,118,0,59,122,0,18,117,0,59,122,0,47,0,18,118,0,59,119,0,18,117,0,59,119,0,47,0,0,0,0, +1,0,6,2,29,1,1,0,6,118,0,0,1,1,0,6,117,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0,18,117,0, +59,120,0,46,0,18,118,0,59,121,0,18,117,0,59,121,0,46,0,0,0,0,1,0,6,2,30,1,1,0,6,118,0,0,1,1,0,6,117, +0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59,120,0,47,0,18,118,0,59,121,0,18,117, +0,59,121,0,47,0,0,0,0,1,0,7,2,29,1,1,0,7,118,0,0,1,1,0,7,117,0,0,0,1,8,58,105,118,101,99,51,0,18, +118,0,59,120,0,18,117,0,59,120,0,46,0,18,118,0,59,121,0,18,117,0,59,121,0,46,0,18,118,0,59,122,0,18, +117,0,59,122,0,46,0,0,0,0,1,0,7,2,30,1,1,0,7,118,0,0,1,1,0,7,117,0,0,0,1,8,58,105,118,101,99,51,0, +18,118,0,59,120,0,18,117,0,59,120,0,47,0,18,118,0,59,121,0,18,117,0,59,121,0,47,0,18,118,0,59,122,0, +18,117,0,59,122,0,47,0,0,0,0,1,0,8,2,29,1,1,0,8,118,0,0,1,1,0,8,117,0,0,0,1,8,58,105,118,101,99,52, +0,18,118,0,59,120,0,18,117,0,59,120,0,46,0,18,118,0,59,121,0,18,117,0,59,121,0,46,0,18,118,0,59,122, +0,18,117,0,59,122,0,46,0,18,118,0,59,119,0,18,117,0,59,119,0,46,0,0,0,0,1,0,8,2,30,1,1,0,8,118,0,0, +1,1,0,8,117,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,47,0,18,118,0,59, +121,0,18,117,0,59,121,0,47,0,18,118,0,59,122,0,18,117,0,59,122,0,47,0,18,118,0,59,119,0,18,117,0,59, +119,0,47,0,0,0,0,1,0,13,2,29,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16, +8,48,0,57,18,110,0,16,8,48,0,57,46,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,46,0,0,0,0,1,0, +13,2,30,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8,48,0,57,18,110,0, +16,8,48,0,57,47,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,47,0,0,0,0,1,0,14,2,29,1,1,0,14,109, +0,0,1,1,0,14,110,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,46,0,18, +109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,46,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,46,0, +0,0,0,1,0,14,2,30,1,1,0,14,109,0,0,1,1,0,14,110,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57, +18,110,0,16,8,48,0,57,47,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,47,0,18,109,0,16,10,50,0, +57,18,110,0,16,10,50,0,57,47,0,0,0,0,1,0,15,2,29,1,1,0,15,109,0,0,1,1,0,15,110,0,0,0,1,8,58,109,97, +116,52,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,46,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49, +0,57,46,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,46,0,18,109,0,16,10,51,0,57,18,110,0,16,10, +51,0,57,46,0,0,0,0,1,0,15,2,30,1,1,0,15,109,0,0,1,1,0,15,110,0,0,0,1,8,58,109,97,116,52,0,18,109,0, +16,8,48,0,57,18,110,0,16,8,48,0,57,47,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,47,0,18,109,0, +16,10,50,0,57,18,110,0,16,10,50,0,57,47,0,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,47,0,0,0,0, +1,0,10,2,29,1,1,0,9,97,0,0,1,1,0,10,117,0,0,0,1,8,58,118,101,99,50,0,18,97,0,18,117,0,59,120,0,46,0, +18,97,0,18,117,0,59,121,0,46,0,0,0,0,1,0,10,2,29,1,1,0,10,118,0,0,1,1,0,9,98,0,0,0,1,8,58,118,101, +99,50,0,18,118,0,59,120,0,18,98,0,46,0,18,118,0,59,121,0,18,98,0,46,0,0,0,0,1,0,10,2,30,1,1,0,9,97, +0,0,1,1,0,10,117,0,0,0,1,8,58,118,101,99,50,0,18,97,0,18,117,0,59,120,0,47,0,18,97,0,18,117,0,59, +121,0,47,0,0,0,0,1,0,10,2,30,1,1,0,10,118,0,0,1,1,0,9,98,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59, +120,0,18,98,0,47,0,18,118,0,59,121,0,18,98,0,47,0,0,0,0,1,0,10,2,24,1,1,0,9,97,0,0,1,1,0,10,117,0,0, +0,1,8,58,118,101,99,50,0,18,97,0,18,117,0,59,120,0,48,0,18,97,0,18,117,0,59,121,0,48,0,0,0,0,1,0,10, +2,24,1,1,0,10,118,0,0,1,1,0,9,98,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,18,98,0,48,0,18,118, +0,59,121,0,18,98,0,48,0,0,0,0,1,0,10,2,25,1,1,0,9,97,0,0,1,1,0,10,117,0,0,0,1,8,58,118,101,99,50,0, +18,97,0,18,117,0,59,120,0,49,0,18,97,0,18,117,0,59,121,0,49,0,0,0,0,1,0,10,2,25,1,1,0,10,118,0,0,1, +1,0,9,98,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,18,98,0,49,0,18,118,0,59,121,0,18,98,0,49,0, +0,0,0,1,0,11,2,29,1,1,0,9,97,0,0,1,1,0,11,117,0,0,0,1,8,58,118,101,99,51,0,18,97,0,18,117,0,59,120, +0,46,0,18,97,0,18,117,0,59,121,0,46,0,18,97,0,18,117,0,59,122,0,46,0,0,0,0,1,0,11,2,29,1,1,0,11,118, +0,0,1,1,0,9,98,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,18,98,0,46,0,18,118,0,59,121,0,18,98, +0,46,0,18,118,0,59,122,0,18,98,0,46,0,0,0,0,1,0,11,2,30,1,1,0,9,97,0,0,1,1,0,11,117,0,0,0,1,8,58, +118,101,99,51,0,18,97,0,18,117,0,59,120,0,47,0,18,97,0,18,117,0,59,121,0,47,0,18,97,0,18,117,0,59, +122,0,47,0,0,0,0,1,0,11,2,30,1,1,0,11,118,0,0,1,1,0,9,98,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59, +120,0,18,98,0,47,0,18,118,0,59,121,0,18,98,0,47,0,18,118,0,59,122,0,18,98,0,47,0,0,0,0,1,0,11,2,24, +1,1,0,9,97,0,0,1,1,0,11,117,0,0,0,1,8,58,118,101,99,51,0,18,97,0,18,117,0,59,120,0,48,0,18,97,0,18, +117,0,59,121,0,48,0,18,97,0,18,117,0,59,122,0,48,0,0,0,0,1,0,11,2,24,1,1,0,11,118,0,0,1,1,0,9,98,0, +0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,18,98,0,48,0,18,118,0,59,121,0,18,98,0,48,0,18,118,0, +59,122,0,18,98,0,48,0,0,0,0,1,0,11,2,25,1,1,0,9,97,0,0,1,1,0,11,117,0,0,0,1,8,58,118,101,99,51,0,18, +97,0,18,117,0,59,120,0,49,0,18,97,0,18,117,0,59,121,0,49,0,18,97,0,18,117,0,59,122,0,49,0,0,0,0,1,0, +11,2,25,1,1,0,11,118,0,0,1,1,0,9,98,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,18,98,0,49,0,18, +118,0,59,121,0,18,98,0,49,0,18,118,0,59,122,0,18,98,0,49,0,0,0,0,1,0,12,2,29,1,1,0,9,97,0,0,1,1,0, +12,117,0,0,0,1,8,58,118,101,99,52,0,18,97,0,18,117,0,59,120,0,46,0,18,97,0,18,117,0,59,121,0,46,0, +18,97,0,18,117,0,59,122,0,46,0,18,97,0,18,117,0,59,119,0,46,0,0,0,0,1,0,12,2,29,1,1,0,12,118,0,0,1, +1,0,9,98,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,98,0,46,0,18,118,0,59,121,0,18,98,0,46,0, +18,118,0,59,122,0,18,98,0,46,0,18,118,0,59,119,0,18,98,0,46,0,0,0,0,1,0,12,2,30,1,1,0,9,97,0,0,1,1, +0,12,117,0,0,0,1,8,58,118,101,99,52,0,18,97,0,18,117,0,59,120,0,47,0,18,97,0,18,117,0,59,121,0,47,0, +18,97,0,18,117,0,59,122,0,47,0,18,97,0,18,117,0,59,119,0,47,0,0,0,0,1,0,12,2,30,1,1,0,12,118,0,0,1, +1,0,9,98,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,98,0,47,0,18,118,0,59,121,0,18,98,0,47,0, +18,118,0,59,122,0,18,98,0,47,0,18,118,0,59,119,0,18,98,0,47,0,0,0,0,1,0,12,2,24,1,1,0,9,97,0,0,1,1, +0,12,117,0,0,0,1,8,58,118,101,99,52,0,18,97,0,18,117,0,59,120,0,48,0,18,97,0,18,117,0,59,121,0,48,0, +18,97,0,18,117,0,59,122,0,48,0,18,97,0,18,117,0,59,119,0,48,0,0,0,0,1,0,12,2,24,1,1,0,12,118,0,0,1, +1,0,9,98,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,98,0,48,0,18,118,0,59,121,0,18,98,0,48,0, +18,118,0,59,122,0,18,98,0,48,0,18,118,0,59,119,0,18,98,0,48,0,0,0,0,1,0,12,2,25,1,1,0,9,97,0,0,1,1, +0,12,117,0,0,0,1,8,58,118,101,99,52,0,18,97,0,18,117,0,59,120,0,49,0,18,97,0,18,117,0,59,121,0,49,0, +18,97,0,18,117,0,59,122,0,49,0,18,97,0,18,117,0,59,119,0,49,0,0,0,0,1,0,12,2,25,1,1,0,12,118,0,0,1, +1,0,9,98,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,98,0,49,0,18,118,0,59,121,0,18,98,0,49,0, +18,118,0,59,122,0,18,98,0,49,0,18,118,0,59,119,0,18,98,0,49,0,0,0,0,1,0,13,2,29,1,1,0,9,97,0,0,1,1, +0,13,110,0,0,0,1,8,58,109,97,116,50,0,18,97,0,18,110,0,16,8,48,0,57,46,0,18,97,0,18,110,0,16,10,49, +0,57,46,0,0,0,0,1,0,13,2,29,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8, +48,0,57,18,98,0,46,0,18,109,0,16,10,49,0,57,18,98,0,46,0,0,0,0,1,0,13,2,30,1,1,0,9,97,0,0,1,1,0,13, +110,0,0,0,1,8,58,109,97,116,50,0,18,97,0,18,110,0,16,8,48,0,57,47,0,18,97,0,18,110,0,16,10,49,0,57, +47,0,0,0,0,1,0,13,2,30,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8,48,0, +57,18,98,0,47,0,18,109,0,16,10,49,0,57,18,98,0,47,0,0,0,0,1,0,13,2,24,1,1,0,9,97,0,0,1,1,0,13,110,0, +0,0,1,8,58,109,97,116,50,0,18,97,0,18,110,0,16,8,48,0,57,48,0,18,97,0,18,110,0,16,10,49,0,57,48,0,0, +0,0,1,0,13,2,24,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8,48,0,57,18, +98,0,48,0,18,109,0,16,10,49,0,57,18,98,0,48,0,0,0,0,1,0,13,2,25,1,1,0,9,97,0,0,1,1,0,13,110,0,0,0,1, +8,58,109,97,116,50,0,18,97,0,18,110,0,16,8,48,0,57,49,0,18,97,0,18,110,0,16,10,49,0,57,49,0,0,0,0,1, +0,13,2,25,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8,48,0,57,18,98,0,49, +0,18,109,0,16,10,49,0,57,18,98,0,49,0,0,0,0,1,0,14,2,29,1,1,0,9,97,0,0,1,1,0,14,110,0,0,0,1,8,58, +109,97,116,51,0,18,97,0,18,110,0,16,8,48,0,57,46,0,18,97,0,18,110,0,16,10,49,0,57,46,0,18,97,0,18, +110,0,16,10,50,0,57,46,0,0,0,0,1,0,14,2,29,1,1,0,14,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,51,0, +18,109,0,16,8,48,0,57,18,98,0,46,0,18,109,0,16,10,49,0,57,18,98,0,46,0,18,109,0,16,10,50,0,57,18,98, +0,46,0,0,0,0,1,0,14,2,30,1,1,0,9,97,0,0,1,1,0,14,110,0,0,0,1,8,58,109,97,116,51,0,18,97,0,18,110,0, +16,8,48,0,57,47,0,18,97,0,18,110,0,16,10,49,0,57,47,0,18,97,0,18,110,0,16,10,50,0,57,47,0,0,0,0,1,0, +14,2,30,1,1,0,14,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,18,98,0,47,0, +18,109,0,16,10,49,0,57,18,98,0,47,0,18,109,0,16,10,50,0,57,18,98,0,47,0,0,0,0,1,0,14,2,24,1,1,0,9, +97,0,0,1,1,0,14,110,0,0,0,1,8,58,109,97,116,51,0,18,97,0,18,110,0,16,8,48,0,57,48,0,18,97,0,18,110, +0,16,10,49,0,57,48,0,18,97,0,18,110,0,16,10,50,0,57,48,0,0,0,0,1,0,14,2,24,1,1,0,14,109,0,0,1,1,0,9, +98,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,18,98,0,48,0,18,109,0,16,10,49,0,57,18,98,0, +48,0,18,109,0,16,10,50,0,57,18,98,0,48,0,0,0,0,1,0,14,2,25,1,1,0,9,97,0,0,1,1,0,14,110,0,0,0,1,8,58, +109,97,116,51,0,18,97,0,18,110,0,16,8,48,0,57,49,0,18,97,0,18,110,0,16,10,49,0,57,49,0,18,97,0,18, +110,0,16,10,50,0,57,49,0,0,0,0,1,0,14,2,25,1,1,0,14,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,51,0, +18,109,0,16,8,48,0,57,18,98,0,49,0,18,109,0,16,10,49,0,57,18,98,0,49,0,18,109,0,16,10,50,0,57,18,98, +0,49,0,0,0,0,1,0,15,2,29,1,1,0,9,97,0,0,1,1,0,15,110,0,0,0,1,8,58,109,97,116,52,0,18,97,0,18,110,0, +16,8,48,0,57,46,0,18,97,0,18,110,0,16,10,49,0,57,46,0,18,97,0,18,110,0,16,10,50,0,57,46,0,18,97,0, +18,110,0,16,10,51,0,57,46,0,0,0,0,1,0,15,2,29,1,1,0,15,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116, +52,0,18,109,0,16,8,48,0,57,18,98,0,46,0,18,109,0,16,10,49,0,57,18,98,0,46,0,18,109,0,16,10,50,0,57, +18,98,0,46,0,18,109,0,16,10,51,0,57,18,98,0,46,0,0,0,0,1,0,15,2,30,1,1,0,9,97,0,0,1,1,0,15,110,0,0, +0,1,8,58,109,97,116,52,0,18,97,0,18,110,0,16,8,48,0,57,47,0,18,97,0,18,110,0,16,10,49,0,57,47,0,18, +97,0,18,110,0,16,10,50,0,57,47,0,18,97,0,18,110,0,16,10,51,0,57,47,0,0,0,0,1,0,15,2,30,1,1,0,15,109, +0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,52,0,18,109,0,16,8,48,0,57,18,98,0,47,0,18,109,0,16,10,49,0, +57,18,98,0,47,0,18,109,0,16,10,50,0,57,18,98,0,47,0,18,109,0,16,10,51,0,57,18,98,0,47,0,0,0,0,1,0, +15,2,24,1,1,0,9,97,0,0,1,1,0,15,110,0,0,0,1,8,58,109,97,116,52,0,18,97,0,18,110,0,16,8,48,0,57,48,0, +18,97,0,18,110,0,16,10,49,0,57,48,0,18,97,0,18,110,0,16,10,50,0,57,48,0,18,97,0,18,110,0,16,10,51,0, +57,48,0,0,0,0,1,0,15,2,24,1,1,0,15,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,52,0,18,109,0,16,8,48, +0,57,18,98,0,48,0,18,109,0,16,10,49,0,57,18,98,0,48,0,18,109,0,16,10,50,0,57,18,98,0,48,0,18,109,0, +16,10,51,0,57,18,98,0,48,0,0,0,0,1,0,15,2,25,1,1,0,9,97,0,0,1,1,0,15,110,0,0,0,1,8,58,109,97,116,52, +0,18,97,0,18,110,0,16,8,48,0,57,49,0,18,97,0,18,110,0,16,10,49,0,57,49,0,18,97,0,18,110,0,16,10,50, +0,57,49,0,18,97,0,18,110,0,16,10,51,0,57,49,0,0,0,0,1,0,15,2,25,1,1,0,15,109,0,0,1,1,0,9,98,0,0,0,1, +8,58,109,97,116,52,0,18,109,0,16,8,48,0,57,18,98,0,49,0,18,109,0,16,10,49,0,57,18,98,0,49,0,18,109, +0,16,10,50,0,57,18,98,0,49,0,18,109,0,16,10,51,0,57,18,98,0,49,0,0,0,0,1,0,6,2,29,1,1,0,5,97,0,0,1, +1,0,6,117,0,0,0,1,8,58,105,118,101,99,50,0,18,97,0,18,117,0,59,120,0,46,0,18,97,0,18,117,0,59,121,0, +46,0,0,0,0,1,0,6,2,29,1,1,0,6,118,0,0,1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0, +18,98,0,46,0,18,118,0,59,121,0,18,98,0,46,0,0,0,0,1,0,6,2,30,1,1,0,5,97,0,0,1,1,0,6,117,0,0,0,1,8, +58,105,118,101,99,50,0,18,97,0,18,117,0,59,120,0,47,0,18,97,0,18,117,0,59,121,0,47,0,0,0,0,1,0,6,2, +30,1,1,0,6,118,0,0,1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0,18,98,0,47,0,18, +118,0,59,121,0,18,98,0,47,0,0,0,0,1,0,6,2,24,1,1,0,5,97,0,0,1,1,0,6,117,0,0,0,1,8,58,105,118,101,99, +50,0,18,97,0,18,117,0,59,120,0,48,0,18,97,0,18,117,0,59,121,0,48,0,0,0,0,1,0,6,2,24,1,1,0,6,118,0,0, +1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0,18,98,0,48,0,18,118,0,59,121,0,18,98, +0,48,0,0,0,0,1,0,6,2,25,1,1,0,5,97,0,0,1,1,0,6,117,0,0,0,1,8,58,105,118,101,99,50,0,18,97,0,18,117, +0,59,120,0,49,0,18,97,0,18,117,0,59,121,0,49,0,0,0,0,1,0,6,2,25,1,1,0,6,118,0,0,1,1,0,5,98,0,0,0,1, +8,58,105,118,101,99,50,0,18,118,0,59,120,0,18,98,0,49,0,18,118,0,59,121,0,18,98,0,49,0,0,0,0,1,0,7, +2,29,1,1,0,5,97,0,0,1,1,0,7,117,0,0,0,1,8,58,105,118,101,99,51,0,18,97,0,18,117,0,59,120,0,46,0,18, +97,0,18,117,0,59,121,0,46,0,18,97,0,18,117,0,59,122,0,46,0,0,0,0,1,0,7,2,29,1,1,0,7,118,0,0,1,1,0,5, +98,0,0,0,1,8,58,105,118,101,99,51,0,18,118,0,59,120,0,18,98,0,46,0,18,118,0,59,121,0,18,98,0,46,0, +18,118,0,59,122,0,18,98,0,46,0,0,0,0,1,0,7,2,30,1,1,0,5,97,0,0,1,1,0,7,117,0,0,0,1,8,58,105,118,101, +99,51,0,18,97,0,18,117,0,59,120,0,47,0,18,97,0,18,117,0,59,121,0,47,0,18,97,0,18,117,0,59,122,0,47, +0,0,0,0,1,0,7,2,30,1,1,0,7,118,0,0,1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,51,0,18,118,0,59,120,0,18, +98,0,47,0,18,118,0,59,121,0,18,98,0,47,0,18,118,0,59,122,0,18,98,0,47,0,0,0,0,1,0,7,2,24,1,1,0,5,97, +0,0,1,1,0,7,117,0,0,0,1,8,58,105,118,101,99,51,0,18,97,0,18,117,0,59,120,0,48,0,18,97,0,18,117,0,59, +121,0,48,0,18,97,0,18,117,0,59,122,0,48,0,0,0,0,1,0,7,2,24,1,1,0,7,118,0,0,1,1,0,5,98,0,0,0,1,8,58, +105,118,101,99,51,0,18,118,0,59,120,0,18,98,0,48,0,18,118,0,59,121,0,18,98,0,48,0,18,118,0,59,122,0, +18,98,0,48,0,0,0,0,1,0,7,2,25,1,1,0,5,97,0,0,1,1,0,7,117,0,0,0,1,8,58,105,118,101,99,51,0,18,97,0, +18,117,0,59,120,0,49,0,18,97,0,18,117,0,59,121,0,49,0,18,97,0,18,117,0,59,122,0,49,0,0,0,0,1,0,7,2, +25,1,1,0,7,118,0,0,1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,51,0,18,118,0,59,120,0,18,98,0,49,0,18, +118,0,59,121,0,18,98,0,49,0,18,118,0,59,122,0,18,98,0,49,0,0,0,0,1,0,8,2,29,1,1,0,5,97,0,0,1,1,0,8, +117,0,0,0,1,8,58,105,118,101,99,52,0,18,97,0,18,117,0,59,120,0,46,0,18,97,0,18,117,0,59,121,0,46,0, +18,97,0,18,117,0,59,122,0,46,0,18,97,0,18,117,0,59,119,0,46,0,0,0,0,1,0,8,2,29,1,1,0,8,118,0,0,1,1, +0,5,98,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,18,98,0,46,0,18,118,0,59,121,0,18,98,0,46, +0,18,118,0,59,122,0,18,98,0,46,0,18,118,0,59,119,0,18,98,0,46,0,0,0,0,1,0,8,2,30,1,1,0,5,97,0,0,1,1, +0,8,117,0,0,0,1,8,58,105,118,101,99,52,0,18,97,0,18,117,0,59,120,0,47,0,18,97,0,18,117,0,59,121,0, +47,0,18,97,0,18,117,0,59,122,0,47,0,18,97,0,18,117,0,59,119,0,47,0,0,0,0,1,0,8,2,30,1,1,0,8,118,0,0, +1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,18,98,0,47,0,18,118,0,59,121,0,18,98, +0,47,0,18,118,0,59,122,0,18,98,0,47,0,18,118,0,59,119,0,18,98,0,47,0,0,0,0,1,0,8,2,24,1,1,0,5,97,0, +0,1,1,0,8,117,0,0,0,1,8,58,105,118,101,99,52,0,18,97,0,18,117,0,59,120,0,48,0,18,97,0,18,117,0,59, +121,0,48,0,18,97,0,18,117,0,59,122,0,48,0,18,97,0,18,117,0,59,119,0,48,0,0,0,0,1,0,8,2,24,1,1,0,8, +118,0,0,1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,18,98,0,48,0,18,118,0,59,121, +0,18,98,0,48,0,18,118,0,59,122,0,18,98,0,48,0,18,118,0,59,119,0,18,98,0,48,0,0,0,0,1,0,8,2,25,1,1,0, +5,97,0,0,1,1,0,8,117,0,0,0,1,8,58,105,118,101,99,52,0,18,97,0,18,117,0,59,120,0,49,0,18,97,0,18,117, +0,59,121,0,49,0,18,97,0,18,117,0,59,122,0,49,0,18,97,0,18,117,0,59,119,0,49,0,0,0,0,1,0,8,2,25,1,1, +0,8,118,0,0,1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,18,98,0,49,0,18,118,0,59, +121,0,18,98,0,49,0,18,118,0,59,122,0,18,98,0,49,0,18,118,0,59,119,0,18,98,0,49,0,0,0,0,1,0,10,2,24, +1,1,0,10,118,0,0,1,1,0,10,117,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59,120,0,48,0, +18,118,0,59,121,0,18,117,0,59,121,0,48,0,0,0,0,1,0,11,2,24,1,1,0,11,118,0,0,1,1,0,11,117,0,0,0,1,8, +58,118,101,99,51,0,18,118,0,59,120,0,18,117,0,59,120,0,48,0,18,118,0,59,121,0,18,117,0,59,121,0,48, +0,18,118,0,59,122,0,18,117,0,59,122,0,48,0,0,0,0,1,0,12,2,24,1,1,0,12,118,0,0,1,1,0,12,117,0,0,0,1, +8,58,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,48,0,18,118,0,59,121,0,18,117,0,59,121,0, +48,0,18,118,0,59,122,0,18,117,0,59,122,0,48,0,18,118,0,59,119,0,18,117,0,59,119,0,48,0,0,0,0,1,0,6, +2,24,1,1,0,6,118,0,0,1,1,0,6,117,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59,120, +0,48,0,18,118,0,59,121,0,18,117,0,59,121,0,48,0,0,0,0,1,0,7,2,24,1,1,0,7,118,0,0,1,1,0,7,117,0,0,0, +1,8,58,105,118,101,99,51,0,18,118,0,59,120,0,18,117,0,59,120,0,48,0,18,118,0,59,121,0,18,117,0,59, +121,0,48,0,18,118,0,59,122,0,18,117,0,59,122,0,48,0,0,0,0,1,0,8,2,24,1,1,0,8,118,0,0,1,1,0,8,117,0, +0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,48,0,18,118,0,59,121,0,18,117,0, +59,121,0,48,0,18,118,0,59,122,0,18,117,0,59,122,0,48,0,18,118,0,59,119,0,18,117,0,59,119,0,48,0,0,0, +0,1,0,10,2,25,1,1,0,10,118,0,0,1,1,0,10,117,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,18,117,0, +59,120,0,49,0,18,118,0,59,121,0,18,117,0,59,121,0,49,0,0,0,0,1,0,11,2,25,1,1,0,11,118,0,0,1,1,0,11, +117,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,18,117,0,59,120,0,49,0,18,118,0,59,121,0,18,117, +0,59,121,0,49,0,18,118,0,59,122,0,18,117,0,59,122,0,49,0,0,0,0,1,0,12,2,25,1,1,0,12,118,0,0,1,1,0, +12,117,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,49,0,18,118,0,59,121,0,18, +117,0,59,121,0,49,0,18,118,0,59,122,0,18,117,0,59,122,0,49,0,18,118,0,59,119,0,18,117,0,59,119,0,49, +0,0,0,0,1,0,6,2,25,1,1,0,6,118,0,0,1,1,0,6,117,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0, +18,117,0,59,120,0,49,0,18,118,0,59,121,0,18,117,0,59,121,0,49,0,0,0,0,1,0,7,2,25,1,1,0,7,118,0,0,1, +1,0,7,117,0,0,0,1,8,58,105,118,101,99,51,0,18,118,0,59,120,0,18,117,0,59,120,0,49,0,18,118,0,59,121, +0,18,117,0,59,121,0,49,0,18,118,0,59,122,0,18,117,0,59,122,0,49,0,0,0,0,1,0,8,2,25,1,1,0,8,118,0,0, +1,1,0,8,117,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,49,0,18,118,0,59, +121,0,18,117,0,59,121,0,49,0,18,118,0,59,122,0,18,117,0,59,122,0,49,0,18,118,0,59,119,0,18,117,0,59, +119,0,49,0,0,0,0,1,0,13,2,25,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16, +8,48,0,57,18,110,0,16,8,48,0,57,49,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,49,0,0,0,0,1,0, +14,2,25,1,1,0,14,109,0,0,1,1,0,14,110,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,18,110,0, +16,8,48,0,57,49,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,49,0,18,109,0,16,10,50,0,57,18,110, +0,16,10,50,0,57,49,0,0,0,0,1,0,15,2,25,1,1,0,15,109,0,0,1,1,0,15,110,0,0,0,1,8,58,109,97,116,52,0, +18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,49,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,49,0, +18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,49,0,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,49, +0,0,0,0,1,0,10,2,30,1,1,0,10,118,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,54,0,18,118,0,59, +121,0,54,0,0,0,0,1,0,11,2,30,1,1,0,11,118,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,54,0,18, +118,0,59,121,0,54,0,18,118,0,59,122,0,54,0,0,0,0,1,0,12,2,30,1,1,0,12,118,0,0,0,1,8,58,118,101,99, +52,0,18,118,0,59,120,0,54,0,18,118,0,59,121,0,54,0,18,118,0,59,122,0,54,0,18,118,0,59,119,0,54,0,0, +0,0,1,0,6,2,30,1,1,0,6,118,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0,54,0,18,118,0,59,121, +0,54,0,0,0,0,1,0,7,2,30,1,1,0,7,118,0,0,0,1,8,58,105,118,101,99,51,0,18,118,0,59,120,0,54,0,18,118, +0,59,121,0,54,0,18,118,0,59,122,0,54,0,0,0,0,1,0,8,2,30,1,1,0,8,118,0,0,0,1,8,58,105,118,101,99,52, +0,18,118,0,59,120,0,54,0,18,118,0,59,121,0,54,0,18,118,0,59,122,0,54,0,18,118,0,59,119,0,54,0,0,0,0, +1,0,13,2,30,1,1,0,13,109,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8,48,0,57,54,0,18,109,0,16,10,49, +0,57,54,0,0,0,0,1,0,14,2,30,1,1,0,14,109,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,54,0,18, +109,0,16,10,49,0,57,54,0,18,109,0,16,10,50,0,57,54,0,0,0,0,1,0,15,2,30,1,1,0,15,109,0,0,0,1,8,58, +109,97,116,52,0,18,109,0,16,8,48,0,57,54,0,18,109,0,16,10,49,0,57,54,0,18,109,0,16,10,50,0,57,54,0, +18,109,0,16,10,51,0,57,54,0,0,0,0,1,0,0,2,28,1,0,2,9,97,0,0,0,1,9,18,97,0,17,49,0,48,0,0,22,0,0,1,0, +0,2,28,1,0,2,5,97,0,0,0,1,9,18,97,0,16,10,49,0,22,0,0,1,0,0,2,28,1,0,2,10,118,0,0,0,1,9,18,118,0,59, +120,0,52,18,118,0,59,121,0,52,19,0,0,1,0,0,2,28,1,0,2,11,118,0,0,0,1,9,18,118,0,59,120,0,52,18,118, +0,59,121,0,52,19,18,118,0,59,122,0,52,19,0,0,1,0,0,2,28,1,0,2,12,118,0,0,0,1,9,18,118,0,59,120,0,52, +18,118,0,59,121,0,52,19,18,118,0,59,122,0,52,19,18,118,0,59,119,0,52,19,0,0,1,0,0,2,28,1,0,2,6,118, +0,0,0,1,9,18,118,0,59,120,0,52,18,118,0,59,121,0,52,19,0,0,1,0,0,2,28,1,0,2,7,118,0,0,0,1,9,18,118, +0,59,120,0,52,18,118,0,59,121,0,52,19,18,118,0,59,122,0,52,19,0,0,1,0,0,2,28,1,0,2,8,118,0,0,0,1,9, +18,118,0,59,120,0,52,18,118,0,59,121,0,52,19,18,118,0,59,122,0,52,19,18,118,0,59,119,0,52,19,0,0,1, +0,0,2,28,1,0,2,13,109,0,0,0,1,9,18,109,0,16,8,48,0,57,52,18,109,0,16,10,49,0,57,52,19,0,0,1,0,0,2, +28,1,0,2,14,109,0,0,0,1,9,18,109,0,16,8,48,0,57,52,18,109,0,16,10,49,0,57,52,19,18,109,0,16,10,50,0, +57,52,19,0,0,1,0,0,2,28,1,0,2,15,109,0,0,0,1,9,18,109,0,16,8,48,0,57,52,18,109,0,16,10,49,0,57,52, +19,18,109,0,16,10,50,0,57,52,19,18,109,0,16,10,51,0,57,52,19,0,0,1,0,0,2,27,1,0,2,9,97,0,0,0,1,9,18, +97,0,17,49,0,48,0,0,21,0,0,1,0,0,2,27,1,0,2,5,97,0,0,0,1,9,18,97,0,16,10,49,0,21,0,0,1,0,0,2,27,1,0, +2,10,118,0,0,0,1,9,18,118,0,59,120,0,51,18,118,0,59,121,0,51,19,0,0,1,0,0,2,27,1,0,2,11,118,0,0,0,1, +9,18,118,0,59,120,0,51,18,118,0,59,121,0,51,19,18,118,0,59,122,0,51,19,0,0,1,0,0,2,27,1,0,2,12,118, +0,0,0,1,9,18,118,0,59,120,0,51,18,118,0,59,121,0,51,19,18,118,0,59,122,0,51,19,18,118,0,59,119,0,51, +19,0,0,1,0,0,2,27,1,0,2,6,118,0,0,0,1,9,18,118,0,59,120,0,51,18,118,0,59,121,0,51,19,0,0,1,0,0,2,27, +1,0,2,7,118,0,0,0,1,9,18,118,0,59,120,0,51,18,118,0,59,121,0,51,19,18,118,0,59,122,0,51,19,0,0,1,0, +0,2,27,1,0,2,8,118,0,0,0,1,9,18,118,0,59,120,0,51,18,118,0,59,121,0,51,19,18,118,0,59,122,0,51,19, +18,118,0,59,119,0,51,19,0,0,1,0,0,2,27,1,0,2,13,109,0,0,0,1,9,18,109,0,16,8,48,0,57,51,18,109,0,16, +10,49,0,57,51,19,0,0,1,0,0,2,27,1,0,2,14,109,0,0,0,1,9,18,109,0,16,8,48,0,57,51,18,109,0,16,10,49,0, +57,51,19,18,109,0,16,10,50,0,57,51,19,0,0,1,0,0,2,27,1,0,2,15,109,0,0,0,1,9,18,109,0,16,8,48,0,57, +51,18,109,0,16,10,49,0,57,51,19,18,109,0,16,10,50,0,57,51,19,18,109,0,16,10,51,0,57,51,19,0,0,1,0,9, +2,28,1,0,2,9,97,0,0,1,1,0,5,0,0,0,1,3,2,0,9,1,99,0,0,0,9,18,99,0,18,97,0,20,0,9,18,97,0,52,0,8,18, +99,0,0,0,1,0,5,2,28,1,0,2,5,97,0,0,1,1,0,5,0,0,0,1,3,2,0,5,1,99,0,0,0,9,18,99,0,18,97,0,20,0,9,18, +97,0,52,0,8,18,99,0,0,0,1,0,10,2,28,1,0,2,10,118,0,0,1,1,0,5,0,0,0,1,8,58,118,101,99,50,0,18,118,0, +59,120,0,61,0,18,118,0,59,121,0,61,0,0,0,0,1,0,11,2,28,1,0,2,11,118,0,0,1,1,0,5,0,0,0,1,8,58,118, +101,99,51,0,18,118,0,59,120,0,61,0,18,118,0,59,121,0,61,0,18,118,0,59,122,0,61,0,0,0,0,1,0,12,2,28, +1,0,2,12,118,0,0,1,1,0,5,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,61,0,18,118,0,59,121,0,61,0, +18,118,0,59,122,0,61,0,18,118,0,59,119,0,61,0,0,0,0,1,0,6,2,28,1,0,2,6,118,0,0,1,1,0,5,0,0,0,1,8,58, +105,118,101,99,50,0,18,118,0,59,120,0,61,0,18,118,0,59,121,0,61,0,0,0,0,1,0,7,2,28,1,0,2,7,118,0,0, +1,1,0,5,0,0,0,1,8,58,105,118,101,99,51,0,18,118,0,59,120,0,61,0,18,118,0,59,121,0,61,0,18,118,0,59, +122,0,61,0,0,0,0,1,0,8,2,28,1,0,2,8,118,0,0,1,1,0,5,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59, +120,0,61,0,18,118,0,59,121,0,61,0,18,118,0,59,122,0,61,0,18,118,0,59,119,0,61,0,0,0,0,1,0,13,2,28,1, +0,2,13,109,0,0,1,1,0,5,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8,48,0,57,61,0,18,109,0,16,10,49,0, +57,61,0,0,0,0,1,0,14,2,28,1,0,2,14,109,0,0,1,1,0,5,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0, +57,61,0,18,109,0,16,10,49,0,57,61,0,18,109,0,16,10,50,0,57,61,0,0,0,0,1,0,15,2,28,1,0,2,15,109,0,0, +1,1,0,5,0,0,0,1,8,58,109,97,116,52,0,18,109,0,16,8,48,0,57,61,0,18,109,0,16,10,49,0,57,61,0,18,109, +0,16,10,50,0,57,61,0,18,109,0,16,10,51,0,57,61,0,0,0,0,1,0,9,2,27,1,0,2,9,97,0,0,1,1,0,5,0,0,0,1,3, +2,0,9,1,99,0,0,0,9,18,99,0,18,97,0,20,0,9,18,97,0,51,0,8,18,99,0,0,0,1,0,5,2,27,1,0,2,5,97,0,0,1,1, +0,5,0,0,0,1,3,2,0,5,1,99,0,0,0,9,18,99,0,18,97,0,20,0,9,18,97,0,51,0,8,18,99,0,0,0,1,0,10,2,27,1,0, +2,10,118,0,0,1,1,0,5,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,60,0,18,118,0,59,121,0,60,0,0,0, +0,1,0,11,2,27,1,0,2,11,118,0,0,1,1,0,5,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,60,0,18,118,0, +59,121,0,60,0,18,118,0,59,122,0,60,0,0,0,0,1,0,12,2,27,1,0,2,12,118,0,0,1,1,0,5,0,0,0,1,8,58,118, +101,99,52,0,18,118,0,59,120,0,60,0,18,118,0,59,121,0,60,0,18,118,0,59,122,0,60,0,18,118,0,59,119,0, +60,0,0,0,0,1,0,6,2,27,1,0,2,6,118,0,0,1,1,0,5,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0,60, +0,18,118,0,59,121,0,60,0,0,0,0,1,0,7,2,27,1,0,2,7,118,0,0,1,1,0,5,0,0,0,1,8,58,105,118,101,99,51,0, +18,118,0,59,120,0,60,0,18,118,0,59,121,0,60,0,18,118,0,59,122,0,60,0,0,0,0,1,0,8,2,27,1,0,2,8,118,0, +0,1,1,0,5,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,60,0,18,118,0,59,121,0,60,0,18,118,0, +59,122,0,60,0,18,118,0,59,119,0,60,0,0,0,0,1,0,13,2,27,1,0,2,13,109,0,0,1,1,0,5,0,0,0,1,8,58,109,97, +116,50,0,18,109,0,16,8,48,0,57,60,0,18,109,0,16,10,49,0,57,60,0,0,0,0,1,0,14,2,27,1,0,2,14,109,0,0, +1,1,0,5,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,60,0,18,109,0,16,10,49,0,57,60,0,18,109, +0,16,10,50,0,57,60,0,0,0,0,1,0,15,2,27,1,0,2,15,109,0,0,1,1,0,5,0,0,0,1,8,58,109,97,116,52,0,18,109, +0,16,8,48,0,57,60,0,18,109,0,16,10,49,0,57,60,0,18,109,0,16,10,50,0,57,60,0,18,109,0,16,10,51,0,57, +60,0,0,0,0,1,0,1,2,18,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,1,1,99,0,0,0,4,102,108,111,97,116,95, +108,101,115,115,0,18,99,0,0,18,97,0,0,18,98,0,0,0,8,18,99,0,0,0,1,0,1,2,18,1,1,0,5,97,0,0,1,1,0,5, +98,0,0,0,1,8,58,102,108,111,97,116,0,18,97,0,0,0,58,102,108,111,97,116,0,18,98,0,0,0,40,0,0,1,0,1,2, +19,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,8,18,98,0,18,97,0,40,0,0,1,0,1,2,19,1,1,0,5,97,0,0,1,1,0,5,98, +0,0,0,1,8,18,98,0,18,97,0,40,0,0,1,0,1,2,21,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,8,18,97,0,18,98,0,41, +18,97,0,18,98,0,38,32,0,0,1,0,1,2,21,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,8,18,97,0,18,98,0,41,18,97,0, +18,98,0,38,32,0,0,1,0,1,2,20,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,8,18,97,0,18,98,0,40,18,97,0,18,98,0, +38,32,0,0,1,0,1,2,20,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,8,18,97,0,18,98,0,40,18,97,0,18,98,0,38,32,0, +0,1,0,1,2,12,1,1,0,1,97,0,0,1,1,0,1,98,0,0,0,1,8,18,97,0,18,98,0,39,0,0,1,0,1,2,32,1,1,0,1,97,0,0,0, +1,8,18,97,0,15,2,48,0,38,0,0,0 \ No newline at end of file diff --git a/reactos/dll/mesa32/src/shader/slang/library/slang_fragment_builtin_gc.h b/reactos/dll/mesa32/src/shader/slang/library/slang_fragment_builtin_gc.h new file mode 100644 index 00000000000..85f74bda8e1 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/library/slang_fragment_builtin_gc.h @@ -0,0 +1,366 @@ +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"__fixed_input vec4 gl_FragCoord;\n" +"__fixed_input bool gl_FrontFacing;\n" +"__fixed_output vec4 gl_FragColor;\n" +"__fixed_output vec4 gl_FragData[gl_MaxDrawBuffers];\n" +"__fixed_output float gl_FragDepth;\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"varying vec4 gl_Color;\n" +"varying vec4 gl_SecondaryColor;\n" +"varying vec4 gl_TexCoord[];\n" +"varying float gl_FogFragCoord;\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 texture1D (sampler1D sampler, float coord, float bias) {\n" +" return vec4 (0.0);\n" +"}\n" +"vec4 texture1DProj (sampler1D sampler, vec2 coord, float bias) {\n" +" return texture1D (sampler, coord.s / coord.t, bias);\n" +"}\n" +"vec4 texture1DProj (sampler1D sampler, vec4 coord, float bias) {\n" +" return texture1D (sampler, coord.s / coord.q, bias);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 texture2D (sampler2D sampler, vec2 coord, float bias) {\n" +" return vec4 (0.0);\n" +"}\n" +"vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias) {\n" +" return texture2D (sampler, vec2 (coord.s / coord.p, coord.t / coord.p), bias);\n" +"}\n" +"vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias) {\n" +" return texture2D (sampler, vec2 (coord.s / coord.q, coord.s / coord.q), bias);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 texture3D (sampler3D sampler, vec3 coord, float bias) {\n" +" return vec4 (0.0);\n" +"}\n" +"vec4 texture3DProj (sampler3D sampler, vec4 coord, float bias) {\n" +" return texture3DProj (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q),\n" +" bias);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 textureCube (samplerCube sampler, vec3 coord, float bias) {\n" +" return vec4 (0.0);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 shadow1D (sampler1DShadow sampler, vec3 coord, float bias) {\n" +" return vec4 (0.0);\n" +"}\n" +"\n" +"vec4 shadow2D (sampler2DShadow sampler, vec3 coord, float bias) {\n" +" return vec4 (0.0);\n" +"}\n" +"vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord, float bias) {\n" +" return shadow1D (sampler, vec3 (coord.s / coord.q, 0.0, coord.p / coord.q), bias);\n" +"}\n" +"vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord, float bias) {\n" +" return shadow2D (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q), bias);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float dFdx (float p) {\n" +" return 0.0;\n" +"}\n" +"\n" +"vec2 dFdx (vec2 p) {\n" +" return vec2 (0.0);\n" +"}\n" +"\n" +"vec3 dFdx (vec3 p) {\n" +" return vec3 (0.0);\n" +"}\n" +"\n" +"vec4 dFdx (vec4 p) {\n" +" return vec4 (0.0);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float dFdy (float p) {\n" +" return 0.0;\n" +"}\n" +"\n" +"vec2 dFdy (vec2 p) {\n" +" return vec2 (0.0);\n" +"}\n" +"\n" +"vec3 dFdy (vec3 p) {\n" +" return vec3 (0.0);\n" +"}\n" +"\n" +"vec4 dFdy (vec4 p) {\n" +" return vec4 (0.0);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"float fwidth (float p) {\n" +" return abs (dFdx (p)) + abs (dFdy (p));\n" +"}\n" +"vec2 fwidth (vec2 p) {\n" +" return abs (dFdx (p)) + abs (dFdy (p));\n" +"}\n" +"vec3 fwidth (vec3 p) {\n" +" return abs (dFdx (p)) + abs (dFdy (p));\n" +"}\n" +"vec4 fwidth (vec4 p) {\n" +" return abs (dFdx (p)) + abs (dFdy (p));\n" +"}\n" +"\n" diff --git a/reactos/dll/mesa32/src/shader/slang/library/slang_fragment_builtin_gc_bin.h b/reactos/dll/mesa32/src/shader/slang/library/slang_fragment_builtin_gc_bin.h new file mode 100755 index 00000000000..b566c8b33d6 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/library/slang_fragment_builtin_gc_bin.h @@ -0,0 +1,87 @@ +2,2,2,6,12,1,103,108,95,70,114,97,103,67,111,111,114,100,0,0,0,2,2,6, +1,1,103,108,95,70,114,111,110,116,70,97,99,105,110,103,0,0,0,2,2,5,12,1, +103,108,95,70,114,97,103,67,111,108,111,114,0,0,0,2,2,5,12,1,103,108,95,70, +114,97,103,68,97,116,97,0,3,18,103,108,95,77,97,120,68,114,97,119,66,117,102,102, +101,114,115,0,0,0,2,2,5,9,1,103,108,95,70,114,97,103,68,101,112,116,104,0, +0,0,2,2,3,12,1,103,108,95,67,111,108,111,114,0,0,0,2,2,3,12,1,103, +108,95,83,101,99,111,110,100,97,114,121,67,111,108,111,114,0,0,0,2,2,3,12,1, +103,108,95,84,101,120,67,111,111,114,100,0,4,0,2,2,3,9,1,103,108,95,70,111, +103,70,114,97,103,67,111,111,114,100,0,0,0,1,0,12,0,116,101,120,116,117,114,101, +49,68,0,1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,9,99,111,111,114, +100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,118,101,99,52,0,17,48, +0,48,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,80,114,111, +106,0,1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,10,99,111,111,114,100, +0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,116,101,120,116,117,114,101,49, +68,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,59,115,0,18,99, +111,111,114,100,0,59,116,0,49,0,18,98,105,97,115,0,0,0,0,0,1,0,12,0, +116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,0,0,16,115,97,109,112,108,101, +114,0,0,1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0, +0,1,8,58,116,101,120,116,117,114,101,49,68,0,18,115,97,109,112,108,101,114,0,0, +18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,98, +105,97,115,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,0,1,0, +0,17,115,97,109,112,108,101,114,0,0,1,0,0,10,99,111,111,114,100,0,0,1,0, +0,9,98,105,97,115,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0,0, +0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114,111,106,0,1,0,0, +17,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0, +9,98,105,97,115,0,0,0,1,8,58,116,101,120,116,117,114,101,50,68,0,18,115,97, +109,112,108,101,114,0,0,58,118,101,99,50,0,18,99,111,111,114,100,0,59,115,0,18, +99,111,111,114,100,0,59,112,0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111, +111,114,100,0,59,112,0,49,0,0,0,18,98,105,97,115,0,0,0,0,0,1,0,12, +0,116,101,120,116,117,114,101,50,68,80,114,111,106,0,1,0,0,17,115,97,109,112,108, +101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0, +0,0,1,8,58,116,101,120,116,117,114,101,50,68,0,18,115,97,109,112,108,101,114,0, +0,58,118,101,99,50,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0, +59,113,0,49,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113, +0,49,0,0,0,18,98,105,97,115,0,0,0,0,0,1,0,12,0,116,101,120,116,117, +114,101,51,68,0,1,0,0,18,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111, +111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,118,101,99,52,0, +17,48,0,48,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,80, +114,111,106,0,1,0,0,18,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111, +114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,116,101,120,116,117,114, +101,51,68,80,114,111,106,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0, +18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99, +111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111, +114,100,0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,18,98,105,97, +115,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,67,117,98,101,0,1,0, +0,19,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0, +0,9,98,105,97,115,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0,0, +0,0,0,1,0,12,0,115,104,97,100,111,119,49,68,0,1,0,0,20,115,97,109,112, +108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115, +0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12, +0,115,104,97,100,111,119,50,68,0,1,0,0,21,115,97,109,112,108,101,114,0,0,1, +0,0,11,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58, +118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,115,104,97,100,111, +119,49,68,80,114,111,106,0,1,0,0,20,115,97,109,112,108,101,114,0,0,1,0,0, +12,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,115,104, +97,100,111,119,49,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18, +99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,17,48,0, +48,0,0,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100,0,59,113,0, +49,0,0,0,18,98,105,97,115,0,0,0,0,0,1,0,12,0,115,104,97,100,111,119, +50,68,80,114,111,106,0,1,0,0,21,115,97,109,112,108,101,114,0,0,1,0,0,12, +99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,115,104,97, +100,111,119,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99, +111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111, +114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100, +0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,18,98,105,97,115,0, +0,0,0,0,1,0,9,0,100,70,100,120,0,1,0,0,9,112,0,0,0,1,8,17, +48,0,48,0,0,0,0,1,0,10,0,100,70,100,120,0,1,0,0,10,112,0,0,0, +1,8,58,118,101,99,50,0,17,48,0,48,0,0,0,0,0,0,1,0,11,0,100,70, +100,120,0,1,0,0,11,112,0,0,0,1,8,58,118,101,99,51,0,17,48,0,48,0, +0,0,0,0,0,1,0,12,0,100,70,100,120,0,1,0,0,12,112,0,0,0,1,8, +58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,9,0,100,70,100,121, +0,1,0,0,9,112,0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,10,0,100, +70,100,121,0,1,0,0,10,112,0,0,0,1,8,58,118,101,99,50,0,17,48,0,48, +0,0,0,0,0,0,1,0,11,0,100,70,100,121,0,1,0,0,11,112,0,0,0,1, +8,58,118,101,99,51,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,100,70,100, +121,0,1,0,0,12,112,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0, +0,0,0,0,1,0,9,0,102,119,105,100,116,104,0,1,0,0,9,112,0,0,0,1, +8,58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0, +58,100,70,100,121,0,18,112,0,0,0,0,0,46,0,0,1,0,10,0,102,119,105,100, +116,104,0,1,0,0,10,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120,0, +18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0, +0,46,0,0,1,0,11,0,102,119,105,100,116,104,0,1,0,0,11,112,0,0,0,1, +8,58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0, +58,100,70,100,121,0,18,112,0,0,0,0,0,46,0,0,1,0,12,0,102,119,105,100, +116,104,0,1,0,0,12,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120,0, +18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0, +0,46,0,0,0 \ No newline at end of file diff --git a/reactos/dll/mesa32/src/shader/slang/library/slang_shader_syn.h b/reactos/dll/mesa32/src/shader/slang/library/slang_shader_syn.h new file mode 100644 index 00000000000..12e2a213786 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/library/slang_shader_syn.h @@ -0,0 +1,758 @@ +".syntax translation_unit;\n" +".emtcode REVISION 2\n" +".emtcode EXTERNAL_NULL 0\n" +".emtcode EXTERNAL_FUNCTION_DEFINITION 1\n" +".emtcode EXTERNAL_DECLARATION 2\n" +".emtcode DECLARATION_FUNCTION_PROTOTYPE 1\n" +".emtcode DECLARATION_INIT_DECLARATOR_LIST 2\n" +".emtcode FUNCTION_ORDINARY 0\n" +".emtcode FUNCTION_CONSTRUCTOR 1\n" +".emtcode FUNCTION_OPERATOR 2\n" +".emtcode OPERATOR_ASSIGN 1\n" +".emtcode OPERATOR_ADDASSIGN 2\n" +".emtcode OPERATOR_SUBASSIGN 3\n" +".emtcode OPERATOR_MULASSIGN 4\n" +".emtcode OPERATOR_DIVASSIGN 5\n" +".emtcode OPERATOR_LOGICALXOR 12\n" +".emtcode OPERATOR_EQUAL 16\n" +".emtcode OPERATOR_NOTEQUAL 17\n" +".emtcode OPERATOR_LESS 18\n" +".emtcode OPERATOR_GREATER 19\n" +".emtcode OPERATOR_LESSEQUAL 20\n" +".emtcode OPERATOR_GREATEREQUAL 21\n" +".emtcode OPERATOR_MULTIPLY 24\n" +".emtcode OPERATOR_DIVIDE 25\n" +".emtcode OPERATOR_INCREMENT 27\n" +".emtcode OPERATOR_DECREMENT 28\n" +".emtcode OPERATOR_PLUS 29\n" +".emtcode OPERATOR_MINUS 30\n" +".emtcode OPERATOR_NOT 32\n" +".emtcode DECLARATOR_NONE 0\n" +".emtcode DECLARATOR_NEXT 1\n" +".emtcode VARIABLE_NONE 0\n" +".emtcode VARIABLE_IDENTIFIER 1\n" +".emtcode VARIABLE_INITIALIZER 2\n" +".emtcode VARIABLE_ARRAY_EXPLICIT 3\n" +".emtcode VARIABLE_ARRAY_UNKNOWN 4\n" +".emtcode TYPE_QUALIFIER_NONE 0\n" +".emtcode TYPE_QUALIFIER_CONST 1\n" +".emtcode TYPE_QUALIFIER_ATTRIBUTE 2\n" +".emtcode TYPE_QUALIFIER_VARYING 3\n" +".emtcode TYPE_QUALIFIER_UNIFORM 4\n" +".emtcode TYPE_QUALIFIER_FIXEDOUTPUT 5\n" +".emtcode TYPE_QUALIFIER_FIXEDINPUT 6\n" +".emtcode TYPE_SPECIFIER_VOID 0\n" +".emtcode TYPE_SPECIFIER_BOOL 1\n" +".emtcode TYPE_SPECIFIER_BVEC2 2\n" +".emtcode TYPE_SPECIFIER_BVEC3 3\n" +".emtcode TYPE_SPECIFIER_BVEC4 4\n" +".emtcode TYPE_SPECIFIER_INT 5\n" +".emtcode TYPE_SPECIFIER_IVEC2 6\n" +".emtcode TYPE_SPECIFIER_IVEC3 7\n" +".emtcode TYPE_SPECIFIER_IVEC4 8\n" +".emtcode TYPE_SPECIFIER_FLOAT 9\n" +".emtcode TYPE_SPECIFIER_VEC2 10\n" +".emtcode TYPE_SPECIFIER_VEC3 11\n" +".emtcode TYPE_SPECIFIER_VEC4 12\n" +".emtcode TYPE_SPECIFIER_MAT2 13\n" +".emtcode TYPE_SPECIFIER_MAT3 14\n" +".emtcode TYPE_SPECIFIER_MAT4 15\n" +".emtcode TYPE_SPECIFIER_SAMPLER1D 16\n" +".emtcode TYPE_SPECIFIER_SAMPLER2D 17\n" +".emtcode TYPE_SPECIFIER_SAMPLER3D 18\n" +".emtcode TYPE_SPECIFIER_SAMPLERCUBE 19\n" +".emtcode TYPE_SPECIFIER_SAMPLER1DSHADOW 20\n" +".emtcode TYPE_SPECIFIER_SAMPLER2DSHADOW 21\n" +".emtcode TYPE_SPECIFIER_STRUCT 22\n" +".emtcode TYPE_SPECIFIER_TYPENAME 23\n" +".emtcode FIELD_NONE 0\n" +".emtcode FIELD_NEXT 1\n" +".emtcode FIELD_ARRAY 2\n" +".emtcode OP_END 0\n" +".emtcode OP_BLOCK_BEGIN_NO_NEW_SCOPE 1\n" +".emtcode OP_BLOCK_BEGIN_NEW_SCOPE 2\n" +".emtcode OP_DECLARE 3\n" +".emtcode OP_ASM 4\n" +".emtcode OP_BREAK 5\n" +".emtcode OP_CONTINUE 6\n" +".emtcode OP_DISCARD 7\n" +".emtcode OP_RETURN 8\n" +".emtcode OP_EXPRESSION 9\n" +".emtcode OP_IF 10\n" +".emtcode OP_WHILE 11\n" +".emtcode OP_DO 12\n" +".emtcode OP_FOR 13\n" +".emtcode OP_PUSH_VOID 14\n" +".emtcode OP_PUSH_BOOL 15\n" +".emtcode OP_PUSH_INT 16\n" +".emtcode OP_PUSH_FLOAT 17\n" +".emtcode OP_PUSH_IDENTIFIER 18\n" +".emtcode OP_SEQUENCE 19\n" +".emtcode OP_ASSIGN 20\n" +".emtcode OP_ADDASSIGN 21\n" +".emtcode OP_SUBASSIGN 22\n" +".emtcode OP_MULASSIGN 23\n" +".emtcode OP_DIVASSIGN 24\n" +".emtcode OP_SELECT 31\n" +".emtcode OP_LOGICALOR 32\n" +".emtcode OP_LOGICALXOR 33\n" +".emtcode OP_LOGICALAND 34\n" +".emtcode OP_EQUAL 38\n" +".emtcode OP_NOTEQUAL 39\n" +".emtcode OP_LESS 40\n" +".emtcode OP_GREATER 41\n" +".emtcode OP_LESSEQUAL 42\n" +".emtcode OP_GREATEREQUAL 43\n" +".emtcode OP_ADD 46\n" +".emtcode OP_SUBTRACT 47\n" +".emtcode OP_MULTIPLY 48\n" +".emtcode OP_DIVIDE 49\n" +".emtcode OP_PREINCREMENT 51\n" +".emtcode OP_PREDECREMENT 52\n" +".emtcode OP_PLUS 53\n" +".emtcode OP_MINUS 54\n" +".emtcode OP_NOT 56\n" +".emtcode OP_SUBSCRIPT 57\n" +".emtcode OP_CALL 58\n" +".emtcode OP_FIELD 59\n" +".emtcode OP_POSTINCREMENT 60\n" +".emtcode OP_POSTDECREMENT 61\n" +".emtcode PARAM_QUALIFIER_IN 0\n" +".emtcode PARAM_QUALIFIER_OUT 1\n" +".emtcode PARAM_QUALIFIER_INOUT 2\n" +".emtcode PARAMETER_NONE 0\n" +".emtcode PARAMETER_NEXT 1\n" +".emtcode PARAMETER_ARRAY_NOT_PRESENT 0\n" +".emtcode PARAMETER_ARRAY_PRESENT 1\n" +".errtext INVALID_EXTERNAL_DECLARATION \"error 2001: invalid external declaration\"\n" +".errtext INVALID_OPERATOR_OVERRIDE \"error 2002: invalid operator override\"\n" +".errtext LBRACE_EXPECTED \"error 2003: '{' expected but '$err_token$' found\"\n" +".errtext LPAREN_EXPECTED \"error 2004: '(' expected but '$err_token$' found\"\n" +".errtext RPAREN_EXPECTED \"error 2005: ')' expected but '$err_token$' found\"\n" +".regbyte parsing_builtin 0\n" +".regbyte shader_type 0\n" +"variable_identifier\n" +" identifier .emit OP_PUSH_IDENTIFIER;\n" +"primary_expression\n" +" floatconstant .or boolconstant .or intconstant .or variable_identifier .or primary_expression_1;\n" +"primary_expression_1\n" +" lparen .and expression .and rparen;\n" +"postfix_expression\n" +" postfix_expression_1 .and .loop postfix_expression_2;\n" +"postfix_expression_1\n" +" function_call .or primary_expression;\n" +"postfix_expression_2\n" +" postfix_expression_3 .or postfix_expression_4 .or\n" +" plusplus .emit OP_POSTINCREMENT .or\n" +" minusminus .emit OP_POSTDECREMENT;\n" +"postfix_expression_3\n" +" lbracket .and integer_expression .and rbracket .emit OP_SUBSCRIPT;\n" +"postfix_expression_4\n" +" dot .and field_selection .emit OP_FIELD;\n" +"integer_expression\n" +" expression;\n" +"function_call\n" +" function_call_generic .emit OP_CALL .and .true .emit OP_END;\n" +"function_call_generic\n" +" function_call_generic_1 .or function_call_generic_2;\n" +"function_call_generic_1\n" +" function_call_header_with_parameters .and rparen .error RPAREN_EXPECTED;\n" +"function_call_generic_2\n" +" function_call_header_no_parameters .and rparen .error RPAREN_EXPECTED;\n" +"function_call_header_no_parameters\n" +" function_call_header .and function_call_header_no_parameters_1;\n" +"function_call_header_no_parameters_1\n" +" \"void\" .or .true;\n" +"function_call_header_with_parameters\n" +" function_call_header .and assignment_expression .and .true .emit OP_END .and\n" +" .loop function_call_header_with_parameters_1;\n" +"function_call_header_with_parameters_1\n" +" comma .and assignment_expression .and .true .emit OP_END;\n" +"function_call_header\n" +" function_identifier .and lparen;\n" +"function_identifier\n" +" identifier;\n" +"unary_expression\n" +" postfix_expression .or unary_expression_1 .or unary_expression_2 .or unary_expression_3 .or\n" +" unary_expression_4 .or unary_expression_5;\n" +"unary_expression_1\n" +" plusplus .and unary_expression .and .true .emit OP_PREINCREMENT;\n" +"unary_expression_2\n" +" minusminus .and unary_expression .and .true .emit OP_PREDECREMENT;\n" +"unary_expression_3\n" +" plus .and unary_expression .and .true .emit OP_PLUS;\n" +"unary_expression_4\n" +" minus .and unary_expression .and .true .emit OP_MINUS;\n" +"unary_expression_5\n" +" bang .and unary_expression .and .true .emit OP_NOT;\n" +"multiplicative_expression\n" +" unary_expression .and .loop multiplicative_expression_1;\n" +"multiplicative_expression_1\n" +" multiplicative_expression_2 .or multiplicative_expression_3;\n" +"multiplicative_expression_2\n" +" star .and unary_expression .and .true .emit OP_MULTIPLY;\n" +"multiplicative_expression_3\n" +" slash .and unary_expression .and .true .emit OP_DIVIDE;\n" +"additive_expression\n" +" multiplicative_expression .and .loop additive_expression_1;\n" +"additive_expression_1\n" +" additive_expression_2 .or additive_expression_3;\n" +"additive_expression_2\n" +" plus .and multiplicative_expression .and .true .emit OP_ADD;\n" +"additive_expression_3\n" +" minus .and multiplicative_expression .and .true .emit OP_SUBTRACT;\n" +"shift_expression\n" +" additive_expression;\n" +"relational_expression\n" +" shift_expression .and .loop relational_expression_1;\n" +"relational_expression_1\n" +" relational_expression_2 .or relational_expression_3 .or relational_expression_4 .or\n" +" relational_expression_5;\n" +"relational_expression_2\n" +" lessequals .and shift_expression .and .true .emit OP_LESSEQUAL;\n" +"relational_expression_3\n" +" greaterequals .and shift_expression .and .true .emit OP_GREATEREQUAL;\n" +"relational_expression_4\n" +" less .and shift_expression .and .true .emit OP_LESS;\n" +"relational_expression_5\n" +" greater .and shift_expression .and .true .emit OP_GREATER;\n" +"equality_expression\n" +" relational_expression .and .loop equality_expression_1;\n" +"equality_expression_1\n" +" equality_expression_2 .or equality_expression_3;\n" +"equality_expression_2\n" +" equalsequals .and relational_expression .and .true .emit OP_EQUAL;\n" +"equality_expression_3\n" +" bangequals .and relational_expression .and .true .emit OP_NOTEQUAL;\n" +"and_expression\n" +" equality_expression;\n" +"exclusive_or_expression\n" +" and_expression;\n" +"inclusive_or_expression\n" +" exclusive_or_expression;\n" +"logical_and_expression\n" +" inclusive_or_expression .and .loop logical_and_expression_1;\n" +"logical_and_expression_1\n" +" ampersandampersand .and inclusive_or_expression .and .true .emit OP_LOGICALAND;\n" +"logical_xor_expression\n" +" logical_and_expression .and .loop logical_xor_expression_1;\n" +"logical_xor_expression_1\n" +" caretcaret .and logical_and_expression .and .true .emit OP_LOGICALXOR;\n" +"logical_or_expression\n" +" logical_xor_expression .and .loop logical_or_expression_1;\n" +"logical_or_expression_1\n" +" barbar .and logical_xor_expression .and .true .emit OP_LOGICALOR;\n" +"conditional_expression\n" +" logical_or_expression .and .loop conditional_expression_1;\n" +"conditional_expression_1\n" +" question .and expression .and colon .and conditional_expression .and .true .emit OP_SELECT;\n" +"assignment_expression\n" +" assignment_expression_1 .or assignment_expression_2 .or assignment_expression_3 .or\n" +" assignment_expression_4 .or assignment_expression_5 .or conditional_expression;\n" +"assignment_expression_1\n" +" unary_expression .and equals .and assignment_expression .and .true .emit OP_ASSIGN;\n" +"assignment_expression_2\n" +" unary_expression .and starequals .and assignment_expression .and .true .emit OP_MULASSIGN;\n" +"assignment_expression_3\n" +" unary_expression .and slashequals .and assignment_expression .and .true .emit OP_DIVASSIGN;\n" +"assignment_expression_4\n" +" unary_expression .and plusequals .and assignment_expression .and .true .emit OP_ADDASSIGN;\n" +"assignment_expression_5\n" +" unary_expression .and minusequals .and assignment_expression .and .true .emit OP_SUBASSIGN;\n" +"expression\n" +" assignment_expression .and .loop expression_1;\n" +"expression_1\n" +" comma .and assignment_expression .and .true .emit OP_SEQUENCE;\n" +"constant_expression\n" +" conditional_expression .and .true .emit OP_END;\n" +"declaration\n" +" declaration_1 .or declaration_2;\n" +"declaration_1\n" +" function_prototype .emit DECLARATION_FUNCTION_PROTOTYPE .and semicolon;\n" +"declaration_2\n" +" init_declarator_list .emit DECLARATION_INIT_DECLARATOR_LIST .and semicolon;\n" +"function_prototype\n" +" function_declarator .and rparen .error RPAREN_EXPECTED .emit PARAMETER_NONE;\n" +"function_declarator\n" +" function_header_with_parameters .or function_header;\n" +"function_header_with_parameters\n" +" function_header .and parameter_declaration .and .loop function_header_with_parameters_1;\n" +"function_header_with_parameters_1\n" +" comma .and parameter_declaration;\n" +"function_header\n" +" function_header_nospace .or function_header_space;\n" +"function_header_space\n" +" fully_specified_type_space .and space .and function_decl_identifier .and lparen;\n" +"function_header_nospace\n" +" fully_specified_type_nospace .and function_decl_identifier .and lparen;\n" +"function_decl_identifier\n" +" .if (parsing_builtin != 0) __operator .emit FUNCTION_OPERATOR .or\n" +" .if (parsing_builtin != 0) \"__constructor\" .emit FUNCTION_CONSTRUCTOR .or\n" +" identifier .emit FUNCTION_ORDINARY;\n" +"__operator\n" +" \"__operator\" .and overriden_operator .error INVALID_OPERATOR_OVERRIDE;\n" +"overriden_operator\n" +" plusplus .emit OPERATOR_INCREMENT .or\n" +" plusequals .emit OPERATOR_ADDASSIGN .or\n" +" plus .emit OPERATOR_PLUS .or\n" +" minusminus .emit OPERATOR_DECREMENT .or\n" +" minusequals .emit OPERATOR_SUBASSIGN .or\n" +" minus .emit OPERATOR_MINUS .or\n" +" bangequals .emit OPERATOR_NOTEQUAL .or\n" +" bang .emit OPERATOR_NOT .or\n" +" starequals .emit OPERATOR_MULASSIGN .or\n" +" star .emit OPERATOR_MULTIPLY .or\n" +" slashequals .emit OPERATOR_DIVASSIGN .or\n" +" slash .emit OPERATOR_DIVIDE .or\n" +" lessequals .emit OPERATOR_LESSEQUAL .or\n" +" \n" +" \n" +" less .emit OPERATOR_LESS .or\n" +" greaterequals .emit OPERATOR_GREATEREQUAL .or\n" +" \n" +" \n" +" greater .emit OPERATOR_GREATER .or\n" +" equalsequals .emit OPERATOR_EQUAL .or\n" +" equals .emit OPERATOR_ASSIGN .or\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" caretcaret .emit OPERATOR_LOGICALXOR ;\n" +"parameter_declarator\n" +" parameter_declarator_nospace .or parameter_declarator_space;\n" +"parameter_declarator_nospace\n" +" type_specifier_nospace .and identifier .and parameter_declarator_1;\n" +"parameter_declarator_space\n" +" type_specifier_space .and space .and identifier .and parameter_declarator_1;\n" +"parameter_declarator_1\n" +" parameter_declarator_2 .emit PARAMETER_ARRAY_PRESENT .or\n" +" .true .emit PARAMETER_ARRAY_NOT_PRESENT;\n" +"parameter_declarator_2\n" +" lbracket .and constant_expression .and rbracket;\n" +"parameter_declaration\n" +" parameter_declaration_1 .emit PARAMETER_NEXT;\n" +"parameter_declaration_1\n" +" parameter_declaration_2 .or parameter_declaration_3;\n" +"parameter_declaration_2\n" +" type_qualifier .and space .and parameter_qualifier .and parameter_declaration_4;\n" +"parameter_declaration_3\n" +" parameter_qualifier .emit TYPE_QUALIFIER_NONE .and parameter_declaration_4;\n" +"parameter_declaration_4\n" +" parameter_declarator .or parameter_type_specifier;\n" +"parameter_qualifier\n" +" parameter_qualifier_1 .or .true .emit PARAM_QUALIFIER_IN;\n" +"parameter_qualifier_1\n" +" parameter_qualifier_2 .and space;\n" +"parameter_qualifier_2\n" +" \"in\" .emit PARAM_QUALIFIER_IN .or\n" +" \"out\" .emit PARAM_QUALIFIER_OUT .or\n" +" \"inout\" .emit PARAM_QUALIFIER_INOUT;\n" +"parameter_type_specifier\n" +" parameter_type_specifier_1 .and .true .emit '\\0' .and parameter_type_specifier_2;\n" +"parameter_type_specifier_1\n" +" type_specifier_nospace .or type_specifier_space;\n" +"parameter_type_specifier_2\n" +" parameter_type_specifier_3 .emit PARAMETER_ARRAY_PRESENT .or\n" +" .true .emit PARAMETER_ARRAY_NOT_PRESENT;\n" +"parameter_type_specifier_3\n" +" lbracket .and constant_expression .and rbracket;\n" +"init_declarator_list\n" +" single_declaration .and .loop init_declarator_list_1 .emit DECLARATOR_NEXT .and\n" +" .true .emit DECLARATOR_NONE;\n" +"init_declarator_list_1\n" +" comma .and identifier .emit VARIABLE_IDENTIFIER .and init_declarator_list_2;\n" +"init_declarator_list_2\n" +" init_declarator_list_3 .or init_declarator_list_4 .or .true .emit VARIABLE_NONE;\n" +"init_declarator_list_3\n" +" equals .and initializer .emit VARIABLE_INITIALIZER;\n" +"init_declarator_list_4\n" +" lbracket .and init_declarator_list_5 .and rbracket;\n" +"init_declarator_list_5\n" +" constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;\n" +"single_declaration\n" +" single_declaration_nospace .or single_declaration_space;\n" +"single_declaration_space\n" +" fully_specified_type_space .and single_declaration_space_1;\n" +"single_declaration_nospace\n" +" fully_specified_type_nospace .and single_declaration_nospace_1;\n" +"single_declaration_space_1\n" +" single_declaration_space_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;\n" +"single_declaration_nospace_1\n" +" single_declaration_nospace_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;\n" +"single_declaration_space_2\n" +" space .and identifier .and single_declaration_3;\n" +"single_declaration_nospace_2\n" +" identifier .and single_declaration_3;\n" +"single_declaration_3\n" +" single_declaration_4 .or single_declaration_5 .or .true .emit VARIABLE_NONE;\n" +"single_declaration_4\n" +" equals .and initializer .emit VARIABLE_INITIALIZER;\n" +"single_declaration_5\n" +" lbracket .and single_declaration_6 .and rbracket;\n" +"single_declaration_6\n" +" constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;\n" +"fully_specified_type_space\n" +" fully_specified_type_1 .and type_specifier_space;\n" +"fully_specified_type_nospace\n" +" fully_specified_type_1 .and type_specifier_nospace;\n" +"fully_specified_type_1\n" +" fully_specified_type_2 .or .true .emit TYPE_QUALIFIER_NONE;\n" +"fully_specified_type_2\n" +" type_qualifier .and space;\n" +"type_qualifier\n" +" \"const\" .emit TYPE_QUALIFIER_CONST .or\n" +" .if (shader_type == 2) \"attribute\" .emit TYPE_QUALIFIER_ATTRIBUTE .or\n" +" \"varying\" .emit TYPE_QUALIFIER_VARYING .or\n" +" \"uniform\" .emit TYPE_QUALIFIER_UNIFORM .or\n" +" .if (parsing_builtin != 0) \"__fixed_output\" .emit TYPE_QUALIFIER_FIXEDOUTPUT .or\n" +" .if (parsing_builtin != 0) \"__fixed_input\" .emit TYPE_QUALIFIER_FIXEDINPUT;\n" +"type_specifier_space\n" +" \"void\" .emit TYPE_SPECIFIER_VOID .or\n" +" \"float\" .emit TYPE_SPECIFIER_FLOAT .or\n" +" \"int\" .emit TYPE_SPECIFIER_INT .or\n" +" \"bool\" .emit TYPE_SPECIFIER_BOOL .or\n" +" \"vec2\" .emit TYPE_SPECIFIER_VEC2 .or\n" +" \"vec3\" .emit TYPE_SPECIFIER_VEC3 .or\n" +" \"vec4\" .emit TYPE_SPECIFIER_VEC4 .or\n" +" \"bvec2\" .emit TYPE_SPECIFIER_BVEC2 .or\n" +" \"bvec3\" .emit TYPE_SPECIFIER_BVEC3 .or\n" +" \"bvec4\" .emit TYPE_SPECIFIER_BVEC4 .or\n" +" \"ivec2\" .emit TYPE_SPECIFIER_IVEC2 .or\n" +" \"ivec3\" .emit TYPE_SPECIFIER_IVEC3 .or\n" +" \"ivec4\" .emit TYPE_SPECIFIER_IVEC4 .or\n" +" \"mat2\" .emit TYPE_SPECIFIER_MAT2 .or\n" +" \"mat3\" .emit TYPE_SPECIFIER_MAT3 .or\n" +" \"mat4\" .emit TYPE_SPECIFIER_MAT4 .or\n" +" \"sampler1D\" .emit TYPE_SPECIFIER_SAMPLER1D .or\n" +" \"sampler2D\" .emit TYPE_SPECIFIER_SAMPLER2D .or\n" +" \"sampler3D\" .emit TYPE_SPECIFIER_SAMPLER3D .or\n" +" \"samplerCube\" .emit TYPE_SPECIFIER_SAMPLERCUBE .or\n" +" \"sampler1DShadow\" .emit TYPE_SPECIFIER_SAMPLER1DSHADOW .or\n" +" \"sampler2DShadow\" .emit TYPE_SPECIFIER_SAMPLER2DSHADOW .or\n" +" type_name .emit TYPE_SPECIFIER_TYPENAME;\n" +"type_specifier_nospace\n" +" struct_specifier .emit TYPE_SPECIFIER_STRUCT;\n" +"struct_specifier\n" +" \"struct\" .and struct_specifier_1 .and optional_space .and lbrace .error LBRACE_EXPECTED .and\n" +" struct_declaration_list .and rbrace .emit FIELD_NONE;\n" +"struct_specifier_1\n" +" struct_specifier_2 .or .true .emit '\\0';\n" +"struct_specifier_2\n" +" space .and identifier;\n" +"struct_declaration_list\n" +" struct_declaration .and .loop struct_declaration .emit FIELD_NEXT;\n" +"struct_declaration\n" +" struct_declaration_nospace .or struct_declaration_space;\n" +"struct_declaration_space\n" +" type_specifier_space .and space .and struct_declarator_list .and semicolon .emit FIELD_NONE;\n" +"struct_declaration_nospace\n" +" type_specifier_nospace .and struct_declarator_list .and semicolon .emit FIELD_NONE;\n" +"struct_declarator_list\n" +" struct_declarator .and .loop struct_declarator_list_1 .emit FIELD_NEXT;\n" +"struct_declarator_list_1\n" +" comma .and struct_declarator;\n" +"struct_declarator\n" +" identifier .and struct_declarator_1;\n" +"struct_declarator_1\n" +" struct_declarator_2 .emit FIELD_ARRAY .or .true .emit FIELD_NONE;\n" +"struct_declarator_2\n" +" lbracket .and constant_expression .and rbracket;\n" +"initializer\n" +" assignment_expression .and .true .emit OP_END;\n" +"declaration_statement\n" +" declaration;\n" +"statement\n" +" compound_statement .or simple_statement;\n" +"statement_space\n" +" compound_statement .or statement_space_1;\n" +"statement_space_1\n" +" space .and simple_statement;\n" +"simple_statement\n" +" .if (parsing_builtin != 0) __asm_statement .emit OP_ASM .or\n" +" selection_statement .or\n" +" iteration_statement .or\n" +" jump_statement .or\n" +" expression_statement .emit OP_EXPRESSION .or\n" +" declaration_statement .emit OP_DECLARE;\n" +"compound_statement\n" +" compound_statement_1 .emit OP_BLOCK_BEGIN_NEW_SCOPE .and .true .emit OP_END;\n" +"compound_statement_1\n" +" compound_statement_2 .or compound_statement_3;\n" +"compound_statement_2\n" +" lbrace .and rbrace;\n" +"compound_statement_3\n" +" lbrace .and statement_list .and rbrace;\n" +"statement_no_new_scope\n" +" compound_statement_no_new_scope .or simple_statement;\n" +"compound_statement_no_new_scope\n" +" compound_statement_no_new_scope_1 .emit OP_BLOCK_BEGIN_NO_NEW_SCOPE .and .true .emit OP_END;\n" +"compound_statement_no_new_scope_1\n" +" compound_statement_no_new_scope_2 .or compound_statement_no_new_scope_3;\n" +"compound_statement_no_new_scope_2\n" +" lbrace .and rbrace;\n" +"compound_statement_no_new_scope_3\n" +" lbrace .and statement_list .and rbrace;\n" +"statement_list\n" +" statement .and .loop statement;\n" +"expression_statement\n" +" expression_statement_1 .or expression_statement_2;\n" +"expression_statement_1\n" +" semicolon .emit OP_PUSH_VOID .emit OP_END;\n" +"expression_statement_2\n" +" expression .and semicolon .emit OP_END;\n" +"selection_statement\n" +" \"if\" .emit OP_IF .and lparen .error LPAREN_EXPECTED .and expression .and\n" +" rparen .error RPAREN_EXPECTED .emit OP_END .and selection_rest_statement;\n" +"selection_rest_statement\n" +" statement .and selection_rest_statement_1;\n" +"selection_rest_statement_1\n" +" selection_rest_statement_2 .or .true .emit OP_EXPRESSION .emit OP_PUSH_VOID .emit OP_END;\n" +"selection_rest_statement_2\n" +" \"else\" .and optional_space .and statement;\n" +"condition\n" +" condition_1 .emit OP_DECLARE .emit DECLARATION_INIT_DECLARATOR_LIST .or\n" +" condition_3 .emit OP_EXPRESSION;\n" +"condition_1\n" +" condition_1_nospace .or condition_1_space;\n" +"condition_1_nospace\n" +" fully_specified_type_nospace .and condition_2;\n" +"condition_1_space\n" +" fully_specified_type_space .and space .and condition_2;\n" +"condition_2\n" +" identifier .emit VARIABLE_IDENTIFIER .and equals .emit VARIABLE_INITIALIZER .and\n" +" initializer .and .true .emit DECLARATOR_NONE;\n" +"condition_3\n" +" expression .and .true .emit OP_END;\n" +"iteration_statement\n" +" iteration_statement_1 .or iteration_statement_2 .or iteration_statement_3;\n" +"iteration_statement_1\n" +" \"while\" .emit OP_WHILE .and lparen .error LPAREN_EXPECTED .and condition .and\n" +" rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n" +"iteration_statement_2\n" +" \"do\" .emit OP_DO .and statement_space .and \"while\" .and lparen .error LPAREN_EXPECTED .and\n" +" expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon;\n" +"iteration_statement_3\n" +" \"for\" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and\n" +" for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n" +"for_init_statement\n" +" expression_statement .emit OP_EXPRESSION .or declaration_statement .emit OP_DECLARE;\n" +"conditionopt\n" +" condition .or\n" +" .true .emit OP_EXPRESSION .emit OP_PUSH_BOOL .emit 2 .emit '1' .emit '\\0' .emit OP_END;\n" +"for_rest_statement\n" +" conditionopt .and semicolon .and for_rest_statement_1;\n" +"for_rest_statement_1\n" +" for_rest_statement_2 .or .true .emit OP_PUSH_VOID .emit OP_END;\n" +"for_rest_statement_2\n" +" expression .and .true .emit OP_END;\n" +"jump_statement\n" +" jump_statement_1 .or jump_statement_2 .or jump_statement_3 .or jump_statement_4 .or\n" +" .if (shader_type == 1) jump_statement_5;\n" +"jump_statement_1\n" +" \"continue\" .and semicolon .emit OP_CONTINUE;\n" +"jump_statement_2\n" +" \"break\" .and semicolon .emit OP_BREAK;\n" +"jump_statement_3\n" +" \"return\" .emit OP_RETURN .and optional_space .and expression .and semicolon .emit OP_END;\n" +"jump_statement_4\n" +" \"return\" .emit OP_RETURN .and semicolon .emit OP_PUSH_VOID .emit OP_END;\n" +"jump_statement_5\n" +" \"discard\" .and semicolon .emit OP_DISCARD;\n" +"__asm_statement\n" +" \"__asm\" .and space .and identifier .and space .and asm_arguments .and semicolon .emit OP_END;\n" +"asm_arguments\n" +" variable_identifier .and .true .emit OP_END .and .loop asm_arguments_1;\n" +"asm_arguments_1\n" +" comma .and variable_identifier .and .true .emit OP_END;\n" +"translation_unit\n" +" optional_space .emit REVISION .and external_declaration .error INVALID_EXTERNAL_DECLARATION .and\n" +" .loop external_declaration .and optional_space .and\n" +" '\\0' .error INVALID_EXTERNAL_DECLARATION .emit EXTERNAL_NULL;\n" +"external_declaration\n" +" function_definition .emit EXTERNAL_FUNCTION_DEFINITION .or\n" +" declaration .emit EXTERNAL_DECLARATION;\n" +"function_definition\n" +" function_prototype .and compound_statement_no_new_scope;\n" +"digit_oct\n" +" '0'-'7';\n" +"digit_dec\n" +" '0'-'9';\n" +"digit_hex\n" +" '0'-'9' .or 'A'-'F' .or 'a'-'f';\n" +"id_character_first\n" +" 'a'-'z' .or 'A'-'Z' .or '_';\n" +"id_character_next\n" +" id_character_first .or digit_dec;\n" +"identifier\n" +" id_character_first .emit * .and .loop id_character_next .emit * .and .true .emit '\\0';\n" +"float\n" +" float_1 .or float_2;\n" +"float_1\n" +" float_fractional_constant .and float_optional_exponent_part;\n" +"float_2\n" +" float_digit_sequence .and .true .emit '\\0' .and float_exponent_part;\n" +"float_fractional_constant\n" +" float_fractional_constant_1 .or float_fractional_constant_2 .or float_fractional_constant_3;\n" +"float_fractional_constant_1\n" +" float_digit_sequence .and '.' .and float_digit_sequence;\n" +"float_fractional_constant_2\n" +" float_digit_sequence .and '.' .and .true .emit '\\0';\n" +"float_fractional_constant_3\n" +" '.' .emit '\\0' .and float_digit_sequence;\n" +"float_optional_exponent_part\n" +" float_exponent_part .or .true .emit '\\0';\n" +"float_digit_sequence\n" +" digit_dec .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n" +"float_exponent_part\n" +" float_exponent_part_1 .or float_exponent_part_2;\n" +"float_exponent_part_1\n" +" 'e' .and float_optional_sign .and float_digit_sequence;\n" +"float_exponent_part_2\n" +" 'E' .and float_optional_sign .and float_digit_sequence;\n" +"float_optional_sign\n" +" float_sign .or .true;\n" +"float_sign\n" +" '+' .or '-' .emit '-';\n" +"integer\n" +" integer_hex .or integer_oct .or integer_dec;\n" +"integer_hex\n" +" '0' .and integer_hex_1 .emit 0x10 .and digit_hex .emit * .and .loop digit_hex .emit * .and\n" +" .true .emit '\\0';\n" +"integer_hex_1\n" +" 'x' .or 'X';\n" +"integer_oct\n" +" '0' .emit 8 .emit * .and .loop digit_oct .emit * .and .true .emit '\\0';\n" +"integer_dec\n" +" digit_dec .emit 10 .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n" +"boolean\n" +" \"true\" .emit 2 .emit '1' .emit '\\0' .or\n" +" \"false\" .emit 2 .emit '0' .emit '\\0';\n" +"type_name\n" +" identifier;\n" +"field_selection\n" +" identifier;\n" +"floatconstant\n" +" float .emit OP_PUSH_FLOAT;\n" +"intconstant\n" +" integer .emit OP_PUSH_INT;\n" +"boolconstant\n" +" boolean .emit OP_PUSH_BOOL;\n" +"optional_space\n" +" .loop single_space;\n" +"space\n" +" single_space .and .loop single_space;\n" +"single_space\n" +" white_char .or c_style_comment_block .or cpp_style_comment_block;\n" +"white_char\n" +" ' ' .or '\\t' .or new_line .or '\\v' .or '\\f';\n" +"new_line\n" +" cr_lf .or lf_cr .or '\\n' .or '\\r';\n" +"cr_lf\n" +" '\\r' .and '\\n';\n" +"lf_cr\n" +" '\\n' .and '\\r';\n" +"c_style_comment_block\n" +" '/' .and '*' .and c_style_comment_rest;\n" +"c_style_comment_rest\n" +" .loop c_style_comment_char_no_star .and c_style_comment_rest_1;\n" +"c_style_comment_rest_1\n" +" c_style_comment_end .or c_style_comment_rest_2;\n" +"c_style_comment_rest_2\n" +" '*' .and c_style_comment_rest;\n" +"c_style_comment_char_no_star\n" +" '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n" +"c_style_comment_end\n" +" '*' .and '/';\n" +"cpp_style_comment_block\n" +" '/' .and '/' .and cpp_style_comment_block_1;\n" +"cpp_style_comment_block_1\n" +" cpp_style_comment_block_2 .or cpp_style_comment_block_3;\n" +"cpp_style_comment_block_2\n" +" .loop cpp_style_comment_char .and new_line;\n" +"cpp_style_comment_block_3\n" +" .loop cpp_style_comment_char;\n" +"cpp_style_comment_char\n" +" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" +"ampersandampersand\n" +" optional_space .and '&' .and '&' .and optional_space;\n" +"barbar\n" +" optional_space .and '|' .and '|' .and optional_space;\n" +"bang\n" +" optional_space .and '!' .and optional_space;\n" +"bangequals\n" +" optional_space .and '!' .and '=' .and optional_space;\n" +"caretcaret\n" +" optional_space .and '^' .and '^' .and optional_space;\n" +"colon\n" +" optional_space .and ':' .and optional_space;\n" +"comma\n" +" optional_space .and ',' .and optional_space;\n" +"dot\n" +" optional_space .and '.' .and optional_space;\n" +"equals\n" +" optional_space .and '=' .and optional_space;\n" +"equalsequals\n" +" optional_space .and '=' .and '=' .and optional_space;\n" +"greater\n" +" optional_space .and '>' .and optional_space;\n" +"greaterequals\n" +" optional_space .and '>' .and '=' .and optional_space;\n" +"lbrace\n" +" optional_space .and '{' .and optional_space;\n" +"lbracket\n" +" optional_space .and '[' .and optional_space;\n" +"less\n" +" optional_space .and '<' .and optional_space;\n" +"lessequals\n" +" optional_space .and '<' .and '=' .and optional_space;\n" +"lparen\n" +" optional_space .and '(' .and optional_space;\n" +"minus\n" +" optional_space .and '-' .and optional_space;\n" +"minusequals\n" +" optional_space .and '-' .and '=' .and optional_space;\n" +"minusminus\n" +" optional_space .and '-' .and '-' .and optional_space;\n" +"plus\n" +" optional_space .and '+' .and optional_space;\n" +"plusequals\n" +" optional_space .and '+' .and '=' .and optional_space;\n" +"plusplus\n" +" optional_space .and '+' .and '+' .and optional_space;\n" +"question\n" +" optional_space .and '?' .and optional_space;\n" +"rbrace\n" +" optional_space .and '}' .and optional_space;\n" +"rbracket\n" +" optional_space .and ']' .and optional_space;\n" +"rparen\n" +" optional_space .and ')' .and optional_space;\n" +"semicolon\n" +" optional_space .and ';' .and optional_space;\n" +"slash\n" +" optional_space .and '/' .and optional_space;\n" +"slashequals\n" +" optional_space .and '/' .and '=' .and optional_space;\n" +"star\n" +" optional_space .and '*' .and optional_space;\n" +"starequals\n" +" optional_space .and '*' .and '=' .and optional_space;\n" +".string string_lexer;\n" +"string_lexer\n" +" lex_first_identifier_character .and .loop lex_next_identifier_character;\n" +"lex_first_identifier_character\n" +" 'a'-'z' .or 'A'-'Z' .or '_';\n" +"lex_next_identifier_character\n" +" 'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';\n" +"err_token\n" +" '~' .or '`' .or '!' .or '@' .or '#' .or '$' .or '%' .or '^' .or '&' .or '*' .or '(' .or ')' .or\n" +" '-' .or '+' .or '=' .or '|' .or '\\\\' .or '[' .or ']' .or '{' .or '}' .or ':' .or ';' .or '\"' .or\n" +" '\\'' .or '<' .or ',' .or '>' .or '.' .or '/' .or '?' .or err_identifier;\n" +"err_identifier\n" +" id_character_first .and .loop id_character_next;\n" +"" diff --git a/reactos/dll/mesa32/src/shader/slang/library/slang_version_syn.h b/reactos/dll/mesa32/src/shader/slang/library/slang_version_syn.h new file mode 100755 index 00000000000..3b94d85927a --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/library/slang_version_syn.h @@ -0,0 +1,64 @@ +".syntax version_directive;\n" +"version_directive\n" +" version_directive_1 .and .loop version_directive_2;\n" +"version_directive_1\n" +" prior_optional_spaces .and optional_version_directive .and .true .emit $;\n" +"version_directive_2\n" +" prior_optional_spaces .and version_directive_body .and .true .emit $;\n" +"optional_version_directive\n" +" version_directive_body .or .true .emit 10 .emit 1;\n" +"version_directive_body\n" +" '#' .and optional_space .and \"version\" .and space .and version_number .and optional_space .and\n" +" new_line;\n" +"version_number\n" +" version_number_110;\n" +"version_number_110\n" +" leading_zeroes .and \"110\" .emit 10 .emit 1;\n" +"leading_zeroes\n" +" .loop zero;\n" +"zero\n" +" '0';\n" +"space\n" +" single_space .and .loop single_space;\n" +"optional_space\n" +" .loop single_space;\n" +"single_space\n" +" ' ' .or '\\t';\n" +"prior_optional_spaces\n" +" .loop prior_space;\n" +"prior_space\n" +" c_style_comment_block .or cpp_style_comment_block .or space .or new_line;\n" +"c_style_comment_block\n" +" '/' .and '*' .and c_style_comment_rest;\n" +"c_style_comment_rest\n" +" .loop c_style_comment_char_no_star .and c_style_comment_rest_1;\n" +"c_style_comment_rest_1\n" +" c_style_comment_end .or c_style_comment_rest_2;\n" +"c_style_comment_rest_2\n" +" '*' .and c_style_comment_rest;\n" +"c_style_comment_char_no_star\n" +" '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n" +"c_style_comment_end\n" +" '*' .and '/';\n" +"cpp_style_comment_block\n" +" '/' .and '/' .and cpp_style_comment_block_1;\n" +"cpp_style_comment_block_1\n" +" cpp_style_comment_block_2 .or cpp_style_comment_block_3;\n" +"cpp_style_comment_block_2\n" +" .loop cpp_style_comment_char .and new_line;\n" +"cpp_style_comment_block_3\n" +" .loop cpp_style_comment_char;\n" +"cpp_style_comment_char\n" +" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" +"new_line\n" +" cr_lf .or lf_cr .or '\\n' .or '\\r';\n" +"cr_lf\n" +" '\\r' .and '\\n';\n" +"lf_cr\n" +" '\\n' .and '\\r';\n" +".string __string_filter;\n" +"__string_filter\n" +" .loop __identifier_char;\n" +"__identifier_char\n" +" 'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';\n" +"" diff --git a/reactos/dll/mesa32/src/shader/slang/library/slang_vertex_builtin_gc.h b/reactos/dll/mesa32/src/shader/slang/library/slang_vertex_builtin_gc.h new file mode 100644 index 00000000000..746226180f7 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/library/slang_vertex_builtin_gc.h @@ -0,0 +1,262 @@ +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"__fixed_output vec4 gl_Position;\n" +"__fixed_output float gl_PointSize;\n" +"__fixed_output vec4 gl_ClipVertex;\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"attribute vec4 gl_Color;\n" +"attribute vec4 gl_SecondaryColor;\n" +"attribute vec3 gl_Normal;\n" +"attribute vec4 gl_Vertex;\n" +"attribute vec4 gl_MultiTexCoord0;\n" +"attribute vec4 gl_MultiTexCoord1;\n" +"attribute vec4 gl_MultiTexCoord2;\n" +"attribute vec4 gl_MultiTexCoord3;\n" +"attribute vec4 gl_MultiTexCoord4;\n" +"attribute vec4 gl_MultiTexCoord5;\n" +"attribute vec4 gl_MultiTexCoord6;\n" +"attribute vec4 gl_MultiTexCoord7;\n" +"attribute float gl_FogCoord;\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"varying vec4 gl_FrontColor;\n" +"varying vec4 gl_BackColor;\n" +"varying vec4 gl_FrontSecondaryColor;\n" +"varying vec4 gl_BackSecondaryColor;\n" +"varying vec4 gl_TexCoord[];\n" +"varying float gl_FogFragCoord;\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 ftransform () {\n" +" return gl_ModelViewProjectionMatrix * gl_Vertex;\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 texture1DLod (sampler1D sampler, float coord, float lod) {\n" +" return vec4 (0.0);\n" +"}\n" +"vec4 texture1DProjLod (sampler1D sampler, vec2 coord, float lod) {\n" +" return texture1DLod (sampler, coord.s / coord.t, lod);\n" +"}\n" +"vec4 texture1DProjLod (sampler1D sampler, vec4 coord, float lod) {\n" +" return texture1DLod (sampler, coord.s / coord.q, lod);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 texture2DLod (sampler2D sampler, vec2 coord, float lod) {\n" +" return vec4 (0.0);\n" +"}\n" +"vec4 texture2DProjLod (sampler2D sampler, vec3 coord, float lod) {\n" +" return texture2DLod (sampler, vec2 (coord.s / coord.p, coord.t / coord.p), lod);\n" +"}\n" +"vec4 texture2DProjLod (sampler2D sampler, vec4 coord, float lod) {\n" +" return texture2DLod (sampler, vec2 (coord.s / coord.q, coord.t / coord.q), lod);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 texture3DLod (sampler3D sampler, vec3 coord, float lod) {\n" +" return vec4 (0.0);\n" +"}\n" +"vec4 texture3DProjLod (sampler3D sampler, vec4 coord, float lod) {\n" +" return texture3DLod (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.s / coord.q),\n" +" lod);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 textureCubeLod (samplerCube sampler, vec3 coord, float lod) {\n" +" return vec4 (0.0);\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"vec4 shadow1DLod (sampler1DShadow sampler, vec3 coord, float lod) {\n" +" return vec4 (0.0);\n" +"}\n" +"\n" +"vec4 shadow2DLod (sampler2DShadow sampler, vec3 coord, float lod) {\n" +" return vec4 (0.0);\n" +"}\n" +"vec4 shadow1DProjLod (sampler1DShadow sampler, vec4 coord, float lod) {\n" +" return shadow1DLod (sampler, vec3 (coord.s / coord.q, 0.0, coord.p / coord.q), lod);\n" +"}\n" +"vec4 shadow2DProjLod (sampler2DShadow sampler, vec4 coord, float lod) {\n" +" return shadow2DLod (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q),\n" +" lod);\n" +"}\n" +"\n" diff --git a/reactos/dll/mesa32/src/shader/slang/library/slang_vertex_builtin_gc_bin.h b/reactos/dll/mesa32/src/shader/slang/library/slang_vertex_builtin_gc_bin.h new file mode 100755 index 00000000000..31d1fce3aca --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/library/slang_vertex_builtin_gc_bin.h @@ -0,0 +1,82 @@ +2,2,2,5,12,1,103,108,95,80,111,115,105,116,105,111,110,0,0,0,2,2,5,9, +1,103,108,95,80,111,105,110,116,83,105,122,101,0,0,0,2,2,5,12,1,103,108,95, +67,108,105,112,86,101,114,116,101,120,0,0,0,2,2,2,12,1,103,108,95,67,111,108, +111,114,0,0,0,2,2,2,12,1,103,108,95,83,101,99,111,110,100,97,114,121,67,111, +108,111,114,0,0,0,2,2,2,11,1,103,108,95,78,111,114,109,97,108,0,0,0,2, +2,2,12,1,103,108,95,86,101,114,116,101,120,0,0,0,2,2,2,12,1,103,108,95, +77,117,108,116,105,84,101,120,67,111,111,114,100,48,0,0,0,2,2,2,12,1,103,108, +95,77,117,108,116,105,84,101,120,67,111,111,114,100,49,0,0,0,2,2,2,12,1,103, +108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,50,0,0,0,2,2,2,12,1, +103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,51,0,0,0,2,2,2,12, +1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,52,0,0,0,2,2,2, +12,1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,53,0,0,0,2,2, +2,12,1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,54,0,0,0,2, +2,2,12,1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,55,0,0,0, +2,2,2,9,1,103,108,95,70,111,103,67,111,111,114,100,0,0,0,2,2,3,12,1, +103,108,95,70,114,111,110,116,67,111,108,111,114,0,0,0,2,2,3,12,1,103,108,95, +66,97,99,107,67,111,108,111,114,0,0,0,2,2,3,12,1,103,108,95,70,114,111,110, +116,83,101,99,111,110,100,97,114,121,67,111,108,111,114,0,0,0,2,2,3,12,1,103, +108,95,66,97,99,107,83,101,99,111,110,100,97,114,121,67,111,108,111,114,0,0,0,2, +2,3,12,1,103,108,95,84,101,120,67,111,111,114,100,0,4,0,2,2,3,9,1,103, +108,95,70,111,103,70,114,97,103,67,111,111,114,100,0,0,0,1,0,12,0,102,116,114, +97,110,115,102,111,114,109,0,0,1,8,18,103,108,95,77,111,100,101,108,86,105,101,119, +80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,0,18,103,108,95,86,101,114, +116,101,120,0,48,0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,76,111,100,0, +1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,9,99,111,111,114,100,0,0, +1,0,0,9,108,111,100,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0, +0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,80,114,111,106,76,111,100, +0,1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,10,99,111,111,114,100,0, +0,1,0,0,9,108,111,100,0,0,0,1,8,58,116,101,120,116,117,114,101,49,68,76, +111,100,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,59,115,0,18, +99,111,111,114,100,0,59,116,0,49,0,18,108,111,100,0,0,0,0,0,1,0,12,0, +116,101,120,116,117,114,101,49,68,80,114,111,106,76,111,100,0,1,0,0,16,115,97,109, +112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,108,111,100, +0,0,0,1,8,58,116,101,120,116,117,114,101,49,68,76,111,100,0,18,115,97,109,112, +108,101,114,0,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113, +0,49,0,18,108,111,100,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50, +68,76,111,100,0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,10,99,111, +111,114,100,0,0,1,0,0,9,108,111,100,0,0,0,1,8,58,118,101,99,52,0,17, +48,0,48,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114, +111,106,76,111,100,0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,11,99, +111,111,114,100,0,0,1,0,0,9,108,111,100,0,0,0,1,8,58,116,101,120,116,117, +114,101,50,68,76,111,100,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,50,0, +18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,112,0,49,0,18,99, +111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,112,0,49,0,0,0,18,108, +111,100,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114,111,106, +76,111,100,0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111, +114,100,0,0,1,0,0,9,108,111,100,0,0,0,1,8,58,116,101,120,116,117,114,101, +50,68,76,111,100,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,50,0,18,99, +111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111, +114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,18,108,111,100, +0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,76,111,100,0,1,0, +0,18,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0, +0,9,108,111,100,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0,0,0, +0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,80,114,111,106,76,111,100,0,1, +0,0,18,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,1, +0,0,9,108,111,100,0,0,0,1,8,58,116,101,120,116,117,114,101,51,68,76,111,100, +0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114,100,0, +59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,116, +0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,115,0,18, +99,111,111,114,100,0,59,113,0,49,0,0,0,18,108,111,100,0,0,0,0,0,1,0, +12,0,116,101,120,116,117,114,101,67,117,98,101,76,111,100,0,1,0,0,19,115,97,109, +112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0,9,108,111,100, +0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12, +0,115,104,97,100,111,119,49,68,76,111,100,0,1,0,0,20,115,97,109,112,108,101,114, +0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0,9,108,111,100,0,0,0,1, +8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,115,104,97, +100,111,119,50,68,76,111,100,0,1,0,0,21,115,97,109,112,108,101,114,0,0,1,0, +0,11,99,111,111,114,100,0,0,1,0,0,9,108,111,100,0,0,0,1,8,58,118,101, +99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,115,104,97,100,111,119,49, +68,80,114,111,106,76,111,100,0,1,0,0,20,115,97,109,112,108,101,114,0,0,1,0, +0,12,99,111,111,114,100,0,0,1,0,0,9,108,111,100,0,0,0,1,8,58,115,104, +97,100,111,119,49,68,76,111,100,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99, +51,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0, +17,48,0,48,0,0,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100,0, +59,113,0,49,0,0,0,18,108,111,100,0,0,0,0,0,1,0,12,0,115,104,97,100, +111,119,50,68,80,114,111,106,76,111,100,0,1,0,0,21,115,97,109,112,108,101,114,0, +0,1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,108,111,100,0,0,0,1,8, +58,115,104,97,100,111,119,50,68,76,111,100,0,18,115,97,109,112,108,101,114,0,0,58, +118,101,99,51,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113, +0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49, +0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0,0, +0,18,108,111,100,0,0,0,0,0,0 \ No newline at end of file diff --git a/reactos/dll/mesa32/src/shader/slang/slang_assemble.c b/reactos/dll/mesa32/src/shader/slang/slang_assemble.c new file mode 100755 index 00000000000..ef22a0172a0 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_assemble.c @@ -0,0 +1,1208 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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 slang_assemble.c + * slang intermediate code assembler + * \author Michal Krol + */ + +#include "imports.h" +#include "slang_utility.h" +#include "slang_assemble.h" +#include "slang_compile.h" +#include "slang_storage.h" +#include "slang_assemble_constructor.h" +#include "slang_assemble_typeinfo.h" +#include "slang_assemble_conditional.h" +#include "slang_assemble_assignment.h" + +/* slang_assembly */ + +static void slang_assembly_construct (slang_assembly *assem) +{ + assem->type = slang_asm_none; +} + +static void slang_assembly_destruct (slang_assembly *assem) +{ +} + +/* slang_assembly_file */ + +void slang_assembly_file_construct (slang_assembly_file *file) +{ + file->code = NULL; + file->count = 0; +} + +void slang_assembly_file_destruct (slang_assembly_file *file) +{ + unsigned int i; + + for (i = 0; i < file->count; i++) + slang_assembly_destruct (file->code + i); + slang_alloc_free (file->code); +} + +static int slang_assembly_file_push_new (slang_assembly_file *file) +{ + file->code = (slang_assembly *) slang_alloc_realloc (file->code, file->count * sizeof ( + slang_assembly), (file->count + 1) * sizeof (slang_assembly)); + if (file->code != NULL) + { + slang_assembly_construct (file->code + file->count); + file->count++; + return 1; + } + return 0; +} + +static int slang_assembly_file_push_general (slang_assembly_file *file, slang_assembly_type type, + GLfloat literal, GLuint label, GLuint size) +{ + slang_assembly *assem; + if (!slang_assembly_file_push_new (file)) + return 0; + assem = file->code + file->count - 1; + assem->type = type; + assem->literal = literal; + assem->param[0] = label; + assem->param[1] = size; + return 1; +} + +int slang_assembly_file_push (slang_assembly_file *file, slang_assembly_type type) +{ + return slang_assembly_file_push_general (file, type, (GLfloat) 0, 0, 0); +} + +int slang_assembly_file_push_label (slang_assembly_file *file, slang_assembly_type type, + GLuint label) +{ + return slang_assembly_file_push_general (file, type, (GLfloat) 0, label, 0); +} + +int slang_assembly_file_push_label2 (slang_assembly_file *file, slang_assembly_type type, + GLuint label1, GLuint label2) +{ + return slang_assembly_file_push_general (file, type, (GLfloat) 0, label1, label2); +} + +int slang_assembly_file_push_literal (slang_assembly_file *file, slang_assembly_type type, + GLfloat literal) +{ + return slang_assembly_file_push_general (file, type, literal, 0, 0); +} + +/* utility functions */ + +static int sizeof_variable (slang_type_specifier *spec, slang_type_qualifier qual, + slang_operation *array_size, slang_assembly_name_space *space, unsigned int *size) +{ + slang_storage_aggregate agg; + + slang_storage_aggregate_construct (&agg); + if (!_slang_aggregate_variable (&agg, spec, array_size, space->funcs, space->structs)) + { + slang_storage_aggregate_destruct (&agg); + return 0; + } + *size += _slang_sizeof_aggregate (&agg); + if (qual == slang_qual_out || qual == slang_qual_inout) + *size += 4; + slang_storage_aggregate_destruct (&agg); + return 1; +} + +static int sizeof_variable2 (slang_variable *var, slang_assembly_name_space *space, + unsigned int *size) +{ + var->address = *size; + if (var->type.qualifier == slang_qual_out || var->type.qualifier == slang_qual_inout) + var->address += 4; + return sizeof_variable (&var->type.specifier, var->type.qualifier, var->array_size, space, + size); +} + +static int sizeof_variables (slang_variable_scope *vars, unsigned int start, unsigned int stop, + slang_assembly_name_space *space, unsigned int *size) +{ + unsigned int i; + + for (i = start; i < stop; i++) + if (!sizeof_variable2 (vars->variables + i, space, size)) + return 0; + return 1; +} + +static int collect_locals (slang_operation *op, slang_assembly_name_space *space, + unsigned int *size) +{ + unsigned int i; + + if (!sizeof_variables (op->locals, 0, op->locals->num_variables, space, size)) + return 0; + for (i = 0; i < op->num_children; i++) + if (!collect_locals (op->children + i, space, size)) + return 0; + return 1; +} + +/* _slang_locate_function() */ + +slang_function *_slang_locate_function (const char *name, slang_operation *params, + unsigned int num_params, slang_assembly_name_space *space) +{ + unsigned int i; + + for (i = 0; i < space->funcs->num_functions; i++) + { + unsigned int j; + slang_function *f = space->funcs->functions + i; + + if (slang_string_compare (name, f->header.name) != 0) + continue; + if (f->param_count != num_params) + continue; + for (j = 0; j < num_params; j++) + { + slang_assembly_typeinfo ti; + slang_assembly_typeinfo_construct (&ti); + if (!_slang_typeof_operation (params + j, space, &ti)) + { + slang_assembly_typeinfo_destruct (&ti); + return 0; + } + if (!slang_type_specifier_equal (&ti.spec, &f->parameters->variables[j].type.specifier)) + { + slang_assembly_typeinfo_destruct (&ti); + break; + } + slang_assembly_typeinfo_destruct (&ti); + /* "out" and "inout" formal parameter requires the actual parameter to be l-value */ + if (!ti.can_be_referenced && + (f->parameters->variables[j].type.qualifier == slang_qual_out || + f->parameters->variables[j].type.qualifier == slang_qual_inout)) + break; + } + if (j == num_params) + return f; + } + if (space->funcs->outer_scope != NULL) + { + slang_assembly_name_space my_space = *space; + my_space.funcs = space->funcs->outer_scope; + return _slang_locate_function (name, params, num_params, &my_space); + } + return NULL; +} + +/* _slang_assemble_function() */ + +int _slang_assemble_function (slang_assembly_file *file, slang_function *fun, + slang_assembly_name_space *space) +{ + unsigned int param_size, local_size; + unsigned int skip, cleanup; + slang_assembly_flow_control flow; + slang_assembly_local_info info; + slang_assembly_stack_info stk; + + fun->address = file->count; + + if (fun->body == NULL) + { + /* TODO: jump to the actual function body */ + return 1; + } + + /* calculate return value and parameters size */ + param_size = 0; + if (fun->header.type.specifier.type != slang_spec_void) + if (!sizeof_variable (&fun->header.type.specifier, slang_qual_none, NULL, space, + ¶m_size)) + return 0; + info.ret_size = param_size; + if (!sizeof_variables (fun->parameters, 0, fun->param_count, space, ¶m_size)) + return 0; + + /* calculate local variables size, take into account the four-byte return address and + temporaries for various tasks */ + info.addr_tmp = param_size + 4; + info.swizzle_tmp = param_size + 4 + 4; + local_size = param_size + 4 + 4 + 16; + if (!sizeof_variables (fun->parameters, fun->param_count, fun->parameters->num_variables, space, + &local_size)) + return 0; + if (!collect_locals (fun->body, space, &local_size)) + return 0; + + /* allocate local variable storage */ + if (!slang_assembly_file_push_label (file, slang_asm_local_alloc, local_size - param_size - 4)) + return 0; + + /* mark a new frame for function variable storage */ + if (!slang_assembly_file_push_label (file, slang_asm_enter, local_size)) + return 0; + + /* skip the cleanup jump */ + skip = file->count; + if (!slang_assembly_file_push_new (file)) + return 0; + file->code[skip].type = slang_asm_jump; + + /* all "return" statements will be directed here */ + flow.function_end = file->count; + cleanup = file->count; + if (!slang_assembly_file_push_new (file)) + return 0; + file->code[cleanup].type = slang_asm_jump; + + /* execute the function body */ + file->code[skip].param[0] = file->count; + if (!_slang_assemble_operation (file, fun->body, 0, &flow, space, &info, &stk)) + return 0; + + /* this is the end of the function - restore the old function frame */ + file->code[cleanup].param[0] = file->count; + if (!slang_assembly_file_push (file, slang_asm_leave)) + return 0; + + /* free local variable storage */ + if (!slang_assembly_file_push_label (file, slang_asm_local_free, local_size - param_size - 4)) + return 0; + + /* jump out of the function */ + if (!slang_assembly_file_push (file, slang_asm_return)) + return 0; + return 1; +} + +int _slang_cleanup_stack (slang_assembly_file *file, slang_operation *op, int ref, + slang_assembly_name_space *space) +{ + slang_assembly_typeinfo ti; + unsigned int size; + + slang_assembly_typeinfo_construct (&ti); + if (!_slang_typeof_operation (op, space, &ti)) + { + slang_assembly_typeinfo_destruct (&ti); + return 0; + } + if (ti.spec.type == slang_spec_void) + size = 0; + else if (ref) + size = 4; + else + { + size = 0; + if (!sizeof_variable (&ti.spec, slang_qual_none, NULL, space, &size)) + { + slang_assembly_typeinfo_destruct (&ti); + return 0; + } + } + slang_assembly_typeinfo_destruct (&ti); + if (size != 0) + { + if (!slang_assembly_file_push_label (file, slang_asm_local_free, size)) + return 0; + } + return 1; +} + +/* _slang_assemble_operation() */ + +/* XXX: general swizzle! */ +static int dereference_aggregate (slang_assembly_file *file, const slang_storage_aggregate *agg, + unsigned int index, unsigned int *size, slang_assembly_local_info *info) +{ + unsigned int i; + + for (i = agg->count; i > 0; i--) + { + const slang_storage_array *arr = agg->arrays + i - 1; + unsigned int j; + + for (j = arr->length; j > 0; j--) + { + if (arr->type == slang_stor_aggregate) + { + if (!dereference_aggregate (file, arr->aggregate, index, size, info)) + return 0; + } + else + { + *size -= 4; + if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp, + 4)) + return 0; + if (!slang_assembly_file_push (file, slang_asm_addr_deref)) + return 0; + if (!slang_assembly_file_push_label (file, slang_asm_addr_push, *size)) + return 0; + if (!slang_assembly_file_push (file, slang_asm_addr_add)) + return 0; + switch (arr->type) + { + case slang_stor_bool: + if (!slang_assembly_file_push (file, slang_asm_bool_deref)) + return 0; + break; + case slang_stor_int: + if (!slang_assembly_file_push (file, slang_asm_int_deref)) + return 0; + break; + case slang_stor_float: + if (!slang_assembly_file_push (file, slang_asm_float_deref)) + return 0; + break; + } + index += 4; + } + } + } + return 1; +} +/* XXX: general swizzle! */ +int dereference (slang_assembly_file *file, slang_operation *op, + slang_assembly_name_space *space, slang_assembly_local_info *info) +{ + slang_assembly_typeinfo ti; + int result; + slang_storage_aggregate agg; + unsigned int size; + + slang_assembly_typeinfo_construct (&ti); + if (!_slang_typeof_operation (op, space, &ti)) + { + slang_assembly_typeinfo_destruct (&ti); + return 0; + } + + slang_storage_aggregate_construct (&agg); + if (!_slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)) + { + slang_storage_aggregate_destruct (&agg); + slang_assembly_typeinfo_destruct (&ti); + return 0; + } + + size = _slang_sizeof_aggregate (&agg); + result = dereference_aggregate (file, &agg, 0, &size, info); + + slang_storage_aggregate_destruct (&agg); + slang_assembly_typeinfo_destruct (&ti); + return result; +} + +static int call_function (slang_assembly_file *file, slang_function *fun, slang_operation *params, + unsigned int param_count, int assignment, slang_assembly_name_space *space, + slang_assembly_local_info *info) +{ + unsigned int i; + slang_assembly_stack_info stk; + + /* make room for the return value, if any */ + if (fun->header.type.specifier.type != slang_spec_void) + { + unsigned int ret_size = 0; + if (!sizeof_variable (&fun->header.type.specifier, slang_qual_none, NULL, space, &ret_size)) + return 0; + if (!slang_assembly_file_push_label (file, slang_asm_local_alloc, ret_size)) + return 0; + } + + /* push the actual parameters on the stack */ + for (i = 0; i < param_count; i++) + { + slang_assembly_flow_control flow; + + if (fun->parameters->variables[i].type.qualifier == slang_qual_inout || + fun->parameters->variables[i].type.qualifier == slang_qual_out) + { + if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp, 4)) + return 0; + /* TODO: optimize the "out" parameter case */ + /* TODO: inspect stk */ + if (!_slang_assemble_operation (file, params + i, 1, &flow, space, info, &stk)) + return 0; + if (!slang_assembly_file_push (file, slang_asm_addr_copy)) + return 0; + if (!slang_assembly_file_push (file, slang_asm_addr_deref)) + return 0; + if (i == 0 && assignment) + { + if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp, + 4)) + return 0; + if (!slang_assembly_file_push (file, slang_asm_addr_deref)) + return 0; + } + if (!dereference (file, params, space, info)) + return 0; + } + else + { + /* TODO: for "out" and "inout" parameters also push the address (first) */ + /* TODO: optimize the "out" parameter case */ + /* TODO: inspect stk */ + if (!_slang_assemble_operation (file, params + i, 0, &flow, space, info, &stk)) + return 0; + } + } + + /* call the function */ + if (!slang_assembly_file_push_label (file, slang_asm_call, fun->address)) + return 0; + + /* pop the parameters from the stack */ + for (i = param_count; i > 0; i--) + { + unsigned int j = i - 1; + if (fun->parameters->variables[j].type.qualifier == slang_qual_inout || + fun->parameters->variables[j].type.qualifier == slang_qual_out) + { + if (!_slang_assemble_assignment (file, params + j, space, info)) + return 0; + if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4)) + return 0; + } + else + { + if (!_slang_cleanup_stack (file, params + j, 0, space)) + return 0; + } + } + + return 1; +} + +int call_function_name (slang_assembly_file *file, const char *name, slang_operation *params, + unsigned int param_count, int assignment, slang_assembly_name_space *space, + slang_assembly_local_info *info) +{ + slang_function *fun = _slang_locate_function (name, params, param_count, space); + if (fun == NULL) + return 0; + return call_function (file, fun, params, param_count, assignment, space, info); +} + +static int call_function_name_dummyint (slang_assembly_file *file, const char *name, + slang_operation *params, slang_assembly_name_space *space, slang_assembly_local_info *info) +{ + slang_operation p2[2]; + int result; + + p2[0] = *params; + if (!slang_operation_construct_a (p2 + 1)) + return 0; + p2[1].type = slang_oper_literal_int; + result = call_function_name (file, name, p2, 2, 0, space, info); + slang_operation_destruct (p2 + 1); + return result; +} + +static int call_asm_instruction (slang_assembly_file *file, const char *name) +{ + const struct + { + const char *name; + slang_assembly_type code1, code2; + } inst[] = { + { "float_to_int", slang_asm_float_to_int, slang_asm_int_copy }, + { "int_to_float", slang_asm_int_to_float, slang_asm_float_copy }, + { "float_copy", slang_asm_float_copy, slang_asm_none }, + { "int_copy", slang_asm_int_copy, slang_asm_none }, + { "bool_copy", slang_asm_bool_copy, slang_asm_none }, + { "float_add", slang_asm_float_add, slang_asm_float_copy }, + { "float_multiply", slang_asm_float_multiply, slang_asm_float_copy }, + { "float_divide", slang_asm_float_divide, slang_asm_float_copy }, + { "float_negate", slang_asm_float_negate, slang_asm_float_copy }, + { "float_less", slang_asm_float_less, slang_asm_bool_copy }, + { "float_equal", slang_asm_float_equal, slang_asm_bool_copy }, + { NULL, slang_asm_none, slang_asm_none } + }; + unsigned int i; + + for (i = 0; inst[i].name != NULL; i++) + if (slang_string_compare (name, inst[i].name) == 0) + break; + if (inst[i].name == NULL) + return 0; + + if (!slang_assembly_file_push_label2 (file, inst[i].code1, 4, 0)) + return 0; + if (inst[i].code2 != slang_asm_none) + if (!slang_assembly_file_push_label2 (file, inst[i].code2, 4, 0)) + return 0; + + /* clean-up the stack from the remaining dst address */ + if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4)) + return 0; + + return 1; +} + +/* XXX: general swizzle! */ +static int equality_aggregate (slang_assembly_file *file, const slang_storage_aggregate *agg, + unsigned int *index, unsigned int size, slang_assembly_local_info *info, unsigned int z_label) +{ + unsigned int i; + + for (i = 0; i < agg->count; i++) + { + const slang_storage_array *arr = agg->arrays + i; + unsigned int j; + + for (j = 0; j < arr->length; j++) + { + if (arr->type == slang_stor_aggregate) + { + if (!equality_aggregate (file, arr->aggregate, index, size, info, z_label)) + return 0; + } + else + { + if (!slang_assembly_file_push_label2 (file, slang_asm_float_equal, size + *index, + *index)) + return 0; + *index += 4; + if (!slang_assembly_file_push_label (file, slang_asm_jump_if_zero, z_label)) + return 0; + } + } + } + return 1; +} +/* XXX: general swizzle! */ +static int equality (slang_assembly_file *file, slang_operation *op, + slang_assembly_name_space *space, slang_assembly_local_info *info, int equal) +{ + slang_assembly_typeinfo ti; + int result; + slang_storage_aggregate agg; + unsigned int index, size; + unsigned int skip_jump, true_label, true_jump, false_label, false_jump; + + /* get type of operation */ + slang_assembly_typeinfo_construct (&ti); + if (!_slang_typeof_operation (op, space, &ti)) + { + slang_assembly_typeinfo_destruct (&ti); + return 0; + } + + /* convert it to an aggregate */ + slang_storage_aggregate_construct (&agg); + if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs))) + goto end; + + /* compute the size of the agregate - there are two such aggregates on the stack */ + size = _slang_sizeof_aggregate (&agg); + + /* jump to the actual data-comparison code */ + skip_jump = file->count; + if (!(result = slang_assembly_file_push (file, slang_asm_jump))) + goto end; + + /* pop off the stack the compared data and push 1 */ + true_label = file->count; + if (!(result = slang_assembly_file_push_label (file, slang_asm_local_free, size * 2))) + goto end; + if (!(result = slang_assembly_file_push_literal (file, slang_asm_bool_push, 1.0f))) + goto end; + true_jump = file->count; + if (!(result = slang_assembly_file_push (file, slang_asm_jump))) + goto end; + + false_label = file->count; + if (!(result = slang_assembly_file_push_label (file, slang_asm_local_free, size * 2))) + goto end; + if (!(result = slang_assembly_file_push_literal (file, slang_asm_bool_push, 0.0f))) + goto end; + false_jump = file->count; + if (!(result = slang_assembly_file_push (file, slang_asm_jump))) + goto end; + + file->code[skip_jump].param[0] = file->count; + + /* compare the data on stack, it will eventually jump either to true or false label */ + index = 0; + if (!(result = equality_aggregate (file, &agg, &index, size, info, + equal ? false_label : true_label))) + goto end; + if (!(result = slang_assembly_file_push_label (file, slang_asm_jump, + equal ? true_label : false_label))) + goto end; + + file->code[true_jump].param[0] = file->count; + file->code[false_jump].param[0] = file->count; + + result = 1; +end: + slang_storage_aggregate_destruct (&agg); + slang_assembly_typeinfo_destruct (&ti); + return result; +} + +int _slang_assemble_operation (slang_assembly_file *file, slang_operation *op, int reference, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info, slang_assembly_stack_info *stk) +{ + unsigned int assem; + + stk->swizzle_mask = 0; + + assem = file->count; + if (!slang_assembly_file_push_new (file)) + return 0; + + switch (op->type) + { + case slang_oper_block_no_new_scope: + case slang_oper_block_new_scope: + { + unsigned int i; + for (i = 0; i < op->num_children; i++) + { + slang_assembly_stack_info stk; + if (!_slang_assemble_operation (file, op->children + i, 0, flow, space, info, &stk)) + return 0; + /* TODO: pass-in stk to cleanup */ + if (!_slang_cleanup_stack (file, op->children + i, 0, space)) + return 0; + } + } + break; + case slang_oper_variable_decl: + { + unsigned int i; + + for (i = 0; i < op->num_children; i++) + { + /* TODO: perform initialization of op->children[i] */ + /* TODO: clean-up stack */ + } + } + break; + case slang_oper_asm: + { + unsigned int i; + for (i = 0; i < op->num_children; i++) + { + slang_assembly_stack_info stk; + if (!_slang_assemble_operation (file, op->children + i, i == 0, flow, space, info, + &stk)) + return 0; + /* TODO: inspect stk */ + } + if (!call_asm_instruction (file, op->identifier)) + return 0; + } + break; + case slang_oper_break: + file->code[assem].type = slang_asm_jump; + file->code[assem].param[0] = flow->loop_end; + break; + case slang_oper_continue: + file->code[assem].type = slang_asm_jump; + file->code[assem].param[0] = flow->loop_start; + break; + case slang_oper_discard: + file->code[assem].type = slang_asm_discard; + if (!slang_assembly_file_push (file, slang_asm_exit)) + return 0; + break; + case slang_oper_return: + if (info->ret_size != 0) + { + slang_assembly_stack_info stk; + if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, 0, info->ret_size)) + return 0; + if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) + return 0; + /* TODO: inspect stk */ + if (!_slang_assemble_assignment (file, op->children, space, info)) + return 0; + if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4)) + return 0; + } + if (!slang_assembly_file_push_label (file, slang_asm_jump, flow->function_end)) + return 0; + break; + case slang_oper_expression: + { + slang_assembly_stack_info stk; + if (!_slang_assemble_operation (file, op->children, reference, flow, space, info, &stk)) + return 0; + /* TODO: inspect stk */ + } + break; + case slang_oper_if: + if (!_slang_assemble_if (file, op, flow, space, info)) + return 0; + break; + case slang_oper_while: + if (!_slang_assemble_while (file, op, flow, space, info)) + return 0; + break; + case slang_oper_do: + if (!_slang_assemble_do (file, op, flow, space, info)) + return 0; + break; + case slang_oper_for: + if (!_slang_assemble_for (file, op, flow, space, info)) + return 0; + break; + case slang_oper_void: + break; + case slang_oper_literal_bool: + file->code[assem].type = slang_asm_bool_push; + file->code[assem].literal = op->literal; + break; + case slang_oper_literal_int: + file->code[assem].type = slang_asm_int_push; + file->code[assem].literal = op->literal; + break; + case slang_oper_literal_float: + file->code[assem].type = slang_asm_float_push; + file->code[assem].literal = op->literal; + break; + case slang_oper_identifier: + { + slang_variable *var; + unsigned int size; + var = _slang_locate_variable (op->locals, op->identifier, 1); + if (var == NULL) + return 0; + size = 0; + if (!sizeof_variable (&var->type.specifier, slang_qual_none, var->array_size, space, + &size)) + return 0; + if (var->initializer != NULL) + { + assert (!"var->initializer, oper_identifier"); + } + else + { + if (!reference) + { + if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, + info->addr_tmp, 4)) + return 0; + } + /* XXX: globals! */ + if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, var->address, + size)) + return 0; + if (!reference) + { + if (!slang_assembly_file_push (file, slang_asm_addr_copy)) + return 0; + if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4)) + return 0; + if (!dereference (file, op, space, info)) + return 0; + } + } + } + break; + case slang_oper_sequence: + { + slang_assembly_stack_info stk; + if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) + return 0; + /* TODO: pass-in stk to cleanup */ + if (!_slang_cleanup_stack (file, op->children, 0, space)) + return 0; + if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, + &stk)) + return 0; + /* TODO: inspect stk */ + } + break; + case slang_oper_assign: + if (!_slang_assemble_assign (file, op, "=", reference, space, info)) + return 0; + break; + case slang_oper_addassign: + if (!_slang_assemble_assign (file, op, "+=", reference, space, info)) + return 0; + break; + case slang_oper_subassign: + if (!_slang_assemble_assign (file, op, "-=", reference, space, info)) + return 0; + break; + case slang_oper_mulassign: + if (!_slang_assemble_assign (file, op, "*=", reference, space, info)) + return 0; + break; + /*case slang_oper_modassign:*/ + /*case slang_oper_lshassign:*/ + /*case slang_oper_rshassign:*/ + /*case slang_oper_orassign:*/ + /*case slang_oper_xorassign:*/ + /*case slang_oper_andassign:*/ + case slang_oper_divassign: + if (!_slang_assemble_assign (file, op, "/=", reference, space, info)) + return 0; + break; + case slang_oper_select: + if (!_slang_assemble_select (file, op, flow, space, info)) + return 0; + break; + case slang_oper_logicalor: + if (!_slang_assemble_logicalor (file, op, flow, space, info)) + return 0; + break; + case slang_oper_logicaland: + if (!_slang_assemble_logicaland (file, op, flow, space, info)) + return 0; + break; + case slang_oper_logicalxor: + if (!call_function_name (file, "^^", op->children, 2, 0, space, info)) + return 0; + break; + /*case slang_oper_bitor:*/ + /*case slang_oper_bitxor:*/ + /*case slang_oper_bitand:*/ + case slang_oper_less: + if (!call_function_name (file, "<", op->children, 2, 0, space, info)) + return 0; + break; + case slang_oper_greater: + if (!call_function_name (file, ">", op->children, 2, 0, space, info)) + return 0; + break; + case slang_oper_lessequal: + if (!call_function_name (file, "<=", op->children, 2, 0, space, info)) + return 0; + break; + case slang_oper_greaterequal: + if (!call_function_name (file, ">=", op->children, 2, 0, space, info)) + return 0; + break; + /*case slang_oper_lshift:*/ + /*case slang_oper_rshift:*/ + case slang_oper_add: + if (!call_function_name (file, "+", op->children, 2, 0, space, info)) + return 0; + break; + case slang_oper_subtract: + if (!call_function_name (file, "-", op->children, 2, 0, space, info)) + return 0; + break; + case slang_oper_multiply: + if (!call_function_name (file, "*", op->children, 2, 0, space, info)) + return 0; + break; + /*case slang_oper_modulus:*/ + case slang_oper_divide: + if (!call_function_name (file, "/", op->children, 2, 0, space, info)) + return 0; + break; + case slang_oper_equal: + { + slang_assembly_stack_info stk; + if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) + return 0; + /* TODO: inspect stk */ + if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) + return 0; + /* TODO: inspect stk */ + if (!equality (file, op->children, space, info, 1)) + return 0; + } + break; + case slang_oper_notequal: + { + slang_assembly_stack_info stk; + if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) + return 0; + /* TODO: inspect stk */ + if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) + return 0; + /* TODO: inspect stk */ + if (!equality (file, op->children, space, info, 0)) + return 0; + } + break; + case slang_oper_preincrement: + if (!_slang_assemble_assign (file, op, "++", reference, space, info)) + return 0; + break; + case slang_oper_predecrement: + if (!_slang_assemble_assign (file, op, "--", reference, space, info)) + return 0; + break; + case slang_oper_plus: + if (!call_function_name (file, "+", op->children, 1, 0, space, info)) + return 0; + break; + case slang_oper_minus: + if (!call_function_name (file, "-", op->children, 1, 0, space, info)) + return 0; + break; + /*case slang_oper_complement:*/ + case slang_oper_not: + if (!call_function_name (file, "!", op->children, 1, 0, space, info)) + return 0; + break; + case slang_oper_subscript: + { + slang_assembly_stack_info _stk; + slang_assembly_typeinfo ti_arr, ti_elem; + unsigned int arr_size = 0, elem_size = 0; + if (!_slang_assemble_operation (file, op->children, reference, flow, space, info, + &_stk)) + return 0; + if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &_stk)) + return 0; + slang_assembly_typeinfo_construct (&ti_arr); + if (!_slang_typeof_operation (op->children, space, &ti_arr)) + { + slang_assembly_typeinfo_destruct (&ti_arr); + return 0; + } + if (!sizeof_variable (&ti_arr.spec, slang_qual_none, NULL, space, &arr_size)) + { + slang_assembly_typeinfo_destruct (&ti_arr); + return 0; + } + slang_assembly_typeinfo_construct (&ti_elem); + if (!_slang_typeof_operation (op, space, &ti_elem)) + { + slang_assembly_typeinfo_destruct (&ti_arr); + slang_assembly_typeinfo_destruct (&ti_elem); + return 0; + } + if (!sizeof_variable (&ti_elem.spec, slang_qual_none, NULL, space, &elem_size)) + { + slang_assembly_typeinfo_destruct (&ti_arr); + slang_assembly_typeinfo_destruct (&ti_elem); + return 0; + } + if (!slang_assembly_file_push (file, slang_asm_int_to_addr)) + { + slang_assembly_typeinfo_destruct (&ti_arr); + slang_assembly_typeinfo_destruct (&ti_elem); + return 0; + } + if (!slang_assembly_file_push_label (file, slang_asm_addr_push, elem_size)) + { + slang_assembly_typeinfo_destruct (&ti_arr); + slang_assembly_typeinfo_destruct (&ti_elem); + return 0; + } + if (!slang_assembly_file_push (file, slang_asm_addr_multiply)) + { + slang_assembly_typeinfo_destruct (&ti_arr); + slang_assembly_typeinfo_destruct (&ti_elem); + return 0; + } + if (reference) + { + if (!slang_assembly_file_push (file, slang_asm_addr_add)) + { + slang_assembly_typeinfo_destruct (&ti_arr); + slang_assembly_typeinfo_destruct (&ti_elem); + return 0; + } + } + else + { + unsigned int i; + for (i = 0; i < elem_size; i += 4) + { + if (!slang_assembly_file_push_label2 (file, slang_asm_float_move, + arr_size - elem_size + i + 4, i + 4)) + { + slang_assembly_typeinfo_destruct (&ti_arr); + slang_assembly_typeinfo_destruct (&ti_elem); + return 0; + } + } + if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4)) + { + slang_assembly_typeinfo_destruct (&ti_arr); + slang_assembly_typeinfo_destruct (&ti_elem); + return 0; + } + if (!slang_assembly_file_push_label (file, slang_asm_local_free, + arr_size - elem_size)) + { + slang_assembly_typeinfo_destruct (&ti_arr); + slang_assembly_typeinfo_destruct (&ti_elem); + return 0; + } + } + slang_assembly_typeinfo_destruct (&ti_arr); + slang_assembly_typeinfo_destruct (&ti_elem); + } + break; + case slang_oper_call: + { + slang_function *fun = _slang_locate_function (op->identifier, op->children, + op->num_children, space); + if (fun == NULL) + { + if (!_slang_assemble_constructor (file, op, flow, space, info)) + return 0; + } + else + { + if (!call_function (file, fun, op->children, op->num_children, 0, space, info)) + return 0; + } + } + break; + case slang_oper_field: + { + slang_assembly_typeinfo ti_after, ti_before; + slang_assembly_stack_info _stk; + slang_assembly_typeinfo_construct (&ti_after); + if (!_slang_typeof_operation (op, space, &ti_after)) + { + slang_assembly_typeinfo_destruct (&ti_after); + return 0; + } + slang_assembly_typeinfo_construct (&ti_before); + if (!_slang_typeof_operation (op->children, space, &ti_before)) + { + slang_assembly_typeinfo_destruct (&ti_after); + slang_assembly_typeinfo_destruct (&ti_before); + return 0; + } + if (!reference && ti_after.is_swizzled) + { + if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, + info->swizzle_tmp, 16)) + { + slang_assembly_typeinfo_destruct (&ti_after); + slang_assembly_typeinfo_destruct (&ti_before); + return 0; + } + } + if (!_slang_assemble_operation (file, op->children, reference, flow, space, info, + &_stk)) + { + slang_assembly_typeinfo_destruct (&ti_after); + slang_assembly_typeinfo_destruct (&ti_before); + return 0; + } + /* TODO: inspect stk */ + if (ti_after.is_swizzled) + { + if (reference) + { + if (ti_after.swz.num_components == 1) + { + if (!slang_assembly_file_push_label (file, slang_asm_addr_push, + ti_after.swz.swizzle[0] * 4)) + { + slang_assembly_typeinfo_destruct (&ti_after); + slang_assembly_typeinfo_destruct (&ti_before); + return 0; + } + if (!slang_assembly_file_push (file, slang_asm_addr_add)) + { + slang_assembly_typeinfo_destruct (&ti_after); + slang_assembly_typeinfo_destruct (&ti_before); + return 0; + } + } + else + { + unsigned int i; + for (i = 0; i < ti_after.swz.num_components; i++) + stk->swizzle_mask |= 1 << ti_after.swz.swizzle[i]; + } + } + else + { + if (!_slang_assemble_constructor_from_swizzle (file, &ti_after.swz, + &ti_after.spec, &ti_before.spec, info)) + { + slang_assembly_typeinfo_destruct (&ti_after); + slang_assembly_typeinfo_destruct (&ti_before); + return 0; + } + } + } + else + { + if (reference) + { + /* TODO: struct field address */ + } + else + { + /* TODO: struct field value */ + } + } + slang_assembly_typeinfo_destruct (&ti_after); + slang_assembly_typeinfo_destruct (&ti_before); + } + break; + case slang_oper_postincrement: + if (!call_function_name_dummyint (file, "++", op->children, space, info)) + return 0; + if (!dereference (file, op, space, info)) + return 0; + break; + case slang_oper_postdecrement: + if (!call_function_name_dummyint (file, "--", op->children, space, info)) + return 0; + if (!dereference (file, op, space, info)) + return 0; + break; + default: + return 0; + } + return 1; +} + + + + + + + + + +void xxx_first (slang_assembly_file *file) +{ + slang_assembly_file_push (file, slang_asm_jump); +} + +void xxx_prolog (slang_assembly_file *file, unsigned int addr) +{ + file->code[0].param[0] = file->count; + slang_assembly_file_push_label (file, slang_asm_call, addr); + slang_assembly_file_push (file, slang_asm_exit); +} + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_assemble.h b/reactos/dll/mesa32/src/shader/slang/slang_assemble.h new file mode 100755 index 00000000000..04ba7cf0458 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_assemble.h @@ -0,0 +1,145 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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. + */ + +#if !defined SLANG_ASSEMBLE_H +#define SLANG_ASSEMBLE_H + +#include "slang_compile.h" + +#if defined __cplusplus +extern "C" { +#endif + +typedef enum slang_assembly_type_ +{ + /* core */ + slang_asm_none, + slang_asm_float_copy, + slang_asm_float_move, + slang_asm_float_push, + slang_asm_float_deref, + slang_asm_float_add, + slang_asm_float_multiply, + slang_asm_float_divide, + slang_asm_float_negate, + slang_asm_float_less, + slang_asm_float_equal, + slang_asm_float_to_int, + slang_asm_int_copy, + slang_asm_int_move, + slang_asm_int_push, + slang_asm_int_deref, + slang_asm_int_to_float, + slang_asm_int_to_addr, + slang_asm_bool_copy, + slang_asm_bool_move, + slang_asm_bool_push, + slang_asm_bool_deref, + slang_asm_addr_copy, + slang_asm_addr_push, + slang_asm_addr_deref, + slang_asm_addr_add, + slang_asm_addr_multiply, + slang_asm_jump, + slang_asm_jump_if_zero, + slang_asm_enter, + slang_asm_leave, + slang_asm_local_alloc, + slang_asm_local_free, + slang_asm_local_addr, + slang_asm_call, + slang_asm_return, + slang_asm_discard, + slang_asm_exit, + slang_asm__last +} slang_assembly_type; + +typedef struct slang_assembly_ +{ + slang_assembly_type type; + GLfloat literal; + GLuint param[2]; +} slang_assembly; + +typedef struct slang_assembly_file_ +{ + slang_assembly *code; + unsigned int count; +} slang_assembly_file; + +void slang_assembly_file_construct (slang_assembly_file *); +void slang_assembly_file_destruct (slang_assembly_file *); +int slang_assembly_file_push (slang_assembly_file *, slang_assembly_type); +int slang_assembly_file_push_label (slang_assembly_file *, slang_assembly_type, GLuint); +int slang_assembly_file_push_label2 (slang_assembly_file *, slang_assembly_type, GLuint, GLuint); +int slang_assembly_file_push_literal (slang_assembly_file *, slang_assembly_type, GLfloat); + +typedef struct slang_assembly_flow_control_ +{ + unsigned int loop_start; /* for "continue" statement */ + unsigned int loop_end; /* for "break" statement */ + unsigned int function_end; /* for "return" statement */ +} slang_assembly_flow_control; + +typedef struct slang_assembly_name_space_ +{ + struct slang_function_scope_ *funcs; + struct slang_struct_scope_ *structs; + struct slang_variable_scope_ *vars; +} slang_assembly_name_space; + +slang_function *_slang_locate_function (const char *name, slang_operation *params, + unsigned int num_params, slang_assembly_name_space *space); + +int _slang_assemble_function (slang_assembly_file *, struct slang_function_ *, + slang_assembly_name_space *); + +typedef struct slang_assembly_stack_info_ +{ + unsigned int swizzle_mask; +} slang_assembly_stack_info; + +int _slang_cleanup_stack (slang_assembly_file *, slang_operation *, int ref, + slang_assembly_name_space *); + +typedef struct slang_assembly_local_info_ +{ + unsigned int ret_size; + unsigned int addr_tmp; + unsigned int swizzle_tmp; +} slang_assembly_local_info; + +int _slang_assemble_operation (slang_assembly_file *, struct slang_operation_ *, int reference, + slang_assembly_flow_control *, slang_assembly_name_space *, slang_assembly_local_info *, + slang_assembly_stack_info *); + +void xxx_first (slang_assembly_file *); +void xxx_prolog (slang_assembly_file *, unsigned int); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_assemble_assignment.c b/reactos/dll/mesa32/src/shader/slang/slang_assemble_assignment.c new file mode 100755 index 00000000000..488c7a91ff5 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_assemble_assignment.c @@ -0,0 +1,187 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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 slang_assemble_assignment.c + * slang assignment expressions assembler + * \author Michal Krol + */ + +#include "imports.h" +#include "slang_assemble_assignment.h" +#include "slang_assemble_typeinfo.h" +#include "slang_storage.h" +#include "slang_utility.h" + +/* + _slang_assemble_assignment() + + copies values on the stack ( to ) to a memory + location pointed by ; + + in: + +------------------+ + | addr of variable | + +------------------+ + | component N-1 | + | ... | + | component 0 | + +------------------+ + + out: + +------------------+ + | addr of variable | + +------------------+ +*/ +/* TODO: add support for swizzle mask */ +static int assign_aggregate (slang_assembly_file *file, const slang_storage_aggregate *agg, + unsigned int *index, unsigned int size, slang_assembly_local_info *info) +{ + unsigned int i; + + for (i = 0; i < agg->count; i++) + { + const slang_storage_array *arr = agg->arrays + i; + unsigned int j; + + for (j = 0; j < arr->length; j++) + { + if (arr->type == slang_stor_aggregate) + { + if (!assign_aggregate (file, arr->aggregate, index, size, info)) + return 0; + } + else + { + slang_assembly_type ty; + + switch (arr->type) + { + case slang_stor_bool: + ty = slang_asm_bool_copy; + break; + case slang_stor_int: + ty = slang_asm_int_copy; + break; + case slang_stor_float: + ty = slang_asm_float_copy; + break; + default: + break; + } + if (!slang_assembly_file_push_label2 (file, ty, size - *index, *index)) + return 0; + *index += 4; + } + } + } + return 1; +} + +int _slang_assemble_assignment (slang_assembly_file *file, slang_operation *op, + slang_assembly_name_space *space, slang_assembly_local_info *info) +{ + slang_assembly_typeinfo ti; + int result; + slang_storage_aggregate agg; + unsigned int index, size; + + slang_assembly_typeinfo_construct (&ti); + if (!_slang_typeof_operation (op, space, &ti)) + { + slang_assembly_typeinfo_destruct (&ti); + return 0; + } + + slang_storage_aggregate_construct (&agg); + if (!_slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)) + { + slang_storage_aggregate_destruct (&agg); + slang_assembly_typeinfo_destruct (&ti); + return 0; + } + + index = 0; + size = _slang_sizeof_aggregate (&agg); + result = assign_aggregate (file, &agg, &index, size, info); + + slang_storage_aggregate_destruct (&agg); + slang_assembly_typeinfo_destruct (&ti); + return result; +} + +/* + _slang_assemble_assign() + + performs unary (pre ++ and --) or binary (=, +=, -=, *=, /=) assignment on the operation's + children +*/ + +int dereference (slang_assembly_file *file, slang_operation *op, + slang_assembly_name_space *space, slang_assembly_local_info *info); + +int call_function_name (slang_assembly_file *file, const char *name, slang_operation *params, + unsigned int param_count, int assignment, slang_assembly_name_space *space, + slang_assembly_local_info *info); + +int _slang_assemble_assign (slang_assembly_file *file, slang_operation *op, const char *oper, + int ref, slang_assembly_name_space *space, slang_assembly_local_info *info) +{ + slang_assembly_stack_info stk; + slang_assembly_flow_control flow; + + if (!ref) + { + if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp, 4)) + return 0; + } + + if (slang_string_compare ("=", oper) == 0) + { + if (!_slang_assemble_operation (file, op->children, 1, &flow, space, info, &stk)) + return 0; + if (!_slang_assemble_operation (file, op->children + 1, 0, &flow, space, info, &stk)) + return 0; + if (!_slang_assemble_assignment (file, op->children, space, info)) + return 0; + } + else + { + if (!call_function_name (file, oper, op->children, op->num_children, 1, space, info)) + return 0; + } + + if (!ref) + { + if (!slang_assembly_file_push (file, slang_asm_addr_copy)) + return 0; + if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4)) + return 0; + if (!dereference (file, op->children, space, info)) + return 0; + } + + return 1; +} + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_assemble_assignment.h b/reactos/dll/mesa32/src/shader/slang/slang_assemble_assignment.h new file mode 100755 index 00000000000..8ffd9e4cda3 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_assemble_assignment.h @@ -0,0 +1,45 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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. + */ + +#if !defined SLANG_ASSEMBLE_ASSIGNMENT_H +#define SLANG_ASSEMBLE_ASSIGNMENT_H + +#include "slang_assemble.h" + +#if defined __cplusplus +extern "C" { +#endif + +int _slang_assemble_assignment (slang_assembly_file *, slang_operation *, + slang_assembly_name_space *, slang_assembly_local_info *); + +int _slang_assemble_assign (slang_assembly_file *, slang_operation *, const char *, int ref, + slang_assembly_name_space *, slang_assembly_local_info *); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_assemble_conditional.c b/reactos/dll/mesa32/src/shader/slang/slang_assemble_conditional.c new file mode 100755 index 00000000000..2347475f438 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_assemble_conditional.c @@ -0,0 +1,485 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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 slang_assemble_conditional.c + * slang condtional expressions assembler + * \author Michal Krol + */ + +#include "imports.h" +#include "slang_utility.h" +#include "slang_assemble_conditional.h" +#include "slang_assemble.h" + +/* _slang_assemble_logicaland() */ + +int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info) +{ + /* + and: + + jumpz zero + + jump end + zero: + push 0 + end: + */ + + unsigned int zero_jump, end_jump; + slang_assembly_stack_info stk; + + /* evaluate left expression */ + if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) + return 0; + /* TODO: inspect stk */ + + /* jump to pushing 0 if not true */ + zero_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump_if_zero)) + return 0; + + /* evaluate right expression */ + if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) + return 0; + /* TODO: inspect stk */ + + /* jump to the end of the expression */ + end_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump)) + return 0; + + /* push 0 on stack */ + file->code[zero_jump].param[0] = file->count; + if (!slang_assembly_file_push (file, slang_asm_bool_push)) + return 0; + + /* the end of the expression */ + file->code[end_jump].param[0] = file->count; + + return 1; +} + +/* _slang_assemble_logicalor() */ + +int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info) +{ + /* + or: + + jumpz right + push 1 + jump end + right: + + end: + */ + + unsigned int right_jump, end_jump; + slang_assembly_stack_info stk; + + /* evaluate left expression */ + if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) + return 0; + /* TODO: inspect stk */ + + /* jump to evaluation of right expression if not true */ + right_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump_if_zero)) + return 0; + + /* push 1 on stack */ + if (!slang_assembly_file_push_literal (file, slang_asm_bool_push, 1.0f)) + return 0; + + /* jump to the end of the expression */ + end_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump)) + return 0; + + /* evaluate right expression */ + file->code[right_jump].param[0] = file->count; + if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) + return 0; + /* TODO: inspect stk */ + + /* the end of the expression */ + file->code[end_jump].param[0] = file->count; + + return 1; +} + +/* _slang_assemble_select() */ + +int _slang_assemble_select (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info) +{ + /* + select: + + jumpz false + + jump end + false: + + end: + */ + + unsigned int cond_jump, end_jump; + slang_assembly_stack_info stk; + + /* execute condition expression */ + if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) + return 0; + /* TODO: inspect stk */ + + /* jump to false expression if not true */ + cond_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump_if_zero)) + return 0; + + /* execute true expression */ + if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) + return 0; + /* TODO: inspect stk */ + + /* jump to the end of the expression */ + end_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump)) + return 0; + + /* resolve false point */ + file->code[cond_jump].param[0] = file->count; + + /* execute false expression */ + if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk)) + return 0; + /* TODO: inspect stk */ + + /* resolve the end of the expression */ + file->code[end_jump].param[0] = file->count; + + return 1; +} + +/* _slang_assemble_for() */ + +int _slang_assemble_for (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info) +{ + /* + for: + + jump start + break: + jump end + continue: + + start: + + jumpz end + + jump continue + end: + */ + + unsigned int start_jump, end_jump, cond_jump; + unsigned int break_label, cont_label; + slang_assembly_flow_control loop_flow = *flow; + slang_assembly_stack_info stk; + + /* execute initialization statement */ + if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) + return 0; + /* TODO: pass-in stk to cleanup */ + if (!_slang_cleanup_stack (file, op->children, 0, space)) + return 0; + + /* skip the "go to the end of the loop" and loop-increment statements */ + start_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump)) + return 0; + + /* go to the end of the loop - break statements are directed here */ + break_label = file->count; + end_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump)) + return 0; + + /* resolve the beginning of the loop - continue statements are directed here */ + cont_label = file->count; + + /* execute loop-increment statement */ + if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk)) + return 0; + /* TODO: pass-in stk to cleanup */ + if (!_slang_cleanup_stack (file, op->children + 2, 0, space)) + return 0; + + /* resolve the condition point */ + file->code[start_jump].param[0] = file->count; + + /* execute condition statement */ + if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) + return 0; + /* TODO: inspect stk */ + + /* jump to the end of the loop if not true */ + cond_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump_if_zero)) + return 0; + + /* execute loop body */ + loop_flow.loop_start = cont_label; + loop_flow.loop_end = break_label; + if (!_slang_assemble_operation (file, op->children + 3, 0, &loop_flow, space, info, &stk)) + return 0; + /* TODO: pass-in stk to cleanup */ + if (!_slang_cleanup_stack (file, op->children + 3, 0, space)) + return 0; + + /* go to the beginning of the loop */ + if (!slang_assembly_file_push_label (file, slang_asm_jump, cont_label)) + return 0; + + /* resolve the end of the loop */ + file->code[end_jump].param[0] = file->count; + file->code[cond_jump].param[0] = file->count; + + return 1; +} + +/* _slang_assemble_do() */ + +int _slang_assemble_do (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info) +{ + /* + do: + jump start + break: + jump end + continue: + jump condition + start: + + condition: + + jumpz end + jump start + end: + */ + + unsigned int skip_jump, end_jump, cont_jump, cond_jump; + unsigned int break_label, cont_label; + slang_assembly_flow_control loop_flow = *flow; + slang_assembly_stack_info stk; + + /* skip the "go to the end of the loop" and "go to condition" statements */ + skip_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump)) + return 0; + + /* go to the end of the loop - break statements are directed here */ + break_label = file->count; + end_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump)) + return 0; + + /* go to condition - continue statements are directed here */ + cont_label = file->count; + cont_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump)) + return 0; + + /* resolve the beginning of the loop */ + file->code[skip_jump].param[0] = file->count; + + /* execute loop body */ + loop_flow.loop_start = cont_label; + loop_flow.loop_end = break_label; + if (!_slang_assemble_operation (file, op->children, 0, &loop_flow, space, info, &stk)) + return 0; + /* TODO: pass-in stk to cleanup */ + if (!_slang_cleanup_stack (file, op->children, 0, space)) + return 0; + + /* resolve condition point */ + file->code[cont_jump].param[0] = file->count; + + /* execute condition statement */ + if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) + return 0; + /* TODO: pass-in stk to cleanup */ + + /* jump to the end of the loop if not true */ + cond_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump_if_zero)) + return 0; + + /* jump to the beginning of the loop */ + if (!slang_assembly_file_push_label (file, slang_asm_jump, file->code[skip_jump].param[0])) + return 0; + + /* resolve the end of the loop */ + file->code[end_jump].param[0] = file->count; + file->code[cond_jump].param[0] = file->count; + + return 1; +} + +/* _slang_assemble_while() */ + +int _slang_assemble_while (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info) +{ + /* + while: + jump continue + break: + jump end + continue: + + jumpz end + + jump continue + end: + */ + + unsigned int skip_jump, end_jump, cond_jump; + unsigned int break_label; + slang_assembly_flow_control loop_flow = *flow; + slang_assembly_stack_info stk; + + /* skip the "go to the end of the loop" statement */ + skip_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump)) + return 0; + + /* go to the end of the loop - break statements are directed here */ + break_label = file->count; + end_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump)) + return 0; + + /* resolve the beginning of the loop - continue statements are directed here */ + file->code[skip_jump].param[0] = file->count; + + /* execute condition statement */ + if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) + return 0; + /* TODO: pass-in stk to cleanup */ + + /* jump to the end of the loop if not true */ + cond_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump_if_zero)) + return 0; + + /* execute loop body */ + loop_flow.loop_start = file->code[skip_jump].param[0]; + loop_flow.loop_end = break_label; + if (!_slang_assemble_operation (file, op->children + 1, 0, &loop_flow, space, info, &stk)) + return 0; + /* TODO: pass-in stk to cleanup */ + if (!_slang_cleanup_stack (file, op->children + 1, 0, space)) + return 0; + + /* jump to the beginning of the loop */ + if (!slang_assembly_file_push_label (file, slang_asm_jump, file->code[skip_jump].param[0])) + return 0; + + /* resolve the end of the loop */ + file->code[end_jump].param[0] = file->count; + file->code[cond_jump].param[0] = file->count; + + return 1; +} + +/* _slang_assemble_if() */ + +int _slang_assemble_if (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info) +{ + /* + if: + + jumpz else + + jump end + else: + + end: + */ + + unsigned int cond_jump, else_jump; + slang_assembly_stack_info stk; + + /* execute condition statement */ + if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) + return 0; + /* TODO: pass-in stk to cleanup */ + + /* jump to false-statement if not true */ + cond_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump_if_zero)) + return 0; + + /* execute true-statement */ + if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) + return 0; + /* TODO: pass-in stk to cleanup */ + if (!_slang_cleanup_stack (file, op->children + 1, 0, space)) + return 0; + + /* skip if-false statement */ + else_jump = file->count; + if (!slang_assembly_file_push (file, slang_asm_jump)) + return 0; + + /* resolve start of false-statement */ + file->code[cond_jump].param[0] = file->count; + + /* execute false-statement */ + if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk)) + return 0; + /* TODO: pass-in stk to cleanup */ + if (!_slang_cleanup_stack (file, op->children + 2, 0, space)) + return 0; + + /* resolve end of if-false statement */ + file->code[else_jump].param[0] = file->count; + + return 1; +} + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_assemble_conditional.h b/reactos/dll/mesa32/src/shader/slang/slang_assemble_conditional.h new file mode 100755 index 00000000000..b8defae68a3 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_assemble_conditional.h @@ -0,0 +1,67 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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. + */ + +#if !defined SLANG_ASSEMBLE_CONDITIONAL_H +#define SLANG_ASSEMBLE_CONDITIONAL_H + +#include "slang_assemble.h" + +#if defined __cplusplus +extern "C" { +#endif + +int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info); + +int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info); + +int _slang_assemble_select (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info); + +int _slang_assemble_for (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info); + +int _slang_assemble_do (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info); + +int _slang_assemble_while (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info); + +int _slang_assemble_if (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_assemble_constructor.c b/reactos/dll/mesa32/src/shader/slang/slang_assemble_constructor.c new file mode 100755 index 00000000000..85ccea9e2bc --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_assemble_constructor.c @@ -0,0 +1,339 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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 slang_assemble_constructor.c + * slang constructor and vector swizzle assembler + * \author Michal Krol + */ + +#include "imports.h" +#include "slang_utility.h" +#include "slang_assemble_constructor.h" +#include "slang_assemble_typeinfo.h" +#include "slang_storage.h" + +/* _slang_is_swizzle() */ + +int _slang_is_swizzle (const char *field, unsigned int rows, slang_swizzle *swz) +{ + unsigned int i; + int xyzw = 0, rgba = 0, stpq = 0; + + /* the swizzle can be at most 4-component long */ + swz->num_components = slang_string_length (field); + if (swz->num_components > 4) + return 0; + + for (i = 0; i < swz->num_components; i++) + { + /* mark which swizzle group is used */ + switch (field[i]) + { + case 'x': + case 'y': + case 'z': + case 'w': + xyzw = 1; + break; + case 'r': + case 'g': + case 'b': + case 'a': + rgba = 1; + break; + case 's': + case 't': + case 'p': + case 'q': + stpq = 1; + break; + default: + return 0; + } + + /* collect swizzle component */ + switch (field[i]) + { + case 'x': + case 'r': + case 's': + swz->swizzle[i] = 0; + break; + case 'y': + case 'g': + case 't': + if (rows < 2) + return 0; + swz->swizzle[i] = 1; + break; + case 'z': + case 'b': + case 'p': + if (rows < 3) + return 0; + swz->swizzle[i] = 2; + break; + case 'w': + case 'a': + case 'q': + if (rows < 4) + return 0; + swz->swizzle[i] = 3; + break; + } + } + + /* only one swizzle group can be used */ + if ((xyzw && rgba) || (xyzw && stpq) || (rgba && stpq)) + return 0; + + return 1; +} + +/* _slang_is_swizzle_mask() */ + +int _slang_is_swizzle_mask (const slang_swizzle *swz, unsigned int rows) +{ + unsigned int c, i; + + if (swz->num_components > rows) + return 0; + c = swz->swizzle[0]; + for (i = 1; i < swz->num_components; i++) + { + if (swz->swizzle[i] <= c) + return 0; + c = swz->swizzle[i]; + } + return 1; +} + +/* _slang_multiply_swizzles() */ + +void _slang_multiply_swizzles (slang_swizzle *dst, const slang_swizzle *left, + const slang_swizzle *right) +{ + unsigned int i; + dst->num_components = right->num_components; + for (i = 0; i < right->num_components; i++) + dst->swizzle[i] = left->swizzle[right->swizzle[i]]; +} + +/* _slang_assemble_constructor() */ + +static int constructor_aggregate (slang_assembly_file *file, const slang_storage_aggregate *flat, + unsigned int *index, slang_operation *op, unsigned int size, slang_assembly_flow_control *flow, + slang_assembly_name_space *space, slang_assembly_local_info *info) +{ + slang_assembly_typeinfo ti; + int result; + slang_storage_aggregate agg, flat_agg; + slang_assembly_stack_info stk; + unsigned int i; + + slang_assembly_typeinfo_construct (&ti); + if (!(result = _slang_typeof_operation (op, space, &ti))) + goto end1; + + slang_storage_aggregate_construct (&agg); + if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs))) + goto end2; + + slang_storage_aggregate_construct (&flat_agg); + if (!(result = _slang_flatten_aggregate (&flat_agg, &agg))) + goto end; + + if (!(result = _slang_assemble_operation (file, op, 0, flow, space, info, &stk))) + goto end; + + for (i = 0; i < flat_agg.count; i++) + { + const slang_storage_array *arr1 = flat_agg.arrays + i; + const slang_storage_array *arr2 = flat->arrays + *index; + + if (arr1->type != arr2->type) + { + /* TODO: convert (generic) from arr1 to arr2 */ + } + (*index)++; + /* TODO: watch the index, if it reaches the size, pop off the stack subsequent values */ + } + + result = 1; +end: + slang_storage_aggregate_destruct (&flat_agg); +end2: + slang_storage_aggregate_destruct (&agg); +end1: + slang_assembly_typeinfo_destruct (&ti); + return result; +} +/* XXX: general swizzle! */ +int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info) +{ + slang_assembly_typeinfo ti; + int result; + slang_storage_aggregate agg, flat; + unsigned int size, index, i; + + slang_assembly_typeinfo_construct (&ti); + if (!(result = _slang_typeof_operation (op, space, &ti))) + goto end1; + + slang_storage_aggregate_construct (&agg); + if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs))) + goto end2; + + size = _slang_sizeof_aggregate (&agg); + + slang_storage_aggregate_construct (&flat); + if (!(result = _slang_flatten_aggregate (&flat, &agg))) + goto end; + + index = 0; + for (i = 0; i < op->num_children; i++) + { + if (!(result = constructor_aggregate (file, &flat, &index, op->children + i, size, flow, + space, info))) + goto end; + /* TODO: watch the index, if it reaches the size, raise an error */ + } + + result = 1; +end: + slang_storage_aggregate_destruct (&flat); +end2: + slang_storage_aggregate_destruct (&agg); +end1: + slang_assembly_typeinfo_destruct (&ti); + return result; +} + +/* _slang_assemble_constructor_from_swizzle() */ +/* XXX: wrong */ +int _slang_assemble_constructor_from_swizzle (slang_assembly_file *file, const slang_swizzle *swz, + slang_type_specifier *spec, slang_type_specifier *master_spec, slang_assembly_local_info *info) +{ + unsigned int master_rows, i; + switch (master_spec->type) + { + case slang_spec_bool: + case slang_spec_int: + case slang_spec_float: + master_rows = 1; + break; + case slang_spec_bvec2: + case slang_spec_ivec2: + case slang_spec_vec2: + master_rows = 2; + break; + case slang_spec_bvec3: + case slang_spec_ivec3: + case slang_spec_vec3: + master_rows = 3; + break; + case slang_spec_bvec4: + case slang_spec_ivec4: + case slang_spec_vec4: + master_rows = 4; + break; + default: + break; + } + for (i = 0; i < master_rows; i++) + { + switch (master_spec->type) + { + case slang_spec_bool: + case slang_spec_bvec2: + case slang_spec_bvec3: + case slang_spec_bvec4: + if (!slang_assembly_file_push_label2 (file, slang_asm_bool_copy, (master_rows - i) * 4, + i * 4)) + return 0; + break; + case slang_spec_int: + case slang_spec_ivec2: + case slang_spec_ivec3: + case slang_spec_ivec4: + if (!slang_assembly_file_push_label2 (file, slang_asm_int_copy, (master_rows - i) * 4, + i * 4)) + return 0; + break; + case slang_spec_float: + case slang_spec_vec2: + case slang_spec_vec3: + case slang_spec_vec4: + if (!slang_assembly_file_push_label2 (file, slang_asm_float_copy, + (master_rows - i) * 4, i * 4)) + return 0; + break; + default: + break; + } + } + if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4)) + return 0; + for (i = swz->num_components; i > 0; i--) + { + unsigned int n = i - 1; + if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->swizzle_tmp, 16)) + return 0; + if (!slang_assembly_file_push_label (file, slang_asm_addr_push, swz->swizzle[n] * 4)) + return 0; + if (!slang_assembly_file_push (file, slang_asm_addr_add)) + return 0; + switch (master_spec->type) + { + case slang_spec_bool: + case slang_spec_bvec2: + case slang_spec_bvec3: + case slang_spec_bvec4: + if (!slang_assembly_file_push (file, slang_asm_bool_deref)) + return 0; + break; + case slang_spec_int: + case slang_spec_ivec2: + case slang_spec_ivec3: + case slang_spec_ivec4: + if (!slang_assembly_file_push (file, slang_asm_int_deref)) + return 0; + break; + case slang_spec_float: + case slang_spec_vec2: + case slang_spec_vec3: + case slang_spec_vec4: + if (!slang_assembly_file_push (file, slang_asm_float_deref)) + return 0; + break; + default: + break; + } + } + return 1; +} + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_assemble_constructor.h b/reactos/dll/mesa32/src/shader/slang/slang_assemble_constructor.h new file mode 100755 index 00000000000..31048bc7bc7 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_assemble_constructor.h @@ -0,0 +1,80 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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. + */ + +#if !defined SLANG_ASSEMBLE_CONSTRUCTOR_H +#define SLANG_ASSEMBLE_CONSTRUCTOR_H + +#include "slang_assemble.h" +#include "slang_compile.h" + +#if defined __cplusplus +extern "C" { +#endif + +/* + holds a complete information about vector swizzle - the array contains + vector component sources indices, where 0 is "x", 1 is "y", ... + example: "xwz" --> { 3, { 0, 3, 2, n/u } } +*/ +typedef struct slang_swizzle_ +{ + unsigned int num_components; + unsigned int swizzle[4]; +} slang_swizzle; + +/* + checks if a field selector is a general swizzle (an r-value swizzle with replicated + components or an l-value swizzle mask) for a vector + returns 1 if this is the case, is filled with swizzle information + returns 0 otherwise +*/ +int _slang_is_swizzle (const char *field, unsigned int rows, slang_swizzle *swz); + +/* + checks if a general swizzle is an l-value swizzle - these swizzles do not have + duplicated fields and they are specified in order + returns 1 if this is a swizzle mask + returns 0 otherwise +*/ +int _slang_is_swizzle_mask (const slang_swizzle *swz, unsigned int rows); + +/* + combines two swizzles to form single swizzle + example: "wzyx.yx" --> "zw" +*/ +void _slang_multiply_swizzles (slang_swizzle *, const slang_swizzle *, const slang_swizzle *); + +int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op, + slang_assembly_flow_control *flow, slang_assembly_name_space *space, + slang_assembly_local_info *info); + +int _slang_assemble_constructor_from_swizzle (slang_assembly_file *file, const slang_swizzle *swz, + slang_type_specifier *spec, slang_type_specifier *master_spec, slang_assembly_local_info *info); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_assemble_typeinfo.c b/reactos/dll/mesa32/src/shader/slang/slang_assemble_typeinfo.c new file mode 100755 index 00000000000..d2cae447a73 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_assemble_typeinfo.c @@ -0,0 +1,430 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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 slang_assemble_typeinfo.c + * slang type info + * \author Michal Krol + */ + +#include "imports.h" +#include "slang_utility.h" +#include "slang_assemble_typeinfo.h" + +/* slang_assembly_typeinfo */ + +void slang_assembly_typeinfo_construct (slang_assembly_typeinfo *ti) +{ + slang_type_specifier_construct (&ti->spec); +} + +void slang_assembly_typeinfo_destruct (slang_assembly_typeinfo *ti) +{ + slang_type_specifier_destruct (&ti->spec); +} + +/* _slang_typeof_operation() */ + +int _slang_typeof_operation (slang_operation *op, slang_assembly_name_space *space, + slang_assembly_typeinfo *ti) +{ + ti->can_be_referenced = 0; + ti->is_swizzled = 0; + + switch (op->type) + { + case slang_oper_block_no_new_scope: + case slang_oper_block_new_scope: + case slang_oper_variable_decl: + case slang_oper_asm: + case slang_oper_break: + case slang_oper_continue: + case slang_oper_discard: + case slang_oper_return: + case slang_oper_if: + case slang_oper_while: + case slang_oper_do: + case slang_oper_for: + case slang_oper_void: + ti->spec.type = slang_spec_void; + break; + case slang_oper_expression: + case slang_oper_assign: + case slang_oper_addassign: + case slang_oper_subassign: + case slang_oper_mulassign: + case slang_oper_divassign: + case slang_oper_preincrement: + case slang_oper_predecrement: + if (!_slang_typeof_operation (op->children, space, ti)) + return 0; + break; + case slang_oper_literal_bool: + case slang_oper_logicalor: + case slang_oper_logicalxor: + case slang_oper_logicaland: + case slang_oper_equal: + case slang_oper_notequal: + case slang_oper_less: + case slang_oper_greater: + case slang_oper_lessequal: + case slang_oper_greaterequal: + case slang_oper_not: + ti->spec.type = slang_spec_bool; + break; + case slang_oper_literal_int: + ti->spec.type = slang_spec_int; + break; + case slang_oper_literal_float: + ti->spec.type = slang_spec_float; + break; + case slang_oper_identifier: + { + slang_variable *var; + + var = _slang_locate_variable (op->locals, op->identifier, 1); + if (var == NULL) + return 0; + if (!slang_type_specifier_copy (&ti->spec, &var->type.specifier)) + return 0; + ti->can_be_referenced = 1; + } + break; + case slang_oper_sequence: + /* TODO: check [0] and [1] if they match */ + if (!_slang_typeof_operation (op->children + 1, space, ti)) + return 0; + ti->can_be_referenced = 0; + ti->is_swizzled = 0; + break; + /*case slang_oper_modassign:*/ + /*case slang_oper_lshassign:*/ + /*case slang_oper_rshassign:*/ + /*case slang_oper_orassign:*/ + /*case slang_oper_xorassign:*/ + /*case slang_oper_andassign:*/ + case slang_oper_select: + /* TODO: check [1] and [2] if they match */ + if (!_slang_typeof_operation (op->children + 1, space, ti)) + return 0; + ti->can_be_referenced = 0; + ti->is_swizzled = 0; + break; + /*case slang_oper_bitor:*/ + /*case slang_oper_bitxor:*/ + /*case slang_oper_bitand:*/ + /*case slang_oper_lshift:*/ + /*case slang_oper_rshift:*/ + case slang_oper_add: + { + int exists; + if (!_slang_typeof_function ("+", op->children, 2, space, &ti->spec, &exists)) + return 0; + if (!exists) + return 0; + } + break; + case slang_oper_subtract: + { + int exists; + if (!_slang_typeof_function ("-", op->children, 2, space, &ti->spec, &exists)) + return 0; + if (!exists) + return 0; + } + break; + case slang_oper_multiply: + { + int exists; + if (!_slang_typeof_function ("*", op->children, 2, space, &ti->spec, &exists)) + return 0; + if (!exists) + return 0; + } + break; + case slang_oper_divide: + { + int exists; + if (!_slang_typeof_function ("/", op->children, 2, space, &ti->spec, &exists)) + return 0; + if (!exists) + return 0; + } + break; + /*case slang_oper_modulus:*/ + case slang_oper_plus: + { + int exists; + if (!_slang_typeof_function ("+", op->children, 1, space, &ti->spec, &exists)) + return 0; + if (!exists) + return 0; + } + break; + case slang_oper_minus: + { + int exists; + if (!_slang_typeof_function ("-", op->children, 1, space, &ti->spec, &exists)) + return 0; + if (!exists) + return 0; + } + break; + /*case slang_oper_complement:*/ + case slang_oper_subscript: + { + slang_assembly_typeinfo _ti; + slang_assembly_typeinfo_construct (&_ti); + if (!_slang_typeof_operation (op->children, space, &_ti)) + { + slang_assembly_typeinfo_destruct (&_ti); + return 0; + } + ti->can_be_referenced = _ti.can_be_referenced; + switch (_ti.spec.type) + { + case slang_spec_bvec2: + case slang_spec_bvec3: + case slang_spec_bvec4: + ti->spec.type = slang_spec_bool; + break; + case slang_spec_ivec2: + case slang_spec_ivec3: + case slang_spec_ivec4: + ti->spec.type = slang_spec_int; + break; + case slang_spec_vec2: + case slang_spec_vec3: + case slang_spec_vec4: + ti->spec.type = slang_spec_float; + break; + case slang_spec_mat2: + ti->spec.type = slang_spec_vec2; + break; + case slang_spec_mat3: + ti->spec.type = slang_spec_vec3; + break; + case slang_spec_mat4: + ti->spec.type = slang_spec_vec4; + break; + case slang_spec_array: + if (!slang_type_specifier_copy (&ti->spec, _ti.spec._array)) + { + slang_assembly_typeinfo_destruct (&_ti); + return 0; + } + break; + default: + slang_assembly_typeinfo_destruct (&_ti); + return 0; + } + slang_assembly_typeinfo_destruct (&_ti); + } + break; + case slang_oper_call: + { + int exists; + if (!_slang_typeof_function (op->identifier, op->children, op->num_children, space, + &ti->spec, &exists)) + return 0; + if (!exists) + { + slang_struct *s = slang_struct_scope_find (space->structs, op->identifier, 1); + if (s != NULL) + { + ti->spec.type = slang_spec_struct; + ti->spec._struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct)); + if (ti->spec._struct == NULL) + return 0; + if (!slang_struct_construct_a (ti->spec._struct)) + { + slang_alloc_free (ti->spec._struct); + ti->spec._struct = NULL; + return 0; + } + if (!slang_struct_copy (ti->spec._struct, s)) + return 0; + } + else + { + slang_type_specifier_type type = slang_type_specifier_type_from_string ( + op->identifier); + if (type == slang_spec_void) + return 0; + ti->spec.type = type; + } + } + } + break; + case slang_oper_field: + { + slang_assembly_typeinfo _ti; + slang_assembly_typeinfo_construct (&_ti); + if (!_slang_typeof_operation (op->children, space, &_ti)) + { + slang_assembly_typeinfo_destruct (&_ti); + return 0; + } + if (_ti.spec.type == slang_spec_struct) + { + slang_variable *field = _slang_locate_variable (_ti.spec._struct->fields, + op->identifier, 0); + if (field == NULL) + { + slang_assembly_typeinfo_destruct (&_ti); + return 0; + } + if (!slang_type_specifier_copy (&ti->spec, &field->type.specifier)) + { + slang_assembly_typeinfo_destruct (&_ti); + return 0; + } + } + else + { + unsigned int rows; + switch (_ti.spec.type) + { + case slang_spec_vec2: + case slang_spec_ivec2: + case slang_spec_bvec2: + rows = 2; + break; + case slang_spec_vec3: + case slang_spec_ivec3: + case slang_spec_bvec3: + rows = 3; + break; + case slang_spec_vec4: + case slang_spec_ivec4: + case slang_spec_bvec4: + rows = 4; + break; + default: + slang_assembly_typeinfo_destruct (&_ti); + return 0; + } + if (!_slang_is_swizzle (op->identifier, rows, &ti->swz)) + return 0; + ti->is_swizzled = 1; + ti->can_be_referenced = _ti.can_be_referenced && _slang_is_swizzle_mask (&ti->swz, + rows); + if (_ti.is_swizzled) + { + slang_swizzle swz; + _slang_multiply_swizzles (&swz, &_ti.swz, &ti->swz); + ti->swz = swz; + } + switch (_ti.spec.type) + { + case slang_spec_vec2: + case slang_spec_vec3: + case slang_spec_vec4: + switch (ti->swz.num_components) + { + case 1: + ti->spec.type = slang_spec_float; + break; + case 2: + ti->spec.type = slang_spec_vec2; + break; + case 3: + ti->spec.type = slang_spec_vec3; + break; + case 4: + ti->spec.type = slang_spec_vec4; + break; + } + break; + case slang_spec_ivec2: + case slang_spec_ivec3: + case slang_spec_ivec4: + switch (ti->swz.num_components) + { + case 1: + ti->spec.type = slang_spec_int; + break; + case 2: + ti->spec.type = slang_spec_ivec2; + break; + case 3: + ti->spec.type = slang_spec_ivec3; + break; + case 4: + ti->spec.type = slang_spec_ivec4; + break; + } + break; + case slang_spec_bvec2: + case slang_spec_bvec3: + case slang_spec_bvec4: + switch (ti->swz.num_components) + { + case 1: + ti->spec.type = slang_spec_bool; + break; + case 2: + ti->spec.type = slang_spec_bvec2; + break; + case 3: + ti->spec.type = slang_spec_bvec3; + break; + case 4: + ti->spec.type = slang_spec_bvec4; + break; + } + break; + default: + break; + } + } + slang_assembly_typeinfo_destruct (&_ti); + return 1; + } + break; + case slang_oper_postincrement: + case slang_oper_postdecrement: + if (!_slang_typeof_operation (op->children, space, ti)) + return 0; + ti->can_be_referenced = 0; + ti->is_swizzled = 0; + break; + default: + return 0; + } + return 1; +} + +/* _slang_typeof_function() */ + +int _slang_typeof_function (const char *name, slang_operation *params, unsigned int num_params, + slang_assembly_name_space *space, slang_type_specifier *spec, int *exists) +{ + slang_function *fun = _slang_locate_function (name, params, num_params, space); + *exists = fun != NULL; + if (fun == NULL) + return 1; + return slang_type_specifier_copy (spec, &fun->header.type.specifier); +} + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_assemble_typeinfo.h b/reactos/dll/mesa32/src/shader/slang/slang_assemble_typeinfo.h new file mode 100755 index 00000000000..fc1f3e3ae7e --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_assemble_typeinfo.h @@ -0,0 +1,67 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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. + */ + +#if !defined SLANG_ASSEMBLE_TYPEINFO_H +#define SLANG_ASSEMBLE_TYPEINFO_H + +#include "slang_assemble_constructor.h" +#include "slang_compile.h" + +#if defined __cplusplus +extern "C" { +#endif + +typedef struct slang_assembly_typeinfo_ +{ + int can_be_referenced; + int is_swizzled; + slang_swizzle swz; + slang_type_specifier spec; +} slang_assembly_typeinfo; + +void slang_assembly_typeinfo_construct (slang_assembly_typeinfo *); +void slang_assembly_typeinfo_destruct (slang_assembly_typeinfo *); + +/* + retrieves type information about an operation + returns 1 on success + returns 0 otherwise +*/ +int _slang_typeof_operation (slang_operation *, slang_assembly_name_space *, + slang_assembly_typeinfo *); + +/* + retrieves type of a function prototype, if one exists + returns 1 on success, even if the function was not found + returns 0 otherwise +*/ +int _slang_typeof_function (const char *name, slang_operation *params, unsigned int num_params, + slang_assembly_name_space *space, slang_type_specifier *spec, int *exists); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_compile.c b/reactos/dll/mesa32/src/shader/slang/slang_compile.c new file mode 100644 index 00000000000..2377173cf0a --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_compile.c @@ -0,0 +1,2369 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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 slang_compile.c + * slang front-end compiler + * \author Michal Krol + */ + +#include "imports.h" +#include "grammar_mesa.h" +#include "slang_utility.h" +#include "slang_compile.h" +#include "slang_preprocess.h" +#include "slang_storage.h" +#include "slang_assemble.h" +#include "slang_execute.h" + +/* + This is a straightforward implementation of the slang front-end compiler. + Lots of error-checking functionality is missing but every well-formed shader source should + compile successfully and execute as expected. However, some semantically ill-formed shaders + may be accepted resulting in undefined behaviour. +*/ + +static void slang_variable_construct (slang_variable *); +static int slang_variable_copy (slang_variable *, const slang_variable *); +static void slang_struct_destruct (slang_struct *); +static int slang_struct_equal (const slang_struct *, const slang_struct *); +static void slang_variable_destruct (slang_variable *); + +/* slang_type_specifier_type */ + +/* these must match with slang_type_specifier_type enum */ +static const char *type_specifier_type_names[] = { + "void", + "bool", + "bvec2", + "bvec3", + "bvec4", + "int", + "ivec2", + "ivec3", + "ivec4", + "float", + "vec2", + "vec3", + "vec4", + "mat2", + "mat3", + "mat4", + "sampler1D", + "sampler2D", + "sampler3D", + "samplerCube", + "sampler1DShadow", + "sampler2DShadow", + NULL +}; + +slang_type_specifier_type slang_type_specifier_type_from_string (const char *name) +{ + const char **p = type_specifier_type_names; + while (*p != NULL) + { + if (slang_string_compare (*p, name) == 0) + return (slang_type_specifier_type) (p - type_specifier_type_names); + p++; + } + return slang_spec_void; +} + +/* slang_type_specifier */ + +void slang_type_specifier_construct (slang_type_specifier *spec) +{ + spec->type = slang_spec_void; + spec->_struct = NULL; + spec->_array = NULL; +} + +void slang_type_specifier_destruct (slang_type_specifier *spec) +{ + if (spec->_struct != NULL) + { + slang_struct_destruct (spec->_struct); + slang_alloc_free (spec->_struct); + } + if (spec->_array != NULL) + { + slang_type_specifier_destruct (spec->_array); + slang_alloc_free (spec->_array); + } +} + +int slang_type_specifier_copy (slang_type_specifier *x, const slang_type_specifier *y) +{ + slang_type_specifier_destruct (x); + slang_type_specifier_construct (x); + x->type = y->type; + if (x->type == slang_spec_struct) + { + x->_struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct)); + if (x->_struct == NULL) + return 0; + if (!slang_struct_construct_a (x->_struct)) + { + slang_alloc_free (x->_struct); + x->_struct = NULL; + return 0; + } + return slang_struct_copy (x->_struct, y->_struct); + } + if (x->type == slang_spec_array) + { + x->_array = (slang_type_specifier *) slang_alloc_malloc (sizeof (slang_type_specifier)); + if (x->_array == NULL) + return 0; + slang_type_specifier_construct (x->_array); + return slang_type_specifier_copy (x->_array, y->_array); + } + return 1; +} + +int slang_type_specifier_equal (const slang_type_specifier *x, const slang_type_specifier *y) +{ + if (x->type != y->type) + return 0; + if (x->type == slang_spec_struct) + return slang_struct_equal (x->_struct, y->_struct); + if (x->type == slang_spec_array) + return slang_type_specifier_equal (x->_array, y->_array); + return 1; +} + +/* slang_fully_specified_type */ + +static void slang_fully_specified_type_construct (slang_fully_specified_type *type) +{ + type->qualifier = slang_qual_none; + slang_type_specifier_construct (&type->specifier); +} + +static void slang_fully_specified_type_destruct (slang_fully_specified_type *type) +{ + slang_type_specifier_destruct (&type->specifier); +} + +static int slang_fully_specified_type_copy (slang_fully_specified_type *x, + const slang_fully_specified_type *y) +{ + slang_fully_specified_type_construct (x); + slang_fully_specified_type_destruct (x); + x->qualifier = y->qualifier; + return slang_type_specifier_copy (&x->specifier, &y->specifier); +} + +/* slang_variable_scope */ + +static void slang_variable_scope_construct (slang_variable_scope *scope) +{ + scope->variables = NULL; + scope->num_variables = 0; + scope->outer_scope = NULL; +} + +static void slang_variable_scope_destruct (slang_variable_scope *scope) +{ + unsigned int i; + for (i = 0; i < scope->num_variables; i++) + slang_variable_destruct (scope->variables + i); + slang_alloc_free (scope->variables); +} + +static int slang_variable_scope_copy (slang_variable_scope *x, const slang_variable_scope *y) +{ + unsigned int i; + slang_variable_scope_destruct (x); + slang_variable_scope_construct (x); + x->variables = (slang_variable *) slang_alloc_malloc (y->num_variables * sizeof ( + slang_variable)); + if (x->variables == NULL) + return 0; + x->num_variables = y->num_variables; + for (i = 0; i < x->num_variables; i++) + slang_variable_construct (x->variables + i); + for (i = 0; i < x->num_variables; i++) + if (!slang_variable_copy (x->variables + i, y->variables + i)) + return 0; + x->outer_scope = y->outer_scope; + return 1; +} + +/* slang_operation */ + +int slang_operation_construct_a (slang_operation *oper) +{ + oper->type = slang_oper_none; + oper->children = NULL; + oper->num_children = 0; + oper->literal = (float) 0; + oper->identifier = NULL; + oper->locals = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope)); + if (oper->locals == NULL) + return 0; + slang_variable_scope_construct (oper->locals); + return 1; +} + +void slang_operation_destruct (slang_operation *oper) +{ + unsigned int i; + for (i = 0; i < oper->num_children; i++) + slang_operation_destruct (oper->children + i); + slang_alloc_free (oper->children); + slang_alloc_free (oper->identifier); + slang_variable_scope_destruct (oper->locals); + slang_alloc_free (oper->locals); +} + +static int slang_operation_copy (slang_operation *x, const slang_operation *y) +{ + unsigned int i; + for (i = 0; i < x->num_children; i++) + slang_operation_destruct (x->children + i); + slang_alloc_free (x->children); + x->num_children = 0; + slang_alloc_free (x->identifier); + x->identifier = NULL; + slang_variable_scope_destruct (x->locals); + slang_variable_scope_construct (x->locals); + + x->type = y->type; + x->children = (slang_operation *) slang_alloc_malloc (y->num_children * sizeof ( + slang_operation)); + if (x->children == NULL) + return 0; + for (i = 0; i < y->num_children; i++) + if (!slang_operation_construct_a (x->children + i)) + { + unsigned int j; + for (j = 0; j < i; j++) + slang_operation_destruct (x->children + j); + slang_alloc_free (x->children); + x->children = NULL; + return 0; + } + x->num_children = y->num_children; + for (i = 0; i < x->num_children; i++) + if (!slang_operation_copy (x->children + i, y->children + i)) + return 0; + x->literal = y->literal; + if (y->identifier != NULL) + { + x->identifier = slang_string_duplicate (y->identifier); + if (x->identifier == NULL) + return 0; + } + if (!slang_variable_scope_copy (x->locals, y->locals)) + return 0; + return 1; +} + +/* slang_variable */ + +static void slang_variable_construct (slang_variable *var) +{ + slang_fully_specified_type_construct (&var->type); + var->name = NULL; + var->array_size = NULL; + var->initializer = NULL; + var->address = ~0; +} + +static void slang_variable_destruct (slang_variable *var) +{ + slang_fully_specified_type_destruct (&var->type); + slang_alloc_free (var->name); + if (var->array_size != NULL) + { + slang_operation_destruct (var->array_size); + slang_alloc_free (var->array_size); + } + if (var->initializer != NULL) + { + slang_operation_destruct (var->initializer); + slang_alloc_free (var->initializer); + } +} + +static int slang_variable_copy (slang_variable *x, const slang_variable *y) +{ + slang_variable_destruct (x); + slang_variable_construct (x); + if (!slang_fully_specified_type_copy (&x->type, &y->type)) + return 0; + if (y->name != NULL) + { + x->name = slang_string_duplicate (y->name); + if (x->name == NULL) + return 0; + } + if (y->array_size != NULL) + { + x->array_size = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation)); + if (x->array_size == NULL) + return 0; + if (!slang_operation_construct_a (x->array_size)) + { + slang_alloc_free (x->array_size); + x->array_size = NULL; + return 0; + } + if (!slang_operation_copy (x->array_size, y->array_size)) + return 0; + } + if (y->initializer != NULL) + { + x->initializer = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation)); + if (x->initializer == NULL) + return 0; + if (!slang_operation_construct_a (x->initializer)) + { + slang_alloc_free (x->initializer); + x->initializer = NULL; + return 0; + } + if (!slang_operation_copy (x->initializer, y->initializer)) + return 0; + } + return 1; +} + +slang_variable *_slang_locate_variable (slang_variable_scope *scope, const char *name, int all) +{ + unsigned int i; + for (i = 0; i < scope->num_variables; i++) + if (slang_string_compare (name, scope->variables[i].name) == 0) + return scope->variables + i; + if (all && scope->outer_scope != NULL) + return _slang_locate_variable (scope->outer_scope, name, 1); + return NULL; +} + +/* slang_struct_scope */ + +static void slang_struct_scope_construct (slang_struct_scope *scope) +{ + scope->structs = NULL; + scope->num_structs = 0; + scope->outer_scope = NULL; +} + +static void slang_struct_scope_destruct (slang_struct_scope *scope) +{ + unsigned int i; + for (i = 0; i < scope->num_structs; i++) + slang_struct_destruct (scope->structs + i); + slang_alloc_free (scope->structs); +} + +static int slang_struct_scope_copy (slang_struct_scope *x, const slang_struct_scope *y) +{ + unsigned int i; + slang_struct_scope_destruct (x); + slang_struct_scope_construct (x); + x->structs = (slang_struct *) slang_alloc_malloc (y->num_structs * sizeof (slang_struct)); + if (x->structs == NULL) + return 0; + x->num_structs = y->num_structs; + for (i = 0; i < x->num_structs; i++) + { + unsigned int j; + if (!slang_struct_construct_a (x->structs + i)) + { + for (j = 0; j < i; j++) + slang_struct_destruct (x->structs + j); + slang_alloc_free (x->structs); + x->structs = NULL; + return 0; + } + } + for (i = 0; i < x->num_structs; i++) + if (!slang_struct_copy (x->structs + i, y->structs + i)) + return 0; + x->outer_scope = y->outer_scope; + return 1; +} + +slang_struct *slang_struct_scope_find (slang_struct_scope *stru, const char *name, int all_scopes) +{ + unsigned int i; + for (i = 0; i < stru->num_structs; i++) + if (slang_string_compare (name, stru->structs[i].name) == 0) + return stru->structs + i; + if (all_scopes && stru->outer_scope != NULL) + return slang_struct_scope_find (stru->outer_scope, name, 1); + return NULL; +} + +/* slang_struct */ + +int slang_struct_construct_a (slang_struct *stru) +{ + stru->name = NULL; + stru->fields = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope)); + if (stru->fields == NULL) + return 0; + slang_variable_scope_construct (stru->fields); + stru->structs = (slang_struct_scope *) slang_alloc_malloc (sizeof (slang_struct_scope)); + if (stru->structs == NULL) + { + slang_variable_scope_destruct (stru->fields); + slang_alloc_free (stru->fields); + return 0; + } + slang_struct_scope_construct (stru->structs); + return 1; +} + +static void slang_struct_destruct (slang_struct *stru) +{ + slang_alloc_free (stru->name); + slang_variable_scope_destruct (stru->fields); + slang_alloc_free (stru->fields); + slang_struct_scope_destruct (stru->structs); + slang_alloc_free (stru->structs); +} + +int slang_struct_copy (slang_struct *x, const slang_struct *y) +{ + slang_alloc_free (x->name); + x->name = NULL; + slang_variable_scope_destruct (x->fields); + slang_variable_scope_construct (x->fields); + slang_struct_scope_destruct (x->structs); + slang_struct_scope_construct (x->structs); + if (y->name != NULL) + { + x->name = slang_string_duplicate (y->name); + if (x->name == NULL) + return 0; + } + if (!slang_variable_scope_copy (x->fields, y->fields)) + return 0; + if (!slang_struct_scope_copy (x->structs, y->structs)) + return 0; + return 1; +} + +static int slang_struct_equal (const slang_struct *x, const slang_struct *y) +{ + unsigned int i; + if (x->fields->num_variables != y->fields->num_variables) + return 0; + for (i = 0; i < x->fields->num_variables; i++) + { + slang_variable *varx = x->fields->variables + i; + slang_variable *vary = y->fields->variables + i; + if (slang_string_compare (varx->name, vary->name) != 0) + return 0; + if (!slang_type_specifier_equal (&varx->type.specifier, &vary->type.specifier)) + return 0; + if (varx->type.specifier.type == slang_spec_array) + { + /* TODO compare array sizes */ + } + } + return 1; +} + +/* slang_function */ +/* XXX mem! */ +static void slang_function_construct (slang_function *func) +{ + func->kind = slang_func_ordinary; + slang_variable_construct (&func->header); + func->parameters = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope)); + slang_variable_scope_construct (func->parameters); + func->body = NULL; + func->address = ~0; +} + +static void slang_function_destruct (slang_function *func) +{ + slang_variable_destruct (&func->header); + slang_variable_scope_destruct (func->parameters); + slang_alloc_free (func->parameters); + if (func->body != NULL) + { + slang_operation_destruct (func->body); + slang_alloc_free (func->body); + } +} + +/* slang_function_scope */ + +static void slang_function_scope_construct (slang_function_scope *scope) +{ + scope->functions = NULL; + scope->num_functions = 0; + scope->outer_scope = NULL; +} + +static void slang_function_scope_destruct (slang_function_scope *scope) +{ + unsigned int i; + for (i = 0; i < scope->num_functions; i++) + slang_function_destruct (scope->functions + i); + slang_alloc_free (scope->functions); +} + +static int slang_function_scope_find_by_name (slang_function_scope *funcs, const char *name, + int all_scopes) +{ + unsigned int i; + for (i = 0; i < funcs->num_functions; i++) + if (slang_string_compare (name, funcs->functions[i].header.name) == 0) + return 1; + if (all_scopes && funcs->outer_scope != NULL) + return slang_function_scope_find_by_name (funcs->outer_scope, name, 1); + return 0; +} + +static slang_function *slang_function_scope_find (slang_function_scope *funcs, slang_function *fun, + int all_scopes) +{ + unsigned int i; + for (i = 0; i < funcs->num_functions; i++) + { + slang_function *f = funcs->functions + i; + unsigned int j; + if (slang_string_compare (fun->header.name, f->header.name) != 0) + continue; + if (fun->param_count != f->param_count) + continue; + for (j = 0; j < fun->param_count; j++) + { + if (!slang_type_specifier_equal (&fun->parameters->variables[j].type.specifier, + &f->parameters->variables[j].type.specifier)) + { + break; + } + } + if (j == fun->param_count) + return f; + } + if (all_scopes && funcs->outer_scope != NULL) + return slang_function_scope_find (funcs->outer_scope, fun, 1); + return NULL; +} + +/* slang_translation_unit */ + +void slang_translation_unit_construct (slang_translation_unit *unit) +{ + slang_variable_scope_construct (&unit->globals); + slang_function_scope_construct (&unit->functions); + slang_struct_scope_construct (&unit->structs); +} + +void slang_translation_unit_destruct (slang_translation_unit *unit) +{ + slang_variable_scope_destruct (&unit->globals); + slang_function_scope_destruct (&unit->functions); + slang_struct_scope_destruct (&unit->structs); +} + +/* slang_info_log */ + +static char *out_of_memory = "error: out of memory\n"; + +void slang_info_log_construct (slang_info_log *log) +{ + log->text = NULL; + log->dont_free_text = 0; +} + +void slang_info_log_destruct (slang_info_log *log) +{ + if (!log->dont_free_text) + slang_alloc_free (log->text); +} + +static int slang_info_log_message (slang_info_log *log, const char *prefix, const char *msg) +{ + unsigned int new_size; + if (log->dont_free_text) + return 0; + new_size = slang_string_length (prefix) + 3 + slang_string_length (msg); + if (log->text != NULL) + { + log->text = (char *) slang_alloc_realloc (log->text, slang_string_length (log->text) + 1, + new_size + slang_string_length (log->text) + 1); + } + else + { + log->text = (char *) slang_alloc_malloc (new_size + 1); + if (log->text != NULL) + *log->text = '\0'; + } + if (log->text == NULL) + return 0; + slang_string_concat (log->text, prefix); + slang_string_concat (log->text, ": "); + slang_string_concat (log->text, msg); + slang_string_concat (log->text, "\n"); + return 1; +} + +int slang_info_log_error (slang_info_log *log, const char *msg, ...) +{ + va_list va; + char buf[1024]; + + va_start (va, msg); + vsprintf (buf, msg, va); + if (slang_info_log_message (log, "error", buf)) + return 1; + slang_info_log_memory (log); + va_end (va); + return 0; +} + +int slang_info_log_warning (slang_info_log *log, const char *msg, ...) +{ + va_list va; + char buf[1024]; + + va_start (va, msg); + vsprintf (buf, msg, va); + if (slang_info_log_message (log, "warning", buf)) + return 1; + slang_info_log_memory (log); + va_end (va); + return 0; +} + +void slang_info_log_memory (slang_info_log *log) +{ + if (!slang_info_log_message (log, "error", "out of memory")) + { + log->dont_free_text = 1; + log->text = out_of_memory; + } +} + +/* slang_parse_ctx */ + +typedef struct slang_parse_ctx_ +{ + const byte *I; + slang_info_log *L; + int parsing_builtin; +} slang_parse_ctx; + +/* _slang_compile() */ + +static int parse_identifier (slang_parse_ctx *C, char **id) +{ + *id = slang_string_duplicate ((const char *) C->I); + if (*id == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + C->I += strlen ((const char *) C->I) + 1; + return 1; +} + +static int parse_number (slang_parse_ctx *C, int *number) +{ + const int radix = (int) (*C->I++); + *number = 0; + while (*C->I != '\0') + { + int digit; + if (*C->I >= '0' && *C->I <= '9') + digit = (int) (*C->I - '0'); + else if (*C->I >= 'A' && *C->I <= 'Z') + digit = (int) (*C->I - 'A') + 10; + else + digit = (int) (*C->I - 'a') + 10; + *number = *number * radix + digit; + C->I++; + } + C->I++; + if (*number > 65535) + slang_info_log_warning (C->L, "%d: literal integer overflow", *number); + return 1; +} + +static int parse_float (slang_parse_ctx *C, float *number) +{ + char *integral = NULL; + char *fractional = NULL; + char *exponent = NULL; + char *whole = NULL; + + if (!parse_identifier (C, &integral)) + return 0; + + if (!parse_identifier (C, &fractional)) + { + slang_alloc_free (integral); + return 0; + } + + if (!parse_identifier (C, &exponent)) + { + slang_alloc_free (fractional); + slang_alloc_free (integral); + return 0; + } + + whole = (char *) (slang_alloc_malloc ((strlen (integral) + strlen (fractional) + strlen ( + exponent) + 3) * sizeof (char))); + if (whole == NULL) + { + slang_alloc_free (exponent); + slang_alloc_free (fractional); + slang_alloc_free (integral); + slang_info_log_memory (C->L); + return 0; + } + + slang_string_copy (whole, integral); + slang_string_concat (whole, "."); + slang_string_concat (whole, fractional); + slang_string_concat (whole, "E"); + slang_string_concat (whole, exponent); + + *number = (float) (atof (whole)); + + slang_alloc_free (whole); + slang_alloc_free (exponent); + slang_alloc_free (fractional); + slang_alloc_free (integral); + return 1; +} + +/* revision number - increment after each change affecting emitted output */ +#define REVISION 2 + +static int check_revision (slang_parse_ctx *C) +{ + if (*C->I != REVISION) + { + slang_info_log_error (C->L, "internal compiler error"); + return 0; + } + C->I++; + return 1; +} + +static int parse_statement (slang_parse_ctx *, slang_operation *, slang_variable_scope *, + slang_struct_scope *, slang_function_scope *); +static int parse_expression (slang_parse_ctx *, slang_operation *, slang_variable_scope *, + slang_struct_scope *, slang_function_scope *); + +/* type qualifier */ +#define TYPE_QUALIFIER_NONE 0 +#define TYPE_QUALIFIER_CONST 1 +#define TYPE_QUALIFIER_ATTRIBUTE 2 +#define TYPE_QUALIFIER_VARYING 3 +#define TYPE_QUALIFIER_UNIFORM 4 +#define TYPE_QUALIFIER_FIXEDOUTPUT 5 +#define TYPE_QUALIFIER_FIXEDINPUT 6 + +static int parse_type_qualifier (slang_parse_ctx *C, slang_type_qualifier *qual) +{ + switch (*C->I++) + { + case TYPE_QUALIFIER_NONE: + *qual = slang_qual_none; + break; + case TYPE_QUALIFIER_CONST: + *qual = slang_qual_const; + break; + case TYPE_QUALIFIER_ATTRIBUTE: + *qual = slang_qual_attribute; + break; + case TYPE_QUALIFIER_VARYING: + *qual = slang_qual_varying; + break; + case TYPE_QUALIFIER_UNIFORM: + *qual = slang_qual_uniform; + break; + case TYPE_QUALIFIER_FIXEDOUTPUT: + *qual = slang_qual_fixedoutput; + break; + case TYPE_QUALIFIER_FIXEDINPUT: + *qual = slang_qual_fixedinput; + break; + default: + return 0; + } + return 1; +} + +/* type specifier */ +#define TYPE_SPECIFIER_VOID 0 +#define TYPE_SPECIFIER_BOOL 1 +#define TYPE_SPECIFIER_BVEC2 2 +#define TYPE_SPECIFIER_BVEC3 3 +#define TYPE_SPECIFIER_BVEC4 4 +#define TYPE_SPECIFIER_INT 5 +#define TYPE_SPECIFIER_IVEC2 6 +#define TYPE_SPECIFIER_IVEC3 7 +#define TYPE_SPECIFIER_IVEC4 8 +#define TYPE_SPECIFIER_FLOAT 9 +#define TYPE_SPECIFIER_VEC2 10 +#define TYPE_SPECIFIER_VEC3 11 +#define TYPE_SPECIFIER_VEC4 12 +#define TYPE_SPECIFIER_MAT2 13 +#define TYPE_SPECIFIER_MAT3 14 +#define TYPE_SPECIFIER_MAT4 15 +#define TYPE_SPECIFIER_SAMPLER1D 16 +#define TYPE_SPECIFIER_SAMPLER2D 17 +#define TYPE_SPECIFIER_SAMPLER3D 18 +#define TYPE_SPECIFIER_SAMPLERCUBE 19 +#define TYPE_SPECIFIER_SAMPLER1DSHADOW 20 +#define TYPE_SPECIFIER_SAMPLER2DSHADOW 21 +#define TYPE_SPECIFIER_STRUCT 22 +#define TYPE_SPECIFIER_TYPENAME 23 + +/* structure field */ +#define FIELD_NONE 0 +#define FIELD_NEXT 1 +#define FIELD_ARRAY 2 + +static int parse_type_specifier (slang_parse_ctx *C, slang_type_specifier *spec, + slang_struct_scope *structs, slang_variable_scope *scope, slang_function_scope *funcs) +{ + switch (*C->I++) + { + case TYPE_SPECIFIER_VOID: + spec->type = slang_spec_void; + break; + case TYPE_SPECIFIER_BOOL: + spec->type = slang_spec_bool; + break; + case TYPE_SPECIFIER_BVEC2: + spec->type = slang_spec_bvec2; + break; + case TYPE_SPECIFIER_BVEC3: + spec->type = slang_spec_bvec3; + break; + case TYPE_SPECIFIER_BVEC4: + spec->type = slang_spec_bvec4; + break; + case TYPE_SPECIFIER_INT: + spec->type = slang_spec_int; + break; + case TYPE_SPECIFIER_IVEC2: + spec->type = slang_spec_ivec2; + break; + case TYPE_SPECIFIER_IVEC3: + spec->type = slang_spec_ivec3; + break; + case TYPE_SPECIFIER_IVEC4: + spec->type = slang_spec_ivec4; + break; + case TYPE_SPECIFIER_FLOAT: + spec->type = slang_spec_float; + break; + case TYPE_SPECIFIER_VEC2: + spec->type = slang_spec_vec2; + break; + case TYPE_SPECIFIER_VEC3: + spec->type = slang_spec_vec3; + break; + case TYPE_SPECIFIER_VEC4: + spec->type = slang_spec_vec4; + break; + case TYPE_SPECIFIER_MAT2: + spec->type = slang_spec_mat2; + break; + case TYPE_SPECIFIER_MAT3: + spec->type = slang_spec_mat3; + break; + case TYPE_SPECIFIER_MAT4: + spec->type = slang_spec_mat4; + break; + case TYPE_SPECIFIER_SAMPLER1D: + spec->type = slang_spec_sampler1D; + break; + case TYPE_SPECIFIER_SAMPLER2D: + spec->type = slang_spec_sampler2D; + break; + case TYPE_SPECIFIER_SAMPLER3D: + spec->type = slang_spec_sampler3D; + break; + case TYPE_SPECIFIER_SAMPLERCUBE: + spec->type = slang_spec_samplerCube; + break; + case TYPE_SPECIFIER_SAMPLER1DSHADOW: + spec->type = slang_spec_sampler1DShadow; + break; + case TYPE_SPECIFIER_SAMPLER2DSHADOW: + spec->type = slang_spec_sampler2DShadow; + break; + case TYPE_SPECIFIER_STRUCT: + spec->type = slang_spec_struct; + { + char *name; + if (!parse_identifier (C, &name)) + return 0; + if (*name != '\0' && slang_struct_scope_find (structs, name, 0) != NULL) + { + slang_info_log_error (C->L, "%s: duplicate type name", name); + slang_alloc_free (name); + return 0; + } + spec->_struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct)); + if (spec->_struct == NULL) + { + slang_alloc_free (name); + slang_info_log_memory (C->L); + return 0; + } + if (!slang_struct_construct_a (spec->_struct)) + { + slang_alloc_free (spec->_struct); + spec->_struct = NULL; + slang_alloc_free (name); + slang_info_log_memory (C->L); + return 0; + } + spec->_struct->name = name; + spec->_struct->structs->outer_scope = structs; + } + do + { + slang_type_specifier sp; + slang_type_specifier_construct (&sp); + if (!parse_type_specifier (C, &sp, spec->_struct->structs, scope, funcs)) + { + slang_type_specifier_destruct (&sp); + return 0; + } + do + { + slang_variable *var; + spec->_struct->fields->variables = (slang_variable *) slang_alloc_realloc ( + spec->_struct->fields->variables, + spec->_struct->fields->num_variables * sizeof (slang_variable), + (spec->_struct->fields->num_variables + 1) * sizeof (slang_variable)); + if (spec->_struct->fields->variables == NULL) + { + slang_type_specifier_destruct (&sp); + slang_info_log_memory (C->L); + return 0; + } + var = spec->_struct->fields->variables + spec->_struct->fields->num_variables; + spec->_struct->fields->num_variables++; + slang_variable_construct (var); + if (!slang_type_specifier_copy (&var->type.specifier, &sp)) + { + slang_type_specifier_destruct (&sp); + return 0; + } + if (!parse_identifier (C, &var->name)) + { + slang_type_specifier_destruct (&sp); + return 0; + } + switch (*C->I++) + { + case FIELD_NONE: + break; + case FIELD_ARRAY: + var->array_size = (slang_operation *) slang_alloc_malloc (sizeof ( + slang_operation)); + if (var->array_size == NULL) + { + slang_type_specifier_destruct (&sp); + slang_info_log_memory (C->L); + return 0; + } + if (!slang_operation_construct_a (var->array_size)) + { + slang_alloc_free (var->array_size); + var->array_size = NULL; + slang_type_specifier_destruct (&sp); + slang_info_log_memory (C->L); + return 0; + } + if (!parse_expression (C, var->array_size, scope, structs, funcs)) + { + slang_type_specifier_destruct (&sp); + return 0; + } + break; + default: + return 0; + } + } + while (*C->I++ != FIELD_NONE); + } + while (*C->I++ != FIELD_NONE); + if (*spec->_struct->name != '\0') + { + slang_struct *s; + structs->structs = (slang_struct *) slang_alloc_realloc (structs->structs, + structs->num_structs * sizeof (slang_struct), + (structs->num_structs + 1) * sizeof (slang_struct)); + if (structs->structs == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + s = structs->structs + structs->num_structs; + if (!slang_struct_construct_a (s)) + return 0; + structs->num_structs++; + if (!slang_struct_copy (s, spec->_struct)) + return 0; + } + break; + case TYPE_SPECIFIER_TYPENAME: + spec->type = slang_spec_struct; + { + char *name; + slang_struct *stru; + if (!parse_identifier (C, &name)) + return 0; + stru = slang_struct_scope_find (structs, name, 1); + if (stru == NULL) + { + slang_info_log_error (C->L, "%s: undeclared type name", name); + slang_alloc_free (name); + return 0; + } + slang_alloc_free (name); + spec->_struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct)); + if (spec->_struct == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + if (!slang_struct_construct_a (spec->_struct)) + { + slang_alloc_free (spec->_struct); + spec->_struct = NULL; + return 0; + } + if (!slang_struct_copy (spec->_struct, stru)) + return 0; + } + break; + default: + return 0; + } + return 1; +} + +static int parse_fully_specified_type (slang_parse_ctx *C, slang_fully_specified_type *type, + slang_struct_scope *structs, slang_variable_scope *scope, slang_function_scope *funcs) +{ + if (!parse_type_qualifier (C, &type->qualifier)) + return 0; + return parse_type_specifier (C, &type->specifier, structs, scope, funcs); +} + +/* operation */ +#define OP_END 0 +#define OP_BLOCK_BEGIN_NO_NEW_SCOPE 1 +#define OP_BLOCK_BEGIN_NEW_SCOPE 2 +#define OP_DECLARE 3 +#define OP_ASM 4 +#define OP_BREAK 5 +#define OP_CONTINUE 6 +#define OP_DISCARD 7 +#define OP_RETURN 8 +#define OP_EXPRESSION 9 +#define OP_IF 10 +#define OP_WHILE 11 +#define OP_DO 12 +#define OP_FOR 13 +#define OP_PUSH_VOID 14 +#define OP_PUSH_BOOL 15 +#define OP_PUSH_INT 16 +#define OP_PUSH_FLOAT 17 +#define OP_PUSH_IDENTIFIER 18 +#define OP_SEQUENCE 19 +#define OP_ASSIGN 20 +#define OP_ADDASSIGN 21 +#define OP_SUBASSIGN 22 +#define OP_MULASSIGN 23 +#define OP_DIVASSIGN 24 +/*#define OP_MODASSIGN 25*/ +/*#define OP_LSHASSIGN 26*/ +/*#define OP_RSHASSIGN 27*/ +/*#define OP_ORASSIGN 28*/ +/*#define OP_XORASSIGN 29*/ +/*#define OP_ANDASSIGN 30*/ +#define OP_SELECT 31 +#define OP_LOGICALOR 32 +#define OP_LOGICALXOR 33 +#define OP_LOGICALAND 34 +/*#define OP_BITOR 35*/ +/*#define OP_BITXOR 36*/ +/*#define OP_BITAND 37*/ +#define OP_EQUAL 38 +#define OP_NOTEQUAL 39 +#define OP_LESS 40 +#define OP_GREATER 41 +#define OP_LESSEQUAL 42 +#define OP_GREATEREQUAL 43 +/*#define OP_LSHIFT 44*/ +/*#define OP_RSHIFT 45*/ +#define OP_ADD 46 +#define OP_SUBTRACT 47 +#define OP_MULTIPLY 48 +#define OP_DIVIDE 49 +/*#define OP_MODULUS 50*/ +#define OP_PREINCREMENT 51 +#define OP_PREDECREMENT 52 +#define OP_PLUS 53 +#define OP_MINUS 54 +/*#define OP_COMPLEMENT 55*/ +#define OP_NOT 56 +#define OP_SUBSCRIPT 57 +#define OP_CALL 58 +#define OP_FIELD 59 +#define OP_POSTINCREMENT 60 +#define OP_POSTDECREMENT 61 + +static int parse_child_operation (slang_parse_ctx *C, slang_operation *oper, int statement, + slang_variable_scope *scope, slang_struct_scope *structs, slang_function_scope *funcs) +{ + oper->children = (slang_operation *) slang_alloc_realloc (oper->children, + oper->num_children * sizeof (slang_operation), + (oper->num_children + 1) * sizeof (slang_operation)); + if (oper->children == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + if (!slang_operation_construct_a (oper->children + oper->num_children)) + { + slang_info_log_memory (C->L); + return 0; + } + oper->num_children++; + if (statement) + return parse_statement (C, oper->children + oper->num_children - 1, scope, structs, funcs); + return parse_expression (C, oper->children + oper->num_children - 1, scope, structs, funcs); +} + +static int parse_declaration (slang_parse_ctx *C, slang_variable_scope *, slang_struct_scope *, + slang_function_scope *); + +static int parse_statement (slang_parse_ctx *C, slang_operation *oper, slang_variable_scope *scope, + slang_struct_scope *structs, slang_function_scope *funcs) +{ + oper->locals->outer_scope = scope; + switch (*C->I++) + { + case OP_BLOCK_BEGIN_NO_NEW_SCOPE: + oper->type = slang_oper_block_no_new_scope; + while (*C->I != OP_END) + if (!parse_child_operation (C, oper, 1, scope, structs, funcs)) + return 0; + C->I++; + break; + case OP_BLOCK_BEGIN_NEW_SCOPE: + oper->type = slang_oper_block_new_scope; + while (*C->I != OP_END) + if (!parse_child_operation (C, oper, 1, oper->locals, structs, funcs)) + return 0; + C->I++; + break; + case OP_DECLARE: + oper->type = slang_oper_variable_decl; + { + const unsigned int first_var = scope->num_variables; + if (!parse_declaration (C, scope, structs, funcs)) + return 0; + if (first_var < scope->num_variables) + { + const unsigned int num_vars = scope->num_variables - first_var; + unsigned int i; + oper->children = (slang_operation *) slang_alloc_malloc (num_vars * sizeof ( + slang_operation)); + if (oper->children == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + for (i = 0; i < num_vars; i++) + if (!slang_operation_construct_a (oper->children + i)) + { + unsigned int j; + for (j = 0; j < i; j++) + slang_operation_destruct (oper->children + j); + slang_alloc_free (oper->children); + oper->children = NULL; + slang_info_log_memory (C->L); + return 0; + } + oper->num_children = num_vars; + for (i = first_var; i < scope->num_variables; i++) + { + slang_operation *o = oper->children + i - first_var; + o->type = slang_oper_identifier; + o->locals->outer_scope = scope; + o->identifier = slang_string_duplicate (scope->variables[i].name); + if (o->identifier == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + } + } + } + break; + case OP_ASM: + oper->type = slang_oper_asm; + if (!parse_identifier (C, &oper->identifier)) + return 0; + while (*C->I != OP_END) + if (!parse_child_operation (C, oper, 0, scope, structs, funcs)) + return 0; + C->I++; + break; + case OP_BREAK: + oper->type = slang_oper_break; + break; + case OP_CONTINUE: + oper->type = slang_oper_continue; + break; + case OP_DISCARD: + oper->type = slang_oper_discard; + break; + case OP_RETURN: + oper->type = slang_oper_return; + if (!parse_child_operation (C, oper, 0, scope, structs, funcs)) + return 0; + break; + case OP_EXPRESSION: + oper->type = slang_oper_expression; + if (!parse_child_operation (C, oper, 0, scope, structs, funcs)) + return 0; + break; + case OP_IF: + oper->type = slang_oper_if; + if (!parse_child_operation (C, oper, 0, scope, structs, funcs)) + return 0; + if (!parse_child_operation (C, oper, 1, scope, structs, funcs)) + return 0; + if (!parse_child_operation (C, oper, 1, scope, structs, funcs)) + return 0; + break; + case OP_WHILE: + oper->type = slang_oper_while; + if (!parse_child_operation (C, oper, 1, oper->locals, structs, funcs)) + return 0; + if (!parse_child_operation (C, oper, 1, oper->locals, structs, funcs)) + return 0; + break; + case OP_DO: + oper->type = slang_oper_do; + if (!parse_child_operation (C, oper, 1, scope, structs, funcs)) + return 0; + if (!parse_child_operation (C, oper, 0, scope, structs, funcs)) + return 0; + break; + case OP_FOR: + oper->type = slang_oper_for; + if (!parse_child_operation (C, oper, 1, oper->locals, structs, funcs)) + return 0; + if (!parse_child_operation (C, oper, 1, oper->locals, structs, funcs)) + return 0; + if (!parse_child_operation (C, oper, 0, oper->locals, structs, funcs)) + return 0; + if (!parse_child_operation (C, oper, 1, oper->locals, structs, funcs)) + return 0; + break; + default: + return 0; + } + return 1; +} + +static int handle_trinary_expression (slang_parse_ctx *C, slang_operation *op, + slang_operation **ops, unsigned int *num_ops) +{ + op->num_children = 3; + op->children = (slang_operation *) slang_alloc_malloc (3 * sizeof (slang_operation)); + if (op->children == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + op->children[0] = (*ops)[*num_ops - 4]; + op->children[1] = (*ops)[*num_ops - 3]; + op->children[2] = (*ops)[*num_ops - 2]; + (*ops)[*num_ops - 4] = (*ops)[*num_ops - 1]; + *num_ops -= 3; + *ops = (slang_operation *) slang_alloc_realloc (*ops, (*num_ops + 3) * sizeof (slang_operation), + *num_ops * sizeof (slang_operation)); + if (*ops == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + return 1; +} + +static int handle_binary_expression (slang_parse_ctx *C, slang_operation *op, + slang_operation **ops, unsigned int *num_ops) +{ + op->num_children = 2; + op->children = (slang_operation *) slang_alloc_malloc (2 * sizeof (slang_operation)); + if (op->children == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + op->children[0] = (*ops)[*num_ops - 3]; + op->children[1] = (*ops)[*num_ops - 2]; + (*ops)[*num_ops - 3] = (*ops)[*num_ops - 1]; + *num_ops -= 2; + *ops = (slang_operation *) slang_alloc_realloc (*ops, (*num_ops + 2) * sizeof (slang_operation), + *num_ops * sizeof (slang_operation)); + if (*ops == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + return 1; +} + +static int handle_unary_expression (slang_parse_ctx *C, slang_operation *op, + slang_operation **ops, unsigned int *num_ops) +{ + op->num_children = 1; + op->children = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation)); + if (op->children == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + op->children[0] = (*ops)[*num_ops - 2]; + (*ops)[*num_ops - 2] = (*ops)[*num_ops - 1]; + (*num_ops)--; + *ops = (slang_operation *) slang_alloc_realloc (*ops, (*num_ops + 1) * sizeof (slang_operation), + *num_ops * sizeof (slang_operation)); + if (*ops == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + return 1; +} + +static int is_constructor_name (const char *name, slang_struct_scope *structs) +{ + if (slang_type_specifier_type_from_string (name) != slang_spec_void) + return 1; + return slang_struct_scope_find (structs, name, 1) != NULL; +} + +static int parse_expression (slang_parse_ctx *C, slang_operation *oper, slang_variable_scope *scope, + slang_struct_scope *structs, slang_function_scope *funcs) +{ + slang_operation *ops = NULL; + unsigned int num_ops = 0; + int number; + + while (*C->I != OP_END) + { + slang_operation *op; + const unsigned int op_code = *C->I++; + ops = (slang_operation *) slang_alloc_realloc (ops, + num_ops * sizeof (slang_operation), (num_ops + 1) * sizeof (slang_operation)); + if (ops == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + op = ops + num_ops; + if (!slang_operation_construct_a (op)) + { + slang_info_log_memory (C->L); + return 0; + } + num_ops++; + op->locals->outer_scope = scope; + switch (op_code) + { + case OP_PUSH_VOID: + op->type = slang_oper_void; + break; + case OP_PUSH_BOOL: + op->type = slang_oper_literal_bool; + if (!parse_number (C, &number)) + return 0; + op->literal = (float) number; + break; + case OP_PUSH_INT: + op->type = slang_oper_literal_int; + if (!parse_number (C, &number)) + return 0; + op->literal = (float) number; + break; + case OP_PUSH_FLOAT: + op->type = slang_oper_literal_float; + if (!parse_float (C, &op->literal)) + return 0; + break; + case OP_PUSH_IDENTIFIER: + op->type = slang_oper_identifier; + if (!parse_identifier (C, &op->identifier)) + return 0; + break; + case OP_SEQUENCE: + op->type = slang_oper_sequence; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_ASSIGN: + op->type = slang_oper_assign; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_ADDASSIGN: + op->type = slang_oper_addassign; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_SUBASSIGN: + op->type = slang_oper_subassign; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_MULASSIGN: + op->type = slang_oper_mulassign; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_DIVASSIGN: + op->type = slang_oper_divassign; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + /*case OP_MODASSIGN:*/ + /*case OP_LSHASSIGN:*/ + /*case OP_RSHASSIGN:*/ + /*case OP_ORASSIGN:*/ + /*case OP_XORASSIGN:*/ + /*case OP_ANDASSIGN:*/ + case OP_SELECT: + op->type = slang_oper_select; + if (!handle_trinary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_LOGICALOR: + op->type = slang_oper_logicalor; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_LOGICALXOR: + op->type = slang_oper_logicalxor; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_LOGICALAND: + op->type = slang_oper_logicaland; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + /*case OP_BITOR:*/ + /*case OP_BITXOR:*/ + /*case OP_BITAND:*/ + case OP_EQUAL: + op->type = slang_oper_equal; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_NOTEQUAL: + op->type = slang_oper_notequal; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_LESS: + op->type = slang_oper_less; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_GREATER: + op->type = slang_oper_greater; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_LESSEQUAL: + op->type = slang_oper_lessequal; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_GREATEREQUAL: + op->type = slang_oper_greaterequal; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + /*case OP_LSHIFT:*/ + /*case OP_RSHIFT:*/ + case OP_ADD: + op->type = slang_oper_add; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_SUBTRACT: + op->type = slang_oper_subtract; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_MULTIPLY: + op->type = slang_oper_multiply; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_DIVIDE: + op->type = slang_oper_divide; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + /*case OP_MODULUS:*/ + case OP_PREINCREMENT: + op->type = slang_oper_preincrement; + if (!handle_unary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_PREDECREMENT: + op->type = slang_oper_predecrement; + if (!handle_unary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_PLUS: + op->type = slang_oper_plus; + if (!handle_unary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_MINUS: + op->type = slang_oper_minus; + if (!handle_unary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_NOT: + op->type = slang_oper_not; + if (!handle_unary_expression (C, op, &ops, &num_ops)) + return 0; + break; + /*case OP_COMPLEMENT:*/ + case OP_SUBSCRIPT: + op->type = slang_oper_subscript; + if (!handle_binary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_CALL: + op->type = slang_oper_call; + if (!parse_identifier (C, &op->identifier)) + return 0; + while (*C->I != OP_END) + if (!parse_child_operation (C, op, 0, scope, structs, funcs)) + return 0; + C->I++; + if (!C->parsing_builtin && + !slang_function_scope_find_by_name (funcs, op->identifier, 1) && + !is_constructor_name (op->identifier, structs)) + { + slang_info_log_error (C->L, "%s: undeclared function name", op->identifier); + return 0; + } + break; + case OP_FIELD: + op->type = slang_oper_field; + if (!parse_identifier (C, &op->identifier)) + return 0; + if (!handle_unary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_POSTINCREMENT: + op->type = slang_oper_postincrement; + if (!handle_unary_expression (C, op, &ops, &num_ops)) + return 0; + break; + case OP_POSTDECREMENT: + op->type = slang_oper_postdecrement; + if (!handle_unary_expression (C, op, &ops, &num_ops)) + return 0; + break; + default: + return 0; + } + } + C->I++; + *oper = *ops; + slang_alloc_free (ops); + return 1; +} + +/* parameter qualifier */ +#define PARAM_QUALIFIER_IN 0 +#define PARAM_QUALIFIER_OUT 1 +#define PARAM_QUALIFIER_INOUT 2 + +/* function parameter array presence */ +#define PARAMETER_ARRAY_NOT_PRESENT 0 +#define PARAMETER_ARRAY_PRESENT 1 + +static int parse_parameter_declaration (slang_parse_ctx *C, slang_variable *param, + slang_struct_scope *structs, slang_variable_scope *scope, slang_function_scope *funcs) +{ + slang_storage_aggregate agg; + if (!parse_type_qualifier (C, ¶m->type.qualifier)) + return 0; + switch (*C->I++) + { + case PARAM_QUALIFIER_IN: + if (param->type.qualifier != slang_qual_const && param->type.qualifier != slang_qual_none) + { + slang_info_log_error (C->L, "invalid type qualifier"); + return 0; + } + break; + case PARAM_QUALIFIER_OUT: + if (param->type.qualifier == slang_qual_none) + param->type.qualifier = slang_qual_out; + else + { + slang_info_log_error (C->L, "invalid type qualifier"); + return 0; + } + break; + case PARAM_QUALIFIER_INOUT: + if (param->type.qualifier == slang_qual_none) + param->type.qualifier = slang_qual_inout; + else + { + slang_info_log_error (C->L, "invalid type qualifier"); + return 0; + } + break; + default: + return 0; + } + if (!parse_type_specifier (C, ¶m->type.specifier, structs, scope, funcs)) + return 0; + if (!parse_identifier (C, ¶m->name)) + return 0; + if (*C->I++ == PARAMETER_ARRAY_PRESENT) + { + param->array_size = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation)); + if (param->array_size == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + if (!slang_operation_construct_a (param->array_size)) + { + slang_alloc_free (param->array_size); + param->array_size = NULL; + slang_info_log_memory (C->L); + return 0; + } + if (!parse_expression (C, param->array_size, scope, structs, funcs)) + return 0; + } + slang_storage_aggregate_construct (&agg); + if (!_slang_aggregate_variable (&agg, ¶m->type.specifier, param->array_size, funcs, + structs)) + { + slang_storage_aggregate_destruct (&agg); + return 0; + } + slang_storage_aggregate_destruct (&agg); + return 1; +} + +/* function type */ +#define FUNCTION_ORDINARY 0 +#define FUNCTION_CONSTRUCTOR 1 +#define FUNCTION_OPERATOR 2 + +/* function parameter */ +#define PARAMETER_NONE 0 +#define PARAMETER_NEXT 1 + +/* operator type */ +#define OPERATOR_ASSIGN 1 +#define OPERATOR_ADDASSIGN 2 +#define OPERATOR_SUBASSIGN 3 +#define OPERATOR_MULASSIGN 4 +#define OPERATOR_DIVASSIGN 5 +/*#define OPERATOR_MODASSIGN 6*/ +/*#define OPERATOR_LSHASSIGN 7*/ +/*#define OPERATOR_RSHASSIGN 8*/ +/*#define OPERATOR_ANDASSIGN 9*/ +/*#define OPERATOR_XORASSIGN 10*/ +/*#define OPERATOR_ORASSIGN 11*/ +#define OPERATOR_LOGICALXOR 12 +/*#define OPERATOR_BITOR 13*/ +/*#define OPERATOR_BITXOR 14*/ +/*#define OPERATOR_BITAND 15*/ +#define OPERATOR_EQUAL 16 +#define OPERATOR_NOTEQUAL 17 +#define OPERATOR_LESS 18 +#define OPERATOR_GREATER 19 +#define OPERATOR_LESSEQUAL 20 +#define OPERATOR_GREATEREQUAL 21 +/*#define OPERATOR_LSHIFT 22*/ +/*#define OPERATOR_RSHIFT 23*/ +#define OPERATOR_MULTIPLY 24 +#define OPERATOR_DIVIDE 25 +/*#define OPERATOR_MODULUS 26*/ +#define OPERATOR_INCREMENT 27 +#define OPERATOR_DECREMENT 28 +#define OPERATOR_PLUS 29 +#define OPERATOR_MINUS 30 +/*#define OPERATOR_COMPLEMENT 31*/ +#define OPERATOR_NOT 32 + +static const struct { + unsigned int o_code; + const char *o_name; +} operator_names[] = { + { OPERATOR_INCREMENT, "++" }, + { OPERATOR_ADDASSIGN, "+=" }, + { OPERATOR_PLUS, "+" }, + { OPERATOR_DECREMENT, "--" }, + { OPERATOR_SUBASSIGN, "-=" }, + { OPERATOR_MINUS, "-" }, + { OPERATOR_NOTEQUAL, "!=" }, + { OPERATOR_NOT, "!" }, + { OPERATOR_MULASSIGN, "*=" }, + { OPERATOR_MULTIPLY, "*" }, + { OPERATOR_DIVASSIGN, "/=" }, + { OPERATOR_DIVIDE, "/" }, + { OPERATOR_LESSEQUAL, "<=" }, + /*{ OPERATOR_LSHASSIGN, "<<=" },*/ + /*{ OPERATOR_LSHIFT, "<<" },*/ + { OPERATOR_LESS, "<" }, + { OPERATOR_GREATEREQUAL, ">=" }, + /*{ OPERATOR_RSHASSIGN, ">>=" },*/ + /*{ OPERATOR_RSHIFT, ">>" },*/ + { OPERATOR_GREATER, ">" }, + { OPERATOR_EQUAL, "==" }, + { OPERATOR_ASSIGN, "=" }, + /*{ OPERATOR_MODASSIGN, "%=" },*/ + /*{ OPERATOR_MODULUS, "%" },*/ + /*{ OPERATOR_ANDASSIGN, "&=" },*/ + /*{ OPERATOR_BITAND, "&" },*/ + /*{ OPERATOR_ORASSIGN, "|=" },*/ + /*{ OPERATOR_BITOR, "|" },*/ + /*{ OPERATOR_COMPLEMENT, "~" },*/ + /*{ OPERATOR_XORASSIGN, "^=" },*/ + { OPERATOR_LOGICALXOR, "^^" }/*,*/ + /*{ OPERATOR_BITXOR, "^" }*/ +}; + +static int parse_operator_name (slang_parse_ctx *C, char **pname) +{ + unsigned int i; + for (i = 0; i < sizeof (operator_names) / sizeof (*operator_names); i++) + if (operator_names[i].o_code == (unsigned int) (*C->I)) + { + *pname = slang_string_duplicate (operator_names[i].o_name); + if (*pname == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + C->I++; + return 1; + } + return 0; +} + +static int parse_function_prototype (slang_parse_ctx *C, slang_function *func, + slang_struct_scope *structs, slang_variable_scope *scope, slang_function_scope *funcs) +{ + if (!parse_fully_specified_type (C, &func->header.type, structs, scope, funcs)) + return 0; + switch (*C->I++) + { + case FUNCTION_ORDINARY: + func->kind = slang_func_ordinary; + if (!parse_identifier (C, &func->header.name)) + return 0; + break; + case FUNCTION_CONSTRUCTOR: + func->kind = slang_func_constructor; + if (func->header.type.specifier.type == slang_spec_struct) + return 0; + func->header.name = slang_string_duplicate ( + type_specifier_type_names[func->header.type.specifier.type]); + if (func->header.name == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + break; + case FUNCTION_OPERATOR: + func->kind = slang_func_operator; + if (!parse_operator_name (C, &func->header.name)) + return 0; + break; + default: + return 0; + } + func->parameters->outer_scope = scope; + while (*C->I++ == PARAMETER_NEXT) + { + func->parameters->variables = (slang_variable *) slang_alloc_realloc ( + func->parameters->variables, + func->parameters->num_variables * sizeof (slang_variable), + (func->parameters->num_variables + 1) * sizeof (slang_variable)); + if (func->parameters->variables == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + slang_variable_construct (func->parameters->variables + func->parameters->num_variables); + func->parameters->num_variables++; + if (!parse_parameter_declaration (C, func->parameters->variables + + func->parameters->num_variables - 1, structs, scope, funcs)) + return 0; + } + func->param_count = func->parameters->num_variables; + return 1; +} + +static int parse_function_definition (slang_parse_ctx *C, slang_function *func, + slang_struct_scope *structs, slang_variable_scope *scope, slang_function_scope *funcs) +{ + if (!parse_function_prototype (C, func, structs, scope, funcs)) + return 0; + func->body = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation)); + if (func->body == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + if (!slang_operation_construct_a (func->body)) + { + slang_alloc_free (func->body); + func->body = NULL; + slang_info_log_memory (C->L); + return 0; + } + if (!parse_statement (C, func->body, func->parameters, structs, funcs)) + return 0; + return 1; +} + +/* init declarator list */ +#define DECLARATOR_NONE 0 +#define DECLARATOR_NEXT 1 + +/* variable declaration */ +#define VARIABLE_NONE 0 +#define VARIABLE_IDENTIFIER 1 +#define VARIABLE_INITIALIZER 2 +#define VARIABLE_ARRAY_EXPLICIT 3 +#define VARIABLE_ARRAY_UNKNOWN 4 + +static int parse_init_declarator (slang_parse_ctx *C, const slang_fully_specified_type *type, + slang_variable_scope *vars, slang_struct_scope *structs, slang_function_scope *funcs) +{ + slang_variable *var; + + if (*C->I++ == VARIABLE_NONE) + return 1; + vars->variables = (slang_variable *) slang_alloc_realloc (vars->variables, + vars->num_variables * sizeof (slang_variable), + (vars->num_variables + 1) * sizeof (slang_variable)); + if (vars->variables == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + var = vars->variables + vars->num_variables; + vars->num_variables++; + slang_variable_construct (var); + var->type.qualifier = type->qualifier; + if (!parse_identifier (C, &var->name)) + return 0; + switch (*C->I++) + { + case VARIABLE_NONE: + if (!slang_type_specifier_copy (&var->type.specifier, &type->specifier)) + return 0; + break; + case VARIABLE_INITIALIZER: + if (!slang_type_specifier_copy (&var->type.specifier, &type->specifier)) + return 0; + var->initializer = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation)); + if (var->initializer == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + if (!slang_operation_construct_a (var->initializer)) + { + slang_alloc_free (var->initializer); + var->initializer = NULL; + slang_info_log_memory (C->L); + return 0; + } + if (!parse_expression (C, var->initializer, vars, structs, funcs)) + return 0; + break; + case VARIABLE_ARRAY_UNKNOWN: + var->type.specifier.type = slang_spec_array; + var->type.specifier._array = (slang_type_specifier *) slang_alloc_malloc (sizeof ( + slang_type_specifier)); + if (var->type.specifier._array == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + slang_type_specifier_construct (var->type.specifier._array); + if (!slang_type_specifier_copy (var->type.specifier._array, &type->specifier)) + return 0; + break; + case VARIABLE_ARRAY_EXPLICIT: + var->type.specifier.type = slang_spec_array; + var->type.specifier._array = (slang_type_specifier *) slang_alloc_malloc (sizeof ( + slang_type_specifier)); + if (var->type.specifier._array == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + slang_type_specifier_construct (var->type.specifier._array); + if (!slang_type_specifier_copy (var->type.specifier._array, &type->specifier)) + return 0; + var->array_size = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation)); + if (var->array_size == NULL) + { + slang_info_log_memory (C->L); + return 0; + } + if (!slang_operation_construct_a (var->array_size)) + { + slang_alloc_free (var->array_size); + var->array_size = NULL; + slang_info_log_memory (C->L); + return 0; + } + if (!parse_expression (C, var->array_size, vars, structs, funcs)) + return 0; + break; + default: + return 0; + } + if (!(var->type.specifier.type == slang_spec_array && var->array_size == NULL)) + { + slang_storage_aggregate agg; + + slang_storage_aggregate_construct (&agg); + if (!_slang_aggregate_variable (&agg, &var->type.specifier, var->array_size, funcs, + structs)) + { + slang_storage_aggregate_destruct (&agg); + return 0; + } + slang_storage_aggregate_destruct (&agg); + } + return 1; +} + +static int parse_init_declarator_list (slang_parse_ctx *C, slang_variable_scope *vars, + slang_struct_scope *structs, slang_function_scope *funcs) +{ + slang_fully_specified_type type; + + slang_fully_specified_type_construct (&type); + if (!parse_fully_specified_type (C, &type, structs, vars, funcs)) + { + slang_fully_specified_type_destruct (&type); + return 0; + } + do + { + if (!parse_init_declarator (C, &type, vars, structs, funcs)) + { + slang_fully_specified_type_destruct (&type); + return 0; + } + } + while (*C->I++ == DECLARATOR_NEXT); + slang_fully_specified_type_destruct (&type); + return 1; +} + +static int parse_function (slang_parse_ctx *C, int definition, slang_struct_scope *structs, + slang_function_scope *funcs, slang_variable_scope *scope, slang_function **parsed_func_ret) +{ + slang_function parsed_func, *found_func; + + /* parse function definition/declaration */ + slang_function_construct (&parsed_func); + if (definition) + { + if (!parse_function_definition (C, &parsed_func, structs, scope, funcs)) + { + slang_function_destruct (&parsed_func); + return 0; + } + } + else + { + if (!parse_function_prototype (C, &parsed_func, structs, scope, funcs)) + { + slang_function_destruct (&parsed_func); + return 0; + } + } + + /* find a function with a prototype matching the parsed one - only the current scope + is being searched to allow built-in function overriding */ + found_func = slang_function_scope_find (funcs, &parsed_func, 0); + if (found_func == NULL) + { + /* add the parsed function to the function list */ + funcs->functions = (slang_function *) slang_alloc_realloc (funcs->functions, + funcs->num_functions * sizeof (slang_function), (funcs->num_functions + 1) * sizeof ( + slang_function)); + if (funcs->functions == NULL) + { + slang_info_log_memory (C->L); + slang_function_destruct (&parsed_func); + return 0; + } + funcs->functions[funcs->num_functions] = parsed_func; + funcs->num_functions++; + + /* return the newly parsed function */ + *parsed_func_ret = funcs->functions + funcs->num_functions - 1; + } + else + { + /* TODO: check function return type qualifiers and specifiers */ + if (definition) + { + /* destroy the existing function declaration and replace it with the new one */ + if (found_func->body != NULL) + { + slang_info_log_error (C->L, "%s: function already has a body", + parsed_func.header.name); + slang_function_destruct (&parsed_func); + return 0; + } + slang_function_destruct (found_func); + *found_func = parsed_func; + } + else + { + /* another declaration of the same function prototype - ignore it */ + slang_function_destruct (&parsed_func); + } + + /* return the found function */ + *parsed_func_ret = found_func; + } + + /* assemble the parsed function */ + if (definition) + { +static int x = 0; +static + slang_assembly_file file; + slang_assembly_name_space space; +x++; +if (x == 1) + slang_assembly_file_construct (&file); + space.funcs = funcs; + space.structs = structs; + space.vars = scope; +if (x == 1) +xxx_first (&file); + (**parsed_func_ret).address = file.count; + if (!_slang_assemble_function (&file, *parsed_func_ret, &space)) + { + slang_assembly_file_destruct (&file); + return 0; + } +if (slang_string_compare ("main", (**parsed_func_ret).header.name) == 0) +{ +xxx_prolog (&file, (**parsed_func_ret).address); +_slang_execute (&file); +slang_assembly_file_destruct (&file); +exit (0); +} + } + return 1; +} + +/* declaration */ +#define DECLARATION_FUNCTION_PROTOTYPE 1 +#define DECLARATION_INIT_DECLARATOR_LIST 2 + +static int parse_declaration (slang_parse_ctx *C, slang_variable_scope *scope, + slang_struct_scope *structs, slang_function_scope *funcs) +{ + slang_function *dummy_func; + + switch (*C->I++) + { + case DECLARATION_INIT_DECLARATOR_LIST: + if (!parse_init_declarator_list (C, scope, structs, funcs)) + return 0; + break; + case DECLARATION_FUNCTION_PROTOTYPE: + if (!parse_function (C, 0, structs, funcs, scope, &dummy_func)) + return 0; + break; + default: + return 0; + } + return 1; +} + +/* external declaration */ +#define EXTERNAL_NULL 0 +#define EXTERNAL_FUNCTION_DEFINITION 1 +#define EXTERNAL_DECLARATION 2 + +static int parse_translation_unit (slang_parse_ctx *C, slang_translation_unit *unit) +{ + while (*C->I != EXTERNAL_NULL) + { + slang_function *func; + + switch (*C->I++) + { + case EXTERNAL_FUNCTION_DEFINITION: + if (!parse_function (C, 1, &unit->structs, &unit->functions, &unit->globals, &func)) + return 0; + break; + case EXTERNAL_DECLARATION: + if (!parse_declaration (C, &unit->globals, &unit->structs, &unit->functions)) + return 0; + break; + default: + return 0; + } + } + C->I++; + return 1; +} + +static int compile_binary (const byte *prod, slang_translation_unit *unit, slang_unit_type type, + slang_info_log *log, slang_translation_unit *builtins) +{ + slang_parse_ctx C; + + /* set-up parse context */ + C.I = prod; + C.L = log; + C.parsing_builtin = builtins == NULL; + + if (!check_revision (&C)) + return 0; + + /* create translation unit object */ + slang_translation_unit_construct (unit); + unit->type = type; + + if (builtins != NULL) + { + /* link to built-in functions */ + builtins[1].functions.outer_scope = &builtins[0].functions; + builtins[2].functions.outer_scope = &builtins[1].functions; + unit->functions.outer_scope = &builtins[2].functions; + + /* link to built-in variables - core unit does not define any */ + builtins[2].globals.outer_scope = &builtins[1].globals; + unit->globals.outer_scope = &builtins[2].globals; + + /* link to built-in structure typedefs - only in common unit */ + unit->structs.outer_scope = &builtins[1].structs; + } + + /* parse translation unit */ + if (!parse_translation_unit (&C, unit)) + { + slang_translation_unit_destruct (unit); + return 0; + } + + return 1; +} + +static int compile_with_grammar (grammar id, const char *source, slang_translation_unit *unit, + slang_unit_type type, slang_info_log *log, slang_translation_unit *builtins) +{ + byte *prod; + unsigned int size, start, version; + + /* retrieve version */ + if (!_slang_preprocess_version (source, &version, &start, log)) + return 0; + + /* check the syntax */ + if (!grammar_fast_check (id, (const byte *) source + start, &prod, &size, 65536)) + { + char buf[1024]; + unsigned int pos; + grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos); + slang_info_log_error (log, buf); + return 0; + } + + if (!compile_binary (prod, unit, type, log, builtins)) + { + grammar_alloc_free (prod); + return 0; + } + + grammar_alloc_free (prod); + return 1; +} + +static const char *slang_shader_syn = +#include "library/slang_shader_syn.h" +; +/* +static const byte slang_core_gc_bin[] = { +#include "library/slang_core_gc_bin.h" +};*/ +static const byte slang_core_gc[] = { +#include "library/slang_core_gc.h" +}; + +static const byte slang_common_builtin_gc_bin[] = { +#include "library/slang_common_builtin_gc_bin.h" +}; + +static const byte slang_fragment_builtin_gc_bin[] = { +#include "library/slang_fragment_builtin_gc_bin.h" +}; + +static const byte slang_vertex_builtin_gc_bin[] = { +#include "library/slang_vertex_builtin_gc_bin.h" +}; + +int _slang_compile (const char *source, slang_translation_unit *unit, slang_unit_type type, + slang_info_log *log) +{ + grammar id; + slang_translation_unit builtin_units[3]; + slang_translation_unit *builtins = NULL; + + /* load slang grammar */ + id = grammar_load_from_text ((const byte *) slang_shader_syn); + if (id == 0) + { + char buf[1024]; + unsigned int pos; + grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos); + slang_info_log_error (log, buf); + return 0; + } + + /* set shader type - the syntax is slightly different for different shaders */ + if (type == slang_unit_fragment_shader || type == slang_unit_fragment_builtin) + grammar_set_reg8 (id, (const byte *) "shader_type", 1); + else + grammar_set_reg8 (id, (const byte *) "shader_type", 2); + + /* enable language extensions */ + grammar_set_reg8 (id, (const byte *) "parsing_builtin", 1); + + /* if parsing user-specified shader, load built-in library */ + if (type == slang_unit_fragment_shader || type == slang_unit_vertex_shader) + { + /*if (!compile_binary (slang_core_gc_bin, builtin_units, + slang_unit_fragment_builtin, log, NULL))*/ + if (!compile_with_grammar (id, (const char*) slang_core_gc, builtin_units, slang_unit_fragment_builtin, + log, NULL)) + { + grammar_destroy (id); + return 0; + } + if (!compile_binary (slang_common_builtin_gc_bin, builtin_units + 1, + slang_unit_fragment_builtin, log, NULL)) + { + slang_translation_unit_destruct (builtin_units); + grammar_destroy (id); + return 0; + } + if (type == slang_unit_fragment_shader) + { + if (!compile_binary (slang_fragment_builtin_gc_bin, builtin_units + 2, + slang_unit_fragment_builtin, log, NULL)) + { + slang_translation_unit_destruct (builtin_units); + slang_translation_unit_destruct (builtin_units + 1); + grammar_destroy (id); + return 0; + } + } + else if (type == slang_unit_vertex_shader) + { + if (!compile_binary (slang_vertex_builtin_gc_bin, builtin_units + 2, + slang_unit_vertex_builtin, log, NULL)) + { + slang_translation_unit_destruct (builtin_units); + slang_translation_unit_destruct (builtin_units + 1); + grammar_destroy (id); + return 0; + } + } + + /* disable language extensions */ + grammar_set_reg8 (id, (const byte *) "parsing_builtin", 0); + builtins = builtin_units; + } + + /* compile the actual shader - pass-in built-in library for external shader */ + if (!compile_with_grammar (id, source, unit, type, log, builtins)) + { + if (type == slang_unit_fragment_shader || type == slang_unit_vertex_shader) + { + slang_translation_unit_destruct (builtin_units); + slang_translation_unit_destruct (builtin_units + 1); + slang_translation_unit_destruct (builtin_units + 2); + } + grammar_destroy (id); + return 0; + } + + /* destroy built-in library */ + if (type == slang_unit_fragment_shader || type == slang_unit_vertex_shader) + { + slang_translation_unit_destruct (builtin_units); + slang_translation_unit_destruct (builtin_units + 1); + slang_translation_unit_destruct (builtin_units + 2); + } + grammar_destroy (id); + return 1; +} + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_compile.h b/reactos/dll/mesa32/src/shader/slang/slang_compile.h new file mode 100644 index 00000000000..d78c66f00b3 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_compile.h @@ -0,0 +1,271 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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. + */ + +#if !defined SLANG_COMPILE_H +#define SLANG_COMPILE_H + +#if defined __cplusplus +extern "C" { +#endif + +typedef enum slang_type_qualifier_ +{ + slang_qual_none, + slang_qual_const, + slang_qual_attribute, + slang_qual_varying, + slang_qual_uniform, + slang_qual_out, + slang_qual_inout, + slang_qual_fixedoutput, /* internal */ + slang_qual_fixedinput /* internal */ +} slang_type_qualifier; + +typedef enum slang_type_specifier_type_ +{ + slang_spec_void, + slang_spec_bool, + slang_spec_bvec2, + slang_spec_bvec3, + slang_spec_bvec4, + slang_spec_int, + slang_spec_ivec2, + slang_spec_ivec3, + slang_spec_ivec4, + slang_spec_float, + slang_spec_vec2, + slang_spec_vec3, + slang_spec_vec4, + slang_spec_mat2, + slang_spec_mat3, + slang_spec_mat4, + slang_spec_sampler1D, + slang_spec_sampler2D, + slang_spec_sampler3D, + slang_spec_samplerCube, + slang_spec_sampler1DShadow, + slang_spec_sampler2DShadow, + slang_spec_struct, + slang_spec_array +} slang_type_specifier_type; + +slang_type_specifier_type slang_type_specifier_type_from_string (const char *); + +typedef struct slang_type_specifier_ +{ + slang_type_specifier_type type; + struct slang_struct_ *_struct; /* spec_struct */ + struct slang_type_specifier_ *_array; /* spec_array */ +} slang_type_specifier; + +void slang_type_specifier_construct (slang_type_specifier *); +void slang_type_specifier_destruct (slang_type_specifier *); +int slang_type_specifier_copy (slang_type_specifier *, const slang_type_specifier *); +int slang_type_specifier_equal (const slang_type_specifier *, const slang_type_specifier *); + +typedef struct slang_fully_specified_type_ +{ + slang_type_qualifier qualifier; + slang_type_specifier specifier; +} slang_fully_specified_type; + +typedef struct slang_variable_scope_ +{ + struct slang_variable_ *variables; + unsigned int num_variables; + struct slang_variable_scope_ *outer_scope; +} slang_variable_scope; + +typedef enum slang_operation_type_ +{ + slang_oper_none, + slang_oper_block_no_new_scope, + slang_oper_block_new_scope, + slang_oper_variable_decl, + slang_oper_asm, + slang_oper_break, + slang_oper_continue, + slang_oper_discard, + slang_oper_return, + slang_oper_expression, + slang_oper_if, + slang_oper_while, + slang_oper_do, + slang_oper_for, + slang_oper_void, + slang_oper_literal_bool, + slang_oper_literal_int, + slang_oper_literal_float, + slang_oper_identifier, + slang_oper_sequence, + slang_oper_assign, + slang_oper_addassign, + slang_oper_subassign, + slang_oper_mulassign, + slang_oper_divassign, + /*slang_oper_modassign,*/ + /*slang_oper_lshassign,*/ + /*slang_oper_rshassign,*/ + /*slang_oper_orassign,*/ + /*slang_oper_xorassign,*/ + /*slang_oper_andassign,*/ + slang_oper_select, + slang_oper_logicalor, + slang_oper_logicalxor, + slang_oper_logicaland, + /*slang_oper_bitor,*/ + /*slang_oper_bitxor,*/ + /*slang_oper_bitand,*/ + slang_oper_equal, + slang_oper_notequal, + slang_oper_less, + slang_oper_greater, + slang_oper_lessequal, + slang_oper_greaterequal, + /*slang_oper_lshift,*/ + /*slang_oper_rshift,*/ + slang_oper_add, + slang_oper_subtract, + slang_oper_multiply, + slang_oper_divide, + /*slang_oper_modulus,*/ + slang_oper_preincrement, + slang_oper_predecrement, + slang_oper_plus, + slang_oper_minus, + /*slang_oper_complement,*/ + slang_oper_not, + slang_oper_subscript, + slang_oper_call, + slang_oper_field, + slang_oper_postincrement, + slang_oper_postdecrement +} slang_operation_type; + +typedef struct slang_operation_ +{ + slang_operation_type type; + struct slang_operation_ *children; + unsigned int num_children; + float literal; /* bool, literal_int, literal_float */ + char *identifier; /* asm, identifier, call, field */ + slang_variable_scope *locals; +} slang_operation; + +int slang_operation_construct_a (slang_operation *); +void slang_operation_destruct (slang_operation *); + +typedef struct slang_variable_ +{ + slang_fully_specified_type type; + char *name; + slang_operation *array_size; /* spec_array */ + slang_operation *initializer; + unsigned int address; +} slang_variable; + +slang_variable *_slang_locate_variable (slang_variable_scope *scope, const char *name, int all); + +typedef struct slang_struct_scope_ +{ + struct slang_struct_ *structs; + unsigned int num_structs; + struct slang_struct_scope_ *outer_scope; +} slang_struct_scope; + +struct slang_struct_ *slang_struct_scope_find (slang_struct_scope *, const char *, int); + +typedef struct slang_struct_ +{ + char *name; + slang_variable_scope *fields; + slang_struct_scope *structs; +} slang_struct; + +int slang_struct_construct_a (slang_struct *); +int slang_struct_copy (slang_struct *, const slang_struct *); + +typedef enum slang_function_kind_ +{ + slang_func_ordinary, + slang_func_constructor, + slang_func_operator +} slang_function_kind; + +typedef struct slang_function_ +{ + slang_function_kind kind; + slang_variable header; + slang_variable_scope *parameters; + unsigned int param_count; + slang_operation *body; + unsigned int address; +} slang_function; + +typedef struct slang_function_scope_ +{ + slang_function *functions; + unsigned int num_functions; + struct slang_function_scope_ *outer_scope; +} slang_function_scope; + +typedef enum slang_unit_type_ +{ + slang_unit_fragment_shader, + slang_unit_vertex_shader, + slang_unit_fragment_builtin, + slang_unit_vertex_builtin +} slang_unit_type; + +typedef struct slang_translation_unit_ +{ + slang_variable_scope globals; + slang_function_scope functions; + slang_struct_scope structs; + slang_unit_type type; +} slang_translation_unit; + +void slang_translation_unit_construct (slang_translation_unit *); +void slang_translation_unit_destruct (slang_translation_unit *); + +typedef struct slang_info_log_ +{ + char *text; + int dont_free_text; +} slang_info_log; + +void slang_info_log_construct (slang_info_log *); +void slang_info_log_destruct (slang_info_log *); +int slang_info_log_error (slang_info_log *, const char *, ...); +int slang_info_log_warning (slang_info_log *, const char *, ...); +void slang_info_log_memory (slang_info_log *); + +int _slang_compile (const char *, slang_translation_unit *, slang_unit_type type, slang_info_log *); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_execute.c b/reactos/dll/mesa32/src/shader/slang/slang_execute.c new file mode 100755 index 00000000000..3e142af2873 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_execute.c @@ -0,0 +1,352 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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 slang_execute.c + * intermediate code interpreter + * \author Michal Krol + */ + +#include "imports.h" +#include "slang_utility.h" +#include "slang_assemble.h" +#include "slang_storage.h" +#include "slang_execute.h" + +static void dump_instruction (FILE *f, slang_assembly *a, unsigned int i) +{ + fprintf (f, "%.5u:\t", i); + + switch (a->type) + { + case slang_asm_none: + fprintf (f, "none"); + break; + case slang_asm_float_copy: + fprintf (f, "float_copy\t%d, %d", a->param[0], a->param[1]); + break; + case slang_asm_float_move: + fprintf (f, "float_move\t%d, %d", a->param[0], a->param[1]); + break; + case slang_asm_float_push: + fprintf (f, "float_push\t%f", a->literal); + break; + case slang_asm_float_deref: + fprintf (f, "float_deref"); + break; + case slang_asm_float_add: + fprintf (f, "float_add"); + break; + case slang_asm_float_multiply: + fprintf (f, "float_multiply"); + break; + case slang_asm_float_divide: + fprintf (f, "float_divide"); + break; + case slang_asm_float_negate: + fprintf (f, "float_negate"); + break; + case slang_asm_float_less: + fprintf (f, "float_less"); + break; + case slang_asm_float_equal: + fprintf (f, "float_equal\t%d, %d", a->param[0], a->param[1]); + break; + case slang_asm_float_to_int: + fprintf (f, "float_to_int"); + break; + case slang_asm_int_copy: + fprintf (f, "int_copy\t%d, %d", a->param[0], a->param[1]); + break; + case slang_asm_int_move: + fprintf (f, "int_move\t%d, %d", a->param[0], a->param[1]); + break; + case slang_asm_int_push: + fprintf (f, "int_push\t%d", (GLint) a->literal); + break; + case slang_asm_int_deref: + fprintf (f, "int_deref"); + break; + case slang_asm_int_to_float: + fprintf (f, "int_to_float"); + break; + case slang_asm_int_to_addr: + fprintf (f, "int_to_addr"); + break; + case slang_asm_bool_copy: + fprintf (f, "bool_copy\t%d, %d", a->param[0], a->param[1]); + break; + case slang_asm_bool_move: + fprintf (f, "bool_move\t%d, %d", a->param[0], a->param[1]); + break; + case slang_asm_bool_push: + fprintf (f, "bool_push\t%d", a->literal != 0.0f); + break; + case slang_asm_bool_deref: + fprintf (f, "bool_deref"); + break; + case slang_asm_addr_copy: + fprintf (f, "addr_copy"); + break; + case slang_asm_addr_push: + fprintf (f, "addr_push\t%u", a->param[0]); + break; + case slang_asm_addr_deref: + fprintf (f, "addr_deref"); + break; + case slang_asm_addr_add: + fprintf (f, "addr_add"); + break; + case slang_asm_addr_multiply: + fprintf (f, "addr_multiply"); + break; + case slang_asm_jump: + fprintf (f, "jump\t%u", a->param[0]); + break; + case slang_asm_jump_if_zero: + fprintf (f, "jump_if_zero\t%u", a->param[0]); + break; + case slang_asm_enter: + fprintf (f, "enter\t%u", a->param[0]); + break; + case slang_asm_leave: + fprintf (f, "leave"); + break; + case slang_asm_local_alloc: + fprintf (f, "local_alloc\t%u", a->param[0]); + break; + case slang_asm_local_free: + fprintf (f, "local_free\t%u", a->param[0]); + break; + case slang_asm_local_addr: + fprintf (f, "local_addr\t%u, %u", a->param[0], a->param[1]); + break; + case slang_asm_call: + fprintf (f, "call\t%u", a->param[0]); + break; + case slang_asm_return: + fprintf (f, "return"); + break; + case slang_asm_discard: + fprintf (f, "discard"); + break; + case slang_asm_exit: + fprintf (f, "exit"); + break; + default: + break; + } + + fprintf (f, "\n"); +} + +static void dump (const slang_assembly_file *file) +{ + unsigned int i; + static unsigned int counter = 0; + FILE *f; + char filename[256]; + + counter++; + sprintf (filename, "~mesa-slang-assembly-dump-(%u).txt", counter); + f = fopen (filename, "w"); + if (f == NULL) + return; + + for (i = 0; i < file->count; i++) + dump_instruction (f, file->code + i, i); + + fclose (f); +} + +int _slang_execute (const slang_assembly_file *file) +{ + slang_machine mach; + FILE *f; + + mach.ip = 0; + mach.sp = SLANG_MACHINE_STACK_SIZE; + mach.bp = 0; + mach.kill = 0; + mach.exit = 0; + + /* assume 32-bit machine */ + /* XXX why???, disabling the pointer size assertions here. + * See bug 4021. + */ + static_assert(sizeof (GLfloat) == 4); + /*static_assert(sizeof (GLfloat *) == 4);*/ + static_assert(sizeof (GLuint) == 4); + /*static_assert(sizeof (GLuint *) == 4);*/ + + dump (file); + + f = fopen ("~mesa-slang-assembly-execution.txt", "w"); + + while (!mach.exit) + { + slang_assembly *a = file->code + mach.ip; + if (f != NULL) + { + unsigned int i; + dump_instruction (f, a, mach.ip); + fprintf (f, "\t\tsp=%u bp=%u\n", mach.sp, mach.bp); + for (i = mach.sp; i < SLANG_MACHINE_STACK_SIZE; i++) + fprintf (f, "\t%.5u\t%6f\t%u\n", i, mach.stack._float[i], mach.stack._addr[i]); + fflush (f); + } + mach.ip++; + + switch (a->type) + { + case slang_asm_none: + break; + case slang_asm_float_copy: + case slang_asm_int_copy: + case slang_asm_bool_copy: + *(mach.stack._floatp[mach.sp + a->param[0] / 4] + a->param[1] / 4) = + mach.stack._float[mach.sp]; + mach.sp++; + break; + case slang_asm_float_move: + case slang_asm_int_move: + case slang_asm_bool_move: + mach.stack._float[mach.sp + a->param[0] / 4] = + mach.stack._float[mach.sp + (mach.stack._addr[mach.sp] + a->param[1]) / 4]; + break; + case slang_asm_float_push: + case slang_asm_int_push: + case slang_asm_bool_push: + mach.sp--; + mach.stack._float[mach.sp] = a->literal; + break; + case slang_asm_float_deref: + case slang_asm_int_deref: + case slang_asm_bool_deref: + mach.stack._float[mach.sp] = *mach.stack._floatp[mach.sp]; + break; + case slang_asm_float_add: + mach.stack._float[mach.sp + 1] += mach.stack._float[mach.sp]; + mach.sp++; + break; + case slang_asm_float_multiply: + mach.stack._float[mach.sp + 1] *= mach.stack._float[mach.sp]; + mach.sp++; + break; + case slang_asm_float_divide: + mach.stack._float[mach.sp + 1] /= mach.stack._float[mach.sp]; + mach.sp++; + break; + case slang_asm_float_negate: + mach.stack._float[mach.sp] = -mach.stack._float[mach.sp]; + break; + case slang_asm_float_less: + mach.stack._float[mach.sp + 1] = + mach.stack._float[mach.sp + 1] < mach.stack._float[mach.sp] ? 1.0f : 0.0f; + mach.sp++; + break; + case slang_asm_float_equal: + mach.sp--; + mach.stack._float[mach.sp] = mach.stack._float[mach.sp + 1 + a->param[0] / 4] == + mach.stack._float[mach.sp + 1 + a->param[1] / 4] ? 1.0f : 0.0f; + break; + case slang_asm_float_to_int: + mach.stack._float[mach.sp] = (GLfloat) (GLint) mach.stack._float[mach.sp]; + break; + case slang_asm_int_to_float: + break; + case slang_asm_int_to_addr: + mach.stack._addr[mach.sp] = (GLuint) (GLint) mach.stack._float[mach.sp]; + break; + case slang_asm_addr_copy: + *mach.stack._addrp[mach.sp + 1] = mach.stack._addr[mach.sp]; + mach.sp++; + break; + case slang_asm_addr_push: + mach.sp--; + mach.stack._addr[mach.sp] = a->param[0]; + break; + case slang_asm_addr_deref: + mach.stack._addr[mach.sp] = *mach.stack._addrp[mach.sp]; + break; + case slang_asm_addr_add: + mach.stack._addr[mach.sp + 1] += mach.stack._addr[mach.sp]; + mach.sp++; + break; + case slang_asm_addr_multiply: + mach.stack._addr[mach.sp + 1] *= mach.stack._addr[mach.sp]; + mach.sp++; + break; + case slang_asm_jump: + mach.ip = a->param[0]; + break; + case slang_asm_jump_if_zero: + if (mach.stack._float[mach.sp] == 0.0f) + mach.ip = a->param[0]; + mach.sp++; + break; + case slang_asm_enter: + mach.sp--; + mach.stack._addr[mach.sp] = mach.bp; + mach.bp = mach.sp + a->param[0] / 4; + break; + case slang_asm_leave: + mach.bp = mach.stack._addr[mach.sp]; + mach.sp++; + break; + case slang_asm_local_alloc: + mach.sp -= a->param[0] / 4; + break; + case slang_asm_local_free: + mach.sp += a->param[0] / 4; + break; + case slang_asm_local_addr: + mach.sp--; + mach.stack._addr[mach.sp] = (GLuint) mach.stack._addr + mach.bp * 4 - + (a->param[0] + a->param[1]) + 4; + break; + case slang_asm_call: + mach.sp--; + mach.stack._addr[mach.sp] = mach.ip; + mach.ip = a->param[0]; + break; + case slang_asm_return: + mach.ip = mach.stack._addr[mach.sp]; + mach.sp++; + break; + case slang_asm_discard: + mach.kill = 1; + break; + case slang_asm_exit: + mach.exit = 1; + break; + } + } + + if (f != NULL) + fclose (f); + + return 0; +} + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_execute.h b/reactos/dll/mesa32/src/shader/slang/slang_execute.h new file mode 100755 index 00000000000..7a77654419f --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_execute.h @@ -0,0 +1,57 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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. + */ + +#if !defined SLANG_EXECUTE_H +#define SLANG_EXECUTE_H + +#if defined __cplusplus +extern "C" { +#endif + +#define SLANG_MACHINE_STACK_SIZE 1024 + +typedef struct slang_machine_ +{ + GLuint ip; /* instruction pointer, for flow control */ + GLuint sp; /* stack pointer, for stack access */ + GLuint bp; /* base pointer, for local variable access */ + GLuint kill; /* discard the fragment */ + GLuint exit; /* terminate the shader */ + union stack_ + { + GLfloat _float[SLANG_MACHINE_STACK_SIZE]; + GLfloat *_floatp[SLANG_MACHINE_STACK_SIZE]; + GLuint _addr[SLANG_MACHINE_STACK_SIZE]; + GLuint *_addrp[SLANG_MACHINE_STACK_SIZE]; + } stack; +} slang_machine; + +int _slang_execute (const slang_assembly_file *); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_mesa.h b/reactos/dll/mesa32/src/shader/slang/slang_mesa.h new file mode 100755 index 00000000000..ca7af22d2a6 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_mesa.h @@ -0,0 +1,36 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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. + */ + +#if defined __cplusplus +extern "C" { +#endif + +int _mesa_isalnum (char); +int _glslang_3dlabs_InitProcess (); +int _glslang_3dlabs_ShInitialize (); + +#if defined __cplusplus +} +#endif + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_preprocess.c b/reactos/dll/mesa32/src/shader/slang/slang_preprocess.c new file mode 100755 index 00000000000..1dc156eedb7 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_preprocess.c @@ -0,0 +1,87 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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 slang_preprocess.c + * slang preprocessor + * \author Michal Krol + */ + +#include "imports.h" +#include "grammar_mesa.h" +#include "slang_compile.h" +#include "slang_preprocess.h" + +static const char *slang_version_syn = +#include "library/slang_version_syn.h" +; + +int _slang_preprocess_version (const char *text, unsigned int *version, unsigned int *eaten, + slang_info_log *log) +{ + grammar id; + byte *prod, *I; + unsigned int size; + + id = grammar_load_from_text ((const byte *) slang_version_syn); + if (id == 0) + { + char buf[1024]; + unsigned int pos; + grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos); + slang_info_log_error (log, buf); + return 0; + } + + if (!grammar_fast_check (id, (const byte *) text, &prod, &size, 8)) + { + char buf[1024]; + unsigned int pos; + grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos); + slang_info_log_error (log, buf); + grammar_destroy (id); + return 0; + } + + grammar_destroy (id); + + /* there can be multiple #version directives - grab the last one */ + I = prod; + while (I < prod + size) + { + *version = + (unsigned int) I[0] + + (unsigned int) I[1] * 100; + *eaten = + ((unsigned int) I[2]) + + ((unsigned int) I[3] << 8) + + ((unsigned int) I[4] << 16) + + ((unsigned int) I[5] << 24); + I += 6; + } + + grammar_alloc_free (prod); + return 1; +} + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_preprocess.h b/reactos/dll/mesa32/src/shader/slang/slang_preprocess.h new file mode 100755 index 00000000000..637b822c975 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_preprocess.h @@ -0,0 +1,39 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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. + */ + +#if !defined SLANG_PREPROCESS_H +#define SLANG_PREPROCESS_H + +#if defined __cplusplus +extern "C" { +#endif + +int _slang_preprocess_version (const char *, unsigned int *, unsigned int *, slang_info_log *); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_storage.c b/reactos/dll/mesa32/src/shader/slang/slang_storage.c new file mode 100755 index 00000000000..3b2fda415b2 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_storage.c @@ -0,0 +1,255 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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 slang_storage.c + * slang variable storage + * \author Michal Krol + */ + +#include "imports.h" +#include "slang_utility.h" +#include "slang_storage.h" +#include "slang_assemble.h" + +/* slang_storage_array */ + +void slang_storage_array_construct (slang_storage_array *arr) +{ + arr->type = slang_stor_aggregate; + arr->aggregate = NULL; + arr->length = 0; +} + +void slang_storage_array_destruct (slang_storage_array *arr) +{ + if (arr->aggregate != NULL) + { + slang_storage_aggregate_destruct (arr->aggregate); + slang_alloc_free (arr->aggregate); + } +} + +/* slang_storage_aggregate */ + +void slang_storage_aggregate_construct (slang_storage_aggregate *agg) +{ + agg->arrays = NULL; + agg->count = 0; +} + +void slang_storage_aggregate_destruct (slang_storage_aggregate *agg) +{ + unsigned int i; + for (i = 0; i < agg->count; i++) + slang_storage_array_destruct (agg->arrays + i); + slang_alloc_free (agg->arrays); +} + +static slang_storage_array *slang_storage_aggregate_push_new (slang_storage_aggregate *agg) +{ + slang_storage_array *arr = NULL; + agg->arrays = (slang_storage_array *) slang_alloc_realloc (agg->arrays, agg->count * sizeof ( + slang_storage_array), (agg->count + 1) * sizeof (slang_storage_array)); + if (agg->arrays != NULL) + { + arr = agg->arrays + agg->count; + slang_storage_array_construct (arr); + agg->count++; + } + return arr; +} + +/* _slang_aggregate_variable() */ + +static int aggregate_vector (slang_storage_aggregate *agg, slang_storage_type basic_type, + unsigned int row_count) +{ + slang_storage_array *arr = slang_storage_aggregate_push_new (agg); + if (arr == NULL) + return 0; + arr->type = basic_type; + arr->length = row_count; + return 1; +} + +static int aggregate_matrix (slang_storage_aggregate *agg, slang_storage_type basic_type, + unsigned int dimension) +{ + slang_storage_array *arr = slang_storage_aggregate_push_new (agg); + if (arr == NULL) + return 0; + arr->type = slang_stor_aggregate; + arr->length = dimension; + arr->aggregate = (slang_storage_aggregate *) slang_alloc_malloc (sizeof ( + slang_storage_aggregate)); + if (arr->aggregate == NULL) + return 0; + slang_storage_aggregate_construct (arr->aggregate); + if (!aggregate_vector (arr->aggregate, basic_type, dimension)) + return 0; + return 1; +} + +static int aggregate_variables (slang_storage_aggregate *agg, const slang_variable_scope *vars, + slang_function_scope *funcs, slang_struct_scope *structs) +{ + unsigned int i; + for (i = 0; i < vars->num_variables; i++) + if (!_slang_aggregate_variable (agg, &vars->variables[i].type.specifier, + vars->variables[i].array_size, funcs, structs)) + return 0; + return 1; +} + +int _slang_aggregate_variable (slang_storage_aggregate *agg, slang_type_specifier *spec, + slang_operation *array_size, slang_function_scope *funcs, slang_struct_scope *structs) +{ + switch (spec->type) + { + case slang_spec_bool: + return aggregate_vector (agg, slang_stor_bool, 1); + case slang_spec_bvec2: + return aggregate_vector (agg, slang_stor_bool, 2); + case slang_spec_bvec3: + return aggregate_vector (agg, slang_stor_bool, 3); + case slang_spec_bvec4: + return aggregate_vector (agg, slang_stor_bool, 4); + case slang_spec_int: + return aggregate_vector (agg, slang_stor_int, 1); + case slang_spec_ivec2: + return aggregate_vector (agg, slang_stor_int, 2); + case slang_spec_ivec3: + return aggregate_vector (agg, slang_stor_int, 3); + case slang_spec_ivec4: + return aggregate_vector (agg, slang_stor_int, 4); + case slang_spec_float: + return aggregate_vector (agg, slang_stor_float, 1); + case slang_spec_vec2: + return aggregate_vector (agg, slang_stor_float, 2); + case slang_spec_vec3: + return aggregate_vector (agg, slang_stor_float, 3); + case slang_spec_vec4: + return aggregate_vector (agg, slang_stor_float, 4); + case slang_spec_mat2: + return aggregate_matrix (agg, slang_stor_float, 2); + case slang_spec_mat3: + return aggregate_matrix (agg, slang_stor_float, 3); + case slang_spec_mat4: + return aggregate_matrix (agg, slang_stor_float, 4); + case slang_spec_sampler1D: + case slang_spec_sampler2D: + case slang_spec_sampler3D: + case slang_spec_samplerCube: + case slang_spec_sampler1DShadow: + case slang_spec_sampler2DShadow: + return aggregate_vector (agg, slang_stor_int, 1); + case slang_spec_struct: + return aggregate_variables (agg, spec->_struct->fields, funcs, structs); + case slang_spec_array: + { + slang_storage_array *arr; + slang_assembly_file file; + slang_assembly_flow_control flow; + slang_assembly_name_space space; + slang_assembly_local_info info; + slang_assembly_stack_info stk; + + arr = slang_storage_aggregate_push_new (agg); + if (arr == NULL) + return 0; + arr->type = slang_stor_aggregate; + arr->aggregate = (slang_storage_aggregate *) slang_alloc_malloc (sizeof ( + slang_storage_aggregate)); + if (arr->aggregate == NULL) + return 0; + slang_storage_aggregate_construct (arr->aggregate); + if (!_slang_aggregate_variable (arr->aggregate, spec->_array, NULL, funcs, structs)) + return 0; + slang_assembly_file_construct (&file); + space.funcs = funcs; + space.structs = structs; + /* XXX: vars! */ + space.vars = NULL; + if (!_slang_assemble_operation (&file, array_size, 0, &flow, &space, &info, &stk)) + { + slang_assembly_file_destruct (&file); + return 0; + } + /* TODO: evaluate array size */ + slang_assembly_file_destruct (&file); + arr->length = 256; + } + return 1; + default: + return 0; + } +} + +/* _slang_sizeof_aggregate() */ + +unsigned int _slang_sizeof_aggregate (const slang_storage_aggregate *agg) +{ + unsigned int i, size = 0; + for (i = 0; i < agg->count; i++) + { + unsigned int element_size; + if (agg->arrays[i].type == slang_stor_aggregate) + element_size = _slang_sizeof_aggregate (agg->arrays[i].aggregate); + else + element_size = sizeof (GLfloat); + size += element_size * agg->arrays[i].length; + } + return size; +} + +/* _slang_flatten_aggregate () */ + +int _slang_flatten_aggregate (slang_storage_aggregate *flat, const slang_storage_aggregate *agg) +{ + unsigned int i; + for (i = 0; i < agg->count; i++) + { + unsigned int j; + for (j = 0; j < agg->arrays[i].length; j++) + { + if (agg->arrays[i].type == slang_stor_aggregate) + { + if (!_slang_flatten_aggregate (flat, agg->arrays[i].aggregate)) + return 0; + } + else + { + slang_storage_array *arr; + arr = slang_storage_aggregate_push_new (flat); + if (arr == NULL) + return 0; + arr->type = agg->arrays[i].type; + arr->length = 1; + } + } + } + return 1; +} + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_storage.h b/reactos/dll/mesa32/src/shader/slang/slang_storage.h new file mode 100755 index 00000000000..77962c1986e --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_storage.h @@ -0,0 +1,109 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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. + */ + +#if !defined SLANG_STORAGE_H +#define SLANG_STORAGE_H + +#include "slang_compile.h" + +#if defined __cplusplus +extern "C" { +#endif + +/* + Program variable data storage is kept completely transparent to the front-end compiler. It is + up to the back-end how the data is actually allocated. The slang_storage_type enum + provides the basic information about how the memory is interpreted. This abstract piece + of memory is called a data slot. A data slot of a particular type has a fixed size. + + For now, only the three basic types are supported, that is bool, int and float. Other built-in + types like vector or matrix can easily be decomposed into a series of basic types. +*/ +typedef enum slang_storage_type_ +{ + slang_stor_aggregate, + slang_stor_bool, + slang_stor_int, + slang_stor_float +} slang_storage_type; + +/* + The slang_storage_array structure groups data slots of the same type into an array. This + array has a fixed length. Arrays are required to have a size equal to the sum of sizes of its + elements. They are also required to support indirect addressing. That is, if B references + first data slot in the array, S is the size of the data slot and I is the integral index that + is not known at compile time, B+I*S references I-th data slot. + + This structure is also used to break down built-in data types that are not supported directly. + Vectors, like vec3, are constructed from arrays of their basic types. Matrices are formed of + an array of column vectors, which are in turn processed as other vectors. +*/ +typedef struct slang_storage_array_ +{ + slang_storage_type type; + struct slang_storage_aggregate_ *aggregate; /* slang_stor_aggregate */ + unsigned int length; +} slang_storage_array; + +void slang_storage_array_construct (slang_storage_array *); +void slang_storage_array_destruct (slang_storage_array *); + +/* + The slang_storage_aggregate structure relaxes the indirect addressing requirement for + slang_storage_array structure. Aggregates are always accessed statically - its member + addresses are well-known at compile time. For example, user-defined types are implemented as + aggregates. Aggregates can collect data of a different type. +*/ +typedef struct slang_storage_aggregate_ +{ + slang_storage_array *arrays; + unsigned int count; +} slang_storage_aggregate; + +void slang_storage_aggregate_construct (slang_storage_aggregate *); +void slang_storage_aggregate_destruct (slang_storage_aggregate *); + +int _slang_aggregate_variable (slang_storage_aggregate *, struct slang_type_specifier_ *, + struct slang_operation_ *, struct slang_function_scope_ *, slang_struct_scope *); + +/* + returns total size (in machine units) of the given aggregate + returns 0 on error +*/ +unsigned int _slang_sizeof_aggregate (const slang_storage_aggregate *); + +/* + converts structured aggregate to a flat one, with arrays of generic type being + one-element long + returns 1 on success + returns 0 otherwise +*/ +int _slang_flatten_aggregate (slang_storage_aggregate *, const slang_storage_aggregate *); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_utility.c b/reactos/dll/mesa32/src/shader/slang/slang_utility.c new file mode 100755 index 00000000000..b1b20d9e30d --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_utility.c @@ -0,0 +1,73 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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 slang_utility.c + * slang utilities + * \author Michal Krol + */ + +#include "imports.h" +#include "slang_utility.h" + +void slang_alloc_free (void *ptr) +{ + _mesa_free (ptr); +} + +void *slang_alloc_malloc (unsigned int size) +{ + return _mesa_malloc (size); +} + +void *slang_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size) +{ + return _mesa_realloc (ptr, old_size, size); +} + +int slang_string_compare (const char *str1, const char *str2) +{ + return _mesa_strcmp (str1, str2); +} + +char *slang_string_copy (char *dst, const char *src) +{ + return _mesa_strcpy (dst, src); +} + +char *slang_string_concat (char *dst, const char *src) +{ + return _mesa_strcpy (dst + _mesa_strlen (dst), src); +} + +char *slang_string_duplicate (const char *src) +{ + return _mesa_strdup (src); +} + +unsigned int slang_string_length (const char *str) +{ + return _mesa_strlen (str); +} + diff --git a/reactos/dll/mesa32/src/shader/slang/slang_utility.h b/reactos/dll/mesa32/src/shader/slang/slang_utility.h new file mode 100755 index 00000000000..d93fb9660e5 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/slang_utility.h @@ -0,0 +1,51 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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. + */ + +#if !defined SLANG_UTILITY_H +#define SLANG_UTILITY_H + +#if defined __cplusplus +extern "C" { +#endif + +/* Compile-time assertions. If the expression is zero, try to declare an + * array of size [-1] to cause compilation error. + */ +#define static_assert(expr) do { int _array[(expr) ? 1 : -1]; _array[0]; } while (0) + +void slang_alloc_free (void *); +void *slang_alloc_malloc (unsigned int); +void *slang_alloc_realloc (void *, unsigned int, unsigned int); +int slang_string_compare (const char *, const char *); +char *slang_string_copy (char *, const char *); +char *slang_string_concat (char *, const char *); +char *slang_string_duplicate (const char *); +unsigned int slang_string_length (const char *); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/reactos/dll/mesa32/src/shader/slang/traverse_wrap.h b/reactos/dll/mesa32/src/shader/slang/traverse_wrap.h new file mode 100755 index 00000000000..b2f244ee011 --- /dev/null +++ b/reactos/dll/mesa32/src/shader/slang/traverse_wrap.h @@ -0,0 +1,112 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 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 traverse_wrap.h + * Handy TIntermTraverser class wrapper + * \author Michal Krol + */ + +#ifndef __TRAVERSE_WRAP_H__ +#define __TRAVERSE_WRAP_H__ + +#include "Include/intermediate.h" + +/* + The original TIntermTraverser class that is used to walk the intermediate tree, + is not very elegant in its design. One must define static functions with + appropriate prototypes, construct TIntermTraverser object, and set its member + function pointers to one's static functions. If traversal-specific data + is needed, a new class must be derived, and one must up-cast the object + passed as a parameter to the static function. + + The class below eliminates this burden by providing virtual methods that are + to be overridden in the derived class. +*/ + +class traverse_wrap: private TIntermTraverser +{ +private: + static void _visitSymbol (TIntermSymbol *S, TIntermTraverser *T) { + static_cast (T)->Symbol (*S); + } + static void _visitConstantUnion (TIntermConstantUnion *U, TIntermTraverser *T) { + static_cast (T)->ConstantUnion (*U); + } + static bool _visitBinary (bool preVisit, TIntermBinary *B, TIntermTraverser *T) { + return static_cast (T)->Binary (preVisit, *B); + } + static bool _visitUnary (bool preVisit, TIntermUnary *U, TIntermTraverser *T) { + return static_cast (T)->Unary (preVisit, *U); + } + static bool _visitSelection (bool preVisit, TIntermSelection *S, TIntermTraverser *T) { + return static_cast (T)->Selection (preVisit, *S); + } + static bool _visitAggregate (bool preVisit, TIntermAggregate *A, TIntermTraverser *T) { + return static_cast (T)->Aggregate (preVisit, *A); + } + static bool _visitLoop (bool preVisit, TIntermLoop *L, TIntermTraverser *T) { + return static_cast (T)->Loop (preVisit, *L); + } + static bool _visitBranch (bool preVisit, TIntermBranch *B, TIntermTraverser *T) { + return static_cast (T)->Branch (preVisit, *B); + } +public: + traverse_wrap () { + visitSymbol = _visitSymbol; + visitConstantUnion = _visitConstantUnion; + visitBinary = _visitBinary; + visitUnary = _visitUnary; + visitSelection = _visitSelection; + visitAggregate = _visitAggregate; + visitLoop = _visitLoop; + visitBranch = _visitBranch; + } +protected: + virtual void Symbol (const TIntermSymbol &) { + } + virtual void ConstantUnion (const TIntermConstantUnion &) { + } + virtual bool Binary (bool, const TIntermBinary &) { + return true; + } + virtual bool Unary (bool, const TIntermUnary &) { + return true; + } + virtual bool Selection (bool, const TIntermSelection &) { + return true; + } + virtual bool Aggregate (bool, const TIntermAggregate &) { + return true; + } + virtual bool Loop (bool, const TIntermLoop &) { + return true; + } + virtual bool Branch (bool, const TIntermBranch &) { + return true; + } +}; + +#endif + diff --git a/reactos/dll/mesa32/src/sources b/reactos/dll/mesa32/src/sources new file mode 100644 index 00000000000..48c3ab543b0 --- /dev/null +++ b/reactos/dll/mesa32/src/sources @@ -0,0 +1,335 @@ +### Lists of source files, included by Makefiles + +MAIN_SOURCES = \ + main/api_arrayelt.c \ + main/api_loopback.c \ + main/api_noop.c \ + main/api_validate.c \ + main/accum.c \ + main/attrib.c \ + main/blend.c \ + main/bufferobj.c \ + main/buffers.c \ + main/clip.c \ + main/colortab.c \ + main/context.c \ + main/convolve.c \ + main/debug.c \ + main/depth.c \ + main/dispatch.c \ + main/dlist.c \ + main/drawpix.c \ + main/enable.c \ + main/enums.c \ + main/eval.c \ + main/execmem.c \ + main/extensions.c \ + main/fbobject.c \ + main/feedback.c \ + main/fog.c \ + main/framebuffer.c \ + main/get.c \ + main/getstring.c \ + main/hash.c \ + main/hint.c \ + main/histogram.c \ + main/image.c \ + main/imports.c \ + main/light.c \ + main/lines.c \ + main/matrix.c \ + main/mm.c \ + main/occlude.c \ + main/pixel.c \ + main/points.c \ + main/polygon.c \ + main/rastpos.c \ + main/renderbuffer.c \ + main/state.c \ + main/stencil.c \ + main/texcompress.c \ + main/texcompress_s3tc.c \ + main/texcompress_fxt1.c \ + main/texenvprogram.c \ + main/texformat.c \ + main/teximage.c \ + main/texrender.c \ + main/texobj.c \ + main/texstate.c \ + main/texstore.c \ + main/varray.c \ + main/vtxfmt.c + +GLAPI_SOURCES = \ + glapi/glapi.c \ + glapi/glthread.c + +MATH_SOURCES = \ + math/m_debug_clip.c \ + math/m_debug_norm.c \ + math/m_debug_xform.c \ + math/m_eval.c \ + math/m_matrix.c \ + math/m_translate.c \ + math/m_vector.c \ + math/m_xform.c + +ARRAY_CACHE_SOURCES = \ + array_cache/ac_context.c \ + array_cache/ac_import.c + +SWRAST_SOURCES = \ + swrast/s_fragprog_to_c.c \ + swrast/s_aaline.c \ + swrast/s_aatriangle.c \ + swrast/s_accum.c \ + swrast/s_alpha.c \ + swrast/s_atifragshader.c \ + swrast/s_bitmap.c \ + swrast/s_blend.c \ + swrast/s_buffers.c \ + swrast/s_copypix.c \ + swrast/s_context.c \ + swrast/s_depth.c \ + swrast/s_drawpix.c \ + swrast/s_feedback.c \ + swrast/s_fog.c \ + swrast/s_imaging.c \ + swrast/s_lines.c \ + swrast/s_logic.c \ + swrast/s_masking.c \ + swrast/s_nvfragprog.c \ + swrast/s_pixeltex.c \ + swrast/s_points.c \ + swrast/s_readpix.c \ + swrast/s_span.c \ + swrast/s_stencil.c \ + swrast/s_tcc.c \ + swrast/s_texture.c \ + swrast/s_texstore.c \ + swrast/s_triangle.c \ + swrast/s_zoom.c + +SWRAST_SETUP_SOURCES = \ + swrast_setup/ss_context.c \ + swrast_setup/ss_triangle.c + +TNL_SOURCES = \ + tnl/t_array_api.c \ + tnl/t_array_import.c \ + tnl/t_context.c \ + tnl/t_pipeline.c \ + tnl/t_save_api.c \ + tnl/t_save_loopback.c \ + tnl/t_save_playback.c \ + tnl/t_vb_arbprogram.c \ + tnl/t_vb_arbprogram_sse.c \ + tnl/t_vb_program.c \ + tnl/t_vb_render.c \ + tnl/t_vb_texgen.c \ + tnl/t_vb_texmat.c \ + tnl/t_vb_vertex.c \ + tnl/t_vb_cull.c \ + tnl/t_vb_fog.c \ + tnl/t_vb_light.c \ + tnl/t_vb_normals.c \ + tnl/t_vb_points.c \ + tnl/t_vp_build.c \ + tnl/t_vertex.c \ + tnl/t_vertex_sse.c \ + tnl/t_vertex_generic.c \ + tnl/t_vtx_api.c \ + tnl/t_vtx_generic.c \ + tnl/t_vtx_x86.c \ + tnl/t_vtx_eval.c \ + tnl/t_vtx_exec.c + + + +SHADER_SOURCES = \ + shader/arbfragparse.c \ + shader/arbprogparse.c \ + shader/arbprogram.c \ + shader/arbvertparse.c \ + shader/atifragshader.c \ + shader/grammar/grammar_mesa.c \ + shader/nvfragparse.c \ + shader/nvprogram.c \ + shader/nvvertexec.c \ + shader/nvvertparse.c \ + shader/program.c \ + shader/shaderobjects.c \ + shader/shaderobjects_3dlabs.c + +SLANG_C_SOURCES = \ + shader/slang/MachineIndependent/preprocessor/atom.c \ + shader/slang/MachineIndependent/preprocessor/cpp.c \ + shader/slang/MachineIndependent/preprocessor/cppstruct.c \ + shader/slang/MachineIndependent/preprocessor/memory.c \ + shader/slang/MachineIndependent/preprocessor/scanner.c \ + shader/slang/MachineIndependent/preprocessor/symbols.c \ + shader/slang/MachineIndependent/preprocessor/tokens.c + +SLANG_CPP_SOURCES = \ + shader/slang/slang_mesa.cpp \ + shader/slang/MachineIndependent/Gen_glslang.cpp \ + shader/slang/MachineIndependent/Gen_glslang_tab.cpp \ + shader/slang/MachineIndependent/InfoSink.cpp \ + shader/slang/MachineIndependent/Initialize.cpp \ + shader/slang/MachineIndependent/Intermediate.cpp \ + shader/slang/MachineIndependent/intermOut.cpp \ + shader/slang/MachineIndependent/IntermTraverse.cpp \ + shader/slang/MachineIndependent/parseConst.cpp \ + shader/slang/MachineIndependent/ParseHelper.cpp \ + shader/slang/MachineIndependent/PoolAlloc.cpp \ + shader/slang/MachineIndependent/QualifierAlive.cpp \ + shader/slang/MachineIndependent/RemoveTree.cpp \ + shader/slang/MachineIndependent/ShaderLang.cpp \ + shader/slang/MachineIndependent/SymbolTable.cpp \ + shader/slang/OGLCompilersDLL/Initialisation.cpp \ + shader/slang/OSDependent/Linux/ossource.cpp + +SLANG_SOURCES = \ + shader/slang/slang_assemble.c \ + shader/slang/slang_assemble_assignment.c \ + shader/slang/slang_assemble_conditional.c \ + shader/slang/slang_assemble_constructor.c \ + shader/slang/slang_assemble_typeinfo.c \ + shader/slang/slang_compile.c \ + shader/slang/slang_execute.c \ + shader/slang/slang_preprocess.c \ + shader/slang/slang_storage.c \ + shader/slang/slang_utility.c + +ASM_C_SOURCES = \ + x86/common_x86.c \ + x86/x86.c \ + x86/3dnow.c \ + x86/sse.c \ + x86/rtasm/x86sse.c \ + sparc/sparc.c \ + ppc/common_ppc.c \ + x86-64/x86-64.c + +X86_SOURCES = \ + x86/common_x86_asm.S \ + x86/x86_xform2.S \ + x86/x86_xform3.S \ + x86/x86_xform4.S \ + x86/x86_cliptest.S \ + x86/mmx_blend.S \ + x86/3dnow_xform1.S \ + x86/3dnow_xform2.S \ + x86/3dnow_xform3.S \ + x86/3dnow_xform4.S \ + x86/3dnow_normal.S \ + x86/sse_xform1.S \ + x86/sse_xform2.S \ + x86/sse_xform3.S \ + x86/sse_xform4.S \ + x86/sse_normal.S \ + x86/read_rgba_span_x86.S \ + tnl/t_vtx_x86_gcc.S + +X86_API = \ + x86/glapi_x86.S + +X86-64_SOURCES = \ + x86-64/xform4.S + +X86-64_API = \ + x86-64/glapi_x86-64.S + +SPARC_SOURCES = \ + sparc/clip.S \ + sparc/norm.S \ + sparc/xform.S + +SPARC_API = \ + sparc/glapi_sparc.S + +COMMON_DRIVER_SOURCES = \ + drivers/common/driverfuncs.c + +X11_DRIVER_SOURCES = \ + drivers/x11/glxapi.c \ + drivers/x11/fakeglx.c \ + drivers/x11/xfonts.c \ + drivers/x11/xm_api.c \ + drivers/x11/xm_buffer.c \ + drivers/x11/xm_dd.c \ + drivers/x11/xm_line.c \ + drivers/x11/xm_span.c \ + drivers/x11/xm_tri.c + +OSMESA_DRIVER_SOURCES = \ + drivers/osmesa/osmesa.c + +GLIDE_DRIVER_SOURCES = \ + drivers/glide/fxapi.c \ + drivers/glide/fxdd.c \ + drivers/glide/fxddspan.c \ + drivers/glide/fxddtex.c \ + drivers/glide/fxsetup.c \ + drivers/glide/fxtexman.c \ + drivers/glide/fxtris.c \ + drivers/glide/fxvb.c \ + drivers/glide/fxglidew.c \ + drivers/glide/fxg.c + +SVGA_DRIVER_SOURCES = \ + drivers/svga/svgamesa.c \ + drivers/svga/svgamesa8.c \ + drivers/svga/svgamesa15.c \ + drivers/svga/svgamesa16.c \ + drivers/svga/svgamesa24.c \ + drivers/svga/svgamesa32.c + +FBDEV_DRIVER_SOURCES = \ + drivers/fbdev/glfbdev.c + + +### All the core C sources + +CORE_SOURCES = \ + $(MAIN_SOURCES) \ + $(GLAPI_SOURCES) \ + $(MATH_SOURCES) \ + $(ARRAY_CACHE_SOURCES) \ + $(TNL_SOURCES) \ + $(SHADER_SOURCES) \ + $(SWRAST_SOURCES) \ + $(SWRAST_SETUP_SOURCES) \ + $(ASM_C_SOURCES) \ + $(SLANG_SOURCES) + +# $(SLANG_C_SOURCES) + + +### Object files + +#CORE_OBJECTS = $(CORE_SOURCES:.c=.o) $(SLANG_CPP_SOURCES:.cpp=.o) +CORE_OBJECTS = $(CORE_SOURCES:.c=.o) + +OSMESA_DRIVER_OBJECTS = $(OSMESA_DRIVER_SOURCES:.c=.o) + +COMMON_DRIVER_OBJECTS = $(COMMON_DRIVER_SOURCES:.c=.o) + + + +### Include directories + +INCLUDE_DIRS = \ + -I$(TOP)/include \ + -I$(TOP)/src/mesa \ + -I$(TOP)/src/mesa/main \ + -I$(TOP)/src/mesa/glapi \ + -I$(TOP)/src/mesa/math \ + -I$(TOP)/src/mesa/tnl \ + -I$(TOP)/src/mesa/shader \ + -I$(TOP)/src/mesa/shader/grammar \ + -I$(TOP)/src/mesa/shader/slang \ + -I$(TOP)/src/mesa/shader/slang/OSDependent/Linux \ + -I$(TOP)/src/mesa/shader/slang/OGLCompilersDLL \ + -I$(TOP)/src/mesa/swrast \ + -I$(TOP)/src/mesa/swrast_setup diff --git a/reactos/dll/mesa32/src/sparc/clip.S b/reactos/dll/mesa32/src/sparc/clip.S new file mode 100644 index 00000000000..58c228ed151 --- /dev/null +++ b/reactos/dll/mesa32/src/sparc/clip.S @@ -0,0 +1,243 @@ +/* + * Clip testing in SPARC assembly + */ + +#if __arch64__ +#define LDPTR ldx +#define V4F_DATA 0x00 +#define V4F_START 0x08 +#define V4F_COUNT 0x10 +#define V4F_STRIDE 0x14 +#define V4F_SIZE 0x18 +#define V4F_FLAGS 0x1c +#else +#define LDPTR ld +#define V4F_DATA 0x00 +#define V4F_START 0x04 +#define V4F_COUNT 0x08 +#define V4F_STRIDE 0x0c +#define V4F_SIZE 0x10 +#define V4F_FLAGS 0x14 +#endif + +#define VEC_SIZE_1 1 +#define VEC_SIZE_2 3 +#define VEC_SIZE_3 7 +#define VEC_SIZE_4 15 + +#if defined(SVR4) || defined(__SVR4) || defined(__svr4__) + /* Solaris requires this for 64-bit. */ + .register %g2, #scratch + .register %g3, #scratch + .register %g7, #scratch +#endif + + .text + .align 64 + +one_dot_zero: + .word 0x3f800000 /* 1.0f */ + + /* This trick is shamelessly stolen from the x86 + * Mesa asm. Very clever, and we can do it too + * since we have the necessary add with carry + * instructions on Sparc. + */ +clip_table: + .byte 0, 1, 0, 2, 4, 5, 4, 6 + .byte 0, 1, 0, 2, 8, 9, 8, 10 + .byte 32, 33, 32, 34, 36, 37, 36, 38 + .byte 32, 33, 32, 34, 40, 41, 40, 42 + .byte 0, 1, 0, 2, 4, 5, 4, 6 + .byte 0, 1, 0, 2, 8, 9, 8, 10 + .byte 16, 17, 16, 18, 20, 21, 20, 22 + .byte 16, 17, 16, 18, 24, 25, 24, 26 + .byte 63, 61, 63, 62, 55, 53, 55, 54 + .byte 63, 61, 63, 62, 59, 57, 59, 58 + .byte 47, 45, 47, 46, 39, 37, 39, 38 + .byte 47, 45, 47, 46, 43, 41, 43, 42 + .byte 63, 61, 63, 62, 55, 53, 55, 54 + .byte 63, 61, 63, 62, 59, 57, 59, 58 + .byte 31, 29, 31, 30, 23, 21, 23, 22 + .byte 31, 29, 31, 30, 27, 25, 27, 26 + +/* GLvector4f *clip_vec, GLvector4f *proj_vec, + GLubyte clipMask[], GLubyte *orMask, GLubyte *andMask */ + + .align 64 +__pc_tramp: + retl + nop + + .globl _mesa_sparc_cliptest_points4 +_mesa_sparc_cliptest_points4: + save %sp, -64, %sp + call __pc_tramp + sub %o7, (. - one_dot_zero - 4), %g1 + ld [%g1 + 0x0], %f4 + add %g1, 0x4, %g1 + + ld [%i0 + V4F_STRIDE], %l1 + ld [%i0 + V4F_COUNT], %g7 + LDPTR [%i0 + V4F_START], %i0 + LDPTR [%i1 + V4F_START], %i5 + ldub [%i3], %g2 + ldub [%i4], %g3 + sll %g3, 8, %g3 + or %g2, %g3, %g2 + + ld [%i1 + V4F_FLAGS], %g3 + or %g3, VEC_SIZE_4, %g3 + st %g3, [%i1 + V4F_FLAGS] + mov 3, %g3 + st %g3, [%i1 + V4F_SIZE] + st %g7, [%i1 + V4F_COUNT] + clr %l2 + clr %l0 + + /* l0: i + * g7: count + * l1: stride + * l2: c + * g2: (tmpAndMask << 8) | tmpOrMask + * g1: clip_table + * i0: from[stride][i] + * i2: clipMask + * i5: vProj[4][i] + */ + +1: ld [%i0 + 0x0c], %f3 ! LSU Group + ld [%i0 + 0x0c], %g5 ! LSU Group + ld [%i0 + 0x08], %g4 ! LSU Group + fdivs %f4, %f3, %f8 ! FGM + addcc %g5, %g5, %g5 ! IEU1 Group + addx %g0, 0x0, %g3 ! IEU1 Group + addcc %g4, %g4, %g4 ! IEU1 Group + addx %g3, %g3, %g3 ! IEU1 Group + subcc %g5, %g4, %g0 ! IEU1 Group + ld [%i0 + 0x04], %g4 ! LSU Group + addx %g3, %g3, %g3 ! IEU1 Group + addcc %g4, %g4, %g4 ! IEU1 Group + addx %g3, %g3, %g3 ! IEU1 Group + subcc %g5, %g4, %g0 ! IEU1 Group + ld [%i0 + 0x00], %g4 ! LSU Group + addx %g3, %g3, %g3 ! IEU1 Group + addcc %g4, %g4, %g4 ! IEU1 Group + addx %g3, %g3, %g3 ! IEU1 Group + subcc %g5, %g4, %g0 ! IEU1 Group + addx %g3, %g3, %g3 ! IEU1 Group + ldub [%g1 + %g3], %g3 ! LSU Group + cmp %g3, 0 ! IEU1 Group, stall + be 2f ! CTI + stb %g3, [%i2] ! LSU + sll %g3, 8, %g4 ! IEU1 Group + add %l2, 1, %l2 ! IEU0 + st %g0, [%i5 + 0x00] ! LSU + or %g4, 0xff, %g4 ! IEU0 Group + or %g2, %g3, %g2 ! IEU1 + st %g0, [%i5 + 0x04] ! LSU + and %g2, %g4, %g2 ! IEU0 Group + st %g0, [%i5 + 0x08] ! LSU + b 3f ! CTI + st %f4, [%i5 + 0x0c] ! LSU Group +2: ld [%i0 + 0x00], %f0 ! LSU Group + ld [%i0 + 0x04], %f1 ! LSU Group + ld [%i0 + 0x08], %f2 ! LSU Group + fmuls %f0, %f8, %f0 ! FGM + st %f0, [%i5 + 0x00] ! LSU Group + fmuls %f1, %f8, %f1 ! FGM + st %f1, [%i5 + 0x04] ! LSU Group + fmuls %f2, %f8, %f2 ! FGM + st %f2, [%i5 + 0x08] ! LSU Group + st %f8, [%i5 + 0x0c] ! LSU Group +3: add %i5, 0x10, %i5 ! IEU1 + add %l0, 1, %l0 ! IEU0 Group + add %i2, 1, %i2 ! IEU0 Group + cmp %l0, %g7 ! IEU1 Group + bne 1b ! CTI + add %i0, %l1, %i0 ! IEU0 Group + stb %g2, [%i3] ! LSU + srl %g2, 8, %g3 ! IEU0 Group + cmp %l2, %g7 ! IEU1 Group + bl,a 1f ! CTI + clr %g3 ! IEU0 +1: stb %g3, [%i4] ! LSU Group + ret ! CTI Group + restore %i1, 0x0, %o0 + + .globl _mesa_sparc_cliptest_points4_np +_mesa_sparc_cliptest_points4_np: + save %sp, -64, %sp + + call __pc_tramp + sub %o7, (. - one_dot_zero - 4), %g1 + add %g1, 0x4, %g1 + + ld [%i0 + V4F_STRIDE], %l1 + ld [%i0 + V4F_COUNT], %g7 + LDPTR [%i0 + V4F_START], %i0 + LDPTR [%i1 + V4F_START], %i5 + ldub [%i3], %g2 + ldub [%i4], %g3 + sll %g3, 8, %g3 + or %g2, %g3, %g2 + + ld [%i1 + V4F_FLAGS], %g3 + or %g3, VEC_SIZE_4, %g3 + st %g3, [%i1 + V4F_FLAGS] + mov 3, %g3 + st %g3, [%i1 + V4F_SIZE] + st %g7, [%i1 + V4F_COUNT] + clr %l2 + clr %l0 + + /* l0: i + * g7: count + * l1: stride + * l2: c + * g2: (tmpAndMask << 8) | tmpOrMask + * g1: clip_table + * i0: from[stride][i] + * i2: clipMask + */ + +1: ld [%i0 + 0x0c], %g5 ! LSU Group + ld [%i0 + 0x08], %g4 ! LSU Group + addcc %g5, %g5, %g5 ! IEU1 Group + addx %g0, 0x0, %g3 ! IEU1 Group + addcc %g4, %g4, %g4 ! IEU1 Group + addx %g3, %g3, %g3 ! IEU1 Group + subcc %g5, %g4, %g0 ! IEU1 Group + ld [%i0 + 0x04], %g4 ! LSU Group + addx %g3, %g3, %g3 ! IEU1 Group + addcc %g4, %g4, %g4 ! IEU1 Group + addx %g3, %g3, %g3 ! IEU1 Group + subcc %g5, %g4, %g0 ! IEU1 Group + ld [%i0 + 0x00], %g4 ! LSU Group + addx %g3, %g3, %g3 ! IEU1 Group + addcc %g4, %g4, %g4 ! IEU1 Group + addx %g3, %g3, %g3 ! IEU1 Group + subcc %g5, %g4, %g0 ! IEU1 Group + addx %g3, %g3, %g3 ! IEU1 Group + ldub [%g1 + %g3], %g3 ! LSU Group + cmp %g3, 0 ! IEU1 Group, stall + be 2f ! CTI + stb %g3, [%i2] ! LSU + sll %g3, 8, %g4 ! IEU1 Group + add %l2, 1, %l2 ! IEU0 + or %g4, 0xff, %g4 ! IEU0 Group + or %g2, %g3, %g2 ! IEU1 + and %g2, %g4, %g2 ! IEU0 Group +2: add %l0, 1, %l0 ! IEU0 Group + add %i2, 1, %i2 ! IEU0 Group + cmp %l0, %g7 ! IEU1 Group + bne 1b ! CTI + add %i0, %l1, %i0 ! IEU0 Group + stb %g2, [%i3] ! LSU + srl %g2, 8, %g3 ! IEU0 Group + cmp %l2, %g7 ! IEU1 Group + bl,a 1f ! CTI + clr %g3 ! IEU0 +1: stb %g3, [%i4] ! LSU Group + ret ! CTI Group + restore %i1, 0x0, %o0 diff --git a/reactos/dll/mesa32/src/sparc/glapi_sparc.S b/reactos/dll/mesa32/src/sparc/glapi_sparc.S new file mode 100644 index 00000000000..175a2819f73 --- /dev/null +++ b/reactos/dll/mesa32/src/sparc/glapi_sparc.S @@ -0,0 +1,1884 @@ +/* DO NOT EDIT - This file generated automatically by gl_SPARC_asm.py (from Mesa) script */ + +/* + * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * (C) Copyright IBM Corporation 2004 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL, IBM, + * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "glapioffsets.h" + +#ifdef __arch64__ +# define GL_STUB(fn,off) \ +fn: \ + sethi %hi(0x00000000), %g4 ; \ + sethi %hi(0x00000000), %g1 ; \ + or %g4, %lo(0x00000000), %g4 ; \ + or %g1, %lo(0x00000000), %g1 ; \ + sllx %g4, 32, %g4 ; \ + ldx [%g1 + %g4], %g1 ; \ + sethi %hi(8 * off), %g4 ; \ + or %g4, %lo(8 * off), %g4 ; \ + ldx [%g1 + %g4], %g5 ; \ + jmpl %g5, %g0 ; \ + nop +#else +# define GL_STUB(fn,off) \ +fn: \ + sethi %hi(0x00000000), %g1 ; \ + ld [%g1 + %lo(0x00000000)], %g1 ; \ + ld [%g1 + (4 * off)], %g5 ; \ + jmpl %g5, %g0 ; \ + nop +#endif + +#define GL_STUB_ALIAS(fn,alias) fn = alias + +.text +.align 32 + .globl __glapi_sparc_icache_flush ; .type __glapi_sparc_icache_flush,#function +__glapi_sparc_icache_flush: /* %o0 = insn_addr */ + flush %o0 + retl + nop + +.data +.align 64 + + .globl glNewList ; .type glNewList,#function + .globl glEndList ; .type glEndList,#function + .globl glCallList ; .type glCallList,#function + .globl glCallLists ; .type glCallLists,#function + .globl glDeleteLists ; .type glDeleteLists,#function + .globl glGenLists ; .type glGenLists,#function + .globl glListBase ; .type glListBase,#function + .globl glBegin ; .type glBegin,#function + .globl glBitmap ; .type glBitmap,#function + .globl glColor3b ; .type glColor3b,#function + .globl glColor3bv ; .type glColor3bv,#function + .globl glColor3d ; .type glColor3d,#function + .globl glColor3dv ; .type glColor3dv,#function + .globl glColor3f ; .type glColor3f,#function + .globl glColor3fv ; .type glColor3fv,#function + .globl glColor3i ; .type glColor3i,#function + .globl glColor3iv ; .type glColor3iv,#function + .globl glColor3s ; .type glColor3s,#function + .globl glColor3sv ; .type glColor3sv,#function + .globl glColor3ub ; .type glColor3ub,#function + .globl glColor3ubv ; .type glColor3ubv,#function + .globl glColor3ui ; .type glColor3ui,#function + .globl glColor3uiv ; .type glColor3uiv,#function + .globl glColor3us ; .type glColor3us,#function + .globl glColor3usv ; .type glColor3usv,#function + .globl glColor4b ; .type glColor4b,#function + .globl glColor4bv ; .type glColor4bv,#function + .globl glColor4d ; .type glColor4d,#function + .globl glColor4dv ; .type glColor4dv,#function + .globl glColor4f ; .type glColor4f,#function + .globl glColor4fv ; .type glColor4fv,#function + .globl glColor4i ; .type glColor4i,#function + .globl glColor4iv ; .type glColor4iv,#function + .globl glColor4s ; .type glColor4s,#function + .globl glColor4sv ; .type glColor4sv,#function + .globl glColor4ub ; .type glColor4ub,#function + .globl glColor4ubv ; .type glColor4ubv,#function + .globl glColor4ui ; .type glColor4ui,#function + .globl glColor4uiv ; .type glColor4uiv,#function + .globl glColor4us ; .type glColor4us,#function + .globl glColor4usv ; .type glColor4usv,#function + .globl glEdgeFlag ; .type glEdgeFlag,#function + .globl glEdgeFlagv ; .type glEdgeFlagv,#function + .globl glEnd ; .type glEnd,#function + .globl glIndexd ; .type glIndexd,#function + .globl glIndexdv ; .type glIndexdv,#function + .globl glIndexf ; .type glIndexf,#function + .globl glIndexfv ; .type glIndexfv,#function + .globl glIndexi ; .type glIndexi,#function + .globl glIndexiv ; .type glIndexiv,#function + .globl glIndexs ; .type glIndexs,#function + .globl glIndexsv ; .type glIndexsv,#function + .globl glNormal3b ; .type glNormal3b,#function + .globl glNormal3bv ; .type glNormal3bv,#function + .globl glNormal3d ; .type glNormal3d,#function + .globl glNormal3dv ; .type glNormal3dv,#function + .globl glNormal3f ; .type glNormal3f,#function + .globl glNormal3fv ; .type glNormal3fv,#function + .globl glNormal3i ; .type glNormal3i,#function + .globl glNormal3iv ; .type glNormal3iv,#function + .globl glNormal3s ; .type glNormal3s,#function + .globl glNormal3sv ; .type glNormal3sv,#function + .globl glRasterPos2d ; .type glRasterPos2d,#function + .globl glRasterPos2dv ; .type glRasterPos2dv,#function + .globl glRasterPos2f ; .type glRasterPos2f,#function + .globl glRasterPos2fv ; .type glRasterPos2fv,#function + .globl glRasterPos2i ; .type glRasterPos2i,#function + .globl glRasterPos2iv ; .type glRasterPos2iv,#function + .globl glRasterPos2s ; .type glRasterPos2s,#function + .globl glRasterPos2sv ; .type glRasterPos2sv,#function + .globl glRasterPos3d ; .type glRasterPos3d,#function + .globl glRasterPos3dv ; .type glRasterPos3dv,#function + .globl glRasterPos3f ; .type glRasterPos3f,#function + .globl glRasterPos3fv ; .type glRasterPos3fv,#function + .globl glRasterPos3i ; .type glRasterPos3i,#function + .globl glRasterPos3iv ; .type glRasterPos3iv,#function + .globl glRasterPos3s ; .type glRasterPos3s,#function + .globl glRasterPos3sv ; .type glRasterPos3sv,#function + .globl glRasterPos4d ; .type glRasterPos4d,#function + .globl glRasterPos4dv ; .type glRasterPos4dv,#function + .globl glRasterPos4f ; .type glRasterPos4f,#function + .globl glRasterPos4fv ; .type glRasterPos4fv,#function + .globl glRasterPos4i ; .type glRasterPos4i,#function + .globl glRasterPos4iv ; .type glRasterPos4iv,#function + .globl glRasterPos4s ; .type glRasterPos4s,#function + .globl glRasterPos4sv ; .type glRasterPos4sv,#function + .globl glRectd ; .type glRectd,#function + .globl glRectdv ; .type glRectdv,#function + .globl glRectf ; .type glRectf,#function + .globl glRectfv ; .type glRectfv,#function + .globl glRecti ; .type glRecti,#function + .globl glRectiv ; .type glRectiv,#function + .globl glRects ; .type glRects,#function + .globl glRectsv ; .type glRectsv,#function + .globl glTexCoord1d ; .type glTexCoord1d,#function + .globl glTexCoord1dv ; .type glTexCoord1dv,#function + .globl glTexCoord1f ; .type glTexCoord1f,#function + .globl glTexCoord1fv ; .type glTexCoord1fv,#function + .globl glTexCoord1i ; .type glTexCoord1i,#function + .globl glTexCoord1iv ; .type glTexCoord1iv,#function + .globl glTexCoord1s ; .type glTexCoord1s,#function + .globl glTexCoord1sv ; .type glTexCoord1sv,#function + .globl glTexCoord2d ; .type glTexCoord2d,#function + .globl glTexCoord2dv ; .type glTexCoord2dv,#function + .globl glTexCoord2f ; .type glTexCoord2f,#function + .globl glTexCoord2fv ; .type glTexCoord2fv,#function + .globl glTexCoord2i ; .type glTexCoord2i,#function + .globl glTexCoord2iv ; .type glTexCoord2iv,#function + .globl glTexCoord2s ; .type glTexCoord2s,#function + .globl glTexCoord2sv ; .type glTexCoord2sv,#function + .globl glTexCoord3d ; .type glTexCoord3d,#function + .globl glTexCoord3dv ; .type glTexCoord3dv,#function + .globl glTexCoord3f ; .type glTexCoord3f,#function + .globl glTexCoord3fv ; .type glTexCoord3fv,#function + .globl glTexCoord3i ; .type glTexCoord3i,#function + .globl glTexCoord3iv ; .type glTexCoord3iv,#function + .globl glTexCoord3s ; .type glTexCoord3s,#function + .globl glTexCoord3sv ; .type glTexCoord3sv,#function + .globl glTexCoord4d ; .type glTexCoord4d,#function + .globl glTexCoord4dv ; .type glTexCoord4dv,#function + .globl glTexCoord4f ; .type glTexCoord4f,#function + .globl glTexCoord4fv ; .type glTexCoord4fv,#function + .globl glTexCoord4i ; .type glTexCoord4i,#function + .globl glTexCoord4iv ; .type glTexCoord4iv,#function + .globl glTexCoord4s ; .type glTexCoord4s,#function + .globl glTexCoord4sv ; .type glTexCoord4sv,#function + .globl glVertex2d ; .type glVertex2d,#function + .globl glVertex2dv ; .type glVertex2dv,#function + .globl glVertex2f ; .type glVertex2f,#function + .globl glVertex2fv ; .type glVertex2fv,#function + .globl glVertex2i ; .type glVertex2i,#function + .globl glVertex2iv ; .type glVertex2iv,#function + .globl glVertex2s ; .type glVertex2s,#function + .globl glVertex2sv ; .type glVertex2sv,#function + .globl glVertex3d ; .type glVertex3d,#function + .globl glVertex3dv ; .type glVertex3dv,#function + .globl glVertex3f ; .type glVertex3f,#function + .globl glVertex3fv ; .type glVertex3fv,#function + .globl glVertex3i ; .type glVertex3i,#function + .globl glVertex3iv ; .type glVertex3iv,#function + .globl glVertex3s ; .type glVertex3s,#function + .globl glVertex3sv ; .type glVertex3sv,#function + .globl glVertex4d ; .type glVertex4d,#function + .globl glVertex4dv ; .type glVertex4dv,#function + .globl glVertex4f ; .type glVertex4f,#function + .globl glVertex4fv ; .type glVertex4fv,#function + .globl glVertex4i ; .type glVertex4i,#function + .globl glVertex4iv ; .type glVertex4iv,#function + .globl glVertex4s ; .type glVertex4s,#function + .globl glVertex4sv ; .type glVertex4sv,#function + .globl glClipPlane ; .type glClipPlane,#function + .globl glColorMaterial ; .type glColorMaterial,#function + .globl glCullFace ; .type glCullFace,#function + .globl glFogf ; .type glFogf,#function + .globl glFogfv ; .type glFogfv,#function + .globl glFogi ; .type glFogi,#function + .globl glFogiv ; .type glFogiv,#function + .globl glFrontFace ; .type glFrontFace,#function + .globl glHint ; .type glHint,#function + .globl glLightf ; .type glLightf,#function + .globl glLightfv ; .type glLightfv,#function + .globl glLighti ; .type glLighti,#function + .globl glLightiv ; .type glLightiv,#function + .globl glLightModelf ; .type glLightModelf,#function + .globl glLightModelfv ; .type glLightModelfv,#function + .globl glLightModeli ; .type glLightModeli,#function + .globl glLightModeliv ; .type glLightModeliv,#function + .globl glLineStipple ; .type glLineStipple,#function + .globl glLineWidth ; .type glLineWidth,#function + .globl glMaterialf ; .type glMaterialf,#function + .globl glMaterialfv ; .type glMaterialfv,#function + .globl glMateriali ; .type glMateriali,#function + .globl glMaterialiv ; .type glMaterialiv,#function + .globl glPointSize ; .type glPointSize,#function + .globl glPolygonMode ; .type glPolygonMode,#function + .globl glPolygonStipple ; .type glPolygonStipple,#function + .globl glScissor ; .type glScissor,#function + .globl glShadeModel ; .type glShadeModel,#function + .globl glTexParameterf ; .type glTexParameterf,#function + .globl glTexParameterfv ; .type glTexParameterfv,#function + .globl glTexParameteri ; .type glTexParameteri,#function + .globl glTexParameteriv ; .type glTexParameteriv,#function + .globl glTexImage1D ; .type glTexImage1D,#function + .globl glTexImage2D ; .type glTexImage2D,#function + .globl glTexEnvf ; .type glTexEnvf,#function + .globl glTexEnvfv ; .type glTexEnvfv,#function + .globl glTexEnvi ; .type glTexEnvi,#function + .globl glTexEnviv ; .type glTexEnviv,#function + .globl glTexGend ; .type glTexGend,#function + .globl glTexGendv ; .type glTexGendv,#function + .globl glTexGenf ; .type glTexGenf,#function + .globl glTexGenfv ; .type glTexGenfv,#function + .globl glTexGeni ; .type glTexGeni,#function + .globl glTexGeniv ; .type glTexGeniv,#function + .globl glFeedbackBuffer ; .type glFeedbackBuffer,#function + .globl glSelectBuffer ; .type glSelectBuffer,#function + .globl glRenderMode ; .type glRenderMode,#function + .globl glInitNames ; .type glInitNames,#function + .globl glLoadName ; .type glLoadName,#function + .globl glPassThrough ; .type glPassThrough,#function + .globl glPopName ; .type glPopName,#function + .globl glPushName ; .type glPushName,#function + .globl glDrawBuffer ; .type glDrawBuffer,#function + .globl glClear ; .type glClear,#function + .globl glClearAccum ; .type glClearAccum,#function + .globl glClearIndex ; .type glClearIndex,#function + .globl glClearColor ; .type glClearColor,#function + .globl glClearStencil ; .type glClearStencil,#function + .globl glClearDepth ; .type glClearDepth,#function + .globl glStencilMask ; .type glStencilMask,#function + .globl glColorMask ; .type glColorMask,#function + .globl glDepthMask ; .type glDepthMask,#function + .globl glIndexMask ; .type glIndexMask,#function + .globl glAccum ; .type glAccum,#function + .globl glDisable ; .type glDisable,#function + .globl glEnable ; .type glEnable,#function + .globl glFinish ; .type glFinish,#function + .globl glFlush ; .type glFlush,#function + .globl glPopAttrib ; .type glPopAttrib,#function + .globl glPushAttrib ; .type glPushAttrib,#function + .globl glMap1d ; .type glMap1d,#function + .globl glMap1f ; .type glMap1f,#function + .globl glMap2d ; .type glMap2d,#function + .globl glMap2f ; .type glMap2f,#function + .globl glMapGrid1d ; .type glMapGrid1d,#function + .globl glMapGrid1f ; .type glMapGrid1f,#function + .globl glMapGrid2d ; .type glMapGrid2d,#function + .globl glMapGrid2f ; .type glMapGrid2f,#function + .globl glEvalCoord1d ; .type glEvalCoord1d,#function + .globl glEvalCoord1dv ; .type glEvalCoord1dv,#function + .globl glEvalCoord1f ; .type glEvalCoord1f,#function + .globl glEvalCoord1fv ; .type glEvalCoord1fv,#function + .globl glEvalCoord2d ; .type glEvalCoord2d,#function + .globl glEvalCoord2dv ; .type glEvalCoord2dv,#function + .globl glEvalCoord2f ; .type glEvalCoord2f,#function + .globl glEvalCoord2fv ; .type glEvalCoord2fv,#function + .globl glEvalMesh1 ; .type glEvalMesh1,#function + .globl glEvalPoint1 ; .type glEvalPoint1,#function + .globl glEvalMesh2 ; .type glEvalMesh2,#function + .globl glEvalPoint2 ; .type glEvalPoint2,#function + .globl glAlphaFunc ; .type glAlphaFunc,#function + .globl glBlendFunc ; .type glBlendFunc,#function + .globl glLogicOp ; .type glLogicOp,#function + .globl glStencilFunc ; .type glStencilFunc,#function + .globl glStencilOp ; .type glStencilOp,#function + .globl glDepthFunc ; .type glDepthFunc,#function + .globl glPixelZoom ; .type glPixelZoom,#function + .globl glPixelTransferf ; .type glPixelTransferf,#function + .globl glPixelTransferi ; .type glPixelTransferi,#function + .globl glPixelStoref ; .type glPixelStoref,#function + .globl glPixelStorei ; .type glPixelStorei,#function + .globl glPixelMapfv ; .type glPixelMapfv,#function + .globl glPixelMapuiv ; .type glPixelMapuiv,#function + .globl glPixelMapusv ; .type glPixelMapusv,#function + .globl glReadBuffer ; .type glReadBuffer,#function + .globl glCopyPixels ; .type glCopyPixels,#function + .globl glReadPixels ; .type glReadPixels,#function + .globl glDrawPixels ; .type glDrawPixels,#function + .globl glGetBooleanv ; .type glGetBooleanv,#function + .globl glGetClipPlane ; .type glGetClipPlane,#function + .globl glGetDoublev ; .type glGetDoublev,#function + .globl glGetError ; .type glGetError,#function + .globl glGetFloatv ; .type glGetFloatv,#function + .globl glGetIntegerv ; .type glGetIntegerv,#function + .globl glGetLightfv ; .type glGetLightfv,#function + .globl glGetLightiv ; .type glGetLightiv,#function + .globl glGetMapdv ; .type glGetMapdv,#function + .globl glGetMapfv ; .type glGetMapfv,#function + .globl glGetMapiv ; .type glGetMapiv,#function + .globl glGetMaterialfv ; .type glGetMaterialfv,#function + .globl glGetMaterialiv ; .type glGetMaterialiv,#function + .globl glGetPixelMapfv ; .type glGetPixelMapfv,#function + .globl glGetPixelMapuiv ; .type glGetPixelMapuiv,#function + .globl glGetPixelMapusv ; .type glGetPixelMapusv,#function + .globl glGetPolygonStipple ; .type glGetPolygonStipple,#function + .globl glGetString ; .type glGetString,#function + .globl glGetTexEnvfv ; .type glGetTexEnvfv,#function + .globl glGetTexEnviv ; .type glGetTexEnviv,#function + .globl glGetTexGendv ; .type glGetTexGendv,#function + .globl glGetTexGenfv ; .type glGetTexGenfv,#function + .globl glGetTexGeniv ; .type glGetTexGeniv,#function + .globl glGetTexImage ; .type glGetTexImage,#function + .globl glGetTexParameterfv ; .type glGetTexParameterfv,#function + .globl glGetTexParameteriv ; .type glGetTexParameteriv,#function + .globl glGetTexLevelParameterfv ; .type glGetTexLevelParameterfv,#function + .globl glGetTexLevelParameteriv ; .type glGetTexLevelParameteriv,#function + .globl glIsEnabled ; .type glIsEnabled,#function + .globl glIsList ; .type glIsList,#function + .globl glDepthRange ; .type glDepthRange,#function + .globl glFrustum ; .type glFrustum,#function + .globl glLoadIdentity ; .type glLoadIdentity,#function + .globl glLoadMatrixf ; .type glLoadMatrixf,#function + .globl glLoadMatrixd ; .type glLoadMatrixd,#function + .globl glMatrixMode ; .type glMatrixMode,#function + .globl glMultMatrixf ; .type glMultMatrixf,#function + .globl glMultMatrixd ; .type glMultMatrixd,#function + .globl glOrtho ; .type glOrtho,#function + .globl glPopMatrix ; .type glPopMatrix,#function + .globl glPushMatrix ; .type glPushMatrix,#function + .globl glRotated ; .type glRotated,#function + .globl glRotatef ; .type glRotatef,#function + .globl glScaled ; .type glScaled,#function + .globl glScalef ; .type glScalef,#function + .globl glTranslated ; .type glTranslated,#function + .globl glTranslatef ; .type glTranslatef,#function + .globl glViewport ; .type glViewport,#function + .globl glArrayElement ; .type glArrayElement,#function + .globl glBindTexture ; .type glBindTexture,#function + .globl glColorPointer ; .type glColorPointer,#function + .globl glDisableClientState ; .type glDisableClientState,#function + .globl glDrawArrays ; .type glDrawArrays,#function + .globl glDrawElements ; .type glDrawElements,#function + .globl glEdgeFlagPointer ; .type glEdgeFlagPointer,#function + .globl glEnableClientState ; .type glEnableClientState,#function + .globl glIndexPointer ; .type glIndexPointer,#function + .globl glIndexub ; .type glIndexub,#function + .globl glIndexubv ; .type glIndexubv,#function + .globl glInterleavedArrays ; .type glInterleavedArrays,#function + .globl glNormalPointer ; .type glNormalPointer,#function + .globl glPolygonOffset ; .type glPolygonOffset,#function + .globl glTexCoordPointer ; .type glTexCoordPointer,#function + .globl glVertexPointer ; .type glVertexPointer,#function + .globl glAreTexturesResident ; .type glAreTexturesResident,#function + .globl glCopyTexImage1D ; .type glCopyTexImage1D,#function + .globl glCopyTexImage2D ; .type glCopyTexImage2D,#function + .globl glCopyTexSubImage1D ; .type glCopyTexSubImage1D,#function + .globl glCopyTexSubImage2D ; .type glCopyTexSubImage2D,#function + .globl glDeleteTextures ; .type glDeleteTextures,#function + .globl glGenTextures ; .type glGenTextures,#function + .globl glGetPointerv ; .type glGetPointerv,#function + .globl glIsTexture ; .type glIsTexture,#function + .globl glPrioritizeTextures ; .type glPrioritizeTextures,#function + .globl glTexSubImage1D ; .type glTexSubImage1D,#function + .globl glTexSubImage2D ; .type glTexSubImage2D,#function + .globl glPopClientAttrib ; .type glPopClientAttrib,#function + .globl glPushClientAttrib ; .type glPushClientAttrib,#function + .globl glBlendColor ; .type glBlendColor,#function + .globl glBlendEquation ; .type glBlendEquation,#function + .globl glDrawRangeElements ; .type glDrawRangeElements,#function + .globl glColorTable ; .type glColorTable,#function + .globl glColorTableParameterfv ; .type glColorTableParameterfv,#function + .globl glColorTableParameteriv ; .type glColorTableParameteriv,#function + .globl glCopyColorTable ; .type glCopyColorTable,#function + .globl glGetColorTable ; .type glGetColorTable,#function + .globl glGetColorTableParameterfv ; .type glGetColorTableParameterfv,#function + .globl glGetColorTableParameteriv ; .type glGetColorTableParameteriv,#function + .globl glColorSubTable ; .type glColorSubTable,#function + .globl glCopyColorSubTable ; .type glCopyColorSubTable,#function + .globl glConvolutionFilter1D ; .type glConvolutionFilter1D,#function + .globl glConvolutionFilter2D ; .type glConvolutionFilter2D,#function + .globl glConvolutionParameterf ; .type glConvolutionParameterf,#function + .globl glConvolutionParameterfv ; .type glConvolutionParameterfv,#function + .globl glConvolutionParameteri ; .type glConvolutionParameteri,#function + .globl glConvolutionParameteriv ; .type glConvolutionParameteriv,#function + .globl glCopyConvolutionFilter1D ; .type glCopyConvolutionFilter1D,#function + .globl glCopyConvolutionFilter2D ; .type glCopyConvolutionFilter2D,#function + .globl glGetConvolutionFilter ; .type glGetConvolutionFilter,#function + .globl glGetConvolutionParameterfv ; .type glGetConvolutionParameterfv,#function + .globl glGetConvolutionParameteriv ; .type glGetConvolutionParameteriv,#function + .globl glGetSeparableFilter ; .type glGetSeparableFilter,#function + .globl glSeparableFilter2D ; .type glSeparableFilter2D,#function + .globl glGetHistogram ; .type glGetHistogram,#function + .globl glGetHistogramParameterfv ; .type glGetHistogramParameterfv,#function + .globl glGetHistogramParameteriv ; .type glGetHistogramParameteriv,#function + .globl glGetMinmax ; .type glGetMinmax,#function + .globl glGetMinmaxParameterfv ; .type glGetMinmaxParameterfv,#function + .globl glGetMinmaxParameteriv ; .type glGetMinmaxParameteriv,#function + .globl glHistogram ; .type glHistogram,#function + .globl glMinmax ; .type glMinmax,#function + .globl glResetHistogram ; .type glResetHistogram,#function + .globl glResetMinmax ; .type glResetMinmax,#function + .globl glTexImage3D ; .type glTexImage3D,#function + .globl glTexSubImage3D ; .type glTexSubImage3D,#function + .globl glCopyTexSubImage3D ; .type glCopyTexSubImage3D,#function + .globl glActiveTextureARB ; .type glActiveTextureARB,#function + .globl glClientActiveTextureARB ; .type glClientActiveTextureARB,#function + .globl glMultiTexCoord1dARB ; .type glMultiTexCoord1dARB,#function + .globl glMultiTexCoord1dvARB ; .type glMultiTexCoord1dvARB,#function + .globl glMultiTexCoord1fARB ; .type glMultiTexCoord1fARB,#function + .globl glMultiTexCoord1fvARB ; .type glMultiTexCoord1fvARB,#function + .globl glMultiTexCoord1iARB ; .type glMultiTexCoord1iARB,#function + .globl glMultiTexCoord1ivARB ; .type glMultiTexCoord1ivARB,#function + .globl glMultiTexCoord1sARB ; .type glMultiTexCoord1sARB,#function + .globl glMultiTexCoord1svARB ; .type glMultiTexCoord1svARB,#function + .globl glMultiTexCoord2dARB ; .type glMultiTexCoord2dARB,#function + .globl glMultiTexCoord2dvARB ; .type glMultiTexCoord2dvARB,#function + .globl glMultiTexCoord2fARB ; .type glMultiTexCoord2fARB,#function + .globl glMultiTexCoord2fvARB ; .type glMultiTexCoord2fvARB,#function + .globl glMultiTexCoord2iARB ; .type glMultiTexCoord2iARB,#function + .globl glMultiTexCoord2ivARB ; .type glMultiTexCoord2ivARB,#function + .globl glMultiTexCoord2sARB ; .type glMultiTexCoord2sARB,#function + .globl glMultiTexCoord2svARB ; .type glMultiTexCoord2svARB,#function + .globl glMultiTexCoord3dARB ; .type glMultiTexCoord3dARB,#function + .globl glMultiTexCoord3dvARB ; .type glMultiTexCoord3dvARB,#function + .globl glMultiTexCoord3fARB ; .type glMultiTexCoord3fARB,#function + .globl glMultiTexCoord3fvARB ; .type glMultiTexCoord3fvARB,#function + .globl glMultiTexCoord3iARB ; .type glMultiTexCoord3iARB,#function + .globl glMultiTexCoord3ivARB ; .type glMultiTexCoord3ivARB,#function + .globl glMultiTexCoord3sARB ; .type glMultiTexCoord3sARB,#function + .globl glMultiTexCoord3svARB ; .type glMultiTexCoord3svARB,#function + .globl glMultiTexCoord4dARB ; .type glMultiTexCoord4dARB,#function + .globl glMultiTexCoord4dvARB ; .type glMultiTexCoord4dvARB,#function + .globl glMultiTexCoord4fARB ; .type glMultiTexCoord4fARB,#function + .globl glMultiTexCoord4fvARB ; .type glMultiTexCoord4fvARB,#function + .globl glMultiTexCoord4iARB ; .type glMultiTexCoord4iARB,#function + .globl glMultiTexCoord4ivARB ; .type glMultiTexCoord4ivARB,#function + .globl glMultiTexCoord4sARB ; .type glMultiTexCoord4sARB,#function + .globl glMultiTexCoord4svARB ; .type glMultiTexCoord4svARB,#function + .globl glLoadTransposeMatrixfARB ; .type glLoadTransposeMatrixfARB,#function + .globl glLoadTransposeMatrixdARB ; .type glLoadTransposeMatrixdARB,#function + .globl glMultTransposeMatrixfARB ; .type glMultTransposeMatrixfARB,#function + .globl glMultTransposeMatrixdARB ; .type glMultTransposeMatrixdARB,#function + .globl glSampleCoverageARB ; .type glSampleCoverageARB,#function + .globl glDrawBuffersARB ; .type glDrawBuffersARB,#function + .globl glPolygonOffsetEXT ; .type glPolygonOffsetEXT,#function + .globl glGetTexFilterFuncSGIS ; .type glGetTexFilterFuncSGIS,#function + .globl glTexFilterFuncSGIS ; .type glTexFilterFuncSGIS,#function + .globl glGetHistogramEXT ; .type glGetHistogramEXT,#function + .globl glGetHistogramParameterfvEXT ; .type glGetHistogramParameterfvEXT,#function + .globl glGetHistogramParameterivEXT ; .type glGetHistogramParameterivEXT,#function + .globl glGetMinmaxEXT ; .type glGetMinmaxEXT,#function + .globl glGetMinmaxParameterfvEXT ; .type glGetMinmaxParameterfvEXT,#function + .globl glGetMinmaxParameterivEXT ; .type glGetMinmaxParameterivEXT,#function + .globl glGetConvolutionFilterEXT ; .type glGetConvolutionFilterEXT,#function + .globl glGetConvolutionParameterfvEXT ; .type glGetConvolutionParameterfvEXT,#function + .globl glGetConvolutionParameterivEXT ; .type glGetConvolutionParameterivEXT,#function + .globl glGetSeparableFilterEXT ; .type glGetSeparableFilterEXT,#function + .globl glGetColorTableSGI ; .type glGetColorTableSGI,#function + .globl glGetColorTableParameterfvSGI ; .type glGetColorTableParameterfvSGI,#function + .globl glGetColorTableParameterivSGI ; .type glGetColorTableParameterivSGI,#function + .globl glPixelTexGenSGIX ; .type glPixelTexGenSGIX,#function + .globl glPixelTexGenParameteriSGIS ; .type glPixelTexGenParameteriSGIS,#function + .globl glPixelTexGenParameterivSGIS ; .type glPixelTexGenParameterivSGIS,#function + .globl glPixelTexGenParameterfSGIS ; .type glPixelTexGenParameterfSGIS,#function + .globl glPixelTexGenParameterfvSGIS ; .type glPixelTexGenParameterfvSGIS,#function + .globl glGetPixelTexGenParameterivSGIS ; .type glGetPixelTexGenParameterivSGIS,#function + .globl glGetPixelTexGenParameterfvSGIS ; .type glGetPixelTexGenParameterfvSGIS,#function + .globl glTexImage4DSGIS ; .type glTexImage4DSGIS,#function + .globl glTexSubImage4DSGIS ; .type glTexSubImage4DSGIS,#function + .globl glAreTexturesResidentEXT ; .type glAreTexturesResidentEXT,#function + .globl glGenTexturesEXT ; .type glGenTexturesEXT,#function + .globl glIsTextureEXT ; .type glIsTextureEXT,#function + .globl glDetailTexFuncSGIS ; .type glDetailTexFuncSGIS,#function + .globl glGetDetailTexFuncSGIS ; .type glGetDetailTexFuncSGIS,#function + .globl glSharpenTexFuncSGIS ; .type glSharpenTexFuncSGIS,#function + .globl glGetSharpenTexFuncSGIS ; .type glGetSharpenTexFuncSGIS,#function + .globl glSampleMaskSGIS ; .type glSampleMaskSGIS,#function + .globl glSamplePatternSGIS ; .type glSamplePatternSGIS,#function + .globl glColorPointerEXT ; .type glColorPointerEXT,#function + .globl glEdgeFlagPointerEXT ; .type glEdgeFlagPointerEXT,#function + .globl glIndexPointerEXT ; .type glIndexPointerEXT,#function + .globl glNormalPointerEXT ; .type glNormalPointerEXT,#function + .globl glTexCoordPointerEXT ; .type glTexCoordPointerEXT,#function + .globl glVertexPointerEXT ; .type glVertexPointerEXT,#function + .globl glSpriteParameterfSGIX ; .type glSpriteParameterfSGIX,#function + .globl glSpriteParameterfvSGIX ; .type glSpriteParameterfvSGIX,#function + .globl glSpriteParameteriSGIX ; .type glSpriteParameteriSGIX,#function + .globl glSpriteParameterivSGIX ; .type glSpriteParameterivSGIX,#function + .globl glPointParameterfEXT ; .type glPointParameterfEXT,#function + .globl glPointParameterfvEXT ; .type glPointParameterfvEXT,#function + .globl glGetInstrumentsSGIX ; .type glGetInstrumentsSGIX,#function + .globl glInstrumentsBufferSGIX ; .type glInstrumentsBufferSGIX,#function + .globl glPollInstrumentsSGIX ; .type glPollInstrumentsSGIX,#function + .globl glReadInstrumentsSGIX ; .type glReadInstrumentsSGIX,#function + .globl glStartInstrumentsSGIX ; .type glStartInstrumentsSGIX,#function + .globl glStopInstrumentsSGIX ; .type glStopInstrumentsSGIX,#function + .globl glFrameZoomSGIX ; .type glFrameZoomSGIX,#function + .globl glTagSampleBufferSGIX ; .type glTagSampleBufferSGIX,#function + .globl glReferencePlaneSGIX ; .type glReferencePlaneSGIX,#function + .globl glFlushRasterSGIX ; .type glFlushRasterSGIX,#function + .globl glGetListParameterfvSGIX ; .type glGetListParameterfvSGIX,#function + .globl glGetListParameterivSGIX ; .type glGetListParameterivSGIX,#function + .globl glListParameterfSGIX ; .type glListParameterfSGIX,#function + .globl glListParameterfvSGIX ; .type glListParameterfvSGIX,#function + .globl glListParameteriSGIX ; .type glListParameteriSGIX,#function + .globl glListParameterivSGIX ; .type glListParameterivSGIX,#function + .globl glFragmentColorMaterialSGIX ; .type glFragmentColorMaterialSGIX,#function + .globl glFragmentLightfSGIX ; .type glFragmentLightfSGIX,#function + .globl glFragmentLightfvSGIX ; .type glFragmentLightfvSGIX,#function + .globl glFragmentLightiSGIX ; .type glFragmentLightiSGIX,#function + .globl glFragmentLightivSGIX ; .type glFragmentLightivSGIX,#function + .globl glFragmentLightModelfSGIX ; .type glFragmentLightModelfSGIX,#function + .globl glFragmentLightModelfvSGIX ; .type glFragmentLightModelfvSGIX,#function + .globl glFragmentLightModeliSGIX ; .type glFragmentLightModeliSGIX,#function + .globl glFragmentLightModelivSGIX ; .type glFragmentLightModelivSGIX,#function + .globl glFragmentMaterialfSGIX ; .type glFragmentMaterialfSGIX,#function + .globl glFragmentMaterialfvSGIX ; .type glFragmentMaterialfvSGIX,#function + .globl glFragmentMaterialiSGIX ; .type glFragmentMaterialiSGIX,#function + .globl glFragmentMaterialivSGIX ; .type glFragmentMaterialivSGIX,#function + .globl glGetFragmentLightfvSGIX ; .type glGetFragmentLightfvSGIX,#function + .globl glGetFragmentLightivSGIX ; .type glGetFragmentLightivSGIX,#function + .globl glGetFragmentMaterialfvSGIX ; .type glGetFragmentMaterialfvSGIX,#function + .globl glGetFragmentMaterialivSGIX ; .type glGetFragmentMaterialivSGIX,#function + .globl glLightEnviSGIX ; .type glLightEnviSGIX,#function + .globl glVertexWeightfEXT ; .type glVertexWeightfEXT,#function + .globl glVertexWeightfvEXT ; .type glVertexWeightfvEXT,#function + .globl glVertexWeightPointerEXT ; .type glVertexWeightPointerEXT,#function + .globl glFlushVertexArrayRangeNV ; .type glFlushVertexArrayRangeNV,#function + .globl glVertexArrayRangeNV ; .type glVertexArrayRangeNV,#function + .globl glCombinerParameterfvNV ; .type glCombinerParameterfvNV,#function + .globl glCombinerParameterfNV ; .type glCombinerParameterfNV,#function + .globl glCombinerParameterivNV ; .type glCombinerParameterivNV,#function + .globl glCombinerParameteriNV ; .type glCombinerParameteriNV,#function + .globl glCombinerInputNV ; .type glCombinerInputNV,#function + .globl glCombinerOutputNV ; .type glCombinerOutputNV,#function + .globl glFinalCombinerInputNV ; .type glFinalCombinerInputNV,#function + .globl glGetCombinerInputParameterfvNV ; .type glGetCombinerInputParameterfvNV,#function + .globl glGetCombinerInputParameterivNV ; .type glGetCombinerInputParameterivNV,#function + .globl glGetCombinerOutputParameterfvNV ; .type glGetCombinerOutputParameterfvNV,#function + .globl glGetCombinerOutputParameterivNV ; .type glGetCombinerOutputParameterivNV,#function + .globl glGetFinalCombinerInputParameterfvNV ; .type glGetFinalCombinerInputParameterfvNV,#function + .globl glGetFinalCombinerInputParameterivNV ; .type glGetFinalCombinerInputParameterivNV,#function + .globl glResizeBuffersMESA ; .type glResizeBuffersMESA,#function + .globl glWindowPos2dMESA ; .type glWindowPos2dMESA,#function + .globl glWindowPos2dvMESA ; .type glWindowPos2dvMESA,#function + .globl glWindowPos2fMESA ; .type glWindowPos2fMESA,#function + .globl glWindowPos2fvMESA ; .type glWindowPos2fvMESA,#function + .globl glWindowPos2iMESA ; .type glWindowPos2iMESA,#function + .globl glWindowPos2ivMESA ; .type glWindowPos2ivMESA,#function + .globl glWindowPos2sMESA ; .type glWindowPos2sMESA,#function + .globl glWindowPos2svMESA ; .type glWindowPos2svMESA,#function + .globl glWindowPos3dMESA ; .type glWindowPos3dMESA,#function + .globl glWindowPos3dvMESA ; .type glWindowPos3dvMESA,#function + .globl glWindowPos3fMESA ; .type glWindowPos3fMESA,#function + .globl glWindowPos3fvMESA ; .type glWindowPos3fvMESA,#function + .globl glWindowPos3iMESA ; .type glWindowPos3iMESA,#function + .globl glWindowPos3ivMESA ; .type glWindowPos3ivMESA,#function + .globl glWindowPos3sMESA ; .type glWindowPos3sMESA,#function + .globl glWindowPos3svMESA ; .type glWindowPos3svMESA,#function + .globl glWindowPos4dMESA ; .type glWindowPos4dMESA,#function + .globl glWindowPos4dvMESA ; .type glWindowPos4dvMESA,#function + .globl glWindowPos4fMESA ; .type glWindowPos4fMESA,#function + .globl glWindowPos4fvMESA ; .type glWindowPos4fvMESA,#function + .globl glWindowPos4iMESA ; .type glWindowPos4iMESA,#function + .globl glWindowPos4ivMESA ; .type glWindowPos4ivMESA,#function + .globl glWindowPos4sMESA ; .type glWindowPos4sMESA,#function + .globl glWindowPos4svMESA ; .type glWindowPos4svMESA,#function + .globl glBlendFuncSeparateEXT ; .type glBlendFuncSeparateEXT,#function + .globl glIndexMaterialEXT ; .type glIndexMaterialEXT,#function + .globl glIndexFuncEXT ; .type glIndexFuncEXT,#function + .globl glLockArraysEXT ; .type glLockArraysEXT,#function + .globl glUnlockArraysEXT ; .type glUnlockArraysEXT,#function + .globl glCullParameterdvEXT ; .type glCullParameterdvEXT,#function + .globl glCullParameterfvEXT ; .type glCullParameterfvEXT,#function + .globl glHintPGI ; .type glHintPGI,#function + .globl glFogCoordfEXT ; .type glFogCoordfEXT,#function + .globl glFogCoordfvEXT ; .type glFogCoordfvEXT,#function + .globl glFogCoorddEXT ; .type glFogCoorddEXT,#function + .globl glFogCoorddvEXT ; .type glFogCoorddvEXT,#function + .globl glFogCoordPointerEXT ; .type glFogCoordPointerEXT,#function + .globl glGetColorTableEXT ; .type glGetColorTableEXT,#function + .globl glGetColorTableParameterivEXT ; .type glGetColorTableParameterivEXT,#function + .globl glGetColorTableParameterfvEXT ; .type glGetColorTableParameterfvEXT,#function + .globl glTbufferMask3DFX ; .type glTbufferMask3DFX,#function + .globl glCompressedTexImage3DARB ; .type glCompressedTexImage3DARB,#function + .globl glCompressedTexImage2DARB ; .type glCompressedTexImage2DARB,#function + .globl glCompressedTexImage1DARB ; .type glCompressedTexImage1DARB,#function + .globl glCompressedTexSubImage3DARB ; .type glCompressedTexSubImage3DARB,#function + .globl glCompressedTexSubImage2DARB ; .type glCompressedTexSubImage2DARB,#function + .globl glCompressedTexSubImage1DARB ; .type glCompressedTexSubImage1DARB,#function + .globl glGetCompressedTexImageARB ; .type glGetCompressedTexImageARB,#function + .globl glSecondaryColor3bEXT ; .type glSecondaryColor3bEXT,#function + .globl glSecondaryColor3bvEXT ; .type glSecondaryColor3bvEXT,#function + .globl glSecondaryColor3dEXT ; .type glSecondaryColor3dEXT,#function + .globl glSecondaryColor3dvEXT ; .type glSecondaryColor3dvEXT,#function + .globl glSecondaryColor3fEXT ; .type glSecondaryColor3fEXT,#function + .globl glSecondaryColor3fvEXT ; .type glSecondaryColor3fvEXT,#function + .globl glSecondaryColor3iEXT ; .type glSecondaryColor3iEXT,#function + .globl glSecondaryColor3ivEXT ; .type glSecondaryColor3ivEXT,#function + .globl glSecondaryColor3sEXT ; .type glSecondaryColor3sEXT,#function + .globl glSecondaryColor3svEXT ; .type glSecondaryColor3svEXT,#function + .globl glSecondaryColor3ubEXT ; .type glSecondaryColor3ubEXT,#function + .globl glSecondaryColor3ubvEXT ; .type glSecondaryColor3ubvEXT,#function + .globl glSecondaryColor3uiEXT ; .type glSecondaryColor3uiEXT,#function + .globl glSecondaryColor3uivEXT ; .type glSecondaryColor3uivEXT,#function + .globl glSecondaryColor3usEXT ; .type glSecondaryColor3usEXT,#function + .globl glSecondaryColor3usvEXT ; .type glSecondaryColor3usvEXT,#function + .globl glSecondaryColorPointerEXT ; .type glSecondaryColorPointerEXT,#function + .globl glAreProgramsResidentNV ; .type glAreProgramsResidentNV,#function + .globl glBindProgramNV ; .type glBindProgramNV,#function + .globl glDeleteProgramsNV ; .type glDeleteProgramsNV,#function + .globl glExecuteProgramNV ; .type glExecuteProgramNV,#function + .globl glGenProgramsNV ; .type glGenProgramsNV,#function + .globl glGetProgramParameterdvNV ; .type glGetProgramParameterdvNV,#function + .globl glGetProgramParameterfvNV ; .type glGetProgramParameterfvNV,#function + .globl glGetProgramivNV ; .type glGetProgramivNV,#function + .globl glGetProgramStringNV ; .type glGetProgramStringNV,#function + .globl glGetTrackMatrixivNV ; .type glGetTrackMatrixivNV,#function + .globl glGetVertexAttribdvARB ; .type glGetVertexAttribdvARB,#function + .globl glGetVertexAttribfvARB ; .type glGetVertexAttribfvARB,#function + .globl glGetVertexAttribivARB ; .type glGetVertexAttribivARB,#function + .globl glGetVertexAttribPointervNV ; .type glGetVertexAttribPointervNV,#function + .globl glIsProgramNV ; .type glIsProgramNV,#function + .globl glLoadProgramNV ; .type glLoadProgramNV,#function + .globl glProgramParameter4dNV ; .type glProgramParameter4dNV,#function + .globl glProgramParameter4dvNV ; .type glProgramParameter4dvNV,#function + .globl glProgramParameter4fNV ; .type glProgramParameter4fNV,#function + .globl glProgramParameter4fvNV ; .type glProgramParameter4fvNV,#function + .globl glProgramParameters4dvNV ; .type glProgramParameters4dvNV,#function + .globl glProgramParameters4fvNV ; .type glProgramParameters4fvNV,#function + .globl glRequestResidentProgramsNV ; .type glRequestResidentProgramsNV,#function + .globl glTrackMatrixNV ; .type glTrackMatrixNV,#function + .globl glVertexAttribPointerNV ; .type glVertexAttribPointerNV,#function + .globl glVertexAttrib1dARB ; .type glVertexAttrib1dARB,#function + .globl glVertexAttrib1dvARB ; .type glVertexAttrib1dvARB,#function + .globl glVertexAttrib1fARB ; .type glVertexAttrib1fARB,#function + .globl glVertexAttrib1fvARB ; .type glVertexAttrib1fvARB,#function + .globl glVertexAttrib1sARB ; .type glVertexAttrib1sARB,#function + .globl glVertexAttrib1svARB ; .type glVertexAttrib1svARB,#function + .globl glVertexAttrib2dARB ; .type glVertexAttrib2dARB,#function + .globl glVertexAttrib2dvARB ; .type glVertexAttrib2dvARB,#function + .globl glVertexAttrib2fARB ; .type glVertexAttrib2fARB,#function + .globl glVertexAttrib2fvARB ; .type glVertexAttrib2fvARB,#function + .globl glVertexAttrib2sARB ; .type glVertexAttrib2sARB,#function + .globl glVertexAttrib2svARB ; .type glVertexAttrib2svARB,#function + .globl glVertexAttrib3dARB ; .type glVertexAttrib3dARB,#function + .globl glVertexAttrib3dvARB ; .type glVertexAttrib3dvARB,#function + .globl glVertexAttrib3fARB ; .type glVertexAttrib3fARB,#function + .globl glVertexAttrib3fvARB ; .type glVertexAttrib3fvARB,#function + .globl glVertexAttrib3sARB ; .type glVertexAttrib3sARB,#function + .globl glVertexAttrib3svARB ; .type glVertexAttrib3svARB,#function + .globl glVertexAttrib4dARB ; .type glVertexAttrib4dARB,#function + .globl glVertexAttrib4dvARB ; .type glVertexAttrib4dvARB,#function + .globl glVertexAttrib4fARB ; .type glVertexAttrib4fARB,#function + .globl glVertexAttrib4fvARB ; .type glVertexAttrib4fvARB,#function + .globl glVertexAttrib4sARB ; .type glVertexAttrib4sARB,#function + .globl glVertexAttrib4svARB ; .type glVertexAttrib4svARB,#function + .globl glVertexAttrib4NubARB ; .type glVertexAttrib4NubARB,#function + .globl glVertexAttrib4NubvARB ; .type glVertexAttrib4NubvARB,#function + .globl glVertexAttribs1dvNV ; .type glVertexAttribs1dvNV,#function + .globl glVertexAttribs1fvNV ; .type glVertexAttribs1fvNV,#function + .globl glVertexAttribs1svNV ; .type glVertexAttribs1svNV,#function + .globl glVertexAttribs2dvNV ; .type glVertexAttribs2dvNV,#function + .globl glVertexAttribs2fvNV ; .type glVertexAttribs2fvNV,#function + .globl glVertexAttribs2svNV ; .type glVertexAttribs2svNV,#function + .globl glVertexAttribs3dvNV ; .type glVertexAttribs3dvNV,#function + .globl glVertexAttribs3fvNV ; .type glVertexAttribs3fvNV,#function + .globl glVertexAttribs3svNV ; .type glVertexAttribs3svNV,#function + .globl glVertexAttribs4dvNV ; .type glVertexAttribs4dvNV,#function + .globl glVertexAttribs4fvNV ; .type glVertexAttribs4fvNV,#function + .globl glVertexAttribs4svNV ; .type glVertexAttribs4svNV,#function + .globl glVertexAttribs4ubvNV ; .type glVertexAttribs4ubvNV,#function + .globl glPointParameteriNV ; .type glPointParameteriNV,#function + .globl glPointParameterivNV ; .type glPointParameterivNV,#function + .globl glMultiDrawArraysEXT ; .type glMultiDrawArraysEXT,#function + .globl glMultiDrawElementsEXT ; .type glMultiDrawElementsEXT,#function + .globl glActiveStencilFaceEXT ; .type glActiveStencilFaceEXT,#function + .globl glDeleteFencesNV ; .type glDeleteFencesNV,#function + .globl glGenFencesNV ; .type glGenFencesNV,#function + .globl glIsFenceNV ; .type glIsFenceNV,#function + .globl glTestFenceNV ; .type glTestFenceNV,#function + .globl glGetFenceivNV ; .type glGetFenceivNV,#function + .globl glFinishFenceNV ; .type glFinishFenceNV,#function + .globl glSetFenceNV ; .type glSetFenceNV,#function + .globl glVertexAttrib4bvARB ; .type glVertexAttrib4bvARB,#function + .globl glVertexAttrib4ivARB ; .type glVertexAttrib4ivARB,#function + .globl glVertexAttrib4ubvARB ; .type glVertexAttrib4ubvARB,#function + .globl glVertexAttrib4usvARB ; .type glVertexAttrib4usvARB,#function + .globl glVertexAttrib4uivARB ; .type glVertexAttrib4uivARB,#function + .globl glVertexAttrib4NbvARB ; .type glVertexAttrib4NbvARB,#function + .globl glVertexAttrib4NsvARB ; .type glVertexAttrib4NsvARB,#function + .globl glVertexAttrib4NivARB ; .type glVertexAttrib4NivARB,#function + .globl glVertexAttrib4NusvARB ; .type glVertexAttrib4NusvARB,#function + .globl glVertexAttrib4NuivARB ; .type glVertexAttrib4NuivARB,#function + .globl glVertexAttribPointerARB ; .type glVertexAttribPointerARB,#function + .globl glEnableVertexAttribArrayARB ; .type glEnableVertexAttribArrayARB,#function + .globl glDisableVertexAttribArrayARB ; .type glDisableVertexAttribArrayARB,#function + .globl glProgramStringARB ; .type glProgramStringARB,#function + .globl glProgramEnvParameter4dARB ; .type glProgramEnvParameter4dARB,#function + .globl glProgramEnvParameter4dvARB ; .type glProgramEnvParameter4dvARB,#function + .globl glProgramEnvParameter4fARB ; .type glProgramEnvParameter4fARB,#function + .globl glProgramEnvParameter4fvARB ; .type glProgramEnvParameter4fvARB,#function + .globl glProgramLocalParameter4dARB ; .type glProgramLocalParameter4dARB,#function + .globl glProgramLocalParameter4dvARB ; .type glProgramLocalParameter4dvARB,#function + .globl glProgramLocalParameter4fARB ; .type glProgramLocalParameter4fARB,#function + .globl glProgramLocalParameter4fvARB ; .type glProgramLocalParameter4fvARB,#function + .globl glGetProgramEnvParameterdvARB ; .type glGetProgramEnvParameterdvARB,#function + .globl glGetProgramEnvParameterfvARB ; .type glGetProgramEnvParameterfvARB,#function + .globl glGetProgramLocalParameterdvARB ; .type glGetProgramLocalParameterdvARB,#function + .globl glGetProgramLocalParameterfvARB ; .type glGetProgramLocalParameterfvARB,#function + .globl glGetProgramivARB ; .type glGetProgramivARB,#function + .globl glGetProgramStringARB ; .type glGetProgramStringARB,#function + .globl glProgramNamedParameter4fNV ; .type glProgramNamedParameter4fNV,#function + .globl glProgramNamedParameter4dNV ; .type glProgramNamedParameter4dNV,#function + .globl glProgramNamedParameter4fvNV ; .type glProgramNamedParameter4fvNV,#function + .globl glProgramNamedParameter4dvNV ; .type glProgramNamedParameter4dvNV,#function + .globl glGetProgramNamedParameterfvNV ; .type glGetProgramNamedParameterfvNV,#function + .globl glGetProgramNamedParameterdvNV ; .type glGetProgramNamedParameterdvNV,#function + .globl glBindBufferARB ; .type glBindBufferARB,#function + .globl glBufferDataARB ; .type glBufferDataARB,#function + .globl glBufferSubDataARB ; .type glBufferSubDataARB,#function + .globl glDeleteBuffersARB ; .type glDeleteBuffersARB,#function + .globl glGenBuffersARB ; .type glGenBuffersARB,#function + .globl glGetBufferParameterivARB ; .type glGetBufferParameterivARB,#function + .globl glGetBufferPointervARB ; .type glGetBufferPointervARB,#function + .globl glGetBufferSubDataARB ; .type glGetBufferSubDataARB,#function + .globl glIsBufferARB ; .type glIsBufferARB,#function + .globl glMapBufferARB ; .type glMapBufferARB,#function + .globl glUnmapBufferARB ; .type glUnmapBufferARB,#function + .globl glDepthBoundsEXT ; .type glDepthBoundsEXT,#function + .globl glGenQueriesARB ; .type glGenQueriesARB,#function + .globl glDeleteQueriesARB ; .type glDeleteQueriesARB,#function + .globl glIsQueryARB ; .type glIsQueryARB,#function + .globl glBeginQueryARB ; .type glBeginQueryARB,#function + .globl glEndQueryARB ; .type glEndQueryARB,#function + .globl glGetQueryivARB ; .type glGetQueryivARB,#function + .globl glGetQueryObjectivARB ; .type glGetQueryObjectivARB,#function + .globl glGetQueryObjectuivARB ; .type glGetQueryObjectuivARB,#function + .globl glMultiModeDrawArraysIBM ; .type glMultiModeDrawArraysIBM,#function + .globl glMultiModeDrawElementsIBM ; .type glMultiModeDrawElementsIBM,#function + .globl glBlendEquationSeparateEXT ; .type glBlendEquationSeparateEXT,#function + .globl glDeleteObjectARB ; .type glDeleteObjectARB,#function + .globl glGetHandleARB ; .type glGetHandleARB,#function + .globl glDetachObjectARB ; .type glDetachObjectARB,#function + .globl glCreateShaderObjectARB ; .type glCreateShaderObjectARB,#function + .globl glShaderSourceARB ; .type glShaderSourceARB,#function + .globl glCompileShaderARB ; .type glCompileShaderARB,#function + .globl glCreateProgramObjectARB ; .type glCreateProgramObjectARB,#function + .globl glAttachObjectARB ; .type glAttachObjectARB,#function + .globl glLinkProgramARB ; .type glLinkProgramARB,#function + .globl glUseProgramObjectARB ; .type glUseProgramObjectARB,#function + .globl glValidateProgramARB ; .type glValidateProgramARB,#function + .globl glUniform1fARB ; .type glUniform1fARB,#function + .globl glUniform2fARB ; .type glUniform2fARB,#function + .globl glUniform3fARB ; .type glUniform3fARB,#function + .globl glUniform4fARB ; .type glUniform4fARB,#function + .globl glUniform1iARB ; .type glUniform1iARB,#function + .globl glUniform2iARB ; .type glUniform2iARB,#function + .globl glUniform3iARB ; .type glUniform3iARB,#function + .globl glUniform4iARB ; .type glUniform4iARB,#function + .globl glUniform1fvARB ; .type glUniform1fvARB,#function + .globl glUniform2fvARB ; .type glUniform2fvARB,#function + .globl glUniform3fvARB ; .type glUniform3fvARB,#function + .globl glUniform4fvARB ; .type glUniform4fvARB,#function + .globl glUniform1ivARB ; .type glUniform1ivARB,#function + .globl glUniform2ivARB ; .type glUniform2ivARB,#function + .globl glUniform3ivARB ; .type glUniform3ivARB,#function + .globl glUniform4ivARB ; .type glUniform4ivARB,#function + .globl glUniformMatrix2fvARB ; .type glUniformMatrix2fvARB,#function + .globl glUniformMatrix3fvARB ; .type glUniformMatrix3fvARB,#function + .globl glUniformMatrix4fvARB ; .type glUniformMatrix4fvARB,#function + .globl glGetObjectParameterfvARB ; .type glGetObjectParameterfvARB,#function + .globl glGetObjectParameterivARB ; .type glGetObjectParameterivARB,#function + .globl glGetInfoLogARB ; .type glGetInfoLogARB,#function + .globl glGetAttachedObjectsARB ; .type glGetAttachedObjectsARB,#function + .globl glGetUniformLocationARB ; .type glGetUniformLocationARB,#function + .globl glGetActiveUniformARB ; .type glGetActiveUniformARB,#function + .globl glGetUniformfvARB ; .type glGetUniformfvARB,#function + .globl glGetUniformivARB ; .type glGetUniformivARB,#function + .globl glGetShaderSourceARB ; .type glGetShaderSourceARB,#function + .globl glBindAttribLocationARB ; .type glBindAttribLocationARB,#function + .globl glGetActiveAttribARB ; .type glGetActiveAttribARB,#function + .globl glGetAttribLocationARB ; .type glGetAttribLocationARB,#function + .globl glGetVertexAttribdvNV ; .type glGetVertexAttribdvNV,#function + .globl glGetVertexAttribfvNV ; .type glGetVertexAttribfvNV,#function + .globl glGetVertexAttribivNV ; .type glGetVertexAttribivNV,#function + .globl glVertexAttrib1dNV ; .type glVertexAttrib1dNV,#function + .globl glVertexAttrib1dvNV ; .type glVertexAttrib1dvNV,#function + .globl glVertexAttrib1fNV ; .type glVertexAttrib1fNV,#function + .globl glVertexAttrib1fvNV ; .type glVertexAttrib1fvNV,#function + .globl glVertexAttrib1sNV ; .type glVertexAttrib1sNV,#function + .globl glVertexAttrib1svNV ; .type glVertexAttrib1svNV,#function + .globl glVertexAttrib2dNV ; .type glVertexAttrib2dNV,#function + .globl glVertexAttrib2dvNV ; .type glVertexAttrib2dvNV,#function + .globl glVertexAttrib2fNV ; .type glVertexAttrib2fNV,#function + .globl glVertexAttrib2fvNV ; .type glVertexAttrib2fvNV,#function + .globl glVertexAttrib2sNV ; .type glVertexAttrib2sNV,#function + .globl glVertexAttrib2svNV ; .type glVertexAttrib2svNV,#function + .globl glVertexAttrib3dNV ; .type glVertexAttrib3dNV,#function + .globl glVertexAttrib3dvNV ; .type glVertexAttrib3dvNV,#function + .globl glVertexAttrib3fNV ; .type glVertexAttrib3fNV,#function + .globl glVertexAttrib3fvNV ; .type glVertexAttrib3fvNV,#function + .globl glVertexAttrib3sNV ; .type glVertexAttrib3sNV,#function + .globl glVertexAttrib3svNV ; .type glVertexAttrib3svNV,#function + .globl glVertexAttrib4dNV ; .type glVertexAttrib4dNV,#function + .globl glVertexAttrib4dvNV ; .type glVertexAttrib4dvNV,#function + .globl glVertexAttrib4fNV ; .type glVertexAttrib4fNV,#function + .globl glVertexAttrib4fvNV ; .type glVertexAttrib4fvNV,#function + .globl glVertexAttrib4sNV ; .type glVertexAttrib4sNV,#function + .globl glVertexAttrib4svNV ; .type glVertexAttrib4svNV,#function + .globl glVertexAttrib4ubNV ; .type glVertexAttrib4ubNV,#function + .globl glVertexAttrib4ubvNV ; .type glVertexAttrib4ubvNV,#function + .globl glGenFragmentShadersATI ; .type glGenFragmentShadersATI,#function + .globl glBindFragmentShaderATI ; .type glBindFragmentShaderATI,#function + .globl glDeleteFragmentShaderATI ; .type glDeleteFragmentShaderATI,#function + .globl glBeginFragmentShaderATI ; .type glBeginFragmentShaderATI,#function + .globl glEndFragmentShaderATI ; .type glEndFragmentShaderATI,#function + .globl glPassTexCoordATI ; .type glPassTexCoordATI,#function + .globl glSampleMapATI ; .type glSampleMapATI,#function + .globl glColorFragmentOp1ATI ; .type glColorFragmentOp1ATI,#function + .globl glColorFragmentOp2ATI ; .type glColorFragmentOp2ATI,#function + .globl glColorFragmentOp3ATI ; .type glColorFragmentOp3ATI,#function + .globl glAlphaFragmentOp1ATI ; .type glAlphaFragmentOp1ATI,#function + .globl glAlphaFragmentOp2ATI ; .type glAlphaFragmentOp2ATI,#function + .globl glAlphaFragmentOp3ATI ; .type glAlphaFragmentOp3ATI,#function + .globl glSetFragmentShaderConstantATI ; .type glSetFragmentShaderConstantATI,#function + .globl glIsRenderbufferEXT ; .type glIsRenderbufferEXT,#function + .globl glBindRenderbufferEXT ; .type glBindRenderbufferEXT,#function + .globl glDeleteRenderbuffersEXT ; .type glDeleteRenderbuffersEXT,#function + .globl glGenRenderbuffersEXT ; .type glGenRenderbuffersEXT,#function + .globl glRenderbufferStorageEXT ; .type glRenderbufferStorageEXT,#function + .globl glGetRenderbufferParameterivEXT ; .type glGetRenderbufferParameterivEXT,#function + .globl glIsFramebufferEXT ; .type glIsFramebufferEXT,#function + .globl glBindFramebufferEXT ; .type glBindFramebufferEXT,#function + .globl glDeleteFramebuffersEXT ; .type glDeleteFramebuffersEXT,#function + .globl glGenFramebuffersEXT ; .type glGenFramebuffersEXT,#function + .globl glCheckFramebufferStatusEXT ; .type glCheckFramebufferStatusEXT,#function + .globl glFramebufferTexture1DEXT ; .type glFramebufferTexture1DEXT,#function + .globl glFramebufferTexture2DEXT ; .type glFramebufferTexture2DEXT,#function + .globl glFramebufferTexture3DEXT ; .type glFramebufferTexture3DEXT,#function + .globl glFramebufferRenderbufferEXT ; .type glFramebufferRenderbufferEXT,#function + .globl glGetFramebufferAttachmentParameterivEXT ; .type glGetFramebufferAttachmentParameterivEXT,#function + .globl glGenerateMipmapEXT ; .type glGenerateMipmapEXT,#function + .globl glStencilFuncSeparate ; .type glStencilFuncSeparate,#function + .globl glStencilOpSeparate ; .type glStencilOpSeparate,#function + .globl glStencilMaskSeparate ; .type glStencilMaskSeparate,#function + .globl _mesa_sparc_glapi_begin ; .type _mesa_sparc_glapi_begin,#function +_mesa_sparc_glapi_begin: + + GL_STUB(glNewList, _gloffset_NewList) + GL_STUB(glEndList, _gloffset_EndList) + GL_STUB(glCallList, _gloffset_CallList) + GL_STUB(glCallLists, _gloffset_CallLists) + GL_STUB(glDeleteLists, _gloffset_DeleteLists) + GL_STUB(glGenLists, _gloffset_GenLists) + GL_STUB(glListBase, _gloffset_ListBase) + GL_STUB(glBegin, _gloffset_Begin) + GL_STUB(glBitmap, _gloffset_Bitmap) + GL_STUB(glColor3b, _gloffset_Color3b) + GL_STUB(glColor3bv, _gloffset_Color3bv) + GL_STUB(glColor3d, _gloffset_Color3d) + GL_STUB(glColor3dv, _gloffset_Color3dv) + GL_STUB(glColor3f, _gloffset_Color3f) + GL_STUB(glColor3fv, _gloffset_Color3fv) + GL_STUB(glColor3i, _gloffset_Color3i) + GL_STUB(glColor3iv, _gloffset_Color3iv) + GL_STUB(glColor3s, _gloffset_Color3s) + GL_STUB(glColor3sv, _gloffset_Color3sv) + GL_STUB(glColor3ub, _gloffset_Color3ub) + GL_STUB(glColor3ubv, _gloffset_Color3ubv) + GL_STUB(glColor3ui, _gloffset_Color3ui) + GL_STUB(glColor3uiv, _gloffset_Color3uiv) + GL_STUB(glColor3us, _gloffset_Color3us) + GL_STUB(glColor3usv, _gloffset_Color3usv) + GL_STUB(glColor4b, _gloffset_Color4b) + GL_STUB(glColor4bv, _gloffset_Color4bv) + GL_STUB(glColor4d, _gloffset_Color4d) + GL_STUB(glColor4dv, _gloffset_Color4dv) + GL_STUB(glColor4f, _gloffset_Color4f) + GL_STUB(glColor4fv, _gloffset_Color4fv) + GL_STUB(glColor4i, _gloffset_Color4i) + GL_STUB(glColor4iv, _gloffset_Color4iv) + GL_STUB(glColor4s, _gloffset_Color4s) + GL_STUB(glColor4sv, _gloffset_Color4sv) + GL_STUB(glColor4ub, _gloffset_Color4ub) + GL_STUB(glColor4ubv, _gloffset_Color4ubv) + GL_STUB(glColor4ui, _gloffset_Color4ui) + GL_STUB(glColor4uiv, _gloffset_Color4uiv) + GL_STUB(glColor4us, _gloffset_Color4us) + GL_STUB(glColor4usv, _gloffset_Color4usv) + GL_STUB(glEdgeFlag, _gloffset_EdgeFlag) + GL_STUB(glEdgeFlagv, _gloffset_EdgeFlagv) + GL_STUB(glEnd, _gloffset_End) + GL_STUB(glIndexd, _gloffset_Indexd) + GL_STUB(glIndexdv, _gloffset_Indexdv) + GL_STUB(glIndexf, _gloffset_Indexf) + GL_STUB(glIndexfv, _gloffset_Indexfv) + GL_STUB(glIndexi, _gloffset_Indexi) + GL_STUB(glIndexiv, _gloffset_Indexiv) + GL_STUB(glIndexs, _gloffset_Indexs) + GL_STUB(glIndexsv, _gloffset_Indexsv) + GL_STUB(glNormal3b, _gloffset_Normal3b) + GL_STUB(glNormal3bv, _gloffset_Normal3bv) + GL_STUB(glNormal3d, _gloffset_Normal3d) + GL_STUB(glNormal3dv, _gloffset_Normal3dv) + GL_STUB(glNormal3f, _gloffset_Normal3f) + GL_STUB(glNormal3fv, _gloffset_Normal3fv) + GL_STUB(glNormal3i, _gloffset_Normal3i) + GL_STUB(glNormal3iv, _gloffset_Normal3iv) + GL_STUB(glNormal3s, _gloffset_Normal3s) + GL_STUB(glNormal3sv, _gloffset_Normal3sv) + GL_STUB(glRasterPos2d, _gloffset_RasterPos2d) + GL_STUB(glRasterPos2dv, _gloffset_RasterPos2dv) + GL_STUB(glRasterPos2f, _gloffset_RasterPos2f) + GL_STUB(glRasterPos2fv, _gloffset_RasterPos2fv) + GL_STUB(glRasterPos2i, _gloffset_RasterPos2i) + GL_STUB(glRasterPos2iv, _gloffset_RasterPos2iv) + GL_STUB(glRasterPos2s, _gloffset_RasterPos2s) + GL_STUB(glRasterPos2sv, _gloffset_RasterPos2sv) + GL_STUB(glRasterPos3d, _gloffset_RasterPos3d) + GL_STUB(glRasterPos3dv, _gloffset_RasterPos3dv) + GL_STUB(glRasterPos3f, _gloffset_RasterPos3f) + GL_STUB(glRasterPos3fv, _gloffset_RasterPos3fv) + GL_STUB(glRasterPos3i, _gloffset_RasterPos3i) + GL_STUB(glRasterPos3iv, _gloffset_RasterPos3iv) + GL_STUB(glRasterPos3s, _gloffset_RasterPos3s) + GL_STUB(glRasterPos3sv, _gloffset_RasterPos3sv) + GL_STUB(glRasterPos4d, _gloffset_RasterPos4d) + GL_STUB(glRasterPos4dv, _gloffset_RasterPos4dv) + GL_STUB(glRasterPos4f, _gloffset_RasterPos4f) + GL_STUB(glRasterPos4fv, _gloffset_RasterPos4fv) + GL_STUB(glRasterPos4i, _gloffset_RasterPos4i) + GL_STUB(glRasterPos4iv, _gloffset_RasterPos4iv) + GL_STUB(glRasterPos4s, _gloffset_RasterPos4s) + GL_STUB(glRasterPos4sv, _gloffset_RasterPos4sv) + GL_STUB(glRectd, _gloffset_Rectd) + GL_STUB(glRectdv, _gloffset_Rectdv) + GL_STUB(glRectf, _gloffset_Rectf) + GL_STUB(glRectfv, _gloffset_Rectfv) + GL_STUB(glRecti, _gloffset_Recti) + GL_STUB(glRectiv, _gloffset_Rectiv) + GL_STUB(glRects, _gloffset_Rects) + GL_STUB(glRectsv, _gloffset_Rectsv) + GL_STUB(glTexCoord1d, _gloffset_TexCoord1d) + GL_STUB(glTexCoord1dv, _gloffset_TexCoord1dv) + GL_STUB(glTexCoord1f, _gloffset_TexCoord1f) + GL_STUB(glTexCoord1fv, _gloffset_TexCoord1fv) + GL_STUB(glTexCoord1i, _gloffset_TexCoord1i) + GL_STUB(glTexCoord1iv, _gloffset_TexCoord1iv) + GL_STUB(glTexCoord1s, _gloffset_TexCoord1s) + GL_STUB(glTexCoord1sv, _gloffset_TexCoord1sv) + GL_STUB(glTexCoord2d, _gloffset_TexCoord2d) + GL_STUB(glTexCoord2dv, _gloffset_TexCoord2dv) + GL_STUB(glTexCoord2f, _gloffset_TexCoord2f) + GL_STUB(glTexCoord2fv, _gloffset_TexCoord2fv) + GL_STUB(glTexCoord2i, _gloffset_TexCoord2i) + GL_STUB(glTexCoord2iv, _gloffset_TexCoord2iv) + GL_STUB(glTexCoord2s, _gloffset_TexCoord2s) + GL_STUB(glTexCoord2sv, _gloffset_TexCoord2sv) + GL_STUB(glTexCoord3d, _gloffset_TexCoord3d) + GL_STUB(glTexCoord3dv, _gloffset_TexCoord3dv) + GL_STUB(glTexCoord3f, _gloffset_TexCoord3f) + GL_STUB(glTexCoord3fv, _gloffset_TexCoord3fv) + GL_STUB(glTexCoord3i, _gloffset_TexCoord3i) + GL_STUB(glTexCoord3iv, _gloffset_TexCoord3iv) + GL_STUB(glTexCoord3s, _gloffset_TexCoord3s) + GL_STUB(glTexCoord3sv, _gloffset_TexCoord3sv) + GL_STUB(glTexCoord4d, _gloffset_TexCoord4d) + GL_STUB(glTexCoord4dv, _gloffset_TexCoord4dv) + GL_STUB(glTexCoord4f, _gloffset_TexCoord4f) + GL_STUB(glTexCoord4fv, _gloffset_TexCoord4fv) + GL_STUB(glTexCoord4i, _gloffset_TexCoord4i) + GL_STUB(glTexCoord4iv, _gloffset_TexCoord4iv) + GL_STUB(glTexCoord4s, _gloffset_TexCoord4s) + GL_STUB(glTexCoord4sv, _gloffset_TexCoord4sv) + GL_STUB(glVertex2d, _gloffset_Vertex2d) + GL_STUB(glVertex2dv, _gloffset_Vertex2dv) + GL_STUB(glVertex2f, _gloffset_Vertex2f) + GL_STUB(glVertex2fv, _gloffset_Vertex2fv) + GL_STUB(glVertex2i, _gloffset_Vertex2i) + GL_STUB(glVertex2iv, _gloffset_Vertex2iv) + GL_STUB(glVertex2s, _gloffset_Vertex2s) + GL_STUB(glVertex2sv, _gloffset_Vertex2sv) + GL_STUB(glVertex3d, _gloffset_Vertex3d) + GL_STUB(glVertex3dv, _gloffset_Vertex3dv) + GL_STUB(glVertex3f, _gloffset_Vertex3f) + GL_STUB(glVertex3fv, _gloffset_Vertex3fv) + GL_STUB(glVertex3i, _gloffset_Vertex3i) + GL_STUB(glVertex3iv, _gloffset_Vertex3iv) + GL_STUB(glVertex3s, _gloffset_Vertex3s) + GL_STUB(glVertex3sv, _gloffset_Vertex3sv) + GL_STUB(glVertex4d, _gloffset_Vertex4d) + GL_STUB(glVertex4dv, _gloffset_Vertex4dv) + GL_STUB(glVertex4f, _gloffset_Vertex4f) + GL_STUB(glVertex4fv, _gloffset_Vertex4fv) + GL_STUB(glVertex4i, _gloffset_Vertex4i) + GL_STUB(glVertex4iv, _gloffset_Vertex4iv) + GL_STUB(glVertex4s, _gloffset_Vertex4s) + GL_STUB(glVertex4sv, _gloffset_Vertex4sv) + GL_STUB(glClipPlane, _gloffset_ClipPlane) + GL_STUB(glColorMaterial, _gloffset_ColorMaterial) + GL_STUB(glCullFace, _gloffset_CullFace) + GL_STUB(glFogf, _gloffset_Fogf) + GL_STUB(glFogfv, _gloffset_Fogfv) + GL_STUB(glFogi, _gloffset_Fogi) + GL_STUB(glFogiv, _gloffset_Fogiv) + GL_STUB(glFrontFace, _gloffset_FrontFace) + GL_STUB(glHint, _gloffset_Hint) + GL_STUB(glLightf, _gloffset_Lightf) + GL_STUB(glLightfv, _gloffset_Lightfv) + GL_STUB(glLighti, _gloffset_Lighti) + GL_STUB(glLightiv, _gloffset_Lightiv) + GL_STUB(glLightModelf, _gloffset_LightModelf) + GL_STUB(glLightModelfv, _gloffset_LightModelfv) + GL_STUB(glLightModeli, _gloffset_LightModeli) + GL_STUB(glLightModeliv, _gloffset_LightModeliv) + GL_STUB(glLineStipple, _gloffset_LineStipple) + GL_STUB(glLineWidth, _gloffset_LineWidth) + GL_STUB(glMaterialf, _gloffset_Materialf) + GL_STUB(glMaterialfv, _gloffset_Materialfv) + GL_STUB(glMateriali, _gloffset_Materiali) + GL_STUB(glMaterialiv, _gloffset_Materialiv) + GL_STUB(glPointSize, _gloffset_PointSize) + GL_STUB(glPolygonMode, _gloffset_PolygonMode) + GL_STUB(glPolygonStipple, _gloffset_PolygonStipple) + GL_STUB(glScissor, _gloffset_Scissor) + GL_STUB(glShadeModel, _gloffset_ShadeModel) + GL_STUB(glTexParameterf, _gloffset_TexParameterf) + GL_STUB(glTexParameterfv, _gloffset_TexParameterfv) + GL_STUB(glTexParameteri, _gloffset_TexParameteri) + GL_STUB(glTexParameteriv, _gloffset_TexParameteriv) + GL_STUB(glTexImage1D, _gloffset_TexImage1D) + GL_STUB(glTexImage2D, _gloffset_TexImage2D) + GL_STUB(glTexEnvf, _gloffset_TexEnvf) + GL_STUB(glTexEnvfv, _gloffset_TexEnvfv) + GL_STUB(glTexEnvi, _gloffset_TexEnvi) + GL_STUB(glTexEnviv, _gloffset_TexEnviv) + GL_STUB(glTexGend, _gloffset_TexGend) + GL_STUB(glTexGendv, _gloffset_TexGendv) + GL_STUB(glTexGenf, _gloffset_TexGenf) + GL_STUB(glTexGenfv, _gloffset_TexGenfv) + GL_STUB(glTexGeni, _gloffset_TexGeni) + GL_STUB(glTexGeniv, _gloffset_TexGeniv) + GL_STUB(glFeedbackBuffer, _gloffset_FeedbackBuffer) + GL_STUB(glSelectBuffer, _gloffset_SelectBuffer) + GL_STUB(glRenderMode, _gloffset_RenderMode) + GL_STUB(glInitNames, _gloffset_InitNames) + GL_STUB(glLoadName, _gloffset_LoadName) + GL_STUB(glPassThrough, _gloffset_PassThrough) + GL_STUB(glPopName, _gloffset_PopName) + GL_STUB(glPushName, _gloffset_PushName) + GL_STUB(glDrawBuffer, _gloffset_DrawBuffer) + GL_STUB(glClear, _gloffset_Clear) + GL_STUB(glClearAccum, _gloffset_ClearAccum) + GL_STUB(glClearIndex, _gloffset_ClearIndex) + GL_STUB(glClearColor, _gloffset_ClearColor) + GL_STUB(glClearStencil, _gloffset_ClearStencil) + GL_STUB(glClearDepth, _gloffset_ClearDepth) + GL_STUB(glStencilMask, _gloffset_StencilMask) + GL_STUB(glColorMask, _gloffset_ColorMask) + GL_STUB(glDepthMask, _gloffset_DepthMask) + GL_STUB(glIndexMask, _gloffset_IndexMask) + GL_STUB(glAccum, _gloffset_Accum) + GL_STUB(glDisable, _gloffset_Disable) + GL_STUB(glEnable, _gloffset_Enable) + GL_STUB(glFinish, _gloffset_Finish) + GL_STUB(glFlush, _gloffset_Flush) + GL_STUB(glPopAttrib, _gloffset_PopAttrib) + GL_STUB(glPushAttrib, _gloffset_PushAttrib) + GL_STUB(glMap1d, _gloffset_Map1d) + GL_STUB(glMap1f, _gloffset_Map1f) + GL_STUB(glMap2d, _gloffset_Map2d) + GL_STUB(glMap2f, _gloffset_Map2f) + GL_STUB(glMapGrid1d, _gloffset_MapGrid1d) + GL_STUB(glMapGrid1f, _gloffset_MapGrid1f) + GL_STUB(glMapGrid2d, _gloffset_MapGrid2d) + GL_STUB(glMapGrid2f, _gloffset_MapGrid2f) + GL_STUB(glEvalCoord1d, _gloffset_EvalCoord1d) + GL_STUB(glEvalCoord1dv, _gloffset_EvalCoord1dv) + GL_STUB(glEvalCoord1f, _gloffset_EvalCoord1f) + GL_STUB(glEvalCoord1fv, _gloffset_EvalCoord1fv) + GL_STUB(glEvalCoord2d, _gloffset_EvalCoord2d) + GL_STUB(glEvalCoord2dv, _gloffset_EvalCoord2dv) + GL_STUB(glEvalCoord2f, _gloffset_EvalCoord2f) + GL_STUB(glEvalCoord2fv, _gloffset_EvalCoord2fv) + GL_STUB(glEvalMesh1, _gloffset_EvalMesh1) + GL_STUB(glEvalPoint1, _gloffset_EvalPoint1) + GL_STUB(glEvalMesh2, _gloffset_EvalMesh2) + GL_STUB(glEvalPoint2, _gloffset_EvalPoint2) + GL_STUB(glAlphaFunc, _gloffset_AlphaFunc) + GL_STUB(glBlendFunc, _gloffset_BlendFunc) + GL_STUB(glLogicOp, _gloffset_LogicOp) + GL_STUB(glStencilFunc, _gloffset_StencilFunc) + GL_STUB(glStencilOp, _gloffset_StencilOp) + GL_STUB(glDepthFunc, _gloffset_DepthFunc) + GL_STUB(glPixelZoom, _gloffset_PixelZoom) + GL_STUB(glPixelTransferf, _gloffset_PixelTransferf) + GL_STUB(glPixelTransferi, _gloffset_PixelTransferi) + GL_STUB(glPixelStoref, _gloffset_PixelStoref) + GL_STUB(glPixelStorei, _gloffset_PixelStorei) + GL_STUB(glPixelMapfv, _gloffset_PixelMapfv) + GL_STUB(glPixelMapuiv, _gloffset_PixelMapuiv) + GL_STUB(glPixelMapusv, _gloffset_PixelMapusv) + GL_STUB(glReadBuffer, _gloffset_ReadBuffer) + GL_STUB(glCopyPixels, _gloffset_CopyPixels) + GL_STUB(glReadPixels, _gloffset_ReadPixels) + GL_STUB(glDrawPixels, _gloffset_DrawPixels) + GL_STUB(glGetBooleanv, _gloffset_GetBooleanv) + GL_STUB(glGetClipPlane, _gloffset_GetClipPlane) + GL_STUB(glGetDoublev, _gloffset_GetDoublev) + GL_STUB(glGetError, _gloffset_GetError) + GL_STUB(glGetFloatv, _gloffset_GetFloatv) + GL_STUB(glGetIntegerv, _gloffset_GetIntegerv) + GL_STUB(glGetLightfv, _gloffset_GetLightfv) + GL_STUB(glGetLightiv, _gloffset_GetLightiv) + GL_STUB(glGetMapdv, _gloffset_GetMapdv) + GL_STUB(glGetMapfv, _gloffset_GetMapfv) + GL_STUB(glGetMapiv, _gloffset_GetMapiv) + GL_STUB(glGetMaterialfv, _gloffset_GetMaterialfv) + GL_STUB(glGetMaterialiv, _gloffset_GetMaterialiv) + GL_STUB(glGetPixelMapfv, _gloffset_GetPixelMapfv) + GL_STUB(glGetPixelMapuiv, _gloffset_GetPixelMapuiv) + GL_STUB(glGetPixelMapusv, _gloffset_GetPixelMapusv) + GL_STUB(glGetPolygonStipple, _gloffset_GetPolygonStipple) + GL_STUB(glGetString, _gloffset_GetString) + GL_STUB(glGetTexEnvfv, _gloffset_GetTexEnvfv) + GL_STUB(glGetTexEnviv, _gloffset_GetTexEnviv) + GL_STUB(glGetTexGendv, _gloffset_GetTexGendv) + GL_STUB(glGetTexGenfv, _gloffset_GetTexGenfv) + GL_STUB(glGetTexGeniv, _gloffset_GetTexGeniv) + GL_STUB(glGetTexImage, _gloffset_GetTexImage) + GL_STUB(glGetTexParameterfv, _gloffset_GetTexParameterfv) + GL_STUB(glGetTexParameteriv, _gloffset_GetTexParameteriv) + GL_STUB(glGetTexLevelParameterfv, _gloffset_GetTexLevelParameterfv) + GL_STUB(glGetTexLevelParameteriv, _gloffset_GetTexLevelParameteriv) + GL_STUB(glIsEnabled, _gloffset_IsEnabled) + GL_STUB(glIsList, _gloffset_IsList) + GL_STUB(glDepthRange, _gloffset_DepthRange) + GL_STUB(glFrustum, _gloffset_Frustum) + GL_STUB(glLoadIdentity, _gloffset_LoadIdentity) + GL_STUB(glLoadMatrixf, _gloffset_LoadMatrixf) + GL_STUB(glLoadMatrixd, _gloffset_LoadMatrixd) + GL_STUB(glMatrixMode, _gloffset_MatrixMode) + GL_STUB(glMultMatrixf, _gloffset_MultMatrixf) + GL_STUB(glMultMatrixd, _gloffset_MultMatrixd) + GL_STUB(glOrtho, _gloffset_Ortho) + GL_STUB(glPopMatrix, _gloffset_PopMatrix) + GL_STUB(glPushMatrix, _gloffset_PushMatrix) + GL_STUB(glRotated, _gloffset_Rotated) + GL_STUB(glRotatef, _gloffset_Rotatef) + GL_STUB(glScaled, _gloffset_Scaled) + GL_STUB(glScalef, _gloffset_Scalef) + GL_STUB(glTranslated, _gloffset_Translated) + GL_STUB(glTranslatef, _gloffset_Translatef) + GL_STUB(glViewport, _gloffset_Viewport) + GL_STUB(glArrayElement, _gloffset_ArrayElement) + GL_STUB(glBindTexture, _gloffset_BindTexture) + GL_STUB(glColorPointer, _gloffset_ColorPointer) + GL_STUB(glDisableClientState, _gloffset_DisableClientState) + GL_STUB(glDrawArrays, _gloffset_DrawArrays) + GL_STUB(glDrawElements, _gloffset_DrawElements) + GL_STUB(glEdgeFlagPointer, _gloffset_EdgeFlagPointer) + GL_STUB(glEnableClientState, _gloffset_EnableClientState) + GL_STUB(glIndexPointer, _gloffset_IndexPointer) + GL_STUB(glIndexub, _gloffset_Indexub) + GL_STUB(glIndexubv, _gloffset_Indexubv) + GL_STUB(glInterleavedArrays, _gloffset_InterleavedArrays) + GL_STUB(glNormalPointer, _gloffset_NormalPointer) + GL_STUB(glPolygonOffset, _gloffset_PolygonOffset) + GL_STUB(glTexCoordPointer, _gloffset_TexCoordPointer) + GL_STUB(glVertexPointer, _gloffset_VertexPointer) + GL_STUB(glAreTexturesResident, _gloffset_AreTexturesResident) + GL_STUB(glCopyTexImage1D, _gloffset_CopyTexImage1D) + GL_STUB(glCopyTexImage2D, _gloffset_CopyTexImage2D) + GL_STUB(glCopyTexSubImage1D, _gloffset_CopyTexSubImage1D) + GL_STUB(glCopyTexSubImage2D, _gloffset_CopyTexSubImage2D) + GL_STUB(glDeleteTextures, _gloffset_DeleteTextures) + GL_STUB(glGenTextures, _gloffset_GenTextures) + GL_STUB(glGetPointerv, _gloffset_GetPointerv) + GL_STUB(glIsTexture, _gloffset_IsTexture) + GL_STUB(glPrioritizeTextures, _gloffset_PrioritizeTextures) + GL_STUB(glTexSubImage1D, _gloffset_TexSubImage1D) + GL_STUB(glTexSubImage2D, _gloffset_TexSubImage2D) + GL_STUB(glPopClientAttrib, _gloffset_PopClientAttrib) + GL_STUB(glPushClientAttrib, _gloffset_PushClientAttrib) + GL_STUB(glBlendColor, _gloffset_BlendColor) + GL_STUB(glBlendEquation, _gloffset_BlendEquation) + GL_STUB(glDrawRangeElements, _gloffset_DrawRangeElements) + GL_STUB(glColorTable, _gloffset_ColorTable) + GL_STUB(glColorTableParameterfv, _gloffset_ColorTableParameterfv) + GL_STUB(glColorTableParameteriv, _gloffset_ColorTableParameteriv) + GL_STUB(glCopyColorTable, _gloffset_CopyColorTable) + GL_STUB(glGetColorTable, _gloffset_GetColorTable) + GL_STUB(glGetColorTableParameterfv, _gloffset_GetColorTableParameterfv) + GL_STUB(glGetColorTableParameteriv, _gloffset_GetColorTableParameteriv) + GL_STUB(glColorSubTable, _gloffset_ColorSubTable) + GL_STUB(glCopyColorSubTable, _gloffset_CopyColorSubTable) + GL_STUB(glConvolutionFilter1D, _gloffset_ConvolutionFilter1D) + GL_STUB(glConvolutionFilter2D, _gloffset_ConvolutionFilter2D) + GL_STUB(glConvolutionParameterf, _gloffset_ConvolutionParameterf) + GL_STUB(glConvolutionParameterfv, _gloffset_ConvolutionParameterfv) + GL_STUB(glConvolutionParameteri, _gloffset_ConvolutionParameteri) + GL_STUB(glConvolutionParameteriv, _gloffset_ConvolutionParameteriv) + GL_STUB(glCopyConvolutionFilter1D, _gloffset_CopyConvolutionFilter1D) + GL_STUB(glCopyConvolutionFilter2D, _gloffset_CopyConvolutionFilter2D) + GL_STUB(glGetConvolutionFilter, _gloffset_GetConvolutionFilter) + GL_STUB(glGetConvolutionParameterfv, _gloffset_GetConvolutionParameterfv) + GL_STUB(glGetConvolutionParameteriv, _gloffset_GetConvolutionParameteriv) + GL_STUB(glGetSeparableFilter, _gloffset_GetSeparableFilter) + GL_STUB(glSeparableFilter2D, _gloffset_SeparableFilter2D) + GL_STUB(glGetHistogram, _gloffset_GetHistogram) + GL_STUB(glGetHistogramParameterfv, _gloffset_GetHistogramParameterfv) + GL_STUB(glGetHistogramParameteriv, _gloffset_GetHistogramParameteriv) + GL_STUB(glGetMinmax, _gloffset_GetMinmax) + GL_STUB(glGetMinmaxParameterfv, _gloffset_GetMinmaxParameterfv) + GL_STUB(glGetMinmaxParameteriv, _gloffset_GetMinmaxParameteriv) + GL_STUB(glHistogram, _gloffset_Histogram) + GL_STUB(glMinmax, _gloffset_Minmax) + GL_STUB(glResetHistogram, _gloffset_ResetHistogram) + GL_STUB(glResetMinmax, _gloffset_ResetMinmax) + GL_STUB(glTexImage3D, _gloffset_TexImage3D) + GL_STUB(glTexSubImage3D, _gloffset_TexSubImage3D) + GL_STUB(glCopyTexSubImage3D, _gloffset_CopyTexSubImage3D) + GL_STUB(glActiveTextureARB, _gloffset_ActiveTextureARB) + GL_STUB(glClientActiveTextureARB, _gloffset_ClientActiveTextureARB) + GL_STUB(glMultiTexCoord1dARB, _gloffset_MultiTexCoord1dARB) + GL_STUB(glMultiTexCoord1dvARB, _gloffset_MultiTexCoord1dvARB) + GL_STUB(glMultiTexCoord1fARB, _gloffset_MultiTexCoord1fARB) + GL_STUB(glMultiTexCoord1fvARB, _gloffset_MultiTexCoord1fvARB) + GL_STUB(glMultiTexCoord1iARB, _gloffset_MultiTexCoord1iARB) + GL_STUB(glMultiTexCoord1ivARB, _gloffset_MultiTexCoord1ivARB) + GL_STUB(glMultiTexCoord1sARB, _gloffset_MultiTexCoord1sARB) + GL_STUB(glMultiTexCoord1svARB, _gloffset_MultiTexCoord1svARB) + GL_STUB(glMultiTexCoord2dARB, _gloffset_MultiTexCoord2dARB) + GL_STUB(glMultiTexCoord2dvARB, _gloffset_MultiTexCoord2dvARB) + GL_STUB(glMultiTexCoord2fARB, _gloffset_MultiTexCoord2fARB) + GL_STUB(glMultiTexCoord2fvARB, _gloffset_MultiTexCoord2fvARB) + GL_STUB(glMultiTexCoord2iARB, _gloffset_MultiTexCoord2iARB) + GL_STUB(glMultiTexCoord2ivARB, _gloffset_MultiTexCoord2ivARB) + GL_STUB(glMultiTexCoord2sARB, _gloffset_MultiTexCoord2sARB) + GL_STUB(glMultiTexCoord2svARB, _gloffset_MultiTexCoord2svARB) + GL_STUB(glMultiTexCoord3dARB, _gloffset_MultiTexCoord3dARB) + GL_STUB(glMultiTexCoord3dvARB, _gloffset_MultiTexCoord3dvARB) + GL_STUB(glMultiTexCoord3fARB, _gloffset_MultiTexCoord3fARB) + GL_STUB(glMultiTexCoord3fvARB, _gloffset_MultiTexCoord3fvARB) + GL_STUB(glMultiTexCoord3iARB, _gloffset_MultiTexCoord3iARB) + GL_STUB(glMultiTexCoord3ivARB, _gloffset_MultiTexCoord3ivARB) + GL_STUB(glMultiTexCoord3sARB, _gloffset_MultiTexCoord3sARB) + GL_STUB(glMultiTexCoord3svARB, _gloffset_MultiTexCoord3svARB) + GL_STUB(glMultiTexCoord4dARB, _gloffset_MultiTexCoord4dARB) + GL_STUB(glMultiTexCoord4dvARB, _gloffset_MultiTexCoord4dvARB) + GL_STUB(glMultiTexCoord4fARB, _gloffset_MultiTexCoord4fARB) + GL_STUB(glMultiTexCoord4fvARB, _gloffset_MultiTexCoord4fvARB) + GL_STUB(glMultiTexCoord4iARB, _gloffset_MultiTexCoord4iARB) + GL_STUB(glMultiTexCoord4ivARB, _gloffset_MultiTexCoord4ivARB) + GL_STUB(glMultiTexCoord4sARB, _gloffset_MultiTexCoord4sARB) + GL_STUB(glMultiTexCoord4svARB, _gloffset_MultiTexCoord4svARB) + GL_STUB(glLoadTransposeMatrixfARB, _gloffset_LoadTransposeMatrixfARB) + GL_STUB(glLoadTransposeMatrixdARB, _gloffset_LoadTransposeMatrixdARB) + GL_STUB(glMultTransposeMatrixfARB, _gloffset_MultTransposeMatrixfARB) + GL_STUB(glMultTransposeMatrixdARB, _gloffset_MultTransposeMatrixdARB) + GL_STUB(glSampleCoverageARB, _gloffset_SampleCoverageARB) + GL_STUB(glDrawBuffersARB, _gloffset_DrawBuffersARB) + GL_STUB(glPolygonOffsetEXT, _gloffset_PolygonOffsetEXT) + GL_STUB(glGetTexFilterFuncSGIS, _gloffset_GetTexFilterFuncSGIS) + GL_STUB(glTexFilterFuncSGIS, _gloffset_TexFilterFuncSGIS) + GL_STUB(glGetHistogramEXT, _gloffset_GetHistogramEXT) + GL_STUB(glGetHistogramParameterfvEXT, _gloffset_GetHistogramParameterfvEXT) + GL_STUB(glGetHistogramParameterivEXT, _gloffset_GetHistogramParameterivEXT) + GL_STUB(glGetMinmaxEXT, _gloffset_GetMinmaxEXT) + GL_STUB(glGetMinmaxParameterfvEXT, _gloffset_GetMinmaxParameterfvEXT) + GL_STUB(glGetMinmaxParameterivEXT, _gloffset_GetMinmaxParameterivEXT) + GL_STUB(glGetConvolutionFilterEXT, _gloffset_GetConvolutionFilterEXT) + GL_STUB(glGetConvolutionParameterfvEXT, _gloffset_GetConvolutionParameterfvEXT) + GL_STUB(glGetConvolutionParameterivEXT, _gloffset_GetConvolutionParameterivEXT) + GL_STUB(glGetSeparableFilterEXT, _gloffset_GetSeparableFilterEXT) + GL_STUB(glGetColorTableSGI, _gloffset_GetColorTableSGI) + GL_STUB(glGetColorTableParameterfvSGI, _gloffset_GetColorTableParameterfvSGI) + GL_STUB(glGetColorTableParameterivSGI, _gloffset_GetColorTableParameterivSGI) + GL_STUB(glPixelTexGenSGIX, _gloffset_PixelTexGenSGIX) + GL_STUB(glPixelTexGenParameteriSGIS, _gloffset_PixelTexGenParameteriSGIS) + GL_STUB(glPixelTexGenParameterivSGIS, _gloffset_PixelTexGenParameterivSGIS) + GL_STUB(glPixelTexGenParameterfSGIS, _gloffset_PixelTexGenParameterfSGIS) + GL_STUB(glPixelTexGenParameterfvSGIS, _gloffset_PixelTexGenParameterfvSGIS) + GL_STUB(glGetPixelTexGenParameterivSGIS, _gloffset_GetPixelTexGenParameterivSGIS) + GL_STUB(glGetPixelTexGenParameterfvSGIS, _gloffset_GetPixelTexGenParameterfvSGIS) + GL_STUB(glTexImage4DSGIS, _gloffset_TexImage4DSGIS) + GL_STUB(glTexSubImage4DSGIS, _gloffset_TexSubImage4DSGIS) + GL_STUB(glAreTexturesResidentEXT, _gloffset_AreTexturesResidentEXT) + GL_STUB(glGenTexturesEXT, _gloffset_GenTexturesEXT) + GL_STUB(glIsTextureEXT, _gloffset_IsTextureEXT) + GL_STUB(glDetailTexFuncSGIS, _gloffset_DetailTexFuncSGIS) + GL_STUB(glGetDetailTexFuncSGIS, _gloffset_GetDetailTexFuncSGIS) + GL_STUB(glSharpenTexFuncSGIS, _gloffset_SharpenTexFuncSGIS) + GL_STUB(glGetSharpenTexFuncSGIS, _gloffset_GetSharpenTexFuncSGIS) + GL_STUB(glSampleMaskSGIS, _gloffset_SampleMaskSGIS) + GL_STUB(glSamplePatternSGIS, _gloffset_SamplePatternSGIS) + GL_STUB(glColorPointerEXT, _gloffset_ColorPointerEXT) + GL_STUB(glEdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT) + GL_STUB(glIndexPointerEXT, _gloffset_IndexPointerEXT) + GL_STUB(glNormalPointerEXT, _gloffset_NormalPointerEXT) + GL_STUB(glTexCoordPointerEXT, _gloffset_TexCoordPointerEXT) + GL_STUB(glVertexPointerEXT, _gloffset_VertexPointerEXT) + GL_STUB(glSpriteParameterfSGIX, _gloffset_SpriteParameterfSGIX) + GL_STUB(glSpriteParameterfvSGIX, _gloffset_SpriteParameterfvSGIX) + GL_STUB(glSpriteParameteriSGIX, _gloffset_SpriteParameteriSGIX) + GL_STUB(glSpriteParameterivSGIX, _gloffset_SpriteParameterivSGIX) + GL_STUB(glPointParameterfEXT, _gloffset_PointParameterfEXT) + GL_STUB(glPointParameterfvEXT, _gloffset_PointParameterfvEXT) + GL_STUB(glGetInstrumentsSGIX, _gloffset_GetInstrumentsSGIX) + GL_STUB(glInstrumentsBufferSGIX, _gloffset_InstrumentsBufferSGIX) + GL_STUB(glPollInstrumentsSGIX, _gloffset_PollInstrumentsSGIX) + GL_STUB(glReadInstrumentsSGIX, _gloffset_ReadInstrumentsSGIX) + GL_STUB(glStartInstrumentsSGIX, _gloffset_StartInstrumentsSGIX) + GL_STUB(glStopInstrumentsSGIX, _gloffset_StopInstrumentsSGIX) + GL_STUB(glFrameZoomSGIX, _gloffset_FrameZoomSGIX) + GL_STUB(glTagSampleBufferSGIX, _gloffset_TagSampleBufferSGIX) + GL_STUB(glReferencePlaneSGIX, _gloffset_ReferencePlaneSGIX) + GL_STUB(glFlushRasterSGIX, _gloffset_FlushRasterSGIX) + GL_STUB(glGetListParameterfvSGIX, _gloffset_GetListParameterfvSGIX) + GL_STUB(glGetListParameterivSGIX, _gloffset_GetListParameterivSGIX) + GL_STUB(glListParameterfSGIX, _gloffset_ListParameterfSGIX) + GL_STUB(glListParameterfvSGIX, _gloffset_ListParameterfvSGIX) + GL_STUB(glListParameteriSGIX, _gloffset_ListParameteriSGIX) + GL_STUB(glListParameterivSGIX, _gloffset_ListParameterivSGIX) + GL_STUB(glFragmentColorMaterialSGIX, _gloffset_FragmentColorMaterialSGIX) + GL_STUB(glFragmentLightfSGIX, _gloffset_FragmentLightfSGIX) + GL_STUB(glFragmentLightfvSGIX, _gloffset_FragmentLightfvSGIX) + GL_STUB(glFragmentLightiSGIX, _gloffset_FragmentLightiSGIX) + GL_STUB(glFragmentLightivSGIX, _gloffset_FragmentLightivSGIX) + GL_STUB(glFragmentLightModelfSGIX, _gloffset_FragmentLightModelfSGIX) + GL_STUB(glFragmentLightModelfvSGIX, _gloffset_FragmentLightModelfvSGIX) + GL_STUB(glFragmentLightModeliSGIX, _gloffset_FragmentLightModeliSGIX) + GL_STUB(glFragmentLightModelivSGIX, _gloffset_FragmentLightModelivSGIX) + GL_STUB(glFragmentMaterialfSGIX, _gloffset_FragmentMaterialfSGIX) + GL_STUB(glFragmentMaterialfvSGIX, _gloffset_FragmentMaterialfvSGIX) + GL_STUB(glFragmentMaterialiSGIX, _gloffset_FragmentMaterialiSGIX) + GL_STUB(glFragmentMaterialivSGIX, _gloffset_FragmentMaterialivSGIX) + GL_STUB(glGetFragmentLightfvSGIX, _gloffset_GetFragmentLightfvSGIX) + GL_STUB(glGetFragmentLightivSGIX, _gloffset_GetFragmentLightivSGIX) + GL_STUB(glGetFragmentMaterialfvSGIX, _gloffset_GetFragmentMaterialfvSGIX) + GL_STUB(glGetFragmentMaterialivSGIX, _gloffset_GetFragmentMaterialivSGIX) + GL_STUB(glLightEnviSGIX, _gloffset_LightEnviSGIX) + GL_STUB(glVertexWeightfEXT, _gloffset_VertexWeightfEXT) + GL_STUB(glVertexWeightfvEXT, _gloffset_VertexWeightfvEXT) + GL_STUB(glVertexWeightPointerEXT, _gloffset_VertexWeightPointerEXT) + GL_STUB(glFlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV) + GL_STUB(glVertexArrayRangeNV, _gloffset_VertexArrayRangeNV) + GL_STUB(glCombinerParameterfvNV, _gloffset_CombinerParameterfvNV) + GL_STUB(glCombinerParameterfNV, _gloffset_CombinerParameterfNV) + GL_STUB(glCombinerParameterivNV, _gloffset_CombinerParameterivNV) + GL_STUB(glCombinerParameteriNV, _gloffset_CombinerParameteriNV) + GL_STUB(glCombinerInputNV, _gloffset_CombinerInputNV) + GL_STUB(glCombinerOutputNV, _gloffset_CombinerOutputNV) + GL_STUB(glFinalCombinerInputNV, _gloffset_FinalCombinerInputNV) + GL_STUB(glGetCombinerInputParameterfvNV, _gloffset_GetCombinerInputParameterfvNV) + GL_STUB(glGetCombinerInputParameterivNV, _gloffset_GetCombinerInputParameterivNV) + GL_STUB(glGetCombinerOutputParameterfvNV, _gloffset_GetCombinerOutputParameterfvNV) + GL_STUB(glGetCombinerOutputParameterivNV, _gloffset_GetCombinerOutputParameterivNV) + GL_STUB(glGetFinalCombinerInputParameterfvNV, _gloffset_GetFinalCombinerInputParameterfvNV) + GL_STUB(glGetFinalCombinerInputParameterivNV, _gloffset_GetFinalCombinerInputParameterivNV) + GL_STUB(glResizeBuffersMESA, _gloffset_ResizeBuffersMESA) + GL_STUB(glWindowPos2dMESA, _gloffset_WindowPos2dMESA) + GL_STUB(glWindowPos2dvMESA, _gloffset_WindowPos2dvMESA) + GL_STUB(glWindowPos2fMESA, _gloffset_WindowPos2fMESA) + GL_STUB(glWindowPos2fvMESA, _gloffset_WindowPos2fvMESA) + GL_STUB(glWindowPos2iMESA, _gloffset_WindowPos2iMESA) + GL_STUB(glWindowPos2ivMESA, _gloffset_WindowPos2ivMESA) + GL_STUB(glWindowPos2sMESA, _gloffset_WindowPos2sMESA) + GL_STUB(glWindowPos2svMESA, _gloffset_WindowPos2svMESA) + GL_STUB(glWindowPos3dMESA, _gloffset_WindowPos3dMESA) + GL_STUB(glWindowPos3dvMESA, _gloffset_WindowPos3dvMESA) + GL_STUB(glWindowPos3fMESA, _gloffset_WindowPos3fMESA) + GL_STUB(glWindowPos3fvMESA, _gloffset_WindowPos3fvMESA) + GL_STUB(glWindowPos3iMESA, _gloffset_WindowPos3iMESA) + GL_STUB(glWindowPos3ivMESA, _gloffset_WindowPos3ivMESA) + GL_STUB(glWindowPos3sMESA, _gloffset_WindowPos3sMESA) + GL_STUB(glWindowPos3svMESA, _gloffset_WindowPos3svMESA) + GL_STUB(glWindowPos4dMESA, _gloffset_WindowPos4dMESA) + GL_STUB(glWindowPos4dvMESA, _gloffset_WindowPos4dvMESA) + GL_STUB(glWindowPos4fMESA, _gloffset_WindowPos4fMESA) + GL_STUB(glWindowPos4fvMESA, _gloffset_WindowPos4fvMESA) + GL_STUB(glWindowPos4iMESA, _gloffset_WindowPos4iMESA) + GL_STUB(glWindowPos4ivMESA, _gloffset_WindowPos4ivMESA) + GL_STUB(glWindowPos4sMESA, _gloffset_WindowPos4sMESA) + GL_STUB(glWindowPos4svMESA, _gloffset_WindowPos4svMESA) + GL_STUB(glBlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT) + GL_STUB(glIndexMaterialEXT, _gloffset_IndexMaterialEXT) + GL_STUB(glIndexFuncEXT, _gloffset_IndexFuncEXT) + GL_STUB(glLockArraysEXT, _gloffset_LockArraysEXT) + GL_STUB(glUnlockArraysEXT, _gloffset_UnlockArraysEXT) + GL_STUB(glCullParameterdvEXT, _gloffset_CullParameterdvEXT) + GL_STUB(glCullParameterfvEXT, _gloffset_CullParameterfvEXT) + GL_STUB(glHintPGI, _gloffset_HintPGI) + GL_STUB(glFogCoordfEXT, _gloffset_FogCoordfEXT) + GL_STUB(glFogCoordfvEXT, _gloffset_FogCoordfvEXT) + GL_STUB(glFogCoorddEXT, _gloffset_FogCoorddEXT) + GL_STUB(glFogCoorddvEXT, _gloffset_FogCoorddvEXT) + GL_STUB(glFogCoordPointerEXT, _gloffset_FogCoordPointerEXT) + GL_STUB(glGetColorTableEXT, _gloffset_GetColorTableEXT) + GL_STUB(glGetColorTableParameterivEXT, _gloffset_GetColorTableParameterivEXT) + GL_STUB(glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfvEXT) + GL_STUB(glTbufferMask3DFX, _gloffset_TbufferMask3DFX) + GL_STUB(glCompressedTexImage3DARB, _gloffset_CompressedTexImage3DARB) + GL_STUB(glCompressedTexImage2DARB, _gloffset_CompressedTexImage2DARB) + GL_STUB(glCompressedTexImage1DARB, _gloffset_CompressedTexImage1DARB) + GL_STUB(glCompressedTexSubImage3DARB, _gloffset_CompressedTexSubImage3DARB) + GL_STUB(glCompressedTexSubImage2DARB, _gloffset_CompressedTexSubImage2DARB) + GL_STUB(glCompressedTexSubImage1DARB, _gloffset_CompressedTexSubImage1DARB) + GL_STUB(glGetCompressedTexImageARB, _gloffset_GetCompressedTexImageARB) + GL_STUB(glSecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT) + GL_STUB(glSecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT) + GL_STUB(glSecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT) + GL_STUB(glSecondaryColor3dvEXT, _gloffset_SecondaryColor3dvEXT) + GL_STUB(glSecondaryColor3fEXT, _gloffset_SecondaryColor3fEXT) + GL_STUB(glSecondaryColor3fvEXT, _gloffset_SecondaryColor3fvEXT) + GL_STUB(glSecondaryColor3iEXT, _gloffset_SecondaryColor3iEXT) + GL_STUB(glSecondaryColor3ivEXT, _gloffset_SecondaryColor3ivEXT) + GL_STUB(glSecondaryColor3sEXT, _gloffset_SecondaryColor3sEXT) + GL_STUB(glSecondaryColor3svEXT, _gloffset_SecondaryColor3svEXT) + GL_STUB(glSecondaryColor3ubEXT, _gloffset_SecondaryColor3ubEXT) + GL_STUB(glSecondaryColor3ubvEXT, _gloffset_SecondaryColor3ubvEXT) + GL_STUB(glSecondaryColor3uiEXT, _gloffset_SecondaryColor3uiEXT) + GL_STUB(glSecondaryColor3uivEXT, _gloffset_SecondaryColor3uivEXT) + GL_STUB(glSecondaryColor3usEXT, _gloffset_SecondaryColor3usEXT) + GL_STUB(glSecondaryColor3usvEXT, _gloffset_SecondaryColor3usvEXT) + GL_STUB(glSecondaryColorPointerEXT, _gloffset_SecondaryColorPointerEXT) + GL_STUB(glAreProgramsResidentNV, _gloffset_AreProgramsResidentNV) + GL_STUB(glBindProgramNV, _gloffset_BindProgramNV) + GL_STUB(glDeleteProgramsNV, _gloffset_DeleteProgramsNV) + GL_STUB(glExecuteProgramNV, _gloffset_ExecuteProgramNV) + GL_STUB(glGenProgramsNV, _gloffset_GenProgramsNV) + GL_STUB(glGetProgramParameterdvNV, _gloffset_GetProgramParameterdvNV) + GL_STUB(glGetProgramParameterfvNV, _gloffset_GetProgramParameterfvNV) + GL_STUB(glGetProgramivNV, _gloffset_GetProgramivNV) + GL_STUB(glGetProgramStringNV, _gloffset_GetProgramStringNV) + GL_STUB(glGetTrackMatrixivNV, _gloffset_GetTrackMatrixivNV) + GL_STUB(glGetVertexAttribdvARB, _gloffset_GetVertexAttribdvARB) + GL_STUB(glGetVertexAttribfvARB, _gloffset_GetVertexAttribfvARB) + GL_STUB(glGetVertexAttribivARB, _gloffset_GetVertexAttribivARB) + GL_STUB(glGetVertexAttribPointervNV, _gloffset_GetVertexAttribPointervNV) + GL_STUB(glIsProgramNV, _gloffset_IsProgramNV) + GL_STUB(glLoadProgramNV, _gloffset_LoadProgramNV) + GL_STUB(glProgramParameter4dNV, _gloffset_ProgramParameter4dNV) + GL_STUB(glProgramParameter4dvNV, _gloffset_ProgramParameter4dvNV) + GL_STUB(glProgramParameter4fNV, _gloffset_ProgramParameter4fNV) + GL_STUB(glProgramParameter4fvNV, _gloffset_ProgramParameter4fvNV) + GL_STUB(glProgramParameters4dvNV, _gloffset_ProgramParameters4dvNV) + GL_STUB(glProgramParameters4fvNV, _gloffset_ProgramParameters4fvNV) + GL_STUB(glRequestResidentProgramsNV, _gloffset_RequestResidentProgramsNV) + GL_STUB(glTrackMatrixNV, _gloffset_TrackMatrixNV) + GL_STUB(glVertexAttribPointerNV, _gloffset_VertexAttribPointerNV) + GL_STUB(glVertexAttrib1dARB, _gloffset_VertexAttrib1dARB) + GL_STUB(glVertexAttrib1dvARB, _gloffset_VertexAttrib1dvARB) + GL_STUB(glVertexAttrib1fARB, _gloffset_VertexAttrib1fARB) + GL_STUB(glVertexAttrib1fvARB, _gloffset_VertexAttrib1fvARB) + GL_STUB(glVertexAttrib1sARB, _gloffset_VertexAttrib1sARB) + GL_STUB(glVertexAttrib1svARB, _gloffset_VertexAttrib1svARB) + GL_STUB(glVertexAttrib2dARB, _gloffset_VertexAttrib2dARB) + GL_STUB(glVertexAttrib2dvARB, _gloffset_VertexAttrib2dvARB) + GL_STUB(glVertexAttrib2fARB, _gloffset_VertexAttrib2fARB) + GL_STUB(glVertexAttrib2fvARB, _gloffset_VertexAttrib2fvARB) + GL_STUB(glVertexAttrib2sARB, _gloffset_VertexAttrib2sARB) + GL_STUB(glVertexAttrib2svARB, _gloffset_VertexAttrib2svARB) + GL_STUB(glVertexAttrib3dARB, _gloffset_VertexAttrib3dARB) + GL_STUB(glVertexAttrib3dvARB, _gloffset_VertexAttrib3dvARB) + GL_STUB(glVertexAttrib3fARB, _gloffset_VertexAttrib3fARB) + GL_STUB(glVertexAttrib3fvARB, _gloffset_VertexAttrib3fvARB) + GL_STUB(glVertexAttrib3sARB, _gloffset_VertexAttrib3sARB) + GL_STUB(glVertexAttrib3svARB, _gloffset_VertexAttrib3svARB) + GL_STUB(glVertexAttrib4dARB, _gloffset_VertexAttrib4dARB) + GL_STUB(glVertexAttrib4dvARB, _gloffset_VertexAttrib4dvARB) + GL_STUB(glVertexAttrib4fARB, _gloffset_VertexAttrib4fARB) + GL_STUB(glVertexAttrib4fvARB, _gloffset_VertexAttrib4fvARB) + GL_STUB(glVertexAttrib4sARB, _gloffset_VertexAttrib4sARB) + GL_STUB(glVertexAttrib4svARB, _gloffset_VertexAttrib4svARB) + GL_STUB(glVertexAttrib4NubARB, _gloffset_VertexAttrib4NubARB) + GL_STUB(glVertexAttrib4NubvARB, _gloffset_VertexAttrib4NubvARB) + GL_STUB(glVertexAttribs1dvNV, _gloffset_VertexAttribs1dvNV) + GL_STUB(glVertexAttribs1fvNV, _gloffset_VertexAttribs1fvNV) + GL_STUB(glVertexAttribs1svNV, _gloffset_VertexAttribs1svNV) + GL_STUB(glVertexAttribs2dvNV, _gloffset_VertexAttribs2dvNV) + GL_STUB(glVertexAttribs2fvNV, _gloffset_VertexAttribs2fvNV) + GL_STUB(glVertexAttribs2svNV, _gloffset_VertexAttribs2svNV) + GL_STUB(glVertexAttribs3dvNV, _gloffset_VertexAttribs3dvNV) + GL_STUB(glVertexAttribs3fvNV, _gloffset_VertexAttribs3fvNV) + GL_STUB(glVertexAttribs3svNV, _gloffset_VertexAttribs3svNV) + GL_STUB(glVertexAttribs4dvNV, _gloffset_VertexAttribs4dvNV) + GL_STUB(glVertexAttribs4fvNV, _gloffset_VertexAttribs4fvNV) + GL_STUB(glVertexAttribs4svNV, _gloffset_VertexAttribs4svNV) + GL_STUB(glVertexAttribs4ubvNV, _gloffset_VertexAttribs4ubvNV) + GL_STUB(glPointParameteriNV, _gloffset_PointParameteriNV) + GL_STUB(glPointParameterivNV, _gloffset_PointParameterivNV) + GL_STUB(glMultiDrawArraysEXT, _gloffset_MultiDrawArraysEXT) + GL_STUB(glMultiDrawElementsEXT, _gloffset_MultiDrawElementsEXT) + GL_STUB(glActiveStencilFaceEXT, _gloffset_ActiveStencilFaceEXT) + GL_STUB(glDeleteFencesNV, _gloffset_DeleteFencesNV) + GL_STUB(glGenFencesNV, _gloffset_GenFencesNV) + GL_STUB(glIsFenceNV, _gloffset_IsFenceNV) + GL_STUB(glTestFenceNV, _gloffset_TestFenceNV) + GL_STUB(glGetFenceivNV, _gloffset_GetFenceivNV) + GL_STUB(glFinishFenceNV, _gloffset_FinishFenceNV) + GL_STUB(glSetFenceNV, _gloffset_SetFenceNV) + GL_STUB(glVertexAttrib4bvARB, _gloffset_VertexAttrib4bvARB) + GL_STUB(glVertexAttrib4ivARB, _gloffset_VertexAttrib4ivARB) + GL_STUB(glVertexAttrib4ubvARB, _gloffset_VertexAttrib4ubvARB) + GL_STUB(glVertexAttrib4usvARB, _gloffset_VertexAttrib4usvARB) + GL_STUB(glVertexAttrib4uivARB, _gloffset_VertexAttrib4uivARB) + GL_STUB(glVertexAttrib4NbvARB, _gloffset_VertexAttrib4NbvARB) + GL_STUB(glVertexAttrib4NsvARB, _gloffset_VertexAttrib4NsvARB) + GL_STUB(glVertexAttrib4NivARB, _gloffset_VertexAttrib4NivARB) + GL_STUB(glVertexAttrib4NusvARB, _gloffset_VertexAttrib4NusvARB) + GL_STUB(glVertexAttrib4NuivARB, _gloffset_VertexAttrib4NuivARB) + GL_STUB(glVertexAttribPointerARB, _gloffset_VertexAttribPointerARB) + GL_STUB(glEnableVertexAttribArrayARB, _gloffset_EnableVertexAttribArrayARB) + GL_STUB(glDisableVertexAttribArrayARB, _gloffset_DisableVertexAttribArrayARB) + GL_STUB(glProgramStringARB, _gloffset_ProgramStringARB) + GL_STUB(glProgramEnvParameter4dARB, _gloffset_ProgramEnvParameter4dARB) + GL_STUB(glProgramEnvParameter4dvARB, _gloffset_ProgramEnvParameter4dvARB) + GL_STUB(glProgramEnvParameter4fARB, _gloffset_ProgramEnvParameter4fARB) + GL_STUB(glProgramEnvParameter4fvARB, _gloffset_ProgramEnvParameter4fvARB) + GL_STUB(glProgramLocalParameter4dARB, _gloffset_ProgramLocalParameter4dARB) + GL_STUB(glProgramLocalParameter4dvARB, _gloffset_ProgramLocalParameter4dvARB) + GL_STUB(glProgramLocalParameter4fARB, _gloffset_ProgramLocalParameter4fARB) + GL_STUB(glProgramLocalParameter4fvARB, _gloffset_ProgramLocalParameter4fvARB) + GL_STUB(glGetProgramEnvParameterdvARB, _gloffset_GetProgramEnvParameterdvARB) + GL_STUB(glGetProgramEnvParameterfvARB, _gloffset_GetProgramEnvParameterfvARB) + GL_STUB(glGetProgramLocalParameterdvARB, _gloffset_GetProgramLocalParameterdvARB) + GL_STUB(glGetProgramLocalParameterfvARB, _gloffset_GetProgramLocalParameterfvARB) + GL_STUB(glGetProgramivARB, _gloffset_GetProgramivARB) + GL_STUB(glGetProgramStringARB, _gloffset_GetProgramStringARB) + GL_STUB(glProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV) + GL_STUB(glProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV) + GL_STUB(glProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV) + GL_STUB(glProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV) + GL_STUB(glGetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV) + GL_STUB(glGetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV) + GL_STUB(glBindBufferARB, _gloffset_BindBufferARB) + GL_STUB(glBufferDataARB, _gloffset_BufferDataARB) + GL_STUB(glBufferSubDataARB, _gloffset_BufferSubDataARB) + GL_STUB(glDeleteBuffersARB, _gloffset_DeleteBuffersARB) + GL_STUB(glGenBuffersARB, _gloffset_GenBuffersARB) + GL_STUB(glGetBufferParameterivARB, _gloffset_GetBufferParameterivARB) + GL_STUB(glGetBufferPointervARB, _gloffset_GetBufferPointervARB) + GL_STUB(glGetBufferSubDataARB, _gloffset_GetBufferSubDataARB) + GL_STUB(glIsBufferARB, _gloffset_IsBufferARB) + GL_STUB(glMapBufferARB, _gloffset_MapBufferARB) + GL_STUB(glUnmapBufferARB, _gloffset_UnmapBufferARB) + GL_STUB(glDepthBoundsEXT, _gloffset_DepthBoundsEXT) + GL_STUB(glGenQueriesARB, _gloffset_GenQueriesARB) + GL_STUB(glDeleteQueriesARB, _gloffset_DeleteQueriesARB) + GL_STUB(glIsQueryARB, _gloffset_IsQueryARB) + GL_STUB(glBeginQueryARB, _gloffset_BeginQueryARB) + GL_STUB(glEndQueryARB, _gloffset_EndQueryARB) + GL_STUB(glGetQueryivARB, _gloffset_GetQueryivARB) + GL_STUB(glGetQueryObjectivARB, _gloffset_GetQueryObjectivARB) + GL_STUB(glGetQueryObjectuivARB, _gloffset_GetQueryObjectuivARB) + GL_STUB(glMultiModeDrawArraysIBM, _gloffset_MultiModeDrawArraysIBM) + GL_STUB(glMultiModeDrawElementsIBM, _gloffset_MultiModeDrawElementsIBM) + GL_STUB(glBlendEquationSeparateEXT, _gloffset_BlendEquationSeparateEXT) + GL_STUB(glDeleteObjectARB, _gloffset_DeleteObjectARB) + GL_STUB(glGetHandleARB, _gloffset_GetHandleARB) + GL_STUB(glDetachObjectARB, _gloffset_DetachObjectARB) + GL_STUB(glCreateShaderObjectARB, _gloffset_CreateShaderObjectARB) + GL_STUB(glShaderSourceARB, _gloffset_ShaderSourceARB) + GL_STUB(glCompileShaderARB, _gloffset_CompileShaderARB) + GL_STUB(glCreateProgramObjectARB, _gloffset_CreateProgramObjectARB) + GL_STUB(glAttachObjectARB, _gloffset_AttachObjectARB) + GL_STUB(glLinkProgramARB, _gloffset_LinkProgramARB) + GL_STUB(glUseProgramObjectARB, _gloffset_UseProgramObjectARB) + GL_STUB(glValidateProgramARB, _gloffset_ValidateProgramARB) + GL_STUB(glUniform1fARB, _gloffset_Uniform1fARB) + GL_STUB(glUniform2fARB, _gloffset_Uniform2fARB) + GL_STUB(glUniform3fARB, _gloffset_Uniform3fARB) + GL_STUB(glUniform4fARB, _gloffset_Uniform4fARB) + GL_STUB(glUniform1iARB, _gloffset_Uniform1iARB) + GL_STUB(glUniform2iARB, _gloffset_Uniform2iARB) + GL_STUB(glUniform3iARB, _gloffset_Uniform3iARB) + GL_STUB(glUniform4iARB, _gloffset_Uniform4iARB) + GL_STUB(glUniform1fvARB, _gloffset_Uniform1fvARB) + GL_STUB(glUniform2fvARB, _gloffset_Uniform2fvARB) + GL_STUB(glUniform3fvARB, _gloffset_Uniform3fvARB) + GL_STUB(glUniform4fvARB, _gloffset_Uniform4fvARB) + GL_STUB(glUniform1ivARB, _gloffset_Uniform1ivARB) + GL_STUB(glUniform2ivARB, _gloffset_Uniform2ivARB) + GL_STUB(glUniform3ivARB, _gloffset_Uniform3ivARB) + GL_STUB(glUniform4ivARB, _gloffset_Uniform4ivARB) + GL_STUB(glUniformMatrix2fvARB, _gloffset_UniformMatrix2fvARB) + GL_STUB(glUniformMatrix3fvARB, _gloffset_UniformMatrix3fvARB) + GL_STUB(glUniformMatrix4fvARB, _gloffset_UniformMatrix4fvARB) + GL_STUB(glGetObjectParameterfvARB, _gloffset_GetObjectParameterfvARB) + GL_STUB(glGetObjectParameterivARB, _gloffset_GetObjectParameterivARB) + GL_STUB(glGetInfoLogARB, _gloffset_GetInfoLogARB) + GL_STUB(glGetAttachedObjectsARB, _gloffset_GetAttachedObjectsARB) + GL_STUB(glGetUniformLocationARB, _gloffset_GetUniformLocationARB) + GL_STUB(glGetActiveUniformARB, _gloffset_GetActiveUniformARB) + GL_STUB(glGetUniformfvARB, _gloffset_GetUniformfvARB) + GL_STUB(glGetUniformivARB, _gloffset_GetUniformivARB) + GL_STUB(glGetShaderSourceARB, _gloffset_GetShaderSourceARB) + GL_STUB(glBindAttribLocationARB, _gloffset_BindAttribLocationARB) + GL_STUB(glGetActiveAttribARB, _gloffset_GetActiveAttribARB) + GL_STUB(glGetAttribLocationARB, _gloffset_GetAttribLocationARB) + GL_STUB(glGetVertexAttribdvNV, _gloffset_GetVertexAttribdvNV) + GL_STUB(glGetVertexAttribfvNV, _gloffset_GetVertexAttribfvNV) + GL_STUB(glGetVertexAttribivNV, _gloffset_GetVertexAttribivNV) + GL_STUB(glVertexAttrib1dNV, _gloffset_VertexAttrib1dNV) + GL_STUB(glVertexAttrib1dvNV, _gloffset_VertexAttrib1dvNV) + GL_STUB(glVertexAttrib1fNV, _gloffset_VertexAttrib1fNV) + GL_STUB(glVertexAttrib1fvNV, _gloffset_VertexAttrib1fvNV) + GL_STUB(glVertexAttrib1sNV, _gloffset_VertexAttrib1sNV) + GL_STUB(glVertexAttrib1svNV, _gloffset_VertexAttrib1svNV) + GL_STUB(glVertexAttrib2dNV, _gloffset_VertexAttrib2dNV) + GL_STUB(glVertexAttrib2dvNV, _gloffset_VertexAttrib2dvNV) + GL_STUB(glVertexAttrib2fNV, _gloffset_VertexAttrib2fNV) + GL_STUB(glVertexAttrib2fvNV, _gloffset_VertexAttrib2fvNV) + GL_STUB(glVertexAttrib2sNV, _gloffset_VertexAttrib2sNV) + GL_STUB(glVertexAttrib2svNV, _gloffset_VertexAttrib2svNV) + GL_STUB(glVertexAttrib3dNV, _gloffset_VertexAttrib3dNV) + GL_STUB(glVertexAttrib3dvNV, _gloffset_VertexAttrib3dvNV) + GL_STUB(glVertexAttrib3fNV, _gloffset_VertexAttrib3fNV) + GL_STUB(glVertexAttrib3fvNV, _gloffset_VertexAttrib3fvNV) + GL_STUB(glVertexAttrib3sNV, _gloffset_VertexAttrib3sNV) + GL_STUB(glVertexAttrib3svNV, _gloffset_VertexAttrib3svNV) + GL_STUB(glVertexAttrib4dNV, _gloffset_VertexAttrib4dNV) + GL_STUB(glVertexAttrib4dvNV, _gloffset_VertexAttrib4dvNV) + GL_STUB(glVertexAttrib4fNV, _gloffset_VertexAttrib4fNV) + GL_STUB(glVertexAttrib4fvNV, _gloffset_VertexAttrib4fvNV) + GL_STUB(glVertexAttrib4sNV, _gloffset_VertexAttrib4sNV) + GL_STUB(glVertexAttrib4svNV, _gloffset_VertexAttrib4svNV) + GL_STUB(glVertexAttrib4ubNV, _gloffset_VertexAttrib4ubNV) + GL_STUB(glVertexAttrib4ubvNV, _gloffset_VertexAttrib4ubvNV) + GL_STUB(glGenFragmentShadersATI, _gloffset_GenFragmentShadersATI) + GL_STUB(glBindFragmentShaderATI, _gloffset_BindFragmentShaderATI) + GL_STUB(glDeleteFragmentShaderATI, _gloffset_DeleteFragmentShaderATI) + GL_STUB(glBeginFragmentShaderATI, _gloffset_BeginFragmentShaderATI) + GL_STUB(glEndFragmentShaderATI, _gloffset_EndFragmentShaderATI) + GL_STUB(glPassTexCoordATI, _gloffset_PassTexCoordATI) + GL_STUB(glSampleMapATI, _gloffset_SampleMapATI) + GL_STUB(glColorFragmentOp1ATI, _gloffset_ColorFragmentOp1ATI) + GL_STUB(glColorFragmentOp2ATI, _gloffset_ColorFragmentOp2ATI) + GL_STUB(glColorFragmentOp3ATI, _gloffset_ColorFragmentOp3ATI) + GL_STUB(glAlphaFragmentOp1ATI, _gloffset_AlphaFragmentOp1ATI) + GL_STUB(glAlphaFragmentOp2ATI, _gloffset_AlphaFragmentOp2ATI) + GL_STUB(glAlphaFragmentOp3ATI, _gloffset_AlphaFragmentOp3ATI) + GL_STUB(glSetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI) + GL_STUB(glIsRenderbufferEXT, _gloffset_IsRenderbufferEXT) + GL_STUB(glBindRenderbufferEXT, _gloffset_BindRenderbufferEXT) + GL_STUB(glDeleteRenderbuffersEXT, _gloffset_DeleteRenderbuffersEXT) + GL_STUB(glGenRenderbuffersEXT, _gloffset_GenRenderbuffersEXT) + GL_STUB(glRenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT) + GL_STUB(glGetRenderbufferParameterivEXT, _gloffset_GetRenderbufferParameterivEXT) + GL_STUB(glIsFramebufferEXT, _gloffset_IsFramebufferEXT) + GL_STUB(glBindFramebufferEXT, _gloffset_BindFramebufferEXT) + GL_STUB(glDeleteFramebuffersEXT, _gloffset_DeleteFramebuffersEXT) + GL_STUB(glGenFramebuffersEXT, _gloffset_GenFramebuffersEXT) + GL_STUB(glCheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT) + GL_STUB(glFramebufferTexture1DEXT, _gloffset_FramebufferTexture1DEXT) + GL_STUB(glFramebufferTexture2DEXT, _gloffset_FramebufferTexture2DEXT) + GL_STUB(glFramebufferTexture3DEXT, _gloffset_FramebufferTexture3DEXT) + GL_STUB(glFramebufferRenderbufferEXT, _gloffset_FramebufferRenderbufferEXT) + GL_STUB(glGetFramebufferAttachmentParameterivEXT, _gloffset_GetFramebufferAttachmentParameterivEXT) + GL_STUB(glGenerateMipmapEXT, _gloffset_GenerateMipmapEXT) + GL_STUB(glStencilFuncSeparate, _gloffset_StencilFuncSeparate) + GL_STUB(glStencilOpSeparate, _gloffset_StencilOpSeparate) + GL_STUB(glStencilMaskSeparate, _gloffset_StencilMaskSeparate) + + .globl _mesa_sparc_glapi_end ; .type _mesa_sparc_glapi_end,#function +_mesa_sparc_glapi_end: + + .globl glArrayElementEXT ; .type glArrayElementEXT,#function ; glArrayElementEXT = glArrayElement + .globl glBindTextureEXT ; .type glBindTextureEXT,#function ; glBindTextureEXT = glBindTexture + .globl glDrawArraysEXT ; .type glDrawArraysEXT,#function ; glDrawArraysEXT = glDrawArrays + .globl glCopyTexImage1DEXT ; .type glCopyTexImage1DEXT,#function ; glCopyTexImage1DEXT = glCopyTexImage1D + .globl glCopyTexImage2DEXT ; .type glCopyTexImage2DEXT,#function ; glCopyTexImage2DEXT = glCopyTexImage2D + .globl glCopyTexSubImage1DEXT ; .type glCopyTexSubImage1DEXT,#function ; glCopyTexSubImage1DEXT = glCopyTexSubImage1D + .globl glCopyTexSubImage2DEXT ; .type glCopyTexSubImage2DEXT,#function ; glCopyTexSubImage2DEXT = glCopyTexSubImage2D + .globl glDeleteTexturesEXT ; .type glDeleteTexturesEXT,#function ; glDeleteTexturesEXT = glDeleteTextures + .globl glGetPointervEXT ; .type glGetPointervEXT,#function ; glGetPointervEXT = glGetPointerv + .globl glPrioritizeTexturesEXT ; .type glPrioritizeTexturesEXT,#function ; glPrioritizeTexturesEXT = glPrioritizeTextures + .globl glTexSubImage1DEXT ; .type glTexSubImage1DEXT,#function ; glTexSubImage1DEXT = glTexSubImage1D + .globl glTexSubImage2DEXT ; .type glTexSubImage2DEXT,#function ; glTexSubImage2DEXT = glTexSubImage2D + .globl glBlendColorEXT ; .type glBlendColorEXT,#function ; glBlendColorEXT = glBlendColor + .globl glBlendEquationEXT ; .type glBlendEquationEXT,#function ; glBlendEquationEXT = glBlendEquation + .globl glDrawRangeElementsEXT ; .type glDrawRangeElementsEXT,#function ; glDrawRangeElementsEXT = glDrawRangeElements + .globl glColorTableSGI ; .type glColorTableSGI,#function ; glColorTableSGI = glColorTable + .globl glColorTableEXT ; .type glColorTableEXT,#function ; glColorTableEXT = glColorTable + .globl glColorTableParameterfvSGI ; .type glColorTableParameterfvSGI,#function ; glColorTableParameterfvSGI = glColorTableParameterfv + .globl glColorTableParameterivSGI ; .type glColorTableParameterivSGI,#function ; glColorTableParameterivSGI = glColorTableParameteriv + .globl glCopyColorTableSGI ; .type glCopyColorTableSGI,#function ; glCopyColorTableSGI = glCopyColorTable + .globl glColorSubTableEXT ; .type glColorSubTableEXT,#function ; glColorSubTableEXT = glColorSubTable + .globl glCopyColorSubTableEXT ; .type glCopyColorSubTableEXT,#function ; glCopyColorSubTableEXT = glCopyColorSubTable + .globl glConvolutionFilter1DEXT ; .type glConvolutionFilter1DEXT,#function ; glConvolutionFilter1DEXT = glConvolutionFilter1D + .globl glConvolutionFilter2DEXT ; .type glConvolutionFilter2DEXT,#function ; glConvolutionFilter2DEXT = glConvolutionFilter2D + .globl glConvolutionParameterfEXT ; .type glConvolutionParameterfEXT,#function ; glConvolutionParameterfEXT = glConvolutionParameterf + .globl glConvolutionParameterfvEXT ; .type glConvolutionParameterfvEXT,#function ; glConvolutionParameterfvEXT = glConvolutionParameterfv + .globl glConvolutionParameteriEXT ; .type glConvolutionParameteriEXT,#function ; glConvolutionParameteriEXT = glConvolutionParameteri + .globl glConvolutionParameterivEXT ; .type glConvolutionParameterivEXT,#function ; glConvolutionParameterivEXT = glConvolutionParameteriv + .globl glCopyConvolutionFilter1DEXT ; .type glCopyConvolutionFilter1DEXT,#function ; glCopyConvolutionFilter1DEXT = glCopyConvolutionFilter1D + .globl glCopyConvolutionFilter2DEXT ; .type glCopyConvolutionFilter2DEXT,#function ; glCopyConvolutionFilter2DEXT = glCopyConvolutionFilter2D + .globl glSeparableFilter2DEXT ; .type glSeparableFilter2DEXT,#function ; glSeparableFilter2DEXT = glSeparableFilter2D + .globl glHistogramEXT ; .type glHistogramEXT,#function ; glHistogramEXT = glHistogram + .globl glMinmaxEXT ; .type glMinmaxEXT,#function ; glMinmaxEXT = glMinmax + .globl glResetHistogramEXT ; .type glResetHistogramEXT,#function ; glResetHistogramEXT = glResetHistogram + .globl glResetMinmaxEXT ; .type glResetMinmaxEXT,#function ; glResetMinmaxEXT = glResetMinmax + .globl glTexImage3DEXT ; .type glTexImage3DEXT,#function ; glTexImage3DEXT = glTexImage3D + .globl glTexSubImage3DEXT ; .type glTexSubImage3DEXT,#function ; glTexSubImage3DEXT = glTexSubImage3D + .globl glCopyTexSubImage3DEXT ; .type glCopyTexSubImage3DEXT,#function ; glCopyTexSubImage3DEXT = glCopyTexSubImage3D + .globl glActiveTexture ; .type glActiveTexture,#function ; glActiveTexture = glActiveTextureARB + .globl glClientActiveTexture ; .type glClientActiveTexture,#function ; glClientActiveTexture = glClientActiveTextureARB + .globl glMultiTexCoord1d ; .type glMultiTexCoord1d,#function ; glMultiTexCoord1d = glMultiTexCoord1dARB + .globl glMultiTexCoord1dv ; .type glMultiTexCoord1dv,#function ; glMultiTexCoord1dv = glMultiTexCoord1dvARB + .globl glMultiTexCoord1f ; .type glMultiTexCoord1f,#function ; glMultiTexCoord1f = glMultiTexCoord1fARB + .globl glMultiTexCoord1fv ; .type glMultiTexCoord1fv,#function ; glMultiTexCoord1fv = glMultiTexCoord1fvARB + .globl glMultiTexCoord1i ; .type glMultiTexCoord1i,#function ; glMultiTexCoord1i = glMultiTexCoord1iARB + .globl glMultiTexCoord1iv ; .type glMultiTexCoord1iv,#function ; glMultiTexCoord1iv = glMultiTexCoord1ivARB + .globl glMultiTexCoord1s ; .type glMultiTexCoord1s,#function ; glMultiTexCoord1s = glMultiTexCoord1sARB + .globl glMultiTexCoord1sv ; .type glMultiTexCoord1sv,#function ; glMultiTexCoord1sv = glMultiTexCoord1svARB + .globl glMultiTexCoord2d ; .type glMultiTexCoord2d,#function ; glMultiTexCoord2d = glMultiTexCoord2dARB + .globl glMultiTexCoord2dv ; .type glMultiTexCoord2dv,#function ; glMultiTexCoord2dv = glMultiTexCoord2dvARB + .globl glMultiTexCoord2f ; .type glMultiTexCoord2f,#function ; glMultiTexCoord2f = glMultiTexCoord2fARB + .globl glMultiTexCoord2fv ; .type glMultiTexCoord2fv,#function ; glMultiTexCoord2fv = glMultiTexCoord2fvARB + .globl glMultiTexCoord2i ; .type glMultiTexCoord2i,#function ; glMultiTexCoord2i = glMultiTexCoord2iARB + .globl glMultiTexCoord2iv ; .type glMultiTexCoord2iv,#function ; glMultiTexCoord2iv = glMultiTexCoord2ivARB + .globl glMultiTexCoord2s ; .type glMultiTexCoord2s,#function ; glMultiTexCoord2s = glMultiTexCoord2sARB + .globl glMultiTexCoord2sv ; .type glMultiTexCoord2sv,#function ; glMultiTexCoord2sv = glMultiTexCoord2svARB + .globl glMultiTexCoord3d ; .type glMultiTexCoord3d,#function ; glMultiTexCoord3d = glMultiTexCoord3dARB + .globl glMultiTexCoord3dv ; .type glMultiTexCoord3dv,#function ; glMultiTexCoord3dv = glMultiTexCoord3dvARB + .globl glMultiTexCoord3f ; .type glMultiTexCoord3f,#function ; glMultiTexCoord3f = glMultiTexCoord3fARB + .globl glMultiTexCoord3fv ; .type glMultiTexCoord3fv,#function ; glMultiTexCoord3fv = glMultiTexCoord3fvARB + .globl glMultiTexCoord3i ; .type glMultiTexCoord3i,#function ; glMultiTexCoord3i = glMultiTexCoord3iARB + .globl glMultiTexCoord3iv ; .type glMultiTexCoord3iv,#function ; glMultiTexCoord3iv = glMultiTexCoord3ivARB + .globl glMultiTexCoord3s ; .type glMultiTexCoord3s,#function ; glMultiTexCoord3s = glMultiTexCoord3sARB + .globl glMultiTexCoord3sv ; .type glMultiTexCoord3sv,#function ; glMultiTexCoord3sv = glMultiTexCoord3svARB + .globl glMultiTexCoord4d ; .type glMultiTexCoord4d,#function ; glMultiTexCoord4d = glMultiTexCoord4dARB + .globl glMultiTexCoord4dv ; .type glMultiTexCoord4dv,#function ; glMultiTexCoord4dv = glMultiTexCoord4dvARB + .globl glMultiTexCoord4f ; .type glMultiTexCoord4f,#function ; glMultiTexCoord4f = glMultiTexCoord4fARB + .globl glMultiTexCoord4fv ; .type glMultiTexCoord4fv,#function ; glMultiTexCoord4fv = glMultiTexCoord4fvARB + .globl glMultiTexCoord4i ; .type glMultiTexCoord4i,#function ; glMultiTexCoord4i = glMultiTexCoord4iARB + .globl glMultiTexCoord4iv ; .type glMultiTexCoord4iv,#function ; glMultiTexCoord4iv = glMultiTexCoord4ivARB + .globl glMultiTexCoord4s ; .type glMultiTexCoord4s,#function ; glMultiTexCoord4s = glMultiTexCoord4sARB + .globl glMultiTexCoord4sv ; .type glMultiTexCoord4sv,#function ; glMultiTexCoord4sv = glMultiTexCoord4svARB + .globl glLoadTransposeMatrixf ; .type glLoadTransposeMatrixf,#function ; glLoadTransposeMatrixf = glLoadTransposeMatrixfARB + .globl glLoadTransposeMatrixd ; .type glLoadTransposeMatrixd,#function ; glLoadTransposeMatrixd = glLoadTransposeMatrixdARB + .globl glMultTransposeMatrixf ; .type glMultTransposeMatrixf,#function ; glMultTransposeMatrixf = glMultTransposeMatrixfARB + .globl glMultTransposeMatrixd ; .type glMultTransposeMatrixd,#function ; glMultTransposeMatrixd = glMultTransposeMatrixdARB + .globl glSampleCoverage ; .type glSampleCoverage,#function ; glSampleCoverage = glSampleCoverageARB + .globl glDrawBuffersATI ; .type glDrawBuffersATI,#function ; glDrawBuffersATI = glDrawBuffersARB + .globl glSampleMaskEXT ; .type glSampleMaskEXT,#function ; glSampleMaskEXT = glSampleMaskSGIS + .globl glSamplePatternEXT ; .type glSamplePatternEXT,#function ; glSamplePatternEXT = glSamplePatternSGIS + .globl glPointParameterf ; .type glPointParameterf,#function ; glPointParameterf = glPointParameterfEXT + .globl glPointParameterfARB ; .type glPointParameterfARB,#function ; glPointParameterfARB = glPointParameterfEXT + .globl glPointParameterfSGIS ; .type glPointParameterfSGIS,#function ; glPointParameterfSGIS = glPointParameterfEXT + .globl glPointParameterfv ; .type glPointParameterfv,#function ; glPointParameterfv = glPointParameterfvEXT + .globl glPointParameterfvARB ; .type glPointParameterfvARB,#function ; glPointParameterfvARB = glPointParameterfvEXT + .globl glPointParameterfvSGIS ; .type glPointParameterfvSGIS,#function ; glPointParameterfvSGIS = glPointParameterfvEXT + .globl glWindowPos2d ; .type glWindowPos2d,#function ; glWindowPos2d = glWindowPos2dMESA + .globl glWindowPos2dARB ; .type glWindowPos2dARB,#function ; glWindowPos2dARB = glWindowPos2dMESA + .globl glWindowPos2dv ; .type glWindowPos2dv,#function ; glWindowPos2dv = glWindowPos2dvMESA + .globl glWindowPos2dvARB ; .type glWindowPos2dvARB,#function ; glWindowPos2dvARB = glWindowPos2dvMESA + .globl glWindowPos2f ; .type glWindowPos2f,#function ; glWindowPos2f = glWindowPos2fMESA + .globl glWindowPos2fARB ; .type glWindowPos2fARB,#function ; glWindowPos2fARB = glWindowPos2fMESA + .globl glWindowPos2fv ; .type glWindowPos2fv,#function ; glWindowPos2fv = glWindowPos2fvMESA + .globl glWindowPos2fvARB ; .type glWindowPos2fvARB,#function ; glWindowPos2fvARB = glWindowPos2fvMESA + .globl glWindowPos2i ; .type glWindowPos2i,#function ; glWindowPos2i = glWindowPos2iMESA + .globl glWindowPos2iARB ; .type glWindowPos2iARB,#function ; glWindowPos2iARB = glWindowPos2iMESA + .globl glWindowPos2iv ; .type glWindowPos2iv,#function ; glWindowPos2iv = glWindowPos2ivMESA + .globl glWindowPos2ivARB ; .type glWindowPos2ivARB,#function ; glWindowPos2ivARB = glWindowPos2ivMESA + .globl glWindowPos2s ; .type glWindowPos2s,#function ; glWindowPos2s = glWindowPos2sMESA + .globl glWindowPos2sARB ; .type glWindowPos2sARB,#function ; glWindowPos2sARB = glWindowPos2sMESA + .globl glWindowPos2sv ; .type glWindowPos2sv,#function ; glWindowPos2sv = glWindowPos2svMESA + .globl glWindowPos2svARB ; .type glWindowPos2svARB,#function ; glWindowPos2svARB = glWindowPos2svMESA + .globl glWindowPos3d ; .type glWindowPos3d,#function ; glWindowPos3d = glWindowPos3dMESA + .globl glWindowPos3dARB ; .type glWindowPos3dARB,#function ; glWindowPos3dARB = glWindowPos3dMESA + .globl glWindowPos3dv ; .type glWindowPos3dv,#function ; glWindowPos3dv = glWindowPos3dvMESA + .globl glWindowPos3dvARB ; .type glWindowPos3dvARB,#function ; glWindowPos3dvARB = glWindowPos3dvMESA + .globl glWindowPos3f ; .type glWindowPos3f,#function ; glWindowPos3f = glWindowPos3fMESA + .globl glWindowPos3fARB ; .type glWindowPos3fARB,#function ; glWindowPos3fARB = glWindowPos3fMESA + .globl glWindowPos3fv ; .type glWindowPos3fv,#function ; glWindowPos3fv = glWindowPos3fvMESA + .globl glWindowPos3fvARB ; .type glWindowPos3fvARB,#function ; glWindowPos3fvARB = glWindowPos3fvMESA + .globl glWindowPos3i ; .type glWindowPos3i,#function ; glWindowPos3i = glWindowPos3iMESA + .globl glWindowPos3iARB ; .type glWindowPos3iARB,#function ; glWindowPos3iARB = glWindowPos3iMESA + .globl glWindowPos3iv ; .type glWindowPos3iv,#function ; glWindowPos3iv = glWindowPos3ivMESA + .globl glWindowPos3ivARB ; .type glWindowPos3ivARB,#function ; glWindowPos3ivARB = glWindowPos3ivMESA + .globl glWindowPos3s ; .type glWindowPos3s,#function ; glWindowPos3s = glWindowPos3sMESA + .globl glWindowPos3sARB ; .type glWindowPos3sARB,#function ; glWindowPos3sARB = glWindowPos3sMESA + .globl glWindowPos3sv ; .type glWindowPos3sv,#function ; glWindowPos3sv = glWindowPos3svMESA + .globl glWindowPos3svARB ; .type glWindowPos3svARB,#function ; glWindowPos3svARB = glWindowPos3svMESA + .globl glBlendFuncSeparate ; .type glBlendFuncSeparate,#function ; glBlendFuncSeparate = glBlendFuncSeparateEXT + .globl glBlendFuncSeparateINGR ; .type glBlendFuncSeparateINGR,#function ; glBlendFuncSeparateINGR = glBlendFuncSeparateEXT + .globl glFogCoordf ; .type glFogCoordf,#function ; glFogCoordf = glFogCoordfEXT + .globl glFogCoordfv ; .type glFogCoordfv,#function ; glFogCoordfv = glFogCoordfvEXT + .globl glFogCoordd ; .type glFogCoordd,#function ; glFogCoordd = glFogCoorddEXT + .globl glFogCoorddv ; .type glFogCoorddv,#function ; glFogCoorddv = glFogCoorddvEXT + .globl glFogCoordPointer ; .type glFogCoordPointer,#function ; glFogCoordPointer = glFogCoordPointerEXT + .globl glCompressedTexImage3D ; .type glCompressedTexImage3D,#function ; glCompressedTexImage3D = glCompressedTexImage3DARB + .globl glCompressedTexImage2D ; .type glCompressedTexImage2D,#function ; glCompressedTexImage2D = glCompressedTexImage2DARB + .globl glCompressedTexImage1D ; .type glCompressedTexImage1D,#function ; glCompressedTexImage1D = glCompressedTexImage1DARB + .globl glCompressedTexSubImage3D ; .type glCompressedTexSubImage3D,#function ; glCompressedTexSubImage3D = glCompressedTexSubImage3DARB + .globl glCompressedTexSubImage2D ; .type glCompressedTexSubImage2D,#function ; glCompressedTexSubImage2D = glCompressedTexSubImage2DARB + .globl glCompressedTexSubImage1D ; .type glCompressedTexSubImage1D,#function ; glCompressedTexSubImage1D = glCompressedTexSubImage1DARB + .globl glGetCompressedTexImage ; .type glGetCompressedTexImage,#function ; glGetCompressedTexImage = glGetCompressedTexImageARB + .globl glSecondaryColor3b ; .type glSecondaryColor3b,#function ; glSecondaryColor3b = glSecondaryColor3bEXT + .globl glSecondaryColor3bv ; .type glSecondaryColor3bv,#function ; glSecondaryColor3bv = glSecondaryColor3bvEXT + .globl glSecondaryColor3d ; .type glSecondaryColor3d,#function ; glSecondaryColor3d = glSecondaryColor3dEXT + .globl glSecondaryColor3dv ; .type glSecondaryColor3dv,#function ; glSecondaryColor3dv = glSecondaryColor3dvEXT + .globl glSecondaryColor3f ; .type glSecondaryColor3f,#function ; glSecondaryColor3f = glSecondaryColor3fEXT + .globl glSecondaryColor3fv ; .type glSecondaryColor3fv,#function ; glSecondaryColor3fv = glSecondaryColor3fvEXT + .globl glSecondaryColor3i ; .type glSecondaryColor3i,#function ; glSecondaryColor3i = glSecondaryColor3iEXT + .globl glSecondaryColor3iv ; .type glSecondaryColor3iv,#function ; glSecondaryColor3iv = glSecondaryColor3ivEXT + .globl glSecondaryColor3s ; .type glSecondaryColor3s,#function ; glSecondaryColor3s = glSecondaryColor3sEXT + .globl glSecondaryColor3sv ; .type glSecondaryColor3sv,#function ; glSecondaryColor3sv = glSecondaryColor3svEXT + .globl glSecondaryColor3ub ; .type glSecondaryColor3ub,#function ; glSecondaryColor3ub = glSecondaryColor3ubEXT + .globl glSecondaryColor3ubv ; .type glSecondaryColor3ubv,#function ; glSecondaryColor3ubv = glSecondaryColor3ubvEXT + .globl glSecondaryColor3ui ; .type glSecondaryColor3ui,#function ; glSecondaryColor3ui = glSecondaryColor3uiEXT + .globl glSecondaryColor3uiv ; .type glSecondaryColor3uiv,#function ; glSecondaryColor3uiv = glSecondaryColor3uivEXT + .globl glSecondaryColor3us ; .type glSecondaryColor3us,#function ; glSecondaryColor3us = glSecondaryColor3usEXT + .globl glSecondaryColor3usv ; .type glSecondaryColor3usv,#function ; glSecondaryColor3usv = glSecondaryColor3usvEXT + .globl glSecondaryColorPointer ; .type glSecondaryColorPointer,#function ; glSecondaryColorPointer = glSecondaryColorPointerEXT + .globl glBindProgramARB ; .type glBindProgramARB,#function ; glBindProgramARB = glBindProgramNV + .globl glDeleteProgramsARB ; .type glDeleteProgramsARB,#function ; glDeleteProgramsARB = glDeleteProgramsNV + .globl glGenProgramsARB ; .type glGenProgramsARB,#function ; glGenProgramsARB = glGenProgramsNV + .globl glGetVertexAttribPointervARB ; .type glGetVertexAttribPointervARB,#function ; glGetVertexAttribPointervARB = glGetVertexAttribPointervNV + .globl glIsProgramARB ; .type glIsProgramARB,#function ; glIsProgramARB = glIsProgramNV + .globl glPointParameteri ; .type glPointParameteri,#function ; glPointParameteri = glPointParameteriNV + .globl glPointParameteriv ; .type glPointParameteriv,#function ; glPointParameteriv = glPointParameterivNV + .globl glMultiDrawArrays ; .type glMultiDrawArrays,#function ; glMultiDrawArrays = glMultiDrawArraysEXT + .globl glMultiDrawElements ; .type glMultiDrawElements,#function ; glMultiDrawElements = glMultiDrawElementsEXT + .globl glBindBuffer ; .type glBindBuffer,#function ; glBindBuffer = glBindBufferARB + .globl glBufferData ; .type glBufferData,#function ; glBufferData = glBufferDataARB + .globl glBufferSubData ; .type glBufferSubData,#function ; glBufferSubData = glBufferSubDataARB + .globl glDeleteBuffers ; .type glDeleteBuffers,#function ; glDeleteBuffers = glDeleteBuffersARB + .globl glGenBuffers ; .type glGenBuffers,#function ; glGenBuffers = glGenBuffersARB + .globl glGetBufferParameteriv ; .type glGetBufferParameteriv,#function ; glGetBufferParameteriv = glGetBufferParameterivARB + .globl glGetBufferPointerv ; .type glGetBufferPointerv,#function ; glGetBufferPointerv = glGetBufferPointervARB + .globl glGetBufferSubData ; .type glGetBufferSubData,#function ; glGetBufferSubData = glGetBufferSubDataARB + .globl glIsBuffer ; .type glIsBuffer,#function ; glIsBuffer = glIsBufferARB + .globl glMapBuffer ; .type glMapBuffer,#function ; glMapBuffer = glMapBufferARB + .globl glUnmapBuffer ; .type glUnmapBuffer,#function ; glUnmapBuffer = glUnmapBufferARB + .globl glGenQueries ; .type glGenQueries,#function ; glGenQueries = glGenQueriesARB + .globl glDeleteQueries ; .type glDeleteQueries,#function ; glDeleteQueries = glDeleteQueriesARB + .globl glIsQuery ; .type glIsQuery,#function ; glIsQuery = glIsQueryARB + .globl glBeginQuery ; .type glBeginQuery,#function ; glBeginQuery = glBeginQueryARB + .globl glEndQuery ; .type glEndQuery,#function ; glEndQuery = glEndQueryARB + .globl glGetQueryiv ; .type glGetQueryiv,#function ; glGetQueryiv = glGetQueryivARB + .globl glGetQueryObjectiv ; .type glGetQueryObjectiv,#function ; glGetQueryObjectiv = glGetQueryObjectivARB + .globl glGetQueryObjectuiv ; .type glGetQueryObjectuiv,#function ; glGetQueryObjectuiv = glGetQueryObjectuivARB + .globl glBlendEquationSeparateATI ; .type glBlendEquationSeparateATI,#function ; glBlendEquationSeparateATI = glBlendEquationSeparateEXT diff --git a/reactos/dll/mesa32/src/sparc/norm.S b/reactos/dll/mesa32/src/sparc/norm.S new file mode 100644 index 00000000000..713cd5b3754 --- /dev/null +++ b/reactos/dll/mesa32/src/sparc/norm.S @@ -0,0 +1,609 @@ +/* $Id: norm.S,v 1.5 2005/07/28 00:11:11 idr Exp $ */ + +#include "sparc_matrix.h" + +#if defined(SVR4) || defined(__SVR4) || defined(__svr4__) + /* Solaris requires this for 64-bit. */ + .register %g2, #scratch + .register %g3, #scratch +#endif + + .text + +#ifdef __arch64__ +#define STACK_VAR_OFF (2047 + (8 * 16)) +#else +#define STACK_VAR_OFF (4 * 16) +#endif + + /* Newton-Raphson approximation turns out to be slower + * (and less accurate) than direct fsqrts/fdivs. + */ +#define ONE_DOT_ZERO 0x3f800000 + + .globl _mesa_sparc_transform_normalize_normals +_mesa_sparc_transform_normalize_normals: + /* o0=mat o1=scale o2=in o3=lengths o4=dest */ + + sethi %hi(ONE_DOT_ZERO), %g2 + sub %sp, 16, %sp + st %g2, [%sp + STACK_VAR_OFF+0x0] + st %o1, [%sp + STACK_VAR_OFF+0x4] + ld [%sp + STACK_VAR_OFF+0x0], %f12 ! f12 = 1.0f + ld [%sp + STACK_VAR_OFF+0x4], %f15 ! f15 = scale + add %sp, 16, %sp + + LDPTR [%o0 + MAT_INV], %o0 ! o0 = mat->inv + LDPTR [%o2 + V4F_START], %o5 ! o5 = 'from' in->start + ld [%o2 + V4F_COUNT], %g1 ! g1 = in->count + ld [%o2 + V4F_STRIDE], %g2 ! g2 = in->stride + LDPTR [%o4 + V4F_START], %g3 ! g3 = 'out' dest->start + + LDMATRIX_0_1_2_4_5_6_8_9_10(%o0) + + /* dest->count = in->count */ + st %g1, [%o4 + V4F_COUNT] + + cmp %g1, 1 + bl 7f + cmp %o3, 0 + bne 4f + clr %o4 ! 'i' for STRIDE_LOOP + +1: /* LENGTHS == NULL */ + ld [%o5 + 0x00], %f0 ! ux = from[0] + ld [%o5 + 0x04], %f1 ! uy = from[1] + ld [%o5 + 0x08], %f2 ! uz = from[2] + add %o5, %g2, %o5 ! STRIDE_F(from, stride) + add %o4, 1, %o4 ! i++ + + /* tx (f3) = (ux * m0) + (uy * m1) + (uz * m2) + * ty (f5) = (ux * m4) + (uy * m5) + (uz * m6) + * tz (f7) = (ux * m8) + (uy * m9) + (uz * m10) + */ + fmuls %f0, M0, %f3 ! FGM Group + fmuls %f1, M1, %f4 ! FGM Group + fmuls %f0, M4, %f5 ! FGM Group + fmuls %f1, M5, %f6 ! FGM Group + fmuls %f0, M8, %f7 ! FGM Group f3 available + fmuls %f1, M9, %f8 ! FGM Group f4 available + fadds %f3, %f4, %f3 ! FGA + fmuls %f2, M2, %f10 ! FGM Group f5 available + fmuls %f2, M6, %f0 ! FGM Group f6 available + fadds %f5, %f6, %f5 ! FGA + fmuls %f2, M10, %f4 ! FGM Group f7 available + fadds %f7, %f8, %f7 ! FGA Group f8,f3 available + fadds %f3, %f10, %f3 ! FGA Group f10 available + fadds %f5, %f0, %f5 ! FGA Group stall f0,f5 available + fadds %f7, %f4, %f7 ! FGA Group stall f4,f7 available + + /* f3=tx, f5=ty, f7=tz */ + + /* len (f6) = (tx * tx) + (ty * ty) + (tz * tz) */ + fmuls %f3, %f3, %f6 ! FGM Group f3 available + fmuls %f5, %f5, %f8 ! FGM Group f5 available + fmuls %f7, %f7, %f10 ! FGM Group f7 available + fadds %f6, %f8, %f6 ! FGA Group 2cyc stall f6,f8 available + fadds %f6, %f10, %f6 ! FGA Group 4cyc stall f6,f10 available + + /* scale (f6) = 1.0 / sqrt(len) */ + fsqrts %f6, %f6 ! FDIV 20 cycles + fdivs %f12, %f6, %f6 ! FDIV 14 cycles + + fmuls %f3, %f6, %f3 + st %f3, [%g3 + 0x00] ! out[i][0] = tx * scale + fmuls %f5, %f6, %f5 + st %f5, [%g3 + 0x04] ! out[i][1] = ty * scale + fmuls %f7, %f6, %f7 + st %f7, [%g3 + 0x08] ! out[i][2] = tz * scale + + cmp %o4, %g1 ! continue if (i < count) + bl 1b + add %g3, 0x0c, %g3 ! advance out vector pointer + + ba 7f + nop + +4: /* LENGTHS != NULL */ + fmuls M0, %f15, M0 + fmuls M1, %f15, M1 + fmuls M2, %f15, M2 + fmuls M4, %f15, M4 + fmuls M5, %f15, M5 + fmuls M6, %f15, M6 + fmuls M8, %f15, M8 + fmuls M9, %f15, M9 + fmuls M10, %f15, M10 + +5: + ld [%o5 + 0x00], %f0 ! ux = from[0] + ld [%o5 + 0x04], %f1 ! uy = from[1] + ld [%o5 + 0x08], %f2 ! uz = from[2] + add %o5, %g2, %o5 ! STRIDE_F(from, stride) + add %o4, 1, %o4 ! i++ + + /* tx (f3) = (ux * m0) + (uy * m1) + (uz * m2) + * ty (f5) = (ux * m4) + (uy * m5) + (uz * m6) + * tz (f7) = (ux * m8) + (uy * m9) + (uz * m10) + */ + fmuls %f0, M0, %f3 ! FGM Group + fmuls %f1, M1, %f4 ! FGM Group + fmuls %f0, M4, %f5 ! FGM Group + fmuls %f1, M5, %f6 ! FGM Group + fmuls %f0, M8, %f7 ! FGM Group f3 available + fmuls %f1, M9, %f8 ! FGM Group f4 available + fadds %f3, %f4, %f3 ! FGA + fmuls %f2, M2, %f10 ! FGM Group f5 available + fmuls %f2, M6, %f0 ! FGM Group f6 available + fadds %f5, %f6, %f5 ! FGA + fmuls %f2, M10, %f4 ! FGM Group f7 available + fadds %f7, %f8, %f7 ! FGA Group f8,f3 available + fadds %f3, %f10, %f3 ! FGA Group f10 available + ld [%o3], %f13 ! LSU + fadds %f5, %f0, %f5 ! FGA Group stall f0,f5 available + add %o3, 4, %o3 ! IEU0 + fadds %f7, %f4, %f7 ! FGA Group stall f4,f7 available + + /* f3=tx, f5=ty, f7=tz, f13=lengths[i] */ + + fmuls %f3, %f13, %f3 + st %f3, [%g3 + 0x00] ! out[i][0] = tx * len + fmuls %f5, %f13, %f5 + st %f5, [%g3 + 0x04] ! out[i][1] = ty * len + fmuls %f7, %f13, %f7 + st %f7, [%g3 + 0x08] ! out[i][2] = tz * len + + cmp %o4, %g1 ! continue if (i < count) + bl 5b + add %g3, 0x0c, %g3 ! advance out vector pointer + +7: retl + nop + + .globl _mesa_sparc_transform_normalize_normals_no_rot +_mesa_sparc_transform_normalize_normals_no_rot: + /* o0=mat o1=scale o2=in o3=lengths o4=dest */ + + sethi %hi(ONE_DOT_ZERO), %g2 + sub %sp, 16, %sp + st %g2, [%sp + STACK_VAR_OFF+0x0] + st %o1, [%sp + STACK_VAR_OFF+0x4] + ld [%sp + STACK_VAR_OFF+0x0], %f12 ! f12 = 1.0f + ld [%sp + STACK_VAR_OFF+0x4], %f15 ! f15 = scale + add %sp, 16, %sp + + LDPTR [%o0 + MAT_INV], %o0 ! o0 = mat->inv + LDPTR [%o2 + V4F_START], %o5 ! o5 = 'from' in->start + ld [%o2 + V4F_COUNT], %g1 ! g1 = in->count + ld [%o2 + V4F_STRIDE], %g2 ! g2 = in->stride + LDPTR [%o4 + V4F_START], %g3 ! g3 = 'out' dest->start + + LDMATRIX_0_5_10(%o0) + + /* dest->count = in->count */ + st %g1, [%o4 + V4F_COUNT] + + cmp %g1, 1 + bl 7f + cmp %o3, 0 + bne 4f + clr %o4 ! 'i' for STRIDE_LOOP + +1: /* LENGTHS == NULL */ + ld [%o5 + 0x00], %f0 ! ux = from[0] + ld [%o5 + 0x04], %f1 ! uy = from[1] + ld [%o5 + 0x08], %f2 ! uz = from[2] + add %o5, %g2, %o5 ! STRIDE_F(from, stride) + add %o4, 1, %o4 ! i++ + + /* tx (f3) = (ux * m0) + * ty (f5) = (uy * m5) + * tz (f7) = (uz * m10) + */ + fmuls %f0, M0, %f3 ! FGM Group + fmuls %f1, M5, %f5 ! FGM Group + fmuls %f2, M10, %f7 ! FGM Group + + /* f3=tx, f5=ty, f7=tz */ + + /* len (f6) = (tx * tx) + (ty * ty) + (tz * tz) */ + fmuls %f3, %f3, %f6 ! FGM Group stall, f3 available + fmuls %f5, %f5, %f8 ! FGM Group f5 available + fmuls %f7, %f7, %f10 ! FGM Group f7 available + fadds %f6, %f8, %f6 ! FGA Group 2cyc stall f6,f8 available + fadds %f6, %f10, %f6 ! FGA Group 4cyc stall f6,f10 available + + /* scale (f6) = 1.0 / sqrt(len) */ + fsqrts %f6, %f6 ! FDIV 20 cycles + fdivs %f12, %f6, %f6 ! FDIV 14 cycles + + fmuls %f3, %f6, %f3 + st %f3, [%g3 + 0x00] ! out[i][0] = tx * scale + fmuls %f5, %f6, %f5 + st %f5, [%g3 + 0x04] ! out[i][1] = ty * scale + fmuls %f7, %f6, %f7 + st %f7, [%g3 + 0x08] ! out[i][2] = tz * scale + + cmp %o4, %g1 ! continue if (i < count) + bl 1b + add %g3, 0x0c, %g3 ! advance out vector pointer + + ba 7f + nop + +4: /* LENGTHS != NULL */ + fmuls M0, %f15, M0 + fmuls M5, %f15, M5 + fmuls M10, %f15, M10 + +5: + ld [%o5 + 0x00], %f0 ! ux = from[0] + ld [%o5 + 0x04], %f1 ! uy = from[1] + ld [%o5 + 0x08], %f2 ! uz = from[2] + add %o5, %g2, %o5 ! STRIDE_F(from, stride) + add %o4, 1, %o4 ! i++ + + /* tx (f3) = (ux * m0) + * ty (f5) = (uy * m5) + * tz (f7) = (uz * m10) + */ + fmuls %f0, M0, %f3 ! FGM Group + ld [%o3], %f13 ! LSU + fmuls %f1, M5, %f5 ! FGM Group + add %o3, 4, %o3 ! IEU0 + fmuls %f2, M10, %f7 ! FGM Group + + /* f3=tx, f5=ty, f7=tz, f13=lengths[i] */ + + fmuls %f3, %f13, %f3 + st %f3, [%g3 + 0x00] ! out[i][0] = tx * len + fmuls %f5, %f13, %f5 + st %f5, [%g3 + 0x04] ! out[i][1] = ty * len + fmuls %f7, %f13, %f7 + st %f7, [%g3 + 0x08] ! out[i][2] = tz * len + + cmp %o4, %g1 ! continue if (i < count) + bl 5b + add %g3, 0x0c, %g3 ! advance out vector pointer + +7: retl + nop + + .globl _mesa_sparc_transform_rescale_normals_no_rot +_mesa_sparc_transform_rescale_normals_no_rot: + /* o0=mat o1=scale o2=in o3=lengths o4=dest */ + sub %sp, 16, %sp + st %o1, [%sp + STACK_VAR_OFF+0x0] + ld [%sp + STACK_VAR_OFF+0x0], %f15 ! f15 = scale + add %sp, 16, %sp + + LDPTR [%o0 + MAT_INV], %o0 ! o0 = mat->inv + LDPTR [%o2 + V4F_START], %o5 ! o5 = 'from' in->start + ld [%o2 + V4F_COUNT], %g1 ! g1 = in->count + ld [%o2 + V4F_STRIDE], %g2 ! g2 = in->stride + LDPTR [%o4 + V4F_START], %g3 ! g3 = 'out' dest->start + + LDMATRIX_0_5_10(%o0) + + /* dest->count = in->count */ + st %g1, [%o4 + V4F_COUNT] + + cmp %g1, 1 + bl 7f + clr %o4 ! 'i' for STRIDE_LOOP + + fmuls M0, %f15, M0 + fmuls M5, %f15, M5 + fmuls M10, %f15, M10 + +1: ld [%o5 + 0x00], %f0 ! ux = from[0] + ld [%o5 + 0x04], %f1 ! uy = from[1] + ld [%o5 + 0x08], %f2 ! uz = from[2] + add %o5, %g2, %o5 ! STRIDE_F(from, stride) + add %o4, 1, %o4 ! i++ + + /* tx (f3) = (ux * m0) + * ty (f5) = (uy * m5) + * tz (f7) = (uz * m10) + */ + fmuls %f0, M0, %f3 ! FGM Group + st %f3, [%g3 + 0x00] ! LSU + fmuls %f1, M5, %f5 ! FGM Group + st %f5, [%g3 + 0x04] ! LSU + fmuls %f2, M10, %f7 ! FGM Group + st %f7, [%g3 + 0x08] ! LSU + + cmp %o4, %g1 ! continue if (i < count) + bl 1b + add %g3, 0x0c, %g3 ! advance out vector pointer + +7: retl + nop + + .globl _mesa_sparc_transform_rescale_normals +_mesa_sparc_transform_rescale_normals: + /* o0=mat o1=scale o2=in o3=lengths o4=dest */ + sub %sp, 16, %sp + st %o1, [%sp + STACK_VAR_OFF+0x0] + ld [%sp + STACK_VAR_OFF+0x0], %f15 ! f15 = scale + add %sp, 16, %sp + + LDPTR [%o0 + MAT_INV], %o0 ! o0 = mat->inv + LDPTR [%o2 + V4F_START], %o5 ! o5 = 'from' in->start + ld [%o2 + V4F_COUNT], %g1 ! g1 = in->count + ld [%o2 + V4F_STRIDE], %g2 ! g2 = in->stride + LDPTR [%o4 + V4F_START], %g3 ! g3 = 'out' dest->start + + LDMATRIX_0_1_2_4_5_6_8_9_10(%o0) + + /* dest->count = in->count */ + st %g1, [%o4 + V4F_COUNT] + + cmp %g1, 1 + bl 7f + clr %o4 ! 'i' for STRIDE_LOOP + + fmuls M0, %f15, M0 + fmuls M1, %f15, M1 + fmuls M2, %f15, M2 + fmuls M4, %f15, M4 + fmuls M5, %f15, M5 + fmuls M6, %f15, M6 + fmuls M8, %f15, M8 + fmuls M9, %f15, M9 + fmuls M10, %f15, M10 + +1: ld [%o5 + 0x00], %f0 ! ux = from[0] + ld [%o5 + 0x04], %f1 ! uy = from[1] + ld [%o5 + 0x08], %f2 ! uz = from[2] + add %o5, %g2, %o5 ! STRIDE_F(from, stride) + add %o4, 1, %o4 ! i++ + + fmuls %f0, M0, %f3 ! FGM Group + fmuls %f1, M1, %f4 ! FGM Group + fmuls %f0, M4, %f5 ! FGM Group + fmuls %f1, M5, %f6 ! FGM Group + fmuls %f0, M8, %f7 ! FGM Group f3 available + fmuls %f1, M9, %f8 ! FGM Group f4 available + fadds %f3, %f4, %f3 ! FGA + fmuls %f2, M2, %f10 ! FGM Group f5 available + fmuls %f2, M6, %f0 ! FGM Group f6 available + fadds %f5, %f6, %f5 ! FGA + fmuls %f2, M10, %f4 ! FGM Group f7 available + fadds %f7, %f8, %f7 ! FGA Group f8,f3 available + fadds %f3, %f10, %f3 ! FGA Group f10 available + st %f3, [%g3 + 0x00] ! LSU + fadds %f5, %f0, %f5 ! FGA Group stall f0,f5 available + st %f5, [%g3 + 0x04] ! LSU + fadds %f7, %f4, %f7 ! FGA Group stall f4,f7 available + st %f7, [%g3 + 0x08] ! LSU + + cmp %o4, %g1 ! continue if (i < count) + bl 1b + add %g3, 0x0c, %g3 ! advance out vector pointer + +7: retl + nop + + .globl _mesa_sparc_transform_normals_no_rot +_mesa_sparc_transform_normals_no_rot: + /* o0=mat o1=scale o2=in o3=lengths o4=dest */ + LDPTR [%o0 + MAT_INV], %o0 ! o0 = mat->inv + LDPTR [%o2 + V4F_START], %o5 ! o5 = 'from' in->start + ld [%o2 + V4F_COUNT], %g1 ! g1 = in->count + ld [%o2 + V4F_STRIDE], %g2 ! g2 = in->stride + LDPTR [%o4 + V4F_START], %g3 ! g3 = 'out' dest->start + + LDMATRIX_0_5_10(%o0) + + /* dest->count = in->count */ + st %g1, [%o4 + V4F_COUNT] + + cmp %g1, 1 + bl 7f + clr %o4 ! 'i' for STRIDE_LOOP + +1: ld [%o5 + 0x00], %f0 ! ux = from[0] + ld [%o5 + 0x04], %f1 ! uy = from[1] + ld [%o5 + 0x08], %f2 ! uz = from[2] + add %o5, %g2, %o5 ! STRIDE_F(from, stride) + add %o4, 1, %o4 ! i++ + + /* tx (f3) = (ux * m0) + * ty (f5) = (uy * m5) + * tz (f7) = (uz * m10) + */ + fmuls %f0, M0, %f3 ! FGM Group + st %f3, [%g3 + 0x00] ! LSU + fmuls %f1, M5, %f5 ! FGM Group + st %f5, [%g3 + 0x04] ! LSU + fmuls %f2, M10, %f7 ! FGM Group + st %f7, [%g3 + 0x08] ! LSU + + cmp %o4, %g1 ! continue if (i < count) + bl 1b + add %g3, 0x0c, %g3 ! advance out vector pointer + +7: retl + nop + + .globl _mesa_sparc_transform_normals +_mesa_sparc_transform_normals: + /* o0=mat o1=scale o2=in o3=lengths o4=dest */ + LDPTR [%o0 + MAT_INV], %o0 ! o0 = mat->inv + LDPTR [%o2 + V4F_START], %o5 ! o5 = 'from' in->start + ld [%o2 + V4F_COUNT], %g1 ! g1 = in->count + ld [%o2 + V4F_STRIDE], %g2 ! g2 = in->stride + LDPTR [%o4 + V4F_START], %g3 ! g3 = 'out' dest->start + + LDMATRIX_0_1_2_4_5_6_8_9_10(%o0) + + /* dest->count = in->count */ + st %g1, [%o4 + V4F_COUNT] + + cmp %g1, 1 + bl 7f + clr %o4 ! 'i' for STRIDE_LOOP + +1: ld [%o5 + 0x00], %f0 ! ux = from[0] + ld [%o5 + 0x04], %f1 ! uy = from[1] + ld [%o5 + 0x08], %f2 ! uz = from[2] + add %o5, %g2, %o5 ! STRIDE_F(from, stride) + add %o4, 1, %o4 ! i++ + + fmuls %f0, M0, %f3 ! FGM Group + fmuls %f1, M1, %f4 ! FGM Group + fmuls %f0, M4, %f5 ! FGM Group + fmuls %f1, M5, %f6 ! FGM Group + fmuls %f0, M8, %f7 ! FGM Group f3 available + fmuls %f1, M9, %f8 ! FGM Group f4 available + fadds %f3, %f4, %f3 ! FGA + fmuls %f2, M2, %f10 ! FGM Group f5 available + fmuls %f2, M6, %f0 ! FGM Group f6 available + fadds %f5, %f6, %f5 ! FGA + fmuls %f2, M10, %f4 ! FGM Group f7 available + fadds %f7, %f8, %f7 ! FGA Group f8,f3 available + fadds %f3, %f10, %f3 ! FGA Group f10 available + st %f3, [%g3 + 0x00] ! LSU + fadds %f5, %f0, %f5 ! FGA Group stall f0,f5 available + st %f5, [%g3 + 0x04] ! LSU + fadds %f7, %f4, %f7 ! FGA Group stall f4,f7 available + st %f7, [%g3 + 0x08] ! LSU + + cmp %o4, %g1 ! continue if (i < count) + bl 1b + add %g3, 0x0c, %g3 ! advance out vector pointer + +7: retl + nop + + .globl _mesa_sparc_normalize_normals +_mesa_sparc_normalize_normals: + /* o0=mat o1=scale o2=in o3=lengths o4=dest */ + + sethi %hi(ONE_DOT_ZERO), %g2 + sub %sp, 16, %sp + st %g2, [%sp + STACK_VAR_OFF+0x0] + ld [%sp + STACK_VAR_OFF+0x0], %f12 ! f12 = 1.0f + add %sp, 16, %sp + + LDPTR [%o2 + V4F_START], %o5 ! o5 = 'from' in->start + ld [%o2 + V4F_COUNT], %g1 ! g1 = in->count + ld [%o2 + V4F_STRIDE], %g2 ! g2 = in->stride + LDPTR [%o4 + V4F_START], %g3 ! g3 = 'out' dest->start + + /* dest->count = in->count */ + st %g1, [%o4 + V4F_COUNT] + + cmp %g1, 1 + bl 7f + cmp %o3, 0 + bne 4f + clr %o4 ! 'i' for STRIDE_LOOP + +1: /* LENGTHS == NULL */ + ld [%o5 + 0x00], %f3 ! ux = from[0] + ld [%o5 + 0x04], %f5 ! uy = from[1] + ld [%o5 + 0x08], %f7 ! uz = from[2] + add %o5, %g2, %o5 ! STRIDE_F(from, stride) + add %o4, 1, %o4 ! i++ + + /* f3=tx, f5=ty, f7=tz */ + + /* len (f6) = (tx * tx) + (ty * ty) + (tz * tz) */ + fmuls %f3, %f3, %f6 ! FGM Group f3 available + fmuls %f5, %f5, %f8 ! FGM Group f5 available + fmuls %f7, %f7, %f10 ! FGM Group f7 available + fadds %f6, %f8, %f6 ! FGA Group 2cyc stall f6,f8 available + fadds %f6, %f10, %f6 ! FGA Group 4cyc stall f6,f10 available + + /* scale (f6) = 1.0 / sqrt(len) */ + fsqrts %f6, %f6 ! FDIV 20 cycles + fdivs %f12, %f6, %f6 ! FDIV 14 cycles + + fmuls %f3, %f6, %f3 + st %f3, [%g3 + 0x00] ! out[i][0] = tx * scale + fmuls %f5, %f6, %f5 + st %f5, [%g3 + 0x04] ! out[i][1] = ty * scale + fmuls %f7, %f6, %f7 + st %f7, [%g3 + 0x08] ! out[i][2] = tz * scale + + cmp %o4, %g1 ! continue if (i < count) + bl 1b + add %g3, 0x0c, %g3 ! advance out vector pointer + + ba 7f + nop + +4: /* LENGTHS != NULL */ + +5: + ld [%o5 + 0x00], %f3 ! ux = from[0] + ld [%o5 + 0x04], %f5 ! uy = from[1] + ld [%o5 + 0x08], %f7 ! uz = from[2] + add %o5, %g2, %o5 ! STRIDE_F(from, stride) + add %o4, 1, %o4 ! i++ + + ld [%o3], %f13 ! LSU + add %o3, 4, %o3 ! IEU0 + + /* f3=tx, f5=ty, f7=tz, f13=lengths[i] */ + + fmuls %f3, %f13, %f3 + st %f3, [%g3 + 0x00] ! out[i][0] = tx * len + fmuls %f5, %f13, %f5 + st %f5, [%g3 + 0x04] ! out[i][1] = ty * len + fmuls %f7, %f13, %f7 + st %f7, [%g3 + 0x08] ! out[i][2] = tz * len + + cmp %o4, %g1 ! continue if (i < count) + bl 5b + add %g3, 0x0c, %g3 ! advance out vector pointer + +7: retl + nop + + .globl _mesa_sparc_rescale_normals +_mesa_sparc_rescale_normals: + /* o0=mat o1=scale o2=in o3=lengths o4=dest */ + + sethi %hi(ONE_DOT_ZERO), %g2 + sub %sp, 16, %sp + st %o1, [%sp + STACK_VAR_OFF+0x0] + ld [%sp + STACK_VAR_OFF+0x0], %f15 ! f15 = scale + add %sp, 16, %sp + + LDPTR [%o2 + V4F_START], %o5 ! o5 = 'from' in->start + ld [%o2 + V4F_COUNT], %g1 ! g1 = in->count + ld [%o2 + V4F_STRIDE], %g2 ! g2 = in->stride + LDPTR [%o4 + V4F_START], %g3 ! g3 = 'out' dest->start + + /* dest->count = in->count */ + st %g1, [%o4 + V4F_COUNT] + + cmp %g1, 1 + bl 7f + clr %o4 ! 'i' for STRIDE_LOOP + +1: + ld [%o5 + 0x00], %f3 ! ux = from[0] + ld [%o5 + 0x04], %f5 ! uy = from[1] + ld [%o5 + 0x08], %f7 ! uz = from[2] + add %o5, %g2, %o5 ! STRIDE_F(from, stride) + add %o4, 1, %o4 ! i++ + + /* f3=tx, f5=ty, f7=tz */ + + fmuls %f3, %f15, %f3 + st %f3, [%g3 + 0x00] ! out[i][0] = tx * scale + fmuls %f5, %f15, %f5 + st %f5, [%g3 + 0x04] ! out[i][1] = ty * scale + fmuls %f7, %f15, %f7 + st %f7, [%g3 + 0x08] ! out[i][2] = tz * scale + + cmp %o4, %g1 ! continue if (i < count) + bl 1b + add %g3, 0x0c, %g3 ! advance out vector pointer + +7: retl + nop diff --git a/reactos/dll/mesa32/src/sparc/sparc.c b/reactos/dll/mesa32/src/sparc/sparc.c new file mode 100644 index 00000000000..b7fe360d2c6 --- /dev/null +++ b/reactos/dll/mesa32/src/sparc/sparc.c @@ -0,0 +1,177 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + +/* + * Sparc assembly code by David S. Miller + */ + + +#include "sparc.h" + +#ifdef USE_SPARC_ASM + +#include "context.h" +#include "math/m_xform.h" +#include "tnl/t_context.h" + +#ifdef DEBUG +#include "math/m_debug.h" +#endif + +#define XFORM_ARGS GLvector4f *to_vec, \ + const GLfloat m[16], \ + const GLvector4f *from_vec + +#define DECLARE_XFORM_GROUP(pfx, sz) \ + extern void _mesa_##pfx##_transform_points##sz##_general(XFORM_ARGS); \ + extern void _mesa_##pfx##_transform_points##sz##_identity(XFORM_ARGS); \ + extern void _mesa_##pfx##_transform_points##sz##_3d_no_rot(XFORM_ARGS); \ + extern void _mesa_##pfx##_transform_points##sz##_perspective(XFORM_ARGS); \ + extern void _mesa_##pfx##_transform_points##sz##_2d(XFORM_ARGS); \ + extern void _mesa_##pfx##_transform_points##sz##_2d_no_rot(XFORM_ARGS); \ + extern void _mesa_##pfx##_transform_points##sz##_3d(XFORM_ARGS); + +#define ASSIGN_XFORM_GROUP(pfx, sz) \ + _mesa_transform_tab[sz][MATRIX_GENERAL] = \ + _mesa_##pfx##_transform_points##sz##_general; \ + _mesa_transform_tab[sz][MATRIX_IDENTITY] = \ + _mesa_##pfx##_transform_points##sz##_identity; \ + _mesa_transform_tab[sz][MATRIX_3D_NO_ROT] = \ + _mesa_##pfx##_transform_points##sz##_3d_no_rot; \ + _mesa_transform_tab[sz][MATRIX_PERSPECTIVE] = \ + _mesa_##pfx##_transform_points##sz##_perspective; \ + _mesa_transform_tab[sz][MATRIX_2D] = \ + _mesa_##pfx##_transform_points##sz##_2d; \ + _mesa_transform_tab[sz][MATRIX_2D_NO_ROT] = \ + _mesa_##pfx##_transform_points##sz##_2d_no_rot; \ + _mesa_transform_tab[sz][MATRIX_3D] = \ + _mesa_##pfx##_transform_points##sz##_3d; + + +DECLARE_XFORM_GROUP(sparc, 1) +DECLARE_XFORM_GROUP(sparc, 2) +DECLARE_XFORM_GROUP(sparc, 3) +DECLARE_XFORM_GROUP(sparc, 4) + +extern GLvector4f *_mesa_sparc_cliptest_points4(GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask); + +extern GLvector4f *_mesa_sparc_cliptest_points4_np(GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask); + +#define NORM_ARGS const GLmatrix *mat, \ + GLfloat scale, \ + const GLvector4f *in, \ + const GLfloat *lengths, \ + GLvector4f *dest + +extern void _mesa_sparc_transform_normalize_normals(NORM_ARGS); +extern void _mesa_sparc_transform_normalize_normals_no_rot(NORM_ARGS); +extern void _mesa_sparc_transform_rescale_normals_no_rot(NORM_ARGS); +extern void _mesa_sparc_transform_rescale_normals(NORM_ARGS); +extern void _mesa_sparc_transform_normals_no_rot(NORM_ARGS); +extern void _mesa_sparc_transform_normals(NORM_ARGS); +extern void _mesa_sparc_normalize_normals(NORM_ARGS); +extern void _mesa_sparc_rescale_normals(NORM_ARGS); + + + +void _mesa_init_all_sparc_transform_asm(void) +{ + ASSIGN_XFORM_GROUP(sparc, 1) + ASSIGN_XFORM_GROUP(sparc, 2) + ASSIGN_XFORM_GROUP(sparc, 3) + ASSIGN_XFORM_GROUP(sparc, 4) + + _mesa_clip_tab[4] = _mesa_sparc_cliptest_points4; + _mesa_clip_np_tab[4] = _mesa_sparc_cliptest_points4_np; + +#if 0 + /* disable these too. See bug 673938 */ + _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] = + _mesa_sparc_transform_normalize_normals; + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] = + _mesa_sparc_transform_normalize_normals_no_rot; + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = + _mesa_sparc_transform_rescale_normals_no_rot; + _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = + _mesa_sparc_transform_rescale_normals; + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = + _mesa_sparc_transform_normals_no_rot; + _mesa_normal_tab[NORM_TRANSFORM] = + _mesa_sparc_transform_normals; + _mesa_normal_tab[NORM_NORMALIZE] = + _mesa_sparc_normalize_normals; + _mesa_normal_tab[NORM_RESCALE] = + _mesa_sparc_rescale_normals; +#endif + +#ifdef DEBUG + _math_test_all_transform_functions("sparc"); + _math_test_all_cliptest_functions("sparc"); + _math_test_all_normal_transform_functions("sparc"); +#endif +} + +extern unsigned int _mesa_sparc_glapi_begin; +extern unsigned int _mesa_sparc_glapi_end; +extern void __glapi_sparc_icache_flush(unsigned int *); + +#endif /* USE_SPARC_ASM */ + + +void _mesa_init_sparc_glapi_relocs(void) +{ +#ifdef USE_SPARC_ASM + unsigned int *insn_ptr, *end_ptr; + unsigned long disp_addr; + + insn_ptr = &_mesa_sparc_glapi_begin; + end_ptr = &_mesa_sparc_glapi_end; + disp_addr = (unsigned long) &_glapi_Dispatch; + + while (insn_ptr < end_ptr) { +#ifdef __arch64__ + insn_ptr[0] |= (disp_addr >> (32 + 10)); + insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10); + __glapi_sparc_icache_flush(&insn_ptr[0]); + insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1)); + insn_ptr[3] |= (disp_addr & ((1 << 10) - 1)); + __glapi_sparc_icache_flush(&insn_ptr[2]); + insn_ptr += 11; +#else + insn_ptr[0] |= (disp_addr >> 10); + insn_ptr[1] |= (disp_addr & ((1 << 10) - 1)); + __glapi_sparc_icache_flush(&insn_ptr[0]); + insn_ptr += 5; +#endif + } +#endif /* USE_SPARC_ASM */ +} diff --git a/reactos/dll/mesa32/src/sparc/sparc.h b/reactos/dll/mesa32/src/sparc/sparc.h new file mode 100644 index 00000000000..55ab12122d8 --- /dev/null +++ b/reactos/dll/mesa32/src/sparc/sparc.h @@ -0,0 +1,38 @@ +/* $Id: sparc.h,v 1.3 2001/06/06 22:55:28 davem69 Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.1 + * + * Copyright (C) 1999 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. + */ + +/* + * Sparc assembly code by David S. Miller + */ + + +#ifndef SPARC_H +#define SPARC_H + +extern void _mesa_init_all_sparc_transform_asm(void); +extern void _mesa_init_sparc_glapi_relocs(void); + +#endif /* !(SPARC_H) */ diff --git a/reactos/dll/mesa32/src/sparc/sparc_matrix.h b/reactos/dll/mesa32/src/sparc/sparc_matrix.h new file mode 100644 index 00000000000..f677d9bda13 --- /dev/null +++ b/reactos/dll/mesa32/src/sparc/sparc_matrix.h @@ -0,0 +1,170 @@ +/* + * SPARC assembly matrix code. + */ + +#ifndef _SPARC_MATRIX_H +#define _SPARC_MATRIX_H + +#ifdef __arch64__ +#define LDPTR ldx +#define MAT_M 0x00 +#define MAT_INV 0x08 +#define V4F_DATA 0x00 +#define V4F_START 0x08 +#define V4F_COUNT 0x10 +#define V4F_STRIDE 0x14 +#define V4F_SIZE 0x18 +#define V4F_FLAGS 0x1c +#else +#define LDPTR ld +#define MAT_M 0x00 +#define MAT_INV 0x04 +#define V4F_DATA 0x00 +#define V4F_START 0x04 +#define V4F_COUNT 0x08 +#define V4F_STRIDE 0x0c +#define V4F_SIZE 0x10 +#define V4F_FLAGS 0x14 +#endif + +#define VEC_SIZE_1 1 +#define VEC_SIZE_2 3 +#define VEC_SIZE_3 7 +#define VEC_SIZE_4 15 + +#define M0 %f16 +#define M1 %f17 +#define M2 %f18 +#define M3 %f19 +#define M4 %f20 +#define M5 %f21 +#define M6 %f22 +#define M7 %f23 +#define M8 %f24 +#define M9 %f25 +#define M10 %f26 +#define M11 %f27 +#define M12 %f28 +#define M13 %f29 +#define M14 %f30 +#define M15 %f31 + +#define LDMATRIX_0_1_2_3_12_13_14_15(BASE) \ + ldd [BASE + ( 0 * 0x4)], M0; \ + ldd [BASE + ( 2 * 0x4)], M2; \ + ldd [BASE + (12 * 0x4)], M12; \ + ldd [BASE + (14 * 0x4)], M14 + +#define LDMATRIX_0_1_12_13(BASE) \ + ldd [BASE + ( 0 * 0x4)], M0; \ + ldd [BASE + (12 * 0x4)], M12 + +#define LDMATRIX_0_12_13(BASE) \ + ld [BASE + ( 0 * 0x4)], M0; \ + ldd [BASE + (12 * 0x4)], M12 + +#define LDMATRIX_0_1_2_12_13_14(BASE) \ + ldd [BASE + ( 0 * 0x4)], M0; \ + ld [BASE + ( 2 * 0x4)], M2; \ + ldd [BASE + (12 * 0x4)], M12; \ + ld [BASE + (14 * 0x4)], M14 + +#define LDMATRIX_0_12_13_14(BASE) \ + ld [BASE + ( 0 * 0x4)], M0; \ + ldd [BASE + (12 * 0x4)], M12; \ + ld [BASE + (14 * 0x4)], M14 + +#define LDMATRIX_0_14(BASE) \ + ld [BASE + ( 0 * 0x4)], M0; \ + ld [BASE + (14 * 0x4)], M14 + +#define LDMATRIX_0_1_2_3_4_5_6_7_12_13_14_15(BASE) \ + ldd [BASE + ( 0 * 0x4)], M0; \ + ldd [BASE + ( 2 * 0x4)], M2; \ + ldd [BASE + ( 4 * 0x4)], M4; \ + ldd [BASE + ( 6 * 0x4)], M6; \ + ldd [BASE + (12 * 0x4)], M12; \ + ldd [BASE + (14 * 0x4)], M14 + +#define LDMATRIX_0_5_12_13(BASE) \ + ld [BASE + ( 0 * 0x4)], M0; \ + ld [BASE + ( 5 * 0x4)], M5; \ + ldd [BASE + (12 * 0x4)], M12 + +#define LDMATRIX_0_1_2_3_4_5_6_12_13_14(BASE) \ + ldd [BASE + ( 0 * 0x4)], M0; \ + ldd [BASE + ( 2 * 0x4)], M2; \ + ldd [BASE + ( 4 * 0x4)], M4; \ + ld [BASE + ( 6 * 0x4)], M6; \ + ldd [BASE + (12 * 0x4)], M12; \ + ld [BASE + (14 * 0x4)], M14 + +#define LDMATRIX_0_5_12_13_14(BASE) \ + ld [BASE + ( 0 * 0x4)], M0; \ + ld [BASE + ( 5 * 0x4)], M5; \ + ldd [BASE + (12 * 0x4)], M12; \ + ld [BASE + (14 * 0x4)], M14 + +#define LDMATRIX_0_5_14(BASE) \ + ld [BASE + ( 0 * 0x4)], M0; \ + ld [BASE + ( 5 * 0x4)], M5; \ + ld [BASE + (14 * 0x4)], M14 + +#define LDMATRIX_0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15(BASE) \ + ldd [BASE + ( 0 * 0x4)], M0; \ + ldd [BASE + ( 2 * 0x4)], M2; \ + ldd [BASE + ( 4 * 0x4)], M4; \ + ldd [BASE + ( 6 * 0x4)], M6; \ + ldd [BASE + ( 8 * 0x4)], M8; \ + ldd [BASE + (10 * 0x4)], M10; \ + ldd [BASE + (12 * 0x4)], M12; \ + ldd [BASE + (14 * 0x4)], M14 + +#define LDMATRIX_0_1_4_5_12_13(BASE) \ + ldd [BASE + ( 0 * 0x4)], M0; \ + ldd [BASE + ( 4 * 0x4)], M4; \ + ldd [BASE + (12 * 0x4)], M12 + +#define LDMATRIX_0_5_12_13(BASE) \ + ld [BASE + ( 0 * 0x4)], M0; \ + ld [BASE + ( 5 * 0x4)], M5; \ + ldd [BASE + (12 * 0x4)], M12 + +#define LDMATRIX_0_1_2_4_5_6_8_9_10(BASE) \ + ldd [BASE + ( 0 * 0x4)], M0; \ + ld [BASE + ( 2 * 0x4)], M2; \ + ldd [BASE + ( 4 * 0x4)], M4; \ + ld [BASE + ( 6 * 0x4)], M6; \ + ldd [BASE + ( 8 * 0x4)], M8; \ + ld [BASE + (10 * 0x4)], M10 + +#define LDMATRIX_0_1_2_4_5_6_8_9_10_12_13_14(BASE) \ + ldd [BASE + ( 0 * 0x4)], M0; \ + ld [BASE + ( 2 * 0x4)], M2; \ + ldd [BASE + ( 4 * 0x4)], M4; \ + ld [BASE + ( 6 * 0x4)], M6; \ + ldd [BASE + ( 8 * 0x4)], M8; \ + ld [BASE + (10 * 0x4)], M10; \ + ldd [BASE + (12 * 0x4)], M12; \ + ld [BASE + (14 * 0x4)], M14 + +#define LDMATRIX_0_5_10(BASE) \ + ld [BASE + ( 0 * 0x4)], M0; \ + ld [BASE + ( 5 * 0x4)], M5; \ + ld [BASE + (10 * 0x4)], M10; \ + +#define LDMATRIX_0_5_10_12_13_14(BASE) \ + ld [BASE + ( 0 * 0x4)], M0; \ + ld [BASE + ( 5 * 0x4)], M5; \ + ld [BASE + (10 * 0x4)], M10; \ + ldd [BASE + (12 * 0x4)], M12; \ + ld [BASE + (14 * 0x4)], M14 + +#define LDMATRIX_0_5_8_9_10_14(BASE) \ + ld [BASE + ( 0 * 0x4)], M0; \ + ld [BASE + ( 5 * 0x4)], M5; \ + ldd [BASE + ( 8 * 0x4)], M8; \ + ld [BASE + (10 * 0x4)], M10; \ + ld [BASE + (14 * 0x4)], M14 + +#endif /* !(_SPARC_MATRIX_H) */ diff --git a/reactos/dll/mesa32/src/sparc/xform.S b/reactos/dll/mesa32/src/sparc/xform.S new file mode 100644 index 00000000000..f44ec794e94 --- /dev/null +++ b/reactos/dll/mesa32/src/sparc/xform.S @@ -0,0 +1,1393 @@ +/* $Id: xform.S,v 1.4 2005/07/28 00:11:11 idr Exp $ */ + + /* TODO + * + * 1) It would be nice if load/store double could be used + * at least for the matrix parts. I think for the matrices + * it is safe, but for the vertices it probably is not due to + * things like glInterleavedArrays etc. + * + * UPDATE: Trying this now in sparc_matrix.h -DaveM_990624 + * + * 2) One extremely slick trick would be if we could enclose + * groups of xform calls on the same vertices such that + * we just load the matrix into f16-->f31 before the calls + * and then we would not have to do them here. This may be + * tricky and not much of a gain though. + */ + +#include "sparc_matrix.h" + +#if defined(SVR4) || defined(__SVR4) || defined(__svr4__) + /* Solaris requires this for 64-bit. */ + .register %g2, #scratch + .register %g3, #scratch +#endif + + .text + .align 64 + +__set_v4f_1: + ld [%o0 + V4F_FLAGS], %g2 + mov 1, %g1 + st %g1, [%o0 + V4F_SIZE] + or %g2, VEC_SIZE_1, %g2 + retl + st %g2, [%o0 + V4F_FLAGS] +__set_v4f_2: + ld [%o0 + V4F_FLAGS], %g2 + mov 2, %g1 + st %g1, [%o0 + V4F_SIZE] + or %g2, VEC_SIZE_2, %g2 + retl + st %g2, [%o0 + V4F_FLAGS] +__set_v4f_3: + ld [%o0 + V4F_FLAGS], %g2 + mov 3, %g1 + st %g1, [%o0 + V4F_SIZE] + or %g2, VEC_SIZE_3, %g2 + retl + st %g2, [%o0 + V4F_FLAGS] +__set_v4f_4: + ld [%o0 + V4F_FLAGS], %g2 + mov 4, %g1 + st %g1, [%o0 + V4F_SIZE] + or %g2, VEC_SIZE_4, %g2 + retl + st %g2, [%o0 + V4F_FLAGS] + + /* First the raw versions. */ + + .globl _mesa_sparc_transform_points1_general +_mesa_sparc_transform_points1_general: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_1_2_3_12_13_14_15(%o1) + + cmp %g3, 1 + st %g3, [%o0 + V4F_COUNT] + bl 3f + clr %o1 + + be 2f + andn %g3, 1, %o2 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + add %g1, %o5, %g1 ! IEU0 + ld [%g1 + 0x00], %f8 ! LSU Group + add %o1, 2, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f1 ! FGM Group 1-cycle stall on %f0 + fmuls %f0, M1, %f2 ! FGM Group + fmuls %f0, M2, %f3 ! FGM Group + fmuls %f0, M3, %f4 ! FGM Group + fmuls %f8, M0, %f9 ! FGM Group f1 available + fadds %f1, M12, %f1 ! FGA + st %f1, [%g2 + 0x00] ! LSU + fmuls %f8, M1, %f10 ! FGM Group f2 available + fadds %f2, M13, %f2 ! FGA + st %f2, [%g2 + 0x04] ! LSU + fmuls %f8, M2, %f11 ! FGM Group f3 available + fadds %f3, M14, %f3 ! FGA + st %f3, [%g2 + 0x08] ! LSU + fmuls %f8, M3, %f12 ! FGM Group f4 available + fadds %f4, M15, %f4 ! FGA + st %f4, [%g2 + 0x0c] ! LSU + fadds %f9, M12, %f9 ! FGA Group f9 available + st %f9, [%g2 + 0x10] ! LSU + fadds %f10, M13, %f10 ! FGA Group f10 available + st %f10, [%g2 + 0x14] ! LSU + fadds %f11, M14, %f11 ! FGA Group f11 available + st %f11, [%g2 + 0x18] ! LSU + fadds %f12, M15, %f12 ! FGA Group f12 available + st %f12, [%g2 + 0x1c] ! LSU + cmp %o1, %o2 ! IEU1 + bne 1b ! CTI + add %g2, 0x20, %g2 ! IEU0 Group + + cmp %o1, %g3 + be 3f + nop + +2: ld [%g1 + 0x00], %f0 ! LSU Group + fmuls %f0, M0, %f1 ! FGM Group 1-cycle stall on %f0 + fmuls %f0, M1, %f2 ! FGM Group + fmuls %f0, M2, %f3 ! FGM Group + fmuls %f0, M3, %f4 ! FGM Group + fadds %f1, M12, %f1 ! FGA Group + st %f1, [%g2 + 0x00] ! LSU + fadds %f2, M13, %f2 ! FGA Group + st %f2, [%g2 + 0x04] ! LSU + fadds %f3, M14, %f3 ! FGA Group + st %f3, [%g2 + 0x08] ! LSU + fadds %f4, M15, %f4 ! FGA Group + st %f4, [%g2 + 0x0c] ! LSU + +3: + ba __set_v4f_4 + nop + + .globl _mesa_sparc_transform_points1_identity +_mesa_sparc_transform_points1_identity: + cmp %o0, %o2 + be 4f + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + cmp %g3, 1 + st %g3, [%o0 + V4F_COUNT] + bl 3f + clr %o1 + + be 2f + andn %g3, 1, %o2 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + add %g1, %o5, %g1 ! IEU0 + ld [%g1 + 0x00], %f1 ! LSU Group + add %o1, 2, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + st %f0, [%g2 + 0x00] ! LSU Group + cmp %o1, %o2 ! IEU1 + st %f1, [%g2 + 0x10] ! LSU Group + bne 1b ! CTI + add %g2, 0x20, %g2 ! IEU0 + + cmp %o1, %g3 + be 3f + nop + +2: ld [%g1 + 0x00], %f0 + addx %g0, %g0, %g0 + st %f0, [%g2 + 0x00] + +3: + ba __set_v4f_1 + nop + +4: retl + nop + + .globl _mesa_sparc_transform_points1_2d +_mesa_sparc_transform_points1_2d: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_1_12_13(%o1) + + cmp %g3, 1 + st %g3, [%o0 + V4F_COUNT] + bl 3f + clr %o1 + + be 2f + andn %g3, 1, %o2 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + add %g1, %o5, %g1 ! IEU0 + ld [%g1 + 0x00], %f8 ! LSU Group + add %o1, 2, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f1 ! FGM Group + fmuls %f0, M1, %f2 ! FGM Group + fmuls %f8, M0, %f9 ! FGM Group + fmuls %f8, M1, %f10 ! FGM Group + fadds %f1, M12, %f3 ! FGA Group f1 available + st %f3, [%g2 + 0x00] ! LSU + fadds %f2, M13, %f4 ! FGA Group f2 available + st %f4, [%g2 + 0x04] ! LSU + fadds %f9, M12, %f11 ! FGA Group f9 available + st %f11, [%g2 + 0x10] ! LSU + fadds %f10, M13, %f12 ! FGA Group f10 available + st %f12, [%g2 + 0x14] ! LSU + cmp %o1, %o2 ! IEU1 + bne 1b ! CTI + add %g2, 0x20, %g2 ! IEU0 Group + + cmp %o1, %g3 + be 3f + nop + +2: ld [%g1 + 0x00], %f0 + fmuls %f0, M0, %f1 + fmuls %f0, M1, %f2 + fadds %f1, M12, %f3 + st %f3, [%g2 + 0x00] + fadds %f2, M13, %f4 + st %f4, [%g2 + 0x04] + +3: + ba __set_v4f_2 + nop + + .globl _mesa_sparc_transform_points1_2d_no_rot +_mesa_sparc_transform_points1_2d_no_rot: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_12_13(%o1) + + cmp %g3, 1 + st %g3, [%o0 + V4F_COUNT] + bl 3f + clr %o1 + + be 2f + andn %g3, 1, %o2 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + add %g1, %o5, %g1 ! IEU0 + ld [%g1 + 0x00], %f4 ! LSU Group + add %o1, 2, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f1 ! FGM Group + fmuls %f4, M0, %f5 ! FGM Group + fadds %f1, M12, %f3 ! FGA Group, 2 cycle stall, f1 available + st %f3, [%g2 + 0x00] ! LSU + st M13, [%g2 + 0x04] ! LSU Group, f5 available + fadds %f5, M12, %f6 ! FGA + st %f6, [%g2 + 0x10] ! LSU Group + st M13, [%g2 + 0x14] ! LSU Group + cmp %o1, %o2 ! IEU1 + bne 1b ! CTI + add %g2, 0x20, %g2 ! IEU0 Group + + cmp %o1, %g3 + be 3f + nop + +2: ld [%g1 + 0x00], %f0 + fmuls %f0, M0, %f1 + fadds %f1, M12, %f3 + st %f3, [%g2 + 0x00] + st M13, [%g2 + 0x04] + +3: + ba __set_v4f_2 + nop + + .globl _mesa_sparc_transform_points1_3d +_mesa_sparc_transform_points1_3d: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_1_2_12_13_14(%o1) + + cmp %g3, 1 + st %g3, [%o0 + V4F_COUNT] + bl 3f + clr %o1 + + be 2f + andn %g3, 1, %o2 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + add %g1, %o5, %g1 ! IEU0 + ld [%g1 + 0x00], %f4 ! LSU Group + add %o1, 2, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f1 ! FGM Group + fmuls %f0, M1, %f2 ! FGM Group + fmuls %f0, M2, %f3 ! FGM Group + fmuls %f4, M0, %f5 ! FGM Group + fadds %f1, M12, %f1 ! FGA Group, f1 available + st %f1, [%g2 + 0x00] ! LSU + fmuls %f4, M1, %f6 ! FGM + fadds %f2, M13, %f2 ! FGA Group, f2 available + st %f2, [%g2 + 0x04] ! LSU + fmuls %f4, M2, %f7 ! FGM + fadds %f3, M14, %f3 ! FGA Group, f3 available + st %f3, [%g2 + 0x08] ! LSU + fadds %f5, M12, %f5 ! FGA Group, f5 available + st %f5, [%g2 + 0x10] ! LSU + fadds %f6, M13, %f6 ! FGA Group, f6 available + st %f6, [%g2 + 0x14] ! LSU + fadds %f7, M14, %f7 ! FGA Group, f7 available + st %f7, [%g2 + 0x18] ! LSU + cmp %o1, %o2 ! IEU1 + bne 1b ! CTI + add %g2, 0x20, %g2 ! IEU0 Group + + cmp %o1, %g3 + be 3f + nop + +2: ld [%g1 + 0x00], %f0 + fmuls %f0, M0, %f1 + fmuls %f0, M1, %f2 + fmuls %f0, M2, %f3 + fadds %f1, M12, %f1 + st %f1, [%g2 + 0x00] + fadds %f2, M13, %f2 + st %f2, [%g2 + 0x04] + fadds %f3, M14, %f3 + st %f3, [%g2 + 0x08] + +3: + ba __set_v4f_3 + nop + + .globl _mesa_sparc_transform_points1_3d_no_rot +_mesa_sparc_transform_points1_3d_no_rot: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_12_13_14(%o1) + + cmp %g3, 1 + st %g3, [%o0 + V4F_COUNT] + bl 3f + clr %o1 + + be 2f + andn %g3, 1, %o2 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + add %g1, %o5, %g1 ! IEU0 + ld [%g1 + 0x00], %f2 ! LSU Group + add %o1, 2, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f1 ! FGM Group + fmuls %f2, M0, %f3 ! FGM Group + fadds %f1, M12, %f1 ! FGA Group, 2 cycle stall, f1 available + st %f1, [%g2 + 0x00] ! LSU + fadds %f3, M12, %f3 ! FGA Group, f3 available + st M13, [%g2 + 0x04] ! LSU + st M14, [%g2 + 0x08] ! LSU Group + st %f3, [%g2 + 0x10] ! LSU Group + st M13, [%g2 + 0x14] ! LSU Group + st M14, [%g2 + 0x18] ! LSU Group + cmp %o1, %o2 ! IEU1 + bne 1b ! CTI + add %g2, 0x20, %g2 ! IEU0 Group + + cmp %o1, %g3 + be 3f + nop + +2: ld [%g1 + 0x00], %f0 + fmuls %f0, M0, %f1 + fadds %f1, M12, %f1 + st %f1, [%g2 + 0x00] + st M13, [%g2 + 0x04] + st M14, [%g2 + 0x08] + +3: + ba __set_v4f_3 + nop + + .globl _mesa_sparc_transform_points1_perspective +_mesa_sparc_transform_points1_perspective: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_14(%o1) + + cmp %g3, 1 + st %g3, [%o0 + V4F_COUNT] + bl 3f + clr %o1 + + be 2f + andn %g3, 1, %o2 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + add %g1, %o5, %g1 ! IEU0 + ld [%g1 + 0x00], %f2 ! LSU Group + add %o1, 2, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f1 ! FGM Group + st %f1, [%g2 + 0x00] ! LSU + fmuls %f2, M0, %f3 ! FGM Group + st %g0, [%g2 + 0x04] ! LSU + st M14, [%g2 + 0x08] ! LSU Group + st %g0, [%g2 + 0x0c] ! LSU Group + st %f3, [%g2 + 0x10] ! LSU Group + st %g0, [%g2 + 0x14] ! LSU Group + st M14, [%g2 + 0x18] ! LSU Group + st %g0, [%g2 + 0x1c] ! LSU Group + cmp %o1, %o2 ! IEU1 + bne 1b ! CTI + add %g2, 0x20, %g2 ! IEU0 Group + + cmp %o1, %g3 + be 3f + nop + +2: ld [%g1 + 0x00], %f0 + fmuls %f0, M0, %f1 + st %f1, [%g2 + 0x00] + st %g0, [%g2 + 0x04] + st M14, [%g2 + 0x08] + st %g0, [%g2 + 0x0c] + +3: + ba __set_v4f_4 + nop + + .globl _mesa_sparc_transform_points2_general +_mesa_sparc_transform_points2_general: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_1_2_3_4_5_6_7_12_13_14_15(%o1) + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + add %o1, 1, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f2 ! FGM Group + fmuls %f0, M1, %f3 ! FGM Group + fmuls %f0, M2, %f4 ! FGM Group + fmuls %f0, M3, %f5 ! FGM Group + fadds %f2, M12, %f2 ! FGA Group f2 available + fmuls %f1, M4, %f6 ! FGM + fadds %f3, M13, %f3 ! FGA Group f3 available + fmuls %f1, M5, %f7 ! FGM + fadds %f4, M14, %f4 ! FGA Group f4 available + fmuls %f1, M6, %f8 ! FGM + fadds %f5, M15, %f5 ! FGA Group f5 available + fmuls %f1, M7, %f9 ! FGM + fadds %f2, %f6, %f2 ! FGA Group f6 available + st %f2, [%g2 + 0x00] ! LSU + fadds %f3, %f7, %f3 ! FGA Group f7 available + st %f3, [%g2 + 0x04] ! LSU + fadds %f4, %f8, %f4 ! FGA Group f8 available + st %f4, [%g2 + 0x08] ! LSU + fadds %f5, %f9, %f5 ! FGA Group f9 available + st %f5, [%g2 + 0x0c] ! LSU + cmp %o1, %g3 ! IEU1 + bne 1b ! CTI + add %g2, 0x10, %g2 ! IEU0 Group +2: + ba __set_v4f_4 + nop + + .globl _mesa_sparc_transform_points2_identity +_mesa_sparc_transform_points2_identity: + cmp %o2, %o0 + be 3f + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + add %o1, 1, %o1 ! IEU0 + ld [%g1 + 0x04], %f1 ! LSU Group + add %g1, %o5, %g1 ! IEU0 + cmp %o1, %g3 ! IEU1 + st %f0, [%g2 + 0x00] ! LSU Group + st %f1, [%g2 + 0x04] ! LSU Group + bne 1b ! CTI + add %g2, 0x10, %g2 ! IEU0 +2: + ba __set_v4f_2 + nop + +3: retl + nop + + .globl _mesa_sparc_transform_points2_2d +_mesa_sparc_transform_points2_2d: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_1_4_5_12_13(%o1) + + cmp %g3, 1 + st %g3, [%o0 + V4F_COUNT] + bl 3f + clr %o1 + + be 2f + andn %g3, 1, %o2 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + add %o1, 2, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f2 ! FGM + ld [%g1 + 0x00], %f8 ! LSU Group + fmuls %f0, M1, %f3 ! FGM + ld [%g1 + 0x04], %f9 ! LSU Group + fmuls %f1, M4, %f6 ! FGM + fmuls %f1, M5, %f7 ! FGM Group + add %g1, %o5, %g1 ! IEU0 + fmuls %f8, M0, %f10 ! FGM Group f2 available + fadds %f2, M12, %f2 ! FGA + fmuls %f8, M1, %f11 ! FGM Group f3 available + fadds %f3, M13, %f3 ! FGA + fmuls %f9, M4, %f12 ! FGM Group + fmuls %f9, M5, %f13 ! FGM Group + fadds %f10, M12, %f10 ! FGA Group f2, f10 available + fadds %f2, %f6, %f2 ! FGA Group f3, f11 available + st %f2, [%g2 + 0x00] ! LSU + fadds %f11, M13, %f11 ! FGA Group f12 available + fadds %f3, %f7, %f3 ! FGA Group f13 available + st %f3, [%g2 + 0x04] ! LSU + fadds %f10, %f12, %f10 ! FGA Group f10 available + st %f10, [%g2 + 0x10] ! LSU + fadds %f11, %f13, %f11 ! FGA Group f11 available + st %f11, [%g2 + 0x14] ! LSU + cmp %o1, %o2 ! IEU1 + bne 1b ! CTI + add %g2, 0x20, %g2 ! IEU0 Group + + cmp %o1, %g3 + be 3f + nop + +2: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + fmuls %f0, M0, %f2 ! FGM Group + fmuls %f0, M1, %f3 ! FGM Group + fmuls %f1, M4, %f6 ! FGM Group + fmuls %f1, M5, %f7 ! FGM Group + fadds %f2, M12, %f2 ! FGA Group f2 available + fadds %f3, M13, %f3 ! FGA Group f3 available + fadds %f2, %f6, %f2 ! FGA Group 2 cycle stall, f2 available + st %f2, [%g2 + 0x00] ! LSU + fadds %f3, %f7, %f3 ! FGA Group f3 available + st %f3, [%g2 + 0x04] ! LSU + +3: + ba __set_v4f_2 + nop + + .globl _mesa_sparc_transform_points2_2d_no_rot +_mesa_sparc_transform_points2_2d_no_rot: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_5_12_13(%o1) + + cmp %g3, 1 + st %g3, [%o0 + V4F_COUNT] + bl 3f + clr %o1 + + be 2f + andn %g3, 1, %o2 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + add %o1, 2, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + ld [%g1 + 0x00], %f4 ! LSU Group + fmuls %f0, M0, %f2 ! FGM + ld [%g1 + 0x04], %f5 ! LSU Group + fmuls %f1, M5, %f3 ! FGM + fmuls %f4, M0, %f6 ! FGM Group + add %g1, %o5, %g1 ! IEU0 + fmuls %f5, M5, %f7 ! FGM Group + fadds %f2, M12, %f2 ! FGA Group f2 available + st %f2, [%g2 + 0x00] ! LSU + fadds %f3, M13, %f3 ! FGA Group f3 available + st %f3, [%g2 + 0x04] ! LSU + fadds %f6, M12, %f6 ! FGA Group f6 available + st %f6, [%g2 + 0x10] ! LSU + fadds %f7, M13, %f7 ! FGA Group f7 available + st %f7, [%g2 + 0x14] ! LSU + cmp %o1, %o2 ! IEU1 + bne 1b ! CTI + add %g2, 0x20, %g2 ! IEU0 Group + + cmp %o1, %g3 + be 3f + nop + +2: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + fmuls %f0, M0, %f2 ! FGM Group + fmuls %f1, M5, %f3 ! FGM Group + fadds %f2, M12, %f2 ! FGA Group, 2 cycle stall, f2 available + st %f2, [%g2 + 0x00] ! LSU + fadds %f3, M13, %f3 ! FGA Group f3 available + st %f3, [%g2 + 0x04] ! LSU + +3: + ba __set_v4f_2 + nop + + /* orig: 12 cycles */ + .globl _mesa_sparc_transform_points2_3d +_mesa_sparc_transform_points2_3d: + ld [%o2 + V4F_STRIDE], %o5 + ld [%o2 + V4F_START], %g1 + ld [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_1_2_3_4_5_6_12_13_14(%o1) + + cmp %g3, 1 + st %g3, [%o0 + V4F_COUNT] + bl 3f + clr %o1 + + be 2f + andn %g3, 1, %o2 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + add %o1, 2, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + ld [%g1 + 0x00], %f9 ! LSU Group + fmuls %f0, M0, %f2 ! FGM + ld [%g1 + 0x04], %f10 ! LSU Group + fmuls %f0, M1, %f3 ! FGM + fmuls %f0, M2, %f4 ! FGM Group + add %g1, %o5, %g1 ! IEU0 + fmuls %f1, M4, %f6 ! FGM Group + fmuls %f1, M5, %f7 ! FGM Group f2 available + fadds %f2, M12, %f2 ! FGA + fmuls %f1, M6, %f8 ! FGM Group f3 available + fadds %f3, M13, %f3 ! FGA + fmuls %f9, M0, %f11 ! FGM Group f4 available + fadds %f4, M14, %f4 ! FGA + fmuls %f9, M1, %f12 ! FGM Group f6 available + fmuls %f9, M2, %f13 ! FGM Group f2, f7 available + fadds %f2, %f6, %f2 ! FGA + st %f2, [%g2 + 0x00] ! LSU + fmuls %f10, M4, %f14 ! FGM Group f3, f8 available + fadds %f3, %f7, %f3 ! FGA + st %f3, [%g2 + 0x04] ! LSU + fmuls %f10, M5, %f15 ! FGM Group f4, f11 available + fadds %f11, M12, %f11 ! FGA + fmuls %f10, M6, %f0 ! FGM Group f12 available + fadds %f12, M13, %f12 ! FGA + fadds %f13, M14, %f13 ! FGA Group f13 available + fadds %f4, %f8, %f4 ! FGA Group f14 available + st %f4, [%g2 + 0x08] ! LSU + fadds %f11, %f14, %f11 ! FGA Group f15, f11 available + st %f11, [%g2 + 0x10] ! LSU + fadds %f12, %f15, %f12 ! FGA Group f0, f12 available + st %f12, [%g2 + 0x14] ! LSU + fadds %f13, %f0, %f13 ! FGA Group f13 available + st %f13, [%g2 + 0x18] ! LSU + + cmp %o1, %o2 ! IEU1 + bne 1b ! CTI + add %g2, 0x20, %g2 ! IEU0 Group + + cmp %o1, %g3 + be 3f + nop + +2: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + fmuls %f0, M0, %f2 ! FGM Group + fmuls %f0, M1, %f3 ! FGM Group + fmuls %f0, M2, %f4 ! FGM Group + fmuls %f1, M4, %f6 ! FGM Group + fmuls %f1, M5, %f7 ! FGM Group f2 available + fadds %f2, M12, %f2 ! FGA + fmuls %f1, M6, %f8 ! FGM Group f3 available + fadds %f3, M13, %f3 ! FGA + fadds %f4, M14, %f4 ! FGA Group f4 available + fadds %f2, %f6, %f2 ! FGA Group stall, f2, f6, f7 available + st %f2, [%g2 + 0x00] ! LSU + fadds %f3, %f7, %f3 ! FGA Group f3, f8 available + st %f3, [%g2 + 0x04] ! LSU + fadds %f4, %f8, %f4 ! FGA Group f4 available + st %f4, [%g2 + 0x08] ! LSU + +3: + ba __set_v4f_3 + nop + + .globl _mesa_sparc_transform_points2_3d_no_rot +_mesa_sparc_transform_points2_3d_no_rot: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_5_12_13_14(%o1) + + cmp %g3, 1 + st %g3, [%o0 + V4F_COUNT] + bl 3f + clr %o3 + + be 2f + andn %g3, 1, %o2 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + add %o3, 2, %o3 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + ld [%g1 + 0x00], %f4 ! LSU Group + fmuls %f0, M0, %f2 ! FGM + ld [%g1 + 0x04], %f5 ! LSU Group + fmuls %f1, M5, %f3 ! FGM + fmuls %f4, M0, %f6 ! FGM Group + add %g1, %o5, %g1 ! IEU0 + fmuls %f5, M5, %f7 ! FGM Group + fadds %f2, M12, %f2 ! FGA Group f2 available + st %f2, [%g2 + 0x00] ! LSU + fadds %f3, M13, %f3 ! FGA Group f3 available + st %f3, [%g2 + 0x04] ! LSU + fadds %f6, M12, %f6 ! FGA Group f6 available + st M14, [%g2 + 0x08] ! LSU + fadds %f7, M13, %f7 ! FGA Group f7 available + st %f6, [%g2 + 0x10] ! LSU + st %f7, [%g2 + 0x14] ! LSU Group + st M14, [%g2 + 0x18] ! LSU Group + cmp %o3, %o2 ! IEU1 + bne 1b ! CTI + add %g2, 0x20, %g2 ! IEU0 Group + + cmp %o3, %g3 + be 3f + nop + +2: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + fmuls %f0, M0, %f2 ! FGM Group + fmuls %f1, M5, %f3 ! FGM Group + fadds %f2, M12, %f2 ! FGA Group, 2 cycle stall, f2 available + st %f2, [%g2 + 0x00] ! LSU + fadds %f3, M13, %f3 ! FGA Group f3 available + st %f3, [%g2 + 0x04] ! LSU + st M14, [%g2 + 0x08] ! LSU Group + +3: ld [%o1 + (14 * 0x4)], %g3 + cmp %g3, 0 + bne __set_v4f_3 + nop + ba __set_v4f_2 + nop + + .globl _mesa_sparc_transform_points2_perspective +_mesa_sparc_transform_points2_perspective: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_5_14(%o1) + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 + ld [%g1 + 0x04], %f1 + add %o1, 1, %o1 + add %g1, %o5, %g1 + fmuls %f0, M0, %f2 + st %f2, [%g2 + 0x00] + fmuls %f1, M5, %f3 + st %f3, [%g2 + 0x04] + st M14, [%g2 + 0x08] + st %g0, [%g2 + 0x0c] + cmp %o1, %g3 + bne 1b + add %g2, 0x10, %g2 +2: + ba __set_v4f_4 + nop + + .globl _mesa_sparc_transform_points3_general +_mesa_sparc_transform_points3_general: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15(%o1) + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + ld [%g1 + 0x08], %f2 ! LSU Group + add %o1, 1, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f3 ! FGM + fmuls %f1, M4, %f7 ! FGM Group + fmuls %f0, M1, %f4 ! FGM Group + fmuls %f1, M5, %f8 ! FGM Group + fmuls %f0, M2, %f5 ! FGM Group f3 available + fmuls %f1, M6, %f9 ! FGM Group f7 available + fadds %f3, %f7, %f3 ! FGA + fmuls %f0, M3, %f6 ! FGM Group f4 available + fmuls %f1, M7, %f10 ! FGM Group f8 available + fadds %f4, %f8, %f4 ! FGA + fmuls %f2, M8, %f7 ! FGM Group f5 available + fmuls %f2, M9, %f8 ! FGM Group f9,f3 available + fadds %f5, %f9, %f5 ! FGA + fmuls %f2, M10, %f9 ! FGM Group f6 available + fadds %f6, %f10, %f6 ! FGA Group f10,f4 available + fmuls %f2, M11, %f10 ! FGM + fadds %f3, M12, %f3 ! FGA Group f7 available + fadds %f4, M13, %f4 ! FGA Group f8,f5 available + fadds %f5, M14, %f5 ! FGA Group f9 available + fadds %f6, M15, %f6 ! FGA Group f10,f6 available + fadds %f3, %f7, %f3 ! FGA Group f3 available + st %f3, [%g2 + 0x00] ! LSU + fadds %f4, %f8, %f4 ! FGA Group f4 available + st %f4, [%g2 + 0x04] ! LSU + fadds %f5, %f9, %f5 ! FGA Group f5 available + st %f5, [%g2 + 0x08] ! LSU + fadds %f6, %f10, %f6 ! FGA Group f6 available + st %f6, [%g2 + 0x0c] ! LSU + cmp %o1, %g3 ! IEU1 + bne 1b ! CTI + add %g2, 0x10, %g2 ! IEU0 Group +2: + ba __set_v4f_4 + nop + + .globl _mesa_sparc_transform_points3_identity +_mesa_sparc_transform_points3_identity: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 + ld [%g1 + 0x04], %f1 + ld [%g1 + 0x08], %f2 + add %o1, 1, %o1 + add %g1, %o5, %g1 + cmp %o1, %g3 + st %f0, [%g2 + 0x00] + st %f1, [%g2 + 0x04] + st %f2, [%g2 + 0x08] + bne 1b + add %g2, 0x10, %g2 +2: + ba __set_v4f_3 + nop + + .globl _mesa_sparc_transform_points3_2d +_mesa_sparc_transform_points3_2d: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_1_4_5_12_13(%o1) + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + ld [%g1 + 0x08], %f2 ! LSU Group + add %o1, 1, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f3 ! FGM + fmuls %f0, M1, %f4 ! FGM Group + fmuls %f1, M4, %f6 ! FGM Group + fmuls %f1, M5, %f7 ! FGM Group + fadds %f3, M12, %f3 ! FGA Group f3 available + fadds %f4, M13, %f4 ! FGA Group f4 available + fadds %f3, %f6, %f3 ! FGA Group f6 available + st %f3, [%g2 + 0x00] ! LSU + fadds %f4, %f7, %f4 ! FGA Group f7 available + st %f4, [%g2 + 0x04] ! LSU + st %f2, [%g2 + 0x08] ! LSU Group + cmp %o1, %g3 ! IEU1 + bne 1b ! CTI + add %g2, 0x10, %g2 ! IEU0 Group +2: + ba __set_v4f_3 + nop + + .globl _mesa_sparc_transform_points3_2d_no_rot +_mesa_sparc_transform_points3_2d_no_rot: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_5_12_13(%o1) + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + ld [%g1 + 0x08], %f2 ! LSU Group + add %o1, 1, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f3 ! FGM + fmuls %f1, M5, %f4 ! FGM Group + st %f2, [%g2 + 0x08] ! LSU + fadds %f3, M12, %f3 ! FGA Group + st %f3, [%g2 + 0x00] ! LSU + fadds %f4, M13, %f4 ! FGA Group + st %f4, [%g2 + 0x04] ! LSU + cmp %o1, %g3 ! IEU1 + bne 1b ! CTI + add %g2, 0x10, %g2 ! IEU0 Group +2: + ba __set_v4f_3 + nop + + .globl _mesa_sparc_transform_points3_3d +_mesa_sparc_transform_points3_3d: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_1_2_4_5_6_8_9_10_12_13_14(%o1) + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + ld [%g1 + 0x08], %f2 ! LSU Group + add %o1, 1, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f3 ! FGM + fmuls %f1, M4, %f6 ! FGM Group + fmuls %f0, M1, %f4 ! FGM Group + fmuls %f1, M5, %f7 ! FGM Group + fmuls %f0, M2, %f5 ! FGM Group f3 available + fmuls %f1, M6, %f8 ! FGM Group f6 available + fadds %f3, %f6, %f3 ! FGA + fmuls %f2, M8, %f9 ! FGM Group f4 available + fmuls %f2, M9, %f10 ! FGM Group f7 available + fadds %f4, %f7, %f4 ! FGA + fmuls %f2, M10, %f11 ! FGM Group f5 available + fadds %f5, %f8, %f5 ! FGA Group f8, f3 available + fadds %f3, %f9, %f3 ! FGA Group f9 available + fadds %f4, %f10, %f4 ! FGA Group f10, f4 available + fadds %f5, %f11, %f5 ! FGA Group stall, f11, f5 available + fadds %f3, M12, %f3 ! FGA Group f3 available + st %f3, [%g2 + 0x00] ! LSU + fadds %f4, M13, %f4 ! FGA Group f4 available + st %f4, [%g2 + 0x04] ! LSU + fadds %f5, M14, %f5 ! FGA Group f5 available + st %f5, [%g2 + 0x08] ! LSU + cmp %o1, %g3 ! IEU1 + bne 1b ! CTI + add %g2, 0x10, %g2 ! IEU0 Group +2: + ba __set_v4f_3 + nop + + .globl _mesa_sparc_transform_points3_3d_no_rot +_mesa_sparc_transform_points3_3d_no_rot: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_5_10_12_13_14(%o1) + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + ld [%g1 + 0x08], %f2 ! LSU Group + add %o1, 1, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + cmp %o1, %g3 ! IEU1 Group + fmuls %f0, M0, %f3 ! FGM + fmuls %f1, M5, %f4 ! FGM Group + fmuls %f2, M10, %f5 ! FGM Group + fadds %f3, M12, %f3 ! FGA Group, stall, f3 available + st %f3, [%g2 + 0x00] ! LSU + fadds %f4, M13, %f4 ! FGA Group, f4 available + st %f4, [%g2 + 0x04] ! LSU + fadds %f5, M14, %f5 ! FGA Group, f5 available + st %f5, [%g2 + 0x08] ! LEU + bne 1b ! CTI + add %g2, 0x10, %g2 ! IEU0 Group +2: + ba __set_v4f_3 + nop + + .globl _mesa_sparc_transform_points3_perspective +_mesa_sparc_transform_points3_perspective: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_5_8_9_10_14(%o1) + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + ld [%g1 + 0x08], %f2 ! LSU Group + add %o1, 1, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f3 ! FGM + fmuls %f2, M8, %f6 ! FGM Group + fmuls %f1, M5, %f4 ! FGM Group + fmuls %f2, M9, %f7 ! FGM Group + fmuls %f2, M10, %f5 ! FGM Group f3 available + fadds %f3, %f6, %f3 ! FGA Group f6 available + st %f3, [%g2 + 0x00] ! LSU + fadds %f4, %f7, %f4 ! FGA Group stall, f4, f7 available + st %f4, [%g2 + 0x04] ! LSU + fadds %f5, M14, %f5 ! FGA Group + st %f5, [%g2 + 0x08] ! LSU + fnegs %f2, %f6 ! FGA Group + st %f6, [%g2 + 0x0c] ! LSU + cmp %o1, %g3 ! IEU1 + bne 1b ! CTI + add %g2, 0x10, %g2 ! IEU0 Group +2: + ba __set_v4f_4 + nop + + .globl _mesa_sparc_transform_points4_general +_mesa_sparc_transform_points4_general: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15(%o1) + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + ld [%g1 + 0x08], %f2 ! LSU Group + ld [%g1 + 0x0c], %f3 ! LSU Group + add %o1, 1, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f4 ! FGM Group + fmuls %f1, M4, %f8 ! FGM Group + fmuls %f0, M1, %f5 ! FGM Group + fmuls %f1, M5, %f9 ! FGM Group + fmuls %f0, M2, %f6 ! FGM Group f4 available + fmuls %f1, M6, %f10 ! FGM Group f8 available + fadds %f4, %f8, %f4 ! FGA + fmuls %f0, M3, %f7 ! FGM Group f5 available + fmuls %f1, M7, %f11 ! FGM Group f9 available + fadds %f5, %f9, %f5 ! FGA + fmuls %f2, M8, %f12 ! FGM Group f6 available + fmuls %f2, M9, %f13 ! FGM Group f10, f4 available + fadds %f6, %f10, %f6 ! FGA + fmuls %f2, M10, %f14 ! FGM Group f7 available + fmuls %f2, M11, %f15 ! FGM Group f11, f5 available + fadds %f7, %f11, %f7 ! FGA + fmuls %f3, M12, %f8 ! FGM Group f12 available + fadds %f4, %f12, %f4 ! FGA + fmuls %f3, M13, %f9 ! FGM Group f13, f6 available + fadds %f5, %f13, %f5 ! FGA + fmuls %f3, M14, %f10 ! FGM Group f14 available + fadds %f6, %f14, %f6 ! FGA + fmuls %f3, M15, %f11 ! FGM Group f15, f7 available + fadds %f7, %f15, %f7 ! FGA + fadds %f4, %f8, %f4 ! FGA Group f8, f4 available + st %f4, [%g2 + 0x00] ! LSU + fadds %f5, %f9, %f5 ! FGA Group f9, f5 available + st %f5, [%g2 + 0x04] ! LSU + fadds %f6, %f10, %f6 ! FGA Group f10, f6 available + st %f6, [%g2 + 0x08] ! LSU + fadds %f7, %f11, %f7 ! FGA Group f11, f7 available + st %f7, [%g2 + 0x0c] ! LSU + cmp %o1, %g3 ! IEU1 + bne 1b ! CTI + add %g2, 0x10, %g2 ! IEU0 Group +2: + ba __set_v4f_4 + nop + + .globl _mesa_sparc_transform_points4_identity +_mesa_sparc_transform_points4_identity: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 + ld [%g1 + 0x04], %f1 + ld [%g1 + 0x08], %f2 + add %o1, 1, %o1 + ld [%g1 + 0x0c], %f3 + add %g1, %o5, %g1 + st %f0, [%g2 + 0x00] + st %f1, [%g2 + 0x04] + st %f2, [%g2 + 0x08] + cmp %o1, %g3 + st %f3, [%g2 + 0x0c] + bne 1b + add %g2, 0x10, %g2 +2: + ba __set_v4f_4 + nop + + .globl _mesa_sparc_transform_points4_2d +_mesa_sparc_transform_points4_2d: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_1_4_5_12_13(%o1) + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + ld [%g1 + 0x08], %f2 ! LSU Group + ld [%g1 + 0x0c], %f3 ! LSU Group + add %o1, 1, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f4 ! FGM + fmuls %f1, M4, %f8 ! FGM Group + fmuls %f0, M1, %f5 ! FGM Group + fmuls %f1, M5, %f9 ! FGM Group f4 available + fmuls %f3, M12, %f12 ! FGM Group + fmuls %f3, M13, %f13 ! FGM Group f8 available + fadds %f4, %f8, %f4 ! FGA + fadds %f5, %f9, %f5 ! FGA Group stall, f5, f9 available + fadds %f4, %f12, %f4 ! FGA Group 2 cycle stall, f4, f12, f13 avail + st %f4, [%g2 + 0x00] ! LSU + fadds %f5, %f13, %f5 ! FGA Group f5 available + st %f5, [%g2 + 0x04] ! LSU + st %f2, [%g2 + 0x08] ! LSU Group + st %f3, [%g2 + 0x0c] ! LSU Group + cmp %o1, %g3 ! IEU1 + bne 1b ! CTI + add %g2, 0x10, %g2 ! IEU0 Group +2: + ba __set_v4f_4 + nop + + .globl _mesa_sparc_transform_points4_2d_no_rot +_mesa_sparc_transform_points4_2d_no_rot: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_1_4_5_12_13(%o1) + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 + ld [%g1 + 0x04], %f1 + ld [%g1 + 0x08], %f2 + ld [%g1 + 0x0c], %f3 + add %o1, 1, %o1 + add %g1, %o5, %g1 + fmuls %f0, M0, %f4 + fmuls %f3, M12, %f8 + fmuls %f1, M5, %f5 + fmuls %f3, M13, %f9 + fadds %f4, %f8, %f4 + st %f4, [%g2 + 0x00] + fadds %f5, %f9, %f5 + st %f5, [%g2 + 0x04] + st %f2, [%g2 + 0x08] + st %f3, [%g2 + 0x0c] + cmp %o1, %g3 + bne 1b + add %g2, 0x10, %g2 +2: + ba __set_v4f_4 + nop + + .globl _mesa_sparc_transform_points4_3d +_mesa_sparc_transform_points4_3d: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_1_2_4_5_6_8_9_10_12_13_14(%o1) + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + ld [%g1 + 0x08], %f2 ! LSU Group + ld [%g1 + 0x0c], %f3 ! LSU Group + add %o1, 1, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f4 ! FGM + fmuls %f1, M4, %f7 ! FGM Group + fmuls %f0, M1, %f5 ! FGM Group + fmuls %f1, M5, %f8 ! FGM Group + fmuls %f0, M2, %f6 ! FGM Group f4 available + fmuls %f1, M6, %f9 ! FGM Group f7 available + fadds %f4, %f7, %f4 ! FGA + fmuls %f2, M8, %f10 ! FGM Group f5 available + fmuls %f2, M9, %f11 ! FGM Group f8 available + fadds %f5, %f8, %f5 ! FGA + fmuls %f2, M10, %f12 ! FGM Group f6 available + fmuls %f3, M12, %f13 ! FGM Group f9, f4 available + fadds %f6, %f9, %f6 ! FGA + fmuls %f3, M13, %f14 ! FGM Group f10 available + fadds %f4, %f10, %f4 ! FGA + fmuls %f3, M14, %f15 ! FGM Group f11, f5 available + fadds %f5, %f11, %f5 ! FGA + fadds %f6, %f12, %f6 ! FGA Group stall, f12, f13, f6 available + fadds %f4, %f13, %f4 ! FGA Group f14, f4 available + st %f4, [%g2 + 0x00] ! LSU + fadds %f5, %f14, %f5 ! FGA Group f15, f5 available + st %f5, [%g2 + 0x04] ! LSU + fadds %f6, %f15, %f6 ! FGA Group f6 available + st %f6, [%g2 + 0x08] ! LSU + st %f3, [%g2 + 0x0c] ! LSU Group + cmp %o1, %g3 ! IEU1 + bne 1b ! CTI + add %g2, 0x10, %g2 ! IEU0 Group +2: + ba __set_v4f_4 + nop + + .globl _mesa_sparc_transform_points4_3d_no_rot +_mesa_sparc_transform_points4_3d_no_rot: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_5_10_12_13_14(%o1) + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + ld [%g1 + 0x08], %f2 ! LSU Group + ld [%g1 + 0x0c], %f3 ! LSU Group + add %o1, 1, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f4 ! FGM + fmuls %f3, M12, %f7 ! FGM Group + fmuls %f1, M5, %f5 ! FGM Group + fmuls %f3, M13, %f8 ! FGM Group + fmuls %f2, M10, %f6 ! FGM Group f4 available + fmuls %f3, M14, %f9 ! FGM Group f7 available + fadds %f4, %f7, %f4 ! FGA + st %f4, [%g2 + 0x00] ! LSU + fadds %f5, %f8, %f5 ! FGA Group stall, f5, f8 available + st %f5, [%g2 + 0x04] ! LSU + fadds %f6, %f9, %f6 ! FGA Group stall, f6, f9 available + st %f6, [%g2 + 0x08] ! LSU + st %f3, [%g2 + 0x0c] ! LSU Group + cmp %o1, %g3 ! IEU1 + bne 1b ! CTI + add %g2, 0x10, %g2 ! IEU0 Group +2: + ba __set_v4f_4 + nop + + .globl _mesa_sparc_transform_points4_perspective +_mesa_sparc_transform_points4_perspective: + ld [%o2 + V4F_STRIDE], %o5 + LDPTR [%o2 + V4F_START], %g1 + LDPTR [%o0 + V4F_START], %g2 + ld [%o2 + V4F_COUNT], %g3 + + LDMATRIX_0_5_8_9_10_14(%o1) + + cmp %g3, 0 + st %g3, [%o0 + V4F_COUNT] + be 2f + clr %o1 + +1: ld [%g1 + 0x00], %f0 ! LSU Group + ld [%g1 + 0x04], %f1 ! LSU Group + ld [%g1 + 0x08], %f2 ! LSU Group + ld [%g1 + 0x0c], %f3 ! LSU Group + add %o1, 1, %o1 ! IEU0 + add %g1, %o5, %g1 ! IEU1 + fmuls %f0, M0, %f4 ! FGM + fmuls %f2, M8, %f7 ! FGM Group + fmuls %f1, M5, %f5 ! FGM Group + fmuls %f2, M9, %f8 ! FGM Group + fmuls %f2, M10, %f6 ! FGM Group f4 available + fmuls %f3, M14, %f9 ! FGM Group f7 available + fadds %f4, %f7, %f4 ! FGA + st %f4, [%g2 + 0x00] ! LSU + fadds %f5, %f8, %f5 ! FGA Group stall, f5, f8 available + st %f5, [%g2 + 0x04] ! LSU + fadds %f6, %f9, %f6 ! FGA Group stall, f6, f9 available + st %f6, [%g2 + 0x08] ! LSU + fnegs %f2, %f7 ! FGA Group + st %f7, [%g2 + 0x0c] ! LSU + cmp %o1, %g3 ! IEU1 + bne 1b ! CTI + add %g2, 0x10, %g2 ! IEU0 Group +2: + ba __set_v4f_4 + nop diff --git a/reactos/dll/mesa32/src/swrast/descrip.mms b/reactos/dll/mesa32/src/swrast/descrip.mms new file mode 100644 index 00000000000..7b356277099 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/descrip.mms @@ -0,0 +1,76 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl +# Last revision : 23 March 2004 + +.first + define gl [---.include.gl] + define math [-.math] + define swrast [-.swrast] + define array_cache [-.array_cache] + +.include [---]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [---.include],[-.main],[-.glapi],[-.shader] +LIBDIR = [---.lib] +CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short) + +SOURCES = s_aaline.c s_aatriangle.c s_accum.c s_alpha.c \ + s_bitmap.c s_blend.c s_buffers.c s_context.c s_copypix.c s_depth.c \ + s_drawpix.c s_feedback.c s_fog.c s_imaging.c s_lines.c s_logic.c \ + s_masking.c s_nvfragprog.c s_pixeltex.c s_points.c s_readpix.c \ + s_span.c s_stencil.c s_texstore.c s_texture.c s_triangle.c s_zoom.c \ + s_atifragshader.c + +OBJECTS = s_aaline.obj,s_aatriangle.obj,s_accum.obj,s_alpha.obj,\ + s_bitmap.obj,s_blend.obj,\ + s_buffers.obj,s_context.obj,s_atifragshader.obj,\ + s_copypix.obj,s_depth.obj,s_drawpix.obj,s_feedback.obj,s_fog.obj,\ + s_imaging.obj,s_lines.obj,s_logic.obj,s_masking.obj,s_nvfragprog.obj,\ + s_pixeltex.obj,s_points.obj,s_readpix.obj,s_span.obj,s_stencil.obj,\ + s_texstore.obj,s_texture.obj,s_triangle.obj,s_zoom.obj + +##### RULES ##### + +VERSION=Mesa V3.4 + +##### TARGETS ##### +# Make the library +$(LIBDIR)$(GL_LIB) : $(OBJECTS) + @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) + +clean : + purge + delete *.obj;* + +s_atifragshader.obj : s_atifragshader.c +s_aaline.obj : s_aaline.c +s_aatriangle.obj : s_aatriangle.c +s_accum.obj : s_accum.c +s_alpha.obj : s_alpha.c +s_bitmap.obj : s_bitmap.c +s_blend.obj : s_blend.c +s_buffers.obj : s_buffers.c +s_context.obj : s_context.c +s_copypix.obj : s_copypix.c +s_depth.obj : s_depth.c +s_drawpix.obj : s_drawpix.c +s_feedback.obj : s_feedback.c +s_fog.obj : s_fog.c +s_imaging.obj : s_imaging.c +s_lines.obj : s_lines.c +s_logic.obj : s_logic.c +s_masking.obj : s_masking.c +s_nvfragprog.obj : s_nvfragprog.c +s_pixeltex.obj : s_pixeltex.c +s_points.obj : s_points.c +s_readpix.obj : s_readpix.c +s_span.obj : s_span.c +s_stencil.obj : s_stencil.c +s_texstore.obj : s_texstore.c +s_texture.obj : s_texture.c +s_triangle.obj : s_triangle.c +s_zoom.obj : s_zoom.c diff --git a/reactos/dll/mesa32/src/swrast/s_aaline.c b/reactos/dll/mesa32/src/swrast/s_aaline.c new file mode 100644 index 00000000000..39c51a50f71 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_aaline.c @@ -0,0 +1,554 @@ +/* + * 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. + */ + + +#include "glheader.h" +#include "imports.h" +#include "macros.h" +#include "swrast/s_aaline.h" +#include "swrast/s_context.h" +#include "swrast/s_span.h" +#include "swrast/swrast.h" +#include "mtypes.h" + + +#define SUB_PIXEL 4 + + +/* + * Info about the AA line we're rendering + */ +struct LineInfo +{ + GLfloat x0, y0; /* start */ + GLfloat x1, y1; /* end */ + GLfloat dx, dy; /* direction vector */ + GLfloat len; /* length */ + GLfloat halfWidth; /* half of line width */ + GLfloat xAdj, yAdj; /* X and Y adjustment for quad corners around line */ + /* for coverage computation */ + GLfloat qx0, qy0; /* quad vertices */ + GLfloat qx1, qy1; + GLfloat qx2, qy2; + GLfloat qx3, qy3; + GLfloat ex0, ey0; /* quad edge vectors */ + GLfloat ex1, ey1; + GLfloat ex2, ey2; + GLfloat ex3, ey3; + + /* DO_Z */ + GLfloat zPlane[4]; + /* DO_FOG */ + GLfloat fPlane[4]; + /* DO_RGBA */ + GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; + /* DO_INDEX */ + GLfloat iPlane[4]; + /* DO_SPEC */ + GLfloat srPlane[4], sgPlane[4], sbPlane[4]; + /* DO_TEX or DO_MULTITEX */ + GLfloat sPlane[MAX_TEXTURE_COORD_UNITS][4]; + GLfloat tPlane[MAX_TEXTURE_COORD_UNITS][4]; + GLfloat uPlane[MAX_TEXTURE_COORD_UNITS][4]; + GLfloat vPlane[MAX_TEXTURE_COORD_UNITS][4]; + GLfloat lambda[MAX_TEXTURE_COORD_UNITS]; + GLfloat texWidth[MAX_TEXTURE_COORD_UNITS]; + GLfloat texHeight[MAX_TEXTURE_COORD_UNITS]; + + struct sw_span span; +}; + + + +/* + * Compute the equation of a plane used to interpolate line fragment data + * such as color, Z, texture coords, etc. + * Input: (x0, y0) and (x1,y1) are the endpoints of the line. + * z0, and z1 are the end point values to interpolate. + * Output: plane - the plane equation. + * + * Note: we don't really have enough parameters to specify a plane. + * We take the endpoints of the line and compute a plane such that + * the cross product of the line vector and the plane normal is + * parallel to the projection plane. + */ +static void +compute_plane(GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, + GLfloat z0, GLfloat z1, GLfloat plane[4]) +{ +#if 0 + /* original */ + const GLfloat px = x1 - x0; + const GLfloat py = y1 - y0; + const GLfloat pz = z1 - z0; + const GLfloat qx = -py; + const GLfloat qy = px; + const GLfloat qz = 0; + const GLfloat a = py * qz - pz * qy; + const GLfloat b = pz * qx - px * qz; + const GLfloat c = px * qy - py * qx; + const GLfloat d = -(a * x0 + b * y0 + c * z0); + plane[0] = a; + plane[1] = b; + plane[2] = c; + plane[3] = d; +#else + /* simplified */ + const GLfloat px = x1 - x0; + const GLfloat py = y1 - y0; + const GLfloat pz = z0 - z1; + const GLfloat a = pz * px; + const GLfloat b = pz * py; + const GLfloat c = px * px + py * py; + const GLfloat d = -(a * x0 + b * y0 + c * z0); + if (a == 0.0 && b == 0.0 && c == 0.0 && d == 0.0) { + plane[0] = 0.0; + plane[1] = 0.0; + plane[2] = 1.0; + plane[3] = 0.0; + } + else { + plane[0] = a; + plane[1] = b; + plane[2] = c; + plane[3] = d; + } +#endif +} + + +static INLINE void +constant_plane(GLfloat value, GLfloat plane[4]) +{ + plane[0] = 0.0; + plane[1] = 0.0; + plane[2] = -1.0; + plane[3] = value; +} + + +static INLINE GLfloat +solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4]) +{ + const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; + return z; +} + +#define SOLVE_PLANE(X, Y, PLANE) \ + ((PLANE[3] + PLANE[0] * (X) + PLANE[1] * (Y)) / -PLANE[2]) + + +/* + * Return 1 / solve_plane(). + */ +static INLINE GLfloat +solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4]) +{ + const GLfloat denom = plane[3] + plane[0] * x + plane[1] * y; + if (denom == 0.0) + return 0.0; + else + return -plane[2] / denom; +} + + +/* + * Solve plane and return clamped GLchan value. + */ +static INLINE GLchan +solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4]) +{ + const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; +#if CHAN_TYPE == GL_FLOAT + return CLAMP(z, 0.0F, CHAN_MAXF); +#else + if (z < 0) + return 0; + else if (z > CHAN_MAX) + return CHAN_MAX; + return (GLchan) IROUND_POS(z); +#endif +} + + +/* + * Compute mipmap level of detail. + */ +static INLINE GLfloat +compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4], + GLfloat invQ, GLfloat width, GLfloat height) +{ + GLfloat dudx = sPlane[0] / sPlane[2] * invQ * width; + GLfloat dudy = sPlane[1] / sPlane[2] * invQ * width; + GLfloat dvdx = tPlane[0] / tPlane[2] * invQ * height; + GLfloat dvdy = tPlane[1] / tPlane[2] * invQ * height; + GLfloat r1 = dudx * dudx + dudy * dudy; + GLfloat r2 = dvdx * dvdx + dvdy * dvdy; + GLfloat rho2 = r1 + r2; + /* return log base 2 of rho */ + if (rho2 == 0.0F) + return 0.0; + else + return (GLfloat) (log(rho2) * 1.442695 * 0.5);/* 1.442695 = 1/log(2) */ +} + + + + +/* + * Fill in the samples[] array with the (x,y) subpixel positions of + * xSamples * ySamples sample positions. + * Note that the four corner samples are put into the first four + * positions of the array. This allows us to optimize for the common + * case of all samples being inside the polygon. + */ +static void +make_sample_table(GLint xSamples, GLint ySamples, GLfloat samples[][2]) +{ + const GLfloat dx = 1.0F / (GLfloat) xSamples; + const GLfloat dy = 1.0F / (GLfloat) ySamples; + GLint x, y; + GLint i; + + i = 4; + for (x = 0; x < xSamples; x++) { + for (y = 0; y < ySamples; y++) { + GLint j; + if (x == 0 && y == 0) { + /* lower left */ + j = 0; + } + else if (x == xSamples - 1 && y == 0) { + /* lower right */ + j = 1; + } + else if (x == 0 && y == ySamples - 1) { + /* upper left */ + j = 2; + } + else if (x == xSamples - 1 && y == ySamples - 1) { + /* upper right */ + j = 3; + } + else { + j = i++; + } + samples[j][0] = x * dx + 0.5F * dx; + samples[j][1] = y * dy + 0.5F * dy; + } + } +} + + + +/* + * Compute how much of the given pixel's area is inside the rectangle + * defined by vertices v0, v1, v2, v3. + * Vertices MUST be specified in counter-clockwise order. + * Return: coverage in [0, 1]. + */ +static GLfloat +compute_coveragef(const struct LineInfo *info, + GLint winx, GLint winy) +{ + static GLfloat samples[SUB_PIXEL * SUB_PIXEL][2]; + static GLboolean haveSamples = GL_FALSE; + const GLfloat x = (GLfloat) winx; + const GLfloat y = (GLfloat) winy; + GLint stop = 4, i; + GLfloat insideCount = SUB_PIXEL * SUB_PIXEL; + + if (!haveSamples) { + make_sample_table(SUB_PIXEL, SUB_PIXEL, samples); + haveSamples = GL_TRUE; + } + +#if 0 /*DEBUG*/ + { + const GLfloat area = dx0 * dy1 - dx1 * dy0; + assert(area >= 0.0); + } +#endif + + for (i = 0; i < stop; i++) { + const GLfloat sx = x + samples[i][0]; + const GLfloat sy = y + samples[i][1]; + const GLfloat fx0 = sx - info->qx0; + const GLfloat fy0 = sy - info->qy0; + const GLfloat fx1 = sx - info->qx1; + const GLfloat fy1 = sy - info->qy1; + const GLfloat fx2 = sx - info->qx2; + const GLfloat fy2 = sy - info->qy2; + const GLfloat fx3 = sx - info->qx3; + const GLfloat fy3 = sy - info->qy3; + /* cross product determines if sample is inside or outside each edge */ + GLfloat cross0 = (info->ex0 * fy0 - info->ey0 * fx0); + GLfloat cross1 = (info->ex1 * fy1 - info->ey1 * fx1); + GLfloat cross2 = (info->ex2 * fy2 - info->ey2 * fx2); + GLfloat cross3 = (info->ex3 * fy3 - info->ey3 * fx3); + /* Check if the sample is exactly on an edge. If so, let cross be a + * positive or negative value depending on the direction of the edge. + */ + if (cross0 == 0.0F) + cross0 = info->ex0 + info->ey0; + if (cross1 == 0.0F) + cross1 = info->ex1 + info->ey1; + if (cross2 == 0.0F) + cross2 = info->ex2 + info->ey2; + if (cross3 == 0.0F) + cross3 = info->ex3 + info->ey3; + if (cross0 < 0.0F || cross1 < 0.0F || cross2 < 0.0F || cross3 < 0.0F) { + /* point is outside quadrilateral */ + insideCount -= 1.0F; + stop = SUB_PIXEL * SUB_PIXEL; + } + } + if (stop == 4) + return 1.0F; + else + return insideCount * (1.0F / (SUB_PIXEL * SUB_PIXEL)); +} + + +/** + * Compute coverage value for color index mode. + * XXX this may not be quite correct. + * \return coverage in [0,15]. + */ +static GLfloat +compute_coveragei(const struct LineInfo *info, + GLint winx, GLint winy) +{ + return compute_coveragef(info, winx, winy) * 15.0F; +} + + + +typedef void (*plot_func)(GLcontext *ctx, struct LineInfo *line, + int ix, int iy); + + + +/* + * Draw an AA line segment (called many times per line when stippling) + */ +static void +segment(GLcontext *ctx, + struct LineInfo *line, + plot_func plot, + GLfloat t0, GLfloat t1) +{ + const GLfloat absDx = (line->dx < 0.0F) ? -line->dx : line->dx; + const GLfloat absDy = (line->dy < 0.0F) ? -line->dy : line->dy; + /* compute the actual segment's endpoints */ + const GLfloat x0 = line->x0 + t0 * line->dx; + const GLfloat y0 = line->y0 + t0 * line->dy; + const GLfloat x1 = line->x0 + t1 * line->dx; + const GLfloat y1 = line->y0 + t1 * line->dy; + + /* compute vertices of the line-aligned quadrilateral */ + line->qx0 = x0 - line->yAdj; + line->qy0 = y0 + line->xAdj; + line->qx1 = x0 + line->yAdj; + line->qy1 = y0 - line->xAdj; + line->qx2 = x1 + line->yAdj; + line->qy2 = y1 - line->xAdj; + line->qx3 = x1 - line->yAdj; + line->qy3 = y1 + line->xAdj; + /* compute the quad's edge vectors (for coverage calc) */ + line->ex0 = line->qx1 - line->qx0; + line->ey0 = line->qy1 - line->qy0; + line->ex1 = line->qx2 - line->qx1; + line->ey1 = line->qy2 - line->qy1; + line->ex2 = line->qx3 - line->qx2; + line->ey2 = line->qy3 - line->qy2; + line->ex3 = line->qx0 - line->qx3; + line->ey3 = line->qy0 - line->qy3; + + if (absDx > absDy) { + /* X-major line */ + GLfloat dydx = line->dy / line->dx; + GLfloat xLeft, xRight, yBot, yTop; + GLint ix, ixRight; + if (x0 < x1) { + xLeft = x0 - line->halfWidth; + xRight = x1 + line->halfWidth; + if (line->dy >= 0.0) { + yBot = y0 - 3.0F * line->halfWidth; + yTop = y0 + line->halfWidth; + } + else { + yBot = y0 - line->halfWidth; + yTop = y0 + 3.0F * line->halfWidth; + } + } + else { + xLeft = x1 - line->halfWidth; + xRight = x0 + line->halfWidth; + if (line->dy <= 0.0) { + yBot = y1 - 3.0F * line->halfWidth; + yTop = y1 + line->halfWidth; + } + else { + yBot = y1 - line->halfWidth; + yTop = y1 + 3.0F * line->halfWidth; + } + } + + /* scan along the line, left-to-right */ + ixRight = (GLint) (xRight + 1.0F); + + /*printf("avg span height: %g\n", yTop - yBot);*/ + for (ix = (GLint) xLeft; ix < ixRight; ix++) { + const GLint iyBot = (GLint) yBot; + const GLint iyTop = (GLint) (yTop + 1.0F); + GLint iy; + /* scan across the line, bottom-to-top */ + for (iy = iyBot; iy < iyTop; iy++) { + (*plot)(ctx, line, ix, iy); + } + yBot += dydx; + yTop += dydx; + } + } + else { + /* Y-major line */ + GLfloat dxdy = line->dx / line->dy; + GLfloat yBot, yTop, xLeft, xRight; + GLint iy, iyTop; + if (y0 < y1) { + yBot = y0 - line->halfWidth; + yTop = y1 + line->halfWidth; + if (line->dx >= 0.0) { + xLeft = x0 - 3.0F * line->halfWidth; + xRight = x0 + line->halfWidth; + } + else { + xLeft = x0 - line->halfWidth; + xRight = x0 + 3.0F * line->halfWidth; + } + } + else { + yBot = y1 - line->halfWidth; + yTop = y0 + line->halfWidth; + if (line->dx <= 0.0) { + xLeft = x1 - 3.0F * line->halfWidth; + xRight = x1 + line->halfWidth; + } + else { + xLeft = x1 - line->halfWidth; + xRight = x1 + 3.0F * line->halfWidth; + } + } + + /* scan along the line, bottom-to-top */ + iyTop = (GLint) (yTop + 1.0F); + + /*printf("avg span width: %g\n", xRight - xLeft);*/ + for (iy = (GLint) yBot; iy < iyTop; iy++) { + const GLint ixLeft = (GLint) xLeft; + const GLint ixRight = (GLint) (xRight + 1.0F); + GLint ix; + /* scan across the line, left-to-right */ + for (ix = ixLeft; ix < ixRight; ix++) { + (*plot)(ctx, line, ix, iy); + } + xLeft += dxdy; + xRight += dxdy; + } + } +} + + +#define NAME(x) aa_ci_##x +#define DO_Z +#define DO_FOG +#define DO_INDEX +#include "s_aalinetemp.h" + + +#define NAME(x) aa_rgba_##x +#define DO_Z +#define DO_FOG +#define DO_RGBA +#include "s_aalinetemp.h" + + +#define NAME(x) aa_tex_rgba_##x +#define DO_Z +#define DO_FOG +#define DO_RGBA +#define DO_TEX +#include "s_aalinetemp.h" + + +#define NAME(x) aa_multitex_rgba_##x +#define DO_Z +#define DO_FOG +#define DO_RGBA +#define DO_MULTITEX +#include "s_aalinetemp.h" + + +#define NAME(x) aa_multitex_spec_##x +#define DO_Z +#define DO_FOG +#define DO_RGBA +#define DO_MULTITEX +#define DO_SPEC +#include "s_aalinetemp.h" + + + +void +_swrast_choose_aa_line_function(GLcontext *ctx) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + ASSERT(ctx->Line.SmoothFlag); + + if (ctx->Visual.rgbMode) { + /* RGBA */ + if (ctx->Texture._EnabledCoordUnits != 0) { + if (ctx->Texture._EnabledCoordUnits > 1) { + /* Multitextured! */ + if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR || + ctx->Fog.ColorSumEnabled) + swrast->Line = aa_multitex_spec_line; + else + swrast->Line = aa_multitex_rgba_line; + } + else { + swrast->Line = aa_tex_rgba_line; + } + } + else { + swrast->Line = aa_rgba_line; + } + } + else { + /* Color Index */ + swrast->Line = aa_ci_line; + } +} diff --git a/reactos/dll/mesa32/src/swrast/s_aaline.h b/reactos/dll/mesa32/src/swrast/s_aaline.h new file mode 100644 index 00000000000..41e7e5fd4d4 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_aaline.h @@ -0,0 +1,39 @@ + +/* + * 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 S_AALINE_H +#define S_AALINE_H + + +#include "mtypes.h" +#include "swrast.h" + + +extern void +_swrast_choose_aa_line_function(GLcontext *ctx); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_aalinetemp.h b/reactos/dll/mesa32/src/swrast/s_aalinetemp.h new file mode 100644 index 00000000000..4a1e1ebda2a --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_aalinetemp.h @@ -0,0 +1,329 @@ +/* + * 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. + */ + + +/* + * Antialiased line template. + */ + + +/* + * Function to render each fragment in the AA line. + * \param ix - integer fragment window X coordiante + * \param iy - integer fragment window Y coordiante + */ +static void +NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) +{ + const GLfloat fx = (GLfloat) ix; + const GLfloat fy = (GLfloat) iy; +#ifdef DO_INDEX + const GLfloat coverage = compute_coveragei(line, ix, iy); +#else + const GLfloat coverage = compute_coveragef(line, ix, iy); +#endif + const GLuint i = line->span.end; + + if (coverage == 0.0) + return; + + line->span.end++; + line->span.array->coverage[i] = coverage; + line->span.array->x[i] = ix; + line->span.array->y[i] = iy; + + /* + * Compute Z, color, texture coords, fog for the fragment by + * solving the plane equations at (ix,iy). + */ +#ifdef DO_Z + line->span.array->z[i] = (GLdepth) IROUND(solve_plane(fx, fy, line->zPlane)); +#endif +#ifdef DO_FOG + line->span.array->fog[i] = solve_plane(fx, fy, line->fPlane); +#endif +#ifdef DO_RGBA + line->span.array->rgba[i][RCOMP] = solve_plane_chan(fx, fy, line->rPlane); + line->span.array->rgba[i][GCOMP] = solve_plane_chan(fx, fy, line->gPlane); + line->span.array->rgba[i][BCOMP] = solve_plane_chan(fx, fy, line->bPlane); + line->span.array->rgba[i][ACOMP] = solve_plane_chan(fx, fy, line->aPlane); +#endif +#ifdef DO_INDEX + line->span.array->index[i] = (GLint) solve_plane(fx, fy, line->iPlane); +#endif +#ifdef DO_SPEC + line->span.array->spec[i][RCOMP] = solve_plane_chan(fx, fy, line->srPlane); + line->span.array->spec[i][GCOMP] = solve_plane_chan(fx, fy, line->sgPlane); + line->span.array->spec[i][BCOMP] = solve_plane_chan(fx, fy, line->sbPlane); +#endif +#ifdef DO_TEX + { + GLfloat invQ; + if (ctx->FragmentProgram._Active) { + invQ = 1.0F; + } + else { + invQ = solve_plane_recip(fx, fy, line->vPlane[0]); + } + line->span.array->texcoords[0][i][0] = solve_plane(fx, fy, line->sPlane[0]) * invQ; + line->span.array->texcoords[0][i][1] = solve_plane(fx, fy, line->tPlane[0]) * invQ; + line->span.array->texcoords[0][i][2] = solve_plane(fx, fy, line->uPlane[0]) * invQ; + line->span.array->lambda[0][i] = compute_lambda(line->sPlane[0], + line->tPlane[0], invQ, + line->texWidth[0], + line->texHeight[0]); + } +#elif defined(DO_MULTITEX) + { + GLuint unit; + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { + if (ctx->Texture.Unit[unit]._ReallyEnabled) { + GLfloat invQ; + if (ctx->FragmentProgram._Active) { + invQ = 1.0F; + } + else { + invQ = solve_plane_recip(fx, fy, line->vPlane[unit]); + } + line->span.array->texcoords[unit][i][0] = solve_plane(fx, fy, line->sPlane[unit]) * invQ; + line->span.array->texcoords[unit][i][1] = solve_plane(fx, fy, line->tPlane[unit]) * invQ; + line->span.array->texcoords[unit][i][2] = solve_plane(fx, fy, line->uPlane[unit]) * invQ; + line->span.array->lambda[unit][i] = compute_lambda(line->sPlane[unit], + line->tPlane[unit], invQ, + line->texWidth[unit], line->texHeight[unit]); + } + } + } +#endif + + if (line->span.end == MAX_WIDTH) { +#if defined(DO_RGBA) + _swrast_write_rgba_span(ctx, &(line->span)); +#else + _swrast_write_index_span(ctx, &(line->span)); +#endif + line->span.end = 0; /* reset counter */ + } +} + + + +/* + * Line setup + */ +static void +NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLfloat tStart, tEnd; /* segment start, end along line length */ + GLboolean inSegment; + GLint iLen, i; + + /* Init the LineInfo struct */ + struct LineInfo line; + line.x0 = v0->win[0]; + line.y0 = v0->win[1]; + line.x1 = v1->win[0]; + line.y1 = v1->win[1]; + line.dx = line.x1 - line.x0; + line.dy = line.y1 - line.y0; + line.len = SQRTF(line.dx * line.dx + line.dy * line.dy); + line.halfWidth = 0.5F * ctx->Line._Width; + + if (line.len == 0.0 || IS_INF_OR_NAN(line.len)) + return; + + INIT_SPAN(line.span, GL_LINE, 0, 0, SPAN_XY | SPAN_COVERAGE); + + line.xAdj = line.dx / line.len * line.halfWidth; + line.yAdj = line.dy / line.len * line.halfWidth; + +#ifdef DO_Z + line.span.arrayMask |= SPAN_Z; + compute_plane(line.x0, line.y0, line.x1, line.y1, + v0->win[2], v1->win[2], line.zPlane); +#endif +#ifdef DO_FOG + line.span.arrayMask |= SPAN_FOG; + compute_plane(line.x0, line.y0, line.x1, line.y1, + v0->fog, v1->fog, line.fPlane); +#endif +#ifdef DO_RGBA + line.span.arrayMask |= SPAN_RGBA; + if (ctx->Light.ShadeModel == GL_SMOOTH) { + compute_plane(line.x0, line.y0, line.x1, line.y1, + v0->color[RCOMP], v1->color[RCOMP], line.rPlane); + compute_plane(line.x0, line.y0, line.x1, line.y1, + v0->color[GCOMP], v1->color[GCOMP], line.gPlane); + compute_plane(line.x0, line.y0, line.x1, line.y1, + v0->color[BCOMP], v1->color[BCOMP], line.bPlane); + compute_plane(line.x0, line.y0, line.x1, line.y1, + v0->color[ACOMP], v1->color[ACOMP], line.aPlane); + } + else { + constant_plane(v1->color[RCOMP], line.rPlane); + constant_plane(v1->color[GCOMP], line.gPlane); + constant_plane(v1->color[BCOMP], line.bPlane); + constant_plane(v1->color[ACOMP], line.aPlane); + } +#endif +#ifdef DO_SPEC + line.span.arrayMask |= SPAN_SPEC; + if (ctx->Light.ShadeModel == GL_SMOOTH) { + compute_plane(line.x0, line.y0, line.x1, line.y1, + v0->specular[RCOMP], v1->specular[RCOMP], line.srPlane); + compute_plane(line.x0, line.y0, line.x1, line.y1, + v0->specular[GCOMP], v1->specular[GCOMP], line.sgPlane); + compute_plane(line.x0, line.y0, line.x1, line.y1, + v0->specular[BCOMP], v1->specular[BCOMP], line.sbPlane); + } + else { + constant_plane(v1->specular[RCOMP], line.srPlane); + constant_plane(v1->specular[GCOMP], line.sgPlane); + constant_plane(v1->specular[BCOMP], line.sbPlane); + } +#endif +#ifdef DO_INDEX + line.span.arrayMask |= SPAN_INDEX; + if (ctx->Light.ShadeModel == GL_SMOOTH) { + compute_plane(line.x0, line.y0, line.x1, line.y1, + v0->index, v1->index, line.iPlane); + } + else { + constant_plane(v1->index, line.iPlane); + } +#endif +#ifdef DO_TEX + { + const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; + const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; + const GLfloat invW0 = v0->win[3]; + const GLfloat invW1 = v1->win[3]; + const GLfloat s0 = v0->texcoord[0][0] * invW0; + const GLfloat s1 = v1->texcoord[0][0] * invW1; + const GLfloat t0 = v0->texcoord[0][1] * invW0; + const GLfloat t1 = v1->texcoord[0][1] * invW1; + const GLfloat r0 = v0->texcoord[0][2] * invW0; + const GLfloat r1 = v1->texcoord[0][2] * invW1; + const GLfloat q0 = v0->texcoord[0][3] * invW0; + const GLfloat q1 = v1->texcoord[0][3] * invW1; + line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); + compute_plane(line.x0, line.y0, line.x1, line.y1, s0, s1, line.sPlane[0]); + compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[0]); + compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[0]); + compute_plane(line.x0, line.y0, line.x1, line.y1, q0, q1, line.vPlane[0]); + line.texWidth[0] = (GLfloat) texImage->Width; + line.texHeight[0] = (GLfloat) texImage->Height; + } +#elif defined(DO_MULTITEX) + { + GLuint u; + line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (ctx->Texture.Unit[u]._ReallyEnabled) { + const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; + const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; + const GLfloat invW0 = v0->win[3]; + const GLfloat invW1 = v1->win[3]; + const GLfloat s0 = v0->texcoord[u][0] * invW0; + const GLfloat s1 = v1->texcoord[u][0] * invW1; + const GLfloat t0 = v0->texcoord[u][1] * invW0; + const GLfloat t1 = v1->texcoord[u][1] * invW1; + const GLfloat r0 = v0->texcoord[u][2] * invW0; + const GLfloat r1 = v1->texcoord[u][2] * invW1; + const GLfloat q0 = v0->texcoord[u][3] * invW0; + const GLfloat q1 = v1->texcoord[u][3] * invW1; + compute_plane(line.x0, line.y0, line.x1, line.y1, s0, s1, line.sPlane[u]); + compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[u]); + compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[u]); + compute_plane(line.x0, line.y0, line.x1, line.y1, q0, q1, line.vPlane[u]); + line.texWidth[u] = (GLfloat) texImage->Width; + line.texHeight[u] = (GLfloat) texImage->Height; + } + } + } +#endif + + tStart = tEnd = 0.0; + inSegment = GL_FALSE; + iLen = (GLint) line.len; + + if (ctx->Line.StippleFlag) { + for (i = 0; i < iLen; i++) { + const GLuint bit = (swrast->StippleCounter / ctx->Line.StippleFactor) & 0xf; + if ((1 << bit) & ctx->Line.StipplePattern) { + /* stipple bit is on */ + const GLfloat t = (GLfloat) i / (GLfloat) line.len; + if (!inSegment) { + /* start new segment */ + inSegment = GL_TRUE; + tStart = t; + } + else { + /* still in the segment, extend it */ + tEnd = t; + } + } + else { + /* stipple bit is off */ + if (inSegment && (tEnd > tStart)) { + /* draw the segment */ + segment(ctx, &line, NAME(plot), tStart, tEnd); + inSegment = GL_FALSE; + } + else { + /* still between segments, do nothing */ + } + } + swrast->StippleCounter++; + } + + if (inSegment) { + /* draw the final segment of the line */ + segment(ctx, &line, NAME(plot), tStart, 1.0F); + } + } + else { + /* non-stippled */ + segment(ctx, &line, NAME(plot), 0.0, 1.0); + } + +#if defined(DO_RGBA) + _swrast_write_rgba_span(ctx, &(line.span)); +#else + _swrast_write_index_span(ctx, &(line.span)); +#endif +} + + + + +#undef DO_Z +#undef DO_FOG +#undef DO_RGBA +#undef DO_INDEX +#undef DO_SPEC +#undef DO_TEX +#undef DO_MULTITEX +#undef NAME diff --git a/reactos/dll/mesa32/src/swrast/s_aatriangle.c b/reactos/dll/mesa32/src/swrast/s_aatriangle.c new file mode 100644 index 00000000000..5509f34c953 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_aatriangle.c @@ -0,0 +1,495 @@ +/* + * 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. + */ + + +/* + * Antialiased Triangle rasterizers + */ + + +#include "glheader.h" +#include "context.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "imports.h" +#include "nvfragprog.h" +#include "s_aatriangle.h" +#include "s_context.h" +#include "s_span.h" + + +/* + * Compute coefficients of a plane using the X,Y coords of the v0, v1, v2 + * vertices and the given Z values. + * A point (x,y,z) lies on plane iff a*x+b*y+c*z+d = 0. + */ +static INLINE void +compute_plane(const GLfloat v0[], const GLfloat v1[], const GLfloat v2[], + GLfloat z0, GLfloat z1, GLfloat z2, GLfloat plane[4]) +{ + const GLfloat px = v1[0] - v0[0]; + const GLfloat py = v1[1] - v0[1]; + const GLfloat pz = z1 - z0; + + const GLfloat qx = v2[0] - v0[0]; + const GLfloat qy = v2[1] - v0[1]; + const GLfloat qz = z2 - z0; + + /* Crossproduct "(a,b,c):= dv1 x dv2" is orthogonal to plane. */ + const GLfloat a = py * qz - pz * qy; + const GLfloat b = pz * qx - px * qz; + const GLfloat c = px * qy - py * qx; + /* Point on the plane = "r*(a,b,c) + w", with fixed "r" depending + on the distance of plane from origin and arbitrary "w" parallel + to the plane. */ + /* The scalar product "(r*(a,b,c)+w)*(a,b,c)" is "r*(a^2+b^2+c^2)", + which is equal to "-d" below. */ + const GLfloat d = -(a * v0[0] + b * v0[1] + c * z0); + + plane[0] = a; + plane[1] = b; + plane[2] = c; + plane[3] = d; +} + + +/* + * Compute coefficients of a plane with a constant Z value. + */ +static INLINE void +constant_plane(GLfloat value, GLfloat plane[4]) +{ + plane[0] = 0.0; + plane[1] = 0.0; + plane[2] = -1.0; + plane[3] = value; +} + +#define CONSTANT_PLANE(VALUE, PLANE) \ +do { \ + PLANE[0] = 0.0F; \ + PLANE[1] = 0.0F; \ + PLANE[2] = -1.0F; \ + PLANE[3] = VALUE; \ +} while (0) + + + +/* + * Solve plane equation for Z at (X,Y). + */ +static INLINE GLfloat +solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4]) +{ + ASSERT(plane[2] != 0.0F); + return (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; +} + + +#define SOLVE_PLANE(X, Y, PLANE) \ + ((PLANE[3] + PLANE[0] * (X) + PLANE[1] * (Y)) / -PLANE[2]) + + +/* + * Return 1 / solve_plane(). + */ +static INLINE GLfloat +solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4]) +{ + const GLfloat denom = plane[3] + plane[0] * x + plane[1] * y; + if (denom == 0.0F) + return 0.0F; + else + return -plane[2] / denom; +} + + +/* + * Solve plane and return clamped GLchan value. + */ +static INLINE GLchan +solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4]) +{ + const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; +#if CHAN_TYPE == GL_FLOAT + return CLAMP(z, 0.0F, CHAN_MAXF); +#else + if (z < 0) + return 0; + else if (z > CHAN_MAX) + return CHAN_MAX; + return (GLchan) IROUND_POS(z); +#endif +} + + + +/* + * Compute how much (area) of the given pixel is inside the triangle. + * Vertices MUST be specified in counter-clockwise order. + * Return: coverage in [0, 1]. + */ +static GLfloat +compute_coveragef(const GLfloat v0[3], const GLfloat v1[3], + const GLfloat v2[3], GLint winx, GLint winy) +{ + /* Given a position [0,3]x[0,3] return the sub-pixel sample position. + * Contributed by Ray Tice. + * + * Jitter sample positions - + * - average should be .5 in x & y for each column + * - each of the 16 rows and columns should be used once + * - the rectangle formed by the first four points + * should contain the other points + * - the distrubition should be fairly even in any given direction + * + * The pattern drawn below isn't optimal, but it's better than a regular + * grid. In the drawing, the center of each subpixel is surrounded by + * four dots. The "x" marks the jittered position relative to the + * subpixel center. + */ +#define POS(a, b) (0.5+a*4+b)/16 + static const GLfloat samples[16][2] = { + /* start with the four corners */ + { POS(0, 2), POS(0, 0) }, + { POS(3, 3), POS(0, 2) }, + { POS(0, 0), POS(3, 1) }, + { POS(3, 1), POS(3, 3) }, + /* continue with interior samples */ + { POS(1, 1), POS(0, 1) }, + { POS(2, 0), POS(0, 3) }, + { POS(0, 3), POS(1, 3) }, + { POS(1, 2), POS(1, 0) }, + { POS(2, 3), POS(1, 2) }, + { POS(3, 2), POS(1, 1) }, + { POS(0, 1), POS(2, 2) }, + { POS(1, 0), POS(2, 1) }, + { POS(2, 1), POS(2, 3) }, + { POS(3, 0), POS(2, 0) }, + { POS(1, 3), POS(3, 0) }, + { POS(2, 2), POS(3, 2) } + }; + + const GLfloat x = (GLfloat) winx; + const GLfloat y = (GLfloat) winy; + const GLfloat dx0 = v1[0] - v0[0]; + const GLfloat dy0 = v1[1] - v0[1]; + const GLfloat dx1 = v2[0] - v1[0]; + const GLfloat dy1 = v2[1] - v1[1]; + const GLfloat dx2 = v0[0] - v2[0]; + const GLfloat dy2 = v0[1] - v2[1]; + GLint stop = 4, i; + GLfloat insideCount = 16.0F; + +#ifdef DEBUG + { + const GLfloat area = dx0 * dy1 - dx1 * dy0; + ASSERT(area >= 0.0); + } +#endif + + for (i = 0; i < stop; i++) { + const GLfloat sx = x + samples[i][0]; + const GLfloat sy = y + samples[i][1]; + /* cross product determines if sample is inside or outside each edge */ + GLfloat cross = (dx0 * (sy - v0[1]) - dy0 * (sx - v0[0])); + /* Check if the sample is exactly on an edge. If so, let cross be a + * positive or negative value depending on the direction of the edge. + */ + if (cross == 0.0F) + cross = dx0 + dy0; + if (cross < 0.0F) { + /* sample point is outside first edge */ + insideCount -= 1.0F; + stop = 16; + } + else { + /* sample point is inside first edge */ + cross = (dx1 * (sy - v1[1]) - dy1 * (sx - v1[0])); + if (cross == 0.0F) + cross = dx1 + dy1; + if (cross < 0.0F) { + /* sample point is outside second edge */ + insideCount -= 1.0F; + stop = 16; + } + else { + /* sample point is inside first and second edges */ + cross = (dx2 * (sy - v2[1]) - dy2 * (sx - v2[0])); + if (cross == 0.0F) + cross = dx2 + dy2; + if (cross < 0.0F) { + /* sample point is outside third edge */ + insideCount -= 1.0F; + stop = 16; + } + } + } + } + if (stop == 4) + return 1.0F; + else + return insideCount * (1.0F / 16.0F); +} + + + +/* + * Compute how much (area) of the given pixel is inside the triangle. + * Vertices MUST be specified in counter-clockwise order. + * Return: coverage in [0, 15]. + */ +static GLint +compute_coveragei(const GLfloat v0[3], const GLfloat v1[3], + const GLfloat v2[3], GLint winx, GLint winy) +{ + /* NOTE: 15 samples instead of 16. */ + static const GLfloat samples[15][2] = { + /* start with the four corners */ + { POS(0, 2), POS(0, 0) }, + { POS(3, 3), POS(0, 2) }, + { POS(0, 0), POS(3, 1) }, + { POS(3, 1), POS(3, 3) }, + /* continue with interior samples */ + { POS(1, 1), POS(0, 1) }, + { POS(2, 0), POS(0, 3) }, + { POS(0, 3), POS(1, 3) }, + { POS(1, 2), POS(1, 0) }, + { POS(2, 3), POS(1, 2) }, + { POS(3, 2), POS(1, 1) }, + { POS(0, 1), POS(2, 2) }, + { POS(1, 0), POS(2, 1) }, + { POS(2, 1), POS(2, 3) }, + { POS(3, 0), POS(2, 0) }, + { POS(1, 3), POS(3, 0) } + }; + const GLfloat x = (GLfloat) winx; + const GLfloat y = (GLfloat) winy; + const GLfloat dx0 = v1[0] - v0[0]; + const GLfloat dy0 = v1[1] - v0[1]; + const GLfloat dx1 = v2[0] - v1[0]; + const GLfloat dy1 = v2[1] - v1[1]; + const GLfloat dx2 = v0[0] - v2[0]; + const GLfloat dy2 = v0[1] - v2[1]; + GLint stop = 4, i; + GLint insideCount = 15; + +#ifdef DEBUG + { + const GLfloat area = dx0 * dy1 - dx1 * dy0; + ASSERT(area >= 0.0); + } +#endif + + for (i = 0; i < stop; i++) { + const GLfloat sx = x + samples[i][0]; + const GLfloat sy = y + samples[i][1]; + const GLfloat fx0 = sx - v0[0]; + const GLfloat fy0 = sy - v0[1]; + const GLfloat fx1 = sx - v1[0]; + const GLfloat fy1 = sy - v1[1]; + const GLfloat fx2 = sx - v2[0]; + const GLfloat fy2 = sy - v2[1]; + /* cross product determines if sample is inside or outside each edge */ + GLfloat cross0 = (dx0 * fy0 - dy0 * fx0); + GLfloat cross1 = (dx1 * fy1 - dy1 * fx1); + GLfloat cross2 = (dx2 * fy2 - dy2 * fx2); + /* Check if the sample is exactly on an edge. If so, let cross be a + * positive or negative value depending on the direction of the edge. + */ + if (cross0 == 0.0F) + cross0 = dx0 + dy0; + if (cross1 == 0.0F) + cross1 = dx1 + dy1; + if (cross2 == 0.0F) + cross2 = dx2 + dy2; + if (cross0 < 0.0F || cross1 < 0.0F || cross2 < 0.0F) { + /* point is outside triangle */ + insideCount--; + stop = 15; + } + } + if (stop == 4) + return 15; + else + return insideCount; +} + + + +static void +rgba_aa_tri(GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2) +{ +#define DO_Z +#define DO_FOG +#define DO_RGBA +#include "s_aatritemp.h" +} + + +static void +index_aa_tri(GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2) +{ +#define DO_Z +#define DO_FOG +#define DO_INDEX +#include "s_aatritemp.h" +} + + +/* + * Compute mipmap level of detail. + * XXX we should really include the R coordinate in this computation + * in order to do 3-D texture mipmapping. + */ +static INLINE GLfloat +compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4], + const GLfloat qPlane[4], GLfloat cx, GLfloat cy, + GLfloat invQ, GLfloat texWidth, GLfloat texHeight) +{ + const GLfloat s = solve_plane(cx, cy, sPlane); + const GLfloat t = solve_plane(cx, cy, tPlane); + const GLfloat invQ_x1 = solve_plane_recip(cx+1.0F, cy, qPlane); + const GLfloat invQ_y1 = solve_plane_recip(cx, cy+1.0F, qPlane); + const GLfloat s_x1 = s - sPlane[0] / sPlane[2]; + const GLfloat s_y1 = s - sPlane[1] / sPlane[2]; + const GLfloat t_x1 = t - tPlane[0] / tPlane[2]; + const GLfloat t_y1 = t - tPlane[1] / tPlane[2]; + GLfloat dsdx = s_x1 * invQ_x1 - s * invQ; + GLfloat dsdy = s_y1 * invQ_y1 - s * invQ; + GLfloat dtdx = t_x1 * invQ_x1 - t * invQ; + GLfloat dtdy = t_y1 * invQ_y1 - t * invQ; + GLfloat maxU, maxV, rho, lambda; + dsdx = FABSF(dsdx); + dsdy = FABSF(dsdy); + dtdx = FABSF(dtdx); + dtdy = FABSF(dtdy); + maxU = MAX2(dsdx, dsdy) * texWidth; + maxV = MAX2(dtdx, dtdy) * texHeight; + rho = MAX2(maxU, maxV); + lambda = LOG2(rho); + return lambda; +} + + +static void +tex_aa_tri(GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2) +{ +#define DO_Z +#define DO_FOG +#define DO_RGBA +#define DO_TEX +#include "s_aatritemp.h" +} + + +static void +spec_tex_aa_tri(GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2) +{ +#define DO_Z +#define DO_FOG +#define DO_RGBA +#define DO_TEX +#define DO_SPEC +#include "s_aatritemp.h" +} + + +static void +multitex_aa_tri(GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2) +{ +#define DO_Z +#define DO_FOG +#define DO_RGBA +#define DO_MULTITEX +#include "s_aatritemp.h" +} + +static void +spec_multitex_aa_tri(GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2) +{ +#define DO_Z +#define DO_FOG +#define DO_RGBA +#define DO_MULTITEX +#define DO_SPEC +#include "s_aatritemp.h" +} + + +/* + * Examine GL state and set swrast->Triangle to an + * appropriate antialiased triangle rasterizer function. + */ +void +_swrast_set_aa_triangle_function(GLcontext *ctx) +{ + ASSERT(ctx->Polygon.SmoothFlag); + + if (ctx->Texture._EnabledCoordUnits != 0) { + if (NEED_SECONDARY_COLOR(ctx)) { + if (ctx->Texture._EnabledCoordUnits > 1) { + SWRAST_CONTEXT(ctx)->Triangle = spec_multitex_aa_tri; + } + else { + SWRAST_CONTEXT(ctx)->Triangle = spec_tex_aa_tri; + } + } + else { + if (ctx->Texture._EnabledCoordUnits > 1) { + SWRAST_CONTEXT(ctx)->Triangle = multitex_aa_tri; + } + else { + SWRAST_CONTEXT(ctx)->Triangle = tex_aa_tri; + } + } + } + else if (ctx->Visual.rgbMode) { + SWRAST_CONTEXT(ctx)->Triangle = rgba_aa_tri; + } + else { + SWRAST_CONTEXT(ctx)->Triangle = index_aa_tri; + } + + ASSERT(SWRAST_CONTEXT(ctx)->Triangle); +} diff --git a/reactos/dll/mesa32/src/swrast/s_aatriangle.h b/reactos/dll/mesa32/src/swrast/s_aatriangle.h new file mode 100644 index 00000000000..ebb828eb19f --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_aatriangle.h @@ -0,0 +1,39 @@ + +/* + * 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 S_AATRIANGLE_H +#define S_AATRIANGLE_H + + +#include "mtypes.h" +#include "swrast.h" + + +extern void +_swrast_set_aa_triangle_function(GLcontext *ctx); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_aatritemp.h b/reactos/dll/mesa32/src/swrast/s_aatritemp.h new file mode 100644 index 00000000000..16e26d3f8a5 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_aatritemp.h @@ -0,0 +1,549 @@ +/* + * 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. + */ + + +/* + * Antialiased Triangle Rasterizer Template + * + * This file is #include'd to generate custom AA triangle rasterizers. + * NOTE: this code hasn't been optimized yet. That'll come after it + * works correctly. + * + * The following macros may be defined to indicate what auxillary information + * must be copmuted across the triangle: + * DO_Z - if defined, compute Z values + * DO_RGBA - if defined, compute RGBA values + * DO_INDEX - if defined, compute color index values + * DO_SPEC - if defined, compute specular RGB values + * DO_TEX - if defined, compute unit 0 STRQ texcoords + * DO_MULTITEX - if defined, compute all unit's STRQ texcoords + */ + +/*void triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv )*/ +{ + const GLfloat *p0 = v0->win; + const GLfloat *p1 = v1->win; + const GLfloat *p2 = v2->win; + const SWvertex *vMin, *vMid, *vMax; + GLint iyMin, iyMax; + GLfloat yMin, yMax; + GLboolean ltor; + GLfloat majDx, majDy; /* major (i.e. long) edge dx and dy */ + + struct sw_span span; + +#ifdef DO_Z + GLfloat zPlane[4]; +#endif +#ifdef DO_FOG + GLfloat fogPlane[4]; +#else + GLfloat *fog = NULL; +#endif +#ifdef DO_RGBA + GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; +#endif +#ifdef DO_INDEX + GLfloat iPlane[4]; +#endif +#ifdef DO_SPEC + GLfloat srPlane[4], sgPlane[4], sbPlane[4]; +#endif +#ifdef DO_TEX + GLfloat sPlane[4], tPlane[4], uPlane[4], vPlane[4]; + GLfloat texWidth, texHeight; +#elif defined(DO_MULTITEX) + GLfloat sPlane[MAX_TEXTURE_COORD_UNITS][4]; /* texture S */ + GLfloat tPlane[MAX_TEXTURE_COORD_UNITS][4]; /* texture T */ + GLfloat uPlane[MAX_TEXTURE_COORD_UNITS][4]; /* texture R */ + GLfloat vPlane[MAX_TEXTURE_COORD_UNITS][4]; /* texture Q */ + GLfloat texWidth[MAX_TEXTURE_COORD_UNITS]; + GLfloat texHeight[MAX_TEXTURE_COORD_UNITS]; +#endif + GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceSign; + + + INIT_SPAN(span, GL_POLYGON, 0, 0, SPAN_COVERAGE); + + /* determine bottom to top order of vertices */ + { + GLfloat y0 = v0->win[1]; + GLfloat y1 = v1->win[1]; + GLfloat y2 = v2->win[1]; + if (y0 <= y1) { + if (y1 <= y2) { + vMin = v0; vMid = v1; vMax = v2; /* y0<=y1<=y2 */ + } + else if (y2 <= y0) { + vMin = v2; vMid = v0; vMax = v1; /* y2<=y0<=y1 */ + } + else { + vMin = v0; vMid = v2; vMax = v1; bf = -bf; /* y0<=y2<=y1 */ + } + } + else { + if (y0 <= y2) { + vMin = v1; vMid = v0; vMax = v2; bf = -bf; /* y1<=y0<=y2 */ + } + else if (y2 <= y1) { + vMin = v2; vMid = v1; vMax = v0; bf = -bf; /* y2<=y1<=y0 */ + } + else { + vMin = v1; vMid = v2; vMax = v0; /* y1<=y2<=y0 */ + } + } + } + + majDx = vMax->win[0] - vMin->win[0]; + majDy = vMax->win[1] - vMin->win[1]; + + { + const GLfloat botDx = vMid->win[0] - vMin->win[0]; + const GLfloat botDy = vMid->win[1] - vMin->win[1]; + const GLfloat area = majDx * botDy - botDx * majDy; + /* Do backface culling */ + if (area * bf < 0 || area == 0 || IS_INF_OR_NAN(area)) + return; + ltor = (GLboolean) (area < 0.0F); + } + +#ifndef DO_OCCLUSION_TEST + ctx->OcclusionResult = GL_TRUE; +#endif + + /* Plane equation setup: + * We evaluate plane equations at window (x,y) coordinates in order + * to compute color, Z, fog, texcoords, etc. This isn't terribly + * efficient but it's easy and reliable. + */ +#ifdef DO_Z + compute_plane(p0, p1, p2, p0[2], p1[2], p2[2], zPlane); + span.arrayMask |= SPAN_Z; +#endif +#ifdef DO_FOG + compute_plane(p0, p1, p2, v0->fog, v1->fog, v2->fog, fogPlane); + span.arrayMask |= SPAN_FOG; +#endif +#ifdef DO_RGBA + if (ctx->Light.ShadeModel == GL_SMOOTH) { + compute_plane(p0, p1, p2, v0->color[RCOMP], v1->color[RCOMP], v2->color[RCOMP], rPlane); + compute_plane(p0, p1, p2, v0->color[GCOMP], v1->color[GCOMP], v2->color[GCOMP], gPlane); + compute_plane(p0, p1, p2, v0->color[BCOMP], v1->color[BCOMP], v2->color[BCOMP], bPlane); + compute_plane(p0, p1, p2, v0->color[ACOMP], v1->color[ACOMP], v2->color[ACOMP], aPlane); + } + else { + constant_plane(v2->color[RCOMP], rPlane); + constant_plane(v2->color[GCOMP], gPlane); + constant_plane(v2->color[BCOMP], bPlane); + constant_plane(v2->color[ACOMP], aPlane); + } + span.arrayMask |= SPAN_RGBA; +#endif +#ifdef DO_INDEX + if (ctx->Light.ShadeModel == GL_SMOOTH) { + compute_plane(p0, p1, p2, (GLfloat) v0->index, + v1->index, v2->index, iPlane); + } + else { + constant_plane(v2->index, iPlane); + } + span.arrayMask |= SPAN_INDEX; +#endif +#ifdef DO_SPEC + if (ctx->Light.ShadeModel == GL_SMOOTH) { + compute_plane(p0, p1, p2, v0->specular[RCOMP], v1->specular[RCOMP], v2->specular[RCOMP], srPlane); + compute_plane(p0, p1, p2, v0->specular[GCOMP], v1->specular[GCOMP], v2->specular[GCOMP], sgPlane); + compute_plane(p0, p1, p2, v0->specular[BCOMP], v1->specular[BCOMP], v2->specular[BCOMP], sbPlane); + } + else { + constant_plane(v2->specular[RCOMP], srPlane); + constant_plane(v2->specular[GCOMP], sgPlane); + constant_plane(v2->specular[BCOMP], sbPlane); + } + span.arrayMask |= SPAN_SPEC; +#endif +#ifdef DO_TEX + { + const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; + const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; + const GLfloat invW0 = v0->win[3]; + const GLfloat invW1 = v1->win[3]; + const GLfloat invW2 = v2->win[3]; + const GLfloat s0 = v0->texcoord[0][0] * invW0; + const GLfloat s1 = v1->texcoord[0][0] * invW1; + const GLfloat s2 = v2->texcoord[0][0] * invW2; + const GLfloat t0 = v0->texcoord[0][1] * invW0; + const GLfloat t1 = v1->texcoord[0][1] * invW1; + const GLfloat t2 = v2->texcoord[0][1] * invW2; + const GLfloat r0 = v0->texcoord[0][2] * invW0; + const GLfloat r1 = v1->texcoord[0][2] * invW1; + const GLfloat r2 = v2->texcoord[0][2] * invW2; + const GLfloat q0 = v0->texcoord[0][3] * invW0; + const GLfloat q1 = v1->texcoord[0][3] * invW1; + const GLfloat q2 = v2->texcoord[0][3] * invW2; + compute_plane(p0, p1, p2, s0, s1, s2, sPlane); + compute_plane(p0, p1, p2, t0, t1, t2, tPlane); + compute_plane(p0, p1, p2, r0, r1, r2, uPlane); + compute_plane(p0, p1, p2, q0, q1, q2, vPlane); + texWidth = (GLfloat) texImage->Width; + texHeight = (GLfloat) texImage->Height; + } + span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); +#elif defined(DO_MULTITEX) + { + GLuint u; + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (ctx->Texture.Unit[u]._ReallyEnabled) { + const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; + const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; + const GLfloat invW0 = v0->win[3]; + const GLfloat invW1 = v1->win[3]; + const GLfloat invW2 = v2->win[3]; + const GLfloat s0 = v0->texcoord[u][0] * invW0; + const GLfloat s1 = v1->texcoord[u][0] * invW1; + const GLfloat s2 = v2->texcoord[u][0] * invW2; + const GLfloat t0 = v0->texcoord[u][1] * invW0; + const GLfloat t1 = v1->texcoord[u][1] * invW1; + const GLfloat t2 = v2->texcoord[u][1] * invW2; + const GLfloat r0 = v0->texcoord[u][2] * invW0; + const GLfloat r1 = v1->texcoord[u][2] * invW1; + const GLfloat r2 = v2->texcoord[u][2] * invW2; + const GLfloat q0 = v0->texcoord[u][3] * invW0; + const GLfloat q1 = v1->texcoord[u][3] * invW1; + const GLfloat q2 = v2->texcoord[u][3] * invW2; + compute_plane(p0, p1, p2, s0, s1, s2, sPlane[u]); + compute_plane(p0, p1, p2, t0, t1, t2, tPlane[u]); + compute_plane(p0, p1, p2, r0, r1, r2, uPlane[u]); + compute_plane(p0, p1, p2, q0, q1, q2, vPlane[u]); + texWidth[u] = (GLfloat) texImage->Width; + texHeight[u] = (GLfloat) texImage->Height; + } + } + } + span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); +#endif + + /* Begin bottom-to-top scan over the triangle. + * The long edge will either be on the left or right side of the + * triangle. We always scan from the long edge toward the shorter + * edges, stopping when we find that coverage = 0. If the long edge + * is on the left we scan left-to-right. Else, we scan right-to-left. + */ + yMin = vMin->win[1]; + yMax = vMax->win[1]; + iyMin = (GLint) yMin; + iyMax = (GLint) yMax + 1; + + if (ltor) { + /* scan left to right */ + const GLfloat *pMin = vMin->win; + const GLfloat *pMid = vMid->win; + const GLfloat *pMax = vMax->win; + const GLfloat dxdy = majDx / majDy; + const GLfloat xAdj = dxdy < 0.0F ? -dxdy : 0.0F; + GLfloat x = pMin[0] - (yMin - iyMin) * dxdy; + GLint iy; + for (iy = iyMin; iy < iyMax; iy++, x += dxdy) { + GLint ix, startX = (GLint) (x - xAdj); + GLuint count; + GLfloat coverage = 0.0F; + + /* skip over fragments with zero coverage */ + while (startX < MAX_WIDTH) { + coverage = compute_coveragef(pMin, pMid, pMax, startX, iy); + if (coverage > 0.0F) + break; + startX++; + } + + /* enter interior of triangle */ + ix = startX; + count = 0; + while (coverage > 0.0F) { + /* (cx,cy) = center of fragment */ + const GLfloat cx = ix + 0.5F, cy = iy + 0.5F; + struct span_arrays *array = span.array; +#ifdef DO_INDEX + array->coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy); +#else + array->coverage[count] = coverage; +#endif +#ifdef DO_Z + array->z[count] = (GLdepth) IROUND(solve_plane(cx, cy, zPlane)); +#endif +#ifdef DO_FOG + array->fog[count] = solve_plane(cx, cy, fogPlane); +#endif +#ifdef DO_RGBA + array->rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane); + array->rgba[count][GCOMP] = solve_plane_chan(cx, cy, gPlane); + array->rgba[count][BCOMP] = solve_plane_chan(cx, cy, bPlane); + array->rgba[count][ACOMP] = solve_plane_chan(cx, cy, aPlane); +#endif +#ifdef DO_INDEX + array->index[count] = (GLint) solve_plane(cx, cy, iPlane); +#endif +#ifdef DO_SPEC + array->spec[count][RCOMP] = solve_plane_chan(cx, cy, srPlane); + array->spec[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane); + array->spec[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane); +#endif +#ifdef DO_TEX + { + const GLfloat invQ = solve_plane_recip(cx, cy, vPlane); + array->texcoords[0][count][0] = solve_plane(cx, cy, sPlane) * invQ; + array->texcoords[0][count][1] = solve_plane(cx, cy, tPlane) * invQ; + array->texcoords[0][count][2] = solve_plane(cx, cy, uPlane) * invQ; + array->lambda[0][count] = compute_lambda(sPlane, tPlane, vPlane, + cx, cy, invQ, + texWidth, texHeight); + } +#elif defined(DO_MULTITEX) + { + GLuint unit; + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { + if (ctx->Texture.Unit[unit]._ReallyEnabled) { + GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]); + array->texcoords[unit][count][0] = solve_plane(cx, cy, sPlane[unit]) * invQ; + array->texcoords[unit][count][1] = solve_plane(cx, cy, tPlane[unit]) * invQ; + array->texcoords[unit][count][2] = solve_plane(cx, cy, uPlane[unit]) * invQ; + array->lambda[unit][count] = compute_lambda(sPlane[unit], + tPlane[unit], vPlane[unit], cx, cy, invQ, + texWidth[unit], texHeight[unit]); + } + } + } +#endif + ix++; + count++; + coverage = compute_coveragef(pMin, pMid, pMax, ix, iy); + } + + if (ix <= startX) + continue; + + span.x = startX; + span.y = iy; + span.end = (GLuint) ix - (GLuint) startX; + ASSERT(span.interpMask == 0); +#if defined(DO_RGBA) + _swrast_write_rgba_span(ctx, &span); +#else + _swrast_write_index_span(ctx, &span); +#endif + } + } + else { + /* scan right to left */ + const GLfloat *pMin = vMin->win; + const GLfloat *pMid = vMid->win; + const GLfloat *pMax = vMax->win; + const GLfloat dxdy = majDx / majDy; + const GLfloat xAdj = dxdy > 0 ? dxdy : 0.0F; + GLfloat x = pMin[0] - (yMin - iyMin) * dxdy; + GLint iy; + for (iy = iyMin; iy < iyMax; iy++, x += dxdy) { + GLint ix, left, startX = (GLint) (x + xAdj); + GLuint count, n; + GLfloat coverage = 0.0F; + + /* make sure we're not past the window edge */ + if (startX >= ctx->DrawBuffer->_Xmax) { + startX = ctx->DrawBuffer->_Xmax - 1; + } + + /* skip fragments with zero coverage */ + while (startX >= 0) { + coverage = compute_coveragef(pMin, pMax, pMid, startX, iy); + if (coverage > 0.0F) + break; + startX--; + } + + /* enter interior of triangle */ + ix = startX; + count = 0; + while (coverage > 0.0F) { + /* (cx,cy) = center of fragment */ + const GLfloat cx = ix + 0.5F, cy = iy + 0.5F; + struct span_arrays *array = span.array; +#ifdef DO_INDEX + array->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy); +#else + array->coverage[ix] = coverage; +#endif +#ifdef DO_Z + array->z[ix] = (GLdepth) IROUND(solve_plane(cx, cy, zPlane)); +#endif +#ifdef DO_FOG + array->fog[ix] = solve_plane(cx, cy, fogPlane); +#endif +#ifdef DO_RGBA + array->rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane); + array->rgba[ix][GCOMP] = solve_plane_chan(cx, cy, gPlane); + array->rgba[ix][BCOMP] = solve_plane_chan(cx, cy, bPlane); + array->rgba[ix][ACOMP] = solve_plane_chan(cx, cy, aPlane); +#endif +#ifdef DO_INDEX + array->index[ix] = (GLint) solve_plane(cx, cy, iPlane); +#endif +#ifdef DO_SPEC + array->spec[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane); + array->spec[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane); + array->spec[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane); +#endif +#ifdef DO_TEX + { + const GLfloat invQ = solve_plane_recip(cx, cy, vPlane); + array->texcoords[0][ix][0] = solve_plane(cx, cy, sPlane) * invQ; + array->texcoords[0][ix][1] = solve_plane(cx, cy, tPlane) * invQ; + array->texcoords[0][ix][2] = solve_plane(cx, cy, uPlane) * invQ; + array->lambda[0][ix] = compute_lambda(sPlane, tPlane, vPlane, + cx, cy, invQ, texWidth, texHeight); + } +#elif defined(DO_MULTITEX) + { + GLuint unit; + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { + if (ctx->Texture.Unit[unit]._ReallyEnabled) { + GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]); + array->texcoords[unit][ix][0] = solve_plane(cx, cy, sPlane[unit]) * invQ; + array->texcoords[unit][ix][1] = solve_plane(cx, cy, tPlane[unit]) * invQ; + array->texcoords[unit][ix][2] = solve_plane(cx, cy, uPlane[unit]) * invQ; + array->lambda[unit][ix] = compute_lambda(sPlane[unit], + tPlane[unit], + vPlane[unit], + cx, cy, invQ, + texWidth[unit], + texHeight[unit]); + } + } + } +#endif + ix--; + count++; + coverage = compute_coveragef(pMin, pMax, pMid, ix, iy); + } + + if (startX <= ix) + continue; + + n = (GLuint) startX - (GLuint) ix; + + left = ix + 1; + + /* shift all values to the left */ + /* XXX this is temporary */ + { + struct span_arrays *array = span.array; + GLint j; + for (j = 0; j < (GLint) n; j++) { +#ifdef DO_RGBA + COPY_CHAN4(array->rgba[j], array->rgba[j + left]); +#endif +#ifdef DO_SPEC + COPY_CHAN4(array->spec[j], array->spec[j + left]); +#endif +#ifdef DO_INDEX + array->index[j] = array->index[j + left]; +#endif +#ifdef DO_Z + array->z[j] = array->z[j + left]; +#endif +#ifdef DO_FOG + array->fog[j] = array->fog[j + left]; +#endif +#ifdef DO_TEX + COPY_4V(array->texcoords[0][j], array->texcoords[0][j + left]); +#endif +#if defined(DO_MULTITEX) || defined(DO_TEX) + array->lambda[0][j] = array->lambda[0][j + left]; +#endif + array->coverage[j] = array->coverage[j + left]; + } + } +#ifdef DO_MULTITEX + /* shift texcoords */ + { + struct span_arrays *array = span.array; + GLuint unit; + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { + if (ctx->Texture.Unit[unit]._ReallyEnabled) { + GLint j; + for (j = 0; j < (GLint) n; j++) { + array->texcoords[unit][j][0] = array->texcoords[unit][j + left][0]; + array->texcoords[unit][j][1] = array->texcoords[unit][j + left][1]; + array->texcoords[unit][j][2] = array->texcoords[unit][j + left][2]; + array->lambda[unit][j] = array->lambda[unit][j + left]; + } + } + } + } +#endif + + span.x = left; + span.y = iy; + span.end = n; + ASSERT(span.interpMask == 0); +#if defined(DO_RGBA) + _swrast_write_rgba_span(ctx, &span); +#else + _swrast_write_index_span(ctx, &span); +#endif + } + } +} + + +#ifdef DO_Z +#undef DO_Z +#endif + +#ifdef DO_FOG +#undef DO_FOG +#endif + +#ifdef DO_RGBA +#undef DO_RGBA +#endif + +#ifdef DO_INDEX +#undef DO_INDEX +#endif + +#ifdef DO_SPEC +#undef DO_SPEC +#endif + +#ifdef DO_TEX +#undef DO_TEX +#endif + +#ifdef DO_MULTITEX +#undef DO_MULTITEX +#endif + +#ifdef DO_OCCLUSION_TEST +#undef DO_OCCLUSION_TEST +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_accum.c b/reactos/dll/mesa32/src/swrast/s_accum.c new file mode 100644 index 00000000000..5621d0c8aa9 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_accum.c @@ -0,0 +1,584 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "imports.h" +#include "fbobject.h" + +#include "s_accum.h" +#include "s_context.h" +#include "s_masking.h" +#include "s_span.h" + + +#define ACCUM_SCALE16 32767.0 + + +/* + * Accumulation buffer notes + * + * Normally, accumulation buffer values are GLshorts with values in + * [-32767, 32767] which represent floating point colors in [-1, 1], + * as defined by the OpenGL specification. + * + * We optimize for the common case used for full-scene antialiasing: + * // start with accum buffer cleared to zero + * glAccum(GL_LOAD, w); // or GL_ACCUM the first image + * glAccum(GL_ACCUM, w); + * ... + * glAccum(GL_ACCUM, w); + * glAccum(GL_RETURN, 1.0); + * That is, we start with an empty accumulation buffer and accumulate + * n images, each with weight w = 1/n. + * In this scenario, we can simply store unscaled integer values in + * the accum buffer instead of scaled integers. We'll also keep track + * of the w value so when we do GL_RETURN we simply divide the accumulated + * values by n (n=1/w). + * This lets us avoid _many_ int->float->int conversions. + */ + + +#if CHAN_BITS == 8 && ACCUM_BITS <= 32 +/* enable the optimization */ +#define USE_OPTIMIZED_ACCUM 1 +#else +#define USE_OPTIMIZED_ACCUM 0 +#endif + + +/** + * This is called when we fall out of optimized/unscaled accum buffer mode. + * That is, we convert each unscaled accum buffer value into a scaled value + * representing the range[-1, 1]. + */ +static void +rescale_accum( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + struct gl_renderbuffer *rb + = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer; + const GLfloat s = swrast->_IntegerAccumScaler * (32767.0F / CHAN_MAXF); + + assert(rb); + assert(rb->_BaseFormat == GL_RGBA); + /* add other types in future? */ + assert(rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT); + assert(swrast->_IntegerAccumMode); + + if (rb->GetPointer(ctx, rb, 0, 0)) { + /* directly-addressable memory */ + GLuint y; + for (y = 0; y < rb->Height; y++) { + GLuint i; + GLshort *acc = (GLshort *) rb->GetPointer(ctx, rb, 0, y); + for (i = 0; i < 4 * rb->Width; i++) { + acc[i] = (GLshort) (acc[i] * s); + } + } + } + else { + /* use get/put row funcs */ + GLuint y; + for (y = 0; y < rb->Height; y++) { + GLshort accRow[MAX_WIDTH * 4]; + GLuint i; + rb->GetRow(ctx, rb, rb->Width, 0, y, accRow); + for (i = 0; i < 4 * rb->Width; i++) { + accRow[i] = (GLshort) (accRow[i] * s); + } + rb->PutRow(ctx, rb, rb->Width, 0, y, accRow, NULL); + } + } + + swrast->_IntegerAccumMode = GL_FALSE; +} + + + +/** + * Clear the accumulation Buffer. + */ +void +_swrast_clear_accum_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLuint x, y, width, height; + + if (ctx->Visual.accumRedBits == 0) { + /* No accumulation buffer! Not an error. */ + return; + } + + assert(rb); + assert(rb->_BaseFormat == GL_RGBA); + /* add other types in future? */ + assert(rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT); + + /* bounds, with scissor */ + x = ctx->DrawBuffer->_Xmin; + y = ctx->DrawBuffer->_Ymin; + width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; + height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; + + if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) { + const GLfloat accScale = 32767.0; + GLshort clearVal[4]; + GLuint i; + + clearVal[0] = (GLshort) (ctx->Accum.ClearColor[0] * accScale); + clearVal[1] = (GLshort) (ctx->Accum.ClearColor[1] * accScale); + clearVal[2] = (GLshort) (ctx->Accum.ClearColor[2] * accScale); + clearVal[3] = (GLshort) (ctx->Accum.ClearColor[3] * accScale); + + for (i = 0; i < height; i++) { + rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL); + } + } + else { + /* someday support other sizes */ + } + + /* update optimized accum state vars */ + if (ctx->Accum.ClearColor[0] == 0.0 && ctx->Accum.ClearColor[1] == 0.0 && + ctx->Accum.ClearColor[2] == 0.0 && ctx->Accum.ClearColor[3] == 0.0) { +#if USE_OPTIMIZED_ACCUM + swrast->_IntegerAccumMode = GL_TRUE; +#else + swrast->_IntegerAccumMode = GL_FALSE; +#endif + swrast->_IntegerAccumScaler = 0.0; /* denotes empty accum buffer */ + } + else { + swrast->_IntegerAccumMode = GL_FALSE; + } +} + + +static void +accum_add(GLcontext *ctx, GLfloat value, + GLint xpos, GLint ypos, GLint width, GLint height ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + struct gl_renderbuffer *rb + = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer; + + assert(rb); + + /* Leave optimized accum buffer mode */ + if (swrast->_IntegerAccumMode) + rescale_accum(ctx); + + if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) { + const GLshort incr = (GLshort) (value * ACCUM_SCALE16); + if (rb->GetPointer(ctx, rb, 0, 0)) { + GLint i, j; + for (i = 0; i < height; i++) { + GLshort *acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i); + for (j = 0; j < 4 * width; j++) { + acc[j] += incr; + } + } + } + else { + GLint i, j; + for (i = 0; i < height; i++) { + GLshort accRow[4 * MAX_WIDTH]; + rb->GetRow(ctx, rb, width, xpos, ypos + i, accRow); + for (j = 0; j < 4 * width; j++) { + accRow[j] += incr; + } + rb->PutRow(ctx, rb, width, xpos, ypos + i, accRow, NULL); + } + } + } + else { + /* other types someday */ + } +} + + +static void +accum_mult(GLcontext *ctx, GLfloat mult, + GLint xpos, GLint ypos, GLint width, GLint height ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + struct gl_renderbuffer *rb + = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer; + + assert(rb); + + /* Leave optimized accum buffer mode */ + if (swrast->_IntegerAccumMode) + rescale_accum(ctx); + + if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) { + if (rb->GetPointer(ctx, rb, 0, 0)) { + GLint i, j; + for (i = 0; i < height; i++) { + GLshort *acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i); + for (j = 0; j < 4 * width; j++) { + acc[j] = (GLshort) (acc[j] * mult); + } + } + } + else { + GLint i, j; + for (i = 0; i < height; i++) { + GLshort accRow[4 * MAX_WIDTH]; + rb->GetRow(ctx, rb, width, xpos, ypos + i, accRow); + for (j = 0; j < 4 * width; j++) { + accRow[j] = (GLshort) (accRow[j] * mult); + } + rb->PutRow(ctx, rb, width, xpos, ypos + i, accRow, NULL); + } + } + } + else { + /* other types someday */ + } +} + + + +static void +accum_accum(GLcontext *ctx, GLfloat value, + GLint xpos, GLint ypos, GLint width, GLint height ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + struct gl_renderbuffer *rb + = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer; + const GLboolean directAccess = (rb->GetPointer(ctx, rb, 0, 0) != NULL); + + assert(rb); + + if (!ctx->ReadBuffer->_ColorReadBuffer) { + /* no read buffer - OK */ + return; + } + + /* May have to leave optimized accum buffer mode */ + if (swrast->_IntegerAccumScaler == 0.0 && value > 0.0 && value <= 1.0) + swrast->_IntegerAccumScaler = value; + if (swrast->_IntegerAccumMode && value != swrast->_IntegerAccumScaler) + rescale_accum(ctx); + + _swrast_use_read_buffer(ctx); + + if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) { + const GLfloat scale = value * ACCUM_SCALE16 / CHAN_MAXF; + GLshort accumRow[4 * MAX_WIDTH]; + GLchan rgba[MAX_WIDTH][4]; + GLint i; + + for (i = 0; i < height; i++) { + GLshort *acc; + if (directAccess) { + acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i); + } + else { + rb->GetRow(ctx, rb, width, xpos, ypos + i, accumRow); + acc = accumRow; + } + + /* read colors from color buffer */ + _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer, width, + xpos, ypos + i, rgba); + + /* do accumulation */ + if (swrast->_IntegerAccumMode) { + /* simply add integer color values into accum buffer */ + GLint j; + for (j = 0; j < width; j++) { + acc[j * 4 + 0] += rgba[j][RCOMP]; + acc[j * 4 + 1] += rgba[j][GCOMP]; + acc[j * 4 + 2] += rgba[j][BCOMP]; + acc[j * 4 + 3] += rgba[j][ACOMP]; + } + } + else { + /* scaled integer (or float) accum buffer */ + GLint j; + for (j = 0; j < width; j++) { + acc[j * 4 + 0] += (GLshort) ((GLfloat) rgba[j][RCOMP] * scale); + acc[j * 4 + 1] += (GLshort) ((GLfloat) rgba[j][GCOMP] * scale); + acc[j * 4 + 2] += (GLshort) ((GLfloat) rgba[j][BCOMP] * scale); + acc[j * 4 + 3] += (GLshort) ((GLfloat) rgba[j][ACOMP] * scale); + } + } + + if (!directAccess) { + rb->PutRow(ctx, rb, width, xpos, ypos + i, accumRow, NULL); + } + } + } + else { + /* other types someday */ + } + + _swrast_use_draw_buffer(ctx); +} + + + +static void +accum_load(GLcontext *ctx, GLfloat value, + GLint xpos, GLint ypos, GLint width, GLint height ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + struct gl_renderbuffer *rb + = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer; + const GLboolean directAccess = (rb->GetPointer(ctx, rb, 0, 0) != NULL); + + assert(rb); + + if (!ctx->ReadBuffer->_ColorReadBuffer) { + /* no read buffer - OK */ + return; + } + + /* This is a change to go into optimized accum buffer mode */ + if (value > 0.0 && value <= 1.0) { +#if USE_OPTIMIZED_ACCUM + swrast->_IntegerAccumMode = GL_TRUE; +#else + swrast->_IntegerAccumMode = GL_FALSE; +#endif + swrast->_IntegerAccumScaler = value; + } + else { + swrast->_IntegerAccumMode = GL_FALSE; + swrast->_IntegerAccumScaler = 0.0; + } + + _swrast_use_read_buffer(ctx); + + if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) { + const GLfloat scale = value * ACCUM_SCALE16 / CHAN_MAXF; + GLshort accumRow[4 * MAX_WIDTH]; + GLchan rgba[MAX_WIDTH][4]; + GLint i; + + for (i = 0; i < height; i++) { + GLshort *acc; + if (directAccess) { + acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i); + } + else { + rb->GetRow(ctx, rb, width, xpos, ypos + i, accumRow); + acc = accumRow; + } + + /* read colors from color buffer */ + _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer, width, + xpos, ypos + i, rgba); + + /* do load */ + if (swrast->_IntegerAccumMode) { + /* just copy values in */ + GLint j; + assert(swrast->_IntegerAccumScaler > 0.0); + assert(swrast->_IntegerAccumScaler <= 1.0); + for (j = 0; j < width; j++) { + acc[j * 4 + 0] = rgba[j][RCOMP]; + acc[j * 4 + 1] = rgba[j][GCOMP]; + acc[j * 4 + 2] = rgba[j][BCOMP]; + acc[j * 4 + 3] = rgba[j][ACOMP]; + } + } + else { + /* scaled integer (or float) accum buffer */ + GLint j; + for (j = 0; j < width; j++) { + acc[j * 4 + 0] = (GLshort) ((GLfloat) rgba[j][RCOMP] * scale); + acc[j * 4 + 1] = (GLshort) ((GLfloat) rgba[j][GCOMP] * scale); + acc[j * 4 + 2] = (GLshort) ((GLfloat) rgba[j][BCOMP] * scale); + acc[j * 4 + 3] = (GLshort) ((GLfloat) rgba[j][ACOMP] * scale); + } + } + + if (!directAccess) { + rb->PutRow(ctx, rb, width, xpos, ypos + i, accumRow, NULL); + } + } + } + else { + /* other types someday */ + } + + _swrast_use_draw_buffer(ctx); +} + + +static void +accum_return(GLcontext *ctx, GLfloat value, + GLint xpos, GLint ypos, GLint width, GLint height ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + struct gl_framebuffer *fb = ctx->DrawBuffer; + struct gl_renderbuffer *accumRb = fb->Attachment[BUFFER_ACCUM].Renderbuffer; + const GLboolean directAccess + = (accumRb->GetPointer(ctx, accumRb, 0, 0) != NULL); + const GLboolean masking = (!ctx->Color.ColorMask[RCOMP] || + !ctx->Color.ColorMask[GCOMP] || + !ctx->Color.ColorMask[BCOMP] || + !ctx->Color.ColorMask[ACOMP]); + + static GLchan multTable[32768]; + static GLfloat prevMult = 0.0; + const GLfloat mult = swrast->_IntegerAccumScaler; + const GLint max = MIN2((GLint) (256 / mult), 32767); + + /* May have to leave optimized accum buffer mode */ + if (swrast->_IntegerAccumMode && value != 1.0) + rescale_accum(ctx); + + if (swrast->_IntegerAccumMode && swrast->_IntegerAccumScaler > 0) { + /* build lookup table to avoid many floating point multiplies */ + GLint j; + assert(swrast->_IntegerAccumScaler <= 1.0); + if (mult != prevMult) { + for (j = 0; j < max; j++) + multTable[j] = IROUND((GLfloat) j * mult); + prevMult = mult; + } + } + + if (accumRb->DataType == GL_SHORT || + accumRb->DataType == GL_UNSIGNED_SHORT) { + const GLfloat scale = value * CHAN_MAXF / ACCUM_SCALE16; + GLuint buffer, i; + + /* XXX maybe transpose the 'i' and 'buffer' loops??? */ + for (i = 0; i < height; i++) { + GLchan rgba[MAX_WIDTH][4]; + GLshort accumRow[4 * MAX_WIDTH]; + GLshort *acc; + + if (directAccess) { + acc = (GLshort *) accumRb->GetPointer(ctx, accumRb, xpos, ypos +i); + } + else { + accumRb->GetRow(ctx, accumRb, width, xpos, ypos + i, accumRow); + acc = accumRow; + } + + /* get the colors to return */ + if (swrast->_IntegerAccumMode) { + GLint j; + for (j = 0; j < width; j++) { + ASSERT(acc[j * 4 + 0] < max); + ASSERT(acc[j * 4 + 1] < max); + ASSERT(acc[j * 4 + 2] < max); + ASSERT(acc[j * 4 + 3] < max); + rgba[j][RCOMP] = multTable[acc[j * 4 + 0]]; + rgba[j][GCOMP] = multTable[acc[j * 4 + 1]]; + rgba[j][BCOMP] = multTable[acc[j * 4 + 2]]; + rgba[j][ACOMP] = multTable[acc[j * 4 + 3]]; + } + } + else { + /* scaled integer (or float) accum buffer */ + GLint j; + for (j = 0; j < width; j++) { + GLint r = IROUND( (GLfloat) (acc[j * 4 + 0]) * scale ); + GLint g = IROUND( (GLfloat) (acc[j * 4 + 1]) * scale ); + GLint b = IROUND( (GLfloat) (acc[j * 4 + 2]) * scale ); + GLint a = IROUND( (GLfloat) (acc[j * 4 + 3]) * scale ); + rgba[j][RCOMP] = CLAMP( r, 0, CHAN_MAX ); + rgba[j][GCOMP] = CLAMP( g, 0, CHAN_MAX ); + rgba[j][BCOMP] = CLAMP( b, 0, CHAN_MAX ); + rgba[j][ACOMP] = CLAMP( a, 0, CHAN_MAX ); + } + } + + /* store colors */ + for (buffer = 0; buffer < fb->_NumColorDrawBuffers[0]; buffer++) { + struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[0][buffer]; + if (masking) { + _swrast_mask_rgba_array(ctx, rb, width, xpos, ypos + i, rgba); + } + rb->PutRow(ctx, rb, width, xpos, ypos + i, rgba, NULL); + } + } + } + else { + /* other types someday */ + } +} + + + +/** + * Software fallback for glAccum. + */ +void +_swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value, + GLint xpos, GLint ypos, + GLint width, GLint height ) + +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + if (SWRAST_CONTEXT(ctx)->NewState) + _swrast_validate_derived( ctx ); + + if (!ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer) { + _mesa_warning(ctx, "Calling glAccum() without an accumulation buffer"); + return; + } + + RENDER_START(swrast, ctx); + + switch (op) { + case GL_ADD: + if (value != 0.0F) { + accum_add(ctx, value, xpos, ypos, width, height); + } + break; + case GL_MULT: + if (value != 1.0F) { + accum_mult(ctx, value, xpos, ypos, width, height); + } + break; + case GL_ACCUM: + if (value != 0.0F) { + accum_accum(ctx, value, xpos, ypos, width, height); + } + break; + case GL_LOAD: + accum_load(ctx, value, xpos, ypos, width, height); + break; + case GL_RETURN: + accum_return(ctx, value, xpos, ypos, width, height); + break; + default: + _mesa_problem(ctx, "invalid mode in _swrast_Accum()"); + break; + } + + RENDER_FINISH(swrast, ctx); +} diff --git a/reactos/dll/mesa32/src/swrast/s_accum.h b/reactos/dll/mesa32/src/swrast/s_accum.h new file mode 100644 index 00000000000..97d2bef4c31 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_accum.h @@ -0,0 +1,37 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 S_ACCUM_H +#define S_ACCUM_H + + +#include "mtypes.h" + + +extern void +_swrast_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_alpha.c b/reactos/dll/mesa32/src/swrast/s_alpha.c new file mode 100644 index 00000000000..55c1e6a58f8 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_alpha.c @@ -0,0 +1,224 @@ + +/* + * 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. + */ + +/** + * \file swrast/s_alpha.c + * \brief Functions to apply alpha test. + */ + +#include "glheader.h" +#include "context.h" +#include "colormac.h" +#include "macros.h" + +#include "s_alpha.h" +#include "s_context.h" + + +/** + * \fn GLint _swrast_alpha_test( const GLcontext *ctx, struct sw_span *span ) + * \brief Apply the alpha test to a span of pixels. + * \return + * - "0" = all pixels in the span failed the alpha test. + * - "1" = one or more pixels passed the alpha test. + */ +GLint +_swrast_alpha_test( const GLcontext *ctx, struct sw_span *span ) +{ + const GLchan (*rgba)[4] = (const GLchan (*)[4]) span->array->rgba; + GLchan ref; + const GLuint n = span->end; + GLubyte *mask = span->array->mask; + GLuint i; + + CLAMPED_FLOAT_TO_CHAN(ref, ctx->Color.AlphaRef); + + if (span->arrayMask & SPAN_RGBA) { + /* Use the array values */ + switch (ctx->Color.AlphaFunc) { + case GL_LESS: + for (i = 0; i < n; i++) + mask[i] &= (rgba[i][ACOMP] < ref); + break; + case GL_LEQUAL: + for (i = 0; i < n; i++) + mask[i] &= (rgba[i][ACOMP] <= ref); + break; + case GL_GEQUAL: + for (i = 0; i < n; i++) + mask[i] &= (rgba[i][ACOMP] >= ref); + break; + case GL_GREATER: + for (i = 0; i < n; i++) + mask[i] &= (rgba[i][ACOMP] > ref); + break; + case GL_NOTEQUAL: + for (i = 0; i < n; i++) + mask[i] &= (rgba[i][ACOMP] != ref); + break; + case GL_EQUAL: + for (i = 0; i < n; i++) + mask[i] &= (rgba[i][ACOMP] == ref); + break; + case GL_ALWAYS: + /* do nothing */ + return 1; + case GL_NEVER: + /* caller should check for zero! */ + span->writeAll = GL_FALSE; + return 0; + default: + _mesa_problem( ctx, "Invalid alpha test in _swrast_alpha_test" ); + return 0; + } + } + else { + /* Use the interpolation values */ +#if CHAN_TYPE == GL_FLOAT + const GLfloat alphaStep = span->alphaStep; + GLfloat alpha = span->alpha; + ASSERT(span->interpMask & SPAN_RGBA); + switch (ctx->Color.AlphaFunc) { + case GL_LESS: + for (i = 0; i < n; i++) { + mask[i] &= (alpha < ref); + alpha += alphaStep; + } + break; + case GL_LEQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (alpha <= ref); + alpha += alphaStep; + } + break; + case GL_GEQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (alpha >= ref); + alpha += alphaStep; + } + break; + case GL_GREATER: + for (i = 0; i < n; i++) { + mask[i] &= (alpha > ref); + alpha += alphaStep; + } + break; + case GL_NOTEQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (alpha != ref); + alpha += alphaStep; + } + break; + case GL_EQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (alpha == ref); + alpha += alphaStep; + } + break; + case GL_ALWAYS: + /* do nothing */ + return 1; + case GL_NEVER: + /* caller should check for zero! */ + span->writeAll = GL_FALSE; + return 0; + default: + _mesa_problem( ctx, "Invalid alpha test in gl_alpha_test" ); + return 0; + } +#else + /* 8 or 16-bit channel interpolation */ + const GLfixed alphaStep = span->alphaStep; + GLfixed alpha = span->alpha; + ASSERT(span->interpMask & SPAN_RGBA); + switch (ctx->Color.AlphaFunc) { + case GL_LESS: + for (i = 0; i < n; i++) { + mask[i] &= (FixedToChan(alpha) < ref); + alpha += alphaStep; + } + break; + case GL_LEQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (FixedToChan(alpha) <= ref); + alpha += alphaStep; + } + break; + case GL_GEQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (FixedToChan(alpha) >= ref); + alpha += alphaStep; + } + break; + case GL_GREATER: + for (i = 0; i < n; i++) { + mask[i] &= (FixedToChan(alpha) > ref); + alpha += alphaStep; + } + break; + case GL_NOTEQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (FixedToChan(alpha) != ref); + alpha += alphaStep; + } + break; + case GL_EQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (FixedToChan(alpha) == ref); + alpha += alphaStep; + } + break; + case GL_ALWAYS: + /* do nothing */ + return 1; + case GL_NEVER: + /* caller should check for zero! */ + span->writeAll = GL_FALSE; + return 0; + default: + _mesa_problem( ctx, "Invalid alpha test in gl_alpha_test" ); + return 0; + } +#endif /* CHAN_TYPE */ + } + +#if 0 + /* XXXX This causes conformance failures!!!! */ + while ((span->start <= span->end) && + (mask[span->start] == 0)) + span->start ++; + + while ((span->end >= span->start) && + (mask[span->end] == 0)) + span->end --; +#endif + + span->writeAll = GL_FALSE; + + if (span->start >= span->end) + return 0; + else + return 1; +} diff --git a/reactos/dll/mesa32/src/swrast/s_alpha.h b/reactos/dll/mesa32/src/swrast/s_alpha.h new file mode 100644 index 00000000000..add0f74c453 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_alpha.h @@ -0,0 +1,39 @@ + +/* + * 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 S_ALPHA_H +#define S_ALPHA_H + + +#include "mtypes.h" +#include "s_context.h" + + +extern GLint +_swrast_alpha_test( const GLcontext *ctx, struct sw_span *span ); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_atifragshader.c b/reactos/dll/mesa32/src/swrast/s_atifragshader.c new file mode 100644 index 00000000000..d137b17d210 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_atifragshader.c @@ -0,0 +1,625 @@ +/* + * + * Copyright (C) 2004 David Airlie 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 + * DAVID AIRLIE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION 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 "colormac.h" +#include "context.h" +#include "atifragshader.h" +#include "macros.h" +#include "program.h" + +#include "s_atifragshader.h" +#include "s_nvfragprog.h" +#include "s_span.h" +#include "s_texture.h" + +/** + * Fetch a texel. + */ +static void +fetch_texel(GLcontext * ctx, const GLfloat texcoord[4], GLfloat lambda, + GLuint unit, GLfloat color[4]) +{ + GLchan rgba[4]; + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + /* XXX use a float-valued TextureSample routine here!!! */ + swrast->TextureSample[unit] (ctx, unit, ctx->Texture.Unit[unit]._Current, + 1, (const GLfloat(*)[4]) texcoord, + &lambda, &rgba); + color[0] = CHAN_TO_FLOAT(rgba[0]); + color[1] = CHAN_TO_FLOAT(rgba[1]); + color[2] = CHAN_TO_FLOAT(rgba[2]); + color[3] = CHAN_TO_FLOAT(rgba[3]); +} + +static void +apply_swizzle(struct atifs_machine *machine, GLuint reg, GLuint swizzle) +{ + GLfloat s, t, r, q; + + s = machine->Registers[reg][0]; + t = machine->Registers[reg][1]; + r = machine->Registers[reg][2]; + q = machine->Registers[reg][3]; + + switch (swizzle) { + case GL_SWIZZLE_STR_ATI: + machine->Registers[reg][0] = s; + machine->Registers[reg][1] = t; + machine->Registers[reg][2] = r; + break; + case GL_SWIZZLE_STQ_ATI: + machine->Registers[reg][0] = s; + machine->Registers[reg][1] = t; + machine->Registers[reg][2] = q; + break; + case GL_SWIZZLE_STR_DR_ATI: + machine->Registers[reg][0] = s / r; + machine->Registers[reg][1] = t / r; + machine->Registers[reg][2] = 1 / r; + break; + case GL_SWIZZLE_STQ_DQ_ATI: + machine->Registers[reg][0] = s / q; + machine->Registers[reg][1] = t / q; + machine->Registers[reg][2] = 1 / q; + break; + } + machine->Registers[reg][3] = 0.0; +} + +static void +apply_src_rep(GLint optype, GLuint rep, GLfloat * val) +{ + GLint i; + GLint start, end; + if (!rep) + return; + + start = optype ? 3 : 0; + end = optype ? 4 : 3; + + for (i = start; i < end; i++) { + switch (rep) { + case GL_RED: + val[i] = val[0]; + break; + case GL_GREEN: + val[i] = val[1]; + break; + case GL_BLUE: + val[i] = val[2]; + break; + case GL_ALPHA: + val[i] = val[3]; + break; + } + } +} + +static void +apply_src_mod(GLint optype, GLuint mod, GLfloat * val) +{ + GLint i; + GLint start, end; + + if (!mod) + return; + + start = optype ? 3 : 0; + end = optype ? 4 : 3; + + for (i = start; i < end; i++) { + if (mod & GL_COMP_BIT_ATI) + val[i] = 1 - val[i]; + + if (mod & GL_BIAS_BIT_ATI) + val[i] = val[i] - 0.5; + + if (mod & GL_2X_BIT_ATI) + val[i] = 2 * val[i]; + + if (mod & GL_NEGATE_BIT_ATI) + val[i] = -val[i]; + } +} + +static void +apply_dst_mod(GLuint optype, GLuint mod, GLfloat * val) +{ + GLint i; + GLint has_sat = mod & GL_SATURATE_BIT_ATI; + GLint start, end; + + mod &= ~GL_SATURATE_BIT_ATI; + + start = optype ? 3 : 0; + end = optype ? 4 : 3; + + for (i = start; i < end; i++) { + switch (mod) { + case GL_2X_BIT_ATI: + val[i] = 2 * val[i]; + break; + case GL_4X_BIT_ATI: + val[i] = 4 * val[i]; + break; + case GL_8X_BIT_ATI: + val[i] = 8 * val[i]; + break; + case GL_HALF_BIT_ATI: + val[i] = val[i] * 0.5; + break; + case GL_QUARTER_BIT_ATI: + val[i] = val[i] * 0.25; + break; + case GL_EIGHTH_BIT_ATI: + val[i] = val[i] * 0.125; + break; + } + + if (has_sat) { + if (val[i] < 0.0) + val[i] = 0; + else if (val[i] > 1.0) + val[i] = 1.0; + } + else { + if (val[i] < -8.0) + val[i] = -8.0; + else if (val[i] > 8.0) + val[i] = 8.0; + } + } +} + + +static void +write_dst_addr(GLuint optype, GLuint mod, GLuint mask, GLfloat * src, + GLfloat * dst) +{ + GLint i; + apply_dst_mod(optype, mod, src); + + if (optype == ATI_FRAGMENT_SHADER_COLOR_OP) { + if (mask) { + if (mask & GL_RED_BIT_ATI) + dst[0] = src[0]; + + if (mask & GL_GREEN_BIT_ATI) + dst[1] = src[1]; + + if (mask & GL_BLUE_BIT_ATI) + dst[2] = src[2]; + } + else { + for (i = 0; i < 3; i++) + dst[i] = src[i]; + } + } + else + dst[3] = src[3]; +} + +static void +finish_pass(struct atifs_machine *machine) +{ + GLint i; + + for (i = 0; i < 6; i++) { + COPY_4V(machine->PrevPassRegisters[i], machine->Registers[i]); + } +} + +/** + * Execute the given fragment shader + * NOTE: we do everything in single-precision floating point; we don't + * currently observe the single/half/fixed-precision qualifiers. + * \param ctx - rendering context + * \param program - the fragment program to execute + * \param machine - machine state (register file) + * \param maxInst - max number of instructions to execute + * \return GL_TRUE if program completed or GL_FALSE if program executed KIL. + */ + +struct ati_fs_opcode_st ati_fs_opcodes[] = { + {GL_ADD_ATI, 2}, + {GL_SUB_ATI, 2}, + {GL_MUL_ATI, 2}, + {GL_MAD_ATI, 3}, + {GL_LERP_ATI, 3}, + {GL_MOV_ATI, 1}, + {GL_CND_ATI, 3}, + {GL_CND0_ATI, 3}, + {GL_DOT2_ADD_ATI, 3}, + {GL_DOT3_ATI, 2}, + {GL_DOT4_ATI, 2} +}; + + + +static void +handle_pass_op(struct atifs_machine *machine, struct atifs_instruction *inst, + const struct sw_span *span, GLuint column) +{ + GLuint idx = inst->DstReg[0].Index - GL_REG_0_ATI; + GLuint swizzle = inst->DstReg[0].Swizzle; + GLuint pass_tex = inst->SrcReg[0][0].Index; + + /* if we get here after passing pass one then we are starting pass two - backup the registers */ + if (machine->pass == 1) { + finish_pass(machine); + machine->pass = 2; + } + if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) { + pass_tex -= GL_TEXTURE0_ARB; + COPY_4V(machine->Registers[idx], + span->array->texcoords[pass_tex][column]); + } + else if (pass_tex >= GL_REG_0_ATI && pass_tex <= GL_REG_5_ATI + && machine->pass == 2) { + pass_tex -= GL_REG_0_ATI; + COPY_4V(machine->Registers[idx], machine->PrevPassRegisters[pass_tex]); + } + apply_swizzle(machine, idx, swizzle); + +} + +static void +handle_sample_op(GLcontext * ctx, struct atifs_machine *machine, + struct atifs_instruction *inst, const struct sw_span *span, + GLuint column) +{ + GLuint idx = inst->DstReg[0].Index - GL_REG_0_ATI; + GLuint swizzle = inst->DstReg[0].Swizzle; + GLuint sample_tex = inst->SrcReg[0][0].Index; + + /* if we get here after passing pass one then we are starting pass two - backup the registers */ + if (machine->pass == 1) { + finish_pass(machine); + machine->pass = 2; + } + + if (sample_tex >= GL_TEXTURE0_ARB && sample_tex <= GL_TEXTURE7_ARB) { + sample_tex -= GL_TEXTURE0_ARB; + fetch_texel(ctx, span->array->texcoords[sample_tex][column], 0.0F, + sample_tex, machine->Registers[idx]); + } + else if (sample_tex >= GL_REG_0_ATI && sample_tex <= GL_REG_5_ATI) { + /* this is wrong... */ + sample_tex -= GL_REG_0_ATI; + fetch_texel(ctx, machine->Registers[sample_tex], 0, sample_tex, + machine->Registers[idx]); + } + + apply_swizzle(machine, idx, swizzle); +} + +#define SETUP_SRC_REG(optype, i, x) do { \ + if (optype) \ + src[optype][i][3] = x[3]; \ + else \ + COPY_3V(src[optype][i], x); \ + } while (0) + +static GLboolean +execute_shader(GLcontext * ctx, + const struct ati_fragment_shader *shader, GLuint maxInst, + struct atifs_machine *machine, const struct sw_span *span, + GLuint column) +{ + GLuint pc; + struct atifs_instruction *inst; + GLint optype; + GLint i; + GLint dstreg; + GLfloat src[2][3][4]; + GLfloat zeros[4] = { 0.0, 0.0, 0.0, 0.0 }; + GLfloat ones[4] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat dst[2][4], *dstp; + + for (pc = 0; pc < shader->Base.NumInstructions; pc++) { + inst = &shader->Instructions[pc]; + + if (inst->Opcode[0] == ATI_FRAGMENT_SHADER_PASS_OP) + handle_pass_op(machine, inst, span, column); + else if (inst->Opcode[0] == ATI_FRAGMENT_SHADER_SAMPLE_OP) + handle_sample_op(ctx, machine, inst, span, column); + else { + if (machine->pass == 0) + machine->pass = 1; + + /* setup the source registers for color and alpha ops */ + for (optype = 0; optype < 2; optype++) { + for (i = 0; i < inst->ArgCount[optype]; i++) { + GLint index = inst->SrcReg[optype][i].Index; + + if (index >= GL_REG_0_ATI && index <= GL_REG_5_ATI) + SETUP_SRC_REG(optype, i, + machine->Registers[index - GL_REG_0_ATI]); + else if (index >= GL_CON_0_ATI && index <= GL_CON_7_ATI) + SETUP_SRC_REG(optype, i, + shader->Constants[index - GL_CON_0_ATI]); + else if (index == GL_ONE) + SETUP_SRC_REG(optype, i, ones); + else if (index == GL_ZERO) + SETUP_SRC_REG(optype, i, zeros); + else if (index == GL_PRIMARY_COLOR_EXT) + SETUP_SRC_REG(optype, i, + machine->Inputs[ATI_FS_INPUT_PRIMARY]); + else if (index == GL_SECONDARY_INTERPOLATOR_ATI) + SETUP_SRC_REG(optype, i, + machine->Inputs[ATI_FS_INPUT_SECONDARY]); + + apply_src_rep(optype, inst->SrcReg[optype][i].argRep, + src[optype][i]); + apply_src_mod(optype, inst->SrcReg[optype][i].argMod, + src[optype][i]); + } + } + + /* Execute the operations - color then alpha */ + for (optype = 0; optype < 2; optype++) { + if (inst->Opcode[optype]) { + switch (inst->Opcode[optype]) { + case GL_ADD_ATI: + if (!optype) + for (i = 0; i < 3; i++) { + dst[optype][i] = + src[optype][0][i] + src[optype][1][i]; + } + else + dst[optype][3] = src[optype][0][3] + src[optype][1][3]; + break; + case GL_SUB_ATI: + if (!optype) + for (i = 0; i < 3; i++) { + dst[optype][i] = + src[optype][0][i] - src[optype][1][i]; + } + else + dst[optype][3] = src[optype][0][3] - src[optype][1][3]; + break; + case GL_MUL_ATI: + if (!optype) + for (i = 0; i < 3; i++) { + dst[optype][i] = + src[optype][0][i] * src[optype][1][i]; + } + else + dst[optype][3] = src[optype][0][3] * src[optype][1][3]; + break; + case GL_MAD_ATI: + if (!optype) + for (i = 0; i < 3; i++) { + dst[optype][i] = + src[optype][0][i] * src[optype][1][i] + + src[optype][2][i]; + } + else + dst[optype][3] = + src[optype][0][3] * src[optype][1][3] + + src[optype][2][3]; + break; + case GL_LERP_ATI: + if (!optype) + for (i = 0; i < 3; i++) { + dst[optype][i] = + src[optype][0][i] * src[optype][1][i] + (1 - + src + [optype] + [0][i]) * + src[optype][2][i]; + } + else + dst[optype][3] = + src[optype][0][3] * src[optype][1][3] + (1 - + src[optype] + [0][3]) * + src[optype][2][3]; + break; + + case GL_MOV_ATI: + if (!optype) + for (i = 0; i < 3; i++) { + dst[optype][i] = src[optype][0][i]; + } + else + dst[optype][3] = src[optype][0][3]; + break; + case GL_CND_ATI: + if (!optype) { + for (i = 0; i < 3; i++) { + dst[optype][i] = + (src[optype][2][i] > + 0.5) ? src[optype][0][i] : src[optype][1][i]; + } + } + else { + dst[optype][3] = + (src[optype][2][3] > + 0.5) ? src[optype][0][3] : src[optype][1][3]; + } + break; + + case GL_CND0_ATI: + if (!optype) + for (i = 0; i < 3; i++) { + dst[optype][i] = + (src[optype][2][i] >= + 0) ? src[optype][0][i] : src[optype][1][i]; + } + else { + dst[optype][3] = + (src[optype][2][3] >= + 0) ? src[optype][0][3] : src[optype][1][3]; + } + break; + case GL_DOT2_ADD_ATI: + { + GLfloat result; + + /* DOT 2 always uses the source from the color op */ + result = src[0][0][0] * src[0][1][0] + + src[0][0][1] * src[0][1][1] + src[0][2][2]; + if (!optype) { + for (i = 0; i < 3; i++) { + dst[optype][i] = result; + } + } + else + dst[optype][3] = result; + + } + break; + case GL_DOT3_ATI: + { + GLfloat result; + + /* DOT 3 always uses the source from the color op */ + result = src[0][0][0] * src[0][1][0] + + src[0][0][1] * src[0][1][1] + + src[0][0][2] * src[0][1][2]; + + if (!optype) { + for (i = 0; i < 3; i++) { + dst[optype][i] = result; + } + } + else + dst[optype][3] = result; + } + break; + case GL_DOT4_ATI: + { + GLfloat result; + + /* DOT 4 always uses the source from the color op */ + result = src[optype][0][0] * src[0][1][0] + + src[0][0][1] * src[0][1][1] + + src[0][0][2] * src[0][1][2] + + src[0][0][3] * src[0][1][3]; + if (!optype) { + for (i = 0; i < 3; i++) { + dst[optype][i] = result; + } + } + else + dst[optype][3] = result; + } + break; + + } + } + } + + /* write out the destination registers */ + for (optype = 0; optype < 2; optype++) { + if (inst->Opcode[optype]) { + dstreg = inst->DstReg[optype].Index; + dstp = machine->Registers[dstreg - GL_REG_0_ATI]; + + write_dst_addr(optype, inst->DstReg[optype].dstMod, + inst->DstReg[optype].dstMask, dst[optype], + dstp); + } + } + } + } + return GL_TRUE; +} + +static void +init_machine(GLcontext * ctx, struct atifs_machine *machine, + const struct ati_fragment_shader *shader, + const struct sw_span *span, GLuint col) +{ + GLint i, j; + + for (i = 0; i < 6; i++) { + for (j = 0; j < 4; j++) + ctx->ATIFragmentShader.Machine.Registers[i][j] = 0.0; + + } + + ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_PRIMARY][0] = + CHAN_TO_FLOAT(span->array->rgba[col][0]); + ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_PRIMARY][1] = + CHAN_TO_FLOAT(span->array->rgba[col][1]); + ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_PRIMARY][2] = + CHAN_TO_FLOAT(span->array->rgba[col][2]); + ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_PRIMARY][3] = + CHAN_TO_FLOAT(span->array->rgba[col][3]); + + ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_SECONDARY][0] = + CHAN_TO_FLOAT(span->array->spec[col][0]); + ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_SECONDARY][1] = + CHAN_TO_FLOAT(span->array->spec[col][1]); + ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_SECONDARY][2] = + CHAN_TO_FLOAT(span->array->spec[col][2]); + ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_SECONDARY][3] = + CHAN_TO_FLOAT(span->array->spec[col][3]); + + ctx->ATIFragmentShader.Machine.pass = 0; +} + + + +/** + * Execute the current fragment program, operating on the given span. + */ +void +_swrast_exec_fragment_shader(GLcontext * ctx, struct sw_span *span) +{ + const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current; + GLuint i; + + ctx->_CurrentProgram = GL_FRAGMENT_SHADER_ATI; + + for (i = 0; i < span->end; i++) { + if (span->array->mask[i]) { + init_machine(ctx, &ctx->ATIFragmentShader.Machine, + ctx->ATIFragmentShader.Current, span, i); + + if (execute_shader(ctx, shader, ~0, + &ctx->ATIFragmentShader.Machine, span, i)) { + span->array->mask[i] = GL_FALSE; + } + + { + const GLfloat *colOut = + ctx->ATIFragmentShader.Machine.Registers[0]; + + /*fprintf(stderr,"outputs %f %f %f %f\n", colOut[0], colOut[1], colOut[2], colOut[3]); */ + UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][RCOMP], colOut[0]); + UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][GCOMP], colOut[1]); + UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][BCOMP], colOut[2]); + UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][ACOMP], colOut[3]); + } + } + + } + + + ctx->_CurrentProgram = 0; + +} diff --git a/reactos/dll/mesa32/src/swrast/s_atifragshader.h b/reactos/dll/mesa32/src/swrast/s_atifragshader.h new file mode 100644 index 00000000000..269be1f2e47 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_atifragshader.h @@ -0,0 +1,37 @@ +/* + * Mesa 3-D graphics library + * Version: 6.1 + * + * Copyright (C) 1999-2003 David Airlie 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 + * DAVID AIRLIE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION 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 S_ATIFRAGSHADER_H +#define S_ATIFRAGSHADER_H + + +#include "s_context.h" + + +extern void +_swrast_exec_fragment_shader( GLcontext *ctx, struct sw_span *span ); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_bitmap.c b/reactos/dll/mesa32/src/swrast/s_bitmap.c new file mode 100644 index 00000000000..84f0864ae8e --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_bitmap.c @@ -0,0 +1,282 @@ +/* + * 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. + */ + +/** + * \file swrast/s_bitmap.c + * \brief glBitmap rendering. + * \author Brian Paul + */ + +#include "glheader.h" +#include "bufferobj.h" +#include "image.h" +#include "macros.h" +#include "pixel.h" + +#include "s_context.h" +#include "s_span.h" + + + +/* + * Render a bitmap. + */ +void +_swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLint row, col; + GLuint count = 0; + struct sw_span span; + + ASSERT(ctx->RenderMode == GL_RENDER); + + if (unpack->BufferObj->Name) { + /* unpack from PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, + GL_COLOR_INDEX, GL_BITMAP, + (GLvoid *) bitmap)) { + _mesa_error(ctx, GL_INVALID_OPERATION,"glBitmap(invalid PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, + unpack->BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); + return; + } + bitmap = ADD_POINTERS(buf, bitmap); + } + + RENDER_START(swrast,ctx); + + if (SWRAST_CONTEXT(ctx)->NewState) + _swrast_validate_derived( ctx ); + + INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_XY); + + if (ctx->Visual.rgbMode) { + span.interpMask |= SPAN_RGBA; + span.red = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF); + span.green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF); + span.blue = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF); + span.alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF); + span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0; + } + else { + span.interpMask |= SPAN_INDEX; + span.index = FloatToFixed(ctx->Current.RasterIndex); + span.indexStep = 0; + } + + if (ctx->Depth.Test) + _swrast_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _swrast_span_default_fog(ctx, &span); + if (ctx->Texture._EnabledCoordUnits) + _swrast_span_default_texcoords(ctx, &span); + + for (row = 0; row < height; row++) { + const GLubyte *src = (const GLubyte *) _mesa_image_address2d(unpack, + bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, row, 0); + + if (unpack->LsbFirst) { + /* Lsb first */ + GLubyte mask = 1U << (unpack->SkipPixels & 0x7); + for (col = 0; col < width; col++) { + if (*src & mask) { + span.array->x[count] = px + col; + span.array->y[count] = py + row; + count++; + } + if (mask == 128U) { + src++; + mask = 1U; + } + else { + mask = mask << 1; + } + } + + /* get ready for next row */ + if (mask != 1) + src++; + } + else { + /* Msb first */ + GLubyte mask = 128U >> (unpack->SkipPixels & 0x7); + for (col = 0; col < width; col++) { + if (*src & mask) { + span.array->x[count] = px + col; + span.array->y[count] = py + row; + count++; + } + if (mask == 1U) { + src++; + mask = 128U; + } + else { + mask = mask >> 1; + } + } + + /* get ready for next row */ + if (mask != 128) + src++; + } + + if (count + width >= MAX_WIDTH || row + 1 == height) { + /* flush the span */ + span.end = count; + if (ctx->Visual.rgbMode) + _swrast_write_rgba_span(ctx, &span); + else + _swrast_write_index_span(ctx, &span); + span.end = 0; + count = 0; + } + } + + RENDER_FINISH(swrast,ctx); + + if (unpack->BufferObj->Name) { + /* done with PBO so unmap it now */ + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + unpack->BufferObj); + } +} + + +#if 0 +/* + * XXX this is another way to implement Bitmap. Use horizontal runs of + * fragments, initializing the mask array to indicate which fragmens to + * draw or skip. + */ +void +_swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLint row, col; + struct sw_span span; + + ASSERT(ctx->RenderMode == GL_RENDER); + ASSERT(bitmap); + + RENDER_START(swrast,ctx); + + if (SWRAST_CONTEXT(ctx)->NewState) + _swrast_validate_derived( ctx ); + + INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_MASK); + + /*span.arrayMask |= SPAN_MASK;*/ /* we'll init span.mask[] */ + span.x = px; + span.y = py; + /*span.end = width;*/ + if (ctx->Visual.rgbMode) { + span.interpMask |= SPAN_RGBA; + span.red = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF); + span.green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF); + span.blue = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF); + span.alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF); + span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0; + } + else { + span.interpMask |= SPAN_INDEX; + span.index = FloatToFixed(ctx->Current.RasterIndex); + span.indexStep = 0; + } + + if (ctx->Depth.Test) + _swrast_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _swrast_span_default_fog(ctx, &span); + if (ctx->Texture._EnabledCoordUnits) + _swrast_span_default_texcoords(ctx, &span); + + for (row=0; rowLsbFirst) { + /* Lsb first */ + GLubyte mask = 1U << (unpack->SkipPixels & 0x7); + for (col=0; colmask[col] = (*src & mask) ? GL_TRUE : GL_FALSE; + if (mask == 128U) { + src++; + mask = 1U; + } + else { + mask = mask << 1; + } + } + + if (ctx->Visual.rgbMode) + _swrast_write_rgba_span(ctx, &span); + else + _swrast_write_index_span(ctx, &span); + + /* get ready for next row */ + if (mask != 1) + src++; + } + else { + /* Msb first */ + GLubyte mask = 128U >> (unpack->SkipPixels & 0x7); + for (col=0; colmask[col] = (*src & mask) ? GL_TRUE : GL_FALSE; + if (mask == 1U) { + src++; + mask = 128U; + } + else { + mask = mask >> 1; + } + } + + if (ctx->Visual.rgbMode) + _swrast_write_rgba_span(ctx, &span); + else + _swrast_write_index_span(ctx, &span); + + /* get ready for next row */ + if (mask != 128) + src++; + } + } + + RENDER_FINISH(swrast,ctx); +} +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_blend.c b/reactos/dll/mesa32/src/swrast/s_blend.c new file mode 100644 index 00000000000..d94ff3923cf --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_blend.c @@ -0,0 +1,872 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + +/* + * Regarding GL_NV_blend_square: + * + * 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 "glheader.h" +#include "context.h" +#include "colormac.h" +#include "macros.h" + +#include "s_blend.h" +#include "s_context.h" +#include "s_span.h" + + +#if defined(USE_MMX_ASM) +#include "x86/mmx.h" +#include "x86/common_x86_asm.h" +#define _BLENDAPI _ASMAPI +#else +#define _BLENDAPI +#endif + + +/* + * Special case for glBlendFunc(GL_ZERO, GL_ONE) + */ +static void _BLENDAPI +blend_noop( GLcontext *ctx, GLuint n, const GLubyte mask[], + GLchan rgba[][4], CONST GLchan dest[][4] ) +{ + GLuint i; + ASSERT(ctx->Color.BlendEquationRGB==GL_FUNC_ADD); + ASSERT(ctx->Color.BlendEquationA==GL_FUNC_ADD); + ASSERT(ctx->Color.BlendSrcRGB==GL_ZERO); + ASSERT(ctx->Color.BlendDstRGB==GL_ONE); + (void) ctx; + + for (i = 0; i < n; i++) { + if (mask[i]) { + COPY_CHAN4( rgba[i], dest[i] ); + } + } +} + + +/* + * Special case for glBlendFunc(GL_ONE, GL_ZERO) + */ +static void _BLENDAPI +blend_replace( GLcontext *ctx, GLuint n, const GLubyte mask[], + GLchan rgba[][4], CONST GLchan dest[][4] ) +{ + ASSERT(ctx->Color.BlendEquationRGB==GL_FUNC_ADD); + ASSERT(ctx->Color.BlendEquationA==GL_FUNC_ADD); + ASSERT(ctx->Color.BlendSrcRGB==GL_ONE); + ASSERT(ctx->Color.BlendDstRGB==GL_ZERO); + (void) ctx; + (void) n; + (void) mask; + (void) rgba; + (void) dest; +} + + +/* + * Common transparency blending mode. + */ +static void _BLENDAPI +blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[], + GLchan rgba[][4], CONST GLchan dest[][4] ) +{ + GLuint i; + ASSERT(ctx->Color.BlendEquationRGB==GL_FUNC_ADD); + ASSERT(ctx->Color.BlendEquationA==GL_FUNC_ADD); + ASSERT(ctx->Color.BlendSrcRGB==GL_SRC_ALPHA); + ASSERT(ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA); + (void) ctx; + + for (i=0;i> 8; + const GLint g = (rgba[i][GCOMP] * t + dest[i][GCOMP] * s + 1) >> 8; + const GLint b = (rgba[i][BCOMP] * t + dest[i][BCOMP] * s + 1) >> 8; + const GLint a = (rgba[i][ACOMP] * t + dest[i][ACOMP] * s + 1) >> 8; +#elif 0 + /* This is slower but satisfies Glean */ + const GLint s = CHAN_MAX - t; + const GLint r = (rgba[i][RCOMP] * t + dest[i][RCOMP] * s) / 255; + const GLint g = (rgba[i][GCOMP] * t + dest[i][GCOMP] * s) / 255; + const GLint b = (rgba[i][BCOMP] * t + dest[i][BCOMP] * s) / 255; + const GLint a = (rgba[i][ACOMP] * t + dest[i][ACOMP] * s) / 255; +#else +#if CHAN_BITS == 8 + /* This satisfies Glean and should be reasonably fast */ + /* Contributed by Nathan Hand */ +#if 0 +#define DIV255(X) (((X) << 8) + (X) + 256) >> 16 +#else + GLint temp; +#define DIV255(X) (temp = (X), ((temp << 8) + temp + 256) >> 16) +#endif + const GLint r = DIV255((rgba[i][RCOMP] - dest[i][RCOMP]) * t) + dest[i][RCOMP]; + const GLint g = DIV255((rgba[i][GCOMP] - dest[i][GCOMP]) * t) + dest[i][GCOMP]; + const GLint b = DIV255((rgba[i][BCOMP] - dest[i][BCOMP]) * t) + dest[i][BCOMP]; + const GLint a = DIV255((rgba[i][ACOMP] - dest[i][ACOMP]) * t) + dest[i][ACOMP]; + +#undef DIV255 +#elif CHAN_BITS == 16 + const GLfloat tt = (GLfloat) t / CHAN_MAXF; + const GLint r = (GLint) ((rgba[i][RCOMP] - dest[i][RCOMP]) * tt + dest[i][RCOMP]); + const GLint g = (GLint) ((rgba[i][GCOMP] - dest[i][GCOMP]) * tt + dest[i][GCOMP]); + const GLint b = (GLint) ((rgba[i][BCOMP] - dest[i][BCOMP]) * tt + dest[i][BCOMP]); + const GLint a = (GLint) ((rgba[i][ACOMP] - dest[i][ACOMP]) * tt + dest[i][ACOMP]); +#else /* CHAN_BITS == 32 */ + const GLfloat tt = (GLfloat) t / CHAN_MAXF; + const GLfloat r = (rgba[i][RCOMP] - dest[i][RCOMP]) * tt + dest[i][RCOMP]; + const GLfloat g = (rgba[i][GCOMP] - dest[i][GCOMP]) * tt + dest[i][GCOMP]; + const GLfloat b = (rgba[i][BCOMP] - dest[i][BCOMP]) * tt + dest[i][BCOMP]; + const GLfloat a = CLAMP( rgba[i][ACOMP], 0.0F, CHAN_MAXF ) * t + + CLAMP( dest[i][ACOMP], 0.0F, CHAN_MAXF ) * (1.0F - t); +#endif +#endif + ASSERT(r <= CHAN_MAX); + ASSERT(g <= CHAN_MAX); + ASSERT(b <= CHAN_MAX); + ASSERT(a <= CHAN_MAX); + rgba[i][RCOMP] = (GLchan) r; + rgba[i][GCOMP] = (GLchan) g; + rgba[i][BCOMP] = (GLchan) b; + rgba[i][ACOMP] = (GLchan) a; + } + } + } +} + + + +/* + * Add src and dest. + */ +static void _BLENDAPI +blend_add( GLcontext *ctx, GLuint n, const GLubyte mask[], + GLchan rgba[][4], CONST GLchan dest[][4] ) +{ + GLuint i; + ASSERT(ctx->Color.BlendEquationRGB==GL_FUNC_ADD); + ASSERT(ctx->Color.BlendEquationA==GL_FUNC_ADD); + ASSERT(ctx->Color.BlendSrcRGB==GL_ONE); + ASSERT(ctx->Color.BlendDstRGB==GL_ONE); + (void) ctx; + + for (i=0;iColor.BlendEquationRGB==GL_MIN); + ASSERT(ctx->Color.BlendEquationA==GL_MIN); + (void) ctx; + + for (i=0;iColor.BlendEquationRGB==GL_MAX); + ASSERT(ctx->Color.BlendEquationA==GL_MAX); + (void) ctx; + + for (i=0;i> 16; + GLint g = (rgba[i][GCOMP] * dest[i][GCOMP] + 65535) >> 16; + GLint b = (rgba[i][BCOMP] * dest[i][BCOMP] + 65535) >> 16; + GLint a = (rgba[i][ACOMP] * dest[i][ACOMP] + 65535) >> 16; + rgba[i][RCOMP] = (GLchan) r; + rgba[i][GCOMP] = (GLchan) g; + rgba[i][BCOMP] = (GLchan) b; + rgba[i][ACOMP] = (GLchan) a; +#else + GLint r = (rgba[i][RCOMP] * dest[i][RCOMP] + 255) >> 8; + GLint g = (rgba[i][GCOMP] * dest[i][GCOMP] + 255) >> 8; + GLint b = (rgba[i][BCOMP] * dest[i][BCOMP] + 255) >> 8; + GLint a = (rgba[i][ACOMP] * dest[i][ACOMP] + 255) >> 8; + rgba[i][RCOMP] = (GLchan) r; + rgba[i][GCOMP] = (GLchan) g; + rgba[i][BCOMP] = (GLchan) b; + rgba[i][ACOMP] = (GLchan) a; +#endif + } + } +} + + + +/* + * General case blend pixels. + * Input: n - number of pixels + * mask - the usual write mask + * In/Out: rgba - the incoming and modified pixels + * Input: dest - the pixels from the dest color buffer + */ +static void _BLENDAPI +blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[], + GLchan rgba[][4], CONST GLchan dest[][4] ) +{ + const GLfloat rscale = 1.0F / CHAN_MAXF; + const GLfloat gscale = 1.0F / CHAN_MAXF; + const GLfloat bscale = 1.0F / CHAN_MAXF; + const GLfloat ascale = 1.0F / CHAN_MAXF; + GLuint i; + + for (i=0;iColor.BlendSrcRGB) { + case GL_ZERO: + sR = sG = sB = 0.0F; + break; + case GL_ONE: + sR = sG = sB = 1.0F; + break; + case GL_DST_COLOR: + sR = (GLfloat) Rd * rscale; + sG = (GLfloat) Gd * gscale; + sB = (GLfloat) Bd * bscale; + break; + case GL_ONE_MINUS_DST_COLOR: + sR = 1.0F - (GLfloat) Rd * rscale; + sG = 1.0F - (GLfloat) Gd * gscale; + sB = 1.0F - (GLfloat) Bd * bscale; + break; + case GL_SRC_ALPHA: + sR = sG = sB = (GLfloat) As * ascale; + break; + case GL_ONE_MINUS_SRC_ALPHA: + sR = sG = sB = 1.0F - (GLfloat) As * ascale; + break; + case GL_DST_ALPHA: + sR = sG = sB = (GLfloat) Ad * ascale; + break; + case GL_ONE_MINUS_DST_ALPHA: + sR = sG = sB = 1.0F - (GLfloat) Ad * ascale; + break; + case GL_SRC_ALPHA_SATURATE: + if (As < CHAN_MAX - Ad) { + sR = sG = sB = (GLfloat) As * ascale; + } + else { + sR = sG = sB = 1.0F - (GLfloat) Ad * ascale; + } + break; + case GL_CONSTANT_COLOR: + sR = ctx->Color.BlendColor[0]; + sG = ctx->Color.BlendColor[1]; + sB = ctx->Color.BlendColor[2]; + break; + case GL_ONE_MINUS_CONSTANT_COLOR: + sR = 1.0F - ctx->Color.BlendColor[0]; + sG = 1.0F - ctx->Color.BlendColor[1]; + sB = 1.0F - ctx->Color.BlendColor[2]; + break; + case GL_CONSTANT_ALPHA: + sR = sG = sB = ctx->Color.BlendColor[3]; + break; + case GL_ONE_MINUS_CONSTANT_ALPHA: + sR = sG = sB = 1.0F - ctx->Color.BlendColor[3]; + break; + case GL_SRC_COLOR: /* GL_NV_blend_square */ + sR = (GLfloat) Rs * rscale; + sG = (GLfloat) Gs * gscale; + sB = (GLfloat) Bs * bscale; + break; + case GL_ONE_MINUS_SRC_COLOR: /* GL_NV_blend_square */ + sR = 1.0F - (GLfloat) Rs * rscale; + sG = 1.0F - (GLfloat) Gs * gscale; + sB = 1.0F - (GLfloat) Bs * bscale; + break; + default: + /* this should never happen */ + _mesa_problem(ctx, "Bad blend source RGB factor in do_blend"); + return; + } + + /* Source Alpha factor */ + switch (ctx->Color.BlendSrcA) { + case GL_ZERO: + sA = 0.0F; + break; + case GL_ONE: + sA = 1.0F; + break; + case GL_DST_COLOR: + sA = (GLfloat) Ad * ascale; + break; + case GL_ONE_MINUS_DST_COLOR: + sA = 1.0F - (GLfloat) Ad * ascale; + break; + case GL_SRC_ALPHA: + sA = (GLfloat) As * ascale; + break; + case GL_ONE_MINUS_SRC_ALPHA: + sA = 1.0F - (GLfloat) As * ascale; + break; + case GL_DST_ALPHA: + sA =(GLfloat) Ad * ascale; + break; + case GL_ONE_MINUS_DST_ALPHA: + sA = 1.0F - (GLfloat) Ad * ascale; + break; + case GL_SRC_ALPHA_SATURATE: + sA = 1.0; + break; + case GL_CONSTANT_COLOR: + sA = ctx->Color.BlendColor[3]; + break; + case GL_ONE_MINUS_CONSTANT_COLOR: + sA = 1.0F - ctx->Color.BlendColor[3]; + break; + case GL_CONSTANT_ALPHA: + sA = ctx->Color.BlendColor[3]; + break; + case GL_ONE_MINUS_CONSTANT_ALPHA: + sA = 1.0F - ctx->Color.BlendColor[3]; + break; + case GL_SRC_COLOR: /* GL_NV_blend_square */ + sA = (GLfloat) As * ascale; + break; + case GL_ONE_MINUS_SRC_COLOR: /* GL_NV_blend_square */ + sA = 1.0F - (GLfloat) As * ascale; + break; + default: + /* this should never happen */ + sA = 0.0F; + _mesa_problem(ctx, "Bad blend source A factor in do_blend"); + } + + /* Dest RGB factor */ + switch (ctx->Color.BlendDstRGB) { + case GL_ZERO: + dR = dG = dB = 0.0F; + break; + case GL_ONE: + dR = dG = dB = 1.0F; + break; + case GL_SRC_COLOR: + dR = (GLfloat) Rs * rscale; + dG = (GLfloat) Gs * gscale; + dB = (GLfloat) Bs * bscale; + break; + case GL_ONE_MINUS_SRC_COLOR: + dR = 1.0F - (GLfloat) Rs * rscale; + dG = 1.0F - (GLfloat) Gs * gscale; + dB = 1.0F - (GLfloat) Bs * bscale; + break; + case GL_SRC_ALPHA: + dR = dG = dB = (GLfloat) As * ascale; + break; + case GL_ONE_MINUS_SRC_ALPHA: + dR = dG = dB = 1.0F - (GLfloat) As * ascale; + break; + case GL_DST_ALPHA: + dR = dG = dB = (GLfloat) Ad * ascale; + break; + case GL_ONE_MINUS_DST_ALPHA: + dR = dG = dB = 1.0F - (GLfloat) Ad * ascale; + break; + case GL_CONSTANT_COLOR: + dR = ctx->Color.BlendColor[0]; + dG = ctx->Color.BlendColor[1]; + dB = ctx->Color.BlendColor[2]; + break; + case GL_ONE_MINUS_CONSTANT_COLOR: + dR = 1.0F - ctx->Color.BlendColor[0]; + dG = 1.0F - ctx->Color.BlendColor[1]; + dB = 1.0F - ctx->Color.BlendColor[2]; + break; + case GL_CONSTANT_ALPHA: + dR = dG = dB = ctx->Color.BlendColor[3]; + break; + case GL_ONE_MINUS_CONSTANT_ALPHA: + dR = dG = dB = 1.0F - ctx->Color.BlendColor[3]; + break; + case GL_DST_COLOR: /* GL_NV_blend_square */ + dR = (GLfloat) Rd * rscale; + dG = (GLfloat) Gd * gscale; + dB = (GLfloat) Bd * bscale; + break; + case GL_ONE_MINUS_DST_COLOR: /* GL_NV_blend_square */ + dR = 1.0F - (GLfloat) Rd * rscale; + dG = 1.0F - (GLfloat) Gd * gscale; + dB = 1.0F - (GLfloat) Bd * bscale; + break; + default: + /* this should never happen */ + dR = dG = dB = 0.0F; + _mesa_problem(ctx, "Bad blend dest RGB factor in do_blend"); + } + + /* Dest Alpha factor */ + switch (ctx->Color.BlendDstA) { + case GL_ZERO: + dA = 0.0F; + break; + case GL_ONE: + dA = 1.0F; + break; + case GL_SRC_COLOR: + dA = (GLfloat) As * ascale; + break; + case GL_ONE_MINUS_SRC_COLOR: + dA = 1.0F - (GLfloat) As * ascale; + break; + case GL_SRC_ALPHA: + dA = (GLfloat) As * ascale; + break; + case GL_ONE_MINUS_SRC_ALPHA: + dA = 1.0F - (GLfloat) As * ascale; + break; + case GL_DST_ALPHA: + dA = (GLfloat) Ad * ascale; + break; + case GL_ONE_MINUS_DST_ALPHA: + dA = 1.0F - (GLfloat) Ad * ascale; + break; + case GL_CONSTANT_COLOR: + dA = ctx->Color.BlendColor[3]; + break; + case GL_ONE_MINUS_CONSTANT_COLOR: + dA = 1.0F - ctx->Color.BlendColor[3]; + break; + case GL_CONSTANT_ALPHA: + dA = ctx->Color.BlendColor[3]; + break; + case GL_ONE_MINUS_CONSTANT_ALPHA: + dA = 1.0F - ctx->Color.BlendColor[3]; + break; + case GL_DST_COLOR: /* GL_NV_blend_square */ + dA = (GLfloat) Ad * ascale; + break; + case GL_ONE_MINUS_DST_COLOR: /* GL_NV_blend_square */ + dA = 1.0F - (GLfloat) Ad * ascale; + break; + default: + /* this should never happen */ + dA = 0.0F; + _mesa_problem(ctx, "Bad blend dest A factor in do_blend"); + return; + } + + /* Due to round-off problems we have to clamp against zero. */ + /* Optimization: we don't have to do this for all src & dst factors */ + if (dA < 0.0F) dA = 0.0F; + if (dR < 0.0F) dR = 0.0F; + if (dG < 0.0F) dG = 0.0F; + if (dB < 0.0F) dB = 0.0F; + if (sA < 0.0F) sA = 0.0F; + if (sR < 0.0F) sR = 0.0F; + if (sG < 0.0F) sG = 0.0F; + if (sB < 0.0F) sB = 0.0F; + + ASSERT( sR <= 1.0 ); + ASSERT( sG <= 1.0 ); + ASSERT( sB <= 1.0 ); + ASSERT( sA <= 1.0 ); + ASSERT( dR <= 1.0 ); + ASSERT( dG <= 1.0 ); + ASSERT( dB <= 1.0 ); + ASSERT( dA <= 1.0 ); + + /* compute blended color */ +#if CHAN_TYPE == GL_FLOAT + if (ctx->Color.BlendEquationRGB==GL_FUNC_ADD) { + r = Rs * sR + Rd * dR; + g = Gs * sG + Gd * dG; + b = Bs * sB + Bd * dB; + a = As * sA + Ad * dA; + } + else if (ctx->Color.BlendEquationRGB==GL_FUNC_SUBTRACT) { + r = Rs * sR - Rd * dR; + g = Gs * sG - Gd * dG; + b = Bs * sB - Bd * dB; + a = As * sA - Ad * dA; + } + else if (ctx->Color.BlendEquationRGB==GL_FUNC_REVERSE_SUBTRACT) { + r = Rd * dR - Rs * sR; + g = Gd * dG - Gs * sG; + b = Bd * dB - Bs * sB; + a = Ad * dA - As * sA; + } + else if (ctx->Color.BlendEquationRGB==GL_MIN) { + r = MIN2( Rd, Rs ); + g = MIN2( Gd, Gs ); + b = MIN2( Bd, Bs ); + } + else if (ctx->Color.BlendEquationRGB==GL_MAX) { + r = MAX2( Rd, Rs ); + g = MAX2( Gd, Gs ); + b = MAX2( Bd, Bs ); + } + else { + /* should never get here */ + r = g = b = 0.0F; /* silence uninitialized var warning */ + _mesa_problem(ctx, "unexpected BlendEquation in blend_general()"); + } + + if (ctx->Color.BlendEquationA==GL_FUNC_ADD) { + a = As * sA + Ad * dA; + } + else if (ctx->Color.BlendEquationA==GL_FUNC_SUBTRACT) { + a = As * sA - Ad * dA; + } + else if (ctx->Color.BlendEquationA==GL_FUNC_REVERSE_SUBTRACT) { + a = Ad * dA - As * sA; + } + else if (ctx->Color.BlendEquationA==GL_MIN) { + a = MIN2( Ad, As ); + } + else if (ctx->Color.BlendEquationA==GL_MAX) { + a = MAX2( Ad, As ); + } + else { + /* should never get here */ + a = 0.0F; /* silence uninitialized var warning */ + _mesa_problem(ctx, "unexpected BlendEquation in blend_general()"); + } + + /* final clamping */ + rgba[i][RCOMP] = MAX2( r, 0.0F ); + rgba[i][GCOMP] = MAX2( g, 0.0F ); + rgba[i][BCOMP] = MAX2( b, 0.0F ); + rgba[i][ACOMP] = CLAMP( a, 0.0F, CHAN_MAXF ); +#else + if (ctx->Color.BlendEquationRGB==GL_FUNC_ADD) { + r = Rs * sR + Rd * dR + 0.5F; + g = Gs * sG + Gd * dG + 0.5F; + b = Bs * sB + Bd * dB + 0.5F; + } + else if (ctx->Color.BlendEquationRGB==GL_FUNC_SUBTRACT) { + r = Rs * sR - Rd * dR + 0.5F; + g = Gs * sG - Gd * dG + 0.5F; + b = Bs * sB - Bd * dB + 0.5F; + } + else if (ctx->Color.BlendEquationRGB==GL_FUNC_REVERSE_SUBTRACT) { + r = Rd * dR - Rs * sR + 0.5F; + g = Gd * dG - Gs * sG + 0.5F; + b = Bd * dB - Bs * sB + 0.5F; + } + else if (ctx->Color.BlendEquationRGB==GL_MIN) { + r = MIN2( Rd, Rs ); + g = MIN2( Gd, Gs ); + b = MIN2( Bd, Bs ); + } + else if (ctx->Color.BlendEquationRGB==GL_MAX) { + r = MAX2( Rd, Rs ); + g = MAX2( Gd, Gs ); + b = MAX2( Bd, Bs ); + } + else { + /* should never get here */ + r = g = b = 0.0F; /* silence uninitialized var warning */ + _mesa_problem(ctx, "unexpected BlendEquation in blend_general()"); + } + + if (ctx->Color.BlendEquationA==GL_FUNC_ADD) { + a = As * sA + Ad * dA + 0.5F; + } + else if (ctx->Color.BlendEquationA==GL_FUNC_SUBTRACT) { + a = As * sA - Ad * dA + 0.5F; + } + else if (ctx->Color.BlendEquationA==GL_FUNC_REVERSE_SUBTRACT) { + a = Ad * dA - As * sA + 0.5F; + } + else if (ctx->Color.BlendEquationA==GL_MIN) { + a = MIN2( Ad, As ); + } + else if (ctx->Color.BlendEquationA==GL_MAX) { + a = MAX2( Ad, As ); + } + else { + /* should never get here */ + a = 0.0F; /* silence uninitialized var warning */ + _mesa_problem(ctx, "unexpected BlendEquation in blend_general()"); + } + + /* final clamping */ + rgba[i][RCOMP] = (GLchan) (GLint) CLAMP( r, 0.0F, CHAN_MAXF ); + rgba[i][GCOMP] = (GLchan) (GLint) CLAMP( g, 0.0F, CHAN_MAXF ); + rgba[i][BCOMP] = (GLchan) (GLint) CLAMP( b, 0.0F, CHAN_MAXF ); + rgba[i][ACOMP] = (GLchan) (GLint) CLAMP( a, 0.0F, CHAN_MAXF ); +#endif + } + } +} + + +/* + * Analyze current blending parameters to pick fastest blending function. + * Result: the ctx->Color.BlendFunc pointer is updated. + */ +void _swrast_choose_blend_func( GLcontext *ctx ) +{ + const GLenum eq = ctx->Color.BlendEquationRGB; + const GLenum srcRGB = ctx->Color.BlendSrcRGB; + const GLenum dstRGB = ctx->Color.BlendDstRGB; + const GLenum srcA = ctx->Color.BlendSrcA; + const GLenum dstA = ctx->Color.BlendDstA; + + if (ctx->Color.BlendEquationRGB != ctx->Color.BlendEquationA) { + SWRAST_CONTEXT(ctx)->BlendFunc = blend_general; + } + else if (eq==GL_MIN) { + /* Note: GL_MIN ignores the blending weight factors */ +#if defined(USE_MMX_ASM) + if ( cpu_has_mmx ) { + SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_min; + } + else +#endif + SWRAST_CONTEXT(ctx)->BlendFunc = blend_min; + } + else if (eq==GL_MAX) { + /* Note: GL_MAX ignores the blending weight factors */ +#if defined(USE_MMX_ASM) + if ( cpu_has_mmx ) { + SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_max; + } + else +#endif + SWRAST_CONTEXT(ctx)->BlendFunc = blend_max; + } + else if (srcRGB != srcA || dstRGB != dstA) { + SWRAST_CONTEXT(ctx)->BlendFunc = blend_general; + } + else if (eq==GL_FUNC_ADD && srcRGB==GL_SRC_ALPHA + && dstRGB==GL_ONE_MINUS_SRC_ALPHA) { +#if defined(USE_MMX_ASM) + if ( cpu_has_mmx ) { + SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_transparency; + } + else +#endif + SWRAST_CONTEXT(ctx)->BlendFunc = blend_transparency; + } + else if (eq==GL_FUNC_ADD && srcRGB==GL_ONE && dstRGB==GL_ONE) { +#if defined(USE_MMX_ASM) + if ( cpu_has_mmx ) { + SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_add; + } + else +#endif + SWRAST_CONTEXT(ctx)->BlendFunc = blend_add; + } + else if (((eq==GL_FUNC_ADD || eq==GL_FUNC_REVERSE_SUBTRACT) + && (srcRGB==GL_ZERO && dstRGB==GL_SRC_COLOR)) + || + ((eq==GL_FUNC_ADD || eq==GL_FUNC_SUBTRACT) + && (srcRGB==GL_DST_COLOR && dstRGB==GL_ZERO))) { +#if defined(USE_MMX_ASM) + if ( cpu_has_mmx ) { + SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_modulate; + } + else +#endif + SWRAST_CONTEXT(ctx)->BlendFunc = blend_modulate; + } + else if (eq==GL_FUNC_ADD && srcRGB == GL_ZERO && dstRGB == GL_ONE) { + SWRAST_CONTEXT(ctx)->BlendFunc = blend_noop; + } + else if (eq==GL_FUNC_ADD && srcRGB == GL_ONE && dstRGB == GL_ZERO) { + SWRAST_CONTEXT(ctx)->BlendFunc = blend_replace; + } + else { + SWRAST_CONTEXT(ctx)->BlendFunc = blend_general; + } +} + + + +/* + * Apply the blending operator to a span of pixels. + * We can handle horizontal runs of pixels (spans) or arrays of x/y + * pixel coordinates. + */ +void +_swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb, + const struct sw_span *span, GLchan rgba[][4]) +{ + GLchan framebuffer[MAX_WIDTH][4]; + + ASSERT(span->end <= MAX_WIDTH); + ASSERT(span->arrayMask & SPAN_RGBA); + ASSERT(!ctx->Color._LogicOpEnabled); + + /* Read span of current frame buffer pixels */ + if (span->arrayMask & SPAN_XY) { + /* array of x/y pixel coords */ + _swrast_get_values(ctx, rb, span->end, span->array->x, span->array->y, + framebuffer, 4 * sizeof(GLchan)); + } + else { + /* horizontal run of pixels */ + _swrast_read_rgba_span(ctx, rb, span->end, span->x, span->y, + framebuffer); + } + + SWRAST_CONTEXT(ctx)->BlendFunc( ctx, span->end, span->array->mask, rgba, + (const GLchan (*)[4]) framebuffer ); +} diff --git a/reactos/dll/mesa32/src/swrast/s_blend.h b/reactos/dll/mesa32/src/swrast/s_blend.h new file mode 100644 index 00000000000..c9519321521 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_blend.h @@ -0,0 +1,43 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 S_BLEND_H +#define S_BLEND_H + + +#include "mtypes.h" +#include "s_context.h" + + +extern void +_swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb, + const struct sw_span *span, GLchan rgba[][4]); + + +extern void +_swrast_choose_blend_func(GLcontext *ctx); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_buffers.c b/reactos/dll/mesa32/src/swrast/s_buffers.c new file mode 100644 index 00000000000..7af9d9d5134 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_buffers.c @@ -0,0 +1,408 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +#include "glheader.h" +#include "colormac.h" +#include "macros.h" +#include "imports.h" +#include "mtypes.h" +#include "fbobject.h" + +#include "s_accum.h" +#include "s_context.h" +#include "s_depth.h" +#include "s_masking.h" +#include "s_stencil.h" + + +/** + * Clear the color buffer when glColorMask is in effect. + */ +static void +clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb) +{ + const GLint x = ctx->DrawBuffer->_Xmin; + const GLint y = ctx->DrawBuffer->_Ymin; + const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; + const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; + GLchan clearColor[4]; + GLint i; + + ASSERT(ctx->Visual.rgbMode); + ASSERT(rb->PutRow); + + CLAMPED_FLOAT_TO_CHAN(clearColor[RCOMP], ctx->Color.ClearColor[0]); + CLAMPED_FLOAT_TO_CHAN(clearColor[GCOMP], ctx->Color.ClearColor[1]); + CLAMPED_FLOAT_TO_CHAN(clearColor[BCOMP], ctx->Color.ClearColor[2]); + CLAMPED_FLOAT_TO_CHAN(clearColor[ACOMP], ctx->Color.ClearColor[3]); + + for (i = 0; i < height; i++) { + GLchan rgba[MAX_WIDTH][4]; + GLint j; + for (j = 0; j < width; j++) { + COPY_CHAN4(rgba[j], clearColor); + } + _swrast_mask_rgba_array( ctx, rb, width, x, y + i, rgba ); + rb->PutRow(ctx, rb, width, x, y + i, rgba, NULL); + } +} + + +/** + * Clear color index buffer with masking. + */ +static void +clear_ci_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb) +{ + const GLint x = ctx->DrawBuffer->_Xmin; + const GLint y = ctx->DrawBuffer->_Ymin; + const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; + const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; + GLuint span[MAX_WIDTH]; + GLubyte mask[MAX_WIDTH]; + GLint i, j; + + ASSERT(!ctx->Visual.rgbMode); + + MEMSET( mask, 1, width ); + for (i = 0; i < height;i++) { + for (j = 0; j < width;j++) { + span[j] = ctx->Color.ClearIndex; + } + _swrast_mask_ci_array(ctx, rb, width, x, y + i, span); + ASSERT(rb->PutRow); + ASSERT(rb->DataType == GL_UNSIGNED_INT); + rb->PutRow(ctx, rb, width, x, y + i, span, mask); + } +} + + +/** + * Clear an rgba color buffer without channel masking. + */ +static void +clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) +{ + const GLint x = ctx->DrawBuffer->_Xmin; + const GLint y = ctx->DrawBuffer->_Ymin; + const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; + const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; + GLubyte clear8[4]; + GLushort clear16[4]; + GLvoid *clearVal; + GLint i; + + ASSERT(ctx->Visual.rgbMode); + + ASSERT(ctx->Color.ColorMask[0] && + ctx->Color.ColorMask[1] && + ctx->Color.ColorMask[2] && + ctx->Color.ColorMask[3]); + + ASSERT(rb->PutMonoRow); + + switch (rb->DataType) { + case GL_UNSIGNED_BYTE: + clear8[0] = FLOAT_TO_UBYTE(ctx->Color.ClearColor[0]); + clear8[1] = FLOAT_TO_UBYTE(ctx->Color.ClearColor[1]); + clear8[2] = FLOAT_TO_UBYTE(ctx->Color.ClearColor[2]); + clear8[3] = FLOAT_TO_UBYTE(ctx->Color.ClearColor[3]); + clearVal = clear8; + break; + case GL_UNSIGNED_SHORT: + clear16[0] = FLOAT_TO_USHORT(ctx->Color.ClearColor[0]); + clear16[1] = FLOAT_TO_USHORT(ctx->Color.ClearColor[1]); + clear16[2] = FLOAT_TO_USHORT(ctx->Color.ClearColor[2]); + clear16[3] = FLOAT_TO_USHORT(ctx->Color.ClearColor[3]); + clearVal = clear16; + break; + case GL_FLOAT: + clearVal = ctx->Color.ClearColor; + break; + default: + _mesa_problem(ctx, "Bad rb DataType in clear_color_buffer"); + return; + } + + for (i = 0; i < height; i++) { + rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL); + } +} + + +/** + * Clear color index buffer without masking. + */ +static void +clear_ci_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) +{ + const GLint x = ctx->DrawBuffer->_Xmin; + const GLint y = ctx->DrawBuffer->_Ymin; + const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; + const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; + GLubyte clear8; + GLushort clear16; + GLuint clear32; + GLvoid *clearVal; + GLint i; + + ASSERT(!ctx->Visual.rgbMode); + + ASSERT((ctx->Color.IndexMask & ((1 << ctx->Visual.indexBits) - 1)) + == (GLuint) ((1 << ctx->Visual.indexBits) - 1)); + + ASSERT(rb->PutMonoRow); + + /* setup clear value */ + switch (rb->DataType) { + case GL_UNSIGNED_BYTE: + clear8 = (GLubyte) ctx->Color.ClearIndex; + clearVal = &clear8; + break; + case GL_UNSIGNED_SHORT: + clear16 = (GLushort) ctx->Color.ClearIndex; + clearVal = &clear16; + break; + case GL_UNSIGNED_INT: + clear32 = ctx->Color.ClearIndex; + clearVal = &clear32; + break; + default: + _mesa_problem(ctx, "Bad rb DataType in clear_color_buffer"); + return; + } + + for (i = 0; i < height; i++) + rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL); +} + + +/** + * Clear the front/back/left/right/aux color buffers. + * This function is usually only called if the device driver can't + * clear its own color buffers for some reason (such as with masking). + */ +static void +clear_color_buffers(GLcontext *ctx) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLboolean masking; + GLuint i; + + if (ctx->Visual.rgbMode) { + if (ctx->Color.ColorMask[0] && + ctx->Color.ColorMask[1] && + ctx->Color.ColorMask[2] && + ctx->Color.ColorMask[3]) { + masking = GL_FALSE; + } + else { + masking = GL_TRUE; + } + } + else { + const GLuint indexBits = (1 << ctx->Visual.indexBits) - 1; + if ((ctx->Color.IndexMask & indexBits) == indexBits) { + masking = GL_FALSE; + } + else { + masking = GL_TRUE; + } + } + + for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers[0]; i++) { + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][i]; +#if OLD_RENDERBUFFER + /* SetBuffer will go away */ + if (swrast->Driver.SetBuffer) + swrast->Driver.SetBuffer(ctx, ctx->DrawBuffer, + ctx->DrawBuffer->_ColorDrawBit[0][i]); +#endif + + if (ctx->Visual.rgbMode) { + if (masking) { + clear_rgba_buffer_with_masking(ctx, rb); + } + else { + clear_rgba_buffer(ctx, rb); + } + } + else { + if (masking) { + clear_ci_buffer_with_masking(ctx, rb); + } + else { + clear_ci_buffer(ctx, rb); + } + } + } + + /* restore default read/draw buffer */ + _swrast_use_draw_buffer(ctx); +} + + +/** + * Called via the device driver's ctx->Driver.Clear() function if the + * device driver can't clear one or more of the buffers itself. + * \param mask bitwise-OR of DD_*_BIT flags. + * \param all if GL_TRUE, clear whole buffer, else clear specified region. + */ +void +_swrast_Clear(GLcontext *ctx, GLbitfield mask, + GLboolean all, GLint x, GLint y, GLint width, GLint height) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + (void) all; (void) x; (void) y; (void) width; (void) height; + +#ifdef DEBUG_FOO + { + const GLbitfield legalBits = + BUFFER_BIT_FRONT_LEFT | + BUFFER_BIT_FRONT_RIGHT | + BUFFER_BIT_BACK_LEFT | + BUFFER_BIT_BACK_RIGHT | + BUFFER_BIT_DEPTH | + BUFFER_BIT_STENCIL | + BUFFER_BIT_ACCUM | + BUFFER_BIT_AUX0 | + BUFFER_BIT_AUX1 | + BUFFER_BIT_AUX2 | + BUFFER_BIT_AUX3; + assert((mask & (~legalBits)) == 0); + } +#endif + + RENDER_START(swrast,ctx); + + /* do software clearing here */ + if (mask) { + if (mask & ctx->DrawBuffer->_ColorDrawBufferMask[0]) { + clear_color_buffers(ctx); + } + if (mask & BUFFER_BIT_DEPTH) { + struct gl_renderbuffer *rb + = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; + _swrast_clear_depth_buffer(ctx, rb); + } + if (mask & BUFFER_BIT_ACCUM) { + struct gl_renderbuffer *rb + = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer; + _swrast_clear_accum_buffer(ctx, rb); + } + if (mask & BUFFER_BIT_STENCIL) { + struct gl_renderbuffer *rb + = ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer; + _swrast_clear_stencil_buffer(ctx, rb); + } + } + + RENDER_FINISH(swrast,ctx); +} + + +/* + * Fallback for ctx->Driver.DrawBuffer() + */ +void +_swrast_DrawBuffer( GLcontext *ctx, GLenum mode ) +{ + (void) mode; + _swrast_use_draw_buffer(ctx); +} + + +/* + * Fallback for ctx->Driver.DrawBuffers() + */ +void +_swrast_DrawBuffers( GLcontext *ctx, GLsizei n, const GLenum *buffers ) +{ + _swrast_use_draw_buffer(ctx); +} + + +/* + * Setup things so that we read/write spans from the user-designated + * read buffer (set via glReadPixels). We usually just have to call + * this for glReadPixels, glCopyPixels, etc. + */ +void +_swrast_use_read_buffer( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + /* Do this so the software-emulated alpha plane span functions work! */ + swrast->CurrentBufferBit = ctx->ReadBuffer->_ColorReadBufferMask; + /* Tell the device driver where to read/write spans */ + if (swrast->Driver.SetBuffer) + swrast->Driver.SetBuffer(ctx, ctx->ReadBuffer, swrast->CurrentBufferBit); +} + + +/* + * Setup things so that we read/write spans from the default draw buffer. + * This is the usual mode that Mesa's software rasterizer operates in. + */ +void +_swrast_use_draw_buffer( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + /* The user can specify rendering to zero, one, two, or four color + * buffers simultaneously with glDrawBuffer()! + * We don't expect the span/point/line/triangle functions to deal with + * that mess so we'll iterate over the multiple buffers as needed. + * But usually we only render to one color buffer at a time. + * We set ctx->Color._DriverDrawBuffer to that buffer and tell the + * device driver to use that buffer. + * Look in s_span.c's multi_write_rgba_span() function to see how + * we loop over multiple color buffers when needed. + */ + + if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_LEFT) + swrast->CurrentBufferBit = BUFFER_BIT_FRONT_LEFT; + else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_BACK_LEFT) + swrast->CurrentBufferBit = BUFFER_BIT_BACK_LEFT; + else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_RIGHT) + swrast->CurrentBufferBit = BUFFER_BIT_FRONT_RIGHT; + else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_BACK_RIGHT) + swrast->CurrentBufferBit = BUFFER_BIT_BACK_RIGHT; + else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX0) + swrast->CurrentBufferBit = BUFFER_BIT_AUX0; + else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX1) + swrast->CurrentBufferBit = BUFFER_BIT_AUX1; + else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX2) + swrast->CurrentBufferBit = BUFFER_BIT_AUX2; + else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX3) + swrast->CurrentBufferBit = BUFFER_BIT_AUX3; + else + /* glDrawBuffer(GL_NONE) */ + swrast->CurrentBufferBit = BUFFER_BIT_FRONT_LEFT; /* we always have this buffer */ + + if (swrast->Driver.SetBuffer) + swrast->Driver.SetBuffer(ctx, ctx->DrawBuffer, swrast->CurrentBufferBit); +} diff --git a/reactos/dll/mesa32/src/swrast/s_context.c b/reactos/dll/mesa32/src/swrast/s_context.c new file mode 100644 index 00000000000..5c57b42d6cb --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_context.c @@ -0,0 +1,749 @@ +/* + * 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 + * Brian Paul + */ + +#include "imports.h" +#include "bufferobj.h" +#include "context.h" +#include "colormac.h" +#include "mtypes.h" +#include "program.h" +#include "texobj.h" +#include "nvfragprog.h" + +#include "swrast.h" +#include "s_blend.h" +#include "s_context.h" +#include "s_lines.h" +#include "s_points.h" +#include "s_span.h" +#include "s_triangle.h" +#include "s_texture.h" + + +/** + * Recompute the value of swrast->_RasterMask, etc. according to + * the current context. The _RasterMask field can be easily tested by + * drivers to determine certain basic GL state (does the primitive need + * stenciling, logic-op, fog, etc?). + */ +static void +_swrast_update_rasterflags( GLcontext *ctx ) +{ + GLuint rasterMask = 0; + + if (ctx->Color.AlphaEnabled) rasterMask |= ALPHATEST_BIT; + if (ctx->Color.BlendEnabled) rasterMask |= BLEND_BIT; + if (ctx->Depth.Test) rasterMask |= DEPTH_BIT; + if (ctx->Fog.Enabled) rasterMask |= FOG_BIT; + if (ctx->Scissor.Enabled) rasterMask |= CLIP_BIT; + if (ctx->Stencil.Enabled) rasterMask |= STENCIL_BIT; + if (ctx->Visual.rgbMode) { + const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); + if (colorMask != 0xffffffff) rasterMask |= MASKING_BIT; + if (ctx->Color._LogicOpEnabled) rasterMask |= LOGIC_OP_BIT; + if (ctx->Texture._EnabledUnits) rasterMask |= TEXTURE_BIT; + } + else { + if (ctx->Color.IndexMask != 0xffffffff) rasterMask |= MASKING_BIT; + if (ctx->Color.IndexLogicOpEnabled) rasterMask |= LOGIC_OP_BIT; + } + + if ( ctx->Viewport.X < 0 + || ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width + || ctx->Viewport.Y < 0 + || ctx->Viewport.Y + ctx->Viewport.Height > (GLint) ctx->DrawBuffer->Height) { + rasterMask |= CLIP_BIT; + } + + if (ctx->Depth.OcclusionTest || ctx->Occlusion.Active) + rasterMask |= OCCLUSION_BIT; + + + /* If we're not drawing to exactly one color buffer set the + * MULTI_DRAW_BIT flag. Also set it if we're drawing to no + * buffers or the RGBA or CI mask disables all writes. + */ + if (ctx->DrawBuffer->_NumColorDrawBuffers[0] != 1) { + /* more than one color buffer designated for writing (or zero buffers) */ + rasterMask |= MULTI_DRAW_BIT; + } + else if (ctx->Visual.rgbMode && *((GLuint *) ctx->Color.ColorMask) == 0) { + rasterMask |= MULTI_DRAW_BIT; /* all RGBA channels disabled */ + } + else if (!ctx->Visual.rgbMode && ctx->Color.IndexMask==0) { + rasterMask |= MULTI_DRAW_BIT; /* all color index bits disabled */ + } + + if (ctx->FragmentProgram._Active) { + rasterMask |= FRAGPROG_BIT; + } + + if (ctx->ATIFragmentShader._Enabled) { + rasterMask |= ATIFRAGSHADER_BIT; + } + + SWRAST_CONTEXT(ctx)->_RasterMask = rasterMask; +} + + +/** + * Examine polycon culls tate to compute the _BackfaceSign field. + * _BackfaceSign will be 0 if no culling, -1 if culling back-faces, + * and 1 if culling front-faces. The Polygon FrontFace state also + * factors in. + */ +static void +_swrast_update_polygon( GLcontext *ctx ) +{ + GLfloat backface_sign = 1; + + if (ctx->Polygon.CullFlag) { + backface_sign = 1; + switch(ctx->Polygon.CullFaceMode) { + case GL_BACK: + if(ctx->Polygon.FrontFace==GL_CCW) + backface_sign = -1; + break; + case GL_FRONT: + if(ctx->Polygon.FrontFace!=GL_CCW) + backface_sign = -1; + break; + default: + case GL_FRONT_AND_BACK: + backface_sign = 0; + break; + } + } + else { + backface_sign = 0; + } + + SWRAST_CONTEXT(ctx)->_BackfaceSign = backface_sign; +} + + +/** + * Update the _PreferPixelFog field to indicate if we need to compute + * fog factors per-fragment. + */ +static void +_swrast_update_fog_hint( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + swrast->_PreferPixelFog = (!swrast->AllowVertexFog || + ctx->FragmentProgram._Enabled || /* not _Active! */ + (ctx->Hint.Fog == GL_NICEST && + swrast->AllowPixelFog)); +} + + + +/** + * Update the swrast->_AnyTextureCombine flag. + */ +static void +_swrast_update_texture_env( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLuint i; + swrast->_AnyTextureCombine = GL_FALSE; + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { + if (ctx->Texture.Unit[i].EnvMode == GL_COMBINE_EXT || + ctx->Texture.Unit[i].EnvMode == GL_COMBINE4_NV) { + swrast->_AnyTextureCombine = GL_TRUE; + return; + } + } +} + + +/** + * Update swrast->_FogColor and swrast->_FogEnable values. + */ +static void +_swrast_update_fog_state( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + /* convert fog color to GLchan values */ + CLAMPED_FLOAT_TO_CHAN(swrast->_FogColor[RCOMP], ctx->Fog.Color[RCOMP]); + CLAMPED_FLOAT_TO_CHAN(swrast->_FogColor[GCOMP], ctx->Fog.Color[GCOMP]); + CLAMPED_FLOAT_TO_CHAN(swrast->_FogColor[BCOMP], ctx->Fog.Color[BCOMP]); + + /* determine if fog is needed, and if so, which fog mode */ + swrast->_FogEnabled = GL_FALSE; + if (ctx->FragmentProgram._Active) { + if (ctx->FragmentProgram._Current->Base.Target==GL_FRAGMENT_PROGRAM_ARB) { + const struct fragment_program *p + = (struct fragment_program *) ctx->FragmentProgram._Current; + if (p->FogOption != GL_NONE) { + swrast->_FogEnabled = GL_TRUE; + swrast->_FogMode = p->FogOption; + } + } + } + else if (ctx->Fog.Enabled) { + swrast->_FogEnabled = GL_TRUE; + swrast->_FogMode = ctx->Fog.Mode; + } +} + + +/** + * Update state for running fragment programs. Basically, load the + * program parameters with current state values. + */ +static void +_swrast_update_fragment_program( GLcontext *ctx ) +{ + if (ctx->FragmentProgram._Active) { + struct fragment_program *program = ctx->FragmentProgram._Current; + _mesa_load_state_parameters(ctx, program->Parameters); + } +} + + + +#define _SWRAST_NEW_DERIVED (_SWRAST_NEW_RASTERMASK | \ + _NEW_TEXTURE | \ + _NEW_HINT | \ + _NEW_POLYGON ) + +/* State referenced by _swrast_choose_triangle, _swrast_choose_line. + */ +#define _SWRAST_NEW_TRIANGLE (_SWRAST_NEW_DERIVED | \ + _NEW_RENDERMODE| \ + _NEW_POLYGON| \ + _NEW_DEPTH| \ + _NEW_STENCIL| \ + _NEW_COLOR| \ + _NEW_TEXTURE| \ + _SWRAST_NEW_RASTERMASK| \ + _NEW_LIGHT| \ + _NEW_FOG | \ + _DD_NEW_SEPARATE_SPECULAR) + +#define _SWRAST_NEW_LINE (_SWRAST_NEW_DERIVED | \ + _NEW_RENDERMODE| \ + _NEW_LINE| \ + _NEW_TEXTURE| \ + _NEW_LIGHT| \ + _NEW_FOG| \ + _NEW_DEPTH | \ + _DD_NEW_SEPARATE_SPECULAR) + +#define _SWRAST_NEW_POINT (_SWRAST_NEW_DERIVED | \ + _NEW_RENDERMODE | \ + _NEW_POINT | \ + _NEW_TEXTURE | \ + _NEW_LIGHT | \ + _NEW_FOG | \ + _DD_NEW_SEPARATE_SPECULAR) + +#define _SWRAST_NEW_TEXTURE_SAMPLE_FUNC _NEW_TEXTURE + +#define _SWRAST_NEW_TEXTURE_ENV_MODE _NEW_TEXTURE + +#define _SWRAST_NEW_BLEND_FUNC _NEW_COLOR + + + +/** + * Stub for swrast->Triangle to select a true triangle function + * after a state change. + */ +static void +_swrast_validate_triangle( GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2 ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + _swrast_validate_derived( ctx ); + swrast->choose_triangle( ctx ); + + if (ctx->Texture._EnabledUnits == 0 + && NEED_SECONDARY_COLOR(ctx) + && !ctx->FragmentProgram._Active) { + /* separate specular color, but no texture */ + swrast->SpecTriangle = swrast->Triangle; + swrast->Triangle = _swrast_add_spec_terms_triangle; + } + + swrast->Triangle( ctx, v0, v1, v2 ); +} + +/** + * Called via swrast->Line. Examine current GL state and choose a software + * line routine. Then call it. + */ +static void +_swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + _swrast_validate_derived( ctx ); + swrast->choose_line( ctx ); + + if (ctx->Texture._EnabledUnits == 0 + && NEED_SECONDARY_COLOR(ctx) + && !ctx->FragmentProgram._Active) { + swrast->SpecLine = swrast->Line; + swrast->Line = _swrast_add_spec_terms_line; + } + + + swrast->Line( ctx, v0, v1 ); +} + +/** + * Called via swrast->Point. Examine current GL state and choose a software + * point routine. Then call it. + */ +static void +_swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + _swrast_validate_derived( ctx ); + swrast->choose_point( ctx ); + + if (ctx->Texture._EnabledUnits == 0 + && NEED_SECONDARY_COLOR(ctx) + && !ctx->FragmentProgram._Active) { + swrast->SpecPoint = swrast->Point; + swrast->Point = _swrast_add_spec_terms_point; + } + + swrast->Point( ctx, v0 ); +} + + +/** + * Called via swrast->BlendFunc. Examine GL state to choose a blending + * function, then call it. + */ +static void _ASMAPI +_swrast_validate_blend_func( GLcontext *ctx, GLuint n, + const GLubyte mask[], + GLchan src[][4], + CONST GLchan dst[][4] ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + _swrast_validate_derived( ctx ); + _swrast_choose_blend_func( ctx ); + + swrast->BlendFunc( ctx, n, mask, src, dst ); +} + + +/** + * Called via the swrast->TextureSample[i] function pointer. + * Basically, given a texture object, an array of texture coords + * and an array of level-of-detail values, return an array of colors. + * In this case, determine the correct texture sampling routine + * (depending on filter mode, texture dimensions, etc) then call the + * sampler routine. + */ +static void +_swrast_validate_texture_sample( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4] ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + _swrast_validate_derived( ctx ); + + /* Compute min/mag filter threshold */ + if (tObj && tObj->MinFilter != tObj->MagFilter) { + if (tObj->MagFilter == GL_LINEAR + && (tObj->MinFilter == GL_NEAREST_MIPMAP_NEAREST || + tObj->MinFilter == GL_NEAREST_MIPMAP_LINEAR)) { + swrast->_MinMagThresh[texUnit] = 0.5F; + } + else { + swrast->_MinMagThresh[texUnit] = 0.0F; + } + } + + swrast->TextureSample[texUnit] = + _swrast_choose_texture_sample_func( ctx, tObj ); + + swrast->TextureSample[texUnit]( ctx, texUnit, tObj, n, texcoords, + lambda, rgba ); +} + + +static void +_swrast_sleep( GLcontext *ctx, GLuint new_state ) +{ + (void) ctx; (void) new_state; +} + + +static void +_swrast_invalidate_state( GLcontext *ctx, GLuint new_state ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLuint i; + + swrast->NewState |= new_state; + + /* After 10 statechanges without any swrast functions being called, + * put the module to sleep. + */ + if (++swrast->StateChanges > 10) { + swrast->InvalidateState = _swrast_sleep; + swrast->NewState = ~0; + new_state = ~0; + } + + if (new_state & swrast->invalidate_triangle) + swrast->Triangle = _swrast_validate_triangle; + + if (new_state & swrast->invalidate_line) + swrast->Line = _swrast_validate_line; + + if (new_state & swrast->invalidate_point) + swrast->Point = _swrast_validate_point; + + if (new_state & _SWRAST_NEW_BLEND_FUNC) + swrast->BlendFunc = _swrast_validate_blend_func; + + if (new_state & _SWRAST_NEW_TEXTURE_SAMPLE_FUNC) + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + swrast->TextureSample[i] = _swrast_validate_texture_sample; +} + + +void +_swrast_validate_derived( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + if (swrast->NewState) { + if (swrast->NewState & _SWRAST_NEW_RASTERMASK) + _swrast_update_rasterflags( ctx ); + + if (swrast->NewState & _NEW_POLYGON) + _swrast_update_polygon( ctx ); + + if (swrast->NewState & (_NEW_HINT | _NEW_PROGRAM)) + _swrast_update_fog_hint( ctx ); + + if (swrast->NewState & _SWRAST_NEW_TEXTURE_ENV_MODE) + _swrast_update_texture_env( ctx ); + + if (swrast->NewState & (_NEW_FOG | _NEW_PROGRAM)) + _swrast_update_fog_state( ctx ); + + if (swrast->NewState & _NEW_PROGRAM) + _swrast_update_fragment_program( ctx ); + + swrast->NewState = 0; + swrast->StateChanges = 0; + swrast->InvalidateState = _swrast_invalidate_state; + } +} + +#define SWRAST_DEBUG 0 + +/* Public entrypoints: See also s_accum.c, s_bitmap.c, etc. + */ +void +_swrast_Quad( GLcontext *ctx, + const SWvertex *v0, const SWvertex *v1, + const SWvertex *v2, const SWvertex *v3 ) +{ + if (SWRAST_DEBUG) { + _mesa_debug(ctx, "_swrast_Quad\n"); + _swrast_print_vertex( ctx, v0 ); + _swrast_print_vertex( ctx, v1 ); + _swrast_print_vertex( ctx, v2 ); + _swrast_print_vertex( ctx, v3 ); + } + SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v3 ); + SWRAST_CONTEXT(ctx)->Triangle( ctx, v1, v2, v3 ); +} + +void +_swrast_Triangle( GLcontext *ctx, const SWvertex *v0, + const SWvertex *v1, const SWvertex *v2 ) +{ + if (SWRAST_DEBUG) { + _mesa_debug(ctx, "_swrast_Triangle\n"); + _swrast_print_vertex( ctx, v0 ); + _swrast_print_vertex( ctx, v1 ); + _swrast_print_vertex( ctx, v2 ); + } + SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 ); +} + +void +_swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) +{ + if (SWRAST_DEBUG) { + _mesa_debug(ctx, "_swrast_Line\n"); + _swrast_print_vertex( ctx, v0 ); + _swrast_print_vertex( ctx, v1 ); + } + SWRAST_CONTEXT(ctx)->Line( ctx, v0, v1 ); +} + +void +_swrast_Point( GLcontext *ctx, const SWvertex *v0 ) +{ + if (SWRAST_DEBUG) { + _mesa_debug(ctx, "_swrast_Point\n"); + _swrast_print_vertex( ctx, v0 ); + } + SWRAST_CONTEXT(ctx)->Point( ctx, v0 ); +} + +void +_swrast_InvalidateState( GLcontext *ctx, GLuint new_state ) +{ + if (SWRAST_DEBUG) { + _mesa_debug(ctx, "_swrast_InvalidateState\n"); + } + SWRAST_CONTEXT(ctx)->InvalidateState( ctx, new_state ); +} + +void +_swrast_ResetLineStipple( GLcontext *ctx ) +{ + if (SWRAST_DEBUG) { + _mesa_debug(ctx, "_swrast_ResetLineStipple\n"); + } + SWRAST_CONTEXT(ctx)->StippleCounter = 0; +} + +void +_swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ) +{ + if (SWRAST_DEBUG) { + _mesa_debug(ctx, "_swrast_allow_vertex_fog %d\n", value); + } + SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT ); + SWRAST_CONTEXT(ctx)->AllowVertexFog = value; +} + +void +_swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value ) +{ + if (SWRAST_DEBUG) { + _mesa_debug(ctx, "_swrast_allow_pixel_fog %d\n", value); + } + SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT ); + SWRAST_CONTEXT(ctx)->AllowPixelFog = value; +} + + +GLboolean +_swrast_CreateContext( GLcontext *ctx ) +{ + GLuint i; + SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext)); + + if (SWRAST_DEBUG) { + _mesa_debug(ctx, "_swrast_CreateContext\n"); + } + + if (!swrast) + return GL_FALSE; + + swrast->NewState = ~0; + + swrast->choose_point = _swrast_choose_point; + swrast->choose_line = _swrast_choose_line; + swrast->choose_triangle = _swrast_choose_triangle; + + swrast->invalidate_point = _SWRAST_NEW_POINT; + swrast->invalidate_line = _SWRAST_NEW_LINE; + swrast->invalidate_triangle = _SWRAST_NEW_TRIANGLE; + + swrast->Point = _swrast_validate_point; + swrast->Line = _swrast_validate_line; + swrast->Triangle = _swrast_validate_triangle; + swrast->InvalidateState = _swrast_sleep; + swrast->BlendFunc = _swrast_validate_blend_func; + + swrast->AllowVertexFog = GL_TRUE; + swrast->AllowPixelFog = GL_TRUE; + + if (ctx->Visual.doubleBufferMode) + swrast->CurrentBufferBit = BUFFER_BIT_BACK_LEFT; + else + swrast->CurrentBufferBit = BUFFER_FRONT_LEFT; + + /* Optimized Accum buffer */ + swrast->_IntegerAccumMode = GL_FALSE; + swrast->_IntegerAccumScaler = 0.0; + + for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) + swrast->TextureSample[i] = _swrast_validate_texture_sample; + + swrast->SpanArrays = MALLOC_STRUCT(span_arrays); + if (!swrast->SpanArrays) { + FREE(swrast); + return GL_FALSE; + } + + /* init point span buffer */ + swrast->PointSpan.primitive = GL_POINT; + swrast->PointSpan.start = 0; + swrast->PointSpan.end = 0; + swrast->PointSpan.facing = 0; + swrast->PointSpan.array = swrast->SpanArrays; + + assert(ctx->Const.MaxTextureUnits > 0); + assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_UNITS); + + swrast->TexelBuffer = (GLchan *) MALLOC(ctx->Const.MaxTextureUnits * + MAX_WIDTH * 4 * sizeof(GLchan)); + if (!swrast->TexelBuffer) { + FREE(swrast->SpanArrays); + FREE(swrast); + return GL_FALSE; + } + + ctx->swrast_context = swrast; + + return GL_TRUE; +} + +void +_swrast_DestroyContext( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + if (SWRAST_DEBUG) { + _mesa_debug(ctx, "_swrast_DestroyContext\n"); + } + + FREE( swrast->SpanArrays ); + FREE( swrast->TexelBuffer ); + FREE( swrast ); + + ctx->swrast_context = 0; +} + + +struct swrast_device_driver * +_swrast_GetDeviceDriverReference( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + return &swrast->Driver; +} + +void +_swrast_flush( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + /* flush any pending fragments from rendering points */ + if (swrast->PointSpan.end > 0) { + if (ctx->Visual.rgbMode) { + _swrast_write_rgba_span(ctx, &(swrast->PointSpan)); + } + else { + _swrast_write_index_span(ctx, &(swrast->PointSpan)); + } + swrast->PointSpan.end = 0; + } +} + +void +_swrast_render_primitive( GLcontext *ctx, GLenum prim ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + if (swrast->Primitive == GL_POINTS && prim != GL_POINTS) { + _swrast_flush(ctx); + } + swrast->Primitive = prim; +} + + +void +_swrast_render_start( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + if (swrast->Driver.SpanRenderStart) + swrast->Driver.SpanRenderStart( ctx ); + swrast->PointSpan.end = 0; +} + +void +_swrast_render_finish( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + if (swrast->Driver.SpanRenderFinish) + swrast->Driver.SpanRenderFinish( ctx ); + + _swrast_flush(ctx); +} + + +#define SWRAST_DEBUG_VERTICES 0 + +void +_swrast_print_vertex( GLcontext *ctx, const SWvertex *v ) +{ + GLuint i; + + if (SWRAST_DEBUG_VERTICES) { + _mesa_debug(ctx, "win %f %f %f %f\n", + v->win[0], v->win[1], v->win[2], v->win[3]); + + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + if (ctx->Texture.Unit[i]._ReallyEnabled) + _mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i, + v->texcoord[i][0], v->texcoord[i][1], + v->texcoord[i][2], v->texcoord[i][3]); + +#if CHAN_TYPE == GL_FLOAT + _mesa_debug(ctx, "color %f %f %f %f\n", + v->color[0], v->color[1], v->color[2], v->color[3]); + _mesa_debug(ctx, "spec %f %f %f %f\n", + v->specular[0], v->specular[1], + v->specular[2], v->specular[3]); +#else + _mesa_debug(ctx, "color %d %d %d %d\n", + v->color[0], v->color[1], v->color[2], v->color[3]); + _mesa_debug(ctx, "spec %d %d %d %d\n", + v->specular[0], v->specular[1], + v->specular[2], v->specular[3]); +#endif + _mesa_debug(ctx, "fog %f\n", v->fog); + _mesa_debug(ctx, "index %d\n", v->index); + _mesa_debug(ctx, "pointsize %f\n", v->pointSize); + _mesa_debug(ctx, "\n"); + } +} diff --git a/reactos/dll/mesa32/src/swrast/s_context.h b/reactos/dll/mesa32/src/swrast/s_context.h new file mode 100644 index 00000000000..5f5efdc22ae --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_context.h @@ -0,0 +1,411 @@ +/* + * 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. + */ + + +/** + * \file swrast/s_context.h + * \brief Software rasterization context and private types. + * \author Keith Whitwell + */ + +/** + * \mainpage swrast module + * + * This module, software rasterization, contains the software fallback + * routines for drawing points, lines, triangles, bitmaps and images. + * All rendering boils down to writing spans (arrays) of pixels with + * particular colors. The span-writing routines must be implemented + * by the device driver. + */ + + +#ifndef S_CONTEXT_H +#define S_CONTEXT_H + +#include "mtypes.h" +#include "swrast.h" + + +/** + * \defgroup SpanFlags SPAN_XXX-flags + * Bitmasks to indicate which span_arrays need to be computed + * (sw_span::interpMask) or have already been filled + * (sw_span::arrayMask) + */ +/*@{*/ +#define SPAN_RGBA 0x001 +#define SPAN_SPEC 0x002 +#define SPAN_INDEX 0x004 +#define SPAN_Z 0x008 +#define SPAN_W 0x010 +#define SPAN_FOG 0x020 +#define SPAN_TEXTURE 0x040 +#define SPAN_INT_TEXTURE 0x080 +#define SPAN_LAMBDA 0x100 +#define SPAN_COVERAGE 0x200 +#define SPAN_FLAT 0x400 /**< flat shading? */ +/** sw_span::arrayMask only - for span_arrays::x, span_arrays::y */ +#define SPAN_XY 0x800 +#define SPAN_MASK 0x1000 /**< sw_span::arrayMask only */ +/*@}*/ + + +/** + * \struct span_arrays + * \brief Arrays of fragment values. + * + * These will either be computed from the x/xStep values above or + * filled in by glDraw/CopyPixels, etc. + * These arrays are separated out of sw_span to conserve memory. + */ +struct span_arrays { + GLchan rgb[MAX_WIDTH][3]; + GLchan rgba[MAX_WIDTH][4]; + GLuint index[MAX_WIDTH]; + GLchan spec[MAX_WIDTH][4]; /* specular color */ + GLint x[MAX_WIDTH]; /**< X/Y used for point/line rendering only */ + GLint y[MAX_WIDTH]; /**< X/Y used for point/line rendering only */ + GLdepth z[MAX_WIDTH]; + GLfloat fog[MAX_WIDTH]; + GLfloat texcoords[MAX_TEXTURE_COORD_UNITS][MAX_WIDTH][4]; + GLfloat lambda[MAX_TEXTURE_COORD_UNITS][MAX_WIDTH]; + GLfloat coverage[MAX_WIDTH]; + + /** This mask indicates if fragment is alive or culled */ + GLubyte mask[MAX_WIDTH]; +}; + + +/** + * \struct sw_span + * \brief Contains data for either a horizontal line or a set of + * pixels that are passed through a pipeline of functions before being + * drawn. + * + * The sw_span structure describes the colors, Z, fogcoord, texcoords, + * etc for either a horizontal run or an array of independent pixels. + * We can either specify a base/step to indicate interpolated values, or + * fill in arrays of values. The interpMask and arrayMask bitfields + * indicate which are active. + * + * With this structure it's easy to hand-off span rasterization to + * subroutines instead of doing it all inline in the triangle functions + * like we used to do. + * It also cleans up the local variable namespace a great deal. + * + * It would be interesting to experiment with multiprocessor rasterization + * with this structure. The triangle rasterizer could simply emit a + * stream of these structures which would be consumed by one or more + * span-processing threads which could run in parallel. + */ +struct sw_span { + GLint x, y; + + /** Only need to process pixels between start <= i < end */ + /** At this time, start is always zero. */ + GLuint start, end; + + /** This flag indicates that mask[] array is effectively filled with ones */ + GLboolean writeAll; + + /** either GL_POLYGON, GL_LINE, GL_POLYGON, GL_BITMAP */ + GLenum primitive; + + /** 0 = front-facing span, 1 = back-facing span (for two-sided stencil) */ + GLuint facing; + + /** + * This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates + * which of the x/xStep variables are relevant. + */ + GLuint interpMask; + + /* For horizontal spans, step is the partial derivative wrt X. + * For lines, step is the delta from one fragment to the next. + */ +#if CHAN_TYPE == GL_FLOAT + GLfloat red, redStep; + GLfloat green, greenStep; + GLfloat blue, blueStep; + GLfloat alpha, alphaStep; + GLfloat specRed, specRedStep; + GLfloat specGreen, specGreenStep; + GLfloat specBlue, specBlueStep; +#else /* CHAN_TYPE == GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT */ + GLfixed red, redStep; + GLfixed green, greenStep; + GLfixed blue, blueStep; + GLfixed alpha, alphaStep; + GLfixed specRed, specRedStep; + GLfixed specGreen, specGreenStep; + GLfixed specBlue, specBlueStep; +#endif + GLfixed index, indexStep; + GLfixed z, zStep; + GLfloat fog, fogStep; + GLfloat tex[MAX_TEXTURE_COORD_UNITS][4]; /* s, t, r, q */ + GLfloat texStepX[MAX_TEXTURE_COORD_UNITS][4]; + GLfloat texStepY[MAX_TEXTURE_COORD_UNITS][4]; + GLfixed intTex[2], intTexStep[2]; /* s, t only */ + + /* partial derivatives wrt X and Y. */ + GLfloat dzdx, dzdy; + GLfloat w, dwdx, dwdy; + GLfloat drdx, drdy; + GLfloat dgdx, dgdy; + GLfloat dbdx, dbdy; + GLfloat dadx, dady; + GLfloat dsrdx, dsrdy; + GLfloat dsgdx, dsgdy; + GLfloat dsbdx, dsbdy; + GLfloat dfogdx, dfogdy; + + /** + * This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates + * which of the fragment arrays in the span_arrays struct are relevant. + */ + GLuint arrayMask; + + /** + * We store the arrays of fragment values in a separate struct so + * that we can allocate sw_span structs on the stack without using + * a lot of memory. The span_arrays struct is about 400KB while the + * sw_span struct is only about 512 bytes. + */ + struct span_arrays *array; +}; + + +#define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK) \ +do { \ + (S).primitive = (PRIMITIVE); \ + (S).interpMask = (INTERP_MASK); \ + (S).arrayMask = (ARRAY_MASK); \ + (S).start = 0; \ + (S).end = (END); \ + (S).facing = 0; \ + (S).array = SWRAST_CONTEXT(ctx)->SpanArrays; \ +} while (0) + + +typedef void (*texture_sample_func)(GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4]); + +typedef void (_ASMAPIP blend_func)( GLcontext *ctx, GLuint n, + const GLubyte mask[], + GLchan src[][4], CONST GLchan dst[][4] ); + +typedef void (*swrast_point_func)( GLcontext *ctx, const SWvertex *); + +typedef void (*swrast_line_func)( GLcontext *ctx, + const SWvertex *, const SWvertex *); + +typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *, + const SWvertex *, const SWvertex *); + + +/** \defgroup Bitmasks + * Bitmasks to indicate which rasterization options are enabled + * (RasterMask) + */ +/*@{*/ +#define ALPHATEST_BIT 0x001 /**< Alpha-test pixels */ +#define BLEND_BIT 0x002 /**< Blend pixels */ +#define DEPTH_BIT 0x004 /**< Depth-test pixels */ +#define FOG_BIT 0x008 /**< Fog pixels */ +#define LOGIC_OP_BIT 0x010 /**< Apply logic op in software */ +#define CLIP_BIT 0x020 /**< Scissor or window clip pixels */ +#define STENCIL_BIT 0x040 /**< Stencil pixels */ +#define MASKING_BIT 0x080 /**< Do glColorMask or glIndexMask */ +#define MULTI_DRAW_BIT 0x400 /**< Write to more than one color- */ + /**< buffer or no buffers. */ +#define OCCLUSION_BIT 0x800 /**< GL_HP_occlusion_test enabled */ +#define TEXTURE_BIT 0x1000 /**< Texturing really enabled */ +#define FRAGPROG_BIT 0x2000 /**< Fragment program enabled */ +#define ATIFRAGSHADER_BIT 0x4000 /**< ATI Fragment shader enabled */ +/*@}*/ + +#define _SWRAST_NEW_RASTERMASK (_NEW_BUFFERS| \ + _NEW_SCISSOR| \ + _NEW_COLOR| \ + _NEW_DEPTH| \ + _NEW_FOG| \ + _NEW_PROGRAM| \ + _NEW_STENCIL| \ + _NEW_TEXTURE| \ + _NEW_VIEWPORT| \ + _NEW_DEPTH) + + +/** + * \struct SWcontext + * \brief SWContext? + */ +typedef struct +{ + /** Driver interface: + */ + struct swrast_device_driver Driver; + + /** Configuration mechanisms to make software rasterizer match + * characteristics of the hardware rasterizer (if present): + */ + GLboolean AllowVertexFog; + GLboolean AllowPixelFog; + + /** Derived values, invalidated on statechanges, updated from + * _swrast_validate_derived(): + */ + GLuint _RasterMask; + GLfloat _MinMagThresh[MAX_TEXTURE_IMAGE_UNITS]; + GLfloat _BackfaceSign; + GLboolean _PreferPixelFog; /* Compute fog blend factor per fragment? */ + GLboolean _AnyTextureCombine; + GLchan _FogColor[3]; + GLboolean _FogEnabled; + GLenum _FogMode; /* either GL_FOG_MODE or fragment program's fog mode */ + + /* Accum buffer temporaries. + */ + GLboolean _IntegerAccumMode; /**< Storing unscaled integers? */ + GLfloat _IntegerAccumScaler; /**< Implicit scale factor */ + + /* Working values: + */ + GLuint StippleCounter; /**< Line stipple counter */ + GLuint NewState; + GLuint StateChanges; + GLenum Primitive; /* current primitive being drawn (ala glBegin) */ + GLbitfield CurrentBufferBit; /* exactly one the of DD_*_BIT buffer bits */ + + /** Mechanism to allow driver (like X11) to register further + * software rasterization routines. + */ + /*@{*/ + void (*choose_point)( GLcontext * ); + void (*choose_line)( GLcontext * ); + void (*choose_triangle)( GLcontext * ); + + GLuint invalidate_point; + GLuint invalidate_line; + GLuint invalidate_triangle; + /*@}*/ + + /** Function pointers for dispatch behind public entrypoints. */ + /*@{*/ + void (*InvalidateState)( GLcontext *ctx, GLuint new_state ); + + swrast_point_func Point; + swrast_line_func Line; + swrast_tri_func Triangle; + /*@}*/ + + /** + * Placeholders for when separate specular (or secondary color) is + * enabled but texturing is not. + */ + /*@{*/ + swrast_point_func SpecPoint; + swrast_line_func SpecLine; + swrast_tri_func SpecTriangle; + /*@}*/ + + /** + * Typically, we'll allocate a sw_span structure as a local variable + * and set its 'array' pointer to point to this object. The reason is + * this object is big and causes problems when allocated on the stack + * on some systems. + */ + struct span_arrays *SpanArrays; + + /** + * Used to buffer N GL_POINTS, instead of rendering one by one. + */ + struct sw_span PointSpan; + + /** Internal hooks, kept uptodate by the same mechanism as above. + */ + blend_func BlendFunc; + texture_sample_func TextureSample[MAX_TEXTURE_IMAGE_UNITS]; + + /** Buffer for saving the sampled texture colors. + * Needed for GL_ARB_texture_env_crossbar implementation. + */ + GLchan *TexelBuffer; + +} SWcontext; + + +extern void +_swrast_validate_derived( GLcontext *ctx ); + + +#define SWRAST_CONTEXT(ctx) ((SWcontext *)ctx->swrast_context) + +#define RENDER_START(SWctx, GLctx) \ + do { \ + if ((SWctx)->Driver.SpanRenderStart) { \ + (*(SWctx)->Driver.SpanRenderStart)(GLctx); \ + } \ + } while (0) + +#define RENDER_FINISH(SWctx, GLctx) \ + do { \ + if ((SWctx)->Driver.SpanRenderFinish) { \ + (*(SWctx)->Driver.SpanRenderFinish)(GLctx); \ + } \ + } while (0) + + + +/* + * XXX these macros are just bandages for now in order to make + * CHAN_BITS==32 compile cleanly. + * These should probably go elsewhere at some point. + */ +#if CHAN_TYPE == GL_FLOAT +#define ChanToFixed(X) (X) +#define FixedToChan(X) (X) +#else +#define ChanToFixed(X) IntToFixed(X) +#define FixedToChan(X) FixedToInt(X) +#endif + + + +extern void +_swrast_translate_program( GLcontext *ctx ); + +extern GLboolean +_swrast_execute_codegen_program(GLcontext *ctx, + const struct fragment_program *program, + GLuint maxInst, + struct fp_machine *machine, + const struct sw_span *span, + GLuint column ); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_copypix.c b/reactos/dll/mesa32/src/swrast/s_copypix.c new file mode 100644 index 00000000000..05dc1d911ce --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_copypix.c @@ -0,0 +1,797 @@ +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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. + */ + + +#include "glheader.h" +#include "context.h" +#include "colormac.h" +#include "convolve.h" +#include "histogram.h" +#include "image.h" +#include "macros.h" +#include "imports.h" +#include "pixel.h" + +#include "s_context.h" +#include "s_depth.h" +#include "s_pixeltex.h" +#include "s_span.h" +#include "s_stencil.h" +#include "s_texture.h" +#include "s_zoom.h" + + + +/* + * Determine if there's overlap in an image copy. + * This test also compensates for the fact that copies are done from + * bottom to top and overlaps can sometimes be handled correctly + * without making a temporary image copy. + */ +static GLboolean +regions_overlap(GLint srcx, GLint srcy, + GLint dstx, GLint dsty, + GLint width, GLint height, + GLfloat zoomX, GLfloat zoomY) +{ + if (zoomX == 1.0 && zoomY == 1.0) { + /* no zoom */ + if (srcx >= dstx + width || (srcx + width <= dstx)) { + return GL_FALSE; + } + else if (srcy < dsty) { /* this is OK */ + return GL_FALSE; + } + else if (srcy > dsty + height) { + return GL_FALSE; + } + else { + return GL_TRUE; + } + } + else { + /* add one pixel of slop when zooming, just to be safe */ + if ((srcx > dstx + (width * zoomX) + 1) || (srcx + width + 1 < dstx)) { + return GL_FALSE; + } + else if ((srcy < dsty) && (srcy + height < dsty + (height * zoomY))) { + return GL_FALSE; + } + else if ((srcy > dsty) && (srcy + height > dsty + (height * zoomY))) { + return GL_FALSE; + } + else { + return GL_TRUE; + } + } +} + + +/** + * Convert GLfloat[n][4] colors to GLchan[n][4]. + * XXX maybe move into image.c + */ +static void +float_span_to_chan(GLuint n, CONST GLfloat in[][4], GLchan out[][4]) +{ + GLuint i; + for (i = 0; i < n; i++) { + UNCLAMPED_FLOAT_TO_CHAN(out[i][RCOMP], in[i][RCOMP]); + UNCLAMPED_FLOAT_TO_CHAN(out[i][GCOMP], in[i][GCOMP]); + UNCLAMPED_FLOAT_TO_CHAN(out[i][BCOMP], in[i][BCOMP]); + UNCLAMPED_FLOAT_TO_CHAN(out[i][ACOMP], in[i][ACOMP]); + } +} + + +/** + * Convert GLchan[n][4] colors to GLfloat[n][4]. + * XXX maybe move into image.c + */ +static void +chan_span_to_float(GLuint n, CONST GLchan in[][4], GLfloat out[][4]) +{ + GLuint i; + for (i = 0; i < n; i++) { + out[i][RCOMP] = CHAN_TO_FLOAT(in[i][RCOMP]); + out[i][GCOMP] = CHAN_TO_FLOAT(in[i][GCOMP]); + out[i][BCOMP] = CHAN_TO_FLOAT(in[i][BCOMP]); + out[i][ACOMP] = CHAN_TO_FLOAT(in[i][ACOMP]); + } +} + + + +/* + * RGBA copypixels with convolution. + */ +static void +copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, + GLint width, GLint height, GLint destx, GLint desty) +{ + struct gl_renderbuffer *drawRb = NULL; + GLboolean quick_draw; + GLint row; + GLboolean changeBuffer; + const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; + const GLuint transferOps = ctx->_ImageTransferState; + GLfloat *dest, *tmpImage, *convImage; + struct sw_span span; + + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); + + if (ctx->Depth.Test) + _swrast_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _swrast_span_default_fog(ctx, &span); + + + if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 + && !zoom + && destx >= 0 + && destx + width <= (GLint) ctx->DrawBuffer->Width) { + quick_draw = GL_TRUE; + drawRb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; + } + else { + quick_draw = GL_FALSE; + } + + /* If read and draw buffer are different we must do buffer switching */ + changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer[0] + || ctx->DrawBuffer != ctx->ReadBuffer; + + + /* allocate space for GLfloat image */ + tmpImage = (GLfloat *) MALLOC(width * height * 4 * sizeof(GLfloat)); + if (!tmpImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels"); + return; + } + convImage = (GLfloat *) MALLOC(width * height * 4 * sizeof(GLfloat)); + if (!convImage) { + FREE(tmpImage); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels"); + return; + } + + if (changeBuffer) { + /* choose the read buffer */ + _swrast_use_read_buffer(ctx); + } + + /* read source image */ + dest = tmpImage; + for (row = 0; row < height; row++) { + GLchan rgba[MAX_WIDTH][4]; + /* Read GLchan and convert to GLfloat */ + _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer, + width, srcx, srcy + row, rgba); + chan_span_to_float(width, (CONST GLchan (*)[4]) rgba, + (GLfloat (*)[4]) dest); + dest += 4 * width; + } + + if (changeBuffer) { + /* restore default src/dst buffer */ + _swrast_use_draw_buffer(ctx); + } + + /* do the image transfer ops which preceed convolution */ + for (row = 0; row < height; row++) { + GLfloat (*rgba)[4] = (GLfloat (*)[4]) (tmpImage + row * width * 4); + _mesa_apply_rgba_transfer_ops(ctx, + transferOps & IMAGE_PRE_CONVOLUTION_BITS, + width, rgba); + } + + /* do convolution */ + if (ctx->Pixel.Convolution2DEnabled) { + _mesa_convolve_2d_image(ctx, &width, &height, tmpImage, convImage); + } + else { + ASSERT(ctx->Pixel.Separable2DEnabled); + _mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage); + } + FREE(tmpImage); + + /* do remaining post-convolution image transfer ops */ + for (row = 0; row < height; row++) { + GLfloat (*rgba)[4] = (GLfloat (*)[4]) (convImage + row * width * 4); + _mesa_apply_rgba_transfer_ops(ctx, + transferOps & IMAGE_POST_CONVOLUTION_BITS, + width, rgba); + } + + /* write the new image */ + for (row = 0; row < height; row++) { + const GLfloat *src = convImage + row * width * 4; + GLint dy; + + /* convert floats back to chan */ + float_span_to_chan(width, (const GLfloat (*)[4]) src, span.array->rgba); + + if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) { + span.end = width; + _swrast_pixel_texture(ctx, &span); + } + + /* write row to framebuffer */ + + dy = desty + row; + if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) { + drawRb->PutRow(ctx, drawRb, width, destx, dy, span.array->rgba, NULL); + } + else if (zoom) { + span.x = destx; + span.y = dy; + span.end = width; + _swrast_write_zoomed_rgba_span(ctx, &span, + (CONST GLchan (*)[4])span.array->rgba, + desty, 0); + } + else { + span.x = destx; + span.y = dy; + span.end = width; + _swrast_write_rgba_span(ctx, &span); + } + } + + FREE(convImage); +} + + +/* + * RGBA copypixels + */ +static void +copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, + GLint width, GLint height, GLint destx, GLint desty) +{ + struct gl_renderbuffer *drawRb; + GLchan *tmpImage,*p; + GLboolean quick_draw; + GLint sy, dy, stepy, j; + GLboolean changeBuffer; + const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; + GLint overlapping; + const GLuint transferOps = ctx->_ImageTransferState; + struct sw_span span; + + if (!ctx->ReadBuffer->_ColorReadBuffer) { + /* no readbuffer - OK */ + return; + } + + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); + + if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { + copy_conv_rgba_pixels(ctx, srcx, srcy, width, height, destx, desty); + return; + } + + /* Determine if copy should be done bottom-to-top or top-to-bottom */ + if (srcy < desty) { + /* top-down max-to-min */ + sy = srcy + height - 1; + dy = desty + height - 1; + stepy = -1; + } + else { + /* bottom-up min-to-max */ + sy = srcy; + dy = desty; + stepy = 1; + } + + if (ctx->DrawBuffer == ctx->ReadBuffer) { + overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, + ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); + } + else { + overlapping = GL_FALSE; + } + + if (ctx->Depth.Test) + _swrast_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _swrast_span_default_fog(ctx, &span); + + if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 + && !zoom + && destx >= 0 + && destx + width <= (GLint) ctx->DrawBuffer->Width) { + quick_draw = GL_TRUE; + drawRb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; + } + else { + quick_draw = GL_FALSE; + drawRb = NULL; + } + + /* If read and draw buffer are different we must do buffer switching */ + changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer[0] + || ctx->DrawBuffer != ctx->ReadBuffer; + + if (overlapping) { + GLint ssy = sy; + tmpImage = (GLchan *) MALLOC(width * height * sizeof(GLchan) * 4); + if (!tmpImage) { + _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); + return; + } + /* setup source */ + if (changeBuffer) + _swrast_use_read_buffer(ctx); + /* read the source image */ + p = tmpImage; + for (j = 0; j < height; j++, ssy += stepy) { + _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, + width, srcx, ssy, (GLchan (*)[4]) p ); + p += width * 4; + } + p = tmpImage; + /* restore dest */ + if (changeBuffer) { + _swrast_use_draw_buffer(ctx); + changeBuffer = GL_FALSE; + } + } + else { + tmpImage = NULL; /* silence compiler warnings */ + p = NULL; + } + + for (j = 0; j < height; j++, sy += stepy, dy += stepy) { + /* Get source pixels */ + if (overlapping) { + /* get from buffered image */ + ASSERT(width < MAX_WIDTH); + MEMCPY(span.array->rgba, p, width * sizeof(GLchan) * 4); + p += width * 4; + } + else { + /* get from framebuffer */ + if (changeBuffer) + _swrast_use_read_buffer(ctx); + ASSERT(width < MAX_WIDTH); + _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, + width, srcx, sy, span.array->rgba ); + if (changeBuffer) + _swrast_use_draw_buffer(ctx); + } + + if (transferOps) { + DEFMARRAY(GLfloat, rgbaFloat, MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(rgbaFloat, return); + + /* convert to float, transfer, convert back to chan */ + chan_span_to_float(width, (CONST GLchan (*)[4]) span.array->rgba, + rgbaFloat); + _mesa_apply_rgba_transfer_ops(ctx, transferOps, width, rgbaFloat); + float_span_to_chan(width, (CONST GLfloat (*)[4]) rgbaFloat, + span.array->rgba); + + UNDEFARRAY(rgbaFloat); /* mac 32k limitation */ + } + + if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) { + span.end = width; + _swrast_pixel_texture(ctx, &span); + } + + /* Write color span */ + if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) { + drawRb->PutRow(ctx, drawRb, width, destx, dy, span.array->rgba, NULL); + } + else if (zoom) { + span.x = destx; + span.y = dy; + span.end = width; + _swrast_write_zoomed_rgba_span(ctx, &span, + (CONST GLchan (*)[4]) span.array->rgba, + desty, 0); + } + else { + span.x = destx; + span.y = dy; + span.end = width; + _swrast_write_rgba_span(ctx, &span); + } + } + + if (overlapping) + FREE(tmpImage); +} + + +static void +copy_ci_pixels( GLcontext *ctx, GLint srcx, GLint srcy, + GLint width, GLint height, + GLint destx, GLint desty ) +{ + GLuint *tmpImage,*p; + GLint sy, dy, stepy; + GLint j; + GLboolean changeBuffer; + const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; + const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset; + GLint overlapping; + struct sw_span span; + + if (!ctx->ReadBuffer->_ColorReadBuffer) { + /* no readbuffer - OK */ + return; + } + + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX); + + /* Determine if copy should be bottom-to-top or top-to-bottom */ + if (srcyDrawBuffer == ctx->ReadBuffer) { + overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, + ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); + } + else { + overlapping = GL_FALSE; + } + + if (ctx->Depth.Test) + _swrast_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _swrast_span_default_fog(ctx, &span); + + /* If read and draw buffer are different we must do buffer switching */ + changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer[0] + || ctx->DrawBuffer != ctx->ReadBuffer; + + if (overlapping) { + GLint ssy = sy; + tmpImage = (GLuint *) MALLOC(width * height * sizeof(GLuint)); + if (!tmpImage) { + _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); + return; + } + /* setup source */ + if (changeBuffer) + _swrast_use_read_buffer(ctx); + /* read the image */ + p = tmpImage; + for (j = 0; j < height; j++, ssy += stepy) { + _swrast_read_index_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, + width, srcx, ssy, p ); + p += width; + } + p = tmpImage; + /* restore to draw buffer */ + if (changeBuffer) { + _swrast_use_draw_buffer(ctx); + changeBuffer = GL_FALSE; + } + } + else { + tmpImage = NULL; /* silence compiler warning */ + p = NULL; + } + + for (j = 0; j < height; j++, sy += stepy, dy += stepy) { + /* Get color indexes */ + if (overlapping) { + MEMCPY(span.array->index, p, width * sizeof(GLuint)); + p += width; + } + else { + if (changeBuffer) + _swrast_use_read_buffer(ctx); + _swrast_read_index_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, + width, srcx, sy, span.array->index ); + if (changeBuffer) + _swrast_use_draw_buffer(ctx); + } + + /* Apply shift, offset, look-up table */ + if (shift_or_offset) { + _mesa_shift_and_offset_ci( ctx, width, span.array->index ); + } + if (ctx->Pixel.MapColorFlag) { + _mesa_map_ci( ctx, width, span.array->index ); + } + + /* write color indexes */ + span.x = destx; + span.y = dy; + span.end = width; + if (zoom) + _swrast_write_zoomed_index_span(ctx, &span, desty, 0); + else + _swrast_write_index_span(ctx, &span); + } + + if (overlapping) + FREE(tmpImage); +} + + + +/* + * TODO: Optimize!!!! + */ +static void +copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, + GLint width, GLint height, + GLint destx, GLint desty ) +{ + const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF; + struct gl_renderbuffer *readRb + = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; + GLfloat *p, *tmpImage; + GLint sy, dy, stepy; + GLint i, j; + const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; + GLint overlapping; + struct sw_span span; + + if (!readRb) { + /* no readbuffer - OK */ + return; + } + + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z); + + if (!ctx->Visual.depthBits) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); + return; + } + + /* Determine if copy should be bottom-to-top or top-to-bottom */ + if (srcyDrawBuffer == ctx->ReadBuffer) { + overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, + ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); + } + else { + overlapping = GL_FALSE; + } + + _swrast_span_default_color(ctx, &span); + if (ctx->Fog.Enabled) + _swrast_span_default_fog(ctx, &span); + + if (overlapping) { + GLint ssy = sy; + tmpImage = (GLfloat *) MALLOC(width * height * sizeof(GLfloat)); + if (!tmpImage) { + _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); + return; + } + p = tmpImage; + for (j = 0; j < height; j++, ssy += stepy) { + _swrast_read_depth_span_float(ctx, readRb, width, srcx, ssy, p); + p += width; + } + p = tmpImage; + } + else { + tmpImage = NULL; /* silence compiler warning */ + p = NULL; + } + + for (j = 0; j < height; j++, sy += stepy, dy += stepy) { + GLfloat depth[MAX_WIDTH]; + /* get depth values */ + if (overlapping) { + MEMCPY(depth, p, width * sizeof(GLfloat)); + p += width; + } + else { + _swrast_read_depth_span_float(ctx, readRb, width, srcx, sy, depth); + } + + /* apply scale and bias */ + for (i = 0; i < width; i++) { + GLfloat d = depth[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias; + span.array->z[i] = (GLdepth) (CLAMP(d, 0.0F, 1.0F) * depthMax); + } + + /* write depth values */ + span.x = destx; + span.y = dy; + span.end = width; + if (ctx->Visual.rgbMode) { + if (zoom) + _swrast_write_zoomed_rgba_span( ctx, &span, + (const GLchan (*)[4])span.array->rgba, desty, 0 ); + else + _swrast_write_rgba_span(ctx, &span); + } + else { + if (zoom) + _swrast_write_zoomed_index_span( ctx, &span, desty, 0 ); + else + _swrast_write_index_span(ctx, &span); + } + } + + if (overlapping) + FREE(tmpImage); +} + + + +static void +copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, + GLint width, GLint height, + GLint destx, GLint desty ) +{ + struct gl_renderbuffer *rb + = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer; + GLint sy, dy, stepy; + GLint j; + GLstencil *p, *tmpImage; + const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; + const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset; + GLint overlapping; + + if (!ctx->Visual.stencilBits) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); + return; + } + + if (!rb) { + /* no readbuffer - OK */ + return; + } + + /* Determine if copy should be bottom-to-top or top-to-bottom */ + if (srcy < desty) { + /* top-down max-to-min */ + sy = srcy + height - 1; + dy = desty + height - 1; + stepy = -1; + } + else { + /* bottom-up min-to-max */ + sy = srcy; + dy = desty; + stepy = 1; + } + + if (ctx->DrawBuffer == ctx->ReadBuffer) { + overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, + ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); + } + else { + overlapping = GL_FALSE; + } + + if (overlapping) { + GLint ssy = sy; + tmpImage = (GLstencil *) MALLOC(width * height * sizeof(GLstencil)); + if (!tmpImage) { + _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); + return; + } + p = tmpImage; + for (j = 0; j < height; j++, ssy += stepy) { + _swrast_read_stencil_span( ctx, rb, width, srcx, ssy, p ); + p += width; + } + p = tmpImage; + } + else { + tmpImage = NULL; /* silence compiler warning */ + p = NULL; + } + + for (j = 0; j < height; j++, sy += stepy, dy += stepy) { + GLstencil stencil[MAX_WIDTH]; + + /* Get stencil values */ + if (overlapping) { + MEMCPY(stencil, p, width * sizeof(GLstencil)); + p += width; + } + else { + _swrast_read_stencil_span( ctx, rb, width, srcx, sy, stencil ); + } + + /* Apply shift, offset, look-up table */ + if (shift_or_offset) { + _mesa_shift_and_offset_stencil( ctx, width, stencil ); + } + if (ctx->Pixel.MapStencilFlag) { + _mesa_map_stencil( ctx, width, stencil ); + } + + /* Write stencil values */ + if (zoom) { + _swrast_write_zoomed_stencil_span( ctx, width, destx, dy, + stencil, desty, 0 ); + } + else { + _swrast_write_stencil_span( ctx, width, destx, dy, stencil ); + } + } + + if (overlapping) + FREE(tmpImage); +} + + + +void +_swrast_CopyPixels( GLcontext *ctx, + GLint srcx, GLint srcy, GLsizei width, GLsizei height, + GLint destx, GLint desty, + GLenum type ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + RENDER_START(swrast,ctx); + + if (swrast->NewState) + _swrast_validate_derived( ctx ); + + if (type == GL_COLOR && ctx->Visual.rgbMode) { + copy_rgba_pixels( ctx, srcx, srcy, width, height, destx, desty ); + } + else if (type == GL_COLOR && !ctx->Visual.rgbMode) { + copy_ci_pixels( ctx, srcx, srcy, width, height, destx, desty ); + } + else if (type == GL_DEPTH) { + copy_depth_pixels( ctx, srcx, srcy, width, height, destx, desty ); + } + else if (type == GL_STENCIL) { + copy_stencil_pixels( ctx, srcx, srcy, width, height, destx, desty ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glCopyPixels" ); + } + + RENDER_FINISH(swrast,ctx); +} diff --git a/reactos/dll/mesa32/src/swrast/s_depth.c b/reactos/dll/mesa32/src/swrast/s_depth.c new file mode 100644 index 00000000000..b9d7d894938 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_depth.c @@ -0,0 +1,1365 @@ +/* + * 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. + */ + + +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "imports.h" +#include "fbobject.h" + +#include "s_depth.h" +#include "s_context.h" +#include "s_span.h" + + +/** + * Do depth test for a horizontal span of fragments. + * Input: zbuffer - array of z values in the zbuffer + * z - array of fragment z values + * Return: number of fragments which pass the test. + */ +static GLuint +depth_test_span16( GLcontext *ctx, GLuint n, + GLushort zbuffer[], const GLuint z[], GLubyte mask[] ) +{ + GLuint passed = 0; + + /* switch cases ordered from most frequent to less frequent */ + switch (ctx->Depth.Func) { + case GL_LESS: + if (ctx->Depth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0;iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0;i= zbuffer[i]) { + zbuffer[i] = z[i]; + passed++; + } + else { + mask[i] = 0; + } + } + } + } + else { + /* Don't update Z buffer */ + GLuint i; + for (i=0;i= zbuffer[i]) { + /* pass */ + passed++; + } + else { + mask[i] = 0; + } + } + } + } + break; + case GL_GREATER: + if (ctx->Depth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0;i zbuffer[i]) { + zbuffer[i] = z[i]; + passed++; + } + else { + mask[i] = 0; + } + } + } + } + else { + /* Don't update Z buffer */ + GLuint i; + for (i=0;i zbuffer[i]) { + /* pass */ + passed++; + } + else { + mask[i] = 0; + } + } + } + } + break; + case GL_NOTEQUAL: + if (ctx->Depth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0;iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0;iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0;iDepth.Func) { + case GL_LESS: + if (ctx->Depth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0;iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0;i= zbuffer[i]) { + zbuffer[i] = z[i]; + passed++; + } + else { + mask[i] = 0; + } + } + } + } + else { + /* Don't update Z buffer */ + GLuint i; + for (i=0;i= zbuffer[i]) { + /* pass */ + passed++; + } + else { + mask[i] = 0; + } + } + } + } + break; + case GL_GREATER: + if (ctx->Depth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0;i zbuffer[i]) { + zbuffer[i] = z[i]; + passed++; + } + else { + mask[i] = 0; + } + } + } + } + else { + /* Don't update Z buffer */ + GLuint i; + for (i=0;i zbuffer[i]) { + /* pass */ + passed++; + } + else { + mask[i] = 0; + } + } + } + } + break; + case GL_NOTEQUAL: + if (ctx->Depth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0;iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0;iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0;iDrawBuffer; + struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer; + const GLint x = span->x; + const GLint y = span->y; + const GLuint count = span->end; + const GLuint *zValues = span->array->z; + GLubyte *mask = span->array->mask; + GLuint passed; + + ASSERT((span->arrayMask & SPAN_XY) == 0); + ASSERT(span->arrayMask & SPAN_Z); + + if (rb->GetPointer(ctx, rb, 0, 0)) { + /* Directly access buffer */ + if (ctx->DrawBuffer->Visual.depthBits <= 16) { + GLushort *zbuffer = (GLushort *) rb->GetPointer(ctx, rb, x, y); + passed = depth_test_span16(ctx, count, zbuffer, zValues, mask); + } + else { + GLuint *zbuffer = (GLuint *) rb->GetPointer(ctx, rb, x, y); + passed = depth_test_span32(ctx, count, zbuffer, zValues, mask); + } + } + else { + /* read depth values from buffer, test, write back */ + if (rb->DataType == GL_UNSIGNED_SHORT) { + GLushort zbuffer[MAX_WIDTH]; + rb->GetRow(ctx, rb, count, x, y, zbuffer); + passed = depth_test_span16(ctx, count, zbuffer, zValues, mask ); + rb->PutRow(ctx, rb, count, x, y, zbuffer, NULL); + } + else { + GLuint zbuffer[MAX_WIDTH]; + ASSERT(rb->DataType == GL_UNSIGNED_INT); + rb->GetRow(ctx, rb, count, x, y, zbuffer); + passed = depth_test_span32(ctx, count, zbuffer, zValues, mask ); + rb->PutRow(ctx, rb, count, x, y, zbuffer, NULL); + } + } + + if (passed < count) { + span->writeAll = GL_FALSE; + } + return passed; +} + + + +#define Z_ADDRESS(X, Y) (zStart + (Y) * stride + (X)) + + +/* + * Do depth testing for an array of fragments at assorted locations. + */ +static void +direct_depth_test_pixels16(GLcontext *ctx, GLushort *zStart, GLuint stride, + GLuint n, const GLint x[], const GLint y[], + const GLuint z[], GLubyte mask[] ) +{ + /* switch cases ordered from most frequent to less frequent */ + switch (ctx->Depth.Func) { + case GL_LESS: + if (ctx->Depth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; i= *zptr) { + /* pass */ + *zptr = z[i]; + } + else { + /* fail */ + mask[i] = 0; + } + } + } + } + else { + /* Don't update Z buffer */ + GLuint i; + for (i=0; i= *zptr) { + /* pass */ + } + else { + /* fail */ + mask[i] = 0; + } + } + } + } + break; + case GL_GREATER: + if (ctx->Depth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; i *zptr) { + /* pass */ + *zptr = z[i]; + } + else { + /* fail */ + mask[i] = 0; + } + } + } + } + else { + /* Don't update Z buffer */ + GLuint i; + for (i=0; i *zptr) { + /* pass */ + } + else { + /* fail */ + mask[i] = 0; + } + } + } + } + break; + case GL_NOTEQUAL: + if (ctx->Depth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; iDepth.Func) { + case GL_LESS: + if (ctx->Depth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; i= *zptr) { + /* pass */ + *zptr = z[i]; + } + else { + /* fail */ + mask[i] = 0; + } + } + } + } + else { + /* Don't update Z buffer */ + GLuint i; + for (i=0; i= *zptr) { + /* pass */ + } + else { + /* fail */ + mask[i] = 0; + } + } + } + } + break; + case GL_GREATER: + if (ctx->Depth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; i *zptr) { + /* pass */ + *zptr = z[i]; + } + else { + /* fail */ + mask[i] = 0; + } + } + } + } + else { + /* Don't update Z buffer */ + GLuint i; + for (i=0; i *zptr) { + /* pass */ + } + else { + /* fail */ + mask[i] = 0; + } + } + } + } + break; + case GL_NOTEQUAL: + if (ctx->Depth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; iDepth.Mask) { + /* Update Z buffer */ + GLuint i; + for (i=0; iDrawBuffer; + struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer; + const GLuint count = span->end; + const GLint *x = span->array->x; + const GLint *y = span->array->y; + const GLuint *z = span->array->z; + GLubyte *mask = span->array->mask; + + if (rb->GetPointer(ctx, rb, 0, 0)) { + /* Directly access values */ + if (rb->DataType == GL_UNSIGNED_SHORT) { + GLushort *zStart = (GLushort *) rb->Data; + GLuint stride = rb->Width; + direct_depth_test_pixels16(ctx, zStart, stride, count, x, y, z, mask); + } + else { + GLuint *zStart = (GLuint *) rb->Data; + GLuint stride = rb->Width; + direct_depth_test_pixels32(ctx, zStart, stride, count, x, y, z, mask); + } + } + else { + /* read depth values from buffer, test, write back */ + if (rb->DataType == GL_UNSIGNED_SHORT) { + GLushort zbuffer[MAX_WIDTH]; + _swrast_get_values(ctx, rb, count, x, y, zbuffer, sizeof(GLushort)); + depth_test_span16(ctx, count, zbuffer, z, mask ); + rb->PutValues(ctx, rb, count, x, y, zbuffer, NULL); + } + else { + GLuint zbuffer[MAX_WIDTH]; + ASSERT(rb->DataType == GL_UNSIGNED_INT); + _swrast_get_values(ctx, rb, count, x, y, zbuffer, sizeof(GLuint)); + depth_test_span32(ctx, count, zbuffer, z, mask ); + rb->PutValues(ctx, rb, count, x, y, zbuffer, NULL); + } + } + + return count; /* not really correct, but OK */ +} + + +/** + * Apply depth (Z) buffer testing to the span. + * \return approx number of pixels that passed (only zero is reliable) + */ +GLuint +_swrast_depth_test_span( GLcontext *ctx, struct sw_span *span) +{ + if (span->arrayMask & SPAN_XY) + return depth_test_pixels(ctx, span); + else + return depth_test_span(ctx, span); +} + + +/** + * GL_EXT_depth_bounds_test extension. + * Discard fragments depending on whether the corresponding Z-buffer + * values are outside the depth bounds test range. + * Note: we test the Z buffer values, not the fragment Z values! + * \return GL_TRUE if any fragments pass, GL_FALSE if no fragments pass + */ +GLboolean +_swrast_depth_bounds_test( GLcontext *ctx, struct sw_span *span ) +{ + struct gl_framebuffer *fb = ctx->DrawBuffer; + struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer; + GLuint zMin = (GLuint) (ctx->Depth.BoundsMin * fb->_DepthMaxF + 0.5F); + GLuint zMax = (GLuint) (ctx->Depth.BoundsMax * fb->_DepthMaxF + 0.5F); + GLubyte *mask = span->array->mask; + const GLuint count = span->end; + GLuint i; + GLboolean anyPass = GL_FALSE; + + if (rb->DataType == GL_UNSIGNED_SHORT) { + /* get 16-bit values */ + GLushort zbuffer16[MAX_WIDTH], *zbuffer; + if (span->arrayMask & SPAN_XY) { + _swrast_get_values(ctx, rb, count, span->array->x, span->array->y, + zbuffer16, sizeof(GLushort)); + zbuffer = zbuffer16; + } + else { + zbuffer = rb->GetPointer(ctx, rb, span->x, span->y); + if (!zbuffer) { + rb->GetRow(ctx, rb, count, span->x, span->y, zbuffer16); + zbuffer = zbuffer16; + } + } + assert(zbuffer); + + /* Now do the tests */ + for (i = 0; i < count; i++) { + if (mask[i]) { + if (zbuffer[i] < zMin || zbuffer[i] > zMax) + mask[i] = GL_FALSE; + else + anyPass = GL_TRUE; + } + } + } + else { + /* get 32-bit values */ + GLuint zbuffer32[MAX_WIDTH], *zbuffer; + if (span->arrayMask & SPAN_XY) { + _swrast_get_values(ctx, rb, count, span->array->x, span->array->y, + zbuffer32, sizeof(GLuint)); + zbuffer = zbuffer32; + } + else { + zbuffer = rb->GetPointer(ctx, rb, span->x, span->y); + if (!zbuffer) { + rb->GetRow(ctx, rb, count, span->x, span->y, zbuffer32); + zbuffer = zbuffer32; + } + } + assert(zbuffer); + + /* Now do the tests */ + for (i = 0; i < count; i++) { + if (mask[i]) { + if (zbuffer[i] < zMin || zbuffer[i] > zMax) + mask[i] = GL_FALSE; + else + anyPass = GL_TRUE; + } + } + } + + return anyPass; +} + + + +/**********************************************************************/ +/***** Read Depth Buffer *****/ +/**********************************************************************/ + + +/** + * Read a span of depth values from the depth buffer. + * This function does clipping before calling the device driver function. + * + * XXXX this is no longer a swrast function!!! + * + */ +void +_swrast_read_depth_span( GLcontext *ctx, struct gl_renderbuffer *rb, + GLint n, GLint x, GLint y, GLuint depth[] ) +{ + if (y < 0 || y >= (GLint) rb->Height || + x + (GLint) n <= 0 || x >= (GLint) rb->Width) { + /* span is completely outside framebuffer */ + GLint i; + for (i = 0; i < n; i++) + depth[i] = 0; + return; + } + + if (x < 0) { + GLint dx = -x; + GLint i; + for (i = 0; i < dx; i++) + depth[i] = 0; + x = 0; + n -= dx; + depth += dx; + } + if (x + n > (GLint) rb->Width) { + GLint dx = x + n - (GLint) rb->Width; + GLint i; + for (i = 0; i < dx; i++) + depth[n - i - 1] = 0; + n -= dx; + } + if (n <= 0) { + return; + } + + /* we'll always return 32-bit values to our caller */ + if (!rb) { + _mesa_bzero(depth, n * sizeof(GLuint)); + } + else if (rb->DataType == GL_UNSIGNED_INT) { + rb->GetRow(ctx, rb, n, x, y, depth); + } + else { + GLushort temp[MAX_WIDTH]; + GLuint i; + ASSERT(rb->DataType == GL_UNSIGNED_SHORT); + rb->GetRow(ctx, rb, n, x, y, temp); + for (i = 0; i < n; i++) { + depth[i] = temp[i]; + } + } +} + + +/** + * Return a span of depth values from the depth buffer as floats in [0,1]. + * Input: n - how many pixels + * x,y - location of first pixel + * Output: depth - the array of depth values + */ +void +_swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb, + GLint n, GLint x, GLint y, GLfloat depth[] ) +{ + const GLfloat scale = 1.0F / ctx->DrawBuffer->_DepthMaxF; + GLuint temp[MAX_WIDTH]; + GLint i; + + assert(n <= MAX_WIDTH); + + _swrast_read_depth_span(ctx, rb, n, x, y, temp); + for (i = 0; i < n; i++) { + depth[i] = temp[i] * scale; + } +} + + +/** + * Clear the depth buffer. + */ +void +_swrast_clear_depth_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) +{ + GLuint clearValue; + GLint x, y, width, height; + + if (!rb || !ctx->Depth.Mask) { + /* no depth buffer, or writing to it is disabled */ + return; + } + + /* compute integer clearing value */ + if (ctx->Depth.Clear == 1.0) { + clearValue = ctx->DrawBuffer->_DepthMax; + } + else { + clearValue = (GLuint) (ctx->Depth.Clear * ctx->DrawBuffer->_DepthMaxF); + } + + assert(rb->_BaseFormat == GL_DEPTH_COMPONENT); + + /* compute region to clear */ + x = ctx->DrawBuffer->_Xmin; + y = ctx->DrawBuffer->_Ymin; + width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; + height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; + + if (rb->GetPointer(ctx, rb, 0, 0)) { + /* Direct buffer access is possible. Either this is just malloc'd + * memory, or perhaps the driver mmap'd the zbuffer memory. + */ + if (rb->DataType == GL_UNSIGNED_SHORT) { + if (width == rb->Width && + (clearValue & 0xff) == ((clearValue >> 8) & 0xff)) { + /* optimized case */ + GLushort *dst = (GLushort *) rb->GetPointer(ctx, rb, x, y); + GLuint len = width * height * sizeof(GLushort); + _mesa_memset(dst, (clearValue & 0xff), len); + } + else { + /* general case */ + GLint i, j; + for (i = 0; i < height; i++) { + GLushort *dst = (GLushort *) rb->GetPointer(ctx, rb, x, y + i); + for (j = 0; j < width; j++) { + dst[j] = clearValue; + } + } + } + } + else { + GLint i, j; + ASSERT(rb->DataType == GL_UNSIGNED_INT); + for (i = 0; i < height; i++) { + GLuint *dst = (GLuint *) rb->GetPointer(ctx, rb, x, y + i); + for (j = 0; j < width; j++) { + dst[j] = clearValue; + } + } + } + } + else { + /* Direct access not possible. Use PutRow to write new values. */ + if (rb->DataType == GL_UNSIGNED_SHORT) { + GLushort clearRow[MAX_WIDTH]; + GLint i, j; + for (j = 0; j < width; j++) { + clearRow[j] = clearValue; + } + for (i = 0; i < height; i++) { + rb->PutRow(ctx, rb, width, x, y + i, clearRow, NULL); + } + } + else { + GLuint clearRow[MAX_WIDTH]; + GLint i, j; + assert(rb->DataType == GL_UNSIGNED_INT); + for (j = 0; j < width; j++) { + clearRow[j] = clearValue; + } + for (i = 0; i < height; i++) { + rb->PutRow(ctx, rb, width, x, y + i, clearRow, NULL); + } + } + } +} diff --git a/reactos/dll/mesa32/src/swrast/s_depth.h b/reactos/dll/mesa32/src/swrast/s_depth.h new file mode 100644 index 00000000000..2229e8a22df --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_depth.h @@ -0,0 +1,56 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 S_DEPTH_H +#define S_DEPTH_H + + +#include "mtypes.h" +#include "s_context.h" + + +extern GLuint +_swrast_depth_test_span( GLcontext *ctx, struct sw_span *span); + + +extern GLboolean +_swrast_depth_bounds_test( GLcontext *ctx, struct sw_span *span ); + + +extern void +_swrast_read_depth_span( GLcontext *ctx, struct gl_renderbuffer *rb, + GLint n, GLint x, GLint y, GLuint depth[] ); + + +extern void +_swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb, + GLint n, GLint x, GLint y, GLfloat depth[] ); + + +extern void +_swrast_clear_depth_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_drawpix.c b/reactos/dll/mesa32/src/swrast/s_drawpix.c new file mode 100644 index 00000000000..6204d351753 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_drawpix.c @@ -0,0 +1,1004 @@ +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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. + */ + + +#include "glheader.h" +#include "bufferobj.h" +#include "context.h" +#include "convolve.h" +#include "image.h" +#include "macros.h" +#include "imports.h" +#include "pixel.h" + +#include "s_context.h" +#include "s_drawpix.h" +#include "s_pixeltex.h" +#include "s_span.h" +#include "s_stencil.h" +#include "s_zoom.h" + + +/* + * Try to do a fast and simple RGB(a) glDrawPixels. + * Return: GL_TRUE if success, GL_FALSE if slow path must be used instead + */ +static GLboolean +fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels) +{ + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; + SWcontext *swrast = SWRAST_CONTEXT(ctx); + struct sw_span span; + + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); + + if (!ctx->Current.RasterPosValid) { + return GL_TRUE; /* no-op */ + } + + if (swrast->_RasterMask & MULTI_DRAW_BIT) + return GL_FALSE; + + if (ctx->Depth.Test) + _swrast_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _swrast_span_default_fog(ctx, &span); + if (ctx->Texture._EnabledCoordUnits) + _swrast_span_default_texcoords(ctx, &span); + + if ((SWRAST_CONTEXT(ctx)->_RasterMask & ~CLIP_BIT) == 0 + && ctx->Texture._EnabledCoordUnits == 0 + && unpack->Alignment == 1 + && !unpack->SwapBytes + && !unpack->LsbFirst) { + + GLint destX = x; + GLint destY = y; + GLint drawWidth = width; /* actual width drawn */ + GLint drawHeight = height; /* actual height drawn */ + GLint skipPixels = unpack->SkipPixels; + GLint skipRows = unpack->SkipRows; + GLint rowLength; + GLint zoomY0 = 0; + + if (unpack->RowLength > 0) + rowLength = unpack->RowLength; + else + rowLength = width; + + /* If we're not using pixel zoom then do all clipping calculations + * now. Otherwise, we'll let the _swrast_write_zoomed_*_span() functions + * handle the clipping. + */ + if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { + /* horizontal clipping */ + if (destX < ctx->DrawBuffer->_Xmin) { + skipPixels += (ctx->DrawBuffer->_Xmin - destX); + drawWidth -= (ctx->DrawBuffer->_Xmin - destX); + destX = ctx->DrawBuffer->_Xmin; + } + if (destX + drawWidth > ctx->DrawBuffer->_Xmax) + drawWidth -= (destX + drawWidth - ctx->DrawBuffer->_Xmax); + if (drawWidth <= 0) + return GL_TRUE; + + /* vertical clipping */ + if (destY < ctx->DrawBuffer->_Ymin) { + skipRows += (ctx->DrawBuffer->_Ymin - destY); + drawHeight -= (ctx->DrawBuffer->_Ymin - destY); + destY = ctx->DrawBuffer->_Ymin; + } + if (destY + drawHeight > ctx->DrawBuffer->_Ymax) + drawHeight -= (destY + drawHeight - ctx->DrawBuffer->_Ymax); + if (drawHeight <= 0) + return GL_TRUE; + } + else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { + /* upside-down image */ + /* horizontal clipping */ + if (destX < ctx->DrawBuffer->_Xmin) { + skipPixels += (ctx->DrawBuffer->_Xmin - destX); + drawWidth -= (ctx->DrawBuffer->_Xmin - destX); + destX = ctx->DrawBuffer->_Xmin; + } + if (destX + drawWidth > ctx->DrawBuffer->_Xmax) + drawWidth -= (destX + drawWidth - ctx->DrawBuffer->_Xmax); + if (drawWidth <= 0) + return GL_TRUE; + + /* vertical clipping */ + if (destY > ctx->DrawBuffer->_Ymax) { + skipRows += (destY - ctx->DrawBuffer->_Ymax); + drawHeight -= (destY - ctx->DrawBuffer->_Ymax); + destY = ctx->DrawBuffer->_Ymax; + } + if (destY - drawHeight < ctx->DrawBuffer->_Ymin) + drawHeight -= (ctx->DrawBuffer->_Ymin - (destY - drawHeight)); + if (drawHeight <= 0) + return GL_TRUE; + } + else { + if (drawWidth > MAX_WIDTH) + return GL_FALSE; /* fall back to general case path */ + + /* save Y value of first row */ + zoomY0 = IROUND(ctx->Current.RasterPos[1]); + } + + + /* + * Ready to draw! + * The window region at (destX, destY) of size (drawWidth, drawHeight) + * will be written to. + * We'll take pixel data from buffer pointed to by "pixels" but we'll + * skip "skipRows" rows and skip "skipPixels" pixels/row. + */ + + if (format == GL_RGBA && type == CHAN_TYPE + && ctx->_ImageTransferState==0) { + if (ctx->Visual.rgbMode) { + GLchan *src = (GLchan *) pixels + + (skipRows * rowLength + skipPixels) * 4; + if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { + /* no zooming */ + GLint row; + for (row=0; rowPutRow(ctx, rb, drawWidth, destX, destY, src, NULL); + src += rowLength * 4; + destY++; + } + } + else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { + /* upside-down */ + GLint row; + for (row=0; rowPutRow(ctx, rb, drawWidth, destX, destY, src, NULL); + src += rowLength * 4; + } + } + else { + /* with zooming */ + GLint row; + for (row=0; row_ImageTransferState == 0) { + if (ctx->Visual.rgbMode) { + GLchan *src = (GLchan *) pixels + + (skipRows * rowLength + skipPixels) * 3; + if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { + GLint row; + for (row=0; rowPutRowRGB(ctx, rb, drawWidth, destX, destY, src, NULL); + src += rowLength * 3; + destY++; + } + } + else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { + /* upside-down */ + GLint row; + for (row=0; rowPutRowRGB(ctx, rb, drawWidth, destX, destY, src, NULL); + src += rowLength * 3; + } + } + else { + /* with zooming */ + GLint row; + for (row=0; row_ImageTransferState==0) { + if (ctx->Visual.rgbMode) { + GLchan *src = (GLchan *) pixels + + (skipRows * rowLength + skipPixels); + if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { + /* no zooming */ + GLint row; + ASSERT(drawWidth <= MAX_WIDTH); + for (row=0; rowrgb[i][0] = src[i]; + span.array->rgb[i][1] = src[i]; + span.array->rgb[i][2] = src[i]; + } + rb->PutRowRGB(ctx, rb, drawWidth, destX, destY, + span.array->rgb, NULL); + src += rowLength; + destY++; + } + } + else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { + /* upside-down */ + GLint row; + ASSERT(drawWidth <= MAX_WIDTH); + for (row=0; rowrgb[i][0] = src[i]; + span.array->rgb[i][1] = src[i]; + span.array->rgb[i][2] = src[i]; + } + destY--; + rb->PutRow(ctx, rb, drawWidth, destX, destY, + span.array->rgb, NULL); + src += rowLength; + } + } + else { + /* with zooming */ + GLint row; + ASSERT(drawWidth <= MAX_WIDTH); + for (row=0; rowrgb[i][0] = src[i]; + span.array->rgb[i][1] = src[i]; + span.array->rgb[i][2] = src[i]; + } + span.x = destX; + span.y = destY; + span.end = drawWidth; + _swrast_write_zoomed_rgb_span(ctx, &span, + (CONST GLchan (*)[3]) span.array->rgb, zoomY0, 0); + src += rowLength; + destY++; + } + } + } + return GL_TRUE; + } + else if (format == GL_LUMINANCE_ALPHA && type == CHAN_TYPE + && ctx->_ImageTransferState == 0) { + if (ctx->Visual.rgbMode) { + GLchan *src = (GLchan *) pixels + + (skipRows * rowLength + skipPixels)*2; + if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { + /* no zooming */ + GLint row; + ASSERT(drawWidth <= MAX_WIDTH); + for (row=0; rowrgba[i][0] = *ptr; + span.array->rgba[i][1] = *ptr; + span.array->rgba[i][2] = *ptr++; + span.array->rgba[i][3] = *ptr++; + } + rb->PutRow(ctx, rb, drawWidth, destX, destY, + span.array->rgba, NULL); + src += rowLength*2; + destY++; + } + } + else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { + /* upside-down */ + GLint row; + ASSERT(drawWidth <= MAX_WIDTH); + for (row=0; rowrgba[i][0] = *ptr; + span.array->rgba[i][1] = *ptr; + span.array->rgba[i][2] = *ptr++; + span.array->rgba[i][3] = *ptr++; + } + destY--; + rb->PutRow(ctx, rb, drawWidth, destX, destY, + span.array->rgba, NULL); + src += rowLength*2; + } + } + else { + /* with zooming */ + GLint row; + ASSERT(drawWidth <= MAX_WIDTH); + for (row=0; rowrgba[i][0] = *ptr; + span.array->rgba[i][1] = *ptr; + span.array->rgba[i][2] = *ptr++; + span.array->rgba[i][3] = *ptr++; + } + span.x = destX; + span.y = destY; + span.end = drawWidth; + _swrast_write_zoomed_rgba_span(ctx, &span, + (CONST GLchan (*)[4]) span.array->rgba, zoomY0, 0); + src += rowLength*2; + destY++; + } + } + } + return GL_TRUE; + } + else if (format==GL_COLOR_INDEX && type==GL_UNSIGNED_BYTE) { + GLubyte *src = (GLubyte *) pixels + skipRows * rowLength + skipPixels; + if (ctx->Visual.rgbMode) { + /* convert CI data to RGBA */ + if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { + /* no zooming */ + GLint row; + for (row=0; rowrgba); + rb->PutRow(ctx, rb, drawWidth, destX, destY, + span.array->rgba, NULL); + src += rowLength; + destY++; + } + return GL_TRUE; + } + else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { + /* upside-down */ + GLint row; + for (row=0; rowrgba); + destY--; + rb->PutRow(ctx, rb, drawWidth, destX, destY, + span.array->rgba, NULL); + src += rowLength; + } + return GL_TRUE; + } + else { + /* with zooming */ + GLint row; + for (row=0; rowrgba); + span.x = destX; + span.y = destY; + span.end = drawWidth; + _swrast_write_zoomed_rgba_span(ctx, &span, + (CONST GLchan (*)[4]) span.array->rgba, zoomY0, 0); + src += rowLength; + destY++; + } + return GL_TRUE; + } + } + else if (ctx->_ImageTransferState==0) { + /* write CI data to CI frame buffer */ + GLint row; + if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { + /* no zooming */ + for (row=0; rowPutRow(ctx, rb, drawWidth, destX, destY, index32, NULL); + src += rowLength; + destY++; + } + return GL_TRUE; + } + else { + /* with zooming */ + return GL_FALSE; + } + } + } + else { + /* can't handle this pixel format and/or data type here */ + return GL_FALSE; + } + } + + /* can't do a simple draw, have to use slow path */ + return GL_FALSE; +} + + + +/* + * Draw color index image. + */ +static void +draw_index_pixels( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ) +{ + const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; + GLint row, skipPixels; + struct sw_span span; + + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX); + + if (ctx->Depth.Test) + _swrast_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _swrast_span_default_fog(ctx, &span); + + /* + * General solution + */ + skipPixels = 0; + while (skipPixels < width) { + const GLint spanX = x + (zoom ? 0 : skipPixels); + GLint spanY = y; + const GLint spanEnd = (width - skipPixels > MAX_WIDTH) + ? MAX_WIDTH : (width - skipPixels); + ASSERT(spanEnd <= MAX_WIDTH); + for (row = 0; row < height; row++, spanY++) { + const GLvoid *source = _mesa_image_address2d(unpack, pixels, + width, height, + GL_COLOR_INDEX, type, + row, skipPixels); + _mesa_unpack_index_span(ctx, spanEnd, GL_UNSIGNED_INT, + span.array->index, type, source, unpack, + ctx->_ImageTransferState); + + /* These may get changed during writing/clipping */ + span.x = spanX; + span.y = spanY; + span.end = spanEnd; + + if (zoom) + _swrast_write_zoomed_index_span(ctx, &span, y, skipPixels); + else + _swrast_write_index_span(ctx, &span); + } + skipPixels += spanEnd; + } +} + + + +/* + * Draw stencil image. + */ +static void +draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ) +{ + const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; + const GLint desty = y; + GLint row, skipPixels; + + if (type != GL_BYTE && + type != GL_UNSIGNED_BYTE && + type != GL_SHORT && + type != GL_UNSIGNED_SHORT && + type != GL_INT && + type != GL_UNSIGNED_INT && + type != GL_FLOAT && + type != GL_BITMAP) { + _mesa_error( ctx, GL_INVALID_ENUM, "glDrawPixels(stencil type)"); + return; + } + + if (ctx->Visual.stencilBits == 0) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawPixels(no stencil buffer)"); + return; + } + + /* if width > MAX_WIDTH, have to process image in chunks */ + skipPixels = 0; + while (skipPixels < width) { + const GLint spanX = x; + GLint spanY = y; + const GLint spanWidth = (width - skipPixels > MAX_WIDTH) + ? MAX_WIDTH : (width - skipPixels); + + for (row = 0; row < height; row++, spanY++) { + GLstencil values[MAX_WIDTH]; + GLenum destType = (sizeof(GLstencil) == sizeof(GLubyte)) + ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT; + const GLvoid *source = _mesa_image_address2d(unpack, pixels, + width, height, + GL_COLOR_INDEX, type, + row, skipPixels); + _mesa_unpack_index_span(ctx, spanWidth, destType, values, + type, source, unpack, + ctx->_ImageTransferState); + if (ctx->_ImageTransferState & IMAGE_SHIFT_OFFSET_BIT) { + _mesa_shift_and_offset_stencil(ctx, spanWidth, values); + } + if (ctx->Pixel.MapStencilFlag) { + _mesa_map_stencil(ctx, spanWidth, values); + } + + if (zoom) { + _swrast_write_zoomed_stencil_span(ctx, (GLuint) spanWidth, + spanX, spanY, values, desty, 0); + } + else { + _swrast_write_stencil_span(ctx, spanWidth, spanX, spanY, values); + } + } + skipPixels += spanWidth; + } +} + + +/* + * Draw depth image. + */ +static void +draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ) +{ + const GLboolean bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0; + const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0; + const GLint desty = y; + struct sw_span span; + + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z); + + if (type != GL_BYTE + && type != GL_UNSIGNED_BYTE + && type != GL_SHORT + && type != GL_UNSIGNED_SHORT + && type != GL_INT + && type != GL_UNSIGNED_INT + && type != GL_FLOAT) { + _mesa_error(ctx, GL_INVALID_ENUM, "glDrawPixels(type)"); + return; + } + + _swrast_span_default_color(ctx, &span); + + if (ctx->Fog.Enabled) + _swrast_span_default_fog(ctx, &span); + if (ctx->Texture._EnabledCoordUnits) + _swrast_span_default_texcoords(ctx, &span); + + if (type == GL_UNSIGNED_SHORT + && ctx->Visual.depthBits == 16 + && !bias_or_scale + && !zoom + && ctx->Visual.rgbMode + && width <= MAX_WIDTH) { + /* Special case: directly write 16-bit depth values */ + GLint row, spanY = y; + for (row = 0; row < height; row++, spanY++) { + const GLushort *zSrc = (const GLushort *) + _mesa_image_address2d(unpack, pixels, width, height, + GL_DEPTH_COMPONENT, type, row, 0); + GLint i; + for (i = 0; i < width; i++) + span.array->z[i] = zSrc[i]; + span.x = x; + span.y = spanY; + span.end = width; + _swrast_write_rgba_span(ctx, &span); + } + } + else if (type == GL_UNSIGNED_INT + && sizeof(GLdepth) == 4 + && !bias_or_scale + && !zoom + && ctx->Visual.rgbMode + && width <= MAX_WIDTH) { + /* Special case: shift 32-bit values down to ctx->Visual.depthBits */ + const GLint shift = 32 - ctx->Visual.depthBits; + GLint row, spanY = y; + for (row = 0; row < height; row++, spanY++) { + const GLuint *zSrc = (const GLuint *) + _mesa_image_address2d(unpack, pixels, width, height, + GL_DEPTH_COMPONENT, type, row, 0); + if (shift == 0) { + MEMCPY(span.array->z, zSrc, width * sizeof(GLdepth)); + } + else { + GLint col; + for (col = 0; col < width; col++) + span.array->z[col] = zSrc[col] >> shift; + } + span.x = x; + span.y = spanY; + span.end = width; + _swrast_write_rgba_span(ctx, &span); + } + } + else { + /* General case */ + const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF; + GLint row, skipPixels = 0; + + /* in case width > MAX_WIDTH do the copy in chunks */ + while (skipPixels < width) { + const GLint spanX = x + (zoom ? 0 : skipPixels); + GLint spanY = y; + const GLint spanEnd = (width - skipPixels > MAX_WIDTH) + ? MAX_WIDTH : (width - skipPixels); + ASSERT(span.end <= MAX_WIDTH); + for (row = 0; row < height; row++, spanY++) { + GLfloat floatSpan[MAX_WIDTH]; + const GLvoid *zSrc = _mesa_image_address2d(unpack, + pixels, width, height, + GL_DEPTH_COMPONENT, type, + row, skipPixels); + + /* Set these for each row since the _swrast_write_* function may + * change them while clipping. + */ + span.x = spanX; + span.y = spanY; + span.end = spanEnd; + + _mesa_unpack_depth_span(ctx, span.end, floatSpan, type, + zSrc, unpack); + /* clamp depth values to [0,1] and convert from floats to ints */ + { + GLuint i; + for (i = 0; i < span.end; i++) { + span.array->z[i] = (GLdepth) (floatSpan[i] * depthMax); + } + } + if (zoom) { + _swrast_write_zoomed_depth_span(ctx, &span, desty, skipPixels); + } + else if (ctx->Visual.rgbMode) { + _swrast_write_rgba_span(ctx, &span); + } + else { + _swrast_write_index_span(ctx, &span); + } + } + skipPixels += spanEnd; + } + } +} + + + +/* + * Draw RGBA image. + */ +static void +draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ) +{ + struct gl_renderbuffer *rb = NULL; /* only used for quickDraw path */ + const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; + const GLint desty = y; + GLboolean quickDraw; + GLfloat *convImage = NULL; + GLuint transferOps = ctx->_ImageTransferState; + struct sw_span span; + + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); + + if (!_mesa_is_legal_format_and_type(ctx, format, type)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glDrawPixels(format or type)"); + return; + } + + /* Try an optimized glDrawPixels first */ + if (fast_draw_pixels(ctx, x, y, width, height, format, type, unpack, pixels)) + return; + + if (ctx->Depth.Test) + _swrast_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _swrast_span_default_fog(ctx, &span); + if (ctx->Texture._EnabledCoordUnits) + _swrast_span_default_texcoords(ctx, &span); + + if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0 + && x + width <= (GLint) ctx->DrawBuffer->Width + && y + height <= (GLint) ctx->DrawBuffer->Height + && ctx->DrawBuffer->_NumColorDrawBuffers[0] == 1) { + quickDraw = GL_TRUE; + rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; + } + else { + quickDraw = GL_FALSE; + rb = NULL; + } + + if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { + /* Convolution has to be handled specially. We'll create an + * intermediate image, applying all pixel transfer operations + * up to convolution. Then we'll convolve the image. Then + * we'll proceed with the rest of the transfer operations and + * rasterize the image. + */ + GLint row; + GLfloat *dest, *tmpImage; + + tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); + if (!tmpImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels"); + return; + } + convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); + if (!convImage) { + _mesa_free(tmpImage); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels"); + return; + } + + /* Unpack the image and apply transfer ops up to convolution */ + dest = tmpImage; + for (row = 0; row < height; row++) { + const GLvoid *source = _mesa_image_address2d(unpack, + pixels, width, height, format, type, row, 0); + _mesa_unpack_color_span_float(ctx, width, GL_RGBA, (GLfloat *) dest, + format, type, source, unpack, + transferOps & IMAGE_PRE_CONVOLUTION_BITS); + dest += width * 4; + } + + /* do convolution */ + if (ctx->Pixel.Convolution2DEnabled) { + _mesa_convolve_2d_image(ctx, &width, &height, tmpImage, convImage); + } + else { + ASSERT(ctx->Pixel.Separable2DEnabled); + _mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage); + } + _mesa_free(tmpImage); + + /* continue transfer ops and draw the convolved image */ + unpack = &ctx->DefaultPacking; + pixels = convImage; + format = GL_RGBA; + type = GL_FLOAT; + transferOps &= IMAGE_POST_CONVOLUTION_BITS; + } + + /* + * General solution + */ + { + const GLuint interpMask = span.interpMask; + const GLuint arrayMask = span.arrayMask; + GLint row, skipPixels = 0; + + /* if the span is wider than MAX_WIDTH we have to do it in chunks */ + while (skipPixels < width) { + const GLint spanX = x + (zoom ? 0 : skipPixels); + GLint spanY = y; + const GLint spanEnd = (width - skipPixels > MAX_WIDTH) + ? MAX_WIDTH : (width - skipPixels); + ASSERT(span.end <= MAX_WIDTH); + + for (row = 0; row < height; row++, spanY++) { + const GLvoid *source = _mesa_image_address2d(unpack, + pixels, width, height, format, type, row, skipPixels); + + /* Set these for each row since the _swrast_write_* function may + * change them while clipping. + */ + span.x = spanX; + span.y = spanY; + span.end = spanEnd; + span.arrayMask = arrayMask; + span.interpMask = interpMask; + + _mesa_unpack_color_span_chan(ctx, span.end, GL_RGBA, + (GLchan *) span.array->rgba, + format, type, source, unpack, + transferOps); + + if ((ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink) || + (ctx->Pixel.HistogramEnabled && ctx->Histogram.Sink)) + continue; + + if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) { + _swrast_pixel_texture(ctx, &span); + } + + /* draw the span */ + if (quickDraw) { + rb->PutRow(ctx, rb, span.end, span.x, span.y, + span.array->rgba, NULL); + } + else if (zoom) { + _swrast_write_zoomed_rgba_span(ctx, &span, + (CONST GLchan (*)[4]) span.array->rgba, desty, skipPixels); + } + else { + _swrast_write_rgba_span(ctx, &span); + } + } + + skipPixels += spanEnd; + } + } + + if (convImage) { + _mesa_free(convImage); + } +} + + + +/* + * Execute glDrawPixels + */ +void +_swrast_DrawPixels( GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + if (swrast->NewState) + _swrast_validate_derived( ctx ); + + if (unpack->BufferObj->Name) { + /* unpack from PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, + format, type, pixels)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawPixels(invalid PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, + unpack->BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)"); + return; + } + pixels = ADD_POINTERS(buf, pixels); + } + + RENDER_START(swrast,ctx); + + switch (format) { + case GL_STENCIL_INDEX: + draw_stencil_pixels( ctx, x, y, width, height, type, unpack, pixels ); + break; + case GL_DEPTH_COMPONENT: + draw_depth_pixels( ctx, x, y, width, height, type, unpack, pixels ); + break; + case GL_COLOR_INDEX: + if (ctx->Visual.rgbMode) + draw_rgba_pixels(ctx, x,y, width, height, format, type, unpack, pixels); + else + draw_index_pixels(ctx, x, y, width, height, type, unpack, pixels); + break; + 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: + draw_rgba_pixels(ctx, x, y, width, height, format, type, unpack, pixels); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glDrawPixels(format)" ); + /* don't return yet, clean-up */ + } + + RENDER_FINISH(swrast,ctx); + + if (unpack->BufferObj->Name) { + /* done with PBO so unmap it now */ + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + unpack->BufferObj); + } +} + + + +#if 0 /* experimental */ +/* + * Execute glDrawDepthPixelsMESA(). + */ +void +_swrast_DrawDepthPixelsMESA( GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum colorFormat, GLenum colorType, + const GLvoid *colors, + GLenum depthType, const GLvoid *depths, + const struct gl_pixelstore_attrib *unpack ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + if (swrast->NewState) + _swrast_validate_derived( ctx ); + + RENDER_START(swrast,ctx); + + switch (colorFormat) { + case GL_COLOR_INDEX: + if (ctx->Visual.rgbMode) + draw_rgba_pixels(ctx, x,y, width, height, colorFormat, colorType, unpack, colors); + else + draw_index_pixels(ctx, x, y, width, height, colorType, unpack, colors); + break; + 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: + draw_rgba_pixels(ctx, x, y, width, height, colorFormat, colorType, unpack, colors); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, + "glDrawDepthPixelsMESA(colorFormat)" ); + } + + RENDER_FINISH(swrast,ctx); +} +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_drawpix.h b/reactos/dll/mesa32/src/swrast/s_drawpix.h new file mode 100644 index 00000000000..66067115ddb --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_drawpix.h @@ -0,0 +1,36 @@ + +/* + * 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 S_DRAWPIXELS_H +#define S_DRAWPIXELS_H + + +#include "mtypes.h" +#include "swrast.h" + +/* XXX kill this header? */ + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_feedback.c b/reactos/dll/mesa32/src/swrast/s_feedback.c new file mode 100644 index 00000000000..26cb05cd560 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_feedback.c @@ -0,0 +1,161 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "enums.h" +#include "feedback.h" +#include "macros.h" + +#include "s_context.h" +#include "s_feedback.h" +#include "s_triangle.h" + + +#define FB_3D 0x01 +#define FB_4D 0x02 +#define FB_INDEX 0x04 +#define FB_COLOR 0x08 +#define FB_TEXTURE 0X10 + + + + +static void feedback_vertex( GLcontext *ctx, + const SWvertex *v, const SWvertex *pv ) +{ + const GLuint texUnit = 0; /* See section 5.3 of 1.2.1 spec */ + GLfloat win[4]; + GLfloat color[4]; + GLfloat tc[4]; + + win[0] = v->win[0]; + win[1] = v->win[1]; + win[2] = v->win[2] / ctx->DrawBuffer->_DepthMaxF; + win[3] = 1.0F / v->win[3]; + + color[0] = CHAN_TO_FLOAT(pv->color[0]); + color[1] = CHAN_TO_FLOAT(pv->color[1]); + color[2] = CHAN_TO_FLOAT(pv->color[2]); + color[3] = CHAN_TO_FLOAT(pv->color[3]); + + if (v->texcoord[texUnit][3] != 1.0 && + v->texcoord[texUnit][3] != 0.0) { + GLfloat invq = 1.0F / v->texcoord[texUnit][3]; + tc[0] = v->texcoord[texUnit][0] * invq; + tc[1] = v->texcoord[texUnit][1] * invq; + tc[2] = v->texcoord[texUnit][2] * invq; + tc[3] = v->texcoord[texUnit][3]; + } + else { + COPY_4V(tc, v->texcoord[texUnit]); + } + + _mesa_feedback_vertex( ctx, win, color, (GLfloat) v->index, tc ); +} + + +/* + * Put triangle in feedback buffer. + */ +void _swrast_feedback_triangle( GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2) +{ + if (_swrast_culltriangle( ctx, v0, v1, v2 )) { + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN ); + FEEDBACK_TOKEN( ctx, (GLfloat) 3 ); /* three vertices */ + + if (ctx->Light.ShadeModel == GL_SMOOTH) { + feedback_vertex( ctx, v0, v0 ); + feedback_vertex( ctx, v1, v1 ); + feedback_vertex( ctx, v2, v2 ); + } else { + feedback_vertex( ctx, v0, v2 ); + feedback_vertex( ctx, v1, v2 ); + feedback_vertex( ctx, v2, v2 ); + } + } +} + + +void _swrast_feedback_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) +{ + GLenum token = GL_LINE_TOKEN; + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + if (swrast->StippleCounter==0) + token = GL_LINE_RESET_TOKEN; + + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) token ); + + if (ctx->Light.ShadeModel == GL_SMOOTH) { + feedback_vertex( ctx, v0, v0 ); + feedback_vertex( ctx, v1, v1 ); + } else { + feedback_vertex( ctx, v0, v1 ); + feedback_vertex( ctx, v1, v1 ); + } + + swrast->StippleCounter++; +} + + +void _swrast_feedback_point( GLcontext *ctx, const SWvertex *v ) +{ + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POINT_TOKEN ); + feedback_vertex( ctx, v, v ); +} + + +void _swrast_select_triangle( GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2) +{ + if (_swrast_culltriangle( ctx, v0, v1, v2 )) { + const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; + + _mesa_update_hitflag( ctx, v0->win[2] * zs ); + _mesa_update_hitflag( ctx, v1->win[2] * zs ); + _mesa_update_hitflag( ctx, v2->win[2] * zs ); + } +} + + +void _swrast_select_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) +{ + const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; + _mesa_update_hitflag( ctx, v0->win[2] * zs ); + _mesa_update_hitflag( ctx, v1->win[2] * zs ); +} + + +void _swrast_select_point( GLcontext *ctx, const SWvertex *v ) +{ + const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; + _mesa_update_hitflag( ctx, v->win[2] * zs ); +} diff --git a/reactos/dll/mesa32/src/swrast/s_feedback.h b/reactos/dll/mesa32/src/swrast/s_feedback.h new file mode 100644 index 00000000000..73f45c10be5 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_feedback.h @@ -0,0 +1,51 @@ + +/* + * 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 S_FEEDBACK_H +#define S_FEEDBACK_H + + +#include "mtypes.h" +#include "swrast.h" + + +extern void _swrast_feedback_point( GLcontext *ctx, const SWvertex *v ); + +extern void _swrast_feedback_line( GLcontext *ctx, + const SWvertex *v1, const SWvertex *v2 ); + +extern void _swrast_feedback_triangle( GLcontext *ctx, const SWvertex *v0, + const SWvertex *v1, const SWvertex *v2 ); + +extern void _swrast_select_point( GLcontext *ctx, const SWvertex *v ); + +extern void _swrast_select_line( GLcontext *ctx, + const SWvertex *v1, const SWvertex *v2 ); + +extern void _swrast_select_triangle( GLcontext *ctx, const SWvertex *v0, + const SWvertex *v1, const SWvertex *v2 ); + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_fog.c b/reactos/dll/mesa32/src/swrast/s_fog.c new file mode 100644 index 00000000000..0af9cd8f284 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_fog.c @@ -0,0 +1,327 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" + +#include "s_context.h" +#include "s_fog.h" +#include "s_span.h" + + +/** + * Used to convert current raster distance to a fog factor in [0,1]. + */ +GLfloat +_swrast_z_to_fogfactor(GLcontext *ctx, GLfloat z) +{ + GLfloat d, f; + + switch (ctx->Fog.Mode) { + case GL_LINEAR: + if (ctx->Fog.Start == ctx->Fog.End) + d = 1.0F; + else + d = 1.0F / (ctx->Fog.End - ctx->Fog.Start); + f = (ctx->Fog.End - z) * d; + return CLAMP(f, 0.0F, 1.0F); + case GL_EXP: + d = ctx->Fog.Density; + f = (GLfloat) exp(-d * z); + f = CLAMP(f, 0.0F, 1.0F); + return f; + case GL_EXP2: + d = ctx->Fog.Density; + f = (GLfloat) exp(-(d * d * z * z)); + f = CLAMP(f, 0.0F, 1.0F); + return f; + default: + _mesa_problem(ctx, "Bad fog mode in _swrast_z_to_fogfactor"); + return 0.0; + } +} + + +/** + * Apply fog to a span of RGBA pixels. + * The fog value are either in the span->array->fog array or interpolated from + * the fog/fogStep values. + * They fog values are either fog coordinates (Z) or fog blend factors. + * _PreferPixelFog should be in sync with that state! + */ +void +_swrast_fog_rgba_span( const GLcontext *ctx, struct sw_span *span ) +{ + const SWcontext *swrast = SWRAST_CONTEXT(ctx); + const GLchan rFog = swrast->_FogColor[RCOMP]; + const GLchan gFog = swrast->_FogColor[GCOMP]; + const GLchan bFog = swrast->_FogColor[BCOMP]; + const GLuint haveW = (span->interpMask & SPAN_W); + GLchan (*rgba)[4] = (GLchan (*)[4]) span->array->rgba; + + ASSERT(swrast->_FogEnabled); + ASSERT((span->interpMask | span->arrayMask) & SPAN_FOG); + ASSERT(span->arrayMask & SPAN_RGBA); + + /* NOTE: if haveW is true, that means the fog start/step values are + * perspective-corrected and we have to divide each fog coord by W. + */ + + /* we need to compute fog blend factors */ + if (swrast->_PreferPixelFog) { + /* The span's fog values are fog coordinates, now compute blend factors + * and blend the fragment colors with the fog color. + */ + switch (swrast->_FogMode) { + case GL_LINEAR: + { + const GLfloat fogEnd = ctx->Fog.End; + const GLfloat fogScale = (ctx->Fog.Start == ctx->Fog.End) + ? 1.0F : 1.0F / (ctx->Fog.End - ctx->Fog.Start); + const GLfloat fogStep = span->fogStep; + GLfloat fogCoord = span->fog; + const GLfloat wStep = haveW ? span->dwdx : 0.0F; + GLfloat w = haveW ? span->w : 1.0F; + GLuint i; + for (i = 0; i < span->end; i++) { + GLfloat f, oneMinusF; + f = (fogEnd - FABSF(fogCoord) / w) * fogScale; + f = CLAMP(f, 0.0F, 1.0F); + oneMinusF = 1.0F - f; + rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + oneMinusF * rFog); + rgba[i][GCOMP] = (GLchan) (f * rgba[i][GCOMP] + oneMinusF * gFog); + rgba[i][BCOMP] = (GLchan) (f * rgba[i][BCOMP] + oneMinusF * bFog); + fogCoord += fogStep; + w += wStep; + } + } + break; + case GL_EXP: + { + const GLfloat density = -ctx->Fog.Density; + const GLfloat fogStep = span->fogStep; + GLfloat fogCoord = span->fog; + const GLfloat wStep = haveW ? span->dwdx : 0.0F; + GLfloat w = haveW ? span->w : 1.0F; + GLuint i; + for (i = 0; i < span->end; i++) { + GLfloat f, oneMinusF; + f = (GLfloat) exp(density * FABSF(fogCoord) / w); + f = CLAMP(f, 0.0F, 1.0F); + oneMinusF = 1.0F - f; + rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + oneMinusF * rFog); + rgba[i][GCOMP] = (GLchan) (f * rgba[i][GCOMP] + oneMinusF * gFog); + rgba[i][BCOMP] = (GLchan) (f * rgba[i][BCOMP] + oneMinusF * bFog); + fogCoord += fogStep; + w += wStep; + } + } + break; + case GL_EXP2: + { + const GLfloat negDensitySquared = -ctx->Fog.Density * ctx->Fog.Density; + const GLfloat fogStep = span->fogStep; + GLfloat fogCoord = span->fog; + const GLfloat wStep = haveW ? span->dwdx : 0.0F; + GLfloat w = haveW ? span->w : 1.0F; + GLuint i; + for (i = 0; i < span->end; i++) { + const GLfloat coord = fogCoord / w; + GLfloat tmp = negDensitySquared * coord * coord; + GLfloat f, oneMinusF; +#if defined(__alpha__) || defined(__alpha) + /* XXX this underflow check may be needed for other systems*/ + if (tmp < FLT_MIN_10_EXP) + tmp = FLT_MIN_10_EXP; +#endif + f = (GLfloat) exp(tmp); + f = CLAMP(f, 0.0F, 1.0F); + oneMinusF = 1.0F - f; + rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + oneMinusF * rFog); + rgba[i][GCOMP] = (GLchan) (f * rgba[i][GCOMP] + oneMinusF * gFog); + rgba[i][BCOMP] = (GLchan) (f * rgba[i][BCOMP] + oneMinusF * bFog); + fogCoord += fogStep; + w += wStep; + } + } + break; + default: + _mesa_problem(ctx, "Bad fog mode in _swrast_fog_rgba_span"); + return; + } + } + else if (span->arrayMask & SPAN_FOG) { + /* The span's fog array values are blend factors. + * They were previously computed per-vertex. + */ + GLuint i; + for (i = 0; i < span->end; i++) { + const GLfloat f = span->array->fog[i]; + const GLfloat oneMinusF = 1.0F - f; + rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + oneMinusF * rFog); + rgba[i][GCOMP] = (GLchan) (f * rgba[i][GCOMP] + oneMinusF * gFog); + rgba[i][BCOMP] = (GLchan) (f * rgba[i][BCOMP] + oneMinusF * bFog); + } + } + else { + /* The span's fog start/step values are blend factors. + * They were previously computed per-vertex. + */ + const GLfloat fogStep = span->fogStep; + GLfloat fog = span->fog; + const GLfloat wStep = haveW ? span->dwdx : 0.0F; + GLfloat w = haveW ? span->w : 1.0F; + GLuint i; + ASSERT(span->interpMask & SPAN_FOG); + for (i = 0; i < span->end; i++) { + const GLfloat fact = fog / w; + const GLfloat oneMinusF = 1.0F - fact; + rgba[i][RCOMP] = (GLchan) (fact * rgba[i][RCOMP] + oneMinusF * rFog); + rgba[i][GCOMP] = (GLchan) (fact * rgba[i][GCOMP] + oneMinusF * gFog); + rgba[i][BCOMP] = (GLchan) (fact * rgba[i][BCOMP] + oneMinusF * bFog); + fog += fogStep; + w += wStep; + } + } +} + + +/** + * As above, but color index mode. + */ +void +_swrast_fog_ci_span( const GLcontext *ctx, struct sw_span *span ) +{ + const SWcontext *swrast = SWRAST_CONTEXT(ctx); + const GLuint haveW = (span->interpMask & SPAN_W); + const GLuint fogIndex = (GLuint) ctx->Fog.Index; + GLuint *index = span->array->index; + + ASSERT(swrast->_FogEnabled); + ASSERT(span->arrayMask & SPAN_INDEX); + ASSERT((span->interpMask | span->arrayMask) & SPAN_FOG); + + /* we need to compute fog blend factors */ + if (swrast->_PreferPixelFog) { + /* The span's fog values are fog coordinates, now compute blend factors + * and blend the fragment colors with the fog color. + */ + switch (ctx->Fog.Mode) { + case GL_LINEAR: + { + const GLfloat fogEnd = ctx->Fog.End; + const GLfloat fogScale = (ctx->Fog.Start == ctx->Fog.End) + ? 1.0F : 1.0F / (ctx->Fog.End - ctx->Fog.Start); + const GLfloat fogStep = span->fogStep; + GLfloat fogCoord = span->fog; + const GLfloat wStep = haveW ? span->dwdx : 0.0F; + GLfloat w = haveW ? span->w : 1.0F; + GLuint i; + for (i = 0; i < span->end; i++) { + GLfloat f = (fogEnd - fogCoord / w) * fogScale; + f = CLAMP(f, 0.0F, 1.0F); + index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex); + fogCoord += fogStep; + w += wStep; + } + } + break; + case GL_EXP: + { + const GLfloat density = -ctx->Fog.Density; + const GLfloat fogStep = span->fogStep; + GLfloat fogCoord = span->fog; + const GLfloat wStep = haveW ? span->dwdx : 0.0F; + GLfloat w = haveW ? span->w : 1.0F; + GLuint i; + for (i = 0; i < span->end; i++) { + GLfloat f = (GLfloat) exp(density * fogCoord / w); + f = CLAMP(f, 0.0F, 1.0F); + index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex); + fogCoord += fogStep; + w += wStep; + } + } + break; + case GL_EXP2: + { + const GLfloat negDensitySquared = -ctx->Fog.Density * ctx->Fog.Density; + const GLfloat fogStep = span->fogStep; + GLfloat fogCoord = span->fog; + const GLfloat wStep = haveW ? span->dwdx : 0.0F; + GLfloat w = haveW ? span->w : 1.0F; + GLuint i; + for (i = 0; i < span->end; i++) { + const GLfloat coord = fogCoord / w; + GLfloat tmp = negDensitySquared * coord * coord; + GLfloat f; +#if defined(__alpha__) || defined(__alpha) + /* XXX this underflow check may be needed for other systems*/ + if (tmp < FLT_MIN_10_EXP) + tmp = FLT_MIN_10_EXP; +#endif + f = (GLfloat) exp(tmp); + f = CLAMP(f, 0.0F, 1.0F); + index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex); + fogCoord += fogStep; + w += wStep; + } + } + break; + default: + _mesa_problem(ctx, "Bad fog mode in _swrast_fog_ci_span"); + return; + } + } + else if (span->arrayMask & SPAN_FOG) { + /* The span's fog array values are blend factors. + * They were previously computed per-vertex. + */ + GLuint i; + for (i = 0; i < span->end; i++) { + const GLfloat f = span->array->fog[i]; + index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex); + } + } + else { + /* The span's fog start/step values are blend factors. + * They were previously computed per-vertex. + */ + const GLfloat fogStep = span->fogStep; + GLfloat fog = span->fog; + const GLfloat wStep = haveW ? span->dwdx : 0.0F; + GLfloat w = haveW ? span->w : 1.0F; + GLuint i; + ASSERT(span->interpMask & SPAN_FOG); + for (i = 0; i < span->end; i++) { + const GLfloat f = fog / w; + index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex); + fog += fogStep; + w += wStep; + } + } +} diff --git a/reactos/dll/mesa32/src/swrast/s_fog.h b/reactos/dll/mesa32/src/swrast/s_fog.h new file mode 100644 index 00000000000..f5744b1d952 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_fog.h @@ -0,0 +1,45 @@ + +/* + * 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 S_FOG_H +#define S_FOG_H + + +#include "mtypes.h" +#include "swrast.h" + + +extern GLfloat +_swrast_z_to_fogfactor(GLcontext *ctx, GLfloat z); + +extern void +_swrast_fog_rgba_span( const GLcontext *ctx, struct sw_span *span ); + +extern void +_swrast_fog_ci_span( const GLcontext *ctx, struct sw_span *span ); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_fragprog_to_c.c b/reactos/dll/mesa32/src/swrast/s_fragprog_to_c.c new file mode 100644 index 00000000000..1953e8c73cc --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_fragprog_to_c.c @@ -0,0 +1,822 @@ +/* + * 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. + */ + +/* An amusing little utility to print ARB fragment programs out as a C + * function. Resulting code not tested except visually. + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "nvfragprog.h" +#include "macros.h" +#include "program.h" + +#include "s_nvfragprog.h" +#include "s_span.h" +#include "s_texture.h" + + +#ifdef USE_TCC + +/* UREG - a way of representing an FP source register including + * swizzling and negation in a single GLuint. Major flaw is the + * limitiation to source->Index < 32. Secondary flaw is the fact that + * it's overkill & we could probably just pass around the original + * datatypes instead. + */ + +#define UREG_TYPE_TEMP 0 +#define UREG_TYPE_INTERP 1 +#define UREG_TYPE_LOCAL_CONST 2 +#define UREG_TYPE_ENV_CONST 3 +#define UREG_TYPE_STATE_CONST 4 +#define UREG_TYPE_PARAM 5 +#define UREG_TYPE_OUTPUT 6 +#define UREG_TYPE_MASK 0x7 + +#define UREG_TYPE_SHIFT 29 +#define UREG_NR_SHIFT 24 +#define UREG_NR_MASK 0x1f /* 31 */ +#define UREG_CHANNEL_X_NEGATE_SHIFT 23 +#define UREG_CHANNEL_X_SHIFT 20 +#define UREG_CHANNEL_Y_NEGATE_SHIFT 19 +#define UREG_CHANNEL_Y_SHIFT 16 +#define UREG_CHANNEL_Z_NEGATE_SHIFT 15 +#define UREG_CHANNEL_Z_SHIFT 12 +#define UREG_CHANNEL_W_NEGATE_SHIFT 11 +#define UREG_CHANNEL_W_SHIFT 8 +#define UREG_CHANNEL_ZERO_NEGATE_MBZ 5 +#define UREG_CHANNEL_ZERO_SHIFT 4 +#define UREG_CHANNEL_ONE_NEGATE_MBZ 1 +#define UREG_CHANNEL_ONE_SHIFT 0 + +#define UREG_BAD 0xffffffff /* not a valid ureg */ + +#define _X 0 +#define _Y 1 +#define _Z 2 +#define _W 3 +#define _ZERO 4 /* NOTE! */ +#define _ONE 5 /* NOTE! */ + + +/* Construct a ureg: + */ +#define UREG( type, nr ) (((type)<< UREG_TYPE_SHIFT) | \ + ((nr) << UREG_NR_SHIFT) | \ + (_X << UREG_CHANNEL_X_SHIFT) | \ + (_Y << UREG_CHANNEL_Y_SHIFT) | \ + (_Z << UREG_CHANNEL_Z_SHIFT) | \ + (_W << UREG_CHANNEL_W_SHIFT) | \ + (_ZERO << UREG_CHANNEL_ZERO_SHIFT) | \ + (_ONE << UREG_CHANNEL_ONE_SHIFT)) + +#define GET_CHANNEL_SRC( reg, channel ) ((reg<<(channel*4)) & \ + (0xf<>(channel*4)) + +#define GET_UREG_TYPE(reg) (((reg)>>UREG_TYPE_SHIFT)&UREG_TYPE_MASK) +#define GET_UREG_NR(reg) (((reg)>>UREG_NR_SHIFT)&UREG_NR_MASK) + + + +#define UREG_XYZW_CHANNEL_MASK 0x00ffff00 + +#define deref(reg,pos) swizzle(reg, pos, pos, pos, pos) + + +static INLINE int is_swizzled( int reg ) +{ + return ((reg & UREG_XYZW_CHANNEL_MASK) != + (UREG(0,0) & UREG_XYZW_CHANNEL_MASK)); +} + + +/* One neat thing about the UREG representation: + */ +static INLINE int swizzle( int reg, int x, int y, int z, int w ) +{ + return ((reg & ~UREG_XYZW_CHANNEL_MASK) | + CHANNEL_SRC( GET_CHANNEL_SRC( reg, x ), 0 ) | + CHANNEL_SRC( GET_CHANNEL_SRC( reg, y ), 1 ) | + CHANNEL_SRC( GET_CHANNEL_SRC( reg, z ), 2 ) | + CHANNEL_SRC( GET_CHANNEL_SRC( reg, w ), 3 )); +} + +/* Another neat thing about the UREG representation: + */ +static INLINE int negate( int reg, int x, int y, int z, int w ) +{ + return reg ^ (((x&1)<c_strlen < sizeof(p->c_str)) + p->c_strlen += vsnprintf( p->c_str + p->c_strlen, + sizeof(p->c_str) - p->c_strlen, + fmt, ap ); + + va_end( ap ); +} + +static INLINE void emit_char( struct fragment_program *p, char c ) +{ + if (p->c_strlen < sizeof(p->c_str)) { + p->c_str[p->c_strlen] = c; + p->c_strlen++; + } +} + + +/** + * Retrieve a ureg for the given source register. Will emit + * constants, apply swizzling and negation as needed. + */ +static GLuint src_vector( const struct fp_src_register *source ) +{ + GLuint src; + + assert(source->Index < 32); /* limitiation of UREG representation */ + + src = UREG( src_reg_file( source->File ), source->Index ); + + src = swizzle(src, + _X + source->Swizzle[0], + _X + source->Swizzle[1], + _X + source->Swizzle[2], + _X + source->Swizzle[3]); + + if (source->NegateBase) + src = negate( src, 1,1,1,1 ); + + return src; +} + + +static void print_header( struct fragment_program *p ) +{ + emit(p, "\n\n\n"); + + /* Mesa's program_parameter struct: + */ + emit(p, + "struct program_parameter\n" + "{\n" + " const char *Name;\n" + " int Type;\n" + " int StateIndexes[6];\n" + " float Values[4];\n" + "};\n"); + + + /* Texture samplers, not written yet: + */ + emit(p, "extern void TEX( void *ctx, const float *txc, int unit, float *rslt );\n" + "extern void TXB( void *ctx, const float *txc, int unit, float *rslt );\n" + "extern void TXP( void *ctx, const float *txc, int unit, float *rslt );\n"); + + /* Resort to the standard math library (float versions): + */ + emit(p, "extern float fabsf( float );\n" + "extern float cosf( float );\n" + "extern float sinf( float );\n" + "extern float expf( float );\n" + "extern float powf( float, float );\n" + "extern float floorf( float );\n"); + + /* These ones we have fast code in Mesa for: + */ + emit(p, "extern float LOG2( float );\n" + "extern float _mesa_inv_sqrtf( float );\n"); + + /* The usual macros, not really needed, but handy: + */ + emit(p, "#define MIN2(x,y) ((x)<(y)?(x):(y))\n" + "#define MAX2(x,y) ((x)<(y)?(x):(y))\n" + "#define SATURATE(x) ((x)>1.0?1.0:((x)<0.0?0.0:(x)))\n"); + + /* Our function! + */ + emit(p, "int run_program( void *ctx, \n" + " const float (*local_param)[4], \n" + " const float (*env_param)[4], \n" + " const struct program_parameter *state_param, \n" + " const float (*interp)[4], \n" + " float (*outputs)[4])\n" + "{\n" + " float temp[32][4];\n" + ); +} + +static void print_footer( struct fragment_program *p ) +{ + emit(p, " return 1;"); + emit(p, "}\n"); +} + +static void print_dest_reg( struct fragment_program *p, + const struct fp_instruction *inst ) +{ + switch (inst->DstReg.File) { + case PROGRAM_OUTPUT: + emit(p, "outputs[%d]", inst->DstReg.Index); + break; + case PROGRAM_TEMPORARY: + emit(p, "temp[%d]", inst->DstReg.Index); + break; + default: + break; + } +} + +static void print_dest( struct fragment_program *p, + const struct fp_instruction *inst, + GLuint idx ) +{ + print_dest_reg(p, inst); + emit(p, "[%d]", idx); +} + + +#define UREG_SRC0(reg) (((reg)>>UREG_CHANNEL_X_SHIFT) & 0x7) + +static void print_reg( struct fragment_program *p, + GLuint arg ) +{ + switch (GET_UREG_TYPE(arg)) { + case UREG_TYPE_TEMP: emit(p, "temp"); break; + case UREG_TYPE_INTERP: emit(p, "interp"); break; + case UREG_TYPE_LOCAL_CONST: emit(p, "local_const"); break; + case UREG_TYPE_ENV_CONST: emit(p, "env_const"); break; + case UREG_TYPE_STATE_CONST: emit(p, "state_param"); break; + case UREG_TYPE_PARAM: emit(p, "local_param"); break; + }; + + emit(p, "[%d]", GET_UREG_NR(arg)); + + if (GET_UREG_TYPE(arg) == UREG_TYPE_STATE_CONST) { + emit(p, ".Values"); + } +} + + +static void print_arg( struct fragment_program *p, + GLuint arg ) +{ + GLuint src = UREG_SRC0(arg); + + if (src == _ZERO) { + emit(p, "0"); + return; + } + + if (arg & (1<Parameters->Parameters[GET_UREG_NR(arg)].Type == CONSTANT) { + emit(p, "%g", p->Parameters->Parameters[GET_UREG_NR(arg)].Values[src]); + return; + } + + print_reg( p, arg ); + + switch (src){ + case _X: emit(p, "[0]"); break; + case _Y: emit(p, "[1]"); break; + case _Z: emit(p, "[2]"); break; + case _W: emit(p, "[3]"); break; + } +} + + +/* This is where the handling of expressions breaks down into string + * processing: + */ +static void print_expression( struct fragment_program *p, + GLuint i, + const char *fmt, + va_list ap ) +{ + while (*fmt) { + if (*fmt == '%' && *(fmt+1) == 's') { + int reg = va_arg(ap, int); + + /* Use of deref() is a bit of a hack: + */ + print_arg( p, deref(reg, i) ); + fmt += 2; + } + else { + emit_char(p, *fmt); + fmt++; + } + } + + emit(p, ";\n"); +} + +static void do_tex_kill( struct fragment_program *p, + const struct fp_instruction *inst, + GLuint arg ) +{ + GLuint i; + + emit(p, "if ("); + + for (i = 0; i < 4; i++) { + print_arg( p, deref(arg, i) ); + emit(p, " < 0 "); + if (i + 1 < 4) + emit(p, "|| "); + } + + emit(p, ")\n"); + emit(p, " return 0;\n"); + +} + +static void do_tex_simple( struct fragment_program *p, + const struct fp_instruction *inst, + const char *fn, GLuint texunit, GLuint arg ) +{ + emit(p, " %s( ctx, ", fn); + print_reg( p, arg ); + emit(p, ", %d, ", texunit ); + print_dest_reg(p, inst); + emit(p, ");\n"); +} + + +static void do_tex( struct fragment_program *p, + const struct fp_instruction *inst, + const char *fn, GLuint texunit, GLuint arg ) +{ + GLuint i; + GLboolean need_tex = GL_FALSE, need_result = GL_FALSE; + + for (i = 0; i < 4; i++) + if (!inst->DstReg.WriteMask[i]) + need_result = GL_TRUE; + + if (is_swizzled(arg)) + need_tex = GL_TRUE; + + if (!need_tex && !need_result) { + do_tex_simple( p, inst, fn, texunit, arg ); + return; + } + + emit(p, " {\n"); + emit(p, " float texcoord[4];\n"); + emit(p, " float result[4];\n"); + + for (i = 0; i < 4; i++) { + emit(p, " texcoord[%d] = ", i); + print_arg( p, deref(arg, i) ); + emit(p, ";\n"); + } + + emit(p, " %s( ctx, texcoord, %d, result);\n", fn, texunit ); + + for (i = 0; i < 4; i++) { + if (inst->DstReg.WriteMask[i]) { + emit(p, " "); + print_dest(p, inst, i); + emit(p, " = result[%d];\n", i); + } + } + + emit(p, " }\n"); +} + + +static void saturate( struct fragment_program *p, + const struct fp_instruction *inst, + GLuint i ) +{ + emit(p, " "); + print_dest(p, inst, i); + emit(p, " = SATURATE( "); + print_dest(p, inst, i); + emit(p, ");\n"); +} + +static void assign_single( GLuint i, + struct fragment_program *p, + const struct fp_instruction *inst, + const char *fmt, + ... ) +{ + va_list ap; + va_start( ap, fmt ); + + if (inst->DstReg.WriteMask[i]) { + emit(p, " "); + print_dest(p, inst, i); + emit(p, " = "); + print_expression( p, i, fmt, ap); + if (inst->Saturate) + saturate(p, inst, i); + } + + va_end( ap ); +} + +static void assign4( struct fragment_program *p, + const struct fp_instruction *inst, + const char *fmt, + ... ) +{ + GLuint i; + va_list ap; + va_start( ap, fmt ); + + for (i = 0; i < 4; i++) + if (inst->DstReg.WriteMask[i]) { + emit(p, " "); + print_dest(p, inst, i); + emit(p, " = "); + print_expression( p, i, fmt, ap); + if (inst->Saturate) + saturate(p, inst, i); + } + + va_end( ap ); +} + +static void assign4_replicate( struct fragment_program *p, + const struct fp_instruction *inst, + const char *fmt, + ... ) +{ + GLuint i, first = 0; + GLboolean ok = 0; + va_list ap; + + for (i = 0; i < 4; i++) + if (inst->DstReg.WriteMask[i]) { + ok = 1; + first = i; + break; + } + + if (!ok) return; + + va_start( ap, fmt ); + + emit(p, " "); + + print_dest(p, inst, first); + emit(p, " = "); + print_expression( p, 0, fmt, ap); + if (inst->Saturate) + saturate(p, inst, first); + va_end( ap ); + + for (i = first+1; i < 4; i++) + if (inst->DstReg.WriteMask[i]) { + emit(p, " "); + print_dest(p, inst, i); + emit(p, " = "); + print_dest(p, inst, first); + emit(p, ";\n"); + } +} + + + + +static GLuint nr_args( GLuint opcode ) +{ + switch (opcode) { + case FP_OPCODE_ABS: return 1; + case FP_OPCODE_ADD: return 2; + case FP_OPCODE_CMP: return 3; + case FP_OPCODE_COS: return 1; + case FP_OPCODE_DP3: return 2; + case FP_OPCODE_DP4: return 2; + case FP_OPCODE_DPH: return 2; + case FP_OPCODE_DST: return 2; + case FP_OPCODE_EX2: return 1; + case FP_OPCODE_FLR: return 1; + case FP_OPCODE_FRC: return 1; + case FP_OPCODE_KIL: return 1; + case FP_OPCODE_LG2: return 1; + case FP_OPCODE_LIT: return 1; + case FP_OPCODE_LRP: return 3; + case FP_OPCODE_MAD: return 3; + case FP_OPCODE_MAX: return 2; + case FP_OPCODE_MIN: return 2; + case FP_OPCODE_MOV: return 1; + case FP_OPCODE_MUL: return 2; + case FP_OPCODE_POW: return 2; + case FP_OPCODE_RCP: return 1; + case FP_OPCODE_RSQ: return 1; + case FP_OPCODE_SCS: return 1; + case FP_OPCODE_SGE: return 2; + case FP_OPCODE_SIN: return 1; + case FP_OPCODE_SLT: return 2; + case FP_OPCODE_SUB: return 2; + case FP_OPCODE_SWZ: return 1; + case FP_OPCODE_TEX: return 1; + case FP_OPCODE_TXB: return 1; + case FP_OPCODE_TXP: return 1; + case FP_OPCODE_XPD: return 2; + default: return 0; + } +} + + + +static void translate_program( struct fragment_program *p ) +{ + const struct fp_instruction *inst = p->Instructions; + + for (; inst->Opcode != FP_OPCODE_END; inst++) { + + GLuint src[3], i; + GLuint nr = nr_args( inst->Opcode ); + + for (i = 0; i < nr; i++) + src[i] = src_vector( &inst->SrcReg[i] ); + + /* Print the original program instruction string */ + if (p->Base.String) + { + const char *s = (const char *) p->Base.String + inst->StringPos; + emit(p, " /* "); + while (*s != ';') { + emit_char(p, *s); + s++; + } + emit(p, "; */\n"); + } + + switch (inst->Opcode) { + case FP_OPCODE_ABS: + assign4(p, inst, "fabsf(%s)", src[0]); + break; + + case FP_OPCODE_ADD: + assign4(p, inst, "%s + %s", src[0], src[1]); + break; + + case FP_OPCODE_CMP: + assign4(p, inst, "%s < 0.0F ? %s : %s", src[0], src[1], src[2]); + break; + + case FP_OPCODE_COS: + assign4_replicate(p, inst, "COS(%s)", src[0]); + break; + + case FP_OPCODE_DP3: + assign4_replicate(p, inst, + "%s*%s + %s*%s + %s*%s", + deref(src[0],_X), + deref(src[1],_X), + deref(src[0],_Y), + deref(src[1],_Y), + deref(src[0],_Z), + deref(src[1],_Z)); + break; + + case FP_OPCODE_DP4: + assign4_replicate(p, inst, + "%s*%s + %s*%s + %s*%s + %s*%s", + deref(src[0],_X), + deref(src[1],_X), + deref(src[0],_Y), + deref(src[1],_Y), + deref(src[0],_Z), + deref(src[1],_Z)); + break; + + case FP_OPCODE_DPH: + assign4_replicate(p, inst, + "%s*%s + %s*%s + %s*%s + %s", + deref(src[0],_X), + deref(src[1],_X), + deref(src[0],_Y), + deref(src[1],_Y), + deref(src[1],_Z)); + break; + + case FP_OPCODE_DST: + /* result[0] = 1 * 1; + * result[1] = a[1] * b[1]; + * result[2] = a[2] * 1; + * result[3] = 1 * b[3]; + */ + assign_single(0, p, inst, "1.0"); + + assign_single(1, p, inst, "%s * %s", + deref(src[0], _Y), deref(src[1], _Y)); + + assign_single(2, p, inst, "%s", deref(src[0], _Z)); + assign_single(3, p, inst, "%s", deref(src[1], _W)); + break; + + case FP_OPCODE_EX2: + assign4_replicate(p, inst, "powf(2.0, %s)", src[0]); + break; + + case FP_OPCODE_FLR: + assign4_replicate(p, inst, "floorf(%s)", src[0]); + break; + + case FP_OPCODE_FRC: + assign4_replicate(p, inst, "%s - floorf(%s)", src[0], src[0]); + break; + + case FP_OPCODE_KIL: + do_tex_kill(p, inst, src[0]); + break; + + case FP_OPCODE_LG2: + assign4_replicate(p, inst, "LOG2(%s)", src[0]); + break; + + case FP_OPCODE_LIT: + assign_single(0, p, inst, "1.0"); + assign_single(1, p, inst, "MIN2(%s, 0)", deref(src[0], _X)); + assign_single(2, p, inst, "(%s > 0.0) ? expf(%s * MIN2(%s, 0)) : 0.0", + deref(src[0], _X), + deref(src[0], _Z), + deref(src[0], _Y)); + assign_single(3, p, inst, "1.0"); + break; + + case FP_OPCODE_LRP: + assign4(p, inst, + "%s * %s + (1.0 - %s) * %s", + src[0], src[1], src[0], src[2]); + break; + + case FP_OPCODE_MAD: + assign4(p, inst, "%s * %s + %s", src[0], src[1], src[2]); + break; + + case FP_OPCODE_MAX: + assign4(p, inst, "MAX2(%s, %s)", src[0], src[1]); + break; + + case FP_OPCODE_MIN: + assign4(p, inst, "MIN2(%s, %s)", src[0], src[1]); + break; + + case FP_OPCODE_MOV: + assign4(p, inst, "%s", src[0]); + break; + + case FP_OPCODE_MUL: + assign4(p, inst, "%s * %s", src[0], src[1]); + break; + + case FP_OPCODE_POW: + assign4_replicate(p, inst, "powf(%s, %s)", src[0], src[1]); + break; + + case FP_OPCODE_RCP: + assign4_replicate(p, inst, "1.0/%s", src[0]); + break; + + case FP_OPCODE_RSQ: + assign4_replicate(p, inst, "_mesa_inv_sqrtf(%s)", src[0]); + break; + + case FP_OPCODE_SCS: + if (inst->DstReg.WriteMask[0]) { + assign_single(0, p, inst, "cosf(%s)", deref(src[0], _X)); + } + + if (inst->DstReg.WriteMask[1]) { + assign_single(1, p, inst, "sinf(%s)", deref(src[0], _X)); + } + break; + + case FP_OPCODE_SGE: + assign4(p, inst, "%s >= %s ? 1.0 : 0.0", src[0], src[1]); + break; + + case FP_OPCODE_SIN: + assign4_replicate(p, inst, "sinf(%s)", src[0]); + break; + + case FP_OPCODE_SLT: + assign4(p, inst, "%s < %s ? 1.0 : 0.0", src[0], src[1]); + break; + + case FP_OPCODE_SUB: + assign4(p, inst, "%s - %s", src[0], src[1]); + break; + + case FP_OPCODE_SWZ: /* same implementation as MOV: */ + assign4(p, inst, "%s", src[0]); + break; + + case FP_OPCODE_TEX: + do_tex(p, inst, "TEX", inst->TexSrcUnit, src[0]); + break; + + case FP_OPCODE_TXB: + do_tex(p, inst, "TXB", inst->TexSrcUnit, src[0]); + break; + + case FP_OPCODE_TXP: + do_tex(p, inst, "TXP", inst->TexSrcUnit, src[0]); + break; + + case FP_OPCODE_XPD: + /* Cross product: + * result.x = src[0].y * src[1].z - src[0].z * src[1].y; + * result.y = src[0].z * src[1].x - src[0].x * src[1].z; + * result.z = src[0].x * src[1].y - src[0].y * src[1].x; + * result.w = undef; + */ + assign4(p, inst, + "%s * %s - %s * %s", + swizzle(src[0], _Y, _Z, _X, _ONE), + swizzle(src[1], _Z, _X, _Y, _ONE), + swizzle(src[0], _Z, _X, _Y, _ONE), + swizzle(src[1], _Y, _Z, _X, _ONE)); + break; + + default: + emit(p, "BOGUS OPCODE\n"); + return; + } + } +} + + + + + +void _swrast_translate_program( GLcontext *ctx ) +{ + struct fragment_program *p = ctx->FragmentProgram._Current; + + if (p) { + p->c_strlen = 0; + + print_header( p ); + translate_program( p ); + print_footer( p ); + } +} + +#endif /*USE_TCC*/ diff --git a/reactos/dll/mesa32/src/swrast/s_imaging.c b/reactos/dll/mesa32/src/swrast/s_imaging.c new file mode 100644 index 00000000000..5c79a7ba95e --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_imaging.c @@ -0,0 +1,213 @@ +/* + * 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. + */ + +/* KW: Moved these here to remove knowledge of swrast from core mesa. + * Should probably pull the entire software implementation of these + * extensions into either swrast or a sister module. + */ + +#include "s_context.h" +#include "s_span.h" +#include "colortab.h" +#include "convolve.h" + + +void +_swrast_CopyColorTable( GLcontext *ctx, + GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width) +{ + GLchan data[MAX_WIDTH][4]; + struct gl_buffer_object *bufferSave; + + if (!ctx->ReadBuffer->_ColorReadBuffer) { + /* no readbuffer - OK */ + return; + } + + /* Select buffer to read from */ + _swrast_use_read_buffer(ctx); + + if (width > MAX_WIDTH) + width = MAX_WIDTH; + + /* read the data from framebuffer */ + _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, + width, x, y, data ); + + /* Restore reading from draw buffer (the default) */ + _swrast_use_draw_buffer(ctx); + + /* save PBO binding */ + bufferSave = ctx->Unpack.BufferObj; + ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; + + _mesa_ColorTable(target, internalformat, width, GL_RGBA, CHAN_TYPE, data); + + /* restore PBO binding */ + ctx->Unpack.BufferObj = bufferSave; +} + + +void +_swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width) +{ + GLchan data[MAX_WIDTH][4]; + struct gl_buffer_object *bufferSave; + + if (!ctx->ReadBuffer->_ColorReadBuffer) { + /* no readbuffer - OK */ + return; + } + + /* Select buffer to read from */ + _swrast_use_read_buffer(ctx); + + if (width > MAX_WIDTH) + width = MAX_WIDTH; + + /* read the data from framebuffer */ + _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, + width, x, y, data ); + + /* Restore reading from draw buffer (the default) */ + _swrast_use_draw_buffer(ctx); + + /* save PBO binding */ + bufferSave = ctx->Unpack.BufferObj; + ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; + + _mesa_ColorSubTable(target, start, width, GL_RGBA, CHAN_TYPE, data); + + /* restore PBO binding */ + ctx->Unpack.BufferObj = bufferSave; +} + + +void +_swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, + GLenum internalFormat, + GLint x, GLint y, GLsizei width) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLchan rgba[MAX_CONVOLUTION_WIDTH][4]; + struct gl_buffer_object *bufferSave; + + if (!ctx->ReadBuffer->_ColorReadBuffer) { + /* no readbuffer - OK */ + return; + } + + /* Select buffer to read from */ + _swrast_use_read_buffer(ctx); + + RENDER_START( swrast, ctx ); + + /* read the data from framebuffer */ + _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, + width, x, y, (GLchan (*)[4]) rgba ); + + RENDER_FINISH( swrast, ctx ); + + /* Restore reading from draw buffer (the default) */ + _swrast_use_draw_buffer(ctx); + + /* save PBO binding */ + bufferSave = ctx->Unpack.BufferObj; + ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; + + /* store as convolution filter */ + _mesa_ConvolutionFilter1D(target, internalFormat, width, + GL_RGBA, CHAN_TYPE, rgba); + + /* restore PBO binding */ + ctx->Unpack.BufferObj = bufferSave; +} + + +void +_swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, + GLenum internalFormat, + GLint x, GLint y, GLsizei width, GLsizei height) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + struct gl_pixelstore_attrib packSave; + GLchan rgba[MAX_CONVOLUTION_HEIGHT][MAX_CONVOLUTION_WIDTH][4]; + GLint i; + struct gl_buffer_object *bufferSave; + + if (!ctx->ReadBuffer->_ColorReadBuffer) { + /* no readbuffer - OK */ + return; + } + + /* Select buffer to read from */ + _swrast_use_read_buffer(ctx); + + RENDER_START(swrast,ctx); + + /* read pixels from framebuffer */ + for (i = 0; i < height; i++) { + _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, + width, x, y + i, (GLchan (*)[4]) rgba[i] ); + } + + RENDER_FINISH(swrast,ctx); + + /* Restore reading from draw buffer (the default) */ + _swrast_use_draw_buffer(ctx); + + /* + * HACK: save & restore context state so we can store this as a + * convolution filter via the GL api. Doesn't call any callbacks + * hanging off ctx->Unpack statechanges. + */ + + packSave = ctx->Unpack; /* save pixel packing params */ + + ctx->Unpack.Alignment = 1; + ctx->Unpack.RowLength = MAX_CONVOLUTION_WIDTH; + ctx->Unpack.SkipPixels = 0; + ctx->Unpack.SkipRows = 0; + ctx->Unpack.ImageHeight = 0; + ctx->Unpack.SkipImages = 0; + ctx->Unpack.SwapBytes = GL_FALSE; + ctx->Unpack.LsbFirst = GL_FALSE; + ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; + ctx->NewState |= _NEW_PACKUNPACK; + + /* save PBO binding */ + bufferSave = ctx->Unpack.BufferObj; + ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; + + _mesa_ConvolutionFilter2D(target, internalFormat, width, height, + GL_RGBA, CHAN_TYPE, rgba); + + /* restore PBO binding */ + ctx->Unpack.BufferObj = bufferSave; + + ctx->Unpack = packSave; /* restore pixel packing params */ + ctx->NewState |= _NEW_PACKUNPACK; +} diff --git a/reactos/dll/mesa32/src/swrast/s_lines.c b/reactos/dll/mesa32/src/swrast/s_lines.c new file mode 100644 index 00000000000..56179bcc05a --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_lines.c @@ -0,0 +1,338 @@ +/* + * 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. + */ + + +#include "glheader.h" +#include "context.h" +#include "colormac.h" +#include "macros.h" +#include "nvfragprog.h" +#include "s_aaline.h" +#include "s_context.h" +#include "s_depth.h" +#include "s_feedback.h" +#include "s_lines.h" +#include "s_span.h" + + +/* + * Init the mask[] array to implement a line stipple. + */ +static void +compute_stipple_mask( GLcontext *ctx, GLuint len, GLubyte mask[] ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLuint i; + + for (i = 0; i < len; i++) { + GLuint bit = (swrast->StippleCounter / ctx->Line.StippleFactor) & 0xf; + if ((1 << bit) & ctx->Line.StipplePattern) { + mask[i] = GL_TRUE; + } + else { + mask[i] = GL_FALSE; + } + swrast->StippleCounter++; + } +} + + +/* + * To draw a wide line we can simply redraw the span N times, side by side. + */ +static void +draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor ) +{ + GLint width, start; + + ASSERT(span->end < MAX_WIDTH); + + width = (GLint) CLAMP( ctx->Line._Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH ); + + if (width & 1) + start = width / 2; + else + start = width / 2 - 1; + + if (xMajor) { + GLint *y = span->array->y; + GLuint i; + GLint w; + for (w = 0; w < width; w++) { + if (w == 0) { + for (i = 0; i < span->end; i++) + y[i] -= start; + } + else { + for (i = 0; i < span->end; i++) + y[i]++; + } + if (ctx->Visual.rgbMode) + _swrast_write_rgba_span(ctx, span); + else + _swrast_write_index_span(ctx, span); + } + } + else { + GLint *x = span->array->x; + GLuint i; + GLint w; + for (w = 0; w < width; w++) { + if (w == 0) { + for (i = 0; i < span->end; i++) + x[i] -= start; + } + else { + for (i = 0; i < span->end; i++) + x[i]++; + } + if (ctx->Visual.rgbMode) + _swrast_write_rgba_span(ctx, span); + else + _swrast_write_index_span(ctx, span); + } + } +} + + + +/**********************************************************************/ +/***** Rasterization *****/ +/**********************************************************************/ + +/* Simple color index line (no stipple, width=1, no Z, no fog, no tex)*/ +#define NAME simple_ci_line +#define INTERP_INDEX +#define RENDER_SPAN(span) _swrast_write_index_span(ctx, &span) +#include "s_linetemp.h" + +/* Simple RGBA index line (no stipple, width=1, no Z, no fog, no tex)*/ +#define NAME simple_rgba_line +#define INTERP_RGBA +#define RENDER_SPAN(span) _swrast_write_rgba_span(ctx, &span); +#include "s_linetemp.h" + + +/* Z, fog, wide, stipple color index line */ +#define NAME general_ci_line +#define INTERP_INDEX +#define INTERP_Z +#define INTERP_FOG +#define RENDER_SPAN(span) \ + if (ctx->Line.StippleFlag) { \ + span.arrayMask |= SPAN_MASK; \ + compute_stipple_mask(ctx, span.end, span.array->mask); \ + } \ + if (ctx->Line._Width > 1.0) { \ + draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ + } \ + else { \ + _swrast_write_index_span(ctx, &span); \ + } +#include "s_linetemp.h" + + +/* Z, fog, wide, stipple RGBA line */ +#define NAME general_rgba_line +#define INTERP_RGBA +#define INTERP_Z +#define INTERP_FOG +#define RENDER_SPAN(span) \ + if (ctx->Line.StippleFlag) { \ + span.arrayMask |= SPAN_MASK; \ + compute_stipple_mask(ctx, span.end, span.array->mask); \ + } \ + if (ctx->Line._Width > 1.0) { \ + draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ + } \ + else { \ + _swrast_write_rgba_span(ctx, &span); \ + } +#include "s_linetemp.h" + + +/* Single-texture line, w/ fog, Z, specular, etc. */ +#define NAME textured_line +#define INTERP_RGBA +#define INTERP_Z +#define INTERP_FOG +#define INTERP_TEX +#define RENDER_SPAN(span) \ + if (ctx->Line.StippleFlag) { \ + span.arrayMask |= SPAN_MASK; \ + compute_stipple_mask(ctx, span.end, span.array->mask); \ + } \ + if (ctx->Line._Width > 1.0) { \ + draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ + } \ + else { \ + _swrast_write_rgba_span(ctx, &span); \ + } +#include "s_linetemp.h" + + +/* Multi-texture or separate specular line, w/ fog, Z, specular, etc. */ +#define NAME multitextured_line +#define INTERP_RGBA +#define INTERP_SPEC +#define INTERP_Z +#define INTERP_FOG +#define INTERP_MULTITEX +#define RENDER_SPAN(span) \ + if (ctx->Line.StippleFlag) { \ + span.arrayMask |= SPAN_MASK; \ + compute_stipple_mask(ctx, span.end, span.array->mask); \ + } \ + if (ctx->Line._Width > 1.0) { \ + draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ + } \ + else { \ + _swrast_write_rgba_span(ctx, &span); \ + } +#include "s_linetemp.h" + + + +void +_swrast_add_spec_terms_line( GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1 ) +{ + SWvertex *ncv0 = (SWvertex *)v0; + SWvertex *ncv1 = (SWvertex *)v1; + GLchan c[2][4]; + COPY_CHAN4( c[0], ncv0->color ); + COPY_CHAN4( c[1], ncv1->color ); + ACC_3V( ncv0->color, ncv0->specular ); + ACC_3V( ncv1->color, ncv1->specular ); + SWRAST_CONTEXT(ctx)->SpecLine( ctx, ncv0, ncv1 ); + COPY_CHAN4( ncv0->color, c[0] ); + COPY_CHAN4( ncv1->color, c[1] ); +} + + +#ifdef DEBUG +extern void +_mesa_print_line_function(GLcontext *ctx); /* silence compiler warning */ +void +_mesa_print_line_function(GLcontext *ctx) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + _mesa_printf("Line Func == "); + if (swrast->Line == simple_ci_line) + _mesa_printf("simple_ci_line\n"); + else if (swrast->Line == simple_rgba_line) + _mesa_printf("simple_rgba_line\n"); + else if (swrast->Line == general_ci_line) + _mesa_printf("general_ci_line\n"); + else if (swrast->Line == general_rgba_line) + _mesa_printf("general_rgba_line\n"); + else if (swrast->Line == textured_line) + _mesa_printf("textured_line\n"); + else if (swrast->Line == multitextured_line) + _mesa_printf("multitextured_line\n"); + else + _mesa_printf("Driver func %p\n", (void *(*)()) swrast->Line); +} +#endif + + + +#ifdef DEBUG + +/* record the current line function name */ +static const char *lineFuncName = NULL; + +#define USE(lineFunc) \ +do { \ + lineFuncName = #lineFunc; \ + /*_mesa_printf("%s\n", lineFuncName);*/ \ + swrast->Line = lineFunc; \ +} while (0) + +#else + +#define USE(lineFunc) swrast->Line = lineFunc + +#endif + + + +/* + * Determine which line drawing function to use given the current + * rendering context. + * + * Please update the summary flag _SWRAST_NEW_LINE if you add or remove + * tests to this code. + */ +void +_swrast_choose_line( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + const GLboolean rgbmode = ctx->Visual.rgbMode; + + if (ctx->RenderMode == GL_RENDER) { + if (ctx->Line.SmoothFlag) { + /* antialiased lines */ + _swrast_choose_aa_line_function(ctx); + ASSERT(swrast->Line); + } + else if (ctx->Texture._EnabledCoordUnits) { + /* textured lines */ + if (ctx->Texture._EnabledCoordUnits > 0x1 + || NEED_SECONDARY_COLOR(ctx)) { + /* multi-texture and/or separate specular color */ + USE(multitextured_line); + } + else { + USE(textured_line); + } + } + else if (ctx->Depth.Test || ctx->Fog.Enabled || ctx->Line._Width != 1.0 + || ctx->Line.StippleFlag) { + /* no texture, but Z, fog, width>1, stipple, etc. */ + if (rgbmode) + USE(general_rgba_line); + else + USE(general_ci_line); + } + else { + /* simplest lines */ + if (rgbmode) + USE(simple_rgba_line); + else + USE(simple_ci_line); + } + } + else if (ctx->RenderMode == GL_FEEDBACK) { + USE(_swrast_feedback_line); + } + else { + ASSERT(ctx->RenderMode == GL_SELECT); + USE(_swrast_select_line); + } + + /*_mesa_print_line_function(ctx);*/ +} diff --git a/reactos/dll/mesa32/src/swrast/s_lines.h b/reactos/dll/mesa32/src/swrast/s_lines.h new file mode 100644 index 00000000000..5372b99b915 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_lines.h @@ -0,0 +1,41 @@ + +/* + * 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 S_LINES_H +#define S_LINES_H + +#include "mtypes.h" + +void +_swrast_choose_line( GLcontext *ctx ); + +void +_swrast_add_spec_terms_line( GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1 ); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_linetemp.h b/reactos/dll/mesa32/src/swrast/s_linetemp.h new file mode 100644 index 00000000000..af7aeabf629 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_linetemp.h @@ -0,0 +1,454 @@ +/* + * 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. + */ + + +/* + * Line Rasterizer Template + * + * This file is #include'd to generate custom line rasterizers. + * + * The following macros may be defined to indicate what auxillary information + * must be interplated along the line: + * INTERP_Z - if defined, interpolate Z values + * INTERP_FOG - if defined, interpolate FOG values + * INTERP_RGBA - if defined, interpolate RGBA values + * INTERP_SPEC - if defined, interpolate specular RGB values + * INTERP_INDEX - if defined, interpolate color index values + * INTERP_TEX - if defined, interpolate unit 0 texcoords + * INTERP_MULTITEX - if defined, interpolate multi-texcoords + * + * When one can directly address pixels in the color buffer the following + * macros can be defined and used to directly compute pixel addresses during + * rasterization (see pixelPtr): + * PIXEL_TYPE - the datatype of a pixel (GLubyte, GLushort, GLuint) + * BYTES_PER_ROW - number of bytes per row in the color buffer + * PIXEL_ADDRESS(X,Y) - returns the address of pixel at (X,Y) where + * Y==0 at bottom of screen and increases upward. + * + * Similarly, for direct depth buffer access, this type is used for depth + * buffer addressing: + * DEPTH_TYPE - either GLushort or GLuint + * + * Optionally, one may provide one-time setup code + * SETUP_CODE - code which is to be executed once per line + * + * To actually "plot" each pixel the PLOT macro must be defined... + * PLOT(X,Y) - code to plot a pixel. Example: + * if (Z < *zPtr) { + * *zPtr = Z; + * color = pack_rgb( FixedToInt(r0), FixedToInt(g0), + * FixedToInt(b0) ); + * put_pixel( X, Y, color ); + * } + * + * This code was designed for the origin to be in the lower-left corner. + * + */ + + +static void +NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) +{ + struct sw_span span; + GLuint interpFlags = 0; + GLint x0 = (GLint) vert0->win[0]; + GLint x1 = (GLint) vert1->win[0]; + GLint y0 = (GLint) vert0->win[1]; + GLint y1 = (GLint) vert1->win[1]; + GLint dx, dy; + GLint numPixels; + GLint xstep, ystep; +#if defined(DEPTH_TYPE) + const GLint depthBits = ctx->Visual.depthBits; + const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0; + struct gl_renderbuffer *zrb = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; +#define FixedToDepth(F) ((F) >> fixedToDepthShift) + GLint zPtrXstep, zPtrYstep; + DEPTH_TYPE *zPtr; +#elif defined(INTERP_Z) + const GLint depthBits = ctx->Visual.depthBits; +#endif +#ifdef PIXEL_ADDRESS + PIXEL_TYPE *pixelPtr; + GLint pixelXstep, pixelYstep; +#endif + +#ifdef SETUP_CODE + SETUP_CODE +#endif + + /* Cull primitives with malformed coordinates. + */ + { + GLfloat tmp = vert0->win[0] + vert0->win[1] + + vert1->win[0] + vert1->win[1]; + if (IS_INF_OR_NAN(tmp)) + return; + } + + /* + printf("%s():\n", __FUNCTION__); + printf(" (%f, %f, %f) -> (%f, %f, %f)\n", + vert0->win[0], vert0->win[1], vert0->win[2], + vert1->win[0], vert1->win[1], vert1->win[2]); + printf(" (%d, %d, %d) -> (%d, %d, %d)\n", + vert0->color[0], vert0->color[1], vert0->color[2], + vert1->color[0], vert1->color[1], vert1->color[2]); + printf(" (%d, %d, %d) -> (%d, %d, %d)\n", + vert0->specular[0], vert0->specular[1], vert0->specular[2], + vert1->specular[0], vert1->specular[1], vert1->specular[2]); + */ + +/* + * Despite being clipped to the view volume, the line's window coordinates + * may just lie outside the window bounds. That is, if the legal window + * coordinates are [0,W-1][0,H-1], it's possible for x==W and/or y==H. + * This quick and dirty code nudges the endpoints inside the window if + * necessary. + */ +#ifdef CLIP_HACK + { + GLint w = ctx->DrawBuffer->Width; + GLint h = ctx->DrawBuffer->Height; + if ((x0==w) | (x1==w)) { + if ((x0==w) & (x1==w)) + return; + x0 -= x0==w; + x1 -= x1==w; + } + if ((y0==h) | (y1==h)) { + if ((y0==h) & (y1==h)) + return; + y0 -= y0==h; + y1 -= y1==h; + } + } +#endif + + dx = x1 - x0; + dy = y1 - y0; + if (dx == 0 && dy == 0) + return; + +#ifdef DEPTH_TYPE + zPtr = (DEPTH_TYPE *) zrb->GetPointer(ctx, zrb, x0, y0); +#endif +#ifdef PIXEL_ADDRESS + pixelPtr = (PIXEL_TYPE *) PIXEL_ADDRESS(x0,y0); +#endif + + if (dx<0) { + dx = -dx; /* make positive */ + xstep = -1; +#ifdef DEPTH_TYPE + zPtrXstep = -((GLint)sizeof(DEPTH_TYPE)); +#endif +#ifdef PIXEL_ADDRESS + pixelXstep = -((GLint)sizeof(PIXEL_TYPE)); +#endif + } + else { + xstep = 1; +#ifdef DEPTH_TYPE + zPtrXstep = ((GLint)sizeof(DEPTH_TYPE)); +#endif +#ifdef PIXEL_ADDRESS + pixelXstep = ((GLint)sizeof(PIXEL_TYPE)); +#endif + } + + if (dy<0) { + dy = -dy; /* make positive */ + ystep = -1; +#ifdef DEPTH_TYPE + zPtrYstep = -((GLint) (ctx->DrawBuffer->Width * sizeof(DEPTH_TYPE))); +#endif +#ifdef PIXEL_ADDRESS + pixelYstep = BYTES_PER_ROW; +#endif + } + else { + ystep = 1; +#ifdef DEPTH_TYPE + zPtrYstep = (GLint) (ctx->DrawBuffer->Width * sizeof(DEPTH_TYPE)); +#endif +#ifdef PIXEL_ADDRESS + pixelYstep = -(BYTES_PER_ROW); +#endif + } + + ASSERT(dx >= 0); + ASSERT(dy >= 0); + + numPixels = MAX2(dx, dy); + + /* + * Span setup: compute start and step values for all interpolated values. + */ +#ifdef INTERP_RGBA + interpFlags |= SPAN_RGBA; + if (ctx->Light.ShadeModel == GL_SMOOTH) { + span.red = ChanToFixed(vert0->color[0]); + span.green = ChanToFixed(vert0->color[1]); + span.blue = ChanToFixed(vert0->color[2]); + span.alpha = ChanToFixed(vert0->color[3]); + span.redStep = (ChanToFixed(vert1->color[0]) - span.red ) / numPixels; + span.greenStep = (ChanToFixed(vert1->color[1]) - span.green) / numPixels; + span.blueStep = (ChanToFixed(vert1->color[2]) - span.blue ) / numPixels; + span.alphaStep = (ChanToFixed(vert1->color[3]) - span.alpha) / numPixels; + } + else { + span.red = ChanToFixed(vert1->color[0]); + span.green = ChanToFixed(vert1->color[1]); + span.blue = ChanToFixed(vert1->color[2]); + span.alpha = ChanToFixed(vert1->color[3]); + span.redStep = 0; + span.greenStep = 0; + span.blueStep = 0; + span.alphaStep = 0; + } +#endif +#ifdef INTERP_SPEC + interpFlags |= SPAN_SPEC; + if (ctx->Light.ShadeModel == GL_SMOOTH) { + span.specRed = ChanToFixed(vert0->specular[0]); + span.specGreen = ChanToFixed(vert0->specular[1]); + span.specBlue = ChanToFixed(vert0->specular[2]); + span.specRedStep = (ChanToFixed(vert1->specular[0]) - span.specRed) / numPixels; + span.specGreenStep = (ChanToFixed(vert1->specular[1]) - span.specBlue) / numPixels; + span.specBlueStep = (ChanToFixed(vert1->specular[2]) - span.specGreen) / numPixels; + } + else { + span.specRed = ChanToFixed(vert1->specular[0]); + span.specGreen = ChanToFixed(vert1->specular[1]); + span.specBlue = ChanToFixed(vert1->specular[2]); + span.specRedStep = 0; + span.specGreenStep = 0; + span.specBlueStep = 0; + } +#endif +#ifdef INTERP_INDEX + interpFlags |= SPAN_INDEX; + if (ctx->Light.ShadeModel == GL_SMOOTH) { + span.index = FloatToFixed(vert0->index); + span.indexStep = FloatToFixed(vert1->index - vert0->index) / numPixels; + } + else { + span.index = FloatToFixed(vert1->index); + span.indexStep = 0; + } +#endif +#if defined(INTERP_Z) || defined(DEPTH_TYPE) + interpFlags |= SPAN_Z; + { + if (depthBits <= 16) { + span.z = FloatToFixed(vert0->win[2]) + FIXED_HALF; + span.zStep = FloatToFixed(vert1->win[2] - vert0->win[2]) / numPixels; + } + else { + /* don't use fixed point */ + span.z = (GLint) vert0->win[2]; + span.zStep = (GLint) ((vert1->win[2] - vert0->win[2]) / numPixels); + } + } +#endif +#ifdef INTERP_FOG + interpFlags |= SPAN_FOG; + span.fog = vert0->fog; + span.fogStep = (vert1->fog - vert0->fog) / numPixels; +#endif +#ifdef INTERP_TEX + interpFlags |= SPAN_TEXTURE; + { + const GLfloat invw0 = vert0->win[3]; + const GLfloat invw1 = vert1->win[3]; + const GLfloat invLen = 1.0F / numPixels; + GLfloat ds, dt, dr, dq; + span.tex[0][0] = invw0 * vert0->texcoord[0][0]; + span.tex[0][1] = invw0 * vert0->texcoord[0][1]; + span.tex[0][2] = invw0 * vert0->texcoord[0][2]; + span.tex[0][3] = invw0 * vert0->texcoord[0][3]; + ds = (invw1 * vert1->texcoord[0][0]) - span.tex[0][0]; + dt = (invw1 * vert1->texcoord[0][1]) - span.tex[0][1]; + dr = (invw1 * vert1->texcoord[0][2]) - span.tex[0][2]; + dq = (invw1 * vert1->texcoord[0][3]) - span.tex[0][3]; + span.texStepX[0][0] = ds * invLen; + span.texStepX[0][1] = dt * invLen; + span.texStepX[0][2] = dr * invLen; + span.texStepX[0][3] = dq * invLen; + span.texStepY[0][0] = 0.0F; + span.texStepY[0][1] = 0.0F; + span.texStepY[0][2] = 0.0F; + span.texStepY[0][3] = 0.0F; + } +#endif +#ifdef INTERP_MULTITEX + interpFlags |= SPAN_TEXTURE; + { + const GLfloat invLen = 1.0F / numPixels; + GLuint u; + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (ctx->Texture.Unit[u]._ReallyEnabled) { + const GLfloat invw0 = vert0->win[3]; + const GLfloat invw1 = vert1->win[3]; + GLfloat ds, dt, dr, dq; + span.tex[u][0] = invw0 * vert0->texcoord[u][0]; + span.tex[u][1] = invw0 * vert0->texcoord[u][1]; + span.tex[u][2] = invw0 * vert0->texcoord[u][2]; + span.tex[u][3] = invw0 * vert0->texcoord[u][3]; + ds = (invw1 * vert1->texcoord[u][0]) - span.tex[u][0]; + dt = (invw1 * vert1->texcoord[u][1]) - span.tex[u][1]; + dr = (invw1 * vert1->texcoord[u][2]) - span.tex[u][2]; + dq = (invw1 * vert1->texcoord[u][3]) - span.tex[u][3]; + span.texStepX[u][0] = ds * invLen; + span.texStepX[u][1] = dt * invLen; + span.texStepX[u][2] = dr * invLen; + span.texStepX[u][3] = dq * invLen; + span.texStepY[u][0] = 0.0F; + span.texStepY[u][1] = 0.0F; + span.texStepY[u][2] = 0.0F; + span.texStepY[u][3] = 0.0F; + } + } + } +#endif + + INIT_SPAN(span, GL_LINE, numPixels, interpFlags, SPAN_XY); + + /* Need these for fragment prog texcoord interpolation */ + span.w = 1.0F; + span.dwdx = 0.0F; + span.dwdy = 0.0F; + + /* + * Draw + */ + + if (dx > dy) { + /*** X-major line ***/ + GLint i; + GLint errorInc = dy+dy; + GLint error = errorInc-dx; + GLint errorDec = error-dx; + + for (i = 0; i < dx; i++) { +#ifdef DEPTH_TYPE + GLdepth Z = FixedToDepth(span.z); +#endif +#ifdef PLOT + PLOT( x0, y0 ); +#else + span.array->x[i] = x0; + span.array->y[i] = y0; +#endif + x0 += xstep; +#ifdef DEPTH_TYPE + zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep); + span.z += span.zStep; +#endif +#ifdef PIXEL_ADDRESS + pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelXstep); +#endif + if (error<0) { + error += errorInc; + } + else { + error += errorDec; + y0 += ystep; +#ifdef DEPTH_TYPE + zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep); +#endif +#ifdef PIXEL_ADDRESS + pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelYstep); +#endif + } + } + } + else { + /*** Y-major line ***/ + GLint i; + GLint errorInc = dx+dx; + GLint error = errorInc-dy; + GLint errorDec = error-dy; + + for (i=0;ix[i] = x0; + span.array->y[i] = y0; +#endif + y0 += ystep; +#ifdef DEPTH_TYPE + zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep); + span.z += span.zStep; +#endif +#ifdef PIXEL_ADDRESS + pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelYstep); +#endif + if (error<0) { + error += errorInc; + } + else { + error += errorDec; + x0 += xstep; +#ifdef DEPTH_TYPE + zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep); +#endif +#ifdef PIXEL_ADDRESS + pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelXstep); +#endif + } + } + } + +#ifdef RENDER_SPAN + RENDER_SPAN( span ); +#endif + + (void)span; + +} + + +#undef NAME +#undef INTERP_Z +#undef INTERP_FOG +#undef INTERP_RGBA +#undef INTERP_SPEC +#undef INTERP_TEX +#undef INTERP_MULTITEX +#undef INTERP_INDEX +#undef PIXEL_ADDRESS +#undef PIXEL_TYPE +#undef DEPTH_TYPE +#undef BYTES_PER_ROW +#undef SETUP_CODE +#undef PLOT +#undef CLIP_HACK +#undef FixedToDepth +#undef RENDER_SPAN diff --git a/reactos/dll/mesa32/src/swrast/s_logic.c b/reactos/dll/mesa32/src/swrast/s_logic.c new file mode 100644 index 00000000000..ff3c3fc2f14 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_logic.c @@ -0,0 +1,244 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +#include "glheader.h" +#include "context.h" +#include "imports.h" +#include "macros.h" + +#include "s_context.h" +#include "s_logic.h" +#include "s_span.h" + + +#define LOGIC_OP_LOOP(MODE) \ +do { \ + GLuint i; \ + switch (MODE) { \ + case GL_CLEAR: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] = 0; \ + } \ + } \ + break; \ + case GL_SET: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] = ~0; \ + } \ + } \ + break; \ + case GL_COPY: \ + /* do nothing */ \ + break; \ + case GL_COPY_INVERTED: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] = ~src[i]; \ + } \ + } \ + break; \ + case GL_NOOP: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] = dest[i]; \ + } \ + } \ + break; \ + case GL_INVERT: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] = ~dest[i]; \ + } \ + } \ + break; \ + case GL_AND: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] &= dest[i]; \ + } \ + } \ + break; \ + case GL_NAND: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] = ~(src[i] & dest[i]); \ + } \ + } \ + break; \ + case GL_OR: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] |= dest[i]; \ + } \ + } \ + break; \ + case GL_NOR: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] = ~(src[i] | dest[i]); \ + } \ + } \ + break; \ + case GL_XOR: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] ^= dest[i]; \ + } \ + } \ + break; \ + case GL_EQUIV: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] = ~(src[i] ^ dest[i]); \ + } \ + } \ + break; \ + case GL_AND_REVERSE: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] = src[i] & ~dest[i]; \ + } \ + } \ + break; \ + case GL_AND_INVERTED: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] = ~src[i] & dest[i]; \ + } \ + } \ + break; \ + case GL_OR_REVERSE: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] = src[i] | ~dest[i]; \ + } \ + } \ + break; \ + case GL_OR_INVERTED: \ + for (i = 0; i < n; i++) { \ + if (mask[i]) { \ + src[i] = ~src[i] | dest[i]; \ + } \ + } \ + break; \ + default: \ + _mesa_problem(ctx, "bad logicop mode");\ + } \ +} while (0) + + + +static void +logicop_ubyte(GLcontext *ctx, GLuint n, GLubyte src[], const GLubyte dest[], + const GLubyte mask[]) +{ + LOGIC_OP_LOOP(ctx->Color.LogicOp); +} + + +static void +logicop_ushort(GLcontext *ctx, GLuint n, GLushort src[], const GLushort dest[], + const GLubyte mask[]) +{ + LOGIC_OP_LOOP(ctx->Color.LogicOp); +} + + +static void +logicop_uint(GLcontext *ctx, GLuint n, GLuint src[], const GLuint dest[], + const GLubyte mask[]) +{ + LOGIC_OP_LOOP(ctx->Color.LogicOp); +} + + + +/* + * Apply the current logic operator to a span of CI pixels. This is only + * used if the device driver can't do logic ops. + */ +void +_swrast_logicop_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb, + const struct sw_span *span, GLuint index[]) +{ + GLuint dest[MAX_WIDTH]; + + ASSERT(span->end < MAX_WIDTH); + ASSERT(rb->DataType == GL_UNSIGNED_INT); + + /* Read dest values from frame buffer */ + if (span->arrayMask & SPAN_XY) { + _swrast_get_values(ctx, rb, span->end, span->array->x, span->array->y, + dest, sizeof(GLuint)); + } + else { + rb->GetRow(ctx, rb, span->end, span->x, span->y, dest); + } + + logicop_uint(ctx, span->end, index, dest, span->array->mask); +} + + +/** + * Apply the current logic operator to a span of RGBA pixels. + * We can handle horizontal runs of pixels (spans) or arrays of x/y + * pixel coordinates. + */ +void +_swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, + const struct sw_span *span, GLchan rgba[][4]) +{ + GLchan dest[MAX_WIDTH][4]; + + ASSERT(span->end < MAX_WIDTH); + ASSERT(span->arrayMask & SPAN_RGBA); + ASSERT(rb->DataType == GL_UNSIGNED_BYTE); + + if (span->arrayMask & SPAN_XY) { + _swrast_get_values(ctx, rb, span->end, span->array->x, span->array->y, + dest, 4 * sizeof(GLchan)); + } + else { + _swrast_read_rgba_span(ctx, rb, span->end, span->x, span->y, dest); + } + + /* XXX make this a runtime test */ +#if CHAN_TYPE == GL_UNSIGNED_BYTE + /* treat 4*GLubyte as GLuint */ + logicop_uint(ctx, span->end, (GLuint *) rgba, + (const GLuint *) dest, span->array->mask); +#elif CHAN_TYPE == GL_UNSIGNED_SHORT + logicop_ushort(ctx, 4 * span->end, (GLushort *) rgba, + (const GLushort *) dest, span->array->mask); +#elif CHAN_TYPE == GL_FLOAT + logicop_uint(ctx, 4 * span->end, (GLuint *) rgba, + (const GLuint *) dest, span->array->mask); +#endif + (void) logicop_ubyte; + (void) logicop_ushort; + (void) logicop_uint; +} diff --git a/reactos/dll/mesa32/src/swrast/s_logic.h b/reactos/dll/mesa32/src/swrast/s_logic.h new file mode 100644 index 00000000000..ce5f183ff65 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_logic.h @@ -0,0 +1,44 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 S_LOGIC_H +#define S_LOGIC_H + + +#include "mtypes.h" +#include "swrast.h" + + +extern void +_swrast_logicop_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb, + const struct sw_span *span, GLuint index[]); + + +extern void +_swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, + const struct sw_span *span, GLchan rgba[][4]); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_masking.c b/reactos/dll/mesa32/src/swrast/s_masking.c new file mode 100644 index 00000000000..65c4e7d01cc --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_masking.c @@ -0,0 +1,172 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +/* + * Implement the effect of glColorMask and glIndexMask in software. + */ + + +#include "glheader.h" +#include "enums.h" +#include "macros.h" + +#include "s_context.h" +#include "s_masking.h" +#include "s_span.h" + + + +void +_swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, + const struct sw_span *span, GLchan rgba[][4]) +{ + GLchan dest[MAX_WIDTH][4]; +#if CHAN_BITS == 8 + GLuint srcMask = *((GLuint*)ctx->Color.ColorMask); + GLuint dstMask = ~srcMask; + GLuint *rgba32 = (GLuint *) rgba; + GLuint *dest32 = (GLuint *) dest; +#else + const GLboolean rMask = ctx->Color.ColorMask[RCOMP]; + const GLboolean gMask = ctx->Color.ColorMask[GCOMP]; + const GLboolean bMask = ctx->Color.ColorMask[BCOMP]; + const GLboolean aMask = ctx->Color.ColorMask[ACOMP]; +#endif + const GLuint n = span->end; + GLuint i; + + ASSERT(n < MAX_WIDTH); + ASSERT(span->arrayMask & SPAN_RGBA); + + if (span->arrayMask & SPAN_XY) { + _swrast_get_values(ctx, rb, n, span->array->x, span->array->y, + dest, 4 * sizeof(GLchan)); + } + else { + _swrast_read_rgba_span(ctx, rb, n, span->x, span->y, dest); + } + +#if CHAN_BITS == 8 + for (i = 0; i < n; i++) { + rgba32[i] = (rgba32[i] & srcMask) | (dest32[i] & dstMask); + } +#else + for (i = 0; i < n; i++) { + if (!rMask) rgba[i][RCOMP] = dest[i][RCOMP]; + if (!gMask) rgba[i][GCOMP] = dest[i][GCOMP]; + if (!bMask) rgba[i][BCOMP] = dest[i][BCOMP]; + if (!aMask) rgba[i][ACOMP] = dest[i][ACOMP]; + } +#endif +} + + +/* + * Apply glColorMask to a span of RGBA pixels. + */ +void +_swrast_mask_rgba_array(GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, GLchan rgba[][4]) +{ + GLchan dest[MAX_WIDTH][4]; + GLuint i; + +#if CHAN_BITS == 8 + + GLuint srcMask = *((GLuint*)ctx->Color.ColorMask); + GLuint dstMask = ~srcMask; + GLuint *rgba32 = (GLuint *) rgba; + GLuint *dest32 = (GLuint *) dest; + + _swrast_read_rgba_span( ctx, rb, n, x, y, dest ); + for (i = 0; i < n; i++) { + rgba32[i] = (rgba32[i] & srcMask) | (dest32[i] & dstMask); + } + +#else + + const GLint rMask = ctx->Color.ColorMask[RCOMP]; + const GLint gMask = ctx->Color.ColorMask[GCOMP]; + const GLint bMask = ctx->Color.ColorMask[BCOMP]; + const GLint aMask = ctx->Color.ColorMask[ACOMP]; + + _swrast_read_rgba_span( ctx, rb, n, x, y, dest ); + for (i = 0; i < n; i++) { + if (!rMask) rgba[i][RCOMP] = dest[i][RCOMP]; + if (!gMask) rgba[i][GCOMP] = dest[i][GCOMP]; + if (!bMask) rgba[i][BCOMP] = dest[i][BCOMP]; + if (!aMask) rgba[i][ACOMP] = dest[i][ACOMP]; + } + +#endif +} + + + +void +_swrast_mask_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb, + const struct sw_span *span, GLuint index[]) +{ + const GLuint srcMask = ctx->Color.IndexMask; + const GLuint dstMask = ~srcMask; + GLuint dest[MAX_WIDTH]; + GLuint i; + + ASSERT(span->arrayMask & SPAN_INDEX); + ASSERT(span->end <= MAX_WIDTH); + ASSERT(rb->DataType == GL_UNSIGNED_INT); + + if (span->arrayMask & SPAN_XY) { + _swrast_get_values(ctx, rb, span->end, span->array->x, span->array->y, + dest, sizeof(GLuint)); + } + else { + _swrast_read_index_span(ctx, rb, span->end, span->x, span->y, dest); + } + + for (i = 0; i < span->end; i++) { + index[i] = (index[i] & srcMask) | (dest[i] & dstMask); + } +} + + +/* + * Apply glIndexMask to an array of CI pixels. + */ +void +_swrast_mask_ci_array(GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, GLuint index[]) +{ + const GLuint srcMask = ctx->Color.IndexMask; + const GLuint dstMask = ~srcMask; + GLuint dest[MAX_WIDTH]; + GLuint i; + + _swrast_read_index_span(ctx, rb, n, x, y, dest); + + for (i=0;iTextureSample[unit](ctx, unit, ctx->Texture.Unit[unit]._Current, + 1, (const GLfloat (*)[4]) texcoord, + &lambda, &rgba); + color[0] = CHAN_TO_FLOAT(rgba[0]); + color[1] = CHAN_TO_FLOAT(rgba[1]); + color[2] = CHAN_TO_FLOAT(rgba[2]); + color[3] = CHAN_TO_FLOAT(rgba[3]); +} + + +/** + * Fetch a texel with the given partial derivatives to compute a level + * of detail in the mipmap. + */ +static void +fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], + const GLfloat texdx[4], const GLfloat texdy[4], + GLuint unit, GLfloat color[4] ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; + const struct gl_texture_image *texImg = texObj->Image[0][texObj->BaseLevel]; + const GLfloat texW = (GLfloat) texImg->WidthScale; + const GLfloat texH = (GLfloat) texImg->HeightScale; + GLchan rgba[4]; + + GLfloat lambda = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */ + texdx[1], texdy[1], /* dt/dx, dt/dy */ + texdx[3], texdy[2], /* dq/dx, dq/dy */ + texW, texH, + texcoord[0], texcoord[1], texcoord[3], + 1.0F / texcoord[3]); + + swrast->TextureSample[unit](ctx, unit, ctx->Texture.Unit[unit]._Current, + 1, (const GLfloat (*)[4]) texcoord, + &lambda, &rgba); + color[0] = CHAN_TO_FLOAT(rgba[0]); + color[1] = CHAN_TO_FLOAT(rgba[1]); + color[2] = CHAN_TO_FLOAT(rgba[2]); + color[3] = CHAN_TO_FLOAT(rgba[3]); +} + + +/** + * Return a pointer to the 4-element float vector specified by the given + * source register. + */ +static INLINE const GLfloat * +get_register_pointer( GLcontext *ctx, + const struct fp_src_register *source, + const struct fp_machine *machine, + const struct fragment_program *program ) +{ + const GLfloat *src; + switch (source->File) { + case PROGRAM_TEMPORARY: + ASSERT(source->Index < MAX_NV_FRAGMENT_PROGRAM_TEMPS); + src = machine->Temporaries[source->Index]; + break; + case PROGRAM_INPUT: + ASSERT(source->Index < MAX_NV_FRAGMENT_PROGRAM_INPUTS); + src = machine->Inputs[source->Index]; + break; + case PROGRAM_OUTPUT: + /* This is only for PRINT */ + ASSERT(source->Index < MAX_NV_FRAGMENT_PROGRAM_OUTPUTS); + src = machine->Outputs[source->Index]; + break; + case PROGRAM_LOCAL_PARAM: + ASSERT(source->Index < MAX_PROGRAM_LOCAL_PARAMS); + src = program->Base.LocalParams[source->Index]; + break; + case PROGRAM_ENV_PARAM: + ASSERT(source->Index < MAX_NV_FRAGMENT_PROGRAM_PARAMS); + src = ctx->FragmentProgram.Parameters[source->Index]; + break; + case PROGRAM_STATE_VAR: + /* Fallthrough */ + case PROGRAM_NAMED_PARAM: + ASSERT(source->Index < (GLint) program->Parameters->NumParameters); + src = program->Parameters->ParameterValues[source->Index]; + break; + default: + _mesa_problem(ctx, "Invalid input register file %d in fetch_vector4", source->File); + src = NULL; + } + return src; +} + + +/** + * Fetch a 4-element float vector from the given source register. + * Apply swizzling and negating as needed. + */ +static void +fetch_vector4( GLcontext *ctx, + const struct fp_src_register *source, + const struct fp_machine *machine, + const struct fragment_program *program, + GLfloat result[4] ) +{ + const GLfloat *src = get_register_pointer(ctx, source, machine, program); + ASSERT(src); + + 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->NegateBase) { + result[0] = -result[0]; + result[1] = -result[1]; + result[2] = -result[2]; + result[3] = -result[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->NegateAbs) { + result[0] = -result[0]; + result[1] = -result[1]; + result[2] = -result[2]; + result[3] = -result[3]; + } +} + + +/** + * Fetch the derivative with respect to X for the given register. + * \return GL_TRUE if it was easily computed or GL_FALSE if we + * need to execute another instance of the program (ugh)! + */ +static GLboolean +fetch_vector4_deriv( GLcontext *ctx, + const struct fp_src_register *source, + const struct sw_span *span, + char xOrY, GLint column, GLfloat result[4] ) +{ + GLfloat src[4]; + + ASSERT(xOrY == 'X' || xOrY == 'Y'); + + switch (source->Index) { + case FRAG_ATTRIB_WPOS: + if (xOrY == 'X') { + src[0] = 1.0; + src[1] = 0.0; + src[2] = span->dzdx / ctx->DrawBuffer->_DepthMaxF; + src[3] = span->dwdx; + } + else { + src[0] = 0.0; + src[1] = 1.0; + src[2] = span->dzdy / ctx->DrawBuffer->_DepthMaxF; + src[3] = span->dwdy; + } + break; + case FRAG_ATTRIB_COL0: + if (xOrY == 'X') { + src[0] = span->drdx * (1.0F / CHAN_MAXF); + src[1] = span->dgdx * (1.0F / CHAN_MAXF); + src[2] = span->dbdx * (1.0F / CHAN_MAXF); + src[3] = span->dadx * (1.0F / CHAN_MAXF); + } + else { + src[0] = span->drdy * (1.0F / CHAN_MAXF); + src[1] = span->dgdy * (1.0F / CHAN_MAXF); + src[2] = span->dbdy * (1.0F / CHAN_MAXF); + src[3] = span->dady * (1.0F / CHAN_MAXF); + } + break; + case FRAG_ATTRIB_COL1: + if (xOrY == 'X') { + src[0] = span->dsrdx * (1.0F / CHAN_MAXF); + src[1] = span->dsgdx * (1.0F / CHAN_MAXF); + src[2] = span->dsbdx * (1.0F / CHAN_MAXF); + src[3] = 0.0; /* XXX need this */ + } + else { + src[0] = span->dsrdy * (1.0F / CHAN_MAXF); + src[1] = span->dsgdy * (1.0F / CHAN_MAXF); + src[2] = span->dsbdy * (1.0F / CHAN_MAXF); + src[3] = 0.0; /* XXX need this */ + } + break; + case FRAG_ATTRIB_FOGC: + if (xOrY == 'X') { + src[0] = span->dfogdx; + src[1] = 0.0; + src[2] = 0.0; + src[3] = 0.0; + } + else { + src[0] = span->dfogdy; + src[1] = 0.0; + src[2] = 0.0; + src[3] = 0.0; + } + break; + case FRAG_ATTRIB_TEX0: + case FRAG_ATTRIB_TEX1: + case FRAG_ATTRIB_TEX2: + case FRAG_ATTRIB_TEX3: + case FRAG_ATTRIB_TEX4: + case FRAG_ATTRIB_TEX5: + case FRAG_ATTRIB_TEX6: + case FRAG_ATTRIB_TEX7: + if (xOrY == 'X') { + const GLuint u = source->Index - FRAG_ATTRIB_TEX0; + /* this is a little tricky - I think I've got it right */ + const GLfloat invQ = 1.0f / (span->tex[u][3] + + span->texStepX[u][3] * column); + src[0] = span->texStepX[u][0] * invQ; + src[1] = span->texStepX[u][1] * invQ; + src[2] = span->texStepX[u][2] * invQ; + src[3] = span->texStepX[u][3] * invQ; + } + else { + const GLuint u = source->Index - FRAG_ATTRIB_TEX0; + /* Tricky, as above, but in Y direction */ + const GLfloat invQ = 1.0f / (span->tex[u][3] + span->texStepY[u][3]); + src[0] = span->texStepY[u][0] * invQ; + src[1] = span->texStepY[u][1] * invQ; + src[2] = span->texStepY[u][2] * invQ; + src[3] = span->texStepY[u][3] * invQ; + } + break; + default: + return GL_FALSE; + } + + 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->NegateBase) { + result[0] = -result[0]; + result[1] = -result[1]; + result[2] = -result[2]; + result[3] = -result[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->NegateAbs) { + result[0] = -result[0]; + result[1] = -result[1]; + result[2] = -result[2]; + result[3] = -result[3]; + } + return GL_TRUE; +} + + +/** + * As above, but only return result[0] element. + */ +static void +fetch_vector1( GLcontext *ctx, + const struct fp_src_register *source, + const struct fp_machine *machine, + const struct fragment_program *program, + GLfloat result[4] ) +{ + const GLfloat *src = get_register_pointer(ctx, source, machine, program); + ASSERT(src); + + result[0] = src[GET_SWZ(source->Swizzle, 0)]; + + if (source->NegateBase) { + result[0] = -result[0]; + } + if (source->Abs) { + result[0] = FABSF(result[0]); + } + if (source->NegateAbs) { + result[0] = -result[0]; + } +} + + +/** + * 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 codee. + */ +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; + } +} + + +/** + * Store 4 floats into a register. Observe the instructions saturate and + * set-condition-code flags. + */ +static void +store_vector4( const struct fp_instruction *inst, + struct fp_machine *machine, + const GLfloat value[4] ) +{ + const struct fp_dst_register *dest = &(inst->DstReg); + const GLboolean clamp = inst->Saturate; + const GLboolean updateCC = inst->UpdateCondRegister; + GLfloat *dstReg; + GLfloat dummyReg[4]; + GLfloat clampedValue[4]; + GLboolean condWriteMask[4]; + GLuint writeMask = dest->WriteMask; + + switch (dest->File) { + case PROGRAM_OUTPUT: + dstReg = machine->Outputs[dest->Index]; + break; + case PROGRAM_TEMPORARY: + dstReg = machine->Temporaries[dest->Index]; + break; + case PROGRAM_WRITE_ONLY: + dstReg = dummyReg; + return; + default: + _mesa_problem(NULL, "bad register file in store_vector4(fp)"); + return; + } + +#if DEBUG_FRAG + 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 (dest->CondMask != COND_TR) { + condWriteMask[0] = GET_BIT(writeMask, 0) + && test_cc(machine->CondCodes[GET_SWZ(dest->CondSwizzle, 0)], dest->CondMask); + condWriteMask[1] = GET_BIT(writeMask, 1) + && test_cc(machine->CondCodes[GET_SWZ(dest->CondSwizzle, 1)], dest->CondMask); + condWriteMask[2] = GET_BIT(writeMask, 2) + && test_cc(machine->CondCodes[GET_SWZ(dest->CondSwizzle, 2)], dest->CondMask); + condWriteMask[3] = GET_BIT(writeMask, 3) + && test_cc(machine->CondCodes[GET_SWZ(dest->CondSwizzle, 3)], dest->CondMask); + + writeMask = ((condWriteMask[0] << 0) | + (condWriteMask[1] << 1) | + (condWriteMask[2] << 2) | + (condWriteMask[3] << 3)); + } + + if (GET_BIT(writeMask, 0)) { + dstReg[0] = value[0]; + if (updateCC) + machine->CondCodes[0] = generate_cc(value[0]); + } + if (GET_BIT(writeMask, 1)) { + dstReg[1] = value[1]; + if (updateCC) + machine->CondCodes[1] = generate_cc(value[1]); + } + if (GET_BIT(writeMask, 2)) { + dstReg[2] = value[2]; + if (updateCC) + machine->CondCodes[2] = generate_cc(value[2]); + } + if (GET_BIT(writeMask, 3)) { + dstReg[3] = value[3]; + if (updateCC) + machine->CondCodes[3] = generate_cc(value[3]); + } +} + + +/** + * Initialize a new machine state instance from an existing one, adding + * the partial derivatives onto the input registers. + * Used to implement DDX and DDY instructions in non-trivial cases. + */ +static void +init_machine_deriv( GLcontext *ctx, + const struct fp_machine *machine, + const struct fragment_program *program, + const struct sw_span *span, char xOrY, + struct fp_machine *dMachine ) +{ + GLuint u; + + ASSERT(xOrY == 'X' || xOrY == 'Y'); + + /* copy existing machine */ + _mesa_memcpy(dMachine, machine, sizeof(struct fp_machine)); + + if (program->Base.Target == GL_FRAGMENT_PROGRAM_NV) { + /* Clear temporary registers (undefined for ARB_f_p) */ + _mesa_bzero( (void*) machine->Temporaries, + MAX_NV_FRAGMENT_PROGRAM_TEMPS * 4 * sizeof(GLfloat)); + } + + /* Add derivatives */ + if (program->InputsRead & (1 << FRAG_ATTRIB_WPOS)) { + GLfloat *wpos = (GLfloat*) machine->Inputs[FRAG_ATTRIB_WPOS]; + if (xOrY == 'X') { + wpos[0] += 1.0F; + wpos[1] += 0.0F; + wpos[2] += span->dzdx; + wpos[3] += span->dwdx; + } + else { + wpos[0] += 0.0F; + wpos[1] += 1.0F; + wpos[2] += span->dzdy; + wpos[3] += span->dwdy; + } + } + if (program->InputsRead & (1 << FRAG_ATTRIB_COL0)) { + GLfloat *col0 = (GLfloat*) machine->Inputs[FRAG_ATTRIB_COL0]; + if (xOrY == 'X') { + col0[0] += span->drdx * (1.0F / CHAN_MAXF); + col0[1] += span->dgdx * (1.0F / CHAN_MAXF); + col0[2] += span->dbdx * (1.0F / CHAN_MAXF); + col0[3] += span->dadx * (1.0F / CHAN_MAXF); + } + else { + col0[0] += span->drdy * (1.0F / CHAN_MAXF); + col0[1] += span->dgdy * (1.0F / CHAN_MAXF); + col0[2] += span->dbdy * (1.0F / CHAN_MAXF); + col0[3] += span->dady * (1.0F / CHAN_MAXF); + } + } + if (program->InputsRead & (1 << FRAG_ATTRIB_COL1)) { + GLfloat *col1 = (GLfloat*) machine->Inputs[FRAG_ATTRIB_COL1]; + if (xOrY == 'X') { + col1[0] += span->dsrdx * (1.0F / CHAN_MAXF); + col1[1] += span->dsgdx * (1.0F / CHAN_MAXF); + col1[2] += span->dsbdx * (1.0F / CHAN_MAXF); + col1[3] += 0.0; /*XXX fix */ + } + else { + col1[0] += span->dsrdy * (1.0F / CHAN_MAXF); + col1[1] += span->dsgdy * (1.0F / CHAN_MAXF); + col1[2] += span->dsbdy * (1.0F / CHAN_MAXF); + col1[3] += 0.0; /*XXX fix */ + } + } + if (program->InputsRead & (1 << FRAG_ATTRIB_FOGC)) { + GLfloat *fogc = (GLfloat*) machine->Inputs[FRAG_ATTRIB_FOGC]; + if (xOrY == 'X') { + fogc[0] += span->dfogdx; + } + else { + fogc[0] += span->dfogdy; + } + } + for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) { + if (program->InputsRead & (1 << (FRAG_ATTRIB_TEX0 + u))) { + GLfloat *tex = (GLfloat*) machine->Inputs[FRAG_ATTRIB_TEX0 + u]; + /* XXX perspective-correct interpolation */ + if (xOrY == 'X') { + tex[0] += span->texStepX[u][0]; + tex[1] += span->texStepX[u][1]; + tex[2] += span->texStepX[u][2]; + tex[3] += span->texStepX[u][3]; + } + else { + tex[0] += span->texStepY[u][0]; + tex[1] += span->texStepY[u][1]; + tex[2] += span->texStepY[u][2]; + tex[3] += span->texStepY[u][3]; + } + } + } + + /* init condition codes */ + dMachine->CondCodes[0] = COND_EQ; + dMachine->CondCodes[1] = COND_EQ; + dMachine->CondCodes[2] = COND_EQ; + dMachine->CondCodes[3] = COND_EQ; +} + + +/** + * Execute the given vertex program. + * NOTE: we do everything in single-precision floating point; we don't + * currently observe the single/half/fixed-precision qualifiers. + * \param ctx - rendering context + * \param program - the fragment program to execute + * \param machine - machine state (register file) + * \param maxInst - max number of instructions to execute + * \return GL_TRUE if program completed or GL_FALSE if program executed KIL. + */ +static GLboolean +execute_program( GLcontext *ctx, + const struct fragment_program *program, GLuint maxInst, + struct fp_machine *machine, const struct sw_span *span, + GLuint column ) +{ + GLuint pc; + +#if DEBUG_FRAG + printf("execute fragment program --------------------\n"); +#endif + + for (pc = 0; pc < maxInst; pc++) { + const struct fp_instruction *inst = program->Instructions + pc; + + if (ctx->FragmentProgram.CallbackEnabled && + ctx->FragmentProgram.Callback) { + ctx->FragmentProgram.CurrentPosition = inst->StringPos; + ctx->FragmentProgram.Callback(program->Base.Target, + ctx->FragmentProgram.CallbackData); + } + + switch (inst->Opcode) { + case FP_OPCODE_ABS: + { + GLfloat a[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, 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 FP_OPCODE_ADD: + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, 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 ); + } + break; + case FP_OPCODE_CMP: + { + GLfloat a[4], b[4], c[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); + fetch_vector4( ctx, &inst->SrcReg[2], machine, program, 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 ); + } + break; + case FP_OPCODE_COS: + { + GLfloat a[4], result[4]; + fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); + result[0] = result[1] = result[2] = result[3] = (GLfloat)_mesa_cos(a[0]); + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_DDX: /* Partial derivative with respect to X */ + { + GLfloat a[4], aNext[4], result[4]; + struct fp_machine dMachine; + if (!fetch_vector4_deriv(ctx, &inst->SrcReg[0], span, 'X', + column, result)) { + /* This is tricky. Make a copy of the current machine state, + * increment the input registers by the dx or dy partial + * derivatives, then re-execute the program up to the + * preceeding instruction, then fetch the source register. + * Finally, find the difference in the register values for + * the original and derivative runs. + */ + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a); + init_machine_deriv(ctx, machine, program, span, + 'X', &dMachine); + execute_program(ctx, program, pc, &dMachine, span, column); + fetch_vector4( ctx, &inst->SrcReg[0], &dMachine, program, aNext ); + result[0] = aNext[0] - a[0]; + result[1] = aNext[1] - a[1]; + result[2] = aNext[2] - a[2]; + result[3] = aNext[3] - a[3]; + } + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_DDY: /* Partial derivative with respect to Y */ + { + GLfloat a[4], aNext[4], result[4]; + struct fp_machine dMachine; + if (!fetch_vector4_deriv(ctx, &inst->SrcReg[0], span, 'Y', + column, result)) { + init_machine_deriv(ctx, machine, program, span, + 'Y', &dMachine); + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a); + execute_program(ctx, program, pc, &dMachine, span, column); + fetch_vector4( ctx, &inst->SrcReg[0], &dMachine, program, aNext ); + result[0] = aNext[0] - a[0]; + result[1] = aNext[1] - a[1]; + result[2] = aNext[2] - a[2]; + result[3] = aNext[3] - a[3]; + } + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_DP3: + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); + result[0] = result[1] = result[2] = result[3] = + a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + store_vector4( inst, machine, result ); +#if DEBUG_FRAG + printf("DP3 %g = (%g %g %g) . (%g %g %g)\n", + result[0], a[0], a[1], a[2], b[0], b[1], b[2]); +#endif + } + break; + case FP_OPCODE_DP4: + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); + result[0] = result[1] = result[2] = result[3] = + a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + store_vector4( inst, machine, result ); +#if DEBUG_FRAG + 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]); +#endif + } + break; + case FP_OPCODE_DPH: + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); + result[0] = result[1] = result[2] = result[3] = + a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + b[3]; + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_DST: /* Distance vector */ + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, 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 FP_OPCODE_EX2: /* Exponential base 2 */ + { + GLfloat a[4], result[4]; + fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); + result[0] = result[1] = result[2] = result[3] = + (GLfloat) _mesa_pow(2.0, a[0]); + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_FLR: + { + GLfloat a[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, 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 FP_OPCODE_FRC: + { + GLfloat a[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, 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 FP_OPCODE_KIL_NV: /* NV_f_p only */ + { + 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_FALSE; + } + } + break; + case FP_OPCODE_KIL: /* ARB_f_p only */ + { + GLfloat a[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + if (a[0] < 0.0F || a[1] < 0.0F || a[2] < 0.0F || a[3] < 0.0F) { + return GL_FALSE; + } + } + break; + case FP_OPCODE_LG2: /* log base 2 */ + { + GLfloat a[4], result[4]; + fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); + result[0] = result[1] = result[2] = result[3] + = LOG2(a[0]); + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_LIT: + { + const GLfloat epsilon = 1.0F / 256.0F; /* from NV VP spec */ + GLfloat a[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, 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 */ + result[2] = (a[0] > 0.0F) ? (GLfloat) exp(a[3] * log(a[1])) : 0.0F; + result[3] = 1.0F; + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_LRP: + { + GLfloat a[4], b[4], c[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); + fetch_vector4( ctx, &inst->SrcReg[2], machine, program, 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 ); + } + break; + case FP_OPCODE_MAD: + { + GLfloat a[4], b[4], c[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); + fetch_vector4( ctx, &inst->SrcReg[2], machine, program, 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 ); + } + break; + case FP_OPCODE_MAX: + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, 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_FRAG + 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]); +#endif + } + break; + case FP_OPCODE_MIN: + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, 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 FP_OPCODE_MOV: + { + GLfloat result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, result ); + store_vector4( inst, machine, result ); +#if DEBUG_FRAG + printf("MOV (%g %g %g %g)\n", + result[0], result[1], result[2], result[3]); +#endif + } + break; + case FP_OPCODE_MUL: + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, 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_FRAG + 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]); +#endif + } + break; + case FP_OPCODE_PK2H: /* pack two 16-bit floats in one 32-bit float */ + { + GLfloat a[4], result[4]; + GLhalfNV hx, hy; + GLuint *rawResult = (GLuint *) result; + GLuint twoHalves; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + hx = _mesa_float_to_half(a[0]); + hy = _mesa_float_to_half(a[1]); + twoHalves = hx | (hy << 16); + rawResult[0] = rawResult[1] = rawResult[2] = rawResult[3] + = twoHalves; + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_PK2US: /* pack two GLushorts into one 32-bit float */ + { + GLfloat a[4], result[4]; + GLuint usx, usy, *rawResult = (GLuint *) result; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, 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); + rawResult[0] = rawResult[1] = rawResult[2] = rawResult[3] + = usx | (usy << 16); + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_PK4B: /* pack four GLbytes into one 32-bit float */ + { + GLfloat a[4], result[4]; + GLuint ubx, uby, ubz, ubw, *rawResult = (GLuint *) result; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, 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); + rawResult[0] = rawResult[1] = rawResult[2] = rawResult[3] + = ubx | (uby << 8) | (ubz << 16) | (ubw << 24); + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_PK4UB: /* pack four GLubytes into one 32-bit float */ + { + GLfloat a[4], result[4]; + GLuint ubx, uby, ubz, ubw, *rawResult = (GLuint *) result; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, 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]); + rawResult[0] = rawResult[1] = rawResult[2] = rawResult[3] + = ubx | (uby << 8) | (ubz << 16) | (ubw << 24); + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_POW: + { + GLfloat a[4], b[4], result[4]; + fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector1( ctx, &inst->SrcReg[1], machine, program, b ); + result[0] = result[1] = result[2] = result[3] + = (GLfloat)_mesa_pow(a[0], b[0]); + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_RCP: + { + GLfloat a[4], result[4]; + fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); +#if DEBUG_FRAG + if (a[0] == 0) + printf("RCP(0)\n"); + else if (IS_INF_OR_NAN(a[0])) + printf("RCP(inf)\n"); +#endif + result[0] = result[1] = result[2] = result[3] + = 1.0F / a[0]; + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_RFL: + { + GLfloat axis[4], dir[4], result[4], tmp[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, axis ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, dir ); + tmp[3] = axis[0] * axis[0] + + axis[1] * axis[1] + + axis[2] * axis[2]; + tmp[0] = (2.0F * (axis[0] * dir[0] + + axis[1] * dir[1] + + axis[2] * dir[2])) / tmp[3]; + result[0] = tmp[0] * axis[0] - dir[0]; + result[1] = tmp[0] * axis[1] - dir[1]; + result[2] = tmp[0] * axis[2] - dir[2]; + /* result[3] is never written! XXX enforce in parser! */ + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_RSQ: /* 1 / sqrt() */ + { + GLfloat a[4], result[4]; + fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); + result[0] = result[1] = result[2] = result[3] = INV_SQRTF(a[0]); + store_vector4( inst, machine, result ); +#if DEBUG_FRAG + printf("RSQ %g = 1/sqrt(%g)\n", result[0], a[0]); +#endif + } + break; + case FP_OPCODE_SCS: /* sine and cos */ + { + GLfloat a[4], result[4]; + fetch_vector1( ctx, &inst->SrcReg[0], machine, program, 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 FP_OPCODE_SEQ: /* set on equal */ + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, 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 ); + } + break; + case FP_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 FP_OPCODE_SGE: /* set on greater or equal */ + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, 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 ); + } + break; + case FP_OPCODE_SGT: /* set on greater */ + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, 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 ); + } + break; + case FP_OPCODE_SIN: + { + GLfloat a[4], result[4]; + fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); + result[0] = result[1] = result[2] = + result[3] = (GLfloat)_mesa_sin(a[0]); + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_SLE: /* set on less or equal */ + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, 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 ); + } + break; + case FP_OPCODE_SLT: /* set on less */ + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, 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 ); + } + break; + case FP_OPCODE_SNE: /* set on not equal */ + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, 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 ); + } + break; + case FP_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 FP_OPCODE_SUB: + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, 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 ); + } + break; + case FP_OPCODE_SWZ: + { + const struct fp_src_register *source = &inst->SrcReg[0]; + const GLfloat *src = get_register_pointer(ctx, source, + machine, program); + GLfloat result[4]; + GLuint i; + + /* do extended swizzling here */ + for (i = 0; i < 4; i++) { + if (GET_SWZ(source->Swizzle, i) == SWIZZLE_ZERO) + result[i] = 0.0; + else if (GET_SWZ(source->Swizzle, i) == SWIZZLE_ONE) + result[i] = 1.0; + else + result[i] = src[GET_SWZ(source->Swizzle, i)]; + + if (source->NegateBase & (1 << i)) + result[i] = -result[i]; + } + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_TEX: /* Both ARB and NV frag prog */ + /* Texel lookup */ + { + GLfloat texcoord[4], color[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, texcoord ); + /* Note: we pass 0 for LOD. The ARB extension requires it + * while the NV extension says it's implementation dependant. + */ + /* KW: Previously lambda was passed as zero, but I + * believe this is incorrect, the spec seems to + * indicate rather that lambda should not be + * changed/biased, unlike TXB where texcoord[3] is + * added to the lambda calculations. The lambda should + * still be calculated normally for TEX & TXP though, + * not set to zero. Otherwise it's very difficult to + * implement normal GL semantics through the fragment + * shader. + */ + fetch_texel( ctx, texcoord, + span->array->lambda[inst->TexSrcUnit][column], + inst->TexSrcUnit, color ); + store_vector4( inst, machine, color ); + } + break; + case FP_OPCODE_TXB: /* GL_ARB_fragment_program only */ + /* Texel lookup with LOD bias */ + { + GLfloat texcoord[4], color[4], bias, lambda; + + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, texcoord ); + /* texcoord[3] is the bias to add to lambda */ + bias = ctx->Texture.Unit[inst->TexSrcUnit].LodBias + + ctx->Texture.Unit[inst->TexSrcUnit]._Current->LodBias + + texcoord[3]; + lambda = span->array->lambda[inst->TexSrcUnit][column] + bias; + fetch_texel( ctx, texcoord, lambda, + inst->TexSrcUnit, color ); + store_vector4( inst, machine, color ); + } + break; + case FP_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( ctx, &inst->SrcReg[0], machine, program, texcoord ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, dtdx ); + fetch_vector4( ctx, &inst->SrcReg[2], machine, program, dtdy ); + fetch_texel_deriv( ctx, texcoord, dtdx, dtdy, inst->TexSrcUnit, + color ); + store_vector4( inst, machine, color ); + } + break; + case FP_OPCODE_TXP: /* GL_ARB_fragment_program only */ + /* Texture lookup w/ projective divide */ + { + GLfloat texcoord[4], color[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, 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]; + } + /* KW: Previously lambda was passed as zero, but I + * believe this is incorrect, the spec seems to + * indicate rather that lambda should not be + * changed/biased, unlike TXB where texcoord[3] is + * added to the lambda calculations. The lambda should + * still be calculated normally for TEX & TXP though, + * not set to zero. + */ + fetch_texel( ctx, texcoord, + span->array->lambda[inst->TexSrcUnit][column], + inst->TexSrcUnit, color ); + store_vector4( inst, machine, color ); + } + break; + case FP_OPCODE_TXP_NV: /* GL_NV_fragment_program only */ + /* Texture lookup w/ projective divide */ + { + GLfloat texcoord[4], color[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, texcoord ); + if (inst->TexSrcIdx != TEXTURE_CUBE_INDEX && + texcoord[3] != 0.0) { + texcoord[0] /= texcoord[3]; + texcoord[1] /= texcoord[3]; + texcoord[2] /= texcoord[3]; + } + fetch_texel( ctx, texcoord, + span->array->lambda[inst->TexSrcUnit][column], + inst->TexSrcUnit, color ); + store_vector4( inst, machine, color ); + } + break; + case FP_OPCODE_UP2H: /* unpack two 16-bit floats */ + { + GLfloat a[4], result[4]; + const GLuint *rawBits = (const GLuint *) a; + GLhalfNV hx, hy; + fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); + hx = rawBits[0] & 0xffff; + hy = rawBits[0] >> 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 FP_OPCODE_UP2US: /* unpack two GLushorts */ + { + GLfloat a[4], result[4]; + const GLuint *rawBits = (const GLuint *) a; + GLushort usx, usy; + fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); + usx = rawBits[0] & 0xffff; + usy = rawBits[0] >> 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 FP_OPCODE_UP4B: /* unpack four GLbytes */ + { + GLfloat a[4], result[4]; + const GLuint *rawBits = (const GLuint *) a; + fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); + result[0] = (((rawBits[0] >> 0) & 0xff) - 128) / 127.0F; + result[1] = (((rawBits[0] >> 8) & 0xff) - 128) / 127.0F; + result[2] = (((rawBits[0] >> 16) & 0xff) - 128) / 127.0F; + result[3] = (((rawBits[0] >> 24) & 0xff) - 128) / 127.0F; + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_UP4UB: /* unpack four GLubytes */ + { + GLfloat a[4], result[4]; + const GLuint *rawBits = (const GLuint *) a; + fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); + result[0] = ((rawBits[0] >> 0) & 0xff) / 255.0F; + result[1] = ((rawBits[0] >> 8) & 0xff) / 255.0F; + result[2] = ((rawBits[0] >> 16) & 0xff) / 255.0F; + result[3] = ((rawBits[0] >> 24) & 0xff) / 255.0F; + store_vector4( inst, machine, result ); + } + break; + case FP_OPCODE_XPD: /* cross product */ + { + GLfloat a[4], b[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, 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 ); + } + break; + case FP_OPCODE_X2D: /* 2-D matrix transform */ + { + GLfloat a[4], b[4], c[4], result[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); + fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); + fetch_vector4( ctx, &inst->SrcReg[2], machine, program, 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 FP_OPCODE_PRINT: + { + if (inst->SrcReg[0].File != -1) { + GLfloat a[4]; + fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a); + _mesa_printf("%s%g, %g, %g, %g\n", (const char *) inst->Data, + a[0], a[1], a[2], a[3]); + } + else { + _mesa_printf("%s\n", (const char *) inst->Data); + } + } + break; + case FP_OPCODE_END: + return GL_TRUE; + default: + _mesa_problem(ctx, "Bad opcode %d in _mesa_exec_fragment_program", + inst->Opcode); + return GL_TRUE; /* return value doesn't matter */ + } + } + return GL_TRUE; +} + + +static void +init_machine( GLcontext *ctx, struct fp_machine *machine, + const struct fragment_program *program, + const struct sw_span *span, GLuint col ) +{ + GLuint inputsRead = program->InputsRead; + GLuint u; + + if (ctx->FragmentProgram.CallbackEnabled) + inputsRead = ~0; + + if (program->Base.Target == GL_FRAGMENT_PROGRAM_NV) { + /* Clear temporary registers (undefined for ARB_f_p) */ + _mesa_bzero(machine->Temporaries, + MAX_NV_FRAGMENT_PROGRAM_TEMPS * 4 * sizeof(GLfloat)); + } + + /* Load input registers */ + if (inputsRead & (1 << FRAG_ATTRIB_WPOS)) { + GLfloat *wpos = machine->Inputs[FRAG_ATTRIB_WPOS]; + ASSERT(span->arrayMask & SPAN_Z); + wpos[0] = (GLfloat) span->x + col; + wpos[1] = (GLfloat) span->y; + wpos[2] = (GLfloat) span->array->z[col] / ctx->DrawBuffer->_DepthMaxF; + wpos[3] = span->w + col * span->dwdx; + } + if (inputsRead & (1 << FRAG_ATTRIB_COL0)) { + GLfloat *col0 = machine->Inputs[FRAG_ATTRIB_COL0]; + ASSERT(span->arrayMask & SPAN_RGBA); + col0[0] = CHAN_TO_FLOAT(span->array->rgba[col][RCOMP]); + col0[1] = CHAN_TO_FLOAT(span->array->rgba[col][GCOMP]); + col0[2] = CHAN_TO_FLOAT(span->array->rgba[col][BCOMP]); + col0[3] = CHAN_TO_FLOAT(span->array->rgba[col][ACOMP]); + } + if (inputsRead & (1 << FRAG_ATTRIB_COL1)) { + GLfloat *col1 = machine->Inputs[FRAG_ATTRIB_COL1]; + col1[0] = CHAN_TO_FLOAT(span->array->spec[col][RCOMP]); + col1[1] = CHAN_TO_FLOAT(span->array->spec[col][GCOMP]); + col1[2] = CHAN_TO_FLOAT(span->array->spec[col][BCOMP]); + col1[3] = CHAN_TO_FLOAT(span->array->spec[col][ACOMP]); + } + if (inputsRead & (1 << FRAG_ATTRIB_FOGC)) { + GLfloat *fogc = machine->Inputs[FRAG_ATTRIB_FOGC]; + ASSERT(span->arrayMask & SPAN_FOG); + fogc[0] = span->array->fog[col]; + fogc[1] = 0.0F; + fogc[2] = 0.0F; + fogc[3] = 0.0F; + } + for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) { + if (inputsRead & (1 << (FRAG_ATTRIB_TEX0 + u))) { + GLfloat *tex = machine->Inputs[FRAG_ATTRIB_TEX0 + u]; + /*ASSERT(ctx->Texture._EnabledCoordUnits & (1 << u));*/ + COPY_4V(tex, span->array->texcoords[u][col]); + /*ASSERT(tex[0] != 0 || tex[1] != 0 || tex[2] != 0);*/ + } + } + + /* init condition codes */ + machine->CondCodes[0] = COND_EQ; + machine->CondCodes[1] = COND_EQ; + machine->CondCodes[2] = COND_EQ; + machine->CondCodes[3] = COND_EQ; +} + + + +/** + * Execute the current fragment program, operating on the given span. + */ +void +_swrast_exec_fragment_program( GLcontext *ctx, struct sw_span *span ) +{ + const struct fragment_program *program = ctx->FragmentProgram._Current; + GLuint i; + + ctx->_CurrentProgram = GL_FRAGMENT_PROGRAM_ARB; /* or NV, doesn't matter */ + + if (program->Parameters) { + _mesa_load_state_parameters(ctx, program->Parameters); + } + + for (i = 0; i < span->end; i++) { + if (span->array->mask[i]) { + init_machine(ctx, &ctx->FragmentProgram.Machine, + ctx->FragmentProgram._Current, span, i); + +#ifdef USE_TCC + if (!_swrast_execute_codegen_program(ctx, program, ~0, + &ctx->FragmentProgram.Machine, + span, i)) { + span->array->mask[i] = GL_FALSE; /* killed fragment */ + span->writeAll = GL_FALSE; + } +#else + if (!execute_program(ctx, program, ~0, + &ctx->FragmentProgram.Machine, span, i)) { + span->array->mask[i] = GL_FALSE; /* killed fragment */ + span->writeAll = GL_FALSE; + } +#endif + + /* Store output registers */ + { + const GLfloat *colOut + = ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_COLR]; + UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][RCOMP], colOut[0]); + UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][GCOMP], colOut[1]); + UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][BCOMP], colOut[2]); + UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][ACOMP], colOut[3]); + } + /* depth value */ + if (program->OutputsWritten & (1 << FRAG_OUTPUT_DEPR)) { + const GLfloat depth + = ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_DEPR][2]; + span->array->z[i] = IROUND(depth * ctx->DrawBuffer->_DepthMaxF); + } + } + } + + if (program->OutputsWritten & (1 << FRAG_OUTPUT_DEPR)) { + span->interpMask &= ~SPAN_Z; + span->arrayMask |= SPAN_Z; + } + + ctx->_CurrentProgram = 0; +} + diff --git a/reactos/dll/mesa32/src/swrast/s_nvfragprog.h b/reactos/dll/mesa32/src/swrast/s_nvfragprog.h new file mode 100644 index 00000000000..ac5a15fe9bc --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_nvfragprog.h @@ -0,0 +1,37 @@ +/* + * Mesa 3-D graphics library + * Version: 6.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. + */ + + +#ifndef S_NVFRAGPROG_H +#define S_NVFRAGPROG_H + + +#include "s_context.h" + + +extern void +_swrast_exec_fragment_program( GLcontext *ctx, struct sw_span *span ); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_pixeltex.c b/reactos/dll/mesa32/src/swrast/s_pixeltex.c new file mode 100644 index 00000000000..1c65290d40d --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_pixeltex.c @@ -0,0 +1,111 @@ +/* + * 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. + */ + + +/* + * This file implements both the GL_SGIX_pixel_texture and + * GL_SIGS_pixel_texture extensions. Luckily, they pretty much + * overlap in functionality so we use the same state variables + * and execution code for both. + */ + + +#include "glheader.h" +#include "colormac.h" +#include "imports.h" + +#include "s_context.h" +#include "s_pixeltex.h" +#include "s_texture.h" + + +/* + * Convert RGBA values into strq texture coordinates. + */ +static void +pixeltexgen(GLcontext *ctx, GLuint n, const GLchan rgba[][4], + GLfloat texcoord[][4]) +{ + if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_COLOR) { + GLuint i; + for (i = 0; i < n; i++) { + texcoord[i][0] = ctx->Current.RasterColor[RCOMP]; + texcoord[i][1] = ctx->Current.RasterColor[GCOMP]; + texcoord[i][2] = ctx->Current.RasterColor[BCOMP]; + } + } + else { + GLuint i; + ASSERT(ctx->Pixel.FragmentRgbSource == GL_PIXEL_GROUP_COLOR_SGIS); + for (i = 0; i < n; i++) { + texcoord[i][0] = CHAN_TO_FLOAT(rgba[i][RCOMP]); + texcoord[i][1] = CHAN_TO_FLOAT(rgba[i][GCOMP]); + texcoord[i][2] = CHAN_TO_FLOAT(rgba[i][BCOMP]); + } + } + + if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_COLOR) { + GLuint i; + for (i = 0; i < n; i++) { + texcoord[i][3] = ctx->Current.RasterColor[ACOMP]; + } + } + else { + GLuint i; + ASSERT(ctx->Pixel.FragmentAlphaSource == GL_PIXEL_GROUP_COLOR_SGIS); + for (i = 0; i < n; i++) { + texcoord[i][3] = CHAN_TO_FLOAT(rgba[i][ACOMP]); + } + } +} + + + +/* + * Used by glDraw/CopyPixels: the incoming image colors are treated + * as texture coordinates. Use those coords to texture the image. + * This is for GL_SGIS_pixel_texture / GL_SGIX_pixel_texture. + */ +void +_swrast_pixel_texture(GLcontext *ctx, struct sw_span *span) +{ + GLuint unit; + + ASSERT(!(span->arrayMask & SPAN_TEXTURE)); + span->arrayMask |= SPAN_TEXTURE; + span->interpMask &= ~SPAN_TEXTURE; + + /* convert colors into texture coordinates */ + pixeltexgen( ctx, span->end, + (const GLchan (*)[4]) span->array->rgba, + span->array->texcoords[0] ); + + /* copy the new texture units for all enabled units */ + for (unit = 1; unit < ctx->Const.MaxTextureUnits; unit++) { + if (ctx->Texture.Unit[unit]._ReallyEnabled) { + MEMCPY( span->array->texcoords[unit], span->array->texcoords[0], + span->end * 4 * sizeof(GLfloat) ); + } + } +} diff --git a/reactos/dll/mesa32/src/swrast/s_pixeltex.h b/reactos/dll/mesa32/src/swrast/s_pixeltex.h new file mode 100644 index 00000000000..6ef7a44df1e --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_pixeltex.h @@ -0,0 +1,38 @@ + +/* + * 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 S_PIXELTEX_H +#define S_PIXELTEX_H + +#include "mtypes.h" +#include "swrast.h" + + +extern void +_swrast_pixel_texture(GLcontext *ctx, struct sw_span *span); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_points.c b/reactos/dll/mesa32/src/swrast/s_points.c new file mode 100644 index 00000000000..5879bccf1e3 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_points.c @@ -0,0 +1,275 @@ +/* + * 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. + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "texstate.h" +#include "s_context.h" +#include "s_feedback.h" +#include "s_points.h" +#include "s_span.h" + + + +#define RGBA 0x1 +#define INDEX 0x2 +#define SMOOTH 0x4 +#define TEXTURE 0x8 +#define SPECULAR 0x10 +#define LARGE 0x20 +#define ATTENUATE 0x40 +#define SPRITE 0x80 + + +/* + * CI points with size == 1.0 + */ +#define FLAGS (INDEX) +#define NAME size1_ci_point +#include "s_pointtemp.h" + + +/* + * General CI points. + */ +#define FLAGS (INDEX | LARGE) +#define NAME general_ci_point +#include "s_pointtemp.h" + + +/* + * Antialiased CI points. + */ +#define FLAGS (INDEX | SMOOTH) +#define NAME antialiased_ci_point +#include "s_pointtemp.h" + + +/* + * Distance attenuated, general CI points. + */ +#define FLAGS (INDEX | ATTENUATE) +#define NAME atten_general_ci_point +#include "s_pointtemp.h" + + +/* + * RGBA points with size == 1.0 + */ +#define FLAGS (RGBA) +#define NAME size1_rgba_point +#include "s_pointtemp.h" + + +/* + * General RGBA points. + */ +#define FLAGS (RGBA | LARGE) +#define NAME general_rgba_point +#include "s_pointtemp.h" + + +/* + * Antialiased RGBA points. + */ +#define FLAGS (RGBA | SMOOTH) +#define NAME antialiased_rgba_point +#include "s_pointtemp.h" + + +/* + * Textured RGBA points. + */ +#define FLAGS (RGBA | LARGE | TEXTURE | SPECULAR) +#define NAME textured_rgba_point +#include "s_pointtemp.h" + + +/* + * Antialiased points with texture mapping. + */ +#define FLAGS (RGBA | SMOOTH | TEXTURE | SPECULAR) +#define NAME antialiased_tex_rgba_point +#include "s_pointtemp.h" + + +/* + * Distance attenuated, general RGBA points. + */ +#define FLAGS (RGBA | ATTENUATE) +#define NAME atten_general_rgba_point +#include "s_pointtemp.h" + + +/* + * Distance attenuated, textured RGBA points. + */ +#define FLAGS (RGBA | ATTENUATE | TEXTURE | SPECULAR) +#define NAME atten_textured_rgba_point +#include "s_pointtemp.h" + + +/* + * Distance attenuated, antialiased points with or without texture mapping. + */ +#define FLAGS (RGBA | ATTENUATE | TEXTURE | SMOOTH) +#define NAME atten_antialiased_rgba_point +#include "s_pointtemp.h" + + +/* + * Sprite (textured point) + */ +#define FLAGS (RGBA | SPRITE | SPECULAR) +#define NAME sprite_point +#include "s_pointtemp.h" + + +#define FLAGS (RGBA | SPRITE | SPECULAR | ATTENUATE) +#define NAME atten_sprite_point +#include "s_pointtemp.h" + + + +void _swrast_add_spec_terms_point( GLcontext *ctx, + const SWvertex *v0 ) +{ + SWvertex *ncv0 = (SWvertex *)v0; + GLchan c[1][4]; + COPY_CHAN4( c[0], ncv0->color ); + ACC_3V( ncv0->color, ncv0->specular ); + SWRAST_CONTEXT(ctx)->SpecPoint( ctx, ncv0 ); + COPY_CHAN4( ncv0->color, c[0] ); +} + + + +/* record the current point function name */ +#ifdef DEBUG + +static const char *pntFuncName = NULL; + +#define USE(pntFunc) \ +do { \ + pntFuncName = #pntFunc; \ + /*printf("%s\n", pntFuncName);*/ \ + swrast->Point = pntFunc; \ +} while (0) + +#else + +#define USE(pntFunc) swrast->Point = pntFunc + +#endif + + +/* + * Examine the current context to determine which point drawing function + * should be used. + */ +void +_swrast_choose_point( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLboolean rgbMode = ctx->Visual.rgbMode; + + if (ctx->RenderMode==GL_RENDER) { + if (ctx->Point.PointSprite) { + /* GL_ARB_point_sprite / GL_NV_point_sprite */ + /* XXX this might not be good enough */ + if (ctx->Point._Attenuated) + USE(atten_sprite_point); + else + USE(sprite_point); + } + else if (ctx->Point.SmoothFlag) { + /* Smooth points */ + if (rgbMode) { + if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) { + USE(atten_antialiased_rgba_point); + } + else if (ctx->Texture._EnabledCoordUnits) { + USE(antialiased_tex_rgba_point); + } + else { + USE(antialiased_rgba_point); + } + } + else { + USE(antialiased_ci_point); + } + } + else if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) { + if (rgbMode) { + if (ctx->Texture._EnabledCoordUnits) { + if (ctx->Point.SmoothFlag) { + USE(atten_antialiased_rgba_point); + } + else { + USE(atten_textured_rgba_point); + } + } + else { + USE(atten_general_rgba_point); + } + } + else { + /* ci, atten */ + USE(atten_general_ci_point); + } + } + else if (ctx->Texture._EnabledCoordUnits && rgbMode) { + /* textured */ + USE(textured_rgba_point); + } + else if (ctx->Point._Size != 1.0) { + /* large points */ + if (rgbMode) { + USE(general_rgba_point); + } + else { + USE(general_ci_point); + } + } + else { + /* single pixel points */ + if (rgbMode) { + USE(size1_rgba_point); + } + else { + USE(size1_ci_point); + } + } + } + else if (ctx->RenderMode==GL_FEEDBACK) { + USE(_swrast_feedback_point); + } + else { + /* GL_SELECT mode */ + USE(_swrast_select_point); + } +} diff --git a/reactos/dll/mesa32/src/swrast/s_points.h b/reactos/dll/mesa32/src/swrast/s_points.h new file mode 100644 index 00000000000..40b442e951f --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_points.h @@ -0,0 +1,39 @@ + +/* + * 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 S_POINTS_H +#define S_POINTS_H + +#include "mtypes.h" + +extern void +_swrast_choose_point( GLcontext *ctx ); + +extern void +_swrast_add_spec_terms_point( GLcontext *ctx, + const SWvertex *v0 ); + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_pointtemp.h b/reactos/dll/mesa32/src/swrast/s_pointtemp.h new file mode 100644 index 00000000000..4ce261009c0 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_pointtemp.h @@ -0,0 +1,419 @@ +/* + * 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. + */ + +/* + * Regarding GL_NV_point_sprite: + * + * 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. + */ + + +/* + * Point rendering template code. + * + * Set FLAGS = bitwise-OR of the following tokens: + * + * RGBA = do rgba instead of color index + * SMOOTH = do antialiasing + * TEXTURE = do texture coords + * SPECULAR = do separate specular color + * LARGE = do points with diameter > 1 pixel + * ATTENUATE = compute point size attenuation + * SPRITE = GL_ARB_point_sprite / GL_NV_point_sprite + * + * Notes: LARGE and ATTENUATE are exclusive of each other. + * TEXTURE requires RGBA + */ + + +/* + * NOTES on antialiased point rasterization: + * + * Let d = distance of fragment center from vertex. + * if d < rmin2 then + * fragment has 100% coverage + * else if d > rmax2 then + * fragment has 0% coverage + * else + * fragment has % coverage = (d - rmin2) / (rmax2 - rmin2) + */ + + + +static void +NAME ( GLcontext *ctx, const SWvertex *vert ) +{ +#if FLAGS & (ATTENUATE | LARGE | SMOOTH | SPRITE) + GLfloat size; +#endif +#if FLAGS & RGBA +#if (FLAGS & ATTENUATE) && (FLAGS & SMOOTH) + GLfloat alphaAtten; +#endif + const GLchan red = vert->color[0]; + const GLchan green = vert->color[1]; + const GLchan blue = vert->color[2]; + const GLchan alpha = vert->color[3]; +#endif +#if FLAGS & SPECULAR + const GLchan specRed = vert->specular[0]; + const GLchan specGreen = vert->specular[1]; + const GLchan specBlue = vert->specular[2]; +#endif +#if FLAGS & INDEX + const GLuint colorIndex = (GLuint) vert->index; /* XXX round? */ +#endif +#if FLAGS & TEXTURE + GLfloat texcoord[MAX_TEXTURE_COORD_UNITS][4]; + GLuint u; +#endif + SWcontext *swrast = SWRAST_CONTEXT(ctx); + struct sw_span *span = &(swrast->PointSpan); + + /* Cull primitives with malformed coordinates. + */ + { + float tmp = vert->win[0] + vert->win[1]; + if (IS_INF_OR_NAN(tmp)) + return; + } + + /* + * Span init + */ + span->interpMask = SPAN_FOG; + span->arrayMask = SPAN_XY | SPAN_Z; + span->fog = vert->fog; + span->fogStep = 0.0; +#if FLAGS & RGBA + span->arrayMask |= SPAN_RGBA; +#endif +#if FLAGS & SPECULAR + span->arrayMask |= SPAN_SPEC; +#endif +#if FLAGS & INDEX + span->arrayMask |= SPAN_INDEX; +#endif +#if FLAGS & TEXTURE + span->arrayMask |= SPAN_TEXTURE; + if (ctx->FragmentProgram._Active) { + /* Don't divide texture s,t,r by q (use TXP to do that) */ + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (ctx->Texture._EnabledCoordUnits & (1 << u)) { + COPY_4V(texcoord[u], vert->texcoord[u]); + } + } + } + else { + /* Divide texture s,t,r by q here */ + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (ctx->Texture._EnabledCoordUnits & (1 << u)) { + const GLfloat q = vert->texcoord[u][3]; + const GLfloat invQ = (q == 0.0F || q == 1.0F) ? 1.0F : (1.0F / q); + texcoord[u][0] = vert->texcoord[u][0] * invQ; + texcoord[u][1] = vert->texcoord[u][1] * invQ; + texcoord[u][2] = vert->texcoord[u][2] * invQ; + texcoord[u][3] = q; + } + } + } + /* need these for fragment programs */ + span->w = 1.0F; + span->dwdx = 0.0F; + span->dwdy = 0.0F; +#endif +#if FLAGS & SMOOTH + span->arrayMask |= SPAN_COVERAGE; +#endif +#if FLAGS & SPRITE + span->arrayMask |= SPAN_TEXTURE; +#endif + + /* Compute point size if not known to be one */ +#if FLAGS & ATTENUATE + /* first, clamp attenuated size to the user-specifed range */ + size = CLAMP(vert->pointSize, ctx->Point.MinSize, ctx->Point.MaxSize); +#if (FLAGS & RGBA) && (FLAGS & SMOOTH) + /* only if multisampling, compute the fade factor */ + if (ctx->Multisample.Enabled) { + if (vert->pointSize >= ctx->Point.Threshold) { + alphaAtten = 1.0F; + } + else { + GLfloat dsize = vert->pointSize / ctx->Point.Threshold; + alphaAtten = dsize * dsize; + } + } + else { + alphaAtten = 1.0; + } +#endif +#elif FLAGS & (LARGE | SMOOTH | SPRITE) + /* constant, non-attenuated size */ + size = ctx->Point._Size; /* this is already clamped */ +#endif + + +#if FLAGS & (ATTENUATE | LARGE | SMOOTH | SPRITE) + /*** + *** Multi-pixel points + ***/ + + /* do final clamping now */ + if (ctx->Point.SmoothFlag) { + size = CLAMP(size, ctx->Const.MinPointSizeAA, ctx->Const.MaxPointSizeAA); + } + else { + size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); + } + + {{ + GLint x, y; + const GLfloat radius = 0.5F * size; + const GLint z = (GLint) (vert->win[2] + 0.5F); + GLuint count; +#if FLAGS & SMOOTH + const GLfloat rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ + const GLfloat rmax = radius + 0.7071F; + const GLfloat rmin2 = MAX2(0.0F, rmin * rmin); + const GLfloat rmax2 = rmax * rmax; + const GLfloat cscale = 1.0F / (rmax2 - rmin2); + const GLint xmin = (GLint) (vert->win[0] - radius); + const GLint xmax = (GLint) (vert->win[0] + radius); + const GLint ymin = (GLint) (vert->win[1] - radius); + const GLint ymax = (GLint) (vert->win[1] + radius); +#else + /* non-smooth */ + GLint xmin, xmax, ymin, ymax; + GLint iSize = (GLint) (size + 0.5F); + GLint iRadius; + iSize = MAX2(1, iSize); + iRadius = iSize / 2; + if (iSize & 1) { + /* odd size */ + xmin = (GLint) (vert->win[0] - iRadius); + xmax = (GLint) (vert->win[0] + iRadius); + ymin = (GLint) (vert->win[1] - iRadius); + ymax = (GLint) (vert->win[1] + iRadius); + } + else { + /* even size */ + xmin = (GLint) vert->win[0] - iRadius + 1; + xmax = xmin + iSize - 1; + ymin = (GLint) vert->win[1] - iRadius + 1; + ymax = ymin + iSize - 1; + } +#endif /*SMOOTH*/ + + /* check if we need to flush */ + if (span->end + (xmax-xmin+1) * (ymax-ymin+1) >= MAX_WIDTH || + (swrast->_RasterMask & (BLEND_BIT | LOGIC_OP_BIT | MASKING_BIT))) { +#if FLAGS & RGBA + _swrast_write_rgba_span(ctx, span); +#else + _swrast_write_index_span(ctx, span); +#endif + span->end = 0; + } + + /* + * OK, generate fragments + */ + count = span->end; + (void) radius; + for (y = ymin; y <= ymax; y++) { + /* check if we need to flush */ + if (count + (xmax-xmin+1) >= MAX_WIDTH) { + span->end = count; +#if FLAGS & RGBA + _swrast_write_rgba_span(ctx, span); +#else + _swrast_write_index_span(ctx, span); +#endif + count = span->end = 0; + } + for (x = xmin; x <= xmax; x++) { +#if FLAGS & (SPRITE | TEXTURE) + GLuint u; +#endif + +#if FLAGS & RGBA + span->array->rgba[count][RCOMP] = red; + span->array->rgba[count][GCOMP] = green; + span->array->rgba[count][BCOMP] = blue; + span->array->rgba[count][ACOMP] = alpha; +#endif +#if FLAGS & SPECULAR + span->array->spec[count][RCOMP] = specRed; + span->array->spec[count][GCOMP] = specGreen; + span->array->spec[count][BCOMP] = specBlue; +#endif +#if FLAGS & INDEX + span->array->index[count] = colorIndex; +#endif +#if FLAGS & TEXTURE + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (ctx->Texture._EnabledCoordUnits & (1 << u)) { + COPY_4V(span->array->texcoords[u][count], texcoord[u]); + } + } +#endif + +#if FLAGS & SMOOTH + /* compute coverage */ + { + const GLfloat dx = x - vert->win[0] + 0.5F; + const GLfloat dy = y - vert->win[1] + 0.5F; + const GLfloat dist2 = dx * dx + dy * dy; + if (dist2 < rmax2) { + if (dist2 >= rmin2) { + /* compute partial coverage */ + span->array->coverage[count] = 1.0F - (dist2 - rmin2) * cscale; +#if FLAGS & INDEX + /* coverage in [0,15] */ + span->array->coverage[count] *= 15.0; +#endif + } + else { + /* full coverage */ + span->array->coverage[count] = 1.0F; + } + + span->array->x[count] = x; + span->array->y[count] = y; + span->array->z[count] = z; + +#if (FLAGS & ATTENUATE) && (FLAGS & RGBA) + span->array->rgba[count][ACOMP] = (GLchan) (alpha * alphaAtten); +#elif FLAGS & RGBA + span->array->rgba[count][ACOMP] = alpha; +#endif /*ATTENUATE*/ + count++; + } /*if*/ + } + +#else /*SMOOTH*/ + + /* not smooth (square points) */ + span->array->x[count] = x; + span->array->y[count] = y; + span->array->z[count] = z; + +#if FLAGS & SPRITE + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (ctx->Texture.Unit[u]._ReallyEnabled) { + if (ctx->Point.CoordReplace[u]) { + GLfloat s = 0.5F + (x + 0.5F - vert->win[0]) / size; + GLfloat t, r; + if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT) + t = 0.5F + (y + 0.5F - vert->win[1]) / size; + else /* GL_UPPER_LEFT */ + t = 0.5F - (y + 0.5F - vert->win[1]) / size; + if (ctx->Point.SpriteRMode == GL_ZERO) + r = 0.0F; + else if (ctx->Point.SpriteRMode == GL_S) + r = vert->texcoord[u][0]; + else /* GL_R */ + r = vert->texcoord[u][2]; + span->array->texcoords[u][count][0] = s; + span->array->texcoords[u][count][1] = t; + span->array->texcoords[u][count][2] = r; + span->array->texcoords[u][count][3] = 1.0F; + } + else { + COPY_4V(span->array->texcoords[u][count], vert->texcoord[u]); + } + } + } +#endif /*SPRITE*/ + + count++; /* square point */ + +#endif /*SMOOTH*/ + + } /*for x*/ + } /*for y*/ + span->end = count; + }} + +#else /* LARGE | ATTENUATE | SMOOTH | SPRITE */ + + /*** + *** Single-pixel points + ***/ + {{ + GLuint count; + + /* check if we need to flush */ + if (span->end >= MAX_WIDTH || + (swrast->_RasterMask & (BLEND_BIT | LOGIC_OP_BIT | MASKING_BIT))) { +#if FLAGS & RGBA + _swrast_write_rgba_span(ctx, span); +#else + _swrast_write_index_span(ctx, span); +#endif + span->end = 0; + } + + count = span->end; + +#if FLAGS & RGBA + span->array->rgba[count][RCOMP] = red; + span->array->rgba[count][GCOMP] = green; + span->array->rgba[count][BCOMP] = blue; + span->array->rgba[count][ACOMP] = alpha; +#endif +#if FLAGS & SPECULAR + span->array->spec[count][RCOMP] = specRed; + span->array->spec[count][GCOMP] = specGreen; + span->array->spec[count][BCOMP] = specBlue; +#endif +#if FLAGS & INDEX + span->array->index[count] = colorIndex; +#endif +#if FLAGS & TEXTURE + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (ctx->Texture.Unit[u]._ReallyEnabled) { + COPY_4V(span->array->texcoords[u][count], texcoord[u]); + } + } +#endif + + span->array->x[count] = (GLint) vert->win[0]; + span->array->y[count] = (GLint) vert->win[1]; + span->array->z[count] = (GLint) (vert->win[2] + 0.5F); + span->end = count + 1; + }} + +#endif /* LARGE || ATTENUATE || SMOOTH */ + + ASSERT(span->end <= MAX_WIDTH); +} + + +#undef FLAGS +#undef NAME diff --git a/reactos/dll/mesa32/src/swrast/s_readpix.c b/reactos/dll/mesa32/src/swrast/s_readpix.c new file mode 100644 index 00000000000..d67b7329c96 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_readpix.c @@ -0,0 +1,584 @@ +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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. + */ + + +#include "glheader.h" +#include "bufferobj.h" +#include "colormac.h" +#include "convolve.h" +#include "context.h" +#include "feedback.h" +#include "image.h" +#include "macros.h" +#include "imports.h" +#include "pixel.h" + +#include "s_context.h" +#include "s_depth.h" +#include "s_span.h" +#include "s_stencil.h" + + + +/* + * Read a block of color index pixels. + */ +static void +read_index_pixels( GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum type, GLvoid *pixels, + const struct gl_pixelstore_attrib *packing ) +{ + struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; + /* + SWcontext *swrast = SWRAST_CONTEXT(ctx); + */ + GLint i, readWidth; + + /* error checking */ + if (ctx->Visual.rgbMode) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels" ); + return; + } + + if (type != GL_BYTE && + type != GL_UNSIGNED_BYTE && + type != GL_SHORT && + type != GL_UNSIGNED_SHORT && + type != GL_INT && + type != GL_UNSIGNED_INT && + type != GL_FLOAT) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels(index type)"); + return; + } + + _swrast_use_read_buffer(ctx); + + /* XXX: width should never be > MAX_WIDTH since we did clipping earlier */ + readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; + + /* process image row by row */ + for (i = 0; i < height; i++) { + GLuint index[MAX_WIDTH]; + GLvoid *dest; + ASSERT(rb->DataType == GL_UNSIGNED_INT); + rb->GetRow(ctx, rb, readWidth, x, y + i, index); + + dest = _mesa_image_address2d(packing, pixels, width, height, + GL_COLOR_INDEX, type, i, 0); + + _mesa_pack_index_span(ctx, readWidth, type, dest, index, + &ctx->Pack, ctx->_ImageTransferState); + } + + _swrast_use_draw_buffer(ctx); +} + + + +/** + * Read pixels for format=GL_DEPTH_COMPONENT. + */ +static void +read_depth_pixels( GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum type, GLvoid *pixels, + const struct gl_pixelstore_attrib *packing ) +{ + struct gl_renderbuffer *rb + = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; + GLint readWidth; + GLboolean bias_or_scale; + + /* Error checking */ + if (ctx->Visual.depthBits <= 0 || !rb) { + /* No depth buffer */ + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels" ); + return; + } + + if (type != GL_BYTE && + type != GL_UNSIGNED_BYTE && + type != GL_SHORT && + type != GL_UNSIGNED_SHORT && + type != GL_INT && + type != GL_UNSIGNED_INT && + type != GL_FLOAT) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels(depth type)"); + return; + } + + /* XXX: width should never be > MAX_WIDTH since we did clipping earlier */ + readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; + + bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0; + + if (type==GL_UNSIGNED_SHORT && ctx->Visual.depthBits == 16 + && !bias_or_scale && !packing->SwapBytes) { + /* Special case: directly read 16-bit unsigned depth values. */ + GLint j; + for (j=0;jVisual.depthBits == 32 + && !bias_or_scale && !packing->SwapBytes) { + /* Special case: directly read 32-bit unsigned depth values. */ + GLint j; + for (j=0;jReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer; + GLint j, readWidth; + + if (type != GL_BYTE && + type != GL_UNSIGNED_BYTE && + type != GL_SHORT && + type != GL_UNSIGNED_SHORT && + type != GL_INT && + type != GL_UNSIGNED_INT && + type != GL_FLOAT && + type != GL_BITMAP) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels(stencil type)"); + return; + } + + if (ctx->Visual.stencilBits <= 0 || !rb) { + /* No stencil buffer */ + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels" ); + return; + } + + /* XXX: width should never be > MAX_WIDTH since we did clipping earlier */ + readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; + + /* process image row by row */ + for (j=0;jReadBuffer->_ColorReadBuffer; + /* can't do scale, bias, mapping, etc */ + if (ctx->_ImageTransferState) + return GL_FALSE; + + /* can't do fancy pixel packing */ + if (packing->Alignment != 1 || packing->SwapBytes || packing->LsbFirst) + return GL_FALSE; + + { + GLint srcX = x; + GLint srcY = y; + GLint readWidth = width; /* actual width read */ + GLint readHeight = height; /* actual height read */ + GLint skipPixels = packing->SkipPixels; + GLint skipRows = packing->SkipRows; + GLint rowLength; + + if (packing->RowLength > 0) + rowLength = packing->RowLength; + else + rowLength = width; + + /* + * Ready to read! + * The window region at (destX, destY) of size (readWidth, readHeight) + * will be read back. + * We'll write pixel data to buffer pointed to by "pixels" but we'll + * skip "skipRows" rows and skip "skipPixels" pixels/row. + */ +#if CHAN_BITS == 8 + if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) { +#elif CHAN_BITS == 16 + if (format == GL_RGBA && type == GL_UNSIGNED_SHORT) { +#else + if (0) { +#endif + GLchan *dest = (GLchan *) pixels + + (skipRows * rowLength + skipPixels) * 4; + GLint row; + + if (packing->Invert) { + /* start at top and go down */ + dest += (readHeight - 1) * rowLength * 4; + rowLength = -rowLength; + } + + ASSERT(rb->GetRow); + for (row=0; rowGetRow(ctx, rb, readWidth, srcX, srcY, dest); + dest += rowLength * 4; + srcY++; + } + return GL_TRUE; + } + else { + /* can't do this format/type combination */ + return GL_FALSE; + } + } +} + + + +/* + * Read R, G, B, A, RGB, L, or LA pixels. + */ +static void +read_rgba_pixels( GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, GLvoid *pixels, + const struct gl_pixelstore_attrib *packing ) +{ + struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; + GLint readWidth; + + if (!rb) { + /* No readbuffer is OK with GL_EXT_framebuffer_object */ + return; + } + + /* do error checking on pixel type, format was already checked by caller */ + switch (type) { + case GL_UNSIGNED_BYTE: + case GL_BYTE: + case GL_UNSIGNED_SHORT: + case GL_SHORT: + case GL_UNSIGNED_INT: + case GL_INT: + case GL_FLOAT: + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + /* valid pixel type */ + break; + case GL_HALF_FLOAT_ARB: + if (!ctx->Extensions.ARB_half_float_pixel) { + _mesa_error( ctx, GL_INVALID_ENUM, "glReadPixels(type)" ); + return; + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glReadPixels(type)" ); + return; + } + + if (!_mesa_is_legal_format_and_type(ctx, format, type) || + format == GL_INTENSITY) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(format or type)"); + return; + } + + _swrast_use_read_buffer(ctx); + + /* Try optimized path first */ + if (read_fast_rgba_pixels( ctx, x, y, width, height, + format, type, pixels, packing )) { + + _swrast_use_draw_buffer(ctx); + return; /* done! */ + } + + /* XXX: width should never be > MAX_WIDTH since we did clipping earlier */ + readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; + + + if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { + const GLuint transferOps = ctx->_ImageTransferState; + GLfloat *dest, *src, *tmpImage, *convImage; + GLint row; + + tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); + if (!tmpImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels"); + return; + } + convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); + if (!convImage) { + _mesa_free(tmpImage); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels"); + return; + } + + /* read full RGBA, FLOAT image */ + dest = tmpImage; + for (row = 0; row < height; row++, y++) { + GLchan rgba[MAX_WIDTH][4]; + if (ctx->Visual.rgbMode) { + _swrast_read_rgba_span(ctx, rb, readWidth, x, y, rgba); + } + else { + GLuint index[MAX_WIDTH]; + ASSERT(rb->DataType == GL_UNSIGNED_INT); + rb->GetRow(ctx, rb, readWidth, x, y, index); + if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset !=0 ) { + _mesa_map_ci(ctx, readWidth, index); + } + _mesa_map_ci_to_rgba_chan(ctx, readWidth, index, rgba); + } + _mesa_pack_rgba_span_chan(ctx, readWidth, (const GLchan (*)[4]) rgba, + GL_RGBA, GL_FLOAT, dest, &ctx->DefaultPacking, + transferOps & IMAGE_PRE_CONVOLUTION_BITS); + dest += width * 4; + } + + /* do convolution */ + if (ctx->Pixel.Convolution2DEnabled) { + _mesa_convolve_2d_image(ctx, &readWidth, &height, tmpImage, convImage); + } + else { + ASSERT(ctx->Pixel.Separable2DEnabled); + _mesa_convolve_sep_image(ctx, &readWidth, &height, tmpImage, convImage); + } + _mesa_free(tmpImage); + + /* finish transfer ops and pack the resulting image */ + src = convImage; + for (row = 0; row < height; row++) { + GLvoid *dest; + dest = _mesa_image_address2d(packing, pixels, readWidth, height, + format, type, row, 0); + _mesa_pack_rgba_span_float(ctx, readWidth, + (const GLfloat (*)[4]) src, + format, type, dest, packing, + transferOps & IMAGE_POST_CONVOLUTION_BITS); + src += readWidth * 4; + } + } + else { + /* no convolution */ + GLint row; + for (row = 0; row < height; row++, y++) { + GLchan rgba[MAX_WIDTH][4]; + GLvoid *dst; + if (ctx->Visual.rgbMode) { + _swrast_read_rgba_span(ctx, rb, readWidth, x, y, rgba); + } + else { + GLuint index[MAX_WIDTH]; + ASSERT(rb->DataType == GL_UNSIGNED_INT); + rb->GetRow(ctx, rb, readWidth, x, y, index); + if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset != 0) { + _mesa_map_ci(ctx, readWidth, index); + } + _mesa_map_ci_to_rgba_chan(ctx, readWidth, index, rgba); + } + dst = _mesa_image_address2d(packing, pixels, width, height, + format, type, row, 0); + if (ctx->Visual.redBits < CHAN_BITS || + ctx->Visual.greenBits < CHAN_BITS || + ctx->Visual.blueBits < CHAN_BITS) { + /* Requantize the color values into floating point and go from + * there. This fixes conformance failures with 16-bit color + * buffers, for example. + */ + DEFMARRAY(GLfloat, rgbaf, MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(rgbaf, return); /* mac 32k limitation */ + _mesa_chan_to_float_span(ctx, readWidth, + (CONST GLchan (*)[4]) rgba, rgbaf); + _mesa_pack_rgba_span_float(ctx, readWidth, + (CONST GLfloat (*)[4]) rgbaf, + format, type, dst, packing, + ctx->_ImageTransferState); + UNDEFARRAY(rgbaf); /* mac 32k limitation */ + } + else { + /* GLubytes are fine */ + _mesa_pack_rgba_span_chan(ctx, readWidth, (CONST GLchan (*)[4]) rgba, + format, type, dst, packing, + ctx->_ImageTransferState); + } + } + } + + _swrast_use_draw_buffer(ctx); +} + + +/** + * Software fallback routine for ctx->Driver.ReadPixels(). + * We wind up using the swrast->ReadSpan() routines to do the job. + */ +void +_swrast_ReadPixels( GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid *pixels ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + struct gl_pixelstore_attrib clippedPacking; + + if (swrast->NewState) + _swrast_validate_derived( ctx ); + + /* Do all needed clipping here, so that we can forget about it later */ + clippedPacking = *packing; + if (clippedPacking.RowLength == 0) { + clippedPacking.RowLength = width; + } + if (!_mesa_clip_readpixels(ctx, &x, &y, &width, &height, + &clippedPacking.SkipPixels, + &clippedPacking.SkipRows)) { + /* The ReadPixels region is totally outside the window bounds */ + return; + } + + if (clippedPacking.BufferObj->Name) { + /* pack into PBO */ + GLubyte *buf; + if (!_mesa_validate_pbo_access(2, &clippedPacking, width, height, 1, + format, type, pixels)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glReadPixels(invalid PBO access)"); + return; + } + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + clippedPacking.BufferObj); + if (!buf) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); + return; + } + pixels = ADD_POINTERS(buf, pixels); + } + + RENDER_START(swrast, ctx); + + switch (format) { + case GL_COLOR_INDEX: + read_index_pixels(ctx, x, y, width, height, type, pixels, + &clippedPacking); + break; + case GL_STENCIL_INDEX: + read_stencil_pixels(ctx, x,y, width,height, type, pixels, + &clippedPacking); + break; + case GL_DEPTH_COMPONENT: + read_depth_pixels(ctx, x, y, width, height, type, pixels, + &clippedPacking); + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_RGB: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_RGBA: + case GL_BGR: + case GL_BGRA: + case GL_ABGR_EXT: + read_rgba_pixels(ctx, x, y, width, height, + format, type, pixels, &clippedPacking); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glReadPixels(format)" ); + /* don't return yet, clean-up */ + } + + RENDER_FINISH(swrast, ctx); + + if (clippedPacking.BufferObj->Name) { + /* done with PBO so unmap it now */ + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + clippedPacking.BufferObj); + } +} diff --git a/reactos/dll/mesa32/src/swrast/s_span.c b/reactos/dll/mesa32/src/swrast/s_span.c new file mode 100644 index 00000000000..68944e3ecf2 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_span.c @@ -0,0 +1,1511 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 swrast/s_span.c + * \brief Span processing functions used by all rasterization functions. + * This is where all the per-fragment tests are performed + * \author Brian Paul + */ + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "imports.h" + +#include "s_atifragshader.h" +#include "s_alpha.h" +#include "s_blend.h" +#include "s_context.h" +#include "s_depth.h" +#include "s_fog.h" +#include "s_logic.h" +#include "s_masking.h" +#include "s_nvfragprog.h" +#include "s_span.h" +#include "s_stencil.h" +#include "s_texture.h" + + +/** + * Init span's Z interpolation values to the RasterPos Z. + * Used during setup for glDraw/CopyPixels. + */ +void +_swrast_span_default_z( GLcontext *ctx, struct sw_span *span ) +{ + const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF; + if (ctx->Visual.depthBits <= 16) + span->z = FloatToFixed(ctx->Current.RasterPos[2] * depthMax + 0.5F); + else + span->z = (GLint) (ctx->Current.RasterPos[2] * depthMax + 0.5F); + span->zStep = 0; + span->interpMask |= SPAN_Z; +} + + +/** + * Init span's fog interpolation values to the RasterPos fog. + * Used during setup for glDraw/CopyPixels. + */ +void +_swrast_span_default_fog( GLcontext *ctx, struct sw_span *span ) +{ + span->fog = _swrast_z_to_fogfactor(ctx, ctx->Current.RasterDistance); + span->fogStep = span->dfogdx = span->dfogdy = 0.0F; + span->interpMask |= SPAN_FOG; +} + + +/** + * Init span's rgba or index interpolation values to the RasterPos color. + * Used during setup for glDraw/CopyPixels. + */ +void +_swrast_span_default_color( GLcontext *ctx, struct sw_span *span ) +{ + if (ctx->Visual.rgbMode) { + GLchan r, g, b, a; + UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterColor[0]); + UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.RasterColor[1]); + UNCLAMPED_FLOAT_TO_CHAN(b, ctx->Current.RasterColor[2]); + UNCLAMPED_FLOAT_TO_CHAN(a, ctx->Current.RasterColor[3]); +#if CHAN_TYPE == GL_FLOAT + span->red = r; + span->green = g; + span->blue = b; + span->alpha = a; +#else + span->red = IntToFixed(r); + span->green = IntToFixed(g); + span->blue = IntToFixed(b); + span->alpha = IntToFixed(a); +#endif + span->redStep = 0; + span->greenStep = 0; + span->blueStep = 0; + span->alphaStep = 0; + span->interpMask |= SPAN_RGBA; + } + else { + span->index = FloatToFixed(ctx->Current.RasterIndex); + span->indexStep = 0; + span->interpMask |= SPAN_INDEX; + } +} + + +/** + * Init span's texcoord interpolation values to the RasterPos texcoords. + * Used during setup for glDraw/CopyPixels. + */ +void +_swrast_span_default_texcoords( GLcontext *ctx, struct sw_span *span ) +{ + GLuint i; + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { + const GLfloat *tc = ctx->Current.RasterTexCoords[i]; + if (ctx->FragmentProgram._Active || ctx->ATIFragmentShader._Enabled) { + COPY_4V(span->tex[i], tc); + } + else if (tc[3] > 0.0F) { + /* use (s/q, t/q, r/q, 1) */ + span->tex[i][0] = tc[0] / tc[3]; + span->tex[i][1] = tc[1] / tc[3]; + span->tex[i][2] = tc[2] / tc[3]; + span->tex[i][3] = 1.0; + } + else { + ASSIGN_4V(span->tex[i], 0.0F, 0.0F, 0.0F, 1.0F); + } + ASSIGN_4V(span->texStepX[i], 0.0F, 0.0F, 0.0F, 0.0F); + ASSIGN_4V(span->texStepY[i], 0.0F, 0.0F, 0.0F, 0.0F); + } + span->interpMask |= SPAN_TEXTURE; +} + + +/* Fill in the span.color.rgba array from the interpolation values */ +static void +interpolate_colors(GLcontext *ctx, struct sw_span *span) +{ + const GLuint n = span->end; + GLchan (*rgba)[4] = span->array->rgba; + GLuint i; + (void) ctx; + + ASSERT((span->interpMask & SPAN_RGBA) && + !(span->arrayMask & SPAN_RGBA)); + + if (span->interpMask & SPAN_FLAT) { + /* constant color */ + GLchan color[4]; + color[RCOMP] = FixedToChan(span->red); + color[GCOMP] = FixedToChan(span->green); + color[BCOMP] = FixedToChan(span->blue); + color[ACOMP] = FixedToChan(span->alpha); + for (i = 0; i < n; i++) { + COPY_CHAN4(span->array->rgba[i], color); + } + } + else { + /* interpolate */ +#if CHAN_TYPE == GL_FLOAT + GLfloat r = span->red; + GLfloat g = span->green; + GLfloat b = span->blue; + GLfloat a = span->alpha; + const GLfloat dr = span->redStep; + const GLfloat dg = span->greenStep; + const GLfloat db = span->blueStep; + const GLfloat da = span->alphaStep; +#else + GLfixed r = span->red; + GLfixed g = span->green; + GLfixed b = span->blue; + GLfixed a = span->alpha; + const GLint dr = span->redStep; + const GLint dg = span->greenStep; + const GLint db = span->blueStep; + const GLint da = span->alphaStep; +#endif + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = FixedToChan(r); + rgba[i][GCOMP] = FixedToChan(g); + rgba[i][BCOMP] = FixedToChan(b); + rgba[i][ACOMP] = FixedToChan(a); + r += dr; + g += dg; + b += db; + a += da; + } + } + span->arrayMask |= SPAN_RGBA; +} + + +/* Fill in the span.color.index array from the interpolation values */ +static void +interpolate_indexes(GLcontext *ctx, struct sw_span *span) +{ + GLfixed index = span->index; + const GLint indexStep = span->indexStep; + const GLuint n = span->end; + GLuint *indexes = span->array->index; + GLuint i; + (void) ctx; + ASSERT((span->interpMask & SPAN_INDEX) && + !(span->arrayMask & SPAN_INDEX)); + + if ((span->interpMask & SPAN_FLAT) || (indexStep == 0)) { + /* constant color */ + index = FixedToInt(index); + for (i = 0; i < n; i++) { + indexes[i] = index; + } + } + else { + /* interpolate */ + for (i = 0; i < n; i++) { + indexes[i] = FixedToInt(index); + index += indexStep; + } + } + span->arrayMask |= SPAN_INDEX; + span->interpMask &= ~SPAN_INDEX; +} + + +/* Fill in the span.->array->spec array from the interpolation values */ +static void +interpolate_specular(GLcontext *ctx, struct sw_span *span) +{ + (void) ctx; + if (span->interpMask & SPAN_FLAT) { + /* constant color */ + const GLchan r = FixedToChan(span->specRed); + const GLchan g = FixedToChan(span->specGreen); + const GLchan b = FixedToChan(span->specBlue); + GLuint i; + for (i = 0; i < span->end; i++) { + span->array->spec[i][RCOMP] = r; + span->array->spec[i][GCOMP] = g; + span->array->spec[i][BCOMP] = b; + } + } + else { + /* interpolate */ +#if CHAN_TYPE == GL_FLOAT + GLfloat r = span->specRed; + GLfloat g = span->specGreen; + GLfloat b = span->specBlue; +#else + GLfixed r = span->specRed; + GLfixed g = span->specGreen; + GLfixed b = span->specBlue; +#endif + GLuint i; + for (i = 0; i < span->end; i++) { + span->array->spec[i][RCOMP] = FixedToChan(r); + span->array->spec[i][GCOMP] = FixedToChan(g); + span->array->spec[i][BCOMP] = FixedToChan(b); + r += span->specRedStep; + g += span->specGreenStep; + b += span->specBlueStep; + } + } + span->arrayMask |= SPAN_SPEC; +} + + +/* Fill in the span.array.fog values from the interpolation values */ +static void +interpolate_fog(const GLcontext *ctx, struct sw_span *span) +{ + GLfloat *fog = span->array->fog; + const GLfloat fogStep = span->fogStep; + GLfloat fogCoord = span->fog; + const GLuint haveW = (span->interpMask & SPAN_W); + const GLfloat wStep = haveW ? span->dwdx : 0.0F; + GLfloat w = haveW ? span->w : 1.0F; + GLuint i; + for (i = 0; i < span->end; i++) { + fog[i] = fogCoord / w; + fogCoord += fogStep; + w += wStep; + } + span->arrayMask |= SPAN_FOG; +} + + +/* Fill in the span.zArray array from the interpolation values */ +void +_swrast_span_interpolate_z( const GLcontext *ctx, struct sw_span *span ) +{ + const GLuint n = span->end; + GLuint i; + + ASSERT((span->interpMask & SPAN_Z) && + !(span->arrayMask & SPAN_Z)); + + if (ctx->Visual.depthBits <= 16) { + GLfixed zval = span->z; + GLdepth *z = span->array->z; + for (i = 0; i < n; i++) { + z[i] = FixedToInt(zval); + zval += span->zStep; + } + } + else { + /* Deep Z buffer, no fixed->int shift */ + GLfixed zval = span->z; + GLdepth *z = span->array->z; + for (i = 0; i < n; i++) { + z[i] = zval; + zval += span->zStep; + } + } + span->interpMask &= ~SPAN_Z; + span->arrayMask |= SPAN_Z; +} + + +/* + * This the ideal solution, as given in the OpenGL spec. + */ +#if 0 +static GLfloat +compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, + GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH, + GLfloat s, GLfloat t, GLfloat q, GLfloat invQ) +{ + GLfloat dudx = texW * ((s + dsdx) / (q + dqdx) - s * invQ); + GLfloat dvdx = texH * ((t + dtdx) / (q + dqdx) - t * invQ); + GLfloat dudy = texW * ((s + dsdy) / (q + dqdy) - s * invQ); + GLfloat dvdy = texH * ((t + dtdy) / (q + dqdy) - t * invQ); + GLfloat x = SQRTF(dudx * dudx + dvdx * dvdx); + GLfloat y = SQRTF(dudy * dudy + dvdy * dvdy); + GLfloat rho = MAX2(x, y); + GLfloat lambda = LOG2(rho); + return lambda; +} +#endif + + +/* + * This is a faster approximation + */ +GLfloat +_swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, + GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH, + GLfloat s, GLfloat t, GLfloat q, GLfloat invQ) +{ + GLfloat dsdx2 = (s + dsdx) / (q + dqdx) - s * invQ; + GLfloat dtdx2 = (t + dtdx) / (q + dqdx) - t * invQ; + GLfloat dsdy2 = (s + dsdy) / (q + dqdy) - s * invQ; + GLfloat dtdy2 = (t + dtdy) / (q + dqdy) - t * invQ; + GLfloat maxU, maxV, rho, lambda; + dsdx2 = FABSF(dsdx2); + dsdy2 = FABSF(dsdy2); + dtdx2 = FABSF(dtdx2); + dtdy2 = FABSF(dtdy2); + maxU = MAX2(dsdx2, dsdy2) * texW; + maxV = MAX2(dtdx2, dtdy2) * texH; + rho = MAX2(maxU, maxV); + lambda = LOG2(rho); + return lambda; +} + + +/** + * Fill in the span.texcoords array from the interpolation values. + * Note: in the places where we divide by Q (or mult by invQ) we're + * really doing two things: perspective correction and texcoord + * projection. Remember, for texcoord (s,t,r,q) we need to index + * texels with (s/q, t/q, r/q). + * If we're using a fragment program, we never do the division + * for texcoord projection. That's done by the TXP instruction + * or user-written code. + */ +static void +interpolate_texcoords(GLcontext *ctx, struct sw_span *span) +{ + ASSERT(span->interpMask & SPAN_TEXTURE); + ASSERT(!(span->arrayMask & SPAN_TEXTURE)); + + if (ctx->Texture._EnabledCoordUnits > 1) { + /* multitexture */ + GLuint u; + span->arrayMask |= SPAN_TEXTURE; + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (ctx->Texture._EnabledCoordUnits & (1 << u)) { + const struct gl_texture_object *obj =ctx->Texture.Unit[u]._Current; + GLfloat texW, texH; + GLboolean needLambda; + if (obj) { + const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; + needLambda = (obj->MinFilter != obj->MagFilter) + || ctx->FragmentProgram._Active; + texW = img->WidthScale; + texH = img->HeightScale; + } + else { + /* using a fragment program */ + texW = 1.0; + texH = 1.0; + needLambda = GL_FALSE; + } + if (needLambda) { + GLfloat (*texcoord)[4] = span->array->texcoords[u]; + GLfloat *lambda = span->array->lambda[u]; + const GLfloat dsdx = span->texStepX[u][0]; + const GLfloat dsdy = span->texStepY[u][0]; + const GLfloat dtdx = span->texStepX[u][1]; + const GLfloat dtdy = span->texStepY[u][1]; + const GLfloat drdx = span->texStepX[u][2]; + const GLfloat dqdx = span->texStepX[u][3]; + const GLfloat dqdy = span->texStepY[u][3]; + GLfloat s = span->tex[u][0]; + GLfloat t = span->tex[u][1]; + GLfloat r = span->tex[u][2]; + GLfloat q = span->tex[u][3]; + GLuint i; + if (ctx->FragmentProgram._Active) { + /* do perspective correction but don't divide s, t, r by q */ + const GLfloat dwdx = span->dwdx; + GLfloat w = span->w; + for (i = 0; i < span->end; i++) { + const GLfloat invW = 1.0F / w; + texcoord[i][0] = s * invW; + texcoord[i][1] = t * invW; + texcoord[i][2] = r * invW; + texcoord[i][3] = q * invW; + lambda[i] = _swrast_compute_lambda(dsdx, dsdy, dtdx, dtdy, + dqdx, dqdy, texW, texH, + s, t, q, invW); + s += dsdx; + t += dtdx; + r += drdx; + q += dqdx; + w += dwdx; + } + + } + else { + for (i = 0; i < span->end; i++) { + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); + texcoord[i][0] = s * invQ; + texcoord[i][1] = t * invQ; + texcoord[i][2] = r * invQ; + texcoord[i][3] = q; + lambda[i] = _swrast_compute_lambda(dsdx, dsdy, dtdx, dtdy, + dqdx, dqdy, texW, texH, + s, t, q, invQ); + s += dsdx; + t += dtdx; + r += drdx; + q += dqdx; + } + } + span->arrayMask |= SPAN_LAMBDA; + } + else { + GLfloat (*texcoord)[4] = span->array->texcoords[u]; + GLfloat *lambda = span->array->lambda[u]; + const GLfloat dsdx = span->texStepX[u][0]; + const GLfloat dtdx = span->texStepX[u][1]; + const GLfloat drdx = span->texStepX[u][2]; + const GLfloat dqdx = span->texStepX[u][3]; + GLfloat s = span->tex[u][0]; + GLfloat t = span->tex[u][1]; + GLfloat r = span->tex[u][2]; + GLfloat q = span->tex[u][3]; + GLuint i; + if (ctx->FragmentProgram._Active) { + /* do perspective correction but don't divide s, t, r by q */ + const GLfloat dwdx = span->dwdx; + GLfloat w = span->w; + for (i = 0; i < span->end; i++) { + const GLfloat invW = 1.0F / w; + texcoord[i][0] = s * invW; + texcoord[i][1] = t * invW; + texcoord[i][2] = r * invW; + texcoord[i][3] = q * invW; + lambda[i] = 0.0; + s += dsdx; + t += dtdx; + r += drdx; + q += dqdx; + w += dwdx; + } + } + else if (dqdx == 0.0F) { + /* Ortho projection or polygon's parallel to window X axis */ + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); + for (i = 0; i < span->end; i++) { + texcoord[i][0] = s * invQ; + texcoord[i][1] = t * invQ; + texcoord[i][2] = r * invQ; + texcoord[i][3] = q; + lambda[i] = 0.0; + s += dsdx; + t += dtdx; + r += drdx; + } + } + else { + for (i = 0; i < span->end; i++) { + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); + texcoord[i][0] = s * invQ; + texcoord[i][1] = t * invQ; + texcoord[i][2] = r * invQ; + texcoord[i][3] = q; + lambda[i] = 0.0; + s += dsdx; + t += dtdx; + r += drdx; + q += dqdx; + } + } + } /* lambda */ + } /* if */ + } /* for */ + } + else { + /* single texture */ + const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; + GLfloat texW, texH; + GLboolean needLambda; + if (obj) { + const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; + needLambda = (obj->MinFilter != obj->MagFilter) + || ctx->FragmentProgram._Active; + texW = (GLfloat) img->WidthScale; + texH = (GLfloat) img->HeightScale; + } + else { + needLambda = GL_FALSE; + texW = texH = 1.0; + } + span->arrayMask |= SPAN_TEXTURE; + if (needLambda) { + /* just texture unit 0, with lambda */ + GLfloat (*texcoord)[4] = span->array->texcoords[0]; + GLfloat *lambda = span->array->lambda[0]; + const GLfloat dsdx = span->texStepX[0][0]; + const GLfloat dsdy = span->texStepY[0][0]; + const GLfloat dtdx = span->texStepX[0][1]; + const GLfloat dtdy = span->texStepY[0][1]; + const GLfloat drdx = span->texStepX[0][2]; + const GLfloat dqdx = span->texStepX[0][3]; + const GLfloat dqdy = span->texStepY[0][3]; + GLfloat s = span->tex[0][0]; + GLfloat t = span->tex[0][1]; + GLfloat r = span->tex[0][2]; + GLfloat q = span->tex[0][3]; + GLuint i; + if (ctx->FragmentProgram._Active) { + /* do perspective correction but don't divide s, t, r by q */ + const GLfloat dwdx = span->dwdx; + GLfloat w = span->w; + for (i = 0; i < span->end; i++) { + const GLfloat invW = 1.0F / w; + texcoord[i][0] = s * invW; + texcoord[i][1] = t * invW; + texcoord[i][2] = r * invW; + texcoord[i][3] = q * invW; + lambda[i] = _swrast_compute_lambda(dsdx, dsdy, dtdx, dtdy, + dqdx, dqdy, texW, texH, + s, t, q, invW); + s += dsdx; + t += dtdx; + r += drdx; + q += dqdx; + w += dwdx; + } + } + else { + /* tex.c */ + for (i = 0; i < span->end; i++) { + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); + lambda[i] = _swrast_compute_lambda(dsdx, dsdy, dtdx, dtdy, + dqdx, dqdy, texW, texH, + s, t, q, invQ); + texcoord[i][0] = s * invQ; + texcoord[i][1] = t * invQ; + texcoord[i][2] = r * invQ; + texcoord[i][3] = q; + s += dsdx; + t += dtdx; + r += drdx; + q += dqdx; + } + } + span->arrayMask |= SPAN_LAMBDA; + } + else { + /* just texture 0, without lambda */ + GLfloat (*texcoord)[4] = span->array->texcoords[0]; + const GLfloat dsdx = span->texStepX[0][0]; + const GLfloat dtdx = span->texStepX[0][1]; + const GLfloat drdx = span->texStepX[0][2]; + const GLfloat dqdx = span->texStepX[0][3]; + GLfloat s = span->tex[0][0]; + GLfloat t = span->tex[0][1]; + GLfloat r = span->tex[0][2]; + GLfloat q = span->tex[0][3]; + GLuint i; + if (ctx->FragmentProgram._Active) { + /* do perspective correction but don't divide s, t, r by q */ + const GLfloat dwdx = span->dwdx; + GLfloat w = span->w; + for (i = 0; i < span->end; i++) { + const GLfloat invW = 1.0F / w; + texcoord[i][0] = s * invW; + texcoord[i][1] = t * invW; + texcoord[i][2] = r * invW; + texcoord[i][3] = q * invW; + s += dsdx; + t += dtdx; + r += drdx; + q += dqdx; + w += dwdx; + } + } + else if (dqdx == 0.0F) { + /* Ortho projection or polygon's parallel to window X axis */ + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); + for (i = 0; i < span->end; i++) { + texcoord[i][0] = s * invQ; + texcoord[i][1] = t * invQ; + texcoord[i][2] = r * invQ; + texcoord[i][3] = q; + s += dsdx; + t += dtdx; + r += drdx; + } + } + else { + for (i = 0; i < span->end; i++) { + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); + texcoord[i][0] = s * invQ; + texcoord[i][1] = t * invQ; + texcoord[i][2] = r * invQ; + texcoord[i][3] = q; + s += dsdx; + t += dtdx; + r += drdx; + q += dqdx; + } + } + } + } +} + + +/** + * Apply the current polygon stipple pattern to a span of pixels. + */ +static void +stipple_polygon_span( GLcontext *ctx, struct sw_span *span ) +{ + const GLuint highbit = 0x80000000; + const GLuint stipple = ctx->PolygonStipple[span->y % 32]; + GLubyte *mask = span->array->mask; + GLuint i, m; + + ASSERT(ctx->Polygon.StippleFlag); + ASSERT((span->arrayMask & SPAN_XY) == 0); + + m = highbit >> (GLuint) (span->x % 32); + + for (i = 0; i < span->end; i++) { + if ((m & stipple) == 0) { + mask[i] = 0; + } + m = m >> 1; + if (m == 0) { + m = highbit; + } + } + span->writeAll = GL_FALSE; +} + + +/** + * Clip a pixel span to the current buffer/window boundaries: + * DrawBuffer->_Xmin, _Xmax, _Ymin, _Ymax. This will accomplish + * window clipping and scissoring. + * Return: GL_TRUE some pixels still visible + * GL_FALSE nothing visible + */ +static GLuint +clip_span( GLcontext *ctx, struct sw_span *span ) +{ + const GLint xmin = ctx->DrawBuffer->_Xmin; + const GLint xmax = ctx->DrawBuffer->_Xmax; + const GLint ymin = ctx->DrawBuffer->_Ymin; + const GLint ymax = ctx->DrawBuffer->_Ymax; + + if (span->arrayMask & SPAN_XY) { + /* arrays of x/y pixel coords */ + const GLint *x = span->array->x; + const GLint *y = span->array->y; + const GLint n = span->end; + GLubyte *mask = span->array->mask; + GLint i; + if (span->arrayMask & SPAN_MASK) { + /* note: using & intead of && to reduce branches */ + for (i = 0; i < n; i++) { + mask[i] &= (x[i] >= xmin) & (x[i] < xmax) + & (y[i] >= ymin) & (y[i] < ymax); + } + } + else { + /* note: using & intead of && to reduce branches */ + for (i = 0; i < n; i++) { + mask[i] = (x[i] >= xmin) & (x[i] < xmax) + & (y[i] >= ymin) & (y[i] < ymax); + } + } + return GL_TRUE; /* some pixels visible */ + } + else { + /* horizontal span of pixels */ + const GLint x = span->x; + const GLint y = span->y; + const GLint n = span->end; + + /* Trivial rejection tests */ + if (y < ymin || y >= ymax || x + n <= xmin || x >= xmax) { + span->end = 0; + return GL_FALSE; /* all pixels clipped */ + } + + /* Clip to the left */ + if (x < xmin) { + ASSERT(x + n > xmin); + span->writeAll = GL_FALSE; + _mesa_bzero(span->array->mask, (xmin - x) * sizeof(GLubyte)); + } + + /* Clip to right */ + if (x + n > xmax) { + ASSERT(x < xmax); + span->end = xmax - x; + } + + return GL_TRUE; /* some pixels visible */ + } +} + + +/** + * Apply all the per-fragment opertions to a span of color index fragments + * and write them to the enabled color drawbuffers. + * The 'span' parameter can be considered to be const. Note that + * span->interpMask and span->arrayMask may be changed but will be restored + * to their original values before returning. + */ +void +_swrast_write_index_span( GLcontext *ctx, struct sw_span *span) +{ + const SWcontext *swrast = SWRAST_CONTEXT(ctx); + const struct gl_framebuffer *fb = ctx->DrawBuffer; + const GLuint output = 0; + const GLuint origInterpMask = span->interpMask; + const GLuint origArrayMask = span->arrayMask; + GLuint buf; + + ASSERT(span->end <= MAX_WIDTH); + ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE || + span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); + ASSERT((span->interpMask | span->arrayMask) & SPAN_INDEX); + ASSERT((span->interpMask & span->arrayMask) == 0); + + if (span->arrayMask & SPAN_MASK) { + /* mask was initialized by caller, probably glBitmap */ + span->writeAll = GL_FALSE; + } + else { + _mesa_memset(span->array->mask, 1, span->end); + span->writeAll = GL_TRUE; + } + + /* Clipping */ + if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) { + if (!clip_span(ctx, span)) { + return; + } + } + + /* Depth bounds test */ + if (ctx->Depth.BoundsTest && ctx->Visual.depthBits > 0) { + if (!_swrast_depth_bounds_test(ctx, span)) { + return; + } + } + +#ifdef DEBUG + /* Make sure all fragments are within window bounds */ + if (span->arrayMask & SPAN_XY) { + GLuint i; + for (i = 0; i < span->end; i++) { + if (span->array->mask[i]) { + assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin); + assert(span->array->x[i] < ctx->DrawBuffer->_Xmax); + assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin); + assert(span->array->y[i] < ctx->DrawBuffer->_Ymax); + } + } + } +#endif + + /* Polygon Stippling */ + if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) { + stipple_polygon_span(ctx, span); + } + + /* Stencil and Z testing */ + if (ctx->Depth.Test || ctx->Stencil.Enabled) { + if (span->interpMask & SPAN_Z) + _swrast_span_interpolate_z(ctx, span); + + if (ctx->Stencil.Enabled) { + if (!_swrast_stencil_and_ztest_span(ctx, span)) { + span->arrayMask = origArrayMask; + return; + } + } + else { + ASSERT(ctx->Depth.Test); + if (!_swrast_depth_test_span(ctx, span)) { + span->interpMask = origInterpMask; + span->arrayMask = origArrayMask; + return; + } + } + } + + /* if we get here, something passed the depth test */ + if (ctx->Depth.OcclusionTest) { + ctx->OcclusionResult = GL_TRUE; + } + +#if FEATURE_ARB_occlusion_query + if (ctx->Occlusion.Active) { + /* update count of 'passed' fragments */ + GLuint i; + for (i = 0; i < span->end; i++) + ctx->Occlusion.PassedCounter += span->array->mask[i]; + } +#endif + + /* we have to wait until after occlusion to do this test */ + if (ctx->Color.DrawBuffer == GL_NONE || ctx->Color.IndexMask == 0) { + /* write no pixels */ + span->arrayMask = origArrayMask; + return; + } + + /* Interpolate the color indexes if needed */ + if (ctx->Fog.Enabled || + ctx->Color.IndexLogicOpEnabled || + ctx->Color.IndexMask != 0xffffffff || + (span->arrayMask & SPAN_COVERAGE)) { + if (span->interpMask & SPAN_INDEX) { + interpolate_indexes(ctx, span); + } + } + + /* Fog */ + if (ctx->Fog.Enabled) { + _swrast_fog_ci_span(ctx, span); + } + + /* Antialias coverage application */ + if (span->arrayMask & SPAN_COVERAGE) { + const GLfloat *coverage = span->array->coverage; + GLuint *index = span->array->index; + GLuint i; + for (i = 0; i < span->end; i++) { + ASSERT(coverage[i] < 16); + index[i] = (index[i] & ~0xf) | ((GLuint) coverage[i]); + } + } + + /* Loop over drawing buffers */ + for (buf = 0; buf < fb->_NumColorDrawBuffers[output]; buf++) { + struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[output][buf]; + GLuint indexTemp[MAX_WIDTH], *index32; + + ASSERT(rb->_BaseFormat == GL_COLOR_INDEX); + + if (ctx->Color.IndexLogicOpEnabled || + ctx->Color.IndexMask != 0xffffffff) { + /* make copy of incoming indexes */ + MEMCPY(indexTemp, span->array->index, span->end * sizeof(GLuint)); + + if (ctx->Color.IndexLogicOpEnabled) { + _swrast_logicop_ci_span(ctx, rb, span, indexTemp); + } + + if (ctx->Color.IndexMask != 0xffffffff) { + _swrast_mask_ci_span(ctx, rb, span, indexTemp); + } + index32 = indexTemp; + } + else { + index32 = span->array->index; + } + + if ((span->interpMask & SPAN_INDEX) && span->indexStep == 0) { + /* all fragments have same color index */ + GLubyte index8; + GLushort index16; + GLuint index32; + void *value; + + if (rb->DataType == GL_UNSIGNED_BYTE) { + index8 = FixedToInt(span->index); + value = &index8; + } + else if (rb->DataType == GL_UNSIGNED_SHORT) { + index16 = FixedToInt(span->index); + value = &index16; + } + else { + ASSERT(rb->DataType == GL_UNSIGNED_INT); + index32 = FixedToInt(span->index); + value = &index32; + } + + if (span->arrayMask & SPAN_XY) { + rb->PutMonoValues(ctx, rb, span->end, span->array->x, + span->array->y, value, span->array->mask); + } + else { + rb->PutMonoRow(ctx, rb, span->end, span->x, span->y, + value, span->array->mask); + } + } + else { + /* each fragment is a different color */ + GLubyte index8[MAX_WIDTH]; + GLushort index16[MAX_WIDTH]; + void *values; + + if (rb->DataType == GL_UNSIGNED_BYTE) { + GLuint k; + for (k = 0; k < span->end; k++) { + index8[k] = (GLubyte) index32[k]; + } + values = index8; + } + else if (rb->DataType == GL_UNSIGNED_SHORT) { + GLuint k; + for (k = 0; k < span->end; k++) { + index16[k] = (GLushort) index32[k]; + } + values = index16; + } + else { + ASSERT(rb->DataType == GL_UNSIGNED_INT); + values = index32; + } + + if (span->arrayMask & SPAN_XY) { + rb->PutValues(ctx, rb, span->end, span->array->x, span->array->y, + values, span->array->mask); + } + else { + rb->PutRow(ctx, rb, span->end, span->x, span->y, + values, span->array->mask); + } + } + } + +#if OLD_RENDERBUFFER + /* restore default dest buffer */ + _swrast_use_draw_buffer(ctx); +#endif + + span->interpMask = origInterpMask; + span->arrayMask = origArrayMask; +} + + +/** + * Add specular color to base color. This is used only when + * GL_LIGHT_MODEL_COLOR_CONTROL = GL_SEPARATE_SPECULAR_COLOR. + */ +static void +add_colors(GLuint n, GLchan rgba[][4], GLchan specular[][4] ) +{ + GLuint i; + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + /* no clamping */ + rgba[i][RCOMP] += specular[i][RCOMP]; + rgba[i][GCOMP] += specular[i][GCOMP]; + rgba[i][BCOMP] += specular[i][BCOMP]; +#else + GLint r = rgba[i][RCOMP] + specular[i][RCOMP]; + GLint g = rgba[i][GCOMP] + specular[i][GCOMP]; + GLint b = rgba[i][BCOMP] + specular[i][BCOMP]; + rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); + rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); + rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); +#endif + } +} + + +/** + * XXX merge this code into the _swrast_write_rgba_span() routine! + * + * Draw to more than one RGBA color buffer (or none). + * All fragment operations, up to (but not) blending/logicop should + * have been done first. + */ +static void +multi_write_rgba_span( GLcontext *ctx, struct sw_span *span ) +{ +#if OLD_RENDERBUFFER + SWcontext *swrast = SWRAST_CONTEXT(ctx); +#endif + const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); + struct gl_framebuffer *fb = ctx->DrawBuffer; + const GLuint output = 0; + GLuint i; + + ASSERT(span->end < MAX_WIDTH); + ASSERT(colorMask != 0x0); + + for (i = 0; i < fb->_NumColorDrawBuffers[output]; i++) { + struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[output][i]; + GLchan rgbaTmp[MAX_WIDTH][4]; + +#if OLD_RENDERBUFFER + /* obsolete code */ + GLuint bufferBit = fb->_ColorDrawBit[output][i]; + /* Set the current read/draw buffer */ + swrast->CurrentBufferBit = bufferBit; + if (swrast->Driver.SetBuffer) + (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit); +#endif + + /* make copy of incoming colors */ + MEMCPY( rgbaTmp, span->array->rgba, 4 * span->end * sizeof(GLchan) ); + + if (ctx->Color._LogicOpEnabled) { + _swrast_logicop_rgba_span(ctx, rb, span, rgbaTmp); + } + else if (ctx->Color.BlendEnabled) { + _swrast_blend_span(ctx, rb, span, rgbaTmp); + } + + if (colorMask != 0xffffffff) { + _swrast_mask_rgba_span(ctx, rb, span, rgbaTmp); + } + + if (span->arrayMask & SPAN_XY) { + /* array of pixel coords */ + ASSERT(rb->PutValues); + rb->PutValues(ctx, rb, span->end, span->array->x, + span->array->y, rgbaTmp, span->array->mask); + } + else { + /* horizontal run of pixels */ + ASSERT(rb->PutRow); + rb->PutRow(ctx, rb, span->end, span->x, span->y, rgbaTmp, + span->array->mask); + } + } + +#if OLD_RENDERBUFFER + /* restore default dest buffer */ + _swrast_use_draw_buffer(ctx); +#endif +} + + +/** + * Apply all the per-fragment operations to a span. + * This now includes texturing (_swrast_write_texture_span() is history). + * This function may modify any of the array values in the span. + * span->interpMask and span->arrayMask may be changed but will be restored + * to their original values before returning. + */ +void +_swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span) +{ + const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); + SWcontext *swrast = SWRAST_CONTEXT(ctx); + const GLuint origInterpMask = span->interpMask; + const GLuint origArrayMask = span->arrayMask; + const GLboolean deferredTexture = !(ctx->Color.AlphaEnabled || + ctx->FragmentProgram._Active || + ctx->ATIFragmentShader._Enabled); + + ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE || + span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); + ASSERT(span->end <= MAX_WIDTH); + ASSERT((span->interpMask & span->arrayMask) == 0); + + /* + printf("%s() interp 0x%x array 0x%x\n", __FUNCTION__, + span->interpMask, span->arrayMask); + */ + + if (span->arrayMask & SPAN_MASK) { + /* mask was initialized by caller, probably glBitmap */ + span->writeAll = GL_FALSE; + } + else { + _mesa_memset(span->array->mask, 1, span->end); + span->writeAll = GL_TRUE; + } + + /* Clip to window/scissor box */ + if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) { + if (!clip_span(ctx, span)) { + return; + } + } + +#ifdef DEBUG + /* Make sure all fragments are within window bounds */ + if (span->arrayMask & SPAN_XY) { + GLuint i; + for (i = 0; i < span->end; i++) { + if (span->array->mask[i]) { + assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin); + assert(span->array->x[i] < ctx->DrawBuffer->_Xmax); + assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin); + assert(span->array->y[i] < ctx->DrawBuffer->_Ymax); + } + } + } +#endif + + /* Polygon Stippling */ + if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) { + stipple_polygon_span(ctx, span); + } + + /* Interpolate texcoords? */ + if (ctx->Texture._EnabledCoordUnits + && (span->interpMask & SPAN_TEXTURE) + && (span->arrayMask & SPAN_TEXTURE) == 0) { + interpolate_texcoords(ctx, span); + } + + /* This is the normal place to compute the resulting fragment color/Z. + * As an optimization, we try to defer this until after Z/stencil + * testing in order to try to avoid computing colors that we won't + * actually need. + */ + if (!deferredTexture) { + /* Now we need the rgba array, fill it in if needed */ + if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0) + interpolate_colors(ctx, span); + + if (span->interpMask & SPAN_SPEC) + interpolate_specular(ctx, span); + + if (span->interpMask & SPAN_FOG) + interpolate_fog(ctx, span); + + /* Compute fragment colors with fragment program or texture lookups */ + if (ctx->FragmentProgram._Active) { + /* frag prog may need Z values */ + if (span->interpMask & SPAN_Z) + _swrast_span_interpolate_z(ctx, span); + _swrast_exec_fragment_program( ctx, span ); + } + else if (ctx->ATIFragmentShader._Enabled) + _swrast_exec_fragment_shader( ctx, span ); + else if (ctx->Texture._EnabledUnits && (span->arrayMask & SPAN_TEXTURE)) + _swrast_texture_span( ctx, span ); + + /* Do the alpha test */ + if (!_swrast_alpha_test(ctx, span)) { + span->arrayMask = origArrayMask; + return; + } + } + + /* Stencil and Z testing */ + if (ctx->Stencil.Enabled || ctx->Depth.Test) { + if (span->interpMask & SPAN_Z) + _swrast_span_interpolate_z(ctx, span); + + if (ctx->Stencil.Enabled && ctx->DrawBuffer->Visual.stencilBits > 0) { + /* Combined Z/stencil tests */ + if (!_swrast_stencil_and_ztest_span(ctx, span)) { + span->interpMask = origInterpMask; + span->arrayMask = origArrayMask; + return; + } + } + else if (ctx->DrawBuffer->Visual.depthBits > 0) { + /* Just regular depth testing */ + ASSERT(ctx->Depth.Test); + ASSERT(span->arrayMask & SPAN_Z); + if (!_swrast_depth_test_span(ctx, span)) { + span->interpMask = origInterpMask; + span->arrayMask = origArrayMask; + return; + } + } + } + + /* if we get here, some fragments passed the depth test */ + if (ctx->Depth.OcclusionTest) { + ctx->OcclusionResult = GL_TRUE; + } + +#if FEATURE_ARB_occlusion_query + if (ctx->Occlusion.Active) { + /* update count of 'passed' fragments */ + GLuint i; + for (i = 0; i < span->end; i++) + ctx->Occlusion.PassedCounter += span->array->mask[i]; + } +#endif + + /* We had to wait until now to check for glColorMask(0,0,0,0) because of + * the occlusion test. + */ + if (colorMask == 0x0) { + span->interpMask = origInterpMask; + span->arrayMask = origArrayMask; + return; + } + + /* If we were able to defer fragment color computation to now, there's + * a good chance that many fragments will have already been killed by + * Z/stencil testing. + */ + if (deferredTexture) { + /* Now we need the rgba array, fill it in if needed */ + if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0) + interpolate_colors(ctx, span); + + if (span->interpMask & SPAN_SPEC) + interpolate_specular(ctx, span); + + if (span->interpMask & SPAN_FOG) + interpolate_fog(ctx, span); + + if (ctx->FragmentProgram._Active) + _swrast_exec_fragment_program( ctx, span ); + else if (ctx->ATIFragmentShader._Enabled) + _swrast_exec_fragment_shader( ctx, span ); + else if (ctx->Texture._EnabledUnits && (span->arrayMask & SPAN_TEXTURE)) + _swrast_texture_span( ctx, span ); + } + + ASSERT(span->arrayMask & SPAN_RGBA); + + if (!ctx->FragmentProgram._Enabled) { + /* Add base and specular colors */ + if (ctx->Fog.ColorSumEnabled || + (ctx->Light.Enabled && + ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) { + if (span->interpMask & SPAN_SPEC) { + interpolate_specular(ctx, span); + } + if (span->arrayMask & SPAN_SPEC) { + add_colors( span->end, span->array->rgba, span->array->spec ); + } + else { + /* We probably added the base/specular colors during the + * vertex stage! + */ + } + } + } + + /* Fog */ + if (swrast->_FogEnabled) { + _swrast_fog_rgba_span(ctx, span); + } + + /* Antialias coverage application */ + if (span->arrayMask & SPAN_COVERAGE) { + GLchan (*rgba)[4] = span->array->rgba; + GLfloat *coverage = span->array->coverage; + GLuint i; + for (i = 0; i < span->end; i++) { + rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]); + } + } + + if (swrast->_RasterMask & MULTI_DRAW_BIT) { + /* need to do blend/logicop separately for each color buffer */ + multi_write_rgba_span(ctx, span); + } + else { + /* normal: write to exactly one buffer */ + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; + + if (ctx->Color._LogicOpEnabled) { + _swrast_logicop_rgba_span(ctx, rb, span, span->array->rgba); + } + else if (ctx->Color.BlendEnabled) { + _swrast_blend_span(ctx, rb, span, span->array->rgba); + } + + /* Color component masking */ + if (colorMask != 0xffffffff) { + _swrast_mask_rgba_span(ctx, rb, span, span->array->rgba); + } + + /* Finally, write the pixels to a color buffer */ + if (span->arrayMask & SPAN_XY) { + /* array of pixel coords */ + ASSERT(rb->PutValues); + ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA); + /* XXX check datatype */ + rb->PutValues(ctx, rb, span->end, span->array->x, span->array->y, + span->array->rgba, span->array->mask); + } + else { + /* horizontal run of pixels */ + ASSERT(rb->PutRow); + ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA); + /* XXX check datatype */ + rb->PutRow(ctx, rb, span->end, span->x, span->y, span->array->rgba, + span->writeAll ? NULL : span->array->mask); + } + } + + span->interpMask = origInterpMask; + span->arrayMask = origArrayMask; +} + + + +/** + * Read RGBA pixels from frame buffer. Clipping will be done to prevent + * reading ouside the buffer's boundaries. + */ +void +_swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, GLchan rgba[][4] ) +{ + const GLint bufWidth = (GLint) rb->Width; + const GLint bufHeight = (GLint) rb->Height; + + if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) { + /* completely above, below, or right */ + /* XXX maybe leave rgba values undefined? */ + _mesa_bzero(rgba, 4 * n * sizeof(GLchan)); + } + else { + GLint skip, length; + if (x < 0) { + /* left edge clipping */ + skip = -x; + length = (GLint) n - skip; + if (length < 0) { + /* completely left of window */ + return; + } + if (length > bufWidth) { + length = bufWidth; + } + } + else if ((GLint) (x + n) > bufWidth) { + /* right edge clipping */ + skip = 0; + length = bufWidth - x; + if (length < 0) { + /* completely to right of window */ + return; + } + } + else { + /* no clipping */ + skip = 0; + length = (GLint) n; + } + + ASSERT(rb); + ASSERT(rb->GetRow); + ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA); + ASSERT(rb->DataType == GL_UNSIGNED_BYTE); + rb->GetRow(ctx, rb, length, x + skip, y, rgba + skip); + } +} + + +/** + * Read CI pixels from frame buffer. Clipping will be done to prevent + * reading ouside the buffer's boundaries. + */ +void +_swrast_read_index_span( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, GLuint index[] ) +{ + const GLint bufWidth = (GLint) rb->Width; + const GLint bufHeight = (GLint) rb->Height; + + if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) { + /* completely above, below, or right */ + _mesa_bzero(index, n * sizeof(GLuint)); + } + else { + GLint skip, length; + if (x < 0) { + /* left edge clipping */ + skip = -x; + length = (GLint) n - skip; + if (length < 0) { + /* completely left of window */ + return; + } + if (length > bufWidth) { + length = bufWidth; + } + } + else if ((GLint) (x + n) > bufWidth) { + /* right edge clipping */ + skip = 0; + length = bufWidth - x; + if (length < 0) { + /* completely to right of window */ + return; + } + } + else { + /* no clipping */ + skip = 0; + length = (GLint) n; + } + + ASSERT(rb->GetRow); + ASSERT(rb->_BaseFormat == GL_COLOR_INDEX); + + if (rb->DataType == GL_UNSIGNED_BYTE) { + GLubyte index8[MAX_WIDTH]; + GLint i; + rb->GetRow(ctx, rb, length, x + skip, y, index8); + for (i = 0; i < length; i++) + index[skip + i] = index8[i]; + } + else if (rb->DataType == GL_UNSIGNED_SHORT) { + GLushort index16[MAX_WIDTH]; + GLint i; + rb->GetRow(ctx, rb, length, x + skip, y, index16); + for (i = 0; i < length; i++) + index[skip + i] = index16[i]; + } + else if (rb->DataType == GL_UNSIGNED_INT) { + rb->GetRow(ctx, rb, length, x + skip, y, index + skip); + } + } +} + + +/** + * Wrapper for gl_renderbuffer::GetValues() which does clipping to avoid + * reading values outside the buffer bounds. + * We can use this for reading any format/type of renderbuffer. + * \param valueSize is the size in bytes of each value put into the + * values array. + */ +void +_swrast_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, const GLint x[], const GLint y[], + void *values, GLuint valueSize) +{ + GLuint i, inCount = 0, inStart = 0; + + for (i = 0; i < count; i++) { + if (x[i] >= 0 && y[i] >= 0 && x[i] < rb->Width && y[i] < rb->Height) { + /* inside */ + if (inCount == 0) + inStart = i; + inCount++; + } + else { + if (inCount > 0) { + /* read [inStart, inStart + inCount) */ + rb->GetValues(ctx, rb, inCount, x + inStart, y + inStart, + (GLubyte *) values + inStart * valueSize); + inCount = 0; + } + } + } + if (inCount > 0) { + /* read last values */ + rb->GetValues(ctx, rb, inCount, x + inStart, y + inStart, + (GLubyte *) values + inStart * valueSize); + } +} diff --git a/reactos/dll/mesa32/src/swrast/s_span.h b/reactos/dll/mesa32/src/swrast/s_span.h new file mode 100644 index 00000000000..1bba5aa53b3 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_span.h @@ -0,0 +1,75 @@ +/* + * 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 S_SPAN_H +#define S_SPAN_H + + +#include "mtypes.h" +#include "swrast.h" + + +extern void +_swrast_span_default_z( GLcontext *ctx, struct sw_span *span ); + +extern void +_swrast_span_interpolate_z( const GLcontext *ctx, struct sw_span *span ); + +extern void +_swrast_span_default_fog( GLcontext *ctx, struct sw_span *span ); + +extern void +_swrast_span_default_color( GLcontext *ctx, struct sw_span *span ); + +extern void +_swrast_span_default_texcoords( GLcontext *ctx, struct sw_span *span ); + +extern GLfloat +_swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, + GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH, + GLfloat s, GLfloat t, GLfloat q, GLfloat invQ); + +extern void +_swrast_write_index_span( GLcontext *ctx, struct sw_span *span); + + +extern void +_swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span); + + +extern void +_swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, GLchan rgba[][4] ); + +extern void +_swrast_read_index_span( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, GLuint indx[] ); + +extern void +_swrast_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, const GLint x[], const GLint y[], + void *values, GLuint valueSize); + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_spantemp.h b/reactos/dll/mesa32/src/swrast/s_spantemp.h new file mode 100644 index 00000000000..4ccf031cb26 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_spantemp.h @@ -0,0 +1,251 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +/* + * Templates for the span/pixel-array write/read functions called via + * the gl_renderbuffer's GetRow, GetValues, PutRow, PutMonoRow, PutValues + * and PutMonoValues functions. + * + * Define the following macros before including this file: + * NAME(PREFIX) to generate the function name + * FORMAT must be either GL_RGBA, GL_RGBA8 or GL_COLOR_INDEX8_EXT + * SPAN_VARS to declare any local variables + * INIT_PIXEL_PTR(P, X, Y) to initialize a pointer to a pixel + * INC_PIXEL_PTR(P) to increment a pixel pointer by one pixel + * STORE_PIXEL(DST, X, Y, VALUE) to store pixel values in buffer + * FETCH_PIXEL(DST, SRC) to fetch pixel values from buffer + * + * Note that in the STORE_PIXEL macros, we also pass in the (X,Y) coordinates + * for the pixels to be stored. This is useful when dithering and probably + * ignored otherwise. + */ + +#include "macros.h" + + +static void +NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, GLint x, GLint y, void *values ) +{ +#ifdef SPAN_VARS + SPAN_VARS +#endif +#if FORMAT == GL_RGBA + GLchan (*dest)[4] = (GLchan (*)[4]) values; +#elif FORMAT == GL_RGBA8 + GLubyte (*dest)[4] = (GLubyte (*)[4]) values; +#elif FORMAT == GL_COLOR_INDEX8_EXT + GLubyte *dest = (GLubyte *) values; +#else +#error FORMAT must be set!!!! +#endif + GLuint i; + INIT_PIXEL_PTR(pixel, x, y); + for (i = 0; i < count; i++) { + FETCH_PIXEL(dest[i], pixel); + INC_PIXEL_PTR(pixel); + } +} + +static void +NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, const GLint x[], const GLint y[], void *values ) +{ +#ifdef SPAN_VARS + SPAN_VARS +#endif +#if FORMAT == GL_RGBA + GLchan (*dest)[4] = (GLchan (*)[4]) values; +#elif FORMAT == GL_RGBA8 + GLubyte (*dest)[4] = (GLubyte (*)[4]) values; +#elif FORMAT == GL_COLOR_INDEX8_EXT + GLubyte *dest = (GLubyte *) values; +#endif + GLuint i; + for (i = 0; i < count; i++) { + INIT_PIXEL_PTR(pixel, x[i], y[i]); + FETCH_PIXEL(dest[i], pixel); + } +} + + +static void +NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, GLint x, GLint y, + const void *values, const GLubyte mask[] ) +{ +#ifdef SPAN_VARS + SPAN_VARS +#endif +#if FORMAT == GL_RGBA + const GLchan (*src)[4] = (const GLchan (*)[4]) values; +#elif FORMAT == GL_RGBA8 + const GLubyte (*src)[4] = (const GLubyte (*)[4]) values; +#elif FORMAT == GL_COLOR_INDEX8_EXT + const GLubyte (*src)[1] = (const GLubyte (*)[1]) values; +#endif + GLuint i; + INIT_PIXEL_PTR(pixel, x, y); + if (mask) { + for (i = 0; i < count; i++) { + if (mask[i]) { + STORE_PIXEL(pixel, x + i, y, src[i]); + } + INC_PIXEL_PTR(pixel); + } + } + else { + for (i = 0; i < count; i++) { + STORE_PIXEL(pixel, x + i, y, src[i]); + INC_PIXEL_PTR(pixel); + } + } +} + +#if (FORMAT == GL_RGBA) || (FORMAT == GL_RGBA8) +static void +NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, GLint x, GLint y, + const void *values, const GLubyte mask[] ) +{ +#ifdef SPAN_VARS + SPAN_VARS +#endif +#if FORMAT == GL_RGBA + const GLchan (*src)[3] = (const GLchan (*)[3]) values; +#elif FORMAT == GL_RGBA8 + const GLubyte (*src)[3] = (const GLubyte (*)[3]) values; +#else +#error bad format +#endif + GLuint i; + INIT_PIXEL_PTR(pixel, x, y); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { +#ifdef STORE_PIXEL_RGB + STORE_PIXEL_RGB(pixel, x + i, y, src[i]); +#else + STORE_PIXEL(pixel, x + i, y, src[i]); +#endif + } + INC_PIXEL_PTR(pixel); + } +} +#endif + +static void +NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, GLint x, GLint y, + const void *value, const GLubyte mask[] ) +{ +#ifdef SPAN_VARS + SPAN_VARS +#endif +#if FORMAT == GL_RGBA + const GLchan *src = (const GLchan *) value; +#elif FORMAT == GL_RGBA8 + const GLubyte *src = (const GLubyte *) value; +#elif FORMAT == GL_COLOR_INDEX8_EXT + const GLubyte *src = (const GLubyte *) value; +#endif + GLuint i; + INIT_PIXEL_PTR(pixel, x, y); + if (mask) { + for (i = 0; i < count; i++) { + if (mask[i]) { + STORE_PIXEL(pixel, x + i, y, src); + } + INC_PIXEL_PTR(pixel); + } + } + else { + for (i = 0; i < count; i++) { + STORE_PIXEL(pixel, x + i, y, src); + INC_PIXEL_PTR(pixel); + } + } +} + + +static void +NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, const GLint x[], const GLint y[], + const void *values, const GLubyte mask[] ) +{ +#ifdef SPAN_VARS + SPAN_VARS +#endif +#if FORMAT == GL_RGBA + const GLchan (*src)[4] = (const GLchan (*)[4]) values; +#elif FORMAT == GL_RGBA8 + const GLubyte (*src)[4] = (const GLubyte (*)[4]) values; +#elif FORMAT == GL_COLOR_INDEX8_EXT + const GLubyte (*src)[1] = (const GLubyte (*)[1]) values; +#endif + GLuint i; + ASSERT(mask); + for (i = 0; i < count; i++) { + if (mask[i]) { + INIT_PIXEL_PTR(pixel, x[i], y[i]); + STORE_PIXEL(pixel, x[i], y[i], src[i]); + } + } +} + + +static void +NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, const GLint x[], const GLint y[], + const void *value, const GLubyte mask[] ) +{ +#ifdef SPAN_VARS + SPAN_VARS +#endif +#if FORMAT == GL_RGBA + const GLchan *src = (const GLchan *) value; +#elif FORMAT == GL_RGBA8 + const GLubyte *src = (const GLubyte *) value; +#elif FORMAT == GL_COLOR_INDEX8_EXT + const GLubyte *src = (const GLubyte *) value; +#endif + GLuint i; + ASSERT(mask); + for (i = 0; i < count; i++) { + if (mask[i]) { + INIT_PIXEL_PTR(pixel, x[i], y[i]); + STORE_PIXEL(pixel, x[i], y[i], src); + } + } +} + + +#undef NAME +#undef SPAN_VARS +#undef INIT_PIXEL_PTR +#undef INC_PIXEL_PTR +#undef STORE_PIXEL +#undef STORE_PIXEL_RGB +#undef FETCH_PIXEL +#undef FORMAT diff --git a/reactos/dll/mesa32/src/swrast/s_stencil.c b/reactos/dll/mesa32/src/swrast/s_stencil.c new file mode 100644 index 00000000000..ea4d844b1ea --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_stencil.c @@ -0,0 +1,1217 @@ +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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. + */ + + +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "imports.h" +#include "fbobject.h" + +#include "s_context.h" +#include "s_depth.h" +#include "s_stencil.h" +#include "s_span.h" + + + +/* Stencil Logic: + +IF stencil test fails THEN + Apply fail-op to stencil value + Don't write the pixel (RGBA,Z) +ELSE + IF doing depth test && depth test fails THEN + Apply zfail-op to stencil value + Write RGBA and Z to appropriate buffers + ELSE + Apply zpass-op to stencil value +ENDIF + +*/ + + +/** + * Apply the given stencil operator to the array of stencil values. + * Don't touch stencil[i] if mask[i] is zero. + * Input: n - size of stencil array + * oper - the stencil buffer operator + * face - 0 or 1 for front or back face operation + * stencil - array of stencil values + * mask - array [n] of flag: 1=apply operator, 0=don't apply operator + * Output: stencil - modified values + */ +static void +apply_stencil_op( const GLcontext *ctx, GLenum oper, GLuint face, + GLuint n, GLstencil stencil[], const GLubyte mask[] ) +{ + const GLstencil ref = ctx->Stencil.Ref[face]; + const GLstencil wrtmask = ctx->Stencil.WriteMask[face]; + const GLstencil invmask = (GLstencil) (~wrtmask); + GLuint i; + + switch (oper) { + case GL_KEEP: + /* do nothing */ + break; + case GL_ZERO: + if (invmask==0) { + for (i=0;i0) { + stencil[i] = (GLstencil) (s-1); + } + } + } + } + else { + for (i=0;i0) { + stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s-1))); + } + } + } + } + break; + case GL_INCR_WRAP_EXT: + if (invmask==0) { + for (i=0;iStencil.ValueMask[face]; + + ASSERT(n <= MAX_WIDTH); + + /* + * Perform stencil test. The results of this operation are stored + * in the fail[] array: + * IF fail[i] is non-zero THEN + * the stencil fail operator is to be applied + * ELSE + * the stencil fail operator is not to be applied + * ENDIF + */ + switch (ctx->Stencil.Function[face]) { + case GL_NEVER: + /* never pass; always fail */ + for (i=0;iStencil.Ref[face] & valueMask); + for (i=0;iStencil.Ref[face] & valueMask); + for (i=0;iStencil.Ref[face] & valueMask); + for (i=0;i s) { + /* passed */ + fail[i] = 0; + } + else { + fail[i] = 1; + mask[i] = 0; + } + } + else { + fail[i] = 0; + } + } + break; + case GL_GEQUAL: + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); + for (i=0;i= s) { + /* passed */ + fail[i] = 0; + } + else { + fail[i] = 1; + mask[i] = 0; + } + } + else { + fail[i] = 0; + } + } + break; + case GL_EQUAL: + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); + for (i=0;iStencil.Ref[face] & valueMask); + for (i=0;iStencil.FailFunc[face] != GL_KEEP) { + apply_stencil_op( ctx, ctx->Stencil.FailFunc[face], face, n, stencil, fail ); + } + + return !allfail; +} + + + +/** + * Apply stencil and depth testing to the span of pixels. + * Both software and hardware stencil buffers are acceptable. + * Input: n - number of pixels in the span + * x, y - location of leftmost pixel in span + * z - array [n] of z values + * mask - array [n] of flags (1=test this pixel, 0=skip the pixel) + * Output: mask - array [n] of flags (1=stencil and depth test passed) + * Return: GL_FALSE - all fragments failed the testing + * GL_TRUE - one or more fragments passed the testing + * + */ +static GLboolean +stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span, GLuint face) +{ + struct gl_framebuffer *fb = ctx->DrawBuffer; + struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer; + GLstencil stencilRow[MAX_WIDTH]; + GLstencil *stencil; + const GLuint n = span->end; + const GLint x = span->x; + const GLint y = span->y; + GLubyte *mask = span->array->mask; + + ASSERT((span->arrayMask & SPAN_XY) == 0); + ASSERT(ctx->Stencil.Enabled); + ASSERT(n <= MAX_WIDTH); +#ifdef DEBUG + if (ctx->Depth.Test) { + ASSERT(span->arrayMask & SPAN_Z); + } +#endif + + stencil = rb->GetPointer(ctx, rb, x, y); + if (!stencil) { + rb->GetRow(ctx, rb, n, x, y, stencilRow); + stencil = stencilRow; + } + + /* + * Apply the stencil test to the fragments. + * failMask[i] is 1 if the stencil test failed. + */ + if (do_stencil_test( ctx, face, n, stencil, mask ) == GL_FALSE) { + /* all fragments failed the stencil test, we're done. */ + span->writeAll = GL_FALSE; + return GL_FALSE; + } + + /* + * Some fragments passed the stencil test, apply depth test to them + * and apply Zpass and Zfail stencil ops. + */ + if (ctx->Depth.Test == GL_FALSE) { + /* + * No depth buffer, just apply zpass stencil function to active pixels. + */ + apply_stencil_op( ctx, ctx->Stencil.ZPassFunc[face], face, n, stencil, mask ); + } + else { + /* + * Perform depth buffering, then apply zpass or zfail stencil function. + */ + GLubyte passmask[MAX_WIDTH], failmask[MAX_WIDTH], oldmask[MAX_WIDTH]; + GLuint i; + + /* save the current mask bits */ + _mesa_memcpy(oldmask, mask, n * sizeof(GLubyte)); + + /* apply the depth test */ + _swrast_depth_test_span(ctx, span); + + /* Set the stencil pass/fail flags according to result of depth testing. + * if oldmask[i] == 0 then + * Don't touch the stencil value + * else if oldmask[i] and newmask[i] then + * Depth test passed + * else + * assert(oldmask[i] && !newmask[i]) + * Depth test failed + * endif + */ + for (i=0;iStencil.ZFailFunc[face] != GL_KEEP) { + apply_stencil_op( ctx, ctx->Stencil.ZFailFunc[face], face, + n, stencil, failmask ); + } + if (ctx->Stencil.ZPassFunc[face] != GL_KEEP) { + apply_stencil_op( ctx, ctx->Stencil.ZPassFunc[face], face, + n, stencil, passmask ); + } + } + + /* + * Write updated stencil values back into hardware stencil buffer. + */ + if (!rb->GetPointer(ctx, rb, 0, 0)) { + rb->PutRow(ctx, rb, n, x, y, stencil, mask); + } + + span->writeAll = GL_FALSE; + + return GL_TRUE; /* one or more fragments passed both tests */ +} + + + +/* + * Return the address of a stencil buffer value given the window coords: + */ +#define STENCIL_ADDRESS(X, Y) (stencilStart + (Y) * stride + (X)) + + + +/** + * Apply the given stencil operator for each pixel in the array whose + * mask flag is set. + * \note This is for software stencil buffers only. + * Input: n - number of pixels in the span + * x, y - array of [n] pixels + * operator - the stencil buffer operator + * mask - array [n] of flag: 1=apply operator, 0=don't apply operator + */ +static void +apply_stencil_op_to_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLenum oper, GLuint face, const GLubyte mask[] ) +{ + struct gl_framebuffer *fb = ctx->DrawBuffer; + struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer; + const GLstencil ref = ctx->Stencil.Ref[face]; + const GLstencil wrtmask = ctx->Stencil.WriteMask[face]; + const GLstencil invmask = (GLstencil) (~wrtmask); + GLuint i; + GLstencil *stencilStart = (GLubyte *) rb->Data; + const GLuint stride = rb->Width; + + ASSERT(rb->GetPointer(ctx, rb, 0, 0)); + ASSERT(sizeof(GLstencil) == 1); + + switch (oper) { + case GL_KEEP: + /* do nothing */ + break; + case GL_ZERO: + if (invmask==0) { + for (i=0;i0) { + *sptr = (GLstencil) (*sptr - 1); + } + } + } + } + else { + for (i=0;i0) { + *sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr-1))); + } + } + } + } + break; + case GL_INCR_WRAP_EXT: + if (invmask==0) { + for (i=0;iDrawBuffer; + struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer; + GLubyte fail[MAX_WIDTH]; + GLstencil r, s; + GLuint i; + GLboolean allfail = GL_FALSE; + const GLuint valueMask = ctx->Stencil.ValueMask[face]; + const GLstencil *stencilStart = (GLstencil *) rb->Data; + const GLuint stride = rb->Width; + + ASSERT(rb->GetPointer(ctx, rb, 0, 0)); + ASSERT(sizeof(GLstencil) == 1); + + /* + * Perform stencil test. The results of this operation are stored + * in the fail[] array: + * IF fail[i] is non-zero THEN + * the stencil fail operator is to be applied + * ELSE + * the stencil fail operator is not to be applied + * ENDIF + */ + + switch (ctx->Stencil.Function[face]) { + case GL_NEVER: + /* always fail */ + for (i=0;iStencil.Ref[face] & valueMask); + for (i=0;iStencil.Ref[face] & valueMask); + for (i=0;iStencil.Ref[face] & valueMask); + for (i=0;i s) { + /* passed */ + fail[i] = 0; + } + else { + fail[i] = 1; + mask[i] = 0; + } + } + else { + fail[i] = 0; + } + } + break; + case GL_GEQUAL: + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); + for (i=0;i= s) { + /* passed */ + fail[i] = 0; + } + else { + fail[i] = 1; + mask[i] = 0; + } + } + else { + fail[i] = 0; + } + } + break; + case GL_EQUAL: + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); + for (i=0;iStencil.Ref[face] & valueMask); + for (i=0;iStencil.FailFunc[face] != GL_KEEP) { + apply_stencil_op_to_pixels( ctx, n, x, y, ctx->Stencil.FailFunc[face], + face, fail ); + } + + return !allfail; +} + + + + +/** + * Apply stencil and depth testing to an array of pixels. + * This is used both for software and hardware stencil buffers. + * + * The comments in this function are a bit sparse but the code is + * almost identical to stencil_and_ztest_span(), which is well + * commented. + * + * Input: n - number of pixels in the array + * x, y - array of [n] pixel positions + * z - array [n] of z values + * mask - array [n] of flags (1=test this pixel, 0=skip the pixel) + * Output: mask - array [n] of flags (1=stencil and depth test passed) + * Return: GL_FALSE - all fragments failed the testing + * GL_TRUE - one or more fragments passed the testing + */ +static GLboolean +stencil_and_ztest_pixels( GLcontext *ctx, struct sw_span *span, GLuint face ) +{ + struct gl_framebuffer *fb = ctx->DrawBuffer; + struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer; + const GLuint n = span->end; + const GLint *x = span->array->x; + const GLint *y = span->array->y; + GLubyte *mask = span->array->mask; + + ASSERT(span->arrayMask & SPAN_XY); + ASSERT(ctx->Stencil.Enabled); + ASSERT(n <= MAX_WIDTH); + + if (!rb->GetPointer(ctx, rb, 0, 0)) { + /* No direct access */ + GLstencil stencil[MAX_WIDTH]; + GLubyte origMask[MAX_WIDTH]; + + ASSERT(rb->DataType == GL_UNSIGNED_BYTE); + _swrast_get_values(ctx, rb, n, x, y, stencil, sizeof(GLubyte)); + + _mesa_memcpy(origMask, mask, n * sizeof(GLubyte)); + + (void) do_stencil_test(ctx, face, n, stencil, mask); + + if (ctx->Depth.Test == GL_FALSE) { + apply_stencil_op(ctx, ctx->Stencil.ZPassFunc[face], face, + n, stencil, mask); + } + else { + _swrast_depth_test_span(ctx, span); + + if (ctx->Stencil.ZFailFunc[face] != GL_KEEP) { + GLubyte failmask[MAX_WIDTH]; + GLuint i; + for (i = 0; i < n; i++) { + ASSERT(mask[i] == 0 || mask[i] == 1); + failmask[i] = origMask[i] & (mask[i] ^ 1); + } + apply_stencil_op(ctx, ctx->Stencil.ZFailFunc[face], face, + n, stencil, failmask); + } + if (ctx->Stencil.ZPassFunc[face] != GL_KEEP) { + GLubyte passmask[MAX_WIDTH]; + GLuint i; + for (i = 0; i < n; i++) { + ASSERT(mask[i] == 0 || mask[i] == 1); + passmask[i] = origMask[i] & mask[i]; + } + apply_stencil_op(ctx, ctx->Stencil.ZPassFunc[face], face, + n, stencil, passmask); + } + } + + /* Write updated stencil values into hardware stencil buffer */ + rb->PutValues(ctx, rb, n, x, y, stencil, origMask); + + return GL_TRUE; + } + else { + /* Direct access to stencil buffer */ + + if (stencil_test_pixels(ctx, face, n, x, y, mask) == GL_FALSE) { + /* all fragments failed the stencil test, we're done. */ + return GL_FALSE; + } + + if (ctx->Depth.Test==GL_FALSE) { + apply_stencil_op_to_pixels(ctx, n, x, y, + ctx->Stencil.ZPassFunc[face], face, mask); + } + else { + GLubyte passmask[MAX_WIDTH], failmask[MAX_WIDTH], oldmask[MAX_WIDTH]; + GLuint i; + + _mesa_memcpy(oldmask, mask, n * sizeof(GLubyte)); + + _swrast_depth_test_span(ctx, span); + + for (i=0;iStencil.ZFailFunc[face] != GL_KEEP) { + apply_stencil_op_to_pixels(ctx, n, x, y, + ctx->Stencil.ZFailFunc[face], + face, failmask); + } + if (ctx->Stencil.ZPassFunc[face] != GL_KEEP) { + apply_stencil_op_to_pixels(ctx, n, x, y, + ctx->Stencil.ZPassFunc[face], + face, passmask); + } + } + + return GL_TRUE; /* one or more fragments passed both tests */ + } +} + + +/** + * /return GL_TRUE = one or more fragments passed, + * GL_FALSE = all fragments failed. + */ +GLboolean +_swrast_stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span) +{ + /* span->facing can only be non-zero if using two-sided stencil */ + ASSERT(ctx->Stencil.TestTwoSide || span->facing == 0); + if (span->arrayMask & SPAN_XY) + return stencil_and_ztest_pixels(ctx, span, span->facing); + else + return stencil_and_ztest_span(ctx, span, span->facing); +} + + +#if 0 +GLuint +clip_span(GLuint bufferWidth, GLuint bufferHeight, + GLint x, GLint y, GLuint *count) +{ + GLuint n = *count; + GLuint skipPixels = 0; + + if (y < 0 || y >= bufferHeight || x + n <= 0 || x >= bufferWidth) { + /* totally out of bounds */ + n = 0; + } + else { + /* left clip */ + if (x < 0) { + skipPixels = -x; + x = 0; + n -= skipPixels; + } + /* right clip */ + if (x + n > bufferWidth) { + GLint dx = x + n - bufferWidth; + n -= dx; + } + } + + *count = n; + + return skipPixels; +} +#endif + + +/** + * Return a span of stencil values from the stencil buffer. + * Used for glRead/CopyPixels + * Input: n - how many pixels + * x,y - location of first pixel + * Output: stencil - the array of stencil values + */ +void +_swrast_read_stencil_span(GLcontext *ctx, struct gl_renderbuffer *rb, + GLint n, GLint x, GLint y, GLstencil stencil[]) +{ + if (y < 0 || y >= rb->Height || x + n <= 0 || x >= rb->Width) { + /* span is completely outside framebuffer */ + return; /* undefined values OK */ + } + + if (x < 0) { + GLint dx = -x; + x = 0; + n -= dx; + stencil += dx; + } + if (x + n > rb->Width) { + GLint dx = x + n - rb->Width; + n -= dx; + } + if (n <= 0) { + return; + } + + rb->GetRow(ctx, rb, n, x, y, stencil); +} + + + +/** + * Write a span of stencil values to the stencil buffer. + * Used for glDraw/CopyPixels + * Input: n - how many pixels + * x, y - location of first pixel + * stencil - the array of stencil values + */ +void +_swrast_write_stencil_span(GLcontext *ctx, GLint n, GLint x, GLint y, + const GLstencil stencil[] ) +{ + struct gl_framebuffer *fb = ctx->DrawBuffer; + struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer; + const GLuint stencilMax = (1 << fb->Visual.stencilBits) - 1; + const GLuint stencilMask = ctx->Stencil.WriteMask[0]; + + if (y < 0 || y >= rb->Height || x + n <= 0 || x >= rb->Width) { + /* span is completely outside framebuffer */ + return; /* undefined values OK */ + } + if (x < 0) { + GLint dx = -x; + x = 0; + n -= dx; + stencil += dx; + } + if (x + n > rb->Width) { + GLint dx = x + n - rb->Width; + n -= dx; + } + if (n <= 0) { + return; + } + + if ((stencilMask & stencilMax) != stencilMax) { + /* need to apply writemask */ + GLstencil destVals[MAX_WIDTH], newVals[MAX_WIDTH]; + GLint i; + rb->GetRow(ctx, rb, n, x, y, destVals); + for (i = 0; i < n; i++) { + newVals[i] + = (stencil[i] & stencilMask) | (destVals[i] & ~stencilMask); + } + rb->PutRow(ctx, rb, n, x, y, newVals, NULL); + } + else { + rb->PutRow(ctx, rb, n, x, y, stencil, NULL); + } +} + + + +/** + * Clear the stencil buffer. + */ +void +_swrast_clear_stencil_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) +{ + const GLstencil mask = ctx->Stencil.WriteMask[0]; + const GLstencil invMask = ~mask; + const GLstencil clearVal = (ctx->Stencil.Clear & mask); + GLint x, y, width, height; + + if (!rb || mask == 0) + return; + + ASSERT(rb->DataType == GL_UNSIGNED_BYTE); + ASSERT(rb->_BaseFormat == GL_STENCIL_INDEX); + + /* compute region to clear */ + x = ctx->DrawBuffer->_Xmin; + y = ctx->DrawBuffer->_Ymin; + width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; + height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; + + if (rb->GetPointer(ctx, rb, 0, 0)) { + /* Direct buffer access */ + if (ctx->Stencil.WriteMask[0] != STENCIL_MAX) { + /* need to mask the clear */ + GLint i, j; + for (i = 0; i < height; i++) { + GLubyte *stencil = rb->GetPointer(ctx, rb, x, y + i); + for (j = 0; j < width; j++) { + stencil[j] = (stencil[j] & invMask) | clearVal; + } + } + } + else { + /* no bit masking */ + if (width == rb->Width && + rb->InternalFormat == GL_STENCIL_INDEX8_EXT) { + /* optimized case */ + GLubyte *stencil = rb->GetPointer(ctx, rb, x, y); + GLuint len = width * height * sizeof(GLubyte); + _mesa_memset(stencil, clearVal, len); + } + else { + /* general case */ + GLint i, j; + for (i = 0; i < height; i++) { + GLubyte *stencil = rb->GetPointer(ctx, rb, x, y + i); + for (j = 0; j < width; j++) { + stencil[j] = clearVal; + } + } + } + } + } + else { + /* no direct access */ + if (ctx->Stencil.WriteMask[0] != STENCIL_MAX) { + /* need to mask the clear */ + GLint i, j; + for (i = 0; i < height; i++) { + GLubyte stencil[MAX_WIDTH]; + rb->GetRow(ctx, rb, width, x, y + i, stencil); + for (j = 0; j < width; j++) { + stencil[j] = (stencil[j] & invMask) | clearVal; + } + rb->PutRow(ctx, rb, width, x, y + i, stencil, NULL); + } + } + else { + /* no bit masking */ + const GLubyte clear8 = clearVal; + GLint i; + for (i = 0; i < height; i++) { + rb->PutMonoRow(ctx, rb, width, x, y + i, &clear8, NULL); + } + } + } +} + diff --git a/reactos/dll/mesa32/src/swrast/s_stencil.h b/reactos/dll/mesa32/src/swrast/s_stencil.h new file mode 100644 index 00000000000..fabc25250da --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_stencil.h @@ -0,0 +1,53 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 S_STENCIL_H +#define S_STENCIL_H + + +#include "mtypes.h" +#include "swrast.h" + + + +extern GLboolean +_swrast_stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span); + + +extern void +_swrast_read_stencil_span(GLcontext *ctx, struct gl_renderbuffer *rb, + GLint n, GLint x, GLint y, GLstencil stencil[]); + + +extern void +_swrast_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, + const GLstencil stencil[] ); + + +extern void +_swrast_clear_stencil_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_tcc.c b/reactos/dll/mesa32/src/swrast/s_tcc.c new file mode 100644 index 00000000000..550a2aabdb3 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_tcc.c @@ -0,0 +1,189 @@ +/* + * 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. + */ + +/* An attempt to hook s_fragprog_to_c.c up to libtcc.a to try & + * generate some real code. + * + * TCC isn't threadsafe, so it will need additional locking help if we + * end up using it as a backend in mesa. + */ + +#include +#include + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "nvfragprog.h" +#include "macros.h" +#include "program.h" + +#include "s_nvfragprog.h" +#include "s_texture.h" + +#ifdef USE_TCC + +#include + +typedef int (*cfunc)( void *ctx, + const GLfloat (*local_param)[4], + const GLfloat (*env_param)[4], + const struct program_parameter *state_param, + const GLfloat (*interp)[4], + GLfloat (*outputs)[4]); + + +static cfunc current_func; +static struct fragment_program *current_program; +static TCCState *current_tcc_state; + + +static void TEX( void *cc, const float *texcoord, int unit, float *result ) +{ + GLcontext *ctx = (GLcontext *)cc; + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLfloat lambda = 1.0; /* hack */ + GLchan rgba[4]; + + swrast->TextureSample[unit](ctx, unit, ctx->Texture.Unit[unit]._Current, + 1, (const GLfloat (*)[4]) texcoord, + &lambda, &rgba); + + result[0] = CHAN_TO_FLOAT(rgba[0]); + result[1] = CHAN_TO_FLOAT(rgba[1]); + result[2] = CHAN_TO_FLOAT(rgba[2]); + result[3] = CHAN_TO_FLOAT(rgba[3]); +} + + +static void TXB( void *cc, const float *texcoord, int unit, float *result ) +{ + GLcontext *ctx = (GLcontext *)cc; + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLfloat lambda = 1.0; /* hack */ + GLchan rgba[4]; + + /* texcoord[3] is the bias to add to lambda */ + lambda += texcoord[3]; + + + /* Is it necessary to reset texcoord[3] to 1 at this point? + */ + swrast->TextureSample[unit](ctx, unit, ctx->Texture.Unit[unit]._Current, + 1, (const GLfloat (*)[4]) texcoord, + &lambda, &rgba); + + result[0] = CHAN_TO_FLOAT(rgba[0]); + result[1] = CHAN_TO_FLOAT(rgba[1]); + result[2] = CHAN_TO_FLOAT(rgba[2]); + result[3] = CHAN_TO_FLOAT(rgba[3]); +} + + +static void TXP( void *cc, const float *texcoord, int unit, float *result ) +{ + /* I think that TEX needs to undo the perspective divide which has + * already occurred. In the meantime, TXP is correct to do this: + */ + TEX( cc, texcoord, unit, result ); +} + + +static cfunc codegen( TCCState *s, const char *prog, const char *fname ) +{ + unsigned long val; + + if (s) + tcc_delete(s); + + s = tcc_new(); + if (!s) + return 0; + + tcc_set_output_type(s, TCC_OUTPUT_MEMORY); + tcc_compile_string(s, prog); + +/* tcc_add_dll("/usr/lib/libm.so"); */ + + tcc_add_symbol(s, "TEX", (unsigned long)&TEX); + tcc_add_symbol(s, "TXB", (unsigned long)&TXB); + tcc_add_symbol(s, "TXP", (unsigned long)&TXP); + + + tcc_relocate(s); + tcc_get_symbol(s, &val, fname); + return (cfunc) val; +} + +/* TCC isn't threadsafe and even seems not to like having more than + * one TCCState created or used at any one time in a single threaded + * environment. So, this code is all for investigation only and can't + * currently be used in Mesa proper. + * + * I've taken some liberties with globals myself, now. + */ +GLboolean +_swrast_execute_codegen_program( GLcontext *ctx, + const struct fragment_program *program, GLuint maxInst, + struct fp_machine *machine, const struct sw_span *span, + GLuint column ) +{ + if (program != current_program) { + + _swrast_translate_program( ctx ); + + fprintf(stderr, "%s: compiling:\n%s\n", __FUNCTION__, program->c_str); + + current_program = program; + current_func = codegen( current_tcc_state, program->c_str, + "run_program" ); + } + + assert(current_func); + + return current_func( ctx, + program->Base.LocalParams, + (const GLfloat (*)[4])ctx->FragmentProgram.Parameters, + program->Parameters->Parameters, + (const GLfloat (*)[4])machine->Inputs, + machine->Outputs ); +} + +#else /* USE_TCC */ + +GLboolean +_swrast_execute_codegen_program( GLcontext *ctx, + const struct fragment_program *program, GLuint maxInst, + struct fp_machine *machine, const struct sw_span *span, + GLuint column ) +{ + (void) ctx; + (void) program; (void) maxInst; + (void) machine; (void) span; + (void) column; + return 0; +} + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_texstore.c b/reactos/dll/mesa32/src/swrast/s_texstore.c new file mode 100644 index 00000000000..24470a73580 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_texstore.c @@ -0,0 +1,430 @@ +/* + * 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. + */ + +/* + * Authors: + * Brian Paul + */ + + +/* + * The functions in this file are mostly related to software texture fallbacks. + * This includes texture image transfer/packing and texel fetching. + * Hardware drivers will likely override most of this. + */ + + + +#include "glheader.h" +#include "imports.h" +#include "colormac.h" +#include "context.h" +#include "convolve.h" +#include "image.h" +#include "macros.h" +#include "texformat.h" +#include "teximage.h" +#include "texstore.h" + +#include "s_context.h" +#include "s_depth.h" +#include "s_span.h" + +/* + * Read an RGBA image from the frame buffer. + * This is used by glCopyTex[Sub]Image[12]D(). + * Input: ctx - the context + * x, y - lower left corner + * width, height - size of region to read + * Return: pointer to block of GL_RGBA, GLchan data. + */ +static GLchan * +read_color_image( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLint stride, i; + GLchan *image, *dst; + + image = (GLchan *) _mesa_malloc(width * height * 4 * sizeof(GLchan)); + if (!image) + return NULL; + + /* Select buffer to read from */ + _swrast_use_read_buffer(ctx); + + RENDER_START(swrast,ctx); + + dst = image; + stride = width * 4; + for (i = 0; i < height; i++) { + _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer, + width, x, y + i, (GLchan (*)[4]) dst); + dst += stride; + } + + RENDER_FINISH(swrast,ctx); + + /* Read from draw buffer (the default) */ + _swrast_use_draw_buffer(ctx); + + return image; +} + + +/* + * As above, but read data from depth buffer. + */ +static GLfloat * +read_depth_image( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height ) +{ + struct gl_renderbuffer *rb + = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLfloat *image, *dst; + GLint i; + + image = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat)); + if (!image) + return NULL; + + RENDER_START(swrast,ctx); + + dst = image; + for (i = 0; i < height; i++) { + _swrast_read_depth_span_float(ctx, rb, width, x, y + i, dst); + dst += width; + } + + RENDER_FINISH(swrast,ctx); + + return image; +} + + + +static GLboolean +is_depth_format(GLenum format) +{ + switch (format) { + case GL_DEPTH_COMPONENT: + case GL_DEPTH_COMPONENT16_SGIX: + case GL_DEPTH_COMPONENT24_SGIX: + case GL_DEPTH_COMPONENT32_SGIX: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + +/* + * Fallback for Driver.CopyTexImage1D(). + */ +void +_swrast_copy_teximage1d( GLcontext *ctx, GLenum target, GLint level, + GLenum internalFormat, + GLint x, GLint y, GLsizei width, GLint border ) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + ASSERT(texObj); + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + ASSERT(texImage); + + ASSERT(ctx->Driver.TexImage1D); + + if (is_depth_format(internalFormat)) { + /* read depth image from framebuffer */ + GLfloat *image = read_depth_image(ctx, x, y, width, 1); + if (!image) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D"); + return; + } + + /* call glTexImage1D to redefine the texture */ + (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat, + width, border, + GL_DEPTH_COMPONENT, GL_FLOAT, image, + &ctx->DefaultPacking, texObj, texImage); + _mesa_free(image); + } + else { + /* read RGBA image from framebuffer */ + GLchan *image = read_color_image(ctx, x, y, width, 1); + if (!image) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D"); + return; + } + + /* call glTexImage1D to redefine the texture */ + (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat, + width, border, + GL_RGBA, CHAN_TYPE, image, + &ctx->DefaultPacking, texObj, texImage); + _mesa_free(image); + } + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, texUnit, texObj); + } +} + + +/* + * Fallback for Driver.CopyTexImage2D(). + */ +void +_swrast_copy_teximage2d( GLcontext *ctx, GLenum target, GLint level, + GLenum internalFormat, + GLint x, GLint y, GLsizei width, GLsizei height, + GLint border ) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + ASSERT(texObj); + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + ASSERT(texImage); + + ASSERT(ctx->Driver.TexImage2D); + + if (is_depth_format(internalFormat)) { + /* read depth image from framebuffer */ + GLfloat *image = read_depth_image(ctx, x, y, width, height); + if (!image) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D"); + return; + } + + /* call glTexImage2D to redefine the texture */ + (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat, + width, height, border, + GL_DEPTH_COMPONENT, GL_FLOAT, image, + &ctx->DefaultPacking, texObj, texImage); + _mesa_free(image); + } + else { + /* read RGBA image from framebuffer */ + GLchan *image = read_color_image(ctx, x, y, width, height); + if (!image) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D"); + return; + } + + /* call glTexImage2D to redefine the texture */ + (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat, + width, height, border, + GL_RGBA, CHAN_TYPE, image, + &ctx->DefaultPacking, texObj, texImage); + _mesa_free(image); + } + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, texUnit, texObj); + } +} + + +/* + * Fallback for Driver.CopyTexSubImage1D(). + */ +void +_swrast_copy_texsubimage1d( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint x, GLint y, GLsizei width ) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + ASSERT(texObj); + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + ASSERT(texImage); + + ASSERT(ctx->Driver.TexImage1D); + + if (texImage->Format == GL_DEPTH_COMPONENT) { + /* read depth image from framebuffer */ + GLfloat *image = read_depth_image(ctx, x, y, width, 1); + if (!image) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D"); + return; + } + + /* call glTexSubImage1D to redefine the texture */ + (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width, + GL_DEPTH_COMPONENT, GL_FLOAT, image, + &ctx->DefaultPacking, texObj, texImage); + _mesa_free(image); + } + else { + /* read RGBA image from framebuffer */ + GLchan *image = read_color_image(ctx, x, y, width, 1); + if (!image) { + _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D" ); + return; + } + + /* now call glTexSubImage1D to do the real work */ + (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width, + GL_RGBA, CHAN_TYPE, image, + &ctx->DefaultPacking, texObj, texImage); + _mesa_free(image); + } + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, texUnit, texObj); + } +} + + +/* + * Fallback for Driver.CopyTexSubImage2D(). + */ +void +_swrast_copy_texsubimage2d( GLcontext *ctx, + GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, GLsizei width, GLsizei height ) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + ASSERT(texObj); + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + ASSERT(texImage); + + ASSERT(ctx->Driver.TexImage2D); + + if (texImage->Format == GL_DEPTH_COMPONENT) { + /* read depth image from framebuffer */ + GLfloat *image = read_depth_image(ctx, x, y, width, height); + if (!image) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D"); + return; + } + + /* call glTexImage1D to redefine the texture */ + (*ctx->Driver.TexSubImage2D)(ctx, target, level, + xoffset, yoffset, width, height, + GL_DEPTH_COMPONENT, GL_FLOAT, image, + &ctx->DefaultPacking, texObj, texImage); + _mesa_free(image); + } + else { + /* read RGBA image from framebuffer */ + GLchan *image = read_color_image(ctx, x, y, width, height); + if (!image) { + _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D" ); + return; + } + + /* now call glTexSubImage2D to do the real work */ + (*ctx->Driver.TexSubImage2D)(ctx, target, level, + xoffset, yoffset, width, height, + GL_RGBA, CHAN_TYPE, image, + &ctx->DefaultPacking, texObj, texImage); + _mesa_free(image); + } + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, texUnit, texObj); + } +} + + +/* + * Fallback for Driver.CopyTexSubImage3D(). + */ +void +_swrast_copy_texsubimage3d( GLcontext *ctx, + GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint x, GLint y, GLsizei width, GLsizei height ) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + ASSERT(texObj); + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + ASSERT(texImage); + + ASSERT(ctx->Driver.TexImage3D); + + if (texImage->Format == GL_DEPTH_COMPONENT) { + /* read depth image from framebuffer */ + GLfloat *image = read_depth_image(ctx, x, y, width, height); + if (!image) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D"); + return; + } + + /* call glTexImage1D to redefine the texture */ + (*ctx->Driver.TexSubImage3D)(ctx, target, level, + xoffset, yoffset, zoffset, width, height, 1, + GL_DEPTH_COMPONENT, GL_FLOAT, image, + &ctx->DefaultPacking, texObj, texImage); + _mesa_free(image); + } + else { + /* read RGBA image from framebuffer */ + GLchan *image = read_color_image(ctx, x, y, width, height); + if (!image) { + _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D" ); + return; + } + + /* now call glTexSubImage3D to do the real work */ + (*ctx->Driver.TexSubImage3D)(ctx, target, level, + xoffset, yoffset, zoffset, width, height, 1, + GL_RGBA, CHAN_TYPE, image, + &ctx->DefaultPacking, texObj, texImage); + _mesa_free(image); + } + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, texUnit, texObj); + } +} diff --git a/reactos/dll/mesa32/src/swrast/s_texture.c b/reactos/dll/mesa32/src/swrast/s_texture.c new file mode 100644 index 00000000000..c75d826d2c1 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_texture.c @@ -0,0 +1,3963 @@ +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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. + */ + + +#include "glheader.h" +#include "context.h" +#include "colormac.h" +#include "macros.h" +#include "imports.h" +#include "pixel.h" +#include "texformat.h" +#include "teximage.h" + +#include "s_context.h" +#include "s_texture.h" + + +/** + * Constants for integer linear interpolation. + */ +#define ILERP_SCALE 65536.0F +#define ILERP_SHIFT 16 + + +/** + * Linear interpolation macros + */ +#define LERP(T, A, B) ( (A) + (T) * ((B) - (A)) ) +#define ILERP(IT, A, B) ( (A) + (((IT) * ((B) - (A))) >> ILERP_SHIFT) ) + + +/** + * Do 2D/biliner interpolation of float values. + * v00, v10, v01 and v11 are typically four texture samples in a square/box. + * a and b are the horizontal and vertical interpolants. + * It's important that this function is inlined when compiled with + * optimization! If we find that's not true on some systems, convert + * to a macro. + */ +static INLINE GLfloat +lerp_2d(GLfloat a, GLfloat b, + GLfloat v00, GLfloat v10, GLfloat v01, GLfloat v11) +{ + const GLfloat temp0 = LERP(a, v00, v10); + const GLfloat temp1 = LERP(a, v01, v11); + return LERP(b, temp0, temp1); +} + + +/** + * Do 2D/biliner interpolation of integer values. + * \sa lerp_2d + */ +static INLINE GLint +ilerp_2d(GLint ia, GLint ib, + GLint v00, GLint v10, GLint v01, GLint v11) +{ + /* fixed point interpolants in [0, ILERP_SCALE] */ + const GLint temp0 = ILERP(ia, v00, v10); + const GLint temp1 = ILERP(ia, v01, v11); + return ILERP(ib, temp0, temp1); +} + + +/** + * Do 3D/trilinear interpolation of float values. + * \sa lerp_2d + */ +static INLINE GLfloat +lerp_3d(GLfloat a, GLfloat b, GLfloat c, + GLfloat v000, GLfloat v100, GLfloat v010, GLfloat v110, + GLfloat v001, GLfloat v101, GLfloat v011, GLfloat v111) +{ + const GLfloat temp00 = LERP(a, v000, v100); + const GLfloat temp10 = LERP(a, v010, v110); + const GLfloat temp01 = LERP(a, v001, v101); + const GLfloat temp11 = LERP(a, v011, v111); + const GLfloat temp0 = LERP(b, temp00, temp10); + const GLfloat temp1 = LERP(b, temp01, temp11); + return LERP(c, temp0, temp1); +} + + +/** + * Do 3D/trilinear interpolation of integer values. + * \sa lerp_2d + */ +static INLINE GLint +ilerp_3d(GLint ia, GLint ib, GLint ic, + GLint v000, GLint v100, GLint v010, GLint v110, + GLint v001, GLint v101, GLint v011, GLint v111) +{ + /* fixed point interpolants in [0, ILERP_SCALE] */ + const GLint temp00 = ILERP(ia, v000, v100); + const GLint temp10 = ILERP(ia, v010, v110); + const GLint temp01 = ILERP(ia, v001, v101); + const GLint temp11 = ILERP(ia, v011, v111); + const GLint temp0 = ILERP(ib, temp00, temp10); + const GLint temp1 = ILERP(ib, temp01, temp11); + return ILERP(ic, temp0, temp1); +} + + + +/** + * Compute the remainder of a divided by b, but be careful with + * negative values so that GL_REPEAT mode works right. + */ +static INLINE GLint +repeat_remainder(GLint a, GLint b) +{ + if (a >= 0) + return a % b; + else + return (a + 1) % b + b - 1; +} + + +/** + * Used to compute texel locations for linear sampling. + * Input: + * wrapMode = GL_REPEAT, GL_CLAMP, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER + * S = texcoord in [0,1] + * SIZE = width (or height or depth) of texture + * Output: + * U = texcoord in [0, width] + * I0, I1 = two nearest texel indexes + */ +#define COMPUTE_LINEAR_TEXEL_LOCATIONS(wrapMode, S, U, SIZE, I0, I1) \ +{ \ + if (wrapMode == GL_REPEAT) { \ + U = S * SIZE - 0.5F; \ + if (tObj->_IsPowerOfTwo) { \ + I0 = IFLOOR(U) & (SIZE - 1); \ + I1 = (I0 + 1) & (SIZE - 1); \ + } \ + else { \ + I0 = repeat_remainder(IFLOOR(U), SIZE); \ + I1 = repeat_remainder(I0 + 1, SIZE); \ + } \ + } \ + else if (wrapMode == GL_CLAMP_TO_EDGE) { \ + if (S <= 0.0F) \ + U = 0.0F; \ + else if (S >= 1.0F) \ + U = (GLfloat) SIZE; \ + else \ + U = S * SIZE; \ + U -= 0.5F; \ + I0 = IFLOOR(U); \ + I1 = I0 + 1; \ + if (I0 < 0) \ + I0 = 0; \ + if (I1 >= (GLint) SIZE) \ + I1 = SIZE - 1; \ + } \ + else if (wrapMode == GL_CLAMP_TO_BORDER) { \ + const GLfloat min = -1.0F / (2.0F * SIZE); \ + const GLfloat max = 1.0F - min; \ + if (S <= min) \ + U = min * SIZE; \ + else if (S >= max) \ + U = max * SIZE; \ + else \ + U = S * SIZE; \ + U -= 0.5F; \ + I0 = IFLOOR(U); \ + I1 = I0 + 1; \ + } \ + else if (wrapMode == GL_MIRRORED_REPEAT) { \ + const GLint flr = IFLOOR(S); \ + if (flr & 1) \ + U = 1.0F - (S - (GLfloat) flr); /* flr is odd */ \ + else \ + U = S - (GLfloat) flr; /* flr is even */ \ + U = (U * SIZE) - 0.5F; \ + I0 = IFLOOR(U); \ + I1 = I0 + 1; \ + if (I0 < 0) \ + I0 = 0; \ + if (I1 >= (GLint) SIZE) \ + I1 = SIZE - 1; \ + } \ + else if (wrapMode == GL_MIRROR_CLAMP_EXT) { \ + U = (GLfloat) fabs(S); \ + if (U >= 1.0F) \ + U = (GLfloat) SIZE; \ + else \ + U *= SIZE; \ + U -= 0.5F; \ + I0 = IFLOOR(U); \ + I1 = I0 + 1; \ + } \ + else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_EXT) { \ + U = (GLfloat) fabs(S); \ + if (U >= 1.0F) \ + U = (GLfloat) SIZE; \ + else \ + U *= SIZE; \ + U -= 0.5F; \ + I0 = IFLOOR(U); \ + I1 = I0 + 1; \ + if (I0 < 0) \ + I0 = 0; \ + if (I1 >= (GLint) SIZE) \ + I1 = SIZE - 1; \ + } \ + else if (wrapMode == GL_MIRROR_CLAMP_TO_BORDER_EXT) { \ + const GLfloat min = -1.0F / (2.0F * SIZE); \ + const GLfloat max = 1.0F - min; \ + U = (GLfloat) fabs(S); \ + if (U <= min) \ + U = min * SIZE; \ + else if (U >= max) \ + U = max * SIZE; \ + else \ + U *= SIZE; \ + U -= 0.5F; \ + I0 = IFLOOR(U); \ + I1 = I0 + 1; \ + } \ + else { \ + ASSERT(wrapMode == GL_CLAMP); \ + if (S <= 0.0F) \ + U = 0.0F; \ + else if (S >= 1.0F) \ + U = (GLfloat) SIZE; \ + else \ + U = S * SIZE; \ + U -= 0.5F; \ + I0 = IFLOOR(U); \ + I1 = I0 + 1; \ + } \ +} + + +/** + * Used to compute texel location for nearest sampling. + */ +#define COMPUTE_NEAREST_TEXEL_LOCATION(wrapMode, S, SIZE, I) \ +{ \ + if (wrapMode == GL_REPEAT) { \ + /* s limited to [0,1) */ \ + /* i limited to [0,size-1] */ \ + I = IFLOOR(S * SIZE); \ + if (tObj->_IsPowerOfTwo) \ + I &= (SIZE - 1); \ + else \ + I = repeat_remainder(I, SIZE); \ + } \ + else if (wrapMode == GL_CLAMP_TO_EDGE) { \ + /* s limited to [min,max] */ \ + /* i limited to [0, size-1] */ \ + const GLfloat min = 1.0F / (2.0F * SIZE); \ + const GLfloat max = 1.0F - min; \ + if (S < min) \ + I = 0; \ + else if (S > max) \ + I = SIZE - 1; \ + else \ + I = IFLOOR(S * SIZE); \ + } \ + else if (wrapMode == GL_CLAMP_TO_BORDER) { \ + /* s limited to [min,max] */ \ + /* i limited to [-1, size] */ \ + const GLfloat min = -1.0F / (2.0F * SIZE); \ + const GLfloat max = 1.0F - min; \ + if (S <= min) \ + I = -1; \ + else if (S >= max) \ + I = SIZE; \ + else \ + I = IFLOOR(S * SIZE); \ + } \ + else if (wrapMode == GL_MIRRORED_REPEAT) { \ + const GLfloat min = 1.0F / (2.0F * SIZE); \ + const GLfloat max = 1.0F - min; \ + const GLint flr = IFLOOR(S); \ + GLfloat u; \ + if (flr & 1) \ + u = 1.0F - (S - (GLfloat) flr); /* flr is odd */ \ + else \ + u = S - (GLfloat) flr; /* flr is even */ \ + if (u < min) \ + I = 0; \ + else if (u > max) \ + I = SIZE - 1; \ + else \ + I = IFLOOR(u * SIZE); \ + } \ + else if (wrapMode == GL_MIRROR_CLAMP_EXT) { \ + /* s limited to [0,1] */ \ + /* i limited to [0,size-1] */ \ + const GLfloat u = (GLfloat) fabs(S); \ + if (u <= 0.0F) \ + I = 0; \ + else if (u >= 1.0F) \ + I = SIZE - 1; \ + else \ + I = IFLOOR(u * SIZE); \ + } \ + else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_EXT) { \ + /* s limited to [min,max] */ \ + /* i limited to [0, size-1] */ \ + const GLfloat min = 1.0F / (2.0F * SIZE); \ + const GLfloat max = 1.0F - min; \ + const GLfloat u = (GLfloat) fabs(S); \ + if (u < min) \ + I = 0; \ + else if (u > max) \ + I = SIZE - 1; \ + else \ + I = IFLOOR(u * SIZE); \ + } \ + else if (wrapMode == GL_MIRROR_CLAMP_TO_BORDER_EXT) { \ + /* s limited to [min,max] */ \ + /* i limited to [0, size-1] */ \ + const GLfloat min = -1.0F / (2.0F * SIZE); \ + const GLfloat max = 1.0F - min; \ + const GLfloat u = (GLfloat) fabs(S); \ + if (u < min) \ + I = -1; \ + else if (u > max) \ + I = SIZE; \ + else \ + I = IFLOOR(u * SIZE); \ + } \ + else { \ + ASSERT(wrapMode == GL_CLAMP); \ + /* s limited to [0,1] */ \ + /* i limited to [0,size-1] */ \ + if (S <= 0.0F) \ + I = 0; \ + else if (S >= 1.0F) \ + I = SIZE - 1; \ + else \ + I = IFLOOR(S * SIZE); \ + } \ +} + + +/* Power of two image sizes only */ +#define COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(S, U, SIZE, I0, I1) \ +{ \ + U = S * SIZE - 0.5F; \ + I0 = IFLOOR(U) & (SIZE - 1); \ + I1 = (I0 + 1) & (SIZE - 1); \ +} + + +/* + * Compute linear mipmap levels for given lambda. + */ +#define COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level) \ +{ \ + if (lambda < 0.0F) \ + level = tObj->BaseLevel; \ + else if (lambda > tObj->_MaxLambda) \ + level = (GLint) (tObj->BaseLevel + tObj->_MaxLambda); \ + else \ + level = (GLint) (tObj->BaseLevel + lambda); \ +} + + +/* + * Compute nearest mipmap level for given lambda. + */ +#define COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level) \ +{ \ + GLfloat l; \ + if (lambda <= 0.5F) \ + l = 0.0F; \ + else if (lambda > tObj->_MaxLambda + 0.4999F) \ + l = tObj->_MaxLambda + 0.4999F; \ + else \ + l = lambda; \ + level = (GLint) (tObj->BaseLevel + l + 0.5F); \ + if (level > tObj->_MaxLevel) \ + level = tObj->_MaxLevel; \ +} + + + +/* + * Note, the FRAC macro has to work perfectly. Otherwise you'll sometimes + * see 1-pixel bands of improperly weighted linear-sampled texels. The + * tests/texwrap.c demo is a good test. + * Also note, FRAC(x) doesn't truly return the fractional part of x for x < 0. + * Instead, if x < 0 then FRAC(x) = 1 - true_frac(x). + */ +#define FRAC(f) ((f) - IFLOOR(f)) + + + +/* + * Bitflags for texture border color sampling. + */ +#define I0BIT 1 +#define I1BIT 2 +#define J0BIT 4 +#define J1BIT 8 +#define K0BIT 16 +#define K1BIT 32 + + + +/* + * The lambda[] array values are always monotonic. Either the whole span + * will be minified, magnified, or split between the two. This function + * determines the subranges in [0, n-1] that are to be minified or magnified. + */ +static INLINE void +compute_min_mag_ranges( GLfloat minMagThresh, GLuint n, const GLfloat lambda[], + GLuint *minStart, GLuint *minEnd, + GLuint *magStart, GLuint *magEnd ) +{ + ASSERT(lambda != NULL); +#if 0 + /* Verify that lambda[] is monotonous. + * We can't really use this because the inaccuracy in the LOG2 function + * causes this test to fail, yet the resulting texturing is correct. + */ + if (n > 1) { + GLuint i; + printf("lambda delta = %g\n", lambda[0] - lambda[n-1]); + if (lambda[0] >= lambda[n-1]) { /* decreasing */ + for (i = 0; i < n - 1; i++) { + ASSERT((GLint) (lambda[i] * 10) >= (GLint) (lambda[i+1] * 10)); + } + } + else { /* increasing */ + for (i = 0; i < n - 1; i++) { + ASSERT((GLint) (lambda[i] * 10) <= (GLint) (lambda[i+1] * 10)); + } + } + } +#endif /* DEBUG */ + + /* since lambda is monotonous-array use this check first */ + if (lambda[0] <= minMagThresh && lambda[n-1] <= minMagThresh) { + /* magnification for whole span */ + *magStart = 0; + *magEnd = n; + *minStart = *minEnd = 0; + } + else if (lambda[0] > minMagThresh && lambda[n-1] > minMagThresh) { + /* minification for whole span */ + *minStart = 0; + *minEnd = n; + *magStart = *magEnd = 0; + } + else { + /* a mix of minification and magnification */ + GLuint i; + if (lambda[0] > minMagThresh) { + /* start with minification */ + for (i = 1; i < n; i++) { + if (lambda[i] <= minMagThresh) + break; + } + *minStart = 0; + *minEnd = i; + *magStart = i; + *magEnd = n; + } + else { + /* start with magnification */ + for (i = 1; i < n; i++) { + if (lambda[i] > minMagThresh) + break; + } + *magStart = 0; + *magEnd = i; + *minStart = i; + *minEnd = n; + } + } + +#if 0 + /* Verify the min/mag Start/End values + * We don't use this either (see above) + */ + { + GLint i; + for (i = 0; i < n; i++) { + if (lambda[i] > minMagThresh) { + /* minification */ + ASSERT(i >= *minStart); + ASSERT(i < *minEnd); + } + else { + /* magnification */ + ASSERT(i >= *magStart); + ASSERT(i < *magEnd); + } + } + } +#endif +} + + +/**********************************************************************/ +/* 1-D Texture Sampling Functions */ +/**********************************************************************/ + +/* + * Return the texture sample for coordinate (s) using GL_NEAREST filter. + */ +static void +sample_1d_nearest(GLcontext *ctx, + const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + const GLfloat texcoord[4], GLchan rgba[4]) +{ + const GLint width = img->Width2; /* without border, power of two */ + GLint i; + (void) ctx; + + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i); + + /* skip over the border, if any */ + i += img->Border; + + if (i < 0 || i >= (GLint) img->Width) { + /* Need this test for GL_CLAMP_TO_BORDER mode */ + COPY_CHAN4(rgba, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i, 0, 0, rgba); + } +} + + + +/* + * Return the texture sample for coordinate (s) using GL_LINEAR filter. + */ +static void +sample_1d_linear(GLcontext *ctx, + const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + const GLfloat texcoord[4], GLchan rgba[4]) +{ + const GLint width = img->Width2; + GLint i0, i1; + GLfloat u; + GLuint useBorderColor; + (void) ctx; + + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1); + + useBorderColor = 0; + if (img->Border) { + i0 += img->Border; + i1 += img->Border; + } + else { + if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT; + if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT; + } + + { + const GLfloat a = FRAC(u); + GLchan t0[4], t1[4]; /* texels */ + + /* fetch texel colors */ + if (useBorderColor & I0BIT) { + COPY_CHAN4(t0, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i0, 0, 0, t0); + } + if (useBorderColor & I1BIT) { + COPY_CHAN4(t1, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i1, 0, 0, t1); + } + + /* do linear interpolation of texel colors */ +#if CHAN_TYPE == GL_FLOAT + rgba[0] = LERP(a, t0[0], t1[0]); + rgba[1] = LERP(a, t0[1], t1[1]); + rgba[2] = LERP(a, t0[2], t1[2]); + rgba[3] = LERP(a, t0[3], t1[3]); +#elif CHAN_TYPE == GL_UNSIGNED_SHORT + rgba[0] = (GLchan) (LERP(a, t0[0], t1[0]) + 0.5); + rgba[1] = (GLchan) (LERP(a, t0[1], t1[1]) + 0.5); + rgba[2] = (GLchan) (LERP(a, t0[2], t1[2]) + 0.5); + rgba[3] = (GLchan) (LERP(a, t0[3], t1[3]) + 0.5); +#else + ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE); + { + /* fixed point interpolants in [0, ILERP_SCALE] */ + const GLint ia = IROUND_POS(a * ILERP_SCALE); + rgba[0] = ILERP(ia, t0[0], t1[0]); + rgba[1] = ILERP(ia, t0[1], t1[1]); + rgba[2] = ILERP(ia, t0[2], t1[2]); + rgba[3] = ILERP(ia, t0[3], t1[3]); + } +#endif + } +} + + +static void +sample_1d_nearest_mipmap_nearest(GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + sample_1d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); + } +} + + +static void +sample_1d_linear_mipmap_nearest(GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + sample_1d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); + } +} + + + +/* + * This is really just needed in order to prevent warnings with some compilers. + */ +#if CHAN_TYPE == GL_FLOAT +#define CHAN_CAST +#else +#define CHAN_CAST (GLchan) (GLint) +#endif + + +static void +sample_1d_nearest_mipmap_linear(GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + if (level >= tObj->_MaxLevel) { + sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], + texcoord[i], rgba[i]); + } + else { + GLchan t0[4], t1[4]; + const GLfloat f = FRAC(lambda[i]); + sample_1d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_1d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } + } +} + + + +static void +sample_1d_linear_mipmap_linear(GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + if (level >= tObj->_MaxLevel) { + sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], + texcoord[i], rgba[i]); + } + else { + GLchan t0[4], t1[4]; + const GLfloat f = FRAC(lambda[i]); + sample_1d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_1d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } + } +} + + + +static void +sample_nearest_1d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat texcoords[][4], const GLfloat lambda[], + GLchan rgba[][4] ) +{ + GLuint i; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; + (void) texUnit; + (void) lambda; + for (i=0;iImage[0][tObj->BaseLevel]; + (void) texUnit; + (void) lambda; + for (i=0;i_MinMagThresh[texUnit], + n, lambda, &minStart, &minEnd, &magStart, &magEnd); + + if (minStart < minEnd) { + /* do the minified texels */ + const GLuint m = minEnd - minStart; + switch (tObj->MinFilter) { + case GL_NEAREST: + for (i = minStart; i < minEnd; i++) + sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + case GL_LINEAR: + for (i = minStart; i < minEnd; i++) + sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + case GL_NEAREST_MIPMAP_NEAREST: + sample_1d_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_NEAREST: + sample_1d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_NEAREST_MIPMAP_LINEAR: + sample_1d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_LINEAR: + sample_1d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + default: + _mesa_problem(ctx, "Bad min filter in sample_1d_texture"); + return; + } + } + + if (magStart < magEnd) { + /* do the magnified texels */ + switch (tObj->MagFilter) { + case GL_NEAREST: + for (i = magStart; i < magEnd; i++) + sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + case GL_LINEAR: + for (i = magStart; i < magEnd; i++) + sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + default: + _mesa_problem(ctx, "Bad mag filter in sample_1d_texture"); + return; + } + } +} + + +/**********************************************************************/ +/* 2-D Texture Sampling Functions */ +/**********************************************************************/ + + +/* + * Return the texture sample for coordinate (s,t) using GL_NEAREST filter. + */ +static INLINE void +sample_2d_nearest(GLcontext *ctx, + const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + const GLfloat texcoord[4], + GLchan rgba[]) +{ + const GLint width = img->Width2; /* without border, power of two */ + const GLint height = img->Height2; /* without border, power of two */ + GLint i, j; + (void) ctx; + + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i); + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoord[1], height, j); + + /* skip over the border, if any */ + i += img->Border; + j += img->Border; + + if (i < 0 || i >= (GLint) img->Width || j < 0 || j >= (GLint) img->Height) { + /* Need this test for GL_CLAMP_TO_BORDER mode */ + COPY_CHAN4(rgba, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i, j, 0, rgba); + } +} + + + +/** + * Return the texture sample for coordinate (s,t) using GL_LINEAR filter. + * New sampling code contributed by Lynn Quam . + */ +static INLINE void +sample_2d_linear(GLcontext *ctx, + const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + const GLfloat texcoord[4], + GLchan rgba[]) +{ + const GLint width = img->Width2; + const GLint height = img->Height2; + GLint i0, j0, i1, j1; + GLuint useBorderColor; + GLfloat u, v; + (void) ctx; + + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1); + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoord[1], v, height, j0, j1); + + useBorderColor = 0; + if (img->Border) { + i0 += img->Border; + i1 += img->Border; + j0 += img->Border; + j1 += img->Border; + } + else { + if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT; + if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT; + if (j0 < 0 || j0 >= height) useBorderColor |= J0BIT; + if (j1 < 0 || j1 >= height) useBorderColor |= J1BIT; + } + + { + const GLfloat a = FRAC(u); + const GLfloat b = FRAC(v); +#if CHAN_TYPE == GL_UNSIGNED_BYTE + const GLint ia = IROUND_POS(a * ILERP_SCALE); + const GLint ib = IROUND_POS(b * ILERP_SCALE); +#endif + GLchan t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */ + + /* fetch four texel colors */ + if (useBorderColor & (I0BIT | J0BIT)) { + COPY_CHAN4(t00, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i0, j0, 0, t00); + } + if (useBorderColor & (I1BIT | J0BIT)) { + COPY_CHAN4(t10, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i1, j0, 0, t10); + } + if (useBorderColor & (I0BIT | J1BIT)) { + COPY_CHAN4(t01, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i0, j1, 0, t01); + } + if (useBorderColor & (I1BIT | J1BIT)) { + COPY_CHAN4(t11, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i1, j1, 0, t11); + } + + /* do bilinear interpolation of texel colors */ +#if CHAN_TYPE == GL_FLOAT + rgba[0] = lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]); + rgba[1] = lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]); + rgba[2] = lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]); + rgba[3] = lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]); +#elif CHAN_TYPE == GL_UNSIGNED_SHORT + rgba[0] = (GLchan) (lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]) + 0.5); + rgba[1] = (GLchan) (lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]) + 0.5); + rgba[2] = (GLchan) (lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]) + 0.5); + rgba[3] = (GLchan) (lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]) + 0.5); +#else + ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE); + rgba[0] = ilerp_2d(ia, ib, t00[0], t10[0], t01[0], t11[0]); + rgba[1] = ilerp_2d(ia, ib, t00[1], t10[1], t01[1], t11[1]); + rgba[2] = ilerp_2d(ia, ib, t00[2], t10[2], t01[2], t11[2]); + rgba[3] = ilerp_2d(ia, ib, t00[3], t10[3], t01[3], t11[3]); +#endif + } +} + + +/* + * As above, but we know WRAP_S == REPEAT and WRAP_T == REPEAT. + */ +static INLINE void +sample_2d_linear_repeat(GLcontext *ctx, + const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + const GLfloat texcoord[4], + GLchan rgba[]) +{ + const GLint width = img->Width2; + const GLint height = img->Height2; + GLint i0, j0, i1, j1; + GLfloat u, v; + (void) ctx; + (void) tObj; + + ASSERT(tObj->WrapS == GL_REPEAT); + ASSERT(tObj->WrapT == GL_REPEAT); + ASSERT(img->Border == 0); + ASSERT(img->Format != GL_COLOR_INDEX); + ASSERT(img->_IsPowerOfTwo); + + COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[0], u, width, i0, i1); + COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[1], v, height, j0, j1); + + { + const GLfloat a = FRAC(u); + const GLfloat b = FRAC(v); +#if CHAN_TYPE == GL_UNSIGNED_BYTE + const GLint ia = IROUND_POS(a * ILERP_SCALE); + const GLint ib = IROUND_POS(b * ILERP_SCALE); +#endif + GLchan t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */ + + img->FetchTexelc(img, i0, j0, 0, t00); + img->FetchTexelc(img, i1, j0, 0, t10); + img->FetchTexelc(img, i0, j1, 0, t01); + img->FetchTexelc(img, i1, j1, 0, t11); + + /* do bilinear interpolation of texel colors */ +#if CHAN_TYPE == GL_FLOAT + rgba[0] = lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]); + rgba[1] = lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]); + rgba[2] = lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]); + rgba[3] = lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]); +#elif CHAN_TYPE == GL_UNSIGNED_SHORT + rgba[0] = (GLchan) (lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]) + 0.5); + rgba[1] = (GLchan) (lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]) + 0.5); + rgba[2] = (GLchan) (lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]) + 0.5); + rgba[3] = (GLchan) (lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]) + 0.5); +#else + ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE); + rgba[0] = ilerp_2d(ia, ib, t00[0], t10[0], t01[0], t11[0]); + rgba[1] = ilerp_2d(ia, ib, t00[1], t10[1], t01[1], t11[1]); + rgba[2] = ilerp_2d(ia, ib, t00[2], t10[2], t01[2], t11[2]); + rgba[3] = ilerp_2d(ia, ib, t00[3], t10[3], t01[3], t11[3]); +#endif + } +} + + + +static void +sample_2d_nearest_mipmap_nearest(GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + sample_2d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); + } +} + + + +static void +sample_2d_linear_mipmap_nearest(GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + sample_2d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); + } +} + + + +static void +sample_2d_nearest_mipmap_linear(GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + if (level >= tObj->_MaxLevel) { + sample_2d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], + texcoord[i], rgba[i]); + } + else { + GLchan t0[4], t1[4]; /* texels */ + const GLfloat f = FRAC(lambda[i]); + sample_2d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_2d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } + } +} + + + +/* Trilinear filtering */ +static void +sample_2d_linear_mipmap_linear( GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4] ) +{ + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + if (level >= tObj->_MaxLevel) { + sample_2d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], + texcoord[i], rgba[i]); + } + else { + GLchan t0[4], t1[4]; /* texels */ + const GLfloat f = FRAC(lambda[i]); + sample_2d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_2d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } + } +} + + +static void +sample_2d_linear_mipmap_linear_repeat( GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4] ) +{ + GLuint i; + ASSERT(lambda != NULL); + ASSERT(tObj->WrapS == GL_REPEAT); + ASSERT(tObj->WrapT == GL_REPEAT); + ASSERT(tObj->_IsPowerOfTwo); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + if (level >= tObj->_MaxLevel) { + sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], + texcoord[i], rgba[i]); + } + else { + GLchan t0[4], t1[4]; /* texels */ + const GLfloat f = FRAC(lambda[i]); + sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } + } +} + + +static void +sample_nearest_2d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4] ) +{ + GLuint i; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; + (void) texUnit; + (void) lambda; + for (i=0;iImage[0][tObj->BaseLevel]; + (void) texUnit; + (void) lambda; + if (tObj->WrapS == GL_REPEAT && tObj->WrapT == GL_REPEAT + && image->Border == 0) { + for (i=0;iImage[0][tObj->BaseLevel]; + const GLfloat width = (GLfloat) img->Width; + const GLfloat height = (GLfloat) img->Height; + const GLint colMask = img->Width - 1; + const GLint rowMask = img->Height - 1; + const GLint shift = img->WidthLog2; + GLuint k; + (void) ctx; + (void) texUnit; + (void) lambda; + ASSERT(tObj->WrapS==GL_REPEAT); + ASSERT(tObj->WrapT==GL_REPEAT); + ASSERT(img->Border==0); + ASSERT(img->Format==GL_RGB); + ASSERT(img->_IsPowerOfTwo); + + for (k=0; kData) + 3*pos; + rgba[k][RCOMP] = texel[0]; + rgba[k][GCOMP] = texel[1]; + rgba[k][BCOMP] = texel[2]; + } +} + + +/* + * Optimized 2-D texture sampling: + * S and T wrap mode == GL_REPEAT + * GL_NEAREST min/mag filter + * No border + * RowStride == Width, + * Format = GL_RGBA + */ +static void +opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4] ) +{ + const struct gl_texture_image *img = tObj->Image[0][tObj->BaseLevel]; + const GLfloat width = (GLfloat) img->Width; + const GLfloat height = (GLfloat) img->Height; + const GLint colMask = img->Width - 1; + const GLint rowMask = img->Height - 1; + const GLint shift = img->WidthLog2; + GLuint i; + (void) ctx; + (void) texUnit; + (void) lambda; + ASSERT(tObj->WrapS==GL_REPEAT); + ASSERT(tObj->WrapT==GL_REPEAT); + ASSERT(img->Border==0); + ASSERT(img->Format==GL_RGBA); + ASSERT(img->_IsPowerOfTwo); + + for (i = 0; i < n; i++) { + const GLint col = IFLOOR(texcoords[i][0] * width) & colMask; + const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask; + const GLint pos = (row << shift) | col; + const GLchan *texel = ((GLchan *) img->Data) + (pos << 2); /* pos*4 */ + COPY_CHAN4(rgba[i], texel); + } +} + + +/* + * Given an array of texture coordinate and lambda (level of detail) + * values, return an array of texture sample. + */ +static void +sample_lambda_2d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4] ) +{ + const struct gl_texture_image *tImg = tObj->Image[0][tObj->BaseLevel]; + GLuint minStart, minEnd; /* texels with minification */ + GLuint magStart, magEnd; /* texels with magnification */ + + const GLboolean repeatNoBorderPOT = (tObj->WrapS == GL_REPEAT) + && (tObj->WrapT == GL_REPEAT) + && (tImg->Border == 0 && (tImg->Width == tImg->RowStride)) + && (tImg->Format != GL_COLOR_INDEX) + && tImg->_IsPowerOfTwo; + + ASSERT(lambda != NULL); + compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], + n, lambda, &minStart, &minEnd, &magStart, &magEnd); + + if (minStart < minEnd) { + /* do the minified texels */ + const GLuint m = minEnd - minStart; + switch (tObj->MinFilter) { + case GL_NEAREST: + if (repeatNoBorderPOT) { + switch (tImg->TexFormat->MesaFormat) { + case MESA_FORMAT_RGB: + case MESA_FORMAT_RGB888: + /*case MESA_FORMAT_BGR888:*/ + opt_sample_rgb_2d(ctx, texUnit, tObj, m, texcoords + minStart, + NULL, rgba + minStart); + break; + case MESA_FORMAT_RGBA: + case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_ARGB8888: + /*case MESA_FORMAT_ABGR8888:*/ + /*case MESA_FORMAT_BGRA8888:*/ + opt_sample_rgba_2d(ctx, texUnit, tObj, m, texcoords + minStart, + NULL, rgba + minStart); + break; + default: + sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + minStart, + NULL, rgba + minStart ); + } + } + else { + sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + minStart, + NULL, rgba + minStart); + } + break; + case GL_LINEAR: + sample_linear_2d(ctx, texUnit, tObj, m, texcoords + minStart, + NULL, rgba + minStart); + break; + case GL_NEAREST_MIPMAP_NEAREST: + sample_2d_nearest_mipmap_nearest(ctx, tObj, m, + texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_NEAREST: + sample_2d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_NEAREST_MIPMAP_LINEAR: + sample_2d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_LINEAR: + if (repeatNoBorderPOT) + sample_2d_linear_mipmap_linear_repeat(ctx, tObj, m, + texcoords + minStart, lambda + minStart, rgba + minStart); + else + sample_2d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + default: + _mesa_problem(ctx, "Bad min filter in sample_2d_texture"); + return; + } + } + + if (magStart < magEnd) { + /* do the magnified texels */ + const GLuint m = magEnd - magStart; + + switch (tObj->MagFilter) { + case GL_NEAREST: + if (repeatNoBorderPOT) { + switch (tImg->TexFormat->MesaFormat) { + case MESA_FORMAT_RGB: + case MESA_FORMAT_RGB888: + /*case MESA_FORMAT_BGR888:*/ + opt_sample_rgb_2d(ctx, texUnit, tObj, m, texcoords + magStart, + NULL, rgba + magStart); + break; + case MESA_FORMAT_RGBA: + case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_ARGB8888: + /*case MESA_FORMAT_ABGR8888:*/ + /*case MESA_FORMAT_BGRA8888:*/ + opt_sample_rgba_2d(ctx, texUnit, tObj, m, texcoords + magStart, + NULL, rgba + magStart); + break; + default: + sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + magStart, + NULL, rgba + magStart ); + } + } + else { + sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + magStart, + NULL, rgba + magStart); + } + break; + case GL_LINEAR: + sample_linear_2d(ctx, texUnit, tObj, m, texcoords + magStart, + NULL, rgba + magStart); + break; + default: + _mesa_problem(ctx, "Bad mag filter in sample_lambda_2d"); + } + } +} + + + +/**********************************************************************/ +/* 3-D Texture Sampling Functions */ +/**********************************************************************/ + +/* + * Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter. + */ +static void +sample_3d_nearest(GLcontext *ctx, + const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + const GLfloat texcoord[4], + GLchan rgba[4]) +{ + const GLint width = img->Width2; /* without border, power of two */ + const GLint height = img->Height2; /* without border, power of two */ + const GLint depth = img->Depth2; /* without border, power of two */ + GLint i, j, k; + (void) ctx; + + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i); + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoord[1], height, j); + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapR, texcoord[2], depth, k); + + if (i < 0 || i >= (GLint) img->Width || + j < 0 || j >= (GLint) img->Height || + k < 0 || k >= (GLint) img->Depth) { + /* Need this test for GL_CLAMP_TO_BORDER mode */ + COPY_CHAN4(rgba, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i, j, k, rgba); + } +} + + + +/* + * Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter. + */ +static void +sample_3d_linear(GLcontext *ctx, + const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + const GLfloat texcoord[4], + GLchan rgba[4]) +{ + const GLint width = img->Width2; + const GLint height = img->Height2; + const GLint depth = img->Depth2; + GLint i0, j0, k0, i1, j1, k1; + GLuint useBorderColor; + GLfloat u, v, w; + (void) ctx; + + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1); + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoord[1], v, height, j0, j1); + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapR, texcoord[2], w, depth, k0, k1); + + useBorderColor = 0; + if (img->Border) { + i0 += img->Border; + i1 += img->Border; + j0 += img->Border; + j1 += img->Border; + k0 += img->Border; + k1 += img->Border; + } + else { + /* check if sampling texture border color */ + if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT; + if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT; + if (j0 < 0 || j0 >= height) useBorderColor |= J0BIT; + if (j1 < 0 || j1 >= height) useBorderColor |= J1BIT; + if (k0 < 0 || k0 >= depth) useBorderColor |= K0BIT; + if (k1 < 0 || k1 >= depth) useBorderColor |= K1BIT; + } + + { + const GLfloat a = FRAC(u); + const GLfloat b = FRAC(v); + const GLfloat c = FRAC(w); +#if CHAN_TYPE == GL_UNSIGNED_BYTE + const GLint ia = IROUND_POS(a * ILERP_SCALE); + const GLint ib = IROUND_POS(b * ILERP_SCALE); + const GLint ic = IROUND_POS(c * ILERP_SCALE); +#endif + GLchan t000[4], t010[4], t001[4], t011[4]; + GLchan t100[4], t110[4], t101[4], t111[4]; + + /* Fetch texels */ + if (useBorderColor & (I0BIT | J0BIT | K0BIT)) { + COPY_CHAN4(t000, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i0, j0, k0, t000); + } + if (useBorderColor & (I1BIT | J0BIT | K0BIT)) { + COPY_CHAN4(t100, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i1, j0, k0, t100); + } + if (useBorderColor & (I0BIT | J1BIT | K0BIT)) { + COPY_CHAN4(t010, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i0, j1, k0, t010); + } + if (useBorderColor & (I1BIT | J1BIT | K0BIT)) { + COPY_CHAN4(t110, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i1, j1, k0, t110); + } + + if (useBorderColor & (I0BIT | J0BIT | K1BIT)) { + COPY_CHAN4(t001, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i0, j0, k1, t001); + } + if (useBorderColor & (I1BIT | J0BIT | K1BIT)) { + COPY_CHAN4(t101, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i1, j0, k1, t101); + } + if (useBorderColor & (I0BIT | J1BIT | K1BIT)) { + COPY_CHAN4(t011, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i0, j1, k1, t011); + } + if (useBorderColor & (I1BIT | J1BIT | K1BIT)) { + COPY_CHAN4(t111, tObj->_BorderChan); + } + else { + img->FetchTexelc(img, i1, j1, k1, t111); + } + + /* trilinear interpolation of samples */ +#if CHAN_TYPE == GL_FLOAT + rgba[0] = lerp_3d(a, b, c, + t000[0], t100[0], t010[0], t110[0], + t001[0], t101[0], t011[0], t111[0]); + rgba[1] = lerp_3d(a, b, c, + t000[1], t100[1], t010[1], t110[1], + t001[1], t101[1], t011[1], t111[1]); + rgba[2] = lerp_3d(a, b, c, + t000[2], t100[2], t010[2], t110[2], + t001[2], t101[2], t011[2], t111[2]); + rgba[3] = lerp_3d(a, b, c, + t000[3], t100[3], t010[3], t110[3], + t001[3], t101[3], t011[3], t111[3]); +#elif CHAN_TYPE == GL_UNSIGNED_SHORT + rgba[0] = (GLchan) (lerp_3d(a, b, c, + t000[0], t100[0], t010[0], t110[0], + t001[0], t101[0], t011[0], t111[0]) + 0.5F); + rgba[1] = (GLchan) (lerp_3d(a, b, c, + t000[1], t100[1], t010[1], t110[1], + t001[1], t101[1], t011[1], t111[1]) + 0.5F); + rgba[2] = (GLchan) (lerp_3d(a, b, c, + t000[2], t100[2], t010[2], t110[2], + t001[2], t101[2], t011[2], t111[2]) + 0.5F); + rgba[3] = (GLchan) (lerp_3d(a, b, c, + t000[3], t100[3], t010[3], t110[3], + t001[3], t101[3], t011[3], t111[3]) + 0.5F); +#else + ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE); + rgba[0] = ilerp_3d(ia, ib, ic, + t000[0], t100[0], t010[0], t110[0], + t001[0], t101[0], t011[0], t111[0]); + rgba[1] = ilerp_3d(ia, ib, ic, + t000[1], t100[1], t010[1], t110[1], + t001[1], t101[1], t011[1], t111[1]); + rgba[2] = ilerp_3d(ia, ib, ic, + t000[2], t100[2], t010[2], t110[2], + t001[2], t101[2], t011[2], t111[2]); + rgba[3] = ilerp_3d(ia, ib, ic, + t000[3], t100[3], t010[3], t110[3], + t001[3], t101[3], t011[3], t111[3]); +#endif + } +} + + + +static void +sample_3d_nearest_mipmap_nearest(GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4] ) +{ + GLuint i; + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + sample_3d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); + } +} + + +static void +sample_3d_linear_mipmap_nearest(GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + sample_3d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); + } +} + + +static void +sample_3d_nearest_mipmap_linear(GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + if (level >= tObj->_MaxLevel) { + sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], + texcoord[i], rgba[i]); + } + else { + GLchan t0[4], t1[4]; /* texels */ + const GLfloat f = FRAC(lambda[i]); + sample_3d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_3d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } + } +} + + +static void +sample_3d_linear_mipmap_linear(GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + if (level >= tObj->_MaxLevel) { + sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], + texcoord[i], rgba[i]); + } + else { + GLchan t0[4], t1[4]; /* texels */ + const GLfloat f = FRAC(lambda[i]); + sample_3d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_3d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } + } +} + + +static void +sample_nearest_3d(GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat texcoords[][4], const GLfloat lambda[], + GLchan rgba[][4]) +{ + GLuint i; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; + (void) texUnit; + (void) lambda; + for (i=0;iImage[0][tObj->BaseLevel]; + (void) texUnit; + (void) lambda; + for (i=0;i_MinMagThresh[texUnit], + n, lambda, &minStart, &minEnd, &magStart, &magEnd); + + if (minStart < minEnd) { + /* do the minified texels */ + GLuint m = minEnd - minStart; + switch (tObj->MinFilter) { + case GL_NEAREST: + for (i = minStart; i < minEnd; i++) + sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + case GL_LINEAR: + for (i = minStart; i < minEnd; i++) + sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + case GL_NEAREST_MIPMAP_NEAREST: + sample_3d_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_NEAREST: + sample_3d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_NEAREST_MIPMAP_LINEAR: + sample_3d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_LINEAR: + sample_3d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + default: + _mesa_problem(ctx, "Bad min filter in sample_3d_texture"); + return; + } + } + + if (magStart < magEnd) { + /* do the magnified texels */ + switch (tObj->MagFilter) { + case GL_NEAREST: + for (i = magStart; i < magEnd; i++) + sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + case GL_LINEAR: + for (i = magStart; i < magEnd; i++) + sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + default: + _mesa_problem(ctx, "Bad mag filter in sample_3d_texture"); + return; + } + } +} + + +/**********************************************************************/ +/* Texture Cube Map Sampling Functions */ +/**********************************************************************/ + +/* + * Choose one of six sides of a texture cube map given the texture + * coord (rx,ry,rz). Return pointer to corresponding array of texture + * images. + */ +static const struct gl_texture_image ** +choose_cube_face(const struct gl_texture_object *texObj, + const GLfloat texcoord[4], GLfloat newCoord[4]) +{ +/* + major axis + direction target sc tc ma + ---------- ------------------------------- --- --- --- + +rx TEXTURE_CUBE_MAP_POSITIVE_X_EXT -rz -ry rx + -rx TEXTURE_CUBE_MAP_NEGATIVE_X_EXT +rz -ry rx + +ry TEXTURE_CUBE_MAP_POSITIVE_Y_EXT +rx +rz ry + -ry TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT +rx -rz ry + +rz TEXTURE_CUBE_MAP_POSITIVE_Z_EXT +rx -ry rz + -rz TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT -rx -ry rz +*/ + const GLfloat rx = texcoord[0]; + const GLfloat ry = texcoord[1]; + const GLfloat rz = texcoord[2]; + const struct gl_texture_image **imgArray; + const GLfloat arx = FABSF(rx), ary = FABSF(ry), arz = FABSF(rz); + GLfloat sc, tc, ma; + + if (arx > ary && arx > arz) { + if (rx >= 0.0F) { + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_POS_X]; + sc = -rz; + tc = -ry; + ma = arx; + } + else { + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_NEG_X]; + sc = rz; + tc = -ry; + ma = arx; + } + } + else if (ary > arx && ary > arz) { + if (ry >= 0.0F) { + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_POS_Y]; + sc = rx; + tc = rz; + ma = ary; + } + else { + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_NEG_Y]; + sc = rx; + tc = -rz; + ma = ary; + } + } + else { + if (rz > 0.0F) { + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_POS_Z]; + sc = rx; + tc = -ry; + ma = arz; + } + else { + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_NEG_Z]; + sc = -rx; + tc = -ry; + ma = arz; + } + } + + newCoord[0] = ( sc / ma + 1.0F ) * 0.5F; + newCoord[1] = ( tc / ma + 1.0F ) * 0.5F; + return imgArray; +} + + +static void +sample_nearest_cube(GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat texcoords[][4], const GLfloat lambda[], + GLchan rgba[][4]) +{ + GLuint i; + (void) texUnit; + (void) lambda; + for (i = 0; i < n; i++) { + const struct gl_texture_image **images; + GLfloat newCoord[4]; + images = choose_cube_face(tObj, texcoords[i], newCoord); + sample_2d_nearest(ctx, tObj, images[tObj->BaseLevel], + newCoord, rgba[i]); + } +} + + +static void +sample_linear_cube(GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + (void) texUnit; + (void) lambda; + for (i = 0; i < n; i++) { + const struct gl_texture_image **images; + GLfloat newCoord[4]; + images = choose_cube_face(tObj, texcoords[i], newCoord); + sample_2d_linear(ctx, tObj, images[tObj->BaseLevel], + newCoord, rgba[i]); + } +} + + +static void +sample_cube_nearest_mipmap_nearest(GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + (void) texUnit; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + const struct gl_texture_image **images; + GLfloat newCoord[4]; + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + images = choose_cube_face(tObj, texcoord[i], newCoord); + sample_2d_nearest(ctx, tObj, images[level], newCoord, rgba[i]); + } +} + + +static void +sample_cube_linear_mipmap_nearest(GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + (void) texUnit; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + const struct gl_texture_image **images; + GLfloat newCoord[4]; + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + images = choose_cube_face(tObj, texcoord[i], newCoord); + sample_2d_linear(ctx, tObj, images[level], newCoord, rgba[i]); + } +} + + +static void +sample_cube_nearest_mipmap_linear(GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + (void) texUnit; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + const struct gl_texture_image **images; + GLfloat newCoord[4]; + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + images = choose_cube_face(tObj, texcoord[i], newCoord); + if (level >= tObj->_MaxLevel) { + sample_2d_nearest(ctx, tObj, images[tObj->_MaxLevel], + newCoord, rgba[i]); + } + else { + GLchan t0[4], t1[4]; /* texels */ + const GLfloat f = FRAC(lambda[i]); + sample_2d_nearest(ctx, tObj, images[level ], newCoord, t0); + sample_2d_nearest(ctx, tObj, images[level+1], newCoord, t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } + } +} + + +static void +sample_cube_linear_mipmap_linear(GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + (void) texUnit; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + const struct gl_texture_image **images; + GLfloat newCoord[4]; + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + images = choose_cube_face(tObj, texcoord[i], newCoord); + if (level >= tObj->_MaxLevel) { + sample_2d_linear(ctx, tObj, images[tObj->_MaxLevel], + newCoord, rgba[i]); + } + else { + GLchan t0[4], t1[4]; + const GLfloat f = FRAC(lambda[i]); + sample_2d_linear(ctx, tObj, images[level ], newCoord, t0); + sample_2d_linear(ctx, tObj, images[level+1], newCoord, t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } + } +} + + +static void +sample_lambda_cube( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat texcoords[][4], const GLfloat lambda[], + GLchan rgba[][4]) +{ + GLuint minStart, minEnd; /* texels with minification */ + GLuint magStart, magEnd; /* texels with magnification */ + + ASSERT(lambda != NULL); + compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], + n, lambda, &minStart, &minEnd, &magStart, &magEnd); + + if (minStart < minEnd) { + /* do the minified texels */ + const GLuint m = minEnd - minStart; + switch (tObj->MinFilter) { + case GL_NEAREST: + sample_nearest_cube(ctx, texUnit, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR: + sample_linear_cube(ctx, texUnit, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_NEAREST_MIPMAP_NEAREST: + sample_cube_nearest_mipmap_nearest(ctx, texUnit, tObj, m, + texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_NEAREST: + sample_cube_linear_mipmap_nearest(ctx, texUnit, tObj, m, + texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_NEAREST_MIPMAP_LINEAR: + sample_cube_nearest_mipmap_linear(ctx, texUnit, tObj, m, + texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_LINEAR: + sample_cube_linear_mipmap_linear(ctx, texUnit, tObj, m, + texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + default: + _mesa_problem(ctx, "Bad min filter in sample_lambda_cube"); + } + } + + if (magStart < magEnd) { + /* do the magnified texels */ + const GLuint m = magEnd - magStart; + switch (tObj->MagFilter) { + case GL_NEAREST: + sample_nearest_cube(ctx, texUnit, tObj, m, texcoords + magStart, + lambda + magStart, rgba + magStart); + break; + case GL_LINEAR: + sample_linear_cube(ctx, texUnit, tObj, m, texcoords + magStart, + lambda + magStart, rgba + magStart); + break; + default: + _mesa_problem(ctx, "Bad mag filter in sample_lambda_cube"); + } + } +} + + +/**********************************************************************/ +/* Texture Rectangle Sampling Functions */ +/**********************************************************************/ + +static void +sample_nearest_rect(GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat texcoords[][4], const GLfloat lambda[], + GLchan rgba[][4]) +{ + const struct gl_texture_image *img = tObj->Image[0][0]; + const GLfloat width = (GLfloat) img->Width; + const GLfloat height = (GLfloat) img->Height; + const GLint width_minus_1 = img->Width - 1; + const GLint height_minus_1 = img->Height - 1; + GLuint i; + + (void) ctx; + (void) texUnit; + (void) lambda; + + ASSERT(tObj->WrapS == GL_CLAMP || + tObj->WrapS == GL_CLAMP_TO_EDGE || + tObj->WrapS == GL_CLAMP_TO_BORDER); + ASSERT(tObj->WrapT == GL_CLAMP || + tObj->WrapT == GL_CLAMP_TO_EDGE || + tObj->WrapT == GL_CLAMP_TO_BORDER); + ASSERT(img->Format != GL_COLOR_INDEX); + + /* XXX move Wrap mode tests outside of loops for common cases */ + for (i = 0; i < n; i++) { + GLint row, col; + /* NOTE: we DO NOT use [0, 1] texture coordinates! */ + if (tObj->WrapS == GL_CLAMP) { + col = IFLOOR( CLAMP(texcoords[i][0], 0.0F, width - 1) ); + } + else if (tObj->WrapS == GL_CLAMP_TO_EDGE) { + col = IFLOOR( CLAMP(texcoords[i][0], 0.5F, width - 0.5F) ); + } + else { + col = IFLOOR( CLAMP(texcoords[i][0], -0.5F, width + 0.5F) ); + } + if (tObj->WrapT == GL_CLAMP) { + row = IFLOOR( CLAMP(texcoords[i][1], 0.0F, height - 1) ); + } + else if (tObj->WrapT == GL_CLAMP_TO_EDGE) { + row = IFLOOR( CLAMP(texcoords[i][1], 0.5F, height - 0.5F) ); + } + else { + row = IFLOOR( CLAMP(texcoords[i][1], -0.5F, height + 0.5F) ); + } + + if (col < 0 || col > width_minus_1 || row < 0 || row > height_minus_1) + COPY_CHAN4(rgba[i], tObj->_BorderChan); + else + img->FetchTexelc(img, col, row, 0, rgba[i]); + } +} + + +static void +sample_linear_rect(GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + const struct gl_texture_image *img = tObj->Image[0][0]; + const GLfloat width = (GLfloat) img->Width; + const GLfloat height = (GLfloat) img->Height; + const GLint width_minus_1 = img->Width - 1; + const GLint height_minus_1 = img->Height - 1; + GLuint i; + + (void) ctx; + (void) texUnit; + (void) lambda; + + ASSERT(tObj->WrapS == GL_CLAMP || + tObj->WrapS == GL_CLAMP_TO_EDGE || + tObj->WrapS == GL_CLAMP_TO_BORDER); + ASSERT(tObj->WrapT == GL_CLAMP || + tObj->WrapT == GL_CLAMP_TO_EDGE || + tObj->WrapT == GL_CLAMP_TO_BORDER); + ASSERT(img->Format != GL_COLOR_INDEX); + + /* XXX lots of opportunity for optimization in this loop */ + for (i = 0; i < n; i++) { + GLfloat frow, fcol; + GLint i0, j0, i1, j1; + GLchan t00[4], t01[4], t10[4], t11[4]; + GLfloat a, b; + GLuint useBorderColor = 0; +#if CHAN_TYPE == GL_UNSIGNED_BYTE + GLint ia, ib; +#endif + + /* NOTE: we DO NOT use [0, 1] texture coordinates! */ + if (tObj->WrapS == GL_CLAMP) { + /* Not exactly what the spec says, but it matches NVIDIA output */ + fcol = CLAMP(texcoords[i][0] - 0.5F, 0.0, width_minus_1); + i0 = IFLOOR(fcol); + i1 = i0 + 1; + } + else if (tObj->WrapS == GL_CLAMP_TO_EDGE) { + fcol = CLAMP(texcoords[i][0], 0.5F, width - 0.5F); + fcol -= 0.5F; + i0 = IFLOOR(fcol); + i1 = i0 + 1; + if (i1 > width_minus_1) + i1 = width_minus_1; + } + else { + ASSERT(tObj->WrapS == GL_CLAMP_TO_BORDER); + fcol = CLAMP(texcoords[i][0], -0.5F, width + 0.5F); + fcol -= 0.5F; + i0 = IFLOOR(fcol); + i1 = i0 + 1; + } + + if (tObj->WrapT == GL_CLAMP) { + /* Not exactly what the spec says, but it matches NVIDIA output */ + frow = CLAMP(texcoords[i][1] - 0.5F, 0.0, width_minus_1); + j0 = IFLOOR(frow); + j1 = j0 + 1; + } + else if (tObj->WrapT == GL_CLAMP_TO_EDGE) { + frow = CLAMP(texcoords[i][1], 0.5F, height - 0.5F); + frow -= 0.5F; + j0 = IFLOOR(frow); + j1 = j0 + 1; + if (j1 > height_minus_1) + j1 = height_minus_1; + } + else { + ASSERT(tObj->WrapT == GL_CLAMP_TO_BORDER); + frow = CLAMP(texcoords[i][1], -0.5F, height + 0.5F); + frow -= 0.5F; + j0 = IFLOOR(frow); + j1 = j0 + 1; + } + + /* compute integer rows/columns */ + if (i0 < 0 || i0 > width_minus_1) useBorderColor |= I0BIT; + if (i1 < 0 || i1 > width_minus_1) useBorderColor |= I1BIT; + if (j0 < 0 || j0 > height_minus_1) useBorderColor |= J0BIT; + if (j1 < 0 || j1 > height_minus_1) useBorderColor |= J1BIT; + + /* get four texel samples */ + if (useBorderColor & (I0BIT | J0BIT)) + COPY_CHAN4(t00, tObj->_BorderChan); + else + img->FetchTexelc(img, i0, j0, 0, t00); + + if (useBorderColor & (I1BIT | J0BIT)) + COPY_CHAN4(t10, tObj->_BorderChan); + else + img->FetchTexelc(img, i1, j0, 0, t10); + + if (useBorderColor & (I0BIT | J1BIT)) + COPY_CHAN4(t01, tObj->_BorderChan); + else + img->FetchTexelc(img, i0, j1, 0, t01); + + if (useBorderColor & (I1BIT | J1BIT)) + COPY_CHAN4(t11, tObj->_BorderChan); + else + img->FetchTexelc(img, i1, j1, 0, t11); + + /* compute interpolants */ + a = FRAC(fcol); + b = FRAC(frow); +#if CHAN_TYPE == GL_UNSIGNED_BYTE + ia = IROUND_POS(a * ILERP_SCALE); + ib = IROUND_POS(b * ILERP_SCALE); +#endif + + /* do bilinear interpolation of texel colors */ +#if CHAN_TYPE == GL_FLOAT + rgba[i][0] = lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]); + rgba[i][1] = lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]); + rgba[i][2] = lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]); + rgba[i][3] = lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]); +#elif CHAN_TYPE == GL_UNSIGNED_SHORT + rgba[i][0] = (GLchan) (lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]) + 0.5); + rgba[i][1] = (GLchan) (lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]) + 0.5); + rgba[i][2] = (GLchan) (lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]) + 0.5); + rgba[i][3] = (GLchan) (lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]) + 0.5); +#else + ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE); + rgba[i][0] = ilerp_2d(ia, ib, t00[0], t10[0], t01[0], t11[0]); + rgba[i][1] = ilerp_2d(ia, ib, t00[1], t10[1], t01[1], t11[1]); + rgba[i][2] = ilerp_2d(ia, ib, t00[2], t10[2], t01[2], t11[2]); + rgba[i][3] = ilerp_2d(ia, ib, t00[3], t10[3], t01[3], t11[3]); +#endif + } +} + + +static void +sample_lambda_rect( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat texcoords[][4], const GLfloat lambda[], + GLchan rgba[][4]) +{ + GLuint minStart, minEnd, magStart, magEnd; + + /* We only need lambda to decide between minification and magnification. + * There is no mipmapping with rectangular textures. + */ + compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], + n, lambda, &minStart, &minEnd, &magStart, &magEnd); + + if (minStart < minEnd) { + if (tObj->MinFilter == GL_NEAREST) { + sample_nearest_rect( ctx, texUnit, tObj, minEnd - minStart, + texcoords + minStart, NULL, rgba + minStart); + } + else { + sample_linear_rect( ctx, texUnit, tObj, minEnd - minStart, + texcoords + minStart, NULL, rgba + minStart); + } + } + if (magStart < magEnd) { + if (tObj->MagFilter == GL_NEAREST) { + sample_nearest_rect( ctx, texUnit, tObj, magEnd - magStart, + texcoords + magStart, NULL, rgba + magStart); + } + else { + sample_linear_rect( ctx, texUnit, tObj, magEnd - magStart, + texcoords + magStart, NULL, rgba + magStart); + } + } +} + + + +/* + * Sample a shadow/depth texture. + */ +static void +sample_depth_texture( GLcontext *ctx, GLuint unit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat texcoords[][4], const GLfloat lambda[], + GLchan texel[][4] ) +{ + const GLint baseLevel = tObj->BaseLevel; + const struct gl_texture_image *texImage = tObj->Image[0][baseLevel]; + const GLuint width = texImage->Width; + const GLuint height = texImage->Height; + GLchan ambient; + GLenum function; + GLchan result; + + (void) lambda; + (void) unit; + + ASSERT(tObj->Image[0][tObj->BaseLevel]->Format == GL_DEPTH_COMPONENT); + ASSERT(tObj->Target == GL_TEXTURE_1D || + tObj->Target == GL_TEXTURE_2D || + tObj->Target == GL_TEXTURE_RECTANGLE_NV); + + UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->ShadowAmbient); + + /* XXXX if tObj->MinFilter != tObj->MagFilter, we're ignoring lambda */ + + /* XXX this could be precomputed and saved in the texture object */ + if (tObj->CompareFlag) { + /* GL_SGIX_shadow */ + if (tObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { + function = GL_LEQUAL; + } + else { + ASSERT(tObj->CompareOperator == GL_TEXTURE_GEQUAL_R_SGIX); + function = GL_GEQUAL; + } + } + else if (tObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) { + /* GL_ARB_shadow */ + function = tObj->CompareFunc; + } + else { + function = GL_NONE; /* pass depth through as grayscale */ + } + + if (tObj->MagFilter == GL_NEAREST) { + GLuint i; + for (i = 0; i < n; i++) { + GLfloat depthSample; + GLint col, row; + /* XXX fix for texture rectangle! */ + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoords[i][0], width, col); + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoords[i][1], height, row); + texImage->FetchTexelf(texImage, col, row, 0, &depthSample); + + switch (function) { + case GL_LEQUAL: + result = (texcoords[i][2] <= depthSample) ? CHAN_MAX : ambient; + break; + case GL_GEQUAL: + result = (texcoords[i][2] >= depthSample) ? CHAN_MAX : ambient; + break; + case GL_LESS: + result = (texcoords[i][2] < depthSample) ? CHAN_MAX : ambient; + break; + case GL_GREATER: + result = (texcoords[i][2] > depthSample) ? CHAN_MAX : ambient; + break; + case GL_EQUAL: + result = (texcoords[i][2] == depthSample) ? CHAN_MAX : ambient; + break; + case GL_NOTEQUAL: + result = (texcoords[i][2] != depthSample) ? CHAN_MAX : ambient; + break; + case GL_ALWAYS: + result = CHAN_MAX; + break; + case GL_NEVER: + result = ambient; + break; + case GL_NONE: + CLAMPED_FLOAT_TO_CHAN(result, depthSample); + break; + default: + _mesa_problem(ctx, "Bad compare func in sample_depth_texture"); + return; + } + + switch (tObj->DepthMode) { + case GL_LUMINANCE: + texel[i][RCOMP] = result; + texel[i][GCOMP] = result; + texel[i][BCOMP] = result; + texel[i][ACOMP] = CHAN_MAX; + break; + case GL_INTENSITY: + texel[i][RCOMP] = result; + texel[i][GCOMP] = result; + texel[i][BCOMP] = result; + texel[i][ACOMP] = result; + break; + case GL_ALPHA: + texel[i][RCOMP] = 0; + texel[i][GCOMP] = 0; + texel[i][BCOMP] = 0; + texel[i][ACOMP] = result; + break; + default: + _mesa_problem(ctx, "Bad depth texture mode"); + } + } + } + else { + GLuint i; + ASSERT(tObj->MagFilter == GL_LINEAR); + for (i = 0; i < n; i++) { + GLfloat depth00, depth01, depth10, depth11; + GLint i0, i1, j0, j1; + GLfloat u, v; + GLuint useBorderTexel; + + /* XXX fix for texture rectangle! */ + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoords[i][0], u, width, i0, i1); + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoords[i][1], v, height,j0, j1); + + useBorderTexel = 0; + if (texImage->Border) { + i0 += texImage->Border; + i1 += texImage->Border; + j0 += texImage->Border; + j1 += texImage->Border; + } + else { + if (i0 < 0 || i0 >= (GLint) width) useBorderTexel |= I0BIT; + if (i1 < 0 || i1 >= (GLint) width) useBorderTexel |= I1BIT; + if (j0 < 0 || j0 >= (GLint) height) useBorderTexel |= J0BIT; + if (j1 < 0 || j1 >= (GLint) height) useBorderTexel |= J1BIT; + } + + /* get four depth samples from the texture */ + if (useBorderTexel & (I0BIT | J0BIT)) { + depth00 = 1.0; + } + else { + texImage->FetchTexelf(texImage, i0, j0, 0, &depth00); + } + if (useBorderTexel & (I1BIT | J0BIT)) { + depth10 = 1.0; + } + else { + texImage->FetchTexelf(texImage, i1, j0, 0, &depth10); + } + if (useBorderTexel & (I0BIT | J1BIT)) { + depth01 = 1.0; + } + else { + texImage->FetchTexelf(texImage, i0, j1, 0, &depth01); + } + if (useBorderTexel & (I1BIT | J1BIT)) { + depth11 = 1.0; + } + else { + texImage->FetchTexelf(texImage, i1, j1, 0, &depth11); + } + + if (0) { + /* compute a single weighted depth sample and do one comparison */ + const GLfloat a = FRAC(u + 1.0F); + const GLfloat b = FRAC(v + 1.0F); + const GLfloat depthSample + = lerp_2d(a, b, depth00, depth10, depth01, depth11); + if ((depthSample <= texcoords[i][2] && function == GL_LEQUAL) || + (depthSample >= texcoords[i][2] && function == GL_GEQUAL)) { + result = ambient; + } + else { + result = CHAN_MAX; + } + } + else { + /* Do four depth/R comparisons and compute a weighted result. + * If this touches on somebody's I.P., I'll remove this code + * upon request. + */ + const GLfloat d = (CHAN_MAXF - (GLfloat) ambient) * 0.25F; + GLfloat luminance = CHAN_MAXF; + + switch (function) { + case GL_LEQUAL: + if (depth00 <= texcoords[i][2]) luminance -= d; + if (depth01 <= texcoords[i][2]) luminance -= d; + if (depth10 <= texcoords[i][2]) luminance -= d; + if (depth11 <= texcoords[i][2]) luminance -= d; + result = (GLchan) luminance; + break; + case GL_GEQUAL: + if (depth00 >= texcoords[i][2]) luminance -= d; + if (depth01 >= texcoords[i][2]) luminance -= d; + if (depth10 >= texcoords[i][2]) luminance -= d; + if (depth11 >= texcoords[i][2]) luminance -= d; + result = (GLchan) luminance; + break; + case GL_LESS: + if (depth00 < texcoords[i][2]) luminance -= d; + if (depth01 < texcoords[i][2]) luminance -= d; + if (depth10 < texcoords[i][2]) luminance -= d; + if (depth11 < texcoords[i][2]) luminance -= d; + result = (GLchan) luminance; + break; + case GL_GREATER: + if (depth00 > texcoords[i][2]) luminance -= d; + if (depth01 > texcoords[i][2]) luminance -= d; + if (depth10 > texcoords[i][2]) luminance -= d; + if (depth11 > texcoords[i][2]) luminance -= d; + result = (GLchan) luminance; + break; + case GL_EQUAL: + if (depth00 == texcoords[i][2]) luminance -= d; + if (depth01 == texcoords[i][2]) luminance -= d; + if (depth10 == texcoords[i][2]) luminance -= d; + if (depth11 == texcoords[i][2]) luminance -= d; + result = (GLchan) luminance; + break; + case GL_NOTEQUAL: + if (depth00 != texcoords[i][2]) luminance -= d; + if (depth01 != texcoords[i][2]) luminance -= d; + if (depth10 != texcoords[i][2]) luminance -= d; + if (depth11 != texcoords[i][2]) luminance -= d; + result = (GLchan) luminance; + break; + case GL_ALWAYS: + result = 0; + break; + case GL_NEVER: + result = CHAN_MAX; + break; + case GL_NONE: + /* ordinary bilinear filtering */ + { + const GLfloat a = FRAC(u + 1.0F); + const GLfloat b = FRAC(v + 1.0F); + const GLfloat depthSample + = lerp_2d(a, b, depth00, depth10, depth01, depth11); + CLAMPED_FLOAT_TO_CHAN(result, depthSample); + } + break; + default: + _mesa_problem(ctx, "Bad compare func in sample_depth_texture"); + return; + } + } + + switch (tObj->DepthMode) { + case GL_LUMINANCE: + texel[i][RCOMP] = result; + texel[i][GCOMP] = result; + texel[i][BCOMP] = result; + texel[i][ACOMP] = CHAN_MAX; + break; + case GL_INTENSITY: + texel[i][RCOMP] = result; + texel[i][GCOMP] = result; + texel[i][BCOMP] = result; + texel[i][ACOMP] = result; + break; + case GL_ALPHA: + texel[i][RCOMP] = 0; + texel[i][GCOMP] = 0; + texel[i][BCOMP] = 0; + texel[i][ACOMP] = result; + break; + default: + _mesa_problem(ctx, "Bad depth texture mode"); + } + } /* for */ + } /* if filter */ +} + + +#if 0 +/* + * Experimental depth texture sampling function. + */ +static void +sample_depth_texture2(const GLcontext *ctx, + const struct gl_texture_unit *texUnit, + GLuint n, const GLfloat texcoords[][4], + GLchan texel[][4]) +{ + const struct gl_texture_object *texObj = texUnit->_Current; + const GLint baseLevel = texObj->BaseLevel; + const struct gl_texture_image *texImage = texObj->Image[0][baseLevel]; + const GLuint width = texImage->Width; + const GLuint height = texImage->Height; + GLchan ambient; + GLboolean lequal, gequal; + + if (texObj->Target != GL_TEXTURE_2D) { + _mesa_problem(ctx, "only 2-D depth textures supported at this time"); + return; + } + + if (texObj->MinFilter != texObj->MagFilter) { + _mesa_problem(ctx, "mipmapped depth textures not supported at this time"); + return; + } + + /* XXX the GL_SGIX_shadow extension spec doesn't say what to do if + * GL_TEXTURE_COMPARE_SGIX == GL_TRUE but the current texture object + * isn't a depth texture. + */ + if (texImage->Format != GL_DEPTH_COMPONENT) { + _mesa_problem(ctx,"GL_TEXTURE_COMPARE_SGIX enabled with non-depth texture"); + return; + } + + UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->ShadowAmbient); + + if (texObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { + lequal = GL_TRUE; + gequal = GL_FALSE; + } + else { + lequal = GL_FALSE; + gequal = GL_TRUE; + } + + { + GLuint i; + for (i = 0; i < n; i++) { + const GLint K = 3; + GLint col, row, ii, jj, imin, imax, jmin, jmax, samples, count; + GLfloat w; + GLchan lum; + COMPUTE_NEAREST_TEXEL_LOCATION(texObj->WrapS, texcoords[i][0], + width, col); + COMPUTE_NEAREST_TEXEL_LOCATION(texObj->WrapT, texcoords[i][1], + height, row); + + imin = col - K; + imax = col + K; + jmin = row - K; + jmax = row + K; + + if (imin < 0) imin = 0; + if (imax >= width) imax = width - 1; + if (jmin < 0) jmin = 0; + if (jmax >= height) jmax = height - 1; + + samples = (imax - imin + 1) * (jmax - jmin + 1); + count = 0; + for (jj = jmin; jj <= jmax; jj++) { + for (ii = imin; ii <= imax; ii++) { + GLfloat depthSample; + texImage->FetchTexelf(texImage, ii, jj, 0, &depthSample); + if ((depthSample <= r[i] && lequal) || + (depthSample >= r[i] && gequal)) { + count++; + } + } + } + + w = (GLfloat) count / (GLfloat) samples; + w = CHAN_MAXF - w * (CHAN_MAXF - (GLfloat) ambient); + lum = (GLint) w; + + texel[i][RCOMP] = lum; + texel[i][GCOMP] = lum; + texel[i][BCOMP] = lum; + texel[i][ACOMP] = CHAN_MAX; + } + } +} +#endif + + +/** + * We use this function when a texture object is in an "incomplete" state. + * When a fragment program attempts to sample an incomplete texture we + * return black (see issue 23 in GL_ARB_fragment_program spec). + * Note: fragment programss don't observe the texture enable/disable flags. + */ +static void +null_sample_func( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat texcoords[][4], const GLfloat lambda[], + GLchan rgba[][4]) +{ + GLuint i; + (void) ctx; + (void) texUnit; + (void) tObj; + (void) texcoords; + (void) lambda; + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = 0; + rgba[i][GCOMP] = 0; + rgba[i][BCOMP] = 0; + rgba[i][ACOMP] = CHAN_MAX; + } +} + + +/** + * Setup the texture sampling function for this texture object. + */ +texture_sample_func +_swrast_choose_texture_sample_func( GLcontext *ctx, + const struct gl_texture_object *t ) +{ + if (!t || !t->Complete) { + return &null_sample_func; + } + else { + const GLboolean needLambda = (GLboolean) (t->MinFilter != t->MagFilter); + const GLenum format = t->Image[0][t->BaseLevel]->Format; + + switch (t->Target) { + case GL_TEXTURE_1D: + if (format == GL_DEPTH_COMPONENT) { + return &sample_depth_texture; + } + else if (needLambda) { + return &sample_lambda_1d; + } + else if (t->MinFilter == GL_LINEAR) { + return &sample_linear_1d; + } + else { + ASSERT(t->MinFilter == GL_NEAREST); + return &sample_nearest_1d; + } + case GL_TEXTURE_2D: + if (format == GL_DEPTH_COMPONENT) { + return &sample_depth_texture; + } + else if (needLambda) { + return &sample_lambda_2d; + } + else if (t->MinFilter == GL_LINEAR) { + return &sample_linear_2d; + } + else { + GLint baseLevel = t->BaseLevel; + ASSERT(t->MinFilter == GL_NEAREST); + if (t->WrapS == GL_REPEAT && + t->WrapT == GL_REPEAT && + t->_IsPowerOfTwo && + t->Image[0][baseLevel]->Border == 0 && + t->Image[0][baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGB) { + return &opt_sample_rgb_2d; + } + else if (t->WrapS == GL_REPEAT && + t->WrapT == GL_REPEAT && + t->_IsPowerOfTwo && + t->Image[0][baseLevel]->Border == 0 && + t->Image[0][baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGBA) { + return &opt_sample_rgba_2d; + } + else { + return &sample_nearest_2d; + } + } + case GL_TEXTURE_3D: + if (needLambda) { + return &sample_lambda_3d; + } + else if (t->MinFilter == GL_LINEAR) { + return &sample_linear_3d; + } + else { + ASSERT(t->MinFilter == GL_NEAREST); + return &sample_nearest_3d; + } + case GL_TEXTURE_CUBE_MAP: + if (needLambda) { + return &sample_lambda_cube; + } + else if (t->MinFilter == GL_LINEAR) { + return &sample_linear_cube; + } + else { + ASSERT(t->MinFilter == GL_NEAREST); + return &sample_nearest_cube; + } + case GL_TEXTURE_RECTANGLE_NV: + if (needLambda) { + return &sample_lambda_rect; + } + else if (t->MinFilter == GL_LINEAR) { + return &sample_linear_rect; + } + else { + ASSERT(t->MinFilter == GL_NEAREST); + return &sample_nearest_rect; + } + default: + _mesa_problem(ctx, + "invalid target in _swrast_choose_texture_sample_func"); + return &null_sample_func; + } + } +} + + +#define PROD(A,B) ( (GLuint)(A) * ((GLuint)(B)+1) ) +#define S_PROD(A,B) ( (GLint)(A) * ((GLint)(B)+1) ) + + +/** + * Do texture application for GL_ARB/EXT_texture_env_combine. + * This function also supports GL_{EXT,ARB}_texture_env_dot3 and + * GL_ATI_texture_env_combine3. Since "classic" texture environments are + * implemented using GL_ARB_texture_env_combine-like state, this same function + * is used for classic texture environment application as well. + * + * \param ctx rendering context + * \param textureUnit the texture unit to apply + * \param n number of fragments to process (span width) + * \param primary_rgba incoming fragment color array + * \param texelBuffer pointer to texel colors for all texture units + * + * \param rgba incoming colors, which get modified here + */ +static INLINE void +texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, + CONST GLchan (*primary_rgba)[4], + CONST GLchan *texelBuffer, + GLchan (*rgba)[4] ) +{ + const struct gl_texture_unit *textureUnit = &(ctx->Texture.Unit[unit]); + const GLchan (*argRGB [3])[4]; + const GLchan (*argA [3])[4]; + const GLuint RGBshift = textureUnit->_CurrentCombine->ScaleShiftRGB; + const GLuint Ashift = textureUnit->_CurrentCombine->ScaleShiftA; +#if CHAN_TYPE == GL_FLOAT + const GLchan RGBmult = (GLfloat) (1 << RGBshift); + const GLchan Amult = (GLfloat) (1 << Ashift); + static const GLchan one[4] = { 1.0, 1.0, 1.0, 1.0 }; + static const GLchan zero[4] = { 0.0, 0.0, 0.0, 0.0 }; +#else + const GLint half = (CHAN_MAX + 1) / 2; + static const GLchan one[4] = { CHAN_MAX, CHAN_MAX, CHAN_MAX, CHAN_MAX }; + static const GLchan zero[4] = { 0, 0, 0, 0 }; +#endif + GLuint i, j; + GLuint numColorArgs; + GLuint numAlphaArgs; + + /* GLchan ccolor[3][4]; */ + DEFMNARRAY(GLchan, ccolor, 3, 3 * MAX_WIDTH, 4); /* mac 32k limitation */ + CHECKARRAY(ccolor, return); /* mac 32k limitation */ + + ASSERT(ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine); + ASSERT(SWRAST_CONTEXT(ctx)->_AnyTextureCombine); + + + /* + printf("modeRGB 0x%x modeA 0x%x srcRGB1 0x%x srcA1 0x%x srcRGB2 0x%x srcA2 0x%x\n", + textureUnit->_CurrentCombine->ModeRGB, + textureUnit->_CurrentCombine->ModeA, + textureUnit->_CurrentCombine->SourceRGB[0], + textureUnit->_CurrentCombine->SourceA[0], + textureUnit->_CurrentCombine->SourceRGB[1], + textureUnit->_CurrentCombine->SourceA[1]); + */ + + /* + * Do operand setup for up to 3 operands. Loop over the terms. + */ + numColorArgs = textureUnit->_CurrentCombine->_NumArgsRGB; + numAlphaArgs = textureUnit->_CurrentCombine->_NumArgsA; + + for (j = 0; j < numColorArgs; j++) { + const GLenum srcRGB = textureUnit->_CurrentCombine->SourceRGB[j]; + + + switch (srcRGB) { + case GL_TEXTURE: + argRGB[j] = (const GLchan (*)[4]) + (texelBuffer + unit * (n * 4 * sizeof(GLchan))); + break; + case GL_PRIMARY_COLOR: + argRGB[j] = primary_rgba; + break; + case GL_PREVIOUS: + argRGB[j] = (const GLchan (*)[4]) rgba; + break; + case GL_CONSTANT: + { + GLchan (*c)[4] = ccolor[j]; + GLchan red, green, blue, alpha; + UNCLAMPED_FLOAT_TO_CHAN(red, textureUnit->EnvColor[0]); + UNCLAMPED_FLOAT_TO_CHAN(green, textureUnit->EnvColor[1]); + UNCLAMPED_FLOAT_TO_CHAN(blue, textureUnit->EnvColor[2]); + UNCLAMPED_FLOAT_TO_CHAN(alpha, textureUnit->EnvColor[3]); + for (i = 0; i < n; i++) { + c[i][RCOMP] = red; + c[i][GCOMP] = green; + c[i][BCOMP] = blue; + c[i][ACOMP] = alpha; + } + argRGB[j] = (const GLchan (*)[4]) ccolor[j]; + } + break; + /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources. + */ + case GL_ZERO: + argRGB[j] = & zero; + break; + case GL_ONE: + argRGB[j] = & one; + break; + default: + /* ARB_texture_env_crossbar source */ + { + const GLuint srcUnit = srcRGB - GL_TEXTURE0; + ASSERT(srcUnit < ctx->Const.MaxTextureUnits); + if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) + return; + argRGB[j] = (const GLchan (*)[4]) + (texelBuffer + srcUnit * (n * 4 * sizeof(GLchan))); + } + } + + if (textureUnit->_CurrentCombine->OperandRGB[j] != GL_SRC_COLOR) { + const GLchan (*src)[4] = argRGB[j]; + GLchan (*dst)[4] = ccolor[j]; + + /* point to new arg[j] storage */ + argRGB[j] = (const GLchan (*)[4]) ccolor[j]; + + if (textureUnit->_CurrentCombine->OperandRGB[j] == GL_ONE_MINUS_SRC_COLOR) { + for (i = 0; i < n; i++) { + dst[i][RCOMP] = CHAN_MAX - src[i][RCOMP]; + dst[i][GCOMP] = CHAN_MAX - src[i][GCOMP]; + dst[i][BCOMP] = CHAN_MAX - src[i][BCOMP]; + } + } + else if (textureUnit->_CurrentCombine->OperandRGB[j] == GL_SRC_ALPHA) { + for (i = 0; i < n; i++) { + dst[i][RCOMP] = src[i][ACOMP]; + dst[i][GCOMP] = src[i][ACOMP]; + dst[i][BCOMP] = src[i][ACOMP]; + } + } + else { + ASSERT(textureUnit->_CurrentCombine->OperandRGB[j] ==GL_ONE_MINUS_SRC_ALPHA); + for (i = 0; i < n; i++) { + dst[i][RCOMP] = CHAN_MAX - src[i][ACOMP]; + dst[i][GCOMP] = CHAN_MAX - src[i][ACOMP]; + dst[i][BCOMP] = CHAN_MAX - src[i][ACOMP]; + } + } + } + } + + + for (j = 0; j < numAlphaArgs; j++) { + const GLenum srcA = textureUnit->_CurrentCombine->SourceA[j]; + + switch (srcA) { + case GL_TEXTURE: + argA[j] = (const GLchan (*)[4]) + (texelBuffer + unit * (n * 4 * sizeof(GLchan))); + break; + case GL_PRIMARY_COLOR: + argA[j] = primary_rgba; + break; + case GL_PREVIOUS: + argA[j] = (const GLchan (*)[4]) rgba; + break; + case GL_CONSTANT: + { + GLchan alpha, (*c)[4] = ccolor[j]; + UNCLAMPED_FLOAT_TO_CHAN(alpha, textureUnit->EnvColor[3]); + for (i = 0; i < n; i++) + c[i][ACOMP] = alpha; + argA[j] = (const GLchan (*)[4]) ccolor[j]; + } + break; + /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources. + */ + case GL_ZERO: + argA[j] = & zero; + break; + case GL_ONE: + argA[j] = & one; + break; + default: + /* ARB_texture_env_crossbar source */ + { + const GLuint srcUnit = srcA - GL_TEXTURE0; + ASSERT(srcUnit < ctx->Const.MaxTextureUnits); + if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) + return; + argA[j] = (const GLchan (*)[4]) + (texelBuffer + srcUnit * (n * 4 * sizeof(GLchan))); + } + } + + if (textureUnit->_CurrentCombine->OperandA[j] == GL_ONE_MINUS_SRC_ALPHA) { + const GLchan (*src)[4] = argA[j]; + GLchan (*dst)[4] = ccolor[j]; + argA[j] = (const GLchan (*)[4]) ccolor[j]; + for (i = 0; i < n; i++) { + dst[i][ACOMP] = CHAN_MAX - src[i][ACOMP]; + } + } + } + + /* + * Do the texture combine. + */ + switch (textureUnit->_CurrentCombine->ModeRGB) { + case GL_REPLACE: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + if (RGBshift) { + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][RCOMP] = arg0[i][RCOMP] * RGBmult; + rgba[i][GCOMP] = arg0[i][GCOMP] * RGBmult; + rgba[i][BCOMP] = arg0[i][BCOMP] * RGBmult; +#else + GLuint r = (GLuint) arg0[i][RCOMP] << RGBshift; + GLuint g = (GLuint) arg0[i][GCOMP] << RGBshift; + GLuint b = (GLuint) arg0[i][BCOMP] << RGBshift; + rgba[i][RCOMP] = MIN2(r, CHAN_MAX); + rgba[i][GCOMP] = MIN2(g, CHAN_MAX); + rgba[i][BCOMP] = MIN2(b, CHAN_MAX); +#endif + } + } + else { + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = arg0[i][RCOMP]; + rgba[i][GCOMP] = arg0[i][GCOMP]; + rgba[i][BCOMP] = arg0[i][BCOMP]; + } + } + } + break; + case GL_MODULATE: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - RGBshift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][RCOMP] = arg0[i][RCOMP] * arg1[i][RCOMP] * RGBmult; + rgba[i][GCOMP] = arg0[i][GCOMP] * arg1[i][GCOMP] * RGBmult; + rgba[i][BCOMP] = arg0[i][BCOMP] * arg1[i][BCOMP] * RGBmult; +#else + GLuint r = PROD(arg0[i][RCOMP], arg1[i][RCOMP]) >> shift; + GLuint g = PROD(arg0[i][GCOMP], arg1[i][GCOMP]) >> shift; + GLuint b = PROD(arg0[i][BCOMP], arg1[i][BCOMP]) >> shift; + rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); + rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); + rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); +#endif + } + } + break; + case GL_ADD: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP]) * RGBmult; + rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP]) * RGBmult; + rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP]) * RGBmult; +#else + GLint r = ((GLint) arg0[i][RCOMP] + (GLint) arg1[i][RCOMP]) << RGBshift; + GLint g = ((GLint) arg0[i][GCOMP] + (GLint) arg1[i][GCOMP]) << RGBshift; + GLint b = ((GLint) arg0[i][BCOMP] + (GLint) arg1[i][BCOMP]) << RGBshift; + rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); + rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); + rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); +#endif + } + } + break; + case GL_ADD_SIGNED: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * RGBmult; + rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * RGBmult; + rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * RGBmult; +#else + GLint r = (GLint) arg0[i][RCOMP] + (GLint) arg1[i][RCOMP] -half; + GLint g = (GLint) arg0[i][GCOMP] + (GLint) arg1[i][GCOMP] -half; + GLint b = (GLint) arg0[i][BCOMP] + (GLint) arg1[i][BCOMP] -half; + r = (r < 0) ? 0 : r << RGBshift; + g = (g < 0) ? 0 : g << RGBshift; + b = (b < 0) ? 0 : b << RGBshift; + rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); + rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); + rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); +#endif + } + } + break; + case GL_INTERPOLATE: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - RGBshift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][RCOMP] = (arg0[i][RCOMP] * arg2[i][RCOMP] + + arg1[i][RCOMP] * (CHAN_MAXF - arg2[i][RCOMP])) * RGBmult; + rgba[i][GCOMP] = (arg0[i][GCOMP] * arg2[i][GCOMP] + + arg1[i][GCOMP] * (CHAN_MAXF - arg2[i][GCOMP])) * RGBmult; + rgba[i][BCOMP] = (arg0[i][BCOMP] * arg2[i][BCOMP] + + arg1[i][BCOMP] * (CHAN_MAXF - arg2[i][BCOMP])) * RGBmult; +#else + GLuint r = (PROD(arg0[i][RCOMP], arg2[i][RCOMP]) + + PROD(arg1[i][RCOMP], CHAN_MAX - arg2[i][RCOMP])) + >> shift; + GLuint g = (PROD(arg0[i][GCOMP], arg2[i][GCOMP]) + + PROD(arg1[i][GCOMP], CHAN_MAX - arg2[i][GCOMP])) + >> shift; + GLuint b = (PROD(arg0[i][BCOMP], arg2[i][BCOMP]) + + PROD(arg1[i][BCOMP], CHAN_MAX - arg2[i][BCOMP])) + >> shift; + rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); + rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); + rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); +#endif + } + } + break; + case GL_SUBTRACT: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][RCOMP] = (arg0[i][RCOMP] - arg1[i][RCOMP]) * RGBmult; + rgba[i][GCOMP] = (arg0[i][GCOMP] - arg1[i][GCOMP]) * RGBmult; + rgba[i][BCOMP] = (arg0[i][BCOMP] - arg1[i][BCOMP]) * RGBmult; +#else + GLint r = ((GLint) arg0[i][RCOMP] - (GLint) arg1[i][RCOMP]) << RGBshift; + GLint g = ((GLint) arg0[i][GCOMP] - (GLint) arg1[i][GCOMP]) << RGBshift; + GLint b = ((GLint) arg0[i][BCOMP] - (GLint) arg1[i][BCOMP]) << RGBshift; + rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); + rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); + rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); +#endif + } + } + break; + case GL_DOT3_RGB_EXT: + case GL_DOT3_RGBA_EXT: + { + /* Do not scale the result by 1 2 or 4 */ + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + GLchan dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + + (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + + (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) + * 4.0F; + dot = CLAMP(dot, 0.0F, CHAN_MAXF); +#else + GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - half, + (GLint)arg1[i][RCOMP] - half) + + S_PROD((GLint)arg0[i][GCOMP] - half, + (GLint)arg1[i][GCOMP] - half) + + S_PROD((GLint)arg0[i][BCOMP] - half, + (GLint)arg1[i][BCOMP] - half)) >> 6; + dot = CLAMP(dot, 0, CHAN_MAX); +#endif + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLchan) dot; + } + } + break; + case GL_DOT3_RGB: + case GL_DOT3_RGBA: + { + /* DO scale the result by 1 2 or 4 */ + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + GLchan dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + + (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + + (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) + * 4.0F * RGBmult; + dot = CLAMP(dot, 0.0, CHAN_MAXF); +#else + GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - half, + (GLint)arg1[i][RCOMP] - half) + + S_PROD((GLint)arg0[i][GCOMP] - half, + (GLint)arg1[i][GCOMP] - half) + + S_PROD((GLint)arg0[i][BCOMP] - half, + (GLint)arg1[i][BCOMP] - half)) >> 6; + dot <<= RGBshift; + dot = CLAMP(dot, 0, CHAN_MAX); +#endif + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLchan) dot; + } + } + break; + case GL_MODULATE_ADD_ATI: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - RGBshift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + arg1[i][RCOMP]) * RGBmult; + rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + arg1[i][GCOMP]) * RGBmult; + rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + arg1[i][BCOMP]) * RGBmult; +#else + GLuint r = (PROD(arg0[i][RCOMP], arg2[i][RCOMP]) + + ((GLuint) arg1[i][RCOMP] << CHAN_BITS)) >> shift; + GLuint g = (PROD(arg0[i][GCOMP], arg2[i][GCOMP]) + + ((GLuint) arg1[i][GCOMP] << CHAN_BITS)) >> shift; + GLuint b = (PROD(arg0[i][BCOMP], arg2[i][BCOMP]) + + ((GLuint) arg1[i][BCOMP] << CHAN_BITS)) >> shift; + rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); + rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); + rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); +#endif + } + } + break; + case GL_MODULATE_SIGNED_ADD_ATI: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - RGBshift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + arg1[i][RCOMP] - 0.5) * RGBmult; + rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + arg1[i][GCOMP] - 0.5) * RGBmult; + rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + arg1[i][BCOMP] - 0.5) * RGBmult; +#else + GLint r = (S_PROD(arg0[i][RCOMP], arg2[i][RCOMP]) + + (((GLint) arg1[i][RCOMP] - half) << CHAN_BITS)) + >> shift; + GLint g = (S_PROD(arg0[i][GCOMP], arg2[i][GCOMP]) + + (((GLint) arg1[i][GCOMP] - half) << CHAN_BITS)) + >> shift; + GLint b = (S_PROD(arg0[i][BCOMP], arg2[i][BCOMP]) + + (((GLint) arg1[i][BCOMP] - half) << CHAN_BITS)) + >> shift; + rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); + rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); + rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); +#endif + } + } + break; + case GL_MODULATE_SUBTRACT_ATI: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - RGBshift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) - arg1[i][RCOMP]) * RGBmult; + rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) - arg1[i][GCOMP]) * RGBmult; + rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) - arg1[i][BCOMP]) * RGBmult; +#else + GLint r = (S_PROD(arg0[i][RCOMP], arg2[i][RCOMP]) + - ((GLint) arg1[i][RCOMP] << CHAN_BITS)) + >> shift; + GLint g = (S_PROD(arg0[i][GCOMP], arg2[i][GCOMP]) + - ((GLint) arg1[i][GCOMP] << CHAN_BITS)) + >> shift; + GLint b = (S_PROD(arg0[i][BCOMP], arg2[i][BCOMP]) + - ((GLint) arg1[i][BCOMP] << CHAN_BITS)) + >> shift; + rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); + rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); + rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); +#endif + } + } + break; + default: + _mesa_problem(ctx, "invalid combine mode"); + } + + switch (textureUnit->_CurrentCombine->ModeA) { + case GL_REPLACE: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; + if (Ashift) { + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + GLchan a = arg0[i][ACOMP] * Amult; +#else + GLuint a = (GLuint) arg0[i][ACOMP] << Ashift; +#endif + rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); + } + } + else { + for (i = 0; i < n; i++) { + rgba[i][ACOMP] = arg0[i][ACOMP]; + } + } + } + break; + case GL_MODULATE: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - Ashift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][ACOMP] = arg0[i][ACOMP] * arg1[i][ACOMP] * Amult; +#else + GLuint a = (PROD(arg0[i][ACOMP], arg1[i][ACOMP]) >> shift); + rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); +#endif + } + } + break; + case GL_ADD: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP]) * Amult; +#else + GLint a = ((GLint) arg0[i][ACOMP] + arg1[i][ACOMP]) << Ashift; + rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); +#endif + } + } + break; + case GL_ADD_SIGNED: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP] - 0.5F) * Amult; +#else + GLint a = (GLint) arg0[i][ACOMP] + (GLint) arg1[i][ACOMP] -half; + a = (a < 0) ? 0 : a << Ashift; + rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); +#endif + } + } + break; + case GL_INTERPOLATE: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; + const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - Ashift; +#endif + for (i=0; i> shift; + rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); +#endif + } + } + break; + case GL_SUBTRACT: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][ACOMP] = (arg0[i][ACOMP] - arg1[i][ACOMP]) * Amult; +#else + GLint a = ((GLint) arg0[i][ACOMP] - (GLint) arg1[i][ACOMP]) << Ashift; + rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); +#endif + } + } + break; + case GL_MODULATE_ADD_ATI: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; + const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - Ashift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + arg1[i][ACOMP]) * Amult; +#else + GLint a = (PROD(arg0[i][ACOMP], arg2[i][ACOMP]) + + ((GLuint) arg1[i][ACOMP] << CHAN_BITS)) + >> shift; + rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); +#endif + } + } + break; + case GL_MODULATE_SIGNED_ADD_ATI: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; + const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - Ashift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + arg1[i][ACOMP] - 0.5F) * Amult; +#else + GLint a = (S_PROD(arg0[i][ACOMP], arg2[i][ACOMP]) + + (((GLint) arg1[i][ACOMP] - half) << CHAN_BITS)) + >> shift; + rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); +#endif + } + } + break; + case GL_MODULATE_SUBTRACT_ATI: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; + const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - Ashift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) - arg1[i][ACOMP]) * Amult; +#else + GLint a = (S_PROD(arg0[i][ACOMP], arg2[i][ACOMP]) + - ((GLint) arg1[i][ACOMP] << CHAN_BITS)) + >> shift; + rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); +#endif + } + } + break; + default: + _mesa_problem(ctx, "invalid combine mode"); + } + + /* Fix the alpha component for GL_DOT3_RGBA_EXT/ARB combining. + * This is kind of a kludge. It would have been better if the spec + * were written such that the GL_COMBINE_ALPHA value could be set to + * GL_DOT3. + */ + if (textureUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA_EXT || + textureUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA) { + for (i = 0; i < n; i++) { + rgba[i][ACOMP] = rgba[i][RCOMP]; + } + } + UNDEFARRAY(ccolor); /* mac 32k limitation */ +} +#undef PROD + + +/** + * Apply a conventional OpenGL texture env mode (REPLACE, ADD, BLEND, + * MODULATE, or DECAL) to an array of fragments. + * Input: textureUnit - pointer to texture unit to apply + * format - base internal texture format + * n - number of fragments + * primary_rgba - primary colors (may alias rgba for single texture) + * texels - array of texel colors + * InOut: rgba - incoming fragment colors modified by texel colors + * according to the texture environment mode. + */ +static void +texture_apply( const GLcontext *ctx, + const struct gl_texture_unit *texUnit, + GLuint n, + CONST GLchan primary_rgba[][4], CONST GLchan texel[][4], + GLchan rgba[][4] ) +{ + GLint baseLevel; + GLuint i; + GLint Rc, Gc, Bc, Ac; + GLenum format; + (void) primary_rgba; + + ASSERT(texUnit); + ASSERT(texUnit->_Current); + + baseLevel = texUnit->_Current->BaseLevel; + ASSERT(texUnit->_Current->Image[0][baseLevel]); + + format = texUnit->_Current->Image[0][baseLevel]->Format; + + if (format == GL_COLOR_INDEX || format == GL_YCBCR_MESA) { + format = GL_RGBA; /* a bit of a hack */ + } + else if (format == GL_DEPTH_COMPONENT) { + format = texUnit->_Current->DepthMode; + } + + switch (texUnit->EnvMode) { + case GL_REPLACE: + switch (format) { + case GL_ALPHA: + for (i=0;iEnvColor[0] * CHAN_MAXF); + Gc = (GLint) (texUnit->EnvColor[1] * CHAN_MAXF); + Bc = (GLint) (texUnit->EnvColor[2] * CHAN_MAXF); + Ac = (GLint) (texUnit->EnvColor[3] * CHAN_MAXF); + switch (format) { + case GL_ALPHA: + for (i=0;iend < MAX_WIDTH); + ASSERT(span->arrayMask & SPAN_TEXTURE); + + /* + * Save copy of the incoming fragment colors (the GL_PRIMARY_COLOR) + */ + if (swrast->_AnyTextureCombine) + MEMCPY(primary_rgba, span->array->rgba, 4 * span->end * sizeof(GLchan)); + + /* + * Must do all texture sampling before combining in order to + * accomodate GL_ARB_texture_env_crossbar. + */ + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { + if (ctx->Texture.Unit[unit]._ReallyEnabled) { + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + const struct gl_texture_object *curObj = texUnit->_Current; + GLfloat *lambda = span->array->lambda[unit]; + GLchan (*texels)[4] = (GLchan (*)[4]) + (swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLchan))); + + /* adjust texture lod (lambda) */ + if (span->arrayMask & SPAN_LAMBDA) { + if (texUnit->LodBias + curObj->LodBias != 0.0F) { + /* apply LOD bias, but don't clamp yet */ + const GLfloat bias = CLAMP(texUnit->LodBias + curObj->LodBias, + -ctx->Const.MaxTextureLodBias, + ctx->Const.MaxTextureLodBias); + GLuint i; + for (i = 0; i < span->end; i++) { + lambda[i] += bias; + } + } + + if (curObj->MinLod != -1000.0 || curObj->MaxLod != 1000.0) { + /* apply LOD clamping to lambda */ + const GLfloat min = curObj->MinLod; + const GLfloat max = curObj->MaxLod; + GLuint i; + for (i = 0; i < span->end; i++) { + GLfloat l = lambda[i]; + lambda[i] = CLAMP(l, min, max); + } + } + } + + /* Sample the texture (span->end fragments) */ + swrast->TextureSample[unit]( ctx, unit, texUnit->_Current, span->end, + (const GLfloat (*)[4]) span->array->texcoords[unit], + lambda, texels ); + + /* GL_SGI_texture_color_table */ + if (texUnit->ColorTableEnabled) { + _mesa_lookup_rgba_chan(&texUnit->ColorTable, span->end, texels); + } + } + } + + /* + * OK, now apply the texture (aka texture combine/blend). + * We modify the span->color.rgba values. + */ + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { + if (ctx->Texture.Unit[unit]._ReallyEnabled) { + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + if (texUnit->_CurrentCombine != &texUnit->_EnvMode ) { + texture_combine( ctx, unit, span->end, + (CONST GLchan (*)[4]) primary_rgba, + swrast->TexelBuffer, + span->array->rgba ); + } + else { + /* conventional texture blend */ + const GLchan (*texels)[4] = (const GLchan (*)[4]) + (swrast->TexelBuffer + unit * + (span->end * 4 * sizeof(GLchan))); + texture_apply( ctx, texUnit, span->end, + (CONST GLchan (*)[4]) primary_rgba, texels, + span->array->rgba ); + } + } + } +} diff --git a/reactos/dll/mesa32/src/swrast/s_texture.h b/reactos/dll/mesa32/src/swrast/s_texture.h new file mode 100644 index 00000000000..698f363a1cd --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_texture.h @@ -0,0 +1,42 @@ +/* + * 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 S_TEXTURE_H +#define S_TEXTURE_H + + +#include "mtypes.h" +#include "swrast.h" + + +extern texture_sample_func +_swrast_choose_texture_sample_func( GLcontext *ctx, + const struct gl_texture_object *tObj ); + + +extern void +_swrast_texture_span( GLcontext *ctx, struct sw_span *span ); + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_triangle.c b/reactos/dll/mesa32/src/swrast/s_triangle.c new file mode 100644 index 00000000000..16dea94778d --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_triangle.c @@ -0,0 +1,1175 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + +/* + * When the device driver doesn't implement triangle rasterization it + * can hook in _swrast_Triangle, which eventually calls one of these + * functions to draw triangles. + */ + +#include "glheader.h" +#include "context.h" +#include "colormac.h" +#include "imports.h" +#include "macros.h" +#include "texformat.h" + +#include "s_aatriangle.h" +#include "s_context.h" +#include "s_depth.h" +#include "s_feedback.h" +#include "s_span.h" +#include "s_triangle.h" + + +/* + * Just used for feedback mode. + */ +GLboolean +_swrast_culltriangle( GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2 ) +{ + GLfloat ex = v1->win[0] - v0->win[0]; + GLfloat ey = v1->win[1] - v0->win[1]; + GLfloat fx = v2->win[0] - v0->win[0]; + GLfloat fy = v2->win[1] - v0->win[1]; + GLfloat c = ex*fy-ey*fx; + + if (c * SWRAST_CONTEXT(ctx)->_BackfaceSign > 0) + return 0; + + return 1; +} + + + +/* + * Render a flat-shaded color index triangle. + */ +#define NAME flat_ci_triangle +#define INTERP_Z 1 +#define INTERP_FOG 1 +#define SETUP_CODE \ + span.interpMask |= SPAN_INDEX; \ + span.index = FloatToFixed(v2->index);\ + span.indexStep = 0; +#define RENDER_SPAN( span ) _swrast_write_index_span(ctx, &span); +#include "s_tritemp.h" + + + +/* + * Render a smooth-shaded color index triangle. + */ +#define NAME smooth_ci_triangle +#define INTERP_Z 1 +#define INTERP_FOG 1 +#define INTERP_INDEX 1 +#define RENDER_SPAN( span ) _swrast_write_index_span(ctx, &span); +#include "s_tritemp.h" + + + +/* + * Render a flat-shaded RGBA triangle. + */ +#define NAME flat_rgba_triangle +#define INTERP_Z 1 +#define INTERP_FOG 1 +#define SETUP_CODE \ + ASSERT(ctx->Texture._EnabledCoordUnits == 0);\ + ASSERT(ctx->Light.ShadeModel==GL_FLAT); \ + span.interpMask |= SPAN_RGBA; \ + span.red = ChanToFixed(v2->color[0]); \ + span.green = ChanToFixed(v2->color[1]); \ + span.blue = ChanToFixed(v2->color[2]); \ + span.alpha = ChanToFixed(v2->color[3]); \ + span.redStep = 0; \ + span.greenStep = 0; \ + span.blueStep = 0; \ + span.alphaStep = 0; +#define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span); +#include "s_tritemp.h" + + + +/* + * Render a smooth-shaded RGBA triangle. + */ +#define NAME smooth_rgba_triangle +#define INTERP_Z 1 +#define INTERP_FOG 1 +#define INTERP_RGB 1 +#define INTERP_ALPHA 1 +#define SETUP_CODE \ + { \ + /* texturing must be off */ \ + ASSERT(ctx->Texture._EnabledCoordUnits == 0); \ + ASSERT(ctx->Light.ShadeModel==GL_SMOOTH); \ + } +#define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span); +#include "s_tritemp.h" + + + +/* + * Render an RGB, GL_DECAL, textured triangle. + * Interpolate S,T only w/out mipmapping or perspective correction. + * + * No fog. + */ +#define NAME simple_textured_triangle +#define INTERP_INT_TEX 1 +#define S_SCALE twidth +#define T_SCALE theight + +#define SETUP_CODE \ + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0];\ + struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ + const GLint b = obj->BaseLevel; \ + const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ + const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ + const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \ + const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \ + const GLint smask = obj->Image[0][b]->Width - 1; \ + const GLint tmask = obj->Image[0][b]->Height - 1; \ + if (!texture) { \ + /* this shouldn't happen */ \ + return; \ + } + +#define RENDER_SPAN( span ) \ + GLuint i; \ + span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \ + span.intTex[1] -= FIXED_HALF; \ + for (i = 0; i < span.end; i++) { \ + GLint s = FixedToInt(span.intTex[0]) & smask; \ + GLint t = FixedToInt(span.intTex[1]) & tmask; \ + GLint pos = (t << twidth_log2) + s; \ + pos = pos + pos + pos; /* multiply by 3 */ \ + span.array->rgb[i][RCOMP] = texture[pos]; \ + span.array->rgb[i][GCOMP] = texture[pos+1]; \ + span.array->rgb[i][BCOMP] = texture[pos+2]; \ + span.intTex[0] += span.intTexStep[0]; \ + span.intTex[1] += span.intTexStep[1]; \ + } \ + rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, span.array->rgb, NULL); + +#include "s_tritemp.h" + + + +/* + * Render an RGB, GL_DECAL, textured triangle. + * Interpolate S,T, GL_LESS depth test, w/out mipmapping or + * perspective correction. + * Depth buffer bits must be <= sizeof(DEFAULT_SOFTWARE_DEPTH_TYPE) + * + * No fog. + */ +#define NAME simple_z_textured_triangle +#define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE +#define INTERP_INT_TEX 1 +#define S_SCALE twidth +#define T_SCALE theight + +#define SETUP_CODE \ + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0];\ + struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ + const GLint b = obj->BaseLevel; \ + const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ + const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ + const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \ + const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \ + const GLint smask = obj->Image[0][b]->Width - 1; \ + const GLint tmask = obj->Image[0][b]->Height - 1; \ + if (!texture) { \ + /* this shouldn't happen */ \ + return; \ + } + +#define RENDER_SPAN( span ) \ + GLuint i; \ + span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \ + span.intTex[1] -= FIXED_HALF; \ + for (i = 0; i < span.end; i++) { \ + const GLdepth z = FixedToDepth(span.z); \ + if (z < zRow[i]) { \ + GLint s = FixedToInt(span.intTex[0]) & smask; \ + GLint t = FixedToInt(span.intTex[1]) & tmask; \ + GLint pos = (t << twidth_log2) + s; \ + pos = pos + pos + pos; /* multiply by 3 */ \ + span.array->rgb[i][RCOMP] = texture[pos]; \ + span.array->rgb[i][GCOMP] = texture[pos+1]; \ + span.array->rgb[i][BCOMP] = texture[pos+2]; \ + zRow[i] = z; \ + span.array->mask[i] = 1; \ + } \ + else { \ + span.array->mask[i] = 0; \ + } \ + span.intTex[0] += span.intTexStep[0]; \ + span.intTex[1] += span.intTexStep[1]; \ + span.z += span.zStep; \ + } \ + rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, \ + span.array->rgb, span.array->mask); + +#include "s_tritemp.h" + + + +#if CHAN_TYPE != GL_FLOAT + +struct affine_info +{ + GLenum filter; + GLenum format; + GLenum envmode; + GLint smask, tmask; + GLint twidth_log2; + const GLchan *texture; + GLfixed er, eg, eb, ea; + GLint tbytesline, tsize; +}; + + +static INLINE GLint +ilerp(GLint t, GLint a, GLint b) +{ + return a + ((t * (b - a)) >> FIXED_SHIFT); +} + +static INLINE GLint +ilerp_2d(GLint ia, GLint ib, GLint v00, GLint v10, GLint v01, GLint v11) +{ + const GLint temp0 = ilerp(ia, v00, v10); + const GLint temp1 = ilerp(ia, v01, v11); + return ilerp(ib, temp0, temp1); +} + + +/* This function can handle GL_NEAREST or GL_LINEAR sampling of 2D RGB or RGBA + * textures with GL_REPLACE, GL_MODULATE, GL_BLEND, GL_DECAL or GL_ADD + * texture env modes. + */ +static INLINE void +affine_span(GLcontext *ctx, struct sw_span *span, + struct affine_info *info) +{ + GLchan sample[4]; /* the filtered texture sample */ + + /* Instead of defining a function for each mode, a test is done + * between the outer and inner loops. This is to reduce code size + * and complexity. Observe that an optimizing compiler kills + * unused variables (for instance tf,sf,ti,si in case of GL_NEAREST). + */ + +#define NEAREST_RGB \ + sample[RCOMP] = tex00[RCOMP]; \ + sample[GCOMP] = tex00[GCOMP]; \ + sample[BCOMP] = tex00[BCOMP]; \ + sample[ACOMP] = CHAN_MAX + +#define LINEAR_RGB \ + sample[RCOMP] = ilerp_2d(sf, tf, tex00[0], tex01[0], tex10[0], tex11[0]);\ + sample[GCOMP] = ilerp_2d(sf, tf, tex00[1], tex01[1], tex10[1], tex11[1]);\ + sample[BCOMP] = ilerp_2d(sf, tf, tex00[2], tex01[2], tex10[2], tex11[2]);\ + sample[ACOMP] = CHAN_MAX; + +#define NEAREST_RGBA COPY_CHAN4(sample, tex00) + +#define LINEAR_RGBA \ + sample[RCOMP] = ilerp_2d(sf, tf, tex00[0], tex01[0], tex10[0], tex11[0]);\ + sample[GCOMP] = ilerp_2d(sf, tf, tex00[1], tex01[1], tex10[1], tex11[1]);\ + sample[BCOMP] = ilerp_2d(sf, tf, tex00[2], tex01[2], tex10[2], tex11[2]);\ + sample[ACOMP] = ilerp_2d(sf, tf, tex00[3], tex01[3], tex10[3], tex11[3]) + +#define MODULATE \ + dest[RCOMP] = span->red * (sample[RCOMP] + 1u) >> (FIXED_SHIFT + 8); \ + dest[GCOMP] = span->green * (sample[GCOMP] + 1u) >> (FIXED_SHIFT + 8); \ + dest[BCOMP] = span->blue * (sample[BCOMP] + 1u) >> (FIXED_SHIFT + 8); \ + dest[ACOMP] = span->alpha * (sample[ACOMP] + 1u) >> (FIXED_SHIFT + 8) + +#define DECAL \ + dest[RCOMP] = ((CHAN_MAX - sample[ACOMP]) * span->red + \ + ((sample[ACOMP] + 1) * sample[RCOMP] << FIXED_SHIFT)) \ + >> (FIXED_SHIFT + 8); \ + dest[GCOMP] = ((CHAN_MAX - sample[ACOMP]) * span->green + \ + ((sample[ACOMP] + 1) * sample[GCOMP] << FIXED_SHIFT)) \ + >> (FIXED_SHIFT + 8); \ + dest[BCOMP] = ((CHAN_MAX - sample[ACOMP]) * span->blue + \ + ((sample[ACOMP] + 1) * sample[BCOMP] << FIXED_SHIFT)) \ + >> (FIXED_SHIFT + 8); \ + dest[ACOMP] = FixedToInt(span->alpha) + +#define BLEND \ + dest[RCOMP] = ((CHAN_MAX - sample[RCOMP]) * span->red \ + + (sample[RCOMP] + 1) * info->er) >> (FIXED_SHIFT + 8); \ + dest[GCOMP] = ((CHAN_MAX - sample[GCOMP]) * span->green \ + + (sample[GCOMP] + 1) * info->eg) >> (FIXED_SHIFT + 8); \ + dest[BCOMP] = ((CHAN_MAX - sample[BCOMP]) * span->blue \ + + (sample[BCOMP] + 1) * info->eb) >> (FIXED_SHIFT + 8); \ + dest[ACOMP] = span->alpha * (sample[ACOMP] + 1) >> (FIXED_SHIFT + 8) + +#define REPLACE COPY_CHAN4(dest, sample) + +#define ADD \ + { \ + GLint rSum = FixedToInt(span->red) + (GLint) sample[RCOMP]; \ + GLint gSum = FixedToInt(span->green) + (GLint) sample[GCOMP]; \ + GLint bSum = FixedToInt(span->blue) + (GLint) sample[BCOMP]; \ + dest[RCOMP] = MIN2(rSum, CHAN_MAX); \ + dest[GCOMP] = MIN2(gSum, CHAN_MAX); \ + dest[BCOMP] = MIN2(bSum, CHAN_MAX); \ + dest[ACOMP] = span->alpha * (sample[ACOMP] + 1) >> (FIXED_SHIFT + 8); \ + } + +/* shortcuts */ + +#define NEAREST_RGB_REPLACE \ + NEAREST_RGB; \ + dest[0] = sample[0]; \ + dest[1] = sample[1]; \ + dest[2] = sample[2]; \ + dest[3] = FixedToInt(span->alpha); + +#define NEAREST_RGBA_REPLACE COPY_CHAN4(dest, tex00) + +#define SPAN_NEAREST(DO_TEX, COMPS) \ + for (i = 0; i < span->end; i++) { \ + /* Isn't it necessary to use FixedFloor below?? */ \ + GLint s = FixedToInt(span->intTex[0]) & info->smask; \ + GLint t = FixedToInt(span->intTex[1]) & info->tmask; \ + GLint pos = (t << info->twidth_log2) + s; \ + const GLchan *tex00 = info->texture + COMPS * pos; \ + DO_TEX; \ + span->red += span->redStep; \ + span->green += span->greenStep; \ + span->blue += span->blueStep; \ + span->alpha += span->alphaStep; \ + span->intTex[0] += span->intTexStep[0]; \ + span->intTex[1] += span->intTexStep[1]; \ + dest += 4; \ + } + +#define SPAN_LINEAR(DO_TEX, COMPS) \ + for (i = 0; i < span->end; i++) { \ + /* Isn't it necessary to use FixedFloor below?? */ \ + const GLint s = FixedToInt(span->intTex[0]) & info->smask; \ + const GLint t = FixedToInt(span->intTex[1]) & info->tmask; \ + const GLfixed sf = span->intTex[0] & FIXED_FRAC_MASK; \ + const GLfixed tf = span->intTex[1] & FIXED_FRAC_MASK; \ + const GLint pos = (t << info->twidth_log2) + s; \ + const GLchan *tex00 = info->texture + COMPS * pos; \ + const GLchan *tex10 = tex00 + info->tbytesline; \ + const GLchan *tex01 = tex00 + COMPS; \ + const GLchan *tex11 = tex10 + COMPS; \ + if (t == info->tmask) { \ + tex10 -= info->tsize; \ + tex11 -= info->tsize; \ + } \ + if (s == info->smask) { \ + tex01 -= info->tbytesline; \ + tex11 -= info->tbytesline; \ + } \ + DO_TEX; \ + span->red += span->redStep; \ + span->green += span->greenStep; \ + span->blue += span->blueStep; \ + span->alpha += span->alphaStep; \ + span->intTex[0] += span->intTexStep[0]; \ + span->intTex[1] += span->intTexStep[1]; \ + dest += 4; \ + } + + + GLuint i; + GLchan *dest = span->array->rgba[0]; + + span->intTex[0] -= FIXED_HALF; + span->intTex[1] -= FIXED_HALF; + switch (info->filter) { + case GL_NEAREST: + switch (info->format) { + case GL_RGB: + switch (info->envmode) { + case GL_MODULATE: + SPAN_NEAREST(NEAREST_RGB;MODULATE,3); + break; + case GL_DECAL: + case GL_REPLACE: + SPAN_NEAREST(NEAREST_RGB_REPLACE,3); + break; + case GL_BLEND: + SPAN_NEAREST(NEAREST_RGB;BLEND,3); + break; + case GL_ADD: + SPAN_NEAREST(NEAREST_RGB;ADD,3); + break; + default: + _mesa_problem(ctx, "bad tex env mode in SPAN_LINEAR"); + return; + } + break; + case GL_RGBA: + switch(info->envmode) { + case GL_MODULATE: + SPAN_NEAREST(NEAREST_RGBA;MODULATE,4); + break; + case GL_DECAL: + SPAN_NEAREST(NEAREST_RGBA;DECAL,4); + break; + case GL_BLEND: + SPAN_NEAREST(NEAREST_RGBA;BLEND,4); + break; + case GL_ADD: + SPAN_NEAREST(NEAREST_RGBA;ADD,4); + break; + case GL_REPLACE: + SPAN_NEAREST(NEAREST_RGBA_REPLACE,4); + break; + default: + _mesa_problem(ctx, "bad tex env mode (2) in SPAN_LINEAR"); + return; + } + break; + } + break; + + case GL_LINEAR: + span->intTex[0] -= FIXED_HALF; + span->intTex[1] -= FIXED_HALF; + switch (info->format) { + case GL_RGB: + switch (info->envmode) { + case GL_MODULATE: + SPAN_LINEAR(LINEAR_RGB;MODULATE,3); + break; + case GL_DECAL: + case GL_REPLACE: + SPAN_LINEAR(LINEAR_RGB;REPLACE,3); + break; + case GL_BLEND: + SPAN_LINEAR(LINEAR_RGB;BLEND,3); + break; + case GL_ADD: + SPAN_LINEAR(LINEAR_RGB;ADD,3); + break; + default: + _mesa_problem(ctx, "bad tex env mode (3) in SPAN_LINEAR"); + return; + } + break; + case GL_RGBA: + switch (info->envmode) { + case GL_MODULATE: + SPAN_LINEAR(LINEAR_RGBA;MODULATE,4); + break; + case GL_DECAL: + SPAN_LINEAR(LINEAR_RGBA;DECAL,4); + break; + case GL_BLEND: + SPAN_LINEAR(LINEAR_RGBA;BLEND,4); + break; + case GL_ADD: + SPAN_LINEAR(LINEAR_RGBA;ADD,4); + break; + case GL_REPLACE: + SPAN_LINEAR(LINEAR_RGBA;REPLACE,4); + break; + default: + _mesa_problem(ctx, "bad tex env mode (4) in SPAN_LINEAR"); + return; + } + break; + } + break; + } + span->interpMask &= ~SPAN_RGBA; + ASSERT(span->arrayMask & SPAN_RGBA); + _swrast_write_rgba_span(ctx, span); + +#undef SPAN_NEAREST +#undef SPAN_LINEAR +} + + + +/* + * Render an RGB/RGBA textured triangle without perspective correction. + */ +#define NAME affine_textured_triangle +#define INTERP_Z 1 +#define INTERP_FOG 1 +#define INTERP_RGB 1 +#define INTERP_ALPHA 1 +#define INTERP_INT_TEX 1 +#define S_SCALE twidth +#define T_SCALE theight + +#define SETUP_CODE \ + struct affine_info info; \ + struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ + struct gl_texture_object *obj = unit->Current2D; \ + const GLint b = obj->BaseLevel; \ + const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ + const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ + info.texture = (const GLchan *) obj->Image[0][b]->Data; \ + info.twidth_log2 = obj->Image[0][b]->WidthLog2; \ + info.smask = obj->Image[0][b]->Width - 1; \ + info.tmask = obj->Image[0][b]->Height - 1; \ + info.format = obj->Image[0][b]->Format; \ + info.filter = obj->MinFilter; \ + info.envmode = unit->EnvMode; \ + span.arrayMask |= SPAN_RGBA; \ + \ + if (info.envmode == GL_BLEND) { \ + /* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \ + info.er = FloatToFixed(unit->EnvColor[RCOMP] * CHAN_MAXF); \ + info.eg = FloatToFixed(unit->EnvColor[GCOMP] * CHAN_MAXF); \ + info.eb = FloatToFixed(unit->EnvColor[BCOMP] * CHAN_MAXF); \ + info.ea = FloatToFixed(unit->EnvColor[ACOMP] * CHAN_MAXF); \ + } \ + if (!info.texture) { \ + /* this shouldn't happen */ \ + return; \ + } \ + \ + switch (info.format) { \ + case GL_ALPHA: \ + case GL_LUMINANCE: \ + case GL_INTENSITY: \ + info.tbytesline = obj->Image[0][b]->Width; \ + break; \ + case GL_LUMINANCE_ALPHA: \ + info.tbytesline = obj->Image[0][b]->Width * 2; \ + break; \ + case GL_RGB: \ + info.tbytesline = obj->Image[0][b]->Width * 3; \ + break; \ + case GL_RGBA: \ + info.tbytesline = obj->Image[0][b]->Width * 4; \ + break; \ + default: \ + _mesa_problem(NULL, "Bad texture format in affine_texture_triangle");\ + return; \ + } \ + info.tsize = obj->Image[0][b]->Height * info.tbytesline; + +#define RENDER_SPAN( span ) affine_span(ctx, &span, &info); + +#include "s_tritemp.h" + + + +struct persp_info +{ + GLenum filter; + GLenum format; + GLenum envmode; + GLint smask, tmask; + GLint twidth_log2; + const GLchan *texture; + GLfixed er, eg, eb, ea; /* texture env color */ + GLint tbytesline, tsize; +}; + + +static INLINE void +fast_persp_span(GLcontext *ctx, struct sw_span *span, + struct persp_info *info) +{ + GLchan sample[4]; /* the filtered texture sample */ + + /* Instead of defining a function for each mode, a test is done + * between the outer and inner loops. This is to reduce code size + * and complexity. Observe that an optimizing compiler kills + * unused variables (for instance tf,sf,ti,si in case of GL_NEAREST). + */ +#define SPAN_NEAREST(DO_TEX,COMP) \ + for (i = 0; i < span->end; i++) { \ + GLdouble invQ = tex_coord[2] ? \ + (1.0 / tex_coord[2]) : 1.0; \ + GLfloat s_tmp = (GLfloat) (tex_coord[0] * invQ); \ + GLfloat t_tmp = (GLfloat) (tex_coord[1] * invQ); \ + GLint s = IFLOOR(s_tmp) & info->smask; \ + GLint t = IFLOOR(t_tmp) & info->tmask; \ + GLint pos = (t << info->twidth_log2) + s; \ + const GLchan *tex00 = info->texture + COMP * pos; \ + DO_TEX; \ + span->red += span->redStep; \ + span->green += span->greenStep; \ + span->blue += span->blueStep; \ + span->alpha += span->alphaStep; \ + tex_coord[0] += tex_step[0]; \ + tex_coord[1] += tex_step[1]; \ + tex_coord[2] += tex_step[2]; \ + dest += 4; \ + } + +#define SPAN_LINEAR(DO_TEX,COMP) \ + for (i = 0; i < span->end; i++) { \ + GLdouble invQ = tex_coord[2] ? \ + (1.0 / tex_coord[2]) : 1.0; \ + const GLfloat s_tmp = (GLfloat) (tex_coord[0] * invQ); \ + const GLfloat t_tmp = (GLfloat) (tex_coord[1] * invQ); \ + const GLfixed s_fix = FloatToFixed(s_tmp) - FIXED_HALF; \ + const GLfixed t_fix = FloatToFixed(t_tmp) - FIXED_HALF; \ + const GLint s = FixedToInt(FixedFloor(s_fix)) & info->smask; \ + const GLint t = FixedToInt(FixedFloor(t_fix)) & info->tmask; \ + const GLfixed sf = s_fix & FIXED_FRAC_MASK; \ + const GLfixed tf = t_fix & FIXED_FRAC_MASK; \ + const GLint pos = (t << info->twidth_log2) + s; \ + const GLchan *tex00 = info->texture + COMP * pos; \ + const GLchan *tex10 = tex00 + info->tbytesline; \ + const GLchan *tex01 = tex00 + COMP; \ + const GLchan *tex11 = tex10 + COMP; \ + if (t == info->tmask) { \ + tex10 -= info->tsize; \ + tex11 -= info->tsize; \ + } \ + if (s == info->smask) { \ + tex01 -= info->tbytesline; \ + tex11 -= info->tbytesline; \ + } \ + DO_TEX; \ + span->red += span->redStep; \ + span->green += span->greenStep; \ + span->blue += span->blueStep; \ + span->alpha += span->alphaStep; \ + tex_coord[0] += tex_step[0]; \ + tex_coord[1] += tex_step[1]; \ + tex_coord[2] += tex_step[2]; \ + dest += 4; \ + } + + GLuint i; + GLfloat tex_coord[3], tex_step[3]; + GLchan *dest = span->array->rgba[0]; + + const GLuint savedTexEnable = ctx->Texture._EnabledUnits; + ctx->Texture._EnabledUnits = 0; + + tex_coord[0] = span->tex[0][0] * (info->smask + 1); + tex_step[0] = span->texStepX[0][0] * (info->smask + 1); + tex_coord[1] = span->tex[0][1] * (info->tmask + 1); + tex_step[1] = span->texStepX[0][1] * (info->tmask + 1); + /* span->tex[0][2] only if 3D-texturing, here only 2D */ + tex_coord[2] = span->tex[0][3]; + tex_step[2] = span->texStepX[0][3]; + + switch (info->filter) { + case GL_NEAREST: + switch (info->format) { + case GL_RGB: + switch (info->envmode) { + case GL_MODULATE: + SPAN_NEAREST(NEAREST_RGB;MODULATE,3); + break; + case GL_DECAL: + case GL_REPLACE: + SPAN_NEAREST(NEAREST_RGB_REPLACE,3); + break; + case GL_BLEND: + SPAN_NEAREST(NEAREST_RGB;BLEND,3); + break; + case GL_ADD: + SPAN_NEAREST(NEAREST_RGB;ADD,3); + break; + default: + _mesa_problem(ctx, "bad tex env mode (5) in SPAN_LINEAR"); + return; + } + break; + case GL_RGBA: + switch(info->envmode) { + case GL_MODULATE: + SPAN_NEAREST(NEAREST_RGBA;MODULATE,4); + break; + case GL_DECAL: + SPAN_NEAREST(NEAREST_RGBA;DECAL,4); + break; + case GL_BLEND: + SPAN_NEAREST(NEAREST_RGBA;BLEND,4); + break; + case GL_ADD: + SPAN_NEAREST(NEAREST_RGBA;ADD,4); + break; + case GL_REPLACE: + SPAN_NEAREST(NEAREST_RGBA_REPLACE,4); + break; + default: + _mesa_problem(ctx, "bad tex env mode (6) in SPAN_LINEAR"); + return; + } + break; + } + break; + + case GL_LINEAR: + switch (info->format) { + case GL_RGB: + switch (info->envmode) { + case GL_MODULATE: + SPAN_LINEAR(LINEAR_RGB;MODULATE,3); + break; + case GL_DECAL: + case GL_REPLACE: + SPAN_LINEAR(LINEAR_RGB;REPLACE,3); + break; + case GL_BLEND: + SPAN_LINEAR(LINEAR_RGB;BLEND,3); + break; + case GL_ADD: + SPAN_LINEAR(LINEAR_RGB;ADD,3); + break; + default: + _mesa_problem(ctx, "bad tex env mode (7) in SPAN_LINEAR"); + return; + } + break; + case GL_RGBA: + switch (info->envmode) { + case GL_MODULATE: + SPAN_LINEAR(LINEAR_RGBA;MODULATE,4); + break; + case GL_DECAL: + SPAN_LINEAR(LINEAR_RGBA;DECAL,4); + break; + case GL_BLEND: + SPAN_LINEAR(LINEAR_RGBA;BLEND,4); + break; + case GL_ADD: + SPAN_LINEAR(LINEAR_RGBA;ADD,4); + break; + case GL_REPLACE: + SPAN_LINEAR(LINEAR_RGBA;REPLACE,4); + break; + default: + _mesa_problem(ctx, "bad tex env mode (8) in SPAN_LINEAR"); + return; + } + break; + } + break; + } + + ASSERT(span->arrayMask & SPAN_RGBA); + _swrast_write_rgba_span(ctx, span); + +#undef SPAN_NEAREST +#undef SPAN_LINEAR + + /* restore state */ + ctx->Texture._EnabledUnits = savedTexEnable; +} + + +/* + * Render an perspective corrected RGB/RGBA textured triangle. + * The Q (aka V in Mesa) coordinate must be zero such that the divide + * by interpolated Q/W comes out right. + * + */ +#define NAME persp_textured_triangle +#define INTERP_Z 1 +#define INTERP_W 1 +#define INTERP_FOG 1 +#define INTERP_RGB 1 +#define INTERP_ALPHA 1 +#define INTERP_TEX 1 + +#define SETUP_CODE \ + struct persp_info info; \ + const struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ + const struct gl_texture_object *obj = unit->Current2D; \ + const GLint b = obj->BaseLevel; \ + info.texture = (const GLchan *) obj->Image[0][b]->Data; \ + info.twidth_log2 = obj->Image[0][b]->WidthLog2; \ + info.smask = obj->Image[0][b]->Width - 1; \ + info.tmask = obj->Image[0][b]->Height - 1; \ + info.format = obj->Image[0][b]->Format; \ + info.filter = obj->MinFilter; \ + info.envmode = unit->EnvMode; \ + \ + if (info.envmode == GL_BLEND) { \ + /* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \ + info.er = FloatToFixed(unit->EnvColor[RCOMP] * CHAN_MAXF); \ + info.eg = FloatToFixed(unit->EnvColor[GCOMP] * CHAN_MAXF); \ + info.eb = FloatToFixed(unit->EnvColor[BCOMP] * CHAN_MAXF); \ + info.ea = FloatToFixed(unit->EnvColor[ACOMP] * CHAN_MAXF); \ + } \ + if (!info.texture) { \ + /* this shouldn't happen */ \ + return; \ + } \ + \ + switch (info.format) { \ + case GL_ALPHA: \ + case GL_LUMINANCE: \ + case GL_INTENSITY: \ + info.tbytesline = obj->Image[0][b]->Width; \ + break; \ + case GL_LUMINANCE_ALPHA: \ + info.tbytesline = obj->Image[0][b]->Width * 2; \ + break; \ + case GL_RGB: \ + info.tbytesline = obj->Image[0][b]->Width * 3; \ + break; \ + case GL_RGBA: \ + info.tbytesline = obj->Image[0][b]->Width * 4; \ + break; \ + default: \ + _mesa_problem(NULL, "Bad texture format in persp_textured_triangle");\ + return; \ + } \ + info.tsize = obj->Image[0][b]->Height * info.tbytesline; + +#define RENDER_SPAN( span ) \ + span.interpMask &= ~SPAN_RGBA; \ + span.arrayMask |= SPAN_RGBA; \ + fast_persp_span(ctx, &span, &info); + +#include "s_tritemp.h" + + +#endif /* CHAN_BITS != GL_FLOAT */ + + + + +/* + * Render a smooth-shaded, textured, RGBA triangle. + * Interpolate S,T,R with perspective correction, w/out mipmapping. + */ +#define NAME general_textured_triangle +#define INTERP_Z 1 +#define INTERP_W 1 +#define INTERP_FOG 1 +#define INTERP_RGB 1 +#define INTERP_SPEC 1 +#define INTERP_ALPHA 1 +#define INTERP_TEX 1 +#define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span); +#include "s_tritemp.h" + + + +/* + * This is the big one! + * Interpolate Z, RGB, Alpha, specular, fog, and N sets of texture coordinates. + * Yup, it's slow. + */ +#define NAME multitextured_triangle +#define INTERP_Z 1 +#define INTERP_W 1 +#define INTERP_FOG 1 +#define INTERP_RGB 1 +#define INTERP_ALPHA 1 +#define INTERP_SPEC 1 +#define INTERP_MULTITEX 1 +#define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span); +#include "s_tritemp.h" + + + +/* + * Special tri function for occlusion testing + */ +#define NAME occlusion_zless_triangle +#define INTERP_Z 1 +#define SETUP_CODE \ + struct gl_renderbuffer *rb \ + = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; \ + ASSERT(ctx->Depth.Test); \ + ASSERT(!ctx->Depth.Mask); \ + ASSERT(ctx->Depth.Func == GL_LESS); \ + if (ctx->OcclusionResult && !ctx->Occlusion.Active) { \ + return; \ + } +#define RENDER_SPAN( span ) \ + if (ctx->Visual.depthBits <= 16) { \ + GLuint i; \ + const GLushort *zRow = (const GLushort *) \ + rb->GetPointer(ctx, rb, span.x, span.y); \ + for (i = 0; i < span.end; i++) { \ + GLdepth z = FixedToDepth(span.z); \ + if (z < zRow[i]) { \ + ctx->OcclusionResult = GL_TRUE; \ + ctx->Occlusion.PassedCounter++; \ + } \ + span.z += span.zStep; \ + } \ + } \ + else { \ + GLuint i; \ + const GLuint *zRow = (const GLuint *) \ + rb->GetPointer(ctx, rb, span.x, span.y); \ + for (i = 0; i < span.end; i++) { \ + if ((GLuint)span.z < zRow[i]) { \ + ctx->OcclusionResult = GL_TRUE; \ + ctx->Occlusion.PassedCounter++; \ + } \ + span.z += span.zStep; \ + } \ + } +#include "s_tritemp.h" + + + +static void +nodraw_triangle( GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2 ) +{ + (void) (ctx && v0 && v1 && v2); +} + + +/* + * This is used when separate specular color is enabled, but not + * texturing. We add the specular color to the primary color, + * draw the triangle, then restore the original primary color. + * Inefficient, but seldom needed. + */ +void _swrast_add_spec_terms_triangle( GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2 ) +{ + SWvertex *ncv0 = (SWvertex *)v0; /* drop const qualifier */ + SWvertex *ncv1 = (SWvertex *)v1; + SWvertex *ncv2 = (SWvertex *)v2; +#if CHAN_TYPE == GL_FLOAT + GLfloat rSum, gSum, bSum; +#else + GLint rSum, gSum, bSum; +#endif + GLchan c[3][4]; + /* save original colors */ + COPY_CHAN4( c[0], ncv0->color ); + COPY_CHAN4( c[1], ncv1->color ); + COPY_CHAN4( c[2], ncv2->color ); + /* sum v0 */ + rSum = ncv0->color[0] + ncv0->specular[0]; + gSum = ncv0->color[1] + ncv0->specular[1]; + bSum = ncv0->color[2] + ncv0->specular[2]; + ncv0->color[0] = MIN2(rSum, CHAN_MAX); + ncv0->color[1] = MIN2(gSum, CHAN_MAX); + ncv0->color[2] = MIN2(bSum, CHAN_MAX); + /* sum v1 */ + rSum = ncv1->color[0] + ncv1->specular[0]; + gSum = ncv1->color[1] + ncv1->specular[1]; + bSum = ncv1->color[2] + ncv1->specular[2]; + ncv1->color[0] = MIN2(rSum, CHAN_MAX); + ncv1->color[1] = MIN2(gSum, CHAN_MAX); + ncv1->color[2] = MIN2(bSum, CHAN_MAX); + /* sum v2 */ + rSum = ncv2->color[0] + ncv2->specular[0]; + gSum = ncv2->color[1] + ncv2->specular[1]; + bSum = ncv2->color[2] + ncv2->specular[2]; + ncv2->color[0] = MIN2(rSum, CHAN_MAX); + ncv2->color[1] = MIN2(gSum, CHAN_MAX); + ncv2->color[2] = MIN2(bSum, CHAN_MAX); + /* draw */ + SWRAST_CONTEXT(ctx)->SpecTriangle( ctx, ncv0, ncv1, ncv2 ); + /* restore original colors */ + COPY_CHAN4( ncv0->color, c[0] ); + COPY_CHAN4( ncv1->color, c[1] ); + COPY_CHAN4( ncv2->color, c[2] ); +} + + + +#ifdef DEBUG + +/* record the current triangle function name */ +const char *_mesa_triFuncName = NULL; + +#define USE(triFunc) \ +do { \ + _mesa_triFuncName = #triFunc; \ + /*printf("%s\n", _mesa_triFuncName);*/ \ + swrast->Triangle = triFunc; \ +} while (0) + +#else + +#define USE(triFunc) swrast->Triangle = triFunc; + +#endif + + + + +/* + * Determine which triangle rendering function to use given the current + * rendering context. + * + * Please update the summary flag _SWRAST_NEW_TRIANGLE if you add or + * remove tests to this code. + */ +void +_swrast_choose_triangle( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + const GLboolean rgbmode = ctx->Visual.rgbMode; + + if (ctx->Polygon.CullFlag && + ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) { + USE(nodraw_triangle); + return; + } + + if (ctx->RenderMode==GL_RENDER) { + + if (ctx->Polygon.SmoothFlag) { + _swrast_set_aa_triangle_function(ctx); + ASSERT(swrast->Triangle); + return; + } + + /* special case for occlusion testing */ + if ((ctx->Depth.OcclusionTest || ctx->Occlusion.Active) && + ctx->Depth.Test && + ctx->Depth.Mask == GL_FALSE && + ctx->Depth.Func == GL_LESS && + !ctx->Stencil.Enabled) { + if ((rgbmode && + ctx->Color.ColorMask[0] == 0 && + ctx->Color.ColorMask[1] == 0 && + ctx->Color.ColorMask[2] == 0 && + ctx->Color.ColorMask[3] == 0) + || + (!rgbmode && ctx->Color.IndexMask == 0)) { + USE(occlusion_zless_triangle); + return; + } + } + + if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram._Active) { + /* Ugh, we do a _lot_ of tests to pick the best textured tri func */ + const struct gl_texture_object *texObj2D; + const struct gl_texture_image *texImg; + GLenum minFilter, magFilter, envMode; + GLint format; + texObj2D = ctx->Texture.Unit[0].Current2D; + texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL; + format = texImg ? texImg->TexFormat->MesaFormat : -1; + minFilter = texObj2D ? texObj2D->MinFilter : (GLenum) 0; + magFilter = texObj2D ? texObj2D->MagFilter : (GLenum) 0; + envMode = ctx->Texture.Unit[0].EnvMode; + + /* First see if we can use an optimized 2-D texture function */ + if (ctx->Texture._EnabledCoordUnits == 0x1 + && !ctx->FragmentProgram._Active + && ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT + && texObj2D->WrapS == GL_REPEAT + && texObj2D->WrapT == GL_REPEAT + && texObj2D->_IsPowerOfTwo + && texImg->Border == 0 + && texImg->Width == texImg->RowStride + && (format == MESA_FORMAT_RGB || format == MESA_FORMAT_RGBA) + && minFilter == magFilter + && ctx->Light.Model.ColorControl == GL_SINGLE_COLOR + && ctx->Texture.Unit[0].EnvMode != GL_COMBINE_EXT) { + if (ctx->Hint.PerspectiveCorrection==GL_FASTEST) { + if (minFilter == GL_NEAREST + && format == MESA_FORMAT_RGB + && (envMode == GL_REPLACE || envMode == GL_DECAL) + && ((swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT) + && ctx->Depth.Func == GL_LESS + && ctx->Depth.Mask == GL_TRUE) + || swrast->_RasterMask == TEXTURE_BIT) + && ctx->Polygon.StippleFlag == GL_FALSE + && ctx->Visual.depthBits <= 16) { + if (swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT)) { + USE(simple_z_textured_triangle); + } + else { + USE(simple_textured_triangle); + } + } + else { +#if (CHAN_BITS == 16 || CHAN_BITS == 32) + USE(general_textured_triangle); +#else + USE(affine_textured_triangle); +#endif + } + } + else { +#if (CHAN_BITS == 16 || CHAN_BITS == 32) + USE(general_textured_triangle); +#else + USE(persp_textured_triangle); +#endif + } + } + else { + /* general case textured triangles */ + if (ctx->Texture._EnabledCoordUnits > 1) { + USE(multitextured_triangle); + } + else { + USE(general_textured_triangle); + } + } + } + else { + ASSERT(!ctx->Texture._EnabledCoordUnits); + if (ctx->Light.ShadeModel==GL_SMOOTH) { + /* smooth shaded, no texturing, stippled or some raster ops */ + if (rgbmode) { + USE(smooth_rgba_triangle); + } + else { + USE(smooth_ci_triangle); + } + } + else { + /* flat shaded, no texturing, stippled or some raster ops */ + if (rgbmode) { + USE(flat_rgba_triangle); + } + else { + USE(flat_ci_triangle); + } + } + } + } + else if (ctx->RenderMode==GL_FEEDBACK) { + USE(_swrast_feedback_triangle); + } + else { + /* GL_SELECT mode */ + USE(_swrast_select_triangle); + } +} diff --git a/reactos/dll/mesa32/src/swrast/s_triangle.h b/reactos/dll/mesa32/src/swrast/s_triangle.h new file mode 100644 index 00000000000..0de812500c5 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_triangle.h @@ -0,0 +1,51 @@ + +/* + * 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. + */ + + +#ifndef S_TRIANGLES_H +#define S_TRIANGLES_H + + +#include "mtypes.h" +#include "swrast.h" + + +extern GLboolean +_swrast_culltriangle( GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2); + +extern void +_swrast_choose_triangle( GLcontext *ctx ); + +extern void +_swrast_add_spec_terms_triangle( GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2 ); + + +#endif diff --git a/reactos/dll/mesa32/src/swrast/s_trispan.h b/reactos/dll/mesa32/src/swrast/s_trispan.h new file mode 100644 index 00000000000..15207e863e3 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_trispan.h @@ -0,0 +1,31 @@ + +/* + * 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 S_TRISPAN_H +#define S_TRISPAN_H + + +#endif /* S_TRISPAN_H */ diff --git a/reactos/dll/mesa32/src/swrast/s_tritemp.h b/reactos/dll/mesa32/src/swrast/s_tritemp.h new file mode 100644 index 00000000000..82f397a087b --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_tritemp.h @@ -0,0 +1,1334 @@ +/* + * Mesa 3-D graphics library + * Version: 6.4 + * + * 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. + */ + +/* + * Triangle Rasterizer Template + * + * This file is #include'd to generate custom triangle rasterizers. + * + * The following macros may be defined to indicate what auxillary information + * must be interplated across the triangle: + * INTERP_Z - if defined, interpolate vertex Z values + * INTERP_W - if defined, interpolate vertex W values + * INTERP_FOG - if defined, interpolate fog values + * INTERP_RGB - if defined, interpolate RGB values + * INTERP_ALPHA - if defined, interpolate Alpha values (req's INTERP_RGB) + * INTERP_SPEC - if defined, interpolate specular RGB values + * INTERP_INDEX - if defined, interpolate color index values + * INTERP_INT_TEX - if defined, interpolate integer ST texcoords + * (fast, simple 2-D texture mapping) + * INTERP_TEX - if defined, interpolate set 0 float STRQ texcoords + * NOTE: OpenGL STRQ = Mesa STUV (R was taken for red) + * INTERP_MULTITEX - if defined, interpolate N units of STRQ texcoords + * + * When one can directly address pixels in the color buffer the following + * macros can be defined and used to compute pixel addresses during + * rasterization (see pRow): + * PIXEL_TYPE - the datatype of a pixel (GLubyte, GLushort, GLuint) + * BYTES_PER_ROW - number of bytes per row in the color buffer + * PIXEL_ADDRESS(X,Y) - returns the address of pixel at (X,Y) where + * Y==0 at bottom of screen and increases upward. + * + * Similarly, for direct depth buffer access, this type is used for depth + * buffer addressing: + * DEPTH_TYPE - either GLushort or GLuint + * + * Optionally, one may provide one-time setup code per triangle: + * SETUP_CODE - code which is to be executed once per triangle + * CLEANUP_CODE - code to execute at end of triangle + * + * The following macro MUST be defined: + * RENDER_SPAN(span) - code to write a span of pixels. + * + * This code was designed for the origin to be in the lower-left corner. + * + * Inspired by triangle rasterizer code written by Allen Akin. Thanks Allen! + * + * + * Some notes on rasterization accuracy: + * + * This code uses fixed point arithmetic (the GLfixed type) to iterate + * over the triangle edges and interpolate ancillary data (such as Z, + * color, secondary color, etc). The number of fractional bits in + * GLfixed and the value of SUB_PIXEL_BITS has a direct bearing on the + * accuracy of rasterization. + * + * If SUB_PIXEL_BITS=4 then we'll snap the vertices to the nearest + * 1/16 of a pixel. If we're walking up a long, nearly vertical edge + * (dx=1/16, dy=1024) we'll need 4 + 10 = 14 fractional bits in + * GLfixed to walk the edge without error. If the maximum viewport + * height is 4K pixels, then we'll need 4 + 12 = 16 fractional bits. + * + * Historically, Mesa has used 11 fractional bits in GLfixed, snaps + * vertices to 1/16 pixel and allowed a maximum viewport height of 2K + * pixels. 11 fractional bits is actually insufficient for accurately + * rasterizing some triangles. More recently, the maximum viewport + * height was increased to 4K pixels. Thus, Mesa should be using 16 + * fractional bits in GLfixed. Unfortunately, there may be some issues + * with setting FIXED_FRAC_BITS=16, such as multiplication overflow. + * This will have to be examined in some detail... + * + * For now, if you find rasterization errors, particularly with tall, + * sliver triangles, try increasing FIXED_FRAC_BITS and/or decreasing + * SUB_PIXEL_BITS. + */ + +/* + * ColorTemp is used for intermediate color values. + */ +#if CHAN_TYPE == GL_FLOAT +#define ColorTemp GLfloat +#else +#define ColorTemp GLint /* same as GLfixed */ +#endif + + +/* + * Walk triangle edges with GLfixed or GLdouble + */ +#if TRIANGLE_WALK_DOUBLE +#define GLinterp GLdouble +#define InterpToInt(X) ((GLint) (X)) +#define INTERP_ONE 1.0 +#else +#define GLinterp GLfixed +#define InterpToInt(X) FixedToInt(X) +#define INTERP_ONE FIXED_ONE +#endif + + +/* + * Either loop over all texture units, or just use unit zero. + */ +#ifdef INTERP_MULTITEX +#define TEX_UNIT_LOOP(CODE) \ + { \ + GLuint u; \ + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \ + if (ctx->Texture._EnabledCoordUnits & (1 << u)) { \ + CODE \ + } \ + } \ + } +#define INTERP_TEX +#elif defined(INTERP_TEX) +#define TEX_UNIT_LOOP(CODE) \ + { \ + const GLuint u = 0; \ + CODE \ + } +#endif + + +static void NAME(GLcontext *ctx, const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2 ) +{ + typedef struct { + const SWvertex *v0, *v1; /* Y(v0) < Y(v1) */ +#if TRIANGLE_WALK_DOUBLE + GLdouble dx; /* X(v1) - X(v0) */ + GLdouble dy; /* Y(v1) - Y(v0) */ + GLdouble dxdy; /* dx/dy */ + GLdouble adjy; /* adjust from v[0]->fy to fsy, scaled */ + GLdouble fsx; /* first sample point x coord */ + GLdouble fsy; + GLdouble fx0; /*X of lower endpoint */ +#else + GLfloat dx; /* X(v1) - X(v0) */ + GLfloat dy; /* Y(v1) - Y(v0) */ + GLfloat dxdy; /* dx/dy */ + GLfixed fdxdy; /* dx/dy in fixed-point */ + GLfloat adjy; /* adjust from v[0]->fy to fsy, scaled */ + GLfixed fsx; /* first sample point x coord */ + GLfixed fsy; + GLfixed fx0; /* fixed pt X of lower endpoint */ +#endif + GLint lines; /* number of lines to be sampled on this edge */ + } EdgeT; + +#ifdef INTERP_Z + const GLint depthBits = ctx->DrawBuffer->Visual.depthBits; + const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0; + const GLfloat maxDepth = ctx->DrawBuffer->_DepthMaxF; +#define FixedToDepth(F) ((F) >> fixedToDepthShift) +#endif + EdgeT eMaj, eTop, eBot; + GLfloat oneOverArea; + const SWvertex *vMin, *vMid, *vMax; /* Y(vMin)<=Y(vMid)<=Y(vMax) */ + GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceSign; +#if !TRIANGLE_WALK_DOUBLE + const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1); /* for x/y coord snapping */ +#endif + GLinterp vMin_fx, vMin_fy, vMid_fx, vMid_fy, vMax_fx, vMax_fy; + + struct sw_span span; + + INIT_SPAN(span, GL_POLYGON, 0, 0, 0); + +#ifdef INTERP_Z + (void) fixedToDepthShift; +#endif + + /* + printf("%s()\n", __FUNCTION__); + printf(" %g, %g, %g\n", v0->win[0], v0->win[1], v0->win[2]); + printf(" %g, %g, %g\n", v1->win[0], v1->win[1], v1->win[2]); + printf(" %g, %g, %g\n", v2->win[0], v2->win[1], v2->win[2]); + */ + /* + ASSERT(v0->win[2] >= 0.0); + ASSERT(v1->win[2] >= 0.0); + ASSERT(v2->win[2] >= 0.0); + */ + /* Compute fixed point x,y coords w/ half-pixel offsets and snapping. + * And find the order of the 3 vertices along the Y axis. + */ + { +#if TRIANGLE_WALK_DOUBLE + const GLdouble fy0 = v0->win[1] - 0.5; + const GLdouble fy1 = v1->win[1] - 0.5; + const GLdouble fy2 = v2->win[1] - 0.5; +#else + const GLfixed fy0 = FloatToFixed(v0->win[1] - 0.5F) & snapMask; + const GLfixed fy1 = FloatToFixed(v1->win[1] - 0.5F) & snapMask; + const GLfixed fy2 = FloatToFixed(v2->win[1] - 0.5F) & snapMask; +#endif + if (fy0 <= fy1) { + if (fy1 <= fy2) { + /* y0 <= y1 <= y2 */ + vMin = v0; vMid = v1; vMax = v2; + vMin_fy = fy0; vMid_fy = fy1; vMax_fy = fy2; + } + else if (fy2 <= fy0) { + /* y2 <= y0 <= y1 */ + vMin = v2; vMid = v0; vMax = v1; + vMin_fy = fy2; vMid_fy = fy0; vMax_fy = fy1; + } + else { + /* y0 <= y2 <= y1 */ + vMin = v0; vMid = v2; vMax = v1; + vMin_fy = fy0; vMid_fy = fy2; vMax_fy = fy1; + bf = -bf; + } + } + else { + if (fy0 <= fy2) { + /* y1 <= y0 <= y2 */ + vMin = v1; vMid = v0; vMax = v2; + vMin_fy = fy1; vMid_fy = fy0; vMax_fy = fy2; + bf = -bf; + } + else if (fy2 <= fy1) { + /* y2 <= y1 <= y0 */ + vMin = v2; vMid = v1; vMax = v0; + vMin_fy = fy2; vMid_fy = fy1; vMax_fy = fy0; + bf = -bf; + } + else { + /* y1 <= y2 <= y0 */ + vMin = v1; vMid = v2; vMax = v0; + vMin_fy = fy1; vMid_fy = fy2; vMax_fy = fy0; + } + } + + /* fixed point X coords */ +#if TRIANGLE_WALK_DOUBLE + vMin_fx = vMin->win[0] + 0.5; + vMid_fx = vMid->win[0] + 0.5; + vMax_fx = vMax->win[0] + 0.5; +#else + vMin_fx = FloatToFixed(vMin->win[0] + 0.5F) & snapMask; + vMid_fx = FloatToFixed(vMid->win[0] + 0.5F) & snapMask; + vMax_fx = FloatToFixed(vMax->win[0] + 0.5F) & snapMask; +#endif + } + + /* vertex/edge relationship */ + eMaj.v0 = vMin; eMaj.v1 = vMax; /*TODO: .v1's not needed */ + eTop.v0 = vMid; eTop.v1 = vMax; + eBot.v0 = vMin; eBot.v1 = vMid; + + /* compute deltas for each edge: vertex[upper] - vertex[lower] */ +#if TRIANGLE_WALK_DOUBLE + eMaj.dx = vMax_fx - vMin_fx; + eMaj.dy = vMax_fy - vMin_fy; + eTop.dx = vMax_fx - vMid_fx; + eTop.dy = vMax_fy - vMid_fy; + eBot.dx = vMid_fx - vMin_fx; + eBot.dy = vMid_fy - vMin_fy; +#else + eMaj.dx = FixedToFloat(vMax_fx - vMin_fx); + eMaj.dy = FixedToFloat(vMax_fy - vMin_fy); + eTop.dx = FixedToFloat(vMax_fx - vMid_fx); + eTop.dy = FixedToFloat(vMax_fy - vMid_fy); + eBot.dx = FixedToFloat(vMid_fx - vMin_fx); + eBot.dy = FixedToFloat(vMid_fy - vMin_fy); +#endif + + /* compute area, oneOverArea and perform backface culling */ + { +#if TRIANGLE_WALK_DOUBLE + const GLdouble area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy; +#else + const GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy; +#endif + /* Do backface culling */ + if (area * bf < 0.0) + return; + + if (IS_INF_OR_NAN(area) || area == 0.0F) + return; + + oneOverArea = 1.0F / area; + } + + span.facing = ctx->_Facing; /* for 2-sided stencil test */ + + /* Edge setup. For a triangle strip these could be reused... */ + { +#if TRIANGLE_WALK_DOUBLE + eMaj.fsy = CEILF(vMin_fy); + eMaj.lines = (GLint) CEILF(vMax_fy - eMaj.fsy); +#else + eMaj.fsy = FixedCeil(vMin_fy); + eMaj.lines = FixedToInt(FixedCeil(vMax_fy - eMaj.fsy)); +#endif + if (eMaj.lines > 0) { + eMaj.dxdy = eMaj.dx / eMaj.dy; +#if TRIANGLE_WALK_DOUBLE + eMaj.adjy = (eMaj.fsy - vMin_fy) * FIXED_SCALE; /* SCALED! */ + eMaj.fx0 = vMin_fx; + eMaj.fsx = eMaj.fx0 + (eMaj.adjy * eMaj.dxdy) / (GLdouble) FIXED_SCALE; +#else + eMaj.fdxdy = SignedFloatToFixed(eMaj.dxdy); + eMaj.adjy = (GLfloat) (eMaj.fsy - vMin_fy); /* SCALED! */ + eMaj.fx0 = vMin_fx; + eMaj.fsx = eMaj.fx0 + (GLfixed) (eMaj.adjy * eMaj.dxdy); +#endif + } + else { + return; /*CULLED*/ + } + +#if TRIANGLE_WALK_DOUBLE + eTop.fsy = CEILF(vMid_fy); + eTop.lines = (GLint) CEILF(vMax_fy - eTop.fsy); +#else + eTop.fsy = FixedCeil(vMid_fy); + eTop.lines = FixedToInt(FixedCeil(vMax_fy - eTop.fsy)); +#endif + if (eTop.lines > 0) { + eTop.dxdy = eTop.dx / eTop.dy; +#if TRIANGLE_WALK_DOUBLE + eTop.adjy = (eTop.fsy - vMid_fy) * FIXED_SCALE; /* SCALED! */ + eTop.fx0 = vMid_fx; + eTop.fsx = eTop.fx0 + (eTop.adjy * eTop.dxdy) / (GLdouble) FIXED_SCALE; +#else + eTop.fdxdy = SignedFloatToFixed(eTop.dxdy); + eTop.adjy = (GLfloat) (eTop.fsy - vMid_fy); /* SCALED! */ + eTop.fx0 = vMid_fx; + eTop.fsx = eTop.fx0 + (GLfixed) (eTop.adjy * eTop.dxdy); +#endif + } + +#if TRIANGLE_WALK_DOUBLE + eBot.fsy = CEILF(vMin_fy); + eBot.lines = (GLint) CEILF(vMid_fy - eBot.fsy); +#else + eBot.fsy = FixedCeil(vMin_fy); + eBot.lines = FixedToInt(FixedCeil(vMid_fy - eBot.fsy)); +#endif + if (eBot.lines > 0) { + eBot.dxdy = eBot.dx / eBot.dy; +#if TRIANGLE_WALK_DOUBLE + eBot.adjy = (eBot.fsy - vMin_fy) * FIXED_SCALE; /* SCALED! */ + eBot.fx0 = vMin_fx; + eBot.fsx = eBot.fx0 + (eBot.adjy * eBot.dxdy) / (GLdouble) FIXED_SCALE; +#else + eBot.fdxdy = SignedFloatToFixed(eBot.dxdy); + eBot.adjy = (GLfloat) (eBot.fsy - vMin_fy); /* SCALED! */ + eBot.fx0 = vMin_fx; + eBot.fsx = eBot.fx0 + (GLfixed) (eBot.adjy * eBot.dxdy); +#endif + } + } + + /* + * Conceptually, we view a triangle as two subtriangles + * separated by a perfectly horizontal line. The edge that is + * intersected by this line is one with maximal absolute dy; we + * call it a ``major'' edge. The other two edges are the + * ``top'' edge (for the upper subtriangle) and the ``bottom'' + * edge (for the lower subtriangle). If either of these two + * edges is horizontal or very close to horizontal, the + * corresponding subtriangle might cover zero sample points; + * we take care to handle such cases, for performance as well + * as correctness. + * + * By stepping rasterization parameters along the major edge, + * we can avoid recomputing them at the discontinuity where + * the top and bottom edges meet. However, this forces us to + * be able to scan both left-to-right and right-to-left. + * Also, we must determine whether the major edge is at the + * left or right side of the triangle. We do this by + * computing the magnitude of the cross-product of the major + * and top edges. Since this magnitude depends on the sine of + * the angle between the two edges, its sign tells us whether + * we turn to the left or to the right when travelling along + * the major edge to the top edge, and from this we infer + * whether the major edge is on the left or the right. + * + * Serendipitously, this cross-product magnitude is also a + * value we need to compute the iteration parameter + * derivatives for the triangle, and it can be used to perform + * backface culling because its sign tells us whether the + * triangle is clockwise or counterclockwise. In this code we + * refer to it as ``area'' because it's also proportional to + * the pixel area of the triangle. + */ + + { + GLint scan_from_left_to_right; /* true if scanning left-to-right */ +#ifdef INTERP_INDEX + GLfloat didx, didy; +#endif + + /* + * Execute user-supplied setup code + */ +#ifdef SETUP_CODE + SETUP_CODE +#endif + + scan_from_left_to_right = (oneOverArea < 0.0F); + + + /* compute d?/dx and d?/dy derivatives */ +#ifdef INTERP_Z + span.interpMask |= SPAN_Z; + { + GLfloat eMaj_dz = vMax->win[2] - vMin->win[2]; + GLfloat eBot_dz = vMid->win[2] - vMin->win[2]; + span.dzdx = oneOverArea * (eMaj_dz * eBot.dy - eMaj.dy * eBot_dz); + if (span.dzdx > maxDepth || span.dzdx < -maxDepth) { + /* probably a sliver triangle */ + span.dzdx = 0.0; + span.dzdy = 0.0; + } + else { + span.dzdy = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx); + } + if (depthBits <= 16) + span.zStep = SignedFloatToFixed(span.dzdx); + else + span.zStep = (GLint) span.dzdx; + } +#endif +#ifdef INTERP_W + span.interpMask |= SPAN_W; + { + const GLfloat eMaj_dw = vMax->win[3] - vMin->win[3]; + const GLfloat eBot_dw = vMid->win[3] - vMin->win[3]; + span.dwdx = oneOverArea * (eMaj_dw * eBot.dy - eMaj.dy * eBot_dw); + span.dwdy = oneOverArea * (eMaj.dx * eBot_dw - eMaj_dw * eBot.dx); + } +#endif +#ifdef INTERP_FOG + span.interpMask |= SPAN_FOG; + { +# ifdef INTERP_W + const GLfloat wMax = vMax->win[3], wMin = vMin->win[3], wMid = vMid->win[3]; + const GLfloat eMaj_dfog = vMax->fog * wMax - vMin->fog * wMin; + const GLfloat eBot_dfog = vMid->fog * wMid - vMin->fog * wMin; +# else + const GLfloat eMaj_dfog = vMax->fog - vMin->fog; + const GLfloat eBot_dfog = vMid->fog - vMin->fog; +# endif + span.dfogdx = oneOverArea * (eMaj_dfog * eBot.dy - eMaj.dy * eBot_dfog); + span.dfogdy = oneOverArea * (eMaj.dx * eBot_dfog - eMaj_dfog * eBot.dx); + span.fogStep = span.dfogdx; + } +#endif +#ifdef INTERP_RGB + span.interpMask |= SPAN_RGBA; + if (ctx->Light.ShadeModel == GL_SMOOTH) { + GLfloat eMaj_dr = (GLfloat) ((ColorTemp) vMax->color[RCOMP] - (ColorTemp) vMin->color[RCOMP]); + GLfloat eBot_dr = (GLfloat) ((ColorTemp) vMid->color[RCOMP] - (ColorTemp) vMin->color[RCOMP]); + GLfloat eMaj_dg = (GLfloat) ((ColorTemp) vMax->color[GCOMP] - (ColorTemp) vMin->color[GCOMP]); + GLfloat eBot_dg = (GLfloat) ((ColorTemp) vMid->color[GCOMP] - (ColorTemp) vMin->color[GCOMP]); + GLfloat eMaj_db = (GLfloat) ((ColorTemp) vMax->color[BCOMP] - (ColorTemp) vMin->color[BCOMP]); + GLfloat eBot_db = (GLfloat) ((ColorTemp) vMid->color[BCOMP] - (ColorTemp) vMin->color[BCOMP]); +# ifdef INTERP_ALPHA + GLfloat eMaj_da = (GLfloat) ((ColorTemp) vMax->color[ACOMP] - (ColorTemp) vMin->color[ACOMP]); + GLfloat eBot_da = (GLfloat) ((ColorTemp) vMid->color[ACOMP] - (ColorTemp) vMin->color[ACOMP]); +# endif + span.drdx = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr); + span.drdy = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx); + span.dgdx = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg); + span.dgdy = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx); + span.dbdx = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db); + span.dbdy = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx); +# if CHAN_TYPE == GL_FLOAT + span.redStep = span.drdx; + span.greenStep = span.dgdx; + span.blueStep = span.dbdx; +# else + span.redStep = SignedFloatToFixed(span.drdx); + span.greenStep = SignedFloatToFixed(span.dgdx); + span.blueStep = SignedFloatToFixed(span.dbdx); +# endif /* GL_FLOAT */ +# ifdef INTERP_ALPHA + span.dadx = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da); + span.dady = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx); +# if CHAN_TYPE == GL_FLOAT + span.alphaStep = span.dadx; +# else + span.alphaStep = SignedFloatToFixed(span.dadx); +# endif /* GL_FLOAT */ +# endif /* INTERP_ALPHA */ + } + else { + ASSERT (ctx->Light.ShadeModel == GL_FLAT); + span.interpMask |= SPAN_FLAT; + span.drdx = span.drdy = 0.0F; + span.dgdx = span.dgdy = 0.0F; + span.dbdx = span.dbdy = 0.0F; +# if CHAN_TYPE == GL_FLOAT + span.redStep = 0.0F; + span.greenStep = 0.0F; + span.blueStep = 0.0F; +# else + span.redStep = 0; + span.greenStep = 0; + span.blueStep = 0; +# endif /* GL_FLOAT */ +# ifdef INTERP_ALPHA + span.dadx = span.dady = 0.0F; +# if CHAN_TYPE == GL_FLOAT + span.alphaStep = 0.0F; +# else + span.alphaStep = 0; +# endif /* GL_FLOAT */ +# endif + } +#endif /* INTERP_RGB */ +#ifdef INTERP_SPEC + span.interpMask |= SPAN_SPEC; + if (ctx->Light.ShadeModel == GL_SMOOTH) { + GLfloat eMaj_dsr = (GLfloat) ((ColorTemp) vMax->specular[RCOMP] - (ColorTemp) vMin->specular[RCOMP]); + GLfloat eBot_dsr = (GLfloat) ((ColorTemp) vMid->specular[RCOMP] - (ColorTemp) vMin->specular[RCOMP]); + GLfloat eMaj_dsg = (GLfloat) ((ColorTemp) vMax->specular[GCOMP] - (ColorTemp) vMin->specular[GCOMP]); + GLfloat eBot_dsg = (GLfloat) ((ColorTemp) vMid->specular[GCOMP] - (ColorTemp) vMin->specular[GCOMP]); + GLfloat eMaj_dsb = (GLfloat) ((ColorTemp) vMax->specular[BCOMP] - (ColorTemp) vMin->specular[BCOMP]); + GLfloat eBot_dsb = (GLfloat) ((ColorTemp) vMid->specular[BCOMP] - (ColorTemp) vMin->specular[BCOMP]); + span.dsrdx = oneOverArea * (eMaj_dsr * eBot.dy - eMaj.dy * eBot_dsr); + span.dsrdy = oneOverArea * (eMaj.dx * eBot_dsr - eMaj_dsr * eBot.dx); + span.dsgdx = oneOverArea * (eMaj_dsg * eBot.dy - eMaj.dy * eBot_dsg); + span.dsgdy = oneOverArea * (eMaj.dx * eBot_dsg - eMaj_dsg * eBot.dx); + span.dsbdx = oneOverArea * (eMaj_dsb * eBot.dy - eMaj.dy * eBot_dsb); + span.dsbdy = oneOverArea * (eMaj.dx * eBot_dsb - eMaj_dsb * eBot.dx); +# if CHAN_TYPE == GL_FLOAT + span.specRedStep = span.dsrdx; + span.specGreenStep = span.dsgdx; + span.specBlueStep = span.dsbdx; +# else + span.specRedStep = SignedFloatToFixed(span.dsrdx); + span.specGreenStep = SignedFloatToFixed(span.dsgdx); + span.specBlueStep = SignedFloatToFixed(span.dsbdx); +# endif + } + else { + span.dsrdx = span.dsrdy = 0.0F; + span.dsgdx = span.dsgdy = 0.0F; + span.dsbdx = span.dsbdy = 0.0F; +# if CHAN_TYPE == GL_FLOAT + span.specRedStep = 0.0F; + span.specGreenStep = 0.0F; + span.specBlueStep = 0.0F; +# else + span.specRedStep = 0; + span.specGreenStep = 0; + span.specBlueStep = 0; +# endif + } +#endif /* INTERP_SPEC */ +#ifdef INTERP_INDEX + span.interpMask |= SPAN_INDEX; + if (ctx->Light.ShadeModel == GL_SMOOTH) { + GLfloat eMaj_di = vMax->index - vMin->index; + GLfloat eBot_di = vMid->index - vMin->index; + didx = oneOverArea * (eMaj_di * eBot.dy - eMaj.dy * eBot_di); + didy = oneOverArea * (eMaj.dx * eBot_di - eMaj_di * eBot.dx); + span.indexStep = SignedFloatToFixed(didx); + } + else { + span.interpMask |= SPAN_FLAT; + didx = didy = 0.0F; + span.indexStep = 0; + } +#endif +#ifdef INTERP_INT_TEX + span.interpMask |= SPAN_INT_TEXTURE; + { + GLfloat eMaj_ds = (vMax->texcoord[0][0] - vMin->texcoord[0][0]) * S_SCALE; + GLfloat eBot_ds = (vMid->texcoord[0][0] - vMin->texcoord[0][0]) * S_SCALE; + GLfloat eMaj_dt = (vMax->texcoord[0][1] - vMin->texcoord[0][1]) * T_SCALE; + GLfloat eBot_dt = (vMid->texcoord[0][1] - vMin->texcoord[0][1]) * T_SCALE; + span.texStepX[0][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); + span.texStepY[0][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); + span.texStepX[0][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); + span.texStepY[0][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); + span.intTexStep[0] = SignedFloatToFixed(span.texStepX[0][0]); + span.intTexStep[1] = SignedFloatToFixed(span.texStepX[0][1]); + } +#endif +#ifdef INTERP_TEX + span.interpMask |= SPAN_TEXTURE; + { + /* win[3] is 1/W */ + const GLfloat wMax = vMax->win[3], wMin = vMin->win[3], wMid = vMid->win[3]; + TEX_UNIT_LOOP( + GLfloat eMaj_ds = vMax->texcoord[u][0] * wMax - vMin->texcoord[u][0] * wMin; + GLfloat eBot_ds = vMid->texcoord[u][0] * wMid - vMin->texcoord[u][0] * wMin; + GLfloat eMaj_dt = vMax->texcoord[u][1] * wMax - vMin->texcoord[u][1] * wMin; + GLfloat eBot_dt = vMid->texcoord[u][1] * wMid - vMin->texcoord[u][1] * wMin; + GLfloat eMaj_du = vMax->texcoord[u][2] * wMax - vMin->texcoord[u][2] * wMin; + GLfloat eBot_du = vMid->texcoord[u][2] * wMid - vMin->texcoord[u][2] * wMin; + GLfloat eMaj_dv = vMax->texcoord[u][3] * wMax - vMin->texcoord[u][3] * wMin; + GLfloat eBot_dv = vMid->texcoord[u][3] * wMid - vMin->texcoord[u][3] * wMin; + span.texStepX[u][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); + span.texStepY[u][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); + span.texStepX[u][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); + span.texStepY[u][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); + span.texStepX[u][2] = oneOverArea * (eMaj_du * eBot.dy - eMaj.dy * eBot_du); + span.texStepY[u][2] = oneOverArea * (eMaj.dx * eBot_du - eMaj_du * eBot.dx); + span.texStepX[u][3] = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv); + span.texStepY[u][3] = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx); + ) + } +#endif + + /* + * We always sample at pixel centers. However, we avoid + * explicit half-pixel offsets in this code by incorporating + * the proper offset in each of x and y during the + * transformation to window coordinates. + * + * We also apply the usual rasterization rules to prevent + * cracks and overlaps. A pixel is considered inside a + * subtriangle if it meets all of four conditions: it is on or + * to the right of the left edge, strictly to the left of the + * right edge, on or below the top edge, and strictly above + * the bottom edge. (Some edges may be degenerate.) + * + * The following discussion assumes left-to-right scanning + * (that is, the major edge is on the left); the right-to-left + * case is a straightforward variation. + * + * We start by finding the half-integral y coordinate that is + * at or below the top of the triangle. This gives us the + * first scan line that could possibly contain pixels that are + * inside the triangle. + * + * Next we creep down the major edge until we reach that y, + * and compute the corresponding x coordinate on the edge. + * Then we find the half-integral x that lies on or just + * inside the edge. This is the first pixel that might lie in + * the interior of the triangle. (We won't know for sure + * until we check the other edges.) + * + * As we rasterize the triangle, we'll step down the major + * edge. For each step in y, we'll move an integer number + * of steps in x. There are two possible x step sizes, which + * we'll call the ``inner'' step (guaranteed to land on the + * edge or inside it) and the ``outer'' step (guaranteed to + * land on the edge or outside it). The inner and outer steps + * differ by one. During rasterization we maintain an error + * term that indicates our distance from the true edge, and + * select either the inner step or the outer step, whichever + * gets us to the first pixel that falls inside the triangle. + * + * All parameters (z, red, etc.) as well as the buffer + * addresses for color and z have inner and outer step values, + * so that we can increment them appropriately. This method + * eliminates the need to adjust parameters by creeping a + * sub-pixel amount into the triangle at each scanline. + */ + + { + GLint subTriangle; + GLinterp fxLeftEdge = 0, fxRightEdge = 0; + GLinterp fdxLeftEdge = 0, fdxRightEdge = 0; + GLinterp fError = 0, fdError = 0; +#ifdef PIXEL_ADDRESS + PIXEL_TYPE *pRow = NULL; + GLint dPRowOuter = 0, dPRowInner; /* offset in bytes */ +#endif +#ifdef INTERP_Z +# ifdef DEPTH_TYPE + struct gl_renderbuffer *zrb + = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; + DEPTH_TYPE *zRow = NULL; + GLint dZRowOuter = 0, dZRowInner; /* offset in bytes */ +# endif + GLfixed zLeft = 0, fdzOuter = 0, fdzInner; +#endif +#ifdef INTERP_W + GLfloat wLeft = 0, dwOuter = 0, dwInner; +#endif +#ifdef INTERP_FOG + GLfloat fogLeft = 0, dfogOuter = 0, dfogInner; +#endif +#ifdef INTERP_RGB + ColorTemp rLeft = 0, fdrOuter = 0, fdrInner; + ColorTemp gLeft = 0, fdgOuter = 0, fdgInner; + ColorTemp bLeft = 0, fdbOuter = 0, fdbInner; +#endif +#ifdef INTERP_ALPHA + ColorTemp aLeft = 0, fdaOuter = 0, fdaInner; +#endif +#ifdef INTERP_SPEC + ColorTemp srLeft=0, dsrOuter=0, dsrInner; + ColorTemp sgLeft=0, dsgOuter=0, dsgInner; + ColorTemp sbLeft=0, dsbOuter=0, dsbInner; +#endif +#ifdef INTERP_INDEX + GLfixed iLeft=0, diOuter=0, diInner; +#endif +#ifdef INTERP_INT_TEX + GLfixed sLeft=0, dsOuter=0, dsInner; + GLfixed tLeft=0, dtOuter=0, dtInner; +#endif +#ifdef INTERP_TEX + GLfloat sLeft[MAX_TEXTURE_COORD_UNITS]; + GLfloat tLeft[MAX_TEXTURE_COORD_UNITS]; + GLfloat uLeft[MAX_TEXTURE_COORD_UNITS]; + GLfloat vLeft[MAX_TEXTURE_COORD_UNITS]; + GLfloat dsOuter[MAX_TEXTURE_COORD_UNITS], dsInner[MAX_TEXTURE_COORD_UNITS]; + GLfloat dtOuter[MAX_TEXTURE_COORD_UNITS], dtInner[MAX_TEXTURE_COORD_UNITS]; + GLfloat duOuter[MAX_TEXTURE_COORD_UNITS], duInner[MAX_TEXTURE_COORD_UNITS]; + GLfloat dvOuter[MAX_TEXTURE_COORD_UNITS], dvInner[MAX_TEXTURE_COORD_UNITS]; +#endif + + for (subTriangle=0; subTriangle<=1; subTriangle++) { + EdgeT *eLeft, *eRight; + int setupLeft, setupRight; + int lines; + + if (subTriangle==0) { + /* bottom half */ + if (scan_from_left_to_right) { + eLeft = &eMaj; + eRight = &eBot; + lines = eRight->lines; + setupLeft = 1; + setupRight = 1; + } + else { + eLeft = &eBot; + eRight = &eMaj; + lines = eLeft->lines; + setupLeft = 1; + setupRight = 1; + } + } + else { + /* top half */ + if (scan_from_left_to_right) { + eLeft = &eMaj; + eRight = &eTop; + lines = eRight->lines; + setupLeft = 0; + setupRight = 1; + } + else { + eLeft = &eTop; + eRight = &eMaj; + lines = eLeft->lines; + setupLeft = 1; + setupRight = 0; + } + if (lines == 0) + return; + } + + if (setupLeft && eLeft->lines > 0) { + const SWvertex *vLower = eLeft->v0; +#if TRIANGLE_WALK_DOUBLE + const GLdouble fsy = eLeft->fsy; + const GLdouble fsx = eLeft->fsx; + const GLdouble fx = CEILF(fsx); + const GLdouble adjx = (fx - eLeft->fx0) * FIXED_SCALE; /* SCALED! */ +#else + const GLfixed fsy = eLeft->fsy; + const GLfixed fsx = eLeft->fsx; /* no fractional part */ + const GLfixed fx = FixedCeil(fsx); /* no fractional part */ + const GLfixed adjx = (GLinterp) (fx - eLeft->fx0); /* SCALED! */ +#endif + const GLinterp adjy = (GLinterp) eLeft->adjy; /* SCALED! */ + GLint idxOuter; +#if TRIANGLE_WALK_DOUBLE + GLdouble dxOuter; + + fError = fx - fsx - 1.0; + fxLeftEdge = fsx; + fdxLeftEdge = eLeft->dxdy; + dxOuter = FLOORF(fdxLeftEdge); + fdError = dxOuter - fdxLeftEdge + 1.0; + idxOuter = (GLint) dxOuter; + span.y = (GLint) fsy; +#else + GLfloat dxOuter; + GLfixed fdxOuter; + + fError = fx - fsx - FIXED_ONE; + fxLeftEdge = fsx - FIXED_EPSILON; + fdxLeftEdge = eLeft->fdxdy; + fdxOuter = FixedFloor(fdxLeftEdge - FIXED_EPSILON); + fdError = fdxOuter - fdxLeftEdge + FIXED_ONE; + idxOuter = FixedToInt(fdxOuter); + dxOuter = (GLfloat) idxOuter; + span.y = FixedToInt(fsy); +#endif + + /* silence warnings on some compilers */ + (void) dxOuter; + (void) adjx; + (void) adjy; + (void) vLower; + +#ifdef PIXEL_ADDRESS + { + pRow = (PIXEL_TYPE *) PIXEL_ADDRESS(InterpToInt(fxLeftEdge), span.y); + dPRowOuter = -((int)BYTES_PER_ROW) + idxOuter * sizeof(PIXEL_TYPE); + /* negative because Y=0 at bottom and increases upward */ + } +#endif + /* + * Now we need the set of parameter (z, color, etc.) values at + * the point (fx, fsy). This gives us properly-sampled parameter + * values that we can step from pixel to pixel. Furthermore, + * although we might have intermediate results that overflow + * the normal parameter range when we step temporarily outside + * the triangle, we shouldn't overflow or underflow for any + * pixel that's actually inside the triangle. + */ + +#ifdef INTERP_Z + { + GLfloat z0 = vLower->win[2]; + if (depthBits <= 16) { + /* interpolate fixed-pt values */ + GLfloat tmp = (z0 * FIXED_SCALE + span.dzdx * adjx + span.dzdy * adjy) + FIXED_HALF; + if (tmp < MAX_GLUINT / 2) + zLeft = (GLfixed) tmp; + else + zLeft = MAX_GLUINT / 2; + fdzOuter = SignedFloatToFixed(span.dzdy + dxOuter * span.dzdx); + } + else { + /* interpolate depth values exactly */ + zLeft = (GLint) (z0 + span.dzdx * FixedToFloat(adjx) + span.dzdy * FixedToFloat(adjy)); + fdzOuter = (GLint) (span.dzdy + dxOuter * span.dzdx); + } +# ifdef DEPTH_TYPE + zRow = (DEPTH_TYPE *) + zrb->GetPointer(ctx, zrb, InterpToInt(fxLeftEdge), span.y); + dZRowOuter = (ctx->DrawBuffer->Width + idxOuter) * sizeof(DEPTH_TYPE); +# endif + } +#endif +#ifdef INTERP_W + wLeft = vLower->win[3] + (span.dwdx * adjx + span.dwdy * adjy) * (1.0F/FIXED_SCALE); + dwOuter = span.dwdy + dxOuter * span.dwdx; +#endif +#ifdef INTERP_FOG +# ifdef INTERP_W + fogLeft = vLower->fog * vLower->win[3] + (span.dfogdx * adjx + span.dfogdy * adjy) * (1.0F/FIXED_SCALE); +# else + fogLeft = vLower->fog + (span.dfogdx * adjx + span.dfogdy * adjy) * (1.0F/FIXED_SCALE); +# endif + dfogOuter = span.dfogdy + dxOuter * span.dfogdx; +#endif +#ifdef INTERP_RGB + if (ctx->Light.ShadeModel == GL_SMOOTH) { +# if CHAN_TYPE == GL_FLOAT + rLeft = vLower->color[RCOMP] + (span.drdx * adjx + span.drdy * adjy) * (1.0F / FIXED_SCALE); + gLeft = vLower->color[GCOMP] + (span.dgdx * adjx + span.dgdy * adjy) * (1.0F / FIXED_SCALE); + bLeft = vLower->color[BCOMP] + (span.dbdx * adjx + span.dbdy * adjy) * (1.0F / FIXED_SCALE); + fdrOuter = span.drdy + dxOuter * span.drdx; + fdgOuter = span.dgdy + dxOuter * span.dgdx; + fdbOuter = span.dbdy + dxOuter * span.dbdx; +# else + rLeft = (GLint)(ChanToFixed(vLower->color[RCOMP]) + span.drdx * adjx + span.drdy * adjy) + FIXED_HALF; + gLeft = (GLint)(ChanToFixed(vLower->color[GCOMP]) + span.dgdx * adjx + span.dgdy * adjy) + FIXED_HALF; + bLeft = (GLint)(ChanToFixed(vLower->color[BCOMP]) + span.dbdx * adjx + span.dbdy * adjy) + FIXED_HALF; + fdrOuter = SignedFloatToFixed(span.drdy + dxOuter * span.drdx); + fdgOuter = SignedFloatToFixed(span.dgdy + dxOuter * span.dgdx); + fdbOuter = SignedFloatToFixed(span.dbdy + dxOuter * span.dbdx); +# endif +# ifdef INTERP_ALPHA +# if CHAN_TYPE == GL_FLOAT + aLeft = vLower->color[ACOMP] + (span.dadx * adjx + span.dady * adjy) * (1.0F / FIXED_SCALE); + fdaOuter = span.dady + dxOuter * span.dadx; +# else + aLeft = (GLint)(ChanToFixed(vLower->color[ACOMP]) + span.dadx * adjx + span.dady * adjy) + FIXED_HALF; + fdaOuter = SignedFloatToFixed(span.dady + dxOuter * span.dadx); +# endif +# endif + } + else { + ASSERT (ctx->Light.ShadeModel == GL_FLAT); +# if CHAN_TYPE == GL_FLOAT + rLeft = v2->color[RCOMP]; + gLeft = v2->color[GCOMP]; + bLeft = v2->color[BCOMP]; + fdrOuter = fdgOuter = fdbOuter = 0.0F; +# else + rLeft = ChanToFixed(v2->color[RCOMP]); + gLeft = ChanToFixed(v2->color[GCOMP]); + bLeft = ChanToFixed(v2->color[BCOMP]); + fdrOuter = fdgOuter = fdbOuter = 0; +# endif +# ifdef INTERP_ALPHA +# if CHAN_TYPE == GL_FLOAT + aLeft = v2->color[ACOMP]; + fdaOuter = 0.0F; +# else + aLeft = ChanToFixed(v2->color[ACOMP]); + fdaOuter = 0; +# endif +# endif + } +#endif + +#ifdef INTERP_SPEC + if (ctx->Light.ShadeModel == GL_SMOOTH) { +# if CHAN_TYPE == GL_FLOAT + srLeft = vLower->specular[RCOMP] + (span.dsrdx * adjx + span.dsrdy * adjy) * (1.0F / FIXED_SCALE); + sgLeft = vLower->specular[GCOMP] + (span.dsgdx * adjx + span.dsgdy * adjy) * (1.0F / FIXED_SCALE); + sbLeft = vLower->specular[BCOMP] + (span.dsbdx * adjx + span.dsbdy * adjy) * (1.0F / FIXED_SCALE); + dsrOuter = span.dsrdy + dxOuter * span.dsrdx; + dsgOuter = span.dsgdy + dxOuter * span.dsgdx; + dsbOuter = span.dsbdy + dxOuter * span.dsbdx; +# else + srLeft = (GLfixed) (ChanToFixed(vLower->specular[RCOMP]) + span.dsrdx * adjx + span.dsrdy * adjy) + FIXED_HALF; + sgLeft = (GLfixed) (ChanToFixed(vLower->specular[GCOMP]) + span.dsgdx * adjx + span.dsgdy * adjy) + FIXED_HALF; + sbLeft = (GLfixed) (ChanToFixed(vLower->specular[BCOMP]) + span.dsbdx * adjx + span.dsbdy * adjy) + FIXED_HALF; + dsrOuter = SignedFloatToFixed(span.dsrdy + dxOuter * span.dsrdx); + dsgOuter = SignedFloatToFixed(span.dsgdy + dxOuter * span.dsgdx); + dsbOuter = SignedFloatToFixed(span.dsbdy + dxOuter * span.dsbdx); +# endif + } + else { +#if CHAN_TYPE == GL_FLOAT + srLeft = v2->specular[RCOMP]; + sgLeft = v2->specular[GCOMP]; + sbLeft = v2->specular[BCOMP]; + dsrOuter = dsgOuter = dsbOuter = 0.0F; +# else + srLeft = ChanToFixed(v2->specular[RCOMP]); + sgLeft = ChanToFixed(v2->specular[GCOMP]); + sbLeft = ChanToFixed(v2->specular[BCOMP]); + dsrOuter = dsgOuter = dsbOuter = 0; +# endif + } +#endif + +#ifdef INTERP_INDEX + if (ctx->Light.ShadeModel == GL_SMOOTH) { + iLeft = (GLfixed)(vLower->index * FIXED_SCALE + + didx * adjx + didy * adjy) + FIXED_HALF; + diOuter = SignedFloatToFixed(didy + dxOuter * didx); + } + else { + iLeft = FloatToFixed(v2->index); + diOuter = 0; + } +#endif +#ifdef INTERP_INT_TEX + { + GLfloat s0, t0; + s0 = vLower->texcoord[0][0] * S_SCALE; + sLeft = (GLfixed)(s0 * FIXED_SCALE + span.texStepX[0][0] * adjx + + span.texStepY[0][0] * adjy) + FIXED_HALF; + dsOuter = SignedFloatToFixed(span.texStepY[0][0] + dxOuter * span.texStepX[0][0]); + + t0 = vLower->texcoord[0][1] * T_SCALE; + tLeft = (GLfixed)(t0 * FIXED_SCALE + span.texStepX[0][1] * adjx + + span.texStepY[0][1] * adjy) + FIXED_HALF; + dtOuter = SignedFloatToFixed(span.texStepY[0][1] + dxOuter * span.texStepX[0][1]); + } +#endif +#ifdef INTERP_TEX + TEX_UNIT_LOOP( + const GLfloat invW = vLower->win[3]; + const GLfloat s0 = vLower->texcoord[u][0] * invW; + const GLfloat t0 = vLower->texcoord[u][1] * invW; + const GLfloat u0 = vLower->texcoord[u][2] * invW; + const GLfloat v0 = vLower->texcoord[u][3] * invW; + sLeft[u] = s0 + (span.texStepX[u][0] * adjx + span.texStepY[u][0] * adjy) * (1.0F/FIXED_SCALE); + tLeft[u] = t0 + (span.texStepX[u][1] * adjx + span.texStepY[u][1] * adjy) * (1.0F/FIXED_SCALE); + uLeft[u] = u0 + (span.texStepX[u][2] * adjx + span.texStepY[u][2] * adjy) * (1.0F/FIXED_SCALE); + vLeft[u] = v0 + (span.texStepX[u][3] * adjx + span.texStepY[u][3] * adjy) * (1.0F/FIXED_SCALE); + dsOuter[u] = span.texStepY[u][0] + dxOuter * span.texStepX[u][0]; + dtOuter[u] = span.texStepY[u][1] + dxOuter * span.texStepX[u][1]; + duOuter[u] = span.texStepY[u][2] + dxOuter * span.texStepX[u][2]; + dvOuter[u] = span.texStepY[u][3] + dxOuter * span.texStepX[u][3]; + ) +#endif + } /*if setupLeft*/ + + + if (setupRight && eRight->lines>0) { +#if TRIANGLE_WALK_DOUBLE + fxRightEdge = eRight->fsx; + fdxRightEdge = eRight->dxdy; +#else + fxRightEdge = eRight->fsx - FIXED_EPSILON; + fdxRightEdge = eRight->fdxdy; +#endif + } + + if (lines==0) { + continue; + } + + + /* Rasterize setup */ +#ifdef PIXEL_ADDRESS + dPRowInner = dPRowOuter + sizeof(PIXEL_TYPE); +#endif +#ifdef INTERP_Z +# ifdef DEPTH_TYPE + dZRowInner = dZRowOuter + sizeof(DEPTH_TYPE); +# endif + fdzInner = fdzOuter + span.zStep; +#endif +#ifdef INTERP_W + dwInner = dwOuter + span.dwdx; +#endif +#ifdef INTERP_FOG + dfogInner = dfogOuter + span.dfogdx; +#endif +#ifdef INTERP_RGB + fdrInner = fdrOuter + span.redStep; + fdgInner = fdgOuter + span.greenStep; + fdbInner = fdbOuter + span.blueStep; +#endif +#ifdef INTERP_ALPHA + fdaInner = fdaOuter + span.alphaStep; +#endif +#ifdef INTERP_SPEC + dsrInner = dsrOuter + span.specRedStep; + dsgInner = dsgOuter + span.specGreenStep; + dsbInner = dsbOuter + span.specBlueStep; +#endif +#ifdef INTERP_INDEX + diInner = diOuter + span.indexStep; +#endif +#ifdef INTERP_INT_TEX + dsInner = dsOuter + span.intTexStep[0]; + dtInner = dtOuter + span.intTexStep[1]; +#endif +#ifdef INTERP_TEX + TEX_UNIT_LOOP( + dsInner[u] = dsOuter[u] + span.texStepX[u][0]; + dtInner[u] = dtOuter[u] + span.texStepX[u][1]; + duInner[u] = duOuter[u] + span.texStepX[u][2]; + dvInner[u] = dvOuter[u] + span.texStepX[u][3]; + ) +#endif + + while (lines > 0) { + /* initialize the span interpolants to the leftmost value */ + /* ff = fixed-pt fragment */ + const GLint right = InterpToInt(fxRightEdge); + span.x = InterpToInt(fxLeftEdge); + if (right <= span.x) + span.end = 0; + else + span.end = right - span.x; + +#ifdef INTERP_Z + span.z = zLeft; +#endif +#ifdef INTERP_W + span.w = wLeft; +#endif +#ifdef INTERP_FOG + span.fog = fogLeft; +#endif +#ifdef INTERP_RGB + span.red = rLeft; + span.green = gLeft; + span.blue = bLeft; +#endif +#ifdef INTERP_ALPHA + span.alpha = aLeft; +#endif +#ifdef INTERP_SPEC + span.specRed = srLeft; + span.specGreen = sgLeft; + span.specBlue = sbLeft; +#endif +#ifdef INTERP_INDEX + span.index = iLeft; +#endif +#ifdef INTERP_INT_TEX + span.intTex[0] = sLeft; + span.intTex[1] = tLeft; +#endif + +#ifdef INTERP_TEX + TEX_UNIT_LOOP( + span.tex[u][0] = sLeft[u]; + span.tex[u][1] = tLeft[u]; + span.tex[u][2] = uLeft[u]; + span.tex[u][3] = vLeft[u]; + ) +#endif + + if (span.end > 1) { + /* Under rare circumstances, we might have to fudge the + * colors. XXX does this really happen anymore??? + */ + const GLint len = span.end - 1; + (void) len; +#ifdef INTERP_RGB + { + GLfixed ffrend = span.red + len * span.redStep; + GLfixed ffgend = span.green + len * span.greenStep; + GLfixed ffbend = span.blue + len * span.blueStep; + if (ffrend < 0) { + span.red -= ffrend; + if (span.red < 0) + span.red = 0; + } + if (ffgend < 0) { + span.green -= ffgend; + if (span.green < 0) + span.green = 0; + } + if (ffbend < 0) { + span.blue -= ffbend; + if (span.blue < 0) + span.blue = 0; + } + } +#endif +#ifdef INTERP_ALPHA + { + GLfixed ffaend = span.alpha + len * span.alphaStep; + if (ffaend < 0) { + span.alpha -= ffaend; + if (span.alpha < 0) + span.alpha = 0; + } + } +#endif +#ifdef INTERP_SPEC + { + GLfixed ffsrend = span.specRed + len * span.specRedStep; + GLfixed ffsgend = span.specGreen + len * span.specGreenStep; + GLfixed ffsbend = span.specBlue + len * span.specBlueStep; + if (ffsrend < 0) { + span.specRed -= ffsrend; + if (span.specRed < 0) + span.specRed = 0; + } + if (ffsgend < 0) { + span.specGreen -= ffsgend; + if (span.specGreen < 0) + span.specGreen = 0; + } + if (ffsbend < 0) { + span.specBlue -= ffsbend; + if (span.specBlue < 0) + span.specBlue = 0; + } + } +#endif +#ifdef INTERP_INDEX + if (span.index < 0) + span.index = 0; +#endif + } /* span.end > 1 */ + + /* This is where we actually generate fragments */ + /* XXX the test for span.y > 0 _shouldn't_ be needed but + * it fixes a problem on 64-bit Opterons (bug 4842). + */ + if (span.end > 0 && span.y >= 0) { + RENDER_SPAN( span ); + } + + /* + * Advance to the next scan line. Compute the + * new edge coordinates, and adjust the + * pixel-center x coordinate so that it stays + * on or inside the major edge. + */ + span.y++; + lines--; + + fxLeftEdge += fdxLeftEdge; + fxRightEdge += fdxRightEdge; + + fError += fdError; + if (fError >= 0) { + fError -= INTERP_ONE; + +#ifdef PIXEL_ADDRESS + pRow = (PIXEL_TYPE *) ((GLubyte *) pRow + dPRowOuter); +#endif +#ifdef INTERP_Z +# ifdef DEPTH_TYPE + zRow = (DEPTH_TYPE *) ((GLubyte *) zRow + dZRowOuter); +# endif + zLeft += fdzOuter; +#endif +#ifdef INTERP_W + wLeft += dwOuter; +#endif +#ifdef INTERP_FOG + fogLeft += dfogOuter; +#endif +#ifdef INTERP_RGB + rLeft += fdrOuter; + gLeft += fdgOuter; + bLeft += fdbOuter; +#endif +#ifdef INTERP_ALPHA + aLeft += fdaOuter; +#endif +#ifdef INTERP_SPEC + srLeft += dsrOuter; + sgLeft += dsgOuter; + sbLeft += dsbOuter; +#endif +#ifdef INTERP_INDEX + iLeft += diOuter; +#endif +#ifdef INTERP_INT_TEX + sLeft += dsOuter; + tLeft += dtOuter; +#endif +#ifdef INTERP_TEX + TEX_UNIT_LOOP( + sLeft[u] += dsOuter[u]; + tLeft[u] += dtOuter[u]; + uLeft[u] += duOuter[u]; + vLeft[u] += dvOuter[u]; + ) +#endif + } + else { +#ifdef PIXEL_ADDRESS + pRow = (PIXEL_TYPE *) ((GLubyte *) pRow + dPRowInner); +#endif +#ifdef INTERP_Z +# ifdef DEPTH_TYPE + zRow = (DEPTH_TYPE *) ((GLubyte *) zRow + dZRowInner); +# endif + zLeft += fdzInner; +#endif +#ifdef INTERP_W + wLeft += dwInner; +#endif +#ifdef INTERP_FOG + fogLeft += dfogInner; +#endif +#ifdef INTERP_RGB + rLeft += fdrInner; + gLeft += fdgInner; + bLeft += fdbInner; +#endif +#ifdef INTERP_ALPHA + aLeft += fdaInner; +#endif +#ifdef INTERP_SPEC + srLeft += dsrInner; + sgLeft += dsgInner; + sbLeft += dsbInner; +#endif +#ifdef INTERP_INDEX + iLeft += diInner; +#endif +#ifdef INTERP_INT_TEX + sLeft += dsInner; + tLeft += dtInner; +#endif +#ifdef INTERP_TEX + TEX_UNIT_LOOP( + sLeft[u] += dsInner[u]; + tLeft[u] += dtInner[u]; + uLeft[u] += duInner[u]; + vLeft[u] += dvInner[u]; + ) +#endif + } + } /*while lines>0*/ + + } /* for subTriangle */ + + } +#ifdef CLEANUP_CODE + CLEANUP_CODE +#endif + } +} + +#undef SETUP_CODE +#undef CLEANUP_CODE +#undef RENDER_SPAN + +#undef PIXEL_TYPE +#undef BYTES_PER_ROW +#undef PIXEL_ADDRESS +#undef DEPTH_TYPE + +#undef INTERP_Z +#undef INTERP_W +#undef INTERP_FOG +#undef INTERP_RGB +#undef INTERP_ALPHA +#undef INTERP_SPEC +#undef INTERP_INDEX +#undef INTERP_INT_TEX +#undef INTERP_TEX +#undef INTERP_MULTITEX +#undef TEX_UNIT_LOOP + +#undef S_SCALE +#undef T_SCALE + +#undef FixedToDepth +#undef ColorTemp +#undef GLinterp +#undef InterpToInt +#undef INTERP_ONE + +#undef NAME diff --git a/reactos/dll/mesa32/src/swrast/s_zoom.c b/reactos/dll/mesa32/src/swrast/s_zoom.c new file mode 100644 index 00000000000..b67a2970109 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast/s_zoom.c @@ -0,0 +1,428 @@ + +/* + * 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. + */ + +#include "glheader.h" +#include "macros.h" +#include "imports.h" +#include "colormac.h" + +#include "s_context.h" +#include "s_span.h" +#include "s_stencil.h" +#include "s_zoom.h" + + +/* + * Helper function called from _swrast_write_zoomed_rgba/rgb/index_span(). + */ +static void +zoom_span( GLcontext *ctx, const struct sw_span *span, + const GLvoid *src, GLint y0, GLenum format, GLint skipPixels ) +{ + GLint r0, r1, row; + GLint c0, c1, skipCol; + GLint i, j; + const GLuint maxWidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH ); + struct sw_span zoomed; + struct span_arrays zoomed_arrays; /* this is big! */ + + /* no pixel arrays! must be horizontal spans. */ + ASSERT((span->arrayMask & SPAN_XY) == 0); + ASSERT(span->primitive == GL_BITMAP); + + INIT_SPAN(zoomed, GL_BITMAP, 0, 0, 0); + zoomed.array = &zoomed_arrays; + + /* copy fog interp info */ + zoomed.fog = span->fog; + zoomed.fogStep = span->fogStep; + /* XXX copy texcoord info? */ + + if (format == GL_RGBA || format == GL_RGB) { + /* copy Z info */ + zoomed.z = span->z; + zoomed.zStep = span->zStep; + /* we'll generate an array of colorss */ + zoomed.interpMask = span->interpMask & ~SPAN_RGBA; + zoomed.arrayMask |= SPAN_RGBA; + } + else if (format == GL_COLOR_INDEX) { + /* copy Z info */ + zoomed.z = span->z; + zoomed.zStep = span->zStep; + /* we'll generate an array of color indexes */ + zoomed.interpMask = span->interpMask & ~SPAN_INDEX; + zoomed.arrayMask |= SPAN_INDEX; + } + else { + assert(format == GL_DEPTH_COMPONENT); + /* Copy color info */ + zoomed.red = span->red; + zoomed.green = span->green; + zoomed.blue = span->blue; + zoomed.alpha = span->alpha; + zoomed.redStep = span->redStep; + zoomed.greenStep = span->greenStep; + zoomed.blueStep = span->blueStep; + zoomed.alphaStep = span->alphaStep; + /* we'll generate an array of depth values */ + zoomed.interpMask = span->interpMask & ~SPAN_Z; + zoomed.arrayMask |= SPAN_Z; + } + + /* + * Compute which columns to draw: [c0, c1) + */ + c0 = (GLint) (span->x + skipPixels * ctx->Pixel.ZoomX); + c1 = (GLint) (span->x + (skipPixels + span->end) * ctx->Pixel.ZoomX); + if (c0 == c1) { + return; + } + else if (c1 < c0) { + /* swap */ + GLint ctmp = c1; + c1 = c0; + c0 = ctmp; + } + if (c0 < 0) { + zoomed.x = 0; + zoomed.start = 0; + zoomed.end = c1; + skipCol = -c0; + } + else { + zoomed.x = c0; + zoomed.start = 0; + zoomed.end = c1 - c0; + skipCol = 0; + } + if (zoomed.end > maxWidth) + zoomed.end = maxWidth; + + /* + * Compute which rows to draw: [r0, r1) + */ + row = span->y - y0; + r0 = y0 + (GLint) (row * ctx->Pixel.ZoomY); + r1 = y0 + (GLint) ((row+1) * ctx->Pixel.ZoomY); + if (r0 == r1) { + return; + } + else if (r1 < r0) { + /* swap */ + GLint rtmp = r1; + r1 = r0; + r0 = rtmp; + } + + ASSERT(r0 < r1); + ASSERT(c0 < c1); + + /* + * Trivial clip rejection testing. + */ + if (r1 < 0) /* below window */ + return; + if (r0 >= (GLint) ctx->DrawBuffer->Height) /* above window */ + return; + if (c1 < 0) /* left of window */ + return; + if (c0 >= (GLint) ctx->DrawBuffer->Width) /* right of window */ + return; + + /* zoom the span horizontally */ + if (format == GL_RGBA) { + const GLchan (*rgba)[4] = (const GLchan (*)[4]) src; + if (ctx->Pixel.ZoomX == -1.0F) { + /* common case */ + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = span->end - (j + skipCol) - 1; + COPY_CHAN4(zoomed.array->rgba[j], rgba[i]); + } + } + else { + /* general solution */ + const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = (GLint) ((j + skipCol) * xscale); + if (ctx->Pixel.ZoomX < 0.0) { + ASSERT(i <= 0); + i = span->end + i - 1; + } + ASSERT(i >= 0); + ASSERT(i < (GLint) span->end); + COPY_CHAN4(zoomed.array->rgba[j], rgba[i]); + } + } + } + else if (format == GL_RGB) { + const GLchan (*rgb)[3] = (const GLchan (*)[3]) src; + if (ctx->Pixel.ZoomX == -1.0F) { + /* common case */ + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = span->end - (j + skipCol) - 1; + zoomed.array->rgba[j][0] = rgb[i][0]; + zoomed.array->rgba[j][1] = rgb[i][1]; + zoomed.array->rgba[j][2] = rgb[i][2]; + zoomed.array->rgba[j][3] = CHAN_MAX; + } + } + else { + /* general solution */ + const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = (GLint) ((j + skipCol) * xscale); + if (ctx->Pixel.ZoomX < 0.0) { + ASSERT(i <= 0); + i = span->end + i - 1; + } + ASSERT(i >= 0); + ASSERT(i < (GLint) span->end); + zoomed.array->rgba[j][0] = rgb[i][0]; + zoomed.array->rgba[j][1] = rgb[i][1]; + zoomed.array->rgba[j][2] = rgb[i][2]; + zoomed.array->rgba[j][3] = CHAN_MAX; + } + } + } + else if (format == GL_COLOR_INDEX) { + const GLuint *indexes = (const GLuint *) src; + if (ctx->Pixel.ZoomX == -1.0F) { + /* common case */ + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = span->end - (j + skipCol) - 1; + zoomed.array->index[j] = indexes[i]; + } + } + else { + /* general solution */ + const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = (GLint) ((j + skipCol) * xscale); + if (ctx->Pixel.ZoomX < 0.0) { + ASSERT(i <= 0); + i = span->end + i - 1; + } + ASSERT(i >= 0); + ASSERT(i < (GLint) span->end); + zoomed.array->index[j] = indexes[i]; + } + } + } + else { + const GLdepth *zValues = (const GLuint *) src; + assert(format == GL_DEPTH_COMPONENT); + if (ctx->Pixel.ZoomX == -1.0F) { + /* common case */ + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = span->end - (j + skipCol) - 1; + zoomed.array->z[j] = zValues[i]; + } + } + else { + /* general solution */ + const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = (GLint) ((j + skipCol) * xscale); + if (ctx->Pixel.ZoomX < 0.0) { + ASSERT(i <= 0); + i = span->end + i - 1; + } + ASSERT(i >= 0); + ASSERT(i < (GLint) span->end); + zoomed.array->z[j] = zValues[i]; + } + } + /* Now, fall into either the RGB or COLOR_INDEX path below */ + if (ctx->Visual.rgbMode) + format = GL_RGBA; + else + format = GL_COLOR_INDEX; + } + + + /* write the span in rows [r0, r1) */ + if (format == GL_RGBA || format == GL_RGB) { + /* Writing the span may modify the colors, so make a backup now if we're + * going to call _swrast_write_zoomed_span() more than once. + * Also, clipping may change the span end value, so store it as well. + */ + GLchan rgbaSave[MAX_WIDTH][4]; + const GLint end = zoomed.end; /* save */ + if (r1 - r0 > 1) { + MEMCPY(rgbaSave, zoomed.array->rgba, zoomed.end * 4 * sizeof(GLchan)); + } + for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) { + _swrast_write_rgba_span(ctx, &zoomed); + zoomed.end = end; /* restore */ + if (r1 - r0 > 1) { + /* restore the colors */ + MEMCPY(zoomed.array->rgba, rgbaSave, zoomed.end*4 * sizeof(GLchan)); + } + } + } + else if (format == GL_COLOR_INDEX) { + GLuint indexSave[MAX_WIDTH]; + const GLint end = zoomed.end; /* save */ + if (r1 - r0 > 1) { + MEMCPY(indexSave, zoomed.array->index, zoomed.end * sizeof(GLuint)); + } + for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) { + _swrast_write_index_span(ctx, &zoomed); + zoomed.end = end; /* restore */ + if (r1 - r0 > 1) { + /* restore the colors */ + MEMCPY(zoomed.array->index, indexSave, zoomed.end * sizeof(GLuint)); + } + } + } +} + + +void +_swrast_write_zoomed_rgba_span( GLcontext *ctx, const struct sw_span *span, + CONST GLchan rgba[][4], GLint y0, + GLint skipPixels ) +{ + zoom_span(ctx, span, (const GLvoid *) rgba, y0, GL_RGBA, skipPixels); +} + + +void +_swrast_write_zoomed_rgb_span( GLcontext *ctx, const struct sw_span *span, + CONST GLchan rgb[][3], GLint y0, + GLint skipPixels ) +{ + zoom_span(ctx, span, (const GLvoid *) rgb, y0, GL_RGB, skipPixels); +} + + +void +_swrast_write_zoomed_index_span( GLcontext *ctx, const struct sw_span *span, + GLint y0, GLint skipPixels ) +{ + zoom_span(ctx, span, (const GLvoid *) span->array->index, y0, + GL_COLOR_INDEX, skipPixels); +} + + +void +_swrast_write_zoomed_depth_span( GLcontext *ctx, const struct sw_span *span, + GLint y0, GLint skipPixels ) +{ + zoom_span(ctx, span, (const GLvoid *) span->array->z, y0, + GL_DEPTH_COMPONENT, skipPixels); +} + + +/* + * As above, but write stencil values. + */ +void +_swrast_write_zoomed_stencil_span( GLcontext *ctx, + GLuint n, GLint x, GLint y, + const GLstencil stencil[], GLint y0, + GLint skipPixels ) +{ + GLint m; + GLint r0, r1, row, r; + GLint i, j, skipcol; + GLstencil zstencil[MAX_WIDTH]; /* zoomed stencil values */ + GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH ); + + (void) skipPixels; /* XXX this shouldn't be ignored */ + + /* compute width of output row */ + m = (GLint) FABSF( n * ctx->Pixel.ZoomX ); + if (m==0) { + return; + } + if (ctx->Pixel.ZoomX<0.0) { + /* adjust x coordinate for left/right mirroring */ + x = x - m; + } + + /* compute which rows to draw */ + row = y - y0; + r0 = y0 + (GLint) (row * ctx->Pixel.ZoomY); + r1 = y0 + (GLint) ((row+1) * ctx->Pixel.ZoomY); + if (r0==r1) { + return; + } + else if (r1= (GLint) ctx->DrawBuffer->Height && + r1 >= (GLint) ctx->DrawBuffer->Height) { + /* above window */ + return; + } + + /* check if left edge is outside window */ + skipcol = 0; + if (x<0) { + skipcol = -x; + m += x; + } + /* make sure span isn't too long or short */ + if (m>maxwidth) { + m = maxwidth; + } + else if (m<=0) { + return; + } + + ASSERT( m <= MAX_WIDTH ); + + /* zoom the span horizontally */ + if (ctx->Pixel.ZoomX==-1.0F) { + /* n==m */ + for (j=0;jPixel.ZoomX; + for (j=0;j + */ + +#ifndef SWRAST_H +#define SWRAST_H + +#include "mtypes.h" + +/** + * \struct SWvertex + * \brief Data-structure to handle vertices in the software rasterizer. + * + * The software rasterizer now uses this format for vertices. Thus a + * 'RasterSetup' stage or other translation is required between the + * tnl module and the swrast rasterization functions. This serves to + * isolate the swrast module from the internals of the tnl module, and + * improve its usefulness as a fallback mechanism for hardware + * drivers. + * + * Full software drivers: + * - Register the rastersetup and triangle functions from + * utils/software_helper. + * - On statechange, update the rasterization pointers in that module. + * + * Rasterization hardware drivers: + * - Keep native rastersetup. + * - Implement native twoside,offset and unfilled triangle setup. + * - Implement a translator from native vertices to swrast vertices. + * - On partial fallback (mix of accelerated and unaccelerated + * prims), call a pass-through function which translates native + * vertices to SWvertices and calls the appropriate swrast function. + * - On total fallback (vertex format insufficient for state or all + * primitives unaccelerated), hook in swrast_setup instead. + */ +typedef struct { + /** win[0], win[1] are the screen-coords of SWvertex. + * win[2] is the z-buffer coord (if 16-bit Z buffer, in range [0,65535]). + * win[3] is 1/w where w is the clip-space W coord. This is the value + * that clip{XYZ} were multiplied by to get ndc{XYZ}. + */ + GLfloat win[4]; + GLfloat texcoord[MAX_TEXTURE_COORD_UNITS][4]; + GLchan color[4]; + GLchan specular[4]; + GLfloat fog; + GLfloat index; + GLfloat pointSize; +} SWvertex; + + +struct swrast_device_driver; + + +/* These are the public-access functions exported from swrast. + */ +extern void +_swrast_use_read_buffer( GLcontext *ctx ); + +extern void +_swrast_use_draw_buffer( GLcontext *ctx ); + +extern GLboolean +_swrast_CreateContext( GLcontext *ctx ); + +extern void +_swrast_DestroyContext( GLcontext *ctx ); + +/* Get a (non-const) reference to the device driver struct for swrast. + */ +extern struct swrast_device_driver * +_swrast_GetDeviceDriverReference( GLcontext *ctx ); + +extern void +_swrast_Bitmap( GLcontext *ctx, + GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ); + +extern void +_swrast_CopyPixels( GLcontext *ctx, + GLint srcx, GLint srcy, + GLint destx, GLint desty, + GLsizei width, GLsizei height, + GLenum type ); + +extern void +_swrast_DrawPixels( GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ); + +extern void +_swrast_ReadPixels( GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + GLvoid *pixels ); + +extern void +_swrast_Clear( GLcontext *ctx, GLbitfield mask, GLboolean all, + GLint x, GLint y, GLint width, GLint height ); + +extern void +_swrast_Accum( GLcontext *ctx, GLenum op, + GLfloat value, GLint xpos, GLint ypos, + GLint width, GLint height ); + + +extern void +_swrast_DrawBuffer( GLcontext *ctx, GLenum mode ); + + +extern void +_swrast_DrawBuffers( GLcontext *ctx, GLsizei n, const GLenum *buffers ); + + +/* Reset the stipple counter + */ +extern void +_swrast_ResetLineStipple( GLcontext *ctx ); + +/* These will always render the correct point/line/triangle for the + * current state. + * + * For flatshaded primitives, the provoking vertex is the final one. + */ +extern void +_swrast_Point( GLcontext *ctx, const SWvertex *v ); + +extern void +_swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ); + +extern void +_swrast_Triangle( GLcontext *ctx, const SWvertex *v0, + const SWvertex *v1, const SWvertex *v2 ); + +extern void +_swrast_Quad( GLcontext *ctx, + const SWvertex *v0, const SWvertex *v1, + const SWvertex *v2, const SWvertex *v3); + +extern void +_swrast_flush( GLcontext *ctx ); + +extern void +_swrast_render_primitive( GLcontext *ctx, GLenum mode ); + +extern void +_swrast_render_start( GLcontext *ctx ); + +extern void +_swrast_render_finish( GLcontext *ctx ); + +/* Tell the software rasterizer about core state changes. + */ +extern void +_swrast_InvalidateState( GLcontext *ctx, GLuint new_state ); + +/* Configure software rasterizer to match hardware rasterizer characteristics: + */ +extern void +_swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ); + +extern void +_swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value ); + +/* Debug: + */ +extern void +_swrast_print_vertex( GLcontext *ctx, const SWvertex *v ); + + +/* + * Imaging fallbacks (a better solution should be found, perhaps + * moving all the imaging fallback code to a new module) + */ +extern void +_swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, + GLenum internalFormat, + GLint x, GLint y, GLsizei width, + GLsizei height); +extern void +_swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, + GLenum internalFormat, + GLint x, GLint y, GLsizei width); +extern void +_swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width); +extern void +_swrast_CopyColorTable( GLcontext *ctx, + GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width); + + +/* + * Texture fallbacks. Could also live in a new module + * with the rest of the texture store fallbacks? + */ +extern void +_swrast_copy_teximage1d(GLcontext *ctx, GLenum target, GLint level, + GLenum internalFormat, + GLint x, GLint y, GLsizei width, GLint border); + +extern void +_swrast_copy_teximage2d(GLcontext *ctx, GLenum target, GLint level, + GLenum internalFormat, + GLint x, GLint y, GLsizei width, GLsizei height, + GLint border); + + +extern void +_swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint x, GLint y, GLsizei width); + +extern void +_swrast_copy_texsubimage2d(GLcontext *ctx, + GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, GLsizei width, GLsizei height); + +extern void +_swrast_copy_texsubimage3d(GLcontext *ctx, + GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint x, GLint y, GLsizei width, GLsizei height); + + +/* The driver interface for the software rasterizer. + * Unless otherwise noted, all functions are mandatory. + */ +struct swrast_device_driver { +#if OLD_RENDERBUFFER + void (*SetBuffer)(GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit); + /* + * Specifies the current color buffer for span/pixel writing/reading. + * buffer indicates which window to write to / read from. Normally, + * this'll be the buffer currently bound to the context, but it doesn't + * have to be! + * bufferBit indicates which color buffer, exactly one of: + * DD_FRONT_LEFT_BIT - this buffer always exists + * DD_BACK_LEFT_BIT - when double buffering + * DD_FRONT_RIGHT_BIT - when using stereo + * DD_BACK_RIGHT_BIT - when using stereo and double buffering + * DD_AUXn_BIT - if aux buffers are implemented + */ +#endif + + /*** + *** Functions for synchronizing access to the framebuffer: + ***/ + + void (*SpanRenderStart)(GLcontext *ctx); + void (*SpanRenderFinish)(GLcontext *ctx); + /* OPTIONAL. + * + * Called before and after all rendering operations, including DrawPixels, + * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands. + * These are a suitable place for grabbing/releasing hardware locks. + * + * NOTE: The swrast triangle/line/point routines *DO NOT* call + * these functions. Locking in that case must be organized by the + * driver by other mechanisms. + */ +}; + + + +#endif diff --git a/reactos/dll/mesa32/src/swrast_setup/descrip.mms b/reactos/dll/mesa32/src/swrast_setup/descrip.mms new file mode 100644 index 00000000000..3b8af930ce1 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast_setup/descrip.mms @@ -0,0 +1,39 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl +# Last revision : 16 June 2003 + +.first + define gl [---.include.gl] + define math [-.math] + define tnl [-.tnl] + define swrast [-.swrast] + define array_cache [-.array_cache] + +.include [---]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [---.include],[-.main],[-.glapi] +LIBDIR = [---.lib] +CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short) + +SOURCES = ss_context.c ss_triangle.c + +OBJECTS = ss_context.obj,ss_triangle.obj +##### RULES ##### + +VERSION=Mesa V3.4 + +##### TARGETS ##### +# Make the library +$(LIBDIR)$(GL_LIB) : $(OBJECTS) + @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) + +clean : + purge + delete *.obj;* + +ss_context.obj : ss_context.c +ss_triangle.obj : ss_triangle.c diff --git a/reactos/dll/mesa32/src/swrast_setup/ss_context.c b/reactos/dll/mesa32/src/swrast_setup/ss_context.c new file mode 100644 index 00000000000..c63646ca977 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast_setup/ss_context.c @@ -0,0 +1,250 @@ +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +#include "glheader.h" +#include "imports.h" +#include "colormac.h" +#include "ss_context.h" +#include "ss_triangle.h" +#include "swrast_setup.h" +#include "tnl/tnl.h" +#include "tnl/t_context.h" +#include "tnl/t_pipeline.h" +#include "tnl/t_vertex.h" + +/* Need to check lighting state and vertex program state to know + * if two-sided lighting is in effect. + */ +#define _SWSETUP_NEW_RENDERINDEX (_NEW_POLYGON|_NEW_LIGHT|_NEW_PROGRAM) + + +GLboolean +_swsetup_CreateContext( GLcontext *ctx ) +{ + SScontext *swsetup = (SScontext *)CALLOC(sizeof(SScontext)); + + if (!swsetup) + return GL_FALSE; + + ctx->swsetup_context = swsetup; + + swsetup->NewState = ~0; + _swsetup_trifuncs_init( ctx ); + + _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12, + sizeof(SWvertex) ); + + + return GL_TRUE; +} + +void +_swsetup_DestroyContext( GLcontext *ctx ) +{ + SScontext *swsetup = SWSETUP_CONTEXT(ctx); + + if (swsetup) { + FREE(swsetup); + ctx->swsetup_context = 0; + } + + _tnl_free_vertices( ctx ); +} + +static void +_swsetup_RenderPrimitive( GLcontext *ctx, GLenum mode ) +{ + SWSETUP_CONTEXT(ctx)->render_prim = mode; + _swrast_render_primitive( ctx, mode ); +} + +#define SWZ ((SWvertex *)0) +#define SWOffset(MEMBER) (((char *)&(SWZ->MEMBER)) - ((char *)SWZ)) + +#define EMIT_ATTR( ATTR, STYLE, MEMBER ) \ +do { \ + map[e].attrib = (ATTR); \ + map[e].format = (STYLE); \ + map[e].offset = SWOffset(MEMBER); \ + e++; \ +} while (0) + + +/* + * We patch this function into tnl->Driver.Render.Start. + * It's called when we start rendering a vertex buffer. + */ +static void +_swsetup_RenderStart( GLcontext *ctx ) +{ + SScontext *swsetup = SWSETUP_CONTEXT(ctx); + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + GLuint new_state = swsetup->NewState; + + if (new_state & _SWSETUP_NEW_RENDERINDEX) { + _swsetup_choose_trifuncs( ctx ); + } + + swsetup->NewState = 0; + + _swrast_render_start( ctx ); + + /* Important: + */ + VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr; + + + if (tnl->render_inputs != swsetup->last_index) { + GLuint index = tnl->render_inputs; + struct tnl_attr_map map[_TNL_ATTRIB_MAX]; + int i, e = 0; + + EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, win ); + + if (index & _TNL_BIT_COLOR0) + EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4CHAN_4F_RGBA, color ); + + if (index & _TNL_BIT_COLOR1) + EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4CHAN_4F_RGBA, specular); + + if (index & _TNL_BIT_FOG) + EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F, fog); + + if (index & _TNL_BITS_TEX_ANY) { + for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { + if (index & _TNL_BIT_TEX(i)) { + EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_4F, texcoord[i] ); + } + } + } + + if (index & _TNL_BIT_INDEX) + EMIT_ATTR( _TNL_ATTRIB_INDEX, EMIT_1F, index ); + + if (index & _TNL_BIT_POINTSIZE) + EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, pointSize ); + + _tnl_install_attrs( ctx, map, e, + ctx->Viewport._WindowMap.m, + sizeof(SWvertex) ); + + swsetup->last_index = index; + } + +} + +/* + * We patch this function into tnl->Driver.Render.Finish. + * It's called when we finish rendering a vertex buffer. + */ +static void +_swsetup_RenderFinish( GLcontext *ctx ) +{ + _swrast_render_finish( ctx ); +} + +void +_swsetup_InvalidateState( GLcontext *ctx, GLuint new_state ) +{ + SScontext *swsetup = SWSETUP_CONTEXT(ctx); + swsetup->NewState |= new_state; + _tnl_invalidate_vertex_state( ctx, new_state ); +} + + +void +_swsetup_Wakeup( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + SScontext *swsetup = SWSETUP_CONTEXT(ctx); + + tnl->Driver.Render.Start = _swsetup_RenderStart; + tnl->Driver.Render.Finish = _swsetup_RenderFinish; + tnl->Driver.Render.PrimitiveNotify = _swsetup_RenderPrimitive; + tnl->Driver.Render.Interp = _tnl_interp; + tnl->Driver.Render.CopyPV = _tnl_copy_pv; + tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon; /* new */ + tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine; /* new */ + /* points */ + /* line */ + /* triangle */ + /* quad */ + tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts; + tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts; + tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple; + tnl->Driver.Render.BuildVertices = _tnl_build_vertices; + tnl->Driver.Render.Multipass = 0; + + _tnl_invalidate_vertices( ctx, ~0 ); + _tnl_need_projected_coords( ctx, GL_TRUE ); + _swsetup_InvalidateState( ctx, ~0 ); + + swsetup->verts = (SWvertex *)tnl->clipspace.vertex_buf; + swsetup->last_index = 0; +} + + + + + +/* Populate a swrast SWvertex from an attrib-style vertex. + */ +void +_swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest ) +{ + const GLfloat *m = ctx->Viewport._WindowMap.m; + GLfloat tmp[4]; + GLuint i; + + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POS, tmp ); + + dest->win[0] = m[0] * tmp[0] + m[12]; + dest->win[1] = m[5] * tmp[1] + m[13]; + dest->win[2] = m[10] * tmp[2] + m[14]; + dest->win[3] = tmp[3]; + + + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0+i, dest->texcoord[i] ); + + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR0, tmp ); + UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->color, tmp ); + + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR1, tmp ); + UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->specular, tmp ); + + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_FOG, tmp ); + dest->fog = tmp[0]; + + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_INDEX, tmp ); + dest->index = (GLuint) tmp[0]; + + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POINTSIZE, tmp ); + dest->pointSize = tmp[0]; +} + diff --git a/reactos/dll/mesa32/src/swrast_setup/ss_context.h b/reactos/dll/mesa32/src/swrast_setup/ss_context.h new file mode 100644 index 00000000000..2c6e4faf3da --- /dev/null +++ b/reactos/dll/mesa32/src/swrast_setup/ss_context.h @@ -0,0 +1,45 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +#ifndef SS_CONTEXT_H +#define SS_CONTEXT_H + +#include "mtypes.h" +#include "swrast/swrast.h" +#include "swrast_setup.h" + +typedef struct { + GLuint NewState; + GLenum render_prim; + GLuint last_index; + SWvertex *verts; +} SScontext; + +#define SWSETUP_CONTEXT(ctx) ((SScontext *)ctx->swsetup_context) + +#endif diff --git a/reactos/dll/mesa32/src/swrast_setup/ss_triangle.c b/reactos/dll/mesa32/src/swrast_setup/ss_triangle.c new file mode 100644 index 00000000000..d37bdf71cbc --- /dev/null +++ b/reactos/dll/mesa32/src/swrast_setup/ss_triangle.c @@ -0,0 +1,314 @@ +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +#include "glheader.h" +#include "colormac.h" +#include "macros.h" +#include "mtypes.h" + +#include "tnl/t_context.h" + +#include "ss_triangle.h" +#include "ss_context.h" + +#define SS_RGBA_BIT 0x1 +#define SS_OFFSET_BIT 0x2 +#define SS_TWOSIDE_BIT 0x4 +#define SS_UNFILLED_BIT 0x8 +#define SS_MAX_TRIFUNC 0x10 + +static tnl_triangle_func tri_tab[SS_MAX_TRIFUNC]; +static tnl_quad_func quad_tab[SS_MAX_TRIFUNC]; + + +static void _swsetup_render_line_tri( GLcontext *ctx, + GLuint e0, GLuint e1, GLuint e2, + GLuint facing ) +{ + SScontext *swsetup = SWSETUP_CONTEXT(ctx); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte *ef = VB->EdgeFlag; + SWvertex *verts = swsetup->verts; + SWvertex *v0 = &verts[e0]; + SWvertex *v1 = &verts[e1]; + SWvertex *v2 = &verts[e2]; + GLchan c[2][4]; + GLchan s[2][4]; + GLfloat i[2]; + + /* cull testing */ + if (ctx->Polygon.CullFlag) { + if (facing == 1 && ctx->Polygon.CullFaceMode != GL_FRONT) + return; + if (facing == 0 && ctx->Polygon.CullFaceMode != GL_BACK) + return; + } + + if (ctx->Light.ShadeModel == GL_FLAT) { + COPY_CHAN4(c[0], v0->color); + COPY_CHAN4(c[1], v1->color); + COPY_CHAN4(s[0], v0->specular); + COPY_CHAN4(s[1], v1->specular); + i[0] = v0->index; + i[1] = v1->index; + + COPY_CHAN4(v0->color, v2->color); + COPY_CHAN4(v1->color, v2->color); + COPY_CHAN4(v0->specular, v2->specular); + COPY_CHAN4(v1->specular, v2->specular); + v0->index = v2->index; + v1->index = v2->index; + } + + if (swsetup->render_prim == GL_POLYGON) { + if (ef[e2]) _swrast_Line( ctx, v2, v0 ); + if (ef[e0]) _swrast_Line( ctx, v0, v1 ); + if (ef[e1]) _swrast_Line( ctx, v1, v2 ); + } else { + if (ef[e0]) _swrast_Line( ctx, v0, v1 ); + if (ef[e1]) _swrast_Line( ctx, v1, v2 ); + if (ef[e2]) _swrast_Line( ctx, v2, v0 ); + } + + if (ctx->Light.ShadeModel == GL_FLAT) { + COPY_CHAN4(v0->color, c[0]); + COPY_CHAN4(v1->color, c[1]); + COPY_CHAN4(v0->specular, s[0]); + COPY_CHAN4(v1->specular, s[1]); + v0->index = i[0]; + v1->index = i[1]; + } +} + +static void _swsetup_render_point_tri( GLcontext *ctx, + GLuint e0, GLuint e1, GLuint e2, + GLuint facing ) +{ + SScontext *swsetup = SWSETUP_CONTEXT(ctx); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte *ef = VB->EdgeFlag; + SWvertex *verts = swsetup->verts; + SWvertex *v0 = &verts[e0]; + SWvertex *v1 = &verts[e1]; + SWvertex *v2 = &verts[e2]; + GLchan c[2][4]; + GLchan s[2][4]; + GLfloat i[2]; + + /* cull testing */ + if (ctx->Polygon.CullFlag) { + if (facing == 1 && ctx->Polygon.CullFaceMode != GL_FRONT) + return; + if (facing == 0 && ctx->Polygon.CullFaceMode != GL_BACK) + return; + } + + if (ctx->Light.ShadeModel == GL_FLAT) { + /* save colors/indexes for v0, v1 vertices */ + COPY_CHAN4(c[0], v0->color); + COPY_CHAN4(c[1], v1->color); + COPY_CHAN4(s[0], v0->specular); + COPY_CHAN4(s[1], v1->specular); + i[0] = v0->index; + i[1] = v1->index; + + /* copy v2 color/indexes to v0, v1 indexes */ + COPY_CHAN4(v0->color, v2->color); + COPY_CHAN4(v1->color, v2->color); + COPY_CHAN4(v0->specular, v2->specular); + COPY_CHAN4(v1->specular, v2->specular); + v0->index = v2->index; + v1->index = v2->index; + } + + if (ef[e0]) _swrast_Point( ctx, v0 ); + if (ef[e1]) _swrast_Point( ctx, v1 ); + if (ef[e2]) _swrast_Point( ctx, v2 ); + + if (ctx->Light.ShadeModel == GL_FLAT) { + /* restore v0, v1 colores/indexes */ + COPY_CHAN4(v0->color, c[0]); + COPY_CHAN4(v1->color, c[1]); + COPY_CHAN4(v0->specular, s[0]); + COPY_CHAN4(v1->specular, s[1]); + v0->index = i[0]; + v1->index = i[1]; + } + _swrast_flush(ctx); +} + +#define SS_COLOR(a,b) UNCLAMPED_FLOAT_TO_RGBA_CHAN(a,b) +#define SS_SPEC(a,b) UNCLAMPED_FLOAT_TO_RGB_CHAN(a,b) +#define SS_IND(a,b) (a = b) + +#define IND (0) +#define TAG(x) x +#include "ss_tritmp.h" + +#define IND (SS_OFFSET_BIT) +#define TAG(x) x##_offset +#include "ss_tritmp.h" + +#define IND (SS_TWOSIDE_BIT) +#define TAG(x) x##_twoside +#include "ss_tritmp.h" + +#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT) +#define TAG(x) x##_offset_twoside +#include "ss_tritmp.h" + +#define IND (SS_UNFILLED_BIT) +#define TAG(x) x##_unfilled +#include "ss_tritmp.h" + +#define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT) +#define TAG(x) x##_offset_unfilled +#include "ss_tritmp.h" + +#define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT) +#define TAG(x) x##_twoside_unfilled +#include "ss_tritmp.h" + +#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT) +#define TAG(x) x##_offset_twoside_unfilled +#include "ss_tritmp.h" + +#define IND (0|SS_RGBA_BIT) +#define TAG(x) x##_rgba +#include "ss_tritmp.h" + +#define IND (SS_OFFSET_BIT|SS_RGBA_BIT) +#define TAG(x) x##_offset_rgba +#include "ss_tritmp.h" + +#define IND (SS_TWOSIDE_BIT|SS_RGBA_BIT) +#define TAG(x) x##_twoside_rgba +#include "ss_tritmp.h" + +#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_RGBA_BIT) +#define TAG(x) x##_offset_twoside_rgba +#include "ss_tritmp.h" + +#define IND (SS_UNFILLED_BIT|SS_RGBA_BIT) +#define TAG(x) x##_unfilled_rgba +#include "ss_tritmp.h" + +#define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) +#define TAG(x) x##_offset_unfilled_rgba +#include "ss_tritmp.h" + +#define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) +#define TAG(x) x##_twoside_unfilled_rgba +#include "ss_tritmp.h" + +#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) +#define TAG(x) x##_offset_twoside_unfilled_rgba +#include "ss_tritmp.h" + + +void _swsetup_trifuncs_init( GLcontext *ctx ) +{ + (void) ctx; + + init(); + init_offset(); + init_twoside(); + init_offset_twoside(); + init_unfilled(); + init_offset_unfilled(); + init_twoside_unfilled(); + init_offset_twoside_unfilled(); + + init_rgba(); + init_offset_rgba(); + init_twoside_rgba(); + init_offset_twoside_rgba(); + init_unfilled_rgba(); + init_offset_unfilled_rgba(); + init_twoside_unfilled_rgba(); + init_offset_twoside_unfilled_rgba(); +} + + +static void swsetup_points( GLcontext *ctx, GLuint first, GLuint last ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; + GLuint i; + + if (VB->Elts) { + for (i = first; i < last; i++) + if (VB->ClipMask[VB->Elts[i]] == 0) + _swrast_Point( ctx, &verts[VB->Elts[i]] ); + } + else { + for (i = first; i < last; i++) + if (VB->ClipMask[i] == 0) + _swrast_Point( ctx, &verts[i] ); + } +} + +static void swsetup_line( GLcontext *ctx, GLuint v0, GLuint v1 ) +{ + SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; + _swrast_Line( ctx, &verts[v0], &verts[v1] ); +} + + + +void _swsetup_choose_trifuncs( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint ind = 0; + + if (ctx->Polygon.OffsetPoint || + ctx->Polygon.OffsetLine || + ctx->Polygon.OffsetFill) + ind |= SS_OFFSET_BIT; + + if ((ctx->Light.Enabled && ctx->Light.Model.TwoSide) || + (ctx->VertexProgram._Enabled && ctx->VertexProgram.TwoSideEnabled)) + ind |= SS_TWOSIDE_BIT; + + /* We piggyback the two-sided stencil front/back determination on the + * unfilled triangle path. + */ + if (ctx->Polygon.FrontMode != GL_FILL || + ctx->Polygon.BackMode != GL_FILL || + (ctx->Stencil.Enabled && ctx->Stencil.TestTwoSide)) + ind |= SS_UNFILLED_BIT; + + if (ctx->Visual.rgbMode) + ind |= SS_RGBA_BIT; + + tnl->Driver.Render.Triangle = tri_tab[ind]; + tnl->Driver.Render.Quad = quad_tab[ind]; + tnl->Driver.Render.Line = swsetup_line; + tnl->Driver.Render.Points = swsetup_points; + + ctx->_Facing = 0; +} diff --git a/reactos/dll/mesa32/src/swrast_setup/ss_triangle.h b/reactos/dll/mesa32/src/swrast_setup/ss_triangle.h new file mode 100644 index 00000000000..78833269e6e --- /dev/null +++ b/reactos/dll/mesa32/src/swrast_setup/ss_triangle.h @@ -0,0 +1,39 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +#ifndef SS_TRIANGLE_H +#define SS_TRIANGLE_H + +#include "mtypes.h" +#include "ss_context.h" + + +void _swsetup_trifuncs_init( GLcontext *ctx ); +void _swsetup_choose_trifuncs( GLcontext *ctx ); + +#endif diff --git a/reactos/dll/mesa32/src/swrast_setup/ss_tritmp.h b/reactos/dll/mesa32/src/swrast_setup/ss_tritmp.h new file mode 100644 index 00000000000..61c9b2817e6 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast_setup/ss_tritmp.h @@ -0,0 +1,222 @@ +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + + +static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; + SWvertex *v[3]; + GLfloat z[3]; + GLfloat offset; + GLenum mode = GL_FILL; + GLuint facing = 0; + GLchan saved_color[3][4]; + GLchan saved_spec[3][4]; + GLfloat saved_index[3]; + + v[0] = &verts[e0]; + v[1] = &verts[e1]; + v[2] = &verts[e2]; + + + if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT)) + { + GLfloat ex = v[0]->win[0] - v[2]->win[0]; + GLfloat ey = v[0]->win[1] - v[2]->win[1]; + GLfloat fx = v[1]->win[0] - v[2]->win[0]; + GLfloat fy = v[1]->win[1] - v[2]->win[1]; + GLfloat cc = ex*fy - ey*fx; + + if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT)) + { + facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; + if (ctx->Stencil.TestTwoSide) + ctx->_Facing = facing; /* for 2-sided stencil test */ + + if (IND & SS_UNFILLED_BIT) + mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode; + + if (facing == 1) { + if (IND & SS_TWOSIDE_BIT) { + if (IND & SS_RGBA_BIT) { + GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->data; + + COPY_CHAN4(saved_color[0], v[0]->color); + COPY_CHAN4(saved_color[1], v[1]->color); + COPY_CHAN4(saved_color[2], v[2]->color); + + if (VB->ColorPtr[1]->stride) { + SS_COLOR(v[0]->color, vbcolor[e0]); + SS_COLOR(v[1]->color, vbcolor[e1]); + SS_COLOR(v[2]->color, vbcolor[e2]); + } + else { + SS_COLOR(v[0]->color, vbcolor[0]); + SS_COLOR(v[1]->color, vbcolor[0]); + SS_COLOR(v[2]->color, vbcolor[0]); + } + + if (VB->SecondaryColorPtr[1]) { + GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->data; + + COPY_CHAN4(saved_spec[0], v[0]->specular); + COPY_CHAN4(saved_spec[1], v[1]->specular); + COPY_CHAN4(saved_spec[2], v[2]->specular); + + if (VB->SecondaryColorPtr[1]->stride) { + SS_SPEC(v[0]->specular, vbspec[e0]); + SS_SPEC(v[1]->specular, vbspec[e1]); + SS_SPEC(v[2]->specular, vbspec[e2]); + } + else { + SS_SPEC(v[0]->specular, vbspec[0]); + SS_SPEC(v[1]->specular, vbspec[0]); + SS_SPEC(v[2]->specular, vbspec[0]); + } + } + } else { + GLfloat *vbindex = (GLfloat *)VB->IndexPtr[1]->data; + saved_index[0] = v[0]->index; + saved_index[1] = v[1]->index; + saved_index[2] = v[2]->index; + + SS_IND(v[0]->index, (GLuint) vbindex[e0]); + SS_IND(v[1]->index, (GLuint) vbindex[e1]); + SS_IND(v[2]->index, (GLuint) vbindex[e2]); + } + } + } + } + + if (IND & SS_OFFSET_BIT) + { + offset = ctx->Polygon.OffsetUnits * ctx->DrawBuffer->_MRD; + z[0] = v[0]->win[2]; + z[1] = v[1]->win[2]; + z[2] = v[2]->win[2]; + if (cc * cc > 1e-16) { + const GLfloat ez = z[0] - z[2]; + const GLfloat fz = z[1] - z[2]; + const GLfloat oneOverArea = 1.0F / cc; + const GLfloat dzdx = FABSF((ey * fz - ez * fy) * oneOverArea); + const GLfloat dzdy = FABSF((ez * fx - ex * fz) * oneOverArea); + offset += MAX2(dzdx, dzdy) * ctx->Polygon.OffsetFactor; + /* Unfortunately, we need to clamp to prevent negative Zs below. + * Technically, we should do the clamping per-fragment. + */ + offset = MAX2(offset, -v[0]->win[2]); + offset = MAX2(offset, -v[1]->win[2]); + offset = MAX2(offset, -v[2]->win[2]); + } + } + } + + if (mode == GL_POINT) { + if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetPoint) { + v[0]->win[2] += offset; + v[1]->win[2] += offset; + v[2]->win[2] += offset; + } + _swsetup_render_point_tri( ctx, e0, e1, e2, facing ); + } else if (mode == GL_LINE) { + if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) { + v[0]->win[2] += offset; + v[1]->win[2] += offset; + v[2]->win[2] += offset; + } + _swsetup_render_line_tri( ctx, e0, e1, e2, facing ); + } else { + if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetFill) { + v[0]->win[2] += offset; + v[1]->win[2] += offset; + v[2]->win[2] += offset; + } + _swrast_Triangle( ctx, v[0], v[1], v[2] ); + } + + if (IND & SS_OFFSET_BIT) { + v[0]->win[2] = z[0]; + v[1]->win[2] = z[1]; + v[2]->win[2] = z[2]; + } + + if (IND & SS_TWOSIDE_BIT) { + if (facing == 1) { + if (IND & SS_RGBA_BIT) { + COPY_CHAN4(v[0]->color, saved_color[0]); + COPY_CHAN4(v[1]->color, saved_color[1]); + COPY_CHAN4(v[2]->color, saved_color[2]); + if (VB->SecondaryColorPtr[1]) { + COPY_CHAN4(v[0]->specular, saved_spec[0]); + COPY_CHAN4(v[1]->specular, saved_spec[1]); + COPY_CHAN4(v[2]->specular, saved_spec[2]); + } + } else { + v[0]->index = saved_index[0]; + v[1]->index = saved_index[1]; + v[2]->index = saved_index[2]; + } + } + } +} + + + +/* Need to fixup edgeflags when decomposing to triangles: + */ +static void TAG(quadfunc)( GLcontext *ctx, GLuint v0, + GLuint v1, GLuint v2, GLuint v3 ) +{ + if (IND & SS_UNFILLED_BIT) { + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte ef1 = VB->EdgeFlag[v1]; + GLubyte ef3 = VB->EdgeFlag[v3]; + VB->EdgeFlag[v1] = 0; + TAG(triangle)( ctx, v0, v1, v3 ); + VB->EdgeFlag[v1] = ef1; + VB->EdgeFlag[v3] = 0; + TAG(triangle)( ctx, v1, v2, v3 ); + VB->EdgeFlag[v3] = ef3; + } else { + TAG(triangle)( ctx, v0, v1, v3 ); + TAG(triangle)( ctx, v1, v2, v3 ); + } +} + + + + +static void TAG(init)( void ) +{ + tri_tab[IND] = TAG(triangle); + quad_tab[IND] = TAG(quadfunc); +} + + +#undef IND +#undef TAG diff --git a/reactos/dll/mesa32/src/swrast_setup/ss_vb.h b/reactos/dll/mesa32/src/swrast_setup/ss_vb.h new file mode 100644 index 00000000000..6ea0cb1a704 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast_setup/ss_vb.h @@ -0,0 +1,38 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +#ifndef SS_VB_H +#define SS_VB_H + +#include "mtypes.h" +#include "swrast_setup.h" + +void _swsetup_vb_init( GLcontext *ctx ); +void _swsetup_choose_rastersetup_func( GLcontext *ctx ); + +#endif diff --git a/reactos/dll/mesa32/src/swrast_setup/swrast_setup.h b/reactos/dll/mesa32/src/swrast_setup/swrast_setup.h new file mode 100644 index 00000000000..5dcbe2675b4 --- /dev/null +++ b/reactos/dll/mesa32/src/swrast_setup/swrast_setup.h @@ -0,0 +1,61 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +/* Public interface to the swrast_setup module. This module provides + * an implementation of the driver interface to t_vb_render.c, and uses + * the software rasterizer (swrast) to perform actual rasterization. + * + * The internals of the implementation are private, but can be hooked + * into tnl at any time (except between RenderStart/RenderEnd) by + * calling _swsetup_Wakeup(). + */ + +#ifndef SWRAST_SETUP_H +#define SWRAST_SETUP_H + +#include "swrast/swrast.h" + +extern GLboolean +_swsetup_CreateContext( GLcontext *ctx ); + +extern void +_swsetup_DestroyContext( GLcontext *ctx ); + +extern void +_swsetup_InvalidateState( GLcontext *ctx, GLuint new_state ); + +extern void +_swsetup_Wakeup( GLcontext *ctx ); + +/* Helper function to translate a hardware vertex (as understood by + * the tnl/t_vertex.c code) to a swrast vertex. + */ +extern void +_swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest ); + +#endif diff --git a/reactos/dll/mesa32/src/tnl/descrip.mms b/reactos/dll/mesa32/src/tnl/descrip.mms new file mode 100644 index 00000000000..a77d66ca34b --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/descrip.mms @@ -0,0 +1,74 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl +# Last revision : 13 June 2005 + +.first + define gl [---.include.gl] + define math [-.math] + define shader [-.shader] + define array_cache [-.array_cache] + +.include [---]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [---.include],[-.main],[-.glapi],[-.shader] +LIBDIR = [---.lib] +CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short) + +SOURCES = t_array_api.c t_array_import.c t_context.c \ + t_pipeline.c t_vb_fog.c t_save_api.c t_vtx_api.c \ + t_vb_light.c t_vb_normals.c t_vb_points.c t_vb_program.c \ + t_vb_render.c t_vb_texgen.c t_vb_texmat.c t_vb_vertex.c \ + t_vtx_eval.c t_vtx_exec.c t_save_playback.c t_save_loopback.c \ + t_vertex.c t_vtx_generic.c t_vtx_x86.c t_vertex_generic.c \ + t_vb_arbprogram.c t_vp_build.c + +OBJECTS = t_array_api.obj,t_array_import.obj,t_context.obj,\ + t_pipeline.obj,t_vb_fog.obj,t_vb_light.obj,t_vb_normals.obj,\ + t_vb_points.obj,t_vb_program.obj,t_vb_render.obj,t_vb_texgen.obj,\ + t_vb_texmat.obj,t_vb_vertex.obj,t_save_api.obj,t_vtx_api.obj,\ + t_vtx_eval.obj,t_vtx_exec.obj,t_save_playback.obj,t_save_loopback.obj,\ + t_vertex.obj,t_vtx_generic.obj,t_vtx_x86.obj,t_vertex_generic.obj,\ + t_vb_arbprogram.obj,t_vp_build.obj + +##### RULES ##### + +VERSION=Mesa V3.4 + +##### TARGETS ##### +# Make the library +$(LIBDIR)$(GL_LIB) : $(OBJECTS) + @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) + +clean : + purge + delete *.obj;* + +t_array_api.obj : t_array_api.c +t_array_import.obj : t_array_import.c +t_context.obj : t_context.c +t_pipeline.obj : t_pipeline.c +t_vb_fog.obj : t_vb_fog.c +t_vb_light.obj : t_vb_light.c +t_vb_normals.obj : t_vb_normals.c +t_vb_points.obj : t_vb_points.c +t_vb_program.obj : t_vb_program.c +t_vb_render.obj : t_vb_render.c +t_vb_texgen.obj : t_vb_texgen.c +t_vb_texmat.obj : t_vb_texmat.c +t_vb_vertex.obj : t_vb_vertex.c +t_save_api.obj : t_save_api.c +t_vtx_api.obj : t_vtx_api.c +t_vtx_eval.obj : t_vtx_eval.c +t_vtx_exec.obj : t_vtx_exec.c +t_save_playback.obj : t_save_playback.c +t_save_loopback.obj : t_save_loopback.c +t_vertex.obj : t_vertex.c +t_vtx_x86.obj : t_vtx_x86.c +t_vtx_generic.obj : t_vtx_generic.c +t_vertex_generic.obj : t_vertex_generic.c +t_vb_arbprogram.obj : t_vb_arbprogram.c +t_vp_build.obj : t_vp_build.c diff --git a/reactos/dll/mesa32/src/tnl/t_array_api.c b/reactos/dll/mesa32/src/tnl/t_array_api.c new file mode 100644 index 00000000000..1ad77c5a99b --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_array_api.c @@ -0,0 +1,414 @@ +/* + * 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. + */ + +/** + * \file t_array_api.c + * \brief Vertex array API functions (glDrawArrays, etc) + * \author Keith Whitwell + */ + +#include "glheader.h" +#include "api_validate.h" +#include "context.h" +#include "imports.h" +#include "macros.h" +#include "mtypes.h" +#include "state.h" + +#include "array_cache/acache.h" + +#include "t_array_api.h" +#include "t_array_import.h" +#include "t_save_api.h" +#include "t_context.h" +#include "t_pipeline.h" +#include "dispatch.h" + +static void fallback_drawarrays( GLcontext *ctx, GLenum mode, GLint start, + GLsizei count ) +{ + GLint i; + + assert(!ctx->CompileFlag); + assert(ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1); + + CALL_Begin(GET_DISPATCH(), (mode)); + for (i = 0; i < count; i++) + CALL_ArrayElement(GET_DISPATCH(), ( start + i )); + CALL_End(GET_DISPATCH(), ()); +} + + +static void fallback_drawelements( GLcontext *ctx, GLenum mode, GLsizei count, + const GLuint *indices) +{ + GLint i; + + assert(!ctx->CompileFlag); + assert(ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1); + + /* Here, indices will already reflect the buffer object if active */ + + CALL_Begin(GET_DISPATCH(), (mode)); + for (i = 0 ; i < count ; i++) { + CALL_ArrayElement(GET_DISPATCH(), ( indices[i] )); + } + CALL_End(GET_DISPATCH(), ()); +} + + +/* Note this function no longer takes a 'start' value, the range is + * assumed to start at zero. The old trick of subtracting 'start' + * from each index won't work if the indices are not in writeable + * memory. + */ +static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode, + GLuint max_index, + GLsizei index_count, GLuint *indices ) + +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct tnl_prim prim; + FLUSH_CURRENT( ctx, 0 ); + + _tnl_vb_bind_arrays( ctx, 0, max_index ); + + tnl->vb.Primitive = &prim; + tnl->vb.Primitive[0].mode = mode | PRIM_BEGIN | PRIM_END; + tnl->vb.Primitive[0].start = 0; + tnl->vb.Primitive[0].count = index_count; + tnl->vb.PrimitiveCount = 1; + + tnl->vb.Elts = (GLuint *)indices; + + tnl->Driver.RunPipeline( ctx ); +} + + + +/** + * Called via the GL API dispatcher. + */ +void GLAPIENTRY +_tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) +{ + GET_CURRENT_CONTEXT(ctx); + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint thresh = (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) ? 30 : 10; + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(NULL, "_tnl_DrawArrays %d %d\n", start, count); + + /* Check arguments, etc. + */ + if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) + return; + + assert(!ctx->CompileFlag); + + if (!ctx->Array.LockCount && (GLuint) count < thresh) { + /* Small primitives: attempt to share a vb (at the expense of + * using the immediate interface). + */ + fallback_drawarrays( ctx, mode, start, count ); + } + else if (start >= (GLint) ctx->Array.LockFirst && + start + count <= (GLint)(ctx->Array.LockFirst + ctx->Array.LockCount)) { + + struct tnl_prim prim; + + /* Locked primitives which can fit in a single vertex buffer: + */ + FLUSH_CURRENT( ctx, 0 ); + + /* Locked drawarrays. Reuse any previously transformed data. + */ + _tnl_vb_bind_arrays( ctx, ctx->Array.LockFirst, + ctx->Array.LockFirst + ctx->Array.LockCount ); + + tnl->vb.Primitive = &prim; + tnl->vb.Primitive[0].mode = mode | PRIM_BEGIN | PRIM_END; + tnl->vb.Primitive[0].start = start; + tnl->vb.Primitive[0].count = count; + tnl->vb.PrimitiveCount = 1; + + tnl->Driver.RunPipeline( ctx ); + } + else { + int bufsz = 256; /* Use a small buffer for cache goodness */ + int j, nr; + int minimum, modulo, skip; + + /* Large primitives requiring decomposition to multiple vertex + * buffers: + */ + switch (mode) { + case GL_POINTS: + minimum = 0; + modulo = 1; + skip = 0; + break; + case GL_LINES: + minimum = 1; + modulo = 2; + skip = 1; + break; + case GL_LINE_STRIP: + minimum = 1; + modulo = 1; + skip = 0; + break; + case GL_TRIANGLES: + minimum = 2; + modulo = 3; + skip = 2; + break; + case GL_TRIANGLE_STRIP: + minimum = 2; + modulo = 1; + skip = 0; + break; + case GL_QUADS: + minimum = 3; + modulo = 4; + skip = 3; + break; + case GL_QUAD_STRIP: + minimum = 3; + modulo = 2; + skip = 0; + break; + case GL_LINE_LOOP: + case GL_TRIANGLE_FAN: + case GL_POLYGON: + default: + /* Primitives requiring a copied vertex (fan-like primitives) + * must use the slow path if they cannot fit in a single + * vertex buffer. + */ + if (count <= (GLint) ctx->Const.MaxArrayLockSize) { + bufsz = ctx->Const.MaxArrayLockSize; + minimum = 0; + modulo = 1; + skip = 0; + } + else { + fallback_drawarrays( ctx, mode, start, count ); + return; + } + } + + FLUSH_CURRENT( ctx, 0 ); + + bufsz -= bufsz % modulo; + bufsz -= minimum; + count += start; + + for (j = start + minimum ; j < count ; j += nr + skip ) { + + struct tnl_prim prim; + + nr = MIN2( bufsz, count - j ); + + /* XXX is the last parameter a count or index into the array??? */ + _tnl_vb_bind_arrays( ctx, j - minimum, j + nr ); + + tnl->vb.Primitive = &prim; + tnl->vb.Primitive[0].mode = mode; + + if (j == start + minimum) + tnl->vb.Primitive[0].mode |= PRIM_BEGIN; + + if (j + nr + skip >= count) + tnl->vb.Primitive[0].mode |= PRIM_END; + + tnl->vb.Primitive[0].start = 0; + tnl->vb.Primitive[0].count = nr + minimum; + tnl->vb.PrimitiveCount = 1; + + tnl->Driver.RunPipeline( ctx ); + } + } +} + + +/** + * Called via the GL API dispatcher. + */ +void GLAPIENTRY +_tnl_DrawRangeElements(GLenum mode, + GLuint start, GLuint end, + GLsizei count, GLenum type, const GLvoid *indices) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint *ui_indices; + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(NULL, "_tnl_DrawRangeElements %d %d %d\n", start, end, count); + + if (ctx->Array.ElementArrayBufferObj->Name) { + /* use indices in the buffer object */ + if (!ctx->Array.ElementArrayBufferObj->Data) { + _mesa_warning(ctx, + "DrawRangeElements with empty vertex elements buffer!"); + return; + } + /* actual address is the sum of pointers */ + indices = (const GLvoid *) + ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data, + (const GLubyte *) indices); + } + + /* Check arguments, etc. + */ + if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, + type, indices )) + return; + + ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT, + count, type, indices ); + + + assert(!ctx->CompileFlag); + + if (ctx->Array.LockCount) { + /* Are the arrays already locked? If so we currently have to look + * at the whole locked range. + */ + + if (start == 0 && ctx->Array.LockFirst == 0 && + end < (ctx->Array.LockFirst + ctx->Array.LockCount)) + _tnl_draw_range_elements( ctx, mode, + ctx->Array.LockCount, + count, ui_indices ); + else { + fallback_drawelements( ctx, mode, count, ui_indices ); + } + } + else if (start == 0 && end < ctx->Const.MaxArrayLockSize) { + /* The arrays aren't locked but we can still fit them inside a + * single vertexbuffer. + */ + _tnl_draw_range_elements( ctx, mode, end + 1, count, ui_indices ); + } + else { + /* Range is too big to optimize: + */ + fallback_drawelements( ctx, mode, count, ui_indices ); + } +} + + + +/** + * Called via the GL API dispatcher. + */ +void GLAPIENTRY +_tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint *ui_indices; + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(NULL, "_tnl_DrawElements %d\n", count); + + /* Check arguments, etc. */ + if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) + return; + + if (ctx->Array.ElementArrayBufferObj->Name) { + /* actual address is the sum of pointers */ + indices = (const GLvoid *) + ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data, + (const GLubyte *) indices); + } + + ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT, + count, type, indices ); + + assert(!ctx->CompileFlag); + + if (ctx->Array.LockCount) { + if (ctx->Array.LockFirst == 0) + _tnl_draw_range_elements( ctx, mode, + ctx->Array.LockCount, + count, ui_indices ); + else + fallback_drawelements( ctx, mode, count, ui_indices ); + } + else { + /* Scan the index list and see if we can use the locked path anyway. + */ + GLuint max_elt = 0; + GLint i; + + for (i = 0 ; i < count ; i++) + if (ui_indices[i] > max_elt) + max_elt = ui_indices[i]; + + if (max_elt < ctx->Const.MaxArrayLockSize && /* can we use it? */ + max_elt < (GLuint) count) /* do we want to use it? */ + _tnl_draw_range_elements( ctx, mode, max_elt+1, count, ui_indices ); + else + fallback_drawelements( ctx, mode, count, ui_indices ); + } +} + + +/** + * Initialize context's vertex array fields. Called during T 'n L context + * creation. + */ +void _tnl_array_init( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct tnl_vertex_arrays *tmp = &tnl->array_inputs; + GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->exec_vtxfmt); + GLuint i; + + vfmt->DrawArrays = _tnl_DrawArrays; + vfmt->DrawElements = _tnl_DrawElements; + vfmt->DrawRangeElements = _tnl_DrawRangeElements; + + /* Setup vector pointers that will be used to bind arrays to VB's. + */ + _mesa_vector4f_init( &tmp->Obj, 0, NULL); + _mesa_vector4f_init( &tmp->Normal, 0, NULL); + _mesa_vector4f_init( &tmp->FogCoord, 0, NULL); + _mesa_vector4f_init( &tmp->Index, 0, NULL); + + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) + _mesa_vector4f_init( &tmp->TexCoord[i], 0, NULL); +} + + +/** + * Destroy the context's vertex array stuff. + * Called during T 'n L context destruction. + */ +void _tnl_array_destroy( GLcontext *ctx ) +{ + (void) ctx; +} diff --git a/reactos/dll/mesa32/src/tnl/t_array_api.h b/reactos/dll/mesa32/src/tnl/t_array_api.h new file mode 100644 index 00000000000..61d1f696b00 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_array_api.h @@ -0,0 +1,46 @@ + +/* + * 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 _T_VARRAY_H +#define _T_VARRAY_H + +#include "mtypes.h" +#include "t_context.h" + + +extern void GLAPIENTRY _tnl_DrawArrays(GLenum mode, GLint first, GLsizei count); + +extern void GLAPIENTRY _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices); + +extern void GLAPIENTRY _tnl_DrawRangeElements(GLenum mode, GLuint start, + GLuint end, GLsizei count, GLenum type, + const GLvoid *indices); + + +extern void _tnl_array_init( GLcontext *ctx ); +extern void _tnl_array_destroy( GLcontext *ctx ); + +#endif diff --git a/reactos/dll/mesa32/src/tnl/t_array_import.c b/reactos/dll/mesa32/src/tnl/t_array_import.c new file mode 100644 index 00000000000..7cc834ffa23 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_array_import.c @@ -0,0 +1,352 @@ +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "imports.h" +#include "state.h" +#include "mtypes.h" + +#include "array_cache/acache.h" +#include "math/m_translate.h" + +#include "t_array_import.h" +#include "t_context.h" + + +static void _tnl_import_vertex( GLcontext *ctx, + GLboolean writeable, + GLboolean stride ) +{ + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + const GLubyte *data; + + tmp = _ac_import_vertex(ctx, + GL_FLOAT, + stride ? 4*sizeof(GLfloat) : 0, + 0, + writeable, + &is_writeable); + + data = tmp->Ptr; + inputs->Obj.data = (GLfloat (*)[4]) data; + inputs->Obj.start = (GLfloat *) data; + inputs->Obj.stride = tmp->StrideB; + inputs->Obj.size = tmp->Size; +} + +static void _tnl_import_normal( GLcontext *ctx, + GLboolean writeable, + GLboolean stride ) +{ + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + const GLubyte *data; + + tmp = _ac_import_normal(ctx, GL_FLOAT, + stride ? 3*sizeof(GLfloat) : 0, writeable, + &is_writeable); + + data = tmp->Ptr; + inputs->Normal.data = (GLfloat (*)[4]) data; + inputs->Normal.start = (GLfloat *) data; + inputs->Normal.stride = tmp->StrideB; + inputs->Normal.size = 3; +} + + +static void _tnl_import_color( GLcontext *ctx, + GLboolean writeable, + GLboolean stride ) +{ + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + const GLubyte *data; + + tmp = _ac_import_color(ctx, + GL_FLOAT, + stride ? 4*sizeof(GLfloat) : 0, + 4, + writeable, + &is_writeable); + + data = tmp->Ptr; + inputs->Color.data = (GLfloat (*)[4]) data; + inputs->Color.start = (GLfloat *) data; + inputs->Color.stride = tmp->StrideB; + inputs->Color.size = tmp->Size; +} + + +static void _tnl_import_secondarycolor( GLcontext *ctx, + GLboolean writeable, + GLboolean stride ) +{ + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + const GLubyte *data; + + tmp = _ac_import_secondarycolor(ctx, + GL_FLOAT, + stride ? 4*sizeof(GLfloat) : 0, + 4, + writeable, + &is_writeable); + + data = tmp->Ptr; + inputs->SecondaryColor.data = (GLfloat (*)[4]) data; + inputs->SecondaryColor.start = (GLfloat *) data; + inputs->SecondaryColor.stride = tmp->StrideB; + inputs->SecondaryColor.size = tmp->Size; +} + +static void _tnl_import_fogcoord( GLcontext *ctx, + GLboolean writeable, + GLboolean stride ) +{ + struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + const GLubyte *data; + + tmp = _ac_import_fogcoord(ctx, GL_FLOAT, + stride ? sizeof(GLfloat) : 0, writeable, + &is_writeable); + + data = tmp->Ptr; + inputs->FogCoord.data = (GLfloat (*)[4]) data; + inputs->FogCoord.start = (GLfloat *) data; + inputs->FogCoord.stride = tmp->StrideB; +} + +static void _tnl_import_index( GLcontext *ctx, + GLboolean writeable, + GLboolean stride ) +{ + struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + const GLubyte *data; + + tmp = _ac_import_index(ctx, GL_FLOAT, + stride ? sizeof(GLfloat) : 0, writeable, + &is_writeable); + + data = tmp->Ptr; + inputs->Index.data = (GLfloat (*)[4]) data; + inputs->Index.start = (GLfloat *) data; + inputs->Index.stride = tmp->StrideB; +} + + +static void _tnl_import_texcoord( GLcontext *ctx, + GLuint unit, + GLboolean writeable, + GLboolean stride ) +{ + struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + const GLubyte *data; + + tmp = _ac_import_texcoord(ctx, unit, GL_FLOAT, + stride ? 4 * sizeof(GLfloat) : 0, + 0, + writeable, + &is_writeable); + + data = tmp->Ptr; + inputs->TexCoord[unit].data = (GLfloat (*)[4]) data; + inputs->TexCoord[unit].start = (GLfloat *) data; + inputs->TexCoord[unit].stride = tmp->StrideB; + inputs->TexCoord[unit].size = tmp->Size; +} + + +static void _tnl_import_edgeflag( GLcontext *ctx, + GLboolean writeable, + GLboolean stride ) +{ + struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + const GLubyte *data; + (void) writeable; (void) stride; + + tmp = _ac_import_edgeflag(ctx, GL_UNSIGNED_BYTE, + sizeof(GLubyte), + 0, + &is_writeable); + + data = tmp->Ptr; + inputs->EdgeFlag = (GLubyte *) data; +} + + + +static void _tnl_import_attrib( GLcontext *ctx, + GLuint index, + GLboolean writeable, + GLboolean stride ) +{ + struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + const GLubyte *data; + + tmp = _ac_import_attrib(ctx, index, GL_FLOAT, + stride ? 4 * sizeof(GLfloat) : 0, + 4, /* want GLfloat[4] */ + writeable, + &is_writeable); + + data = tmp->Ptr; + inputs->Attribs[index].data = (GLfloat (*)[4]) data; + inputs->Attribs[index].start = (GLfloat *) data; + inputs->Attribs[index].stride = tmp->StrideB; + inputs->Attribs[index].size = tmp->Size; +} + + +static void _tnl_constant_attrib( TNLcontext *tnl, + struct tnl_vertex_arrays *tmp, + GLuint i ) +{ + tmp->Attribs[i].count = 1; + tmp->Attribs[i].data = (GLfloat (*)[4]) tnl->vtx.current[i]; + tmp->Attribs[i].start = tnl->vtx.current[i]; + tmp->Attribs[i].size = 4; + tmp->Attribs[i].stride = 0; + tnl->vb.AttribPtr[i] = &tmp->Attribs[i]; +} + + + +void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + struct tnl_vertex_arrays *tmp = &tnl->array_inputs; + GLuint i, index; + + VB->Count = end - start; + VB->Elts = NULL; + + _ac_import_range( ctx, start, end ); + + /* When vertex program mode is enabled, the generic vertex program + * attribute arrays have priority over the conventional attributes. + * Try to use them now. + */ + for (index = 0; index < VERT_ATTRIB_MAX; index++) { + /* When vertex program mode is enabled, the generic vertex attribute + * arrays have priority over the conventional vertex arrays. + */ + if (ctx->VertexProgram._Enabled + && ctx->Array.VertexAttrib[index].Enabled) { + /* Use generic attribute array */ + _tnl_import_attrib( ctx, index, GL_FALSE, GL_TRUE ); + VB->AttribPtr[index] = &tmp->Attribs[index]; + } + /* use conventional arrays... */ + else if (index == VERT_ATTRIB_POS) { + _tnl_import_vertex( ctx, 0, 0 ); + tmp->Obj.count = VB->Count; + VB->AttribPtr[_TNL_ATTRIB_POS] = &tmp->Obj; + } + else if (index == VERT_ATTRIB_NORMAL) { + _tnl_import_normal( ctx, 0, 0 ); + tmp->Normal.count = VB->Count; + VB->AttribPtr[_TNL_ATTRIB_NORMAL] = &tmp->Normal; + } + else if (index == VERT_ATTRIB_COLOR0) { + _tnl_import_color( ctx, 0, 0 ); + tmp->Color.count = VB->Count; + VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &tmp->Color; + } + else if (index == VERT_ATTRIB_COLOR1) { + _tnl_import_secondarycolor( ctx, 0, 0 ); + tmp->SecondaryColor.count = VB->Count; + VB->AttribPtr[_TNL_ATTRIB_COLOR1] = &tmp->SecondaryColor; + } + else if (index == VERT_ATTRIB_FOG) { + _tnl_import_fogcoord( ctx, 0, 0 ); + tmp->FogCoord.count = VB->Count; + VB->AttribPtr[_TNL_ATTRIB_FOG] = &tmp->FogCoord; + } + else if (index >= VERT_ATTRIB_TEX0 && index <= VERT_ATTRIB_TEX7) { + i = index - VERT_ATTRIB_TEX0; + _tnl_import_texcoord( ctx, i, GL_FALSE, GL_FALSE ); + tmp->TexCoord[i].count = VB->Count; + VB->AttribPtr[_TNL_ATTRIB_TEX0 + i] = &tmp->TexCoord[i]; + } + else { + _tnl_constant_attrib(tnl, tmp, index); + } + } + + /* odd-ball vertex attributes */ + { + _tnl_import_index( ctx, 0, 0 ); + tmp->Index.count = VB->Count; + VB->AttribPtr[_TNL_ATTRIB_INDEX] = &tmp->Index; + } + + { + _tnl_import_edgeflag( ctx, GL_TRUE, sizeof(GLboolean) ); + VB->EdgeFlag = (GLboolean *) tmp->EdgeFlag; + } + + /* These are constant & could be precalculated: + */ + for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT; i < _TNL_ATTRIB_INDEX; i++) { + _tnl_constant_attrib(tnl, tmp, i); + } + + + /* Legacy pointers -- remove one day. + */ + VB->ObjPtr = VB->AttribPtr[_TNL_ATTRIB_POS]; + VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; + VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0]; + VB->ColorPtr[1] = NULL; + VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX]; + VB->IndexPtr[1] = NULL; + VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1]; + VB->SecondaryColorPtr[1] = NULL; + VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG]; + + for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { + VB->TexCoordPtr[i] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]; + } +} diff --git a/reactos/dll/mesa32/src/tnl/t_array_import.h b/reactos/dll/mesa32/src/tnl/t_array_import.h new file mode 100644 index 00000000000..39b77641d53 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_array_import.h @@ -0,0 +1,36 @@ + +/* + * 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 _T_ARRAY_IMPORT_H +#define _T_ARRAY_IMPORT_H + +#include "mtypes.h" +#include "t_context.h" + +extern void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end ); + +extern void _tnl_array_import_init( GLcontext *ctx ); + +#endif diff --git a/reactos/dll/mesa32/src/tnl/t_context.c b/reactos/dll/mesa32/src/tnl/t_context.c new file mode 100644 index 00000000000..dab0eb61b0f --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_context.c @@ -0,0 +1,289 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + * + * Authors: + * Keith Whitwell + */ + + +#include "api_arrayelt.h" +#include "glheader.h" +#include "imports.h" +#include "context.h" +#include "macros.h" +#include "mtypes.h" +#include "dlist.h" +#include "light.h" +#include "vtxfmt.h" +#include "nvfragprog.h" + +#include "tnl.h" +#include "t_array_api.h" +#include "t_context.h" +#include "t_pipeline.h" +#include "t_save_api.h" +#include "t_vp_build.h" +#include "t_vtx_api.h" + + + +void +_tnl_MakeCurrent( GLcontext *ctx, + GLframebuffer *drawBuffer, + GLframebuffer *readBuffer ) +{ + (void) ctx; (void) drawBuffer; (void) readBuffer; +} + + +static void +install_driver_callbacks( GLcontext *ctx ) +{ + ctx->Driver.NewList = _tnl_NewList; + ctx->Driver.EndList = _tnl_EndList; + ctx->Driver.FlushVertices = _tnl_FlushVertices; + ctx->Driver.SaveFlushVertices = _tnl_SaveFlushVertices; + ctx->Driver.MakeCurrent = _tnl_MakeCurrent; + ctx->Driver.BeginCallList = _tnl_BeginCallList; + ctx->Driver.EndCallList = _tnl_EndCallList; +} + + + +GLboolean +_tnl_CreateContext( GLcontext *ctx ) +{ + TNLcontext *tnl; + + /* Create the TNLcontext structure + */ + ctx->swtnl_context = tnl = (TNLcontext *) CALLOC( sizeof(TNLcontext) ); + + if (!tnl) { + return GL_FALSE; + } + + if (getenv("MESA_CODEGEN")) + tnl->AllowCodegen = GL_TRUE; + + /* Initialize the VB. + */ + tnl->vb.Size = ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES; + + + /* Initialize tnl state and tnl->vtxfmt. + */ + _tnl_save_init( ctx ); + _tnl_array_init( ctx ); + _tnl_vtx_init( ctx ); + + if (ctx->_MaintainTnlProgram) + _tnl_install_pipeline( ctx, _tnl_vp_pipeline ); + else + _tnl_install_pipeline( ctx, _tnl_default_pipeline ); + + /* Initialize the arrayelt helper + */ + if (!_ae_create_context( ctx )) + return GL_FALSE; + + + tnl->NeedNdcCoords = GL_TRUE; + tnl->LoopbackDListCassettes = GL_FALSE; + tnl->CalcDListNormalLengths = GL_TRUE; + tnl->AllowVertexFog = GL_TRUE; + tnl->AllowPixelFog = GL_TRUE; + + /* Hook our functions into exec and compile dispatch tables. + */ + _mesa_install_exec_vtxfmt( ctx, &tnl->exec_vtxfmt ); + + + /* Set a few default values in the driver struct. + */ + install_driver_callbacks(ctx); + ctx->Driver.NeedFlush = 0; + ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; + ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; + + tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts; + tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts; + tnl->Driver.NotifyMaterialChange = _mesa_validate_all_lighting_tables; + + return GL_TRUE; +} + + +void +_tnl_DestroyContext( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + _tnl_array_destroy( ctx ); + _tnl_vtx_destroy( ctx ); + _tnl_save_destroy( ctx ); + _tnl_destroy_pipeline( ctx ); + _ae_destroy_context( ctx ); + + _tnl_ProgramCacheDestroy( ctx ); + + FREE(tnl); + ctx->swtnl_context = NULL; +} + + +void +_tnl_InvalidateState( GLcontext *ctx, GLuint new_state ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + if (new_state & (_NEW_HINT)) { + ASSERT(tnl->AllowVertexFog || tnl->AllowPixelFog); + tnl->_DoVertexFog = (tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST)) + || !tnl->AllowPixelFog; + } + + _ae_invalidate_state(ctx, new_state); + + tnl->pipeline.new_state |= new_state; + tnl->vtx.eval.new_state |= new_state; + + /* Calculate tnl->render_inputs: + */ + if (ctx->Visual.rgbMode) { + tnl->render_inputs = (_TNL_BIT_POS| + _TNL_BIT_COLOR0| + (ctx->Texture._EnabledCoordUnits << _TNL_ATTRIB_TEX0)); + + if (NEED_SECONDARY_COLOR(ctx)) + tnl->render_inputs |= _TNL_BIT_COLOR1; + } + else { + tnl->render_inputs |= (_TNL_BIT_POS|_TNL_BIT_INDEX); + } + + if (ctx->Fog.Enabled || + (ctx->FragmentProgram._Active && + ctx->FragmentProgram._Current->FogOption != GL_NONE)) + tnl->render_inputs |= _TNL_BIT_FOG; + + if (ctx->Polygon.FrontMode != GL_FILL || + ctx->Polygon.BackMode != GL_FILL) + tnl->render_inputs |= _TNL_BIT_EDGEFLAG; + + if (ctx->RenderMode == GL_FEEDBACK) + tnl->render_inputs |= _TNL_BIT_TEX0; + + if (ctx->Point._Attenuated || + (ctx->VertexProgram._Enabled && ctx->VertexProgram.PointSizeEnabled)) + tnl->render_inputs |= _TNL_BIT_POINTSIZE; +} + + +void +_tnl_wakeup_exec( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + install_driver_callbacks(ctx); + ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; + + /* Hook our functions into exec and compile dispatch tables. + */ + _mesa_install_exec_vtxfmt( ctx, &tnl->exec_vtxfmt ); + + /* Call all appropriate driver callbacks to revive state. + */ + _tnl_MakeCurrent( ctx, ctx->DrawBuffer, ctx->ReadBuffer ); + + /* Assume we haven't been getting state updates either: + */ + _tnl_InvalidateState( ctx, ~0 ); + + if (ctx->Light.ColorMaterialEnabled) { + _mesa_update_color_material( ctx, + ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); + } +} + + +void +_tnl_wakeup_save_exec( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + _tnl_wakeup_exec( ctx ); + _mesa_install_save_vtxfmt( ctx, &tnl->save_vtxfmt ); +} + + +/** + * Drivers call this function to tell the TCL module whether or not + * it wants Normalized Device Coords (NDC) computed. I.e. whether + * we should "Divide-by-W". Software renders will want that. + */ +void +_tnl_need_projected_coords( GLcontext *ctx, GLboolean mode ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + if (tnl->NeedNdcCoords != mode) { + tnl->NeedNdcCoords = mode; + _tnl_InvalidateState( ctx, _NEW_PROJECTION ); + } +} + +void +_tnl_need_dlist_loopback( GLcontext *ctx, GLboolean mode ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + tnl->LoopbackDListCassettes = mode; +} + +void +_tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean mode ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + tnl->CalcDListNormalLengths = mode; +} + +void +_tnl_isolate_materials( GLcontext *ctx, GLboolean mode ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + tnl->IsolateMaterials = mode; +} + +void +_tnl_allow_vertex_fog( GLcontext *ctx, GLboolean value ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + tnl->AllowVertexFog = value; +} + +void +_tnl_allow_pixel_fog( GLcontext *ctx, GLboolean value ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + tnl->AllowPixelFog = value; +} + diff --git a/reactos/dll/mesa32/src/tnl/t_context.h b/reactos/dll/mesa32/src/tnl/t_context.h new file mode 100644 index 00000000000..cdaa252e8fc --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_context.h @@ -0,0 +1,800 @@ +/* + * mesa 3-D graphics library + * Version: 6.3 + * + * 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 t_context.h + * \brief TnL module datatypes and definitions. + * \author Keith Whitwell + */ + + +/** + * \mainpage The TNL-module + * + * TNL stands for "transform and lighting", i.e. this module implements + * a pipeline that receives as input a buffer of vertices and does all + * necessary transformations (rotations, clipping, vertex shader etc.) + * and passes then the output to the rasterizer. + * + * The tnl_pipeline contains the array of all stages, which should be + * applied. Each stage is a black-box, which is described by an + * tnl_pipeline_stage. The function ::_tnl_run_pipeline applies all the + * stages to the vertex_buffer TNLcontext::vb, where the vertex data + * is stored. The last stage in the pipeline is the rasterizer. + * + * The initial vertex_buffer data may either come from an ::immediate + * structure or client vertex_arrays or display lists: + * + * + * - The ::immediate structure records all the GL commands issued between + * glBegin and glEnd. \n + * The structure accumulates data, until it is either full or it is + * flushed (usually by a state change). Before starting then the pipeline, + * the collected vertex data in ::immediate has to be pushed into + * TNLcontext::vb. + * This happens in ::_tnl_vb_bind_immediate. The pipeline is then run by + * calling tnl_device_driver::RunPipeline = ::_tnl_run_pipeline, which + * is stored in TNLcontext::Driver. \n + * An ::immediate does (for performance reasons) usually not finish with a + * glEnd, and hence it also does not need to start with a glBegin. + * This means that the last vertices of one ::immediate may need to be + * saved for the next one. + * + * + * - NOT SURE ABOUT THIS: The vertex_arrays structure is used to handle + * glDrawArrays etc. \n + * Here, the data of the vertex_arrays is copied by ::_tnl_vb_bind_arrays + * into TNLcontext::vb, so that the pipeline can be started. + */ + + +#ifndef _T_CONTEXT_H +#define _T_CONTEXT_H + +#include "glheader.h" +#include "mtypes.h" + +#include "math/m_matrix.h" +#include "math/m_vector.h" +#include "math/m_xform.h" + + +#define MAX_PIPELINE_STAGES 30 + +/* + * Note: The first attributes match the VERT_ATTRIB_* definitions + * in mtypes.h. However, the tnl module has additional attributes + * for materials, color indexes, edge flags, etc. + */ +/* Although it's nice to use these as bit indexes in a DWORD flag, we + * could manage without if necessary. Another limit currently is the + * number of bits allocated for these numbers in places like vertex + * program instruction formats and register layouts. + */ +enum { + _TNL_ATTRIB_POS = 0, + _TNL_ATTRIB_WEIGHT = 1, + _TNL_ATTRIB_NORMAL = 2, + _TNL_ATTRIB_COLOR0 = 3, + _TNL_ATTRIB_COLOR1 = 4, + _TNL_ATTRIB_FOG = 5, + _TNL_ATTRIB_SIX = 6, + _TNL_ATTRIB_SEVEN = 7, + _TNL_ATTRIB_TEX0 = 8, + _TNL_ATTRIB_TEX1 = 9, + _TNL_ATTRIB_TEX2 = 10, + _TNL_ATTRIB_TEX3 = 11, + _TNL_ATTRIB_TEX4 = 12, + _TNL_ATTRIB_TEX5 = 13, + _TNL_ATTRIB_TEX6 = 14, + _TNL_ATTRIB_TEX7 = 15, + _TNL_ATTRIB_MAT_FRONT_AMBIENT = 16, + _TNL_ATTRIB_MAT_BACK_AMBIENT = 17, + _TNL_ATTRIB_MAT_FRONT_DIFFUSE = 18, + _TNL_ATTRIB_MAT_BACK_DIFFUSE = 19, + _TNL_ATTRIB_MAT_FRONT_SPECULAR = 20, + _TNL_ATTRIB_MAT_BACK_SPECULAR = 21, + _TNL_ATTRIB_MAT_FRONT_EMISSION = 22, + _TNL_ATTRIB_MAT_BACK_EMISSION = 23, + _TNL_ATTRIB_MAT_FRONT_SHININESS = 24, + _TNL_ATTRIB_MAT_BACK_SHININESS = 25, + _TNL_ATTRIB_MAT_FRONT_INDEXES = 26, + _TNL_ATTRIB_MAT_BACK_INDEXES = 27, + _TNL_ATTRIB_INDEX = 28, + _TNL_ATTRIB_EDGEFLAG = 29, + _TNL_ATTRIB_POINTSIZE = 30, + _TNL_ATTRIB_MAX = 31 +} ; + +/* Will probably have to revise this scheme fairly shortly, eg. by + * compacting all the MAT flags down to one bit, or by using two + * dwords to store the flags. + */ +#define _TNL_BIT_POS (1<<0) +#define _TNL_BIT_WEIGHT (1<<1) +#define _TNL_BIT_NORMAL (1<<2) +#define _TNL_BIT_COLOR0 (1<<3) +#define _TNL_BIT_COLOR1 (1<<4) +#define _TNL_BIT_FOG (1<<5) +#define _TNL_BIT_SIX (1<<6) +#define _TNL_BIT_SEVEN (1<<7) +#define _TNL_BIT_TEX0 (1<<8) +#define _TNL_BIT_TEX1 (1<<9) +#define _TNL_BIT_TEX2 (1<<10) +#define _TNL_BIT_TEX3 (1<<11) +#define _TNL_BIT_TEX4 (1<<12) +#define _TNL_BIT_TEX5 (1<<13) +#define _TNL_BIT_TEX6 (1<<14) +#define _TNL_BIT_TEX7 (1<<15) +#define _TNL_BIT_MAT_FRONT_AMBIENT (1<<16) +#define _TNL_BIT_MAT_BACK_AMBIENT (1<<17) +#define _TNL_BIT_MAT_FRONT_DIFFUSE (1<<18) +#define _TNL_BIT_MAT_BACK_DIFFUSE (1<<19) +#define _TNL_BIT_MAT_FRONT_SPECULAR (1<<20) +#define _TNL_BIT_MAT_BACK_SPECULAR (1<<21) +#define _TNL_BIT_MAT_FRONT_EMISSION (1<<22) +#define _TNL_BIT_MAT_BACK_EMISSION (1<<23) +#define _TNL_BIT_MAT_FRONT_SHININESS (1<<24) +#define _TNL_BIT_MAT_BACK_SHININESS (1<<25) +#define _TNL_BIT_MAT_FRONT_INDEXES (1<<26) +#define _TNL_BIT_MAT_BACK_INDEXES (1<<27) +#define _TNL_BIT_INDEX (1<<28) +#define _TNL_BIT_EDGEFLAG (1<<29) +#define _TNL_BIT_POINTSIZE (1<<30) + +#define _TNL_BIT_TEX(u) (1 << (_TNL_ATTRIB_TEX0 + (u))) + + + +#define _TNL_BITS_MAT_ANY (_TNL_BIT_MAT_FRONT_AMBIENT | \ + _TNL_BIT_MAT_BACK_AMBIENT | \ + _TNL_BIT_MAT_FRONT_DIFFUSE | \ + _TNL_BIT_MAT_BACK_DIFFUSE | \ + _TNL_BIT_MAT_FRONT_SPECULAR | \ + _TNL_BIT_MAT_BACK_SPECULAR | \ + _TNL_BIT_MAT_FRONT_EMISSION | \ + _TNL_BIT_MAT_BACK_EMISSION | \ + _TNL_BIT_MAT_FRONT_SHININESS | \ + _TNL_BIT_MAT_BACK_SHININESS | \ + _TNL_BIT_MAT_FRONT_INDEXES | \ + _TNL_BIT_MAT_BACK_INDEXES) + + +#define _TNL_BITS_TEX_ANY (_TNL_BIT_TEX0 | \ + _TNL_BIT_TEX1 | \ + _TNL_BIT_TEX2 | \ + _TNL_BIT_TEX3 | \ + _TNL_BIT_TEX4 | \ + _TNL_BIT_TEX5 | \ + _TNL_BIT_TEX6 | \ + _TNL_BIT_TEX7) + + +#define _TNL_BITS_PROG_ANY (_TNL_BIT_POS | \ + _TNL_BIT_WEIGHT | \ + _TNL_BIT_NORMAL | \ + _TNL_BIT_COLOR0 | \ + _TNL_BIT_COLOR1 | \ + _TNL_BIT_FOG | \ + _TNL_BIT_SIX | \ + _TNL_BIT_SEVEN | \ + _TNL_BITS_TEX_ANY) + + + +#define PRIM_BEGIN 0x10 +#define PRIM_END 0x20 +#define PRIM_WEAK 0x40 +#define PRIM_MODE_MASK 0x0f + +/* + */ +struct tnl_prim { + GLuint mode; + GLuint start; + GLuint count; +}; + + + +struct tnl_eval1_map { + struct gl_1d_map *map; + GLuint sz; +}; + +struct tnl_eval2_map { + struct gl_2d_map *map; + GLuint sz; +}; + +struct tnl_eval { + GLuint new_state; + struct tnl_eval1_map map1[_TNL_ATTRIB_INDEX + 1]; + struct tnl_eval2_map map2[_TNL_ATTRIB_INDEX + 1]; +}; + + +#define TNL_MAX_PRIM 16 +#define TNL_MAX_COPIED_VERTS 3 + +struct tnl_copied_vtx { + GLfloat buffer[_TNL_ATTRIB_MAX * 4 * TNL_MAX_COPIED_VERTS]; + GLuint nr; +}; + +#define VERT_BUFFER_SIZE 2048 /* 8kbytes */ + + +typedef void (*tnl_attrfv_func)( const GLfloat * ); + +struct _tnl_dynfn { + struct _tnl_dynfn *next, *prev; + GLuint key; + char *code; +}; + +struct _tnl_dynfn_lists { + struct _tnl_dynfn Vertex[4]; + struct _tnl_dynfn Attribute[4]; +}; + +struct _tnl_dynfn_generators { + struct _tnl_dynfn *(*Vertex[4])( GLcontext *ctx, int key ); + struct _tnl_dynfn *(*Attribute[4])( GLcontext *ctx, int key ); +}; + +#define _TNL_MAX_ATTR_CODEGEN 16 + + +/* The assembly of vertices in immediate mode is separated from + * display list compilation. This allows a simpler immediate mode + * treatment and a display list compiler better suited to + * hardware-acceleration. + */ +struct tnl_vtx { + GLfloat buffer[VERT_BUFFER_SIZE]; + GLubyte attrsz[_TNL_ATTRIB_MAX]; + GLuint vertex_size; + struct tnl_prim prim[TNL_MAX_PRIM]; + GLuint prim_count; + GLfloat *vbptr; /* cursor, points into buffer */ + GLfloat vertex[_TNL_ATTRIB_MAX*4]; /* current vertex */ + GLfloat *attrptr[_TNL_ATTRIB_MAX]; /* points into vertex */ + GLfloat *current[_TNL_ATTRIB_MAX]; /* points into ctx->Current, etc */ + GLfloat CurrentFloatEdgeFlag; + GLuint counter, initial_counter; + struct tnl_copied_vtx copied; + + tnl_attrfv_func tabfv[_TNL_MAX_ATTR_CODEGEN+1][4]; /* plus 1 for ERROR_ATTRIB */ + + struct _tnl_dynfn_lists cache; + struct _tnl_dynfn_generators gen; + + struct tnl_eval eval; + GLboolean *edgeflag_tmp; + GLboolean have_materials; +}; + + + + +/* For display lists, this structure holds a run of vertices of the + * same format, and a strictly well-formed set of begin/end pairs, + * starting on the first vertex and ending at the last. Vertex + * copying on buffer breaks is precomputed according to these + * primitives, though there are situations where the copying will need + * correction at execute-time, perhaps by replaying the list as + * immediate mode commands. + * + * On executing this list, the 'current' values may be updated with + * the values of the final vertex, and often no fixup of the start of + * the vertex list is required. + * + * Eval and other commands that don't fit into these vertex lists are + * compiled using the fallback opcode mechanism provided by dlist.c. + */ +struct tnl_vertex_list { + GLubyte attrsz[_TNL_ATTRIB_MAX]; + GLuint vertex_size; + + GLfloat *buffer; + GLuint count; + GLuint wrap_count; /* number of copied vertices at start */ + GLboolean have_materials; /* bit of a hack - quick check for materials */ + GLboolean dangling_attr_ref; /* current attr implicitly referenced + outside the list */ + + GLfloat *normal_lengths; + struct tnl_prim *prim; + GLuint prim_count; + + struct tnl_vertex_store *vertex_store; + struct tnl_primitive_store *prim_store; +}; + +/* These buffers should be a reasonable size to support upload to + * hardware? Maybe drivers should stitch them back together, or + * specify a desired size? + */ +#define SAVE_BUFFER_SIZE (16*1024) +#define SAVE_PRIM_SIZE 128 + +/* Storage to be shared among several vertex_lists. + */ +struct tnl_vertex_store { + GLfloat buffer[SAVE_BUFFER_SIZE]; + GLuint used; + GLuint refcount; +}; + +struct tnl_primitive_store { + struct tnl_prim buffer[SAVE_PRIM_SIZE]; + GLuint used; + GLuint refcount; +}; + + +struct tnl_save { + GLubyte attrsz[_TNL_ATTRIB_MAX]; + GLuint vertex_size; + + GLfloat *buffer; + GLuint count; + GLuint wrap_count; + GLuint replay_flags; + + struct tnl_prim *prim; + GLuint prim_count, prim_max; + + struct tnl_vertex_store *vertex_store; + struct tnl_primitive_store *prim_store; + + GLfloat *vbptr; /* cursor, points into buffer */ + GLfloat vertex[_TNL_ATTRIB_MAX*4]; /* current values */ + GLfloat *attrptr[_TNL_ATTRIB_MAX]; + GLuint counter, initial_counter; + GLboolean dangling_attr_ref; + GLboolean have_materials; + + GLuint opcode_vertex_list; + + struct tnl_copied_vtx copied; + + GLfloat CurrentFloatEdgeFlag; + + GLfloat *current[_TNL_ATTRIB_MAX]; /* points into ctx->ListState */ + GLubyte *currentsz[_TNL_ATTRIB_MAX]; + + void (*tabfv[_TNL_ATTRIB_MAX][4])( const GLfloat * ); +}; + + +struct tnl_vertex_arrays +{ + /* Conventional vertex attribute arrays */ + GLvector4f Obj; + GLvector4f Normal; + GLvector4f Color; + GLvector4f SecondaryColor; + GLvector4f FogCoord; + GLvector4f TexCoord[MAX_TEXTURE_COORD_UNITS]; + GLvector4f Index; + + GLubyte *EdgeFlag; + GLuint *Elt; + + /* These attributes don't alias with the conventional attributes. + * The GL_NV_vertex_program extension defines 16 extra sets of vertex + * arrays which have precedent over the conventional arrays when enabled. + */ + GLvector4f Attribs[_TNL_ATTRIB_MAX]; +}; + + +/** + * Contains the current state of a running pipeline. + */ +struct vertex_buffer +{ + /* Constant over life of the vertex_buffer. + */ + GLuint Size; + + /* Constant over the pipeline. + */ + GLuint Count; /* for everything except Elts */ + + /* Pointers to current data. + */ + GLuint *Elts; + GLvector4f *ObjPtr; /* _TNL_BIT_POS */ + GLvector4f *EyePtr; /* _TNL_BIT_POS */ + GLvector4f *ClipPtr; /* _TNL_BIT_POS */ + GLvector4f *NdcPtr; /* _TNL_BIT_POS */ + GLubyte ClipOrMask; /* _TNL_BIT_POS */ + GLubyte ClipAndMask; /* _TNL_BIT_POS */ + GLubyte *ClipMask; /* _TNL_BIT_POS */ + GLvector4f *NormalPtr; /* _TNL_BIT_NORMAL */ + GLfloat *NormalLengthPtr; /* _TNL_BIT_NORMAL */ + GLboolean *EdgeFlag; /* _TNL_BIT_EDGEFLAG */ + GLvector4f *TexCoordPtr[MAX_TEXTURE_COORD_UNITS]; /* VERT_TEX_0..n */ + GLvector4f *IndexPtr[2]; /* _TNL_BIT_INDEX */ + GLvector4f *ColorPtr[2]; /* _TNL_BIT_COLOR0 */ + GLvector4f *SecondaryColorPtr[2]; /* _TNL_BIT_COLOR1 */ + GLvector4f *PointSizePtr; /* _TNL_BIT_POS */ + GLvector4f *FogCoordPtr; /* _TNL_BIT_FOG */ + + struct tnl_prim *Primitive; + GLuint PrimitiveCount; + + /* Inputs to the vertex program stage */ + GLvector4f *AttribPtr[_TNL_ATTRIB_MAX]; /* GL_NV_vertex_program */ + + GLuint LastClipped; + /* Private data from _tnl_render_stage that has no business being + * in this struct. + */ +}; + + +/** Describes an individual operation on the pipeline. + */ +struct tnl_pipeline_stage +{ + const char *name; + + /* Private data for the pipeline stage: + */ + void *privatePtr; + + /* Allocate private data + */ + GLboolean (*create)( GLcontext *ctx, struct tnl_pipeline_stage * ); + + /* Free private data. + */ + void (*destroy)( struct tnl_pipeline_stage * ); + + /* Called on any statechange or input array size change or + * input array change to/from zero stride. + */ + void (*validate)( GLcontext *ctx, struct tnl_pipeline_stage * ); + + /* Called from _tnl_run_pipeline(). The stage.changed_inputs value + * encodes all inputs to thee struct which have changed. If + * non-zero, recompute all affected outputs of the stage, otherwise + * execute any 'sideeffects' of the stage. + * + * Return value: GL_TRUE - keep going + * GL_FALSE - finished pipeline + */ + GLboolean (*run)( GLcontext *ctx, struct tnl_pipeline_stage * ); +}; + + + +/** Contains the array of all pipeline stages. + * The default values are defined at the end of t_pipeline.c + */ +struct tnl_pipeline { + + GLuint last_attrib_stride[_TNL_ATTRIB_MAX]; + GLuint last_attrib_size[_TNL_ATTRIB_MAX]; + GLuint input_changes; + GLuint new_state; + + struct tnl_pipeline_stage stages[MAX_PIPELINE_STAGES+1]; + GLuint nr_stages; +}; + +struct tnl_clipspace; +struct tnl_clipspace_attr; + +typedef void (*tnl_extract_func)( const struct tnl_clipspace_attr *a, + GLfloat *out, + const GLubyte *v ); + +typedef void (*tnl_insert_func)( const struct tnl_clipspace_attr *a, + GLubyte *v, + const GLfloat *in ); + +typedef void (*tnl_emit_func)( GLcontext *ctx, + GLuint count, + GLubyte *dest ); + + +/** + * Describes how to convert/move a vertex attribute from a vertex array + * to a vertex structure. + */ +struct tnl_clipspace_attr +{ + GLuint attrib; /* which vertex attrib (0=position, etc) */ + GLuint format; + GLuint vertoffset; /* position of the attrib in the vertex struct */ + GLuint vertattrsize; /* size of the attribute in bytes */ + GLubyte *inputptr; + GLuint inputstride; + GLuint inputsize; + const tnl_insert_func *insert; + tnl_insert_func emit; + tnl_extract_func extract; + const GLfloat *vp; /* NDC->Viewport mapping matrix */ +}; + + + + +typedef void (*tnl_points_func)( GLcontext *ctx, GLuint first, GLuint last ); +typedef void (*tnl_line_func)( GLcontext *ctx, GLuint v1, GLuint v2 ); +typedef void (*tnl_triangle_func)( GLcontext *ctx, + GLuint v1, GLuint v2, GLuint v3 ); +typedef void (*tnl_quad_func)( GLcontext *ctx, GLuint v1, GLuint v2, + GLuint v3, GLuint v4 ); +typedef void (*tnl_render_func)( GLcontext *ctx, GLuint start, GLuint count, + GLuint flags ); +typedef void (*tnl_interp_func)( GLcontext *ctx, + GLfloat t, GLuint dst, GLuint out, GLuint in, + GLboolean force_boundary ); +typedef void (*tnl_copy_pv_func)( GLcontext *ctx, GLuint dst, GLuint src ); +typedef void (*tnl_setup_func)( GLcontext *ctx, + GLuint start, GLuint end, + GLuint new_inputs); + + +struct tnl_clipspace_fastpath { + GLuint vertex_size; + GLuint attr_count; + GLboolean match_strides; + + struct { + GLuint format; + GLuint size; + GLuint stride; + GLuint offset; + } *attr; + + tnl_emit_func func; + struct tnl_clipspace_fastpath *next; +}; + +/** + * Used to describe conversion of vertex arrays to vertex structures. + * I.e. Structure of arrays to arrays of structs. + */ +struct tnl_clipspace +{ + GLboolean need_extras; + + GLuint new_inputs; + + GLubyte *vertex_buf; + GLuint vertex_size; + GLuint max_vertex_size; + + struct tnl_clipspace_attr attr[_TNL_ATTRIB_MAX]; + GLuint attr_count; + + tnl_emit_func emit; + tnl_interp_func interp; + tnl_copy_pv_func copy_pv; + + /* Parameters and constants for codegen: + */ + GLboolean need_viewport; + GLfloat vp_scale[4]; + GLfloat vp_xlate[4]; + GLfloat chan_scale[4]; + GLfloat identity[4]; + + struct tnl_clipspace_fastpath *fastpath; + + void (*codegen_emit)( GLcontext *ctx ); +}; + + + +struct tnl_cache { + GLuint hash; + void *key; + void *data; + struct tnl_cache *next; +}; + + +struct tnl_device_driver +{ + /*** + *** TNL Pipeline + ***/ + + void (*RunPipeline)(GLcontext *ctx); + /* Replaces PipelineStart/PipelineFinish -- intended to allow + * drivers to wrap _tnl_run_pipeline() with code to validate state + * and grab/release hardware locks. + */ + + void (*NotifyMaterialChange)(GLcontext *ctx); + /* Alert tnl-aware drivers of changes to material. + */ + + GLboolean (*NotifyBegin)(GLcontext *ctx, GLenum p); + /* Allow drivers to hook in optimized begin/end engines. + * Return value: GL_TRUE - driver handled the begin + * GL_FALSE - driver didn't handle the begin + */ + + /*** + *** Rendering -- These functions called only from t_vb_render.c + ***/ + struct + { + void (*Start)(GLcontext *ctx); + void (*Finish)(GLcontext *ctx); + /* Called before and after all rendering operations, including DrawPixels, + * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands. + * These are a suitable place for grabbing/releasing hardware locks. + */ + + void (*PrimitiveNotify)(GLcontext *ctx, GLenum mode); + /* Called between RenderStart() and RenderFinish() to indicate the + * type of primitive we're about to draw. Mode will be one of the + * modes accepted by glBegin(). + */ + + tnl_interp_func Interp; + /* The interp function is called by the clipping routines when we need + * to generate an interpolated vertex. All pertinant vertex ancilliary + * data should be computed by interpolating between the 'in' and 'out' + * vertices. + */ + + tnl_copy_pv_func CopyPV; + /* The copy function is used to make a copy of a vertex. All pertinant + * vertex attributes should be copied. + */ + + void (*ClippedPolygon)( GLcontext *ctx, const GLuint *elts, GLuint n ); + /* Render a polygon with vertices whose indexes are in the + * array. + */ + + void (*ClippedLine)( GLcontext *ctx, GLuint v0, GLuint v1 ); + /* Render a line between the two vertices given by indexes v0 and v1. */ + + tnl_points_func Points; /* must now respect vb->elts */ + tnl_line_func Line; + tnl_triangle_func Triangle; + tnl_quad_func Quad; + /* These functions are called in order to render points, lines, + * triangles and quads. These are only called via the T&L module. + */ + + tnl_render_func *PrimTabVerts; + tnl_render_func *PrimTabElts; + /* Render whole unclipped primitives (points, lines, linestrips, + * lineloops, etc). The tables are indexed by the GL enum of the + * primitive to be rendered. RenderTabVerts is used for non-indexed + * arrays of vertices. RenderTabElts is used for indexed arrays of + * vertices. + */ + + void (*ResetLineStipple)( GLcontext *ctx ); + /* Reset the hardware's line stipple counter. + */ + + tnl_setup_func BuildVertices; + /* This function is called whenever new vertices are required for + * rendering. The vertices in question are those n such that start + * <= n < end. The new_inputs parameter indicates those fields of + * the vertex which need to be updated, if only a partial repair of + * the vertex is required. + * + * This function is called only from _tnl_render_stage in tnl/t_render.c. + */ + + + GLboolean (*Multipass)( GLcontext *ctx, GLuint passno ); + /* Driver may request additional render passes by returning GL_TRUE + * when this function is called. This function will be called + * after the first pass, and passes will be made until the function + * returns GL_FALSE. If no function is registered, only one pass + * is made. + * + * This function will be first invoked with passno == 1. + */ + } Render; +}; + + +/** + * Context state for T&L context. + */ +typedef struct +{ + /* Driver interface. + */ + struct tnl_device_driver Driver; + + /* Execute: + */ + struct tnl_vtx vtx; + + /* Compile: + */ + struct tnl_save save; + + /* Pipeline + */ + struct tnl_pipeline pipeline; + struct vertex_buffer vb; + + /* GLvectors for binding to vb: + */ + struct tnl_vertex_arrays vtx_inputs; + struct tnl_vertex_arrays save_inputs; + struct tnl_vertex_arrays current; + struct tnl_vertex_arrays array_inputs; + + /* Clipspace/ndc/window vertex managment: + */ + struct tnl_clipspace clipspace; + + /* Probably need a better configuration mechanism: + */ + GLboolean NeedNdcCoords; + GLboolean LoopbackDListCassettes; + GLboolean CalcDListNormalLengths; + GLboolean IsolateMaterials; + GLboolean AllowVertexFog; + GLboolean AllowPixelFog; + GLboolean AllowCodegen; + + GLboolean _DoVertexFog; /* eval fog function at each vertex? */ + + GLuint render_inputs; + + GLvertexformat exec_vtxfmt; + GLvertexformat save_vtxfmt; + + struct tnl_cache *vp_cache; + +} TNLcontext; + + + +#define TNL_CONTEXT(ctx) ((TNLcontext *)((ctx)->swtnl_context)) + + +#define TYPE_IDX(t) ((t) & 0xf) +#define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */ + +extern void _tnl_MakeCurrent( GLcontext *ctx, + GLframebuffer *drawBuffer, + GLframebuffer *readBuffer ); + + + + +#endif diff --git a/reactos/dll/mesa32/src/tnl/t_pipeline.c b/reactos/dll/mesa32/src/tnl/t_pipeline.c new file mode 100644 index 00000000000..61bfed290e9 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_pipeline.c @@ -0,0 +1,218 @@ + +/* + * 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: + * Keith Whitwell + */ + +#include "glheader.h" +#include "context.h" +#include "imports.h" +#include "state.h" +#include "mtypes.h" + +#include "math/m_translate.h" +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" +#include "t_vp_build.h" +#include "t_vertex.h" + +void _tnl_install_pipeline( GLcontext *ctx, + const struct tnl_pipeline_stage **stages ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint i; + + tnl->pipeline.new_state = ~0; + + /* Create a writeable copy of each stage. + */ + for (i = 0 ; i < MAX_PIPELINE_STAGES && stages[i] ; i++) { + struct tnl_pipeline_stage *s = &tnl->pipeline.stages[i]; + MEMCPY(s, stages[i], sizeof(*s)); + if (s->create) + s->create(ctx, s); + } + + tnl->pipeline.nr_stages = i; +} + +void _tnl_destroy_pipeline( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint i; + + for (i = 0 ; i < tnl->pipeline.nr_stages ; i++) { + struct tnl_pipeline_stage *s = &tnl->pipeline.stages[i]; + if (s->destroy) + s->destroy(s); + } + + tnl->pipeline.nr_stages = 0; +} + + + +static GLuint check_input_changes( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint i; + + for (i = 0; i < _TNL_ATTRIB_EDGEFLAG; i++) { + if (tnl->vb.AttribPtr[i]->size != tnl->pipeline.last_attrib_size[i] || + tnl->vb.AttribPtr[i]->stride != tnl->pipeline.last_attrib_stride[i]) { + tnl->pipeline.last_attrib_size[i] = tnl->vb.AttribPtr[i]->size; + tnl->pipeline.last_attrib_stride[i] = tnl->vb.AttribPtr[i]->stride; + tnl->pipeline.input_changes |= 1<pipeline.input_changes; +} + + +static GLuint check_output_changes( GLcontext *ctx ) +{ +#if 0 + TNLcontext *tnl = TNL_CONTEXT(ctx); + + for (i = 0; i < VERT_RESULT_MAX; i++) { + if (tnl->vb.ResultPtr[i]->size != tnl->last_result_size[i] || + tnl->vb.ResultPtr[i]->stride != tnl->last_result_stride[i]) { + tnl->last_result_size[i] = tnl->vb.ResultPtr[i]->size; + tnl->last_result_stride[i] = tnl->vb.ResultPtr[i]->stride; + tnl->pipeline.output_changes |= 1<pipeline.output_changes) + tnl->Driver.NotifyOutputChanges( ctx, tnl->pipeline.output_changes ); + + return tnl->pipeline.output_changes; +#else + return ~0; +#endif +} + + +void _tnl_run_pipeline( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + unsigned short __tmp; + GLuint i; + + if (!tnl->vb.Count) + return; + + /* Check for changed input sizes or change in stride to/from zero + * (ie const or non-const). + */ + if (check_input_changes( ctx ) || tnl->pipeline.new_state) { + if (ctx->_MaintainTnlProgram) + _tnl_UpdateFixedFunctionProgram( ctx ); + + for (i = 0; i < tnl->pipeline.nr_stages ; i++) { + struct tnl_pipeline_stage *s = &tnl->pipeline.stages[i]; + if (s->validate) + s->validate( ctx, s ); + } + + tnl->pipeline.new_state = 0; + tnl->pipeline.input_changes = 0; + + /* Pipeline can only change its output in response to either a + * statechange or an input size/stride change. No other changes + * are allowed. + */ + if (check_output_changes( ctx )) + _tnl_notify_pipeline_output_change( ctx ); + } + + START_FAST_MATH(__tmp); + + for (i = 0; i < tnl->pipeline.nr_stages ; i++) { + struct tnl_pipeline_stage *s = &tnl->pipeline.stages[i]; + if (!s->run( ctx, s )) + break; + } + + END_FAST_MATH(__tmp); +} + + + +/* The default pipeline. This is useful for software rasterizers, and + * simple hardware rasterizers. For customization, I don't recommend + * tampering with the internals of these stages in the way that + * drivers did in Mesa 3.4. These stages are basically black boxes, + * and should be left intact. + * + * To customize the pipeline, consider: + * + * - removing redundant stages (making sure that the software rasterizer + * can cope with this on fallback paths). An example is fog + * coordinate generation, which is not required in the FX driver. + * + * - replacing general-purpose machine-independent stages with + * general-purpose machine-specific stages. There is no example of + * this to date, though it must be borne in mind that all subsequent + * stages that reference the output of the new stage must cope with + * any machine-specific data introduced. This may not be easy + * unless there are no such stages (ie the new stage is the last in + * the pipe). + * + * - inserting optimized (but specialized) stages ahead of the + * general-purpose fallback implementation. For example, the old + * fastpath mechanism, which only works when the VB->Elts input is + * available, can be duplicated by placing the fastpath stage at the + * head of this pipeline. Such specialized stages are currently + * constrained to have no outputs (ie. they must either finish the * + * pipeline by returning GL_FALSE from run(), or do nothing). + * + * Some work can be done to lift some of the restrictions in the final + * case, if it becomes necessary to do so. + */ +const struct tnl_pipeline_stage *_tnl_default_pipeline[] = { + &_tnl_vertex_transform_stage, + &_tnl_normal_transform_stage, + &_tnl_lighting_stage, + &_tnl_fog_coordinate_stage, + &_tnl_texgen_stage, + &_tnl_texture_transform_stage, + &_tnl_point_attenuation_stage, +#if defined(FEATURE_NV_vertex_program) || defined(FEATURE_ARB_vertex_program) + &_tnl_arb_vertex_program_stage, + &_tnl_vertex_program_stage, +#endif + &_tnl_render_stage, + NULL +}; + +const struct tnl_pipeline_stage *_tnl_vp_pipeline[] = { + &_tnl_arb_vertex_program_stage, + &_tnl_render_stage, + NULL +}; diff --git a/reactos/dll/mesa32/src/tnl/t_pipeline.h b/reactos/dll/mesa32/src/tnl/t_pipeline.h new file mode 100644 index 00000000000..6c7a0814c56 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_pipeline.h @@ -0,0 +1,76 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + + + +#ifndef _T_PIPELINE_H_ +#define _T_PIPELINE_H_ + +#include "mtypes.h" +#include "t_context.h" + +extern void _tnl_run_pipeline( GLcontext *ctx ); + +extern void _tnl_destroy_pipeline( GLcontext *ctx ); + +extern void _tnl_install_pipeline( GLcontext *ctx, + const struct tnl_pipeline_stage **stages ); + + +/* These are implemented in the t_vb_*.c files: + */ +extern const struct tnl_pipeline_stage _tnl_vertex_transform_stage; +extern const struct tnl_pipeline_stage _tnl_vertex_cull_stage; +extern const struct tnl_pipeline_stage _tnl_normal_transform_stage; +extern const struct tnl_pipeline_stage _tnl_lighting_stage; +extern const struct tnl_pipeline_stage _tnl_fog_coordinate_stage; +extern const struct tnl_pipeline_stage _tnl_texgen_stage; +extern const struct tnl_pipeline_stage _tnl_texture_transform_stage; +extern const struct tnl_pipeline_stage _tnl_point_attenuation_stage; +extern const struct tnl_pipeline_stage _tnl_arb_vertex_program_stage; +extern const struct tnl_pipeline_stage _tnl_vertex_program_stage; +extern const struct tnl_pipeline_stage _tnl_render_stage; + +/* Shorthand to plug in the default pipeline: + */ +extern const struct tnl_pipeline_stage *_tnl_default_pipeline[]; +extern const struct tnl_pipeline_stage *_tnl_vp_pipeline[]; + + +/* Convenience routines provided by t_vb_render.c: + */ +extern tnl_render_func _tnl_render_tab_elts[]; +extern tnl_render_func _tnl_render_tab_verts[]; + +extern void _tnl_RenderClippedPolygon( GLcontext *ctx, + const GLuint *elts, GLuint n ); + +extern void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ); + + +#endif diff --git a/reactos/dll/mesa32/src/tnl/t_save_api.c b/reactos/dll/mesa32/src/tnl/t_save_api.c new file mode 100644 index 00000000000..9788468d508 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_save_api.c @@ -0,0 +1,1724 @@ +/* $XFree86$ */ +/************************************************************************** + +Copyright 2002 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 +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 +TUNGSTEN GRAPHICS 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. + +**************************************************************************/ + +/* + * Authors: + * Keith Whitwell + */ + + + +/* Display list compiler attempts to store lists of vertices with the + * same vertex layout. Additionally it attempts to minimize the need + * for execute-time fixup of these vertex lists, allowing them to be + * cached on hardware. + * + * There are still some circumstances where this can be thwarted, for + * example by building a list that consists of one very long primitive + * (eg Begin(Triangles), 1000 vertices, End), and calling that list + * from inside a different begin/end object (Begin(Lines), CallList, + * End). + * + * In that case the code will have to replay the list as individual + * commands through the Exec dispatch table, or fix up the copied + * vertices at execute-time. + * + * The other case where fixup is required is when a vertex attribute + * is introduced in the middle of a primitive. Eg: + * Begin(Lines) + * TexCoord1f() Vertex2f() + * TexCoord1f() Color3f() Vertex2f() + * End() + * + * If the current value of Color isn't known at compile-time, this + * primitive will require fixup. + * + * + * The list compiler currently doesn't attempt to compile lists + * containing EvalCoord or EvalPoint commands. On encountering one of + * these, compilation falls back to opcodes. + * + * This could be improved to fallback only when a mix of EvalCoord and + * Vertex commands are issued within a single primitive. + */ + + +#include "glheader.h" +#include "context.h" +#include "dlist.h" +#include "enums.h" +#include "macros.h" +#include "api_validate.h" +#include "api_arrayelt.h" +#include "vtxfmt.h" +#include "t_save_api.h" +#include "dispatch.h" + +/* + * NOTE: Old 'parity' issue is gone, but copying can still be + * wrong-footed on replay. + */ +static GLuint _save_copy_vertices( GLcontext *ctx, + const struct tnl_vertex_list *node ) +{ + TNLcontext *tnl = TNL_CONTEXT( ctx ); + const struct tnl_prim *prim = &node->prim[node->prim_count-1]; + GLuint nr = prim->count; + GLuint sz = tnl->save.vertex_size; + const GLfloat *src = node->buffer + prim->start * sz; + GLfloat *dst = tnl->save.copied.buffer; + GLuint ovf, i; + + if (prim->mode & PRIM_END) + return 0; + + switch( prim->mode & PRIM_MODE_MASK ) + { + case GL_POINTS: + return 0; + case GL_LINES: + ovf = nr&1; + for (i = 0 ; i < ovf ; i++) + _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); + return i; + case GL_TRIANGLES: + ovf = nr%3; + for (i = 0 ; i < ovf ; i++) + _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); + return i; + case GL_QUADS: + ovf = nr&3; + for (i = 0 ; i < ovf ; i++) + _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); + return i; + case GL_LINE_STRIP: + if (nr == 0) + return 0; + else { + _mesa_memcpy( dst, src+(nr-1)*sz, sz*sizeof(GLfloat) ); + return 1; + } + case GL_LINE_LOOP: + case GL_TRIANGLE_FAN: + case GL_POLYGON: + if (nr == 0) + return 0; + else if (nr == 1) { + _mesa_memcpy( dst, src+0, sz*sizeof(GLfloat) ); + return 1; + } else { + _mesa_memcpy( dst, src+0, sz*sizeof(GLfloat) ); + _mesa_memcpy( dst+sz, src+(nr-1)*sz, sz*sizeof(GLfloat) ); + return 2; + } + case GL_TRIANGLE_STRIP: + case GL_QUAD_STRIP: + switch (nr) { + case 0: ovf = 0; break; + case 1: ovf = 1; break; + default: ovf = 2 + (nr&1); break; + } + for (i = 0 ; i < ovf ; i++) + _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); + return i; + default: + assert(0); + return 0; + } +} + + +static void +build_normal_lengths( struct tnl_vertex_list *node ) +{ + GLuint i; + GLfloat *len; + GLfloat *n = node->buffer; + GLuint stride = node->vertex_size; + GLuint count = node->count; + + len = node->normal_lengths = (GLfloat *) MALLOC( count * sizeof(GLfloat) ); + if (!len) + return; + + /* Find the normal of the first vertex: + */ + for (i = 0 ; i < _TNL_ATTRIB_NORMAL ; i++) + n += node->attrsz[i]; + + for (i = 0 ; i < count ; i++, n += stride) { + len[i] = LEN_3FV( n ); + if (len[i] > 0.0F) len[i] = 1.0F / len[i]; + } +} + +static struct tnl_vertex_store *alloc_vertex_store( GLcontext *ctx ) +{ + struct tnl_vertex_store *store = MALLOC_STRUCT(tnl_vertex_store); + (void) ctx; + store->used = 0; + store->refcount = 1; + return store; +} + +static struct tnl_primitive_store *alloc_prim_store( GLcontext *ctx ) +{ + struct tnl_primitive_store *store = MALLOC_STRUCT(tnl_primitive_store); + (void) ctx; + store->used = 0; + store->refcount = 1; + return store; +} + +static void _save_reset_counters( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + tnl->save.prim = tnl->save.prim_store->buffer + tnl->save.prim_store->used; + tnl->save.buffer = (tnl->save.vertex_store->buffer + + tnl->save.vertex_store->used); + + if (tnl->save.vertex_size) + tnl->save.initial_counter = ((SAVE_BUFFER_SIZE - + tnl->save.vertex_store->used) / + tnl->save.vertex_size); + else + tnl->save.initial_counter = 0; + + if (tnl->save.initial_counter > ctx->Const.MaxArrayLockSize ) + tnl->save.initial_counter = ctx->Const.MaxArrayLockSize; + + tnl->save.counter = tnl->save.initial_counter; + tnl->save.prim_count = 0; + tnl->save.prim_max = SAVE_PRIM_SIZE - tnl->save.prim_store->used; + tnl->save.copied.nr = 0; + tnl->save.dangling_attr_ref = 0; +} + + +/* Insert the active immediate struct onto the display list currently + * being built. + */ +static void _save_compile_vertex_list( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct tnl_vertex_list *node; + + /* Allocate space for this structure in the display list currently + * being compiled. + */ + node = (struct tnl_vertex_list *) + _mesa_alloc_instruction(ctx, tnl->save.opcode_vertex_list, sizeof(*node)); + + if (!node) + return; + + /* Duplicate our template, increment refcounts to the storage structs: + */ + _mesa_memcpy(node->attrsz, tnl->save.attrsz, sizeof(node->attrsz)); + node->vertex_size = tnl->save.vertex_size; + node->buffer = tnl->save.buffer; + node->count = tnl->save.initial_counter - tnl->save.counter; + node->wrap_count = tnl->save.copied.nr; + node->have_materials = tnl->save.have_materials; + node->dangling_attr_ref = tnl->save.dangling_attr_ref; + node->normal_lengths = NULL; + node->prim = tnl->save.prim; + node->prim_count = tnl->save.prim_count; + node->vertex_store = tnl->save.vertex_store; + node->prim_store = tnl->save.prim_store; + + node->vertex_store->refcount++; + node->prim_store->refcount++; + + assert(node->attrsz[_TNL_ATTRIB_POS] != 0 || + node->count == 0); + + if (tnl->save.dangling_attr_ref) + ctx->ListState.CurrentList->flags |= MESA_DLIST_DANGLING_REFS; + + /* Maybe calculate normal lengths: + */ + if (tnl->CalcDListNormalLengths && + node->attrsz[_TNL_ATTRIB_NORMAL] == 3 && + !(ctx->ListState.CurrentList->flags & MESA_DLIST_DANGLING_REFS)) + build_normal_lengths( node ); + + + tnl->save.vertex_store->used += tnl->save.vertex_size * node->count; + tnl->save.prim_store->used += node->prim_count; + + /* Decide whether the storage structs are full, or can be used for + * the next vertex lists as well. + */ + if (tnl->save.vertex_store->used > + SAVE_BUFFER_SIZE - 16 * (tnl->save.vertex_size + 4)) { + + tnl->save.vertex_store->refcount--; + assert(tnl->save.vertex_store->refcount != 0); + tnl->save.vertex_store = alloc_vertex_store( ctx ); + tnl->save.vbptr = tnl->save.vertex_store->buffer; + } + + if (tnl->save.prim_store->used > SAVE_PRIM_SIZE - 6) { + tnl->save.prim_store->refcount--; + assert(tnl->save.prim_store->refcount != 0); + tnl->save.prim_store = alloc_prim_store( ctx ); + } + + /* Reset our structures for the next run of vertices: + */ + _save_reset_counters( ctx ); + + /* Copy duplicated vertices + */ + tnl->save.copied.nr = _save_copy_vertices( ctx, node ); + + + /* Deal with GL_COMPILE_AND_EXECUTE: + */ + if (ctx->ExecuteFlag) { + _tnl_playback_vertex_list( ctx, (void *) node ); + } +} + + +/* TODO -- If no new vertices have been stored, don't bother saving + * it. + */ +static void _save_wrap_buffers( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLint i = tnl->save.prim_count - 1; + GLenum mode; + + assert(i < (GLint) tnl->save.prim_max); + assert(i >= 0); + + /* Close off in-progress primitive. + */ + tnl->save.prim[i].count = ((tnl->save.initial_counter - tnl->save.counter) - + tnl->save.prim[i].start); + mode = tnl->save.prim[i].mode & ~(PRIM_BEGIN|PRIM_END); + + /* store the copied vertices, and allocate a new list. + */ + _save_compile_vertex_list( ctx ); + + /* Restart interrupted primitive + */ + tnl->save.prim[0].mode = mode; + tnl->save.prim[0].start = 0; + tnl->save.prim[0].count = 0; + tnl->save.prim_count = 1; +} + + + +/* Called only when buffers are wrapped as the result of filling the + * vertex_store struct. + */ +static void _save_wrap_filled_vertex( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLfloat *data = tnl->save.copied.buffer; + GLuint i; + + /* Emit a glEnd to close off the last vertex list. + */ + _save_wrap_buffers( ctx ); + + /* Copy stored stored vertices to start of new list. + */ + assert(tnl->save.counter > tnl->save.copied.nr); + + for (i = 0 ; i < tnl->save.copied.nr ; i++) { + _mesa_memcpy( tnl->save.vbptr, data, tnl->save.vertex_size * sizeof(GLfloat)); + data += tnl->save.vertex_size; + tnl->save.vbptr += tnl->save.vertex_size; + tnl->save.counter--; + } +} + + +static void _save_copy_to_current( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint i; + + for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_INDEX ; i++) { + if (tnl->save.attrsz[i]) { + tnl->save.currentsz[i][0] = tnl->save.attrsz[i]; + COPY_CLEAN_4V(tnl->save.current[i], + tnl->save.attrsz[i], + tnl->save.attrptr[i]); + } + } + + /* Edgeflag requires special treatment: + * + * TODO: change edgeflag to GLfloat in Mesa. + */ + if (tnl->save.attrsz[_TNL_ATTRIB_EDGEFLAG]) { + ctx->ListState.ActiveEdgeFlag = 1; + tnl->save.CurrentFloatEdgeFlag = + tnl->save.attrptr[_TNL_ATTRIB_EDGEFLAG][0]; + ctx->ListState.CurrentEdgeFlag = + (tnl->save.CurrentFloatEdgeFlag == 1.0); + } +} + + +static void _save_copy_from_current( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLint i; + + for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_INDEX ; i++) + switch (tnl->save.attrsz[i]) { + case 4: tnl->save.attrptr[i][3] = tnl->save.current[i][3]; + case 3: tnl->save.attrptr[i][2] = tnl->save.current[i][2]; + case 2: tnl->save.attrptr[i][1] = tnl->save.current[i][1]; + case 1: tnl->save.attrptr[i][0] = tnl->save.current[i][0]; + case 0: break; + } + + /* Edgeflag requires special treatment: + */ + if (tnl->save.attrsz[_TNL_ATTRIB_EDGEFLAG]) { + tnl->save.CurrentFloatEdgeFlag = (GLfloat)ctx->ListState.CurrentEdgeFlag; + tnl->save.attrptr[_TNL_ATTRIB_EDGEFLAG][0] = tnl->save.CurrentFloatEdgeFlag; + } +} + + + + +/* Flush existing data, set new attrib size, replay copied vertices. + */ +static void _save_upgrade_vertex( GLcontext *ctx, + GLuint attr, + GLuint newsz ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint oldsz; + GLuint i; + GLfloat *tmp; + + /* Store the current run of vertices, and emit a GL_END. Emit a + * BEGIN in the new buffer. + */ + if (tnl->save.initial_counter != tnl->save.counter) + _save_wrap_buffers( ctx ); + else + assert( tnl->save.copied.nr == 0 ); + + /* Do a COPY_TO_CURRENT to ensure back-copying works for the case + * when the attribute already exists in the vertex and is having + * its size increased. + */ + _save_copy_to_current( ctx ); + + /* Fix up sizes: + */ + oldsz = tnl->save.attrsz[attr]; + tnl->save.attrsz[attr] = newsz; + + tnl->save.vertex_size += newsz - oldsz; + tnl->save.counter = ((SAVE_BUFFER_SIZE - tnl->save.vertex_store->used) / + tnl->save.vertex_size); + if (tnl->save.counter > ctx->Const.MaxArrayLockSize ) + tnl->save.counter = ctx->Const.MaxArrayLockSize; + tnl->save.initial_counter = tnl->save.counter; + + /* Recalculate all the attrptr[] values: + */ + for (i = 0, tmp = tnl->save.vertex ; i < _TNL_ATTRIB_MAX ; i++) { + if (tnl->save.attrsz[i]) { + tnl->save.attrptr[i] = tmp; + tmp += tnl->save.attrsz[i]; + } + else + tnl->save.attrptr[i] = NULL; /* will not be dereferenced. */ + } + + /* Copy from current to repopulate the vertex with correct values. + */ + _save_copy_from_current( ctx ); + + /* Replay stored vertices to translate them to new format here. + * + * If there are copied vertices and the new (upgraded) attribute + * has not been defined before, this list is somewhat degenerate, + * and will need fixup at runtime. + */ + if (tnl->save.copied.nr) + { + GLfloat *data = tnl->save.copied.buffer; + GLfloat *dest = tnl->save.buffer; + GLuint j; + + /* Need to note this and fix up at runtime (or loopback): + */ + if (tnl->save.currentsz[attr][0] == 0) { + assert(oldsz == 0); + tnl->save.dangling_attr_ref = GL_TRUE; + +/* _mesa_debug(NULL, "_save_upgrade_vertex: dangling reference attr %d\n", */ +/* attr); */ + +#if 0 + /* The current strategy is to punt these degenerate cases + * through _tnl_loopback_vertex_list(), a lower-performance + * option. To minimize the impact of this, artificially + * reduce the size of this vertex_list. + */ + if (t->save.counter > 10) { + t->save.initial_counter = 10; + t->save.counter = 10; + } +#endif + } + + for (i = 0 ; i < tnl->save.copied.nr ; i++) { + for (j = 0 ; j < _TNL_ATTRIB_MAX ; j++) { + if (tnl->save.attrsz[j]) { + if (j == attr) { + if (oldsz) { + COPY_CLEAN_4V( dest, oldsz, data ); + data += oldsz; + dest += newsz; + } + else { + COPY_SZ_4V( dest, newsz, tnl->save.current[attr] ); + dest += newsz; + } + } + else { + GLint sz = tnl->save.attrsz[j]; + COPY_SZ_4V( dest, sz, data ); + data += sz; + dest += sz; + } + } + } + } + + tnl->save.vbptr = dest; + tnl->save.counter -= tnl->save.copied.nr; + } +} + + + + +/* Helper function for 'CHOOSE' macro. Do what's necessary when an + * entrypoint is called for the first time. + */ +static void do_choose( GLuint attr, GLuint sz, + void (*attr_func)( const GLfloat *), + void (*choose1)( const GLfloat *), + void (*choose2)( const GLfloat *), + void (*choose3)( const GLfloat *), + void (*choose4)( const GLfloat *), + const GLfloat *v ) +{ + GET_CURRENT_CONTEXT( ctx ); + TNLcontext *tnl = TNL_CONTEXT(ctx); + static GLfloat id[4] = { 0, 0, 0, 1 }; + int i; + + if (tnl->save.attrsz[attr] < sz) { + /* New size is larger. Need to flush existing vertices and get + * an enlarged vertex format. + */ + _save_upgrade_vertex( ctx, attr, sz ); + } + else { + /* New size is equal or smaller - just need to fill in some + * zeros. + */ + for (i = sz ; i <= tnl->save.attrsz[attr] ; i++) + tnl->save.attrptr[attr][i-1] = id[i-1]; + } + + /* Reset any active pointers for this attribute + */ + tnl->save.tabfv[attr][0] = choose1; + tnl->save.tabfv[attr][1] = choose2; + tnl->save.tabfv[attr][2] = choose3; + tnl->save.tabfv[attr][3] = choose4; + + /* Update the secondary dispatch table with the new function + */ + tnl->save.tabfv[attr][sz-1] = attr_func; + + (*attr_func)(v); +} + + + +/* Only one size for each attribute may be active at once. Eg. if + * Color3f is installed/active, then Color4f may not be, even if the + * vertex actually contains 4 color coordinates. This is because the + * 3f version won't otherwise set color[3] to 1.0 -- this is the job + * of the chooser function when switching between Color4f and Color3f. + */ +#define ATTRFV( ATTR, N ) \ +static void save_choose_##ATTR##_##N( const GLfloat *v ); \ + \ +static void save_attrib_##ATTR##_##N( const GLfloat *v ) \ +{ \ + GET_CURRENT_CONTEXT( ctx ); \ + TNLcontext *tnl = TNL_CONTEXT(ctx); \ + \ + if ((ATTR) == 0) { \ + GLuint i; \ + \ + if (N>0) tnl->save.vbptr[0] = v[0]; \ + if (N>1) tnl->save.vbptr[1] = v[1]; \ + if (N>2) tnl->save.vbptr[2] = v[2]; \ + if (N>3) tnl->save.vbptr[3] = v[3]; \ + \ + for (i = N; i < tnl->save.vertex_size; i++) \ + tnl->save.vbptr[i] = tnl->save.vertex[i]; \ + \ + tnl->save.vbptr += tnl->save.vertex_size; \ + \ + if (--tnl->save.counter == 0) \ + _save_wrap_filled_vertex( ctx ); \ + } \ + else { \ + GLfloat *dest = tnl->save.attrptr[ATTR]; \ + if (N>0) dest[0] = v[0]; \ + if (N>1) dest[1] = v[1]; \ + if (N>2) dest[2] = v[2]; \ + if (N>3) dest[3] = v[3]; \ + } \ +} + +#define CHOOSE( ATTR, N ) \ +static void save_choose_##ATTR##_##N( const GLfloat *v ) \ +{ \ + do_choose(ATTR, N, \ + save_attrib_##ATTR##_##N, \ + save_choose_##ATTR##_1, \ + save_choose_##ATTR##_2, \ + save_choose_##ATTR##_3, \ + save_choose_##ATTR##_4, \ + v ); \ +} + +#define INIT(ATTR) \ +static void save_init_##ATTR( TNLcontext *tnl ) \ +{ \ + tnl->save.tabfv[ATTR][0] = save_choose_##ATTR##_1; \ + tnl->save.tabfv[ATTR][1] = save_choose_##ATTR##_2; \ + tnl->save.tabfv[ATTR][2] = save_choose_##ATTR##_3; \ + tnl->save.tabfv[ATTR][3] = save_choose_##ATTR##_4; \ +} + +#define ATTRS( ATTRIB ) \ + ATTRFV( ATTRIB, 1 ) \ + ATTRFV( ATTRIB, 2 ) \ + ATTRFV( ATTRIB, 3 ) \ + ATTRFV( ATTRIB, 4 ) \ + CHOOSE( ATTRIB, 1 ) \ + CHOOSE( ATTRIB, 2 ) \ + CHOOSE( ATTRIB, 3 ) \ + CHOOSE( ATTRIB, 4 ) \ + INIT( ATTRIB ) \ + + +/* Generate a lot of functions. These are the actual worker + * functions, which are equivalent to those generated via codegen + * elsewhere. + */ +ATTRS( 0 ) +ATTRS( 1 ) +ATTRS( 2 ) +ATTRS( 3 ) +ATTRS( 4 ) +ATTRS( 5 ) +ATTRS( 6 ) +ATTRS( 7 ) +ATTRS( 8 ) +ATTRS( 9 ) +ATTRS( 10 ) +ATTRS( 11 ) +ATTRS( 12 ) +ATTRS( 13 ) +ATTRS( 14 ) +ATTRS( 15 ) + + +static void _save_reset_vertex( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint i; + + save_init_0( tnl ); + save_init_1( tnl ); + save_init_2( tnl ); + save_init_3( tnl ); + save_init_4( tnl ); + save_init_5( tnl ); + save_init_6( tnl ); + save_init_7( tnl ); + save_init_8( tnl ); + save_init_9( tnl ); + save_init_10( tnl ); + save_init_11( tnl ); + save_init_12( tnl ); + save_init_13( tnl ); + save_init_14( tnl ); + save_init_15( tnl ); + + for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) + tnl->save.attrsz[i] = 0; + + tnl->save.vertex_size = 0; + tnl->save.have_materials = 0; + + _save_reset_counters( ctx ); +} + + + +/* Cope with aliasing of classic Vertex, Normal, etc. and the fan-out + * of glMultTexCoord and glProgramParamterNV by routing all these + * through a second level dispatch table. + */ +#define DISPATCH_ATTRFV( ATTR, COUNT, P ) \ +do { \ + GET_CURRENT_CONTEXT( ctx ); \ + TNLcontext *tnl = TNL_CONTEXT(ctx); \ + tnl->save.tabfv[ATTR][COUNT-1]( P ); \ +} while (0) + +#define DISPATCH_ATTR1FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 1, V ) +#define DISPATCH_ATTR2FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 2, V ) +#define DISPATCH_ATTR3FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 3, V ) +#define DISPATCH_ATTR4FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 4, V ) + +#define DISPATCH_ATTR1F( ATTR, S ) DISPATCH_ATTRFV( ATTR, 1, &(S) ) + +#if defined(USE_X86_ASM) && 0 /* will break register calling convention */ +/* Naughty cheat: + */ +#define DISPATCH_ATTR2F( ATTR, S,T ) DISPATCH_ATTRFV( ATTR, 2, &(S) ) +#define DISPATCH_ATTR3F( ATTR, S,T,R ) DISPATCH_ATTRFV( ATTR, 3, &(S) ) +#define DISPATCH_ATTR4F( ATTR, S,T,R,Q ) DISPATCH_ATTRFV( ATTR, 4, &(S) ) +#else +/* Safe: + */ +#define DISPATCH_ATTR2F( ATTR, S,T ) \ +do { \ + GLfloat v[2]; \ + v[0] = S; v[1] = T; \ + DISPATCH_ATTR2FV( ATTR, v ); \ +} while (0) +#define DISPATCH_ATTR3F( ATTR, S,T,R ) \ +do { \ + GLfloat v[3]; \ + v[0] = S; v[1] = T; v[2] = R; \ + DISPATCH_ATTR3FV( ATTR, v ); \ +} while (0) +#define DISPATCH_ATTR4F( ATTR, S,T,R,Q ) \ +do { \ + GLfloat v[4]; \ + v[0] = S; v[1] = T; v[2] = R; v[3] = Q; \ + DISPATCH_ATTR4FV( ATTR, v ); \ +} while (0) +#endif + + +static void enum_error( void ) +{ + GET_CURRENT_CONTEXT( ctx ); + _mesa_compile_error( ctx, GL_INVALID_ENUM, "glVertexAttrib" ); +} + +static void GLAPIENTRY _save_Vertex2f( GLfloat x, GLfloat y ) +{ + DISPATCH_ATTR2F( _TNL_ATTRIB_POS, x, y ); +} + +static void GLAPIENTRY _save_Vertex2fv( const GLfloat *v ) +{ + DISPATCH_ATTR2FV( _TNL_ATTRIB_POS, v ); +} + +static void GLAPIENTRY _save_Vertex3f( GLfloat x, GLfloat y, GLfloat z ) +{ + DISPATCH_ATTR3F( _TNL_ATTRIB_POS, x, y, z ); +} + +static void GLAPIENTRY _save_Vertex3fv( const GLfloat *v ) +{ + DISPATCH_ATTR3FV( _TNL_ATTRIB_POS, v ); +} + +static void GLAPIENTRY _save_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + DISPATCH_ATTR4F( _TNL_ATTRIB_POS, x, y, z, w ); +} + +static void GLAPIENTRY _save_Vertex4fv( const GLfloat *v ) +{ + DISPATCH_ATTR4FV( _TNL_ATTRIB_POS, v ); +} + +static void GLAPIENTRY _save_TexCoord1f( GLfloat x ) +{ + DISPATCH_ATTR1F( _TNL_ATTRIB_TEX0, x ); +} + +static void GLAPIENTRY _save_TexCoord1fv( const GLfloat *v ) +{ + DISPATCH_ATTR1FV( _TNL_ATTRIB_TEX0, v ); +} + +static void GLAPIENTRY _save_TexCoord2f( GLfloat x, GLfloat y ) +{ + DISPATCH_ATTR2F( _TNL_ATTRIB_TEX0, x, y ); +} + +static void GLAPIENTRY _save_TexCoord2fv( const GLfloat *v ) +{ + DISPATCH_ATTR2FV( _TNL_ATTRIB_TEX0, v ); +} + +static void GLAPIENTRY _save_TexCoord3f( GLfloat x, GLfloat y, GLfloat z ) +{ + DISPATCH_ATTR3F( _TNL_ATTRIB_TEX0, x, y, z ); +} + +static void GLAPIENTRY _save_TexCoord3fv( const GLfloat *v ) +{ + DISPATCH_ATTR3FV( _TNL_ATTRIB_TEX0, v ); +} + +static void GLAPIENTRY _save_TexCoord4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + DISPATCH_ATTR4F( _TNL_ATTRIB_TEX0, x, y, z, w ); +} + +static void GLAPIENTRY _save_TexCoord4fv( const GLfloat *v ) +{ + DISPATCH_ATTR4FV( _TNL_ATTRIB_TEX0, v ); +} + +static void GLAPIENTRY _save_Normal3f( GLfloat x, GLfloat y, GLfloat z ) +{ + DISPATCH_ATTR3F( _TNL_ATTRIB_NORMAL, x, y, z ); +} + +static void GLAPIENTRY _save_Normal3fv( const GLfloat *v ) +{ + DISPATCH_ATTR3FV( _TNL_ATTRIB_NORMAL, v ); +} + +static void GLAPIENTRY _save_FogCoordfEXT( GLfloat x ) +{ + DISPATCH_ATTR1F( _TNL_ATTRIB_FOG, x ); +} + +static void GLAPIENTRY _save_FogCoordfvEXT( const GLfloat *v ) +{ + DISPATCH_ATTR1FV( _TNL_ATTRIB_FOG, v ); +} + +static void GLAPIENTRY _save_Color3f( GLfloat x, GLfloat y, GLfloat z ) +{ + DISPATCH_ATTR3F( _TNL_ATTRIB_COLOR0, x, y, z ); +} + +static void GLAPIENTRY _save_Color3fv( const GLfloat *v ) +{ + DISPATCH_ATTR3FV( _TNL_ATTRIB_COLOR0, v ); +} + +static void GLAPIENTRY _save_Color4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + DISPATCH_ATTR4F( _TNL_ATTRIB_COLOR0, x, y, z, w ); +} + +static void GLAPIENTRY _save_Color4fv( const GLfloat *v ) +{ + DISPATCH_ATTR4FV( _TNL_ATTRIB_COLOR0, v ); +} + +static void GLAPIENTRY _save_SecondaryColor3fEXT( GLfloat x, GLfloat y, GLfloat z ) +{ + DISPATCH_ATTR3F( _TNL_ATTRIB_COLOR1, x, y, z ); +} + +static void GLAPIENTRY _save_SecondaryColor3fvEXT( const GLfloat *v ) +{ + DISPATCH_ATTR3FV( _TNL_ATTRIB_COLOR1, v ); +} + +static void GLAPIENTRY _save_MultiTexCoord1f( GLenum target, GLfloat x ) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR1F( attr, x ); +} + +static void GLAPIENTRY _save_MultiTexCoord1fv( GLenum target, const GLfloat *v ) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR1FV( attr, v ); +} + +static void GLAPIENTRY _save_MultiTexCoord2f( GLenum target, GLfloat x, GLfloat y ) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR2F( attr, x, y ); +} + +static void GLAPIENTRY _save_MultiTexCoord2fv( GLenum target, const GLfloat *v ) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR2FV( attr, v ); +} + +static void GLAPIENTRY _save_MultiTexCoord3f( GLenum target, GLfloat x, GLfloat y, + GLfloat z) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR3F( attr, x, y, z ); +} + +static void GLAPIENTRY _save_MultiTexCoord3fv( GLenum target, const GLfloat *v ) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR3FV( attr, v ); +} + +static void GLAPIENTRY _save_MultiTexCoord4f( GLenum target, GLfloat x, GLfloat y, + GLfloat z, GLfloat w ) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR4F( attr, x, y, z, w ); +} + +static void GLAPIENTRY _save_MultiTexCoord4fv( GLenum target, const GLfloat *v ) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR4FV( attr, v ); +} + +static void GLAPIENTRY _save_VertexAttrib1fNV( GLuint index, GLfloat x ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR1F( index, x ); + else + enum_error(); +} + +static void GLAPIENTRY _save_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR1FV( index, v ); + else + enum_error(); +} + +static void GLAPIENTRY _save_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR2F( index, x, y ); + else + enum_error(); +} + +static void GLAPIENTRY _save_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR2FV( index, v ); + else + enum_error(); +} + +static void GLAPIENTRY _save_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, + GLfloat z ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR3F( index, x, y, z ); + else + enum_error(); +} + +static void GLAPIENTRY _save_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR3FV( index, v ); + else + enum_error(); +} + +static void GLAPIENTRY _save_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, + GLfloat z, GLfloat w ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR4F( index, x, y, z, w ); + else + enum_error(); +} + +static void GLAPIENTRY _save_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR4FV( index, v ); + else + enum_error(); +} + + +static void GLAPIENTRY +_save_VertexAttrib1fARB( GLuint index, GLfloat x ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR1F( index, x ); + else + enum_error(); +} + +static void GLAPIENTRY +_save_VertexAttrib1fvARB( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR1FV( index, v ); + else + enum_error(); +} + +static void GLAPIENTRY +_save_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR2F( index, x, y ); + else + enum_error(); +} + +static void GLAPIENTRY +_save_VertexAttrib2fvARB( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR2FV( index, v ); + else + enum_error(); +} + +static void GLAPIENTRY +_save_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR3F( index, x, y, z ); + else + enum_error(); +} + +static void GLAPIENTRY +_save_VertexAttrib3fvARB( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR3FV( index, v ); + else + enum_error(); +} + +static void GLAPIENTRY +_save_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR4F( index, x, y, z, w ); + else + enum_error(); +} + +static void GLAPIENTRY +_save_VertexAttrib4fvARB( GLuint index, const GLfloat *v ) +{ + if (index < VERT_ATTRIB_MAX) + DISPATCH_ATTR4FV( index, v ); + else + enum_error(); +} + + +/* Materials: + * + * These are treated as per-vertex attributes, at indices above where + * the NV_vertex_program leaves off. There are a lot of good things + * about treating materials this way. + * + * However: I don't want to double the number of generated functions + * just to cope with this, so I unroll the 'C' varients of CHOOSE and + * ATTRF into this function, and dispense with codegen and + * second-level dispatch. + * + * There is no aliasing of material attributes with other entrypoints. + */ +#define MAT_ATTR( A, N, params ) \ +do { \ + if (tnl->save.attrsz[A] < N) { \ + _save_upgrade_vertex( ctx, A, N ); \ + tnl->save.have_materials = GL_TRUE; \ + } \ + \ + { \ + GLfloat *dest = tnl->save.attrptr[A]; \ + if (N>0) dest[0] = params[0]; \ + if (N>1) dest[1] = params[1]; \ + if (N>2) dest[2] = params[2]; \ + if (N>3) dest[3] = params[3]; \ + } \ +} while (0) + + +#define MAT( ATTR, N, face, params ) \ +do { \ + if (face != GL_BACK) \ + MAT_ATTR( ATTR, N, params ); /* front */ \ + if (face != GL_FRONT) \ + MAT_ATTR( ATTR + 1, N, params ); /* back */ \ +} while (0) + + +/* NOTE: Have to remove/deal-with colormaterial crossovers, probably + * later on - in the meantime just store everything. + */ +static void GLAPIENTRY _save_Materialfv( GLenum face, GLenum pname, + const GLfloat *params ) +{ + GET_CURRENT_CONTEXT( ctx ); + TNLcontext *tnl = TNL_CONTEXT(ctx); + + switch (pname) { + case GL_EMISSION: + MAT( _TNL_ATTRIB_MAT_FRONT_EMISSION, 4, face, params ); + break; + case GL_AMBIENT: + MAT( _TNL_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params ); + break; + case GL_DIFFUSE: + MAT( _TNL_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params ); + break; + case GL_SPECULAR: + MAT( _TNL_ATTRIB_MAT_FRONT_SPECULAR, 4, face, params ); + break; + case GL_SHININESS: + MAT( _TNL_ATTRIB_MAT_FRONT_SHININESS, 1, face, params ); + break; + case GL_COLOR_INDEXES: + MAT( _TNL_ATTRIB_MAT_FRONT_INDEXES, 3, face, params ); + break; + case GL_AMBIENT_AND_DIFFUSE: + MAT( _TNL_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params ); + MAT( _TNL_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params ); + break; + default: + _mesa_compile_error( ctx, GL_INVALID_ENUM, "glMaterialfv" ); + return; + } +} + + +#define IDX_ATTR( A, IDX ) \ +do { \ + GET_CURRENT_CONTEXT( ctx ); \ + TNLcontext *tnl = TNL_CONTEXT(ctx); \ + \ + if (tnl->save.attrsz[A] < 1) { \ + _save_upgrade_vertex( ctx, A, 1 ); \ + } \ + \ + { \ + GLfloat *dest = tnl->save.attrptr[A]; \ + dest[0] = IDX; \ + } \ +} while (0) + + +static void GLAPIENTRY _save_EdgeFlag( GLboolean b ) +{ + IDX_ATTR( _TNL_ATTRIB_EDGEFLAG, (GLfloat)b ); +} + +static void GLAPIENTRY _save_EdgeFlagv( const GLboolean *v ) +{ + IDX_ATTR( _TNL_ATTRIB_EDGEFLAG, (GLfloat)(v[0]) ); +} + +static void GLAPIENTRY _save_Indexf( GLfloat f ) +{ + IDX_ATTR( _TNL_ATTRIB_INDEX, f ); +} + +static void GLAPIENTRY _save_Indexfv( const GLfloat *f ) +{ + IDX_ATTR( _TNL_ATTRIB_INDEX, f[0] ); +} + + + + +/* Cope with EvalCoord/CallList called within a begin/end object: + * -- Flush current buffer + * -- Fallback to opcodes for the rest of the begin/end object. + */ +#define FALLBACK(ctx) \ +do { \ + TNLcontext *tnl = TNL_CONTEXT(ctx); \ + \ + if (tnl->save.initial_counter != tnl->save.counter || \ + tnl->save.prim_count) \ + _save_compile_vertex_list( ctx ); \ + \ + _save_copy_to_current( ctx ); \ + _save_reset_vertex( ctx ); \ + _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); \ + ctx->Driver.SaveNeedFlush = 0; \ +} while (0) + +static void GLAPIENTRY _save_EvalCoord1f( GLfloat u ) +{ + GET_CURRENT_CONTEXT(ctx); + FALLBACK(ctx); + CALL_EvalCoord1f(ctx->Save, ( u )); +} + +static void GLAPIENTRY _save_EvalCoord1fv( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + FALLBACK(ctx); + CALL_EvalCoord1fv(ctx->Save, ( v )); +} + +static void GLAPIENTRY _save_EvalCoord2f( GLfloat u, GLfloat v ) +{ + GET_CURRENT_CONTEXT(ctx); + FALLBACK(ctx); + CALL_EvalCoord2f(ctx->Save, ( u, v )); +} + +static void GLAPIENTRY _save_EvalCoord2fv( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + FALLBACK(ctx); + CALL_EvalCoord2fv(ctx->Save, ( v )); +} + +static void GLAPIENTRY _save_EvalPoint1( GLint i ) +{ + GET_CURRENT_CONTEXT(ctx); + FALLBACK(ctx); + CALL_EvalPoint1(ctx->Save, ( i )); +} + +static void GLAPIENTRY _save_EvalPoint2( GLint i, GLint j ) +{ + GET_CURRENT_CONTEXT(ctx); + FALLBACK(ctx); + CALL_EvalPoint2(ctx->Save, ( i, j )); +} + +static void GLAPIENTRY _save_CallList( GLuint l ) +{ + GET_CURRENT_CONTEXT(ctx); + FALLBACK(ctx); + CALL_CallList(ctx->Save, ( l )); +} + +static void GLAPIENTRY _save_CallLists( GLsizei n, GLenum type, const GLvoid *v ) +{ + GET_CURRENT_CONTEXT(ctx); + FALLBACK(ctx); + CALL_CallLists(ctx->Save, ( n, type, v )); +} + + + + +/* This begin is hooked into ... Updating of + * ctx->Driver.CurrentSavePrimitive is already taken care of. + */ +static GLboolean _save_NotifyBegin( GLcontext *ctx, GLenum mode ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + if (1) { + GLuint i = tnl->save.prim_count++; + + assert(i < tnl->save.prim_max); + tnl->save.prim[i].mode = mode | PRIM_BEGIN; + tnl->save.prim[i].start = tnl->save.initial_counter - tnl->save.counter; + tnl->save.prim[i].count = 0; + + _mesa_install_save_vtxfmt( ctx, &tnl->save_vtxfmt ); + ctx->Driver.SaveNeedFlush = 1; + return GL_TRUE; + } + else + return GL_FALSE; +} + + + +static void GLAPIENTRY _save_End( void ) +{ + GET_CURRENT_CONTEXT( ctx ); + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLint i = tnl->save.prim_count - 1; + + ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; + tnl->save.prim[i].mode |= PRIM_END; + tnl->save.prim[i].count = ((tnl->save.initial_counter - tnl->save.counter) - + tnl->save.prim[i].start); + + if (i == (GLint) tnl->save.prim_max - 1) { + _save_compile_vertex_list( ctx ); + assert(tnl->save.copied.nr == 0); + } + + /* Swap out this vertex format while outside begin/end. Any color, + * etc. received between here and the next begin will be compiled + * as opcodes. + */ + _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); +} + + +/* These are all errors as this vtxfmt is only installed inside + * begin/end pairs. + */ +static void GLAPIENTRY _save_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices) +{ + GET_CURRENT_CONTEXT(ctx); + (void) mode; (void) count; (void) type; (void) indices; + _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glDrawElements" ); +} + + +static void GLAPIENTRY _save_DrawRangeElements(GLenum mode, + GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices) +{ + GET_CURRENT_CONTEXT(ctx); + (void) mode; (void) start; (void) end; (void) count; (void) type; (void) indices; + _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glDrawRangeElements" ); +} + +static void GLAPIENTRY _save_DrawArrays(GLenum mode, GLint start, GLsizei count) +{ + GET_CURRENT_CONTEXT(ctx); + (void) mode; (void) start; (void) count; + _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glDrawArrays" ); +} + +static void GLAPIENTRY _save_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) +{ + GET_CURRENT_CONTEXT(ctx); + (void) x1; (void) y1; (void) x2; (void) y2; + _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glRectf" ); +} + +static void GLAPIENTRY _save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) +{ + GET_CURRENT_CONTEXT(ctx); + (void) mode; (void) i1; (void) i2; + _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glEvalMesh1" ); +} + +static void GLAPIENTRY _save_EvalMesh2( GLenum mode, GLint i1, GLint i2, + GLint j1, GLint j2 ) +{ + GET_CURRENT_CONTEXT(ctx); + (void) mode; (void) i1; (void) i2; (void) j1; (void) j2; + _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glEvalMesh2" ); +} + +static void GLAPIENTRY _save_Begin( GLenum mode ) +{ + GET_CURRENT_CONTEXT( ctx ); + (void) mode; + _mesa_compile_error( ctx, GL_INVALID_OPERATION, "Recursive glBegin" ); +} + + +/* Unlike the functions above, these are to be hooked into the vtxfmt + * maintained in ctx->ListState, active when the list is known or + * suspected to be outside any begin/end primitive. + */ +static void GLAPIENTRY _save_OBE_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) +{ + GET_CURRENT_CONTEXT(ctx); + _save_NotifyBegin( ctx, GL_QUADS | PRIM_WEAK ); + CALL_Vertex2f(GET_DISPATCH(), ( x1, y1 )); + CALL_Vertex2f(GET_DISPATCH(), ( x2, y1 )); + CALL_Vertex2f(GET_DISPATCH(), ( x2, y2 )); + CALL_Vertex2f(GET_DISPATCH(), ( x1, y2 )); + CALL_End(GET_DISPATCH(), ()); +} + + +static void GLAPIENTRY _save_OBE_DrawArrays(GLenum mode, GLint start, GLsizei count) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + + if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) + return; + + _save_NotifyBegin( ctx, mode | PRIM_WEAK ); + for (i = 0; i < count; i++) + CALL_ArrayElement(GET_DISPATCH(), (start + i)); + CALL_End(GET_DISPATCH(), ()); +} + + +static void GLAPIENTRY _save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + + if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) + return; + + _save_NotifyBegin( ctx, mode | PRIM_WEAK ); + + switch (type) { + case GL_UNSIGNED_BYTE: + for (i = 0 ; i < count ; i++) + CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte *)indices)[i] )); + break; + case GL_UNSIGNED_SHORT: + for (i = 0 ; i < count ; i++) + CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort *)indices)[i] )); + break; + case GL_UNSIGNED_INT: + for (i = 0 ; i < count ; i++) + CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint *)indices)[i] )); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); + break; + } + + CALL_End(GET_DISPATCH(), ()); +} + +static void GLAPIENTRY _save_OBE_DrawRangeElements(GLenum mode, + GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices) +{ + GET_CURRENT_CONTEXT(ctx); + if (_mesa_validate_DrawRangeElements( ctx, mode, + start, end, + count, type, indices )) + _save_OBE_DrawElements( mode, count, type, indices ); +} + + + + + +static void _save_vtxfmt_init( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLvertexformat *vfmt = &tnl->save_vtxfmt; + + vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ + vfmt->Begin = _save_Begin; + vfmt->Color3f = _save_Color3f; + vfmt->Color3fv = _save_Color3fv; + vfmt->Color4f = _save_Color4f; + vfmt->Color4fv = _save_Color4fv; + vfmt->EdgeFlag = _save_EdgeFlag; + vfmt->EdgeFlagv = _save_EdgeFlagv; + vfmt->End = _save_End; + 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; + + /* This will all require us to fallback to saving the list as opcodes: + */ + vfmt->CallList = _save_CallList; /* inside begin/end */ + vfmt->CallLists = _save_CallLists; /* inside begin/end */ + vfmt->EvalCoord1f = _save_EvalCoord1f; + vfmt->EvalCoord1fv = _save_EvalCoord1fv; + vfmt->EvalCoord2f = _save_EvalCoord2f; + vfmt->EvalCoord2fv = _save_EvalCoord2fv; + vfmt->EvalPoint1 = _save_EvalPoint1; + vfmt->EvalPoint2 = _save_EvalPoint2; + + /* These are all errors as we at least know we are in some sort of + * begin/end pair: + */ + vfmt->EvalMesh1 = _save_EvalMesh1; + vfmt->EvalMesh2 = _save_EvalMesh2; + vfmt->Begin = _save_Begin; + vfmt->Rectf = _save_Rectf; + vfmt->DrawArrays = _save_DrawArrays; + vfmt->DrawElements = _save_DrawElements; + vfmt->DrawRangeElements = _save_DrawRangeElements; + +} + + +void _tnl_SaveFlushVertices( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + /* Noop when we are actually active: + */ + if (ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM || + ctx->Driver.CurrentSavePrimitive <= GL_POLYGON) + return; + + if (tnl->save.initial_counter != tnl->save.counter || + tnl->save.prim_count) + _save_compile_vertex_list( ctx ); + + _save_copy_to_current( ctx ); + _save_reset_vertex( ctx ); + ctx->Driver.SaveNeedFlush = 0; +} + +void _tnl_NewList( GLcontext *ctx, GLuint list, GLenum mode ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + (void) list; (void) mode; + + if (!tnl->save.prim_store) + tnl->save.prim_store = alloc_prim_store( ctx ); + + if (!tnl->save.vertex_store) { + tnl->save.vertex_store = alloc_vertex_store( ctx ); + tnl->save.vbptr = tnl->save.vertex_store->buffer; + } + + _save_reset_vertex( ctx ); + ctx->Driver.SaveNeedFlush = 0; +} + +void _tnl_EndList( GLcontext *ctx ) +{ + (void) ctx; + assert(TNL_CONTEXT(ctx)->save.vertex_size == 0); +} + +void _tnl_BeginCallList( GLcontext *ctx, struct mesa_display_list *dlist ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + tnl->save.replay_flags |= dlist->flags; + tnl->save.replay_flags |= tnl->LoopbackDListCassettes; +} + +void _tnl_EndCallList( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + if (ctx->ListState.CallDepth == 1) + tnl->save.replay_flags = 0; +} + + +static void _tnl_destroy_vertex_list( GLcontext *ctx, void *data ) +{ + struct tnl_vertex_list *node = (struct tnl_vertex_list *)data; + (void) ctx; + + if ( --node->vertex_store->refcount == 0 ) + FREE( node->vertex_store ); + + if ( --node->prim_store->refcount == 0 ) + FREE( node->prim_store ); + + if ( node->normal_lengths ) + FREE( node->normal_lengths ); +} + + +static void _tnl_print_vertex_list( GLcontext *ctx, void *data ) +{ + struct tnl_vertex_list *node = (struct tnl_vertex_list *)data; + GLuint i; + (void) ctx; + + _mesa_debug(NULL, "TNL-VERTEX-LIST, %u vertices %d primitives, %d vertsize\n", + node->count, + node->prim_count, + node->vertex_size); + + for (i = 0 ; i < node->prim_count ; i++) { + struct tnl_prim *prim = &node->prim[i]; + _mesa_debug(NULL, " prim %d: %s %d..%d %s %s\n", + i, + _mesa_lookup_enum_by_nr(prim->mode & PRIM_MODE_MASK), + prim->start, + prim->start + prim->count, + (prim->mode & PRIM_BEGIN) ? "BEGIN" : "(wrap)", + (prim->mode & PRIM_END) ? "END" : "(wrap)"); + } +} + + +static void _save_current_init( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLint i; + + for (i = 0; i < _TNL_ATTRIB_MAT_FRONT_AMBIENT; i++) { + ASSERT(i < VERT_ATTRIB_MAX); + tnl->save.currentsz[i] = &ctx->ListState.ActiveAttribSize[i]; + tnl->save.current[i] = ctx->ListState.CurrentAttrib[i]; + } + + for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT; i < _TNL_ATTRIB_INDEX; i++) { + const GLuint j = i - _TNL_ATTRIB_MAT_FRONT_AMBIENT; + ASSERT(j < MAT_ATTRIB_MAX); + tnl->save.currentsz[i] = &ctx->ListState.ActiveMaterialSize[j]; + tnl->save.current[i] = ctx->ListState.CurrentMaterial[j]; + } + + tnl->save.currentsz[_TNL_ATTRIB_INDEX] = &ctx->ListState.ActiveIndex; + tnl->save.current[_TNL_ATTRIB_INDEX] = &ctx->ListState.CurrentIndex; + + tnl->save.currentsz[_TNL_ATTRIB_EDGEFLAG] = &ctx->ListState.ActiveEdgeFlag; + tnl->save.current[_TNL_ATTRIB_EDGEFLAG] = &tnl->save.CurrentFloatEdgeFlag; +} + +/** + * Initialize the display list compiler + */ +void _tnl_save_init( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct tnl_vertex_arrays *tmp = &tnl->save_inputs; + GLuint i; + + + for (i = 0; i < _TNL_ATTRIB_MAX; i++) + _mesa_vector4f_init( &tmp->Attribs[i], 0, NULL); + + tnl->save.opcode_vertex_list = + _mesa_alloc_opcode( ctx, + sizeof(struct tnl_vertex_list), + _tnl_playback_vertex_list, + _tnl_destroy_vertex_list, + _tnl_print_vertex_list ); + + ctx->Driver.NotifySaveBegin = _save_NotifyBegin; + + _save_vtxfmt_init( ctx ); + _save_current_init( ctx ); + + /* Hook our array functions into the outside-begin-end vtxfmt in + * ctx->ListState. + */ + ctx->ListState.ListVtxfmt.Rectf = _save_OBE_Rectf; + ctx->ListState.ListVtxfmt.DrawArrays = _save_OBE_DrawArrays; + ctx->ListState.ListVtxfmt.DrawElements = _save_OBE_DrawElements; + ctx->ListState.ListVtxfmt.DrawRangeElements = _save_OBE_DrawRangeElements; + _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); +} + + +/** + * Deallocate the immediate-mode buffer for the given context, if + * its reference count goes to zero. + */ +void _tnl_save_destroy( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + /* Decrement the refcounts. References may still be held by + * display lists yet to be destroyed, so it may not yet be time to + * free these items. + */ + if (tnl->save.prim_store && + --tnl->save.prim_store->refcount == 0 ) + FREE( tnl->save.prim_store ); + + if (tnl->save.vertex_store && + --tnl->save.vertex_store->refcount == 0 ) + FREE( tnl->save.vertex_store ); +} diff --git a/reactos/dll/mesa32/src/tnl/t_save_api.h b/reactos/dll/mesa32/src/tnl/t_save_api.h new file mode 100644 index 00000000000..8ffb7f57331 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_save_api.h @@ -0,0 +1,58 @@ +/* $XFree86$ */ +/************************************************************************** + +Copyright 2002 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 +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 +TUNGSTEN GRAPHICS 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. + +**************************************************************************/ + +/* + * Authors: + * Keith Whitwell + * + */ + +#ifndef __T_SAVE_API_H__ +#define __T_SAVE_API_H__ + +#include "t_context.h" + +extern GLboolean _tnl_weak_begin( GLcontext *ctx, GLenum mode ); + +extern void _tnl_EndList( GLcontext *ctx ); +extern void _tnl_NewList( GLcontext *ctx, GLuint list, GLenum mode ); + +extern void _tnl_EndCallList( GLcontext *ctx ); +extern void _tnl_BeginCallList( GLcontext *ctx, struct mesa_display_list *list ); + +extern void _tnl_SaveFlushVertices( GLcontext *ctx ); + +extern void _tnl_save_init( GLcontext *ctx ); +extern void _tnl_save_destroy( GLcontext *ctx ); + +extern void _tnl_loopback_vertex_list( GLcontext *ctx, + const struct tnl_vertex_list *list ); + +extern void _tnl_playback_vertex_list( GLcontext *ctx, void *data ); + +#endif diff --git a/reactos/dll/mesa32/src/tnl/t_save_loopback.c b/reactos/dll/mesa32/src/tnl/t_save_loopback.c new file mode 100644 index 00000000000..7b2e4a43203 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_save_loopback.c @@ -0,0 +1,342 @@ +/* + * 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. + */ + +/* Author: + * Keith Whitwell + */ + +#include "glheader.h" +#include "context.h" +#include "enums.h" +#include "glapi.h" +#include "imports.h" +#include "macros.h" +#include "mtypes.h" +#include "t_context.h" +#include "t_save_api.h" +#include "dispatch.h" + +/* If someone compiles a display list like: + * glBegin(Triangles) + * glVertex() + * ... lots of vertices ... + * glEnd() + * + * or: + * glDrawArrays(...) + * + * and then tries to execute it like this: + * + * glBegin(Lines) + * glCallList() + * glEnd() + * + * it will wind up in here, as the vertex copying used when wrapping + * buffers in list compilation (Triangles) won't be right for how the + * list is being executed (as Lines). + * + * This could be avoided by not compiling as vertex_lists until after + * the first glEnd() has been seen. However, that would miss an + * important category of display lists, for the sake of a degenerate + * usage. + * + * Further, replaying degenerately-called lists in this fashion is + * probably still faster than the replay using opcodes. + */ + +typedef void (*attr_func)( GLcontext *ctx, GLint target, const GLfloat * ); + + +/* Wrapper functions in case glVertexAttrib*fvNV doesn't exist */ +static void VertexAttrib1fvNV(GLcontext *ctx, GLint target, const GLfloat *v) +{ + CALL_VertexAttrib1fvNV(ctx->Exec, (target, v)); +} + +static void VertexAttrib2fvNV(GLcontext *ctx, GLint target, const GLfloat *v) +{ + CALL_VertexAttrib2fvNV(ctx->Exec, (target, v)); +} + +static void VertexAttrib3fvNV(GLcontext *ctx, GLint target, const GLfloat *v) +{ + CALL_VertexAttrib3fvNV(ctx->Exec, (target, v)); +} + +static void VertexAttrib4fvNV(GLcontext *ctx, GLint target, const GLfloat *v) +{ + CALL_VertexAttrib4fvNV(ctx->Exec, (target, v)); +} + +static attr_func vert_attrfunc[4] = { + VertexAttrib1fvNV, + VertexAttrib2fvNV, + VertexAttrib3fvNV, + VertexAttrib4fvNV +}; + + +static void VertexAttrib1fvARB(GLcontext *ctx, GLint target, const GLfloat *v) +{ + CALL_VertexAttrib1fvARB(ctx->Exec, (target, v)); +} + +static void VertexAttrib2fvARB(GLcontext *ctx, GLint target, const GLfloat *v) +{ + CALL_VertexAttrib2fvARB(ctx->Exec, (target, v)); +} + +static void VertexAttrib3fvARB(GLcontext *ctx, GLint target, const GLfloat *v) +{ + CALL_VertexAttrib3fvARB(ctx->Exec, (target, v)); +} + +static void VertexAttrib4fvARB(GLcontext *ctx, GLint target, const GLfloat *v) +{ + CALL_VertexAttrib4fvARB(ctx->Exec, (target, v)); +} + +static attr_func vert_attrfunc_arb[4] = { + VertexAttrib1fvARB, + VertexAttrib2fvARB, + VertexAttrib3fvARB, + VertexAttrib4fvARB +}; + + + + + + + +static void mat_attr1fv( GLcontext *ctx, GLint target, const GLfloat *v ) +{ + switch (target) { + case _TNL_ATTRIB_MAT_FRONT_SHININESS: + CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_SHININESS, v )); + break; + case _TNL_ATTRIB_MAT_BACK_SHININESS: + CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_SHININESS, v )); + break; + } +} + + +static void mat_attr3fv( GLcontext *ctx, GLint target, const GLfloat *v ) +{ + switch (target) { + case _TNL_ATTRIB_MAT_FRONT_INDEXES: + CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_COLOR_INDEXES, v )); + break; + case _TNL_ATTRIB_MAT_BACK_INDEXES: + CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_COLOR_INDEXES, v )); + break; + } +} + + +static void mat_attr4fv( GLcontext *ctx, GLint target, const GLfloat *v ) +{ + switch (target) { + case _TNL_ATTRIB_MAT_FRONT_EMISSION: + CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_EMISSION, v )); + break; + case _TNL_ATTRIB_MAT_BACK_EMISSION: + CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_EMISSION, v )); + break; + case _TNL_ATTRIB_MAT_FRONT_AMBIENT: + CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_AMBIENT, v )); + break; + case _TNL_ATTRIB_MAT_BACK_AMBIENT: + CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_AMBIENT, v )); + break; + case _TNL_ATTRIB_MAT_FRONT_DIFFUSE: + CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_DIFFUSE, v )); + break; + case _TNL_ATTRIB_MAT_BACK_DIFFUSE: + CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_DIFFUSE, v )); + break; + case _TNL_ATTRIB_MAT_FRONT_SPECULAR: + CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_SPECULAR, v )); + break; + case _TNL_ATTRIB_MAT_BACK_SPECULAR: + CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_SPECULAR, v )); + break; + } +} + + +static attr_func mat_attrfunc[4] = { + mat_attr1fv, + NULL, + mat_attr3fv, + mat_attr4fv +}; + + +static void index_attr1fv(GLcontext *ctx, GLint target, const GLfloat *v) +{ + (void) target; + CALL_Indexf(ctx->Exec, (v[0])); +} + +static void edgeflag_attr1fv(GLcontext *ctx, GLint target, const GLfloat *v) +{ + (void) target; + CALL_EdgeFlag(ctx->Exec, ((GLboolean)(v[0] == 1.0))); +} + +struct loopback_attr { + GLint target; + GLint sz; + attr_func func; +}; + +/* Don't emit ends and begins on wrapped primitives. Don't replay + * wrapped vertices. If we get here, it's probably because the the + * precalculated wrapping is wrong. + */ +static void loopback_prim( GLcontext *ctx, + const struct tnl_vertex_list *list, GLuint i, + const struct loopback_attr *la, GLuint nr ) +{ + struct tnl_prim *prim = &list->prim[i]; + GLint begin = prim->start; + GLint end = begin + prim->count; + GLfloat *data; + GLint j; + GLuint k; + + if (prim->mode & PRIM_BEGIN) { + CALL_Begin(GET_DISPATCH(), ( prim->mode & PRIM_MODE_MASK )); + } + else { + assert(i == 0); + assert(begin == 0); + begin += list->wrap_count; + } + + data = list->buffer + begin * list->vertex_size; + + for (j = begin ; j < end ; j++) { + GLfloat *tmp = data + la[0].sz; + + for (k = 1 ; k < nr ; k++) { + la[k].func( ctx, la[k].target, tmp ); + tmp += la[k].sz; + } + + /* Fire the vertex + */ + la[0].func( ctx, VERT_ATTRIB_POS, data ); + data = tmp; + } + + if (prim->mode & PRIM_END) { + CALL_End(GET_DISPATCH(), ()); + } + else { + assert (i == list->prim_count-1); + } +} + +/* Primitives generated by DrawArrays/DrawElements/Rectf may be + * caught here. If there is no primitive in progress, execute them + * normally, otherwise need to track and discard the generated + * primitives. + */ +static void loopback_weak_prim( GLcontext *ctx, + const struct tnl_vertex_list *list, GLuint i, + const struct loopback_attr *la, GLuint nr ) +{ + if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) + loopback_prim( ctx, list, i, la, nr ); + else { + struct tnl_prim *prim = &list->prim[i]; + + /* Use the prim_weak flag to ensure that if this primitive + * wraps, we don't mistake future vertex_lists for part of the + * surrounding primitive. + * + * While this flag is set, we are simply disposing of data + * generated by an operation now known to be a noop. + */ + if (prim->mode & PRIM_BEGIN) + ctx->Driver.CurrentExecPrimitive |= PRIM_WEAK; + if (prim->mode & PRIM_END) + ctx->Driver.CurrentExecPrimitive &= ~PRIM_WEAK; + } +} + + + +void _tnl_loopback_vertex_list( GLcontext *ctx, + const struct tnl_vertex_list *list ) +{ + struct loopback_attr la[_TNL_ATTRIB_MAX]; + GLuint i, nr = 0; + + for (i = 0 ; i <= _TNL_ATTRIB_TEX7 ; i++) { + if (list->attrsz[i]) { + la[nr].target = i; + la[nr].sz = list->attrsz[i]; + la[nr].func = vert_attrfunc[list->attrsz[i]-1]; + nr++; + } + } + + for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT ; + i <= _TNL_ATTRIB_MAT_BACK_INDEXES ; + i++) { + if (list->attrsz[i]) { + la[nr].target = i; + la[nr].sz = list->attrsz[i]; + la[nr].func = mat_attrfunc[list->attrsz[i]-1]; + nr++; + } + } + + if (list->attrsz[_TNL_ATTRIB_EDGEFLAG]) { + la[nr].target = _TNL_ATTRIB_EDGEFLAG; + la[nr].sz = list->attrsz[_TNL_ATTRIB_EDGEFLAG]; + la[nr].func = edgeflag_attr1fv; + nr++; + } + + if (list->attrsz[_TNL_ATTRIB_INDEX]) { + la[nr].target = _TNL_ATTRIB_INDEX; + la[nr].sz = list->attrsz[_TNL_ATTRIB_INDEX]; + la[nr].func = index_attr1fv; + nr++; + } + + /* XXX ARB vertex attribs */ + + for (i = 0 ; i < list->prim_count ; i++) { + if (list->prim[i].mode & PRIM_WEAK) + loopback_weak_prim( ctx, list, i, la, nr ); + else + loopback_prim( ctx, list, i, la, nr ); + } +} diff --git a/reactos/dll/mesa32/src/tnl/t_save_playback.c b/reactos/dll/mesa32/src/tnl/t_save_playback.c new file mode 100644 index 00000000000..995964c9614 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_save_playback.c @@ -0,0 +1,215 @@ +/* + * 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. + */ + +/* Author: + * Keith Whitwell + */ + +#include "glheader.h" +#include "context.h" +#include "imports.h" +#include "mtypes.h" +#include "macros.h" +#include "light.h" +#include "state.h" +#include "t_pipeline.h" +#include "t_save_api.h" +#include "t_vtx_api.h" + +static INLINE GLint get_size( const GLfloat *f ) +{ + if (f[3] != 1.0) return 4; + if (f[2] != 0.0) return 3; + return 2; +} + + +/* Some nasty stuff still hanging on here. + * + * TODO - remove VB->ColorPtr, etc and just use the AttrPtr's. + */ +static void _tnl_bind_vertex_list( GLcontext *ctx, + const struct tnl_vertex_list *node ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + struct tnl_vertex_arrays *tmp = &tnl->save_inputs; + GLfloat *data = node->buffer; + GLuint attr, i; + + /* Setup constant data in the VB. + */ + VB->Count = node->count; + VB->Primitive = node->prim; + VB->PrimitiveCount = node->prim_count; + VB->Elts = NULL; + VB->NormalLengthPtr = node->normal_lengths; + + for (attr = 0; attr <= _TNL_ATTRIB_INDEX; attr++) { + if (node->attrsz[attr]) { + tmp->Attribs[attr].count = node->count; + tmp->Attribs[attr].data = (GLfloat (*)[4]) data; + tmp->Attribs[attr].start = data; + tmp->Attribs[attr].size = node->attrsz[attr]; + tmp->Attribs[attr].stride = node->vertex_size * sizeof(GLfloat); + VB->AttribPtr[attr] = &tmp->Attribs[attr]; + data += node->attrsz[attr]; + } + else { + tmp->Attribs[attr].count = 1; + tmp->Attribs[attr].data = (GLfloat (*)[4]) tnl->vtx.current[attr]; + tmp->Attribs[attr].start = tnl->vtx.current[attr]; + tmp->Attribs[attr].size = get_size( tnl->vtx.current[attr] ); + tmp->Attribs[attr].stride = 0; + VB->AttribPtr[attr] = &tmp->Attribs[attr]; + } + } + + + /* Copy edgeflag to a contiguous array + */ + if (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) { + if (node->attrsz[_TNL_ATTRIB_EDGEFLAG]) { + VB->EdgeFlag = _tnl_translate_edgeflag( ctx, data, + node->count, + node->vertex_size ); + data++; + } + else + VB->EdgeFlag = _tnl_import_current_edgeflag( ctx, node->count ); + } + + /* Legacy pointers -- remove one day. + */ + VB->ObjPtr = VB->AttribPtr[_TNL_ATTRIB_POS]; + VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; + VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0]; + VB->ColorPtr[1] = NULL; + VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX]; + VB->IndexPtr[1] = NULL; + VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1]; + VB->SecondaryColorPtr[1] = NULL; + VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG]; + + for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { + VB->TexCoordPtr[i] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]; + } +} + +static void _playback_copy_to_current( GLcontext *ctx, + const struct tnl_vertex_list *node ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + const GLfloat *data; + GLuint i; + + if (node->count) + data = node->buffer + (node->count-1) * node->vertex_size; + else + data = node->buffer; + + for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_INDEX ; i++) { + if (node->attrsz[i]) { + COPY_CLEAN_4V(tnl->vtx.current[i], node->attrsz[i], data); + data += node->attrsz[i]; + } + } + + /* Edgeflag requires special treatment: + */ + if (node->attrsz[_TNL_ATTRIB_EDGEFLAG]) { + ctx->Current.EdgeFlag = (data[0] == 1.0); + } + + /* Colormaterial -- this kindof sucks. + */ + if (ctx->Light.ColorMaterialEnabled) { + _mesa_update_color_material(ctx, ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); + } + + if (node->have_materials) { + tnl->Driver.NotifyMaterialChange( ctx ); + } + + /* CurrentExecPrimitive + */ + if (node->prim_count) { + GLenum mode = node->prim[node->prim_count - 1].mode; + if (mode & PRIM_END) + ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; + else + ctx->Driver.CurrentExecPrimitive = (mode & PRIM_MODE_MASK); + } +} + + +/** + * Execute the buffer and save copied verts. + */ +void _tnl_playback_vertex_list( GLcontext *ctx, void *data ) +{ + const struct tnl_vertex_list *node = (const struct tnl_vertex_list *) data; + TNLcontext *tnl = TNL_CONTEXT(ctx); + + FLUSH_CURRENT(ctx, 0); + + if (node->prim_count > 0 && node->count > 0) { + + if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END && + (node->prim[0].mode & PRIM_BEGIN)) { + + /* Degenerate case: list is called inside begin/end pair and + * includes operations such as glBegin or glDrawArrays. + */ + _mesa_error( ctx, GL_INVALID_OPERATION, "displaylist recursive begin"); + _tnl_loopback_vertex_list( ctx, node ); + return; + } + else if (tnl->save.replay_flags) { + /* Various degnerate cases: translate into immediate mode + * calls rather than trying to execute in place. + */ + _tnl_loopback_vertex_list( ctx, node ); + return; + } + + if (ctx->NewState) + _mesa_update_state( ctx ); + + if ((ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) || + (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBegin (invalid vertex/fragment program)"); + return; + } + + _tnl_bind_vertex_list( ctx, node ); + + tnl->Driver.RunPipeline( ctx ); + } + + /* Copy to current? + */ + _playback_copy_to_current( ctx, node ); +} diff --git a/reactos/dll/mesa32/src/tnl/t_vb_arbprogram.c b/reactos/dll/mesa32/src/tnl/t_vb_arbprogram.c new file mode 100644 index 00000000000..5cee3d78dc3 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_arbprogram.c @@ -0,0 +1,1461 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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 t_arb_program.c + * Compile vertex programs to an intermediate representation. + * Execute vertex programs over a buffer of vertices. + * \author Keith Whitwell, Brian Paul + */ + +#include "glheader.h" +#include "context.h" +#include "imports.h" +#include "macros.h" +#include "mtypes.h" +#include "arbprogparse.h" +#include "light.h" +#include "program.h" +#include "math/m_matrix.h" +#include "math/m_translate.h" +#include "t_context.h" +#include "t_pipeline.h" +#include "t_vb_arbprogram.h" + +#define DISASSEM 0 + +/*--------------------------------------------------------------------------- */ + +struct opcode_info { + GLuint nr_args; + const char *string; + void (*print)( union instruction , const struct opcode_info * ); +}; + +struct compilation { + GLuint reg_active; + union instruction *csr; +}; + + +#define ARB_VP_MACHINE(stage) ((struct arb_vp_machine *)(stage->privatePtr)) + +#define PUFF(x) ((x)[1] = (x)[2] = (x)[3] = (x)[0]) + + + +/* Lower precision functions for the EXP, LOG and LIT opcodes. The + * LOG2() implementation is probably not accurate enough, and the + * attempted optimization for Exp2 is definitely not accurate + * enough - it discards all of t's fractional bits! + */ +static GLfloat RoughApproxLog2(GLfloat t) +{ + return LOG2(t); +} + +static GLfloat RoughApproxExp2(GLfloat t) +{ +#if 0 + fi_type fi; + fi.i = (GLint) t; + fi.i = (fi.i << 23) + 0x3f800000; + return fi.f; +#else + return (GLfloat) _mesa_pow(2.0, t); +#endif +} + +static GLfloat RoughApproxPower(GLfloat x, GLfloat y) +{ + return RoughApproxExp2(y * RoughApproxLog2(x)); +} + + +/* Higher precision functions for the EX2, LG2 and POW opcodes: + */ +static GLfloat ApproxLog2(GLfloat t) +{ + return (GLfloat) (log(t) * 1.442695F); +} + +static GLfloat ApproxExp2(GLfloat t) +{ + return (GLfloat) _mesa_pow(2.0, t); +} + +static GLfloat ApproxPower(GLfloat x, GLfloat y) +{ + return (GLfloat) _mesa_pow(x, y); +} + +static GLfloat rough_approx_log2_0_1(GLfloat x) +{ + return LOG2(x); +} + + + + +/** + * Perform a reduced swizzle: + */ +static void do_RSW( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.rsw.dst]; + const GLfloat *arg0 = m->File[op.rsw.file0][op.rsw.idx0]; + GLuint swz = op.rsw.swz; + GLuint neg = op.rsw.neg; + + result[0] = arg0[GET_RSW(swz, 0)]; + result[1] = arg0[GET_RSW(swz, 1)]; + result[2] = arg0[GET_RSW(swz, 2)]; + result[3] = arg0[GET_RSW(swz, 3)]; + + if (neg) { + if (neg & 0x1) result[0] = -result[0]; + if (neg & 0x2) result[1] = -result[1]; + if (neg & 0x4) result[2] = -result[2]; + if (neg & 0x8) result[3] = -result[3]; + } +} + +/* Used to implement write masking. To make things easier for the sse + * generator I've gone back to a 1 argument version of this function + * (dst.msk = arg), rather than the semantically cleaner (dst = SEL + * arg0, arg1, msk) + * + * That means this is the only instruction which doesn't write a full + * 4 dwords out. This would make such a program harder to analyse, + * but it looks like analysis is going to take place on a higher level + * anyway. + */ +static void do_MSK( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *dst = m->File[0][op.msk.dst]; + const GLfloat *arg = m->File[op.msk.file][op.msk.idx]; + + if (op.msk.mask & 0x1) dst[0] = arg[0]; + if (op.msk.mask & 0x2) dst[1] = arg[1]; + if (op.msk.mask & 0x4) dst[2] = arg[2]; + if (op.msk.mask & 0x8) dst[3] = arg[3]; +} + + +static void do_PRT( struct arb_vp_machine *m, union instruction op ) +{ + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + + _mesa_printf("%d: %f %f %f %f\n", m->vtx_nr, + arg0[0], arg0[1], arg0[2], arg0[3]); +} + + +/** + * The traditional ALU and texturing instructions. All operate on + * internal registers and ignore write masks and swizzling issues. + */ + +static void do_ABS( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + + result[0] = (arg0[0] < 0.0) ? -arg0[0] : arg0[0]; + result[1] = (arg0[1] < 0.0) ? -arg0[1] : arg0[1]; + result[2] = (arg0[2] < 0.0) ? -arg0[2] : arg0[2]; + result[3] = (arg0[3] < 0.0) ? -arg0[3] : arg0[3]; +} + +static void do_ADD( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; + + result[0] = arg0[0] + arg1[0]; + result[1] = arg0[1] + arg1[1]; + result[2] = arg0[2] + arg1[2]; + result[3] = arg0[3] + arg1[3]; +} + + +static void do_DP3( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; + + result[0] = (arg0[0] * arg1[0] + + arg0[1] * arg1[1] + + arg0[2] * arg1[2]); + + PUFF(result); +} + + + +static void do_DP4( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; + + result[0] = (arg0[0] * arg1[0] + + arg0[1] * arg1[1] + + arg0[2] * arg1[2] + + arg0[3] * arg1[3]); + + PUFF(result); +} + +static void do_DPH( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; + + result[0] = (arg0[0] * arg1[0] + + arg0[1] * arg1[1] + + arg0[2] * arg1[2] + + 1.0 * arg1[3]); + + PUFF(result); +} + +static void do_DST( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; + + result[0] = 1.0F; + result[1] = arg0[1] * arg1[1]; + result[2] = arg0[2]; + result[3] = arg1[3]; +} + + +/* Intended to be high precision: + */ +static void do_EX2( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + + result[0] = (GLfloat)ApproxExp2(arg0[0]); + PUFF(result); +} + + +/* Allowed to be lower precision: + */ +static void do_EXP( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + GLfloat tmp = arg0[0]; + GLfloat flr_tmp = FLOORF(tmp); + GLfloat frac_tmp = tmp - flr_tmp; + + result[0] = LDEXPF(1.0, (int)flr_tmp); + result[1] = frac_tmp; + result[2] = LDEXPF(rough_approx_log2_0_1(frac_tmp), (int)flr_tmp); + result[3] = 1.0F; +} + +static void do_FLR( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + + result[0] = FLOORF(arg0[0]); + result[1] = FLOORF(arg0[1]); + result[2] = FLOORF(arg0[2]); + result[3] = FLOORF(arg0[3]); +} + +static void do_FRC( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + + result[0] = arg0[0] - FLOORF(arg0[0]); + result[1] = arg0[1] - FLOORF(arg0[1]); + result[2] = arg0[2] - FLOORF(arg0[2]); + result[3] = arg0[3] - FLOORF(arg0[3]); +} + +/* High precision log base 2: + */ +static void do_LG2( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + + result[0] = ApproxLog2(arg0[0]); + PUFF(result); +} + + + +static void do_LIT( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + GLfloat tmp[4]; + + tmp[0] = 1.0; + tmp[1] = 0.0; + tmp[2] = 0.0; + tmp[3] = 1.0; + + if (arg0[0] > 0.0) { + tmp[1] = arg0[0]; + + if (arg0[1] > 0.0) { + tmp[2] = RoughApproxPower(arg0[1], arg0[3]); + } + } + + COPY_4V(result, tmp); +} + + +/* Intended to allow a lower precision than required for LG2 above. + */ +static void do_LOG( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + GLfloat tmp = FABSF(arg0[0]); + int exponent; + GLfloat mantissa = FREXPF(tmp, &exponent); + + result[0] = (GLfloat) (exponent - 1); + result[1] = 2.0 * mantissa; /* map [.5, 1) -> [1, 2) */ + result[2] = exponent + LOG2(mantissa); + result[3] = 1.0; +} + +static void do_MAX( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; + + result[0] = (arg0[0] > arg1[0]) ? arg0[0] : arg1[0]; + result[1] = (arg0[1] > arg1[1]) ? arg0[1] : arg1[1]; + result[2] = (arg0[2] > arg1[2]) ? arg0[2] : arg1[2]; + result[3] = (arg0[3] > arg1[3]) ? arg0[3] : arg1[3]; +} + + +static void do_MIN( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; + + result[0] = (arg0[0] < arg1[0]) ? arg0[0] : arg1[0]; + result[1] = (arg0[1] < arg1[1]) ? arg0[1] : arg1[1]; + result[2] = (arg0[2] < arg1[2]) ? arg0[2] : arg1[2]; + result[3] = (arg0[3] < arg1[3]) ? arg0[3] : arg1[3]; +} + +static void do_MOV( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + + result[0] = arg0[0]; + result[1] = arg0[1]; + result[2] = arg0[2]; + result[3] = arg0[3]; +} + +static void do_MUL( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; + + result[0] = arg0[0] * arg1[0]; + result[1] = arg0[1] * arg1[1]; + result[2] = arg0[2] * arg1[2]; + result[3] = arg0[3] * arg1[3]; +} + + +/* Intended to be "high" precision + */ +static void do_POW( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; + + result[0] = (GLfloat)ApproxPower(arg0[0], arg1[0]); + PUFF(result); +} + +static void do_REL( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + GLuint idx = (op.alu.idx0 + (GLint)m->File[0][REG_ADDR][0]) & (MAX_NV_VERTEX_PROGRAM_PARAMS-1); + const GLfloat *arg0 = m->File[op.alu.file0][idx]; + + result[0] = arg0[0]; + result[1] = arg0[1]; + result[2] = arg0[2]; + result[3] = arg0[3]; +} + +static void do_RCP( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + + result[0] = 1.0F / arg0[0]; + PUFF(result); +} + +static void do_RSQ( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + + result[0] = INV_SQRTF(FABSF(arg0[0])); + PUFF(result); +} + + +static void do_SGE( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; + + result[0] = (arg0[0] >= arg1[0]) ? 1.0F : 0.0F; + result[1] = (arg0[1] >= arg1[1]) ? 1.0F : 0.0F; + result[2] = (arg0[2] >= arg1[2]) ? 1.0F : 0.0F; + result[3] = (arg0[3] >= arg1[3]) ? 1.0F : 0.0F; +} + + +static void do_SLT( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; + + result[0] = (arg0[0] < arg1[0]) ? 1.0F : 0.0F; + result[1] = (arg0[1] < arg1[1]) ? 1.0F : 0.0F; + result[2] = (arg0[2] < arg1[2]) ? 1.0F : 0.0F; + result[3] = (arg0[3] < arg1[3]) ? 1.0F : 0.0F; +} + +static void do_SUB( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; + + result[0] = arg0[0] - arg1[0]; + result[1] = arg0[1] - arg1[1]; + result[2] = arg0[2] - arg1[2]; + result[3] = arg0[3] - arg1[3]; +} + + +static void do_XPD( struct arb_vp_machine *m, union instruction op ) +{ + GLfloat *result = m->File[0][op.alu.dst]; + const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; + const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; + + result[0] = arg0[1] * arg1[2] - arg0[2] * arg1[1]; + result[1] = arg0[2] * arg1[0] - arg0[0] * arg1[2]; + result[2] = arg0[0] * arg1[1] - arg0[1] * arg1[0]; +} + +static void do_NOP( struct arb_vp_machine *m, union instruction op ) +{ +} + +/* Some useful debugging functions: + */ +static void print_mask( GLuint mask ) +{ + _mesa_printf("."); + if (mask&0x1) _mesa_printf("x"); + if (mask&0x2) _mesa_printf("y"); + if (mask&0x4) _mesa_printf("z"); + if (mask&0x8) _mesa_printf("w"); +} + +static void print_reg( GLuint file, GLuint reg ) +{ + static const char *reg_file[] = { + "REG", + "LOCAL_PARAM", + "ENV_PARAM", + "STATE_VAR", + }; + + if (file == 0) { + if (reg == REG_RES) + _mesa_printf("RES"); + else if (reg >= REG_ARG0 && reg <= REG_ARG1) + _mesa_printf("ARG%d", reg - REG_ARG0); + else if (reg >= REG_TMP0 && reg <= REG_TMP11) + _mesa_printf("TMP%d", reg - REG_TMP0); + else if (reg >= REG_IN0 && reg <= REG_IN31) + _mesa_printf("IN%d", reg - REG_IN0); + else if (reg >= REG_OUT0 && reg <= REG_OUT14) + _mesa_printf("OUT%d", reg - REG_OUT0); + else if (reg == REG_ADDR) + _mesa_printf("ADDR"); + else if (reg == REG_ID) + _mesa_printf("ID"); + else + _mesa_printf("REG%d", reg); + } + else + _mesa_printf("%s:%d", reg_file[file], reg); +} + + +static void print_RSW( union instruction op, const struct opcode_info *info ) +{ + GLuint swz = op.rsw.swz; + GLuint neg = op.rsw.neg; + GLuint i; + + _mesa_printf("%s ", info->string); + print_reg(0, op.rsw.dst); + _mesa_printf(", "); + print_reg(op.rsw.file0, op.rsw.idx0); + _mesa_printf("."); + for (i = 0; i < 4; i++, swz >>= 2) { + const char *cswz = "xyzw"; + if (neg & (1<string); + print_reg(0, op.alu.dst); + _mesa_printf(", "); + print_reg(op.alu.file0, op.alu.idx0); + if (info->nr_args > 1) { + _mesa_printf(", "); + print_reg(op.alu.file1, op.alu.idx1); + } + _mesa_printf("\n"); +} + +static void print_MSK( union instruction op, const struct opcode_info *info ) +{ + _mesa_printf("%s ", info->string); + print_reg(0, op.msk.dst); + print_mask(op.msk.mask); + _mesa_printf(", "); + print_reg(op.msk.file, op.msk.idx); + _mesa_printf("\n"); +} + + +static void print_NOP( union instruction op, const struct opcode_info *info ) +{ +} + +#define NOP 0 +#define ALU 1 +#define SWZ 2 + +static const struct opcode_info opcode_info[] = +{ + { 1, "ABS", print_ALU }, + { 2, "ADD", print_ALU }, + { 1, "ARL", print_NOP }, + { 2, "DP3", print_ALU }, + { 2, "DP4", print_ALU }, + { 2, "DPH", print_ALU }, + { 2, "DST", print_ALU }, + { 0, "END", print_NOP }, + { 1, "EX2", print_ALU }, + { 1, "EXP", print_ALU }, + { 1, "FLR", print_ALU }, + { 1, "FRC", print_ALU }, + { 1, "LG2", print_ALU }, + { 1, "LIT", print_ALU }, + { 1, "LOG", print_ALU }, + { 3, "MAD", print_NOP }, + { 2, "MAX", print_ALU }, + { 2, "MIN", print_ALU }, + { 1, "MOV", print_ALU }, + { 2, "MUL", print_ALU }, + { 2, "POW", print_ALU }, + { 1, "PRT", print_ALU }, /* PRINT */ + { 1, "RCC", print_NOP }, + { 1, "RCP", print_ALU }, + { 1, "RSQ", print_ALU }, + { 2, "SGE", print_ALU }, + { 2, "SLT", print_ALU }, + { 2, "SUB", print_ALU }, + { 1, "SWZ", print_NOP }, + { 2, "XPD", print_ALU }, + { 1, "RSW", print_RSW }, + { 2, "MSK", print_MSK }, + { 1, "REL", print_ALU }, +}; + +void _tnl_disassem_vba_insn( union instruction op ) +{ + const struct opcode_info *info = &opcode_info[op.alu.opcode]; + info->print( op, info ); +} + + +static void (* const opcode_func[])(struct arb_vp_machine *, union instruction) = +{ + do_ABS, + do_ADD, + do_NOP, + do_DP3, + do_DP4, + do_DPH, + do_DST, + do_NOP, + do_EX2, + do_EXP, + do_FLR, + do_FRC, + do_LG2, + do_LIT, + do_LOG, + do_NOP, + do_MAX, + do_MIN, + do_MOV, + do_MUL, + do_POW, + do_PRT, + do_NOP, + do_RCP, + do_RSQ, + do_SGE, + do_SLT, + do_SUB, + do_RSW, + do_XPD, + do_RSW, + do_MSK, + do_REL, +}; + +static union instruction *cvp_next_instruction( struct compilation *cp ) +{ + union instruction *op = cp->csr++; + op->dword = 0; + return op; +} + +static struct reg cvp_make_reg( GLuint file, GLuint idx ) +{ + struct reg reg; + reg.file = file; + reg.idx = idx; + return reg; +} + +static struct reg cvp_emit_rel( struct compilation *cp, + struct reg reg, + struct reg tmpreg ) +{ + union instruction *op = cvp_next_instruction(cp); + op->alu.opcode = REL; + op->alu.file0 = reg.file; + op->alu.idx0 = reg.idx; + op->alu.dst = tmpreg.idx; + return tmpreg; +} + + +static struct reg cvp_load_reg( struct compilation *cp, + GLuint file, + GLuint index, + GLuint rel, + GLuint tmpidx ) +{ + struct reg tmpreg = cvp_make_reg(FILE_REG, tmpidx); + struct reg reg; + + switch (file) { + case PROGRAM_TEMPORARY: + return cvp_make_reg(FILE_REG, REG_TMP0 + index); + + case PROGRAM_INPUT: + return cvp_make_reg(FILE_REG, REG_IN0 + index); + + case PROGRAM_OUTPUT: + return cvp_make_reg(FILE_REG, REG_OUT0 + index); + + /* These two aren't populated by the parser? + */ + case PROGRAM_LOCAL_PARAM: + reg = cvp_make_reg(FILE_LOCAL_PARAM, index); + if (rel) + return cvp_emit_rel(cp, reg, tmpreg); + else + return reg; + + case PROGRAM_ENV_PARAM: + reg = cvp_make_reg(FILE_ENV_PARAM, index); + if (rel) + return cvp_emit_rel(cp, reg, tmpreg); + else + return reg; + + case PROGRAM_STATE_VAR: + reg = cvp_make_reg(FILE_STATE_PARAM, index); + if (rel) + return cvp_emit_rel(cp, reg, tmpreg); + else + return reg; + + /* Invalid values: + */ + case PROGRAM_WRITE_ONLY: + case PROGRAM_ADDRESS: + default: + assert(0); + return tmpreg; /* can't happen */ + } +} + +static struct reg cvp_emit_arg( struct compilation *cp, + const struct vp_src_register *src, + GLuint arg ) +{ + struct reg reg = cvp_load_reg( cp, src->File, src->Index, src->RelAddr, arg ); + union instruction rsw, noop; + + /* Emit any necessary swizzling. + */ + rsw.dword = 0; + rsw.rsw.neg = src->Negate ? WRITEMASK_XYZW : 0; + rsw.rsw.swz = ((GET_SWZ(src->Swizzle, 0) << 0) | + (GET_SWZ(src->Swizzle, 1) << 2) | + (GET_SWZ(src->Swizzle, 2) << 4) | + (GET_SWZ(src->Swizzle, 3) << 6)); + + noop.dword = 0; + noop.rsw.neg = 0; + noop.rsw.swz = RSW_NOOP; + + if (rsw.dword != noop.dword) { + union instruction *op = cvp_next_instruction(cp); + struct reg rsw_reg = cvp_make_reg(FILE_REG, REG_ARG0 + arg); + op->dword = rsw.dword; + op->rsw.opcode = RSW; + op->rsw.file0 = reg.file; + op->rsw.idx0 = reg.idx; + op->rsw.dst = rsw_reg.idx; + return rsw_reg; + } + else + return reg; +} + +static GLuint cvp_choose_result( struct compilation *cp, + const struct vp_dst_register *dst, + union instruction *fixup ) +{ + GLuint mask = dst->WriteMask; + GLuint idx; + + switch (dst->File) { + case PROGRAM_TEMPORARY: + idx = REG_TMP0 + dst->Index; + break; + case PROGRAM_OUTPUT: + idx = REG_OUT0 + dst->Index; + break; + default: + assert(0); + return REG_RES; /* can't happen */ + } + + /* Optimization: When writing (with a writemask) to an undefined + * value for the first time, the writemask may be ignored. + */ + if (mask != WRITEMASK_XYZW && (cp->reg_active & (1 << idx))) { + fixup->msk.opcode = MSK; + fixup->msk.dst = idx; + fixup->msk.file = FILE_REG; + fixup->msk.idx = REG_RES; + fixup->msk.mask = mask; + cp->reg_active |= 1 << idx; + return REG_RES; + } + else { + fixup->dword = 0; + cp->reg_active |= 1 << idx; + return idx; + } +} + +static struct reg cvp_emit_rsw( struct compilation *cp, + GLuint dst, + struct reg src, + GLuint neg, + GLuint swz, + GLboolean force) +{ + struct reg retval; + + if (swz != RSW_NOOP || neg != 0) { + union instruction *op = cvp_next_instruction(cp); + op->rsw.opcode = RSW; + op->rsw.dst = dst; + op->rsw.file0 = src.file; + op->rsw.idx0 = src.idx; + op->rsw.neg = neg; + op->rsw.swz = swz; + + retval.file = FILE_REG; + retval.idx = dst; + return retval; + } + else if (force) { + /* Oops. Degenerate case: + */ + union instruction *op = cvp_next_instruction(cp); + op->alu.opcode = VP_OPCODE_MOV; + op->alu.dst = dst; + op->alu.file0 = src.file; + op->alu.idx0 = src.idx; + + retval.file = FILE_REG; + retval.idx = dst; + return retval; + } + else { + return src; + } +} + + +static void cvp_emit_inst( struct compilation *cp, + const struct vp_instruction *inst ) +{ + const struct opcode_info *info = &opcode_info[inst->Opcode]; + union instruction *op; + union instruction fixup; + struct reg reg[3]; + GLuint result, i; + + assert(sizeof(*op) == sizeof(GLuint)); + + /* Need to handle SWZ, ARL specially. + */ + switch (inst->Opcode) { + /* Split into mul and add: + */ + case VP_OPCODE_MAD: + result = cvp_choose_result( cp, &inst->DstReg, &fixup ); + for (i = 0; i < 3; i++) + reg[i] = cvp_emit_arg( cp, &inst->SrcReg[i], REG_ARG0+i ); + + op = cvp_next_instruction(cp); + op->alu.opcode = VP_OPCODE_MUL; + op->alu.file0 = reg[0].file; + op->alu.idx0 = reg[0].idx; + op->alu.file1 = reg[1].file; + op->alu.idx1 = reg[1].idx; + op->alu.dst = REG_ARG0; + + op = cvp_next_instruction(cp); + op->alu.opcode = VP_OPCODE_ADD; + op->alu.file0 = FILE_REG; + op->alu.idx0 = REG_ARG0; + op->alu.file1 = reg[2].file; + op->alu.idx1 = reg[2].idx; + op->alu.dst = result; + + if (result == REG_RES) { + op = cvp_next_instruction(cp); + op->dword = fixup.dword; + } + break; + + case VP_OPCODE_ARL: + reg[0] = cvp_emit_arg( cp, &inst->SrcReg[0], REG_ARG0 ); + + op = cvp_next_instruction(cp); + op->alu.opcode = VP_OPCODE_FLR; + op->alu.dst = REG_ADDR; + op->alu.file0 = reg[0].file; + op->alu.idx0 = reg[0].idx; + break; + + case VP_OPCODE_SWZ: { + GLuint swz0 = 0, swz1 = 0; + GLuint neg0 = 0, neg1 = 0; + GLuint mask = 0; + + /* Translate 3-bit-per-element swizzle into two 2-bit swizzles, + * one from the source register the other from a constant + * {0,0,0,1}. + */ + for (i = 0; i < 4; i++) { + GLuint swzelt = GET_SWZ(inst->SrcReg[0].Swizzle, i); + if (swzelt >= SWIZZLE_ZERO) { + neg0 |= inst->SrcReg[0].Negate & (1<SrcReg[0].Negate & (1<DstReg, &fixup ); + reg[0].file = FILE_REG; + reg[0].idx = REG_ID; + reg[1] = cvp_emit_arg( cp, &inst->SrcReg[0], REG_ARG0 ); + + if (mask == WRITEMASK_XYZW) { + cvp_emit_rsw(cp, result, reg[0], neg0, swz0, GL_TRUE); + + } + else if (mask == 0) { + cvp_emit_rsw(cp, result, reg[1], neg1, swz1, GL_TRUE); + } + else { + cvp_emit_rsw(cp, result, reg[0], neg0, swz0, GL_TRUE); + reg[1] = cvp_emit_rsw(cp, REG_ARG0, reg[1], neg1, swz1, GL_FALSE); + + op = cvp_next_instruction(cp); + op->msk.opcode = MSK; + op->msk.dst = result; + op->msk.file = reg[1].file; + op->msk.idx = reg[1].idx; + op->msk.mask = mask; + } + + if (result == REG_RES) { + op = cvp_next_instruction(cp); + op->dword = fixup.dword; + } + break; + } + + case VP_OPCODE_END: + break; + + default: + result = cvp_choose_result( cp, &inst->DstReg, &fixup ); + for (i = 0; i < info->nr_args; i++) + reg[i] = cvp_emit_arg( cp, &inst->SrcReg[i], REG_ARG0 + i ); + + op = cvp_next_instruction(cp); + op->alu.opcode = inst->Opcode; + op->alu.file0 = reg[0].file; + op->alu.idx0 = reg[0].idx; + op->alu.file1 = reg[1].file; + op->alu.idx1 = reg[1].idx; + op->alu.dst = result; + + if (result == REG_RES) { + op = cvp_next_instruction(cp); + op->dword = fixup.dword; + } + break; + } +} + +static void free_tnl_data( struct vertex_program *program ) +{ + struct tnl_compiled_program *p = program->TnlData; + if (p->compiled_func) + _mesa_free((void *)p->compiled_func); + _mesa_free(p); + program->TnlData = NULL; +} + +static void compile_vertex_program( struct vertex_program *program, + GLboolean try_codegen ) +{ + struct compilation cp; + struct tnl_compiled_program *p = CALLOC_STRUCT(tnl_compiled_program); + GLuint i; + + if (program->TnlData) + free_tnl_data( program ); + + program->TnlData = p; + + /* Initialize cp. Note that ctx and VB aren't used in compilation + * so we don't have to worry about statechanges: + */ + memset(&cp, 0, sizeof(cp)); + cp.csr = p->instructions; + + /* Compile instructions: + */ + for (i = 0; i < program->Base.NumInstructions; i++) { + cvp_emit_inst(&cp, &program->Instructions[i]); + } + + /* Finish up: + */ + p->nr_instructions = cp.csr - p->instructions; + + /* Print/disassemble: + */ + if (DISASSEM) { + for (i = 0; i < p->nr_instructions; i++) { + _tnl_disassem_vba_insn(p->instructions[i]); + } + _mesa_printf("\n\n"); + } + +#ifdef USE_SSE_ASM + if (try_codegen) + _tnl_sse_codegen_vertex_program(p); +#endif + +} + + + + +/* ---------------------------------------------------------------------- + * Execution + */ +static void userclip( GLcontext *ctx, + GLvector4f *clip, + GLubyte *clipmask, + GLubyte *clipormask, + GLubyte *clipandmask ) +{ + GLuint p; + + for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { + GLuint nr, i; + const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + GLfloat *coord = (GLfloat *)clip->data; + GLuint stride = clip->stride; + GLuint count = clip->count; + + for (nr = 0, i = 0 ; i < count ; i++) { + GLfloat dp = (coord[0] * a + + coord[1] * b + + coord[2] * c + + coord[3] * d); + + if (dp < 0) { + nr++; + clipmask[i] |= CLIP_USER_BIT; + } + + STRIDE_F(coord, stride); + } + + if (nr > 0) { + *clipormask |= CLIP_USER_BIT; + if (nr == count) { + *clipandmask |= CLIP_USER_BIT; + return; + } + } + } + } +} + + +static GLboolean do_ndc_cliptest( struct arb_vp_machine *m ) +{ + GLcontext *ctx = m->ctx; + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = m->VB; + + /* Cliptest and perspective divide. Clip functions must clear + * the clipmask. + */ + m->ormask = 0; + m->andmask = CLIP_ALL_BITS; + + if (tnl->NeedNdcCoords) { + VB->NdcPtr = + _mesa_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, + &m->ndcCoords, + m->clipmask, + &m->ormask, + &m->andmask ); + } + else { + VB->NdcPtr = NULL; + _mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr, + NULL, + m->clipmask, + &m->ormask, + &m->andmask ); + } + + if (m->andmask) { + /* All vertices are outside the frustum */ + return GL_FALSE; + } + + /* Test userclip planes. This contributes to VB->ClipMask. + */ + if (ctx->Transform.ClipPlanesEnabled && !ctx->VertexProgram._Enabled) { + userclip( ctx, + VB->ClipPtr, + m->clipmask, + &m->ormask, + &m->andmask ); + + if (m->andmask) { + return GL_FALSE; + } + } + + VB->ClipAndMask = m->andmask; + VB->ClipOrMask = m->ormask; + VB->ClipMask = m->clipmask; + + return GL_TRUE; +} + + +static INLINE void call_func( struct tnl_compiled_program *p, + struct arb_vp_machine *m ) +{ + p->compiled_func(m); +} + +/** + * Execute the given vertex program. + * + * TODO: Integrate the t_vertex.c code here, to build machine vertices + * directly at this point. + * + * TODO: Eliminate the VB struct entirely and just use + * struct arb_vertex_machine. + */ +static GLboolean +run_arb_vertex_program(GLcontext *ctx, struct tnl_pipeline_stage *stage) +{ + struct vertex_program *program = (ctx->VertexProgram._Enabled ? + ctx->VertexProgram.Current : + ctx->_TnlProgram); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct arb_vp_machine *m = ARB_VP_MACHINE(stage); + struct tnl_compiled_program *p; + GLuint i, j, outputs; + + if (!program || program->IsNVProgram) + return GL_TRUE; + + if (program->Parameters) { + _mesa_load_state_parameters(ctx, program->Parameters); + } + + p = (struct tnl_compiled_program *)program->TnlData; + assert(p); + + + m->nr_inputs = m->nr_outputs = 0; + + for (i = 0; i < _TNL_ATTRIB_MAX; i++) { + if (program->InputsRead & (1<nr_inputs++; + m->input[j].idx = i; + m->input[j].data = (GLfloat *)m->VB->AttribPtr[i]->data; + m->input[j].stride = m->VB->AttribPtr[i]->stride; + m->input[j].size = m->VB->AttribPtr[i]->size; + ASSIGN_4V(m->File[0][REG_IN0 + i], 0, 0, 0, 1); + } + } + + for (i = 0; i < 15; i++) { + if (program->OutputsWritten & (1<nr_outputs++; + m->output[j].idx = i; + m->output[j].data = (GLfloat *)m->attribs[i].data; + } + } + + + /* Run the actual program: + */ + for (m->vtx_nr = 0; m->vtx_nr < VB->Count; m->vtx_nr++) { + for (j = 0; j < m->nr_inputs; j++) { + GLuint idx = REG_IN0 + m->input[j].idx; + switch (m->input[j].size) { + case 4: m->File[0][idx][3] = m->input[j].data[3]; + case 3: m->File[0][idx][2] = m->input[j].data[2]; + case 2: m->File[0][idx][1] = m->input[j].data[1]; + case 1: m->File[0][idx][0] = m->input[j].data[0]; + } + + STRIDE_F(m->input[j].data, m->input[j].stride); + } + + if (p->compiled_func) { + call_func( p, m ); + } + else { + for (j = 0; j < p->nr_instructions; j++) { + union instruction inst = p->instructions[j]; + opcode_func[inst.alu.opcode]( m, inst ); + } + } + + for (j = 0; j < m->nr_outputs; j++) { + GLuint idx = REG_OUT0 + m->output[j].idx; + m->output[j].data[0] = m->File[0][idx][0]; + m->output[j].data[1] = m->File[0][idx][1]; + m->output[j].data[2] = m->File[0][idx][2]; + m->output[j].data[3] = m->File[0][idx][3]; + m->output[j].data += 4; + } + } + + /* Setup the VB pointers so that the next pipeline stages get + * their data from the right place (the program output arrays). + * + * TODO: 1) Have tnl use these RESULT values for outputs rather + * than trying to shoe-horn inputs and outputs into one set of + * values. + * + * TODO: 2) Integrate t_vertex.c so that we just go straight ahead + * and build machine vertices here. + */ + VB->ClipPtr = &m->attribs[VERT_RESULT_HPOS]; + VB->ClipPtr->count = VB->Count; + + outputs = program->OutputsWritten; + + if (outputs & (1<ColorPtr[0] = &m->attribs[VERT_RESULT_COL0]; + VB->AttribPtr[VERT_ATTRIB_COLOR0] = VB->ColorPtr[0]; + } + + if (outputs & (1<ColorPtr[1] = &m->attribs[VERT_RESULT_BFC0]; + } + + if (outputs & (1<SecondaryColorPtr[0] = &m->attribs[VERT_RESULT_COL1]; + VB->AttribPtr[VERT_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0]; + } + + if (outputs & (1<SecondaryColorPtr[1] = &m->attribs[VERT_RESULT_BFC1]; + } + + if (outputs & (1<FogCoordPtr = &m->attribs[VERT_RESULT_FOGC]; + VB->AttribPtr[VERT_ATTRIB_FOG] = VB->FogCoordPtr; + } + + if (outputs & (1<PointSizePtr = &m->attribs[VERT_RESULT_PSIZ]; + VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &m->attribs[VERT_RESULT_PSIZ]; + } + + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { + if (outputs & (1<<(VERT_RESULT_TEX0+i))) { + VB->TexCoordPtr[i] = &m->attribs[VERT_RESULT_TEX0 + i]; + VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i]; + } + } + +#if 0 + for (i = 0; i < VB->Count; i++) { + printf("Out %d: %f %f %f %f %f %f %f %f\n", i, + VEC_ELT(VB->ClipPtr, GLfloat, i)[0], + VEC_ELT(VB->ClipPtr, GLfloat, i)[1], + VEC_ELT(VB->ClipPtr, GLfloat, i)[2], + VEC_ELT(VB->ClipPtr, GLfloat, i)[3], + VEC_ELT(VB->TexCoordPtr[0], GLfloat, i)[0], + VEC_ELT(VB->TexCoordPtr[0], GLfloat, i)[1], + VEC_ELT(VB->TexCoordPtr[0], GLfloat, i)[2], + VEC_ELT(VB->TexCoordPtr[0], GLfloat, i)[3]); + } +#endif + + /* Perform NDC and cliptest operations: + */ + return do_ndc_cliptest(m); +} + + +static void +validate_vertex_program( GLcontext *ctx, struct tnl_pipeline_stage *stage ) +{ + struct arb_vp_machine *m = ARB_VP_MACHINE(stage); + struct vertex_program *program = + (ctx->VertexProgram._Enabled ? ctx->VertexProgram.Current : 0); + + if (!program && ctx->_MaintainTnlProgram) { + program = ctx->_TnlProgram; + } + + if (program) { + if (!program->TnlData) + compile_vertex_program( program, m->try_codegen ); + + /* Grab the state GL state and put into registers: + */ + m->File[FILE_LOCAL_PARAM] = program->Base.LocalParams; + m->File[FILE_ENV_PARAM] = ctx->VertexProgram.Parameters; + /* GL_NV_vertex_programs can't reference GL state */ + if (program->Parameters) + m->File[FILE_STATE_PARAM] = program->Parameters->ParameterValues; + else + m->File[FILE_STATE_PARAM] = NULL; + } +} + + + + + + + +/** + * Called the first time stage->run is called. In effect, don't + * allocate data until the first time the stage is run. + */ +static GLboolean init_vertex_program( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &(tnl->vb); + struct arb_vp_machine *m; + const GLuint size = VB->Size; + GLuint i; + + stage->privatePtr = _mesa_malloc(sizeof(*m)); + m = ARB_VP_MACHINE(stage); + if (!m) + return GL_FALSE; + + /* arb_vertex_machine struct should subsume the VB: + */ + m->VB = VB; + m->ctx = ctx; + + m->File[0] = ALIGN_MALLOC(REG_MAX * sizeof(GLfloat) * 4, 16); + + /* Initialize regs where necessary: + */ + ASSIGN_4V(m->File[0][REG_ID], 0, 0, 0, 1); + ASSIGN_4V(m->File[0][REG_ONES], 1, 1, 1, 1); + ASSIGN_4V(m->File[0][REG_SWZ], -1, 1, 0, 0); + ASSIGN_4V(m->File[0][REG_NEG], -1, -1, -1, -1); + ASSIGN_4V(m->File[0][REG_LIT], 1, 0, 0, 1); + ASSIGN_4V(m->File[0][REG_LIT2], 1, .5, .2, 1); /* debug value */ + + if (_mesa_getenv("MESA_EXPERIMENTAL")) + m->try_codegen = 1; + + /* Allocate arrays of vertex output values */ + for (i = 0; i < VERT_RESULT_MAX; i++) { + _mesa_vector4f_alloc( &m->attribs[i], 0, size, 32 ); + m->attribs[i].size = 4; + } + + /* a few other misc allocations */ + _mesa_vector4f_alloc( &m->ndcCoords, 0, size, 32 ); + m->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); + + if (ctx->_MaintainTnlProgram) + _mesa_allow_light_in_model( ctx, GL_FALSE ); + + m->fpucntl_rnd_neg = RND_NEG_FPU; /* const value */ + m->fpucntl_restore = RESTORE_FPU; /* const value */ + + return GL_TRUE; +} + + + + +/** + * Destructor for this pipeline stage. + */ +static void dtr( struct tnl_pipeline_stage *stage ) +{ + struct arb_vp_machine *m = ARB_VP_MACHINE(stage); + + if (m) { + GLuint i; + + /* free the vertex program result arrays */ + for (i = 0; i < VERT_RESULT_MAX; i++) + _mesa_vector4f_free( &m->attribs[i] ); + + /* free misc arrays */ + _mesa_vector4f_free( &m->ndcCoords ); + ALIGN_FREE( m->clipmask ); + ALIGN_FREE( m->File[0] ); + + _mesa_free( m ); + stage->privatePtr = NULL; + } +} + +/** + * Public description of this pipeline stage. + */ +const struct tnl_pipeline_stage _tnl_arb_vertex_program_stage = +{ + "vertex-program", + NULL, /* private_data */ + init_vertex_program, /* create */ + dtr, /* destroy */ + validate_vertex_program, /* validate */ + run_arb_vertex_program /* run */ +}; diff --git a/reactos/dll/mesa32/src/tnl/t_vb_arbprogram.h b/reactos/dll/mesa32/src/tnl/t_vb_arbprogram.h new file mode 100644 index 00000000000..02cd432825c --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_arbprogram.h @@ -0,0 +1,189 @@ +/* + * 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. + */ + +/** + * \file t_arb_program.c + * Compile vertex programs to an intermediate representation. + * Execute vertex programs over a buffer of vertices. + * \author Keith Whitwell, Brian Paul + */ + + +#ifndef _T_VB_ARBPROGRAM_H_ +#define _T_VB_ARBPROGRAM_H_ + + +/* New, internal instructions: + */ +#define RSW (VP_MAX_OPCODE) +#define MSK (VP_MAX_OPCODE+1) +#define REL (VP_MAX_OPCODE+2) + +/** + * Register files for vertex programs + */ +#define FILE_REG 0 /* temporaries */ +#define FILE_LOCAL_PARAM 1 /* local parameters */ +#define FILE_ENV_PARAM 2 /* global parameters */ +#define FILE_STATE_PARAM 3 /* GL state references */ + +#define REG_ARG0 0 +#define REG_ARG1 1 +#define REG_ARG2 2 +#define REG_RES 3 +#define REG_ADDR 4 +#define REG_TMP0 5 +#define REG_TMP11 16 +#define REG_OUT0 17 +#define REG_OUT14 31 +#define REG_IN0 32 +#define REG_IN31 63 +#define REG_ID 64 /* 0,0,0,1 */ +#define REG_ONES 65 /* 1,1,1,1 */ +#define REG_SWZ 66 /* -1,1,0,0 */ +#define REG_NEG 67 /* -1,-1,-1,-1 */ +#define REG_LIT 68 /* 1,0,0,1 */ +#define REG_LIT2 69 /* 1,0,0,1 */ +#define REG_SCRATCH 70 /* internal temporary */ +#define REG_UNDEF 127 /* special case - never used */ +#define REG_MAX 128 +#define REG_INVALID ~0 + +/* ARB_vp instructions are broken down into one or more of the + * following micro-instructions, each representable in a 32 bit packed + * structure. + */ +struct reg { + GLuint file:2; + GLuint idx:7; +}; + + +union instruction { + struct { + GLuint opcode:6; + GLuint dst:5; + GLuint file0:2; + GLuint idx0:7; + GLuint file1:2; + GLuint idx1:7; + GLuint pad:3; + } alu; + + struct { + GLuint opcode:6; + GLuint dst:5; + GLuint file0:2; + GLuint idx0:7; + GLuint neg:4; + GLuint swz:8; /* xyzw only */ + } rsw; + + struct { + GLuint opcode:6; + GLuint dst:5; + GLuint file:2; + GLuint idx:7; + GLuint mask:4; + GLuint pad:1; + } msk; + + GLuint dword; +}; + +#define RSW_NOOP ((0<<0) | (1<<2) | (2<<4) | (3<<6)) +#define GET_RSW(swz, idx) (((swz) >> ((idx)*2)) & 0x3) + + +struct input { + GLuint idx; + GLfloat *data; + GLuint stride; + GLuint size; +}; + +struct output { + GLuint idx; + GLfloat *data; +}; + + + +/*--------------------------------------------------------------------------- */ +#if defined(USE_SSE_ASM) +#ifdef NO_FAST_MATH +#define RESTORE_FPU (DEFAULT_X86_FPU) +#define RND_NEG_FPU (DEFAULT_X86_FPU | 0x400) +#else +#define RESTORE_FPU (FAST_X86_FPU) +#define RND_NEG_FPU (FAST_X86_FPU | 0x400) +#endif +#else +#define RESTORE_FPU 0 +#define RND_NEG_FPU 0 +#endif + + +/*! + * Private storage for the vertex program pipeline stage. + */ +struct arb_vp_machine { + GLfloat (*File[4])[4]; /* All values referencable from the program. */ + + struct input input[_TNL_ATTRIB_MAX]; + GLuint nr_inputs; + + struct output output[15]; + GLuint nr_outputs; + + GLvector4f attribs[VERT_RESULT_MAX]; /**< result vectors. */ + GLvector4f ndcCoords; /**< normalized device coords */ + GLubyte *clipmask; /**< clip flags */ + GLubyte ormask, andmask; /**< for clipping */ + + GLuint vtx_nr; /**< loop counter */ + + struct vertex_buffer *VB; + GLcontext *ctx; + + GLshort fpucntl_rnd_neg; /* constant value */ + GLshort fpucntl_restore; /* constant value */ + + GLboolean try_codegen; +}; + +struct tnl_compiled_program { + union instruction instructions[1024]; + GLint nr_instructions; + void (*compiled_func)( struct arb_vp_machine * ); /**< codegen'd program */ +}; + +void _tnl_program_string_change( struct vertex_program * ); +void _tnl_program_destroy( struct vertex_program * ); + +void _tnl_disassem_vba_insn( union instruction op ); + +GLboolean _tnl_sse_codegen_vertex_program(struct tnl_compiled_program *p); + +#endif diff --git a/reactos/dll/mesa32/src/tnl/t_vb_arbprogram_sse.c b/reactos/dll/mesa32/src/tnl/t_vb_arbprogram_sse.c new file mode 100644 index 00000000000..330d30efb92 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_arbprogram_sse.c @@ -0,0 +1,1222 @@ +/* + * 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. + */ + +/** + * \file t_vb_arb_program_sse.c + * + * Translate simplified vertex_program representation to + * x86/x87/SSE/SSE2 machine code using mesa's rtasm runtime assembler. + * + * This is very much a first attempt - build something that works. + * There are probably better approaches for applying SSE to vertex + * programs, and the whole thing is crying out for static analysis of + * the programs to avoid redundant operations. + * + * \author Keith Whitwell + */ + +#include "glheader.h" +#include "context.h" +#include "imports.h" +#include "macros.h" +#include "mtypes.h" +#include "arbprogparse.h" +#include "program.h" +#include "math/m_matrix.h" +#include "math/m_translate.h" +#include "t_context.h" +#include "t_vb_arbprogram.h" + +#if defined(USE_SSE_ASM) + +#include "x86/rtasm/x86sse.h" +#include "x86/common_x86_asm.h" + +#define X 0 +#define Y 1 +#define Z 2 +#define W 3 + +/* Reg usage: + * + * EAX - temp + * EBX - point to 'm->File[0]' + * ECX - point to 'm->File[3]' + * EDX - holds 'm' + * EBP, + * ESI, + * EDI + */ + +#define DISASSEM 0 + +#define FAIL \ +do { \ + _mesa_printf("x86 translation failed in %s\n", __FUNCTION__); \ + return GL_FALSE; \ +} while (0) + +struct compilation { + struct x86_function func; + struct tnl_compiled_program *p; + GLuint insn_counter; + + struct { + GLuint file:2; + GLuint idx:7; + GLuint dirty:1; + GLuint last_used:10; + } xmm[8]; + + struct { + struct x86_reg base; + } file[4]; + + GLboolean have_sse2; + GLshort fpucntl; +}; + +static INLINE GLboolean eq( struct x86_reg a, + struct x86_reg b ) +{ + return (a.file == b.file && + a.idx == b.idx && + a.mod == b.mod && + a.disp == b.disp); +} + +static GLint get_offset( const void *a, const void *b ) +{ + return (const char *)b - (const char *)a; +} + + +static struct x86_reg get_reg_ptr(GLuint file, + GLuint idx ) +{ + struct x86_reg reg; + + switch (file) { + case FILE_REG: + reg = x86_make_reg(file_REG32, reg_BX); + assert(idx != REG_UNDEF); + break; + case FILE_STATE_PARAM: + reg = x86_make_reg(file_REG32, reg_CX); + break; + default: + assert(0); + } + + return x86_make_disp(reg, 16 * idx); +} + + +static void spill( struct compilation *cp, GLuint idx ) +{ + struct x86_reg oldval = get_reg_ptr(cp->xmm[idx].file, + cp->xmm[idx].idx); + + assert(cp->xmm[idx].dirty); + sse_movups(&cp->func, oldval, x86_make_reg(file_XMM, idx)); + cp->xmm[idx].dirty = 0; +} + +static struct x86_reg get_xmm_reg( struct compilation *cp ) +{ + GLuint i; + GLuint oldest = 0; + + for (i = 0; i < 8; i++) + if (cp->xmm[i].last_used < cp->xmm[oldest].last_used) + oldest = i; + + /* Need to write out the old value? + */ + if (cp->xmm[oldest].dirty) + spill(cp, oldest); + + assert(cp->xmm[oldest].last_used != cp->insn_counter); + + cp->xmm[oldest].file = FILE_REG; + cp->xmm[oldest].idx = REG_UNDEF; + cp->xmm[oldest].last_used = cp->insn_counter; + return x86_make_reg(file_XMM, oldest); +} + +static void invalidate_xmm( struct compilation *cp, + GLuint file, GLuint idx ) +{ + GLuint i; + + /* Invalidate any old copy of this register in XMM0-7. + */ + for (i = 0; i < 8; i++) { + if (cp->xmm[i].file == file && cp->xmm[i].idx == idx) { + cp->xmm[i].file = FILE_REG; + cp->xmm[i].idx = REG_UNDEF; + cp->xmm[i].dirty = 0; + break; + } + } +} + + +/* Return an XMM reg to receive the results of an operation. + */ +static struct x86_reg get_dst_xmm_reg( struct compilation *cp, + GLuint file, GLuint idx ) +{ + struct x86_reg reg; + + /* Invalidate any old copy of this register in XMM0-7. Don't reuse + * as this may be one of the arguments. + */ + invalidate_xmm( cp, file, idx ); + + reg = get_xmm_reg( cp ); + cp->xmm[reg.idx].file = file; + cp->xmm[reg.idx].idx = idx; + cp->xmm[reg.idx].dirty = 1; + return reg; +} + +/* As above, but return a pointer. Note - this pointer may alias + * those returned by get_arg_ptr(). + */ +static struct x86_reg get_dst_ptr( struct compilation *cp, + GLuint file, GLuint idx ) +{ + /* Invalidate any old copy of this register in XMM0-7. Don't reuse + * as this may be one of the arguments. + */ + invalidate_xmm( cp, file, idx ); + + return get_reg_ptr(file, idx); +} + + + +/* Return an XMM reg if the argument is resident, otherwise return a + * base+offset pointer to the saved value. + */ +static struct x86_reg get_arg( struct compilation *cp, GLuint file, GLuint idx ) +{ + GLuint i; + + for (i = 0; i < 8; i++) { + if (cp->xmm[i].file == file && + cp->xmm[i].idx == idx) { + cp->xmm[i].last_used = cp->insn_counter; + return x86_make_reg(file_XMM, i); + } + } + + return get_reg_ptr(file, idx); +} + +/* As above, but always return a pointer: + */ +static struct x86_reg get_arg_ptr( struct compilation *cp, GLuint file, GLuint idx ) +{ + GLuint i; + + /* If there is a modified version of this register in one of the + * XMM regs, write it out to memory. + */ + for (i = 0; i < 8; i++) { + if (cp->xmm[i].file == file && + cp->xmm[i].idx == idx && + cp->xmm[i].dirty) + spill(cp, i); + } + + return get_reg_ptr(file, idx); +} + +/* Emulate pshufd insn in regular SSE, if necessary: + */ +static void emit_pshufd( struct compilation *cp, + struct x86_reg dst, + struct x86_reg arg0, + GLubyte shuf ) +{ + if (cp->have_sse2) { + sse2_pshufd(&cp->func, dst, arg0, shuf); + cp->func.fn = 0; + } + else { + if (!eq(dst, arg0)) + sse_movups(&cp->func, dst, arg0); + + sse_shufps(&cp->func, dst, dst, shuf); + } +} + +static void set_fpu_round_neg_inf( struct compilation *cp ) +{ + if (cp->fpucntl != RND_NEG_FPU) { + struct x86_reg regEDX = x86_make_reg(file_REG32, reg_DX); + struct arb_vp_machine *m = NULL; + + cp->fpucntl = RND_NEG_FPU; + x87_fnclex(&cp->func); + x87_fldcw(&cp->func, x86_make_disp(regEDX, get_offset(m, &m->fpucntl_rnd_neg))); + } +} + + +/* Perform a reduced swizzle. + */ +static GLboolean emit_RSW( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.rsw.file0, op.rsw.idx0); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.rsw.dst); + GLuint swz = op.rsw.swz; + GLuint neg = op.rsw.neg; + + emit_pshufd(cp, dst, arg0, swz); + + if (neg) { + struct x86_reg negs = get_arg(cp, FILE_REG, REG_SWZ); + struct x86_reg tmp = get_xmm_reg(cp); + /* Load 1,-1,0,0 + * Use neg as arg to pshufd + * Multiply + */ + emit_pshufd(cp, tmp, negs, + SHUF((neg & 1) ? 1 : 0, + (neg & 2) ? 1 : 0, + (neg & 4) ? 1 : 0, + (neg & 8) ? 1 : 0)); + sse_mulps(&cp->func, dst, tmp); + } + + return GL_TRUE; +} + +/* Helper for writemask: + */ +static GLboolean emit_shuf_copy1( struct compilation *cp, + struct x86_reg dst, + struct x86_reg arg0, + struct x86_reg arg1, + GLubyte shuf ) +{ + struct x86_reg tmp = get_xmm_reg(cp); + sse_movups(&cp->func, dst, arg1); + emit_pshufd(cp, dst, dst, shuf); + emit_pshufd(cp, tmp, arg0, shuf); + + sse_movss(&cp->func, dst, tmp); + + emit_pshufd(cp, dst, dst, shuf); + return GL_TRUE; +} + + +/* Helper for writemask: + */ +static GLboolean emit_shuf_copy2( struct compilation *cp, + struct x86_reg dst, + struct x86_reg arg0, + struct x86_reg arg1, + GLubyte shuf ) +{ + struct x86_reg tmp = get_xmm_reg(cp); + emit_pshufd(cp, dst, arg1, shuf); + emit_pshufd(cp, tmp, arg0, shuf); + + sse_shufps(&cp->func, dst, tmp, SHUF(X, Y, Z, W)); + + emit_pshufd(cp, dst, dst, shuf); + return GL_TRUE; +} + + +static void emit_x87_ex2( struct compilation *cp ) +{ + struct x86_reg st0 = x86_make_reg(file_x87, 0); + struct x86_reg st1 = x86_make_reg(file_x87, 1); + struct x86_reg st3 = x86_make_reg(file_x87, 3); + + set_fpu_round_neg_inf( cp ); + + x87_fld(&cp->func, st0); /* a a */ + x87_fprndint( &cp->func ); /* int(a) a */ + x87_fld(&cp->func, st0); /* int(a) int(a) a */ + x87_fstp(&cp->func, st3); /* int(a) a int(a)*/ + x87_fsubp(&cp->func, st1); /* frac(a) int(a) */ + x87_f2xm1(&cp->func); /* (2^frac(a))-1 int(a)*/ + x87_fld1(&cp->func); /* 1 (2^frac(a))-1 int(a)*/ + x87_faddp(&cp->func, st1); /* 2^frac(a) int(a) */ + x87_fscale(&cp->func); /* 2^a */ +} + +#if 0 +static GLboolean emit_MSK2( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.msk.file, op.msk.arg); + struct x86_reg arg1 = get_arg(cp, FILE_REG, op.msk.dst); /* NOTE! */ + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.msk.dst); + + /* make full width bitmask in tmp + * dst = ~tmp + * tmp &= arg0 + * dst &= arg1 + * dst |= tmp + */ + emit_pshufd(cp, tmp, get_arg(cp, FILE_REG, REG_NEGS), + SHUF((op.msk.mask & 1) ? 2 : 0, + (op.msk.mask & 2) ? 2 : 0, + (op.msk.mask & 4) ? 2 : 0, + (op.msk.mask & 8) ? 2 : 0)); + sse2_pnot(&cp->func, dst, tmp); + sse2_pand(&cp->func, arg0, tmp); + sse2_pand(&cp->func, arg1, dst); + sse2_por(&cp->func, tmp, dst); + return GL_TRUE; +} +#endif + + +/* Used to implement write masking. This and most of the other instructions + * here would be easier to implement if there had been a translation + * to a 2 argument format (dst/arg0, arg1) at the shader level before + * attempting to translate to x86/sse code. + */ +static GLboolean emit_MSK( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg = get_arg(cp, op.msk.file, op.msk.idx); + struct x86_reg dst0 = get_arg(cp, FILE_REG, op.msk.dst); /* NOTE! */ + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.msk.dst); + + /* Note that dst and dst0 refer to the same program variable, but + * will definitely be different XMM registers. We're effectively + * treating this as a 2 argument SEL now, just one of which happens + * always to be the same register as the destination. + */ + + switch (op.msk.mask) { + case 0: + sse_movups(&cp->func, dst, dst0); + return GL_TRUE; + + case WRITEMASK_X: + if (arg.file == file_XMM) { + sse_movups(&cp->func, dst, dst0); + sse_movss(&cp->func, dst, arg); + } + else { + struct x86_reg tmp = get_xmm_reg(cp); + sse_movups(&cp->func, dst, dst0); + sse_movss(&cp->func, tmp, arg); + sse_movss(&cp->func, dst, tmp); + } + return GL_TRUE; + + case WRITEMASK_XY: + sse_movups(&cp->func, dst, dst0); + sse_shufps(&cp->func, dst, arg, SHUF(X, Y, Z, W)); + return GL_TRUE; + + case WRITEMASK_ZW: + sse_movups(&cp->func, dst, arg); + sse_shufps(&cp->func, dst, dst0, SHUF(X, Y, Z, W)); + return GL_TRUE; + + case WRITEMASK_YZW: + if (dst0.file == file_XMM) { + sse_movups(&cp->func, dst, arg); + sse_movss(&cp->func, dst, dst0); + } + else { + struct x86_reg tmp = get_xmm_reg(cp); + sse_movups(&cp->func, dst, arg); + sse_movss(&cp->func, tmp, dst0); + sse_movss(&cp->func, dst, tmp); + } + return GL_TRUE; + + case WRITEMASK_Y: + emit_shuf_copy1(cp, dst, arg, dst0, SHUF(Y,X,Z,W)); + return GL_TRUE; + + case WRITEMASK_Z: + emit_shuf_copy1(cp, dst, arg, dst0, SHUF(Z,Y,X,W)); + return GL_TRUE; + + case WRITEMASK_W: + emit_shuf_copy1(cp, dst, arg, dst0, SHUF(W,Y,Z,X)); + return GL_TRUE; + + case WRITEMASK_XZ: + emit_shuf_copy2(cp, dst, arg, dst0, SHUF(X,Z,Y,W)); + return GL_TRUE; + + case WRITEMASK_XW: + emit_shuf_copy2(cp, dst, arg, dst0, SHUF(X,W,Z,Y)); + + case WRITEMASK_YZ: + emit_shuf_copy2(cp, dst, arg, dst0, SHUF(Z,Y,X,W)); + return GL_TRUE; + + case WRITEMASK_YW: + emit_shuf_copy2(cp, dst, arg, dst0, SHUF(W,Y,Z,X)); + return GL_TRUE; + + case WRITEMASK_XZW: + emit_shuf_copy1(cp, dst, dst0, arg, SHUF(Y,X,Z,W)); + return GL_TRUE; + + case WRITEMASK_XYW: + emit_shuf_copy1(cp, dst, dst0, arg, SHUF(Z,Y,X,W)); + return GL_TRUE; + + case WRITEMASK_XYZ: + emit_shuf_copy1(cp, dst, dst0, arg, SHUF(W,Y,Z,X)); + return GL_TRUE; + + case WRITEMASK_XYZW: + sse_movups(&cp->func, dst, arg); + return GL_TRUE; + + default: + assert(0); + break; + } +} + + + +static GLboolean emit_PRT( struct compilation *cp, union instruction op ) +{ + FAIL; +} + + +/** + * The traditional instructions. All operate on internal registers + * and ignore write masks and swizzling issues. + */ + +static GLboolean emit_ABS( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + struct x86_reg neg = get_reg_ptr(FILE_REG, REG_NEG); + + sse_movups(&cp->func, dst, arg0); + sse_mulps(&cp->func, dst, neg); + sse_maxps(&cp->func, dst, arg0); + return GL_TRUE; +} + +static GLboolean emit_ADD( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + + sse_movups(&cp->func, dst, arg0); + sse_addps(&cp->func, dst, arg1); + return GL_TRUE; +} + + +/* The dotproduct instructions don't really do that well in sse: + */ +static GLboolean emit_DP3( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + struct x86_reg tmp = get_xmm_reg(cp); + + sse_movups(&cp->func, dst, arg0); + sse_mulps(&cp->func, dst, arg1); + + /* Now the hard bit: sum the first 3 values: + */ + sse_movhlps(&cp->func, tmp, dst); + sse_addss(&cp->func, dst, tmp); /* a*x+c*z, b*y, ?, ? */ + emit_pshufd(cp, tmp, dst, SHUF(Y,X,W,Z)); + sse_addss(&cp->func, dst, tmp); + sse_shufps(&cp->func, dst, dst, SHUF(X, X, X, X)); + return GL_TRUE; +} + + + +static GLboolean emit_DP4( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + struct x86_reg tmp = get_xmm_reg(cp); + + sse_movups(&cp->func, dst, arg0); + sse_mulps(&cp->func, dst, arg1); + + /* Now the hard bit: sum the values: + */ + sse_movhlps(&cp->func, tmp, dst); + sse_addps(&cp->func, dst, tmp); /* a*x+c*z, b*y+d*w, a*x+c*z, b*y+d*w */ + emit_pshufd(cp, tmp, dst, SHUF(Y,X,W,Z)); + sse_addss(&cp->func, dst, tmp); + sse_shufps(&cp->func, dst, dst, SHUF(X, X, X, X)); + return GL_TRUE; +} + +static GLboolean emit_DPH( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + struct x86_reg ones = get_reg_ptr(FILE_REG, REG_ONES); + struct x86_reg tmp = get_xmm_reg(cp); + + emit_pshufd(cp, dst, arg0, SHUF(W,X,Y,Z)); + sse_movss(&cp->func, dst, ones); + emit_pshufd(cp, dst, dst, SHUF(W,X,Y,Z)); + sse_mulps(&cp->func, dst, arg1); + + /* Now the hard bit: sum the values (from DP4): + */ + sse_movhlps(&cp->func, tmp, dst); + sse_addps(&cp->func, dst, tmp); /* a*x+c*z, b*y+d*w, a*x+c*z, b*y+d*w */ + emit_pshufd(cp, tmp, dst, SHUF(Y,X,W,Z)); + sse_addss(&cp->func, dst, tmp); + sse_shufps(&cp->func, dst, dst, SHUF(X, X, X, X)); + return GL_TRUE; +} + +#if 0 +static GLboolean emit_DST( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); + struct x86_reg arg1 = get_arg_ptr(cp, op.alu.file1, op.alu.idx1); + struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); + +/* dst[0] = 1.0 * 1.0F; */ +/* dst[1] = arg0[1] * arg1[1]; */ +/* dst[2] = arg0[2] * 1.0; */ +/* dst[3] = 1.0 * arg1[3]; */ + + /* Would rather do some of this with integer regs, but: + * 1) No proper support for immediate values yet + * 2) I'd need to push/pop somewhere to get a free reg. + */ + x87_fld1(&cp->func); + x87_fstp(&cp->func, dst); /* would rather do an immediate store... */ + x87_fld(&cp->func, x86_make_disp(arg0, 4)); + x87_fmul(&cp->func, x86_make_disp(arg1, 4)); + x87_fstp(&cp->func, x86_make_disp(dst, 4)); + + if (!eq(arg0, dst)) { + x86_fld(&cp->func, x86_make_disp(arg0, 8)); + x86_stp(&cp->func, x86_make_disp(dst, 8)); + } + + if (!eq(arg1, dst)) { + x86_fld(&cp->func, x86_make_disp(arg0, 12)); + x86_stp(&cp->func, x86_make_disp(dst, 12)); + } + + return GL_TRUE; +} +#else +static GLboolean emit_DST( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + struct x86_reg tmp = get_xmm_reg(cp); + struct x86_reg ones = get_reg_ptr(FILE_REG, REG_ONES); + + emit_shuf_copy2(cp, dst, arg0, ones, SHUF(X,W,Z,Y)); + emit_shuf_copy2(cp, tmp, arg1, ones, SHUF(X,Z,Y,W)); + sse_mulps(&cp->func, dst, tmp); + +/* dst[0] = 1.0 * 1.0F; */ +/* dst[1] = arg0[1] * arg1[1]; */ +/* dst[2] = arg0[2] * 1.0; */ +/* dst[3] = 1.0 * arg1[3]; */ + + return GL_TRUE; +} +#endif + +static GLboolean emit_LG2( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); + struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); + + x87_fld1(&cp->func); /* 1 */ + x87_fld(&cp->func, arg0); /* a0 1 */ + x87_fyl2x(&cp->func); /* log2(a0) */ + x87_fst(&cp->func, x86_make_disp(dst, 0)); + x87_fst(&cp->func, x86_make_disp(dst, 4)); + x87_fst(&cp->func, x86_make_disp(dst, 8)); + x87_fstp(&cp->func, x86_make_disp(dst, 12)); + + return GL_TRUE; +} + + +static GLboolean emit_EX2( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); + struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); + + /* CAUTION: dst may alias arg0! + */ + x87_fld(&cp->func, arg0); + + emit_x87_ex2(cp); + + x87_fst(&cp->func, x86_make_disp(dst, 0)); + x87_fst(&cp->func, x86_make_disp(dst, 4)); + x87_fst(&cp->func, x86_make_disp(dst, 8)); + x87_fst(&cp->func, x86_make_disp(dst, 12)); + return GL_TRUE; +} + +static GLboolean emit_EXP( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); + struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); + struct x86_reg st0 = x86_make_reg(file_x87, 0); + struct x86_reg st1 = x86_make_reg(file_x87, 1); + struct x86_reg st3 = x86_make_reg(file_x87, 3); + + /* CAUTION: dst may alias arg0! + */ + x87_fld(&cp->func, arg0); /* arg0.x */ + x87_fld(&cp->func, st0); /* arg arg */ + + /* by default, fpu is setup to round-to-nearest. We want to + * change this now, and track the state through to the end of the + * generated function so that it isn't repeated unnecessarily. + * Alternately, could subtract .5 to get round to -inf behaviour. + */ + set_fpu_round_neg_inf( cp ); + x87_fprndint( &cp->func ); /* flr(a) a */ + x87_fld(&cp->func, st0); /* flr(a) flr(a) a */ + x87_fld1(&cp->func); /* 1 floor(a) floor(a) a */ + x87_fst(&cp->func, x86_make_disp(dst, 12)); /* stack unchanged */ + x87_fscale(&cp->func); /* 2^floor(a) floor(a) a */ + x87_fst(&cp->func, st3); /* 2^floor(a) floor(a) a 2^floor(a)*/ + x87_fstp(&cp->func, x86_make_disp(dst, 0)); /* flr(a) a 2^flr(a) */ + x87_fsubrp(&cp->func, st1); /* frac(a) 2^flr(a) */ + x87_fst(&cp->func, x86_make_disp(dst, 4)); /* frac(a) 2^flr(a) */ + x87_f2xm1(&cp->func); /* (2^frac(a))-1 2^flr(a)*/ + x87_fld1(&cp->func); /* 1 (2^frac(a))-1 2^flr(a)*/ + x87_faddp(&cp->func, st1); /* 2^frac(a) 2^flr(a) */ + x87_fmulp(&cp->func, st1); /* 2^a */ + x87_fst(&cp->func, x86_make_disp(dst, 8)); + + + +/* dst[0] = 2^floor(tmp); */ +/* dst[1] = frac(tmp); */ +/* dst[2] = 2^floor(tmp) * 2^frac(tmp); */ +/* dst[3] = 1.0F; */ + return GL_TRUE; +} + +static GLboolean emit_LOG( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); + struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); + struct x86_reg st0 = x86_make_reg(file_x87, 0); + struct x86_reg st1 = x86_make_reg(file_x87, 1); + struct x86_reg st2 = x86_make_reg(file_x87, 2); + + /* CAUTION: dst may alias arg0! + */ + x87_fld(&cp->func, arg0); /* arg0.x */ + x87_fabs(&cp->func); /* |arg0.x| */ + x87_fxtract(&cp->func); /* mantissa(arg0.x), exponent(arg0.x) */ + x87_fst(&cp->func, st2); /* mantissa, exponent, mantissa */ + x87_fld1(&cp->func); /* 1, mantissa, exponent, mantissa */ + x87_fyl2x(&cp->func); /* log2(mantissa), exponent, mantissa */ + x87_fadd(&cp->func, st0, st1); /* e+l2(m), e, m */ + x87_fstp(&cp->func, x86_make_disp(dst, 8)); /* e, m */ + + x87_fld1(&cp->func); /* 1, e, m */ + x87_fsub(&cp->func, st1, st0); /* 1, e-1, m */ + x87_fstp(&cp->func, x86_make_disp(dst, 12)); /* e-1,m */ + x87_fstp(&cp->func, dst); /* m */ + + x87_fadd(&cp->func, st0, st0); /* 2m */ + x87_fstp(&cp->func, x86_make_disp(dst, 4)); + + return GL_TRUE; +} + +static GLboolean emit_FLR( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); + struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); + int i; + + set_fpu_round_neg_inf( cp ); + + for (i = 0; i < 4; i++) { + x87_fld(&cp->func, x86_make_disp(arg0, i*4)); + x87_fprndint( &cp->func ); + x87_fstp(&cp->func, x86_make_disp(dst, i*4)); + } + + + return GL_TRUE; +} + +static GLboolean emit_FRC( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); + struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); + struct x86_reg st0 = x86_make_reg(file_x87, 0); + struct x86_reg st1 = x86_make_reg(file_x87, 1); + int i; + + set_fpu_round_neg_inf( cp ); + + /* Knowing liveness info or even just writemask would be useful + * here: + */ + for (i = 0; i < 4; i++) { + x87_fld(&cp->func, x86_make_disp(arg0, i*4)); + x87_fld(&cp->func, st0); /* a a */ + x87_fprndint( &cp->func ); /* flr(a) a */ + x87_fsubrp(&cp->func, st1); /* frc(a) */ + x87_fstp(&cp->func, x86_make_disp(dst, i*4)); + } + + return GL_TRUE; +} + + + +static GLboolean emit_LIT( struct compilation *cp, union instruction op ) +{ +#if 1 + struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); + struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); + struct x86_reg lit = get_arg(cp, FILE_REG, REG_LIT); + struct x86_reg tmp = get_xmm_reg(cp); + struct x86_reg st1 = x86_make_reg(file_x87, 1); + struct x86_reg regEAX = x86_make_reg(file_REG32, reg_AX); + GLubyte *fixup1, *fixup2; + + + /* Load the interesting parts of arg0: + */ + x87_fld(&cp->func, x86_make_disp(arg0, 12)); /* a3 */ + x87_fld(&cp->func, x86_make_disp(arg0, 4)); /* a1 a3 */ + x87_fld(&cp->func, x86_make_disp(arg0, 0)); /* a0 a1 a3 */ + + /* Intialize dst: + */ + sse_movaps(&cp->func, tmp, lit); + sse_movaps(&cp->func, dst, tmp); + + /* Check arg0[0]: + */ + x87_fldz(&cp->func); /* 0 a0 a1 a3 */ + x87_fucomp(&cp->func, st1); /* a0 a1 a3 */ + x87_fnstsw(&cp->func, regEAX); + x86_sahf(&cp->func); + fixup1 = x86_jcc_forward(&cp->func, cc_AE); + + x87_fstp(&cp->func, x86_make_disp(dst, 4)); /* a1 a3 */ + + /* Check arg0[1]: + */ + x87_fldz(&cp->func); /* 0 a1 a3 */ + x87_fucomp(&cp->func, st1); /* a1 a3 */ + x87_fnstsw(&cp->func, regEAX); + x86_sahf(&cp->func); + fixup2 = x86_jcc_forward(&cp->func, cc_AE); + + /* Compute pow(a1, a3) + */ + x87_fyl2x(&cp->func); /* a3*log2(a1) */ + + emit_x87_ex2( cp ); /* 2^(a3*log2(a1)) */ + + x87_fstp(&cp->func, x86_make_disp(dst, 8)); + + /* Land jumps: + */ + x86_fixup_fwd_jump(&cp->func, fixup1); + x86_fixup_fwd_jump(&cp->func, fixup2); +#else + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + struct x86_reg ones = get_reg_ptr(FILE_REG, REG_LIT); + sse_movups(&cp->func, dst, ones); +#endif + return GL_TRUE; +} + + + +static GLboolean emit_MAX( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + + sse_movups(&cp->func, dst, arg0); + sse_maxps(&cp->func, dst, arg1); + return GL_TRUE; +} + + +static GLboolean emit_MIN( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + + sse_movups(&cp->func, dst, arg0); + sse_minps(&cp->func, dst, arg1); + return GL_TRUE; +} + +static GLboolean emit_MOV( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + + sse_movups(&cp->func, dst, arg0); + return GL_TRUE; +} + +static GLboolean emit_MUL( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + + sse_movups(&cp->func, dst, arg0); + sse_mulps(&cp->func, dst, arg1); + return GL_TRUE; +} + + +static GLboolean emit_POW( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); + struct x86_reg arg1 = get_arg_ptr(cp, op.alu.file1, op.alu.idx1); + struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); + + x87_fld(&cp->func, arg1); /* a1 */ + x87_fld(&cp->func, arg0); /* a0 a1 */ + x87_fyl2x(&cp->func); /* a1*log2(a0) */ + + emit_x87_ex2( cp ); /* 2^(a1*log2(a0)) */ + + x87_fst(&cp->func, x86_make_disp(dst, 0)); + x87_fst(&cp->func, x86_make_disp(dst, 4)); + x87_fst(&cp->func, x86_make_disp(dst, 8)); + x87_fstp(&cp->func, x86_make_disp(dst, 12)); + + return GL_TRUE; +} + +static GLboolean emit_REL( struct compilation *cp, union instruction op ) +{ +/* GLuint idx = (op.alu.idx0 + (GLint)cp->File[0][REG_ADDR][0]) & (MAX_NV_VERTEX_PROGRAM_PARAMS-1); */ +/* GLuint idx = 0; */ +/* struct x86_reg arg0 = get_arg(cp, op.alu.file0, idx); */ +/* struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); */ + +/* dst[0] = arg0[0]; */ +/* dst[1] = arg0[1]; */ +/* dst[2] = arg0[2]; */ +/* dst[3] = arg0[3]; */ + + FAIL; +} + +static GLboolean emit_RCP( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + + if (cp->have_sse2) { + sse2_rcpss(&cp->func, dst, arg0); + } + else { + struct x86_reg ones = get_reg_ptr(FILE_REG, REG_ONES); + sse_movss(&cp->func, dst, ones); + sse_divss(&cp->func, dst, arg0); + } + + sse_shufps(&cp->func, dst, dst, SHUF(X, X, X, X)); + return GL_TRUE; +} + +static GLboolean emit_RSQ( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + + /* TODO: Calculate absolute value + */ +#if 0 + sse_movss(&cp->func, dst, arg0); + sse_mulss(&cp->func, dst, neg); + sse_maxss(&cp->func, dst, arg0); +#endif + + sse_rsqrtss(&cp->func, dst, arg0); + sse_shufps(&cp->func, dst, dst, SHUF(X, X, X, X)); + return GL_TRUE; +} + + +static GLboolean emit_SGE( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + struct x86_reg ones = get_reg_ptr(FILE_REG, REG_ONES); + + sse_movups(&cp->func, dst, arg0); + sse_cmpps(&cp->func, dst, arg1, cc_NotLessThan); + sse_andps(&cp->func, dst, ones); + return GL_TRUE; +} + + +static GLboolean emit_SLT( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + struct x86_reg ones = get_reg_ptr(FILE_REG, REG_ONES); + + sse_movups(&cp->func, dst, arg0); + sse_cmpps(&cp->func, dst, arg1, cc_LessThan); + sse_andps(&cp->func, dst, ones); + return GL_TRUE; +} + +static GLboolean emit_SUB( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + + sse_movups(&cp->func, dst, arg0); + sse_subps(&cp->func, dst, arg1); + return GL_TRUE; +} + + +static GLboolean emit_XPD( struct compilation *cp, union instruction op ) +{ + struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); + struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); + struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); + struct x86_reg tmp0 = get_xmm_reg(cp); + struct x86_reg tmp1 = get_xmm_reg(cp); + + /* Could avoid tmp0, tmp1 if we overwrote arg0, arg1. Need a way + * to invalidate registers. This will come with better analysis + * (liveness analysis) of the incoming program. + */ + emit_pshufd(cp, dst, arg0, SHUF(Y, Z, X, W)); + emit_pshufd(cp, tmp1, arg1, SHUF(Z, X, Y, W)); + sse_mulps(&cp->func, dst, tmp1); + emit_pshufd(cp, tmp0, arg0, SHUF(Z, X, Y, W)); + emit_pshufd(cp, tmp1, arg1, SHUF(Y, Z, X, W)); + sse_mulps(&cp->func, tmp0, tmp1); + sse_subps(&cp->func, dst, tmp0); + +/* dst[0] = arg0[1] * arg1[2] - arg0[2] * arg1[1]; */ +/* dst[1] = arg0[2] * arg1[0] - arg0[0] * arg1[2]; */ +/* dst[2] = arg0[0] * arg1[1] - arg0[1] * arg1[0]; */ +/* dst[3] is undef */ + + return GL_TRUE; +} + +static GLboolean emit_NOP( struct compilation *cp, union instruction op ) +{ + return GL_TRUE; +} + + +static GLboolean (* const emit_func[])(struct compilation *, union instruction) = +{ + emit_ABS, + emit_ADD, + emit_NOP, + emit_DP3, + emit_DP4, + emit_DPH, + emit_DST, + emit_NOP, + emit_EX2, + emit_EXP, + emit_FLR, + emit_FRC, + emit_LG2, + emit_LIT, + emit_LOG, + emit_NOP, + emit_MAX, + emit_MIN, + emit_MOV, + emit_MUL, + emit_POW, + emit_PRT, + emit_NOP, + emit_RCP, + emit_RSQ, + emit_SGE, + emit_SLT, + emit_SUB, + emit_RSW, + emit_XPD, + emit_RSW, + emit_MSK, + emit_REL, +}; + + + +static GLboolean build_vertex_program( struct compilation *cp ) +{ + struct arb_vp_machine *m = NULL; + GLuint j; + + struct x86_reg regEBX = x86_make_reg(file_REG32, reg_BX); + struct x86_reg regECX = x86_make_reg(file_REG32, reg_CX); + struct x86_reg regEDX = x86_make_reg(file_REG32, reg_DX); + + x86_push(&cp->func, regEBX); + + x86_mov(&cp->func, regEDX, x86_fn_arg(&cp->func, 1)); + x86_mov(&cp->func, regEBX, x86_make_disp(regEDX, get_offset(m, m->File + FILE_REG))); + x86_mov(&cp->func, regECX, x86_make_disp(regEDX, get_offset(m, m->File + FILE_STATE_PARAM))); + + for (j = 0; j < cp->p->nr_instructions; j++) { + union instruction inst = cp->p->instructions[j]; + cp->insn_counter = j+1; /* avoid zero */ + + if (DISASSEM) { + _mesa_printf("%p: ", cp->func.csr); + _tnl_disassem_vba_insn( inst ); + } + cp->func.fn = NULL; + + if (!emit_func[inst.alu.opcode]( cp, inst )) { + return GL_FALSE; + } + } + + /* TODO: only for outputs: + */ + for (j = 0; j < 8; j++) { + if (cp->xmm[j].dirty) + spill(cp, j); + } + + + /* Exit mmx state? + */ + if (cp->func.need_emms) + mmx_emms(&cp->func); + + /* Restore FPU control word? + */ + if (cp->fpucntl != RESTORE_FPU) { + x87_fnclex(&cp->func); + x87_fldcw(&cp->func, x86_make_disp(regEDX, get_offset(m, &m->fpucntl_restore))); + } + + x86_pop(&cp->func, regEBX); + x86_ret(&cp->func); + + return GL_TRUE; +} + +/** + * Execute the given vertex program. + * + * TODO: Integrate the t_vertex.c code here, to build machine vertices + * directly at this point. + * + * TODO: Eliminate the VB struct entirely and just use + * struct arb_vertex_machine. + */ +GLboolean +_tnl_sse_codegen_vertex_program(struct tnl_compiled_program *p) +{ + struct compilation cp; + + memset(&cp, 0, sizeof(cp)); + cp.p = p; + cp.have_sse2 = 1; + + if (p->compiled_func) { + _mesa_free((void *)p->compiled_func); + p->compiled_func = NULL; + } + + x86_init_func(&cp.func); + + cp.fpucntl = RESTORE_FPU; + + + /* Note ctx state is not referenced in building the function, so it + * depends only on the list of instructions: + */ + if (!build_vertex_program(&cp)) { + x86_release_func( &cp.func ); + return GL_FALSE; + } + + + p->compiled_func = (void (*)(struct arb_vp_machine *))x86_get_func( &cp.func ); + return GL_TRUE; +} + + + +#else + +GLboolean +_tnl_sse_codegen_vertex_program(struct tnl_compiled_program *p) +{ + /* Dummy version for when USE_SSE_ASM not defined */ + return GL_FALSE; +} + +#endif diff --git a/reactos/dll/mesa32/src/tnl/t_vb_cliptmp.h b/reactos/dll/mesa32/src/tnl/t_vb_cliptmp.h new file mode 100644 index 00000000000..1e3a6b02ee2 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_cliptmp.h @@ -0,0 +1,270 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + + +#define CLIP_DOTPROD(K, A, B, C, D) X(K)*A + Y(K)*B + Z(K)*C + W(K)*D + +#define POLY_CLIP( PLANE, A, B, C, D ) \ +do { \ + if (mask & PLANE) { \ + GLuint idxPrev = inlist[0]; \ + GLfloat dpPrev = CLIP_DOTPROD(idxPrev, A, B, C, D ); \ + GLuint outcount = 0; \ + GLuint i; \ + \ + inlist[n] = inlist[0]; /* prevent rotation of vertices */ \ + for (i = 1; i <= n; i++) { \ + GLuint idx = inlist[i]; \ + GLfloat dp = CLIP_DOTPROD(idx, A, B, C, D ); \ + \ + clipmask[idxPrev] |= PLANE; \ + if (!IS_NEGATIVE(dpPrev)) { \ + outlist[outcount++] = idxPrev; \ + clipmask[idxPrev] &= ~PLANE; \ + } \ + \ + if (DIFFERENT_SIGNS(dp, dpPrev)) { \ + GLuint newvert = VB->LastClipped++; \ + VB->ClipMask[newvert] = 0; \ + outlist[outcount++] = newvert; \ + if (IS_NEGATIVE(dp)) { \ + /* Going out of bounds. Avoid division by zero as we \ + * know dp != dpPrev from DIFFERENT_SIGNS, above. \ + */ \ + GLfloat t = dp / (dp - dpPrev); \ + INTERP_4F( t, coord[newvert], coord[idx], coord[idxPrev]); \ + interp( ctx, t, newvert, idx, idxPrev, GL_TRUE ); \ + } else { \ + /* Coming back in. \ + */ \ + GLfloat t = dpPrev / (dpPrev - dp); \ + INTERP_4F( t, coord[newvert], coord[idxPrev], coord[idx]); \ + interp( ctx, t, newvert, idxPrev, idx, GL_FALSE ); \ + } \ + } \ + \ + idxPrev = idx; \ + dpPrev = dp; \ + } \ + \ + if (outcount < 3) \ + return; \ + \ + { \ + GLuint *tmp = inlist; \ + inlist = outlist; \ + outlist = tmp; \ + n = outcount; \ + } \ + } \ +} while (0) + + +#define LINE_CLIP(PLANE, A, B, C, D ) \ +do { \ + if (mask & PLANE) { \ + GLfloat dpI = CLIP_DOTPROD( ii, A, B, C, D ); \ + GLfloat dpJ = CLIP_DOTPROD( jj, A, B, C, D ); \ + \ + if (DIFFERENT_SIGNS(dpI, dpJ)) { \ + GLuint newvert = VB->LastClipped++; \ + VB->ClipMask[newvert] = 0; \ + if (IS_NEGATIVE(dpJ)) { \ + GLfloat t = dpI / (dpI - dpJ); \ + VB->ClipMask[jj] |= PLANE; \ + INTERP_4F( t, coord[newvert], coord[ii], coord[jj] ); \ + interp( ctx, t, newvert, ii, jj, GL_FALSE ); \ + jj = newvert; \ + } else { \ + GLfloat t = dpJ / (dpJ - dpI); \ + VB->ClipMask[ii] |= PLANE; \ + INTERP_4F( t, coord[newvert], coord[jj], coord[ii] ); \ + interp( ctx, t, newvert, jj, ii, GL_FALSE ); \ + ii = newvert; \ + } \ + } \ + else if (IS_NEGATIVE(dpI)) \ + return; \ + } \ +} while (0) + + + +/* Clip a line against the viewport and user clip planes. + */ +static INLINE void +TAG(clip_line)( GLcontext *ctx, GLuint i, GLuint j, GLubyte mask ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + tnl_interp_func interp = tnl->Driver.Render.Interp; + GLfloat (*coord)[4] = VB->ClipPtr->data; + GLuint ii = i, jj = j, p; + + VB->LastClipped = VB->Count; + + if (mask & 0x3f) { + LINE_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); + LINE_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); + LINE_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 ); + LINE_CLIP( CLIP_BOTTOM_BIT, 0, 1, 0, 1 ); + LINE_CLIP( CLIP_FAR_BIT, 0, 0, -1, 1 ); + LINE_CLIP( CLIP_NEAR_BIT, 0, 0, 1, 1 ); + } + + if (mask & CLIP_USER_BIT) { + for (p=0;pTransform.ClipPlanesEnabled & (1 << p)) { + const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + LINE_CLIP( CLIP_USER_BIT, a, b, c, d ); + } + } + } + + if ((ctx->_TriangleCaps & DD_FLATSHADE) && j != jj) + tnl->Driver.Render.CopyPV( ctx, jj, j ); + + tnl->Driver.Render.ClippedLine( ctx, ii, jj ); +} + + +/* Clip a triangle against the viewport and user clip planes. + */ +static INLINE void +TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + tnl_interp_func interp = tnl->Driver.Render.Interp; + GLfloat (*coord)[4] = VB->ClipPtr->data; + GLuint pv = v2; + GLuint vlist[2][MAX_CLIPPED_VERTICES]; + GLuint *inlist = vlist[0], *outlist = vlist[1]; + GLuint p; + GLubyte *clipmask = VB->ClipMask; + GLuint n = 3; + + ASSIGN_3V(inlist, v2, v0, v1 ); /* pv rotated to slot zero */ + + VB->LastClipped = VB->Count; + + if (mask & 0x3f) { + POLY_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); + POLY_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); + POLY_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 ); + POLY_CLIP( CLIP_BOTTOM_BIT, 0, 1, 0, 1 ); + POLY_CLIP( CLIP_FAR_BIT, 0, 0, -1, 1 ); + POLY_CLIP( CLIP_NEAR_BIT, 0, 0, 1, 1 ); + } + + if (mask & CLIP_USER_BIT) { + for (p=0;pTransform.ClipPlanesEnabled & (1 << p)) { + const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + POLY_CLIP( CLIP_USER_BIT, a, b, c, d ); + } + } + } + + if (ctx->_TriangleCaps & DD_FLATSHADE) { + if (pv != inlist[0]) { + ASSERT( inlist[0] >= VB->Count ); + tnl->Driver.Render.CopyPV( ctx, inlist[0], pv ); + } + } + + tnl->Driver.Render.ClippedPolygon( ctx, inlist, n ); +} + + +/* Clip a quad against the viewport and user clip planes. + */ +static INLINE void +TAG(clip_quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, + GLubyte mask ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + tnl_interp_func interp = tnl->Driver.Render.Interp; + GLfloat (*coord)[4] = VB->ClipPtr->data; + GLuint pv = v3; + GLuint vlist[2][MAX_CLIPPED_VERTICES]; + GLuint *inlist = vlist[0], *outlist = vlist[1]; + GLuint p; + GLubyte *clipmask = VB->ClipMask; + GLuint n = 4; + + ASSIGN_4V(inlist, v3, v0, v1, v2 ); /* pv rotated to slot zero */ + + VB->LastClipped = VB->Count; + + if (mask & 0x3f) { + POLY_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); + POLY_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); + POLY_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 ); + POLY_CLIP( CLIP_BOTTOM_BIT, 0, 1, 0, 1 ); + POLY_CLIP( CLIP_FAR_BIT, 0, 0, -1, 1 ); + POLY_CLIP( CLIP_NEAR_BIT, 0, 0, 1, 1 ); + } + + if (mask & CLIP_USER_BIT) { + for (p=0;pTransform.ClipPlanesEnabled & (1 << p)) { + const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + POLY_CLIP( CLIP_USER_BIT, a, b, c, d ); + } + } + } + + if (ctx->_TriangleCaps & DD_FLATSHADE) { + if (pv != inlist[0]) { + ASSERT( inlist[0] >= VB->Count ); + tnl->Driver.Render.CopyPV( ctx, inlist[0], pv ); + } + } + + tnl->Driver.Render.ClippedPolygon( ctx, inlist, n ); +} + +#undef W +#undef Z +#undef Y +#undef X +#undef SIZE +#undef TAG +#undef POLY_CLIP +#undef LINE_CLIP diff --git a/reactos/dll/mesa32/src/tnl/t_vb_cull.c b/reactos/dll/mesa32/src/tnl/t_vb_cull.c new file mode 100644 index 00000000000..3f12945707f --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_cull.c @@ -0,0 +1,97 @@ +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "imports.h" +#include "mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + + + +/* EXT_vertex_cull. Not really a big win, but probably depends on + * your application. This stage not included in the default pipeline. + */ +static GLboolean run_cull_stage( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + + const GLfloat a = ctx->Transform.CullObjPos[0]; + const GLfloat b = ctx->Transform.CullObjPos[1]; + const GLfloat c = ctx->Transform.CullObjPos[2]; + GLfloat *norm = (GLfloat *)VB->NormalPtr->data; + GLuint stride = VB->NormalPtr->stride; + GLuint count = VB->Count; + GLuint i; + + if (ctx->VertexProgram._Enabled || + !ctx->Transform.CullVertexFlag) + return GL_TRUE; + + VB->ClipOrMask &= ~CLIP_CULL_BIT; + VB->ClipAndMask |= CLIP_CULL_BIT; + + for (i = 0 ; i < count ; i++) { + GLfloat dp = (norm[0] * a + + norm[1] * b + + norm[2] * c); + + if (dp < 0) { + VB->ClipMask[i] |= CLIP_CULL_BIT; + VB->ClipOrMask |= CLIP_CULL_BIT; + } + else { + VB->ClipMask[i] &= ~CLIP_CULL_BIT; + VB->ClipAndMask &= ~CLIP_CULL_BIT; + } + + STRIDE_F(norm, stride); + } + + return !(VB->ClipAndMask & CLIP_CULL_BIT); +} + + + +const struct tnl_pipeline_stage _tnl_vertex_cull_stage = +{ + "EXT_cull_vertex", + NULL, /* private data */ + NULL, /* ctr */ + NULL, /* destructor */ + NULL, + run_cull_stage /* run -- initially set to init */ +}; diff --git a/reactos/dll/mesa32/src/tnl/t_vb_fog.c b/reactos/dll/mesa32/src/tnl/t_vb_fog.c new file mode 100644 index 00000000000..f1d01bc47f9 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_fog.c @@ -0,0 +1,266 @@ +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "imports.h" +#include "mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + + +struct fog_stage_data { + GLvector4f fogcoord; /* has actual storage allocated */ + GLvector4f input; /* points into VB->EyePtr Z values */ +}; + +#define FOG_STAGE_DATA(stage) ((struct fog_stage_data *)stage->privatePtr) + +#define FOG_EXP_TABLE_SIZE 256 +#define FOG_MAX (10.0) +#define EXP_FOG_MAX .0006595 +#define FOG_INCR (FOG_MAX/FOG_EXP_TABLE_SIZE) +static GLfloat exp_table[FOG_EXP_TABLE_SIZE]; +static GLfloat inited = 0; + +#if 1 +#define NEG_EXP( result, narg ) \ +do { \ + GLfloat f = (GLfloat) (narg * (1.0/FOG_INCR)); \ + GLint k = (GLint) f; \ + if (k > FOG_EXP_TABLE_SIZE-2) \ + result = (GLfloat) EXP_FOG_MAX; \ + else \ + result = exp_table[k] + (f-k)*(exp_table[k+1]-exp_table[k]); \ +} while (0) +#else +#define NEG_EXP( result, narg ) \ +do { \ + result = exp(-narg); \ +} while (0) +#endif + + +/** + * Initialize the exp_table[] lookup table for approximating exp(). + */ +static void +init_static_data( void ) +{ + GLfloat f = 0.0F; + GLint i = 0; + for ( ; i < FOG_EXP_TABLE_SIZE ; i++, f += FOG_INCR) { + exp_table[i] = EXPF(-f); + } + inited = 1; +} + + +/** + * Compute per-vertex fog blend factors from fog coordinates by + * evaluating the GL_LINEAR, GL_EXP or GL_EXP2 fog function. + * Fog coordinates are distances from the eye (typically between the + * near and far clip plane distances). + * Note the fog (eye Z) coords may be negative so we use ABS(z) below. + * Fog blend factors are in the range [0,1]. + */ +static void +compute_fog_blend_factors(GLcontext *ctx, GLvector4f *out, const GLvector4f *in) +{ + GLfloat end = ctx->Fog.End; + GLfloat *v = in->start; + GLuint stride = in->stride; + GLuint n = in->count; + GLfloat (*data)[4] = out->data; + GLfloat d; + GLuint i; + + out->count = in->count; + + switch (ctx->Fog.Mode) { + case GL_LINEAR: + if (ctx->Fog.Start == ctx->Fog.End) + d = 1.0F; + else + d = 1.0F / (ctx->Fog.End - ctx->Fog.Start); + for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { + const GLfloat z = FABSF(*v); + GLfloat f = (end - z) * d; + data[i][0] = CLAMP(f, 0.0F, 1.0F); + } + break; + case GL_EXP: + d = ctx->Fog.Density; + for ( i = 0 ; i < n ; i++, STRIDE_F(v,stride)) { + const GLfloat z = FABSF(*v); + NEG_EXP( data[i][0], d * z ); + } + break; + case GL_EXP2: + d = ctx->Fog.Density*ctx->Fog.Density; + for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { + const GLfloat z = FABSF(*v); + NEG_EXP( data[i][0], d * z * z ); + } + break; + default: + _mesa_problem(ctx, "Bad fog mode in make_fog_coord"); + return; + } +} + + +static GLboolean +run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + struct fog_stage_data *store = FOG_STAGE_DATA(stage); + GLvector4f *input; + + if (!ctx->Fog.Enabled || ctx->VertexProgram._Enabled) + return GL_TRUE; + + + if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) { + /* Fog is computed from vertex or fragment Z values */ + /* source = VB->ObjPtr or VB->EyePtr coords */ + /* dest = VB->FogCoordPtr = fog stage private storage */ + VB->FogCoordPtr = &store->fogcoord; + + if (!ctx->_NeedEyeCoords) { + /* compute fog coords from object coords */ + const GLfloat *m = ctx->ModelviewMatrixStack.Top->m; + GLfloat plane[4]; + + /* Use this to store calculated eye z values: + */ + input = &store->fogcoord; + + /* NOTE: negate plane here so we get positive fog coords! */ + plane[0] = -m[2]; + plane[1] = -m[6]; + plane[2] = -m[10]; + plane[3] = -m[14]; + /* Full eye coords weren't required, just calculate the + * eye Z values. + */ + _mesa_dotprod_tab[VB->ObjPtr->size]( (GLfloat *) input->data, + 4 * sizeof(GLfloat), + VB->ObjPtr, plane ); + + input->count = VB->ObjPtr->count; + } + else { + /* fog coordinates = eye Z coordinates (use ABS later) */ + input = &store->input; + + if (VB->EyePtr->size < 2) + _mesa_vector4f_clean_elem( VB->EyePtr, VB->Count, 2 ); + + input->data = (GLfloat (*)[4]) &(VB->EyePtr->data[0][2]); + input->start = VB->EyePtr->start+2; + input->stride = VB->EyePtr->stride; + input->count = VB->EyePtr->count; + } + } + else { + /* use glFogCoord() coordinates */ + input = VB->FogCoordPtr; /* source data */ + + /* input->count may be one if glFogCoord was only called once + * before glBegin. But we need to compute fog for all vertices. + */ + input->count = VB->ObjPtr->count; + + VB->FogCoordPtr = &store->fogcoord; /* dest data */ + } + + if (tnl->_DoVertexFog) { + /* compute blend factors from fog coordinates */ + compute_fog_blend_factors( ctx, VB->FogCoordPtr, input ); + } + else { + /* results = incoming fog coords (compute fog per-fragment later) */ + VB->FogCoordPtr = input; + } + + VB->AttribPtr[_TNL_ATTRIB_FOG] = VB->FogCoordPtr; + return GL_TRUE; +} + + + +/* Called the first time stage->run() is invoked. + */ +static GLboolean +alloc_fog_data(GLcontext *ctx, struct tnl_pipeline_stage *stage) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct fog_stage_data *store; + stage->privatePtr = MALLOC(sizeof(*store)); + store = FOG_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + _mesa_vector4f_alloc( &store->fogcoord, 0, tnl->vb.Size, 32 ); + _mesa_vector4f_init( &store->input, 0, NULL ); + + if (!inited) + init_static_data(); + + return GL_TRUE; +} + + +static void +free_fog_data(struct tnl_pipeline_stage *stage) +{ + struct fog_stage_data *store = FOG_STAGE_DATA(stage); + if (store) { + _mesa_vector4f_free( &store->fogcoord ); + FREE( store ); + stage->privatePtr = NULL; + } +} + + +const struct tnl_pipeline_stage _tnl_fog_coordinate_stage = +{ + "build fog coordinates", /* name */ + NULL, /* private_data */ + alloc_fog_data, /* dtr */ + free_fog_data, /* dtr */ + NULL, /* check */ + run_fog_stage /* run -- initially set to init. */ +}; diff --git a/reactos/dll/mesa32/src/tnl/t_vb_light.c b/reactos/dll/mesa32/src/tnl/t_vb_light.c new file mode 100644 index 00000000000..1deab4d43a6 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_light.c @@ -0,0 +1,362 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + + + +#include "glheader.h" +#include "colormac.h" +#include "light.h" +#include "macros.h" +#include "imports.h" +#include "simple_list.h" +#include "mtypes.h" + +#include "math/m_translate.h" + +#include "t_context.h" +#include "t_pipeline.h" + +#define LIGHT_TWOSIDE 0x1 +#define LIGHT_MATERIAL 0x2 +#define MAX_LIGHT_FUNC 0x4 + +typedef void (*light_func)( GLcontext *ctx, + struct vertex_buffer *VB, + struct tnl_pipeline_stage *stage, + GLvector4f *input ); + +/** + * Information for updating current material attributes from vertex color, + * for GL_COLOR_MATERIAL. + */ +struct material_cursor { + const GLfloat *ptr; /* points to src vertex color (in VB array) */ + GLuint stride; /* stride to next vertex color (bytes) */ + GLfloat *current; /* points to material attribute to update */ + GLuint size; /* vertex/color size: 1, 2, 3 or 4 */ +}; + +/** + * Data private to this pipeline stage. + */ +struct light_stage_data { + GLvector4f Input; + GLvector4f LitColor[2]; + GLvector4f LitSecondary[2]; + GLvector4f LitIndex[2]; + light_func *light_func_tab; + + struct material_cursor mat[MAT_ATTRIB_MAX]; + GLuint mat_count; + GLuint mat_bitmask; +}; + + +#define LIGHT_STAGE_DATA(stage) ((struct light_stage_data *)(stage->privatePtr)) + + + +/** + * In the case of colormaterial, the effected material attributes + * should already have been bound to point to the incoming color data, + * prior to running the pipeline. + * This function copies the vertex's color to the material attributes + * which are tracking glColor. + * It's called per-vertex in the lighting loop. + */ +static void +update_materials(GLcontext *ctx, struct light_stage_data *store) +{ + GLuint i; + + for (i = 0 ; i < store->mat_count ; i++) { + /* update the material */ + COPY_CLEAN_4V(store->mat[i].current, store->mat[i].size, store->mat[i].ptr); + /* increment src vertex color pointer */ + STRIDE_F(store->mat[i].ptr, store->mat[i].stride); + } + + /* recompute derived light/material values */ + _mesa_update_material( ctx, store->mat_bitmask ); + /* XXX we should only call this if we're tracking/changing the specular + * exponent. + */ + _mesa_validate_all_lighting_tables( ctx ); +} + + +/** + * Prepare things prior to running the lighting stage. + * Return number of material attributes which will track vertex color. + */ +static GLuint +prepare_materials(GLcontext *ctx, + struct vertex_buffer *VB, struct light_stage_data *store) +{ + GLuint i; + + store->mat_count = 0; + store->mat_bitmask = 0; + + /* Examine the ColorMaterialBitmask to determine which materials + * track vertex color. Override the material attribute's pointer + * with the color pointer for each one. + */ + if (ctx->Light.ColorMaterialEnabled) { + const GLuint bitmask = ctx->Light.ColorMaterialBitmask; + for (i = 0 ; i < MAT_ATTRIB_MAX ; i++) + if (bitmask & (1<AttribPtr[_TNL_ATTRIB_MAT_FRONT_AMBIENT + i] = VB->ColorPtr[0]; + } + + /* Now, for each material attribute that's tracking vertex color, save + * some values (ptr, stride, size, current) that we'll need in + * update_materials(), above, that'll actually copy the vertex color to + * the material attribute(s). + */ + for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT ; i < _TNL_ATTRIB_INDEX ; i++) { + if (VB->AttribPtr[i]->stride) { + const GLuint j = store->mat_count++; + const GLuint attr = i - _TNL_ATTRIB_MAT_FRONT_AMBIENT; + store->mat[j].ptr = VB->AttribPtr[i]->start; + store->mat[j].stride = VB->AttribPtr[i]->stride; + store->mat[j].size = VB->AttribPtr[i]->size; + store->mat[j].current = ctx->Light.Material.Attrib[attr]; + store->mat_bitmask |= (1<mat_count; +} + +/* Tables for all the shading functions. + */ +static light_func _tnl_light_tab[MAX_LIGHT_FUNC]; +static light_func _tnl_light_fast_tab[MAX_LIGHT_FUNC]; +static light_func _tnl_light_fast_single_tab[MAX_LIGHT_FUNC]; +static light_func _tnl_light_spec_tab[MAX_LIGHT_FUNC]; +static light_func _tnl_light_ci_tab[MAX_LIGHT_FUNC]; + +#define TAG(x) x +#define IDX (0) +#include "t_vb_lighttmp.h" + +#define TAG(x) x##_twoside +#define IDX (LIGHT_TWOSIDE) +#include "t_vb_lighttmp.h" + +#define TAG(x) x##_material +#define IDX (LIGHT_MATERIAL) +#include "t_vb_lighttmp.h" + +#define TAG(x) x##_twoside_material +#define IDX (LIGHT_TWOSIDE|LIGHT_MATERIAL) +#include "t_vb_lighttmp.h" + + +static void init_lighting_tables( void ) +{ + static int done; + + if (!done) { + init_light_tab(); + init_light_tab_twoside(); + init_light_tab_material(); + init_light_tab_twoside_material(); + done = 1; + } +} + + +static GLboolean run_lighting( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct light_stage_data *store = LIGHT_STAGE_DATA(stage); + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + GLvector4f *input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->ObjPtr; + GLuint idx; + + if (!ctx->Light.Enabled || ctx->VertexProgram._Enabled) + return GL_TRUE; + + /* Make sure we can talk about position x,y and z: + */ + if (input->size <= 2 && input == VB->ObjPtr) { + + _math_trans_4f( store->Input.data, + VB->ObjPtr->data, + VB->ObjPtr->stride, + GL_FLOAT, + VB->ObjPtr->size, + 0, + VB->Count ); + + if (input->size <= 2) { + /* Clean z. + */ + _mesa_vector4f_clean_elem(&store->Input, VB->Count, 2); + } + + if (input->size <= 1) { + /* Clean y. + */ + _mesa_vector4f_clean_elem(&store->Input, VB->Count, 1); + } + + input = &store->Input; + } + + idx = 0; + + if (prepare_materials( ctx, VB, store )) + idx |= LIGHT_MATERIAL; + + if (ctx->Light.Model.TwoSide) + idx |= LIGHT_TWOSIDE; + + /* The individual functions know about replaying side-effects + * vs. full re-execution. + */ + store->light_func_tab[idx]( ctx, VB, stage, input ); + + VB->AttribPtr[_TNL_ATTRIB_COLOR0] = VB->ColorPtr[0]; + VB->AttribPtr[_TNL_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0]; + VB->AttribPtr[_TNL_ATTRIB_INDEX] = VB->IndexPtr[0]; + + return GL_TRUE; +} + + +/* Called in place of do_lighting when the light table may have changed. + */ +static void validate_lighting( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) +{ + light_func *tab; + + if (!ctx->Light.Enabled || ctx->VertexProgram._Enabled) + return; + + if (ctx->Visual.rgbMode) { + if (ctx->Light._NeedVertices) { + if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) + tab = _tnl_light_spec_tab; + else + tab = _tnl_light_tab; + } + else { + if (ctx->Light.EnabledList.next == ctx->Light.EnabledList.prev) + tab = _tnl_light_fast_single_tab; + else + tab = _tnl_light_fast_tab; + } + } + else + tab = _tnl_light_ci_tab; + + + LIGHT_STAGE_DATA(stage)->light_func_tab = tab; + + /* This and the above should only be done on _NEW_LIGHT: + */ + TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx ); +} + + + +/* Called the first time stage->run is called. In effect, don't + * allocate data until the first time the stage is run. + */ +static GLboolean init_lighting( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct light_stage_data *store; + GLuint size = tnl->vb.Size; + + stage->privatePtr = MALLOC(sizeof(*store)); + store = LIGHT_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + /* Do onetime init. + */ + init_lighting_tables(); + + _mesa_vector4f_alloc( &store->Input, 0, size, 32 ); + _mesa_vector4f_alloc( &store->LitColor[0], 0, size, 32 ); + _mesa_vector4f_alloc( &store->LitColor[1], 0, size, 32 ); + _mesa_vector4f_alloc( &store->LitSecondary[0], 0, size, 32 ); + _mesa_vector4f_alloc( &store->LitSecondary[1], 0, size, 32 ); + _mesa_vector4f_alloc( &store->LitIndex[0], 0, size, 32 ); + _mesa_vector4f_alloc( &store->LitIndex[1], 0, size, 32 ); + + store->LitColor[0].size = 4; + store->LitColor[1].size = 4; + store->LitSecondary[0].size = 3; + store->LitSecondary[1].size = 3; + + store->LitIndex[0].size = 1; + store->LitIndex[0].stride = sizeof(GLfloat); + store->LitIndex[1].size = 1; + store->LitIndex[1].stride = sizeof(GLfloat); + + return GL_TRUE; +} + + + + +static void dtr( struct tnl_pipeline_stage *stage ) +{ + struct light_stage_data *store = LIGHT_STAGE_DATA(stage); + + if (store) { + _mesa_vector4f_free( &store->Input ); + _mesa_vector4f_free( &store->LitColor[0] ); + _mesa_vector4f_free( &store->LitColor[1] ); + _mesa_vector4f_free( &store->LitSecondary[0] ); + _mesa_vector4f_free( &store->LitSecondary[1] ); + _mesa_vector4f_free( &store->LitIndex[0] ); + _mesa_vector4f_free( &store->LitIndex[1] ); + FREE( store ); + stage->privatePtr = NULL; + } +} + +const struct tnl_pipeline_stage _tnl_lighting_stage = +{ + "lighting", /* name */ + NULL, /* private_data */ + init_lighting, + dtr, /* destroy */ + validate_lighting, + run_lighting +}; diff --git a/reactos/dll/mesa32/src/tnl/t_vb_lighttmp.h b/reactos/dll/mesa32/src/tnl/t_vb_lighttmp.h new file mode 100644 index 00000000000..a27f708421e --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_lighttmp.h @@ -0,0 +1,824 @@ +/* + * 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 + * Keith Whitwell + */ + + +#if IDX & LIGHT_TWOSIDE +# define NR_SIDES 2 +#else +# define NR_SIDES 1 +#endif + + +/* define TRACE to trace lighting code */ +/* #define TRACE 1 */ + +/* + * ctx is the current context + * VB is the vertex buffer + * stage is the lighting stage-private data + * input is the vector of eye or object-space vertex coordinates + */ +static void TAG(light_rgba_spec)( GLcontext *ctx, + struct vertex_buffer *VB, + struct tnl_pipeline_stage *stage, + GLvector4f *input ) +{ + struct light_stage_data *store = LIGHT_STAGE_DATA(stage); + GLfloat (*base)[3] = ctx->Light._BaseColor; + GLfloat sumA[2]; + GLuint j; + + const GLuint vstride = input->stride; + const GLfloat *vertex = (GLfloat *)input->data; + const GLuint nstride = VB->NormalPtr->stride; + const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; + + GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data; + GLfloat (*Fspec)[4] = (GLfloat (*)[4]) store->LitSecondary[0].data; +#if IDX & LIGHT_TWOSIDE + GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data; + GLfloat (*Bspec)[4] = (GLfloat (*)[4]) store->LitSecondary[1].data; +#endif + + const GLuint nr = VB->Count; + +#ifdef TRACE + fprintf(stderr, "%s\n", __FUNCTION__ ); +#endif + + VB->ColorPtr[0] = &store->LitColor[0]; + VB->SecondaryColorPtr[0] = &store->LitSecondary[0]; + sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; + +#if IDX & LIGHT_TWOSIDE + VB->ColorPtr[1] = &store->LitColor[1]; + VB->SecondaryColorPtr[1] = &store->LitSecondary[1]; + sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; +#endif + + + store->LitColor[0].stride = 16; + store->LitColor[1].stride = 16; + + for (j = 0; j < nr; j++,STRIDE_F(vertex,vstride),STRIDE_F(normal,nstride)) { + GLfloat sum[2][3], spec[2][3]; + struct gl_light *light; + +#if IDX & LIGHT_MATERIAL + update_materials( ctx, store ); + sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; +#if IDX & LIGHT_TWOSIDE + sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; +#endif +#endif + + COPY_3V(sum[0], base[0]); + ZERO_3V(spec[0]); + +#if IDX & LIGHT_TWOSIDE + COPY_3V(sum[1], base[1]); + ZERO_3V(spec[1]); +#endif + + /* Add contribution from each enabled light source */ + foreach (light, &ctx->Light.EnabledList) { + GLfloat n_dot_h; + GLfloat correction; + GLint side; + GLfloat contrib[3]; + GLfloat attenuation; + GLfloat VP[3]; /* unit vector from vertex to light */ + GLfloat n_dot_VP; /* n dot VP */ + GLfloat *h; + + /* compute VP and attenuation */ + if (!(light->_Flags & LIGHT_POSITIONAL)) { + /* directional light */ + COPY_3V(VP, light->_VP_inf_norm); + attenuation = light->_VP_inf_spot_attenuation; + } + else { + GLfloat d; /* distance from vertex to light */ + + SUB_3V(VP, light->_Position, vertex); + + d = (GLfloat) LEN_3FV( VP ); + + if (d > 1e-6) { + GLfloat invd = 1.0F / d; + SELF_SCALE_SCALAR_3V(VP, invd); + } + + attenuation = 1.0F / (light->ConstantAttenuation + d * + (light->LinearAttenuation + d * + light->QuadraticAttenuation)); + + /* spotlight attenuation */ + if (light->_Flags & LIGHT_SPOT) { + GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + + if (PV_dot_dir_CosCutoff) { + continue; /* this light makes no contribution */ + } + else { + GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1); + GLint k = (GLint) x; + GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] + + (x-k)*light->_SpotExpTable[k][1]); + attenuation *= spot; + } + } + } + + if (attenuation < 1e-3) + continue; /* this light makes no contribution */ + + /* Compute dot product or normal and vector from V to light pos */ + n_dot_VP = DOT3( normal, VP ); + + /* Which side gets the diffuse & specular terms? */ + if (n_dot_VP < 0.0F) { + ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]); +#if IDX & LIGHT_TWOSIDE + side = 1; + correction = -1; + n_dot_VP = -n_dot_VP; +#else + continue; +#endif + } + else { +#if IDX & LIGHT_TWOSIDE + ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]); +#endif + side = 0; + correction = 1; + } + + /* diffuse term */ + COPY_3V(contrib, light->_MatAmbient[side]); + ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]); + ACC_SCALE_SCALAR_3V(sum[side], attenuation, contrib ); + + /* specular term - cannibalize VP... */ + if (ctx->Light.Model.LocalViewer) { + GLfloat v[3]; + COPY_3V(v, vertex); + NORMALIZE_3FV(v); + SUB_3V(VP, VP, v); /* h = VP + VPe */ + h = VP; + NORMALIZE_3FV(h); + } + else if (light->_Flags & LIGHT_POSITIONAL) { + h = VP; + ACC_3V(h, ctx->_EyeZDir); + NORMALIZE_3FV(h); + } + else { + h = light->_h_inf_norm; + } + + n_dot_h = correction * DOT3(normal, h); + + if (n_dot_h > 0.0F) { + GLfloat spec_coef; + struct gl_shine_tab *tab = ctx->_ShineTable[side]; + GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef ); + + if (spec_coef > 1.0e-10) { + spec_coef *= attenuation; + ACC_SCALE_SCALAR_3V( spec[side], spec_coef, + light->_MatSpecular[side]); + } + } + } /*loop over lights*/ + + COPY_3V( Fcolor[j], sum[0] ); + COPY_3V( Fspec[j], spec[0] ); + Fcolor[j][3] = sumA[0]; + +#if IDX & LIGHT_TWOSIDE + COPY_3V( Bcolor[j], sum[1] ); + COPY_3V( Bspec[j], spec[1] ); + Bcolor[j][3] = sumA[1]; +#endif + } +} + + +static void TAG(light_rgba)( GLcontext *ctx, + struct vertex_buffer *VB, + struct tnl_pipeline_stage *stage, + GLvector4f *input ) +{ + struct light_stage_data *store = LIGHT_STAGE_DATA(stage); + GLuint j; + + GLfloat (*base)[3] = ctx->Light._BaseColor; + GLfloat sumA[2]; + + const GLuint vstride = input->stride; + const GLfloat *vertex = (GLfloat *) input->data; + const GLuint nstride = VB->NormalPtr->stride; + const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; + + GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data; +#if IDX & LIGHT_TWOSIDE + GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data; +#endif + + const GLuint nr = VB->Count; + +#ifdef TRACE + fprintf(stderr, "%s\n", __FUNCTION__ ); +#endif + + VB->ColorPtr[0] = &store->LitColor[0]; + sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; + +#if IDX & LIGHT_TWOSIDE + VB->ColorPtr[1] = &store->LitColor[1]; + sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; +#endif + + store->LitColor[0].stride = 16; + store->LitColor[1].stride = 16; + + for (j = 0; j < nr; j++,STRIDE_F(vertex,vstride),STRIDE_F(normal,nstride)) { + GLfloat sum[2][3]; + struct gl_light *light; + +#if IDX & LIGHT_MATERIAL + update_materials( ctx, store ); + sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; +#if IDX & LIGHT_TWOSIDE + sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; +#endif +#endif + + COPY_3V(sum[0], base[0]); + +#if IDX & LIGHT_TWOSIDE + COPY_3V(sum[1], base[1]); +#endif + + /* Add contribution from each enabled light source */ + foreach (light, &ctx->Light.EnabledList) { + + GLfloat n_dot_h; + GLfloat correction; + GLint side; + GLfloat contrib[3]; + GLfloat attenuation = 1.0; + GLfloat VP[3]; /* unit vector from vertex to light */ + GLfloat n_dot_VP; /* n dot VP */ + GLfloat *h; + + /* compute VP and attenuation */ + if (!(light->_Flags & LIGHT_POSITIONAL)) { + /* directional light */ + COPY_3V(VP, light->_VP_inf_norm); + attenuation = light->_VP_inf_spot_attenuation; + } + else { + GLfloat d; /* distance from vertex to light */ + + + SUB_3V(VP, light->_Position, vertex); + + d = (GLfloat) LEN_3FV( VP ); + + if ( d > 1e-6) { + GLfloat invd = 1.0F / d; + SELF_SCALE_SCALAR_3V(VP, invd); + } + + attenuation = 1.0F / (light->ConstantAttenuation + d * + (light->LinearAttenuation + d * + light->QuadraticAttenuation)); + + /* spotlight attenuation */ + if (light->_Flags & LIGHT_SPOT) { + GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + + if (PV_dot_dir_CosCutoff) { + continue; /* this light makes no contribution */ + } + else { + GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1); + GLint k = (GLint) x; + GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] + + (x-k)*light->_SpotExpTable[k][1]); + attenuation *= spot; + } + } + } + + if (attenuation < 1e-3) + continue; /* this light makes no contribution */ + + /* Compute dot product or normal and vector from V to light pos */ + n_dot_VP = DOT3( normal, VP ); + + /* which side are we lighting? */ + if (n_dot_VP < 0.0F) { + ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]); +#if IDX & LIGHT_TWOSIDE + side = 1; + correction = -1; + n_dot_VP = -n_dot_VP; +#else + continue; +#endif + } + else { +#if IDX & LIGHT_TWOSIDE + ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]); +#endif + side = 0; + correction = 1; + } + + COPY_3V(contrib, light->_MatAmbient[side]); + + /* diffuse term */ + ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]); + + /* specular term - cannibalize VP... */ + { + if (ctx->Light.Model.LocalViewer) { + GLfloat v[3]; + COPY_3V(v, vertex); + NORMALIZE_3FV(v); + SUB_3V(VP, VP, v); /* h = VP + VPe */ + h = VP; + NORMALIZE_3FV(h); + } + else if (light->_Flags & LIGHT_POSITIONAL) { + h = VP; + ACC_3V(h, ctx->_EyeZDir); + NORMALIZE_3FV(h); + } + else { + h = light->_h_inf_norm; + } + + n_dot_h = correction * DOT3(normal, h); + + if (n_dot_h > 0.0F) + { + GLfloat spec_coef; + struct gl_shine_tab *tab = ctx->_ShineTable[side]; + + GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef ); + + ACC_SCALE_SCALAR_3V( contrib, spec_coef, + light->_MatSpecular[side]); + } + } + + ACC_SCALE_SCALAR_3V( sum[side], attenuation, contrib ); + } + + COPY_3V( Fcolor[j], sum[0] ); + Fcolor[j][3] = sumA[0]; + +#if IDX & LIGHT_TWOSIDE + COPY_3V( Bcolor[j], sum[1] ); + Bcolor[j][3] = sumA[1]; +#endif + } +} + + + + +/* As below, but with just a single light. + */ +static void TAG(light_fast_rgba_single)( GLcontext *ctx, + struct vertex_buffer *VB, + struct tnl_pipeline_stage *stage, + GLvector4f *input ) + +{ + struct light_stage_data *store = LIGHT_STAGE_DATA(stage); + const GLuint nstride = VB->NormalPtr->stride; + const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; + GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data; +#if IDX & LIGHT_TWOSIDE + GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data; +#endif + const struct gl_light *light = ctx->Light.EnabledList.next; + GLuint j = 0; + GLfloat base[2][4]; +#if IDX & LIGHT_MATERIAL + const GLuint nr = VB->Count; +#else + const GLuint nr = VB->NormalPtr->count; +#endif + +#ifdef TRACE + fprintf(stderr, "%s\n", __FUNCTION__ ); +#endif + + (void) input; /* doesn't refer to Eye or Obj */ + + VB->ColorPtr[0] = &store->LitColor[0]; +#if IDX & LIGHT_TWOSIDE + VB->ColorPtr[1] = &store->LitColor[1]; +#endif + + if (nr > 1) { + store->LitColor[0].stride = 16; + store->LitColor[1].stride = 16; + } + else { + store->LitColor[0].stride = 0; + store->LitColor[1].stride = 0; + } + + for (j = 0; j < nr; j++, STRIDE_F(normal,nstride)) { + + GLfloat n_dot_VP; + +#if IDX & LIGHT_MATERIAL + update_materials( ctx, store ); +#endif + + /* No attenuation, so incoporate _MatAmbient into base color. + */ +#if !(IDX & LIGHT_MATERIAL) + if ( j == 0 ) +#endif + { + COPY_3V(base[0], light->_MatAmbient[0]); + ACC_3V(base[0], ctx->Light._BaseColor[0] ); + base[0][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; + +#if IDX & LIGHT_TWOSIDE + COPY_3V(base[1], light->_MatAmbient[1]); + ACC_3V(base[1], ctx->Light._BaseColor[1]); + base[1][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; +#endif + } + + n_dot_VP = DOT3(normal, light->_VP_inf_norm); + + if (n_dot_VP < 0.0F) { +#if IDX & LIGHT_TWOSIDE + GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm); + GLfloat sum[3]; + COPY_3V(sum, base[1]); + ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->_MatDiffuse[1]); + if (n_dot_h > 0.0F) { + GLfloat spec; + GET_SHINE_TAB_ENTRY( ctx->_ShineTable[1], n_dot_h, spec ); + ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[1]); + } + COPY_3V(Bcolor[j], sum ); + Bcolor[j][3] = base[1][3]; +#endif + COPY_4FV(Fcolor[j], base[0]); + } + else { + GLfloat n_dot_h = DOT3(normal, light->_h_inf_norm); + GLfloat sum[3]; + COPY_3V(sum, base[0]); + ACC_SCALE_SCALAR_3V(sum, n_dot_VP, light->_MatDiffuse[0]); + if (n_dot_h > 0.0F) { + GLfloat spec; + GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec ); + ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[0]); + + } + COPY_3V(Fcolor[j], sum ); + Fcolor[j][3] = base[0][3]; +#if IDX & LIGHT_TWOSIDE + COPY_4FV(Bcolor[j], base[1]); +#endif + } + } +} + + +/* Light infinite lights + */ +static void TAG(light_fast_rgba)( GLcontext *ctx, + struct vertex_buffer *VB, + struct tnl_pipeline_stage *stage, + GLvector4f *input ) +{ + struct light_stage_data *store = LIGHT_STAGE_DATA(stage); + GLfloat sumA[2]; + const GLuint nstride = VB->NormalPtr->stride; + const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; + GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data; +#if IDX & LIGHT_TWOSIDE + GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data; +#endif + GLuint j = 0; +#if IDX & LIGHT_MATERIAL + const GLuint nr = VB->Count; +#else + const GLuint nr = VB->NormalPtr->count; +#endif + const struct gl_light *light; + +#ifdef TRACE + fprintf(stderr, "%s %d\n", __FUNCTION__, nr ); +#endif + + (void) input; + + sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; + sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; + + VB->ColorPtr[0] = &store->LitColor[0]; +#if IDX & LIGHT_TWOSIDE + VB->ColorPtr[1] = &store->LitColor[1]; +#endif + + if (nr > 1) { + store->LitColor[0].stride = 16; + store->LitColor[1].stride = 16; + } + else { + store->LitColor[0].stride = 0; + store->LitColor[1].stride = 0; + } + + for (j = 0; j < nr; j++, STRIDE_F(normal,nstride)) { + + GLfloat sum[2][3]; + +#if IDX & LIGHT_MATERIAL + update_materials( ctx, store ); + + sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; +#if IDX & LIGHT_TWOSIDE + sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; +#endif +#endif + + + COPY_3V(sum[0], ctx->Light._BaseColor[0]); +#if IDX & LIGHT_TWOSIDE + COPY_3V(sum[1], ctx->Light._BaseColor[1]); +#endif + + foreach (light, &ctx->Light.EnabledList) { + GLfloat n_dot_h, n_dot_VP, spec; + + ACC_3V(sum[0], light->_MatAmbient[0]); +#if IDX & LIGHT_TWOSIDE + ACC_3V(sum[1], light->_MatAmbient[1]); +#endif + + n_dot_VP = DOT3(normal, light->_VP_inf_norm); + + if (n_dot_VP > 0.0F) { + ACC_SCALE_SCALAR_3V(sum[0], n_dot_VP, light->_MatDiffuse[0]); + n_dot_h = DOT3(normal, light->_h_inf_norm); + if (n_dot_h > 0.0F) { + struct gl_shine_tab *tab = ctx->_ShineTable[0]; + GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec ); + ACC_SCALE_SCALAR_3V( sum[0], spec, light->_MatSpecular[0]); + } + } +#if IDX & LIGHT_TWOSIDE + else { + ACC_SCALE_SCALAR_3V(sum[1], -n_dot_VP, light->_MatDiffuse[1]); + n_dot_h = -DOT3(normal, light->_h_inf_norm); + if (n_dot_h > 0.0F) { + struct gl_shine_tab *tab = ctx->_ShineTable[1]; + GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec ); + ACC_SCALE_SCALAR_3V( sum[1], spec, light->_MatSpecular[1]); + } + } +#endif + } + + COPY_3V( Fcolor[j], sum[0] ); + Fcolor[j][3] = sumA[0]; + +#if IDX & LIGHT_TWOSIDE + COPY_3V( Bcolor[j], sum[1] ); + Bcolor[j][3] = sumA[1]; +#endif + } +} + + + + + +/* + * Use current lighting/material settings to compute the color indexes + * for an array of vertices. + * Input: n - number of vertices to light + * side - 0=use front material, 1=use back material + * vertex - array of [n] vertex position in eye coordinates + * normal - array of [n] surface normal vector + * Output: indexResult - resulting array of [n] color indexes + */ +static void TAG(light_ci)( GLcontext *ctx, + struct vertex_buffer *VB, + struct tnl_pipeline_stage *stage, + GLvector4f *input ) +{ + struct light_stage_data *store = LIGHT_STAGE_DATA(stage); + GLuint j; + const GLuint vstride = input->stride; + const GLfloat *vertex = (GLfloat *) input->data; + const GLuint nstride = VB->NormalPtr->stride; + const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; + GLfloat *indexResult[2]; + const GLuint nr = VB->Count; + +#ifdef TRACE + fprintf(stderr, "%s\n", __FUNCTION__ ); +#endif + + VB->IndexPtr[0] = &store->LitIndex[0]; +#if IDX & LIGHT_TWOSIDE + VB->IndexPtr[1] = &store->LitIndex[1]; +#endif + + indexResult[0] = (GLfloat *)VB->IndexPtr[0]->data; +#if IDX & LIGHT_TWOSIDE + indexResult[1] = (GLfloat *)VB->IndexPtr[1]->data; +#endif + + /* loop over vertices */ + for (j=0; jLight.EnabledList) { + + GLfloat attenuation = 1.0F; + GLfloat VP[3]; /* unit vector from vertex to light */ + GLfloat n_dot_VP; /* dot product of l and n */ + GLfloat *h, n_dot_h, correction = 1.0; + + /* compute l and attenuation */ + if (!(light->_Flags & LIGHT_POSITIONAL)) { + /* directional light */ + COPY_3V(VP, light->_VP_inf_norm); + } + else { + GLfloat d; /* distance from vertex to light */ + + SUB_3V(VP, light->_Position, vertex); + + d = (GLfloat) LEN_3FV( VP ); + if ( d > 1e-6) { + GLfloat invd = 1.0F / d; + SELF_SCALE_SCALAR_3V(VP, invd); + } + + attenuation = 1.0F / (light->ConstantAttenuation + d * + (light->LinearAttenuation + d * + light->QuadraticAttenuation)); + + /* spotlight attenuation */ + if (light->_Flags & LIGHT_SPOT) { + GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + if (PV_dot_dir < light->_CosCutoff) { + continue; /* this light makes no contribution */ + } + else { + GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1); + GLint k = (GLint) x; + GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] + + (x-k)*light->_SpotExpTable[k][1]); + attenuation *= spot; + } + } + } + + if (attenuation < 1e-3) + continue; /* this light makes no contribution */ + + n_dot_VP = DOT3( normal, VP ); + + /* which side are we lighting? */ + if (n_dot_VP < 0.0F) { +#if IDX & LIGHT_TWOSIDE + side = 1; + correction = -1; + n_dot_VP = -n_dot_VP; +#else + continue; +#endif + } + + /* accumulate diffuse term */ + diffuse[side] += n_dot_VP * light->_dli * attenuation; + + /* specular term */ + if (ctx->Light.Model.LocalViewer) { + GLfloat v[3]; + COPY_3V(v, vertex); + NORMALIZE_3FV(v); + SUB_3V(VP, VP, v); /* h = VP + VPe */ + h = VP; + NORMALIZE_3FV(h); + } + else if (light->_Flags & LIGHT_POSITIONAL) { + h = VP; + /* Strangely, disabling this addition fixes a conformance + * problem. If this code is enabled, l_sed.c fails. + */ + /*ACC_3V(h, ctx->_EyeZDir);*/ + NORMALIZE_3FV(h); + } + else { + h = light->_h_inf_norm; + } + + n_dot_h = correction * DOT3(normal, h); + if (n_dot_h > 0.0F) { + GLfloat spec_coef; + struct gl_shine_tab *tab = ctx->_ShineTable[side]; + GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef); + specular[side] += spec_coef * light->_sli * attenuation; + } + } /*loop over lights*/ + + /* Now compute final color index */ + for (side = 0 ; side < NR_SIDES ; side++) { + const GLfloat *ind = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_INDEXES + side]; + GLfloat index; + + if (specular[side] > 1.0F) { + index = ind[MAT_INDEX_SPECULAR]; + } + else { + GLfloat d_a = ind[MAT_INDEX_DIFFUSE] - ind[MAT_INDEX_AMBIENT]; + GLfloat s_a = ind[MAT_INDEX_SPECULAR] - ind[MAT_INDEX_AMBIENT]; + index = (ind[MAT_INDEX_AMBIENT] + + diffuse[side] * (1.0F-specular[side]) * d_a + + specular[side] * s_a); + if (index > ind[MAT_INDEX_SPECULAR]) { + index = ind[MAT_INDEX_SPECULAR]; + } + } + indexResult[side][j] = index; + } + } /*for vertex*/ +} + + + +static void TAG(init_light_tab)( void ) +{ + _tnl_light_tab[IDX] = TAG(light_rgba); + _tnl_light_fast_tab[IDX] = TAG(light_fast_rgba); + _tnl_light_fast_single_tab[IDX] = TAG(light_fast_rgba_single); + _tnl_light_spec_tab[IDX] = TAG(light_rgba_spec); + _tnl_light_ci_tab[IDX] = TAG(light_ci); +} + + +#undef TAG +#undef IDX +#undef NR_SIDES diff --git a/reactos/dll/mesa32/src/tnl/t_vb_normals.c b/reactos/dll/mesa32/src/tnl/t_vb_normals.c new file mode 100644 index 00000000000..7ac33f8bec4 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_normals.c @@ -0,0 +1,189 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + * + * Authors: + * Keith Whitwell + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "imports.h" +#include "mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + + +struct normal_stage_data { + normal_func NormalTransform; + GLvector4f normal; +}; + +#define NORMAL_STAGE_DATA(stage) ((struct normal_stage_data *)stage->privatePtr) + + +static GLboolean +run_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) +{ + struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + const GLfloat *lengths; + + if (!store->NormalTransform) + return GL_TRUE; + + /* We can only use the display list's saved normal lengths if we've + * got a transformation matrix with uniform scaling. + */ + if (_math_matrix_is_general_scale(ctx->ModelviewMatrixStack.Top)) + lengths = NULL; + else + lengths = VB->NormalLengthPtr; + + store->NormalTransform( ctx->ModelviewMatrixStack.Top, + ctx->_ModelViewInvScale, + VB->NormalPtr, /* input normals */ + lengths, + &store->normal ); /* resulting normals */ + + if (VB->NormalPtr->count > 1) { + store->normal.stride = 4 * sizeof(GLfloat); + } + else { + store->normal.stride = 0; + } + + VB->NormalPtr = &store->normal; + VB->AttribPtr[_TNL_ATTRIB_NORMAL] = VB->NormalPtr; + + VB->NormalLengthPtr = NULL; /* no longer valid */ + return GL_TRUE; +} + + +/** + * Examine current GL state and set the store->NormalTransform pointer + * to point to the appropriate normal transformation routine. + */ +static void +validate_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) +{ + struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); + + if (ctx->VertexProgram._Enabled || + (!ctx->Light.Enabled && + !(ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS))) { + store->NormalTransform = NULL; + return; + } + + if (ctx->_NeedEyeCoords) { + /* Eye coordinates are needed, for whatever reasons. + * Do lighting in eye coordinates, as the GL spec says. + */ + GLuint transform = NORM_TRANSFORM_NO_ROT; + + if (_math_matrix_has_rotation(ctx->ModelviewMatrixStack.Top)) { + /* need to do full (3x3) matrix transform */ + transform = NORM_TRANSFORM; + } + + if (ctx->Transform.Normalize) { + store->NormalTransform = _mesa_normal_tab[transform | NORM_NORMALIZE]; + } + else if (ctx->Transform.RescaleNormals && + ctx->_ModelViewInvScale != 1.0) { + store->NormalTransform = _mesa_normal_tab[transform | NORM_RESCALE]; + } + else { + store->NormalTransform = _mesa_normal_tab[transform]; + } + } + else { + /* We don't need eye coordinates. + * Do lighting in object coordinates. Thus, we don't need to fully + * transform normal vectors (just leave them in object coordinates) + * but we still need to do normalization/rescaling if enabled. + */ + if (ctx->Transform.Normalize) { + store->NormalTransform = _mesa_normal_tab[NORM_NORMALIZE]; + } + else if (!ctx->Transform.RescaleNormals && + ctx->_ModelViewInvScale != 1.0) { + store->NormalTransform = _mesa_normal_tab[NORM_RESCALE]; + } + else { + store->NormalTransform = NULL; + } + } +} + + +/** + * Allocate stage's private data (storage for transformed normals). + */ +static GLboolean +alloc_normal_data(GLcontext *ctx, struct tnl_pipeline_stage *stage) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct normal_stage_data *store; + + stage->privatePtr = _mesa_malloc(sizeof(*store)); + store = NORMAL_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + _mesa_vector4f_alloc( &store->normal, 0, tnl->vb.Size, 32 ); + return GL_TRUE; +} + + +/** + * Free stage's private data. + */ +static void +free_normal_data(struct tnl_pipeline_stage *stage) +{ + struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); + if (store) { + _mesa_vector4f_free( &store->normal ); + _mesa_free( store ); + stage->privatePtr = NULL; + } +} + + +const struct tnl_pipeline_stage _tnl_normal_transform_stage = +{ + "normal transform", /* name */ + NULL, /* privatePtr */ + alloc_normal_data, /* create */ + free_normal_data, /* destroy */ + validate_normal_stage, /* validate */ + run_normal_stage /* run */ +}; diff --git a/reactos/dll/mesa32/src/tnl/t_vb_points.c b/reactos/dll/mesa32/src/tnl/t_vb_points.c new file mode 100644 index 00000000000..47c37930d57 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_points.c @@ -0,0 +1,111 @@ +/* + * 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. + * + * Authors: + * Brian Paul + */ + +#include "mtypes.h" +#include "imports.h" +#include "t_context.h" +#include "t_pipeline.h" + + +struct point_stage_data { + GLvector4f PointSize; +}; + +#define POINT_STAGE_DATA(stage) ((struct point_stage_data *)stage->privatePtr) + + +/** + * Compute point size for each vertex from the vertex eye-space Z + * coordinate and the point size attenuation factors. + * Only done when point size attenuation is enabled and vertex program is + * disabled. + */ +static GLboolean +run_point_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) +{ + if (ctx->Point._Attenuated && !ctx->VertexProgram._Enabled) { + struct point_stage_data *store = POINT_STAGE_DATA(stage); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + const GLfloat (*eye)[4] = (const GLfloat (*)[4]) VB->EyePtr->data; + const GLfloat p0 = ctx->Point.Params[0]; + const GLfloat p1 = ctx->Point.Params[1]; + const GLfloat p2 = ctx->Point.Params[2]; + const GLfloat pointSize = ctx->Point.Size; + GLfloat (*size)[4] = store->PointSize.data; + GLuint i; + + for (i = 0; i < VB->Count; i++) { + const GLfloat dist = FABSF(eye[i][2]); + const GLfloat q = p0 + dist * (p1 + dist * p2); + const GLfloat atten = (q != 0.0) ? SQRTF(1.0 / q) : 1.0; + size[i][0] = pointSize * atten; /* clamping done in rasterization */ + } + + VB->PointSizePtr = &store->PointSize; + VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->PointSize; + } + + return GL_TRUE; +} + + +static GLboolean +alloc_point_data(GLcontext *ctx, struct tnl_pipeline_stage *stage) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct point_stage_data *store; + stage->privatePtr = _mesa_malloc(sizeof(*store)); + store = POINT_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + _mesa_vector4f_alloc( &store->PointSize, 0, VB->Size, 32 ); + return GL_TRUE; +} + + +static void +free_point_data(struct tnl_pipeline_stage *stage) +{ + struct point_stage_data *store = POINT_STAGE_DATA(stage); + if (store) { + _mesa_vector4f_free( &store->PointSize ); + _mesa_free( store ); + stage->privatePtr = NULL; + } +} + + +const struct tnl_pipeline_stage _tnl_point_attenuation_stage = +{ + "point size attenuation", /* name */ + NULL, /* stage private data */ + alloc_point_data, /* alloc data */ + free_point_data, /* destructor */ + NULL, + run_point_stage /* run */ +}; diff --git a/reactos/dll/mesa32/src/tnl/t_vb_program.c b/reactos/dll/mesa32/src/tnl/t_vb_program.c new file mode 100644 index 00000000000..d77f5424c14 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_program.c @@ -0,0 +1,281 @@ +/* + * 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. + */ + + +/** + * \file tnl/t_vb_program.c + * \brief Pipeline stage for executing NVIDIA vertex programs. + * \author Brian Paul, Keith Whitwell + */ + + +#include "glheader.h" +#include "api_noop.h" +#include "colormac.h" +#include "context.h" +#include "dlist.h" +#include "hash.h" +#include "light.h" +#include "macros.h" +#include "imports.h" +#include "simple_list.h" +#include "mtypes.h" +#include "nvvertprog.h" +#include "nvvertexec.h" +#include "nvprogram.h" + +#include "math/m_translate.h" + +#include "t_context.h" +#include "t_pipeline.h" + + + +/*! + * Private storage for the vertex program pipeline stage. + */ +struct vp_stage_data { + /** The results of running the vertex program go into these arrays. */ + GLvector4f attribs[15]; + + GLvector4f ndcCoords; /**< normalized device coords */ + GLubyte *clipmask; /**< clip flags */ + GLubyte ormask, andmask; /**< for clipping */ +}; + + +#define VP_STAGE_DATA(stage) ((struct vp_stage_data *)(stage->privatePtr)) + + +/** + * This function executes vertex programs + */ +static GLboolean +run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vp_stage_data *store = VP_STAGE_DATA(stage); + struct vertex_buffer *VB = &tnl->vb; + struct vertex_program *program = ctx->VertexProgram.Current; + GLuint i; + + if (!ctx->VertexProgram._Enabled || + !program->IsNVProgram) + return GL_TRUE; + + /* load program parameter registers (they're read-only) */ + _mesa_init_vp_per_primitive_registers(ctx); + + for (i = 0; i < VB->Count; i++) { + GLuint attr; + + _mesa_init_vp_per_vertex_registers(ctx); + +#if 0 + printf("Input %d: %f, %f, %f, %f\n", i, + VB->AttribPtr[0]->data[i][0], + VB->AttribPtr[0]->data[i][1], + VB->AttribPtr[0]->data[i][2], + VB->AttribPtr[0]->data[i][3]); + printf(" color: %f, %f, %f, %f\n", + VB->AttribPtr[3]->data[i][0], + VB->AttribPtr[3]->data[i][1], + VB->AttribPtr[3]->data[i][2], + VB->AttribPtr[3]->data[i][3]); + printf(" normal: %f, %f, %f, %f\n", + VB->AttribPtr[2]->data[i][0], + VB->AttribPtr[2]->data[i][1], + VB->AttribPtr[2]->data[i][2], + VB->AttribPtr[2]->data[i][3]); +#endif + + /* the vertex array case */ + for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { + if (program->InputsRead & (1 << attr)) { + const GLubyte *ptr = (const GLubyte*) VB->AttribPtr[attr]->data; + const GLuint size = VB->AttribPtr[attr]->size; + const GLuint stride = VB->AttribPtr[attr]->stride; + const GLfloat *data = (GLfloat *) (ptr + stride * i); + COPY_CLEAN_4V(ctx->VertexProgram.Inputs[attr], size, data); + } + } + + /* execute the program */ + ASSERT(program); + _mesa_exec_vertex_program(ctx, program); + + /* Fixup fog an point size results if needed */ + if (ctx->Fog.Enabled && + (program->OutputsWritten & (1 << VERT_RESULT_FOGC)) == 0) { + ctx->VertexProgram.Outputs[VERT_RESULT_FOGC][0] = 1.0; + } + + if (ctx->VertexProgram.PointSizeEnabled && + (program->OutputsWritten & (1 << VERT_RESULT_PSIZ)) == 0) { + ctx->VertexProgram.Outputs[VERT_RESULT_PSIZ][0] = ctx->Point.Size; + } + + /* copy the output registers into the VB->attribs arrays */ + /* XXX (optimize) could use a conditional and smaller loop limit here */ + for (attr = 0; attr < 15; attr++) { + COPY_4V(store->attribs[attr].data[i], + ctx->VertexProgram.Outputs[attr]); + } + } + + /* Setup the VB pointers so that the next pipeline stages get + * their data from the right place (the program output arrays). + */ + VB->ClipPtr = &store->attribs[VERT_RESULT_HPOS]; + VB->ClipPtr->size = 4; + VB->ClipPtr->count = VB->Count; + VB->ColorPtr[0] = &store->attribs[VERT_RESULT_COL0]; + VB->ColorPtr[1] = &store->attribs[VERT_RESULT_BFC0]; + VB->SecondaryColorPtr[0] = &store->attribs[VERT_RESULT_COL1]; + VB->SecondaryColorPtr[1] = &store->attribs[VERT_RESULT_BFC1]; + VB->FogCoordPtr = &store->attribs[VERT_RESULT_FOGC]; + VB->PointSizePtr = &store->attribs[VERT_RESULT_PSIZ]; + + VB->AttribPtr[VERT_ATTRIB_COLOR0] = VB->ColorPtr[0]; + VB->AttribPtr[VERT_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0]; + VB->AttribPtr[VERT_ATTRIB_FOG] = VB->FogCoordPtr; + VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->attribs[VERT_RESULT_PSIZ]; + + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { + VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] = + &store->attribs[VERT_RESULT_TEX0 + i]; + } + + + + /* Cliptest and perspective divide. Clip functions must clear + * the clipmask. + */ + store->ormask = 0; + store->andmask = CLIP_ALL_BITS; + + if (tnl->NeedNdcCoords) { + VB->NdcPtr = + _mesa_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, + &store->ndcCoords, + store->clipmask, + &store->ormask, + &store->andmask ); + } + else { + VB->NdcPtr = NULL; + _mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr, + NULL, + store->clipmask, + &store->ormask, + &store->andmask ); + } + + if (store->andmask) /* All vertices are outside the frustum */ + return GL_FALSE; + + + /* This is where we'd do clip testing against the user-defined + * clipping planes, but they're not supported by vertex programs. + */ + + VB->ClipOrMask = store->ormask; + VB->ClipMask = store->clipmask; + + return GL_TRUE; +} + + + + +/** + * Called the first time stage->run is called. In effect, don't + * allocate data until the first time the stage is run. + */ +static GLboolean init_vp( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &(tnl->vb); + struct vp_stage_data *store; + const GLuint size = VB->Size; + GLuint i; + + stage->privatePtr = MALLOC(sizeof(*store)); + store = VP_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + /* Allocate arrays of vertex output values */ + for (i = 0; i < 15; i++) { + _mesa_vector4f_alloc( &store->attribs[i], 0, size, 32 ); + store->attribs[i].size = 4; + } + + /* a few other misc allocations */ + _mesa_vector4f_alloc( &store->ndcCoords, 0, size, 32 ); + store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); + + return GL_TRUE; +} + + + + + +/** + * Destructor for this pipeline stage. + */ +static void dtr( struct tnl_pipeline_stage *stage ) +{ + struct vp_stage_data *store = VP_STAGE_DATA(stage); + + if (store) { + GLuint i; + + /* free the vertex program result arrays */ + for (i = 0; i < VERT_RESULT_MAX; i++) + _mesa_vector4f_free( &store->attribs[i] ); + + /* free misc arrays */ + _mesa_vector4f_free( &store->ndcCoords ); + ALIGN_FREE( store->clipmask ); + + FREE( store ); + stage->privatePtr = NULL; + } +} + +/** + * Public description of this pipeline stage. + */ +const struct tnl_pipeline_stage _tnl_vertex_program_stage = +{ + "vertex-program", + NULL, /* private_data */ + init_vp, /* create */ + dtr, /* destroy */ + NULL, /* validate */ + run_vp /* run -- initially set to ctr */ +}; diff --git a/reactos/dll/mesa32/src/tnl/t_vb_render.c b/reactos/dll/mesa32/src/tnl/t_vb_render.c new file mode 100644 index 00000000000..8c92ac0db9e --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_render.c @@ -0,0 +1,352 @@ + +/* + * 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: + * Keith Whitwell + */ + + +/* + * Render whole vertex buffers, including projection of vertices from + * clip space and clipping of primitives. + * + * This file makes calls to project vertices and to the point, line + * and triangle rasterizers via the function pointers: + * + * context->Driver.Render.* + * + */ + + +#include "glheader.h" +#include "context.h" +#include "enums.h" +#include "macros.h" +#include "imports.h" +#include "mtypes.h" +#include "nvfragprog.h" +#include "math/m_matrix.h" +#include "math/m_xform.h" + +#include "t_pipeline.h" + + + +/**********************************************************************/ +/* Clip single primitives */ +/**********************************************************************/ + + +#define W(i) coord[i][3] +#define Z(i) coord[i][2] +#define Y(i) coord[i][1] +#define X(i) coord[i][0] +#define SIZE 4 +#define TAG(x) x##_4 +#include "t_vb_cliptmp.h" + + + +/**********************************************************************/ +/* Clip and render whole begin/end objects */ +/**********************************************************************/ + +#define NEED_EDGEFLAG_SETUP (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) +#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] +#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val + + +#define CLIPMASK (CLIP_ALL_BITS|CLIP_CULL_BIT) + + +/* Vertices, with the possibility of clipping. + */ +#define RENDER_POINTS( start, count ) \ + tnl->Driver.Render.Points( ctx, start, count ) + +#define RENDER_LINE( v1, v2 ) \ +do { \ + GLubyte c1 = mask[v1], c2 = mask[v2]; \ + GLubyte ormask = c1|c2; \ + if (!ormask) \ + LineFunc( ctx, v1, v2 ); \ + else if (!(c1 & c2 & CLIPMASK)) \ + clip_line_4( ctx, v1, v2, ormask ); \ +} while (0) + +#define RENDER_TRI( v1, v2, v3 ) \ +do { \ + GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \ + GLubyte ormask = c1|c2|c3; \ + if (!ormask) \ + TriangleFunc( ctx, v1, v2, v3 ); \ + else if (!(c1 & c2 & c3 & CLIPMASK)) \ + clip_tri_4( ctx, v1, v2, v3, ormask ); \ +} while (0) + +#define RENDER_QUAD( v1, v2, v3, v4 ) \ +do { \ + GLubyte c1 = mask[v1], c2 = mask[v2]; \ + GLubyte c3 = mask[v3], c4 = mask[v4]; \ + GLubyte ormask = c1|c2|c3|c4; \ + if (!ormask) \ + QuadFunc( ctx, v1, v2, v3, v4 ); \ + else if (!(c1 & c2 & c3 & c4 & CLIPMASK)) \ + clip_quad_4( ctx, v1, v2, v3, v4, ormask ); \ +} while (0) + + +#define LOCAL_VARS \ + TNLcontext *tnl = TNL_CONTEXT(ctx); \ + struct vertex_buffer *VB = &tnl->vb; \ + const GLuint * const elt = VB->Elts; \ + const GLubyte *mask = VB->ClipMask; \ + const GLuint sz = VB->ClipPtr->size; \ + const tnl_line_func LineFunc = tnl->Driver.Render.Line; \ + const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ + const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \ + const GLboolean stipple = ctx->Line.StippleFlag; \ + (void) (LineFunc && TriangleFunc && QuadFunc); \ + (void) elt; (void) mask; (void) sz; (void) stipple; + +#define TAG(x) clip_##x##_verts +#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) +#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) +#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE +#define PRESERVE_VB_DEFS +#include "t_vb_rendertmp.h" + + + +/* Elts, with the possibility of clipping. + */ +#undef ELT +#undef TAG +#define ELT(x) elt[x] +#define TAG(x) clip_##x##_elts +#include "t_vb_rendertmp.h" + +/* TODO: do this for all primitives, verts and elts: + */ +static void clip_elt_triangles( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + tnl_render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES]; + struct vertex_buffer *VB = &tnl->vb; + const GLuint * const elt = VB->Elts; + GLubyte *mask = VB->ClipMask; + GLuint last = count-2; + GLuint j; + (void) flags; + + tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES ); + + for (j=start; j < last; j+=3 ) { + GLubyte c1 = mask[elt[j]]; + GLubyte c2 = mask[elt[j+1]]; + GLubyte c3 = mask[elt[j+2]]; + GLubyte ormask = c1|c2|c3; + if (ormask) { + if (start < j) + render_tris( ctx, start, j, 0 ); + if (!(c1&c2&c3&CLIPMASK)) + clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask ); + start = j+3; + } + } + + if (start < j) + render_tris( ctx, start, j, 0 ); +} + +/**********************************************************************/ +/* Render whole begin/end objects */ +/**********************************************************************/ + +#define NEED_EDGEFLAG_SETUP (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) +#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] +#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val + + +/* Vertices, no clipping. + */ +#define RENDER_POINTS( start, count ) \ + tnl->Driver.Render.Points( ctx, start, count ) + +#define RENDER_LINE( v1, v2 ) \ + LineFunc( ctx, v1, v2 ) + +#define RENDER_TRI( v1, v2, v3 ) \ + TriangleFunc( ctx, v1, v2, v3 ) + +#define RENDER_QUAD( v1, v2, v3, v4 ) \ + QuadFunc( ctx, v1, v2, v3, v4 ) + +#define TAG(x) _tnl_##x##_verts + +#define LOCAL_VARS \ + TNLcontext *tnl = TNL_CONTEXT(ctx); \ + struct vertex_buffer *VB = &tnl->vb; \ + const GLuint * const elt = VB->Elts; \ + const tnl_line_func LineFunc = tnl->Driver.Render.Line; \ + const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ + const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \ + const GLboolean stipple = ctx->Line.StippleFlag; \ + (void) (LineFunc && TriangleFunc && QuadFunc); \ + (void) elt; (void) stipple + +#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) +#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE +#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) +#define RENDER_TAB_QUALIFIER +#define PRESERVE_VB_DEFS +#include "t_vb_rendertmp.h" + + +/* Elts, no clipping. + */ +#undef ELT +#define TAG(x) _tnl_##x##_elts +#define ELT(x) elt[x] +#include "t_vb_rendertmp.h" + + +/**********************************************************************/ +/* Helper functions for drivers */ +/**********************************************************************/ + +void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + GLuint *tmp = VB->Elts; + + VB->Elts = (GLuint *)elts; + tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END ); + VB->Elts = tmp; +} + +void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + tnl->Driver.Render.Line( ctx, ii, jj ); +} + + + +/**********************************************************************/ +/* Clip and render whole vertex buffers */ +/**********************************************************************/ + + +static GLboolean run_render( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + tnl_render_func *tab; + GLint pass = 0; + + /* Allow the drivers to lock before projected verts are built so + * that window coordinates are guarenteed not to change before + * rendering. + */ + ASSERT(tnl->Driver.Render.Start); + + tnl->Driver.Render.Start( ctx ); + + ASSERT(tnl->Driver.Render.BuildVertices); + ASSERT(tnl->Driver.Render.PrimitiveNotify); + ASSERT(tnl->Driver.Render.Points); + ASSERT(tnl->Driver.Render.Line); + ASSERT(tnl->Driver.Render.Triangle); + ASSERT(tnl->Driver.Render.Quad); + ASSERT(tnl->Driver.Render.ResetLineStipple); + ASSERT(tnl->Driver.Render.Interp); + ASSERT(tnl->Driver.Render.CopyPV); + ASSERT(tnl->Driver.Render.ClippedLine); + ASSERT(tnl->Driver.Render.ClippedPolygon); + ASSERT(tnl->Driver.Render.Finish); + + tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 ); + + if (VB->ClipOrMask) { + tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts; + clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles; + } + else { + tab = (VB->Elts ? + tnl->Driver.Render.PrimTabElts : + tnl->Driver.Render.PrimTabVerts); + } + + do + { + GLuint i; + + for (i = 0 ; i < VB->PrimitiveCount ; i++) + { + GLuint prim = VB->Primitive[i].mode; + GLuint start = VB->Primitive[i].start; + GLuint length = VB->Primitive[i].count; + + assert((prim & PRIM_MODE_MASK) < GL_POLYGON+1); + + if (MESA_VERBOSE & VERBOSE_PRIMS) + _mesa_debug(NULL, "MESA prim %s %d..%d\n", + _mesa_lookup_enum_by_nr(prim & PRIM_MODE_MASK), + start, start+length); + + if (length) + tab[prim & PRIM_MODE_MASK]( ctx, start, start + length, prim ); + } + } while (tnl->Driver.Render.Multipass && + tnl->Driver.Render.Multipass( ctx, ++pass )); + + tnl->Driver.Render.Finish( ctx ); + + return GL_FALSE; /* finished the pipe */ +} + + +/**********************************************************************/ +/* Render pipeline stage */ +/**********************************************************************/ + + + + + +const struct tnl_pipeline_stage _tnl_render_stage = +{ + "render", /* name */ + NULL, /* private data */ + NULL, /* creator */ + NULL, /* destructor */ + NULL, /* validate */ + run_render /* run */ +}; diff --git a/reactos/dll/mesa32/src/tnl/t_vb_rendertmp.h b/reactos/dll/mesa32/src/tnl/t_vb_rendertmp.h new file mode 100644 index 00000000000..3db94bc0934 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_rendertmp.h @@ -0,0 +1,440 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + + +#ifndef POSTFIX +#define POSTFIX +#endif + +#ifndef INIT +#define INIT(x) +#endif + +#ifndef NEED_EDGEFLAG_SETUP +#define NEED_EDGEFLAG_SETUP 0 +#define EDGEFLAG_GET(a) 0 +#define EDGEFLAG_SET(a,b) (void)b +#endif + +#ifndef RESET_STIPPLE +#define RESET_STIPPLE +#endif + +#ifndef RESET_OCCLUSION +#define RESET_OCCLUSION +#endif + +#ifndef TEST_PRIM_END +#define TEST_PRIM_END(flags) (flags & PRIM_END) +#define TEST_PRIM_BEGIN(flags) (flags & PRIM_BEGIN) +#endif + +#ifndef ELT +#define ELT(x) x +#endif + +#ifndef RENDER_TAB_QUALIFIER +#define RENDER_TAB_QUALIFIER static +#endif + +static void TAG(render_points)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + (void) flags; + + RESET_OCCLUSION; + INIT(GL_POINTS); + RENDER_POINTS( start, count ); + POSTFIX; +} + +static void TAG(render_lines)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + GLuint j; + LOCAL_VARS; + (void) flags; + + RESET_OCCLUSION; + INIT(GL_LINES); + for (j=start+1; j + */ + +/* + * Regarding GL_NV_texgen_reflection: + * + * 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 "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "imports.h" +#include "mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + + +/*********************************************************************** + * Automatic texture coordinate generation (texgen) code. + */ + + +struct texgen_stage_data; + +typedef void (*texgen_func)( GLcontext *ctx, + struct texgen_stage_data *store, + GLuint unit); + + +struct texgen_stage_data { + + /* Per-texunit derived state. + */ + GLuint TexgenSize[MAX_TEXTURE_COORD_UNITS]; + texgen_func TexgenFunc[MAX_TEXTURE_COORD_UNITS]; + + /* Temporary values used in texgen. + */ + GLfloat (*tmp_f)[3]; + GLfloat *tmp_m; + + /* Buffered outputs of the stage. + */ + GLvector4f texcoord[MAX_TEXTURE_COORD_UNITS]; +}; + + +#define TEXGEN_STAGE_DATA(stage) ((struct texgen_stage_data *)stage->privatePtr) + + + +static GLuint all_bits[5] = { + 0, + VEC_SIZE_1, + VEC_SIZE_2, + VEC_SIZE_3, + VEC_SIZE_4, +}; + +#define VEC_SIZE_FLAGS (VEC_SIZE_1|VEC_SIZE_2|VEC_SIZE_3|VEC_SIZE_4) + +#define TEXGEN_NEED_M (TEXGEN_SPHERE_MAP) +#define TEXGEN_NEED_F (TEXGEN_SPHERE_MAP | \ + TEXGEN_REFLECTION_MAP_NV) + + + +static void build_m3( GLfloat f[][3], GLfloat m[], + const GLvector4f *normal, + const GLvector4f *eye ) +{ + GLuint stride = eye->stride; + GLfloat *coord = (GLfloat *)eye->start; + GLuint count = eye->count; + const GLfloat *norm = normal->start; + GLuint i; + + for (i=0;istride)) { + GLfloat u[3], two_nu, fx, fy, fz; + COPY_3V( u, coord ); + NORMALIZE_3FV( u ); + two_nu = 2.0F * DOT3(norm,u); + fx = f[i][0] = u[0] - norm[0] * two_nu; + fy = f[i][1] = u[1] - norm[1] * two_nu; + fz = f[i][2] = u[2] - norm[2] * two_nu; + m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); + if (m[i] != 0.0F) { + m[i] = 0.5F * _mesa_inv_sqrtf(m[i]); + } + } +} + + + +static void build_m2( GLfloat f[][3], GLfloat m[], + const GLvector4f *normal, + const GLvector4f *eye ) +{ + GLuint stride = eye->stride; + GLfloat *coord = eye->start; + GLuint count = eye->count; + + GLfloat *norm = normal->start; + GLuint i; + + for (i=0;istride)) { + GLfloat u[3], two_nu, fx, fy, fz; + COPY_2V( u, coord ); + u[2] = 0; + NORMALIZE_3FV( u ); + two_nu = 2.0F * DOT3(norm,u); + fx = f[i][0] = u[0] - norm[0] * two_nu; + fy = f[i][1] = u[1] - norm[1] * two_nu; + fz = f[i][2] = u[2] - norm[2] * two_nu; + m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); + if (m[i] != 0.0F) { + m[i] = 0.5F * _mesa_inv_sqrtf(m[i]); + } + } +} + + + +typedef void (*build_m_func)( GLfloat f[][3], + GLfloat m[], + const GLvector4f *normal, + const GLvector4f *eye ); + + +static build_m_func build_m_tab[5] = { + NULL, + NULL, + build_m2, + build_m3, + build_m3 +}; + + +/* This is unusual in that we respect the stride of the output vector + * (f). This allows us to pass in either a texcoord vector4f, or a + * temporary vector3f. + */ +static void build_f3( GLfloat *f, + GLuint fstride, + const GLvector4f *normal, + const GLvector4f *eye ) +{ + GLuint stride = eye->stride; + GLfloat *coord = eye->start; + GLuint count = eye->count; + + GLfloat *norm = normal->start; + GLuint i; + + for (i=0;istride); + } +} + + +static void build_f2( GLfloat *f, + GLuint fstride, + const GLvector4f *normal, + const GLvector4f *eye ) +{ + GLuint stride = eye->stride; + GLfloat *coord = eye->start; + GLuint count = eye->count; + GLfloat *norm = normal->start; + GLuint i; + + for (i=0;istride); + } +} + +typedef void (*build_f_func)( GLfloat *f, + GLuint fstride, + const GLvector4f *normal_vec, + const GLvector4f *eye ); + + + +/* Just treat 4-vectors as 3-vectors. + */ +static build_f_func build_f_tab[5] = { + NULL, + NULL, + build_f2, + build_f3, + build_f3 +}; + + + +/* Special case texgen functions. + */ +static void texgen_reflection_map_nv( GLcontext *ctx, + struct texgen_stage_data *store, + GLuint unit ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLvector4f *in = VB->TexCoordPtr[unit]; + GLvector4f *out = &store->texcoord[unit]; + + build_f_tab[VB->EyePtr->size]( out->start, + out->stride, + VB->NormalPtr, + VB->EyePtr ); + + out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3; + out->count = VB->Count; + out->size = MAX2(in->size, 3); + if (in->size == 4) + _mesa_copy_tab[0x8]( out, in ); +} + + + +static void texgen_normal_map_nv( GLcontext *ctx, + struct texgen_stage_data *store, + GLuint unit ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLvector4f *in = VB->TexCoordPtr[unit]; + GLvector4f *out = &store->texcoord[unit]; + GLvector4f *normal = VB->NormalPtr; + GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->start; + GLuint count = VB->Count; + GLuint i; + const GLfloat *norm = normal->start; + + for (i=0;istride)) { + texcoord[i][0] = norm[0]; + texcoord[i][1] = norm[1]; + texcoord[i][2] = norm[2]; + } + + + out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3; + out->count = count; + out->size = MAX2(in->size, 3); + if (in->size == 4) + _mesa_copy_tab[0x8]( out, in ); +} + + +static void texgen_sphere_map( GLcontext *ctx, + struct texgen_stage_data *store, + GLuint unit ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLvector4f *in = VB->TexCoordPtr[unit]; + GLvector4f *out = &store->texcoord[unit]; + GLfloat (*texcoord)[4] = (GLfloat (*)[4]) out->start; + GLuint count = VB->Count; + GLuint i; + GLfloat (*f)[3] = store->tmp_f; + GLfloat *m = store->tmp_m; + + (build_m_tab[VB->EyePtr->size])( store->tmp_f, + store->tmp_m, + VB->NormalPtr, + VB->EyePtr ); + + out->size = MAX2(in->size,2); + + for (i=0;icount = count; + out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_2; + if (in->size > 2) + _mesa_copy_tab[all_bits[in->size] & ~0x3]( out, in ); +} + + + +static void texgen( GLcontext *ctx, + struct texgen_stage_data *store, + GLuint unit ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + GLvector4f *in = VB->TexCoordPtr[unit]; + GLvector4f *out = &store->texcoord[unit]; + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + const GLvector4f *obj = VB->ObjPtr; + const GLvector4f *eye = VB->EyePtr; + const GLvector4f *normal = VB->NormalPtr; + const GLfloat *m = store->tmp_m; + const GLuint count = VB->Count; + GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data; + GLfloat (*f)[3] = store->tmp_f; + GLuint copy; + + if (texUnit->_GenFlags & TEXGEN_NEED_M) { + build_m_tab[eye->size]( store->tmp_f, store->tmp_m, normal, eye ); + } else if (texUnit->_GenFlags & TEXGEN_NEED_F) { + build_f_tab[eye->size]( (GLfloat *)store->tmp_f, 3, normal, eye ); + } + + + out->size = MAX2(in->size, store->TexgenSize[unit]); + out->flags |= (in->flags & VEC_SIZE_FLAGS) | texUnit->TexGenEnabled; + out->count = count; + + copy = (all_bits[in->size] & ~texUnit->TexGenEnabled); + if (copy) + _mesa_copy_tab[copy]( out, in ); + + if (texUnit->TexGenEnabled & S_BIT) { + GLuint i; + switch (texUnit->GenModeS) { + case GL_OBJECT_LINEAR: + _mesa_dotprod_tab[obj->size]( (GLfloat *)out->data, + sizeof(out->data[0]), obj, + texUnit->ObjectPlaneS ); + break; + case GL_EYE_LINEAR: + _mesa_dotprod_tab[eye->size]( (GLfloat *)out->data, + sizeof(out->data[0]), eye, + texUnit->EyePlaneS ); + break; + case GL_SPHERE_MAP: + for (i = 0; i < count; i++) + texcoord[i][0] = f[i][0] * m[i] + 0.5F; + break; + case GL_REFLECTION_MAP_NV: + for (i=0;istart; + for (i=0;istride)) { + texcoord[i][0] = norm[0]; + } + break; + } + default: + _mesa_problem(ctx, "Bad S texgen"); + } + } + + if (texUnit->TexGenEnabled & T_BIT) { + GLuint i; + switch (texUnit->GenModeT) { + case GL_OBJECT_LINEAR: + _mesa_dotprod_tab[obj->size]( &(out->data[0][1]), + sizeof(out->data[0]), obj, + texUnit->ObjectPlaneT ); + break; + case GL_EYE_LINEAR: + _mesa_dotprod_tab[eye->size]( &(out->data[0][1]), + sizeof(out->data[0]), eye, + texUnit->EyePlaneT ); + break; + case GL_SPHERE_MAP: + for (i = 0; i < count; i++) + texcoord[i][1] = f[i][1] * m[i] + 0.5F; + break; + case GL_REFLECTION_MAP_NV: + for (i=0;istart; + for (i=0;istride)) { + texcoord[i][1] = norm[1]; + } + break; + } + default: + _mesa_problem(ctx, "Bad T texgen"); + } + } + + if (texUnit->TexGenEnabled & R_BIT) { + GLuint i; + switch (texUnit->GenModeR) { + case GL_OBJECT_LINEAR: + _mesa_dotprod_tab[obj->size]( &(out->data[0][2]), + sizeof(out->data[0]), obj, + texUnit->ObjectPlaneR ); + break; + case GL_EYE_LINEAR: + _mesa_dotprod_tab[eye->size]( &(out->data[0][2]), + sizeof(out->data[0]), eye, + texUnit->EyePlaneR ); + break; + case GL_REFLECTION_MAP_NV: + for (i=0;istart; + for (i=0;istride)) { + texcoord[i][2] = norm[2]; + } + break; + } + default: + _mesa_problem(ctx, "Bad R texgen"); + } + } + + if (texUnit->TexGenEnabled & Q_BIT) { + switch (texUnit->GenModeQ) { + case GL_OBJECT_LINEAR: + _mesa_dotprod_tab[obj->size]( &(out->data[0][3]), + sizeof(out->data[0]), obj, + texUnit->ObjectPlaneQ ); + break; + case GL_EYE_LINEAR: + _mesa_dotprod_tab[eye->size]( &(out->data[0][3]), + sizeof(out->data[0]), eye, + texUnit->EyePlaneQ ); + break; + default: + _mesa_problem(ctx, "Bad Q texgen"); + } + } +} + + + + +static GLboolean run_texgen_stage( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); + GLuint i; + + if (!ctx->Texture._TexGenEnabled || ctx->VertexProgram._Enabled) + return GL_TRUE; + + for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; + + if (texUnit->TexGenEnabled) { + + store->TexgenFunc[i]( ctx, store, i ); + + VB->AttribPtr[VERT_ATTRIB_TEX0+i] = + VB->TexCoordPtr[i] = &store->texcoord[i]; + } + } + + return GL_TRUE; +} + + +static void validate_texgen_stage( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); + GLuint i; + + if (!ctx->Texture._TexGenEnabled || ctx->VertexProgram._Enabled) + return; + + for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; + + if (texUnit->TexGenEnabled) { + GLuint sz; + + if (texUnit->TexGenEnabled & Q_BIT) + sz = 4; + else if (texUnit->TexGenEnabled & R_BIT) + sz = 3; + else if (texUnit->TexGenEnabled & T_BIT) + sz = 2; + else + sz = 1; + + store->TexgenSize[i] = sz; + store->TexgenFunc[i] = texgen; /* general solution */ + + /* look for special texgen cases */ + if (texUnit->TexGenEnabled == (S_BIT|T_BIT|R_BIT)) { + if (texUnit->_GenFlags == TEXGEN_REFLECTION_MAP_NV) { + store->TexgenFunc[i] = texgen_reflection_map_nv; + } + else if (texUnit->_GenFlags == TEXGEN_NORMAL_MAP_NV) { + store->TexgenFunc[i] = texgen_normal_map_nv; + } + } + else if (texUnit->TexGenEnabled == (S_BIT|T_BIT) && + texUnit->_GenFlags == TEXGEN_SPHERE_MAP) { + store->TexgenFunc[i] = texgen_sphere_map; + } + } + } +} + + + + + +/* Called the first time stage->run() is invoked. + */ +static GLboolean alloc_texgen_data( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct texgen_stage_data *store; + GLuint i; + + stage->privatePtr = CALLOC(sizeof(*store)); + store = TEXGEN_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) + _mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 ); + + store->tmp_f = (GLfloat (*)[3]) MALLOC(VB->Size * sizeof(GLfloat) * 3); + store->tmp_m = (GLfloat *) MALLOC(VB->Size * sizeof(GLfloat)); + + return GL_TRUE; +} + + +static void free_texgen_data( struct tnl_pipeline_stage *stage ) + +{ + struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); + GLuint i; + + if (store) { + for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++) + if (store->texcoord[i].data) + _mesa_vector4f_free( &store->texcoord[i] ); + + + if (store->tmp_f) FREE( store->tmp_f ); + if (store->tmp_m) FREE( store->tmp_m ); + FREE( store ); + stage->privatePtr = NULL; + } +} + + + +const struct tnl_pipeline_stage _tnl_texgen_stage = +{ + "texgen", /* name */ + NULL, /* private data */ + alloc_texgen_data, /* destructor */ + free_texgen_data, /* destructor */ + validate_texgen_stage, /* check */ + run_texgen_stage /* run -- initially set to alloc data */ +}; diff --git a/reactos/dll/mesa32/src/tnl/t_vb_texmat.c b/reactos/dll/mesa32/src/tnl/t_vb_texmat.c new file mode 100644 index 00000000000..23475303853 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_texmat.c @@ -0,0 +1,130 @@ +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "imports.h" +#include "mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + +/* Is there any real benefit seperating texmat from texgen? It means + * we need two lots of intermediate storage. Any changes to + * _NEW_TEXTURE will invalidate both sets -- it's only on changes to + * *only* _NEW_TEXTURE_MATRIX that texgen survives but texmat doesn't. + * + * However, the seperation of this code from the complex texgen stuff + * is very appealing. + */ +struct texmat_stage_data { + GLvector4f texcoord[MAX_TEXTURE_COORD_UNITS]; +}; + +#define TEXMAT_STAGE_DATA(stage) ((struct texmat_stage_data *)stage->privatePtr) + + + +static GLboolean run_texmat_stage( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLuint i; + + if (!ctx->Texture._TexMatEnabled || ctx->VertexProgram._Enabled) + return GL_TRUE; + + /* ENABLE_TEXMAT implies that the texture matrix is not the + * identity, so we don't have to check that here. + */ + for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) { + if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) { + (void) TransformRaw( &store->texcoord[i], + ctx->TextureMatrixStack[i].Top, + VB->TexCoordPtr[i]); + + VB->AttribPtr[VERT_ATTRIB_TEX0+i] = + VB->TexCoordPtr[i] = &store->texcoord[i]; + } + } + + return GL_TRUE; +} + + +/* Called the first time stage->run() is invoked. + */ +static GLboolean alloc_texmat_data( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct texmat_stage_data *store; + GLuint i; + + stage->privatePtr = CALLOC(sizeof(*store)); + store = TEXMAT_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) + _mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 ); + + return GL_TRUE; +} + + +static void free_texmat_data( struct tnl_pipeline_stage *stage ) +{ + struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); + GLuint i; + + if (store) { + for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) + if (store->texcoord[i].data) + _mesa_vector4f_free( &store->texcoord[i] ); + FREE( store ); + stage->privatePtr = NULL; + } +} + + + +const struct tnl_pipeline_stage _tnl_texture_transform_stage = +{ + "texture transform", /* name */ + NULL, /* private data */ + alloc_texmat_data, + free_texmat_data, /* destructor */ + NULL, + run_texmat_stage, +}; diff --git a/reactos/dll/mesa32/src/tnl/t_vb_vertex.c b/reactos/dll/mesa32/src/tnl/t_vb_vertex.c new file mode 100644 index 00000000000..b3defaad05e --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vb_vertex.c @@ -0,0 +1,264 @@ +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "imports.h" +#include "mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + + + +struct vertex_stage_data { + GLvector4f eye; + GLvector4f clip; + GLvector4f proj; + GLubyte *clipmask; + GLubyte ormask; + GLubyte andmask; +}; + +#define VERTEX_STAGE_DATA(stage) ((struct vertex_stage_data *)stage->privatePtr) + + + + +/* This function implements cliptesting for user-defined clip planes. + * The clipping of primitives to these planes is implemented in + * t_render_clip.h. + */ +#define USER_CLIPTEST(NAME, SZ) \ +static void NAME( GLcontext *ctx, \ + GLvector4f *clip, \ + GLubyte *clipmask, \ + GLubyte *clipormask, \ + GLubyte *clipandmask ) \ +{ \ + GLuint p; \ + \ + for (p = 0; p < ctx->Const.MaxClipPlanes; p++) \ + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { \ + GLuint nr, i; \ + const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; \ + const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; \ + const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; \ + const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; \ + GLfloat *coord = (GLfloat *)clip->data; \ + GLuint stride = clip->stride; \ + GLuint count = clip->count; \ + \ + for (nr = 0, i = 0 ; i < count ; i++) { \ + GLfloat dp = coord[0] * a + coord[1] * b; \ + if (SZ > 2) dp += coord[2] * c; \ + if (SZ > 3) dp += coord[3] * d; else dp += d; \ + \ + if (dp < 0) { \ + nr++; \ + clipmask[i] |= CLIP_USER_BIT; \ + } \ + \ + STRIDE_F(coord, stride); \ + } \ + \ + if (nr > 0) { \ + *clipormask |= CLIP_USER_BIT; \ + if (nr == count) { \ + *clipandmask |= CLIP_USER_BIT; \ + return; \ + } \ + } \ + } \ +} + + +USER_CLIPTEST(userclip2, 2) +USER_CLIPTEST(userclip3, 3) +USER_CLIPTEST(userclip4, 4) + +static void (*(usercliptab[5]))( GLcontext *, + GLvector4f *, GLubyte *, + GLubyte *, GLubyte * ) = +{ + NULL, + NULL, + userclip2, + userclip3, + userclip4 +}; + + + +static GLboolean run_vertex_stage( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct vertex_stage_data *store = (struct vertex_stage_data *)stage->privatePtr; + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + + if (ctx->VertexProgram._Enabled) + return GL_TRUE; + + if (ctx->_NeedEyeCoords) { + /* Separate modelview transformation: + * Use combined ModelProject to avoid some depth artifacts + */ + if (ctx->ModelviewMatrixStack.Top->type == MATRIX_IDENTITY) + VB->EyePtr = VB->ObjPtr; + else + VB->EyePtr = TransformRaw( &store->eye, + ctx->ModelviewMatrixStack.Top, + VB->ObjPtr); + } + + VB->ClipPtr = TransformRaw( &store->clip, + &ctx->_ModelProjectMatrix, + VB->ObjPtr ); + + /* Drivers expect this to be clean to element 4... + */ + switch (VB->ClipPtr->size) { + case 1: + /* impossible */ + case 2: + _mesa_vector4f_clean_elem( VB->ClipPtr, VB->Count, 2 ); + /* fall-through */ + case 3: + _mesa_vector4f_clean_elem( VB->ClipPtr, VB->Count, 3 ); + /* fall-through */ + case 4: + break; + } + + + /* Cliptest and perspective divide. Clip functions must clear + * the clipmask. + */ + store->ormask = 0; + store->andmask = CLIP_ALL_BITS; + + if (tnl->NeedNdcCoords) { + VB->NdcPtr = + _mesa_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, + &store->proj, + store->clipmask, + &store->ormask, + &store->andmask ); + } + else { + VB->NdcPtr = NULL; + _mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr, + NULL, + store->clipmask, + &store->ormask, + &store->andmask ); + } + + if (store->andmask) + return GL_FALSE; + + + /* Test userclip planes. This contributes to VB->ClipMask, so + * is essentially required to be in this stage. + */ + if (ctx->Transform.ClipPlanesEnabled) { + usercliptab[VB->ClipPtr->size]( ctx, + VB->ClipPtr, + store->clipmask, + &store->ormask, + &store->andmask ); + + if (store->andmask) + return GL_FALSE; + } + + VB->ClipAndMask = store->andmask; + VB->ClipOrMask = store->ormask; + VB->ClipMask = store->clipmask; + + return GL_TRUE; +} + + +static GLboolean init_vertex_stage( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct vertex_stage_data *store; + GLuint size = VB->Size; + + stage->privatePtr = CALLOC(sizeof(*store)); + store = VERTEX_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + _mesa_vector4f_alloc( &store->eye, 0, size, 32 ); + _mesa_vector4f_alloc( &store->clip, 0, size, 32 ); + _mesa_vector4f_alloc( &store->proj, 0, size, 32 ); + + store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); + + if (!store->clipmask || + !store->eye.data || + !store->clip.data || + !store->proj.data) + return GL_FALSE; + + return GL_TRUE; +} + +static void dtr( struct tnl_pipeline_stage *stage ) +{ + struct vertex_stage_data *store = VERTEX_STAGE_DATA(stage); + + if (store) { + _mesa_vector4f_free( &store->eye ); + _mesa_vector4f_free( &store->clip ); + _mesa_vector4f_free( &store->proj ); + ALIGN_FREE( store->clipmask ); + FREE(store); + stage->privatePtr = NULL; + stage->run = init_vertex_stage; + } +} + + +const struct tnl_pipeline_stage _tnl_vertex_transform_stage = +{ + "modelview/project/cliptest/divide", + NULL, /* private data */ + init_vertex_stage, + dtr, /* destructor */ + NULL, + run_vertex_stage /* run -- initially set to init */ +}; diff --git a/reactos/dll/mesa32/src/tnl/t_vertex.c b/reactos/dll/mesa32/src/tnl/t_vertex.c new file mode 100644 index 00000000000..bed3cf1879c --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vertex.c @@ -0,0 +1,502 @@ +/* + * Copyright 2003 Tungsten Graphics, 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 + * 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 + * TUNGSTEN GRAPHICS 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. + * + * Authors: + * Keith Whitwell + */ + +#include "glheader.h" +#include "context.h" +#include "colormac.h" + +#include "t_context.h" +#include "t_vertex.h" + +#define DBG 0 + +/* Build and manage clipspace/ndc/window vertices. + */ + +static GLboolean match_fastpath( struct tnl_clipspace *vtx, + const struct tnl_clipspace_fastpath *fp) +{ + GLuint j; + + if (vtx->attr_count != fp->attr_count) + return GL_FALSE; + + for (j = 0; j < vtx->attr_count; j++) + if (vtx->attr[j].format != fp->attr[j].format || + vtx->attr[j].inputsize != fp->attr[j].size || + vtx->attr[j].vertoffset != fp->attr[j].offset) + return GL_FALSE; + + if (fp->match_strides) { + if (vtx->vertex_size != fp->vertex_size) + return GL_FALSE; + + for (j = 0; j < vtx->attr_count; j++) + if (vtx->attr[j].inputstride != fp->attr[j].stride) + return GL_FALSE; + } + + return GL_TRUE; +} + +static GLboolean search_fastpath_emit( struct tnl_clipspace *vtx ) +{ + struct tnl_clipspace_fastpath *fp = vtx->fastpath; + + for ( ; fp ; fp = fp->next) { + if (match_fastpath(vtx, fp)) { + vtx->emit = fp->func; + return GL_TRUE; + } + } + + return GL_FALSE; +} + +void _tnl_register_fastpath( struct tnl_clipspace *vtx, + GLboolean match_strides ) +{ + struct tnl_clipspace_fastpath *fastpath = CALLOC_STRUCT(tnl_clipspace_fastpath); + GLuint i; + + fastpath->vertex_size = vtx->vertex_size; + fastpath->attr_count = vtx->attr_count; + fastpath->match_strides = match_strides; + fastpath->func = vtx->emit; + fastpath->attr = MALLOC(vtx->attr_count * sizeof(fastpath->attr[0])); + + for (i = 0; i < vtx->attr_count; i++) { + fastpath->attr[i].format = vtx->attr[i].format; + fastpath->attr[i].stride = vtx->attr[i].inputstride; + fastpath->attr[i].size = vtx->attr[i].inputsize; + fastpath->attr[i].offset = vtx->attr[i].vertoffset; + } + + fastpath->next = vtx->fastpath; + vtx->fastpath = fastpath; +} + + + +/*********************************************************************** + * Build codegen functions or return generic ones: + */ +static void choose_emit_func( GLcontext *ctx, GLuint count, GLubyte *dest) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + struct tnl_clipspace_attr *a = vtx->attr; + const GLuint attr_count = vtx->attr_count; + GLuint j; + + for (j = 0; j < attr_count; j++) { + GLvector4f *vptr = VB->AttribPtr[a[j].attrib]; + a[j].inputstride = vptr->stride; + a[j].inputsize = vptr->size; + a[j].emit = a[j].insert[vptr->size - 1]; /* not always used */ + } + + vtx->emit = NULL; + + /* Does this match an existing (hardwired, codegen or known-bad) + * fastpath? + */ + if (search_fastpath_emit(vtx)) { + /* Use this result. If it is null, then it is already known + * that the current state will fail for codegen and there is no + * point trying again. + */ + } + else if (vtx->codegen_emit) { + vtx->codegen_emit(ctx); + } + + if (!vtx->emit) { + _tnl_generate_hardwired_emit(ctx); + } + + /* Otherwise use the generic version: + */ + if (!vtx->emit) + vtx->emit = _tnl_generic_emit; + + vtx->emit( ctx, count, dest ); +} + + + +static void choose_interp_func( GLcontext *ctx, + GLfloat t, + GLuint edst, GLuint eout, GLuint ein, + GLboolean force_boundary ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + + if (vtx->need_extras && + (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) { + vtx->interp = _tnl_generic_interp_extras; + } else { + vtx->interp = _tnl_generic_interp; + } + + vtx->interp( ctx, t, edst, eout, ein, force_boundary ); +} + + +static void choose_copy_pv_func( GLcontext *ctx, GLuint edst, GLuint esrc ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + + if (vtx->need_extras && + (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) { + vtx->copy_pv = _tnl_generic_copy_pv_extras; + } else { + vtx->copy_pv = _tnl_generic_copy_pv; + } + + vtx->copy_pv( ctx, edst, esrc ); +} + + +/*********************************************************************** + * Public entrypoints, mostly dispatch to the above: + */ + + +/* Interpolate between two vertices to produce a third: + */ +void _tnl_interp( GLcontext *ctx, + GLfloat t, + GLuint edst, GLuint eout, GLuint ein, + GLboolean force_boundary ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + vtx->interp( ctx, t, edst, eout, ein, force_boundary ); +} + +/* Copy colors from one vertex to another: + */ +void _tnl_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + vtx->copy_pv( ctx, edst, esrc ); +} + + +/* Extract a named attribute from a hardware vertex. Will have to + * reverse any viewport transformation, swizzling or other conversions + * which may have been applied: + */ +void _tnl_get_attr( GLcontext *ctx, const void *vin, + GLenum attr, GLfloat *dest ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + const struct tnl_clipspace_attr *a = vtx->attr; + const GLuint attr_count = vtx->attr_count; + GLuint j; + + for (j = 0; j < attr_count; j++) { + if (a[j].attrib == attr) { + a[j].extract( &a[j], dest, (GLubyte *)vin + a[j].vertoffset ); + return; + } + } + + /* Else return the value from ctx->Current. + */ + _mesa_memcpy( dest, ctx->Current.Attrib[attr], 4*sizeof(GLfloat)); +} + + +/* Complementary operation to the above. + */ +void _tnl_set_attr( GLcontext *ctx, void *vout, + GLenum attr, const GLfloat *src ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + const struct tnl_clipspace_attr *a = vtx->attr; + const GLuint attr_count = vtx->attr_count; + GLuint j; + + for (j = 0; j < attr_count; j++) { + if (a[j].attrib == attr) { + a[j].insert[4-1]( &a[j], (GLubyte *)vout + a[j].vertoffset, src ); + return; + } + } +} + + +void *_tnl_get_vertex( GLcontext *ctx, GLuint nr ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + + return vtx->vertex_buf + nr * vtx->vertex_size; +} + +void _tnl_invalidate_vertex_state( GLcontext *ctx, GLuint new_state ) +{ + if (new_state & (_DD_NEW_TRI_LIGHT_TWOSIDE|_DD_NEW_TRI_UNFILLED) ) { + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + vtx->new_inputs = ~0; + vtx->interp = choose_interp_func; + vtx->copy_pv = choose_copy_pv_func; + } +} + +static void invalidate_funcs( struct tnl_clipspace *vtx ) +{ + vtx->emit = choose_emit_func; + vtx->interp = choose_interp_func; + vtx->copy_pv = choose_copy_pv_func; + vtx->new_inputs = ~0; +} + +GLuint _tnl_install_attrs( GLcontext *ctx, const struct tnl_attr_map *map, + GLuint nr, const GLfloat *vp, + GLuint unpacked_size ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + GLuint offset = 0; + GLuint i, j; + + assert(nr < _TNL_ATTRIB_MAX); + assert(nr == 0 || map[0].attrib == VERT_ATTRIB_POS); + + vtx->new_inputs = ~0; + vtx->need_viewport = GL_FALSE; + + if (vp) { + vtx->need_viewport = GL_TRUE; + } + + for (j = 0, i = 0; i < nr; i++) { + const GLuint format = map[i].format; + if (format == EMIT_PAD) { + if (DBG) + _mesa_printf("%d: pad %d, offset %d\n", i, + map[i].offset, offset); + + offset += map[i].offset; + + } + else { + GLuint tmpoffset; + + if (unpacked_size) + tmpoffset = map[i].offset; + else + tmpoffset = offset; + + if (vtx->attr_count != j || + vtx->attr[j].attrib != map[i].attrib || + vtx->attr[j].format != format || + vtx->attr[j].vertoffset != tmpoffset) { + invalidate_funcs(vtx); + + vtx->attr[j].attrib = map[i].attrib; + vtx->attr[j].format = format; + vtx->attr[j].vp = vp; + vtx->attr[j].insert = _tnl_format_info[format].insert; + vtx->attr[j].extract = _tnl_format_info[format].extract; + vtx->attr[j].vertattrsize = _tnl_format_info[format].attrsize; + vtx->attr[j].vertoffset = tmpoffset; + } + + + if (DBG) + _mesa_printf("%d: %s, vp %p, offset %d\n", i, + _tnl_format_info[format].name, (void *)vp, + vtx->attr[j].vertoffset); + + offset += _tnl_format_info[format].attrsize; + j++; + } + } + + vtx->attr_count = j; + + if (unpacked_size) + vtx->vertex_size = unpacked_size; + else + vtx->vertex_size = offset; + + assert(vtx->vertex_size <= vtx->max_vertex_size); + return vtx->vertex_size; +} + + + +void _tnl_invalidate_vertices( GLcontext *ctx, GLuint newinputs ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + vtx->new_inputs |= newinputs; +} + + +/* This event has broader use beyond this file - will move elsewhere + * and probably invoke a driver callback. + */ +void _tnl_notify_pipeline_output_change( GLcontext *ctx ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + invalidate_funcs(vtx); +} + +static void update_input_ptrs( GLcontext *ctx, GLuint start ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + struct tnl_clipspace_attr *a = vtx->attr; + const GLuint count = vtx->attr_count; + GLuint j; + + for (j = 0; j < count; j++) { + GLvector4f *vptr = VB->AttribPtr[a[j].attrib]; + + if (vtx->emit != choose_emit_func) { + assert(a[j].inputstride == vptr->stride); + assert(a[j].inputsize == vptr->size); + } + + a[j].inputptr = ((GLubyte *)vptr->data) + start * vptr->stride; + } + + if (a->vp) { + vtx->vp_scale[0] = a->vp[MAT_SX]; + vtx->vp_scale[1] = a->vp[MAT_SY]; + vtx->vp_scale[2] = a->vp[MAT_SZ]; + vtx->vp_scale[3] = 1.0; + vtx->vp_xlate[0] = a->vp[MAT_TX]; + vtx->vp_xlate[1] = a->vp[MAT_TY]; + vtx->vp_xlate[2] = a->vp[MAT_TZ]; + vtx->vp_xlate[3] = 0.0; + } +} + + +void _tnl_build_vertices( GLcontext *ctx, + GLuint start, + GLuint end, + GLuint newinputs ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + update_input_ptrs( ctx, start ); + vtx->emit( ctx, end - start, + (GLubyte *)(vtx->vertex_buf + + start * vtx->vertex_size)); +} + +/* Emit VB vertices start..end to dest. Note that VB vertex at + * postion start will be emitted to dest at position zero. + */ +void *_tnl_emit_vertices_to_buffer( GLcontext *ctx, + GLuint start, + GLuint end, + void *dest ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + + update_input_ptrs(ctx, start); + + /* Note: dest should not be adjusted for non-zero 'start' values: + */ + vtx->emit( ctx, end - start, dest ); + return (void *)((GLubyte *)dest + vtx->vertex_size * (end - start)); +} + + +void _tnl_init_vertices( GLcontext *ctx, + GLuint vb_size, + GLuint max_vertex_size ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + + _tnl_install_attrs( ctx, NULL, 0, NULL, 0 ); + + vtx->need_extras = GL_TRUE; + if (max_vertex_size > vtx->max_vertex_size) { + _tnl_free_vertices( ctx ); + vtx->max_vertex_size = max_vertex_size; + vtx->vertex_buf = (GLubyte *)ALIGN_CALLOC(vb_size * max_vertex_size, 32 ); + invalidate_funcs(vtx); + } + + switch(CHAN_TYPE) { + case GL_UNSIGNED_BYTE: + vtx->chan_scale[0] = 255.0; + vtx->chan_scale[1] = 255.0; + vtx->chan_scale[2] = 255.0; + vtx->chan_scale[3] = 255.0; + break; + case GL_UNSIGNED_SHORT: + vtx->chan_scale[0] = 65535.0; + vtx->chan_scale[1] = 65535.0; + vtx->chan_scale[2] = 65535.0; + vtx->chan_scale[3] = 65535.0; + break; + default: + vtx->chan_scale[0] = 1.0; + vtx->chan_scale[1] = 1.0; + vtx->chan_scale[2] = 1.0; + vtx->chan_scale[3] = 1.0; + break; + } + + vtx->identity[0] = 0.0; + vtx->identity[1] = 0.0; + vtx->identity[2] = 0.0; + vtx->identity[3] = 1.0; + + vtx->codegen_emit = NULL; + +#ifdef USE_SSE_ASM + if (!_mesa_getenv("MESA_NO_CODEGEN")) + vtx->codegen_emit = _tnl_generate_sse_emit; +#endif +} + + +void _tnl_free_vertices( GLcontext *ctx ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + struct tnl_clipspace_fastpath *fp, *tmp; + + if (vtx->vertex_buf) { + ALIGN_FREE(vtx->vertex_buf); + vtx->vertex_buf = NULL; + } + + for (fp = vtx->fastpath ; fp ; fp = tmp) { + tmp = fp->next; + FREE(fp->attr); + FREE((void *)fp->func); + FREE(fp); + } + + vtx->fastpath = NULL; +} diff --git a/reactos/dll/mesa32/src/tnl/t_vertex.h b/reactos/dll/mesa32/src/tnl/t_vertex.h new file mode 100644 index 00000000000..fda8f151d3e --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vertex.h @@ -0,0 +1,169 @@ +/* + * Copyright 2003 Tungsten Graphics, 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 + * 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 + * TUNGSTEN GRAPHICS 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. + * + * Authors: + * Keith Whitwell + */ + +#ifndef _TNL_VERTEX_H +#define _TNL_VERTEX_H + +#include "mtypes.h" +#include "t_context.h" + +/* New mechanism to specify hardware vertices so that tnl can build + * and manipulate them directly. + */ + + +/* It will probably be necessary to allow drivers to specify new + * emit-styles to cover all the wierd and wacky things out there. + */ +enum tnl_attr_format { + EMIT_1F, + EMIT_2F, + EMIT_3F, + EMIT_4F, + EMIT_2F_VIEWPORT, /* do viewport transform and emit */ + EMIT_3F_VIEWPORT, /* do viewport transform and emit */ + EMIT_4F_VIEWPORT, /* do viewport transform and emit */ + EMIT_3F_XYW, /* for projective texture */ + EMIT_1UB_1F, /* for fog coordinate */ + EMIT_3UB_3F_RGB, /* for specular color */ + EMIT_3UB_3F_BGR, /* for specular color */ + EMIT_4UB_4F_RGBA, /* for color */ + EMIT_4UB_4F_BGRA, /* for color */ + EMIT_4UB_4F_ARGB, /* for color */ + EMIT_4UB_4F_ABGR, /* for color */ + EMIT_4CHAN_4F_RGBA, /* for swrast color */ + EMIT_PAD, /* leave a hole of 'offset' bytes */ + EMIT_MAX +}; + +struct tnl_attr_map { + GLuint attrib; /* _TNL_ATTRIB_ enum */ + enum tnl_attr_format format; + GLuint offset; +}; + +struct tnl_format_info { + const char *name; + tnl_extract_func extract; + tnl_insert_func insert[4]; + const GLuint attrsize; +}; + +extern const struct tnl_format_info _tnl_format_info[EMIT_MAX]; + + +/* Interpolate between two vertices to produce a third: + */ +extern void _tnl_interp( GLcontext *ctx, + GLfloat t, + GLuint edst, GLuint eout, GLuint ein, + GLboolean force_boundary ); + +/* Copy colors from one vertex to another: + */ +extern void _tnl_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ); + + +/* Extract a named attribute from a hardware vertex. Will have to + * reverse any viewport transformation, swizzling or other conversions + * which may have been applied: + */ +extern void _tnl_get_attr( GLcontext *ctx, const void *vertex, GLenum attrib, + GLfloat *dest ); + +/* Complementary to the above. + */ +extern void _tnl_set_attr( GLcontext *ctx, void *vout, GLenum attrib, + const GLfloat *src ); + + +extern void *_tnl_get_vertex( GLcontext *ctx, GLuint nr ); + +extern GLuint _tnl_install_attrs( GLcontext *ctx, + const struct tnl_attr_map *map, + GLuint nr, const GLfloat *vp, + GLuint unpacked_size ); + +extern void _tnl_free_vertices( GLcontext *ctx ); + +extern void _tnl_init_vertices( GLcontext *ctx, + GLuint vb_size, + GLuint max_vertex_size ); + +extern void *_tnl_emit_vertices_to_buffer( GLcontext *ctx, + GLuint start, + GLuint end, + void *dest ); + +extern void _tnl_build_vertices( GLcontext *ctx, + GLuint start, + GLuint end, + GLuint newinputs ); + +extern void _tnl_invalidate_vertices( GLcontext *ctx, GLuint newinputs ); + +extern void _tnl_invalidate_vertex_state( GLcontext *ctx, GLuint new_state ); + +extern void _tnl_notify_pipeline_output_change( GLcontext *ctx ); + + +#define GET_VERTEX_STATE(ctx) &(TNL_CONTEXT(ctx)->clipspace) + +/* Internal function: + */ +void _tnl_register_fastpath( struct tnl_clipspace *vtx, + GLboolean match_strides ); + + +/* t_vertex_generic.c -- Internal functions for t_vertex.c + */ +void _tnl_generic_copy_pv_extras( GLcontext *ctx, + GLuint dst, GLuint src ); + +void _tnl_generic_interp_extras( GLcontext *ctx, + GLfloat t, + GLuint dst, GLuint out, GLuint in, + GLboolean force_boundary ); + +void _tnl_generic_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ); + +void _tnl_generic_interp( GLcontext *ctx, + GLfloat t, + GLuint edst, GLuint eout, GLuint ein, + GLboolean force_boundary ); + +void _tnl_generic_emit( GLcontext *ctx, + GLuint count, + GLubyte *v ); + +void _tnl_generate_hardwired_emit( GLcontext *ctx ); + +/* t_vertex_sse.c -- Internal functions for t_vertex.c + */ +void _tnl_generate_sse_emit( GLcontext *ctx ); + +#endif diff --git a/reactos/dll/mesa32/src/tnl/t_vertex_generic.c b/reactos/dll/mesa32/src/tnl/t_vertex_generic.c new file mode 100644 index 00000000000..3f944580538 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vertex_generic.c @@ -0,0 +1,1119 @@ + +/* + * Copyright 2003 Tungsten Graphics, 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 + * 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 + * TUNGSTEN GRAPHICS 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. + * + * Authors: + * Keith Whitwell + */ + +#include "glheader.h" +#include "context.h" +#include "colormac.h" +#include "t_context.h" +#include "t_vertex.h" +#include "simple_list.h" + + + +/* + * These functions take the NDC coordinates pointed to by 'in', apply the + * NDC->Viewport mapping and store the results at 'v'. + */ + +static INLINE void insert_4f_viewport_4( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)v; + const GLfloat * const vp = a->vp; + + out[0] = vp[0] * in[0] + vp[12]; + out[1] = vp[5] * in[1] + vp[13]; + out[2] = vp[10] * in[2] + vp[14]; + out[3] = in[3]; +} + +static INLINE void insert_4f_viewport_3( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)v; + const GLfloat * const vp = a->vp; + + out[0] = vp[0] * in[0] + vp[12]; + out[1] = vp[5] * in[1] + vp[13]; + out[2] = vp[10] * in[2] + vp[14]; + out[3] = 1; +} + +static INLINE void insert_4f_viewport_2( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)v; + const GLfloat * const vp = a->vp; + + out[0] = vp[0] * in[0] + vp[12]; + out[1] = vp[5] * in[1] + vp[13]; + out[2] = vp[14]; + out[3] = 1; +} + +static INLINE void insert_4f_viewport_1( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)v; + const GLfloat * const vp = a->vp; + + out[0] = vp[0] * in[0] + vp[12]; + out[1] = vp[13]; + out[2] = vp[14]; + out[3] = 1; +} + +static INLINE void insert_3f_viewport_3( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)v; + const GLfloat * const vp = a->vp; + + out[0] = vp[0] * in[0] + vp[12]; + out[1] = vp[5] * in[1] + vp[13]; + out[2] = vp[10] * in[2] + vp[14]; +} + +static INLINE void insert_3f_viewport_2( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)v; + const GLfloat * const vp = a->vp; + + out[0] = vp[0] * in[0] + vp[12]; + out[1] = vp[5] * in[1] + vp[13]; + out[2] = vp[10] * in[2] + vp[14]; +} + +static INLINE void insert_3f_viewport_1( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)v; + const GLfloat * const vp = a->vp; + + out[0] = vp[0] * in[0] + vp[12]; + out[1] = vp[13]; + out[2] = vp[14]; +} + +static INLINE void insert_2f_viewport_2( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)v; + const GLfloat * const vp = a->vp; + + out[0] = vp[0] * in[0] + vp[12]; + out[1] = vp[5] * in[1] + vp[13]; +} + +static INLINE void insert_2f_viewport_1( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)v; + const GLfloat * const vp = a->vp; + + out[0] = vp[0] * in[0] + vp[12]; + out[1] = vp[13]; +} + + +/* + * These functions do the same as above, except for the viewport mapping. + */ + +static INLINE void insert_4f_4( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)(v); + (void) a; + + out[0] = in[0]; + out[1] = in[1]; + out[2] = in[2]; + out[3] = in[3]; +} + +static INLINE void insert_4f_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)(v); + (void) a; + + out[0] = in[0]; + out[1] = in[1]; + out[2] = in[2]; + out[3] = 1; +} + +static INLINE void insert_4f_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)(v); + (void) a; + + out[0] = in[0]; + out[1] = in[1]; + out[2] = 0; + out[3] = 1; +} + +static INLINE void insert_4f_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)(v); + (void) a; + + out[0] = in[0]; + out[1] = 0; + out[2] = 0; + out[3] = 1; +} + +static INLINE void insert_3f_xyw_4( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)(v); + (void) a; + + out[0] = in[0]; + out[1] = in[1]; + out[2] = in[3]; +} + +static INLINE void insert_3f_xyw_err( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) +{ + (void) a; (void) v; (void) in; + abort(); +} + +static INLINE void insert_3f_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)(v); + (void) a; + + out[0] = in[0]; + out[1] = in[1]; + out[2] = in[2]; +} + +static INLINE void insert_3f_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)(v); + (void) a; + + out[0] = in[0]; + out[1] = in[1]; + out[2] = 0; +} + +static INLINE void insert_3f_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)(v); + (void) a; + + out[0] = in[0]; + out[1] = 0; + out[2] = 0; +} + + +static INLINE void insert_2f_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)(v); + (void) a; + + out[0] = in[0]; + out[1] = in[1]; +} + +static INLINE void insert_2f_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)(v); + (void) a; + + out[0] = in[0]; + out[1] = 0; +} + +static INLINE void insert_1f_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) +{ + GLfloat *out = (GLfloat *)(v); + (void) a; + + out[0] = in[0]; +} + +static INLINE void insert_null( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) +{ + (void) a; (void) v; (void) in; +} + +static INLINE void insert_4chan_4f_rgba_4( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + GLchan *c = (GLchan *)v; + (void) a; + UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]); + UNCLAMPED_FLOAT_TO_CHAN(c[1], in[1]); + UNCLAMPED_FLOAT_TO_CHAN(c[2], in[2]); + UNCLAMPED_FLOAT_TO_CHAN(c[3], in[3]); +} + +static INLINE void insert_4chan_4f_rgba_3( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + GLchan *c = (GLchan *)v; + (void) a; + UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]); + UNCLAMPED_FLOAT_TO_CHAN(c[1], in[1]); + UNCLAMPED_FLOAT_TO_CHAN(c[2], in[2]); + c[3] = CHAN_MAX; +} + +static INLINE void insert_4chan_4f_rgba_2( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + GLchan *c = (GLchan *)v; + (void) a; + UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]); + UNCLAMPED_FLOAT_TO_CHAN(c[1], in[1]); + c[2] = 0; + c[3] = CHAN_MAX; +} + +static INLINE void insert_4chan_4f_rgba_1( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + GLchan *c = (GLchan *)v; + (void) a; + UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]); + c[1] = 0; + c[2] = 0; + c[3] = CHAN_MAX; +} + +static INLINE void insert_4ub_4f_rgba_4( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[2]); + UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[3]); +} + +static INLINE void insert_4ub_4f_rgba_3( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[2]); + v[3] = 0xff; +} + +static INLINE void insert_4ub_4f_rgba_2( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); + v[2] = 0; + v[3] = 0xff; +} + +static INLINE void insert_4ub_4f_rgba_1( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); + v[1] = 0; + v[2] = 0; + v[3] = 0xff; +} + +static INLINE void insert_4ub_4f_bgra_4( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[2]); + UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[3]); +} + +static INLINE void insert_4ub_4f_bgra_3( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[2]); + v[3] = 0xff; +} + +static INLINE void insert_4ub_4f_bgra_2( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); + v[0] = 0; + v[3] = 0xff; +} + +static INLINE void insert_4ub_4f_bgra_1( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]); + v[1] = 0; + v[0] = 0; + v[3] = 0xff; +} + +static INLINE void insert_4ub_4f_argb_4( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]); + UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[2]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[3]); +} + +static INLINE void insert_4ub_4f_argb_3( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]); + UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[2]); + v[0] = 0xff; +} + +static INLINE void insert_4ub_4f_argb_2( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]); + v[3] = 0x00; + v[0] = 0xff; +} + +static INLINE void insert_4ub_4f_argb_1( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[0]); + v[2] = 0x00; + v[3] = 0x00; + v[0] = 0xff; +} + +static INLINE void insert_4ub_4f_abgr_4( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]); + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[2]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[3]); +} + +static INLINE void insert_4ub_4f_abgr_3( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]); + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[2]); + v[0] = 0xff; +} + +static INLINE void insert_4ub_4f_abgr_2( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]); + v[1] = 0x00; + v[0] = 0xff; +} + +static INLINE void insert_4ub_4f_abgr_1( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[0]); + v[2] = 0x00; + v[1] = 0x00; + v[0] = 0xff; +} + +static INLINE void insert_3ub_3f_rgb_3( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[2]); +} + +static INLINE void insert_3ub_3f_rgb_2( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); + v[2] = 0; +} + +static INLINE void insert_3ub_3f_rgb_1( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); + v[1] = 0; + v[2] = 0; +} + +static INLINE void insert_3ub_3f_bgr_3( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[2]); +} + +static INLINE void insert_3ub_3f_bgr_2( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); + v[0] = 0; +} + +static INLINE void insert_3ub_3f_bgr_1( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]); + v[1] = 0; + v[0] = 0; +} + + +static INLINE void insert_1ub_1f_1( const struct tnl_clipspace_attr *a, GLubyte *v, + const GLfloat *in ) +{ + (void) a; + UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); +} + + +/*********************************************************************** + * Functions to perform the reverse operations to the above, for + * swrast translation and clip-interpolation. + * + * Currently always extracts a full 4 floats. + */ + +static void extract_4f_viewport( const struct tnl_clipspace_attr *a, GLfloat *out, + const GLubyte *v ) +{ + const GLfloat *in = (const GLfloat *)v; + const GLfloat * const vp = a->vp; + + /* Although included for completeness, the position coordinate is + * usually handled differently during clipping. + */ + out[0] = (in[0] - vp[12]) / vp[0]; + out[1] = (in[1] - vp[13]) / vp[5]; + out[2] = (in[2] - vp[14]) / vp[10]; + out[3] = in[3]; +} + +static void extract_3f_viewport( const struct tnl_clipspace_attr *a, GLfloat *out, + const GLubyte *v ) +{ + const GLfloat *in = (const GLfloat *)v; + const GLfloat * const vp = a->vp; + + out[0] = (in[0] - vp[12]) / vp[0]; + out[1] = (in[1] - vp[13]) / vp[5]; + out[2] = (in[2] - vp[14]) / vp[10]; + out[3] = 1; +} + + +static void extract_2f_viewport( const struct tnl_clipspace_attr *a, GLfloat *out, + const GLubyte *v ) +{ + const GLfloat *in = (const GLfloat *)v; + const GLfloat * const vp = a->vp; + + out[0] = (in[0] - vp[12]) / vp[0]; + out[1] = (in[1] - vp[13]) / vp[5]; + out[2] = 0; + out[3] = 1; +} + + +static void extract_4f( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) +{ + const GLfloat *in = (const GLfloat *)v; + (void) a; + + out[0] = in[0]; + out[1] = in[1]; + out[2] = in[2]; + out[3] = in[3]; +} + +static void extract_3f_xyw( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) +{ + const GLfloat *in = (const GLfloat *)v; + (void) a; + + out[0] = in[0]; + out[1] = in[1]; + out[2] = 0; + out[3] = in[2]; +} + + +static void extract_3f( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) +{ + const GLfloat *in = (const GLfloat *)v; + (void) a; + + out[0] = in[0]; + out[1] = in[1]; + out[2] = in[2]; + out[3] = 1; +} + + +static void extract_2f( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) +{ + const GLfloat *in = (const GLfloat *)v; + (void) a; + + out[0] = in[0]; + out[1] = in[1]; + out[2] = 0; + out[3] = 1; +} + +static void extract_1f( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) +{ + const GLfloat *in = (const GLfloat *)v; + (void) a; + + out[0] = in[0]; + out[1] = 0; + out[2] = 0; + out[3] = 1; +} + +static void extract_4chan_4f_rgba( const struct tnl_clipspace_attr *a, GLfloat *out, + const GLubyte *v ) +{ + GLchan *c = (GLchan *)v; + (void) a; + + out[0] = CHAN_TO_FLOAT(c[0]); + out[1] = CHAN_TO_FLOAT(c[1]); + out[2] = CHAN_TO_FLOAT(c[2]); + out[3] = CHAN_TO_FLOAT(c[3]); +} + +static void extract_4ub_4f_rgba( const struct tnl_clipspace_attr *a, GLfloat *out, + const GLubyte *v ) +{ + (void) a; + out[0] = UBYTE_TO_FLOAT(v[0]); + out[1] = UBYTE_TO_FLOAT(v[1]); + out[2] = UBYTE_TO_FLOAT(v[2]); + out[3] = UBYTE_TO_FLOAT(v[3]); +} + +static void extract_4ub_4f_bgra( const struct tnl_clipspace_attr *a, GLfloat *out, + const GLubyte *v ) +{ + (void) a; + out[2] = UBYTE_TO_FLOAT(v[0]); + out[1] = UBYTE_TO_FLOAT(v[1]); + out[0] = UBYTE_TO_FLOAT(v[2]); + out[3] = UBYTE_TO_FLOAT(v[3]); +} + +static void extract_4ub_4f_argb( const struct tnl_clipspace_attr *a, GLfloat *out, + const GLubyte *v ) +{ + (void) a; + out[3] = UBYTE_TO_FLOAT(v[0]); + out[0] = UBYTE_TO_FLOAT(v[1]); + out[1] = UBYTE_TO_FLOAT(v[2]); + out[2] = UBYTE_TO_FLOAT(v[3]); +} + +static void extract_4ub_4f_abgr( const struct tnl_clipspace_attr *a, GLfloat *out, + const GLubyte *v ) +{ + (void) a; + out[3] = UBYTE_TO_FLOAT(v[0]); + out[2] = UBYTE_TO_FLOAT(v[1]); + out[1] = UBYTE_TO_FLOAT(v[2]); + out[0] = UBYTE_TO_FLOAT(v[3]); +} + +static void extract_3ub_3f_rgb( const struct tnl_clipspace_attr *a, GLfloat *out, + const GLubyte *v ) +{ + (void) a; + out[0] = UBYTE_TO_FLOAT(v[0]); + out[1] = UBYTE_TO_FLOAT(v[1]); + out[2] = UBYTE_TO_FLOAT(v[2]); + out[3] = 1; +} + +static void extract_3ub_3f_bgr( const struct tnl_clipspace_attr *a, GLfloat *out, + const GLubyte *v ) +{ + (void) a; + out[2] = UBYTE_TO_FLOAT(v[0]); + out[1] = UBYTE_TO_FLOAT(v[1]); + out[0] = UBYTE_TO_FLOAT(v[2]); + out[3] = 1; +} + +static void extract_1ub_1f( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) +{ + (void) a; + out[0] = UBYTE_TO_FLOAT(v[0]); + out[1] = 0; + out[2] = 0; + out[3] = 1; +} + + +const struct tnl_format_info _tnl_format_info[EMIT_MAX] = +{ + { "1f", + extract_1f, + { insert_1f_1, insert_1f_1, insert_1f_1, insert_1f_1 }, + sizeof(GLfloat) }, + + { "2f", + extract_2f, + { insert_2f_1, insert_2f_2, insert_2f_2, insert_2f_2 }, + 2 * sizeof(GLfloat) }, + + { "3f", + extract_3f, + { insert_3f_1, insert_3f_2, insert_3f_3, insert_3f_3 }, + 3 * sizeof(GLfloat) }, + + { "4f", + extract_4f, + { insert_4f_1, insert_4f_2, insert_4f_3, insert_4f_4 }, + 4 * sizeof(GLfloat) }, + + { "2f_viewport", + extract_2f_viewport, + { insert_2f_viewport_1, insert_2f_viewport_2, insert_2f_viewport_2, + insert_2f_viewport_2 }, + 2 * sizeof(GLfloat) }, + + { "3f_viewport", + extract_3f_viewport, + { insert_3f_viewport_1, insert_3f_viewport_2, insert_3f_viewport_3, + insert_3f_viewport_3 }, + 3 * sizeof(GLfloat) }, + + { "4f_viewport", + extract_4f_viewport, + { insert_4f_viewport_1, insert_4f_viewport_2, insert_4f_viewport_3, + insert_4f_viewport_4 }, + 4 * sizeof(GLfloat) }, + + { "3f_xyw", + extract_3f_xyw, + { insert_3f_xyw_err, insert_3f_xyw_err, insert_3f_xyw_err, + insert_3f_xyw_4 }, + 3 * sizeof(GLfloat) }, + + { "1ub_1f", + extract_1ub_1f, + { insert_1ub_1f_1, insert_1ub_1f_1, insert_1ub_1f_1, insert_1ub_1f_1 }, + sizeof(GLubyte) }, + + { "3ub_3f_rgb", + extract_3ub_3f_rgb, + { insert_3ub_3f_rgb_1, insert_3ub_3f_rgb_2, insert_3ub_3f_rgb_3, + insert_3ub_3f_rgb_3 }, + 3 * sizeof(GLubyte) }, + + { "3ub_3f_bgr", + extract_3ub_3f_bgr, + { insert_3ub_3f_bgr_1, insert_3ub_3f_bgr_2, insert_3ub_3f_bgr_3, + insert_3ub_3f_bgr_3 }, + 3 * sizeof(GLubyte) }, + + { "4ub_4f_rgba", + extract_4ub_4f_rgba, + { insert_4ub_4f_rgba_1, insert_4ub_4f_rgba_2, insert_4ub_4f_rgba_3, + insert_4ub_4f_rgba_4 }, + 4 * sizeof(GLubyte) }, + + { "4ub_4f_bgra", + extract_4ub_4f_bgra, + { insert_4ub_4f_bgra_1, insert_4ub_4f_bgra_2, insert_4ub_4f_bgra_3, + insert_4ub_4f_bgra_4 }, + 4 * sizeof(GLubyte) }, + + { "4ub_4f_argb", + extract_4ub_4f_argb, + { insert_4ub_4f_argb_1, insert_4ub_4f_argb_2, insert_4ub_4f_argb_3, + insert_4ub_4f_argb_4 }, + 4 * sizeof(GLubyte) }, + + { "4ub_4f_abgr", + extract_4ub_4f_abgr, + { insert_4ub_4f_abgr_1, insert_4ub_4f_abgr_2, insert_4ub_4f_abgr_3, + insert_4ub_4f_abgr_4 }, + 4 * sizeof(GLubyte) }, + + { "4chan_4f_rgba", + extract_4chan_4f_rgba, + { insert_4chan_4f_rgba_1, insert_4chan_4f_rgba_2, insert_4chan_4f_rgba_3, + insert_4chan_4f_rgba_4 }, + 4 * sizeof(GLchan) }, + + { "pad", + NULL, + { NULL, NULL, NULL, NULL }, + 0 } + +}; + + + + +/*********************************************************************** + * Hardwired fastpaths for emitting whole vertices or groups of + * vertices + */ +#define EMIT5(NR, F0, F1, F2, F3, F4, NAME) \ +static void NAME( GLcontext *ctx, \ + GLuint count, \ + GLubyte *v ) \ +{ \ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); \ + struct tnl_clipspace_attr *a = vtx->attr; \ + GLuint i; \ + \ + for (i = 0 ; i < count ; i++, v += vtx->vertex_size) { \ + if (NR > 0) { \ + F0( &a[0], v + a[0].vertoffset, (GLfloat *)a[0].inputptr ); \ + a[0].inputptr += a[0].inputstride; \ + } \ + \ + if (NR > 1) { \ + F1( &a[1], v + a[1].vertoffset, (GLfloat *)a[1].inputptr ); \ + a[1].inputptr += a[1].inputstride; \ + } \ + \ + if (NR > 2) { \ + F2( &a[2], v + a[2].vertoffset, (GLfloat *)a[2].inputptr ); \ + a[2].inputptr += a[2].inputstride; \ + } \ + \ + if (NR > 3) { \ + F3( &a[3], v + a[3].vertoffset, (GLfloat *)a[3].inputptr ); \ + a[3].inputptr += a[3].inputstride; \ + } \ + \ + if (NR > 4) { \ + F4( &a[4], v + a[4].vertoffset, (GLfloat *)a[4].inputptr ); \ + a[4].inputptr += a[4].inputstride; \ + } \ + } \ +} + + +#define EMIT2(F0, F1, NAME) EMIT5(2, F0, F1, insert_null, \ + insert_null, insert_null, NAME) + +#define EMIT3(F0, F1, F2, NAME) EMIT5(3, F0, F1, F2, insert_null, \ + insert_null, NAME) + +#define EMIT4(F0, F1, F2, F3, NAME) EMIT5(4, F0, F1, F2, F3, \ + insert_null, NAME) + + +EMIT2(insert_3f_viewport_3, insert_4ub_4f_rgba_4, emit_viewport3_rgba4) +EMIT2(insert_3f_viewport_3, insert_4ub_4f_bgra_4, emit_viewport3_bgra4) +EMIT2(insert_3f_3, insert_4ub_4f_rgba_4, emit_xyz3_rgba4) + +EMIT3(insert_4f_viewport_4, insert_4ub_4f_rgba_4, insert_2f_2, emit_viewport4_rgba4_st2) +EMIT3(insert_4f_viewport_4, insert_4ub_4f_bgra_4, insert_2f_2, emit_viewport4_bgra4_st2) +EMIT3(insert_4f_4, insert_4ub_4f_rgba_4, insert_2f_2, emit_xyzw4_rgba4_st2) + +EMIT4(insert_4f_viewport_4, insert_4ub_4f_rgba_4, insert_2f_2, insert_2f_2, emit_viewport4_rgba4_st2_st2) +EMIT4(insert_4f_viewport_4, insert_4ub_4f_bgra_4, insert_2f_2, insert_2f_2, emit_viewport4_bgra4_st2_st2) +EMIT4(insert_4f_4, insert_4ub_4f_rgba_4, insert_2f_2, insert_2f_2, emit_xyzw4_rgba4_st2_st2) + + +/* Use the codegen paths to select one of a number of hardwired + * fastpaths. + */ +void _tnl_generate_hardwired_emit( GLcontext *ctx ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + tnl_emit_func func = NULL; + + /* Does it fit a hardwired fastpath? Help! this is growing out of + * control! + */ + switch (vtx->attr_count) { + case 2: + if (vtx->attr[0].emit == insert_3f_viewport_3) { + if (vtx->attr[1].emit == insert_4ub_4f_bgra_4) + func = emit_viewport3_bgra4; + else if (vtx->attr[1].emit == insert_4ub_4f_rgba_4) + func = emit_viewport3_rgba4; + } + else if (vtx->attr[0].emit == insert_3f_3 && + vtx->attr[1].emit == insert_4ub_4f_rgba_4) { + func = emit_xyz3_rgba4; + } + break; + case 3: + if (vtx->attr[2].emit == insert_2f_2) { + if (vtx->attr[1].emit == insert_4ub_4f_rgba_4) { + if (vtx->attr[0].emit == insert_4f_viewport_4) + func = emit_viewport4_rgba4_st2; + else if (vtx->attr[0].emit == insert_4f_4) + func = emit_xyzw4_rgba4_st2; + } + else if (vtx->attr[1].emit == insert_4ub_4f_bgra_4 && + vtx->attr[0].emit == insert_4f_viewport_4) + func = emit_viewport4_bgra4_st2; + } + break; + case 4: + if (vtx->attr[2].emit == insert_2f_2 && + vtx->attr[3].emit == insert_2f_2) { + if (vtx->attr[1].emit == insert_4ub_4f_rgba_4) { + if (vtx->attr[0].emit == insert_4f_viewport_4) + func = emit_viewport4_rgba4_st2_st2; + else if (vtx->attr[0].emit == insert_4f_4) + func = emit_xyzw4_rgba4_st2_st2; + } + else if (vtx->attr[1].emit == insert_4ub_4f_bgra_4 && + vtx->attr[0].emit == insert_4f_viewport_4) + func = emit_viewport4_bgra4_st2_st2; + } + break; + } + + vtx->emit = func; +} + +/*********************************************************************** + * Generic (non-codegen) functions for whole vertices or groups of + * vertices + */ + +void _tnl_generic_emit( GLcontext *ctx, + GLuint count, + GLubyte *v ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + struct tnl_clipspace_attr *a = vtx->attr; + const GLuint attr_count = vtx->attr_count; + const GLuint stride = vtx->vertex_size; + GLuint i, j; + + for (i = 0 ; i < count ; i++, v += stride) { + for (j = 0; j < attr_count; j++) { + GLfloat *in = (GLfloat *)a[j].inputptr; + a[j].inputptr += a[j].inputstride; + a[j].emit( &a[j], v + a[j].vertoffset, in ); + } + } +} + + +void _tnl_generic_interp( GLcontext *ctx, + GLfloat t, + GLuint edst, GLuint eout, GLuint ein, + GLboolean force_boundary ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + const GLubyte *vin = vtx->vertex_buf + ein * vtx->vertex_size; + const GLubyte *vout = vtx->vertex_buf + eout * vtx->vertex_size; + GLubyte *vdst = vtx->vertex_buf + edst * vtx->vertex_size; + const struct tnl_clipspace_attr *a = vtx->attr; + const GLuint attr_count = vtx->attr_count; + GLuint j; + (void) force_boundary; + + if (tnl->NeedNdcCoords) { + const GLfloat *dstclip = VB->ClipPtr->data[edst]; + if (dstclip[3] != 0.0) { + const GLfloat w = 1.0f / dstclip[3]; + GLfloat pos[4]; + + pos[0] = dstclip[0] * w; + pos[1] = dstclip[1] * w; + pos[2] = dstclip[2] * w; + pos[3] = w; + + a[0].insert[4-1]( &a[0], vdst, pos ); + } + } + else { + a[0].insert[4-1]( &a[0], vdst, VB->ClipPtr->data[edst] ); + } + + + for (j = 1; j < attr_count; j++) { + GLfloat fin[4], fout[4], fdst[4]; + + a[j].extract( &a[j], fin, vin + a[j].vertoffset ); + a[j].extract( &a[j], fout, vout + a[j].vertoffset ); + + INTERP_F( t, fdst[3], fout[3], fin[3] ); + INTERP_F( t, fdst[2], fout[2], fin[2] ); + INTERP_F( t, fdst[1], fout[1], fin[1] ); + INTERP_F( t, fdst[0], fout[0], fin[0] ); + + a[j].insert[4-1]( &a[j], vdst + a[j].vertoffset, fdst ); + } +} + + +/* Extract color attributes from one vertex and insert them into + * another. (Shortcircuit extract/insert with memcpy). + */ +void _tnl_generic_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + GLubyte *vsrc = vtx->vertex_buf + esrc * vtx->vertex_size; + GLubyte *vdst = vtx->vertex_buf + edst * vtx->vertex_size; + const struct tnl_clipspace_attr *a = vtx->attr; + const GLuint attr_count = vtx->attr_count; + GLuint j; + + for (j = 0; j < attr_count; j++) { + if (a[j].attrib == VERT_ATTRIB_COLOR0 || + a[j].attrib == VERT_ATTRIB_COLOR1) { + + _mesa_memcpy( vdst + a[j].vertoffset, + vsrc + a[j].vertoffset, + a[j].vertattrsize ); + } + } +} + + +/* Helper functions for hardware which doesn't put back colors and/or + * edgeflags into vertices. + */ +void _tnl_generic_interp_extras( GLcontext *ctx, + GLfloat t, + GLuint dst, GLuint out, GLuint in, + GLboolean force_boundary ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + + /* If stride is zero, ColorPtr[1] is constant across the VB, so + * there is no point interpolating between two values as they will + * be identical. In all other cases, this value is generated by + * t_vb_lighttmp.h and has a stride of 4 dwords. + */ + if (VB->ColorPtr[1] && VB->ColorPtr[1]->stride) { + assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat)); + + INTERP_4F( t, + VB->ColorPtr[1]->data[dst], + VB->ColorPtr[1]->data[out], + VB->ColorPtr[1]->data[in] ); + } + + if (VB->SecondaryColorPtr[1]) { + assert(VB->SecondaryColorPtr[1]->stride == 4 * sizeof(GLfloat)); + + INTERP_3F( t, + VB->SecondaryColorPtr[1]->data[dst], + VB->SecondaryColorPtr[1]->data[out], + VB->SecondaryColorPtr[1]->data[in] ); + } + + if (VB->IndexPtr[1]) { + VB->IndexPtr[1]->data[dst][0] = LINTERP( t, + VB->IndexPtr[1]->data[out][0], + VB->IndexPtr[1]->data[in][0] ); + } + + if (VB->EdgeFlag) { + VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary; + } + + _tnl_generic_interp(ctx, t, dst, out, in, force_boundary); +} + +void _tnl_generic_copy_pv_extras( GLcontext *ctx, + GLuint dst, GLuint src ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + + /* See above comment: + */ + if (VB->ColorPtr[1] && VB->ColorPtr[1]->stride) { + COPY_4FV( VB->ColorPtr[1]->data[dst], + VB->ColorPtr[1]->data[src] ); + } + + if (VB->SecondaryColorPtr[1]) { + COPY_4FV( VB->SecondaryColorPtr[1]->data[dst], + VB->SecondaryColorPtr[1]->data[src] ); + } + + if (VB->IndexPtr[1]) { + VB->IndexPtr[1]->data[dst][0] = VB->IndexPtr[1]->data[src][0]; + } + + _tnl_generic_copy_pv(ctx, dst, src); +} + + diff --git a/reactos/dll/mesa32/src/tnl/t_vertex_sse.c b/reactos/dll/mesa32/src/tnl/t_vertex_sse.c new file mode 100644 index 00000000000..13dc2f4d534 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vertex_sse.c @@ -0,0 +1,670 @@ +/* + * Copyright 2003 Tungsten Graphics, 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 + * 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 + * TUNGSTEN GRAPHICS 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. + * + * Authors: + * Keith Whitwell + */ + +#include "glheader.h" +#include "context.h" +#include "colormac.h" +#include "t_context.h" +#include "t_vertex.h" +#include "simple_list.h" +#include "enums.h" + +#if defined(USE_SSE_ASM) + +#include "x86/rtasm/x86sse.h" +#include "x86/common_x86_asm.h" + + +#define X 0 +#define Y 1 +#define Z 2 +#define W 3 + + +struct x86_program { + struct x86_function func; + + GLcontext *ctx; + GLboolean inputs_safe; + GLboolean outputs_safe; + GLboolean have_sse2; + + struct x86_reg identity; + struct x86_reg chan0; +}; + + +static struct x86_reg get_identity( struct x86_program *p ) +{ + return p->identity; +} + +static void emit_load4f_4( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) +{ + sse_movups(&p->func, dest, arg0); +} + +static void emit_load4f_3( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) +{ + /* Have to jump through some hoops: + * + * c 0 0 0 + * c 0 0 1 + * 0 0 c 1 + * a b c 1 + */ + sse_movss(&p->func, dest, x86_make_disp(arg0, 8)); + sse_shufps(&p->func, dest, get_identity(p), SHUF(X,Y,Z,W) ); + sse_shufps(&p->func, dest, dest, SHUF(Y,Z,X,W) ); + sse_movlps(&p->func, dest, arg0); +} + +static void emit_load4f_2( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) +{ + /* Initialize from identity, then pull in low two words: + */ + sse_movups(&p->func, dest, get_identity(p)); + sse_movlps(&p->func, dest, arg0); +} + +static void emit_load4f_1( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) +{ + /* Pull in low word, then swizzle in identity */ + sse_movss(&p->func, dest, arg0); + sse_shufps(&p->func, dest, get_identity(p), SHUF(X,Y,Z,W) ); +} + + + +static void emit_load3f_3( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) +{ + /* Over-reads by 1 dword - potential SEGV if input is a vertex + * array. + */ + if (p->inputs_safe) { + sse_movups(&p->func, dest, arg0); + } + else { + /* c 0 0 0 + * c c c c + * a b c c + */ + sse_movss(&p->func, dest, x86_make_disp(arg0, 8)); + sse_shufps(&p->func, dest, dest, SHUF(X,X,X,X)); + sse_movlps(&p->func, dest, arg0); + } +} + +static void emit_load3f_2( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) +{ + emit_load4f_2(p, dest, arg0); +} + +static void emit_load3f_1( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) +{ + emit_load4f_1(p, dest, arg0); +} + +static void emit_load2f_2( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) +{ + sse_movlps(&p->func, dest, arg0); +} + +static void emit_load2f_1( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) +{ + emit_load4f_1(p, dest, arg0); +} + +static void emit_load1f_1( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) +{ + sse_movss(&p->func, dest, arg0); +} + +static void (*load[4][4])( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) = { + { emit_load1f_1, + emit_load1f_1, + emit_load1f_1, + emit_load1f_1 }, + + { emit_load2f_1, + emit_load2f_2, + emit_load2f_2, + emit_load2f_2 }, + + { emit_load3f_1, + emit_load3f_2, + emit_load3f_3, + emit_load3f_3 }, + + { emit_load4f_1, + emit_load4f_2, + emit_load4f_3, + emit_load4f_4 } +}; + +static void emit_load( struct x86_program *p, + struct x86_reg dest, + GLuint sz, + struct x86_reg src, + GLuint src_sz) +{ + load[sz-1][src_sz-1](p, dest, src); +} + +static void emit_store4f( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) +{ + sse_movups(&p->func, dest, arg0); +} + +static void emit_store3f( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) +{ + if (p->outputs_safe) { + /* Emit the extra dword anyway. This may hurt writecombining, + * may cause other problems. + */ + sse_movups(&p->func, dest, arg0); + } + else { + /* Alternate strategy - emit two, shuffle, emit one. + */ + sse_movlps(&p->func, dest, arg0); + sse_shufps(&p->func, arg0, arg0, SHUF(Z,Z,Z,Z) ); /* NOTE! destructive */ + sse_movss(&p->func, x86_make_disp(dest,8), arg0); + } +} + +static void emit_store2f( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) +{ + sse_movlps(&p->func, dest, arg0); +} + +static void emit_store1f( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) +{ + sse_movss(&p->func, dest, arg0); +} + + +static void (*store[4])( struct x86_program *p, + struct x86_reg dest, + struct x86_reg arg0 ) = +{ + emit_store1f, + emit_store2f, + emit_store3f, + emit_store4f +}; + +static void emit_store( struct x86_program *p, + struct x86_reg dest, + GLuint sz, + struct x86_reg temp ) + +{ + store[sz-1](p, dest, temp); +} + +static void emit_pack_store_4ub( struct x86_program *p, + struct x86_reg dest, + struct x86_reg temp ) +{ + /* Scale by 255.0 + */ + sse_mulps(&p->func, temp, p->chan0); + + if (p->have_sse2) { + sse2_cvtps2dq(&p->func, temp, temp); + sse2_packssdw(&p->func, temp, temp); + sse2_packuswb(&p->func, temp, temp); + sse_movss(&p->func, dest, temp); + } + else { + struct x86_reg mmx0 = x86_make_reg(file_MMX, 0); + struct x86_reg mmx1 = x86_make_reg(file_MMX, 1); + sse_cvtps2pi(&p->func, mmx0, temp); + sse_movhlps(&p->func, temp, temp); + sse_cvtps2pi(&p->func, mmx1, temp); + mmx_packssdw(&p->func, mmx0, mmx1); + mmx_packuswb(&p->func, mmx0, mmx0); + mmx_movd(&p->func, dest, mmx0); + } +} + +static GLint get_offset( const void *a, const void *b ) +{ + return (const char *)b - (const char *)a; +} + +/* Not much happens here. Eventually use this function to try and + * avoid saving/reloading the source pointers each vertex (if some of + * them can fit in registers). + */ +static void get_src_ptr( struct x86_program *p, + struct x86_reg srcREG, + struct x86_reg vtxREG, + struct tnl_clipspace_attr *a ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(p->ctx); + struct x86_reg ptr_to_src = x86_make_disp(vtxREG, get_offset(vtx, &a->inputptr)); + + /* Load current a[j].inputptr + */ + x86_mov(&p->func, srcREG, ptr_to_src); +} + +static void update_src_ptr( struct x86_program *p, + struct x86_reg srcREG, + struct x86_reg vtxREG, + struct tnl_clipspace_attr *a ) +{ + if (a->inputstride) { + struct tnl_clipspace *vtx = GET_VERTEX_STATE(p->ctx); + struct x86_reg ptr_to_src = x86_make_disp(vtxREG, get_offset(vtx, &a->inputptr)); + + /* add a[j].inputstride (hardcoded value - could just as easily + * pull the stride value from memory each time). + */ + x86_lea(&p->func, srcREG, x86_make_disp(srcREG, a->inputstride)); + + /* save new value of a[j].inputptr + */ + x86_mov(&p->func, ptr_to_src, srcREG); + } +} + + +/* Lots of hardcoding + * + * EAX -- pointer to current output vertex + * ECX -- pointer to current attribute + * + */ +static GLboolean build_vertex_emit( struct x86_program *p ) +{ + GLcontext *ctx = p->ctx; + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + GLuint j = 0; + + struct x86_reg vertexEAX = x86_make_reg(file_REG32, reg_AX); + struct x86_reg srcECX = x86_make_reg(file_REG32, reg_CX); + struct x86_reg countEBP = x86_make_reg(file_REG32, reg_BP); + struct x86_reg vtxESI = x86_make_reg(file_REG32, reg_SI); + struct x86_reg temp = x86_make_reg(file_XMM, 0); + struct x86_reg vp0 = x86_make_reg(file_XMM, 1); + struct x86_reg vp1 = x86_make_reg(file_XMM, 2); + GLubyte *fixup, *label; + + x86_init_func(&p->func); + + /* Push a few regs? + */ + x86_push(&p->func, countEBP); + x86_push(&p->func, vtxESI); + + + /* Get vertex count, compare to zero + */ + x86_xor(&p->func, srcECX, srcECX); + x86_mov(&p->func, countEBP, x86_fn_arg(&p->func, 2)); + x86_cmp(&p->func, countEBP, srcECX); + fixup = x86_jcc_forward(&p->func, cc_E); + + /* Initialize destination register. + */ + x86_mov(&p->func, vertexEAX, x86_fn_arg(&p->func, 3)); + + /* Dereference ctx to get tnl, then vtx: + */ + x86_mov(&p->func, vtxESI, x86_fn_arg(&p->func, 1)); + x86_mov(&p->func, vtxESI, x86_make_disp(vtxESI, get_offset(ctx, &ctx->swtnl_context))); + vtxESI = x86_make_disp(vtxESI, get_offset(tnl, &tnl->clipspace)); + + + /* Possibly load vp0, vp1 for viewport calcs: + */ + if (vtx->need_viewport) { + sse_movups(&p->func, vp0, x86_make_disp(vtxESI, get_offset(vtx, &vtx->vp_scale[0]))); + sse_movups(&p->func, vp1, x86_make_disp(vtxESI, get_offset(vtx, &vtx->vp_xlate[0]))); + } + + /* always load, needed or not: + */ + sse_movups(&p->func, p->chan0, x86_make_disp(vtxESI, get_offset(vtx, &vtx->chan_scale[0]))); + sse_movups(&p->func, p->identity, x86_make_disp(vtxESI, get_offset(vtx, &vtx->identity[0]))); + + /* Note address for loop jump */ + label = x86_get_label(&p->func); + + /* Emit code for each of the attributes. Currently routes + * everything through SSE registers, even when it might be more + * efficient to stick with regular old x86. No optimization or + * other tricks - enough new ground to cover here just getting + * things working. + */ + while (j < vtx->attr_count) { + struct tnl_clipspace_attr *a = &vtx->attr[j]; + struct x86_reg dest = x86_make_disp(vertexEAX, a->vertoffset); + + /* Now, load an XMM reg from src, perhaps transform, then save. + * Could be shortcircuited in specific cases: + */ + switch (a->format) { + case EMIT_1F: + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 1, x86_deref(srcECX), a->inputsize); + emit_store(p, dest, 1, temp); + update_src_ptr(p, srcECX, vtxESI, a); + break; + case EMIT_2F: + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 2, x86_deref(srcECX), a->inputsize); + emit_store(p, dest, 2, temp); + update_src_ptr(p, srcECX, vtxESI, a); + break; + case EMIT_3F: + /* Potentially the worst case - hardcode 2+1 copying: + */ + if (0) { + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 3, x86_deref(srcECX), a->inputsize); + emit_store(p, dest, 3, temp); + update_src_ptr(p, srcECX, vtxESI, a); + } + else { + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 2, x86_deref(srcECX), a->inputsize); + emit_store(p, dest, 2, temp); + if (a->inputsize > 2) { + emit_load(p, temp, 1, x86_make_disp(srcECX, 8), 1); + emit_store(p, x86_make_disp(dest,8), 1, temp); + } + else { + sse_movss(&p->func, x86_make_disp(dest,8), get_identity(p)); + } + update_src_ptr(p, srcECX, vtxESI, a); + } + break; + case EMIT_4F: + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); + emit_store(p, dest, 4, temp); + update_src_ptr(p, srcECX, vtxESI, a); + break; + case EMIT_2F_VIEWPORT: + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 2, x86_deref(srcECX), a->inputsize); + sse_mulps(&p->func, temp, vp0); + sse_addps(&p->func, temp, vp1); + emit_store(p, dest, 2, temp); + update_src_ptr(p, srcECX, vtxESI, a); + break; + case EMIT_3F_VIEWPORT: + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 3, x86_deref(srcECX), a->inputsize); + sse_mulps(&p->func, temp, vp0); + sse_addps(&p->func, temp, vp1); + emit_store(p, dest, 3, temp); + update_src_ptr(p, srcECX, vtxESI, a); + break; + case EMIT_4F_VIEWPORT: + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); + sse_mulps(&p->func, temp, vp0); + sse_addps(&p->func, temp, vp1); + emit_store(p, dest, 4, temp); + update_src_ptr(p, srcECX, vtxESI, a); + break; + case EMIT_3F_XYW: + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); + sse_shufps(&p->func, temp, temp, SHUF(X,Y,W,Z)); + emit_store(p, dest, 3, temp); + update_src_ptr(p, srcECX, vtxESI, a); + break; + + case EMIT_1UB_1F: + /* Test for PAD3 + 1UB: + */ + if (j > 0 && + a[-1].vertoffset + a[-1].vertattrsize <= a->vertoffset - 3) + { + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 1, x86_deref(srcECX), a->inputsize); + sse_shufps(&p->func, temp, temp, SHUF(X,X,X,X)); + emit_pack_store_4ub(p, x86_make_disp(dest, -3), temp); /* overkill! */ + update_src_ptr(p, srcECX, vtxESI, a); + } + else { + _mesa_printf("Can't emit 1ub %x %x %d\n", a->vertoffset, a[-1].vertoffset, a[-1].vertattrsize ); + return GL_FALSE; + } + break; + case EMIT_3UB_3F_RGB: + case EMIT_3UB_3F_BGR: + /* Test for 3UB + PAD1: + */ + if (j == vtx->attr_count - 1 || + a[1].vertoffset >= a->vertoffset + 4) { + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 3, x86_deref(srcECX), a->inputsize); + if (a->format == EMIT_3UB_3F_BGR) + sse_shufps(&p->func, temp, temp, SHUF(Z,Y,X,W)); + emit_pack_store_4ub(p, dest, temp); + update_src_ptr(p, srcECX, vtxESI, a); + } + /* Test for 3UB + 1UB: + */ + else if (j < vtx->attr_count - 1 && + a[1].format == EMIT_1UB_1F && + a[1].vertoffset == a->vertoffset + 3) { + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 3, x86_deref(srcECX), a->inputsize); + update_src_ptr(p, srcECX, vtxESI, a); + + /* Make room for incoming value: + */ + sse_shufps(&p->func, temp, temp, SHUF(W,X,Y,Z)); + + get_src_ptr(p, srcECX, vtxESI, &a[1]); + emit_load(p, temp, 1, x86_deref(srcECX), a[1].inputsize); + update_src_ptr(p, srcECX, vtxESI, &a[1]); + + /* Rearrange and possibly do BGR conversion: + */ + if (a->format == EMIT_3UB_3F_BGR) + sse_shufps(&p->func, temp, temp, SHUF(W,Z,Y,X)); + else + sse_shufps(&p->func, temp, temp, SHUF(Y,Z,W,X)); + + emit_pack_store_4ub(p, dest, temp); + j++; /* NOTE: two attrs consumed */ + } + else { + _mesa_printf("Can't emit 3ub\n"); + } + return GL_FALSE; /* add this later */ + break; + + case EMIT_4UB_4F_RGBA: + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); + emit_pack_store_4ub(p, dest, temp); + update_src_ptr(p, srcECX, vtxESI, a); + break; + case EMIT_4UB_4F_BGRA: + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); + sse_shufps(&p->func, temp, temp, SHUF(Z,Y,X,W)); + emit_pack_store_4ub(p, dest, temp); + update_src_ptr(p, srcECX, vtxESI, a); + break; + case EMIT_4UB_4F_ARGB: + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); + sse_shufps(&p->func, temp, temp, SHUF(W,X,Y,Z)); + emit_pack_store_4ub(p, dest, temp); + update_src_ptr(p, srcECX, vtxESI, a); + break; + case EMIT_4UB_4F_ABGR: + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); + sse_shufps(&p->func, temp, temp, SHUF(W,Z,Y,X)); + emit_pack_store_4ub(p, dest, temp); + update_src_ptr(p, srcECX, vtxESI, a); + break; + case EMIT_4CHAN_4F_RGBA: + switch (CHAN_TYPE) { + case GL_UNSIGNED_BYTE: + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); + emit_pack_store_4ub(p, dest, temp); + update_src_ptr(p, srcECX, vtxESI, a); + break; + case GL_FLOAT: + get_src_ptr(p, srcECX, vtxESI, a); + emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); + emit_store(p, dest, 4, temp); + update_src_ptr(p, srcECX, vtxESI, a); + break; + case GL_UNSIGNED_SHORT: + default: + _mesa_printf("unknown CHAN_TYPE %s\n", _mesa_lookup_enum_by_nr(CHAN_TYPE)); + return GL_FALSE; + } + break; + default: + _mesa_printf("unknown a[%d].format %d\n", j, a->format); + return GL_FALSE; /* catch any new opcodes */ + } + + /* Increment j by at least 1 - may have been incremented above also: + */ + j++; + } + + /* Next vertex: + */ + x86_lea(&p->func, vertexEAX, x86_make_disp(vertexEAX, vtx->vertex_size)); + + /* decr count, loop if not zero + */ + x86_dec(&p->func, countEBP); + x86_test(&p->func, countEBP, countEBP); + x86_jcc(&p->func, cc_NZ, label); + + /* Exit mmx state? + */ + if (p->func.need_emms) + mmx_emms(&p->func); + + /* Land forward jump here: + */ + x86_fixup_fwd_jump(&p->func, fixup); + + /* Pop regs and return + */ + x86_pop(&p->func, x86_get_base_reg(vtxESI)); + x86_pop(&p->func, countEBP); + x86_ret(&p->func); + + vtx->emit = (tnl_emit_func)x86_get_func(&p->func); + return GL_TRUE; +} + + + +void _tnl_generate_sse_emit( GLcontext *ctx ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + struct x86_program p; + + if (!cpu_has_xmm) { + vtx->codegen_emit = NULL; + return; + } + + memset(&p, 0, sizeof(p)); + + p.ctx = ctx; + p.inputs_safe = 0; /* for now */ + p.outputs_safe = 1; /* for now */ + p.have_sse2 = cpu_has_xmm2; + p.identity = x86_make_reg(file_XMM, 6); + p.chan0 = x86_make_reg(file_XMM, 7); + + x86_init_func(&p.func); + + if (build_vertex_emit(&p)) { + _tnl_register_fastpath( vtx, GL_TRUE ); + } + else { + /* Note the failure so that we don't keep trying to codegen an + * impossible state: + */ + _tnl_register_fastpath( vtx, GL_FALSE ); + x86_release_func(&p.func); + } +} + +#else + +void _tnl_generate_sse_emit( GLcontext *ctx ) +{ + /* Dummy version for when USE_SSE_ASM not defined */ +} + +#endif diff --git a/reactos/dll/mesa32/src/tnl/t_vp_build.c b/reactos/dll/mesa32/src/tnl/t_vp_build.c new file mode 100644 index 00000000000..e62c5b374c2 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vp_build.c @@ -0,0 +1,1497 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3.1 + * + * Copyright (C) 2005 Tungsten Graphics 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. + */ + +/** + * \file t_vp_build.c + * Create a vertex program to execute the current fixed function T&L pipeline. + * \author Keith Whitwell + */ + + +#include "glheader.h" +#include "macros.h" +#include "enums.h" +#include "t_context.h" +#include "t_vp_build.h" + +#include "shader/program.h" +#include "shader/nvvertprog.h" +#include "shader/arbvertparse.h" + +struct state_key { + unsigned light_global_enabled:1; + unsigned light_local_viewer:1; + unsigned light_twoside:1; + unsigned light_color_material:1; + unsigned light_color_material_mask:12; + unsigned light_material_mask:12; + + unsigned normalize:1; + unsigned rescale_normals:1; + unsigned fog_source_is_depth:1; + unsigned tnl_do_vertex_fog:1; + unsigned separate_specular:1; + unsigned fog_enabled:1; + unsigned fog_mode:2; + unsigned point_attenuated:1; + unsigned texture_enabled_global:1; + + struct { + unsigned light_enabled:1; + unsigned light_eyepos3_is_zero:1; + unsigned light_spotcutoff_is_180:1; + unsigned light_attenuated:1; + unsigned texunit_really_enabled:1; + unsigned texmat_enabled:1; + unsigned texgen_enabled:4; + unsigned texgen_mode0:4; + unsigned texgen_mode1:4; + unsigned texgen_mode2:4; + unsigned texgen_mode3:4; + } unit[8]; +}; + + + +#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 TXG_NONE 0 +#define TXG_OBJ_LINEAR 1 +#define TXG_EYE_LINEAR 2 +#define TXG_SPHERE_MAP 3 +#define TXG_REFLECTION_MAP 4 +#define TXG_NORMAL_MAP 5 + +static GLuint translate_texgen( GLboolean enabled, GLenum mode ) +{ + if (!enabled) + return TXG_NONE; + + switch (mode) { + case GL_OBJECT_LINEAR: return TXG_OBJ_LINEAR; + case GL_EYE_LINEAR: return TXG_EYE_LINEAR; + case GL_SPHERE_MAP: return TXG_SPHERE_MAP; + case GL_REFLECTION_MAP_NV: return TXG_REFLECTION_MAP; + case GL_NORMAL_MAP_NV: return TXG_NORMAL_MAP; + default: return TXG_NONE; + } +} + +static struct state_key *make_state_key( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + struct state_key *key = CALLOC_STRUCT(state_key); + GLuint i; + + key->separate_specular = (ctx->Light.Model.ColorControl == + GL_SEPARATE_SPECULAR_COLOR); + + if (ctx->Light.Enabled) { + key->light_global_enabled = 1; + + if (ctx->Light.Model.LocalViewer) + key->light_local_viewer = 1; + + if (ctx->Light.Model.TwoSide) + key->light_twoside = 1; + + if (ctx->Light.ColorMaterialEnabled) { + key->light_color_material = 1; + key->light_color_material_mask = ctx->Light.ColorMaterialBitmask; + } + + for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT ; i < _TNL_ATTRIB_INDEX ; i++) + if (VB->AttribPtr[i]->stride) + key->light_material_mask |= 1<<(i-_TNL_ATTRIB_MAT_FRONT_AMBIENT); + + for (i = 0; i < MAX_LIGHTS; i++) { + struct gl_light *light = &ctx->Light.Light[i]; + + if (light->Enabled) { + key->unit[i].light_enabled = 1; + + if (light->EyePosition[3] == 0.0) + key->unit[i].light_eyepos3_is_zero = 1; + + if (light->SpotCutoff == 180.0) + key->unit[i].light_spotcutoff_is_180 = 1; + + if (light->ConstantAttenuation != 1.0 || + light->LinearAttenuation != 0.0 || + light->QuadraticAttenuation != 0.0) + key->unit[i].light_attenuated = 1; + } + } + } + + if (ctx->Transform.Normalize) + key->normalize = 1; + + if (ctx->Transform.RescaleNormals) + key->rescale_normals = 1; + + if (ctx->Fog.Enabled) + key->fog_enabled = 1; + + if (key->fog_enabled) { + if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) + key->fog_source_is_depth = 1; + + if (tnl->_DoVertexFog) + key->tnl_do_vertex_fog = 1; + + key->fog_mode = translate_fog_mode(ctx->Fog.Mode); + } + + if (ctx->Point._Attenuated) + key->point_attenuated = 1; + + if (ctx->Texture._TexGenEnabled || + ctx->Texture._TexMatEnabled || + ctx->Texture._EnabledUnits) + key->texture_enabled_global = 1; + + for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; + + if (texUnit->_ReallyEnabled) + key->unit[i].texunit_really_enabled = 1; + + if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) + key->unit[i].texmat_enabled = 1; + + if (texUnit->TexGenEnabled) { + key->unit[i].texgen_enabled = 1; + + key->unit[i].texgen_mode0 = + translate_texgen( texUnit->TexGenEnabled & (1<<0), + texUnit->GenModeS ); + key->unit[i].texgen_mode1 = + translate_texgen( texUnit->TexGenEnabled & (1<<1), + texUnit->GenModeT ); + key->unit[i].texgen_mode2 = + translate_texgen( texUnit->TexGenEnabled & (1<<2), + texUnit->GenModeR ); + key->unit[i].texgen_mode3 = + translate_texgen( texUnit->TexGenEnabled & (1<<3), + texUnit->GenModeQ ); + } + } + + return key; +} + + + +/* Very useful debugging tool - produces annotated listing of + * generated program with line/function references for each + * instruction back into this file: + */ +#define DISASSEM (MESA_VERBOSE&VERBOSE_DISASSEM) + +/* Should be tunable by the driver - do we want to do matrix + * multiplications with DP4's or with MUL/MAD's? SSE works better + * with the latter, drivers may differ. + */ +#define PREFER_DP4 0 + +#define MAX_INSN 200 + +/* 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; + GLint idx:8; /* relative addressing may be negative */ + GLuint negate:1; + GLuint swz:12; + GLuint pad:7; +}; + + +struct tnl_program { + const struct state_key *state; + struct vertex_program *program; + + GLuint temp_in_use; + GLuint temp_reserved; + + struct ureg eye_position; + struct ureg eye_position_normalized; + struct ureg eye_normal; + struct ureg identity; + + GLuint materials; + GLuint color_materials; +}; + + +const static struct ureg undef = { + ~0, + ~0, + 0, + 0, + 0 +}; + +/* Local shorthand: + */ +#define X SWIZZLE_X +#define Y SWIZZLE_Y +#define Z SWIZZLE_Z +#define W SWIZZLE_W + + +/* Construct a ureg: + */ +static struct ureg make_ureg(GLuint file, GLint idx) +{ + struct ureg reg; + reg.file = file; + reg.idx = idx; + reg.negate = 0; + reg.swz = SWIZZLE_NOOP; + reg.pad = 0; + return reg; +} + + + +static struct ureg negate( struct ureg reg ) +{ + reg.negate ^= 1; + 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 get_temp( struct tnl_program *p ) +{ + int bit = ffs( ~p->temp_in_use ); + if (!bit) { + fprintf(stderr, "%s: out of temporaries\n", __FILE__); + exit(1); + } + + p->temp_in_use |= 1<<(bit-1); + return make_ureg(PROGRAM_TEMPORARY, bit-1); +} + +static struct ureg reserve_temp( struct tnl_program *p ) +{ + struct ureg temp = get_temp( p ); + p->temp_reserved |= 1<temp_in_use &= ~(1<temp_in_use |= p->temp_reserved; /* can't release reserved temps */ + } +} + +static void release_temps( struct tnl_program *p ) +{ + p->temp_in_use = p->temp_reserved; +} + + + +static struct ureg register_input( struct tnl_program *p, GLuint input ) +{ + p->program->InputsRead |= (1<program->OutputsWritten |= (1<program->Parameters, values ); + return make_ureg(PROGRAM_STATE_VAR, idx); +} + +#define register_const1f(p, s0) register_const4f(p, s0, 0, 0, 1) +#define register_scalar_const(p, s0) register_const4f(p, s0, s0, s0, s0) +#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 GLboolean is_undef( struct ureg reg ) +{ + return reg.file == 0xf; +} + +static struct ureg get_identity_param( struct tnl_program *p ) +{ + if (is_undef(p->identity)) + p->identity = register_const4f(p, 0,0,0,1); + + return p->identity; +} + +static struct ureg register_param6( struct tnl_program *p, + GLint s0, + GLint s1, + GLint s2, + GLint s3, + GLint s4, + GLint s5) +{ + GLint tokens[6]; + GLint idx; + tokens[0] = s0; + tokens[1] = s1; + tokens[2] = s2; + tokens[3] = s3; + tokens[4] = s4; + tokens[5] = s5; + idx = _mesa_add_state_reference( p->program->Parameters, tokens ); + return make_ureg(PROGRAM_STATE_VAR, idx); +} + + +#define register_param1(p,s0) register_param6(p,s0,0,0,0,0,0) +#define register_param2(p,s0,s1) register_param6(p,s0,s1,0,0,0,0) +#define register_param3(p,s0,s1,s2) register_param6(p,s0,s1,s2,0,0,0) +#define register_param4(p,s0,s1,s2,s3) register_param6(p,s0,s1,s2,s3,0,0) + + +static void register_matrix_param6( struct tnl_program *p, + GLint s0, + GLint s1, + GLint s2, + GLint s3, + GLint s4, + GLint s5, + struct ureg *matrix ) +{ + GLuint i; + + /* This is a bit sad as the support is there to pull the whole + * matrix out in one go: + */ + for (i = 0; i <= s4 - s3; i++) + matrix[i] = register_param6( p, s0, s1, s2, i, i, s5 ); +} + + +static void emit_arg( struct vp_src_register *src, + struct ureg reg ) +{ + src->File = reg.file; + src->Index = reg.idx; + src->Swizzle = reg.swz; + src->Negate = reg.negate; + src->RelAddr = 0; + src->pad = 0; +} + +static void emit_dst( struct vp_dst_register *dst, + struct ureg reg, GLuint mask ) +{ + dst->File = reg.file; + dst->Index = reg.idx; + /* allow zero as a shorthand for xyzw */ + dst->WriteMask = mask ? mask : WRITEMASK_XYZW; + dst->pad = 0; +} + +static void debug_insn( struct vp_instruction *inst, const char *fn, + GLuint line ) +{ + if (DISASSEM) { + static const char *last_fn; + + if (fn != last_fn) { + last_fn = fn; + _mesa_printf("%s:\n", fn); + } + + _mesa_printf("%d:\t", line); + _mesa_debug_vp_inst(1, inst); + } +} + + +static void emit_op3fn(struct tnl_program *p, + GLuint op, + struct ureg dest, + GLuint mask, + struct ureg src0, + struct ureg src1, + struct ureg src2, + const char *fn, + GLuint line) +{ + GLuint nr = p->program->Base.NumInstructions++; + struct vp_instruction *inst = &p->program->Instructions[nr]; + + if (p->program->Base.NumInstructions > MAX_INSN) { + _mesa_problem(0, "Out of instructions in emit_op3fn\n"); + return; + } + + inst->Opcode = op; + inst->StringPos = 0; + inst->Data = 0; + + emit_arg( &inst->SrcReg[0], src0 ); + emit_arg( &inst->SrcReg[1], src1 ); + emit_arg( &inst->SrcReg[2], src2 ); + + emit_dst( &inst->DstReg, dest, mask ); + + debug_insn(inst, fn, line); +} + + +#define emit_op3(p, op, dst, mask, src0, src1, src2) \ + emit_op3fn(p, op, dst, mask, src0, src1, src2, __FUNCTION__, __LINE__) + +#define emit_op2(p, op, dst, mask, src0, src1) \ + emit_op3fn(p, op, dst, mask, src0, src1, undef, __FUNCTION__, __LINE__) + +#define emit_op1(p, op, dst, mask, src0) \ + emit_op3fn(p, op, dst, mask, src0, undef, undef, __FUNCTION__, __LINE__) + + +static struct ureg make_temp( struct tnl_program *p, struct ureg reg ) +{ + if (reg.file == PROGRAM_TEMPORARY && + !(p->temp_reserved & (1<eye_position)) { + struct ureg pos = register_input( p, VERT_ATTRIB_POS ); + struct ureg modelview[4]; + + p->eye_position = reserve_temp(p); + + if (PREFER_DP4) { + register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 3, + STATE_MATRIX, modelview ); + + emit_matrix_transform_vec4(p, p->eye_position, modelview, pos); + } + else { + register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 3, + STATE_MATRIX_TRANSPOSE, modelview ); + + emit_transpose_matrix_transform_vec4(p, p->eye_position, modelview, pos); + } + } + + return p->eye_position; +} + + +static struct ureg get_eye_position_normalized( struct tnl_program *p ) +{ + if (is_undef(p->eye_position_normalized)) { + struct ureg eye = get_eye_position(p); + p->eye_position_normalized = reserve_temp(p); + emit_normalize_vec3(p, p->eye_position_normalized, eye); + } + + return p->eye_position_normalized; +} + + +static struct ureg get_eye_normal( struct tnl_program *p ) +{ + if (is_undef(p->eye_normal)) { + struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL ); + struct ureg mvinv[3]; + + register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 2, + STATE_MATRIX_INVTRANS, mvinv ); + + p->eye_normal = reserve_temp(p); + + /* Transform to eye space: + */ + emit_matrix_transform_vec3( p, p->eye_normal, mvinv, normal ); + + /* Normalize/Rescale: + */ + if (p->state->normalize) { + emit_normalize_vec3( p, p->eye_normal, p->eye_normal ); + } + else if (p->state->rescale_normals) { + struct ureg rescale = register_param2(p, STATE_INTERNAL, + STATE_NORMAL_SCALE); + + emit_op2( p, VP_OPCODE_MUL, p->eye_normal, 0, normal, + swizzle1(rescale, X)); + } + } + + return p->eye_normal; +} + + + +static void build_hpos( struct tnl_program *p ) +{ + struct ureg pos = register_input( p, VERT_ATTRIB_POS ); + struct ureg hpos = register_output( p, VERT_RESULT_HPOS ); + struct ureg mvp[4]; + + if (PREFER_DP4) { + register_matrix_param6( p, STATE_MATRIX, STATE_MVP, 0, 0, 3, + STATE_MATRIX, mvp ); + emit_matrix_transform_vec4( p, hpos, mvp, pos ); + } + else { + register_matrix_param6( p, STATE_MATRIX, STATE_MVP, 0, 0, 3, + STATE_MATRIX_TRANSPOSE, mvp ); + emit_transpose_matrix_transform_vec4( p, hpos, mvp, pos ); + } +} + + +static GLuint material_attrib( GLuint side, GLuint property ) +{ + return ((property - STATE_AMBIENT) * 2 + + side); +} + +static void set_material_flags( struct tnl_program *p ) +{ + p->color_materials = 0; + p->materials = 0; + + if (p->state->light_color_material) { + p->materials = + p->color_materials = p->state->light_color_material_mask; + } + + p->materials |= p->state->light_material_mask; +} + + +static struct ureg get_material( struct tnl_program *p, GLuint side, + GLuint property ) +{ + GLuint attrib = material_attrib(side, property); + + if (p->color_materials & (1<materials & (1<materials & SCENE_COLOR_BITS(side)) { + struct ureg lm_ambient = register_param1(p, STATE_LIGHTMODEL_AMBIENT); + struct ureg material_emission = get_material(p, side, STATE_EMISSION); + struct ureg material_ambient = get_material(p, side, STATE_AMBIENT); + struct ureg material_diffuse = get_material(p, side, STATE_DIFFUSE); + struct ureg tmp = make_temp(p, material_diffuse); + emit_op3(p, VP_OPCODE_MAD, tmp, WRITEMASK_XYZ, lm_ambient, + material_ambient, material_emission); + return tmp; + } + else + return register_param2( p, STATE_LIGHTMODEL_SCENECOLOR, side ); +} + + +static struct ureg get_lightprod( struct tnl_program *p, GLuint light, + GLuint side, GLuint property ) +{ + GLuint attrib = material_attrib(side, property); + if (p->materials & (1<state->unit[i].light_spotcutoff_is_180) { + struct ureg spot_dir = register_param3(p, STATE_LIGHT, i, + STATE_SPOT_DIRECTION); + struct ureg spot = get_temp(p); + struct ureg slt = get_temp(p); + + emit_normalize_vec3( p, spot, spot_dir ); /* XXX: precompute! */ + emit_op2(p, VP_OPCODE_DP3, spot, 0, negate(VPpli), spot); + emit_op2(p, VP_OPCODE_SLT, slt, 0, swizzle1(spot_dir,W), spot); + emit_op2(p, VP_OPCODE_POW, spot, 0, spot, swizzle1(attenuation, W)); + emit_op2(p, VP_OPCODE_MUL, att, 0, slt, spot); + + release_temp(p, spot); + release_temp(p, slt); + } + + /* Calculate distance attenuation: + */ + if (p->state->unit[i].light_attenuated) { + + /* 1/d,d,d,1/d */ + emit_op1(p, VP_OPCODE_RCP, dist, WRITEMASK_YZ, dist); + /* 1,d,d*d,1/d */ + emit_op2(p, VP_OPCODE_MUL, dist, WRITEMASK_XZ, dist, swizzle1(dist,Y)); + /* 1/dist-atten */ + emit_op2(p, VP_OPCODE_DP3, dist, 0, attenuation, dist); + + if (!p->state->unit[i].light_spotcutoff_is_180) { + /* dist-atten */ + emit_op1(p, VP_OPCODE_RCP, dist, 0, dist); + /* spot-atten * dist-atten */ + emit_op2(p, VP_OPCODE_MUL, att, 0, dist, att); + } else { + /* dist-atten */ + emit_op1(p, VP_OPCODE_RCP, att, 0, dist); + } + } + + return att; +} + + + + + +/* Need to add some addtional parameters to allow lighting in object + * space - STATE_SPOT_DIRECTION and STATE_HALF implicitly assume eye + * space lighting. + */ +static void build_lighting( struct tnl_program *p ) +{ + const GLboolean twoside = p->state->light_twoside; + const GLboolean separate = p->state->separate_specular; + GLuint nr_lights = 0, count = 0; + struct ureg normal = get_eye_normal(p); + struct ureg lit = get_temp(p); + struct ureg dots = get_temp(p); + struct ureg _col0 = undef, _col1 = undef; + struct ureg _bfc0 = undef, _bfc1 = undef; + GLuint i; + + for (i = 0; i < MAX_LIGHTS; i++) + if (p->state->unit[i].light_enabled) + nr_lights++; + + set_material_flags(p); + + { + struct ureg shininess = get_material(p, 0, STATE_SHININESS); + emit_op1(p, VP_OPCODE_MOV, dots, WRITEMASK_W, swizzle1(shininess,X)); + release_temp(p, shininess); + + _col0 = make_temp(p, get_scenecolor(p, 0)); + if (separate) + _col1 = make_temp(p, get_identity_param(p)); + else + _col1 = _col0; + + } + + if (twoside) { + struct ureg shininess = get_material(p, 1, STATE_SHININESS); + emit_op1(p, VP_OPCODE_MOV, dots, WRITEMASK_Z, + negate(swizzle1(shininess,X))); + release_temp(p, shininess); + + _bfc0 = make_temp(p, get_scenecolor(p, 1)); + if (separate) + _bfc1 = make_temp(p, get_identity_param(p)); + else + _bfc1 = _bfc0; + } + + + /* If no lights, still need to emit the scenecolor. + */ + { + struct ureg res0 = register_output( p, VERT_RESULT_COL0 ); + emit_op1(p, VP_OPCODE_MOV, res0, 0, _col0); + } + + if (separate) { + struct ureg res1 = register_output( p, VERT_RESULT_COL1 ); + emit_op1(p, VP_OPCODE_MOV, res1, 0, _col1); + } + + if (twoside) { + struct ureg res0 = register_output( p, VERT_RESULT_BFC0 ); + emit_op1(p, VP_OPCODE_MOV, res0, 0, _bfc0); + } + + if (twoside && separate) { + struct ureg res1 = register_output( p, VERT_RESULT_BFC1 ); + emit_op1(p, VP_OPCODE_MOV, res1, 0, _bfc1); + } + + if (nr_lights == 0) { + release_temps(p); + return; + } + + + for (i = 0; i < MAX_LIGHTS; i++) { + if (p->state->unit[i].light_enabled) { + struct ureg half = undef; + struct ureg att = undef, VPpli = undef; + + count++; + + if (p->state->unit[i].light_eyepos3_is_zero) { + /* Can used precomputed constants in this case. + * Attenuation never applies to infinite lights. + */ + VPpli = register_param3(p, STATE_LIGHT, i, + STATE_POSITION_NORMALIZED); + half = register_param3(p, STATE_LIGHT, i, STATE_HALF); + } + else { + struct ureg Ppli = register_param3(p, STATE_LIGHT, i, + STATE_POSITION); + struct ureg V = get_eye_position(p); + struct ureg dist = get_temp(p); + + VPpli = get_temp(p); + half = get_temp(p); + + /* Calulate VPpli vector + */ + emit_op2(p, VP_OPCODE_SUB, VPpli, 0, Ppli, V); + + /* Normalize VPpli. The dist value also used in + * attenuation below. + */ + emit_op2(p, VP_OPCODE_DP3, dist, 0, VPpli, VPpli); + emit_op1(p, VP_OPCODE_RSQ, dist, 0, dist); + emit_op2(p, VP_OPCODE_MUL, VPpli, 0, VPpli, dist); + + + /* Calculate attenuation: + */ + if (!p->state->unit[i].light_spotcutoff_is_180 || + p->state->unit[i].light_attenuated) { + att = calculate_light_attenuation(p, i, VPpli, dist); + } + + + /* Calculate viewer direction, or use infinite viewer: + */ + if (p->state->light_local_viewer) { + struct ureg eye_hat = get_eye_position_normalized(p); + emit_op2(p, VP_OPCODE_SUB, half, 0, VPpli, eye_hat); + } + else { + struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z); + emit_op2(p, VP_OPCODE_ADD, half, 0, VPpli, z_dir); + } + + emit_normalize_vec3(p, half, half); + + release_temp(p, dist); + } + + /* Calculate dot products: + */ + emit_op2(p, VP_OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli); + emit_op2(p, VP_OPCODE_DP3, dots, WRITEMASK_Y, normal, half); + + + /* Front face lighting: + */ + { + struct ureg ambient = get_lightprod(p, i, 0, STATE_AMBIENT); + struct ureg diffuse = get_lightprod(p, i, 0, STATE_DIFFUSE); + struct ureg specular = get_lightprod(p, i, 0, STATE_SPECULAR); + struct ureg res0, res1; + GLuint mask0, mask1; + + emit_op1(p, VP_OPCODE_LIT, lit, 0, dots); + + if (!is_undef(att)) + emit_op2(p, VP_OPCODE_MUL, lit, 0, lit, att); + + + if (count == nr_lights) { + if (separate) { + mask0 = WRITEMASK_XYZ; + mask1 = WRITEMASK_XYZ; + res0 = register_output( p, VERT_RESULT_COL0 ); + res1 = register_output( p, VERT_RESULT_COL1 ); + } + else { + mask0 = 0; + mask1 = WRITEMASK_XYZ; + res0 = _col0; + res1 = register_output( p, VERT_RESULT_COL0 ); + } + } else { + mask0 = 0; + mask1 = 0; + res0 = _col0; + res1 = _col1; + } + + emit_op3(p, VP_OPCODE_MAD, _col0, 0, swizzle1(lit,X), ambient, _col0); + emit_op3(p, VP_OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _col0); + emit_op3(p, VP_OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _col1); + + release_temp(p, ambient); + release_temp(p, diffuse); + release_temp(p, specular); + } + + /* Back face lighting: + */ + if (twoside) { + struct ureg ambient = get_lightprod(p, i, 1, STATE_AMBIENT); + struct ureg diffuse = get_lightprod(p, i, 1, STATE_DIFFUSE); + struct ureg specular = get_lightprod(p, i, 1, STATE_SPECULAR); + struct ureg res0, res1; + GLuint mask0, mask1; + + emit_op1(p, VP_OPCODE_LIT, lit, 0, negate(swizzle(dots,X,Y,W,Z))); + + if (!is_undef(att)) + emit_op2(p, VP_OPCODE_MUL, lit, 0, lit, att); + + if (count == nr_lights) { + if (separate) { + mask0 = WRITEMASK_XYZ; + mask1 = WRITEMASK_XYZ; + res0 = register_output( p, VERT_RESULT_BFC0 ); + res1 = register_output( p, VERT_RESULT_BFC1 ); + } + else { + mask0 = 0; + mask1 = WRITEMASK_XYZ; + res0 = _bfc0; + res1 = register_output( p, VERT_RESULT_BFC0 ); + } + } else { + res0 = _bfc0; + res1 = _bfc1; + mask0 = 0; + mask1 = 0; + } + + emit_op3(p, VP_OPCODE_MAD, _bfc0, 0, swizzle1(lit,X), ambient, _bfc0); + emit_op3(p, VP_OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _bfc0); + emit_op3(p, VP_OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _bfc1); + + release_temp(p, ambient); + release_temp(p, diffuse); + release_temp(p, specular); + } + + release_temp(p, half); + release_temp(p, VPpli); + release_temp(p, att); + } + } + + release_temps( p ); +} + + +static void build_fog( struct tnl_program *p ) +{ + struct ureg fog = register_output(p, VERT_RESULT_FOGC); + struct ureg input; + + if (p->state->fog_source_is_depth) { + input = swizzle1(get_eye_position(p), Z); + } + else { + input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X); + } + + if (p->state->tnl_do_vertex_fog) { + struct ureg params = register_param1(p, STATE_FOG_PARAMS); + struct ureg tmp = get_temp(p); + + switch (p->state->fog_mode) { + case FOG_LINEAR: { + struct ureg id = get_identity_param(p); + emit_op2(p, VP_OPCODE_SUB, tmp, 0, swizzle1(params,Z), input); + emit_op2(p, VP_OPCODE_MUL, tmp, 0, tmp, swizzle1(params,W)); + emit_op2(p, VP_OPCODE_MAX, tmp, 0, tmp, swizzle1(id,X)); /* saturate */ + emit_op2(p, VP_OPCODE_MIN, fog, WRITEMASK_X, tmp, swizzle1(id,W)); + break; + } + case FOG_EXP: + emit_op1(p, VP_OPCODE_ABS, tmp, 0, input); + emit_op2(p, VP_OPCODE_MUL, tmp, 0, tmp, swizzle1(params,X)); + emit_op2(p, VP_OPCODE_POW, fog, WRITEMASK_X, + register_const1f(p, M_E), negate(tmp)); + break; + case FOG_EXP2: + emit_op2(p, VP_OPCODE_MUL, tmp, 0, input, swizzle1(params,X)); + emit_op2(p, VP_OPCODE_MUL, tmp, 0, tmp, tmp); + emit_op2(p, VP_OPCODE_POW, fog, WRITEMASK_X, + register_const1f(p, M_E), negate(tmp)); + break; + } + + release_temp(p, tmp); + } + else { + /* results = incoming fog coords (compute fog per-fragment later) + * + * KW: Is it really necessary to do anything in this case? + */ + emit_op1(p, VP_OPCODE_MOV, fog, WRITEMASK_X, input); + } +} + +static void build_reflect_texgen( struct tnl_program *p, + struct ureg dest, + GLuint writemask ) +{ + struct ureg normal = get_eye_normal(p); + struct ureg eye_hat = get_eye_position_normalized(p); + struct ureg tmp = get_temp(p); + + /* n.u */ + emit_op2(p, VP_OPCODE_DP3, tmp, 0, normal, eye_hat); + /* 2n.u */ + emit_op2(p, VP_OPCODE_ADD, tmp, 0, tmp, tmp); + /* (-2n.u)n + u */ + emit_op3(p, VP_OPCODE_MAD, dest, writemask, negate(tmp), normal, eye_hat); +} + +static void build_sphere_texgen( struct tnl_program *p, + struct ureg dest, + GLuint writemask ) +{ + struct ureg normal = get_eye_normal(p); + struct ureg eye_hat = get_eye_position_normalized(p); + struct ureg tmp = get_temp(p); + struct ureg half = register_scalar_const(p, .5); + struct ureg r = get_temp(p); + struct ureg inv_m = get_temp(p); + struct ureg id = get_identity_param(p); + + /* Could share the above calculations, but it would be + * a fairly odd state for someone to set (both sphere and + * reflection active for different texture coordinate + * components. Of course - if two texture units enable + * reflect and/or sphere, things start to tilt in favour + * of seperating this out: + */ + + /* n.u */ + emit_op2(p, VP_OPCODE_DP3, tmp, 0, normal, eye_hat); + /* 2n.u */ + emit_op2(p, VP_OPCODE_ADD, tmp, 0, tmp, tmp); + /* (-2n.u)n + u */ + emit_op3(p, VP_OPCODE_MAD, r, 0, negate(tmp), normal, eye_hat); + /* r + 0,0,1 */ + emit_op2(p, VP_OPCODE_ADD, tmp, 0, r, swizzle(id,X,Y,W,Z)); + /* rx^2 + ry^2 + (rz+1)^2 */ + emit_op2(p, VP_OPCODE_DP3, tmp, 0, tmp, tmp); + /* 2/m */ + emit_op1(p, VP_OPCODE_RSQ, tmp, 0, tmp); + /* 1/m */ + emit_op2(p, VP_OPCODE_MUL, inv_m, 0, tmp, half); + /* r/m + 1/2 */ + emit_op3(p, VP_OPCODE_MAD, dest, writemask, r, inv_m, half); + + release_temp(p, tmp); + release_temp(p, r); + release_temp(p, inv_m); +} + + +static void build_texture_transform( struct tnl_program *p ) +{ + GLuint i, j; + + for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + GLuint texmat_enabled = p->state->unit[i].texmat_enabled; + + if (p->state->unit[i].texgen_enabled || texmat_enabled) { + struct ureg out = register_output(p, VERT_RESULT_TEX0 + i); + struct ureg out_texgen = undef; + + if (p->state->unit[i].texgen_enabled) { + GLuint copy_mask = 0; + GLuint sphere_mask = 0; + GLuint reflect_mask = 0; + GLuint normal_mask = 0; + GLuint modes[4]; + + if (texmat_enabled) + out_texgen = get_temp(p); + else + out_texgen = out; + + modes[0] = p->state->unit[i].texgen_mode0; + modes[1] = p->state->unit[i].texgen_mode1; + modes[2] = p->state->unit[i].texgen_mode2; + modes[3] = p->state->unit[i].texgen_mode3; + + for (j = 0; j < 4; j++) { + switch (modes[j]) { + case TXG_OBJ_LINEAR: { + struct ureg obj = register_input(p, VERT_ATTRIB_POS); + struct ureg plane = + register_param3(p, STATE_TEXGEN, i, + STATE_TEXGEN_OBJECT_S + j); + + emit_op2(p, VP_OPCODE_DP4, out_texgen, WRITEMASK_X << j, + obj, plane ); + break; + } + case TXG_EYE_LINEAR: { + struct ureg eye = get_eye_position(p); + struct ureg plane = + register_param3(p, STATE_TEXGEN, i, + STATE_TEXGEN_EYE_S + j); + + emit_op2(p, VP_OPCODE_DP4, out_texgen, WRITEMASK_X << j, + eye, plane ); + break; + } + case TXG_SPHERE_MAP: + sphere_mask |= WRITEMASK_X << j; + break; + case TXG_REFLECTION_MAP: + reflect_mask |= WRITEMASK_X << j; + break; + case TXG_NORMAL_MAP: + normal_mask |= WRITEMASK_X << j; + break; + case TXG_NONE: + copy_mask |= WRITEMASK_X << j; + } + + } + + + if (sphere_mask) { + build_sphere_texgen(p, out_texgen, sphere_mask); + } + + if (reflect_mask) { + build_reflect_texgen(p, out_texgen, reflect_mask); + } + + if (normal_mask) { + struct ureg normal = get_eye_normal(p); + emit_op1(p, VP_OPCODE_MOV, out_texgen, normal_mask, normal ); + } + + if (copy_mask) { + struct ureg in = register_input(p, VERT_ATTRIB_TEX0+i); + emit_op1(p, VP_OPCODE_MOV, out_texgen, copy_mask, in ); + } + } + + if (texmat_enabled) { + struct ureg texmat[4]; + struct ureg in = (!is_undef(out_texgen) ? + out_texgen : + register_input(p, VERT_ATTRIB_TEX0+i)); + if (PREFER_DP4) { + register_matrix_param6( p, STATE_MATRIX, STATE_TEXTURE, i, + 0, 3, STATE_MATRIX, texmat ); + emit_matrix_transform_vec4( p, out, texmat, in ); + } + else { + register_matrix_param6( p, STATE_MATRIX, STATE_TEXTURE, i, + 0, 3, STATE_MATRIX_TRANSPOSE, texmat ); + emit_transpose_matrix_transform_vec4( p, out, texmat, in ); + } + } + + release_temps(p); + } + else if (p->state->unit[i].texunit_really_enabled) { + /* KW: _ReallyEnabled isn't sufficient? Need to know whether + * this texture unit is referenced by the fragment shader. + */ + emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i); + } + } +} + + +/* Seems like it could be tighter: + */ +static void build_pointsize( struct tnl_program *p ) +{ + struct ureg eye = get_eye_position(p); + struct ureg state_size = register_param1(p, STATE_POINT_SIZE); + struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION); + struct ureg out = register_output(p, VERT_RESULT_PSIZ); + struct ureg ut = get_temp(p); + + /* 1, -Z, Z * Z, 1 */ + emit_op1(p, VP_OPCODE_MOV, ut, 0, swizzle1(get_identity_param(p), W)); + emit_op2(p, VP_OPCODE_MUL, ut, WRITEMASK_YZ, ut, negate(swizzle1(eye, Z))); + emit_op2(p, VP_OPCODE_MUL, ut, WRITEMASK_Z, ut, negate(swizzle1(eye, Z))); + + + /* p1 + p2 * dist + p3 * dist * dist, 0 */ + emit_op2(p, VP_OPCODE_DP3, ut, 0, ut, state_attenuation); + + /* 1 / factor */ + emit_op1(p, VP_OPCODE_RCP, ut, 0, ut ); + + /* out = pointSize / factor */ + emit_op2(p, VP_OPCODE_MUL, out, WRITEMASK_X, ut, state_size); + + release_temp(p, ut); +} + +static void build_tnl_program( struct tnl_program *p ) +{ /* Emit the program, starting with modelviewproject: + */ + build_hpos(p); + + /* Lighting calculations: + */ + if (p->state->light_global_enabled) + build_lighting(p); + else + emit_passthrough(p, VERT_ATTRIB_COLOR0, VERT_RESULT_COL0); + + if (p->state->fog_enabled) + build_fog(p); + + if (p->state->texture_enabled_global) + build_texture_transform(p); + + if (p->state->point_attenuated) + build_pointsize(p); + + /* Finish up: + */ + emit_op1(p, VP_OPCODE_END, undef, 0, undef); + + /* Disassemble: + */ + if (DISASSEM) { + _mesa_printf ("\n"); + } +} + + +static void +create_new_program( const struct state_key *key, + struct vertex_program *program, + GLuint max_temps) +{ + struct tnl_program p; + + _mesa_memset(&p, 0, sizeof(p)); + p.state = key; + p.program = program; + p.eye_position = undef; + p.eye_position_normalized = undef; + p.eye_normal = undef; + p.identity = undef; + p.temp_in_use = 0; + + if (max_temps >= sizeof(int) * 8) + p.temp_reserved = 0; + else + p.temp_reserved = ~((1<Instructions = MALLOC(sizeof(struct vp_instruction) * MAX_INSN); + p.program->Base.String = 0; + p.program->Base.NumInstructions = + p.program->Base.NumTemporaries = + p.program->Base.NumParameters = + p.program->Base.NumAttributes = p.program->Base.NumAddressRegs = 0; + p.program->Parameters = _mesa_new_parameter_list(); + p.program->InputsRead = 0; + p.program->OutputsWritten = 0; + + build_tnl_program( &p ); +} + +static void *search_cache( struct tnl_cache *cache, + GLuint hash, + const void *key, + GLuint keysize) +{ + struct tnl_cache *c; + + for (c = cache; c; c = c->next) { + if (c->hash == hash && memcmp(c->key, key, keysize) == 0) + return c->data; + } + + return NULL; +} + +static void cache_item( struct tnl_cache **cache, + GLuint hash, + void *key, + void *data ) +{ + struct tnl_cache *c = MALLOC(sizeof(*c)); + c->hash = hash; + c->key = key; + c->data = data; + c->next = *cache; + *cache = c; +} + +static GLuint hash_key( struct state_key *key ) +{ + GLuint *ikey = (GLuint *)key; + GLuint hash = 0, i; + + /* I'm sure this can be improved on, but speed is important: + */ + for (i = 0; i < sizeof(*key)/sizeof(GLuint); i++) + hash ^= ikey[i]; + + return hash; +} + +void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct state_key *key; + GLuint hash; + + if (ctx->VertexProgram._Enabled) + return; + + /* Grab all the relevent state and put it in a single structure: + */ + key = make_state_key(ctx); + hash = hash_key(key); + + /* Look for an already-prepared program for this state: + */ + ctx->_TnlProgram = (struct vertex_program *) + search_cache( tnl->vp_cache, hash, key, sizeof(*key) ); + + /* OK, we'll have to build a new one: + */ + if (!ctx->_TnlProgram) { + if (0) + _mesa_printf("Build new TNL program\n"); + + ctx->_TnlProgram = (struct vertex_program *) + ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); + + create_new_program( key, ctx->_TnlProgram, + ctx->Const.MaxVertexProgramTemps ); + + cache_item(&tnl->vp_cache, hash, key, ctx->_TnlProgram ); + } + else { + FREE(key); + if (0) + _mesa_printf("Found existing TNL program for key %x\n", hash); + } + + /* Need a BindProgram callback for the driver? + */ +} + + +void _tnl_ProgramCacheDestroy( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct tnl_cache *a, *tmp; + + for (a = tnl->vp_cache ; a; a = tmp) { + tmp = a->next; + FREE(a->key); + FREE(a->data); + FREE(a); + } +} diff --git a/reactos/dll/mesa32/src/tnl/t_vp_build.h b/reactos/dll/mesa32/src/tnl/t_vp_build.h new file mode 100644 index 00000000000..83e685b1ae4 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vp_build.h @@ -0,0 +1,35 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 2005 Tungsten Graphics 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. + */ + + +#ifndef _T_ARB_BUILD_H +#define _T_ARB_BUILD_H + +#include "mtypes.h" + +extern void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ); + +extern void _tnl_ProgramCacheDestroy( GLcontext *ctx ); + +#endif diff --git a/reactos/dll/mesa32/src/tnl/t_vtx_api.c b/reactos/dll/mesa32/src/tnl/t_vtx_api.c new file mode 100644 index 00000000000..fa9e04ad336 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vtx_api.c @@ -0,0 +1,976 @@ +/* $XFree86$ */ +/************************************************************************** + +Copyright 2002 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 +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 +TUNGSTEN GRAPHICS 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. + +**************************************************************************/ + +/* + * Authors: + * Keith Whitwell + */ + +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "vtxfmt.h" +#include "dlist.h" +#include "state.h" +#include "light.h" +#include "api_arrayelt.h" +#include "api_noop.h" +#include "t_vtx_api.h" +#include "simple_list.h" + +#include "dispatch.h" + +static void reset_attrfv( TNLcontext *tnl ); + +static tnl_attrfv_func choose[_TNL_MAX_ATTR_CODEGEN+1][4]; /* +1 for ERROR_ATTRIB */ +static tnl_attrfv_func generic_attr_func[_TNL_MAX_ATTR_CODEGEN][4]; + + +/* Close off the last primitive, execute the buffer, restart the + * primitive. + */ +static void _tnl_wrap_buffers( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + + if (tnl->vtx.prim_count == 0) { + tnl->vtx.copied.nr = 0; + tnl->vtx.counter = tnl->vtx.initial_counter; + tnl->vtx.vbptr = tnl->vtx.buffer; + } + else { + GLuint last_prim = tnl->vtx.prim[tnl->vtx.prim_count-1].mode; + GLuint last_count; + + if (ctx->Driver.CurrentExecPrimitive != GL_POLYGON+1) { + GLint i = tnl->vtx.prim_count - 1; + assert(i >= 0); + tnl->vtx.prim[i].count = ((tnl->vtx.initial_counter - + tnl->vtx.counter) - + tnl->vtx.prim[i].start); + } + + last_count = tnl->vtx.prim[tnl->vtx.prim_count-1].count; + + /* Execute the buffer and save copied vertices. + */ + if (tnl->vtx.counter != tnl->vtx.initial_counter) + _tnl_flush_vtx( ctx ); + else { + tnl->vtx.prim_count = 0; + tnl->vtx.copied.nr = 0; + } + + /* Emit a glBegin to start the new list. + */ + assert(tnl->vtx.prim_count == 0); + + if (ctx->Driver.CurrentExecPrimitive != GL_POLYGON+1) { + tnl->vtx.prim[0].mode = ctx->Driver.CurrentExecPrimitive; + tnl->vtx.prim[0].start = 0; + tnl->vtx.prim[0].count = 0; + tnl->vtx.prim_count++; + + if (tnl->vtx.copied.nr == last_count) + tnl->vtx.prim[0].mode |= last_prim & PRIM_BEGIN; + } + } +} + + +/* Deal with buffer wrapping where provoked by the vertex buffer + * filling up, as opposed to upgrade_vertex(). + * + * Make it GLAPIENTRY, so we can tail from the codegen'ed Vertex*fv + */ +void GLAPIENTRY _tnl_wrap_filled_vertex( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLfloat *data = tnl->vtx.copied.buffer; + GLuint i; + + /* Run pipeline on current vertices, copy wrapped vertices + * to tnl->copied. + */ + _tnl_wrap_buffers( ctx ); + + /* Copy stored stored vertices to start of new list. + */ + assert(tnl->vtx.counter > tnl->vtx.copied.nr); + + for (i = 0 ; i < tnl->vtx.copied.nr ; i++) { + _mesa_memcpy( tnl->vtx.vbptr, data, + tnl->vtx.vertex_size * sizeof(GLfloat)); + tnl->vtx.vbptr += tnl->vtx.vertex_size; + data += tnl->vtx.vertex_size; + tnl->vtx.counter--; + } + + tnl->vtx.copied.nr = 0; +} + + +/* + * Copy the active vertex's values to the ctx->Current fields. + */ +static void _tnl_copy_to_current( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint i; + + for (i = _TNL_ATTRIB_POS+1 ; i < _TNL_ATTRIB_INDEX ; i++) { + if (tnl->vtx.attrsz[i]) { + /* Note: the tnl->vtx.current[i] pointers points to + * the ctx->Current fields. The first 16 or so, anyway. + */ + COPY_CLEAN_4V(tnl->vtx.current[i], + tnl->vtx.attrsz[i], + tnl->vtx.attrptr[i]); + } + } + + /* color index is special (it's not a float[4] so COPY_CLEAN_4V above + * will trash adjacent memory!) + */ + if (tnl->vtx.attrsz[_TNL_ATTRIB_INDEX]) { + ctx->Current.Index = tnl->vtx.attrptr[_TNL_ATTRIB_INDEX][0]; + } + + /* Edgeflag requires additional treatment: + */ + if (tnl->vtx.attrsz[_TNL_ATTRIB_EDGEFLAG]) { + ctx->Current.EdgeFlag = + (tnl->vtx.CurrentFloatEdgeFlag == 1.0); + } + + /* Colormaterial -- this kindof sucks. + */ + if (ctx->Light.ColorMaterialEnabled) { + _mesa_update_color_material(ctx, + ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); + } + + if (tnl->vtx.have_materials) { + tnl->Driver.NotifyMaterialChange( ctx ); + } + + ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT; +} + + +static void _tnl_copy_from_current( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLint i; + + /* Edgeflag requires additional treatment: + */ + tnl->vtx.CurrentFloatEdgeFlag = + (GLfloat)ctx->Current.EdgeFlag; + + for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_MAX ; i++) + switch (tnl->vtx.attrsz[i]) { + case 4: tnl->vtx.attrptr[i][3] = tnl->vtx.current[i][3]; + case 3: tnl->vtx.attrptr[i][2] = tnl->vtx.current[i][2]; + case 2: tnl->vtx.attrptr[i][1] = tnl->vtx.current[i][1]; + case 1: tnl->vtx.attrptr[i][0] = tnl->vtx.current[i][0]; + break; + } + + ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; +} + + +/* Flush existing data, set new attrib size, replay copied vertices. + */ +static void _tnl_wrap_upgrade_vertex( GLcontext *ctx, + GLuint attr, + GLuint newsz ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint oldsz; + GLuint i; + GLfloat *tmp; + GLint lastcount = tnl->vtx.initial_counter - tnl->vtx.counter; + + /* Run pipeline on current vertices, copy wrapped vertices + * to tnl->vtx.copied. + */ + _tnl_wrap_buffers( ctx ); + + + /* Do a COPY_TO_CURRENT to ensure back-copying works for the case + * when the attribute already exists in the vertex and is having + * its size increased. + */ + _tnl_copy_to_current( ctx ); + + + /* Heuristic: Attempt to isolate attributes received outside + * begin/end so that they don't bloat the vertices. + */ + if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END && + tnl->vtx.attrsz[attr] == 0 && + lastcount > 8 && + tnl->vtx.vertex_size) { + reset_attrfv( tnl ); + } + + /* Fix up sizes: + */ + oldsz = tnl->vtx.attrsz[attr]; + tnl->vtx.attrsz[attr] = newsz; + + tnl->vtx.vertex_size += newsz - oldsz; + tnl->vtx.counter = MIN2( VERT_BUFFER_SIZE / tnl->vtx.vertex_size, + ctx->Const.MaxArrayLockSize ); + tnl->vtx.initial_counter = tnl->vtx.counter; + tnl->vtx.vbptr = tnl->vtx.buffer; + + + /* Recalculate all the attrptr[] values + */ + for (i = 0, tmp = tnl->vtx.vertex ; i < _TNL_ATTRIB_MAX ; i++) { + if (tnl->vtx.attrsz[i]) { + tnl->vtx.attrptr[i] = tmp; + tmp += tnl->vtx.attrsz[i]; + } + else + tnl->vtx.attrptr[i] = NULL; /* will not be dereferenced */ + } + + /* Copy from current to repopulate the vertex with correct values. + */ + _tnl_copy_from_current( ctx ); + + /* Replay stored vertices to translate them + * to new format here. + * + * -- No need to replay - just copy piecewise + */ + if (tnl->vtx.copied.nr) + { + GLfloat *data = tnl->vtx.copied.buffer; + GLfloat *dest = tnl->vtx.buffer; + GLuint j; + + for (i = 0 ; i < tnl->vtx.copied.nr ; i++) { + for (j = 0 ; j < _TNL_ATTRIB_MAX ; j++) { + if (tnl->vtx.attrsz[j]) { + if (j == attr) { + if (oldsz) { + COPY_CLEAN_4V( dest, oldsz, data ); + data += oldsz; + dest += newsz; + } else { + COPY_SZ_4V( dest, newsz, tnl->vtx.current[j] ); + dest += newsz; + } + } + else { + GLuint sz = tnl->vtx.attrsz[j]; + COPY_SZ_4V( dest, sz, data ); + dest += sz; + data += sz; + } + } + } + } + + tnl->vtx.vbptr = dest; + tnl->vtx.counter -= tnl->vtx.copied.nr; + tnl->vtx.copied.nr = 0; + } + + /* For codegen - attrptr's may have changed, so need to redo + * codegen. Might be a reasonable place to try & detect attributes + * in the vertex which aren't being submitted any more. + */ + for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) + if (tnl->vtx.attrsz[i]) { + GLuint j = tnl->vtx.attrsz[i] - 1; + + if (i < _TNL_MAX_ATTR_CODEGEN) + tnl->vtx.tabfv[i][j] = choose[i][j]; + } + +} + + +static void _tnl_fixup_vertex( GLcontext *ctx, GLuint attr, GLuint sz ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + static const GLfloat id[4] = { 0, 0, 0, 1 }; + int i; + + if (tnl->vtx.attrsz[attr] < sz) { + /* New size is larger. Need to flush existing vertices and get + * an enlarged vertex format. + */ + _tnl_wrap_upgrade_vertex( ctx, attr, sz ); + } + else if (tnl->vtx.attrsz[attr] > sz) { + /* New size is smaller - just need to fill in some + * zeros. Don't need to flush or wrap. + */ + for (i = sz ; i <= tnl->vtx.attrsz[attr] ; i++) + tnl->vtx.attrptr[attr][i-1] = id[i-1]; + } + + /* Does setting NeedFlush belong here? Necessitates resetting + * vtxfmt on each flush (otherwise flags won't get reset + * afterwards). + */ + if (attr == 0) + ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; + else + ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; +} + +#ifdef USE_X86_ASM + +static struct _tnl_dynfn *lookup( struct _tnl_dynfn *l, GLuint key ) +{ + struct _tnl_dynfn *f; + + foreach( f, l ) { + if (f->key == key) + return f; + } + + return NULL; +} + + +static tnl_attrfv_func do_codegen( GLcontext *ctx, GLuint attr, GLuint sz ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct _tnl_dynfn *dfn = NULL; + + if (attr == 0) { + GLuint key = tnl->vtx.vertex_size; + + dfn = lookup( &tnl->vtx.cache.Vertex[sz-1], key ); + + if (!dfn) + dfn = tnl->vtx.gen.Vertex[sz-1]( ctx, key ); + } + else { + GLuint key = (GLuint) tnl->vtx.attrptr[attr]; + + dfn = lookup( &tnl->vtx.cache.Attribute[sz-1], key ); + + if (!dfn) + dfn = tnl->vtx.gen.Attribute[sz-1]( ctx, key ); + } + + if (dfn) + return *(tnl_attrfv_func *) &dfn->code; + else + return NULL; +} + +#endif /* USE_X86_ASM */ + +/* Helper function for 'CHOOSE' macro. Do what's necessary when an + * entrypoint is called for the first time. + */ + +static tnl_attrfv_func do_choose( GLuint attr, GLuint sz ) +{ + GET_CURRENT_CONTEXT( ctx ); + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint oldsz = tnl->vtx.attrsz[attr]; + + assert(attr < _TNL_MAX_ATTR_CODEGEN); + + if (oldsz != sz) { + /* Reset any active pointers for this attribute + */ + if (oldsz) + tnl->vtx.tabfv[attr][oldsz-1] = choose[attr][oldsz-1]; + + _tnl_fixup_vertex( ctx, attr, sz ); + + } + + + /* Try to use codegen: + */ +#ifdef USE_X86_ASM + if (tnl->AllowCodegen) + tnl->vtx.tabfv[attr][sz-1] = do_codegen( ctx, attr, sz ); + else +#endif + tnl->vtx.tabfv[attr][sz-1] = NULL; + + /* Else use generic version: + */ + if (!tnl->vtx.tabfv[attr][sz-1]) + tnl->vtx.tabfv[attr][sz-1] = generic_attr_func[attr][sz-1]; + + return tnl->vtx.tabfv[attr][sz-1]; +} + + + +#define CHOOSE( ATTR, N ) \ +static void choose_##ATTR##_##N( const GLfloat *v ) \ +{ \ + tnl_attrfv_func f = do_choose(ATTR, N); \ + f( v ); \ +} + +#define CHOOSERS( ATTRIB ) \ + CHOOSE( ATTRIB, 1 ) \ + CHOOSE( ATTRIB, 2 ) \ + CHOOSE( ATTRIB, 3 ) \ + CHOOSE( ATTRIB, 4 ) \ + + +#define INIT_CHOOSERS(ATTR) \ + choose[ATTR][0] = choose_##ATTR##_1; \ + choose[ATTR][1] = choose_##ATTR##_2; \ + choose[ATTR][2] = choose_##ATTR##_3; \ + choose[ATTR][3] = choose_##ATTR##_4; + +CHOOSERS( 0 ) +CHOOSERS( 1 ) +CHOOSERS( 2 ) +CHOOSERS( 3 ) +CHOOSERS( 4 ) +CHOOSERS( 5 ) +CHOOSERS( 6 ) +CHOOSERS( 7 ) +CHOOSERS( 8 ) +CHOOSERS( 9 ) +CHOOSERS( 10 ) +CHOOSERS( 11 ) +CHOOSERS( 12 ) +CHOOSERS( 13 ) +CHOOSERS( 14 ) +CHOOSERS( 15 ) + +static void error_attrib( const GLfloat *unused ) +{ + GET_CURRENT_CONTEXT( ctx ); + (void) unused; + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib" ); +} + + + +static void reset_attrfv( TNLcontext *tnl ) +{ + GLuint i; + + for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) + if (tnl->vtx.attrsz[i]) { + GLint j = tnl->vtx.attrsz[i] - 1; + tnl->vtx.attrsz[i] = 0; + + if (i < _TNL_MAX_ATTR_CODEGEN) { + while (j >= 0) { + tnl->vtx.tabfv[i][j] = choose[i][j]; + j--; + } + } + } + + tnl->vtx.vertex_size = 0; + tnl->vtx.have_materials = 0; +} + + + +/* Materials: + * + * These are treated as per-vertex attributes, at indices above where + * the NV_vertex_program leaves off. There are a lot of good things + * about treating materials this way. + * + * However: I don't want to double the number of generated functions + * just to cope with this, so I unroll the 'C' varients of CHOOSE and + * ATTRF into this function, and dispense with codegen and + * second-level dispatch. + * + * There is no aliasing of material attributes with other entrypoints. + */ +#define OTHER_ATTR( A, N, params ) \ +do { \ + if (tnl->vtx.attrsz[A] != N) { \ + _tnl_fixup_vertex( ctx, A, N ); \ + } \ + \ + { \ + GLfloat *dest = tnl->vtx.attrptr[A]; \ + if (N>0) dest[0] = (params)[0]; \ + if (N>1) dest[1] = (params)[1]; \ + if (N>2) dest[2] = (params)[2]; \ + if (N>3) dest[3] = (params)[3]; \ + } \ +} while (0) + + +#define MAT( ATTR, N, face, params ) \ +do { \ + if (face != GL_BACK) \ + OTHER_ATTR( ATTR, N, params ); /* front */ \ + if (face != GL_FRONT) \ + OTHER_ATTR( ATTR + 1, N, params ); /* back */ \ +} while (0) + + +/* Colormaterial is dealt with later on. + */ +static void GLAPIENTRY _tnl_Materialfv( GLenum face, GLenum pname, + const GLfloat *params ) +{ + GET_CURRENT_CONTEXT( ctx ); + TNLcontext *tnl = TNL_CONTEXT(ctx); + + switch (face) { + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glMaterialfv" ); + return; + } + + switch (pname) { + case GL_EMISSION: + MAT( _TNL_ATTRIB_MAT_FRONT_EMISSION, 4, face, params ); + break; + case GL_AMBIENT: + MAT( _TNL_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params ); + break; + case GL_DIFFUSE: + MAT( _TNL_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params ); + break; + case GL_SPECULAR: + MAT( _TNL_ATTRIB_MAT_FRONT_SPECULAR, 4, face, params ); + break; + case GL_SHININESS: + MAT( _TNL_ATTRIB_MAT_FRONT_SHININESS, 1, face, params ); + break; + case GL_COLOR_INDEXES: + MAT( _TNL_ATTRIB_MAT_FRONT_INDEXES, 3, face, params ); + break; + case GL_AMBIENT_AND_DIFFUSE: + MAT( _TNL_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params ); + MAT( _TNL_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params ); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glMaterialfv" ); + return; + } + + tnl->vtx.have_materials = GL_TRUE; +} + + +static void GLAPIENTRY _tnl_EdgeFlag( GLboolean b ) +{ + GET_CURRENT_CONTEXT( ctx ); + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLfloat f = (GLfloat)b; + + OTHER_ATTR( _TNL_ATTRIB_EDGEFLAG, 1, &f ); +} + +static void GLAPIENTRY _tnl_EdgeFlagv( const GLboolean *v ) +{ + GET_CURRENT_CONTEXT( ctx ); + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLfloat f = (GLfloat)v[0]; + + OTHER_ATTR( _TNL_ATTRIB_EDGEFLAG, 1, &f ); +} + +static void GLAPIENTRY _tnl_Indexf( GLfloat f ) +{ + GET_CURRENT_CONTEXT( ctx ); + TNLcontext *tnl = TNL_CONTEXT(ctx); + + OTHER_ATTR( _TNL_ATTRIB_INDEX, 1, &f ); +} + +static void GLAPIENTRY _tnl_Indexfv( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT( ctx ); + TNLcontext *tnl = TNL_CONTEXT(ctx); + + OTHER_ATTR( _TNL_ATTRIB_INDEX, 1, v ); +} + +/* Eval + */ +static void GLAPIENTRY _tnl_EvalCoord1f( GLfloat u ) +{ + GET_CURRENT_CONTEXT( ctx ); + TNLcontext *tnl = TNL_CONTEXT(ctx); + + /* TODO: use a CHOOSE() function for this: */ + { + GLint i; + if (tnl->vtx.eval.new_state) + _tnl_update_eval( ctx ); + + for (i = 0 ; i <= _TNL_ATTRIB_INDEX ; i++) { + if (tnl->vtx.eval.map1[i].map) + if (tnl->vtx.attrsz[i] != tnl->vtx.eval.map1[i].sz) + _tnl_fixup_vertex( ctx, i, tnl->vtx.eval.map1[i].sz ); + } + } + + + _mesa_memcpy( tnl->vtx.copied.buffer, tnl->vtx.vertex, + tnl->vtx.vertex_size * sizeof(GLfloat)); + + _tnl_do_EvalCoord1f( ctx, u ); + + _mesa_memcpy( tnl->vtx.vertex, tnl->vtx.copied.buffer, + tnl->vtx.vertex_size * sizeof(GLfloat)); +} + +static void GLAPIENTRY _tnl_EvalCoord2f( GLfloat u, GLfloat v ) +{ + GET_CURRENT_CONTEXT( ctx ); + TNLcontext *tnl = TNL_CONTEXT(ctx); + + /* TODO: use a CHOOSE() function for this: */ + { + GLint i; + if (tnl->vtx.eval.new_state) + _tnl_update_eval( ctx ); + + for (i = 0 ; i <= _TNL_ATTRIB_INDEX ; i++) { + if (tnl->vtx.eval.map2[i].map) + if (tnl->vtx.attrsz[i] != tnl->vtx.eval.map2[i].sz) + _tnl_fixup_vertex( ctx, i, tnl->vtx.eval.map2[i].sz ); + } + + if (ctx->Eval.AutoNormal) + if (tnl->vtx.attrsz[_TNL_ATTRIB_NORMAL] != 3) + _tnl_fixup_vertex( ctx, _TNL_ATTRIB_NORMAL, 3 ); + } + + _mesa_memcpy( tnl->vtx.copied.buffer, tnl->vtx.vertex, + tnl->vtx.vertex_size * sizeof(GLfloat)); + + _tnl_do_EvalCoord2f( ctx, u, v ); + + _mesa_memcpy( tnl->vtx.vertex, tnl->vtx.copied.buffer, + tnl->vtx.vertex_size * sizeof(GLfloat)); +} + +static void GLAPIENTRY _tnl_EvalCoord1fv( const GLfloat *u ) +{ + _tnl_EvalCoord1f( u[0] ); +} + +static void GLAPIENTRY _tnl_EvalCoord2fv( const GLfloat *u ) +{ + _tnl_EvalCoord2f( u[0], u[1] ); +} + +static void GLAPIENTRY _tnl_EvalPoint1( GLint i ) +{ + GET_CURRENT_CONTEXT( ctx ); + GLfloat du = ((ctx->Eval.MapGrid1u2 - ctx->Eval.MapGrid1u1) / + (GLfloat) ctx->Eval.MapGrid1un); + GLfloat u = i * du + ctx->Eval.MapGrid1u1; + + _tnl_EvalCoord1f( u ); +} + + +static void GLAPIENTRY _tnl_EvalPoint2( GLint i, GLint j ) +{ + GET_CURRENT_CONTEXT( ctx ); + GLfloat du = ((ctx->Eval.MapGrid2u2 - ctx->Eval.MapGrid2u1) / + (GLfloat) ctx->Eval.MapGrid2un); + GLfloat dv = ((ctx->Eval.MapGrid2v2 - ctx->Eval.MapGrid2v1) / + (GLfloat) ctx->Eval.MapGrid2vn); + GLfloat u = i * du + ctx->Eval.MapGrid2u1; + GLfloat v = j * dv + ctx->Eval.MapGrid2v1; + + _tnl_EvalCoord2f( u, v ); +} + + +/* Build a list of primitives on the fly. Keep + * ctx->Driver.CurrentExecPrimitive uptodate as well. + */ +static void GLAPIENTRY _tnl_Begin( GLenum mode ) +{ + GET_CURRENT_CONTEXT( ctx ); + + if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) { + TNLcontext *tnl = TNL_CONTEXT(ctx); + int i; + + if (ctx->NewState) { + _mesa_update_state( ctx ); + + if ((ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) || + (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBegin (invalid vertex/fragment program)"); + return; + } + + if (!(tnl->Driver.NotifyBegin && + tnl->Driver.NotifyBegin( ctx, mode ))) + CALL_Begin(ctx->Exec, (mode)); + return; + } + + /* Heuristic: attempt to isolate attributes occuring outside + * begin/end pairs. + */ + if (tnl->vtx.vertex_size && !tnl->vtx.attrsz[0]) + _tnl_FlushVertices( ctx, ~0 ); + + i = tnl->vtx.prim_count++; + tnl->vtx.prim[i].mode = mode | PRIM_BEGIN; + tnl->vtx.prim[i].start = tnl->vtx.initial_counter - tnl->vtx.counter; + tnl->vtx.prim[i].count = 0; + + ctx->Driver.CurrentExecPrimitive = mode; + } + else + _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin" ); + +} + +static void GLAPIENTRY _tnl_End( void ) +{ + GET_CURRENT_CONTEXT( ctx ); + + if (ctx->Driver.CurrentExecPrimitive != GL_POLYGON+1) { + TNLcontext *tnl = TNL_CONTEXT(ctx); + int idx = tnl->vtx.initial_counter - tnl->vtx.counter; + int i = tnl->vtx.prim_count - 1; + + tnl->vtx.prim[i].mode |= PRIM_END; + tnl->vtx.prim[i].count = idx - tnl->vtx.prim[i].start; + + ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1; + + /* Two choices which effect the way vertex attributes are + * carried over (or not) between adjacent primitives. + */ +#if 0 + if (tnl->vtx.prim_count == TNL_MAX_PRIM) + _tnl_FlushVertices( ctx, ~0 ); +#else + if (tnl->vtx.prim_count == TNL_MAX_PRIM) + _tnl_flush_vtx( ctx ); +#endif + + } + else + _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" ); +} + + +static void _tnl_exec_vtxfmt_init( GLcontext *ctx ) +{ + GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->exec_vtxfmt); + + vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ + vfmt->Begin = _tnl_Begin; + vfmt->CallList = _mesa_CallList; + vfmt->CallLists = _mesa_CallLists; + vfmt->EdgeFlag = _tnl_EdgeFlag; + vfmt->EdgeFlagv = _tnl_EdgeFlagv; + vfmt->End = _tnl_End; + vfmt->EvalCoord1f = _tnl_EvalCoord1f; + vfmt->EvalCoord1fv = _tnl_EvalCoord1fv; + vfmt->EvalCoord2f = _tnl_EvalCoord2f; + vfmt->EvalCoord2fv = _tnl_EvalCoord2fv; + vfmt->EvalPoint1 = _tnl_EvalPoint1; + vfmt->EvalPoint2 = _tnl_EvalPoint2; + vfmt->Indexf = _tnl_Indexf; + vfmt->Indexfv = _tnl_Indexfv; + vfmt->Materialfv = _tnl_Materialfv; + + vfmt->Rectf = _mesa_noop_Rectf; + vfmt->EvalMesh1 = _mesa_noop_EvalMesh1; + vfmt->EvalMesh2 = _mesa_noop_EvalMesh2; +} + + + +void _tnl_FlushVertices( GLcontext *ctx, GLuint flags ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + (void) flags; + + if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) + return; + + if (tnl->vtx.counter != tnl->vtx.initial_counter) { + _tnl_flush_vtx( ctx ); + } + + if (tnl->vtx.vertex_size) { + _tnl_copy_to_current( ctx ); + reset_attrfv( tnl ); + } + + ctx->Driver.NeedFlush = 0; +} + + +static void _tnl_current_init( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLint i; + + /* setup the pointers for the typical 16 vertex attributes */ + for (i = 0; i < VERT_ATTRIB_MAX; i++) + tnl->vtx.current[i] = ctx->Current.Attrib[i]; + + /* setup pointers for the 12 material attributes */ + for (i = 0; i < MAT_ATTRIB_MAX; i++) + tnl->vtx.current[_TNL_ATTRIB_MAT_FRONT_AMBIENT + i] = + ctx->Light.Material.Attrib[i]; + + tnl->vtx.current[_TNL_ATTRIB_INDEX] = &ctx->Current.Index; + tnl->vtx.current[_TNL_ATTRIB_EDGEFLAG] = &tnl->vtx.CurrentFloatEdgeFlag; +} + +static struct _tnl_dynfn *no_codegen( GLcontext *ctx, int key ) +{ + (void) ctx; (void) key; + return NULL; +} + +void _tnl_vtx_init( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct tnl_vertex_arrays *tmp = &tnl->vtx_inputs; + GLuint i; + static int firsttime = 1; + + if (firsttime) { + firsttime = 0; + + INIT_CHOOSERS( 0 ); + INIT_CHOOSERS( 1 ); + INIT_CHOOSERS( 2 ); + INIT_CHOOSERS( 3 ); + INIT_CHOOSERS( 4 ); + INIT_CHOOSERS( 5 ); + INIT_CHOOSERS( 6 ); + INIT_CHOOSERS( 7 ); + INIT_CHOOSERS( 8 ); + INIT_CHOOSERS( 9 ); + INIT_CHOOSERS( 10 ); + INIT_CHOOSERS( 11 ); + INIT_CHOOSERS( 12 ); + INIT_CHOOSERS( 13 ); + INIT_CHOOSERS( 14 ); + INIT_CHOOSERS( 15 ); + + choose[ERROR_ATTRIB][0] = error_attrib; + choose[ERROR_ATTRIB][1] = error_attrib; + choose[ERROR_ATTRIB][2] = error_attrib; + choose[ERROR_ATTRIB][3] = error_attrib; + +#ifdef USE_X86_ASM + if (tnl->AllowCodegen) { + _tnl_x86choosers(choose, do_choose); /* x86 INIT_CHOOSERS */ + } +#endif + + _tnl_generic_attr_table_init( generic_attr_func ); + } + + for (i = 0; i < _TNL_ATTRIB_INDEX; i++) + _mesa_vector4f_init( &tmp->Attribs[i], 0, NULL); + + for (i = 0; i < 4; i++) { + make_empty_list( &tnl->vtx.cache.Vertex[i] ); + make_empty_list( &tnl->vtx.cache.Attribute[i] ); + tnl->vtx.gen.Vertex[i] = no_codegen; + tnl->vtx.gen.Attribute[i] = no_codegen; + } + +#ifdef USE_X86_ASM + _tnl_InitX86Codegen( &tnl->vtx.gen ); +#endif + + _tnl_current_init( ctx ); + _tnl_exec_vtxfmt_init( ctx ); + _tnl_generic_exec_vtxfmt_init( ctx ); +#ifdef USE_X86_ASM + if (tnl->AllowCodegen) { + _tnl_x86_exec_vtxfmt_init( ctx ); /* x86 DISPATCH_ATTRFV */ + } +#endif + + _mesa_install_exec_vtxfmt( ctx, &tnl->exec_vtxfmt ); + + memcpy( tnl->vtx.tabfv, choose, sizeof(choose) ); + + for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) + tnl->vtx.attrsz[i] = 0; + + tnl->vtx.vertex_size = 0; + tnl->vtx.have_materials = 0; +} + +static void free_funcs( struct _tnl_dynfn *l ) +{ + struct _tnl_dynfn *f, *tmp; + foreach_s (f, tmp, l) { + remove_from_list( f ); + ALIGN_FREE( f->code ); + FREE( f ); + } +} + + +void _tnl_vtx_destroy( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint i; + + for (i = 0; i < 4; i++) { + free_funcs( &tnl->vtx.cache.Vertex[i] ); + free_funcs( &tnl->vtx.cache.Attribute[i] ); + } +} + diff --git a/reactos/dll/mesa32/src/tnl/t_vtx_api.h b/reactos/dll/mesa32/src/tnl/t_vtx_api.h new file mode 100644 index 00000000000..9818c082b80 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vtx_api.h @@ -0,0 +1,90 @@ +/* $XFree86$ */ +/************************************************************************** + +Copyright 2002 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 +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 +TUNGSTEN GRAPHICS 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. + +**************************************************************************/ + +/* + * Authors: + * Keith Whitwell + * + */ + +#ifndef __T_VTX_API_H__ +#define __T_VTX_API_H__ + +#include "t_context.h" + +#define ERROR_ATTRIB 16 + + + +/* t_vtx_api.c: + */ +extern void _tnl_vtx_init( GLcontext *ctx ); +extern void _tnl_vtx_destroy( GLcontext *ctx ); + +extern void _tnl_FlushVertices( GLcontext *ctx, GLuint flags ); +extern void _tnl_flush_vtx( GLcontext *ctx ); + +extern void GLAPIENTRY _tnl_wrap_filled_vertex( GLcontext *ctx ); + +/* t_vtx_exec.c: + */ + +extern void _tnl_do_EvalCoord2f( GLcontext* ctx, GLfloat u, GLfloat v ); +extern void _tnl_do_EvalCoord1f(GLcontext* ctx, GLfloat u); +extern void _tnl_update_eval( GLcontext *ctx ); + +extern GLboolean *_tnl_translate_edgeflag( GLcontext *ctx, + const GLfloat *data, + GLuint count, + GLuint stride ); + +extern GLboolean *_tnl_import_current_edgeflag( GLcontext *ctx, + GLuint count ); + + + +/* t_vtx_generic.c: + */ +extern void _tnl_generic_exec_vtxfmt_init( GLcontext *ctx ); + +extern void _tnl_generic_attr_table_init( tnl_attrfv_func (*tab)[4] ); + +/* t_vtx_x86.c: + */ +extern void _tnl_InitX86Codegen( struct _tnl_dynfn_generators *gen ); + +extern void _tnl_x86_exec_vtxfmt_init( GLcontext *ctx ); + +extern void _tnl_x86choosers( tnl_attrfv_func (*choose)[4], + tnl_attrfv_func (*do_choose)( GLuint attr, + GLuint sz )); + + + + +#endif diff --git a/reactos/dll/mesa32/src/tnl/t_vtx_eval.c b/reactos/dll/mesa32/src/tnl/t_vtx_eval.c new file mode 100644 index 00000000000..d948e700b0d --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vtx_eval.c @@ -0,0 +1,254 @@ +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +#include "glheader.h" +#include "api_eval.h" +#include "context.h" +#include "macros.h" +#include "math/m_eval.h" +#include "t_vtx_api.h" +#include "dispatch.h" + + +static void clear_active_eval1( TNLcontext *tnl, GLuint attr ) +{ + tnl->vtx.eval.map1[attr].map = NULL; +} + +static void clear_active_eval2( TNLcontext *tnl, GLuint attr ) +{ + tnl->vtx.eval.map2[attr].map = NULL; +} + +static void set_active_eval1( TNLcontext *tnl, GLuint attr, GLuint dim, + struct gl_1d_map *map ) +{ + if (!tnl->vtx.eval.map1[attr].map) { + tnl->vtx.eval.map1[attr].map = map; + tnl->vtx.eval.map1[attr].sz = dim; + } +} + +static void set_active_eval2( TNLcontext *tnl, GLuint attr, GLuint dim, + struct gl_2d_map *map ) +{ + if (!tnl->vtx.eval.map2[attr].map) { + tnl->vtx.eval.map2[attr].map = map; + tnl->vtx.eval.map2[attr].sz = dim; + } +} + +void _tnl_update_eval( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint attr; + + /* Vertex program maps have priority over conventional attribs */ + + for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { + clear_active_eval1( tnl, attr ); + clear_active_eval2( tnl, attr ); + } + + if (ctx->VertexProgram._Enabled) { + for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { + if (ctx->Eval.Map1Attrib[attr]) + set_active_eval1( tnl, attr, 4, &ctx->EvalMap.Map1Attrib[attr] ); + + if (ctx->Eval.Map2Attrib[attr]) + set_active_eval2( tnl, attr, 4, &ctx->EvalMap.Map2Attrib[attr] ); + } + } + + if (ctx->Eval.Map1Color4) + set_active_eval1( tnl, VERT_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map1Color4 ); + + if (ctx->Eval.Map2Color4) + set_active_eval2( tnl, VERT_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map2Color4 ); + + if (ctx->Eval.Map1TextureCoord4) + set_active_eval1( tnl, VERT_ATTRIB_TEX0, 4, &ctx->EvalMap.Map1Texture4 ); + else if (ctx->Eval.Map1TextureCoord3) + set_active_eval1( tnl, VERT_ATTRIB_TEX0, 3, &ctx->EvalMap.Map1Texture3 ); + else if (ctx->Eval.Map1TextureCoord2) + set_active_eval1( tnl, VERT_ATTRIB_TEX0, 2, &ctx->EvalMap.Map1Texture2 ); + else if (ctx->Eval.Map1TextureCoord1) + set_active_eval1( tnl, VERT_ATTRIB_TEX0, 1, &ctx->EvalMap.Map1Texture1 ); + + if (ctx->Eval.Map2TextureCoord4) + set_active_eval2( tnl, VERT_ATTRIB_TEX0, 4, &ctx->EvalMap.Map2Texture4 ); + else if (ctx->Eval.Map2TextureCoord3) + set_active_eval2( tnl, VERT_ATTRIB_TEX0, 3, &ctx->EvalMap.Map2Texture3 ); + else if (ctx->Eval.Map2TextureCoord2) + set_active_eval2( tnl, VERT_ATTRIB_TEX0, 2, &ctx->EvalMap.Map2Texture2 ); + else if (ctx->Eval.Map2TextureCoord1) + set_active_eval2( tnl, VERT_ATTRIB_TEX0, 1, &ctx->EvalMap.Map2Texture1 ); + + if (ctx->Eval.Map1Normal) + set_active_eval1( tnl, VERT_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map1Normal ); + + if (ctx->Eval.Map2Normal) + set_active_eval2( tnl, VERT_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map2Normal ); + + if (ctx->Eval.Map1Vertex4) + set_active_eval1( tnl, VERT_ATTRIB_POS, 4, &ctx->EvalMap.Map1Vertex4 ); + else if (ctx->Eval.Map1Vertex3) + set_active_eval1( tnl, VERT_ATTRIB_POS, 3, &ctx->EvalMap.Map1Vertex3 ); + + if (ctx->Eval.Map2Vertex4) + set_active_eval2( tnl, VERT_ATTRIB_POS, 4, &ctx->EvalMap.Map2Vertex4 ); + else if (ctx->Eval.Map2Vertex3) + set_active_eval2( tnl, VERT_ATTRIB_POS, 3, &ctx->EvalMap.Map2Vertex3 ); + + tnl->vtx.eval.new_state = 0; +} + + + +void _tnl_do_EvalCoord1f(GLcontext* ctx, GLfloat u) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint attr; + + for (attr = 1; attr <= _TNL_ATTRIB_INDEX; attr++) { + struct gl_1d_map *map = tnl->vtx.eval.map1[attr].map; + if (map) { + GLfloat uu = (u - map->u1) * map->du; + GLfloat data[4]; + + ASSIGN_4V(data, 0, 0, 0, 1); + + _math_horner_bezier_curve(map->Points, data, uu, + tnl->vtx.eval.map1[attr].sz, + map->Order); + + COPY_SZ_4V( tnl->vtx.attrptr[attr], + tnl->vtx.attrsz[attr], + data ); + } + } + + /** Vertex -- EvalCoord1f is a noop if this map not enabled: + **/ + if (tnl->vtx.eval.map1[0].map) { + struct gl_1d_map *map = tnl->vtx.eval.map1[0].map; + GLfloat uu = (u - map->u1) * map->du; + GLfloat vertex[4]; + + ASSIGN_4V(vertex, 0, 0, 0, 1); + + _math_horner_bezier_curve(map->Points, vertex, uu, + tnl->vtx.eval.map1[0].sz, + map->Order); + + if (tnl->vtx.eval.map1[0].sz == 4) + CALL_Vertex4fv(GET_DISPATCH(), ( vertex )); + else + CALL_Vertex3fv(GET_DISPATCH(), ( vertex )); + } +} + + + +void _tnl_do_EvalCoord2f( GLcontext* ctx, GLfloat u, GLfloat v ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint attr; + + for (attr = 1; attr <= _TNL_ATTRIB_INDEX; attr++) { + struct gl_2d_map *map = tnl->vtx.eval.map2[attr].map; + if (map) { + GLfloat uu = (u - map->u1) * map->du; + GLfloat vv = (v - map->v1) * map->dv; + GLfloat data[4]; + + ASSIGN_4V(data, 0, 0, 0, 1); + + _math_horner_bezier_surf(map->Points, + data, + uu, vv, + tnl->vtx.eval.map2[attr].sz, + map->Uorder, map->Vorder); + + COPY_SZ_4V( tnl->vtx.attrptr[attr], + tnl->vtx.attrsz[attr], + data ); + } + } + + /** Vertex -- EvalCoord2f is a noop if this map not enabled: + **/ + if (tnl->vtx.eval.map2[0].map) { + struct gl_2d_map *map = tnl->vtx.eval.map2[0].map; + GLfloat uu = (u - map->u1) * map->du; + GLfloat vv = (v - map->v1) * map->dv; + GLfloat vertex[4]; + + ASSIGN_4V(vertex, 0, 0, 0, 1); + + if (ctx->Eval.AutoNormal) { + GLfloat normal[4]; + GLfloat du[4], dv[4]; + + _math_de_casteljau_surf(map->Points, vertex, du, dv, uu, vv, + tnl->vtx.eval.map2[0].sz, + map->Uorder, map->Vorder); + + if (tnl->vtx.eval.map2[0].sz == 4) { + du[0] = du[0]*vertex[3] - du[3]*vertex[0]; + du[1] = du[1]*vertex[3] - du[3]*vertex[1]; + du[2] = du[2]*vertex[3] - du[3]*vertex[2]; + + dv[0] = dv[0]*vertex[3] - dv[3]*vertex[0]; + dv[1] = dv[1]*vertex[3] - dv[3]*vertex[1]; + dv[2] = dv[2]*vertex[3] - dv[3]*vertex[2]; + } + + + CROSS3(normal, du, dv); + NORMALIZE_3FV(normal); + normal[3] = 1.0; + + COPY_SZ_4V( tnl->vtx.attrptr[_TNL_ATTRIB_NORMAL], + tnl->vtx.attrsz[_TNL_ATTRIB_NORMAL], + normal ); + + } + else { + _math_horner_bezier_surf(map->Points, vertex, uu, vv, + tnl->vtx.eval.map2[0].sz, + map->Uorder, map->Vorder); + } + + if (tnl->vtx.attrsz[0] == 4) + CALL_Vertex4fv(GET_DISPATCH(), ( vertex )); + else + CALL_Vertex3fv(GET_DISPATCH(), ( vertex )); + } +} + + diff --git a/reactos/dll/mesa32/src/tnl/t_vtx_exec.c b/reactos/dll/mesa32/src/tnl/t_vtx_exec.c new file mode 100644 index 00000000000..ef609781c51 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vtx_exec.c @@ -0,0 +1,284 @@ +/* + * 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: + * Keith Whitwell + */ + +#include "glheader.h" +#include "api_eval.h" +#include "context.h" +#include "enums.h" +#include "state.h" +#include "macros.h" +#include "math/m_eval.h" +#include "t_vtx_api.h" +#include "t_pipeline.h" + + +static void _tnl_print_vtx( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint count = tnl->vtx.initial_counter - tnl->vtx.counter; + GLuint i; + + _mesa_debug(ctx, "_tnl_print_vtx: %u vertices %d primitives, %d vertsize\n", + count, + tnl->vtx.prim_count, + tnl->vtx.vertex_size); + + for (i = 0 ; i < tnl->vtx.prim_count ; i++) { + struct tnl_prim *prim = &tnl->vtx.prim[i]; + _mesa_debug(NULL, " prim %d: %s %d..%d %s %s\n", + i, + _mesa_lookup_enum_by_nr(prim->mode & PRIM_MODE_MASK), + prim->start, + prim->start + prim->count, + (prim->mode & PRIM_BEGIN) ? "BEGIN" : "(wrap)", + (prim->mode & PRIM_END) ? "END" : "(wrap)"); + } +} + +GLboolean *_tnl_translate_edgeflag( GLcontext *ctx, const GLfloat *data, + GLuint count, GLuint stride ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLboolean *ef = tnl->vtx.edgeflag_tmp; + GLuint i; + + if (!ef) + ef = tnl->vtx.edgeflag_tmp = (GLboolean *) MALLOC( tnl->vb.Size ); + + for (i = 0 ; i < count ; i++, data += stride) + ef[i] = (data[0] == 1.0); + + return ef; +} + + +GLboolean *_tnl_import_current_edgeflag( GLcontext *ctx, + GLuint count ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLboolean *ef = tnl->vtx.edgeflag_tmp; + GLboolean tmp = ctx->Current.EdgeFlag; + GLuint i; + + if (!ef) + ef = tnl->vtx.edgeflag_tmp = (GLboolean *) MALLOC( tnl->vb.Size ); + + for (i = 0 ; i < count ; i++) + ef[i] = tmp; + + return ef; +} + +static INLINE GLint get_size( const GLfloat *f ) +{ + if (f[3] != 1.0) return 4; + if (f[2] != 0.0) return 3; + return 2; +} + +/* Some nasty stuff still hanging on here. + * + * TODO - remove VB->NormalPtr, etc and just use the AttrPtr's. + */ +static void _tnl_vb_bind_vtx( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + struct tnl_vertex_arrays *tmp = &tnl->vtx_inputs; + GLfloat *data = tnl->vtx.buffer; + GLuint count = tnl->vtx.initial_counter - tnl->vtx.counter; + GLuint attr, i; + + if (0) fprintf(stderr, "_tnl_vb_bind_vtx(): %d verts %d vertsize\n", + count, tnl->vtx.vertex_size); + + + /* Setup constant data in the VB. + */ + VB->Count = count; + VB->Primitive = tnl->vtx.prim; + VB->PrimitiveCount = tnl->vtx.prim_count; + VB->Elts = NULL; + VB->NormalLengthPtr = NULL; + + for (attr = 0; attr <= _TNL_ATTRIB_INDEX ; attr++) { + if (tnl->vtx.attrsz[attr]) { + tmp->Attribs[attr].count = count; + tmp->Attribs[attr].data = (GLfloat (*)[4]) data; + tmp->Attribs[attr].start = data; + tmp->Attribs[attr].size = tnl->vtx.attrsz[attr]; + tmp->Attribs[attr].stride = tnl->vtx.vertex_size * sizeof(GLfloat); + VB->AttribPtr[attr] = &tmp->Attribs[attr]; + data += tnl->vtx.attrsz[attr]; + } + else { +/* VB->AttribPtr[attr] = &tnl->current.Attribs[attr]; */ + + + tmp->Attribs[attr].count = 1; + tmp->Attribs[attr].data = (GLfloat (*)[4]) tnl->vtx.current[attr]; + tmp->Attribs[attr].start = tnl->vtx.current[attr]; + tmp->Attribs[attr].size = get_size( tnl->vtx.current[attr] ); + tmp->Attribs[attr].stride = 0; + VB->AttribPtr[attr] = &tmp->Attribs[attr]; + } + } + + + /* Copy and translate EdgeFlag to a contiguous array of GLbooleans + */ + if (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) { + if (tnl->vtx.attrsz[_TNL_ATTRIB_EDGEFLAG]) { + VB->EdgeFlag = _tnl_translate_edgeflag( ctx, data, count, + tnl->vtx.vertex_size ); + data++; + } + else + VB->EdgeFlag = _tnl_import_current_edgeflag( ctx, count ); + } + + /* Legacy pointers -- remove one day. + */ + VB->ObjPtr = VB->AttribPtr[_TNL_ATTRIB_POS]; + VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; + VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0]; + VB->ColorPtr[1] = NULL; + VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX]; + VB->IndexPtr[1] = NULL; + VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1]; + VB->SecondaryColorPtr[1] = NULL; + VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG]; + + for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { + VB->TexCoordPtr[i] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]; + } +} + + +/* + * NOTE: Need to have calculated primitives by this point -- do it on the fly. + * NOTE: Old 'parity' issue is gone. + */ +static GLuint _tnl_copy_vertices( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT( ctx ); + GLuint nr = tnl->vtx.prim[tnl->vtx.prim_count-1].count; + GLuint ovf, i; + GLuint sz = tnl->vtx.vertex_size; + GLfloat *dst = tnl->vtx.copied.buffer; + GLfloat *src = (tnl->vtx.buffer + + tnl->vtx.prim[tnl->vtx.prim_count-1].start * + tnl->vtx.vertex_size); + + + switch( ctx->Driver.CurrentExecPrimitive ) + { + case GL_POINTS: + return 0; + case GL_LINES: + ovf = nr&1; + for (i = 0 ; i < ovf ; i++) + _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) ); + return i; + case GL_TRIANGLES: + ovf = nr%3; + for (i = 0 ; i < ovf ; i++) + _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) ); + return i; + case GL_QUADS: + ovf = nr&3; + for (i = 0 ; i < ovf ; i++) + _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) ); + return i; + case GL_LINE_STRIP: + if (nr == 0) + return 0; + else { + _mesa_memcpy( dst, src+(nr-1)*sz, sz * sizeof(GLfloat) ); + return 1; + } + case GL_LINE_LOOP: + case GL_TRIANGLE_FAN: + case GL_POLYGON: + if (nr == 0) + return 0; + else if (nr == 1) { + _mesa_memcpy( dst, src+0, sz * sizeof(GLfloat) ); + return 1; + } else { + _mesa_memcpy( dst, src+0, sz * sizeof(GLfloat) ); + _mesa_memcpy( dst+sz, src+(nr-1)*sz, sz * sizeof(GLfloat) ); + return 2; + } + case GL_TRIANGLE_STRIP: + case GL_QUAD_STRIP: + switch (nr) { + case 0: ovf = 0; break; + case 1: ovf = 1; break; + default: ovf = 2 + (nr&1); break; + } + for (i = 0 ; i < ovf ; i++) + _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) ); + return i; + case GL_POLYGON+1: + return 0; + default: + assert(0); + return 0; + } +} + + +/** + * Execute the buffer and save copied verts. + */ +void _tnl_flush_vtx( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint vertex_count = tnl->vtx.initial_counter - tnl->vtx.counter; + + if (0) + _tnl_print_vtx( ctx ); + + if (tnl->vtx.prim_count && vertex_count) { + + tnl->vtx.copied.nr = _tnl_copy_vertices( ctx ); + + if (tnl->vtx.copied.nr != vertex_count) { + if (ctx->NewState) + _mesa_update_state( ctx ); + + _tnl_vb_bind_vtx( ctx ); + + tnl->Driver.RunPipeline( ctx ); + } + } + + tnl->vtx.prim_count = 0; + tnl->vtx.counter = tnl->vtx.initial_counter; + tnl->vtx.vbptr = tnl->vtx.buffer; +} diff --git a/reactos/dll/mesa32/src/tnl/t_vtx_generic.c b/reactos/dll/mesa32/src/tnl/t_vtx_generic.c new file mode 100644 index 00000000000..0422fcd45dc --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vtx_generic.c @@ -0,0 +1,538 @@ +/************************************************************************** + +Copyright 2004 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 +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 +ATI, TUNGSTEN GRAPHICS 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. + +**************************************************************************/ + +/* + * Authors: + * Keith Whitwell + */ + +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "vtxfmt.h" +#include "dlist.h" +#include "state.h" +#include "light.h" +#include "api_arrayelt.h" +#include "api_noop.h" +#include "t_vtx_api.h" + + +/* Versions of all the entrypoints for situations where codegen isn't + * available. + * + * Note: Only one size for each attribute may be active at once. + * Eg. if Color3f is installed/active, then Color4f may not be, even + * if the vertex actually contains 4 color coordinates. This is + * because the 3f version won't otherwise set color[3] to 1.0 -- this + * is the job of the chooser function when switching between Color4f + * and Color3f. + */ +#define ATTRFV( ATTR, N ) \ +static void attrib_##ATTR##_##N( const GLfloat *v ) \ +{ \ + GET_CURRENT_CONTEXT( ctx ); \ + TNLcontext *tnl = TNL_CONTEXT(ctx); \ + \ + if ((ATTR) == 0) { \ + GLuint i; \ + \ + if (N>0) tnl->vtx.vbptr[0] = v[0]; \ + if (N>1) tnl->vtx.vbptr[1] = v[1]; \ + if (N>2) tnl->vtx.vbptr[2] = v[2]; \ + if (N>3) tnl->vtx.vbptr[3] = v[3]; \ + \ + for (i = N; i < tnl->vtx.vertex_size; i++) \ + tnl->vtx.vbptr[i] = tnl->vtx.vertex[i]; \ + \ + tnl->vtx.vbptr += tnl->vtx.vertex_size; \ + \ + if (--tnl->vtx.counter == 0) \ + _tnl_wrap_filled_vertex( ctx ); \ + } \ + else { \ + GLfloat *dest = tnl->vtx.attrptr[ATTR]; \ + if (N>0) dest[0] = v[0]; \ + if (N>1) dest[1] = v[1]; \ + if (N>2) dest[2] = v[2]; \ + if (N>3) dest[3] = v[3]; \ + } \ +} + +#define INIT(TAB, ATTR) \ + TAB[ATTR][0] = attrib_##ATTR##_1; \ + TAB[ATTR][1] = attrib_##ATTR##_2; \ + TAB[ATTR][2] = attrib_##ATTR##_3; \ + TAB[ATTR][3] = attrib_##ATTR##_4; + + +#define ATTRS( ATTRIB ) \ + ATTRFV( ATTRIB, 1 ) \ + ATTRFV( ATTRIB, 2 ) \ + ATTRFV( ATTRIB, 3 ) \ + ATTRFV( ATTRIB, 4 ) + +ATTRS( 0 ) +ATTRS( 1 ) +ATTRS( 2 ) +ATTRS( 3 ) +ATTRS( 4 ) +ATTRS( 5 ) +ATTRS( 6 ) +ATTRS( 7 ) +ATTRS( 8 ) +ATTRS( 9 ) +ATTRS( 10 ) +ATTRS( 11 ) +ATTRS( 12 ) +ATTRS( 13 ) +ATTRS( 14 ) +ATTRS( 15 ) + +void _tnl_generic_attr_table_init( tnl_attrfv_func (*tab)[4] ) +{ + INIT( tab, 0 ); + INIT( tab, 1 ); + INIT( tab, 2 ); + INIT( tab, 3 ); + INIT( tab, 4 ); + INIT( tab, 5 ); + INIT( tab, 6 ); + INIT( tab, 7 ); + INIT( tab, 8 ); + INIT( tab, 9 ); + INIT( tab, 10 ); + INIT( tab, 11 ); + INIT( tab, 12 ); + INIT( tab, 13 ); + INIT( tab, 14 ); + INIT( tab, 15 ); +} + +/* These can be made efficient with codegen. Further, by adding more + * logic to do_choose(), the double-dispatch for legacy entrypoints + * like glVertex3f() can be removed. + */ +#define DISPATCH_ATTRFV( ATTR, COUNT, P ) \ +do { \ + GET_CURRENT_CONTEXT( ctx ); \ + TNLcontext *tnl = TNL_CONTEXT(ctx); \ + tnl->vtx.tabfv[ATTR][COUNT-1]( P ); \ +} while (0) + +#define DISPATCH_ATTR1FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 1, V ) +#define DISPATCH_ATTR2FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 2, V ) +#define DISPATCH_ATTR3FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 3, V ) +#define DISPATCH_ATTR4FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 4, V ) + +#define DISPATCH_ATTR1F( ATTR, S ) DISPATCH_ATTRFV( ATTR, 1, &(S) ) + +#if defined(USE_X86_ASM) && 0 /* will break register calling convention */ +/* Naughty cheat: + */ +#define DISPATCH_ATTR2F( ATTR, S,T ) DISPATCH_ATTRFV( ATTR, 2, &(S) ) +#define DISPATCH_ATTR3F( ATTR, S,T,R ) DISPATCH_ATTRFV( ATTR, 3, &(S) ) +#define DISPATCH_ATTR4F( ATTR, S,T,R,Q ) DISPATCH_ATTRFV( ATTR, 4, &(S) ) +#else +/* Safe: + */ +#define DISPATCH_ATTR2F( ATTR, S,T ) \ +do { \ + GLfloat v[2]; \ + v[0] = S; v[1] = T; \ + DISPATCH_ATTR2FV( ATTR, v ); \ +} while (0) +#define DISPATCH_ATTR3F( ATTR, S,T,R ) \ +do { \ + GLfloat v[3]; \ + v[0] = S; v[1] = T; v[2] = R; \ + DISPATCH_ATTR3FV( ATTR, v ); \ +} while (0) +#define DISPATCH_ATTR4F( ATTR, S,T,R,Q ) \ +do { \ + GLfloat v[4]; \ + v[0] = S; v[1] = T; v[2] = R; v[3] = Q; \ + DISPATCH_ATTR4FV( ATTR, v ); \ +} while (0) +#endif + + +static void GLAPIENTRY _tnl_Vertex2f( GLfloat x, GLfloat y ) +{ + DISPATCH_ATTR2F( _TNL_ATTRIB_POS, x, y ); +} + +static void GLAPIENTRY _tnl_Vertex2fv( const GLfloat *v ) +{ + DISPATCH_ATTR2FV( _TNL_ATTRIB_POS, v ); +} + +static void GLAPIENTRY _tnl_Vertex3f( GLfloat x, GLfloat y, GLfloat z ) +{ + DISPATCH_ATTR3F( _TNL_ATTRIB_POS, x, y, z ); +} + +static void GLAPIENTRY _tnl_Vertex3fv( const GLfloat *v ) +{ + DISPATCH_ATTR3FV( _TNL_ATTRIB_POS, v ); +} + +static void GLAPIENTRY _tnl_Vertex4f( GLfloat x, GLfloat y, GLfloat z, + GLfloat w ) +{ + DISPATCH_ATTR4F( _TNL_ATTRIB_POS, x, y, z, w ); +} + +static void GLAPIENTRY _tnl_Vertex4fv( const GLfloat *v ) +{ + DISPATCH_ATTR4FV( _TNL_ATTRIB_POS, v ); +} + +static void GLAPIENTRY _tnl_TexCoord1f( GLfloat x ) +{ + DISPATCH_ATTR1F( _TNL_ATTRIB_TEX0, x ); +} + +static void GLAPIENTRY _tnl_TexCoord1fv( const GLfloat *v ) +{ + DISPATCH_ATTR1FV( _TNL_ATTRIB_TEX0, v ); +} + +static void GLAPIENTRY _tnl_TexCoord2f( GLfloat x, GLfloat y ) +{ + DISPATCH_ATTR2F( _TNL_ATTRIB_TEX0, x, y ); +} + +static void GLAPIENTRY _tnl_TexCoord2fv( const GLfloat *v ) +{ + DISPATCH_ATTR2FV( _TNL_ATTRIB_TEX0, v ); +} + +static void GLAPIENTRY _tnl_TexCoord3f( GLfloat x, GLfloat y, GLfloat z ) +{ + DISPATCH_ATTR3F( _TNL_ATTRIB_TEX0, x, y, z ); +} + +static void GLAPIENTRY _tnl_TexCoord3fv( const GLfloat *v ) +{ + DISPATCH_ATTR3FV( _TNL_ATTRIB_TEX0, v ); +} + +static void GLAPIENTRY _tnl_TexCoord4f( GLfloat x, GLfloat y, GLfloat z, + GLfloat w ) +{ + DISPATCH_ATTR4F( _TNL_ATTRIB_TEX0, x, y, z, w ); +} + +static void GLAPIENTRY _tnl_TexCoord4fv( const GLfloat *v ) +{ + DISPATCH_ATTR4FV( _TNL_ATTRIB_TEX0, v ); +} + +static void GLAPIENTRY _tnl_Normal3f( GLfloat x, GLfloat y, GLfloat z ) +{ + DISPATCH_ATTR3F( _TNL_ATTRIB_NORMAL, x, y, z ); +} + +static void GLAPIENTRY _tnl_Normal3fv( const GLfloat *v ) +{ + DISPATCH_ATTR3FV( _TNL_ATTRIB_NORMAL, v ); +} + +static void GLAPIENTRY _tnl_FogCoordfEXT( GLfloat x ) +{ + DISPATCH_ATTR1F( _TNL_ATTRIB_FOG, x ); +} + +static void GLAPIENTRY _tnl_FogCoordfvEXT( const GLfloat *v ) +{ + DISPATCH_ATTR1FV( _TNL_ATTRIB_FOG, v ); +} + +static void GLAPIENTRY _tnl_Color3f( GLfloat x, GLfloat y, GLfloat z ) +{ + DISPATCH_ATTR3F( _TNL_ATTRIB_COLOR0, x, y, z ); +} + +static void GLAPIENTRY _tnl_Color3fv( const GLfloat *v ) +{ + DISPATCH_ATTR3FV( _TNL_ATTRIB_COLOR0, v ); +} + +static void GLAPIENTRY _tnl_Color4f( GLfloat x, GLfloat y, GLfloat z, + GLfloat w ) +{ + DISPATCH_ATTR4F( _TNL_ATTRIB_COLOR0, x, y, z, w ); +} + +static void GLAPIENTRY _tnl_Color4fv( const GLfloat *v ) +{ + DISPATCH_ATTR4FV( _TNL_ATTRIB_COLOR0, v ); +} + +static void GLAPIENTRY _tnl_SecondaryColor3fEXT( GLfloat x, GLfloat y, + GLfloat z ) +{ + DISPATCH_ATTR3F( _TNL_ATTRIB_COLOR1, x, y, z ); +} + +static void GLAPIENTRY _tnl_SecondaryColor3fvEXT( const GLfloat *v ) +{ + DISPATCH_ATTR3FV( _TNL_ATTRIB_COLOR1, v ); +} + +static void GLAPIENTRY _tnl_MultiTexCoord1f( GLenum target, GLfloat x ) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR1F( attr, x ); +} + +static void GLAPIENTRY _tnl_MultiTexCoord1fv( GLenum target, + const GLfloat *v ) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR1FV( attr, v ); +} + +static void GLAPIENTRY _tnl_MultiTexCoord2f( GLenum target, GLfloat x, + GLfloat y ) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR2F( attr, x, y ); +} + +static void GLAPIENTRY _tnl_MultiTexCoord2fv( GLenum target, + const GLfloat *v ) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR2FV( attr, v ); +} + +static void GLAPIENTRY _tnl_MultiTexCoord3f( GLenum target, GLfloat x, + GLfloat y, GLfloat z) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR3F( attr, x, y, z ); +} + +static void GLAPIENTRY _tnl_MultiTexCoord3fv( GLenum target, + const GLfloat *v ) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR3FV( attr, v ); +} + +static void GLAPIENTRY _tnl_MultiTexCoord4f( GLenum target, GLfloat x, + GLfloat y, GLfloat z, + GLfloat w ) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR4F( attr, x, y, z, w ); +} + +static void GLAPIENTRY _tnl_MultiTexCoord4fv( GLenum target, + const GLfloat *v ) +{ + GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; + DISPATCH_ATTR4FV( attr, v ); +} + + +static void GLAPIENTRY _tnl_VertexAttrib1fNV( GLuint index, GLfloat x ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR1F( index, x ); +} + +static void GLAPIENTRY _tnl_VertexAttrib1fvNV( GLuint index, + const GLfloat *v ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR1FV( index, v ); +} + +static void GLAPIENTRY _tnl_VertexAttrib2fNV( GLuint index, GLfloat x, + GLfloat y ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR2F( index, x, y ); +} + +static void GLAPIENTRY _tnl_VertexAttrib2fvNV( GLuint index, + const GLfloat *v ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR2FV( index, v ); +} + +static void GLAPIENTRY _tnl_VertexAttrib3fNV( GLuint index, GLfloat x, + GLfloat y, GLfloat z ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR3F( index, x, y, z ); +} + +static void GLAPIENTRY _tnl_VertexAttrib3fvNV( GLuint index, + const GLfloat *v ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR3FV( index, v ); +} + +static void GLAPIENTRY _tnl_VertexAttrib4fNV( GLuint index, GLfloat x, + GLfloat y, GLfloat z, + GLfloat w ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR4F( index, x, y, z, w ); +} + +static void GLAPIENTRY _tnl_VertexAttrib4fvNV( GLuint index, + const GLfloat *v ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR4FV( index, v ); +} + + +/* + * XXX adjust index + */ + +static void GLAPIENTRY _tnl_VertexAttrib1fARB( GLuint index, GLfloat x ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR1F( index, x ); +} + +static void GLAPIENTRY _tnl_VertexAttrib1fvARB( GLuint index, + const GLfloat *v ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR1FV( index, v ); +} + +static void GLAPIENTRY _tnl_VertexAttrib2fARB( GLuint index, GLfloat x, + GLfloat y ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR2F( index, x, y ); +} + +static void GLAPIENTRY _tnl_VertexAttrib2fvARB( GLuint index, + const GLfloat *v ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR2FV( index, v ); +} + +static void GLAPIENTRY _tnl_VertexAttrib3fARB( GLuint index, GLfloat x, + GLfloat y, GLfloat z ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR3F( index, x, y, z ); +} + +static void GLAPIENTRY _tnl_VertexAttrib3fvARB( GLuint index, + const GLfloat *v ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR3FV( index, v ); +} + +static void GLAPIENTRY _tnl_VertexAttrib4fARB( GLuint index, GLfloat x, + GLfloat y, GLfloat z, + GLfloat w ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR4F( index, x, y, z, w ); +} + +static void GLAPIENTRY _tnl_VertexAttrib4fvARB( GLuint index, + const GLfloat *v ) +{ + if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; + DISPATCH_ATTR4FV( index, v ); +} + + +/* Install the generic versions of the 2nd level dispatch + * functions. Some of these have a codegen alternative. + */ +void _tnl_generic_exec_vtxfmt_init( GLcontext *ctx ) +{ + GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->exec_vtxfmt); + + vfmt->Color3f = _tnl_Color3f; + vfmt->Color3fv = _tnl_Color3fv; + vfmt->Color4f = _tnl_Color4f; + vfmt->Color4fv = _tnl_Color4fv; + vfmt->FogCoordfEXT = _tnl_FogCoordfEXT; + vfmt->FogCoordfvEXT = _tnl_FogCoordfvEXT; + vfmt->MultiTexCoord1fARB = _tnl_MultiTexCoord1f; + vfmt->MultiTexCoord1fvARB = _tnl_MultiTexCoord1fv; + vfmt->MultiTexCoord2fARB = _tnl_MultiTexCoord2f; + vfmt->MultiTexCoord2fvARB = _tnl_MultiTexCoord2fv; + vfmt->MultiTexCoord3fARB = _tnl_MultiTexCoord3f; + vfmt->MultiTexCoord3fvARB = _tnl_MultiTexCoord3fv; + vfmt->MultiTexCoord4fARB = _tnl_MultiTexCoord4f; + vfmt->MultiTexCoord4fvARB = _tnl_MultiTexCoord4fv; + vfmt->Normal3f = _tnl_Normal3f; + vfmt->Normal3fv = _tnl_Normal3fv; + vfmt->SecondaryColor3fEXT = _tnl_SecondaryColor3fEXT; + vfmt->SecondaryColor3fvEXT = _tnl_SecondaryColor3fvEXT; + vfmt->TexCoord1f = _tnl_TexCoord1f; + vfmt->TexCoord1fv = _tnl_TexCoord1fv; + vfmt->TexCoord2f = _tnl_TexCoord2f; + vfmt->TexCoord2fv = _tnl_TexCoord2fv; + vfmt->TexCoord3f = _tnl_TexCoord3f; + vfmt->TexCoord3fv = _tnl_TexCoord3fv; + vfmt->TexCoord4f = _tnl_TexCoord4f; + vfmt->TexCoord4fv = _tnl_TexCoord4fv; + vfmt->Vertex2f = _tnl_Vertex2f; + vfmt->Vertex2fv = _tnl_Vertex2fv; + vfmt->Vertex3f = _tnl_Vertex3f; + vfmt->Vertex3fv = _tnl_Vertex3fv; + vfmt->Vertex4f = _tnl_Vertex4f; + vfmt->Vertex4fv = _tnl_Vertex4fv; + vfmt->VertexAttrib1fNV = _tnl_VertexAttrib1fNV; + vfmt->VertexAttrib1fvNV = _tnl_VertexAttrib1fvNV; + vfmt->VertexAttrib2fNV = _tnl_VertexAttrib2fNV; + vfmt->VertexAttrib2fvNV = _tnl_VertexAttrib2fvNV; + vfmt->VertexAttrib3fNV = _tnl_VertexAttrib3fNV; + vfmt->VertexAttrib3fvNV = _tnl_VertexAttrib3fvNV; + vfmt->VertexAttrib4fNV = _tnl_VertexAttrib4fNV; + vfmt->VertexAttrib4fvNV = _tnl_VertexAttrib4fvNV; + vfmt->VertexAttrib1fARB = _tnl_VertexAttrib1fARB; + vfmt->VertexAttrib1fvARB = _tnl_VertexAttrib1fvARB; + vfmt->VertexAttrib2fARB = _tnl_VertexAttrib2fARB; + vfmt->VertexAttrib2fvARB = _tnl_VertexAttrib2fvARB; + vfmt->VertexAttrib3fARB = _tnl_VertexAttrib3fARB; + vfmt->VertexAttrib3fvARB = _tnl_VertexAttrib3fvARB; + vfmt->VertexAttrib4fARB = _tnl_VertexAttrib4fARB; + vfmt->VertexAttrib4fvARB = _tnl_VertexAttrib4fvARB; +} diff --git a/reactos/dll/mesa32/src/tnl/t_vtx_x86.c b/reactos/dll/mesa32/src/tnl/t_vtx_x86.c new file mode 100644 index 00000000000..38cdad451c7 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vtx_x86.c @@ -0,0 +1,385 @@ +/************************************************************************** + +Copyright 2004 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 +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 +ATI, TUNGSTEN GRAPHICS 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. + +**************************************************************************/ + +/* + * Authors: + * Keith Whitwell + * Daniel Borca + */ + + +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "vtxfmt.h" +#include "dlist.h" +#include "state.h" +#include "light.h" +#include "api_arrayelt.h" +#include "api_noop.h" +#include "t_vtx_api.h" +#include "simple_list.h" + + +#if defined(USE_X86_ASM) && !defined(HAVE_NONSTANDARD_GLAPIENTRY) + +#define EXTERN( FUNC ) \ +extern const char FUNC[]; \ +extern const char FUNC##_end[] + +EXTERN( _tnl_x86_Attribute1fv ); +EXTERN( _tnl_x86_Attribute2fv ); +EXTERN( _tnl_x86_Attribute3fv ); +EXTERN( _tnl_x86_Attribute4fv ); +EXTERN( _tnl_x86_Vertex1fv ); +EXTERN( _tnl_x86_Vertex2fv ); +EXTERN( _tnl_x86_Vertex3fv ); +EXTERN( _tnl_x86_Vertex4fv ); + +EXTERN( _tnl_x86_dispatch_attrf1 ); +EXTERN( _tnl_x86_dispatch_attrf2 ); +EXTERN( _tnl_x86_dispatch_attrf3 ); +EXTERN( _tnl_x86_dispatch_attrf4 ); +EXTERN( _tnl_x86_dispatch_attrfv ); +EXTERN( _tnl_x86_dispatch_multitexcoordf1 ); +EXTERN( _tnl_x86_dispatch_multitexcoordf2 ); +EXTERN( _tnl_x86_dispatch_multitexcoordf3 ); +EXTERN( _tnl_x86_dispatch_multitexcoordf4 ); +EXTERN( _tnl_x86_dispatch_multitexcoordfv ); +EXTERN( _tnl_x86_dispatch_vertexattribf1 ); +EXTERN( _tnl_x86_dispatch_vertexattribf2 ); +EXTERN( _tnl_x86_dispatch_vertexattribf3 ); +EXTERN( _tnl_x86_dispatch_vertexattribf4 ); +EXTERN( _tnl_x86_dispatch_vertexattribfv ); + +EXTERN( _tnl_x86_choose_fv ); + + +#define DONT_KNOW_OFFSETS 1 + + +#define DFN( FUNC, CACHE, KEY ) \ + struct _tnl_dynfn *dfn = MALLOC_STRUCT( _tnl_dynfn );\ + const char *start = FUNC; \ + const char *end = FUNC##_end; \ + int offset = 0; \ + insert_at_head( &CACHE, dfn ); \ + dfn->key = KEY; \ + dfn->code = ALIGN_MALLOC( end - start, 16 ); \ + memcpy (dfn->code, start, end - start) + + + +#define FIXUP( CODE, KNOWN_OFFSET, CHECKVAL, NEWVAL ) \ +do { \ + GLint subst = 0x10101010 + CHECKVAL; \ + \ + if (DONT_KNOW_OFFSETS) { \ + while (*(int *)(CODE+offset) != subst) offset++; \ + *(int *)(CODE+offset) = (int)(NEWVAL); \ + if (0) fprintf(stderr, "%s/%d: offset %d, new value: 0x%x\n", __FILE__, __LINE__, offset, (int)(NEWVAL)); \ + offset += 4; \ + } \ + else { \ + int *icode = (int *)(CODE+KNOWN_OFFSET); \ + assert (*icode == subst); \ + *icode = (int)NEWVAL; \ + } \ +} while (0) + + + +#define FIXUPREL( CODE, KNOWN_OFFSET, CHECKVAL, NEWVAL )\ +do { \ + GLint subst = 0x10101010 + CHECKVAL; \ + \ + if (DONT_KNOW_OFFSETS) { \ + while (*(int *)(CODE+offset) != subst) offset++; \ + *(int *)(CODE+offset) = (int)(NEWVAL) - ((int)(CODE)+offset) - 4; \ + if (0) fprintf(stderr, "%s/%d: offset %d, new value: 0x%x\n", __FILE__, __LINE__, offset, (int)(NEWVAL) - ((int)(CODE)+offset) - 4); \ + offset += 4; \ + } \ + else { \ + int *icode = (int *)(CODE+KNOWN_OFFSET); \ + assert (*icode == subst); \ + *icode = (int)(NEWVAL) - (int)(icode) - 4; \ + } \ +} while (0) + + + + +/* Build specialized versions of the immediate calls on the fly for + * the current state. Generic x86 versions. + */ + +static struct _tnl_dynfn *makeX86Vertex1fv( GLcontext *ctx, int vertex_size ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + DFN ( _tnl_x86_Vertex1fv, tnl->vtx.cache.Vertex[1-1], vertex_size ); + + FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); + FIXUP(dfn->code, 0, 1, vertex_size - 1); + FIXUP(dfn->code, 0, 2, (int)&tnl->vtx.vertex[1]); + FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); + FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); + FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); + FIXUP(dfn->code, 0, 4, (int)ctx); + FIXUPREL(dfn->code, 0, 5, (int)&_tnl_wrap_filled_vertex); + + return dfn; +} + +static struct _tnl_dynfn *makeX86Vertex2fv( GLcontext *ctx, int vertex_size ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + DFN ( _tnl_x86_Vertex2fv, tnl->vtx.cache.Vertex[2-1], vertex_size ); + + FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); + FIXUP(dfn->code, 0, 1, vertex_size - 2); + FIXUP(dfn->code, 0, 2, (int)&tnl->vtx.vertex[2]); + FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); + FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); + FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); + FIXUP(dfn->code, 0, 4, (int)ctx); + FIXUPREL(dfn->code, 0, 5, (int)&_tnl_wrap_filled_vertex); + + return dfn; +} + +static struct _tnl_dynfn *makeX86Vertex3fv( GLcontext *ctx, int vertex_size ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + switch (vertex_size) { + default: { + DFN ( _tnl_x86_Vertex3fv, tnl->vtx.cache.Vertex[3-1], vertex_size ); + + FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); + FIXUP(dfn->code, 0, 1, vertex_size - 3); + FIXUP(dfn->code, 0, 2, (int)&tnl->vtx.vertex[3]); + FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); + FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); + FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); + FIXUP(dfn->code, 0, 4, (int)ctx); + FIXUPREL(dfn->code, 0, 5, (int)&_tnl_wrap_filled_vertex); + return dfn; + } + } +} + +static struct _tnl_dynfn *makeX86Vertex4fv( GLcontext *ctx, int vertex_size ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + DFN ( _tnl_x86_Vertex4fv, tnl->vtx.cache.Vertex[4-1], vertex_size ); + + FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); + FIXUP(dfn->code, 0, 1, vertex_size - 4); + FIXUP(dfn->code, 0, 2, (int)&tnl->vtx.vertex[4]); + FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); + FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); + FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); + FIXUP(dfn->code, 0, 4, (int)ctx); + FIXUPREL(dfn->code, 0, 5, (int)&_tnl_wrap_filled_vertex); + + return dfn; +} + + +static struct _tnl_dynfn *makeX86Attribute1fv( GLcontext *ctx, int dest ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + DFN ( _tnl_x86_Attribute1fv, tnl->vtx.cache.Attribute[1-1], dest ); + + FIXUP(dfn->code, 0, 0, dest); + + return dfn; +} + +static struct _tnl_dynfn *makeX86Attribute2fv( GLcontext *ctx, int dest ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + DFN ( _tnl_x86_Attribute2fv, tnl->vtx.cache.Attribute[2-1], dest ); + + FIXUP(dfn->code, 0, 0, dest); + FIXUP(dfn->code, 0, 1, 4+dest); + + return dfn; +} + +static struct _tnl_dynfn *makeX86Attribute3fv( GLcontext *ctx, int dest ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + DFN ( _tnl_x86_Attribute3fv, tnl->vtx.cache.Attribute[3-1], dest ); + + FIXUP(dfn->code, 0, 0, dest); + FIXUP(dfn->code, 0, 1, 4+dest); + FIXUP(dfn->code, 0, 2, 8+dest); + + return dfn; +} + +static struct _tnl_dynfn *makeX86Attribute4fv( GLcontext *ctx, int dest ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + DFN ( _tnl_x86_Attribute4fv, tnl->vtx.cache.Attribute[4-1], dest ); + + FIXUP(dfn->code, 0, 0, dest); + FIXUP(dfn->code, 0, 1, 4+dest); + FIXUP(dfn->code, 0, 2, 8+dest); + FIXUP(dfn->code, 0, 3, 12+dest); + + return dfn; +} + + +void _tnl_InitX86Codegen( struct _tnl_dynfn_generators *gen ) +{ + gen->Vertex[0] = makeX86Vertex1fv; + gen->Vertex[1] = makeX86Vertex2fv; + gen->Vertex[2] = makeX86Vertex3fv; + gen->Vertex[3] = makeX86Vertex4fv; + gen->Attribute[0] = makeX86Attribute1fv; + gen->Attribute[1] = makeX86Attribute2fv; + gen->Attribute[2] = makeX86Attribute3fv; + gen->Attribute[3] = makeX86Attribute4fv; +} + + +#define MKDISP(FUNC, SIZE, ATTR, WARP) \ +do { \ + char *code; \ + const char *start = WARP; \ + const char *end = WARP##_end; \ + int offset = 0; \ + code = ALIGN_MALLOC( end - start, 16 ); \ + memcpy (code, start, end - start); \ + FIXUP(code, 0, 0, (int)&(TNL_CONTEXT(ctx)->vtx.tabfv[ATTR][SIZE-1]));\ + *(void **)&vfmt->FUNC = code; \ +} while (0) + + +/* Install the codegen'ed versions of the 2nd level dispatch + * functions. We should keep a list and free them in the end... + */ +void _tnl_x86_exec_vtxfmt_init( GLcontext *ctx ) +{ + GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->exec_vtxfmt); + + MKDISP(Color3f, 3, _TNL_ATTRIB_COLOR0, _tnl_x86_dispatch_attrf3); + MKDISP(Color3fv, 3, _TNL_ATTRIB_COLOR0, _tnl_x86_dispatch_attrfv); + MKDISP(Color4f, 4, _TNL_ATTRIB_COLOR0, _tnl_x86_dispatch_attrf4); + MKDISP(Color4fv, 4, _TNL_ATTRIB_COLOR0, _tnl_x86_dispatch_attrfv); + MKDISP(FogCoordfEXT, 1, _TNL_ATTRIB_FOG, _tnl_x86_dispatch_attrf1); + MKDISP(FogCoordfvEXT, 1, _TNL_ATTRIB_FOG, _tnl_x86_dispatch_attrfv); + MKDISP(Normal3f, 3, _TNL_ATTRIB_NORMAL, _tnl_x86_dispatch_attrf3); + MKDISP(Normal3fv, 3, _TNL_ATTRIB_NORMAL, _tnl_x86_dispatch_attrfv); + MKDISP(SecondaryColor3fEXT, 3, _TNL_ATTRIB_COLOR1, _tnl_x86_dispatch_attrf3); + MKDISP(SecondaryColor3fvEXT,3, _TNL_ATTRIB_COLOR1, _tnl_x86_dispatch_attrfv); + MKDISP(TexCoord1f, 1, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrf1); + MKDISP(TexCoord1fv, 1, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrfv); + MKDISP(TexCoord2f, 2, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrf2); + MKDISP(TexCoord2fv, 2, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrfv); + MKDISP(TexCoord3f, 3, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrf3); + MKDISP(TexCoord3fv, 3, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrfv); + MKDISP(TexCoord4f, 4, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrf4); + MKDISP(TexCoord4fv, 4, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrfv); + MKDISP(Vertex2f, 2, _TNL_ATTRIB_POS, _tnl_x86_dispatch_attrf2); + MKDISP(Vertex2fv, 2, _TNL_ATTRIB_POS, _tnl_x86_dispatch_attrfv); + MKDISP(Vertex3f, 3, _TNL_ATTRIB_POS, _tnl_x86_dispatch_attrf3); + MKDISP(Vertex3fv, 3, _TNL_ATTRIB_POS, _tnl_x86_dispatch_attrfv); + MKDISP(Vertex4f, 4, _TNL_ATTRIB_POS, _tnl_x86_dispatch_attrf4); + MKDISP(Vertex4fv, 4, _TNL_ATTRIB_POS, _tnl_x86_dispatch_attrfv); + + MKDISP(MultiTexCoord1fARB, 1, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordf1); + MKDISP(MultiTexCoord1fvARB, 1, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordfv); + MKDISP(MultiTexCoord2fARB, 2, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordf2); + MKDISP(MultiTexCoord2fvARB, 2, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordfv); + MKDISP(MultiTexCoord3fARB, 3, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordf3); + MKDISP(MultiTexCoord3fvARB, 3, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordfv); + MKDISP(MultiTexCoord4fARB, 4, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordf4); + MKDISP(MultiTexCoord4fvARB, 4, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordfv); + + MKDISP(VertexAttrib1fNV, 1, 0, _tnl_x86_dispatch_vertexattribf1); + MKDISP(VertexAttrib1fvNV, 1, 0, _tnl_x86_dispatch_vertexattribfv); + MKDISP(VertexAttrib2fNV, 2, 0, _tnl_x86_dispatch_vertexattribf2); + MKDISP(VertexAttrib2fvNV, 2, 0, _tnl_x86_dispatch_vertexattribfv); + MKDISP(VertexAttrib3fNV, 3, 0, _tnl_x86_dispatch_vertexattribf3); + MKDISP(VertexAttrib3fvNV, 3, 0, _tnl_x86_dispatch_vertexattribfv); + MKDISP(VertexAttrib4fNV, 4, 0, _tnl_x86_dispatch_vertexattribf4); + MKDISP(VertexAttrib4fvNV, 4, 0, _tnl_x86_dispatch_vertexattribfv); +} + + +/* Install the codegen'ed choosers. + * We should keep a list and free them in the end... + */ +void _tnl_x86choosers( tnl_attrfv_func (*choose)[4], + tnl_attrfv_func (*do_choose)( GLuint attr, + GLuint sz )) +{ + int attr, size; + + for (attr = 0; attr < _TNL_MAX_ATTR_CODEGEN; attr++) { + for (size = 0; size < 4; size++) { + char *code; + const char *start = _tnl_x86_choose_fv; + const char *end = _tnl_x86_choose_fv_end; + int offset = 0; + code = ALIGN_MALLOC( end - start, 16 ); + memcpy (code, start, end - start); + FIXUP(code, 0, 0, attr); + FIXUP(code, 0, 1, size + 1); + FIXUPREL(code, 0, 2, do_choose); + choose[attr][size] = (tnl_attrfv_func)code; + } + } +} + +#else + +void _tnl_InitX86Codegen( struct _tnl_dynfn_generators *gen ) +{ + (void) gen; +} + + +void _tnl_x86_exec_vtxfmt_init( GLcontext *ctx ) +{ + (void) ctx; +} + + +void _tnl_x86choosers( tnl_attrfv_func (*choose)[4], + tnl_attrfv_func (*do_choose)( GLuint attr, + GLuint sz )) +{ + (void) choose; + (void) do_choose; +} + +#endif diff --git a/reactos/dll/mesa32/src/tnl/t_vtx_x86_gcc.S b/reactos/dll/mesa32/src/tnl/t_vtx_x86_gcc.S new file mode 100644 index 00000000000..5f79197f7e5 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/t_vtx_x86_gcc.S @@ -0,0 +1,557 @@ +/************************************************************************** + +Copyright 2004 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 +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 +ATI, TUNGSTEN GRAPHICS 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. + +**************************************************************************/ + +/* + * Authors: + * Keith Whitwell + * Daniel Borca + */ + +#if defined (__DJGPP__) || defined (__MINGW32__) || defined (__CYGWIN__) +#define GLOBL( x ) \ +.globl _##x; \ +_##x: +#else /* !defined (__DJGPP__) && !defined (__MINGW32__) && !defined (__CYGWIN__) */ +#define GLOBL( x ) \ +.globl x; \ +x: +#endif /* !defined (__DJGPP__) && !defined (__MINGW32__) && !defined (__CYGWIN__) */ + + +#if !defined (STDCALL_API) +#define RETCLEAN( x ) ret +#else +#define RETCLEAN( x ) ret $x +#endif + + +#define _JMP(x) \ +.byte 0xe9; \ +.long x + +#define _CALL(x) \ +.byte 0xe8; \ +.long x + + +/* Someone who knew a lot about this sort of thing would use this + * macro to note current offsets, etc in a special region of the + * object file & just make everything work out neat. I don't know + * enough to do that... + */ + +#define SUBST( x ) (0x10101010 + x) + + +.data + + +/* [dBorca] TODO + * Unfold functions for each vertex size? + * Build super-specialized SSE versions? + * + * There is a trick in Vertex*fv: under certain conditions, + * we tail to _tnl_wrap_filled_vertex(ctx). This means that + * if Vertex*fv is STDCALL, then _tnl_wrap_filled_vertex must + * be STDCALL as well, because (GLcontext *) and (GLfloat *) + * have the same size. + */ +.align 4 +GLOBL ( _tnl_x86_Vertex1fv ) + movl 4(%esp), %ecx + push %edi + push %esi + movl SUBST(0), %edi /* 0x0 --> tnl->vtx.vbptr */ + movl (%ecx), %edx /* load v[0] */ + movl %edx, (%edi) /* tnl->vtx.vbptr[0] = v[0] */ + addl $4, %edi /* tnl->vtx.vbptr += 1 */ + movl $SUBST(1), %ecx /* 0x1 --> (tnl->vtx.vertex_size - 1) */ + movl $SUBST(2), %esi /* 0x2 --> (tnl->vtx.vertex + 1) */ + repz + movsl %ds:(%esi), %es:(%edi) + movl %edi, SUBST(0) /* 0x0 --> tnl->vtx.vbptr */ + movl SUBST(3), %edx /* 0x3 --> counter */ + pop %esi + pop %edi + dec %edx /* counter-- */ + movl %edx, SUBST(3) /* 0x3 --> counter */ + je .0 /* if (counter == 0) goto .0 */ + RETCLEAN(4) /* return */ + .balign 16 +.0: + movl $SUBST(4), %eax /* load ctx */ + movl %eax, 4(%esp) /* push ctx */ + _JMP (SUBST(5)) /* jmp _tnl_wrap_filled_vertex */ +GLOBL ( _tnl_x86_Vertex1fv_end ) + +.align 4 +GLOBL ( _tnl_x86_Vertex2fv ) + movl 4(%esp), %ecx + push %edi + push %esi + movl SUBST(0), %edi /* load tnl->vtx.vbptr */ + movl (%ecx), %edx /* load v[0] */ + movl 4(%ecx), %eax /* load v[1] */ + movl %edx, (%edi) /* tnl->vtx.vbptr[0] = v[0] */ + movl %eax, 4(%edi) /* tnl->vtx.vbptr[1] = v[1] */ + addl $8, %edi /* tnl->vtx.vbptr += 2 */ + movl $SUBST(1), %ecx /* vertex_size - 2 */ + movl $SUBST(2), %esi /* tnl->vtx.vertex + 2 */ + repz + movsl %ds:(%esi), %es:(%edi) + movl %edi, SUBST(0) /* save tnl->vtx.vbptr */ + movl SUBST(3), %edx /* load counter */ + pop %esi + pop %edi + dec %edx /* counter-- */ + movl %edx, SUBST(3) /* save counter */ + je .1 /* if (counter == 0) goto .1 */ + RETCLEAN(4) /* return */ + .balign 16 +.1: + movl $SUBST(4), %eax /* load ctx */ + movl %eax, 4(%esp) /* push ctx */ + _JMP (SUBST(5)) /* jmp _tnl_wrap_filled_vertex */ +GLOBL ( _tnl_x86_Vertex2fv_end ) + +.align 4 +GLOBL ( _tnl_x86_Vertex3fv ) + movl 4(%esp), %ecx + push %edi + push %esi + movl SUBST(0), %edi /* load tnl->vtx.vbptr */ + movl (%ecx), %edx /* load v[0] */ + movl 4(%ecx), %eax /* load v[1] */ + movl 8(%ecx), %esi /* load v[2] */ + movl %edx, (%edi) /* tnl->vtx.vbptr[0] = v[0] */ + movl %eax, 4(%edi) /* tnl->vtx.vbptr[1] = v[1] */ + movl %esi, 8(%edi) /* tnl->vtx.vbptr[2] = v[2] */ + addl $12, %edi /* tnl->vtx.vbptr += 3 */ + movl $SUBST(1), %ecx /* vertex_size - 3 */ + movl $SUBST(2), %esi /* tnl->vtx.vertex + 3 */ + repz + movsl %ds:(%esi), %es:(%edi) + movl %edi, SUBST(0) /* save tnl->vtx.vbptr */ + movl SUBST(3), %edx /* load counter */ + pop %esi + pop %edi + dec %edx /* counter-- */ + movl %edx, SUBST(3) /* save counter */ + je .2 /* if (counter == 0) goto .2 */ + RETCLEAN(4) /* return */ + .balign 16 +.2: + movl $SUBST(4), %eax /* load ctx */ + movl %eax, 4(%esp) /* push ctx */ + _JMP (SUBST(5)) /* jmp _tnl_wrap_filled_vertex */ +GLOBL ( _tnl_x86_Vertex3fv_end ) + +.align 4 +GLOBL ( _tnl_x86_Vertex4fv ) + movl 4(%esp), %ecx + push %edi + push %esi + movl SUBST(0), %edi /* load tnl->vtx.vbptr */ + movl (%ecx), %edx /* load v[0] */ + movl 4(%ecx), %eax /* load v[1] */ + movl 8(%ecx), %esi /* load v[2] */ + movl 12(%ecx), %ecx /* load v[3] */ + movl %edx, (%edi) /* tnl->vtx.vbptr[0] = v[0] */ + movl %eax, 4(%edi) /* tnl->vtx.vbptr[1] = v[1] */ + movl %esi, 8(%edi) /* tnl->vtx.vbptr[2] = v[2] */ + movl %ecx, 12(%edi) /* tnl->vtx.vbptr[3] = v[3] */ + addl $16, %edi /* tnl->vtx.vbptr += 4 */ + movl $SUBST(1), %ecx /* vertex_size - 4 */ + movl $SUBST(2), %esi /* tnl->vtx.vertex + 4 */ + repz + movsl %ds:(%esi), %es:(%edi) + movl %edi, SUBST(0) /* save tnl->vtx.vbptr */ + movl SUBST(3), %edx /* load counter */ + pop %esi + pop %edi + dec %edx /* counter-- */ + movl %edx, SUBST(3) /* save counter */ + je .3 /* if (counter == 0) goto .3 */ + RETCLEAN(4) /* return */ + .balign 16 +.3: + movl $SUBST(4), %eax /* load ctx */ + movl %eax, 4(%esp) /* push ctx */ + _JMP (SUBST(5)) /* jmp _tnl_wrap_filled_vertex */ +GLOBL ( _tnl_x86_Vertex4fv_end ) + + +/** + * Generic handlers for vector format data. + */ +GLOBL( _tnl_x86_Attribute1fv ) + movl 4(%esp), %ecx + movl (%ecx), %eax /* load v[0] */ + movl %eax, SUBST(0) /* store v[0] to current vertex */ + RETCLEAN(4) +GLOBL ( _tnl_x86_Attribute1fv_end ) + +GLOBL( _tnl_x86_Attribute2fv ) + movl 4(%esp), %ecx + movl (%ecx), %eax /* load v[0] */ + movl 4(%ecx), %edx /* load v[1] */ + movl %eax, SUBST(0) /* store v[0] to current vertex */ + movl %edx, SUBST(1) /* store v[1] to current vertex */ + RETCLEAN(4) +GLOBL ( _tnl_x86_Attribute2fv_end ) + +GLOBL( _tnl_x86_Attribute3fv ) + movl 4(%esp), %ecx + movl (%ecx), %eax /* load v[0] */ + movl 4(%ecx), %edx /* load v[1] */ + movl 8(%ecx), %ecx /* load v[2] */ + movl %eax, SUBST(0) /* store v[0] to current vertex */ + movl %edx, SUBST(1) /* store v[1] to current vertex */ + movl %ecx, SUBST(2) /* store v[2] to current vertex */ + RETCLEAN(4) +GLOBL ( _tnl_x86_Attribute3fv_end ) + +GLOBL( _tnl_x86_Attribute4fv ) + movl 4(%esp), %ecx + movl (%ecx), %eax /* load v[0] */ + movl 4(%ecx), %edx /* load v[1] */ + movl %eax, SUBST(0) /* store v[0] to current vertex */ + movl %edx, SUBST(1) /* store v[1] to current vertex */ + movl 8(%ecx), %eax /* load v[2] */ + movl 12(%ecx), %edx /* load v[3] */ + movl %eax, SUBST(2) /* store v[2] to current vertex */ + movl %edx, SUBST(3) /* store v[3] to current vertex */ + RETCLEAN(4) +GLOBL ( _tnl_x86_Attribute4fv_end ) + + +/* Choosers: + * + * Must generate all of these ahead of first usage. Generate at + * compile-time? + */ +GLOBL( _tnl_x86_choose_fv ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + movl $SUBST(0), (%esp) /* arg 0 - attrib */ + movl $SUBST(1), 4(%esp) /* arg 1 - N */ + _CALL (SUBST(2)) /* call do_choose */ + add $12, %esp /* tear down stack frame */ + jmp *%eax /* jump to new func */ +GLOBL ( _tnl_x86_choose_fv_end ) + + +/* FIRST LEVEL FUNCTIONS -- these are plugged directly into GL dispatch. + * + * In the 1st level dispatch functions, switch to a different + * calling convention -- (const GLfloat *v) in %ecx. + * + * As with regular (x86) dispatch, don't create a new stack frame - + * just let the 'ret' in the dispatched function return straight + * back to the original caller. + * + * Vertex/Normal/Color, etc: the address of the function pointer + * is known at codegen time. + */ + +/* Unfortunately, have to play with the stack in the non-fv case: + */ +#if !defined (STDCALL_API) +GLOBL( _tnl_x86_dispatch_attrf1 ) +GLOBL( _tnl_x86_dispatch_attrf2 ) +GLOBL( _tnl_x86_dispatch_attrf3 ) +GLOBL( _tnl_x86_dispatch_attrf4 ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + leal 16(%esp), %edx /* address of first float on stack */ + movl %edx, (%esp) /* save as 'v' */ + call *SUBST(0) /* 0x0 --> tabfv[attr][n] */ + addl $12, %esp /* tear down frame */ + ret /* return */ +GLOBL( _tnl_x86_dispatch_attrf4_end ) +GLOBL( _tnl_x86_dispatch_attrf3_end ) +GLOBL( _tnl_x86_dispatch_attrf2_end ) +GLOBL( _tnl_x86_dispatch_attrf1_end ) + +#else /* defined(STDCALL_API) */ + +GLOBL( _tnl_x86_dispatch_attrf1 ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + leal 16(%esp), %edx /* address of first float on stack */ + movl %edx, (%esp) /* save as 'v' */ + call *SUBST(0) /* 0x0 --> tabfv[attr][n] */ + addl $8, %esp /* tear down frame (4 shaved off by the callee) */ + ret $4 /* return */ +GLOBL( _tnl_x86_dispatch_attrf1_end ) + +GLOBL( _tnl_x86_dispatch_attrf2 ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + leal 16(%esp), %edx /* address of first float on stack */ + movl %edx, (%esp) /* save as 'v' */ + call *SUBST(0) /* 0x0 --> tabfv[attr][n] */ + addl $8, %esp /* tear down frame (4 shaved off by the callee) */ + ret $8 /* return */ +GLOBL( _tnl_x86_dispatch_attrf2_end ) + +GLOBL( _tnl_x86_dispatch_attrf3 ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + leal 16(%esp), %edx /* address of first float on stack */ + movl %edx, (%esp) /* save as 'v' */ + call *SUBST(0) /* 0x0 --> tabfv[attr][n] */ + addl $8, %esp /* tear down frame (4 shaved off by the callee) */ + ret $12 /* return */ +GLOBL( _tnl_x86_dispatch_attrf3_end ) + +GLOBL( _tnl_x86_dispatch_attrf4 ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + leal 16(%esp), %edx /* address of first float on stack */ + movl %edx, (%esp) /* save as 'v' */ + call *SUBST(0) /* 0x0 --> tabfv[attr][n] */ + addl $8, %esp /* tear down frame (4 shaved off by the callee) */ + ret $16 /* return */ +GLOBL( _tnl_x86_dispatch_attrf4_end ) +#endif /* defined(STDCALL_API) */ + +/* The fv case is simpler: + */ +GLOBL( _tnl_x86_dispatch_attrfv ) + jmp *SUBST(0) /* 0x0 --> tabfv[attr][n] */ +GLOBL( _tnl_x86_dispatch_attrfv_end ) + + +/* MultiTexcoord: the address of the function pointer must be + * calculated, but can use the index argument slot to hold 'v', and + * avoid setting up a new stack frame. + * + * [dBorca] + * right, this would be the preferred approach, but gcc does not + * clean up the stack after each function call when optimizing (-fdefer-pop); + * can it make assumptions about what's already on the stack? I dunno, + * but in this case, we can't mess with the caller's stack frame, and + * we must use a model like `_x86_dispatch_attrfv' above. Caveat emptor! + */ + +/* Also, will only need a maximum of four of each of these per context: + */ +#if !defined (STDCALL_API) +GLOBL( _tnl_x86_dispatch_multitexcoordf1 ) +GLOBL( _tnl_x86_dispatch_multitexcoordf2 ) +GLOBL( _tnl_x86_dispatch_multitexcoordf3 ) +GLOBL( _tnl_x86_dispatch_multitexcoordf4 ) + movl 4(%esp), %ecx + leal 8(%esp), %edx + andl $7, %ecx + movl %edx, 4(%esp) + sall $4, %ecx + jmp *SUBST(0)(%ecx) /* 0x0 - tabfv[tex0][n] */ +GLOBL( _tnl_x86_dispatch_multitexcoordf4_end ) +GLOBL( _tnl_x86_dispatch_multitexcoordf3_end ) +GLOBL( _tnl_x86_dispatch_multitexcoordf2_end ) +GLOBL( _tnl_x86_dispatch_multitexcoordf1_end ) + +GLOBL( _tnl_x86_dispatch_multitexcoordfv ) + movl 4(%esp), %ecx + movl 8(%esp), %edx + andl $7, %ecx + movl %edx, 4(%esp) + sall $4, %ecx + jmp *SUBST(0)(%ecx) /* 0x0 - tabfv[tex0][n] */ +GLOBL( _tnl_x86_dispatch_multitexcoordfv_end ) + +#else /* defined (STDCALL_API) */ + +GLOBL( _tnl_x86_dispatch_multitexcoordf1 ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + movl 16(%esp), %ecx + leal 20(%esp), %edx + andl $7, %ecx + movl %edx, (%esp) + sall $4, %ecx + call *SUBST(0)(%ecx) /* 0x0 - tabfv[tex0][n] */ + addl $8, %esp /* tear down frame (4 shaved off by the callee) */ + ret $8 /* return */ +GLOBL( _tnl_x86_dispatch_multitexcoordf1_end ) + +GLOBL( _tnl_x86_dispatch_multitexcoordf2 ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + movl 16(%esp), %ecx + leal 20(%esp), %edx + andl $7, %ecx + movl %edx, (%esp) + sall $4, %ecx + call *SUBST(0)(%ecx) /* 0x0 - tabfv[tex0][n] */ + addl $8, %esp /* tear down frame (4 shaved off by the callee) */ + ret $12 /* return */ +GLOBL( _tnl_x86_dispatch_multitexcoordf2_end ) + +GLOBL( _tnl_x86_dispatch_multitexcoordf3 ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + movl 16(%esp), %ecx + leal 20(%esp), %edx + andl $7, %ecx + movl %edx, (%esp) + sall $4, %ecx + call *SUBST(0)(%ecx) /* 0x0 - tabfv[tex0][n] */ + addl $8, %esp /* tear down frame (4 shaved off by the callee) */ + ret $16 /* return */ +GLOBL( _tnl_x86_dispatch_multitexcoordf3_end ) + +GLOBL( _tnl_x86_dispatch_multitexcoordf4 ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + movl 16(%esp), %ecx + leal 20(%esp), %edx + andl $7, %ecx + movl %edx, (%esp) + sall $4, %ecx + call *SUBST(0)(%ecx) /* 0x0 - tabfv[tex0][n] */ + addl $8, %esp /* tear down frame (4 shaved off by the callee) */ + ret $20 /* return */ +GLOBL( _tnl_x86_dispatch_multitexcoordf4_end ) + +GLOBL( _tnl_x86_dispatch_multitexcoordfv ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + movl 16(%esp), %ecx + movl 20(%esp), %edx + andl $7, %ecx + movl %edx, (%esp) + sall $4, %ecx + call *SUBST(0)(%ecx) /* 0x0 - tabfv[tex0][n] */ + addl $8, %esp /* tear down frame (4 shaved off by the callee) */ + ret $8 /* return */ +GLOBL( _tnl_x86_dispatch_multitexcoordfv_end ) +#endif /* defined (STDCALL_API) */ + + +/* VertexAttrib: the address of the function pointer must be + * calculated. + */ +#if !defined (STDCALL_API) +GLOBL( _tnl_x86_dispatch_vertexattribf1 ) +GLOBL( _tnl_x86_dispatch_vertexattribf2 ) +GLOBL( _tnl_x86_dispatch_vertexattribf3 ) +GLOBL( _tnl_x86_dispatch_vertexattribf4 ) + movl 4(%esp), %eax + cmpl $16, %eax + jb .8 /* "cmovge" is not supported on all CPUs */ + movl $16, %eax +.8: + leal 8(%esp), %ecx /* calculate 'v' */ + movl %ecx, 4(%esp) /* save in 1st arg slot */ + sall $4, %eax + jmp *SUBST(0)(%eax) /* 0x0 - tabfv[0][n] */ +GLOBL( _tnl_x86_dispatch_vertexattribf4_end ) +GLOBL( _tnl_x86_dispatch_vertexattribf3_end ) +GLOBL( _tnl_x86_dispatch_vertexattribf2_end ) +GLOBL( _tnl_x86_dispatch_vertexattribf1_end ) + +GLOBL( _tnl_x86_dispatch_vertexattribfv ) + movl 4(%esp), %eax + cmpl $16, %eax + jb .9 /* "cmovge" is not supported on all CPUs */ + movl $16, %eax +.9: + movl 8(%esp), %ecx /* load 'v' */ + movl %ecx, 4(%esp) /* save in 1st arg slot */ + sall $4, %eax + jmp *SUBST(0)(%eax) /* 0x0 - tabfv[0][n] */ +GLOBL( _tnl_x86_dispatch_vertexattribfv_end ) + +#else /* defined (STDCALL_API) */ + +GLOBL( _tnl_x86_dispatch_vertexattribf1 ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + movl 16(%esp), %eax + cmpl $16, %eax + jb .81 /* "cmovge" is not supported on all CPUs */ + movl $16, %eax +.81: + leal 20(%esp), %ecx /* load 'v' */ + movl %ecx, (%esp) /* save in 1st arg slot */ + sall $4, %eax + call *SUBST(0)(%eax) /* 0x0 - tabfv[0][n] */ + addl $8, %esp /* tear down frame (4 shaved off by the callee) */ + ret $8 /* return */ +GLOBL( _tnl_x86_dispatch_vertexattribf1_end ) + +GLOBL( _tnl_x86_dispatch_vertexattribf2 ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + movl 16(%esp), %eax + cmpl $16, %eax + jb .82 /* "cmovge" is not supported on all CPUs */ + movl $16, %eax +.82: + leal 20(%esp), %ecx /* load 'v' */ + movl %ecx, (%esp) /* save in 1st arg slot */ + sall $4, %eax + call *SUBST(0)(%eax) /* 0x0 - tabfv[0][n] */ + addl $8, %esp /* tear down frame (4 shaved off by the callee) */ + ret $12 /* return */ +GLOBL( _tnl_x86_dispatch_vertexattribf2_end ) + +GLOBL( _tnl_x86_dispatch_vertexattribf3 ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + movl 16(%esp), %eax + cmpl $16, %eax + jb .83 /* "cmovge" is not supported on all CPUs */ + movl $16, %eax +.83: + leal 20(%esp), %ecx /* load 'v' */ + movl %ecx, (%esp) /* save in 1st arg slot */ + sall $4, %eax + call *SUBST(0)(%eax) /* 0x0 - tabfv[0][n] */ + addl $8, %esp /* tear down frame (4 shaved off by the callee) */ + ret $16 /* return */ +GLOBL( _tnl_x86_dispatch_vertexattribf3_end ) + +GLOBL( _tnl_x86_dispatch_vertexattribf4 ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + movl 16(%esp), %eax + cmpl $16, %eax + jb .84 /* "cmovge" is not supported on all CPUs */ + movl $16, %eax +.84: + leal 20(%esp), %ecx /* load 'v' */ + movl %ecx, (%esp) /* save in 1st arg slot */ + sall $4, %eax + call *SUBST(0)(%eax) /* 0x0 - tabfv[0][n] */ + addl $8, %esp /* tear down frame (4 shaved off by the callee) */ + ret $20 /* return */ +GLOBL( _tnl_x86_dispatch_vertexattribf4_end ) + +GLOBL( _tnl_x86_dispatch_vertexattribfv ) + subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ + movl 16(%esp), %eax + cmpl $16, %eax + jb .9 /* "cmovge" is not supported on all CPUs */ + movl $16, %eax +.9: + movl 20(%esp), %ecx /* load 'v' */ + movl %ecx, (%esp) /* save in 1st arg slot */ + sall $4, %eax + call *SUBST(0)(%eax) /* 0x0 - tabfv[0][n] */ + addl $8, %esp /* tear down frame (4 shaved off by the callee) */ + ret $8 /* return */ +GLOBL( _tnl_x86_dispatch_vertexattribfv_end ) +#endif /* defined (STDCALL_API) */ diff --git a/reactos/dll/mesa32/src/tnl/tnl.h b/reactos/dll/mesa32/src/tnl/tnl.h new file mode 100644 index 00000000000..d04310fb53e --- /dev/null +++ b/reactos/dll/mesa32/src/tnl/tnl.h @@ -0,0 +1,87 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +#ifndef _TNL_H +#define _TNL_H + +#include "mtypes.h" + + + +/* These are the public-access functions exported from tnl. (A few + * more are currently hooked into dispatch directly by the module + * itself.) + */ +extern GLboolean +_tnl_CreateContext( GLcontext *ctx ); + +extern void +_tnl_DestroyContext( GLcontext *ctx ); + +extern void +_tnl_InvalidateState( GLcontext *ctx, GLuint new_state ); + +/* Functions to revive the tnl module after being unhooked from + * dispatch and/or driver callbacks. + */ + +/* Restore just the ctx->Exec table: + */ +extern void +_tnl_wakeup_exec( GLcontext *ctx ); + +/* Restore both ctx->Exec and ctx->Save: + */ +extern void +_tnl_wakeup_save_exec( GLcontext *ctx ); + +/* Driver configuration options: + */ +extern void +_tnl_need_projected_coords( GLcontext *ctx, GLboolean flag ); + +extern void +_tnl_need_dlist_loopback( GLcontext *ctx, GLboolean flag ); + +extern void +_tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean flag ); + +extern void +_tnl_isolate_materials( GLcontext *ctx, GLboolean flag ); + + +/* Control whether T&L does per-vertex fog + */ +extern void +_tnl_allow_vertex_fog( GLcontext *ctx, GLboolean value ); + +extern void +_tnl_allow_pixel_fog( GLcontext *ctx, GLboolean value ); + + +#endif diff --git a/reactos/dll/mesa32/src/tnl_dd/imm/NOTES.imm b/reactos/dll/mesa32/src/tnl_dd/imm/NOTES.imm new file mode 100644 index 00000000000..9b2bd65e4bf --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/imm/NOTES.imm @@ -0,0 +1,112 @@ + +NOTE: + +These files are incomplete. They do not yet form a working +implementation of hte concepts discused below. + + +OVERVIEW + +The t_dd_imm_* files form a set of templates to produce driver - +specific software tnl modules for a small subset of transformation and +lighting states. + +The approach is quite different to the large vertex buffers of the +src/tnl module, and is based around a cache of four recent vertices +and a 'current' vertex which is updated directly from the Color, +Normal, Texcoord, SecondaryColor and Fog entrypoints. + +The current vertex is actually a composite of the ctx->Current values +and a partial hardware vertex maintained where the hardware values +differ from those in ctx->Current. For example, clamped color values +are kept in the hardware vertex, while texcoords remain in +ctx->Current. + +A crude diagram: + + +--------------+ +-------------------+ + | ctx->Current | | Current-HW-vertex | + +--------------+ +-------------------+ + \ / + \ / + \ / + \ / + --------- -------- + | | + v v + +--------+ +--------+ +--------+ +--------+ + | vert-0 | | vert-1 | | vert-2 | | vert-3 | + +--------+ +--------+ +--------+ +--------+ + | + | + v + + DMA + + +Here values from ctx->Current and current-HW-vertex are merged to +build vert-2, which is then dumped to hardware (DMA). A state machine +determines which vertex is built in turn, and how the vertices are +used to present primitives to hardware. These actions all occur +during a call to Vertex{234}f{v}. + +Each vert-n includes clip coordinates and a clipmask in addition to +the hardware (window) coordinates. This information allows clipping +to take place directly on these vertices, if need be. + +t_dd_imm_capi.h + + Color{34}{fub}{v}() implementations. These update both + ctx->Current (unclamped float colors) and current-HW-vertex + with hardware-specific color values (typically unsigned + bytes). + + When lighting is enabled, the functions from src/api_noop.c + should be used, which just update ctx->Current. (The + current-hw-vertex colors are produced from lighting, which is + keyed to Normal3f). + +t_dd_imm_vb.c + + Support functions for clipping and fallback. See + t_dd_imm_primtmp.h. + +t_dd_imm_napi.c +t_dd_imm_napi.h + + Versions of Normal3f{v} to perform lighting with one or more + infinite lights. Updates ctx->Current.Normal and the current + HW colors. + + When lighting is disabled, use the functions from api_noop.c + instead. + + +t_dd_imm_primtmp.h + + State machine to control emission of vertices and primitives + to hardware. Called indirectly from Vertex{234}f{v}. Capable + of supporting hardware strip and fan primitives, and of + decomposing to discreet primitives for clipping or fallback, + or where the native primitive is unavailable. + +t_dd_imm_tapi.h + + Implementations of TexCoord{v} and MultiTexCoord4f{v}ARB to + fire a callback when transitioning to projective texture. + Most drivers will need to change vertex format at this point, + some may need to enable a software rasterization fallback. + +t_dd_imm_vapi.h + + Implementations of Vertex{234}f{v}. These perform + transformation and cliptesting on their arguments, then jump + into the state machine implemented in primtmp.h. + +t_dd_imm_vertex.h + + Support functions for building and clip-interpolating hardware + vertices. Called from primtmp.h. + + +Keith Whitwell, June 2001. \ No newline at end of file diff --git a/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_capi.h b/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_capi.h new file mode 100644 index 00000000000..eecbf0da5de --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_capi.h @@ -0,0 +1,419 @@ + +/* + * 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. + * + * Authors: + * Gareth Hughes + */ + +/* Template for immediate mode color functions. + * + * FIXME: Floating-point color versions of these... + */ + + +static void TAG(Color3f)( GLfloat r, GLfloat g, GLfloat b ) +{ + GET_CURRENT; +#ifdef COLOR_IS_FLOAT + CURRENT_COLOR( RCOMP ) = CLAMP(r, 0.0f, 1.0f); + CURRENT_COLOR( GCOMP ) = CLAMP(g, 0.0f, 1.0f); + CURRENT_COLOR( BCOMP ) = CLAMP(b, 0.0f, 1.0f); + CURRENT_COLOR( ACOMP ) = 1.0f; +#else + UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( RCOMP ), r ); + UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( GCOMP ), g ); + UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( BCOMP ), b ); + CURRENT_COLOR( ACOMP ) = 255; +#endif +} + +static void TAG(Color3fv)( const GLfloat *v ) +{ + GET_CURRENT; +#ifdef COLOR_IS_FLOAT + CURRENT_COLOR( RCOMP ) = CLAMP(v[0], 0.0f, 1.0f); + CURRENT_COLOR( GCOMP ) = CLAMP(v[1], 0.0f, 1.0f); + CURRENT_COLOR( BCOMP ) = CLAMP(v[2], 0.0f, 1.0f); + CURRENT_COLOR( ACOMP ) = 1.0f; +#else + UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( RCOMP ), v[0] ); + UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( GCOMP ), v[1] ); + UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( BCOMP ), v[2] ); + CURRENT_COLOR( ACOMP ) = 255; +#endif +} + +static void TAG(Color3ub)( GLubyte r, GLubyte g, GLubyte b ) +{ + GET_CURRENT; +#ifdef COLOR_IS_FLOAT + CURRENT_COLOR( RCOMP ) = UBYTE_TO_FLOAT( r ); + CURRENT_COLOR( GCOMP ) = UBYTE_TO_FLOAT( g ); + CURRENT_COLOR( BCOMP ) = UBYTE_TO_FLOAT( b ); + CURRENT_COLOR( ACOMP ) = 1.0f; +#else + CURRENT_COLOR( RCOMP ) = r; + CURRENT_COLOR( GCOMP ) = g; + CURRENT_COLOR( BCOMP ) = b; + CURRENT_COLOR( ACOMP ) = 255; +#endif +} + +static void TAG(Color3ubv)( const GLubyte *v ) +{ + GET_CURRENT; +#ifdef COLOR_IS_FLOAT + CURRENT_COLOR( RCOMP ) = UBYTE_TO_FLOAT( v[0] ); + CURRENT_COLOR( GCOMP ) = UBYTE_TO_FLOAT( v[1] ); + CURRENT_COLOR( BCOMP ) = UBYTE_TO_FLOAT( v[2] ); + CURRENT_COLOR( ACOMP ) = 1.0f; +#else + CURRENT_COLOR( RCOMP ) = v[0]; + CURRENT_COLOR( GCOMP ) = v[1]; + CURRENT_COLOR( BCOMP ) = v[2]; + CURRENT_COLOR( ACOMP ) = 255; +#endif +} + +static void TAG(Color4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a ) +{ + GET_CURRENT; +#ifdef COLOR_IS_FLOAT + CURRENT_COLOR( RCOMP ) = CLAMP(r, 0.0f, 1.0f); + CURRENT_COLOR( GCOMP ) = CLAMP(g, 0.0f, 1.0f); + CURRENT_COLOR( BCOMP ) = CLAMP(b, 0.0f, 1.0f); + CURRENT_COLOR( ACOMP ) = CLAMP(a, 0.0f, 1.0f); +#else + UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( RCOMP ), r ); + UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( GCOMP ), g ); + UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( BCOMP ), b ); + UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( ACOMP ), a ); +#endif +} + +static void TAG(Color4fv)( const GLfloat *v ) +{ + GET_CURRENT; +#ifdef COLOR_IS_FLOAT + CURRENT_COLOR( RCOMP ) = CLAMP(v[0], 0.0f, 1.0f); + CURRENT_COLOR( GCOMP ) = CLAMP(v[1], 0.0f, 1.0f); + CURRENT_COLOR( BCOMP ) = CLAMP(v[2], 0.0f, 1.0f); + CURRENT_COLOR( ACOMP ) = CLAMP(v[3], 0.0f, 1.0f); +#else + UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( RCOMP ), v[0] ); + UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( GCOMP ), v[1] ); + UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( BCOMP ), v[2] ); + UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( ACOMP ), v[3] ); +#endif +} + +static void TAG(Color4ub)( GLubyte r, GLubyte g, GLubyte b, GLubyte a ) +{ + GET_CURRENT; +#ifdef COLOR_IS_FLOAT + CURRENT_COLOR( RCOMP ) = UBYTE_TO_FLOAT( r ); + CURRENT_COLOR( GCOMP ) = UBYTE_TO_FLOAT( g ); + CURRENT_COLOR( BCOMP ) = UBYTE_TO_FLOAT( b ); + CURRENT_COLOR( ACOMP ) = UBYTE_TO_FLOAT( a ); +#else + CURRENT_COLOR( RCOMP ) = r; + CURRENT_COLOR( GCOMP ) = g; + CURRENT_COLOR( BCOMP ) = b; + CURRENT_COLOR( ACOMP ) = a; +#endif +} + +static void TAG(Color4ubv)( const GLubyte *v ) +{ + GET_CURRENT; +#ifdef COLOR_IS_FLOAT + CURRENT_COLOR( RCOMP ) = UBYTE_TO_FLOAT( v[0] ); + CURRENT_COLOR( GCOMP ) = UBYTE_TO_FLOAT( v[1] ); + CURRENT_COLOR( BCOMP ) = UBYTE_TO_FLOAT( v[2] ); + CURRENT_COLOR( ACOMP ) = UBYTE_TO_FLOAT( v[3] ); +#else + CURRENT_COLOR( RCOMP ) = v[0]; + CURRENT_COLOR( GCOMP ) = v[1]; + CURRENT_COLOR( BCOMP ) = v[2]; + CURRENT_COLOR( ACOMP ) = v[3]; +#endif +} + + +static void TAG(ColorMaterial3f)( GLfloat r, GLfloat g, GLfloat b ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *color = ctx->Current.Color; + + color[0] = r; + color[1] = g; + color[2] = b; + color[3] = 1.0; + + _mesa_update_color_material( ctx, color ); + RECALC_BASE_COLOR( ctx ); +} + +static void TAG(ColorMaterial3fv)( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *color = ctx->Current.Color; + + color[0] = v[0]; + color[1] = v[1]; + color[2] = v[2]; + color[3] = 1.0; + + _mesa_update_color_material( ctx, color ); + RECALC_BASE_COLOR( ctx ); +} + +static void TAG(ColorMaterial3ub)( GLubyte r, GLubyte g, GLubyte b ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *color = ctx->Current.Color; + + color[0] = UBYTE_TO_FLOAT( r ); + color[1] = UBYTE_TO_FLOAT( g ); + color[2] = UBYTE_TO_FLOAT( b ); + color[3] = 1.0; + + _mesa_update_color_material( ctx, color ); + RECALC_BASE_COLOR( ctx ); +} + +static void TAG(ColorMaterial3ubv)( const GLubyte *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *color = ctx->Current.Color; + + color[0] = UBYTE_TO_FLOAT( v[0] ); + color[1] = UBYTE_TO_FLOAT( v[1] ); + color[2] = UBYTE_TO_FLOAT( v[2] ); + color[3] = 1.0; + + _mesa_update_color_material( ctx, color ); + RECALC_BASE_COLOR( ctx ); +} + +static void TAG(ColorMaterial4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *color = ctx->Current.Color; + + color[0] = r; + color[1] = g; + color[2] = b; + color[3] = a; + + _mesa_update_color_material( ctx, color ); + RECALC_BASE_COLOR( ctx ); +} + +static void TAG(ColorMaterial4fv)( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *color = ctx->Current.Color; + + color[0] = v[0]; + color[1] = v[1]; + color[2] = v[2]; + color[3] = v[3]; + + _mesa_update_color_material( ctx, color ); + RECALC_BASE_COLOR( ctx ); +} + +static void TAG(ColorMaterial4ub)( GLubyte r, GLubyte g, GLubyte b, GLubyte a ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *color = ctx->Current.Color; + + color[0] = UBYTE_TO_FLOAT( r ); + color[1] = UBYTE_TO_FLOAT( g ); + color[2] = UBYTE_TO_FLOAT( b ); + color[3] = UBYTE_TO_FLOAT( a ); + + _mesa_update_color_material( ctx, color ); + RECALC_BASE_COLOR( ctx ); +} + +static void TAG(ColorMaterial4ubv)( const GLubyte *v ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *color = ctx->Current.Color; + + color[0] = UBYTE_TO_FLOAT( v[0] ); + color[1] = UBYTE_TO_FLOAT( v[1] ); + color[2] = UBYTE_TO_FLOAT( v[2] ); + color[3] = UBYTE_TO_FLOAT( v[3] ); + + _mesa_update_color_material( ctx, color ); + RECALC_BASE_COLOR( ctx ); +} + + + + + +/* ============================================================= + * Color chooser functions: + */ + +static void TAG(choose_Color3f)( GLfloat r, GLfloat g, GLfloat b ) +{ + GET_CURRENT_CONTEXT(ctx); + + if ( ctx->Light.Enabled ) { + if ( ctx->Light.ColorMaterialEnabled ) { + SET_Color3f(ctx->Exec, TAG(ColorMaterial3f)); + } else { + SET_Color3f(ctx->Exec, _mesa_noop_Color3f); + } + } else { + SET_Color3f(ctx->Exec, TAG(Color3f)); + } + glColor3f( r, g, b ); +} + +static void TAG(choose_Color3fv)( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + + if ( ctx->Light.Enabled ) { + if ( ctx->Light.ColorMaterialEnabled ) { + SET_Color3fv(ctx->Exec, TAG(ColorMaterial3fv)); + } else { + SET_Color3fv(ctx->Exec, _mesa_noop_Color3fv); + } + } else { + SET_Color3fv(ctx->Exec, TAG(Color3fv)); + } + glColor3fv( v ); +} + +static void TAG(choose_Color3ub)( GLubyte r, GLubyte g, GLubyte b ) +{ + GET_CURRENT_CONTEXT(ctx); + + if ( ctx->Light.Enabled ) { + if ( ctx->Light.ColorMaterialEnabled ) { + SET_Color3ub(ctx->Exec, TAG(ColorMaterial3ub)); + } else { + SET_Color3ub(ctx->Exec, _mesa_noop_Color3ub); + } + } else { + SET_Color3ub(ctx->Exec, TAG(Color3ub)); + } + glColor3ub( r, g, b ); +} + +static void TAG(choose_Color3ubv)( const GLubyte *v ) +{ + GET_CURRENT_CONTEXT(ctx); + + if ( ctx->Light.Enabled ) { + if ( ctx->Light.ColorMaterialEnabled ) { + SET_Color3ubv(ctx->Exec, TAG(ColorMaterial3ubv)); + } else { + SET_Color3ubv(ctx->Exec, _mesa_noop_Color3ubv); + } + } else { + SET_Color3ubv(ctx->Exec, TAG(Color3ubv)); + } + glColor3ubv( v ); +} + +static void TAG(choose_Color4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a ) +{ + GET_CURRENT_CONTEXT(ctx); + + if ( ctx->Light.Enabled ) { + if ( ctx->Light.ColorMaterialEnabled ) { + SET_Color4f(ctx->Exec, TAG(ColorMaterial4f)); + } else { + SET_Color4f(ctx->Exec, _mesa_noop_Color4f); + } + } else { + SET_Color4f(ctx->Exec, TAG(Color4f)); + } + glColor4f( r, g, b, a ); +} + +static void TAG(choose_Color4fv)( const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + + if ( ctx->Light.Enabled ) { + if ( ctx->Light.ColorMaterialEnabled ) { + SET_Color4fv(ctx->Exec, TAG(ColorMaterial4fv)); + } else { + SET_Color4fv(ctx->Exec, _mesa_noop_Color4fv); + } + } else { + SET_Color4fv(ctx->Exec, TAG(Color4fv)); + } + glColor4fv( v ); +} + +static void TAG(choose_Color4ub)( GLubyte r, GLubyte g, GLubyte b, GLubyte a ) +{ + GET_CURRENT_CONTEXT(ctx); + + if ( ctx->Light.Enabled ) { + if ( ctx->Light.ColorMaterialEnabled ) { + SET_Color4ub(ctx->Exec, TAG(ColorMaterial4ub)); + } else { + SET_Color4ub(ctx->Exec, _mesa_noop_Color4ub); + } + } else { + SET_Color4ub(ctx->Exec, TAG(Color4ub)); + } + glColor4ub( r, g, b, a ); +} + +static void TAG(choose_Color4ubv)( const GLubyte *v ) +{ + GET_CURRENT_CONTEXT(ctx); + + if ( ctx->Light.Enabled ) { + if ( ctx->Light.ColorMaterialEnabled ) { + SET_Color4ubv(ctx->Exec, TAG(ColorMaterial4ubv)); + } else { + SET_Color4ubv(ctx->Exec, _mesa_noop_Color4ubv); + } + } else { + SET_Color4ubv(ctx->Exec, TAG(Color4ubv)); + } + glColor4ubv( v ); +} + + + +#undef GET_CURRENT +#undef CURRENT_COLOR +#undef CURRENT_SPECULAR +#undef COLOR_IS_FLOAT +#undef RECALC_BASE_COLOR +#undef TAG diff --git a/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_napi.h b/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_napi.h new file mode 100644 index 00000000000..9844f615ffe --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_napi.h @@ -0,0 +1,226 @@ + +/* + * 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. + * + * Authors: + * Gareth Hughes + * Keith Whitwell + */ + +/* Template for immediate mode normal functions. Optimize for infinite + * lights when doing software lighting. + */ + +static void TAG(Normal3f_single)( GLfloat x, GLfloat y, GLfloat z ) +{ + GET_CURRENT_VERTEX; + const struct gl_light *light = ctx->Light.EnabledList.prev; + GLfloat n_dot_h, n_dot_VP, spec, sum[3]; + GLfloat *normal = ctx->Current.Normal; + GLfloat scale = 1.0; + + ASSIGN_3V( normal, x, y, z ); + COPY_3V( sum, BASE_COLOR ); + + if ( IND & NORM_RESCALE ) { + scale = ctx->_ModelViewInvScale; + } else if ( IND & NORM_NORMALIZE ) { + scale = LEN_3FV( normal ); + if ( scale != 0.0 ) scale = 1.0 / scale; + } + + n_dot_VP = DOT3( normal, light->_VP_inf_norm ) * scale; + if ( n_dot_VP > 0.0F ) { + ACC_SCALE_SCALAR_3V( sum, n_dot_VP, light->_MatDiffuse[0] ); + n_dot_h = DOT3( normal, light->_h_inf_norm ) * scale; + if ( n_dot_h > 0.0F ) { + GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec ); + ACC_SCALE_SCALAR_3V( sum, spec, light->_MatSpecular[0] ); + } + } + +#ifdef LIT_COLOR_IS_FLOAT + LIT_COLOR ( RCOMP ) = CLAMP(sum[0], 0.0f, 0.1f); + LIT_COLOR ( GCOMP ) = CLAMP(sum[1], 0.0f, 0.1f); + LIT_COLOR ( BCOMP ) = CLAMP(sum[2], 0.0f, 0.1f); +#else + UNCLAMPED_FLOAT_TO_UBYTE( LIT_COLOR( RCOMP ), sum[0] ); + UNCLAMPED_FLOAT_TO_UBYTE( LIT_COLOR( GCOMP ), sum[1] ); + UNCLAMPED_FLOAT_TO_UBYTE( LIT_COLOR( BCOMP ), sum[2] ); +#endif + LIT_COLOR( ACOMP ) = LIT_ALPHA; +} + +static void TAG(Normal3fv_single)( const GLfloat *normal ) +{ + GET_CURRENT_VERTEX; + const struct gl_light *light = ctx->Light.EnabledList.prev; + GLfloat n_dot_h, n_dot_VP, spec, sum[3]; + GLfloat scale = 1.0; + + COPY_3V( ctx->Current.Normal, normal ); + COPY_3V( sum, BASE_COLOR ); + + if ( IND & NORM_RESCALE ) { + scale = ctx->_ModelViewInvScale; + } else if ( IND & NORM_NORMALIZE ) { + scale = LEN_3FV( normal ); + if ( scale != 0.0 ) scale = 1.0 / scale; + } + + n_dot_VP = DOT3( normal, light->_VP_inf_norm ) * scale; + if ( n_dot_VP > 0.0F ) { + ACC_SCALE_SCALAR_3V( sum, n_dot_VP, light->_MatDiffuse[0] ); + n_dot_h = DOT3( normal, light->_h_inf_norm ) * scale; + if ( n_dot_h > 0.0F ) { + GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec ); + ACC_SCALE_SCALAR_3V( sum, spec, light->_MatSpecular[0] ); + } + } + +#ifdef LIT_COLOR_IS_FLOAT + LIT_COLOR ( RCOMP ) = CLAMP(sum[0], 0.0f, 0.1f); + LIT_COLOR ( GCOMP ) = CLAMP(sum[1], 0.0f, 0.1f); + LIT_COLOR ( BCOMP ) = CLAMP(sum[2], 0.0f, 0.1f); +#else + UNCLAMPED_FLOAT_TO_UBYTE( LIT_COLOR( RCOMP ), sum[0] ); + UNCLAMPED_FLOAT_TO_UBYTE( LIT_COLOR( GCOMP ), sum[1] ); + UNCLAMPED_FLOAT_TO_UBYTE( LIT_COLOR( BCOMP ), sum[2] ); +#endif + LIT_COLOR( ACOMP ) = LIT_ALPHA; +} + + +static void TAG(Normal3f_multi)( GLfloat x, GLfloat y, GLfloat z ) +{ + GET_CURRENT_VERTEX; + struct gl_light *light; + GLfloat n_dot_h, n_dot_VP, spec, sum[3], tmp[3]; + GLfloat *normal; + + ASSIGN_3V( ctx->Current.Normal, x, y, z ); + COPY_3V( sum, BASE_COLOR ); + + if ( IND & NORM_RESCALE ) { + normal = tmp; + ASSIGN_3V( normal, x, y, z ); + SELF_SCALE_SCALAR_3V( normal, ctx->_ModelViewInvScale ); + } else if ( IND & NORM_NORMALIZE ) { + normal = tmp; + ASSIGN_3V( normal, x, y, z ); + NORMALIZE_3FV( normal ); + } else { + normal = ctx->Current.Normal; + } + + foreach ( light, &ctx->Light.EnabledList ) { + n_dot_VP = DOT3( normal, light->_VP_inf_norm ); + if ( n_dot_VP > 0.0F ) { + ACC_SCALE_SCALAR_3V( sum, n_dot_VP, light->_MatDiffuse[0] ); + n_dot_h = DOT3( normal, light->_h_inf_norm ); + if ( n_dot_h > 0.0F ) { + GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec ); + ACC_SCALE_SCALAR_3V( sum, spec, light->_MatSpecular[0] ); + } + } + } + +#ifdef LIT_COLOR_IS_FLOAT + LIT_COLOR ( RCOMP ) = CLAMP(sum[0], 0.0f, 0.1f); + LIT_COLOR ( GCOMP ) = CLAMP(sum[1], 0.0f, 0.1f); + LIT_COLOR ( BCOMP ) = CLAMP(sum[2], 0.0f, 0.1f); +#else + UNCLAMPED_FLOAT_TO_UBYTE( LIT_COLOR( RCOMP ), sum[0] ); + UNCLAMPED_FLOAT_TO_UBYTE( LIT_COLOR( GCOMP ), sum[1] ); + UNCLAMPED_FLOAT_TO_UBYTE( LIT_COLOR( BCOMP ), sum[2] ); +#endif + LIT_COLOR( ACOMP ) = LIT_ALPHA; +} + +static void TAG(Normal3fv_multi)( const GLfloat *n ) +{ + GET_CURRENT_VERTEX; + struct gl_light *light; + GLfloat n_dot_h, n_dot_VP, spec, sum[3], tmp[3]; + GLfloat *normal; + + COPY_3V( ctx->Current.Normal, n ); + COPY_3V( sum, BASE_COLOR ); + + if ( IND & NORM_RESCALE ) { + normal = tmp; + COPY_3V( normal, n ); + SELF_SCALE_SCALAR_3V( normal, ctx->_ModelViewInvScale ); + } else if ( IND & NORM_NORMALIZE ) { + normal = tmp; + COPY_3V( normal, n ); + NORMALIZE_3FV( normal ); + } else { + normal = ctx->Current.Normal; + } + + foreach ( light, &ctx->Light.EnabledList ) { + n_dot_VP = DOT3( normal, light->_VP_inf_norm ); + if ( n_dot_VP > 0.0F ) { + ACC_SCALE_SCALAR_3V( sum, n_dot_VP, light->_MatDiffuse[0] ); + n_dot_h = DOT3( normal, light->_h_inf_norm ); + if ( n_dot_h > 0.0F ) { + GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec ); + ACC_SCALE_SCALAR_3V( sum, spec, light->_MatSpecular[0] ); + } + } + } + +#ifdef LIT_COLOR_IS_FLOAT + LIT_COLOR ( RCOMP ) = CLAMP(sum[0], 0.0f, 0.1f); + LIT_COLOR ( GCOMP ) = CLAMP(sum[1], 0.0f, 0.1f); + LIT_COLOR ( BCOMP ) = CLAMP(sum[2], 0.0f, 0.1f); +#else + UNCLAMPED_FLOAT_TO_UBYTE( LIT_COLOR( RCOMP ), sum[0] ); + UNCLAMPED_FLOAT_TO_UBYTE( LIT_COLOR( GCOMP ), sum[1] ); + UNCLAMPED_FLOAT_TO_UBYTE( LIT_COLOR( BCOMP ), sum[2] ); +#endif + LIT_COLOR( ACOMP ) = LIT_ALPHA; +} + + + +static void TAG(init_norm)( void ) +{ + norm_tab[IND].normal3f_single = TAG(Normal3f_single); + norm_tab[IND].normal3fv_single = TAG(Normal3fv_single); + norm_tab[IND].normal3f_multi = TAG(Normal3f_multi); + norm_tab[IND].normal3fv_multi = TAG(Normal3fv_multi); +} + + + +#ifndef PRESERVE_NORMAL_DEFS +#undef GET_CURRENT +#undef GET_CURRENT_VERTEX +#undef LIT_COLOR +#undef LIT_COLOR_IS_FLOAT +#endif +#undef PRESERVE_NORMAL_DEFS +#undef IND +#undef TAG diff --git a/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_primtmp.h b/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_primtmp.h new file mode 100644 index 00000000000..97dca3fd421 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_primtmp.h @@ -0,0 +1,570 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + * Gareth Hughes + */ + +/* Template for immediate mode vertices. + * + * Probably instantiate once for each vertex format used: + * - TINY_VERTICES + * - TEX0_VERTICES + * - TEX1_VERTICES + * - PTEX_VERTICES + * + * Have to handle TEX->PTEX transition somehow. + */ + +#define DBG 0 + + + +/* ============================================================= + * GL_POINTS + */ + +static void TAG(flush_point_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + if ( !v0->mask ) { + LOCAL_VARS; + DRAW_POINT( v0 ); + } +} + + +/* ============================================================= + * GL_LINES + */ + +static void TAG(flush_line_1)( GLcontext *ctx, TNL_VERTEX *v0 ); + +static void TAG(flush_line_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + FLUSH_VERTEX = TAG(flush_line_1); + ACTIVE_VERTEX = IMM_VERTICES( 1 ); +} + +static void TAG(flush_line_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + TNL_VERTEX *v1 = v0 - 1; + ACTIVE_VERTEX = IMM_VERTICES( 0 ); + FLUSH_VERTEX = TAG(flush_line_0); + if (FALLBACK_OR_CLIPPING) + CLIP_OR_DRAW_LINE( ctx, v1, v0 ); + else + DRAW_LINE( ctx, v1, v0 ); +} + + +/* ============================================================= + * GL_LINE_LOOP + */ + +static void TAG(flush_line_loop_2)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_line_loop_1)( GLcontext *ctx, TNL_VERTEX *v0 ); + +static void TAG(flush_line_loop_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + + ACTIVE_VERTEX = v0 + 1; + FLUSH_VERTEX = TAG(flush_line_loop_1); +} + +#define DRAW_LINELOOP_LINE( a, b ) \ + if (!HAVE_LINE_STRIP || FALLBACK_OR_CLIPPING) { \ + CLIP_OR_DRAW_LINE( ctx, a, b ); \ + } else if (EXTEND_PRIM( 1 )) { \ + EMIT_VERTEX( b ); \ + } else { \ + BEGIN_PRIM( GL_LINE_STRIP, 2 ); \ + EMIT_VERTEX( a ); \ + EMIT_VERTEX( b ); \ + } + +static void TAG(flush_line_loop_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + TNL_VERTEX *v1 = v0 - 1; + ACTIVE_VERTEX = v1; + FLUSH_VERTEX = TAG(flush_line_loop_2); + DRAW_LINELOOP_LINE( v1, v0 ); +} + +static void TAG(flush_line_loop_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + TNL_VERTEX *v1 = v0 + 1; + ACTIVE_VERTEX = v1; + FLUSH_VERTEX = TAG(flush_line_loop_1); + DRAW_LINELOOP_LINE( v1, v0 ); +} + +static void TAG(end_line_loop)( GLcontext *ctx ) +{ + LOCAL_VARS; + + if ( FLUSH_VERTEX != TAG(flush_line_loop_0) ) { + TNL_VERTEX *v1 = ACTIVE_VERTEX; + TNL_VERTEX *v0 = IMM_VERTICES( 0 ); + DRAW_LINELOOP_LINE( v1, v0 ); + } +} + + + +/* ============================================================= + * GL_LINE_STRIP + */ + +static void TAG(flush_line_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_line_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ); + +static void TAG(flush_line_strip_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + + ACTIVE_VERTEX = v0 + 1; + FLUSH_VERTEX = TAG(flush_line_strip_0b); +} + + +static void TAG(flush_line_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + TNL_VERTEX *v1 = v0 - 1; + + ACTIVE_VERTEX = v1; + FLUSH_VERTEX = TAG(flush_line_strip_2); + + if (!HAVE_LINE_STRIP || FALLBACK_OR_CLIPPING) + CLIP_OR_DRAW_LINE( ctx, v1, v0 ); + else if (EXTEND_PRIM( 1 )) { + EMIT_VERTEX( v0 ); + } else { + BEGIN_PRIM( GL_LINE_STRIP, 2 ); + EMIT_VERTEX( v1 ); + EMIT_VERTEX( v0 ); + } +} + +static void TAG(flush_line_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + TNL_VERTEX *v1 = v0 + 1; + + ACTIVE_VERTEX = v1; + FLUSH_VERTEX = TAG(flush_line_strip_1); + + if (!HAVE_LINE_STRIP || FALLBACK_OR_CLIPPING) + CLIP_OR_DRAW_LINE( ctx, v1, v0 ); + else if (EXTEND_PRIM( 1 )) { + EMIT_VERTEX( v0 ); + } else { + BEGIN_PRIM( GL_LINE_STRIP, 2 ); + EMIT_VERTEX( v1 ); + EMIT_VERTEX( v0 ); + } +} + + + +/* ============================================================= + * GL_TRIANGLES + */ + +static void TAG(flush_triangle_2)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_triangle_1)( GLcontext *ctx, TNL_VERTEX *v0 ); + +static void TAG(flush_triangle_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + + if ( DBG ) fprintf( stderr, __FUNCTION__ "\n" ); + + ACTIVE_VERTEX = v0 + 1; + FLUSH_VERTEX = TAG(flush_triangle_1); + BEGIN_PRIM( GL_TRIANGLES, 0 ); +} + +static void TAG(flush_triangle_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + + if ( DBG ) fprintf( stderr, __FUNCTION__ "\n" ); + + ACTIVE_VERTEX = v0 + 1; + FLUSH_VERTEX = TAG(flush_triangle_2); +} + +static void TAG(flush_triangle_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + TNL_VERTEX *v2 = v0 - 2; + TNL_VERTEX *v1 = v0 - 1; + + if ( DBG ) fprintf( stderr, __FUNCTION__ "\n" ); + + ACTIVE_VERTEX = v2; + FLUSH_VERTEX = TAG(flush_triangle_0); + + /* nothing gained by trying to emit as hw primitives -- that + * happens normally in this case. + */ + if (FALLBACK_OR_CLIPPING) + CLIP_OR_DRAW_TRI( ctx, v2, v1, v0 ); + else + DRAW_TRI( ctx, v2, v1, v0 ); +} + + + + +/* ============================================================= + * GL_TRIANGLE_STRIP + */ + +static void TAG(flush_tri_strip_3)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_tri_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_tri_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ); + +static void TAG(flush_tri_strip_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + ACTIVE_VERTEX = IMM_VERTICES( 1 ); + FLUSH_VERTEX = TAG(flush_tri_strip_1); +} + +static void TAG(flush_tri_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + ACTIVE_VERTEX = IMM_VERTICES( 2 ); + FLUSH_VERTEX = TAG(flush_tri_strip_2); +} + +#define DO_TRISTRIP_TRI( vert0, vert1 ) \ + if (!HAVE_TRI_STRIP || FALLBACK_OR_CLIPPING) { \ + TNL_VERTEX *v2 = IMM_VERTICES( vert0 ); \ + TNL_VERTEX *v1 = IMM_VERTICES( vert1 ); \ + TAG(draw_tri)( ctx, v2, v1, v0 ); \ + } else if (EXTEND_PRIM( 1 )) { \ + EMIT_VERTEX( v0 ); \ + } else { \ + TNL_VERTEX *v2 = IMM_VERTICES( vert0 ); \ + TNL_VERTEX *v1 = IMM_VERTICES( vert1 ); \ + BEGIN_PRIM( GL_TRIANGLE_STRIP, 3 ); \ + EMIT_VERTEX( v2 ); \ + EMIT_VERTEX( v1 ); \ + EMIT_VERTEX( v0 ); \ + } + +static void TAG(flush_tri_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + FLUSH_VERTEX = TAG(flush_tri_strip_3); + ACTIVE_VERTEX = IMM_VERTICES( 3 ); + DO_TRISTRIP_TRI( 0, 1 ); +} + +static void TAG(flush_tri_strip_3)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + FLUSH_VERTEX = TAG(flush_tri_strip_4); + ACTIVE_VERTEX = IMM_VERTICES( 0 ); + DO_TRISTRIP_TRI( 1, 2 ); +} + +static void TAG(flush_tri_strip_4)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + FLUSH_VERTEX = TAG(flush_tri_strip_5); + ACTIVE_VERTEX = IMM_VERTICES( 1 ); + DO_TRISTRIP_TRI( 2, 3 ); +} + +static void TAG(flush_tri_strip_5)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + FLUSH_VERTEX = TAG(flush_tri_strip_2); + ACTIVE_VERTEX = IMM_VERTICES( 2 ); + DO_TRISTRIP_TRI( 0, 3 ); +} + + + +/* ============================================================= + * GL_TRIANGLE_FAN + */ + +static void TAG(flush_tri_fan_2)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_tri_fan_1)( GLcontext *ctx, TNL_VERTEX *v0 ); + +static void TAG(flush_tri_fan_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + + ACTIVE_VERTEX = v0 + 1; + FLUSH_VERTEX = TAG(flush_tri_fan_1); +} + +static void TAG(flush_tri_fan_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + + ACTIVE_VERTEX = v0 + 1; + FLUSH_VERTEX = TAG(flush_tri_fan_2); +} + +#define DO_TRIFAN_TRI( vert0, vert1 ) \ + if (!HAVE_TRI_FAN || FALLBACK_OR_CLIPPING) { \ + TNL_VERTEX *v2 = IMM_VERTICES( vert0 ); \ + TNL_VERTEX *v1 = IMM_VERTICES( vert1 ); \ + TAG(draw_tri)( ctx, v2, v1, v0 ); \ + } else if (EXTEND_PRIM( 1 )) { \ + EMIT_VERTEX( v0 ); \ + } else { \ + TNL_VERTEX *v2 = IMM_VERTICES( vert0 ); \ + TNL_VERTEX *v1 = IMM_VERTICES( vert1 ); \ + BEGIN_PRIM( GL_TRIANGLE_FAN, 3 ); \ + EMIT_VERTEX( v2 ); \ + EMIT_VERTEX( v1 ); \ + EMIT_VERTEX( v0 ); \ + } + +static void TAG(flush_tri_fan_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + ACTIVE_VERTEX = IMM_VERTICES( 1 ); + FLUSH_VERTEX = TAG(flush_tri_fan_3 ); + DO_TRIFAN_TRI( 0, 1 ); +} + +static void TAG(flush_tri_fan_3)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + ACTIVE_VERTEX = IMM_VERTICES( 2 ); + FLUSH_VERTEX = TAG(flush_tri_fan_2 ); + DO_TRIFAN_TRI( 0, 2 ); +} + + + +/* ============================================================= + * GL_QUADS + */ + +static void TAG(flush_quad_3)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_quad_2)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_quad_1)( GLcontext *ctx, TNL_VERTEX *v0 ); + +static void TAG(flush_quad_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + IMM_VERTEX( v0 ) = v0 + 1; + FLUSH_VERTEX = TAG(flush_quad_1); +} + +static void TAG(flush_quad_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + IMM_VERTEX( v0 ) = v0 + 1; + FLUSH_VERTEX = TAG(flush_quad_2); +} + +static void TAG(flush_quad_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + IMM_VERTEX( v0 ) = v0 + 1; + FLUSH_VERTEX = TAG(flush_quad_3); +} + +static void TAG(flush_quad_3)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + TNL_VERTEX *v3 = v0 - 3; + TNL_VERTEX *v2 = v0 - 2; + TNL_VERTEX *v1 = v0 - 1; + + IMM_VERTEX( v0 ) = v3; + FLUSH_VERTEX = TAG(flush_quad_0); + + if (!HAVE_HW_QUADS || FALLBACK_OR_CLIPPING) { + CLIP_OR_DRAW_TRI( ctx, v3, v2, v0 ); + CLIP_OR_DRAW_TRI( ctx, v2, v1, v0 ); + } else { + EXTEND_PRIM_NF( GL_QUADS, 4 ); + EMIT_VERTEX( v3 ); + EMIT_VERTEX( v2 ); + EMIT_VERTEX( v1 ); + EMIT_VERTEX( v0 ); + } +} + + + +/* ============================================================= + * GL_QUAD_STRIP + */ + +static void TAG(flush_quad_strip_3)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_quad_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_quad_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ); + +static void TAG(flush_quad_strip_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + + IMM_VERTEX( v3 ) = v0; + IMM_VERTEX( v0 ) = v0 + 1; + FLUSH_VERTEX = TAG(flush_quad_strip_1); +} + +static void TAG(flush_quad_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + + IMM_VERTEX( v2 ) = v0; + IMM_VERTEX( v0 ) = v0 + 1; + FLUSH_VERTEX = TAG(flush_quad_strip_2); +} + +static void TAG(flush_quad_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + + IMM_VERTEX( v1 ) = v0; + IMM_VERTEX( v0 ) = v0 + 1; + FLUSH_VERTEX = TAG(flush_quad_strip_3); +} + +static void TAG(flush_quad_strip_3)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + TNL_VERTEX *v3 = IMM_VERTEX( v3 ); + TNL_VERTEX *v2 = IMM_VERTEX( v2 ); + TNL_VERTEX *v1 = IMM_VERTEX( v1 ); + + IMM_VERTEX( v0 ) = v3; + IMM_VERTEX( v2 ) = v0; + IMM_VERTEX( v3 ) = v1; + FLUSH_VERTEX = TAG(flush_quad_strip_2); + + if (FALLBACK_OR_CLIPPING) { + CLIP_OR_DRAW_TRI( ctx, v3, v2, v0 ); + CLIP_OR_DRAW_TRI( ctx, v2, v1, v0 ); + } else { + DRAW_TRI( ctx, v3, v2, v0 ); + DRAW_TRI( ctx, v2, v1, v0 ); + } +} + + + +/* ============================================================= + * GL_POLYGON + */ + +static void TAG(flush_poly_2)( GLcontext *ctx, TNL_VERTEX *v0 ); +static void TAG(flush_poly_1)( GLcontext *ctx, TNL_VERTEX *v0 ); + +static void TAG(flush_poly_0)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + ACTIVE_VERTEX = IMM_VERTICES( 1 ); + FLUSH_VERTEX = TAG(flush_poly_1); +} + +static void TAG(flush_poly_1)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + ACTIVE_VERTEX = IMM_VERTICES( 2 ); + FLUSH_VERTEX = TAG(flush_poly_2); +} + +#define DO_POLY_TRI( vert0, vert1 ) \ + if (!HAVE_POLYGONS || FALLBACK_OR_CLIPPING) { \ + TNL_VERTEX *v2 = IMM_VERTICES( vert0 ); \ + TNL_VERTEX *v1 = IMM_VERTICES( vert1 ); \ + TAG(draw_tri)( ctx, v1, v0, v2 ); \ + } else if (EXTEND_PRIM( 1 )) { \ + EMIT_VERTEX( v0 ); \ + } else { \ + TNL_VERTEX *v2 = IMM_VERTICES( vert0 ); \ + TNL_VERTEX *v1 = IMM_VERTICES( vert1 ); \ + BEGIN_PRIM( GL_POLYGON, 3 ); \ + EMIT_VERTEX( v2 ); \ + EMIT_VERTEX( v1 ); \ + EMIT_VERTEX( v0 ); \ + } + +static void TAG(flush_poly_2)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + ACTIVE_VERTEX = IMM_VERTICES( 1 ); + FLUSH_VERTEX = TAG(flush_poly_3); + DO_POLY_TRI( 0, 1 ); +} + +static void TAG(flush_poly_3)( GLcontext *ctx, TNL_VERTEX *v0 ) +{ + LOCAL_VARS; + ACTIVE_VERTEX = IMM_VERTICES( 2 ); + FLUSH_VERTEX = TAG(flush_poly_2); + DO_POLY_TRI( 0, 2 ); +} + + +void (*TAG(flush_tab)[GL_POLYGON+1])( GLcontext *, TNL_VERTEX * ) = +{ + TAG(flush_point), + TAG(flush_line_0), + TAG(flush_line_loop_0), + TAG(flush_line_strip_0), + TAG(flush_triangle_0), + TAG(flush_tri_strip_0), + TAG(flush_tri_fan_0), + TAG(flush_quad_0), + TAG(flush_quad_strip_0), + TAG(flush_poly_0), +}; + + +#ifndef PRESERVE_PRIM_DEFS +#undef LOCAL_VARS +#undef GET_INTERP_FUNC +#undef IMM_VERTEX +#undef IMM_VERTICES +#undef FLUSH_VERTEX +#endif +#undef PRESERVE_PRIM_DEFS +#undef EXTEND_PRIM +#undef EMIT_VERTEX +#undef EMIT_VERTEX_TRI +#undef EMIT_VERTEX_LINE +#undef EMIT_VERTEX_POINT +#undef TAG diff --git a/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_tapi.h b/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_tapi.h new file mode 100644 index 00000000000..b82a9abebff --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_tapi.h @@ -0,0 +1,75 @@ + +/* + * 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. + * + * Authors: + * Gareth Hughes + * Keith Whitwell + */ + +/* Template for immediate mode texture coordinate functions. + */ + +#ifndef DO_PROJ_TEX +#error "Need to define DO_PROJ_TEX" +#endif + + +/* ============================================================= + * Notify on calls to texture4f, to allow switch to projected texture + * vertex format: + */ + +static void TAG(TexCoord4f)( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) +{ + GET_CURRENT; + DO_PROJ_TEX; + TEXCOORD4( s, t, r, q ); +} + +static void TAG(TexCoord4fv)( const GLfloat *v ) +{ + GET_CURRENT; + DO_PROJ_TEX; + TEXCOORD4( v[0], v[1], v[2], v[3] ); +} + +static void TAG(MultiTexCoord4fARB)( GLenum target, GLfloat s, + GLfloat t, GLfloat r, GLfloat q ) +{ + GET_CURRENT; + DO_PROJ_TEX; + MULTI_TEXCOORD4( unit, s, t, r, q ); +} + +static void TAG(MultiTexCoord4fvARB)( GLenum target, const GLfloat *v ) +{ + GET_CURRENT; + DO_PROJ_TEX; + MULTI_TEXCOORD4( unit, v[0], v[1], v[2], v[3] ); +} + + + +#undef DO_PROJ_TEX +#undef TAG diff --git a/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_vapi.h b/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_vapi.h new file mode 100644 index 00000000000..95e93b1c839 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_vapi.h @@ -0,0 +1,159 @@ + +/* + * 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. + * + * Authors: + * Gareth Hughes + * Keith Whitwell + */ + +/* Template for immediate mode vertex functions. + */ + +#define DBG 0 + +#define VERTEX( ox, oy, oz, ow ) +do { + GET_CURRENT_VERTEX; + GLfloat w; + GLuint mask; + const GLfloat * const m = ctx->_ModelProjectMatrix.m; + + if (DO_FULL_MATRIX) { + VERTEX_CLIP(0) = m[0] * ox + m[4] * oy + m[8] * oz + m[12] * ow; + VERTEX_CLIP(1) = m[1] * ox + m[5] * oy + m[9] * oz + m[13] * ow; + VERTEX_CLIP(2) = m[2] * ox + m[6] * oy + m[10] * oz + m[14] * ow; + VERTEX_CLIP(3) = m[3] * ox + m[7] * oy + m[11] * oz + m[15] * ow; + w = VERTEX_CLIP(3); + } + else if (DO_NOROT_MATRIX) { + VERTEX_CLIP(0) = m[0] * ox + m[12] * ow; + VERTEX_CLIP(1) = m[5] * oy + m[13] * ow; + VERTEX_CLIP(2) = m[10] * oz + m[14] * ow; + VERTEX_CLIP(3) = ow; + w = ow; + } + else { + ASSERT (DO_IDENTITY_MATRIX); + VERTEX_CLIP(0) = ox; + VERTEX_CLIP(1) = oy; + VERTEX_CLIP(2) = oz; + VERTEX_CLIP(3) = ow; + w = ow; + } + + mask = 0; + if (DO_CLIP_TEST) { + if ( VERTEX_CLIP(0) > w ) mask |= CLIP_RIGHT_BIT; + if ( VERTEX_CLIP(0) < -w ) mask |= CLIP_LEFT_BIT; + if ( VERTEX_CLIP(1) > w ) mask |= CLIP_TOP_BIT; + if ( VERTEX_CLIP(1) < -w ) mask |= CLIP_BOTTOM_BIT; + if ( VERTEX_CLIP(2) > w ) mask |= CLIP_FAR_BIT; + if ( VERTEX_CLIP(2) < -w ) mask |= CLIP_NEAR_BIT; + VERTEX_MASK(v) = mask; + } + + if (!mask) { + if (HAVE_VERTEX_WIN) { + if (!HAVE_HW_VIEWPORT) { + const GLfloat *s = GET_VIEWPORT_MATRIX(); + if (HAVE_W && HAVE_HW_DIVIDE) { + VERTEX_WIN( 0 ) = s[0] * VERTEX_CLIP( 0 ) + s[12]; + VERTEX_WIN( 1 ) = s[5] * VERTEX_CLIP( 1 ) + s[13]; + VERTEX_WIN( 2 ) = s[10] * VERTEX_CLIP( 2 ) + s[14]; + VERTEX_WIN( 3 ) = w; + } + else { + const GLfloat oow = 1.0/w; /* possibly opt away */ + VERTEX_WIN( 0 ) = s[0] * VERTEX_CLIP( 0 ) * oow + s[12]; + VERTEX_WIN( 1 ) = s[5] * VERTEX_CLIP( 1 ) * oow + s[13]; + VERTEX_WIN( 2 ) = s[10] * VERTEX_CLIP( 2 ) * oow + s[14]; + if (HAVE_W) + VERTEX_WIN( 3 ) = oow; + } + } + else if (HAVE_W && HAVE_HW_DIVIDE) { + if (!VERTEX_WIN_IS_VERTEX_CLIP) { + VERTEX_WIN( 0 ) = VERTEX_CLIP( 0 ); + VERTEX_WIN( 1 ) = VERTEX_CLIP( 1 ); + VERTEX_WIN( 2 ) = VERTEX_CLIP( 2 ); + VERTEX_WIN( 3 ) = w; + } + } + else { + const GLfloat oow = 1.0/w; /* possibly opt away */ + VERTEX_WIN( 0 ) = VERTEX_CLIP( 0 ) * oow; + VERTEX_WIN( 1 ) = VERTEX_CLIP( 1 ) * oow; + VERTEX_WIN( 2 ) = VERTEX_CLIP( 2 ) * oow; + if (HAVE_W) + VERTEX_WIN( 3 ) = oow; + } + } + } else if (!FALLBACK_OR_CLIPPING) { + SET_CLIPPING(); /* transition to clipping */ + } + + COPY_VERTEX_FROM_CURRENT; + BUILD_PRIM_FROM_VERTEX; +} + +/* Let the compiler optimize away the constant operations: + */ +static void VTAG(Vertex2f)( GLfloat ox, GLfloat oy ) +{ + /* Cliptest on clip[2] could also be eliminated... + */ + VERTEX( ox, oy, 0, 1 ); +} + +static void VTAG(Vertex2fv)( const GLfloat *obj ) +{ + /* Cliptest on clip[2] could also be eliminated... + */ + VERTEX( obj[0], obj[1], 0, 1 ); +} + +static void VTAG(Vertex3f)( GLfloat ox, GLfloat oy, GLfloat oz ) +{ + VERTEX( ox, oy, oz, 1 ); +} + +static void VTAG(Vertex3fv)( const GLfloat *obj ) +{ + VERTEX( obj[0], obj[1], obj[2], 1 ); +} + +static void VTAG(Vertex4f)( GLfloat ox, GLfloat oy, GLfloat oz, GLfloat ow ) +{ + VERTEX( ox, oy, oz, ow ); +} + +static void VTAG(Vertex4fv)( const GLfloat *obj ) +{ + VERTEX( obj[0], obj[1], obj[2], obj[3] ); +} + + +#undef DO_FULL_MATRIX +#undef VTAG +#undef VERTEX diff --git a/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_vb.c b/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_vb.c new file mode 100644 index 00000000000..0c4462f556f --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_vb.c @@ -0,0 +1,204 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +/* Template to build clipping routines to support t_dd_imm_primtmp.h. + * + * The TAG(draw_line) and TAG(draw_triangle) routines are called in + * clipping and fallback scenarios, and when the native hardware + * primitive (eg polygons) is unavailable. + */ + + +#define CLIP_DOTPROD(K, A, B, C, D) \ + (CLIP_X(K)*A + CLIP_Y(K)*B + \ + CLIP_Z(K)*C + CLIP_W(K)*D) + +#define POLY_CLIP( PLANE, A, B, C, D ) \ +do { \ + if (mask & PLANE) { \ + TNL_VERTEX **indata = inlist[in]; \ + TNL_VERTEX **outdata = inlist[in ^= 1]; \ + TNL_VERTEX *J = indata[0]; \ + GLfloat dpJ = CLIP_DOTPROD(J, A, B, C, D ); \ + GLuint outcount = 0; \ + GLuint i; \ + \ + indata[n] = indata[0]; /* prevent rotation of vertices */ \ + for (i = 1; i <= n; i++) { \ + TNL_VERTEX *I = indata[i]; \ + GLfloat dpI = CLIP_DOTPROD(idx, A, B, C, D ); \ + \ + if (!NEGATIVE(dpPrev)) { \ + outdata[outcount++] = J; \ + } \ + \ + if (DIFFERENT_SIGNS(dpI, dpJ)) { \ + TNL_VERTEX *O = verts++; \ + outdata[outcount++] = O; \ + if (NEGATIVE(dpI)) { \ + /* Going out of bounds. Avoid division by zero as we \ + * know dp != dpPrev from DIFFERENT_SIGNS, above. \ + */ \ + GLfloat t = dpI / (dpI - dpJ); \ + INTERP( ctx, t, O, I, J ); \ + } else { \ + /* Coming back in. \ + */ \ + GLfloat t = dpJ / (dpJ - dpI); \ + INTERP( ctx, t, O, J, I ); \ + } \ + } \ + \ + J = I; \ + dpJ = dpI; \ + } \ + \ + if (outcount < 3) \ + return; \ + \ + nr = outcount; \ + } \ +} while (0) + + +#define LINE_CLIP(PLANE, A, B, C, D ) \ +do { \ + if (mask & PLANE) { \ + GLfloat dpI = CLIP_DOTPROD( I, A, B, C, D ); \ + GLfloat dpJ = CLIP_DOTPROD( J, A, B, C, D ); \ + \ + if (DIFFERENT_SIGNS(dpI, dpJ)) { \ + TNL_VERTEX *O = verts++; \ + if (NEGATIVE(dpJ)) { \ + GLfloat t = dpI / (dpI - dpJ); \ + INTERP( ctx, t, O, I, J ); \ + J = O; \ + } else { \ + GLfloat t = dpJ / (dpJ - dpI); \ + INTERP( ctx, t, O, J, I ); \ + I = O; \ + } \ + } \ + else if (NEGATIVE(dpI)) \ + return; \ + } \ +} while (0) + + + +/* Clip a line against the viewport and user clip planes. + */ +static void TAG(clip_draw_line)( GLcontext *ctx, + TNL_VERTEX *I, + TNL_VERTEX *J, + GLuint mask ) +{ + LOCAL_VARS; + GET_INTERP_FUNC; + TNL_VERTEX tmp[MAX_CLIPPED_VERTICES]; + TNL_VERTEX *verts = tmp; + TNL_VERTEX *pv = J; + + LINE_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); + LINE_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); + LINE_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 ); + LINE_CLIP( CLIP_BOTTOM_BIT, 0, 1, 0, 1 ); + LINE_CLIP( CLIP_FAR_BIT, 0, 0, -1, 1 ); + LINE_CLIP( CLIP_NEAR_BIT, 0, 0, 1, 1 ); + + if ((ctx->_TriangleCaps & DD_FLATSHADE) && J != pv) + COPY_PV( ctx, J, pv ); + + DRAW_LINE( I, J ); +} + + +/* Clip a triangle against the viewport and user clip planes. + */ +static void TAG(clip_draw_triangle)( GLcontext *ctx, + TNL_VERTEX *v0, + TNL_VERTEX *v1, + TNL_VERTEX *v2, + GLuint mask ) +{ + LOCAL_VARS; + GET_INTERP_FUNC; + TNL_VERTEX tmp[MAX_CLIPPED_VERTICES]; + TNL_VERTEX *verts = tmp; + TNL_VERTEX *(inlist[2][MAX_CLIPPED_VERTICES]); + TNL_VERTEX **out; + GLuint in = 0; + GLuint n = 3; + GLuint i; + + ASSIGN_3V(inlist, v2, v0, v1 ); /* pv rotated to slot zero */ + + POLY_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); + POLY_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); + POLY_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 ); + POLY_CLIP( CLIP_BOTTOM_BIT, 0, 1, 0, 1 ); + POLY_CLIP( CLIP_FAR_BIT, 0, 0, -1, 1 ); + POLY_CLIP( CLIP_NEAR_BIT, 0, 0, 1, 1 ); + + if ((ctx->_TriangleCaps & DD_FLATSHADE) && v2 != inlist[0]) + COPY_PV( ctx, inlist[0], v2 ); + + out = inlist[in]; + DRAW_POLYGON( out, n ); +} + + +static __inline void TAG(draw_triangle)( GLcontext *ctx, + TNL_VERTEX *v0, + TNL_VERTEX *v1, + TNL_VERTEX *v2 ) +{ + LOCAL_VARS; + GLubyte ormask = (v0->mask | v1->mask | v2->mask); + + if ( !ormask ) { + DRAW_TRI( v0, v1, v2 ); + } else if ( !(v0->mask & v1->mask & v2->mask) ) { + TAG(clip_draw_triangle)( ctx, v0, v1, v2, ormask ); + } +} + +static __inline void TAG(draw_line)( GLcontext *ctx, + TNL_VERTEX *v0, + TNL_VERTEX *v1 ) +{ + LOCAL_VARS; + GLubyte ormask = (v0->mask | v1->mask); + + if ( !ormask ) { + DRAW_LINE( v0, v1 ); + } else if ( !(v0->mask & v1->mask) ) { + TAG(clip_draw_line)( ctx, v0, v1, ormask ); + } +} + diff --git a/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_vbtmp.h b/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_vbtmp.h new file mode 100644 index 00000000000..2f76553cff9 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/imm/t_dd_imm_vbtmp.h @@ -0,0 +1,268 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +/* Template to build support for t_dd_imm_* tnl module using vertices + * as defined in t_dd_vertex.h. + * + * See t_dd_vbtmp.h for definitions of arguments to this file. + * Unfortunately it seems necessary to duplicate a lot of that code. + */ + +#ifndef LOCALVARS +#define LOCALVARS +#endif + + + +/* COPY_VERTEX_FROM_CURRENT in t_dd_imm_vapi.c + */ +static void TAG(emit_vfmt)( GLcontext *ctx, VERTEX *v ) +{ + LOCALVARS + ; + + /* This template assumes (like t_dd_vbtmp.h) that color is ubyte. + */ + if (DO_TEX0 || DO_TEX1 || !HAVE_TINY_VERTICES) + { + const GLubyte *col = GET_HARDWARE_COLOR(); + if (HAVE_RGBA_COLOR) { + v->v.ui[4] = *(GLuint *)&col; + } else { + v->v.color.blue = col[2]; + v->v.color.green = col[1]; + v->v.color.red = col[0]; + v->v.color.alpha = col[3]; + } + } + else { + if (HAVE_RGBA_COLOR) { + v->v.ui[3] = *(GLuint *)col; + } + else { + v->tv.color.blue = col[2]; + v->tv.color.green = col[1]; + v->tv.color.red = col[0]; + v->tv.color.alpha = col[3]; + } + } + + if (DO_TEX0) { + GLfloat *tc = ctx->Current.Texture[0]; + v->v.u0 = tc[0]; + v->v.v0 = tc[1]; + if (DO_PTEX) { + if (HAVE_PTEX_VERTICES) { + v->pv.q0 = tc[3]; + } + else { + float rhw = 1.0 / tc[3]; + v->v.w *= tc[3]; + v->v.u0 *= rhw; + v->v.v0 *= rhw; + } + } + } + if (DO_TEX1) { + GLfloat *tc = ctx->Current.Texture[1]; + if (DO_PTEX) { + v->pv.u1 = tc[0]; + v->pv.v1 = tc[1]; + v->pv.q1 = tc[3]; + } + else { + v->v.u1 = tc[0]; + v->v.v1 = tc[1]; + } + } + else if (DO_PTEX) { + *(GLuint *)&v->pv.q1 = 0; /* avoid culling on radeon */ + } + if (DO_TEX2) { + GLfloat *tc = ctx->Current.Texture[2]; + if (DO_PTEX) { + v->pv.u2 = tc[0]; + v->pv.v2 = tc[1]; + v->pv.q2 = tc[3]; + } + else { + v->v.u2 = tc[0]; + v->v.v2 = tc[1]; + } + } + if (DO_TEX3) { + GLfloat *tc = ctx->Current.Texture[3]; + if (DO_PTEX) { + v->pv.u3 = tc[0]; + v->pv.v3 = tc[1]; + v->pv.q3 = tc[3]; + } + else { + v->v.u3 = tc[0]; + v->v.v3 = tc[1]; + } + } +} + + + + +static void TAG(interp)( GLcontext *ctx, + GLfloat t, + TNL_VERTEX *dst, + TNL_VERTEX *in, + TNL_VERTEX *out ) +{ + LOCALVARS + const GLfloat *s = GET_VIEWPORT_MAT(); + GLfloat w; + + (void)s; + + if (HAVE_HW_DIVIDE) { + VIEWPORT_X( dst->v.v.x, dst->clip[0] ); + VIEWPORT_Y( dst->v.v.y, dst->clip[1] ); + VIEWPORT_Z( dst->v.v.z, dst->clip[2] ); + w = dstclip[3]; + } + else { + w = 1.0 / dst->clip[3]; + VIEWPORT_X( dst->v.v.x, dst->clip[0] * w ); + VIEWPORT_Y( dst->v.v.y, dst->clip[1] * w ); + VIEWPORT_Z( dst->v.v.z, dst->clip[2] * w ); + } + + if (HAVE_HW_DIVIDE || DO_TEX0) { + + dst->v.v.w = w; + + INTERP_UB( t, dst->v.ub4[4][0], out->v.ub4[4][0], in->v.ub4[4][0] ); + INTERP_UB( t, dst->v.ub4[4][1], out->v.ub4[4][1], in->v.ub4[4][1] ); + INTERP_UB( t, dst->v.ub4[4][2], out->v.ub4[4][2], in->v.ub4[4][2] ); + INTERP_UB( t, dst->v.ub4[4][3], out->v.ub4[4][3], in->v.ub4[4][3] ); + + if (DO_TEX0) { + if (DO_PTEX) { + if (HAVE_PTEX_VERTICES) { + INTERP_F( t, dst->v.pv.u0, out->v.pv.u0, in->v.pv.u0 ); + INTERP_F( t, dst->v.pv.v0, out->v.pv.v0, in->v.pv.v0 ); + INTERP_F( t, dst->v.pv.q0, out->v.pv.q0, in->v.pv.q0 ); + } else { + GLfloat wout = out->clip[3]; /* projected clip */ + GLfloat win = in->clip[3]; /* projected clip */ + GLfloat qout = out->v.pv.w / wout; + GLfloat qin = in->v.pv.w / win; + GLfloat qdst, rqdst; + + ASSERT( !HAVE_HW_DIVIDE ); /* assert win, wout projected clip */ + + INTERP_F( t, dst->v.v.u0, out->v.v.u0 * qout, in->v.v.u0 * qin ); + INTERP_F( t, dst->v.v.v0, out->v.v.v0 * qout, in->v.v.v0 * qin ); + INTERP_F( t, qdst, qout, qin ); + + rqdst = 1.0 / qdst; + dst->v.v.u0 *= rqdst; + dst->v.v.v0 *= rqdst; + dst->v.v.w *= rqdst; + } + } + else { + INTERP_F( t, dst->v.v.u0, out->v.v.u0, in->v.v.u0 ); + INTERP_F( t, dst->v.v.v0, out->v.v.v0, in->v.v.v0 ); + } + } + if (DO_TEX1) { + if (DO_PTEX) { + INTERP_F( t, dst->v.pv.u1, out->v.pv.u1, in->v.pv.u1 ); + INTERP_F( t, dst->v.pv.v1, out->v.pv.v1, in->v.pv.v1 ); + INTERP_F( t, dst->v.pv.q1, out->v.pv.q1, in->v.pv.q1 ); + } else { + INTERP_F( t, dst->v.v.u1, out->v.v.u1, in->v.v.u1 ); + INTERP_F( t, dst->v.v.v1, out->v.v.v1, in->v.v.v1 ); + } + } + else if (DO_PTEX) { + dst->v.pv.q0 = 0.0; /* must be a valid float on radeon */ + } + if (DO_TEX2) { + if (DO_PTEX) { + INTERP_F( t, dst->v.pv.u2, out->v.pv.u2, in->v.pv.u2 ); + INTERP_F( t, dst->v.pv.v2, out->v.pv.v2, in->v.pv.v2 ); + INTERP_F( t, dst->v.pv.q2, out->v.pv.q2, in->v.pv.q2 ); + } else { + INTERP_F( t, dst->v.v.u2, out->v.v.u2, in->v.v.u2 ); + INTERP_F( t, dst->v.v.v2, out->v.v.v2, in->v.v.v2 ); + } + } + if (DO_TEX3) { + if (DO_PTEX) { + INTERP_F( t, dst->v.pv.u3, out->v.pv.u3, in->v.pv.u3 ); + INTERP_F( t, dst->v.pv.v3, out->v.pv.v3, in->v.pv.v3 ); + INTERP_F( t, dst->v.pv.q3, out->v.pv.q3, in->v.pv.q3 ); + } else { + INTERP_F( t, dst->v.v.u3, out->v.v.u3, in->v.v.u3 ); + INTERP_F( t, dst->v.v.v3, out->v.v.v3, in->v.v.v3 ); + } + } + } else { + /* 4-dword vertex. Color is in v[3] and there is no oow coordinate. + */ + INTERP_UB( t, dst->v.ub4[3][0], out->v.ub4[3][0], in->v.ub4[3][0] ); + INTERP_UB( t, dst->v.ub4[3][1], out->v.ub4[3][1], in->v.ub4[3][1] ); + INTERP_UB( t, dst->v.ub4[3][2], out->v.ub4[3][2], in->v.ub4[3][2] ); + INTERP_UB( t, dst->v.ub4[3][3], out->v.ub4[3][3], in->v.ub4[3][3] ); + } +} + + +static __inline void TAG(copy_pv)( GLcontext *ctx, + TNL_VERTEX *dst, + TNL_VERTEX *src ) +{ + if (DO_TEX0 || DO_TEX1 || !HAVE_TINY_VERTICES) { + dst->v.v.ui[4] = src->v.v.ui[4]; + } + else { + dst->v.v.ui[3] = src->v.v.ui[3]; + } +} + + + +static void TAG(init)( void ) +{ + setup_tab[IND].emit = TAG(emit_vfmt); + setup_tab[IND].interp = TAG(interp_vfmt); +} + + +#undef IND +#undef TAG + + + diff --git a/reactos/dll/mesa32/src/tnl_dd/t_dd.c b/reactos/dll/mesa32/src/tnl_dd/t_dd.c new file mode 100644 index 00000000000..731da5c320d --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/t_dd.c @@ -0,0 +1,58 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +static void copy_pv_rgba4_spec5( GLcontext *ctx, GLuint edst, GLuint esrc ) +{ + i810ContextPtr imesa = I810_CONTEXT( ctx ); + GLubyte *i810verts = (GLubyte *)imesa->verts; + GLuint shift = imesa->vertex_stride_shift; + i810Vertex *dst = (i810Vertex *)(i810verts + (edst << shift)); + i810Vertex *src = (i810Vertex *)(i810verts + (esrc << shift)); + dst->ui[4] = src->ui[4]; + dst->ui[5] = src->ui[5]; +} + +static void copy_pv_rgba4( GLcontext *ctx, GLuint edst, GLuint esrc ) +{ + i810ContextPtr imesa = I810_CONTEXT( ctx ); + GLubyte *i810verts = (GLubyte *)imesa->verts; + GLuint shift = imesa->vertex_stride_shift; + i810Vertex *dst = (i810Vertex *)(i810verts + (edst << shift)); + i810Vertex *src = (i810Vertex *)(i810verts + (esrc << shift)); + dst->ui[4] = src->ui[4]; +} + +static void copy_pv_rgba3( GLcontext *ctx, GLuint edst, GLuint esrc ) +{ + i810ContextPtr imesa = I810_CONTEXT( ctx ); + GLubyte *i810verts = (GLubyte *)imesa->verts; + GLuint shift = imesa->vertex_stride_shift; + i810Vertex *dst = (i810Vertex *)(i810verts + (edst << shift)); + i810Vertex *src = (i810Vertex *)(i810verts + (esrc << shift)); + dst->ui[3] = src->ui[3]; +} diff --git a/reactos/dll/mesa32/src/tnl_dd/t_dd_dmatmp.h b/reactos/dll/mesa32/src/tnl_dd/t_dd_dmatmp.h new file mode 100644 index 00000000000..d274ead2c27 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/t_dd_dmatmp.h @@ -0,0 +1,1254 @@ +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + + +/* Template for render stages which build and emit vertices directly + * to fixed-size dma buffers. Useful for rendering strips and other + * native primitives where clipping and per-vertex tweaks such as + * those in t_dd_tritmp.h are not required. + * + * Produces code for both inline triangles and indexed triangles. + * Where various primitive types are unaccelerated by hardware, the + * code attempts to fallback to other primitive types (quadstrips to + * tristrips, lineloops to linestrips), or to indexed vertices. + */ + +#if !defined(HAVE_TRIANGLES) +#error "must have at least triangles to use render template" +#endif + +#if !HAVE_ELTS +#define ELTS_VARS(buf) +#define ALLOC_ELTS(nr) 0 +#define EMIT_ELT( offset, elt ) +#define EMIT_TWO_ELTS( offset, elt0, elt1 ) +#define INCR_ELTS( nr ) +#define ELT_INIT(prim) +#define GET_CURRENT_VB_MAX_ELTS() 0 +#define GET_SUBSEQUENT_VB_MAX_ELTS() 0 +#define RELEASE_ELT_VERTS() +#define EMIT_INDEXED_VERTS( ctx, start, count ) +#endif + +#ifndef EMIT_TWO_ELTS +#define EMIT_TWO_ELTS( offset, elt0, elt1 ) \ +do { \ + EMIT_ELT( offset, elt0 ); \ + EMIT_ELT( offset+1, elt1 ); \ +} while (0) +#endif + + +/**********************************************************************/ +/* Render whole begin/end objects */ +/**********************************************************************/ + + + + +#if (HAVE_ELTS) +static void *TAG(emit_elts)( GLcontext *ctx, GLuint *elts, GLuint nr, + void *buf) +{ + GLint i; + LOCAL_VARS; + ELTS_VARS(buf); + + for ( i = 0 ; i+1 < nr ; i+=2, elts += 2 ) { + EMIT_TWO_ELTS( 0, elts[0], elts[1] ); + INCR_ELTS( 2 ); + } + + if (i < nr) { + EMIT_ELT( 0, elts[0] ); + INCR_ELTS( 1 ); + } + + return (void *)ELTPTR; +} +#endif + +static __inline void *TAG(emit_verts)( GLcontext *ctx, GLuint start, + GLuint count, void *buf ) +{ + return EMIT_VERTS(ctx, start, count, buf); +} + +/*********************************************************************** + * Render non-indexed primitives. + ***********************************************************************/ + +static void TAG(render_points_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_POINTS) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz; + GLuint j, nr; + + INIT( GL_POINTS ); + + currentsz = GET_CURRENT_VB_MAX_VERTS(); + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j < count; j += nr ) { + nr = MIN2( currentsz, count - j ); + TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) ); + currentsz = dmasz; + } + + } else { + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + +static void TAG(render_lines_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_LINES) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz; + GLuint j, nr; + + INIT( GL_LINES ); + + /* Emit whole number of lines in total and in each buffer: + */ + count -= (count-start) & 1; + currentsz = GET_CURRENT_VB_MAX_VERTS(); + currentsz -= currentsz & 1; + dmasz -= dmasz & 1; + + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j < count; j += nr ) { + nr = MIN2( currentsz, count - j ); + TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) ); + currentsz = dmasz; + } + + } else { + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + + +static void TAG(render_line_strip_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_LINE_STRIPS) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz; + GLuint j, nr; + + INIT( GL_LINE_STRIP ); + + currentsz = GET_CURRENT_VB_MAX_VERTS(); + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j + 1 < count; j += nr - 1 ) { + nr = MIN2( currentsz, count - j ); + TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) ); + currentsz = dmasz; + } + + FLUSH(); + + } else { + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + + +static void TAG(render_line_loop_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_LINE_STRIPS) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz; + GLuint j, nr; + + INIT( GL_LINE_STRIP ); + + if (flags & PRIM_BEGIN) + j = start; + else + j = start + 1; + + /* Ensure last vertex won't wrap buffers: + */ + currentsz = GET_CURRENT_VB_MAX_VERTS(); + currentsz--; + dmasz--; + + if (currentsz < 8) { + currentsz = dmasz; + } + + if (j + 1 < count) { + for ( ; j + 1 < count; j += nr - 1 ) { + nr = MIN2( currentsz, count - j ); + + if (j + nr >= count && + start < count - 1 && + (flags & PRIM_END)) + { + void *tmp; + tmp = ALLOC_VERTS(nr+1); + tmp = TAG(emit_verts)( ctx, j, nr, tmp ); + tmp = TAG(emit_verts)( ctx, start, 1, tmp ); + } + else { + TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) ); + currentsz = dmasz; + } + } + + } + else if (start + 1 < count && (flags & PRIM_END)) { + void *tmp; + tmp = ALLOC_VERTS(2); + tmp = TAG(emit_verts)( ctx, start+1, 1, tmp ); + tmp = TAG(emit_verts)( ctx, start, 1, tmp ); + } + + FLUSH(); + + } else { + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + + +static void TAG(render_triangles_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + int dmasz = (GET_SUBSEQUENT_VB_MAX_VERTS()/3) * 3; + int currentsz; + GLuint j, nr; + + INIT(GL_TRIANGLES); + + currentsz = (GET_CURRENT_VB_MAX_VERTS()/3) * 3; + + /* Emit whole number of tris in total. dmasz is already a multiple + * of 3. + */ + count -= (count-start)%3; + + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j < count; j += nr) { + nr = MIN2( currentsz, count - j ); + TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) ); + currentsz = dmasz; + } +} + + + +static void TAG(render_tri_strip_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_TRI_STRIPS) { + LOCAL_VARS; + GLuint j, nr; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz; + + INIT(GL_TRIANGLE_STRIP); + + currentsz = GET_CURRENT_VB_MAX_VERTS(); + + if (currentsz < 8) { + currentsz = dmasz; + } + + /* From here on emit even numbers of tris when wrapping over buffers: + */ + dmasz -= (dmasz & 1); + currentsz -= (currentsz & 1); + + for (j = start ; j + 2 < count; j += nr - 2 ) { + nr = MIN2( currentsz, count - j ); + TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) ); + currentsz = dmasz; + } + + FLUSH(); + + } else { + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + +static void TAG(render_tri_fan_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_TRI_FANS) { + LOCAL_VARS; + GLuint j, nr; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz; + + INIT(GL_TRIANGLE_FAN); + + currentsz = GET_CURRENT_VB_MAX_VERTS(); + if (currentsz < 8) { + currentsz = dmasz; + } + + for (j = start + 1 ; j + 1 < count; j += nr - 2 ) { + void *tmp; + nr = MIN2( currentsz, count - j + 1 ); + tmp = ALLOC_VERTS( nr ); + tmp = TAG(emit_verts)( ctx, start, 1, tmp ); + tmp = TAG(emit_verts)( ctx, j, nr - 1, tmp ); + currentsz = dmasz; + } + + FLUSH(); + } + else { + /* Could write code to emit these as indexed vertices (for the + * g400, for instance). + */ + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + + +static void TAG(render_poly_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_POLYGONS) { + LOCAL_VARS; + GLuint j, nr; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz; + + INIT(GL_POLYGON); + + currentsz = GET_CURRENT_VB_MAX_VERTS(); + if (currentsz < 8) { + currentsz = dmasz; + } + + for (j = start + 1 ; j + 1 < count ; j += nr - 2 ) { + void *tmp; + nr = MIN2( currentsz, count - j + 1 ); + tmp = ALLOC_VERTS( nr ); + tmp = TAG(emit_verts)( ctx, start, 1, tmp ); + tmp = TAG(emit_verts)( ctx, j, nr - 1, tmp ); + currentsz = dmasz; + } + + FLUSH(); + } + else if (HAVE_TRI_FANS && !(ctx->_TriangleCaps & DD_FLATSHADE)) { + TAG(render_tri_fan_verts)( ctx, start, count, flags ); + } else { + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + +static void TAG(render_quad_strip_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + GLuint j, nr; + + if (HAVE_QUAD_STRIPS) { + LOCAL_VARS; + GLuint j, nr; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz; + + INIT(GL_QUAD_STRIP); + + currentsz = GET_CURRENT_VB_MAX_VERTS(); + if (currentsz < 8) { + currentsz = dmasz; + } + + dmasz -= (dmasz & 2); + currentsz -= (currentsz & 2); + + for (j = start ; j + 3 < count; j += nr - 2 ) { + nr = MIN2( currentsz, count - j ); + TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) ); + currentsz = dmasz; + } + + FLUSH(); + + } else if (HAVE_TRI_STRIPS && + (ctx->_TriangleCaps & DD_FLATSHADE) && + TNL_CONTEXT(ctx)->vb.ColorPtr[0]->stride) { + if (HAVE_ELTS) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + GLuint j, nr; + + EMIT_INDEXED_VERTS( ctx, start, count ); + + /* Simulate flat-shaded quadstrips using indexed vertices: + */ + ELT_INIT( GL_TRIANGLES ); + + currentsz = GET_CURRENT_VB_MAX_ELTS(); + + /* Emit whole number of quads in total, and in each buffer. + */ + dmasz -= dmasz & 1; + count -= (count-start) & 1; + currentsz -= currentsz & 1; + + if (currentsz < 12) + currentsz = dmasz; + + currentsz = currentsz/6*2; + dmasz = dmasz/6*2; + + for (j = start; j + 3 < count; j += nr - 2 ) { + nr = MIN2( currentsz, count - j ); + if (nr >= 4) { + GLint quads = (nr/2)-1; + GLint i; + ELTS_VARS( ALLOC_ELTS( quads*6 ) ); + + for ( i = j-start ; i < j-start+quads*2 ; i+=2 ) { + EMIT_TWO_ELTS( 0, (i+0), (i+1) ); + EMIT_TWO_ELTS( 2, (i+2), (i+1) ); + EMIT_TWO_ELTS( 4, (i+3), (i+2) ); + INCR_ELTS( 6 ); + } + + FLUSH(); + } + currentsz = dmasz; + } + + RELEASE_ELT_VERTS(); + FLUSH(); + } + else { + /* Vertices won't fit in a single buffer or elts not + * available - should never happen. + */ + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } + } + else if (HAVE_TRI_STRIPS) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); + int currentsz; + + /* Emit smooth-shaded quadstrips as tristrips: + */ + FLUSH(); + INIT( GL_TRIANGLE_STRIP ); + + /* Emit whole number of quads in total, and in each buffer. + */ + dmasz -= dmasz & 1; + currentsz = GET_CURRENT_VB_MAX_VERTS(); + currentsz -= currentsz & 1; + count -= (count-start) & 1; + + if (currentsz < 8) { + currentsz = dmasz; + } + + for (j = start; j + 3 < count; j += nr - 2 ) { + nr = MIN2( currentsz, count - j ); + TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) ); + currentsz = dmasz; + } + + FLUSH(); + + } else { + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + + +static void TAG(render_quads_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_QUADS) { + LOCAL_VARS; + int dmasz = (GET_SUBSEQUENT_VB_MAX_VERTS()/4) * 4; + int currentsz; + GLuint j, nr; + + INIT(GL_QUADS); + + /* Emit whole number of quads in total. dmasz is already a multiple + * of 4. + */ + count -= (count-start)%4; + + currentsz = (GET_CURRENT_VB_MAX_VERTS()/4) * 4; + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j < count; j += nr) { + nr = MIN2( currentsz, count - j ); + TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) ); + currentsz = dmasz; + } + } + else if (HAVE_ELTS) { + /* Hardware doesn't have a quad primitive type -- try to + * simulate it using indexed vertices and the triangle + * primitive: + */ + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + GLuint j, nr; + + EMIT_INDEXED_VERTS( ctx, start, count ); + + FLUSH(); + ELT_INIT( GL_TRIANGLES ); + currentsz = GET_CURRENT_VB_MAX_ELTS(); + + /* Emit whole number of quads in total, and in each buffer. + */ + dmasz -= dmasz & 3; + count -= (count-start) & 3; + currentsz -= currentsz & 3; + + /* Adjust for rendering as triangles: + */ + currentsz = currentsz/6*4; + dmasz = dmasz/6*4; + + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j < count; j += nr ) { + nr = MIN2( currentsz, count - j ); + if (nr >= 4) { + GLint quads = nr/4; + GLint i; + ELTS_VARS( ALLOC_ELTS( quads*6 ) ); + + for ( i = j-start ; i < j-start+quads*4 ; i+=4 ) { + EMIT_TWO_ELTS( 0, (i+0), (i+1) ); + EMIT_TWO_ELTS( 2, (i+3), (i+1) ); + EMIT_TWO_ELTS( 4, (i+2), (i+3) ); + INCR_ELTS( 6 ); + } + + FLUSH(); + } + currentsz = dmasz; + } + + RELEASE_ELT_VERTS(); + } + else if (HAVE_TRIANGLES) { + /* Hardware doesn't have a quad primitive type -- try to + * simulate it using triangle primitive. This is a win for + * gears, but is it useful in the broader world? + */ + LOCAL_VARS; + GLuint j; + + INIT(GL_TRIANGLES); + + for (j = start; j < count-3; j += 4) { + void *tmp = ALLOC_VERTS( 6 ); + /* Send v0, v1, v3 + */ + tmp = EMIT_VERTS(ctx, j, 2, tmp); + tmp = EMIT_VERTS(ctx, j + 3, 1, tmp); + /* Send v1, v2, v3 + */ + tmp = EMIT_VERTS(ctx, j + 1, 3, tmp); + } + } + else { + /* Vertices won't fit in a single buffer, should never happen. + */ + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + +static void TAG(render_noop)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ +} + + + + +static tnl_render_func TAG(render_tab_verts)[GL_POLYGON+2] = +{ + TAG(render_points_verts), + TAG(render_lines_verts), + TAG(render_line_loop_verts), + TAG(render_line_strip_verts), + TAG(render_triangles_verts), + TAG(render_tri_strip_verts), + TAG(render_tri_fan_verts), + TAG(render_quads_verts), + TAG(render_quad_strip_verts), + TAG(render_poly_verts), + TAG(render_noop), +}; + + +/**************************************************************************** + * Render elts using hardware indexed verts * + ****************************************************************************/ + +#if (HAVE_ELTS) +static void TAG(render_points_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_POINTS) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; + GLuint j, nr; + + ELT_INIT( GL_POINTS ); + + currentsz = GET_CURRENT_VB_MAX_ELTS(); + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j < count; j += nr ) { + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) ); + FLUSH(); + currentsz = dmasz; + } + } else { + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + + + +static void TAG(render_lines_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_LINES) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; + GLuint j, nr; + + ELT_INIT( GL_LINES ); + + /* Emit whole number of lines in total and in each buffer: + */ + count -= (count-start) & 1; + currentsz -= currentsz & 1; + dmasz -= dmasz & 1; + + currentsz = GET_CURRENT_VB_MAX_ELTS(); + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j < count; j += nr ) { + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) ); + FLUSH(); + currentsz = dmasz; + } + } else { + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + + +static void TAG(render_line_strip_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_LINE_STRIPS) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; + GLuint j, nr; + + FLUSH(); /* always a new primitive */ + ELT_INIT( GL_LINE_STRIP ); + + currentsz = GET_CURRENT_VB_MAX_ELTS(); + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j + 1 < count; j += nr - 1 ) { + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) ); + FLUSH(); + currentsz = dmasz; + } + } else { + /* TODO: Try to emit as indexed lines. + */ + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + + +static void TAG(render_line_loop_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_LINE_STRIPS) { + LOCAL_VARS; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; + GLuint j, nr; + + FLUSH(); + ELT_INIT( GL_LINE_STRIP ); + + if (flags & PRIM_BEGIN) + j = start; + else + j = start + 1; + + currentsz = GET_CURRENT_VB_MAX_ELTS(); + if (currentsz < 8) { + currentsz = dmasz; + } + + /* Ensure last vertex doesn't wrap: + */ + currentsz--; + dmasz--; + + if (j + 1 < count) { + for ( ; j + 1 < count; j += nr - 1 ) { + nr = MIN2( currentsz, count - j ); + + if (j + nr >= count && + start < count - 1 && + (flags & PRIM_END)) + { + void *tmp; + tmp = ALLOC_ELTS(nr+1); + tmp = TAG(emit_elts)( ctx, elts+j, nr, tmp ); + tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp ); + } + else { + TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) ); + currentsz = dmasz; + } + } + + } + else if (start + 1 < count && (flags & PRIM_END)) { + void *tmp; + tmp = ALLOC_ELTS(2); + tmp = TAG(emit_elts)( ctx, elts+start+1, 1, tmp ); + tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp ); + } + + FLUSH(); + } else { + /* TODO: Try to emit as indexed lines */ + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + + +/* For verts, we still eliminate the copy from main memory to dma + * buffers. For elts, this is probably no better (worse?) than the + * standard path. + */ +static void TAG(render_triangles_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS()/3*3; + int currentsz; + GLuint j, nr; + + FLUSH(); + ELT_INIT( GL_TRIANGLES ); + + currentsz = GET_CURRENT_VB_MAX_ELTS(); + + /* Emit whole number of tris in total. dmasz is already a multiple + * of 3. + */ + count -= (count-start)%3; + currentsz -= currentsz%3; + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j < count; j += nr) { + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) ); + FLUSH(); + currentsz = dmasz; + } +} + + + +static void TAG(render_tri_strip_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_TRI_STRIPS) { + LOCAL_VARS; + GLuint j, nr; + GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + + FLUSH(); + ELT_INIT( GL_TRIANGLE_STRIP ); + + currentsz = GET_CURRENT_VB_MAX_ELTS(); + if (currentsz < 8) { + currentsz = dmasz; + } + + /* Keep the same winding over multiple buffers: + */ + dmasz -= (dmasz & 1); + currentsz -= (currentsz & 1); + + for (j = start ; j + 2 < count; j += nr - 2 ) { + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) ); + FLUSH(); + currentsz = dmasz; + } + } else { + /* TODO: try to emit as indexed triangles */ + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + +static void TAG(render_tri_fan_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_TRI_FANS) { + LOCAL_VARS; + GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; + GLuint j, nr; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + + FLUSH(); + ELT_INIT( GL_TRIANGLE_FAN ); + + currentsz = GET_CURRENT_VB_MAX_ELTS(); + if (currentsz < 8) { + currentsz = dmasz; + } + + for (j = start + 1 ; j + 1 < count; j += nr - 2 ) { + void *tmp; + nr = MIN2( currentsz, count - j + 1 ); + tmp = ALLOC_ELTS( nr ); + tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp ); + tmp = TAG(emit_elts)( ctx, elts+j, nr - 1, tmp ); + FLUSH(); + currentsz = dmasz; + } + } else { + /* TODO: try to emit as indexed triangles */ + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + + +static void TAG(render_poly_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_POLYGONS) { + LOCAL_VARS; + GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; + GLuint j, nr; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + + FLUSH(); + ELT_INIT( GL_POLYGON ); + + currentsz = GET_CURRENT_VB_MAX_ELTS(); + if (currentsz < 8) { + currentsz = dmasz; + } + + for (j = start + 1 ; j + 1 < count; j += nr - 2 ) { + void *tmp; + nr = MIN2( currentsz, count - j + 1 ); + tmp = ALLOC_ELTS( nr ); + tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp ); + tmp = TAG(emit_elts)( ctx, elts+j, nr - 1, tmp ); + FLUSH(); + currentsz = dmasz; + } + } else if (HAVE_TRI_FANS && !(ctx->_TriangleCaps & DD_FLATSHADE)) { + TAG(render_tri_fan_verts)( ctx, start, count, flags ); + } else { + fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__); + return; + } +} + +static void TAG(render_quad_strip_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_QUAD_STRIPS && 0) { + } + else if (HAVE_TRI_STRIPS) { + LOCAL_VARS; + GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + GLuint j, nr; + + FLUSH(); + currentsz = GET_CURRENT_VB_MAX_ELTS(); + + /* Emit whole number of quads in total, and in each buffer. + */ + dmasz -= dmasz & 1; + count -= (count-start) & 1; + currentsz -= currentsz & 1; + + if (currentsz < 12) + currentsz = dmasz; + + if (ctx->_TriangleCaps & DD_FLATSHADE) { + ELT_INIT( GL_TRIANGLES ); + + currentsz = currentsz/6*2; + dmasz = dmasz/6*2; + + for (j = start; j + 3 < count; j += nr - 2 ) { + nr = MIN2( currentsz, count - j ); + + if (nr >= 4) + { + GLint i; + GLint quads = (nr/2)-1; + ELTS_VARS( ALLOC_ELTS( quads*6 ) ); + + for ( i = j-start ; i < j-start+quads ; i++, elts += 2 ) { + EMIT_TWO_ELTS( 0, elts[0], elts[1] ); + EMIT_TWO_ELTS( 2, elts[2], elts[1] ); + EMIT_TWO_ELTS( 4, elts[3], elts[2] ); + INCR_ELTS( 6 ); + } + + FLUSH(); + } + + currentsz = dmasz; + } + } + else { + ELT_INIT( GL_TRIANGLE_STRIP ); + + for (j = start; j + 3 < count; j += nr - 2 ) { + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) ); + FLUSH(); + currentsz = dmasz; + } + } + } +} + + +static void TAG(render_quads_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (HAVE_QUADS) { + LOCAL_VARS; + GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS()/4*4; + int currentsz; + GLuint j, nr; + + FLUSH(); + ELT_INIT( GL_TRIANGLES ); + + currentsz = GET_CURRENT_VB_MAX_ELTS()/4*4; + + count -= (count-start)%4; + + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j < count; j += nr) { + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) ); + FLUSH(); + currentsz = dmasz; + } + } else { + LOCAL_VARS; + GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + GLuint j, nr; + + ELT_INIT( GL_TRIANGLES ); + currentsz = GET_CURRENT_VB_MAX_ELTS(); + + /* Emit whole number of quads in total, and in each buffer. + */ + dmasz -= dmasz & 3; + count -= (count-start) & 3; + currentsz -= currentsz & 3; + + /* Adjust for rendering as triangles: + */ + currentsz = currentsz/6*4; + dmasz = dmasz/6*4; + + if (currentsz < 8) + currentsz = dmasz; + + for (j = start; j + 3 < count; j += nr - 2 ) { + nr = MIN2( currentsz, count - j ); + + if (nr >= 4) + { + GLint quads = nr/4; + GLint i; + ELTS_VARS( ALLOC_ELTS( quads * 6 ) ); + + for ( i = j-start ; i < j-start+quads ; i++, elts += 4 ) { + EMIT_TWO_ELTS( 0, elts[0], elts[1] ); + EMIT_TWO_ELTS( 2, elts[3], elts[1] ); + EMIT_TWO_ELTS( 4, elts[2], elts[3] ); + INCR_ELTS( 6 ); + } + + FLUSH(); + } + + currentsz = dmasz; + } + } +} + + + +static tnl_render_func TAG(render_tab_elts)[GL_POLYGON+2] = +{ + TAG(render_points_elts), + TAG(render_lines_elts), + TAG(render_line_loop_elts), + TAG(render_line_strip_elts), + TAG(render_triangles_elts), + TAG(render_tri_strip_elts), + TAG(render_tri_fan_elts), + TAG(render_quads_elts), + TAG(render_quad_strip_elts), + TAG(render_poly_elts), + TAG(render_noop), +}; + + + +#endif + + + +/* Pre-check the primitives in the VB to prevent the need for + * fallbacks later on. + */ +static GLboolean TAG(validate_render)( GLcontext *ctx, + struct vertex_buffer *VB ) +{ + GLint i; + + if (VB->ClipOrMask & ~CLIP_CULL_BIT) + return GL_FALSE; + + if (VB->Elts && !HAVE_ELTS) + return GL_FALSE; + + for (i = 0 ; i < VB->PrimitiveCount ; i++) { + GLuint prim = VB->Primitive[i].mode; + GLuint count = VB->Primitive[i].count; + GLboolean ok = GL_FALSE; + + if (!count) + continue; + + switch (prim & PRIM_MODE_MASK) { + case GL_POINTS: + ok = HAVE_POINTS; + break; + case GL_LINES: + ok = HAVE_LINES && !ctx->Line.StippleFlag; + break; + case GL_LINE_STRIP: + ok = HAVE_LINE_STRIPS && !ctx->Line.StippleFlag; + break; + case GL_LINE_LOOP: + ok = HAVE_LINE_STRIPS && !ctx->Line.StippleFlag; + break; + case GL_TRIANGLES: + ok = HAVE_TRIANGLES; + break; + case GL_TRIANGLE_STRIP: + ok = HAVE_TRI_STRIPS; + break; + case GL_TRIANGLE_FAN: + ok = HAVE_TRI_FANS; + break; + case GL_POLYGON: + if (HAVE_POLYGONS) { + ok = GL_TRUE; + } + else + ok = (HAVE_TRI_FANS && !(ctx->_TriangleCaps & DD_FLATSHADE)); + break; + case GL_QUAD_STRIP: + if (VB->Elts) { + ok = HAVE_TRI_STRIPS; + } + else if (HAVE_QUAD_STRIPS) { + ok = GL_TRUE; + } else if (HAVE_TRI_STRIPS && + (ctx->_TriangleCaps & DD_FLATSHADE) && + VB->ColorPtr[0]->stride != 0) { + if (HAVE_ELTS) { + ok = (GLint) count < GET_SUBSEQUENT_VB_MAX_ELTS(); + } + else { + ok = GL_FALSE; + } + } + else + ok = HAVE_TRI_STRIPS; + break; + case GL_QUADS: + if (HAVE_QUADS) { + ok = GL_TRUE; + } else if (HAVE_ELTS) { + ok = (GLint) count < GET_SUBSEQUENT_VB_MAX_ELTS(); + } + else { + ok = HAVE_TRIANGLES; /* flatshading is ok. */ + } + break; + default: + break; + } + + if (!ok) { +/* fprintf(stderr, "not ok %s\n", _mesa_lookup_enum_by_nr(prim & PRIM_MODE_MASK)); */ + return GL_FALSE; + } + } + + return GL_TRUE; +} + diff --git a/reactos/dll/mesa32/src/tnl_dd/t_dd_dmatmp2.h b/reactos/dll/mesa32/src/tnl_dd/t_dd_dmatmp2.h new file mode 100644 index 00000000000..b762221b1a8 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/t_dd_dmatmp2.h @@ -0,0 +1,914 @@ + +/* + * Mesa 3-D graphics library + * Version: 4.0.3 + * + * 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: + * Keith Whitwell + */ + + +/* Template for render stages which build and emit vertices directly + * to fixed-size dma buffers. Useful for rendering strips and other + * native primitives where clipping and per-vertex tweaks such as + * those in t_dd_tritmp.h are not required. + * + */ + +#if !HAVE_TRIANGLES || !HAVE_POINTS || !HAVE_LINES +#error "must have points, lines & triangles to use render template" +#endif + +#if !HAVE_TRI_STRIPS || !HAVE_TRI_FANS +#error "must have tri strip and fans to use render template" +#endif + +#if !HAVE_LINE_STRIPS +#error "must have line strips to use render template" +#endif + +#if !HAVE_POLYGONS +#error "must have polygons to use render template" +#endif + +#if !HAVE_ELTS +#error "must have elts to use render template" +#endif + + +#ifndef EMIT_TWO_ELTS +#define EMIT_TWO_ELTS( dest, offset, elt0, elt1 ) \ +do { \ + (dest)[offset] = (elt0); \ + (dest)[offset+1] = (elt1); \ +} while (0) +#endif + + +/**********************************************************************/ +/* Render whole begin/end objects */ +/**********************************************************************/ + + +static ELT_TYPE *TAG(emit_elts)( GLcontext *ctx, + ELT_TYPE *dest, + GLuint *elts, GLuint nr ) +{ + GLint i; + LOCAL_VARS; + + for ( i = 0 ; i+1 < nr ; i+=2, elts += 2 ) { + EMIT_TWO_ELTS( dest, 0, elts[0], elts[1] ); + dest += 2; + } + if (i < nr) { + EMIT_ELT( dest, 0, elts[0] ); + dest += 1; + } + + return dest; +} + +static ELT_TYPE *TAG(emit_consecutive_elts)( GLcontext *ctx, + ELT_TYPE *dest, + GLuint start, GLuint nr ) +{ + GLint i; + LOCAL_VARS; + + for ( i = 0 ; i+1 < nr ; i+=2, start += 2 ) { + EMIT_TWO_ELTS( dest, 0, start, start+1 ); + dest += 2; + } + if (i < nr) { + EMIT_ELT( dest, 0, start ); + dest += 1; + } + + return dest; +} + +/*********************************************************************** + * Render non-indexed primitives. + ***********************************************************************/ + + + +static void TAG(render_points_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (start < count) { + LOCAL_VARS; + if (0) fprintf(stderr, "%s\n", __FUNCTION__); + EMIT_PRIM( ctx, GL_POINTS, HW_POINTS, start, count ); + } +} + +static void TAG(render_lines_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + if (0) fprintf(stderr, "%s\n", __FUNCTION__); + count -= (count-start) & 1; + + if (start+1 >= count) + return; + + if ((flags & PRIM_BEGIN) && ctx->Line.StippleFlag) { + RESET_STIPPLE(); + AUTO_STIPPLE( GL_TRUE ); + } + + EMIT_PRIM( ctx, GL_LINES, HW_LINES, start, count ); + + if ((flags & PRIM_END) && ctx->Line.StippleFlag) + AUTO_STIPPLE( GL_FALSE ); +} + + +static void TAG(render_line_strip_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + if (0) fprintf(stderr, "%s\n", __FUNCTION__); + + if (start+1 >= count) + return; + + if ((flags & PRIM_BEGIN) && ctx->Line.StippleFlag) + RESET_STIPPLE(); + + + if (PREFER_DISCRETE_ELT_PRIM( count-start, HW_LINES )) + { + int dmasz = GET_MAX_HW_ELTS(); + GLuint j, nr; + + ELT_INIT( GL_LINES, HW_LINES ); + + /* Emit whole number of lines in each full buffer. + */ + dmasz = dmasz/2; + + + for (j = start; j + 1 < count; j += nr - 1 ) { + ELT_TYPE *dest; + GLint i; + + nr = MIN2( dmasz, count - j ); + dest = ALLOC_ELTS( (nr-1)*2 ); + + for ( i = j ; i+1 < j+nr ; i+=1 ) { + EMIT_TWO_ELTS( dest, 0, (i+0), (i+1) ); + dest += 2; + } + + CLOSE_ELTS(); + } + } + else + EMIT_PRIM( ctx, GL_LINE_STRIP, HW_LINE_STRIP, start, count ); +} + + +static void TAG(render_line_loop_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + GLuint j, nr; + if (0) fprintf(stderr, "%s\n", __FUNCTION__); + + if (flags & PRIM_BEGIN) { + j = start; + if (ctx->Line.StippleFlag) + RESET_STIPPLE( ); + } + else + j = start + 1; + + if (flags & PRIM_END) { + + if (start+1 >= count) + return; + + if (PREFER_DISCRETE_ELT_PRIM( count-start, HW_LINES )) { + int dmasz = GET_MAX_HW_ELTS(); + + ELT_INIT( GL_LINES, HW_LINES ); + + /* Emit whole number of lines in each full buffer. + */ + dmasz = dmasz/2; + + /* Ensure last vertex doesn't wrap: + */ + dmasz--; + + for (; j + 1 < count; ) { + GLint i; + ELT_TYPE *dest; + + nr = MIN2( dmasz, count - j ); + dest = ALLOC_ELTS( nr*2 ); /* allocs room for 1 more line */ + + for ( i = 0 ; i < nr - 1 ; i+=1 ) { + EMIT_TWO_ELTS( dest, 0, (j+i), (j+i+1) ); + dest += 2; + } + + j += nr - 1; + + /* Emit 1 more line into space alloced above */ + if (j + 1 >= count) { + EMIT_TWO_ELTS( dest, 0, (j), (start) ); + dest += 2; + } + + CLOSE_ELTS(); + } + } + else + { + int dmasz = GET_MAX_HW_ELTS() - 1; + + ELT_INIT( GL_LINE_STRIP, HW_LINE_STRIP ); + + for ( ; j + 1 < count; ) { + nr = MIN2( dmasz, count - j ); + if (j + nr < count) { + ELT_TYPE *dest = ALLOC_ELTS( nr ); + dest = TAG(emit_consecutive_elts)( ctx, dest, j, nr ); + j += nr - 1; + CLOSE_ELTS(); + } + else if (nr) { + ELT_TYPE *dest = ALLOC_ELTS( nr + 1 ); + dest = TAG(emit_consecutive_elts)( ctx, dest, j, nr ); + dest = TAG(emit_consecutive_elts)( ctx, dest, start, 1 ); + j += nr; + CLOSE_ELTS(); + } + } + } + } else { + TAG(render_line_strip_verts)( ctx, j, count, flags ); + } +} + + +static void TAG(render_triangles_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + if (0) fprintf(stderr, "%s\n", __FUNCTION__); + + count -= (count-start)%3; + + if (start+2 >= count) { + return; + } + + /* need a PREFER_DISCRETE_ELT_PRIM here too.. + */ + EMIT_PRIM( ctx, GL_TRIANGLES, HW_TRIANGLES, start, count ); +} + + + +static void TAG(render_tri_strip_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + if (0) fprintf(stderr, "%s\n", __FUNCTION__); + + if (start + 2 >= count) + return; + + if (PREFER_DISCRETE_ELT_PRIM( count-start, HW_TRIANGLES )) + { + int dmasz = GET_MAX_HW_ELTS(); + int parity = 0; + GLuint j, nr; + + ELT_INIT( GL_TRIANGLES, HW_TRIANGLES ); + + /* Emit even number of tris in each full buffer. + */ + dmasz = dmasz/3; + dmasz -= dmasz & 1; + + for (j = start; j + 2 < count; j += nr - 2 ) { + ELT_TYPE *dest; + GLint i; + + nr = MIN2( dmasz, count - j ); + dest = ALLOC_ELTS( (nr-2)*3 ); + + for ( i = j ; i+2 < j+nr ; i++, parity^=1 ) { + EMIT_ELT( dest, 0, (i+0+parity) ); + EMIT_ELT( dest, 1, (i+1-parity) ); + EMIT_ELT( dest, 2, (i+2) ); + dest += 3; + } + + CLOSE_ELTS(); + } + } + else + EMIT_PRIM( ctx, GL_TRIANGLE_STRIP, HW_TRIANGLE_STRIP_0, start, count ); +} + +static void TAG(render_tri_fan_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + if (0) fprintf(stderr, "%s\n", __FUNCTION__); + + if (start+2 >= count) + return; + + if (PREFER_DISCRETE_ELT_PRIM( count-start, HW_TRIANGLES )) + { + int dmasz = GET_MAX_HW_ELTS(); + GLuint j, nr; + + ELT_INIT( GL_TRIANGLES, HW_TRIANGLES ); + + dmasz = dmasz/3; + + for (j = start + 1; j + 1 < count; j += nr - 1 ) { + ELT_TYPE *dest; + GLint i; + + nr = MIN2( dmasz, count - j ); + dest = ALLOC_ELTS( (nr-1)*3 ); + + for ( i = j ; i+1 < j+nr ; i++ ) { + EMIT_ELT( dest, 0, (start) ); + EMIT_ELT( dest, 1, (i) ); + EMIT_ELT( dest, 2, (i+1) ); + dest += 3; + } + + CLOSE_ELTS(); + } + } + else { + EMIT_PRIM( ctx, GL_TRIANGLE_FAN, HW_TRIANGLE_FAN, start, count ); + } +} + + +static void TAG(render_poly_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + if (0) fprintf(stderr, "%s\n", __FUNCTION__); + + if (start+2 >= count) + return; + + EMIT_PRIM( ctx, GL_POLYGON, HW_POLYGON, start, count ); +} + +static void TAG(render_quad_strip_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + if (0) fprintf(stderr, "%s\n", __FUNCTION__); + + count -= (count-start) & 1; + + if (start+3 >= count) + return; + + if (HAVE_QUAD_STRIPS) { + EMIT_PRIM( ctx, GL_QUAD_STRIP, HW_QUAD_STRIP, start, count ); + } + else if (ctx->_TriangleCaps & DD_FLATSHADE) { + LOCAL_VARS; + int dmasz = GET_MAX_HW_ELTS(); + GLuint j, nr; + + ELT_INIT( GL_TRIANGLES, HW_TRIANGLES ); + + /* Emit whole number of quads in total, and in each buffer. + */ + dmasz = (dmasz/6)*2; + + for (j = start; j + 3 < count; j += nr - 2 ) { + ELT_TYPE *dest; + GLint quads, i; + + nr = MIN2( dmasz, count - j ); + quads = (nr/2)-1; + dest = ALLOC_ELTS( quads*6 ); + + for ( i = j ; i < j+quads*2 ; i+=2 ) { + EMIT_TWO_ELTS( dest, 0, (i+0), (i+1) ); + EMIT_TWO_ELTS( dest, 2, (i+2), (i+1) ); + EMIT_TWO_ELTS( dest, 4, (i+3), (i+2) ); + dest += 6; + } + + CLOSE_ELTS(); + } + } + else { + EMIT_PRIM( ctx, GL_TRIANGLE_STRIP, HW_TRIANGLE_STRIP_0, start, count ); + } +} + + +static void TAG(render_quads_verts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + if (0) fprintf(stderr, "%s\n", __FUNCTION__); + count -= (count-start)%4; + + if (start+3 >= count) + return; + + if (HAVE_QUADS) { + EMIT_PRIM( ctx, GL_QUADS, HW_QUADS, start, count ); + } + else { + /* Hardware doesn't have a quad primitive type -- simulate it + * using indexed vertices and the triangle primitive: + */ + LOCAL_VARS; + int dmasz = GET_MAX_HW_ELTS(); + GLuint j, nr; + + ELT_INIT( GL_TRIANGLES, HW_TRIANGLES ); + + /* Adjust for rendering as triangles: + */ + dmasz = (dmasz/6)*4; + + for (j = start; j < count; j += nr ) { + ELT_TYPE *dest; + GLint quads, i; + + nr = MIN2( dmasz, count - j ); + quads = nr/4; + dest = ALLOC_ELTS( quads*6 ); + + for ( i = j ; i < j+quads*4 ; i+=4 ) { + EMIT_TWO_ELTS( dest, 0, (i+0), (i+1) ); + EMIT_TWO_ELTS( dest, 2, (i+3), (i+1) ); + EMIT_TWO_ELTS( dest, 4, (i+2), (i+3) ); + dest += 6; + } + + CLOSE_ELTS(); + } + } +} + +static void TAG(render_noop)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ +} + + + + +static tnl_render_func TAG(render_tab_verts)[GL_POLYGON+2] = +{ + TAG(render_points_verts), + TAG(render_lines_verts), + TAG(render_line_loop_verts), + TAG(render_line_strip_verts), + TAG(render_triangles_verts), + TAG(render_tri_strip_verts), + TAG(render_tri_fan_verts), + TAG(render_quads_verts), + TAG(render_quad_strip_verts), + TAG(render_poly_verts), + TAG(render_noop), +}; + + +/**************************************************************************** + * Render elts using hardware indexed verts * + ****************************************************************************/ + +static void TAG(render_points_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + int dmasz = GET_MAX_HW_ELTS(); + GLuint *elts = GET_MESA_ELTS(); + GLuint j, nr; + ELT_TYPE *dest; + + ELT_INIT( GL_POINTS, HW_POINTS ); + + for (j = start; j < count; j += nr ) { + nr = MIN2( dmasz, count - j ); + dest = ALLOC_ELTS( nr ); + dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); + CLOSE_ELTS(); + } +} + + + +static void TAG(render_lines_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + int dmasz = GET_MAX_HW_ELTS(); + GLuint *elts = GET_MESA_ELTS(); + GLuint j, nr; + ELT_TYPE *dest; + + if (start+1 >= count) + return; + + if ((flags & PRIM_BEGIN) && ctx->Line.StippleFlag) { + RESET_STIPPLE(); + AUTO_STIPPLE( GL_TRUE ); + } + + ELT_INIT( GL_LINES, HW_LINES ); + + /* Emit whole number of lines in total and in each buffer: + */ + count -= (count-start) & 1; + dmasz -= dmasz & 1; + + for (j = start; j < count; j += nr ) { + nr = MIN2( dmasz, count - j ); + dest = ALLOC_ELTS( nr ); + dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); + CLOSE_ELTS(); + } + + if ((flags & PRIM_END) && ctx->Line.StippleFlag) + AUTO_STIPPLE( GL_FALSE ); +} + + +static void TAG(render_line_strip_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + int dmasz = GET_MAX_HW_ELTS(); + GLuint *elts = GET_MESA_ELTS(); + GLuint j, nr; + ELT_TYPE *dest; + + if (start+1 >= count) + return; + + ELT_INIT( GL_LINE_STRIP, HW_LINE_STRIP ); + + if ((flags & PRIM_BEGIN) && ctx->Line.StippleFlag) + RESET_STIPPLE(); + + for (j = start; j + 1 < count; j += nr - 1 ) { + nr = MIN2( dmasz, count - j ); + dest = ALLOC_ELTS( nr ); + dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); + CLOSE_ELTS(); + } +} + + +static void TAG(render_line_loop_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + int dmasz = GET_MAX_HW_ELTS(); + GLuint *elts = GET_MESA_ELTS(); + GLuint j, nr; + ELT_TYPE *dest; + + if (0) fprintf(stderr, "%s\n", __FUNCTION__); + + if (flags & PRIM_BEGIN) + j = start; + else + j = start + 1; + + + if (flags & PRIM_END) { + if (start+1 >= count) + return; + } + else { + if (j+1 >= count) + return; + } + + ELT_INIT( GL_LINE_STRIP, HW_LINE_STRIP ); + + if ((flags & PRIM_BEGIN) && ctx->Line.StippleFlag) + RESET_STIPPLE(); + + + /* Ensure last vertex doesn't wrap: + */ + dmasz--; + + for ( ; j + 1 < count; ) { + nr = MIN2( dmasz, count - j ); + dest = ALLOC_ELTS( nr+1 ); /* Reserve possible space for last elt */ + dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); + j += nr - 1; + if (j + 1 >= count && (flags & PRIM_END)) { + dest = TAG(emit_elts)( ctx, dest, elts+start, 1 ); + } + CLOSE_ELTS(); + } +} + + +static void TAG(render_triangles_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + GLuint *elts = GET_MESA_ELTS(); + int dmasz = GET_MAX_HW_ELTS()/3*3; + GLuint j, nr; + ELT_TYPE *dest; + + if (start+2 >= count) + return; + + ELT_INIT( GL_TRIANGLES, HW_TRIANGLES ); + + + /* Emit whole number of tris in total. dmasz is already a multiple + * of 3. + */ + count -= (count-start)%3; + + for (j = start; j < count; j += nr) { + nr = MIN2( dmasz, count - j ); + dest = ALLOC_ELTS( nr ); + dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); + CLOSE_ELTS(); + } +} + + + +static void TAG(render_tri_strip_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + GLuint j, nr; + GLuint *elts = GET_MESA_ELTS(); + int dmasz = GET_MAX_HW_ELTS(); + ELT_TYPE *dest; + + if (start+2 >= count) + return; + + ELT_INIT( GL_TRIANGLE_STRIP, HW_TRIANGLE_STRIP_0 ); + + /* Keep the same winding over multiple buffers: + */ + dmasz -= (dmasz & 1); + + for (j = start ; j + 2 < count; j += nr - 2 ) { + nr = MIN2( dmasz, count - j ); + + dest = ALLOC_ELTS( nr ); + dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); + CLOSE_ELTS(); + } +} + +static void TAG(render_tri_fan_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + GLuint *elts = GET_MESA_ELTS(); + GLuint j, nr; + int dmasz = GET_MAX_HW_ELTS(); + ELT_TYPE *dest; + + if (start+2 >= count) + return; + + ELT_INIT( GL_TRIANGLE_FAN, HW_TRIANGLE_FAN ); + + for (j = start + 1 ; j + 1 < count; j += nr - 1 ) { + nr = MIN2( dmasz, count - j + 1 ); + dest = ALLOC_ELTS( nr ); + dest = TAG(emit_elts)( ctx, dest, elts+start, 1 ); + dest = TAG(emit_elts)( ctx, dest, elts+j, nr - 1 ); + CLOSE_ELTS(); + } +} + + +static void TAG(render_poly_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + GLuint *elts = GET_MESA_ELTS(); + GLuint j, nr; + int dmasz = GET_MAX_HW_ELTS(); + ELT_TYPE *dest; + + if (start+2 >= count) + return; + + ELT_INIT( GL_POLYGON, HW_POLYGON ); + + for (j = start + 1 ; j + 1 < count ; j += nr - 1 ) { + nr = MIN2( dmasz, count - j + 1 ); + dest = ALLOC_ELTS( nr ); + dest = TAG(emit_elts)( ctx, dest, elts+start, 1 ); + dest = TAG(emit_elts)( ctx, dest, elts+j, nr - 1 ); + CLOSE_ELTS(); + } +} + +static void TAG(render_quad_strip_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (start+3 >= count) + return; + + if (HAVE_QUAD_STRIPS && 0) { + } + else { + LOCAL_VARS; + GLuint *elts = GET_MESA_ELTS(); + int dmasz = GET_MAX_HW_ELTS(); + GLuint j, nr; + ELT_TYPE *dest; + + /* Emit whole number of quads in total, and in each buffer. + */ + dmasz -= dmasz & 1; + count -= (count-start) & 1; + + if (ctx->_TriangleCaps & DD_FLATSHADE) { + ELT_INIT( GL_TRIANGLES, HW_TRIANGLES ); + + dmasz = dmasz/6*2; + + for (j = start; j + 3 < count; j += nr - 2 ) { + nr = MIN2( dmasz, count - j ); + + if (nr >= 4) + { + GLint quads = (nr/2)-1; + ELT_TYPE *dest = ALLOC_ELTS( quads*6 ); + GLint i; + + for ( i = j-start ; i < j-start+quads ; i++, elts += 2 ) { + EMIT_TWO_ELTS( dest, 0, elts[0], elts[1] ); + EMIT_TWO_ELTS( dest, 2, elts[2], elts[1] ); + EMIT_TWO_ELTS( dest, 4, elts[3], elts[2] ); + dest += 6; + } + + CLOSE_ELTS(); + } + } + } + else { + ELT_INIT( GL_TRIANGLE_STRIP, HW_TRIANGLE_STRIP_0 ); + + for (j = start; j + 3 < count; j += nr - 2 ) { + nr = MIN2( dmasz, count - j ); + dest = ALLOC_ELTS( nr ); + dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); + CLOSE_ELTS(); + } + } + } +} + + +static void TAG(render_quads_elts)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + if (start+3 >= count) + return; + + if (HAVE_QUADS && 0) { + } else { + LOCAL_VARS; + GLuint *elts = GET_MESA_ELTS(); + int dmasz = GET_MAX_HW_ELTS(); + GLuint j, nr; + + ELT_INIT( GL_TRIANGLES, HW_TRIANGLES ); + + /* Emit whole number of quads in total, and in each buffer. + */ + dmasz -= dmasz & 3; + count -= (count-start) & 3; + + /* Adjust for rendering as triangles: + */ + dmasz = dmasz/6*4; + + for (j = start; j + 3 < count; j += nr ) { + nr = MIN2( dmasz, count - j ); + + { + GLint quads = nr/4; + ELT_TYPE *dest = ALLOC_ELTS( quads * 6 ); + GLint i; + + for ( i = j-start ; i < j-start+quads ; i++, elts += 4 ) { + EMIT_TWO_ELTS( dest, 0, elts[0], elts[1] ); + EMIT_TWO_ELTS( dest, 2, elts[3], elts[1] ); + EMIT_TWO_ELTS( dest, 4, elts[2], elts[3] ); + dest += 6; + } + + CLOSE_ELTS(); + } + } + } +} + + + +static tnl_render_func TAG(render_tab_elts)[GL_POLYGON+2] = +{ + TAG(render_points_elts), + TAG(render_lines_elts), + TAG(render_line_loop_elts), + TAG(render_line_strip_elts), + TAG(render_triangles_elts), + TAG(render_tri_strip_elts), + TAG(render_tri_fan_elts), + TAG(render_quads_elts), + TAG(render_quad_strip_elts), + TAG(render_poly_elts), + TAG(render_noop), +}; diff --git a/reactos/dll/mesa32/src/tnl_dd/t_dd_rendertmp.h b/reactos/dll/mesa32/src/tnl_dd/t_dd_rendertmp.h new file mode 100644 index 00000000000..b9f030195d5 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/t_dd_rendertmp.h @@ -0,0 +1,434 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + + +#ifndef POSTFIX +#define POSTFIX +#endif + +#ifndef INIT +#define INIT(x) +#endif + +#ifndef NEED_EDGEFLAG_SETUP +#define NEED_EDGEFLAG_SETUP 0 +#define EDGEFLAG_GET(a) 0 +#define EDGEFLAG_SET(a,b) (void)b +#endif + +#ifndef RESET_STIPPLE +#define RESET_STIPPLE +#endif + +#ifndef RESET_OCCLUSION +#define RESET_OCCLUSION +#endif + +#ifndef TEST_PRIM_END +#define TEST_PRIM_END(flags) (flags & PRIM_END) +#define TEST_PRIM_BEGIN(flags) (flags & PRIM_BEGIN) +#define TEST_PRIM_PARITY(flags) (flags & PRIM_PARITY) +#endif + +#ifndef ELT +#define ELT(x) x +#endif + +#ifndef RENDER_TAB_QUALIFIER +#define RENDER_TAB_QUALIFIER static +#endif + +static void TAG(render_points)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + (void) flags; + + RESET_OCCLUSION; + INIT(GL_POINTS); + RENDER_POINTS( start, count ); + POSTFIX; +} + +static void TAG(render_lines)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + GLuint j; + LOCAL_VARS; + (void) flags; + + RESET_OCCLUSION; + INIT(GL_LINES); + for (j=start+1; j + */ + + +/* Template for building functions to plug into the driver interface + * of t_vb_render.c: + * ctx->Driver.QuadFunc + * ctx->Driver.TriangleFunc + * ctx->Driver.LineFunc + * ctx->Driver.PointsFunc + * + * DO_TWOSIDE: Plug back-color values from the VB into backfacing triangles, + * and restore vertices afterwards. + * DO_OFFSET: Calculate offset for triangles and adjust vertices. Restore + * vertices after rendering. + * DO_FLAT: For hardware without native flatshading, copy provoking colors + * into the other vertices. Restore after rendering. + * DO_UNFILLED: Decompose triangles to lines and points where appropriate. + * DO_TWOSTENCIL:Gross hack for two-sided stencil. + * + * HAVE_RGBA: Vertices have rgba values (otherwise index values). + * HAVE_SPEC: Vertices have secondary rgba values. + * + * VERT_X(v): Alias for vertex x value. + * VERT_Y(v): Alias for vertex y value. + * VERT_Z(v): Alias for vertex z value. + * DEPTH_SCALE: Scale for constant offset. + * REVERSE_DEPTH: Viewport depth range reversed. + * + * VERTEX: Hardware vertex type. + * GET_VERTEX(n): Retreive vertex with index n. + * AREA_IS_CCW(a): Return true if triangle with signed area a is ccw. + * + * VERT_SET_RGBA: Assign vertex rgba from VB color. + * VERT_COPY_RGBA: Copy vertex rgba another vertex. + * VERT_SAVE_RGBA: Save vertex rgba to a local variable. + * VERT_RESTORE_RGBA: Restore vertex rgba from a local variable. + * --> Similar for IND and SPEC. + * + * LOCAL_VARS(n): (At least) define local vars for save/restore rgba. + * + */ + +#if HAVE_RGBA +#define VERT_SET_IND( v, c ) (void) c +#define VERT_COPY_IND( v0, v1 ) +#define VERT_SAVE_IND( idx ) +#define VERT_RESTORE_IND( idx ) +#if HAVE_BACK_COLORS +#define VERT_SET_RGBA( v, c ) +#endif +#else +#define VERT_SET_RGBA( v, c ) (void) c +#define VERT_COPY_RGBA( v0, v1 ) +#define VERT_SAVE_RGBA( idx ) +#define VERT_RESTORE_RGBA( idx ) +#if HAVE_BACK_COLORS +#define VERT_SET_IND( v, c ) +#endif +#endif + +#if !HAVE_SPEC +#define VERT_SET_SPEC( v, c ) (void) c +#define VERT_COPY_SPEC( v0, v1 ) +#define VERT_SAVE_SPEC( idx ) +#define VERT_RESTORE_SPEC( idx ) +#if HAVE_BACK_COLORS +#define VERT_COPY_SPEC1( v ) +#endif +#else +#if HAVE_BACK_COLORS +#define VERT_SET_SPEC( v, c ) +#endif +#endif + +#if !HAVE_BACK_COLORS +#define VERT_COPY_SPEC1( v ) +#define VERT_COPY_IND1( v ) +#define VERT_COPY_RGBA1( v ) +#endif + +#ifndef INSANE_VERTICES +#define VERT_SET_Z(v,val) VERT_Z(v) = val +#define VERT_Z_ADD(v,val) VERT_Z(v) += val +#endif + +#ifndef REVERSE_DEPTH +#define REVERSE_DEPTH 0 +#endif + +/* disable twostencil for un-aware drivers */ +#ifndef HAVE_STENCIL_TWOSIDE +#define HAVE_STENCIL_TWOSIDE 0 +#endif +#ifndef DO_TWOSTENCIL +#define DO_TWOSTENCIL 0 +#endif +#ifndef SETUP_STENCIL +#define SETUP_STENCIL(f) +#endif +#ifndef UNSET_STENCIL +#define UNSET_STENCIL(f) +#endif + +#if DO_TRI +static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb; + VERTEX *v[3]; + GLfloat offset = 0; + GLfloat z[3]; + GLenum mode = GL_FILL; + GLuint facing = 0; + LOCAL_VARS(3); + +/* fprintf(stderr, "%s\n", __FUNCTION__); */ + + v[0] = (VERTEX *)GET_VERTEX(e0); + v[1] = (VERTEX *)GET_VERTEX(e1); + v[2] = (VERTEX *)GET_VERTEX(e2); + + if (DO_TWOSIDE || DO_OFFSET || DO_UNFILLED || DO_TWOSTENCIL) + { + GLfloat ex = VERT_X(v[0]) - VERT_X(v[2]); + GLfloat ey = VERT_Y(v[0]) - VERT_Y(v[2]); + GLfloat fx = VERT_X(v[1]) - VERT_X(v[2]); + GLfloat fy = VERT_Y(v[1]) - VERT_Y(v[2]); + GLfloat cc = ex*fy - ey*fx; + + if (DO_TWOSIDE || DO_UNFILLED || DO_TWOSTENCIL) + { + facing = AREA_IS_CCW( cc ) ^ ctx->Polygon._FrontBit; + + if (DO_TWOSTENCIL && ctx->Stencil.TestTwoSide) { + ctx->_Facing = facing; /* mixed mode rendering: for 2-sided stencil test */ + } + + if (DO_UNFILLED) { + if (facing) { + mode = ctx->Polygon.BackMode; + if (ctx->Polygon.CullFlag && + ctx->Polygon.CullFaceMode != GL_FRONT) { + return; + } + } else { + mode = ctx->Polygon.FrontMode; + if (ctx->Polygon.CullFlag && + ctx->Polygon.CullFaceMode != GL_BACK) { + return; + } + } + } + + if (DO_TWOSIDE && facing == 1) + { + if (HAVE_RGBA) { + if (HAVE_BACK_COLORS) { + if (!DO_FLAT) { + VERT_SAVE_RGBA( 0 ); + VERT_SAVE_RGBA( 1 ); + VERT_COPY_RGBA1( v[0] ); + VERT_COPY_RGBA1( v[1] ); + } + VERT_SAVE_RGBA( 2 ); + VERT_COPY_RGBA1( v[2] ); + if (HAVE_SPEC) { + if (!DO_FLAT) { + VERT_SAVE_SPEC( 0 ); + VERT_SAVE_SPEC( 1 ); + VERT_COPY_SPEC1( v[0] ); + VERT_COPY_SPEC1( v[1] ); + } + VERT_SAVE_SPEC( 2 ); + VERT_COPY_SPEC1( v[2] ); + } + } + else { + GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->data; + (void) vbcolor; + + if (!DO_FLAT) { + VERT_SAVE_RGBA( 0 ); + VERT_SAVE_RGBA( 1 ); + } + VERT_SAVE_RGBA( 2 ); + + if (VB->ColorPtr[1]->stride) { + ASSERT(VB->ColorPtr[1]->stride == 4*sizeof(GLfloat)); + + if (!DO_FLAT) { + VERT_SET_RGBA( v[0], vbcolor[e0] ); + VERT_SET_RGBA( v[1], vbcolor[e1] ); + } + VERT_SET_RGBA( v[2], vbcolor[e2] ); + } + else { + if (!DO_FLAT) { + VERT_SET_RGBA( v[0], vbcolor[0] ); + VERT_SET_RGBA( v[1], vbcolor[0] ); + } + VERT_SET_RGBA( v[2], vbcolor[0] ); + } + + if (HAVE_SPEC && VB->SecondaryColorPtr[1]) { + GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->data; + ASSERT(VB->SecondaryColorPtr[1]->stride == 4*sizeof(GLfloat)); + + if (!DO_FLAT) { + VERT_SAVE_SPEC( 0 ); + VERT_SAVE_SPEC( 1 ); + VERT_SET_SPEC( v[0], vbspec[e0] ); + VERT_SET_SPEC( v[1], vbspec[e1] ); + } + VERT_SAVE_SPEC( 2 ); + VERT_SET_SPEC( v[2], vbspec[e2] ); + } + } + } + else { + GLfloat (*vbindex) = (GLfloat *)VB->IndexPtr[1]->data; + if (!DO_FLAT) { + VERT_SAVE_IND( 0 ); + VERT_SAVE_IND( 1 ); + VERT_SET_IND( v[0], vbindex[e0] ); + VERT_SET_IND( v[1], vbindex[e1] ); + } + VERT_SAVE_IND( 2 ); + VERT_SET_IND( v[2], vbindex[e2] ); + } + } + } + + + if (DO_OFFSET) + { + offset = ctx->Polygon.OffsetUnits * DEPTH_SCALE; + z[0] = VERT_Z(v[0]); + z[1] = VERT_Z(v[1]); + z[2] = VERT_Z(v[2]); + if (cc * cc > 1e-16) { + GLfloat ic = 1.0 / cc; + GLfloat ez = z[0] - z[2]; + GLfloat fz = z[1] - z[2]; + GLfloat a = ey*fz - ez*fy; + GLfloat b = ez*fx - ex*fz; + GLfloat ac = a * ic; + GLfloat bc = b * ic; + if ( ac < 0.0f ) ac = -ac; + if ( bc < 0.0f ) bc = -bc; + offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor; + } + offset *= ctx->DrawBuffer->_MRD * (REVERSE_DEPTH ? -1.0 : 1.0); + } + } + + if (DO_FLAT) { + if (HAVE_RGBA) { + VERT_SAVE_RGBA( 0 ); + VERT_SAVE_RGBA( 1 ); + VERT_COPY_RGBA( v[0], v[2] ); + VERT_COPY_RGBA( v[1], v[2] ); + if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + VERT_SAVE_SPEC( 0 ); + VERT_SAVE_SPEC( 1 ); + VERT_COPY_SPEC( v[0], v[2] ); + VERT_COPY_SPEC( v[1], v[2] ); + } + } + else { + VERT_SAVE_IND( 0 ); + VERT_SAVE_IND( 1 ); + VERT_COPY_IND( v[0], v[2] ); + VERT_COPY_IND( v[1], v[2] ); + } + } + + if (mode == GL_POINT) { + if (DO_OFFSET && ctx->Polygon.OffsetPoint) { + VERT_Z_ADD(v[0], offset); + VERT_Z_ADD(v[1], offset); + VERT_Z_ADD(v[2], offset); + } + if (DO_TWOSTENCIL && !HAVE_STENCIL_TWOSIDE && ctx->Stencil.TestTwoSide) { + SETUP_STENCIL(facing); + UNFILLED_TRI( ctx, GL_POINT, e0, e1, e2 ); + UNSET_STENCIL(facing); + } else { + UNFILLED_TRI( ctx, GL_POINT, e0, e1, e2 ); + } + } else if (mode == GL_LINE) { + if (DO_OFFSET && ctx->Polygon.OffsetLine) { + VERT_Z_ADD(v[0], offset); + VERT_Z_ADD(v[1], offset); + VERT_Z_ADD(v[2], offset); + } + if (DO_TWOSTENCIL && !HAVE_STENCIL_TWOSIDE && ctx->Stencil.TestTwoSide) { + SETUP_STENCIL(facing); + UNFILLED_TRI( ctx, GL_LINE, e0, e1, e2 ); + UNSET_STENCIL(facing); + } else { + UNFILLED_TRI( ctx, GL_LINE, e0, e1, e2 ); + } + } else { + if (DO_OFFSET && ctx->Polygon.OffsetFill) { + VERT_Z_ADD(v[0], offset); + VERT_Z_ADD(v[1], offset); + VERT_Z_ADD(v[2], offset); + } + if (DO_UNFILLED) + RASTERIZE( GL_TRIANGLES ); + if (DO_TWOSTENCIL && !HAVE_STENCIL_TWOSIDE && ctx->Stencil.TestTwoSide) { + SETUP_STENCIL(facing); + TRI( v[0], v[1], v[2] ); + UNSET_STENCIL(facing); + } else { + TRI( v[0], v[1], v[2] ); + } + } + + if (DO_OFFSET) + { + VERT_SET_Z(v[0], z[0]); + VERT_SET_Z(v[1], z[1]); + VERT_SET_Z(v[2], z[2]); + } + + if (DO_TWOSIDE && facing == 1) + { + if (HAVE_RGBA) { + if (!DO_FLAT) { + VERT_RESTORE_RGBA( 0 ); + VERT_RESTORE_RGBA( 1 ); + } + VERT_RESTORE_RGBA( 2 ); + if (HAVE_SPEC) { + if (!DO_FLAT) { + VERT_RESTORE_SPEC( 0 ); + VERT_RESTORE_SPEC( 1 ); + } + VERT_RESTORE_SPEC( 2 ); + } + } + else { + if (!DO_FLAT) { + VERT_RESTORE_IND( 0 ); + VERT_RESTORE_IND( 1 ); + } + VERT_RESTORE_IND( 2 ); + } + } + + + if (DO_FLAT) { + if (HAVE_RGBA) { + VERT_RESTORE_RGBA( 0 ); + VERT_RESTORE_RGBA( 1 ); + if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + VERT_RESTORE_SPEC( 0 ); + VERT_RESTORE_SPEC( 1 ); + } + } + else { + VERT_RESTORE_IND( 0 ); + VERT_RESTORE_IND( 1 ); + } + } +} +#endif + +#if DO_QUAD +#if DO_FULL_QUAD +static void TAG(quad)( GLcontext *ctx, + GLuint e0, GLuint e1, GLuint e2, GLuint e3 ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb; + VERTEX *v[4]; + GLfloat offset = 0; + GLfloat z[4]; + GLenum mode = GL_FILL; + GLuint facing = 0; + LOCAL_VARS(4); + + v[0] = (VERTEX *)GET_VERTEX(e0); + v[1] = (VERTEX *)GET_VERTEX(e1); + v[2] = (VERTEX *)GET_VERTEX(e2); + v[3] = (VERTEX *)GET_VERTEX(e3); + + if (DO_TWOSIDE || DO_OFFSET || DO_UNFILLED || DO_TWOSTENCIL) + { + GLfloat ex = VERT_X(v[2]) - VERT_X(v[0]); + GLfloat ey = VERT_Y(v[2]) - VERT_Y(v[0]); + GLfloat fx = VERT_X(v[3]) - VERT_X(v[1]); + GLfloat fy = VERT_Y(v[3]) - VERT_Y(v[1]); + GLfloat cc = ex*fy - ey*fx; + + if (DO_TWOSIDE || DO_UNFILLED || DO_TWOSTENCIL) + { + facing = AREA_IS_CCW( cc ) ^ ctx->Polygon._FrontBit; + + if (DO_TWOSTENCIL && ctx->Stencil.TestTwoSide) { + ctx->_Facing = facing; /* mixed mode rendering: for 2-sided stencil test */ + } + + if (DO_UNFILLED) { + if (facing) { + mode = ctx->Polygon.BackMode; + if (ctx->Polygon.CullFlag && + ctx->Polygon.CullFaceMode != GL_FRONT) { + return; + } + } else { + mode = ctx->Polygon.FrontMode; + if (ctx->Polygon.CullFlag && + ctx->Polygon.CullFaceMode != GL_BACK) { + return; + } + } + } + + if (DO_TWOSIDE && facing == 1) + { + if (HAVE_RGBA) { + GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->data; + (void)vbcolor; + + if (HAVE_BACK_COLORS) { + if (!DO_FLAT) { + VERT_SAVE_RGBA( 0 ); + VERT_SAVE_RGBA( 1 ); + VERT_SAVE_RGBA( 2 ); + VERT_COPY_RGBA1( v[0] ); + VERT_COPY_RGBA1( v[1] ); + VERT_COPY_RGBA1( v[2] ); + } + VERT_SAVE_RGBA( 3 ); + VERT_COPY_RGBA1( v[3] ); + if (HAVE_SPEC) { + if (!DO_FLAT) { + VERT_SAVE_SPEC( 0 ); + VERT_SAVE_SPEC( 1 ); + VERT_SAVE_SPEC( 2 ); + VERT_COPY_SPEC1( v[0] ); + VERT_COPY_SPEC1( v[1] ); + VERT_COPY_SPEC1( v[2] ); + } + VERT_SAVE_SPEC( 3 ); + VERT_COPY_SPEC1( v[3] ); + } + } + else { + if (!DO_FLAT) { + VERT_SAVE_RGBA( 0 ); + VERT_SAVE_RGBA( 1 ); + VERT_SAVE_RGBA( 2 ); + } + VERT_SAVE_RGBA( 3 ); + + if (VB->ColorPtr[1]->stride) { + if (!DO_FLAT) { + VERT_SET_RGBA( v[0], vbcolor[e0] ); + VERT_SET_RGBA( v[1], vbcolor[e1] ); + VERT_SET_RGBA( v[2], vbcolor[e2] ); + } + VERT_SET_RGBA( v[3], vbcolor[e3] ); + } + else { + if (!DO_FLAT) { + VERT_SET_RGBA( v[0], vbcolor[0] ); + VERT_SET_RGBA( v[1], vbcolor[0] ); + VERT_SET_RGBA( v[2], vbcolor[0] ); + } + VERT_SET_RGBA( v[3], vbcolor[0] ); + } + + if (HAVE_SPEC && VB->SecondaryColorPtr[1]) { + GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->data; + ASSERT(VB->SecondaryColorPtr[1]->stride==4*sizeof(GLfloat)); + + if (!DO_FLAT) { + VERT_SAVE_SPEC( 0 ); + VERT_SAVE_SPEC( 1 ); + VERT_SAVE_SPEC( 2 ); + VERT_SET_SPEC( v[0], vbspec[e0] ); + VERT_SET_SPEC( v[1], vbspec[e1] ); + VERT_SET_SPEC( v[2], vbspec[e2] ); + } + VERT_SAVE_SPEC( 3 ); + VERT_SET_SPEC( v[3], vbspec[e3] ); + } + } + } + else { + GLfloat *vbindex = (GLfloat *)VB->IndexPtr[1]->data; + if (!DO_FLAT) { + VERT_SAVE_IND( 0 ); + VERT_SAVE_IND( 1 ); + VERT_SAVE_IND( 2 ); + VERT_SET_IND( v[0], vbindex[e0] ); + VERT_SET_IND( v[1], vbindex[e1] ); + VERT_SET_IND( v[2], vbindex[e2] ); + } + VERT_SAVE_IND( 3 ); + VERT_SET_IND( v[3], vbindex[e3] ); + } + } + } + + + if (DO_OFFSET) + { + offset = ctx->Polygon.OffsetUnits * DEPTH_SCALE; + z[0] = VERT_Z(v[0]); + z[1] = VERT_Z(v[1]); + z[2] = VERT_Z(v[2]); + z[3] = VERT_Z(v[3]); + if (cc * cc > 1e-16) { + GLfloat ez = z[2] - z[0]; + GLfloat fz = z[3] - z[1]; + GLfloat a = ey*fz - ez*fy; + GLfloat b = ez*fx - ex*fz; + GLfloat ic = 1.0 / cc; + GLfloat ac = a * ic; + GLfloat bc = b * ic; + if ( ac < 0.0f ) ac = -ac; + if ( bc < 0.0f ) bc = -bc; + offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor; + } + offset *= ctx->DrawBuffer->_MRD * (REVERSE_DEPTH ? -1.0 : 1.0); + } + } + + if (DO_FLAT) { + if (HAVE_RGBA) { + VERT_SAVE_RGBA( 0 ); + VERT_SAVE_RGBA( 1 ); + VERT_SAVE_RGBA( 2 ); + VERT_COPY_RGBA( v[0], v[3] ); + VERT_COPY_RGBA( v[1], v[3] ); + VERT_COPY_RGBA( v[2], v[3] ); + if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + VERT_SAVE_SPEC( 0 ); + VERT_SAVE_SPEC( 1 ); + VERT_SAVE_SPEC( 2 ); + VERT_COPY_SPEC( v[0], v[3] ); + VERT_COPY_SPEC( v[1], v[3] ); + VERT_COPY_SPEC( v[2], v[3] ); + } + } + else { + VERT_SAVE_IND( 0 ); + VERT_SAVE_IND( 1 ); + VERT_SAVE_IND( 2 ); + VERT_COPY_IND( v[0], v[3] ); + VERT_COPY_IND( v[1], v[3] ); + VERT_COPY_IND( v[2], v[3] ); + } + } + + if (mode == GL_POINT) { + if (( DO_OFFSET) && ctx->Polygon.OffsetPoint) { + VERT_Z_ADD(v[0], offset); + VERT_Z_ADD(v[1], offset); + VERT_Z_ADD(v[2], offset); + VERT_Z_ADD(v[3], offset); + } + if (DO_TWOSTENCIL && !HAVE_STENCIL_TWOSIDE && ctx->Stencil.TestTwoSide) { + SETUP_STENCIL(facing); + UNFILLED_QUAD( ctx, GL_POINT, e0, e1, e2, e3 ); + UNSET_STENCIL(facing); + } else { + UNFILLED_QUAD( ctx, GL_POINT, e0, e1, e2, e3 ); + } + } else if (mode == GL_LINE) { + if (DO_OFFSET && ctx->Polygon.OffsetLine) { + VERT_Z_ADD(v[0], offset); + VERT_Z_ADD(v[1], offset); + VERT_Z_ADD(v[2], offset); + VERT_Z_ADD(v[3], offset); + } + if (DO_TWOSTENCIL && !HAVE_STENCIL_TWOSIDE && ctx->Stencil.TestTwoSide) { + SETUP_STENCIL(facing); + UNFILLED_QUAD( ctx, GL_LINE, e0, e1, e2, e3 ); + UNSET_STENCIL(facing); + } else { + UNFILLED_QUAD( ctx, GL_LINE, e0, e1, e2, e3 ); + } + } else { + if (DO_OFFSET && ctx->Polygon.OffsetFill) { + VERT_Z_ADD(v[0], offset); + VERT_Z_ADD(v[1], offset); + VERT_Z_ADD(v[2], offset); + VERT_Z_ADD(v[3], offset); + } + RASTERIZE( GL_QUADS ); + if (DO_TWOSTENCIL && !HAVE_STENCIL_TWOSIDE && ctx->Stencil.TestTwoSide) { + SETUP_STENCIL(facing); + QUAD( (v[0]), (v[1]), (v[2]), (v[3]) ); + UNSET_STENCIL(facing); + } else { + QUAD( (v[0]), (v[1]), (v[2]), (v[3]) ); + } + } + + if (DO_OFFSET) + { + VERT_SET_Z(v[0], z[0]); + VERT_SET_Z(v[1], z[1]); + VERT_SET_Z(v[2], z[2]); + VERT_SET_Z(v[3], z[3]); + } + + if (DO_TWOSIDE && facing == 1) + { + if (HAVE_RGBA) { + if (!DO_FLAT) { + VERT_RESTORE_RGBA( 0 ); + VERT_RESTORE_RGBA( 1 ); + VERT_RESTORE_RGBA( 2 ); + } + VERT_RESTORE_RGBA( 3 ); + if (HAVE_SPEC) { + if (!DO_FLAT) { + VERT_RESTORE_SPEC( 0 ); + VERT_RESTORE_SPEC( 1 ); + VERT_RESTORE_SPEC( 2 ); + } + VERT_RESTORE_SPEC( 3 ); + } + } + else { + if (!DO_FLAT) { + VERT_RESTORE_IND( 0 ); + VERT_RESTORE_IND( 1 ); + VERT_RESTORE_IND( 2 ); + } + VERT_RESTORE_IND( 3 ); + } + } + + + if (DO_FLAT) { + if (HAVE_RGBA) { + VERT_RESTORE_RGBA( 0 ); + VERT_RESTORE_RGBA( 1 ); + VERT_RESTORE_RGBA( 2 ); + if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + VERT_RESTORE_SPEC( 0 ); + VERT_RESTORE_SPEC( 1 ); + VERT_RESTORE_SPEC( 2 ); + } + } + else { + VERT_RESTORE_IND( 0 ); + VERT_RESTORE_IND( 1 ); + VERT_RESTORE_IND( 2 ); + } + } +} +#else +static void TAG(quad)( GLcontext *ctx, GLuint e0, + GLuint e1, GLuint e2, GLuint e3 ) +{ + if (DO_UNFILLED) { + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte ef1 = VB->EdgeFlag[e1]; + GLubyte ef3 = VB->EdgeFlag[e3]; + VB->EdgeFlag[e1] = 0; + TAG(triangle)( ctx, e0, e1, e3 ); + VB->EdgeFlag[e1] = ef1; + VB->EdgeFlag[e3] = 0; + TAG(triangle)( ctx, e1, e2, e3 ); + VB->EdgeFlag[e3] = ef3; + } else { + TAG(triangle)( ctx, e0, e1, e3 ); + TAG(triangle)( ctx, e1, e2, e3 ); + } +} +#endif +#endif + +#if DO_LINE +static void TAG(line)( GLcontext *ctx, GLuint e0, GLuint e1 ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + VERTEX *v[2]; + LOCAL_VARS(2); + + v[0] = (VERTEX *)GET_VERTEX(e0); + v[1] = (VERTEX *)GET_VERTEX(e1); + + if (DO_FLAT) { + if (HAVE_RGBA) { + VERT_SAVE_RGBA( 0 ); + VERT_COPY_RGBA( v[0], v[1] ); + if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + VERT_SAVE_SPEC( 0 ); + VERT_COPY_SPEC( v[0], v[1] ); + } + } + else { + VERT_SAVE_IND( 0 ); + VERT_COPY_IND( v[0], v[1] ); + } + } + + LINE( v[0], v[1] ); + + if (DO_FLAT) { + if (HAVE_RGBA) { + VERT_RESTORE_RGBA( 0 ); + + if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + VERT_RESTORE_SPEC( 0 ); + } + } + else { + VERT_RESTORE_IND( 0 ); + } + } +} +#endif + +#if DO_POINTS +static void TAG(points)( GLcontext *ctx, GLuint first, GLuint last ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb; + GLuint i; + LOCAL_VARS(1); + + if (VB->Elts == 0) { + for ( i = first ; i < last ; i++ ) { + if ( VB->ClipMask[i] == 0 ) { + VERTEX *v = (VERTEX *)GET_VERTEX(i); + POINT( v ); + } + } + } else { + for ( i = first ; i < last ; i++ ) { + GLuint e = VB->Elts[i]; + if ( VB->ClipMask[e] == 0 ) { + VERTEX *v = (VERTEX *)GET_VERTEX(e); + POINT( v ); + } + } + } +} +#endif + +static void TAG(init)( void ) +{ +#if DO_QUAD + TAB[IND].quad = TAG(quad); +#endif +#if DO_TRI + TAB[IND].triangle = TAG(triangle); +#endif +#if DO_LINE + TAB[IND].line = TAG(line); +#endif +#if DO_POINTS + TAB[IND].points = TAG(points); +#endif +} + +#undef IND +#undef TAG + +#if HAVE_RGBA +#undef VERT_SET_IND +#undef VERT_COPY_IND +#undef VERT_SAVE_IND +#undef VERT_RESTORE_IND +#if HAVE_BACK_COLORS +#undef VERT_SET_RGBA +#endif +#else +#undef VERT_SET_RGBA +#undef VERT_COPY_RGBA +#undef VERT_SAVE_RGBA +#undef VERT_RESTORE_RGBA +#if HAVE_BACK_COLORS +#undef VERT_SET_IND +#endif +#endif + +#if !HAVE_SPEC +#undef VERT_SET_SPEC +#undef VERT_COPY_SPEC +#undef VERT_SAVE_SPEC +#undef VERT_RESTORE_SPEC +#if HAVE_BACK_COLORS +#undef VERT_COPY_SPEC1 +#endif +#else +#if HAVE_BACK_COLORS +#undef VERT_SET_SPEC +#endif +#endif + +#if !HAVE_BACK_COLORS +#undef VERT_COPY_SPEC1 +#undef VERT_COPY_IND1 +#undef VERT_COPY_RGBA1 +#endif + +#ifndef INSANE_VERTICES +#undef VERT_SET_Z +#undef VERT_Z_ADD +#endif diff --git a/reactos/dll/mesa32/src/tnl_dd/t_dd_unfilled.h b/reactos/dll/mesa32/src/tnl_dd/t_dd_unfilled.h new file mode 100644 index 00000000000..46415ea5f68 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/t_dd_unfilled.h @@ -0,0 +1,212 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +#if HAVE_RGBA +#define VERT_SET_IND( v, c ) +#define VERT_COPY_IND( v0, v1 ) +#define VERT_SAVE_IND( idx ) +#define VERT_RESTORE_IND( idx ) +#endif + +#if !HAVE_SPEC +#define VERT_SET_SPEC( v, c ) +#define VERT_COPY_SPEC( v0, v1 ) +#define VERT_SAVE_SPEC( idx ) +#define VERT_RESTORE_SPEC( idx ) +#endif + +static void TAG(unfilled_tri)( GLcontext *ctx, + GLenum mode, + GLuint e0, GLuint e1, GLuint e2 ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte *ef = VB->EdgeFlag; + VERTEX *v[3]; + LOCAL_VARS(3); + + v[0] = (VERTEX *)GET_VERTEX(e0); + v[1] = (VERTEX *)GET_VERTEX(e1); + v[2] = (VERTEX *)GET_VERTEX(e2); + + if ((ctx->_TriangleCaps & DD_FLATSHADE) && HAVE_HW_FLATSHADE) { + if (HAVE_RGBA) { + VERT_SAVE_RGBA(0); + VERT_SAVE_RGBA(1); + VERT_COPY_RGBA(v[0], v[2]); + VERT_COPY_RGBA(v[1], v[2]); + + if (HAVE_SPEC) { + VERT_SAVE_SPEC(0); + VERT_SAVE_SPEC(1); + VERT_COPY_SPEC(v[0], v[2]); + VERT_COPY_SPEC(v[1], v[2]); + } + } else { + VERT_SAVE_IND(0); + VERT_SAVE_IND(1); + VERT_COPY_IND(v[0], v[2]); + VERT_COPY_IND(v[1], v[2]); + } + } + +/* fprintf(stderr, "%s %s %d %d %d\n", __FUNCTION__, */ +/* _mesa_lookup_enum_by_nr( mode ), */ +/* ef[e0], ef[e1], ef[e2]); */ + + if (mode == GL_POINT) { + RASTERIZE(GL_POINTS); + if (ef[e0]) POINT( v[0] ); + if (ef[e1]) POINT( v[1] ); + if (ef[e2]) POINT( v[2] ); + } + else { + RASTERIZE(GL_LINES); + if (RENDER_PRIMITIVE == GL_POLYGON) { + if (ef[e2]) LINE( v[2], v[0] ); + if (ef[e0]) LINE( v[0], v[1] ); + if (ef[e1]) LINE( v[1], v[2] ); + } + else { + if (ef[e0]) LINE( v[0], v[1] ); + if (ef[e1]) LINE( v[1], v[2] ); + if (ef[e2]) LINE( v[2], v[0] ); + } + } + + if ((ctx->_TriangleCaps & DD_FLATSHADE) && HAVE_HW_FLATSHADE) { + if (HAVE_RGBA) { + VERT_RESTORE_RGBA(0); + VERT_RESTORE_RGBA(1); + + if (HAVE_SPEC) { + VERT_RESTORE_SPEC(0); + VERT_RESTORE_SPEC(1); + } + } else { + VERT_RESTORE_IND(0); + VERT_RESTORE_IND(1); + } + } +} + + +static void TAG(unfilled_quad)( GLcontext *ctx, + GLenum mode, + GLuint e0, GLuint e1, + GLuint e2, GLuint e3 ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte *ef = VB->EdgeFlag; + VERTEX *v[4]; + LOCAL_VARS(4); + + v[0] = (VERTEX *)GET_VERTEX(e0); + v[1] = (VERTEX *)GET_VERTEX(e1); + v[2] = (VERTEX *)GET_VERTEX(e2); + v[3] = (VERTEX *)GET_VERTEX(e3); + + /* Hardware flatshading breaks down here. If the hardware doesn't + * support flatshading, this will already have been done: + */ + if ((ctx->_TriangleCaps & DD_FLATSHADE) && HAVE_HW_FLATSHADE) { + if (HAVE_RGBA) { + VERT_SAVE_RGBA(0); + VERT_SAVE_RGBA(1); + VERT_SAVE_RGBA(2); + VERT_COPY_RGBA(v[0], v[3]); + VERT_COPY_RGBA(v[1], v[3]); + VERT_COPY_RGBA(v[2], v[3]); + + if (HAVE_SPEC) { + VERT_SAVE_SPEC(0); + VERT_SAVE_SPEC(1); + VERT_SAVE_SPEC(2); + VERT_COPY_SPEC(v[0], v[3]); + VERT_COPY_SPEC(v[1], v[3]); + VERT_COPY_SPEC(v[2], v[3]); + } + } else { + VERT_SAVE_IND(0); + VERT_SAVE_IND(1); + VERT_SAVE_IND(2); + VERT_COPY_IND(v[0], v[3]); + VERT_COPY_IND(v[1], v[3]); + VERT_COPY_IND(v[2], v[3]); + } + } + + if (mode == GL_POINT) { + RASTERIZE(GL_POINTS); + if (ef[e0]) POINT( v[0] ); + if (ef[e1]) POINT( v[1] ); + if (ef[e2]) POINT( v[2] ); + if (ef[e3]) POINT( v[3] ); + } + else { + RASTERIZE(GL_LINES); + if (ef[e0]) LINE( v[0], v[1] ); + if (ef[e1]) LINE( v[1], v[2] ); + if (ef[e2]) LINE( v[2], v[3] ); + if (ef[e3]) LINE( v[3], v[0] ); + } + + if ((ctx->_TriangleCaps & DD_FLATSHADE) && HAVE_HW_FLATSHADE) { + if (HAVE_RGBA) { + VERT_RESTORE_RGBA(0); + VERT_RESTORE_RGBA(1); + VERT_RESTORE_RGBA(2); + + if (HAVE_SPEC) { + VERT_RESTORE_SPEC(0); + VERT_RESTORE_SPEC(1); + VERT_RESTORE_SPEC(2); + } + } else { + VERT_RESTORE_IND(0); + VERT_RESTORE_IND(1); + VERT_RESTORE_IND(2); + } + } +} + + +#if HAVE_RGBA +#undef VERT_SET_IND +#undef VERT_COPY_IND +#undef VERT_SAVE_IND +#undef VERT_RESTORE_IND +#endif + +#if !HAVE_SPEC +#undef VERT_SET_SPEC +#undef VERT_COPY_SPEC +#undef VERT_SAVE_SPEC +#undef VERT_RESTORE_SPEC +#endif + +#undef TAG diff --git a/reactos/dll/mesa32/src/tnl_dd/t_dd_vb.c b/reactos/dll/mesa32/src/tnl_dd/t_dd_vb.c new file mode 100644 index 00000000000..edd78f7acfc --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/t_dd_vb.c @@ -0,0 +1,344 @@ + +/* + * 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. + * + * Authors: + * Keith Whitwell + */ +#include "math/m_translate.h" + +#if (HAVE_HW_VIEWPORT) +#define UNVIEWPORT_VARS +#define UNVIEWPORT_X(x) x +#define UNVIEWPORT_Y(x) x +#define UNVIEWPORT_Z(x) x +#endif + +#ifndef LOCALVARS +#define LOCALVARS +#endif + +#ifndef CHECK_HW_DIVIDE +#define CHECK_HW_DIVIDE 1 +#endif + +/* These don't need to be duplicated, but there's currently nowhere + * really convenient to put them. Need to build some actual .o files in + * this directory? + */ +static void copy_pv_rgba4_spec5( GLcontext *ctx, GLuint edst, GLuint esrc ) +{ + LOCALVARS + GLubyte *verts = GET_VERTEX_STORE(); + GLuint size = GET_VERTEX_SIZE(); + GLuint *dst = (GLuint *)(verts + (edst * size)); + GLuint *src = (GLuint *)(verts + (esrc * size)); + dst[4] = src[4]; + dst[5] = src[5]; +} + +static void copy_pv_rgba4( GLcontext *ctx, GLuint edst, GLuint esrc ) +{ + LOCALVARS + GLubyte *verts = GET_VERTEX_STORE(); + GLuint size = GET_VERTEX_SIZE(); + GLuint *dst = (GLuint *)(verts + (edst * size)); + GLuint *src = (GLuint *)(verts + (esrc * size)); + dst[4] = src[4]; +} + +static void copy_pv_rgba3( GLcontext *ctx, GLuint edst, GLuint esrc ) +{ + LOCALVARS + GLubyte *verts = GET_VERTEX_STORE(); + GLuint size = GET_VERTEX_SIZE(); + GLuint *dst = (GLuint *)(verts + (edst * size)); + GLuint *src = (GLuint *)(verts + (esrc * size)); + dst[3] = src[3]; +} + + +void TAG(translate_vertex)(GLcontext *ctx, + const VERTEX *src, + SWvertex *dst) +{ + LOCALVARS + GLuint format = GET_VERTEX_FORMAT(); + GLfloat *s = ctx->Viewport._WindowMap.m; + UNVIEWPORT_VARS; + + if (format == TINY_VERTEX_FORMAT) { + if (HAVE_HW_VIEWPORT) { + dst->win[0] = s[0] * src->v.x + s[12]; + dst->win[1] = s[5] * src->v.y + s[13]; + dst->win[2] = s[10] * src->v.z + s[14]; + dst->win[3] = 1.0; + } else { + dst->win[0] = UNVIEWPORT_X( src->v.x ); + dst->win[1] = UNVIEWPORT_Y( src->v.y ); + dst->win[2] = UNVIEWPORT_Z( src->v.z ); + dst->win[3] = 1.0; + } + + dst->color[0] = src->tv.color.red; + dst->color[1] = src->tv.color.green; + dst->color[2] = src->tv.color.blue; + dst->color[3] = src->tv.color.alpha; + } + else { + if (HAVE_HW_VIEWPORT) { + if (HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) { + GLfloat oow = 1.0 / src->v.w; + dst->win[0] = s[0] * src->v.x * oow + s[12]; + dst->win[1] = s[5] * src->v.y * oow + s[13]; + dst->win[2] = s[10] * src->v.z * oow + s[14]; + dst->win[3] = oow; + } else { + dst->win[0] = s[0] * src->v.x + s[12]; + dst->win[1] = s[5] * src->v.y + s[13]; + dst->win[2] = s[10] * src->v.z + s[14]; + dst->win[3] = src->v.w; + } + } else { + dst->win[0] = UNVIEWPORT_X( src->v.x ); + dst->win[1] = UNVIEWPORT_Y( src->v.y ); + dst->win[2] = UNVIEWPORT_Z( src->v.z ); + dst->win[3] = src->v.w; + } + + dst->color[0] = src->v.color.red; + dst->color[1] = src->v.color.green; + dst->color[2] = src->v.color.blue; + dst->color[3] = src->v.color.alpha; + + dst->specular[0] = src->v.specular.red; + dst->specular[1] = src->v.specular.green; + dst->specular[2] = src->v.specular.blue; + + dst->fog = src->v.specular.alpha/255.0; + + if (HAVE_PTEX_VERTICES && + ((HAVE_TEX2_VERTICES && format == PROJ_TEX3_VERTEX_FORMAT) || + (format == PROJ_TEX1_VERTEX_FORMAT))) { + + dst->texcoord[0][0] = src->pv.u0; + dst->texcoord[0][1] = src->pv.v0; + dst->texcoord[0][3] = src->pv.q0; + + dst->texcoord[1][0] = src->pv.u1; + dst->texcoord[1][1] = src->pv.v1; + dst->texcoord[1][3] = src->pv.q1; + + if (HAVE_TEX2_VERTICES) { + dst->texcoord[2][0] = src->pv.u2; + dst->texcoord[2][1] = src->pv.v2; + dst->texcoord[2][3] = src->pv.q2; + } + + if (HAVE_TEX3_VERTICES) { + dst->texcoord[3][0] = src->pv.u3; + dst->texcoord[3][1] = src->pv.v3; + dst->texcoord[3][3] = src->pv.q3; + } + } + else { + dst->texcoord[0][0] = src->v.u0; + dst->texcoord[0][1] = src->v.v0; + dst->texcoord[0][3] = 1.0; + + dst->texcoord[1][0] = src->v.u1; + dst->texcoord[1][1] = src->v.v1; + dst->texcoord[1][3] = 1.0; + + if (HAVE_TEX2_VERTICES) { + dst->texcoord[2][0] = src->v.u2; + dst->texcoord[2][1] = src->v.v2; + dst->texcoord[2][3] = 1.0; + } + + if (HAVE_TEX3_VERTICES) { + dst->texcoord[3][0] = src->v.u3; + dst->texcoord[3][1] = src->v.v3; + dst->texcoord[3][3] = 1.0; + } + } + } + + dst->pointSize = ctx->Point._Size; +} + + + +void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v ) +{ + LOCALVARS + GLuint format = GET_VERTEX_FORMAT(); + + fprintf(stderr, "(%x) ", format); + + switch (format) { +#if HAVE_TINY_VERTICES + case TINY_VERTEX_FORMAT: + fprintf(stderr, "xyz %.4f,%.4f,%.4f rgba %x:%x:%x:%x\n", + v->v.x, v->v.y, v->v.z, + v->tv.color.red, + v->tv.color.green, + v->tv.color.blue, + v->tv.color.alpha); + break; +#endif +#if HAVE_NOTEX_VERTICES + case NOTEX_VERTEX_FORMAT: + fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x spec %x:%x:%x:%x\n", + v->v.x, v->v.y, v->v.z, v->v.w, + v->v.color.red, + v->v.color.green, + v->v.color.blue, + v->v.color.alpha, + v->v.specular.red, + v->v.specular.green, + v->v.specular.blue, + v->v.specular.alpha); + break; +#endif +#if HAVE_TEX0_VERTICES + case TEX0_VERTEX_FORMAT: + fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x st %.4f,%.4f\n", + v->v.x, v->v.y, v->v.z, v->v.w, + v->v.color.red, + v->v.color.green, + v->v.color.blue, + v->v.color.alpha, + v->v.u0, + v->v.v0); + break; +#endif +#if HAVE_TEX1_VERTICES + case TEX1_VERTEX_FORMAT: + fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x st %.4f,%.4f st %.4f,%.4f\n", + v->v.x, v->v.y, v->v.z, v->v.w, + v->v.color.red, + v->v.color.green, + v->v.color.blue, + v->v.color.alpha, + v->v.u0, + v->v.v0, + v->v.u1, + v->v.u2); + break; +#endif +#if HAVE_PTEX_VERTICES + case PROJ_TEX1_VERTEX_FORMAT: + fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x stq %.4f,%.4f,%.4f stq %.4f,%.4f,%.4f\n", + v->v.x, v->v.y, v->v.z, v->v.w, + v->v.color.red, + v->v.color.green, + v->v.color.blue, + v->v.color.alpha, + v->pv.u0, + v->pv.v0, + v->pv.q0, + v->pv.u1, + v->pv.v1, + v->pv.q1); + break; +#endif + default: + fprintf(stderr, "???\n"); + break; + } + + fprintf(stderr, "\n"); +} + + + +/* Interpolate the elements of the VB not included in typical hardware + * vertices. + * + * NOTE: All these arrays are guarenteed by tnl to be writeable and + * have good stride. + */ +#ifndef INTERP_QUALIFIER +#define INTERP_QUALIFIER static +#endif + +#define GET_COLOR(ptr, idx) ((ptr)->data[idx]) + + +INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx, + GLfloat t, + GLuint dst, GLuint out, GLuint in, + GLboolean force_boundary ) +{ + LOCALVARS + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + + if (VB->ColorPtr[1]) { + assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat)); + + INTERP_4F( t, + GET_COLOR(VB->ColorPtr[1], dst), + GET_COLOR(VB->ColorPtr[1], out), + GET_COLOR(VB->ColorPtr[1], in) ); + + if (VB->SecondaryColorPtr[1]) { + INTERP_3F( t, + GET_COLOR(VB->SecondaryColorPtr[1], dst), + GET_COLOR(VB->SecondaryColorPtr[1], out), + GET_COLOR(VB->SecondaryColorPtr[1], in) ); + } + } + + if (VB->EdgeFlag) { + VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary; + } + + INTERP_VERTEX(ctx, t, dst, out, in, force_boundary); +} + +INTERP_QUALIFIER void TAG(copy_pv_extras)( GLcontext *ctx, + GLuint dst, GLuint src ) +{ + LOCALVARS + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + + if (VB->ColorPtr[1]) { + COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst), + GET_COLOR(VB->ColorPtr[1], src) ); + + if (VB->SecondaryColorPtr[1]) { + COPY_4FV( GET_COLOR(VB->SecondaryColorPtr[1], dst), + GET_COLOR(VB->SecondaryColorPtr[1], src) ); + } + } + + COPY_PV_VERTEX(ctx, dst, src); +} + + +#undef INTERP_QUALIFIER +#undef GET_COLOR + +#undef IND +#undef TAG diff --git a/reactos/dll/mesa32/src/tnl_dd/t_dd_vbtmp.h b/reactos/dll/mesa32/src/tnl_dd/t_dd_vbtmp.h new file mode 100644 index 00000000000..92dd8931c33 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/t_dd_vbtmp.h @@ -0,0 +1,675 @@ + +/* + * Mesa 3-D graphics library + * Version: 5.0.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: + * Keith Whitwell + */ + + +/* Unlike the other templates here, this assumes quite a bit about the + * underlying hardware. Specifically it assumes a d3d-like vertex + * format, with a layout more or less constrained to look like the + * following: + * + * union { + * struct { + * float x, y, z, w; + * struct { char r, g, b, a; } color; + * struct { char r, g, b, fog; } spec; + * float u0, v0; + * float u1, v1; + * float u2, v2; + * float u3, v3; + * } v; + * struct { + * float x, y, z, w; + * struct { char r, g, b, a; } color; + * struct { char r, g, b, fog; } spec; + * float u0, v0, q0; + * float u1, v1, q1; + * float u2, v2, q2; + * float u3, v3, q3; + * } pv; + * struct { + * float x, y, z; + * struct { char r, g, b, a; } color; + * } tv; + * float f[16]; + * unsigned int ui[16]; + * unsigned char ub4[4][16]; + * } + * + + * VERTEX: hw vertex type as above + * VERTEX_COLOR: hw color struct type in VERTEX + * + * DO_XYZW: Emit xyz and maybe w coordinates. + * DO_RGBA: Emit color. + * DO_SPEC: Emit specular color. + * DO_FOG: Emit fog coordinate in specular alpha. + * DO_TEX0: Emit tex0 u,v coordinates. + * DO_TEX1: Emit tex1 u,v coordinates. + * DO_TEX2: Emit tex2 u,v coordinates. + * DO_TEX3: Emit tex3 u,v coordinates. + * DO_PTEX: Emit tex0,1,2,3 q coordinates where possible. + * + * HAVE_RGBA_COLOR: Hardware takes color in rgba order (else bgra). + * + * HAVE_HW_VIEWPORT: Hardware performs viewport transform. + * HAVE_HW_DIVIDE: Hardware performs perspective divide. + * + * HAVE_TINY_VERTICES: Hardware understands v.tv format. + * HAVE_PTEX_VERTICES: Hardware understands v.pv format. + * HAVE_NOTEX_VERTICES: Hardware understands v.v format with texcount 0. + * + * Additionally, this template assumes it is emitting *transformed* + * vertices; the modifications to emit untransformed vertices (ie. to + * t&l hardware) are probably too great to cooexist with the code + * already in this file. + * + * NOTE: The PTEX vertex format always includes TEX0 and TEX1, even if + * only TEX0 is enabled, in order to maintain a vertex size which is + * an exact number of quadwords. + */ + +#if (HAVE_HW_VIEWPORT) +#define VIEWPORT_X(dst,x) dst = x +#define VIEWPORT_Y(dst,y) dst = y +#define VIEWPORT_Z(dst,z) dst = z +#else +#define VIEWPORT_X(dst,x) dst = s[0] * x + s[12] +#define VIEWPORT_Y(dst,y) dst = s[5] * y + s[13] +#define VIEWPORT_Z(dst,z) dst = s[10] * z + s[14] +#endif + +#if (HAVE_HW_DIVIDE && !HAVE_PTEX_VERTICES) +#error "can't cope with this combination" +#endif + +#ifndef LOCALVARS +#define LOCALVARS +#endif + +#ifndef CHECK_HW_DIVIDE +#define CHECK_HW_DIVIDE 1 +#endif + +#if (HAVE_HW_DIVIDE || DO_SPEC || DO_TEX0 || DO_FOG || !HAVE_TINY_VERTICES) + +static void TAG(emit)( GLcontext *ctx, + GLuint start, GLuint end, + void *dest, + GLuint stride ) +{ + LOCALVARS + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLfloat (*tc0)[4], (*tc1)[4], (*fog)[4]; + GLfloat (*tc2)[4], (*tc3)[4]; + GLfloat (*col)[4], (*spec)[4]; + GLuint tc0_stride, tc1_stride, col_stride, spec_stride, fog_stride; + GLuint tc2_stride, tc3_stride; + GLuint tc0_size, tc1_size, col_size; + GLuint tc2_size, tc3_size; + GLfloat (*coord)[4]; + GLuint coord_stride; + VERTEX *v = (VERTEX *)dest; + const GLfloat *s = GET_VIEWPORT_MAT(); + const GLubyte *mask = VB->ClipMask; + int i; + +/* fprintf(stderr, "%s(big) importable %d %d..%d\n", */ +/* __FUNCTION__, VB->importable_data, start, end); */ + + if (HAVE_HW_VIEWPORT && HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) { + (void) s; + coord = VB->ClipPtr->data; + coord_stride = VB->ClipPtr->stride; + } + else { + coord = VB->NdcPtr->data; + coord_stride = VB->NdcPtr->stride; + } + + if (DO_TEX3) { + const GLuint t3 = GET_TEXSOURCE(3); + tc3 = VB->TexCoordPtr[t3]->data; + tc3_stride = VB->TexCoordPtr[t3]->stride; + if (DO_PTEX) + tc3_size = VB->TexCoordPtr[t3]->size; + } + + if (DO_TEX2) { + const GLuint t2 = GET_TEXSOURCE(2); + tc2 = VB->TexCoordPtr[t2]->data; + tc2_stride = VB->TexCoordPtr[t2]->stride; + if (DO_PTEX) + tc2_size = VB->TexCoordPtr[t2]->size; + } + + if (DO_TEX1) { + const GLuint t1 = GET_TEXSOURCE(1); + tc1 = VB->TexCoordPtr[t1]->data; + tc1_stride = VB->TexCoordPtr[t1]->stride; + if (DO_PTEX) + tc1_size = VB->TexCoordPtr[t1]->size; + } + + if (DO_TEX0) { + const GLuint t0 = GET_TEXSOURCE(0); + tc0_stride = VB->TexCoordPtr[t0]->stride; + tc0 = VB->TexCoordPtr[t0]->data; + if (DO_PTEX) + tc0_size = VB->TexCoordPtr[t0]->size; + } + + if (DO_RGBA) { + col_stride = VB->ColorPtr[0]->stride; + col = VB->ColorPtr[0]->data; + col_size = VB->ColorPtr[0]->size; + } + + if (DO_SPEC) { + if (VB->SecondaryColorPtr[0]) { + spec_stride = VB->SecondaryColorPtr[0]->stride; + spec = VB->SecondaryColorPtr[0]->data; + } else { + spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; + spec_stride = 0; + } + } + + if (DO_FOG) { + if (VB->FogCoordPtr) { + fog = VB->FogCoordPtr->data; + fog_stride = VB->FogCoordPtr->stride; + } + else { + static GLfloat tmp[4] = {0, 0, 0, 0}; + fog = &tmp; + fog_stride = 0; + } + } + + /* May have nonstandard strides: + */ + if (start) { + STRIDE_4F(coord, start * coord_stride); + if (DO_TEX0) + STRIDE_4F(tc0, start * tc0_stride); + if (DO_TEX1) + STRIDE_4F(tc1, start * tc1_stride); + if (DO_TEX2) + STRIDE_4F(tc2, start * tc2_stride); + if (DO_TEX3) + STRIDE_4F(tc3, start * tc3_stride); + if (DO_RGBA) + STRIDE_4F(col, start * col_stride); + if (DO_SPEC) + STRIDE_4F(spec, start * spec_stride); + if (DO_FOG) + STRIDE_4F(fog, start * fog_stride); + } + + for (i=start; i < end; i++, v = (VERTEX *)((GLubyte *)v + stride)) { + if (DO_XYZW) { + if (HAVE_HW_VIEWPORT || mask[i] == 0) { + VIEWPORT_X(v->v.x, coord[0][0]); + VIEWPORT_Y(v->v.y, coord[0][1]); + VIEWPORT_Z(v->v.z, coord[0][2]); + v->v.w = coord[0][3]; + } + STRIDE_4F(coord, coord_stride); + } + if (DO_RGBA) { + UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.red, col[0][0]); + UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.green, col[0][1]); + UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.blue, col[0][2]); + if (col_size == 4) { + UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.alpha, col[0][3]); + } else { + v->v.color.alpha = CHAN_MAX; + } + STRIDE_4F(col, col_stride); + } + if (DO_SPEC) { + UNCLAMPED_FLOAT_TO_UBYTE(v->v.specular.red, spec[0][0]); + UNCLAMPED_FLOAT_TO_UBYTE(v->v.specular.green, spec[0][1]); + UNCLAMPED_FLOAT_TO_UBYTE(v->v.specular.blue, spec[0][2]); + STRIDE_4F(spec, spec_stride); + } + if (DO_FOG) { + UNCLAMPED_FLOAT_TO_UBYTE(v->v.specular.alpha, fog[0][0]); + STRIDE_4F(fog, fog_stride); + } + if (DO_TEX0) { + v->v.u0 = tc0[0][0]; + v->v.v0 = tc0[0][1]; + if (DO_PTEX) { + if (HAVE_PTEX_VERTICES) { + if (tc0_size == 4) + v->pv.q0 = tc0[0][3]; + else + v->pv.q0 = 1.0; + } + else if (tc0_size == 4) { + float rhw = 1.0 / tc0[0][3]; + v->v.w *= tc0[0][3]; + v->v.u0 *= rhw; + v->v.v0 *= rhw; + } + } + STRIDE_4F(tc0, tc0_stride); + } + if (DO_TEX1) { + if (DO_PTEX) { + v->pv.u1 = tc1[0][0]; + v->pv.v1 = tc1[0][1]; + if (tc1_size == 4) + v->pv.q1 = tc1[0][3]; + else + v->pv.q1 = 1.0; + } + else { + v->v.u1 = tc1[0][0]; + v->v.v1 = tc1[0][1]; + } + STRIDE_4F(tc1, tc1_stride); + } + else if (DO_PTEX) { + *(GLuint *)&v->pv.q1 = 0; /* avoid culling on radeon */ + } + if (DO_TEX2) { + if (DO_PTEX) { + v->pv.u2 = tc2[0][0]; + v->pv.v2 = tc2[0][1]; + if (tc2_size == 4) + v->pv.q2 = tc2[0][3]; + else + v->pv.q2 = 1.0; + } + else { + v->v.u2 = tc2[0][0]; + v->v.v2 = tc2[0][1]; + } + STRIDE_4F(tc2, tc2_stride); + } + if (DO_TEX3) { + if (DO_PTEX) { + v->pv.u3 = tc3[0][0]; + v->pv.v3 = tc3[0][1]; + if (tc3_size == 4) + v->pv.q3 = tc3[0][3]; + else + v->pv.q3 = 1.0; + } + else { + v->v.u3 = tc3[0][0]; + v->v.v3 = tc3[0][1]; + } + STRIDE_4F(tc3, tc3_stride); + } + } + +} +#else + +#if HAVE_HW_DIVIDE +#error "cannot use tiny vertices with hw perspective divide" +#endif + +static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, + void *dest, GLuint stride ) +{ + LOCALVARS + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLfloat (*col)[4]; + GLuint col_stride, col_size; + GLfloat (*coord)[4] = VB->NdcPtr->data; + GLuint coord_stride = VB->NdcPtr->stride; + GLfloat *v = (GLfloat *)dest; + const GLubyte *mask = VB->ClipMask; + const GLfloat *s = GET_VIEWPORT_MAT(); + int i; + + (void) s; + + ASSERT(stride == 4); + + col = VB->ColorPtr[0]->data; + col_stride = VB->ColorPtr[0]->stride; + col_size = VB->ColorPtr[0]->size; + +/* fprintf(stderr, "%s(small) importable %x\n", */ +/* __FUNCTION__, VB->importable_data); */ + + /* Pack what's left into a 4-dword vertex. Color is in a different + * place, and there is no 'w' coordinate. + */ + if (start) { + STRIDE_4F(coord, start * coord_stride); + STRIDE_4F(col, start * col_stride); + } + + for (i=start; i < end; i++, v+=4) { + if (DO_XYZW) { + if (HAVE_HW_VIEWPORT || mask[i] == 0) { + VIEWPORT_X(v[0], coord[0][0]); + VIEWPORT_Y(v[1], coord[0][1]); + VIEWPORT_Z(v[2], coord[0][2]); + } + STRIDE_4F( coord, coord_stride ); + } + if (DO_RGBA) { + VERTEX_COLOR *c = (VERTEX_COLOR *)&v[3]; + UNCLAMPED_FLOAT_TO_UBYTE(c->red, col[0][0]); + UNCLAMPED_FLOAT_TO_UBYTE(c->green, col[0][1]); + UNCLAMPED_FLOAT_TO_UBYTE(c->blue, col[0][2]); + if (col_size == 4) { + UNCLAMPED_FLOAT_TO_UBYTE(c->alpha, col[0][3]); + } else { + c->alpha = CHAN_MAX; + } + STRIDE_4F( col, col_stride ); + } +/* fprintf(stderr, "vert %d: %.2f %.2f %.2f %x\n", */ +/* i, v[0], v[1], v[2], *(int *)&v[3]); */ + } +} + +#endif /* emit */ + +#if (DO_XYZW) && (DO_RGBA) + + +#if (HAVE_PTEX_VERTICES) +static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) +{ + LOCALVARS + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + + /* Force 'missing' texcoords to something valid. + */ + if (DO_TEX3 && VB->TexCoordPtr[2] == 0) + VB->TexCoordPtr[2] = VB->TexCoordPtr[3]; + + if (DO_TEX2 && VB->TexCoordPtr[1] == 0) + VB->TexCoordPtr[1] = VB->TexCoordPtr[2]; + + if (DO_TEX1 && VB->TexCoordPtr[0] == 0) + VB->TexCoordPtr[0] = VB->TexCoordPtr[1]; + + if (DO_PTEX) + return GL_TRUE; + + if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) || + (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) || + (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4) || + (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4)) + return GL_FALSE; + + return GL_TRUE; +} +#else +static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) +{ + LOCALVARS + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + + /* Force 'missing' texcoords to something valid. + */ + if (DO_TEX3 && VB->TexCoordPtr[2] == 0) + VB->TexCoordPtr[2] = VB->TexCoordPtr[3]; + + if (DO_TEX2 && VB->TexCoordPtr[1] == 0) + VB->TexCoordPtr[1] = VB->TexCoordPtr[2]; + + if (DO_TEX1 && VB->TexCoordPtr[0] == 0) + VB->TexCoordPtr[0] = VB->TexCoordPtr[1]; + + if (DO_PTEX) + return GL_TRUE; + + /* No hardware support for projective texture. Can fake it for + * TEX0 only. + */ + if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) || + (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) || + (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4)) { + PTEX_FALLBACK(); + return GL_FALSE; + } + + if (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4) { + if (DO_TEX1 || DO_TEX2 || DO_TEX3) { + PTEX_FALLBACK(); + } + return GL_FALSE; + } + + return GL_TRUE; +} +#endif /* ptex */ + + +static void TAG(interp)( GLcontext *ctx, + GLfloat t, + GLuint edst, GLuint eout, GLuint ein, + GLboolean force_boundary ) +{ + LOCALVARS + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte *ddverts = GET_VERTEX_STORE(); + GLuint size = GET_VERTEX_SIZE(); + const GLfloat *dstclip = VB->ClipPtr->data[edst]; + GLfloat w; + const GLfloat *s = GET_VIEWPORT_MAT(); + + VERTEX *dst = (VERTEX *)(ddverts + (edst * size)); + VERTEX *in = (VERTEX *)(ddverts + (ein * size)); + VERTEX *out = (VERTEX *)(ddverts + (eout * size)); + + (void)s; + + if (HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) { + VIEWPORT_X( dst->v.x, dstclip[0] ); + VIEWPORT_Y( dst->v.y, dstclip[1] ); + VIEWPORT_Z( dst->v.z, dstclip[2] ); + w = dstclip[3]; + } + else { + w = 1.0 / dstclip[3]; + VIEWPORT_X( dst->v.x, dstclip[0] * w ); + VIEWPORT_Y( dst->v.y, dstclip[1] * w ); + VIEWPORT_Z( dst->v.z, dstclip[2] * w ); + } + + if ((HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) || + DO_FOG || DO_SPEC || DO_TEX0 || DO_TEX1 || + DO_TEX2 || DO_TEX3 || !HAVE_TINY_VERTICES) { + + dst->v.w = w; + + INTERP_UB( t, dst->ub4[4][0], out->ub4[4][0], in->ub4[4][0] ); + INTERP_UB( t, dst->ub4[4][1], out->ub4[4][1], in->ub4[4][1] ); + INTERP_UB( t, dst->ub4[4][2], out->ub4[4][2], in->ub4[4][2] ); + INTERP_UB( t, dst->ub4[4][3], out->ub4[4][3], in->ub4[4][3] ); + + if (DO_SPEC) { + INTERP_UB( t, dst->v.specular.red, out->v.specular.red, in->v.specular.red ); + INTERP_UB( t, dst->v.specular.green, out->v.specular.green, in->v.specular.green ); + INTERP_UB( t, dst->v.specular.blue, out->v.specular.blue, in->v.specular.blue ); + } + if (DO_FOG) { + INTERP_UB( t, dst->v.specular.alpha, out->v.specular.alpha, in->v.specular.alpha ); + } + if (DO_TEX0) { + if (DO_PTEX) { + if (HAVE_PTEX_VERTICES) { + INTERP_F( t, dst->pv.u0, out->pv.u0, in->pv.u0 ); + INTERP_F( t, dst->pv.v0, out->pv.v0, in->pv.v0 ); + INTERP_F( t, dst->pv.q0, out->pv.q0, in->pv.q0 ); + } else { + GLfloat wout = VB->NdcPtr->data[eout][3]; + GLfloat win = VB->NdcPtr->data[ein][3]; + GLfloat qout = out->pv.w / wout; + GLfloat qin = in->pv.w / win; + GLfloat qdst, rqdst; + + ASSERT( !HAVE_HW_DIVIDE ); + + INTERP_F( t, dst->v.u0, out->v.u0 * qout, in->v.u0 * qin ); + INTERP_F( t, dst->v.v0, out->v.v0 * qout, in->v.v0 * qin ); + INTERP_F( t, qdst, qout, qin ); + + rqdst = 1.0 / qdst; + dst->v.u0 *= rqdst; + dst->v.v0 *= rqdst; + dst->v.w *= rqdst; + } + } + else { + INTERP_F( t, dst->v.u0, out->v.u0, in->v.u0 ); + INTERP_F( t, dst->v.v0, out->v.v0, in->v.v0 ); + } + } + if (DO_TEX1) { + if (DO_PTEX) { + INTERP_F( t, dst->pv.u1, out->pv.u1, in->pv.u1 ); + INTERP_F( t, dst->pv.v1, out->pv.v1, in->pv.v1 ); + INTERP_F( t, dst->pv.q1, out->pv.q1, in->pv.q1 ); + } else { + INTERP_F( t, dst->v.u1, out->v.u1, in->v.u1 ); + INTERP_F( t, dst->v.v1, out->v.v1, in->v.v1 ); + } + } + else if (DO_PTEX) { + dst->pv.q1 = 0.0; /* must be a valid float on radeon */ + } + if (DO_TEX2) { + if (DO_PTEX) { + INTERP_F( t, dst->pv.u2, out->pv.u2, in->pv.u2 ); + INTERP_F( t, dst->pv.v2, out->pv.v2, in->pv.v2 ); + INTERP_F( t, dst->pv.q2, out->pv.q2, in->pv.q2 ); + } else { + INTERP_F( t, dst->v.u2, out->v.u2, in->v.u2 ); + INTERP_F( t, dst->v.v2, out->v.v2, in->v.v2 ); + } + } + if (DO_TEX3) { + if (DO_PTEX) { + INTERP_F( t, dst->pv.u3, out->pv.u3, in->pv.u3 ); + INTERP_F( t, dst->pv.v3, out->pv.v3, in->pv.v3 ); + INTERP_F( t, dst->pv.q3, out->pv.q3, in->pv.q3 ); + } else { + INTERP_F( t, dst->v.u3, out->v.u3, in->v.u3 ); + INTERP_F( t, dst->v.v3, out->v.v3, in->v.v3 ); + } + } + } else { + /* 4-dword vertex. Color is in v[3] and there is no oow coordinate. + */ + INTERP_UB( t, dst->ub4[3][0], out->ub4[3][0], in->ub4[3][0] ); + INTERP_UB( t, dst->ub4[3][1], out->ub4[3][1], in->ub4[3][1] ); + INTERP_UB( t, dst->ub4[3][2], out->ub4[3][2], in->ub4[3][2] ); + INTERP_UB( t, dst->ub4[3][3], out->ub4[3][3], in->ub4[3][3] ); + } +} + +#endif /* rgba && xyzw */ + + +static void TAG(init)( void ) +{ + setup_tab[IND].emit = TAG(emit); + +#if (DO_XYZW && DO_RGBA) + setup_tab[IND].check_tex_sizes = TAG(check_tex_sizes); + setup_tab[IND].interp = TAG(interp); +#endif + + if (DO_SPEC) + setup_tab[IND].copy_pv = copy_pv_rgba4_spec5; + else if (HAVE_HW_DIVIDE || DO_SPEC || DO_FOG || DO_TEX0 || DO_TEX1 || + DO_TEX2 || DO_TEX3 || !HAVE_TINY_VERTICES) + setup_tab[IND].copy_pv = copy_pv_rgba4; + else + setup_tab[IND].copy_pv = copy_pv_rgba3; + + if (DO_TEX3) { + if (DO_PTEX) { + ASSERT(HAVE_PTEX_VERTICES); + setup_tab[IND].vertex_format = PROJ_TEX3_VERTEX_FORMAT; + setup_tab[IND].vertex_size = 18; + } + else { + setup_tab[IND].vertex_format = TEX3_VERTEX_FORMAT; + setup_tab[IND].vertex_size = 14; + } + } + else if (DO_TEX2) { + if (DO_PTEX) { + ASSERT(HAVE_PTEX_VERTICES); + setup_tab[IND].vertex_format = PROJ_TEX3_VERTEX_FORMAT; + setup_tab[IND].vertex_size = 18; + } + else { + setup_tab[IND].vertex_format = TEX2_VERTEX_FORMAT; + setup_tab[IND].vertex_size = 12; + } + } + else if (DO_TEX1) { + if (DO_PTEX) { + ASSERT(HAVE_PTEX_VERTICES); + setup_tab[IND].vertex_format = PROJ_TEX1_VERTEX_FORMAT; + setup_tab[IND].vertex_size = 12; + } + else { + setup_tab[IND].vertex_format = TEX1_VERTEX_FORMAT; + setup_tab[IND].vertex_size = 10; + } + } + else if (DO_TEX0) { + if (DO_PTEX && HAVE_PTEX_VERTICES) { + setup_tab[IND].vertex_format = PROJ_TEX1_VERTEX_FORMAT; + setup_tab[IND].vertex_size = 12; + } else { + setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT; + setup_tab[IND].vertex_size = 8; + } + } + else if (!HAVE_HW_DIVIDE && !DO_SPEC && !DO_FOG && HAVE_TINY_VERTICES) { + setup_tab[IND].vertex_format = TINY_VERTEX_FORMAT; + setup_tab[IND].vertex_size = 4; + } else if (HAVE_NOTEX_VERTICES) { + setup_tab[IND].vertex_format = NOTEX_VERTEX_FORMAT; + setup_tab[IND].vertex_size = 6; + } else { + setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT; + setup_tab[IND].vertex_size = 8; + } +} + + +#undef IND +#undef TAG diff --git a/reactos/dll/mesa32/src/tnl_dd/t_dd_vertex.h b/reactos/dll/mesa32/src/tnl_dd/t_dd_vertex.h new file mode 100644 index 00000000000..d45dd09fbd7 --- /dev/null +++ b/reactos/dll/mesa32/src/tnl_dd/t_dd_vertex.h @@ -0,0 +1,78 @@ + +/* + * Mesa 3-D graphics library + * Version: 4.0.3 + * + * 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: + * Keith Whitwell + */ + +typedef struct { + GLfloat x, y, z, w; +} TAG(_coord_t); + +#ifdef COLOR_IS_RGBA +typedef struct { +#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN + GLubyte alpha, blue, green, red; +#else + GLubyte red, green, blue, alpha; +#endif +} TAG(_color_t); +#else +typedef struct { +#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN + GLubyte alpha, red, green, blue; +#else + GLubyte blue, green, red, alpha; +#endif +} TAG(_color_t); +#endif + +typedef union { + struct { + GLfloat x, y, z, w; + TAG(_color_t) color; + TAG(_color_t) specular; + GLfloat u0, v0; + GLfloat u1, v1; + GLfloat u2, v2; + GLfloat u3, v3; + } v; + struct { + GLfloat x, y, z, w; + TAG(_color_t) color; + TAG(_color_t) specular; + GLfloat u0, v0, q0; + GLfloat u1, v1, q1; + GLfloat u2, v2, q2; + GLfloat u3, v3, q3; + } pv; + struct { + GLfloat x, y, z; + TAG(_color_t) color; + } tv; + GLfloat f[24]; + GLuint ui[24]; + GLubyte ub4[24][4]; +} TAG(Vertex), *TAG(VertexPtr); + diff --git a/reactos/dll/mesa32/src/x86-64/Makefile b/reactos/dll/mesa32/src/x86-64/Makefile new file mode 100644 index 00000000000..252218ca86b --- /dev/null +++ b/reactos/dll/mesa32/src/x86-64/Makefile @@ -0,0 +1,29 @@ +# src/mesa/x86-64/Makefile + +TOP = ../../.. + +include $(TOP)/configs/current + + + +INCLUDE_DIRS = \ + -I$(TOP)/include/GL \ + -I$(TOP)/include \ + -I.. \ + -I../main \ + -I../math \ + -I../glapi \ + -I../tnl + + +default: matypes.h + +clean: + rm -f matypes.h + + +# need some special rules here, unfortunately +matypes.h: ../main/mtypes.h ../tnl/t_context.h ../x86/gen_matypes + ../x86/gen_matypes | grep -v '#include "assyntax.h' > matypes.h + +xform4.o: matypes.h diff --git a/reactos/dll/mesa32/src/x86-64/glapi_x86-64.S b/reactos/dll/mesa32/src/x86-64/glapi_x86-64.S new file mode 100644 index 00000000000..4b85b203ede --- /dev/null +++ b/reactos/dll/mesa32/src/x86-64/glapi_x86-64.S @@ -0,0 +1,30993 @@ +/* DO NOT EDIT - This file generated automatically by gl_x86-64_asm.py (from Mesa) script */ + +/* + * (C) Copyright IBM Corporation 2005 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * IBM, + * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* If we build with gcc's -fvisibility=hidden flag, we'll need to change + * the symbol visibility mode to 'default'. + */ +#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 +# pragma GCC visibility push(default) +# define HIDDEN(x) .hidden x +#else +# define HIDDEN(x) +#endif + +#if defined(PTHREADS) || defined(USE_XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS) +# define THREADS +#endif + + .text + +#ifdef GLX_USE_TLS + + .globl _x86_64_get_get_dispatch; HIDDEN(_x86_64_get_get_dispatch) +_x86_64_get_get_dispatch: + lea _x86_64_get_dispatch(%rip), %rax + ret + + .p2align 4,,15 +_x86_64_get_dispatch: + movq _glapi_tls_Dispatch@GOTTPOFF(%rip), %rax + movq %fs:(%rax), %rax + ret + .size _x86_64_get_dispatch, .-_x86_64_get_dispatch + +#elif defined(PTHREADS) + + .extern _glapi_Dispatch + .extern _gl_DispatchTSD + .extern pthread_getspecific + + .p2align 4,,15 +_x86_64_get_dispatch: + movq _gl_DispatchTSD(%rip), %rdi + jmp pthread_getspecific@PLT + +#elif defined(THREADS) + + .extern _glapi_get_dispatch + +#endif + + .p2align 4,,15 + .globl glNewList + .type glNewList, @function +glNewList: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 0(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq (%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 0(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 0(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glNewList, .-glNewList + + .p2align 4,,15 + .globl glEndList + .type glEndList, @function +glEndList: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 8(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 8(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 8(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 8(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEndList, .-glEndList + + .p2align 4,,15 + .globl glCallList + .type glCallList, @function +glCallList: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 16(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 16(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 16(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 16(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCallList, .-glCallList + + .p2align 4,,15 + .globl glCallLists + .type glCallLists, @function +glCallLists: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 24(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 24(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 24(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 24(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCallLists, .-glCallLists + + .p2align 4,,15 + .globl glDeleteLists + .type glDeleteLists, @function +glDeleteLists: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 32(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 32(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 32(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 32(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDeleteLists, .-glDeleteLists + + .p2align 4,,15 + .globl glGenLists + .type glGenLists, @function +glGenLists: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 40(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 40(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 40(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 40(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGenLists, .-glGenLists + + .p2align 4,,15 + .globl glListBase + .type glListBase, @function +glListBase: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 48(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 48(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 48(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 48(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glListBase, .-glListBase + + .p2align 4,,15 + .globl glBegin + .type glBegin, @function +glBegin: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 56(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 56(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 56(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 56(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBegin, .-glBegin + + .p2align 4,,15 + .globl glBitmap + .type glBitmap, @function +glBitmap: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 64(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + movq %rdx, 48(%rsp) + call _x86_64_get_dispatch@PLT + movq 48(%rsp), %rdx + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 64(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 64(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + movq %rdx, 48(%rsp) + call _glapi_get_dispatch + movq 48(%rsp), %rdx + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 64(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBitmap, .-glBitmap + + .p2align 4,,15 + .globl glColor3b + .type glColor3b, @function +glColor3b: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 72(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 72(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 72(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 72(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3b, .-glColor3b + + .p2align 4,,15 + .globl glColor3bv + .type glColor3bv, @function +glColor3bv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 80(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 80(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 80(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 80(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3bv, .-glColor3bv + + .p2align 4,,15 + .globl glColor3d + .type glColor3d, @function +glColor3d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 88(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 88(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 88(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 88(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3d, .-glColor3d + + .p2align 4,,15 + .globl glColor3dv + .type glColor3dv, @function +glColor3dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 96(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 96(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 96(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 96(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3dv, .-glColor3dv + + .p2align 4,,15 + .globl glColor3f + .type glColor3f, @function +glColor3f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 104(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 104(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 104(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 104(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3f, .-glColor3f + + .p2align 4,,15 + .globl glColor3fv + .type glColor3fv, @function +glColor3fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 112(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 112(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 112(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 112(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3fv, .-glColor3fv + + .p2align 4,,15 + .globl glColor3i + .type glColor3i, @function +glColor3i: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 120(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 120(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 120(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 120(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3i, .-glColor3i + + .p2align 4,,15 + .globl glColor3iv + .type glColor3iv, @function +glColor3iv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 128(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 128(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 128(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 128(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3iv, .-glColor3iv + + .p2align 4,,15 + .globl glColor3s + .type glColor3s, @function +glColor3s: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 136(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 136(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 136(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 136(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3s, .-glColor3s + + .p2align 4,,15 + .globl glColor3sv + .type glColor3sv, @function +glColor3sv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 144(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 144(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 144(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 144(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3sv, .-glColor3sv + + .p2align 4,,15 + .globl glColor3ub + .type glColor3ub, @function +glColor3ub: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 152(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 152(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 152(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 152(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3ub, .-glColor3ub + + .p2align 4,,15 + .globl glColor3ubv + .type glColor3ubv, @function +glColor3ubv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 160(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 160(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 160(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 160(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3ubv, .-glColor3ubv + + .p2align 4,,15 + .globl glColor3ui + .type glColor3ui, @function +glColor3ui: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 168(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 168(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 168(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 168(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3ui, .-glColor3ui + + .p2align 4,,15 + .globl glColor3uiv + .type glColor3uiv, @function +glColor3uiv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 176(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 176(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 176(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 176(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3uiv, .-glColor3uiv + + .p2align 4,,15 + .globl glColor3us + .type glColor3us, @function +glColor3us: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3us, .-glColor3us + + .p2align 4,,15 + .globl glColor3usv + .type glColor3usv, @function +glColor3usv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 192(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor3usv, .-glColor3usv + + .p2align 4,,15 + .globl glColor4b + .type glColor4b, @function +glColor4b: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 200(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4b, .-glColor4b + + .p2align 4,,15 + .globl glColor4bv + .type glColor4bv, @function +glColor4bv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 208(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 208(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 208(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 208(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4bv, .-glColor4bv + + .p2align 4,,15 + .globl glColor4d + .type glColor4d, @function +glColor4d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 216(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 216(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 216(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 216(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4d, .-glColor4d + + .p2align 4,,15 + .globl glColor4dv + .type glColor4dv, @function +glColor4dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 224(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 224(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 224(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 224(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4dv, .-glColor4dv + + .p2align 4,,15 + .globl glColor4f + .type glColor4f, @function +glColor4f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 232(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 232(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 232(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 232(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4f, .-glColor4f + + .p2align 4,,15 + .globl glColor4fv + .type glColor4fv, @function +glColor4fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 240(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 240(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 240(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 240(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4fv, .-glColor4fv + + .p2align 4,,15 + .globl glColor4i + .type glColor4i, @function +glColor4i: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 248(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 248(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4i, .-glColor4i + + .p2align 4,,15 + .globl glColor4iv + .type glColor4iv, @function +glColor4iv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 256(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 256(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 256(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 256(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4iv, .-glColor4iv + + .p2align 4,,15 + .globl glColor4s + .type glColor4s, @function +glColor4s: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 264(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 264(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 264(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 264(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4s, .-glColor4s + + .p2align 4,,15 + .globl glColor4sv + .type glColor4sv, @function +glColor4sv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 272(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 272(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 272(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 272(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4sv, .-glColor4sv + + .p2align 4,,15 + .globl glColor4ub + .type glColor4ub, @function +glColor4ub: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 280(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 280(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 280(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 280(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4ub, .-glColor4ub + + .p2align 4,,15 + .globl glColor4ubv + .type glColor4ubv, @function +glColor4ubv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 288(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 288(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 288(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 288(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4ubv, .-glColor4ubv + + .p2align 4,,15 + .globl glColor4ui + .type glColor4ui, @function +glColor4ui: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 296(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 296(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 296(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 296(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4ui, .-glColor4ui + + .p2align 4,,15 + .globl glColor4uiv + .type glColor4uiv, @function +glColor4uiv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 304(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 304(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 304(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 304(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4uiv, .-glColor4uiv + + .p2align 4,,15 + .globl glColor4us + .type glColor4us, @function +glColor4us: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 312(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 312(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 312(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 312(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4us, .-glColor4us + + .p2align 4,,15 + .globl glColor4usv + .type glColor4usv, @function +glColor4usv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 320(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 320(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 320(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 320(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColor4usv, .-glColor4usv + + .p2align 4,,15 + .globl glEdgeFlag + .type glEdgeFlag, @function +glEdgeFlag: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 328(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 328(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 328(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 328(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEdgeFlag, .-glEdgeFlag + + .p2align 4,,15 + .globl glEdgeFlagv + .type glEdgeFlagv, @function +glEdgeFlagv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 336(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 336(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 336(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 336(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEdgeFlagv, .-glEdgeFlagv + + .p2align 4,,15 + .globl glEnd + .type glEnd, @function +glEnd: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 344(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 344(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 344(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 344(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEnd, .-glEnd + + .p2align 4,,15 + .globl glIndexd + .type glIndexd, @function +glIndexd: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 352(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 352(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 352(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 352(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexd, .-glIndexd + + .p2align 4,,15 + .globl glIndexdv + .type glIndexdv, @function +glIndexdv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 360(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 360(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 360(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 360(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexdv, .-glIndexdv + + .p2align 4,,15 + .globl glIndexf + .type glIndexf, @function +glIndexf: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 368(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 368(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 368(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 368(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexf, .-glIndexf + + .p2align 4,,15 + .globl glIndexfv + .type glIndexfv, @function +glIndexfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 376(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 376(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 376(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 376(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexfv, .-glIndexfv + + .p2align 4,,15 + .globl glIndexi + .type glIndexi, @function +glIndexi: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 384(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 384(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 384(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 384(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexi, .-glIndexi + + .p2align 4,,15 + .globl glIndexiv + .type glIndexiv, @function +glIndexiv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 392(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 392(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 392(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 392(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexiv, .-glIndexiv + + .p2align 4,,15 + .globl glIndexs + .type glIndexs, @function +glIndexs: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 400(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 400(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 400(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexs, .-glIndexs + + .p2align 4,,15 + .globl glIndexsv + .type glIndexsv, @function +glIndexsv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 408(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexsv, .-glIndexsv + + .p2align 4,,15 + .globl glNormal3b + .type glNormal3b, @function +glNormal3b: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 416(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 416(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glNormal3b, .-glNormal3b + + .p2align 4,,15 + .globl glNormal3bv + .type glNormal3bv, @function +glNormal3bv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 424(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 424(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 424(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 424(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glNormal3bv, .-glNormal3bv + + .p2align 4,,15 + .globl glNormal3d + .type glNormal3d, @function +glNormal3d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 432(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 432(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 432(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 432(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glNormal3d, .-glNormal3d + + .p2align 4,,15 + .globl glNormal3dv + .type glNormal3dv, @function +glNormal3dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 440(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 440(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 440(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 440(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glNormal3dv, .-glNormal3dv + + .p2align 4,,15 + .globl glNormal3f + .type glNormal3f, @function +glNormal3f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 448(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 448(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 448(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 448(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glNormal3f, .-glNormal3f + + .p2align 4,,15 + .globl glNormal3fv + .type glNormal3fv, @function +glNormal3fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 456(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 456(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 456(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 456(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glNormal3fv, .-glNormal3fv + + .p2align 4,,15 + .globl glNormal3i + .type glNormal3i, @function +glNormal3i: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 464(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 464(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 464(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 464(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glNormal3i, .-glNormal3i + + .p2align 4,,15 + .globl glNormal3iv + .type glNormal3iv, @function +glNormal3iv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 472(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 472(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 472(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 472(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glNormal3iv, .-glNormal3iv + + .p2align 4,,15 + .globl glNormal3s + .type glNormal3s, @function +glNormal3s: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 480(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 480(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 480(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 480(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glNormal3s, .-glNormal3s + + .p2align 4,,15 + .globl glNormal3sv + .type glNormal3sv, @function +glNormal3sv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 488(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 488(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 488(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 488(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glNormal3sv, .-glNormal3sv + + .p2align 4,,15 + .globl glRasterPos2d + .type glRasterPos2d, @function +glRasterPos2d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 496(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos2d, .-glRasterPos2d + + .p2align 4,,15 + .globl glRasterPos2dv + .type glRasterPos2dv, @function +glRasterPos2dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 504(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos2dv, .-glRasterPos2dv + + .p2align 4,,15 + .globl glRasterPos2f + .type glRasterPos2f, @function +glRasterPos2f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 512(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos2f, .-glRasterPos2f + + .p2align 4,,15 + .globl glRasterPos2fv + .type glRasterPos2fv, @function +glRasterPos2fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 520(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos2fv, .-glRasterPos2fv + + .p2align 4,,15 + .globl glRasterPos2i + .type glRasterPos2i, @function +glRasterPos2i: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 528(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 528(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 528(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 528(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos2i, .-glRasterPos2i + + .p2align 4,,15 + .globl glRasterPos2iv + .type glRasterPos2iv, @function +glRasterPos2iv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 536(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 536(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 536(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 536(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos2iv, .-glRasterPos2iv + + .p2align 4,,15 + .globl glRasterPos2s + .type glRasterPos2s, @function +glRasterPos2s: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 544(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 544(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 544(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 544(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos2s, .-glRasterPos2s + + .p2align 4,,15 + .globl glRasterPos2sv + .type glRasterPos2sv, @function +glRasterPos2sv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 552(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 552(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 552(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 552(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos2sv, .-glRasterPos2sv + + .p2align 4,,15 + .globl glRasterPos3d + .type glRasterPos3d, @function +glRasterPos3d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 560(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 560(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 560(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 560(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos3d, .-glRasterPos3d + + .p2align 4,,15 + .globl glRasterPos3dv + .type glRasterPos3dv, @function +glRasterPos3dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 568(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 568(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 568(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 568(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos3dv, .-glRasterPos3dv + + .p2align 4,,15 + .globl glRasterPos3f + .type glRasterPos3f, @function +glRasterPos3f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 576(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 576(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 576(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 576(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos3f, .-glRasterPos3f + + .p2align 4,,15 + .globl glRasterPos3fv + .type glRasterPos3fv, @function +glRasterPos3fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 584(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 584(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 584(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 584(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos3fv, .-glRasterPos3fv + + .p2align 4,,15 + .globl glRasterPos3i + .type glRasterPos3i, @function +glRasterPos3i: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 592(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 592(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 592(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 592(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos3i, .-glRasterPos3i + + .p2align 4,,15 + .globl glRasterPos3iv + .type glRasterPos3iv, @function +glRasterPos3iv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 600(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 600(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 600(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 600(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos3iv, .-glRasterPos3iv + + .p2align 4,,15 + .globl glRasterPos3s + .type glRasterPos3s, @function +glRasterPos3s: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 608(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 608(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 608(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 608(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos3s, .-glRasterPos3s + + .p2align 4,,15 + .globl glRasterPos3sv + .type glRasterPos3sv, @function +glRasterPos3sv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 616(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 616(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 616(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 616(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos3sv, .-glRasterPos3sv + + .p2align 4,,15 + .globl glRasterPos4d + .type glRasterPos4d, @function +glRasterPos4d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 624(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 624(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 624(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 624(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos4d, .-glRasterPos4d + + .p2align 4,,15 + .globl glRasterPos4dv + .type glRasterPos4dv, @function +glRasterPos4dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 632(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 632(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 632(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 632(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos4dv, .-glRasterPos4dv + + .p2align 4,,15 + .globl glRasterPos4f + .type glRasterPos4f, @function +glRasterPos4f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 640(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 640(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 640(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 640(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos4f, .-glRasterPos4f + + .p2align 4,,15 + .globl glRasterPos4fv + .type glRasterPos4fv, @function +glRasterPos4fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 648(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 648(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 648(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 648(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos4fv, .-glRasterPos4fv + + .p2align 4,,15 + .globl glRasterPos4i + .type glRasterPos4i, @function +glRasterPos4i: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 656(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 656(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 656(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 656(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos4i, .-glRasterPos4i + + .p2align 4,,15 + .globl glRasterPos4iv + .type glRasterPos4iv, @function +glRasterPos4iv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 664(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 664(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 664(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 664(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos4iv, .-glRasterPos4iv + + .p2align 4,,15 + .globl glRasterPos4s + .type glRasterPos4s, @function +glRasterPos4s: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 672(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 672(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 672(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 672(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos4s, .-glRasterPos4s + + .p2align 4,,15 + .globl glRasterPos4sv + .type glRasterPos4sv, @function +glRasterPos4sv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 680(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 680(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 680(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 680(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRasterPos4sv, .-glRasterPos4sv + + .p2align 4,,15 + .globl glRectd + .type glRectd, @function +glRectd: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 688(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 688(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 688(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 688(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRectd, .-glRectd + + .p2align 4,,15 + .globl glRectdv + .type glRectdv, @function +glRectdv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 696(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 696(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 696(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 696(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRectdv, .-glRectdv + + .p2align 4,,15 + .globl glRectf + .type glRectf, @function +glRectf: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 704(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 704(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 704(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 704(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRectf, .-glRectf + + .p2align 4,,15 + .globl glRectfv + .type glRectfv, @function +glRectfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 712(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 712(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 712(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 712(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRectfv, .-glRectfv + + .p2align 4,,15 + .globl glRecti + .type glRecti, @function +glRecti: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 720(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 720(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 720(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 720(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRecti, .-glRecti + + .p2align 4,,15 + .globl glRectiv + .type glRectiv, @function +glRectiv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 728(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 728(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 728(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 728(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRectiv, .-glRectiv + + .p2align 4,,15 + .globl glRects + .type glRects, @function +glRects: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 736(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 736(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 736(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 736(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRects, .-glRects + + .p2align 4,,15 + .globl glRectsv + .type glRectsv, @function +glRectsv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 744(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 744(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 744(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 744(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRectsv, .-glRectsv + + .p2align 4,,15 + .globl glTexCoord1d + .type glTexCoord1d, @function +glTexCoord1d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 752(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 752(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 752(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 752(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord1d, .-glTexCoord1d + + .p2align 4,,15 + .globl glTexCoord1dv + .type glTexCoord1dv, @function +glTexCoord1dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 760(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 760(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 760(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 760(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord1dv, .-glTexCoord1dv + + .p2align 4,,15 + .globl glTexCoord1f + .type glTexCoord1f, @function +glTexCoord1f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 768(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 768(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 768(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 768(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord1f, .-glTexCoord1f + + .p2align 4,,15 + .globl glTexCoord1fv + .type glTexCoord1fv, @function +glTexCoord1fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 776(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 776(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 776(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 776(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord1fv, .-glTexCoord1fv + + .p2align 4,,15 + .globl glTexCoord1i + .type glTexCoord1i, @function +glTexCoord1i: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 784(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 784(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 784(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 784(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord1i, .-glTexCoord1i + + .p2align 4,,15 + .globl glTexCoord1iv + .type glTexCoord1iv, @function +glTexCoord1iv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 792(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 792(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 792(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 792(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord1iv, .-glTexCoord1iv + + .p2align 4,,15 + .globl glTexCoord1s + .type glTexCoord1s, @function +glTexCoord1s: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 800(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 800(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 800(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 800(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord1s, .-glTexCoord1s + + .p2align 4,,15 + .globl glTexCoord1sv + .type glTexCoord1sv, @function +glTexCoord1sv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 808(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 808(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 808(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 808(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord1sv, .-glTexCoord1sv + + .p2align 4,,15 + .globl glTexCoord2d + .type glTexCoord2d, @function +glTexCoord2d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 816(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 816(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 816(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 816(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord2d, .-glTexCoord2d + + .p2align 4,,15 + .globl glTexCoord2dv + .type glTexCoord2dv, @function +glTexCoord2dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 824(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 824(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 824(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 824(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord2dv, .-glTexCoord2dv + + .p2align 4,,15 + .globl glTexCoord2f + .type glTexCoord2f, @function +glTexCoord2f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 832(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 832(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 832(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 832(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord2f, .-glTexCoord2f + + .p2align 4,,15 + .globl glTexCoord2fv + .type glTexCoord2fv, @function +glTexCoord2fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 840(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 840(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 840(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 840(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord2fv, .-glTexCoord2fv + + .p2align 4,,15 + .globl glTexCoord2i + .type glTexCoord2i, @function +glTexCoord2i: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 848(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 848(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 848(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 848(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord2i, .-glTexCoord2i + + .p2align 4,,15 + .globl glTexCoord2iv + .type glTexCoord2iv, @function +glTexCoord2iv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 856(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 856(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 856(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 856(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord2iv, .-glTexCoord2iv + + .p2align 4,,15 + .globl glTexCoord2s + .type glTexCoord2s, @function +glTexCoord2s: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 864(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 864(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 864(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 864(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord2s, .-glTexCoord2s + + .p2align 4,,15 + .globl glTexCoord2sv + .type glTexCoord2sv, @function +glTexCoord2sv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 872(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 872(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 872(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 872(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord2sv, .-glTexCoord2sv + + .p2align 4,,15 + .globl glTexCoord3d + .type glTexCoord3d, @function +glTexCoord3d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 880(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 880(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 880(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 880(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord3d, .-glTexCoord3d + + .p2align 4,,15 + .globl glTexCoord3dv + .type glTexCoord3dv, @function +glTexCoord3dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 888(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 888(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 888(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 888(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord3dv, .-glTexCoord3dv + + .p2align 4,,15 + .globl glTexCoord3f + .type glTexCoord3f, @function +glTexCoord3f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 896(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 896(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 896(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 896(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord3f, .-glTexCoord3f + + .p2align 4,,15 + .globl glTexCoord3fv + .type glTexCoord3fv, @function +glTexCoord3fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 904(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 904(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 904(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 904(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord3fv, .-glTexCoord3fv + + .p2align 4,,15 + .globl glTexCoord3i + .type glTexCoord3i, @function +glTexCoord3i: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 912(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 912(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 912(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 912(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord3i, .-glTexCoord3i + + .p2align 4,,15 + .globl glTexCoord3iv + .type glTexCoord3iv, @function +glTexCoord3iv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 920(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 920(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 920(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 920(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord3iv, .-glTexCoord3iv + + .p2align 4,,15 + .globl glTexCoord3s + .type glTexCoord3s, @function +glTexCoord3s: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 928(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 928(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 928(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 928(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord3s, .-glTexCoord3s + + .p2align 4,,15 + .globl glTexCoord3sv + .type glTexCoord3sv, @function +glTexCoord3sv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 936(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 936(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 936(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 936(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord3sv, .-glTexCoord3sv + + .p2align 4,,15 + .globl glTexCoord4d + .type glTexCoord4d, @function +glTexCoord4d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 944(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 944(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 944(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 944(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord4d, .-glTexCoord4d + + .p2align 4,,15 + .globl glTexCoord4dv + .type glTexCoord4dv, @function +glTexCoord4dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 952(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 952(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 952(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 952(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord4dv, .-glTexCoord4dv + + .p2align 4,,15 + .globl glTexCoord4f + .type glTexCoord4f, @function +glTexCoord4f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 960(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 960(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 960(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 960(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord4f, .-glTexCoord4f + + .p2align 4,,15 + .globl glTexCoord4fv + .type glTexCoord4fv, @function +glTexCoord4fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 968(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 968(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 968(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 968(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord4fv, .-glTexCoord4fv + + .p2align 4,,15 + .globl glTexCoord4i + .type glTexCoord4i, @function +glTexCoord4i: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 976(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 976(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 976(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 976(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord4i, .-glTexCoord4i + + .p2align 4,,15 + .globl glTexCoord4iv + .type glTexCoord4iv, @function +glTexCoord4iv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 984(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 984(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 984(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 984(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord4iv, .-glTexCoord4iv + + .p2align 4,,15 + .globl glTexCoord4s + .type glTexCoord4s, @function +glTexCoord4s: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 992(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 992(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 992(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 992(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord4s, .-glTexCoord4s + + .p2align 4,,15 + .globl glTexCoord4sv + .type glTexCoord4sv, @function +glTexCoord4sv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1000(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1000(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1000(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1000(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoord4sv, .-glTexCoord4sv + + .p2align 4,,15 + .globl glVertex2d + .type glVertex2d, @function +glVertex2d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1008(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1008(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1008(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1008(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex2d, .-glVertex2d + + .p2align 4,,15 + .globl glVertex2dv + .type glVertex2dv, @function +glVertex2dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1016(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1016(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1016(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1016(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex2dv, .-glVertex2dv + + .p2align 4,,15 + .globl glVertex2f + .type glVertex2f, @function +glVertex2f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1024(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1024(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1024(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1024(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex2f, .-glVertex2f + + .p2align 4,,15 + .globl glVertex2fv + .type glVertex2fv, @function +glVertex2fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1032(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1032(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1032(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1032(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex2fv, .-glVertex2fv + + .p2align 4,,15 + .globl glVertex2i + .type glVertex2i, @function +glVertex2i: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1040(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1040(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1040(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1040(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex2i, .-glVertex2i + + .p2align 4,,15 + .globl glVertex2iv + .type glVertex2iv, @function +glVertex2iv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1048(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1048(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1048(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1048(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex2iv, .-glVertex2iv + + .p2align 4,,15 + .globl glVertex2s + .type glVertex2s, @function +glVertex2s: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1056(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1056(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1056(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1056(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex2s, .-glVertex2s + + .p2align 4,,15 + .globl glVertex2sv + .type glVertex2sv, @function +glVertex2sv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1064(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1064(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1064(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1064(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex2sv, .-glVertex2sv + + .p2align 4,,15 + .globl glVertex3d + .type glVertex3d, @function +glVertex3d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1072(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1072(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1072(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1072(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex3d, .-glVertex3d + + .p2align 4,,15 + .globl glVertex3dv + .type glVertex3dv, @function +glVertex3dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1080(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1080(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1080(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1080(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex3dv, .-glVertex3dv + + .p2align 4,,15 + .globl glVertex3f + .type glVertex3f, @function +glVertex3f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1088(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1088(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1088(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1088(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex3f, .-glVertex3f + + .p2align 4,,15 + .globl glVertex3fv + .type glVertex3fv, @function +glVertex3fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1096(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1096(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1096(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1096(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex3fv, .-glVertex3fv + + .p2align 4,,15 + .globl glVertex3i + .type glVertex3i, @function +glVertex3i: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1104(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1104(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1104(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1104(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex3i, .-glVertex3i + + .p2align 4,,15 + .globl glVertex3iv + .type glVertex3iv, @function +glVertex3iv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1112(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1112(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1112(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1112(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex3iv, .-glVertex3iv + + .p2align 4,,15 + .globl glVertex3s + .type glVertex3s, @function +glVertex3s: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1120(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1120(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1120(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1120(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex3s, .-glVertex3s + + .p2align 4,,15 + .globl glVertex3sv + .type glVertex3sv, @function +glVertex3sv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1128(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1128(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1128(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1128(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex3sv, .-glVertex3sv + + .p2align 4,,15 + .globl glVertex4d + .type glVertex4d, @function +glVertex4d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1136(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 1136(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1136(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 1136(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex4d, .-glVertex4d + + .p2align 4,,15 + .globl glVertex4dv + .type glVertex4dv, @function +glVertex4dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1144(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1144(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1144(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1144(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex4dv, .-glVertex4dv + + .p2align 4,,15 + .globl glVertex4f + .type glVertex4f, @function +glVertex4f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1152(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 1152(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1152(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 1152(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex4f, .-glVertex4f + + .p2align 4,,15 + .globl glVertex4fv + .type glVertex4fv, @function +glVertex4fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1160(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1160(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1160(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1160(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex4fv, .-glVertex4fv + + .p2align 4,,15 + .globl glVertex4i + .type glVertex4i, @function +glVertex4i: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1168(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1168(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1168(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1168(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex4i, .-glVertex4i + + .p2align 4,,15 + .globl glVertex4iv + .type glVertex4iv, @function +glVertex4iv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1176(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1176(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1176(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1176(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex4iv, .-glVertex4iv + + .p2align 4,,15 + .globl glVertex4s + .type glVertex4s, @function +glVertex4s: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex4s, .-glVertex4s + + .p2align 4,,15 + .globl glVertex4sv + .type glVertex4sv, @function +glVertex4sv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1192(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertex4sv, .-glVertex4sv + + .p2align 4,,15 + .globl glClipPlane + .type glClipPlane, @function +glClipPlane: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1200(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glClipPlane, .-glClipPlane + + .p2align 4,,15 + .globl glColorMaterial + .type glColorMaterial, @function +glColorMaterial: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1208(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1208(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1208(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1208(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColorMaterial, .-glColorMaterial + + .p2align 4,,15 + .globl glCullFace + .type glCullFace, @function +glCullFace: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1216(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1216(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1216(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1216(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCullFace, .-glCullFace + + .p2align 4,,15 + .globl glFogf + .type glFogf, @function +glFogf: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1224(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1224(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1224(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1224(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFogf, .-glFogf + + .p2align 4,,15 + .globl glFogfv + .type glFogfv, @function +glFogfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1232(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1232(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1232(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1232(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFogfv, .-glFogfv + + .p2align 4,,15 + .globl glFogi + .type glFogi, @function +glFogi: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1240(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1240(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1240(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1240(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFogi, .-glFogi + + .p2align 4,,15 + .globl glFogiv + .type glFogiv, @function +glFogiv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1248(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1248(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFogiv, .-glFogiv + + .p2align 4,,15 + .globl glFrontFace + .type glFrontFace, @function +glFrontFace: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1256(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1256(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1256(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1256(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFrontFace, .-glFrontFace + + .p2align 4,,15 + .globl glHint + .type glHint, @function +glHint: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1264(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1264(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1264(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1264(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glHint, .-glHint + + .p2align 4,,15 + .globl glLightf + .type glLightf, @function +glLightf: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1272(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1272(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1272(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1272(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLightf, .-glLightf + + .p2align 4,,15 + .globl glLightfv + .type glLightfv, @function +glLightfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1280(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1280(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1280(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1280(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLightfv, .-glLightfv + + .p2align 4,,15 + .globl glLighti + .type glLighti, @function +glLighti: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1288(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1288(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1288(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1288(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLighti, .-glLighti + + .p2align 4,,15 + .globl glLightiv + .type glLightiv, @function +glLightiv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1296(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1296(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1296(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1296(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLightiv, .-glLightiv + + .p2align 4,,15 + .globl glLightModelf + .type glLightModelf, @function +glLightModelf: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1304(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1304(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1304(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1304(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLightModelf, .-glLightModelf + + .p2align 4,,15 + .globl glLightModelfv + .type glLightModelfv, @function +glLightModelfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1312(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1312(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1312(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1312(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLightModelfv, .-glLightModelfv + + .p2align 4,,15 + .globl glLightModeli + .type glLightModeli, @function +glLightModeli: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1320(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1320(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1320(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1320(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLightModeli, .-glLightModeli + + .p2align 4,,15 + .globl glLightModeliv + .type glLightModeliv, @function +glLightModeliv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1328(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1328(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1328(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1328(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLightModeliv, .-glLightModeliv + + .p2align 4,,15 + .globl glLineStipple + .type glLineStipple, @function +glLineStipple: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1336(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1336(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1336(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1336(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLineStipple, .-glLineStipple + + .p2align 4,,15 + .globl glLineWidth + .type glLineWidth, @function +glLineWidth: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1344(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1344(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1344(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1344(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLineWidth, .-glLineWidth + + .p2align 4,,15 + .globl glMaterialf + .type glMaterialf, @function +glMaterialf: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1352(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1352(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1352(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1352(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMaterialf, .-glMaterialf + + .p2align 4,,15 + .globl glMaterialfv + .type glMaterialfv, @function +glMaterialfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1360(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1360(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1360(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1360(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMaterialfv, .-glMaterialfv + + .p2align 4,,15 + .globl glMateriali + .type glMateriali, @function +glMateriali: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1368(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1368(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1368(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1368(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMateriali, .-glMateriali + + .p2align 4,,15 + .globl glMaterialiv + .type glMaterialiv, @function +glMaterialiv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1376(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1376(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1376(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1376(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMaterialiv, .-glMaterialiv + + .p2align 4,,15 + .globl glPointSize + .type glPointSize, @function +glPointSize: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1384(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1384(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1384(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1384(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPointSize, .-glPointSize + + .p2align 4,,15 + .globl glPolygonMode + .type glPolygonMode, @function +glPolygonMode: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1392(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1392(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1392(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1392(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPolygonMode, .-glPolygonMode + + .p2align 4,,15 + .globl glPolygonStipple + .type glPolygonStipple, @function +glPolygonStipple: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1400(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1400(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1400(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPolygonStipple, .-glPolygonStipple + + .p2align 4,,15 + .globl glScissor + .type glScissor, @function +glScissor: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1408(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glScissor, .-glScissor + + .p2align 4,,15 + .globl glShadeModel + .type glShadeModel, @function +glShadeModel: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1416(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1416(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glShadeModel, .-glShadeModel + + .p2align 4,,15 + .globl glTexParameterf + .type glTexParameterf, @function +glTexParameterf: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1424(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1424(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1424(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1424(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexParameterf, .-glTexParameterf + + .p2align 4,,15 + .globl glTexParameterfv + .type glTexParameterfv, @function +glTexParameterfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1432(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1432(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1432(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1432(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexParameterfv, .-glTexParameterfv + + .p2align 4,,15 + .globl glTexParameteri + .type glTexParameteri, @function +glTexParameteri: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1440(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1440(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1440(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1440(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexParameteri, .-glTexParameteri + + .p2align 4,,15 + .globl glTexParameteriv + .type glTexParameteriv, @function +glTexParameteriv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1448(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1448(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1448(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1448(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexParameteriv, .-glTexParameteriv + + .p2align 4,,15 + .globl glTexImage1D + .type glTexImage1D, @function +glTexImage1D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1456(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1456(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1456(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1456(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexImage1D, .-glTexImage1D + + .p2align 4,,15 + .globl glTexImage2D + .type glTexImage2D, @function +glTexImage2D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1464(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1464(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1464(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1464(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexImage2D, .-glTexImage2D + + .p2align 4,,15 + .globl glTexEnvf + .type glTexEnvf, @function +glTexEnvf: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1472(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1472(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1472(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1472(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexEnvf, .-glTexEnvf + + .p2align 4,,15 + .globl glTexEnvfv + .type glTexEnvfv, @function +glTexEnvfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1480(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1480(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1480(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1480(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexEnvfv, .-glTexEnvfv + + .p2align 4,,15 + .globl glTexEnvi + .type glTexEnvi, @function +glTexEnvi: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1488(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1488(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1488(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1488(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexEnvi, .-glTexEnvi + + .p2align 4,,15 + .globl glTexEnviv + .type glTexEnviv, @function +glTexEnviv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1496(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexEnviv, .-glTexEnviv + + .p2align 4,,15 + .globl glTexGend + .type glTexGend, @function +glTexGend: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1504(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexGend, .-glTexGend + + .p2align 4,,15 + .globl glTexGendv + .type glTexGendv, @function +glTexGendv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1512(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexGendv, .-glTexGendv + + .p2align 4,,15 + .globl glTexGenf + .type glTexGenf, @function +glTexGenf: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1520(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexGenf, .-glTexGenf + + .p2align 4,,15 + .globl glTexGenfv + .type glTexGenfv, @function +glTexGenfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1528(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1528(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1528(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1528(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexGenfv, .-glTexGenfv + + .p2align 4,,15 + .globl glTexGeni + .type glTexGeni, @function +glTexGeni: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1536(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1536(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1536(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1536(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexGeni, .-glTexGeni + + .p2align 4,,15 + .globl glTexGeniv + .type glTexGeniv, @function +glTexGeniv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1544(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1544(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1544(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1544(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexGeniv, .-glTexGeniv + + .p2align 4,,15 + .globl glFeedbackBuffer + .type glFeedbackBuffer, @function +glFeedbackBuffer: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1552(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1552(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1552(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1552(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFeedbackBuffer, .-glFeedbackBuffer + + .p2align 4,,15 + .globl glSelectBuffer + .type glSelectBuffer, @function +glSelectBuffer: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1560(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1560(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1560(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1560(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSelectBuffer, .-glSelectBuffer + + .p2align 4,,15 + .globl glRenderMode + .type glRenderMode, @function +glRenderMode: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1568(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1568(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1568(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1568(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRenderMode, .-glRenderMode + + .p2align 4,,15 + .globl glInitNames + .type glInitNames, @function +glInitNames: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1576(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 1576(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1576(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 1576(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glInitNames, .-glInitNames + + .p2align 4,,15 + .globl glLoadName + .type glLoadName, @function +glLoadName: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1584(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1584(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1584(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1584(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLoadName, .-glLoadName + + .p2align 4,,15 + .globl glPassThrough + .type glPassThrough, @function +glPassThrough: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1592(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1592(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1592(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1592(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPassThrough, .-glPassThrough + + .p2align 4,,15 + .globl glPopName + .type glPopName, @function +glPopName: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1600(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 1600(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1600(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 1600(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPopName, .-glPopName + + .p2align 4,,15 + .globl glPushName + .type glPushName, @function +glPushName: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1608(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1608(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1608(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1608(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPushName, .-glPushName + + .p2align 4,,15 + .globl glDrawBuffer + .type glDrawBuffer, @function +glDrawBuffer: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1616(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1616(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1616(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1616(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDrawBuffer, .-glDrawBuffer + + .p2align 4,,15 + .globl glClear + .type glClear, @function +glClear: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1624(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1624(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1624(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1624(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glClear, .-glClear + + .p2align 4,,15 + .globl glClearAccum + .type glClearAccum, @function +glClearAccum: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1632(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 1632(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1632(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 1632(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glClearAccum, .-glClearAccum + + .p2align 4,,15 + .globl glClearIndex + .type glClearIndex, @function +glClearIndex: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1640(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1640(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1640(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1640(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glClearIndex, .-glClearIndex + + .p2align 4,,15 + .globl glClearColor + .type glClearColor, @function +glClearColor: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1648(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1648(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1648(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1648(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glClearColor, .-glClearColor + + .p2align 4,,15 + .globl glClearStencil + .type glClearStencil, @function +glClearStencil: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1656(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1656(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1656(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1656(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glClearStencil, .-glClearStencil + + .p2align 4,,15 + .globl glClearDepth + .type glClearDepth, @function +glClearDepth: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1664(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1664(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1664(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1664(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glClearDepth, .-glClearDepth + + .p2align 4,,15 + .globl glStencilMask + .type glStencilMask, @function +glStencilMask: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1672(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1672(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1672(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1672(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glStencilMask, .-glStencilMask + + .p2align 4,,15 + .globl glColorMask + .type glColorMask, @function +glColorMask: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1680(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1680(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1680(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1680(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColorMask, .-glColorMask + + .p2align 4,,15 + .globl glDepthMask + .type glDepthMask, @function +glDepthMask: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1688(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1688(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1688(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1688(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDepthMask, .-glDepthMask + + .p2align 4,,15 + .globl glIndexMask + .type glIndexMask, @function +glIndexMask: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1696(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1696(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1696(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1696(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexMask, .-glIndexMask + + .p2align 4,,15 + .globl glAccum + .type glAccum, @function +glAccum: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1704(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1704(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1704(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1704(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glAccum, .-glAccum + + .p2align 4,,15 + .globl glDisable + .type glDisable, @function +glDisable: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1712(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1712(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1712(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1712(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDisable, .-glDisable + + .p2align 4,,15 + .globl glEnable + .type glEnable, @function +glEnable: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1720(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1720(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1720(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1720(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEnable, .-glEnable + + .p2align 4,,15 + .globl glFinish + .type glFinish, @function +glFinish: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1728(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 1728(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1728(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 1728(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFinish, .-glFinish + + .p2align 4,,15 + .globl glFlush + .type glFlush, @function +glFlush: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1736(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 1736(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1736(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 1736(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFlush, .-glFlush + + .p2align 4,,15 + .globl glPopAttrib + .type glPopAttrib, @function +glPopAttrib: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1744(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 1744(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1744(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 1744(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPopAttrib, .-glPopAttrib + + .p2align 4,,15 + .globl glPushAttrib + .type glPushAttrib, @function +glPushAttrib: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1752(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1752(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1752(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1752(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPushAttrib, .-glPushAttrib + + .p2align 4,,15 + .globl glMap1d + .type glMap1d, @function +glMap1d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1760(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %rcx, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %rcx + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1760(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1760(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %rcx, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %rcx + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1760(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMap1d, .-glMap1d + + .p2align 4,,15 + .globl glMap1f + .type glMap1f, @function +glMap1f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1768(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %rcx, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %rcx + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1768(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1768(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %rcx, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %rcx + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1768(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMap1f, .-glMap1f + + .p2align 4,,15 + .globl glMap2d + .type glMap2d, @function +glMap2d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1776(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $88, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + movq %rcx, 56(%rsp) + movq %r8, 64(%rsp) + movq %r9, 72(%rsp) + call _x86_64_get_dispatch@PLT + movq 72(%rsp), %r9 + movq 64(%rsp), %r8 + movq 56(%rsp), %rcx + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $88, %rsp + movq 1776(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1776(%rax), %r11 + jmp *%r11 +1: + subq $88, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + movq %rcx, 56(%rsp) + movq %r8, 64(%rsp) + movq %r9, 72(%rsp) + call _glapi_get_dispatch + movq 72(%rsp), %r9 + movq 64(%rsp), %r8 + movq 56(%rsp), %rcx + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $88, %rsp + movq 1776(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMap2d, .-glMap2d + + .p2align 4,,15 + .globl glMap2f + .type glMap2f, @function +glMap2f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1784(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $88, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + movq %rcx, 56(%rsp) + movq %r8, 64(%rsp) + movq %r9, 72(%rsp) + call _x86_64_get_dispatch@PLT + movq 72(%rsp), %r9 + movq 64(%rsp), %r8 + movq 56(%rsp), %rcx + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $88, %rsp + movq 1784(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1784(%rax), %r11 + jmp *%r11 +1: + subq $88, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + movq %rcx, 56(%rsp) + movq %r8, 64(%rsp) + movq %r9, 72(%rsp) + call _glapi_get_dispatch + movq 72(%rsp), %r9 + movq 64(%rsp), %r8 + movq 56(%rsp), %rcx + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $88, %rsp + movq 1784(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMap2f, .-glMap2f + + .p2align 4,,15 + .globl glMapGrid1d + .type glMapGrid1d, @function +glMapGrid1d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1792(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1792(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1792(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1792(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMapGrid1d, .-glMapGrid1d + + .p2align 4,,15 + .globl glMapGrid1f + .type glMapGrid1f, @function +glMapGrid1f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1800(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1800(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1800(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1800(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMapGrid1f, .-glMapGrid1f + + .p2align 4,,15 + .globl glMapGrid2d + .type glMapGrid2d, @function +glMapGrid2d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1808(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1808(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1808(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1808(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMapGrid2d, .-glMapGrid2d + + .p2align 4,,15 + .globl glMapGrid2f + .type glMapGrid2f, @function +glMapGrid2f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1816(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1816(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1816(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1816(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMapGrid2f, .-glMapGrid2f + + .p2align 4,,15 + .globl glEvalCoord1d + .type glEvalCoord1d, @function +glEvalCoord1d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1824(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1824(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1824(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1824(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEvalCoord1d, .-glEvalCoord1d + + .p2align 4,,15 + .globl glEvalCoord1dv + .type glEvalCoord1dv, @function +glEvalCoord1dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1832(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1832(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1832(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1832(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEvalCoord1dv, .-glEvalCoord1dv + + .p2align 4,,15 + .globl glEvalCoord1f + .type glEvalCoord1f, @function +glEvalCoord1f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1840(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1840(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1840(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1840(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEvalCoord1f, .-glEvalCoord1f + + .p2align 4,,15 + .globl glEvalCoord1fv + .type glEvalCoord1fv, @function +glEvalCoord1fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1848(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1848(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1848(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1848(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEvalCoord1fv, .-glEvalCoord1fv + + .p2align 4,,15 + .globl glEvalCoord2d + .type glEvalCoord2d, @function +glEvalCoord2d: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1856(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1856(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1856(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1856(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEvalCoord2d, .-glEvalCoord2d + + .p2align 4,,15 + .globl glEvalCoord2dv + .type glEvalCoord2dv, @function +glEvalCoord2dv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1864(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1864(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1864(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1864(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEvalCoord2dv, .-glEvalCoord2dv + + .p2align 4,,15 + .globl glEvalCoord2f + .type glEvalCoord2f, @function +glEvalCoord2f: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1872(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1872(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1872(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1872(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEvalCoord2f, .-glEvalCoord2f + + .p2align 4,,15 + .globl glEvalCoord2fv + .type glEvalCoord2fv, @function +glEvalCoord2fv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1880(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1880(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1880(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1880(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEvalCoord2fv, .-glEvalCoord2fv + + .p2align 4,,15 + .globl glEvalMesh1 + .type glEvalMesh1, @function +glEvalMesh1: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1888(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1888(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1888(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1888(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEvalMesh1, .-glEvalMesh1 + + .p2align 4,,15 + .globl glEvalPoint1 + .type glEvalPoint1, @function +glEvalPoint1: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1896(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1896(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1896(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1896(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEvalPoint1, .-glEvalPoint1 + + .p2align 4,,15 + .globl glEvalMesh2 + .type glEvalMesh2, @function +glEvalMesh2: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1904(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1904(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1904(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1904(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEvalMesh2, .-glEvalMesh2 + + .p2align 4,,15 + .globl glEvalPoint2 + .type glEvalPoint2, @function +glEvalPoint2: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1912(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1912(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1912(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1912(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEvalPoint2, .-glEvalPoint2 + + .p2align 4,,15 + .globl glAlphaFunc + .type glAlphaFunc, @function +glAlphaFunc: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1920(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1920(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1920(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1920(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glAlphaFunc, .-glAlphaFunc + + .p2align 4,,15 + .globl glBlendFunc + .type glBlendFunc, @function +glBlendFunc: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1928(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1928(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1928(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1928(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBlendFunc, .-glBlendFunc + + .p2align 4,,15 + .globl glLogicOp + .type glLogicOp, @function +glLogicOp: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1936(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1936(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1936(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1936(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLogicOp, .-glLogicOp + + .p2align 4,,15 + .globl glStencilFunc + .type glStencilFunc, @function +glStencilFunc: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1944(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1944(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1944(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1944(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glStencilFunc, .-glStencilFunc + + .p2align 4,,15 + .globl glStencilOp + .type glStencilOp, @function +glStencilOp: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1952(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1952(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1952(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1952(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glStencilOp, .-glStencilOp + + .p2align 4,,15 + .globl glDepthFunc + .type glDepthFunc, @function +glDepthFunc: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1960(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1960(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1960(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1960(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDepthFunc, .-glDepthFunc + + .p2align 4,,15 + .globl glPixelZoom + .type glPixelZoom, @function +glPixelZoom: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1968(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1968(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1968(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1968(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPixelZoom, .-glPixelZoom + + .p2align 4,,15 + .globl glPixelTransferf + .type glPixelTransferf, @function +glPixelTransferf: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1976(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1976(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1976(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1976(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPixelTransferf, .-glPixelTransferf + + .p2align 4,,15 + .globl glPixelTransferi + .type glPixelTransferi, @function +glPixelTransferi: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1984(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1984(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1984(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1984(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPixelTransferi, .-glPixelTransferi + + .p2align 4,,15 + .globl glPixelStoref + .type glPixelStoref, @function +glPixelStoref: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1992(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1992(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1992(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1992(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPixelStoref, .-glPixelStoref + + .p2align 4,,15 + .globl glPixelStorei + .type glPixelStorei, @function +glPixelStorei: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2000(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2000(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2000(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2000(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPixelStorei, .-glPixelStorei + + .p2align 4,,15 + .globl glPixelMapfv + .type glPixelMapfv, @function +glPixelMapfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2008(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2008(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2008(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2008(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPixelMapfv, .-glPixelMapfv + + .p2align 4,,15 + .globl glPixelMapuiv + .type glPixelMapuiv, @function +glPixelMapuiv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2016(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2016(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2016(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2016(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPixelMapuiv, .-glPixelMapuiv + + .p2align 4,,15 + .globl glPixelMapusv + .type glPixelMapusv, @function +glPixelMapusv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2024(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2024(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2024(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2024(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPixelMapusv, .-glPixelMapusv + + .p2align 4,,15 + .globl glReadBuffer + .type glReadBuffer, @function +glReadBuffer: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2032(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2032(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2032(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2032(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glReadBuffer, .-glReadBuffer + + .p2align 4,,15 + .globl glCopyPixels + .type glCopyPixels, @function +glCopyPixels: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2040(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2040(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2040(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2040(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCopyPixels, .-glCopyPixels + + .p2align 4,,15 + .globl glReadPixels + .type glReadPixels, @function +glReadPixels: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2048(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2048(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2048(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2048(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glReadPixels, .-glReadPixels + + .p2align 4,,15 + .globl glDrawPixels + .type glDrawPixels, @function +glDrawPixels: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2056(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2056(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2056(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2056(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDrawPixels, .-glDrawPixels + + .p2align 4,,15 + .globl glGetBooleanv + .type glGetBooleanv, @function +glGetBooleanv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2064(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2064(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2064(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2064(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetBooleanv, .-glGetBooleanv + + .p2align 4,,15 + .globl glGetClipPlane + .type glGetClipPlane, @function +glGetClipPlane: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2072(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2072(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2072(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2072(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetClipPlane, .-glGetClipPlane + + .p2align 4,,15 + .globl glGetDoublev + .type glGetDoublev, @function +glGetDoublev: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2080(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2080(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2080(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2080(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetDoublev, .-glGetDoublev + + .p2align 4,,15 + .globl glGetError + .type glGetError, @function +glGetError: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2088(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 2088(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2088(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 2088(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetError, .-glGetError + + .p2align 4,,15 + .globl glGetFloatv + .type glGetFloatv, @function +glGetFloatv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2096(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2096(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2096(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2096(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetFloatv, .-glGetFloatv + + .p2align 4,,15 + .globl glGetIntegerv + .type glGetIntegerv, @function +glGetIntegerv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2104(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2104(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2104(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2104(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetIntegerv, .-glGetIntegerv + + .p2align 4,,15 + .globl glGetLightfv + .type glGetLightfv, @function +glGetLightfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2112(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2112(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2112(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2112(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetLightfv, .-glGetLightfv + + .p2align 4,,15 + .globl glGetLightiv + .type glGetLightiv, @function +glGetLightiv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2120(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2120(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2120(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2120(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetLightiv, .-glGetLightiv + + .p2align 4,,15 + .globl glGetMapdv + .type glGetMapdv, @function +glGetMapdv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2128(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2128(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2128(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2128(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetMapdv, .-glGetMapdv + + .p2align 4,,15 + .globl glGetMapfv + .type glGetMapfv, @function +glGetMapfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2136(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2136(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2136(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2136(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetMapfv, .-glGetMapfv + + .p2align 4,,15 + .globl glGetMapiv + .type glGetMapiv, @function +glGetMapiv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2144(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2144(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2144(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2144(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetMapiv, .-glGetMapiv + + .p2align 4,,15 + .globl glGetMaterialfv + .type glGetMaterialfv, @function +glGetMaterialfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2152(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2152(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2152(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2152(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetMaterialfv, .-glGetMaterialfv + + .p2align 4,,15 + .globl glGetMaterialiv + .type glGetMaterialiv, @function +glGetMaterialiv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2160(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2160(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2160(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2160(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetMaterialiv, .-glGetMaterialiv + + .p2align 4,,15 + .globl glGetPixelMapfv + .type glGetPixelMapfv, @function +glGetPixelMapfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2168(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2168(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2168(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2168(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetPixelMapfv, .-glGetPixelMapfv + + .p2align 4,,15 + .globl glGetPixelMapuiv + .type glGetPixelMapuiv, @function +glGetPixelMapuiv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2176(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2176(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2176(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2176(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetPixelMapuiv, .-glGetPixelMapuiv + + .p2align 4,,15 + .globl glGetPixelMapusv + .type glGetPixelMapusv, @function +glGetPixelMapusv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetPixelMapusv, .-glGetPixelMapusv + + .p2align 4,,15 + .globl glGetPolygonStipple + .type glGetPolygonStipple, @function +glGetPolygonStipple: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2192(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetPolygonStipple, .-glGetPolygonStipple + + .p2align 4,,15 + .globl glGetString + .type glGetString, @function +glGetString: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2200(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetString, .-glGetString + + .p2align 4,,15 + .globl glGetTexEnvfv + .type glGetTexEnvfv, @function +glGetTexEnvfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2208(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2208(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2208(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2208(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetTexEnvfv, .-glGetTexEnvfv + + .p2align 4,,15 + .globl glGetTexEnviv + .type glGetTexEnviv, @function +glGetTexEnviv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2216(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2216(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2216(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2216(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetTexEnviv, .-glGetTexEnviv + + .p2align 4,,15 + .globl glGetTexGendv + .type glGetTexGendv, @function +glGetTexGendv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2224(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2224(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2224(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2224(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetTexGendv, .-glGetTexGendv + + .p2align 4,,15 + .globl glGetTexGenfv + .type glGetTexGenfv, @function +glGetTexGenfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2232(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2232(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2232(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2232(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetTexGenfv, .-glGetTexGenfv + + .p2align 4,,15 + .globl glGetTexGeniv + .type glGetTexGeniv, @function +glGetTexGeniv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2240(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2240(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2240(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2240(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetTexGeniv, .-glGetTexGeniv + + .p2align 4,,15 + .globl glGetTexImage + .type glGetTexImage, @function +glGetTexImage: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2248(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2248(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetTexImage, .-glGetTexImage + + .p2align 4,,15 + .globl glGetTexParameterfv + .type glGetTexParameterfv, @function +glGetTexParameterfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2256(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2256(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2256(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2256(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetTexParameterfv, .-glGetTexParameterfv + + .p2align 4,,15 + .globl glGetTexParameteriv + .type glGetTexParameteriv, @function +glGetTexParameteriv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2264(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2264(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2264(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2264(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetTexParameteriv, .-glGetTexParameteriv + + .p2align 4,,15 + .globl glGetTexLevelParameterfv + .type glGetTexLevelParameterfv, @function +glGetTexLevelParameterfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2272(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2272(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2272(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2272(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetTexLevelParameterfv, .-glGetTexLevelParameterfv + + .p2align 4,,15 + .globl glGetTexLevelParameteriv + .type glGetTexLevelParameteriv, @function +glGetTexLevelParameteriv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2280(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2280(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2280(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2280(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetTexLevelParameteriv, .-glGetTexLevelParameteriv + + .p2align 4,,15 + .globl glIsEnabled + .type glIsEnabled, @function +glIsEnabled: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2288(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2288(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2288(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2288(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIsEnabled, .-glIsEnabled + + .p2align 4,,15 + .globl glIsList + .type glIsList, @function +glIsList: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2296(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2296(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2296(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2296(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIsList, .-glIsList + + .p2align 4,,15 + .globl glDepthRange + .type glDepthRange, @function +glDepthRange: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2304(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2304(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2304(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2304(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDepthRange, .-glDepthRange + + .p2align 4,,15 + .globl glFrustum + .type glFrustum, @function +glFrustum: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2312(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + movq %xmm4, 32(%rsp) + movq %xmm5, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm5 + movq 32(%rsp), %xmm4 + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $56, %rsp + movq 2312(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2312(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + movq %xmm4, 32(%rsp) + movq %xmm5, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm5 + movq 32(%rsp), %xmm4 + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $56, %rsp + movq 2312(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFrustum, .-glFrustum + + .p2align 4,,15 + .globl glLoadIdentity + .type glLoadIdentity, @function +glLoadIdentity: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2320(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 2320(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2320(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 2320(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLoadIdentity, .-glLoadIdentity + + .p2align 4,,15 + .globl glLoadMatrixf + .type glLoadMatrixf, @function +glLoadMatrixf: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2328(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2328(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2328(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2328(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLoadMatrixf, .-glLoadMatrixf + + .p2align 4,,15 + .globl glLoadMatrixd + .type glLoadMatrixd, @function +glLoadMatrixd: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2336(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2336(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2336(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2336(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLoadMatrixd, .-glLoadMatrixd + + .p2align 4,,15 + .globl glMatrixMode + .type glMatrixMode, @function +glMatrixMode: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2344(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2344(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2344(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2344(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMatrixMode, .-glMatrixMode + + .p2align 4,,15 + .globl glMultMatrixf + .type glMultMatrixf, @function +glMultMatrixf: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2352(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2352(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2352(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2352(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultMatrixf, .-glMultMatrixf + + .p2align 4,,15 + .globl glMultMatrixd + .type glMultMatrixd, @function +glMultMatrixd: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2360(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2360(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2360(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2360(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultMatrixd, .-glMultMatrixd + + .p2align 4,,15 + .globl glOrtho + .type glOrtho, @function +glOrtho: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2368(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + movq %xmm4, 32(%rsp) + movq %xmm5, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm5 + movq 32(%rsp), %xmm4 + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $56, %rsp + movq 2368(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2368(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + movq %xmm4, 32(%rsp) + movq %xmm5, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm5 + movq 32(%rsp), %xmm4 + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $56, %rsp + movq 2368(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glOrtho, .-glOrtho + + .p2align 4,,15 + .globl glPopMatrix + .type glPopMatrix, @function +glPopMatrix: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2376(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 2376(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2376(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 2376(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPopMatrix, .-glPopMatrix + + .p2align 4,,15 + .globl glPushMatrix + .type glPushMatrix, @function +glPushMatrix: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2384(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 2384(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2384(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 2384(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPushMatrix, .-glPushMatrix + + .p2align 4,,15 + .globl glRotated + .type glRotated, @function +glRotated: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2392(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 2392(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2392(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 2392(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRotated, .-glRotated + + .p2align 4,,15 + .globl glRotatef + .type glRotatef, @function +glRotatef: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2400(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 2400(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2400(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 2400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRotatef, .-glRotatef + + .p2align 4,,15 + .globl glScaled + .type glScaled, @function +glScaled: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2408(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glScaled, .-glScaled + + .p2align 4,,15 + .globl glScalef + .type glScalef, @function +glScalef: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2416(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2416(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glScalef, .-glScalef + + .p2align 4,,15 + .globl glTranslated + .type glTranslated, @function +glTranslated: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2424(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2424(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2424(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2424(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTranslated, .-glTranslated + + .p2align 4,,15 + .globl glTranslatef + .type glTranslatef, @function +glTranslatef: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2432(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2432(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2432(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2432(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTranslatef, .-glTranslatef + + .p2align 4,,15 + .globl glViewport + .type glViewport, @function +glViewport: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2440(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2440(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2440(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2440(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glViewport, .-glViewport + + .p2align 4,,15 + .globl glArrayElement + .type glArrayElement, @function +glArrayElement: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2448(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2448(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2448(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2448(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glArrayElement, .-glArrayElement + + .p2align 4,,15 + .globl glBindTexture + .type glBindTexture, @function +glBindTexture: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2456(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2456(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2456(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2456(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBindTexture, .-glBindTexture + + .p2align 4,,15 + .globl glColorPointer + .type glColorPointer, @function +glColorPointer: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2464(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2464(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2464(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2464(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColorPointer, .-glColorPointer + + .p2align 4,,15 + .globl glDisableClientState + .type glDisableClientState, @function +glDisableClientState: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2472(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2472(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2472(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2472(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDisableClientState, .-glDisableClientState + + .p2align 4,,15 + .globl glDrawArrays + .type glDrawArrays, @function +glDrawArrays: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2480(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2480(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2480(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2480(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDrawArrays, .-glDrawArrays + + .p2align 4,,15 + .globl glDrawElements + .type glDrawElements, @function +glDrawElements: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2488(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2488(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2488(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2488(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDrawElements, .-glDrawElements + + .p2align 4,,15 + .globl glEdgeFlagPointer + .type glEdgeFlagPointer, @function +glEdgeFlagPointer: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2496(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEdgeFlagPointer, .-glEdgeFlagPointer + + .p2align 4,,15 + .globl glEnableClientState + .type glEnableClientState, @function +glEnableClientState: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2504(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEnableClientState, .-glEnableClientState + + .p2align 4,,15 + .globl glIndexPointer + .type glIndexPointer, @function +glIndexPointer: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2512(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexPointer, .-glIndexPointer + + .p2align 4,,15 + .globl glIndexub + .type glIndexub, @function +glIndexub: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2520(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexub, .-glIndexub + + .p2align 4,,15 + .globl glIndexubv + .type glIndexubv, @function +glIndexubv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2528(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2528(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2528(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2528(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexubv, .-glIndexubv + + .p2align 4,,15 + .globl glInterleavedArrays + .type glInterleavedArrays, @function +glInterleavedArrays: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2536(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2536(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2536(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2536(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glInterleavedArrays, .-glInterleavedArrays + + .p2align 4,,15 + .globl glNormalPointer + .type glNormalPointer, @function +glNormalPointer: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2544(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2544(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2544(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2544(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glNormalPointer, .-glNormalPointer + + .p2align 4,,15 + .globl glPolygonOffset + .type glPolygonOffset, @function +glPolygonOffset: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2552(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2552(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2552(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2552(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPolygonOffset, .-glPolygonOffset + + .p2align 4,,15 + .globl glTexCoordPointer + .type glTexCoordPointer, @function +glTexCoordPointer: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2560(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2560(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2560(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2560(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoordPointer, .-glTexCoordPointer + + .p2align 4,,15 + .globl glVertexPointer + .type glVertexPointer, @function +glVertexPointer: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2568(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2568(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2568(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2568(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexPointer, .-glVertexPointer + + .p2align 4,,15 + .globl glAreTexturesResident + .type glAreTexturesResident, @function +glAreTexturesResident: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2576(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2576(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2576(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2576(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glAreTexturesResident, .-glAreTexturesResident + + .p2align 4,,15 + .globl glCopyTexImage1D + .type glCopyTexImage1D, @function +glCopyTexImage1D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2584(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2584(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2584(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2584(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCopyTexImage1D, .-glCopyTexImage1D + + .p2align 4,,15 + .globl glCopyTexImage2D + .type glCopyTexImage2D, @function +glCopyTexImage2D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2592(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2592(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2592(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2592(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCopyTexImage2D, .-glCopyTexImage2D + + .p2align 4,,15 + .globl glCopyTexSubImage1D + .type glCopyTexSubImage1D, @function +glCopyTexSubImage1D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2600(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2600(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2600(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2600(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCopyTexSubImage1D, .-glCopyTexSubImage1D + + .p2align 4,,15 + .globl glCopyTexSubImage2D + .type glCopyTexSubImage2D, @function +glCopyTexSubImage2D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2608(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2608(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2608(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2608(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCopyTexSubImage2D, .-glCopyTexSubImage2D + + .p2align 4,,15 + .globl glDeleteTextures + .type glDeleteTextures, @function +glDeleteTextures: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2616(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2616(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2616(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2616(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDeleteTextures, .-glDeleteTextures + + .p2align 4,,15 + .globl glGenTextures + .type glGenTextures, @function +glGenTextures: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2624(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2624(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2624(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2624(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGenTextures, .-glGenTextures + + .p2align 4,,15 + .globl glGetPointerv + .type glGetPointerv, @function +glGetPointerv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2632(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2632(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2632(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2632(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetPointerv, .-glGetPointerv + + .p2align 4,,15 + .globl glIsTexture + .type glIsTexture, @function +glIsTexture: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2640(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2640(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2640(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2640(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIsTexture, .-glIsTexture + + .p2align 4,,15 + .globl glPrioritizeTextures + .type glPrioritizeTextures, @function +glPrioritizeTextures: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2648(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2648(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2648(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2648(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPrioritizeTextures, .-glPrioritizeTextures + + .p2align 4,,15 + .globl glTexSubImage1D + .type glTexSubImage1D, @function +glTexSubImage1D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2656(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2656(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2656(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2656(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexSubImage1D, .-glTexSubImage1D + + .p2align 4,,15 + .globl glTexSubImage2D + .type glTexSubImage2D, @function +glTexSubImage2D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2664(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2664(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2664(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2664(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexSubImage2D, .-glTexSubImage2D + + .p2align 4,,15 + .globl glPopClientAttrib + .type glPopClientAttrib, @function +glPopClientAttrib: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2672(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 2672(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2672(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 2672(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPopClientAttrib, .-glPopClientAttrib + + .p2align 4,,15 + .globl glPushClientAttrib + .type glPushClientAttrib, @function +glPushClientAttrib: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2680(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2680(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2680(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2680(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPushClientAttrib, .-glPushClientAttrib + + .p2align 4,,15 + .globl glBlendColor + .type glBlendColor, @function +glBlendColor: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2688(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2688(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2688(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2688(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBlendColor, .-glBlendColor + + .p2align 4,,15 + .globl glBlendEquation + .type glBlendEquation, @function +glBlendEquation: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2696(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2696(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2696(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2696(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBlendEquation, .-glBlendEquation + + .p2align 4,,15 + .globl glDrawRangeElements + .type glDrawRangeElements, @function +glDrawRangeElements: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2704(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2704(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2704(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2704(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDrawRangeElements, .-glDrawRangeElements + + .p2align 4,,15 + .globl glColorTable + .type glColorTable, @function +glColorTable: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2712(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2712(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2712(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2712(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColorTable, .-glColorTable + + .p2align 4,,15 + .globl glColorTableParameterfv + .type glColorTableParameterfv, @function +glColorTableParameterfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2720(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2720(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2720(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2720(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColorTableParameterfv, .-glColorTableParameterfv + + .p2align 4,,15 + .globl glColorTableParameteriv + .type glColorTableParameteriv, @function +glColorTableParameteriv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2728(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2728(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2728(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2728(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColorTableParameteriv, .-glColorTableParameteriv + + .p2align 4,,15 + .globl glCopyColorTable + .type glCopyColorTable, @function +glCopyColorTable: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2736(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2736(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2736(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2736(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCopyColorTable, .-glCopyColorTable + + .p2align 4,,15 + .globl glGetColorTable + .type glGetColorTable, @function +glGetColorTable: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2744(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2744(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2744(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2744(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetColorTable, .-glGetColorTable + + .p2align 4,,15 + .globl glGetColorTableParameterfv + .type glGetColorTableParameterfv, @function +glGetColorTableParameterfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2752(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2752(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2752(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2752(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetColorTableParameterfv, .-glGetColorTableParameterfv + + .p2align 4,,15 + .globl glGetColorTableParameteriv + .type glGetColorTableParameteriv, @function +glGetColorTableParameteriv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2760(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2760(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2760(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2760(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetColorTableParameteriv, .-glGetColorTableParameteriv + + .p2align 4,,15 + .globl glColorSubTable + .type glColorSubTable, @function +glColorSubTable: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2768(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2768(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2768(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2768(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColorSubTable, .-glColorSubTable + + .p2align 4,,15 + .globl glCopyColorSubTable + .type glCopyColorSubTable, @function +glCopyColorSubTable: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2776(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2776(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2776(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2776(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCopyColorSubTable, .-glCopyColorSubTable + + .p2align 4,,15 + .globl glConvolutionFilter1D + .type glConvolutionFilter1D, @function +glConvolutionFilter1D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2784(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2784(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2784(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2784(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glConvolutionFilter1D, .-glConvolutionFilter1D + + .p2align 4,,15 + .globl glConvolutionFilter2D + .type glConvolutionFilter2D, @function +glConvolutionFilter2D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2792(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2792(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2792(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2792(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glConvolutionFilter2D, .-glConvolutionFilter2D + + .p2align 4,,15 + .globl glConvolutionParameterf + .type glConvolutionParameterf, @function +glConvolutionParameterf: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2800(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 2800(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2800(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 2800(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glConvolutionParameterf, .-glConvolutionParameterf + + .p2align 4,,15 + .globl glConvolutionParameterfv + .type glConvolutionParameterfv, @function +glConvolutionParameterfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2808(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2808(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2808(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2808(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glConvolutionParameterfv, .-glConvolutionParameterfv + + .p2align 4,,15 + .globl glConvolutionParameteri + .type glConvolutionParameteri, @function +glConvolutionParameteri: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2816(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2816(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2816(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2816(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glConvolutionParameteri, .-glConvolutionParameteri + + .p2align 4,,15 + .globl glConvolutionParameteriv + .type glConvolutionParameteriv, @function +glConvolutionParameteriv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2824(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2824(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2824(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2824(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glConvolutionParameteriv, .-glConvolutionParameteriv + + .p2align 4,,15 + .globl glCopyConvolutionFilter1D + .type glCopyConvolutionFilter1D, @function +glCopyConvolutionFilter1D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2832(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2832(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2832(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2832(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCopyConvolutionFilter1D, .-glCopyConvolutionFilter1D + + .p2align 4,,15 + .globl glCopyConvolutionFilter2D + .type glCopyConvolutionFilter2D, @function +glCopyConvolutionFilter2D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2840(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2840(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2840(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2840(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCopyConvolutionFilter2D, .-glCopyConvolutionFilter2D + + .p2align 4,,15 + .globl glGetConvolutionFilter + .type glGetConvolutionFilter, @function +glGetConvolutionFilter: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2848(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2848(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2848(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2848(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetConvolutionFilter, .-glGetConvolutionFilter + + .p2align 4,,15 + .globl glGetConvolutionParameterfv + .type glGetConvolutionParameterfv, @function +glGetConvolutionParameterfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2856(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2856(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2856(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2856(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetConvolutionParameterfv, .-glGetConvolutionParameterfv + + .p2align 4,,15 + .globl glGetConvolutionParameteriv + .type glGetConvolutionParameteriv, @function +glGetConvolutionParameteriv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2864(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2864(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2864(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2864(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetConvolutionParameteriv, .-glGetConvolutionParameteriv + + .p2align 4,,15 + .globl glGetSeparableFilter + .type glGetSeparableFilter, @function +glGetSeparableFilter: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2872(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2872(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2872(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2872(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetSeparableFilter, .-glGetSeparableFilter + + .p2align 4,,15 + .globl glSeparableFilter2D + .type glSeparableFilter2D, @function +glSeparableFilter2D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2880(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2880(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2880(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2880(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSeparableFilter2D, .-glSeparableFilter2D + + .p2align 4,,15 + .globl glGetHistogram + .type glGetHistogram, @function +glGetHistogram: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2888(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2888(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2888(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2888(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetHistogram, .-glGetHistogram + + .p2align 4,,15 + .globl glGetHistogramParameterfv + .type glGetHistogramParameterfv, @function +glGetHistogramParameterfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2896(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2896(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2896(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2896(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetHistogramParameterfv, .-glGetHistogramParameterfv + + .p2align 4,,15 + .globl glGetHistogramParameteriv + .type glGetHistogramParameteriv, @function +glGetHistogramParameteriv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2904(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2904(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2904(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2904(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetHistogramParameteriv, .-glGetHistogramParameteriv + + .p2align 4,,15 + .globl glGetMinmax + .type glGetMinmax, @function +glGetMinmax: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2912(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2912(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2912(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2912(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetMinmax, .-glGetMinmax + + .p2align 4,,15 + .globl glGetMinmaxParameterfv + .type glGetMinmaxParameterfv, @function +glGetMinmaxParameterfv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2920(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2920(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2920(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2920(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetMinmaxParameterfv, .-glGetMinmaxParameterfv + + .p2align 4,,15 + .globl glGetMinmaxParameteriv + .type glGetMinmaxParameteriv, @function +glGetMinmaxParameteriv: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2928(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2928(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2928(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2928(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetMinmaxParameteriv, .-glGetMinmaxParameteriv + + .p2align 4,,15 + .globl glHistogram + .type glHistogram, @function +glHistogram: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2936(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2936(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2936(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2936(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glHistogram, .-glHistogram + + .p2align 4,,15 + .globl glMinmax + .type glMinmax, @function +glMinmax: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2944(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2944(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2944(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2944(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMinmax, .-glMinmax + + .p2align 4,,15 + .globl glResetHistogram + .type glResetHistogram, @function +glResetHistogram: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2952(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2952(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2952(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2952(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glResetHistogram, .-glResetHistogram + + .p2align 4,,15 + .globl glResetMinmax + .type glResetMinmax, @function +glResetMinmax: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2960(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2960(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2960(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2960(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glResetMinmax, .-glResetMinmax + + .p2align 4,,15 + .globl glTexImage3D + .type glTexImage3D, @function +glTexImage3D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2968(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2968(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2968(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2968(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexImage3D, .-glTexImage3D + + .p2align 4,,15 + .globl glTexSubImage3D + .type glTexSubImage3D, @function +glTexSubImage3D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2976(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2976(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2976(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2976(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexSubImage3D, .-glTexSubImage3D + + .p2align 4,,15 + .globl glCopyTexSubImage3D + .type glCopyTexSubImage3D, @function +glCopyTexSubImage3D: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2984(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2984(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2984(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2984(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCopyTexSubImage3D, .-glCopyTexSubImage3D + + .p2align 4,,15 + .globl glActiveTextureARB + .type glActiveTextureARB, @function +glActiveTextureARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2992(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2992(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2992(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2992(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glActiveTextureARB, .-glActiveTextureARB + + .p2align 4,,15 + .globl glClientActiveTextureARB + .type glClientActiveTextureARB, @function +glClientActiveTextureARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3000(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3000(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3000(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3000(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glClientActiveTextureARB, .-glClientActiveTextureARB + + .p2align 4,,15 + .globl glMultiTexCoord1dARB + .type glMultiTexCoord1dARB, @function +glMultiTexCoord1dARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3008(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3008(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3008(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3008(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord1dARB, .-glMultiTexCoord1dARB + + .p2align 4,,15 + .globl glMultiTexCoord1dvARB + .type glMultiTexCoord1dvARB, @function +glMultiTexCoord1dvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3016(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3016(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3016(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3016(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord1dvARB, .-glMultiTexCoord1dvARB + + .p2align 4,,15 + .globl glMultiTexCoord1fARB + .type glMultiTexCoord1fARB, @function +glMultiTexCoord1fARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3024(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3024(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3024(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3024(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord1fARB, .-glMultiTexCoord1fARB + + .p2align 4,,15 + .globl glMultiTexCoord1fvARB + .type glMultiTexCoord1fvARB, @function +glMultiTexCoord1fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3032(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3032(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3032(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3032(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord1fvARB, .-glMultiTexCoord1fvARB + + .p2align 4,,15 + .globl glMultiTexCoord1iARB + .type glMultiTexCoord1iARB, @function +glMultiTexCoord1iARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3040(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3040(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3040(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3040(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord1iARB, .-glMultiTexCoord1iARB + + .p2align 4,,15 + .globl glMultiTexCoord1ivARB + .type glMultiTexCoord1ivARB, @function +glMultiTexCoord1ivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3048(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3048(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3048(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3048(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord1ivARB, .-glMultiTexCoord1ivARB + + .p2align 4,,15 + .globl glMultiTexCoord1sARB + .type glMultiTexCoord1sARB, @function +glMultiTexCoord1sARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3056(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3056(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3056(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3056(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord1sARB, .-glMultiTexCoord1sARB + + .p2align 4,,15 + .globl glMultiTexCoord1svARB + .type glMultiTexCoord1svARB, @function +glMultiTexCoord1svARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3064(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3064(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3064(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3064(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord1svARB, .-glMultiTexCoord1svARB + + .p2align 4,,15 + .globl glMultiTexCoord2dARB + .type glMultiTexCoord2dARB, @function +glMultiTexCoord2dARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3072(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3072(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3072(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3072(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord2dARB, .-glMultiTexCoord2dARB + + .p2align 4,,15 + .globl glMultiTexCoord2dvARB + .type glMultiTexCoord2dvARB, @function +glMultiTexCoord2dvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3080(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3080(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3080(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3080(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord2dvARB, .-glMultiTexCoord2dvARB + + .p2align 4,,15 + .globl glMultiTexCoord2fARB + .type glMultiTexCoord2fARB, @function +glMultiTexCoord2fARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3088(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3088(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3088(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3088(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord2fARB, .-glMultiTexCoord2fARB + + .p2align 4,,15 + .globl glMultiTexCoord2fvARB + .type glMultiTexCoord2fvARB, @function +glMultiTexCoord2fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3096(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3096(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3096(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3096(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord2fvARB, .-glMultiTexCoord2fvARB + + .p2align 4,,15 + .globl glMultiTexCoord2iARB + .type glMultiTexCoord2iARB, @function +glMultiTexCoord2iARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3104(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3104(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3104(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3104(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord2iARB, .-glMultiTexCoord2iARB + + .p2align 4,,15 + .globl glMultiTexCoord2ivARB + .type glMultiTexCoord2ivARB, @function +glMultiTexCoord2ivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3112(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3112(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3112(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3112(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord2ivARB, .-glMultiTexCoord2ivARB + + .p2align 4,,15 + .globl glMultiTexCoord2sARB + .type glMultiTexCoord2sARB, @function +glMultiTexCoord2sARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3120(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3120(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3120(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3120(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord2sARB, .-glMultiTexCoord2sARB + + .p2align 4,,15 + .globl glMultiTexCoord2svARB + .type glMultiTexCoord2svARB, @function +glMultiTexCoord2svARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3128(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3128(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3128(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3128(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord2svARB, .-glMultiTexCoord2svARB + + .p2align 4,,15 + .globl glMultiTexCoord3dARB + .type glMultiTexCoord3dARB, @function +glMultiTexCoord3dARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3136(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3136(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3136(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3136(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord3dARB, .-glMultiTexCoord3dARB + + .p2align 4,,15 + .globl glMultiTexCoord3dvARB + .type glMultiTexCoord3dvARB, @function +glMultiTexCoord3dvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3144(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3144(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3144(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3144(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord3dvARB, .-glMultiTexCoord3dvARB + + .p2align 4,,15 + .globl glMultiTexCoord3fARB + .type glMultiTexCoord3fARB, @function +glMultiTexCoord3fARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3152(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3152(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3152(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3152(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord3fARB, .-glMultiTexCoord3fARB + + .p2align 4,,15 + .globl glMultiTexCoord3fvARB + .type glMultiTexCoord3fvARB, @function +glMultiTexCoord3fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3160(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3160(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3160(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3160(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord3fvARB, .-glMultiTexCoord3fvARB + + .p2align 4,,15 + .globl glMultiTexCoord3iARB + .type glMultiTexCoord3iARB, @function +glMultiTexCoord3iARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3168(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3168(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3168(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3168(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord3iARB, .-glMultiTexCoord3iARB + + .p2align 4,,15 + .globl glMultiTexCoord3ivARB + .type glMultiTexCoord3ivARB, @function +glMultiTexCoord3ivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3176(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3176(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3176(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3176(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord3ivARB, .-glMultiTexCoord3ivARB + + .p2align 4,,15 + .globl glMultiTexCoord3sARB + .type glMultiTexCoord3sARB, @function +glMultiTexCoord3sARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord3sARB, .-glMultiTexCoord3sARB + + .p2align 4,,15 + .globl glMultiTexCoord3svARB + .type glMultiTexCoord3svARB, @function +glMultiTexCoord3svARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3192(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord3svARB, .-glMultiTexCoord3svARB + + .p2align 4,,15 + .globl glMultiTexCoord4dARB + .type glMultiTexCoord4dARB, @function +glMultiTexCoord4dARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _x86_64_get_dispatch@PLT + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3200(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _glapi_get_dispatch + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord4dARB, .-glMultiTexCoord4dARB + + .p2align 4,,15 + .globl glMultiTexCoord4dvARB + .type glMultiTexCoord4dvARB, @function +glMultiTexCoord4dvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3208(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3208(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3208(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3208(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord4dvARB, .-glMultiTexCoord4dvARB + + .p2align 4,,15 + .globl glMultiTexCoord4fARB + .type glMultiTexCoord4fARB, @function +glMultiTexCoord4fARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3216(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _x86_64_get_dispatch@PLT + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3216(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3216(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _glapi_get_dispatch + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3216(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord4fARB, .-glMultiTexCoord4fARB + + .p2align 4,,15 + .globl glMultiTexCoord4fvARB + .type glMultiTexCoord4fvARB, @function +glMultiTexCoord4fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3224(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3224(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3224(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3224(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord4fvARB, .-glMultiTexCoord4fvARB + + .p2align 4,,15 + .globl glMultiTexCoord4iARB + .type glMultiTexCoord4iARB, @function +glMultiTexCoord4iARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3232(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3232(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3232(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3232(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord4iARB, .-glMultiTexCoord4iARB + + .p2align 4,,15 + .globl glMultiTexCoord4ivARB + .type glMultiTexCoord4ivARB, @function +glMultiTexCoord4ivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3240(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3240(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3240(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3240(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord4ivARB, .-glMultiTexCoord4ivARB + + .p2align 4,,15 + .globl glMultiTexCoord4sARB + .type glMultiTexCoord4sARB, @function +glMultiTexCoord4sARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3248(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3248(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord4sARB, .-glMultiTexCoord4sARB + + .p2align 4,,15 + .globl glMultiTexCoord4svARB + .type glMultiTexCoord4svARB, @function +glMultiTexCoord4svARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3256(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3256(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3256(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3256(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiTexCoord4svARB, .-glMultiTexCoord4svARB + + .p2align 4,,15 + .globl glLoadTransposeMatrixfARB + .type glLoadTransposeMatrixfARB, @function +glLoadTransposeMatrixfARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3264(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3264(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3264(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3264(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLoadTransposeMatrixfARB, .-glLoadTransposeMatrixfARB + + .p2align 4,,15 + .globl glLoadTransposeMatrixdARB + .type glLoadTransposeMatrixdARB, @function +glLoadTransposeMatrixdARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3272(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3272(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3272(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3272(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLoadTransposeMatrixdARB, .-glLoadTransposeMatrixdARB + + .p2align 4,,15 + .globl glMultTransposeMatrixfARB + .type glMultTransposeMatrixfARB, @function +glMultTransposeMatrixfARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3280(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3280(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3280(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3280(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultTransposeMatrixfARB, .-glMultTransposeMatrixfARB + + .p2align 4,,15 + .globl glMultTransposeMatrixdARB + .type glMultTransposeMatrixdARB, @function +glMultTransposeMatrixdARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3288(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3288(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3288(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3288(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultTransposeMatrixdARB, .-glMultTransposeMatrixdARB + + .p2align 4,,15 + .globl glSampleCoverageARB + .type glSampleCoverageARB, @function +glSampleCoverageARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3296(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3296(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3296(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3296(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSampleCoverageARB, .-glSampleCoverageARB + + .p2align 4,,15 + .globl glDrawBuffersARB + .type glDrawBuffersARB, @function +glDrawBuffersARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3304(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3304(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3304(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3304(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDrawBuffersARB, .-glDrawBuffersARB + + .p2align 4,,15 + .globl glPolygonOffsetEXT + .type glPolygonOffsetEXT, @function +glPolygonOffsetEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3312(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 3312(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3312(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 3312(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPolygonOffsetEXT, .-glPolygonOffsetEXT + + .p2align 4,,15 + .globl glGetTexFilterFuncSGIS + .type glGetTexFilterFuncSGIS, @function +glGetTexFilterFuncSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3320(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3320(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3320(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3320(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetTexFilterFuncSGIS, .-glGetTexFilterFuncSGIS + + .p2align 4,,15 + .globl glTexFilterFuncSGIS + .type glTexFilterFuncSGIS, @function +glTexFilterFuncSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3328(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3328(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3328(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3328(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexFilterFuncSGIS, .-glTexFilterFuncSGIS + + .p2align 4,,15 + .globl glGetHistogramEXT + .type glGetHistogramEXT, @function +glGetHistogramEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3336(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3336(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3336(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3336(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetHistogramEXT, .-glGetHistogramEXT + + .p2align 4,,15 + .globl glGetHistogramParameterfvEXT + .type glGetHistogramParameterfvEXT, @function +glGetHistogramParameterfvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3344(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3344(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3344(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3344(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetHistogramParameterfvEXT, .-glGetHistogramParameterfvEXT + + .p2align 4,,15 + .globl glGetHistogramParameterivEXT + .type glGetHistogramParameterivEXT, @function +glGetHistogramParameterivEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3352(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3352(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3352(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3352(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetHistogramParameterivEXT, .-glGetHistogramParameterivEXT + + .p2align 4,,15 + .globl glGetMinmaxEXT + .type glGetMinmaxEXT, @function +glGetMinmaxEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3360(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3360(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3360(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3360(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetMinmaxEXT, .-glGetMinmaxEXT + + .p2align 4,,15 + .globl glGetMinmaxParameterfvEXT + .type glGetMinmaxParameterfvEXT, @function +glGetMinmaxParameterfvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3368(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3368(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3368(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3368(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetMinmaxParameterfvEXT, .-glGetMinmaxParameterfvEXT + + .p2align 4,,15 + .globl glGetMinmaxParameterivEXT + .type glGetMinmaxParameterivEXT, @function +glGetMinmaxParameterivEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3376(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3376(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3376(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3376(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetMinmaxParameterivEXT, .-glGetMinmaxParameterivEXT + + .p2align 4,,15 + .globl glGetConvolutionFilterEXT + .type glGetConvolutionFilterEXT, @function +glGetConvolutionFilterEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3384(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3384(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3384(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3384(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetConvolutionFilterEXT, .-glGetConvolutionFilterEXT + + .p2align 4,,15 + .globl glGetConvolutionParameterfvEXT + .type glGetConvolutionParameterfvEXT, @function +glGetConvolutionParameterfvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3392(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3392(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3392(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3392(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetConvolutionParameterfvEXT, .-glGetConvolutionParameterfvEXT + + .p2align 4,,15 + .globl glGetConvolutionParameterivEXT + .type glGetConvolutionParameterivEXT, @function +glGetConvolutionParameterivEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3400(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3400(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3400(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetConvolutionParameterivEXT, .-glGetConvolutionParameterivEXT + + .p2align 4,,15 + .globl glGetSeparableFilterEXT + .type glGetSeparableFilterEXT, @function +glGetSeparableFilterEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3408(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetSeparableFilterEXT, .-glGetSeparableFilterEXT + + .p2align 4,,15 + .globl glGetColorTableSGI + .type glGetColorTableSGI, @function +glGetColorTableSGI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3416(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3416(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetColorTableSGI, .-glGetColorTableSGI + + .p2align 4,,15 + .globl glGetColorTableParameterfvSGI + .type glGetColorTableParameterfvSGI, @function +glGetColorTableParameterfvSGI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3424(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3424(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3424(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3424(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetColorTableParameterfvSGI, .-glGetColorTableParameterfvSGI + + .p2align 4,,15 + .globl glGetColorTableParameterivSGI + .type glGetColorTableParameterivSGI, @function +glGetColorTableParameterivSGI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3432(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3432(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3432(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3432(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetColorTableParameterivSGI, .-glGetColorTableParameterivSGI + + .p2align 4,,15 + .globl glPixelTexGenSGIX + .type glPixelTexGenSGIX, @function +glPixelTexGenSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3440(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3440(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3440(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3440(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPixelTexGenSGIX, .-glPixelTexGenSGIX + + .p2align 4,,15 + .globl glPixelTexGenParameteriSGIS + .type glPixelTexGenParameteriSGIS, @function +glPixelTexGenParameteriSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3448(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3448(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3448(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3448(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPixelTexGenParameteriSGIS, .-glPixelTexGenParameteriSGIS + + .p2align 4,,15 + .globl glPixelTexGenParameterivSGIS + .type glPixelTexGenParameterivSGIS, @function +glPixelTexGenParameterivSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3456(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3456(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3456(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3456(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPixelTexGenParameterivSGIS, .-glPixelTexGenParameterivSGIS + + .p2align 4,,15 + .globl glPixelTexGenParameterfSGIS + .type glPixelTexGenParameterfSGIS, @function +glPixelTexGenParameterfSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3464(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3464(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3464(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3464(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPixelTexGenParameterfSGIS, .-glPixelTexGenParameterfSGIS + + .p2align 4,,15 + .globl glPixelTexGenParameterfvSGIS + .type glPixelTexGenParameterfvSGIS, @function +glPixelTexGenParameterfvSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3472(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3472(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3472(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3472(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPixelTexGenParameterfvSGIS, .-glPixelTexGenParameterfvSGIS + + .p2align 4,,15 + .globl glGetPixelTexGenParameterivSGIS + .type glGetPixelTexGenParameterivSGIS, @function +glGetPixelTexGenParameterivSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3480(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3480(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3480(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3480(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetPixelTexGenParameterivSGIS, .-glGetPixelTexGenParameterivSGIS + + .p2align 4,,15 + .globl glGetPixelTexGenParameterfvSGIS + .type glGetPixelTexGenParameterfvSGIS, @function +glGetPixelTexGenParameterfvSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3488(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3488(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3488(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3488(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetPixelTexGenParameterfvSGIS, .-glGetPixelTexGenParameterfvSGIS + + .p2align 4,,15 + .globl glTexImage4DSGIS + .type glTexImage4DSGIS, @function +glTexImage4DSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3496(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexImage4DSGIS, .-glTexImage4DSGIS + + .p2align 4,,15 + .globl glTexSubImage4DSGIS + .type glTexSubImage4DSGIS, @function +glTexSubImage4DSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3504(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexSubImage4DSGIS, .-glTexSubImage4DSGIS + + .p2align 4,,15 + .globl glAreTexturesResidentEXT + .type glAreTexturesResidentEXT, @function +glAreTexturesResidentEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3512(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glAreTexturesResidentEXT, .-glAreTexturesResidentEXT + + .p2align 4,,15 + .globl glGenTexturesEXT + .type glGenTexturesEXT, @function +glGenTexturesEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3520(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGenTexturesEXT, .-glGenTexturesEXT + + .p2align 4,,15 + .globl glIsTextureEXT + .type glIsTextureEXT, @function +glIsTextureEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3528(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3528(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3528(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3528(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIsTextureEXT, .-glIsTextureEXT + + .p2align 4,,15 + .globl glDetailTexFuncSGIS + .type glDetailTexFuncSGIS, @function +glDetailTexFuncSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3536(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3536(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3536(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3536(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDetailTexFuncSGIS, .-glDetailTexFuncSGIS + + .p2align 4,,15 + .globl glGetDetailTexFuncSGIS + .type glGetDetailTexFuncSGIS, @function +glGetDetailTexFuncSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3544(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3544(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3544(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3544(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetDetailTexFuncSGIS, .-glGetDetailTexFuncSGIS + + .p2align 4,,15 + .globl glSharpenTexFuncSGIS + .type glSharpenTexFuncSGIS, @function +glSharpenTexFuncSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3552(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3552(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3552(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3552(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSharpenTexFuncSGIS, .-glSharpenTexFuncSGIS + + .p2align 4,,15 + .globl glGetSharpenTexFuncSGIS + .type glGetSharpenTexFuncSGIS, @function +glGetSharpenTexFuncSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3560(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3560(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3560(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3560(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetSharpenTexFuncSGIS, .-glGetSharpenTexFuncSGIS + + .p2align 4,,15 + .globl glSampleMaskSGIS + .type glSampleMaskSGIS, @function +glSampleMaskSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3568(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3568(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3568(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3568(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSampleMaskSGIS, .-glSampleMaskSGIS + + .p2align 4,,15 + .globl glSamplePatternSGIS + .type glSamplePatternSGIS, @function +glSamplePatternSGIS: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3576(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3576(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3576(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3576(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSamplePatternSGIS, .-glSamplePatternSGIS + + .p2align 4,,15 + .globl glColorPointerEXT + .type glColorPointerEXT, @function +glColorPointerEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3584(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3584(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3584(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3584(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColorPointerEXT, .-glColorPointerEXT + + .p2align 4,,15 + .globl glEdgeFlagPointerEXT + .type glEdgeFlagPointerEXT, @function +glEdgeFlagPointerEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3592(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3592(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3592(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3592(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEdgeFlagPointerEXT, .-glEdgeFlagPointerEXT + + .p2align 4,,15 + .globl glIndexPointerEXT + .type glIndexPointerEXT, @function +glIndexPointerEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3600(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3600(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3600(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3600(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexPointerEXT, .-glIndexPointerEXT + + .p2align 4,,15 + .globl glNormalPointerEXT + .type glNormalPointerEXT, @function +glNormalPointerEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3608(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3608(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3608(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3608(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glNormalPointerEXT, .-glNormalPointerEXT + + .p2align 4,,15 + .globl glTexCoordPointerEXT + .type glTexCoordPointerEXT, @function +glTexCoordPointerEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3616(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3616(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3616(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3616(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTexCoordPointerEXT, .-glTexCoordPointerEXT + + .p2align 4,,15 + .globl glVertexPointerEXT + .type glVertexPointerEXT, @function +glVertexPointerEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3624(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3624(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3624(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3624(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexPointerEXT, .-glVertexPointerEXT + + .p2align 4,,15 + .globl glSpriteParameterfSGIX + .type glSpriteParameterfSGIX, @function +glSpriteParameterfSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3632(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3632(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3632(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3632(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSpriteParameterfSGIX, .-glSpriteParameterfSGIX + + .p2align 4,,15 + .globl glSpriteParameterfvSGIX + .type glSpriteParameterfvSGIX, @function +glSpriteParameterfvSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3640(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3640(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3640(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3640(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSpriteParameterfvSGIX, .-glSpriteParameterfvSGIX + + .p2align 4,,15 + .globl glSpriteParameteriSGIX + .type glSpriteParameteriSGIX, @function +glSpriteParameteriSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3648(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3648(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3648(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3648(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSpriteParameteriSGIX, .-glSpriteParameteriSGIX + + .p2align 4,,15 + .globl glSpriteParameterivSGIX + .type glSpriteParameterivSGIX, @function +glSpriteParameterivSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3656(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3656(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3656(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3656(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSpriteParameterivSGIX, .-glSpriteParameterivSGIX + + .p2align 4,,15 + .globl glPointParameterfEXT + .type glPointParameterfEXT, @function +glPointParameterfEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3664(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3664(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3664(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3664(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPointParameterfEXT, .-glPointParameterfEXT + + .p2align 4,,15 + .globl glPointParameterfvEXT + .type glPointParameterfvEXT, @function +glPointParameterfvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3672(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3672(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3672(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3672(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPointParameterfvEXT, .-glPointParameterfvEXT + + .p2align 4,,15 + .globl glGetInstrumentsSGIX + .type glGetInstrumentsSGIX, @function +glGetInstrumentsSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3680(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 3680(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3680(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 3680(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetInstrumentsSGIX, .-glGetInstrumentsSGIX + + .p2align 4,,15 + .globl glInstrumentsBufferSGIX + .type glInstrumentsBufferSGIX, @function +glInstrumentsBufferSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3688(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3688(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3688(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3688(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glInstrumentsBufferSGIX, .-glInstrumentsBufferSGIX + + .p2align 4,,15 + .globl glPollInstrumentsSGIX + .type glPollInstrumentsSGIX, @function +glPollInstrumentsSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3696(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3696(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3696(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3696(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPollInstrumentsSGIX, .-glPollInstrumentsSGIX + + .p2align 4,,15 + .globl glReadInstrumentsSGIX + .type glReadInstrumentsSGIX, @function +glReadInstrumentsSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3704(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3704(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3704(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3704(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glReadInstrumentsSGIX, .-glReadInstrumentsSGIX + + .p2align 4,,15 + .globl glStartInstrumentsSGIX + .type glStartInstrumentsSGIX, @function +glStartInstrumentsSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3712(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 3712(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3712(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 3712(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glStartInstrumentsSGIX, .-glStartInstrumentsSGIX + + .p2align 4,,15 + .globl glStopInstrumentsSGIX + .type glStopInstrumentsSGIX, @function +glStopInstrumentsSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3720(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3720(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3720(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3720(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glStopInstrumentsSGIX, .-glStopInstrumentsSGIX + + .p2align 4,,15 + .globl glFrameZoomSGIX + .type glFrameZoomSGIX, @function +glFrameZoomSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3728(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3728(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3728(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3728(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFrameZoomSGIX, .-glFrameZoomSGIX + + .p2align 4,,15 + .globl glTagSampleBufferSGIX + .type glTagSampleBufferSGIX, @function +glTagSampleBufferSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3736(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 3736(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3736(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 3736(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTagSampleBufferSGIX, .-glTagSampleBufferSGIX + + .p2align 4,,15 + .globl glReferencePlaneSGIX + .type glReferencePlaneSGIX, @function +glReferencePlaneSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3744(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3744(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3744(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3744(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glReferencePlaneSGIX, .-glReferencePlaneSGIX + + .p2align 4,,15 + .globl glFlushRasterSGIX + .type glFlushRasterSGIX, @function +glFlushRasterSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3752(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 3752(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3752(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 3752(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFlushRasterSGIX, .-glFlushRasterSGIX + + .p2align 4,,15 + .globl glGetListParameterfvSGIX + .type glGetListParameterfvSGIX, @function +glGetListParameterfvSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3760(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3760(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3760(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3760(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetListParameterfvSGIX, .-glGetListParameterfvSGIX + + .p2align 4,,15 + .globl glGetListParameterivSGIX + .type glGetListParameterivSGIX, @function +glGetListParameterivSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3768(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3768(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3768(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3768(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetListParameterivSGIX, .-glGetListParameterivSGIX + + .p2align 4,,15 + .globl glListParameterfSGIX + .type glListParameterfSGIX, @function +glListParameterfSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3776(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 3776(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3776(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 3776(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glListParameterfSGIX, .-glListParameterfSGIX + + .p2align 4,,15 + .globl glListParameterfvSGIX + .type glListParameterfvSGIX, @function +glListParameterfvSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3784(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3784(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3784(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3784(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glListParameterfvSGIX, .-glListParameterfvSGIX + + .p2align 4,,15 + .globl glListParameteriSGIX + .type glListParameteriSGIX, @function +glListParameteriSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3792(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3792(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3792(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3792(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glListParameteriSGIX, .-glListParameteriSGIX + + .p2align 4,,15 + .globl glListParameterivSGIX + .type glListParameterivSGIX, @function +glListParameterivSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3800(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3800(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3800(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3800(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glListParameterivSGIX, .-glListParameterivSGIX + + .p2align 4,,15 + .globl glFragmentColorMaterialSGIX + .type glFragmentColorMaterialSGIX, @function +glFragmentColorMaterialSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3808(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3808(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3808(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3808(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFragmentColorMaterialSGIX, .-glFragmentColorMaterialSGIX + + .p2align 4,,15 + .globl glFragmentLightfSGIX + .type glFragmentLightfSGIX, @function +glFragmentLightfSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3816(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 3816(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3816(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 3816(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFragmentLightfSGIX, .-glFragmentLightfSGIX + + .p2align 4,,15 + .globl glFragmentLightfvSGIX + .type glFragmentLightfvSGIX, @function +glFragmentLightfvSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3824(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3824(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3824(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3824(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFragmentLightfvSGIX, .-glFragmentLightfvSGIX + + .p2align 4,,15 + .globl glFragmentLightiSGIX + .type glFragmentLightiSGIX, @function +glFragmentLightiSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3832(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3832(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3832(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3832(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFragmentLightiSGIX, .-glFragmentLightiSGIX + + .p2align 4,,15 + .globl glFragmentLightivSGIX + .type glFragmentLightivSGIX, @function +glFragmentLightivSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3840(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3840(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3840(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3840(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFragmentLightivSGIX, .-glFragmentLightivSGIX + + .p2align 4,,15 + .globl glFragmentLightModelfSGIX + .type glFragmentLightModelfSGIX, @function +glFragmentLightModelfSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3848(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3848(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3848(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3848(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFragmentLightModelfSGIX, .-glFragmentLightModelfSGIX + + .p2align 4,,15 + .globl glFragmentLightModelfvSGIX + .type glFragmentLightModelfvSGIX, @function +glFragmentLightModelfvSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3856(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3856(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3856(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3856(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFragmentLightModelfvSGIX, .-glFragmentLightModelfvSGIX + + .p2align 4,,15 + .globl glFragmentLightModeliSGIX + .type glFragmentLightModeliSGIX, @function +glFragmentLightModeliSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3864(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3864(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3864(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3864(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFragmentLightModeliSGIX, .-glFragmentLightModeliSGIX + + .p2align 4,,15 + .globl glFragmentLightModelivSGIX + .type glFragmentLightModelivSGIX, @function +glFragmentLightModelivSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3872(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3872(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3872(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3872(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFragmentLightModelivSGIX, .-glFragmentLightModelivSGIX + + .p2align 4,,15 + .globl glFragmentMaterialfSGIX + .type glFragmentMaterialfSGIX, @function +glFragmentMaterialfSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3880(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 3880(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3880(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 3880(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFragmentMaterialfSGIX, .-glFragmentMaterialfSGIX + + .p2align 4,,15 + .globl glFragmentMaterialfvSGIX + .type glFragmentMaterialfvSGIX, @function +glFragmentMaterialfvSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3888(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3888(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3888(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3888(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFragmentMaterialfvSGIX, .-glFragmentMaterialfvSGIX + + .p2align 4,,15 + .globl glFragmentMaterialiSGIX + .type glFragmentMaterialiSGIX, @function +glFragmentMaterialiSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3896(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3896(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3896(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3896(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFragmentMaterialiSGIX, .-glFragmentMaterialiSGIX + + .p2align 4,,15 + .globl glFragmentMaterialivSGIX + .type glFragmentMaterialivSGIX, @function +glFragmentMaterialivSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3904(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3904(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3904(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3904(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFragmentMaterialivSGIX, .-glFragmentMaterialivSGIX + + .p2align 4,,15 + .globl glGetFragmentLightfvSGIX + .type glGetFragmentLightfvSGIX, @function +glGetFragmentLightfvSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3912(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3912(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3912(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3912(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetFragmentLightfvSGIX, .-glGetFragmentLightfvSGIX + + .p2align 4,,15 + .globl glGetFragmentLightivSGIX + .type glGetFragmentLightivSGIX, @function +glGetFragmentLightivSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3920(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3920(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3920(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3920(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetFragmentLightivSGIX, .-glGetFragmentLightivSGIX + + .p2align 4,,15 + .globl glGetFragmentMaterialfvSGIX + .type glGetFragmentMaterialfvSGIX, @function +glGetFragmentMaterialfvSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3928(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3928(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3928(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3928(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetFragmentMaterialfvSGIX, .-glGetFragmentMaterialfvSGIX + + .p2align 4,,15 + .globl glGetFragmentMaterialivSGIX + .type glGetFragmentMaterialivSGIX, @function +glGetFragmentMaterialivSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3936(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3936(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3936(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3936(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetFragmentMaterialivSGIX, .-glGetFragmentMaterialivSGIX + + .p2align 4,,15 + .globl glLightEnviSGIX + .type glLightEnviSGIX, @function +glLightEnviSGIX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3944(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3944(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3944(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3944(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLightEnviSGIX, .-glLightEnviSGIX + + .p2align 4,,15 + .globl glVertexWeightfEXT + .type glVertexWeightfEXT, @function +glVertexWeightfEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3952(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 3952(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3952(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 3952(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexWeightfEXT, .-glVertexWeightfEXT + + .p2align 4,,15 + .globl glVertexWeightfvEXT + .type glVertexWeightfvEXT, @function +glVertexWeightfvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3960(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3960(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3960(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3960(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexWeightfvEXT, .-glVertexWeightfvEXT + + .p2align 4,,15 + .globl glVertexWeightPointerEXT + .type glVertexWeightPointerEXT, @function +glVertexWeightPointerEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3968(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3968(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3968(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3968(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexWeightPointerEXT, .-glVertexWeightPointerEXT + + .p2align 4,,15 + .globl glFlushVertexArrayRangeNV + .type glFlushVertexArrayRangeNV, @function +glFlushVertexArrayRangeNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3976(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 3976(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3976(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 3976(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFlushVertexArrayRangeNV, .-glFlushVertexArrayRangeNV + + .p2align 4,,15 + .globl glVertexArrayRangeNV + .type glVertexArrayRangeNV, @function +glVertexArrayRangeNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3984(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3984(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3984(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3984(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexArrayRangeNV, .-glVertexArrayRangeNV + + .p2align 4,,15 + .globl glCombinerParameterfvNV + .type glCombinerParameterfvNV, @function +glCombinerParameterfvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3992(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3992(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3992(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3992(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCombinerParameterfvNV, .-glCombinerParameterfvNV + + .p2align 4,,15 + .globl glCombinerParameterfNV + .type glCombinerParameterfNV, @function +glCombinerParameterfNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4000(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4000(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4000(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4000(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCombinerParameterfNV, .-glCombinerParameterfNV + + .p2align 4,,15 + .globl glCombinerParameterivNV + .type glCombinerParameterivNV, @function +glCombinerParameterivNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4008(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4008(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4008(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4008(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCombinerParameterivNV, .-glCombinerParameterivNV + + .p2align 4,,15 + .globl glCombinerParameteriNV + .type glCombinerParameteriNV, @function +glCombinerParameteriNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4016(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4016(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4016(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4016(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCombinerParameteriNV, .-glCombinerParameteriNV + + .p2align 4,,15 + .globl glCombinerInputNV + .type glCombinerInputNV, @function +glCombinerInputNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4024(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4024(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4024(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4024(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCombinerInputNV, .-glCombinerInputNV + + .p2align 4,,15 + .globl glCombinerOutputNV + .type glCombinerOutputNV, @function +glCombinerOutputNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4032(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4032(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4032(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4032(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCombinerOutputNV, .-glCombinerOutputNV + + .p2align 4,,15 + .globl glFinalCombinerInputNV + .type glFinalCombinerInputNV, @function +glFinalCombinerInputNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4040(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4040(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4040(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4040(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFinalCombinerInputNV, .-glFinalCombinerInputNV + + .p2align 4,,15 + .globl glGetCombinerInputParameterfvNV + .type glGetCombinerInputParameterfvNV, @function +glGetCombinerInputParameterfvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4048(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4048(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4048(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4048(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetCombinerInputParameterfvNV, .-glGetCombinerInputParameterfvNV + + .p2align 4,,15 + .globl glGetCombinerInputParameterivNV + .type glGetCombinerInputParameterivNV, @function +glGetCombinerInputParameterivNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4056(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4056(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4056(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4056(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetCombinerInputParameterivNV, .-glGetCombinerInputParameterivNV + + .p2align 4,,15 + .globl glGetCombinerOutputParameterfvNV + .type glGetCombinerOutputParameterfvNV, @function +glGetCombinerOutputParameterfvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4064(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4064(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4064(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4064(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetCombinerOutputParameterfvNV, .-glGetCombinerOutputParameterfvNV + + .p2align 4,,15 + .globl glGetCombinerOutputParameterivNV + .type glGetCombinerOutputParameterivNV, @function +glGetCombinerOutputParameterivNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4072(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4072(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4072(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4072(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetCombinerOutputParameterivNV, .-glGetCombinerOutputParameterivNV + + .p2align 4,,15 + .globl glGetFinalCombinerInputParameterfvNV + .type glGetFinalCombinerInputParameterfvNV, @function +glGetFinalCombinerInputParameterfvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4080(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4080(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4080(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4080(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetFinalCombinerInputParameterfvNV, .-glGetFinalCombinerInputParameterfvNV + + .p2align 4,,15 + .globl glGetFinalCombinerInputParameterivNV + .type glGetFinalCombinerInputParameterivNV, @function +glGetFinalCombinerInputParameterivNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4088(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4088(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4088(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4088(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetFinalCombinerInputParameterivNV, .-glGetFinalCombinerInputParameterivNV + + .p2align 4,,15 + .globl glResizeBuffersMESA + .type glResizeBuffersMESA, @function +glResizeBuffersMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4096(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 4096(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4096(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 4096(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glResizeBuffersMESA, .-glResizeBuffersMESA + + .p2align 4,,15 + .globl glWindowPos2dMESA + .type glWindowPos2dMESA, @function +glWindowPos2dMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4104(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4104(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4104(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4104(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos2dMESA, .-glWindowPos2dMESA + + .p2align 4,,15 + .globl glWindowPos2dvMESA + .type glWindowPos2dvMESA, @function +glWindowPos2dvMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4112(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4112(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4112(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4112(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos2dvMESA, .-glWindowPos2dvMESA + + .p2align 4,,15 + .globl glWindowPos2fMESA + .type glWindowPos2fMESA, @function +glWindowPos2fMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4120(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4120(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4120(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4120(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos2fMESA, .-glWindowPos2fMESA + + .p2align 4,,15 + .globl glWindowPos2fvMESA + .type glWindowPos2fvMESA, @function +glWindowPos2fvMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4128(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4128(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4128(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4128(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos2fvMESA, .-glWindowPos2fvMESA + + .p2align 4,,15 + .globl glWindowPos2iMESA + .type glWindowPos2iMESA, @function +glWindowPos2iMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4136(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4136(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4136(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4136(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos2iMESA, .-glWindowPos2iMESA + + .p2align 4,,15 + .globl glWindowPos2ivMESA + .type glWindowPos2ivMESA, @function +glWindowPos2ivMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4144(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4144(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4144(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4144(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos2ivMESA, .-glWindowPos2ivMESA + + .p2align 4,,15 + .globl glWindowPos2sMESA + .type glWindowPos2sMESA, @function +glWindowPos2sMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4152(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4152(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4152(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4152(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos2sMESA, .-glWindowPos2sMESA + + .p2align 4,,15 + .globl glWindowPos2svMESA + .type glWindowPos2svMESA, @function +glWindowPos2svMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4160(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4160(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4160(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4160(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos2svMESA, .-glWindowPos2svMESA + + .p2align 4,,15 + .globl glWindowPos3dMESA + .type glWindowPos3dMESA, @function +glWindowPos3dMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4168(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4168(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4168(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4168(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos3dMESA, .-glWindowPos3dMESA + + .p2align 4,,15 + .globl glWindowPos3dvMESA + .type glWindowPos3dvMESA, @function +glWindowPos3dvMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4176(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4176(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4176(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4176(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos3dvMESA, .-glWindowPos3dvMESA + + .p2align 4,,15 + .globl glWindowPos3fMESA + .type glWindowPos3fMESA, @function +glWindowPos3fMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4184(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos3fMESA, .-glWindowPos3fMESA + + .p2align 4,,15 + .globl glWindowPos3fvMESA + .type glWindowPos3fvMESA, @function +glWindowPos3fvMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4192(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos3fvMESA, .-glWindowPos3fvMESA + + .p2align 4,,15 + .globl glWindowPos3iMESA + .type glWindowPos3iMESA, @function +glWindowPos3iMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4200(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos3iMESA, .-glWindowPos3iMESA + + .p2align 4,,15 + .globl glWindowPos3ivMESA + .type glWindowPos3ivMESA, @function +glWindowPos3ivMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4208(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4208(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4208(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4208(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos3ivMESA, .-glWindowPos3ivMESA + + .p2align 4,,15 + .globl glWindowPos3sMESA + .type glWindowPos3sMESA, @function +glWindowPos3sMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4216(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4216(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4216(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4216(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos3sMESA, .-glWindowPos3sMESA + + .p2align 4,,15 + .globl glWindowPos3svMESA + .type glWindowPos3svMESA, @function +glWindowPos3svMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4224(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4224(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4224(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4224(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos3svMESA, .-glWindowPos3svMESA + + .p2align 4,,15 + .globl glWindowPos4dMESA + .type glWindowPos4dMESA, @function +glWindowPos4dMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4232(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 4232(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4232(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 4232(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos4dMESA, .-glWindowPos4dMESA + + .p2align 4,,15 + .globl glWindowPos4dvMESA + .type glWindowPos4dvMESA, @function +glWindowPos4dvMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4240(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4240(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4240(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4240(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos4dvMESA, .-glWindowPos4dvMESA + + .p2align 4,,15 + .globl glWindowPos4fMESA + .type glWindowPos4fMESA, @function +glWindowPos4fMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4248(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 4248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4248(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 4248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos4fMESA, .-glWindowPos4fMESA + + .p2align 4,,15 + .globl glWindowPos4fvMESA + .type glWindowPos4fvMESA, @function +glWindowPos4fvMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4256(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4256(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4256(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4256(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos4fvMESA, .-glWindowPos4fvMESA + + .p2align 4,,15 + .globl glWindowPos4iMESA + .type glWindowPos4iMESA, @function +glWindowPos4iMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4264(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4264(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4264(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4264(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos4iMESA, .-glWindowPos4iMESA + + .p2align 4,,15 + .globl glWindowPos4ivMESA + .type glWindowPos4ivMESA, @function +glWindowPos4ivMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4272(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4272(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4272(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4272(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos4ivMESA, .-glWindowPos4ivMESA + + .p2align 4,,15 + .globl glWindowPos4sMESA + .type glWindowPos4sMESA, @function +glWindowPos4sMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4280(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4280(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4280(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4280(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos4sMESA, .-glWindowPos4sMESA + + .p2align 4,,15 + .globl glWindowPos4svMESA + .type glWindowPos4svMESA, @function +glWindowPos4svMESA: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4288(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4288(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4288(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4288(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glWindowPos4svMESA, .-glWindowPos4svMESA + + .p2align 4,,15 + .globl glBlendFuncSeparateEXT + .type glBlendFuncSeparateEXT, @function +glBlendFuncSeparateEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4296(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4296(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4296(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4296(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBlendFuncSeparateEXT, .-glBlendFuncSeparateEXT + + .p2align 4,,15 + .globl glIndexMaterialEXT + .type glIndexMaterialEXT, @function +glIndexMaterialEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4304(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4304(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4304(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4304(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexMaterialEXT, .-glIndexMaterialEXT + + .p2align 4,,15 + .globl glIndexFuncEXT + .type glIndexFuncEXT, @function +glIndexFuncEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4312(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4312(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4312(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4312(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIndexFuncEXT, .-glIndexFuncEXT + + .p2align 4,,15 + .globl glLockArraysEXT + .type glLockArraysEXT, @function +glLockArraysEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4320(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4320(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4320(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4320(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLockArraysEXT, .-glLockArraysEXT + + .p2align 4,,15 + .globl glUnlockArraysEXT + .type glUnlockArraysEXT, @function +glUnlockArraysEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4328(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 4328(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4328(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 4328(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUnlockArraysEXT, .-glUnlockArraysEXT + + .p2align 4,,15 + .globl glCullParameterdvEXT + .type glCullParameterdvEXT, @function +glCullParameterdvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4336(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4336(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4336(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4336(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCullParameterdvEXT, .-glCullParameterdvEXT + + .p2align 4,,15 + .globl glCullParameterfvEXT + .type glCullParameterfvEXT, @function +glCullParameterfvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4344(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4344(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4344(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4344(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCullParameterfvEXT, .-glCullParameterfvEXT + + .p2align 4,,15 + .globl glHintPGI + .type glHintPGI, @function +glHintPGI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4352(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4352(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4352(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4352(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glHintPGI, .-glHintPGI + + .p2align 4,,15 + .globl glFogCoordfEXT + .type glFogCoordfEXT, @function +glFogCoordfEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4360(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 4360(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4360(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 4360(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFogCoordfEXT, .-glFogCoordfEXT + + .p2align 4,,15 + .globl glFogCoordfvEXT + .type glFogCoordfvEXT, @function +glFogCoordfvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4368(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4368(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4368(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4368(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFogCoordfvEXT, .-glFogCoordfvEXT + + .p2align 4,,15 + .globl glFogCoorddEXT + .type glFogCoorddEXT, @function +glFogCoorddEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4376(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 4376(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4376(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 4376(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFogCoorddEXT, .-glFogCoorddEXT + + .p2align 4,,15 + .globl glFogCoorddvEXT + .type glFogCoorddvEXT, @function +glFogCoorddvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4384(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4384(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4384(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4384(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFogCoorddvEXT, .-glFogCoorddvEXT + + .p2align 4,,15 + .globl glFogCoordPointerEXT + .type glFogCoordPointerEXT, @function +glFogCoordPointerEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4392(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4392(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4392(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4392(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFogCoordPointerEXT, .-glFogCoordPointerEXT + + .p2align 4,,15 + .globl glGetColorTableEXT + .type glGetColorTableEXT, @function +glGetColorTableEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4400(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4400(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4400(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetColorTableEXT, .-glGetColorTableEXT + + .p2align 4,,15 + .globl glGetColorTableParameterivEXT + .type glGetColorTableParameterivEXT, @function +glGetColorTableParameterivEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4408(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetColorTableParameterivEXT, .-glGetColorTableParameterivEXT + + .p2align 4,,15 + .globl glGetColorTableParameterfvEXT + .type glGetColorTableParameterfvEXT, @function +glGetColorTableParameterfvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4416(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4416(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetColorTableParameterfvEXT, .-glGetColorTableParameterfvEXT + + .p2align 4,,15 + .globl glTbufferMask3DFX + .type glTbufferMask3DFX, @function +glTbufferMask3DFX: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4424(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4424(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4424(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4424(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTbufferMask3DFX, .-glTbufferMask3DFX + + .p2align 4,,15 + .globl glCompressedTexImage3DARB + .type glCompressedTexImage3DARB, @function +glCompressedTexImage3DARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4432(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4432(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4432(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4432(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCompressedTexImage3DARB, .-glCompressedTexImage3DARB + + .p2align 4,,15 + .globl glCompressedTexImage2DARB + .type glCompressedTexImage2DARB, @function +glCompressedTexImage2DARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4440(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4440(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4440(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4440(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCompressedTexImage2DARB, .-glCompressedTexImage2DARB + + .p2align 4,,15 + .globl glCompressedTexImage1DARB + .type glCompressedTexImage1DARB, @function +glCompressedTexImage1DARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4448(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4448(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4448(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4448(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCompressedTexImage1DARB, .-glCompressedTexImage1DARB + + .p2align 4,,15 + .globl glCompressedTexSubImage3DARB + .type glCompressedTexSubImage3DARB, @function +glCompressedTexSubImage3DARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4456(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4456(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4456(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4456(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCompressedTexSubImage3DARB, .-glCompressedTexSubImage3DARB + + .p2align 4,,15 + .globl glCompressedTexSubImage2DARB + .type glCompressedTexSubImage2DARB, @function +glCompressedTexSubImage2DARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4464(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4464(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4464(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4464(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCompressedTexSubImage2DARB, .-glCompressedTexSubImage2DARB + + .p2align 4,,15 + .globl glCompressedTexSubImage1DARB + .type glCompressedTexSubImage1DARB, @function +glCompressedTexSubImage1DARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4472(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4472(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4472(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4472(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCompressedTexSubImage1DARB, .-glCompressedTexSubImage1DARB + + .p2align 4,,15 + .globl glGetCompressedTexImageARB + .type glGetCompressedTexImageARB, @function +glGetCompressedTexImageARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4480(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4480(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4480(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4480(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetCompressedTexImageARB, .-glGetCompressedTexImageARB + + .p2align 4,,15 + .globl glSecondaryColor3bEXT + .type glSecondaryColor3bEXT, @function +glSecondaryColor3bEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4488(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4488(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4488(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4488(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3bEXT, .-glSecondaryColor3bEXT + + .p2align 4,,15 + .globl glSecondaryColor3bvEXT + .type glSecondaryColor3bvEXT, @function +glSecondaryColor3bvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4496(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3bvEXT, .-glSecondaryColor3bvEXT + + .p2align 4,,15 + .globl glSecondaryColor3dEXT + .type glSecondaryColor3dEXT, @function +glSecondaryColor3dEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4504(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3dEXT, .-glSecondaryColor3dEXT + + .p2align 4,,15 + .globl glSecondaryColor3dvEXT + .type glSecondaryColor3dvEXT, @function +glSecondaryColor3dvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4512(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3dvEXT, .-glSecondaryColor3dvEXT + + .p2align 4,,15 + .globl glSecondaryColor3fEXT + .type glSecondaryColor3fEXT, @function +glSecondaryColor3fEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4520(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3fEXT, .-glSecondaryColor3fEXT + + .p2align 4,,15 + .globl glSecondaryColor3fvEXT + .type glSecondaryColor3fvEXT, @function +glSecondaryColor3fvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4528(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4528(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4528(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4528(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3fvEXT, .-glSecondaryColor3fvEXT + + .p2align 4,,15 + .globl glSecondaryColor3iEXT + .type glSecondaryColor3iEXT, @function +glSecondaryColor3iEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4536(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4536(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4536(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4536(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3iEXT, .-glSecondaryColor3iEXT + + .p2align 4,,15 + .globl glSecondaryColor3ivEXT + .type glSecondaryColor3ivEXT, @function +glSecondaryColor3ivEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4544(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4544(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4544(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4544(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3ivEXT, .-glSecondaryColor3ivEXT + + .p2align 4,,15 + .globl glSecondaryColor3sEXT + .type glSecondaryColor3sEXT, @function +glSecondaryColor3sEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4552(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4552(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4552(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4552(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3sEXT, .-glSecondaryColor3sEXT + + .p2align 4,,15 + .globl glSecondaryColor3svEXT + .type glSecondaryColor3svEXT, @function +glSecondaryColor3svEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4560(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4560(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4560(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4560(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3svEXT, .-glSecondaryColor3svEXT + + .p2align 4,,15 + .globl glSecondaryColor3ubEXT + .type glSecondaryColor3ubEXT, @function +glSecondaryColor3ubEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4568(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4568(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4568(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4568(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3ubEXT, .-glSecondaryColor3ubEXT + + .p2align 4,,15 + .globl glSecondaryColor3ubvEXT + .type glSecondaryColor3ubvEXT, @function +glSecondaryColor3ubvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4576(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4576(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4576(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4576(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3ubvEXT, .-glSecondaryColor3ubvEXT + + .p2align 4,,15 + .globl glSecondaryColor3uiEXT + .type glSecondaryColor3uiEXT, @function +glSecondaryColor3uiEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4584(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4584(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4584(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4584(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3uiEXT, .-glSecondaryColor3uiEXT + + .p2align 4,,15 + .globl glSecondaryColor3uivEXT + .type glSecondaryColor3uivEXT, @function +glSecondaryColor3uivEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4592(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4592(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4592(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4592(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3uivEXT, .-glSecondaryColor3uivEXT + + .p2align 4,,15 + .globl glSecondaryColor3usEXT + .type glSecondaryColor3usEXT, @function +glSecondaryColor3usEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4600(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4600(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4600(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4600(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3usEXT, .-glSecondaryColor3usEXT + + .p2align 4,,15 + .globl glSecondaryColor3usvEXT + .type glSecondaryColor3usvEXT, @function +glSecondaryColor3usvEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4608(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4608(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4608(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4608(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColor3usvEXT, .-glSecondaryColor3usvEXT + + .p2align 4,,15 + .globl glSecondaryColorPointerEXT + .type glSecondaryColorPointerEXT, @function +glSecondaryColorPointerEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4616(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4616(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4616(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4616(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSecondaryColorPointerEXT, .-glSecondaryColorPointerEXT + + .p2align 4,,15 + .globl glAreProgramsResidentNV + .type glAreProgramsResidentNV, @function +glAreProgramsResidentNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4624(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4624(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4624(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4624(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glAreProgramsResidentNV, .-glAreProgramsResidentNV + + .p2align 4,,15 + .globl glBindProgramNV + .type glBindProgramNV, @function +glBindProgramNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4632(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4632(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4632(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4632(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBindProgramNV, .-glBindProgramNV + + .p2align 4,,15 + .globl glDeleteProgramsNV + .type glDeleteProgramsNV, @function +glDeleteProgramsNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4640(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4640(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4640(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4640(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDeleteProgramsNV, .-glDeleteProgramsNV + + .p2align 4,,15 + .globl glExecuteProgramNV + .type glExecuteProgramNV, @function +glExecuteProgramNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4648(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4648(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4648(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4648(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glExecuteProgramNV, .-glExecuteProgramNV + + .p2align 4,,15 + .globl glGenProgramsNV + .type glGenProgramsNV, @function +glGenProgramsNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4656(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4656(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4656(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4656(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGenProgramsNV, .-glGenProgramsNV + + .p2align 4,,15 + .globl glGetProgramParameterdvNV + .type glGetProgramParameterdvNV, @function +glGetProgramParameterdvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4664(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4664(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4664(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4664(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetProgramParameterdvNV, .-glGetProgramParameterdvNV + + .p2align 4,,15 + .globl glGetProgramParameterfvNV + .type glGetProgramParameterfvNV, @function +glGetProgramParameterfvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4672(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4672(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4672(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4672(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetProgramParameterfvNV, .-glGetProgramParameterfvNV + + .p2align 4,,15 + .globl glGetProgramivNV + .type glGetProgramivNV, @function +glGetProgramivNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4680(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4680(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4680(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4680(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetProgramivNV, .-glGetProgramivNV + + .p2align 4,,15 + .globl glGetProgramStringNV + .type glGetProgramStringNV, @function +glGetProgramStringNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4688(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4688(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4688(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4688(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetProgramStringNV, .-glGetProgramStringNV + + .p2align 4,,15 + .globl glGetTrackMatrixivNV + .type glGetTrackMatrixivNV, @function +glGetTrackMatrixivNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4696(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4696(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4696(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4696(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetTrackMatrixivNV, .-glGetTrackMatrixivNV + + .p2align 4,,15 + .globl glGetVertexAttribdvARB + .type glGetVertexAttribdvARB, @function +glGetVertexAttribdvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4704(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4704(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4704(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4704(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetVertexAttribdvARB, .-glGetVertexAttribdvARB + + .p2align 4,,15 + .globl glGetVertexAttribfvARB + .type glGetVertexAttribfvARB, @function +glGetVertexAttribfvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4712(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4712(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4712(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4712(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetVertexAttribfvARB, .-glGetVertexAttribfvARB + + .p2align 4,,15 + .globl glGetVertexAttribivARB + .type glGetVertexAttribivARB, @function +glGetVertexAttribivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4720(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4720(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4720(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4720(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetVertexAttribivARB, .-glGetVertexAttribivARB + + .p2align 4,,15 + .globl glGetVertexAttribPointervNV + .type glGetVertexAttribPointervNV, @function +glGetVertexAttribPointervNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4728(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4728(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4728(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4728(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetVertexAttribPointervNV, .-glGetVertexAttribPointervNV + + .p2align 4,,15 + .globl glIsProgramNV + .type glIsProgramNV, @function +glIsProgramNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4736(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4736(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4736(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4736(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIsProgramNV, .-glIsProgramNV + + .p2align 4,,15 + .globl glLoadProgramNV + .type glLoadProgramNV, @function +glLoadProgramNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4744(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4744(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4744(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4744(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLoadProgramNV, .-glLoadProgramNV + + .p2align 4,,15 + .globl glProgramParameter4dNV + .type glProgramParameter4dNV, @function +glProgramParameter4dNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4752(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 4752(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4752(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 4752(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramParameter4dNV, .-glProgramParameter4dNV + + .p2align 4,,15 + .globl glProgramParameter4dvNV + .type glProgramParameter4dvNV, @function +glProgramParameter4dvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4760(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4760(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4760(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4760(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramParameter4dvNV, .-glProgramParameter4dvNV + + .p2align 4,,15 + .globl glProgramParameter4fNV + .type glProgramParameter4fNV, @function +glProgramParameter4fNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4768(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 4768(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4768(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 4768(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramParameter4fNV, .-glProgramParameter4fNV + + .p2align 4,,15 + .globl glProgramParameter4fvNV + .type glProgramParameter4fvNV, @function +glProgramParameter4fvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4776(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4776(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4776(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4776(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramParameter4fvNV, .-glProgramParameter4fvNV + + .p2align 4,,15 + .globl glProgramParameters4dvNV + .type glProgramParameters4dvNV, @function +glProgramParameters4dvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4784(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4784(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4784(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4784(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramParameters4dvNV, .-glProgramParameters4dvNV + + .p2align 4,,15 + .globl glProgramParameters4fvNV + .type glProgramParameters4fvNV, @function +glProgramParameters4fvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4792(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4792(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4792(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4792(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramParameters4fvNV, .-glProgramParameters4fvNV + + .p2align 4,,15 + .globl glRequestResidentProgramsNV + .type glRequestResidentProgramsNV, @function +glRequestResidentProgramsNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4800(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4800(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4800(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4800(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRequestResidentProgramsNV, .-glRequestResidentProgramsNV + + .p2align 4,,15 + .globl glTrackMatrixNV + .type glTrackMatrixNV, @function +glTrackMatrixNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4808(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4808(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4808(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4808(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTrackMatrixNV, .-glTrackMatrixNV + + .p2align 4,,15 + .globl glVertexAttribPointerNV + .type glVertexAttribPointerNV, @function +glVertexAttribPointerNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4816(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4816(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4816(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4816(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribPointerNV, .-glVertexAttribPointerNV + + .p2align 4,,15 + .globl glVertexAttrib1dARB + .type glVertexAttrib1dARB, @function +glVertexAttrib1dARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4824(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4824(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4824(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4824(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib1dARB, .-glVertexAttrib1dARB + + .p2align 4,,15 + .globl glVertexAttrib1dvARB + .type glVertexAttrib1dvARB, @function +glVertexAttrib1dvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4832(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4832(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4832(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4832(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib1dvARB, .-glVertexAttrib1dvARB + + .p2align 4,,15 + .globl glVertexAttrib1fARB + .type glVertexAttrib1fARB, @function +glVertexAttrib1fARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4840(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4840(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4840(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4840(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib1fARB, .-glVertexAttrib1fARB + + .p2align 4,,15 + .globl glVertexAttrib1fvARB + .type glVertexAttrib1fvARB, @function +glVertexAttrib1fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4848(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4848(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4848(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4848(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib1fvARB, .-glVertexAttrib1fvARB + + .p2align 4,,15 + .globl glVertexAttrib1sARB + .type glVertexAttrib1sARB, @function +glVertexAttrib1sARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4856(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4856(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4856(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4856(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib1sARB, .-glVertexAttrib1sARB + + .p2align 4,,15 + .globl glVertexAttrib1svARB + .type glVertexAttrib1svARB, @function +glVertexAttrib1svARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4864(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4864(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4864(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4864(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib1svARB, .-glVertexAttrib1svARB + + .p2align 4,,15 + .globl glVertexAttrib2dARB + .type glVertexAttrib2dARB, @function +glVertexAttrib2dARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4872(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4872(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4872(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4872(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib2dARB, .-glVertexAttrib2dARB + + .p2align 4,,15 + .globl glVertexAttrib2dvARB + .type glVertexAttrib2dvARB, @function +glVertexAttrib2dvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4880(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4880(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4880(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4880(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib2dvARB, .-glVertexAttrib2dvARB + + .p2align 4,,15 + .globl glVertexAttrib2fARB + .type glVertexAttrib2fARB, @function +glVertexAttrib2fARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4888(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4888(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4888(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4888(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib2fARB, .-glVertexAttrib2fARB + + .p2align 4,,15 + .globl glVertexAttrib2fvARB + .type glVertexAttrib2fvARB, @function +glVertexAttrib2fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4896(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4896(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4896(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4896(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib2fvARB, .-glVertexAttrib2fvARB + + .p2align 4,,15 + .globl glVertexAttrib2sARB + .type glVertexAttrib2sARB, @function +glVertexAttrib2sARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4904(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4904(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4904(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4904(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib2sARB, .-glVertexAttrib2sARB + + .p2align 4,,15 + .globl glVertexAttrib2svARB + .type glVertexAttrib2svARB, @function +glVertexAttrib2svARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4912(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4912(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4912(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4912(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib2svARB, .-glVertexAttrib2svARB + + .p2align 4,,15 + .globl glVertexAttrib3dARB + .type glVertexAttrib3dARB, @function +glVertexAttrib3dARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4920(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 4920(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4920(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 4920(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib3dARB, .-glVertexAttrib3dARB + + .p2align 4,,15 + .globl glVertexAttrib3dvARB + .type glVertexAttrib3dvARB, @function +glVertexAttrib3dvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4928(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4928(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4928(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4928(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib3dvARB, .-glVertexAttrib3dvARB + + .p2align 4,,15 + .globl glVertexAttrib3fARB + .type glVertexAttrib3fARB, @function +glVertexAttrib3fARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4936(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 4936(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4936(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 4936(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib3fARB, .-glVertexAttrib3fARB + + .p2align 4,,15 + .globl glVertexAttrib3fvARB + .type glVertexAttrib3fvARB, @function +glVertexAttrib3fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4944(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4944(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4944(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4944(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib3fvARB, .-glVertexAttrib3fvARB + + .p2align 4,,15 + .globl glVertexAttrib3sARB + .type glVertexAttrib3sARB, @function +glVertexAttrib3sARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4952(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4952(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4952(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4952(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib3sARB, .-glVertexAttrib3sARB + + .p2align 4,,15 + .globl glVertexAttrib3svARB + .type glVertexAttrib3svARB, @function +glVertexAttrib3svARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4960(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4960(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4960(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4960(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib3svARB, .-glVertexAttrib3svARB + + .p2align 4,,15 + .globl glVertexAttrib4dARB + .type glVertexAttrib4dARB, @function +glVertexAttrib4dARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4968(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _x86_64_get_dispatch@PLT + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 4968(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4968(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _glapi_get_dispatch + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 4968(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4dARB, .-glVertexAttrib4dARB + + .p2align 4,,15 + .globl glVertexAttrib4dvARB + .type glVertexAttrib4dvARB, @function +glVertexAttrib4dvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4976(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4976(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4976(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4976(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4dvARB, .-glVertexAttrib4dvARB + + .p2align 4,,15 + .globl glVertexAttrib4fARB + .type glVertexAttrib4fARB, @function +glVertexAttrib4fARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4984(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _x86_64_get_dispatch@PLT + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 4984(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4984(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _glapi_get_dispatch + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 4984(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4fARB, .-glVertexAttrib4fARB + + .p2align 4,,15 + .globl glVertexAttrib4fvARB + .type glVertexAttrib4fvARB, @function +glVertexAttrib4fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4992(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4992(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4992(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4992(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4fvARB, .-glVertexAttrib4fvARB + + .p2align 4,,15 + .globl glVertexAttrib4sARB + .type glVertexAttrib4sARB, @function +glVertexAttrib4sARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5000(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5000(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5000(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5000(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4sARB, .-glVertexAttrib4sARB + + .p2align 4,,15 + .globl glVertexAttrib4svARB + .type glVertexAttrib4svARB, @function +glVertexAttrib4svARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5008(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5008(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5008(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5008(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4svARB, .-glVertexAttrib4svARB + + .p2align 4,,15 + .globl glVertexAttrib4NubARB + .type glVertexAttrib4NubARB, @function +glVertexAttrib4NubARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5016(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5016(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5016(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5016(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4NubARB, .-glVertexAttrib4NubARB + + .p2align 4,,15 + .globl glVertexAttrib4NubvARB + .type glVertexAttrib4NubvARB, @function +glVertexAttrib4NubvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5024(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5024(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5024(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5024(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4NubvARB, .-glVertexAttrib4NubvARB + + .p2align 4,,15 + .globl glVertexAttribs1dvNV + .type glVertexAttribs1dvNV, @function +glVertexAttribs1dvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5032(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5032(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5032(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5032(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribs1dvNV, .-glVertexAttribs1dvNV + + .p2align 4,,15 + .globl glVertexAttribs1fvNV + .type glVertexAttribs1fvNV, @function +glVertexAttribs1fvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5040(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5040(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5040(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5040(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribs1fvNV, .-glVertexAttribs1fvNV + + .p2align 4,,15 + .globl glVertexAttribs1svNV + .type glVertexAttribs1svNV, @function +glVertexAttribs1svNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5048(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5048(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5048(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5048(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribs1svNV, .-glVertexAttribs1svNV + + .p2align 4,,15 + .globl glVertexAttribs2dvNV + .type glVertexAttribs2dvNV, @function +glVertexAttribs2dvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5056(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5056(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5056(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5056(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribs2dvNV, .-glVertexAttribs2dvNV + + .p2align 4,,15 + .globl glVertexAttribs2fvNV + .type glVertexAttribs2fvNV, @function +glVertexAttribs2fvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5064(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5064(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5064(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5064(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribs2fvNV, .-glVertexAttribs2fvNV + + .p2align 4,,15 + .globl glVertexAttribs2svNV + .type glVertexAttribs2svNV, @function +glVertexAttribs2svNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5072(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5072(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5072(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5072(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribs2svNV, .-glVertexAttribs2svNV + + .p2align 4,,15 + .globl glVertexAttribs3dvNV + .type glVertexAttribs3dvNV, @function +glVertexAttribs3dvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5080(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5080(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5080(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5080(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribs3dvNV, .-glVertexAttribs3dvNV + + .p2align 4,,15 + .globl glVertexAttribs3fvNV + .type glVertexAttribs3fvNV, @function +glVertexAttribs3fvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5088(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5088(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5088(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5088(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribs3fvNV, .-glVertexAttribs3fvNV + + .p2align 4,,15 + .globl glVertexAttribs3svNV + .type glVertexAttribs3svNV, @function +glVertexAttribs3svNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5096(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5096(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5096(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5096(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribs3svNV, .-glVertexAttribs3svNV + + .p2align 4,,15 + .globl glVertexAttribs4dvNV + .type glVertexAttribs4dvNV, @function +glVertexAttribs4dvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5104(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5104(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5104(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5104(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribs4dvNV, .-glVertexAttribs4dvNV + + .p2align 4,,15 + .globl glVertexAttribs4fvNV + .type glVertexAttribs4fvNV, @function +glVertexAttribs4fvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5112(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5112(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5112(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5112(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribs4fvNV, .-glVertexAttribs4fvNV + + .p2align 4,,15 + .globl glVertexAttribs4svNV + .type glVertexAttribs4svNV, @function +glVertexAttribs4svNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5120(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5120(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5120(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5120(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribs4svNV, .-glVertexAttribs4svNV + + .p2align 4,,15 + .globl glVertexAttribs4ubvNV + .type glVertexAttribs4ubvNV, @function +glVertexAttribs4ubvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5128(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5128(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5128(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5128(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribs4ubvNV, .-glVertexAttribs4ubvNV + + .p2align 4,,15 + .globl glPointParameteriNV + .type glPointParameteriNV, @function +glPointParameteriNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5136(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5136(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5136(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5136(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPointParameteriNV, .-glPointParameteriNV + + .p2align 4,,15 + .globl glPointParameterivNV + .type glPointParameterivNV, @function +glPointParameterivNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5144(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5144(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5144(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5144(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPointParameterivNV, .-glPointParameterivNV + + .p2align 4,,15 + .globl glMultiDrawArraysEXT + .type glMultiDrawArraysEXT, @function +glMultiDrawArraysEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5152(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5152(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5152(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5152(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiDrawArraysEXT, .-glMultiDrawArraysEXT + + .p2align 4,,15 + .globl glMultiDrawElementsEXT + .type glMultiDrawElementsEXT, @function +glMultiDrawElementsEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5160(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5160(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5160(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5160(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiDrawElementsEXT, .-glMultiDrawElementsEXT + + .p2align 4,,15 + .globl glActiveStencilFaceEXT + .type glActiveStencilFaceEXT, @function +glActiveStencilFaceEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5168(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5168(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5168(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5168(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glActiveStencilFaceEXT, .-glActiveStencilFaceEXT + + .p2align 4,,15 + .globl glDeleteFencesNV + .type glDeleteFencesNV, @function +glDeleteFencesNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5176(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5176(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5176(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5176(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDeleteFencesNV, .-glDeleteFencesNV + + .p2align 4,,15 + .globl glGenFencesNV + .type glGenFencesNV, @function +glGenFencesNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGenFencesNV, .-glGenFencesNV + + .p2align 4,,15 + .globl glIsFenceNV + .type glIsFenceNV, @function +glIsFenceNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5192(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIsFenceNV, .-glIsFenceNV + + .p2align 4,,15 + .globl glTestFenceNV + .type glTestFenceNV, @function +glTestFenceNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5200(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glTestFenceNV, .-glTestFenceNV + + .p2align 4,,15 + .globl glGetFenceivNV + .type glGetFenceivNV, @function +glGetFenceivNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5208(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5208(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5208(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5208(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetFenceivNV, .-glGetFenceivNV + + .p2align 4,,15 + .globl glFinishFenceNV + .type glFinishFenceNV, @function +glFinishFenceNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5216(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5216(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5216(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5216(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFinishFenceNV, .-glFinishFenceNV + + .p2align 4,,15 + .globl glSetFenceNV + .type glSetFenceNV, @function +glSetFenceNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5224(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5224(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5224(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5224(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSetFenceNV, .-glSetFenceNV + + .p2align 4,,15 + .globl glVertexAttrib4bvARB + .type glVertexAttrib4bvARB, @function +glVertexAttrib4bvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5232(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5232(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5232(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5232(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4bvARB, .-glVertexAttrib4bvARB + + .p2align 4,,15 + .globl glVertexAttrib4ivARB + .type glVertexAttrib4ivARB, @function +glVertexAttrib4ivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5240(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5240(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5240(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5240(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4ivARB, .-glVertexAttrib4ivARB + + .p2align 4,,15 + .globl glVertexAttrib4ubvARB + .type glVertexAttrib4ubvARB, @function +glVertexAttrib4ubvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5248(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5248(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4ubvARB, .-glVertexAttrib4ubvARB + + .p2align 4,,15 + .globl glVertexAttrib4usvARB + .type glVertexAttrib4usvARB, @function +glVertexAttrib4usvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5256(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5256(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5256(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5256(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4usvARB, .-glVertexAttrib4usvARB + + .p2align 4,,15 + .globl glVertexAttrib4uivARB + .type glVertexAttrib4uivARB, @function +glVertexAttrib4uivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5264(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5264(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5264(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5264(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4uivARB, .-glVertexAttrib4uivARB + + .p2align 4,,15 + .globl glVertexAttrib4NbvARB + .type glVertexAttrib4NbvARB, @function +glVertexAttrib4NbvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5272(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5272(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5272(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5272(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4NbvARB, .-glVertexAttrib4NbvARB + + .p2align 4,,15 + .globl glVertexAttrib4NsvARB + .type glVertexAttrib4NsvARB, @function +glVertexAttrib4NsvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5280(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5280(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5280(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5280(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4NsvARB, .-glVertexAttrib4NsvARB + + .p2align 4,,15 + .globl glVertexAttrib4NivARB + .type glVertexAttrib4NivARB, @function +glVertexAttrib4NivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5288(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5288(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5288(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5288(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4NivARB, .-glVertexAttrib4NivARB + + .p2align 4,,15 + .globl glVertexAttrib4NusvARB + .type glVertexAttrib4NusvARB, @function +glVertexAttrib4NusvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5296(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5296(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5296(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5296(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4NusvARB, .-glVertexAttrib4NusvARB + + .p2align 4,,15 + .globl glVertexAttrib4NuivARB + .type glVertexAttrib4NuivARB, @function +glVertexAttrib4NuivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5304(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5304(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5304(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5304(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4NuivARB, .-glVertexAttrib4NuivARB + + .p2align 4,,15 + .globl glVertexAttribPointerARB + .type glVertexAttribPointerARB, @function +glVertexAttribPointerARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5312(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5312(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5312(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5312(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttribPointerARB, .-glVertexAttribPointerARB + + .p2align 4,,15 + .globl glEnableVertexAttribArrayARB + .type glEnableVertexAttribArrayARB, @function +glEnableVertexAttribArrayARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5320(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5320(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5320(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5320(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEnableVertexAttribArrayARB, .-glEnableVertexAttribArrayARB + + .p2align 4,,15 + .globl glDisableVertexAttribArrayARB + .type glDisableVertexAttribArrayARB, @function +glDisableVertexAttribArrayARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5328(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5328(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5328(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5328(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDisableVertexAttribArrayARB, .-glDisableVertexAttribArrayARB + + .p2align 4,,15 + .globl glProgramStringARB + .type glProgramStringARB, @function +glProgramStringARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5336(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5336(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5336(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5336(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramStringARB, .-glProgramStringARB + + .p2align 4,,15 + .globl glProgramEnvParameter4dARB + .type glProgramEnvParameter4dARB, @function +glProgramEnvParameter4dARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5344(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 5344(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5344(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 5344(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramEnvParameter4dARB, .-glProgramEnvParameter4dARB + + .p2align 4,,15 + .globl glProgramEnvParameter4dvARB + .type glProgramEnvParameter4dvARB, @function +glProgramEnvParameter4dvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5352(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5352(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5352(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5352(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramEnvParameter4dvARB, .-glProgramEnvParameter4dvARB + + .p2align 4,,15 + .globl glProgramEnvParameter4fARB + .type glProgramEnvParameter4fARB, @function +glProgramEnvParameter4fARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5360(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 5360(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5360(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 5360(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramEnvParameter4fARB, .-glProgramEnvParameter4fARB + + .p2align 4,,15 + .globl glProgramEnvParameter4fvARB + .type glProgramEnvParameter4fvARB, @function +glProgramEnvParameter4fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5368(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5368(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5368(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5368(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramEnvParameter4fvARB, .-glProgramEnvParameter4fvARB + + .p2align 4,,15 + .globl glProgramLocalParameter4dARB + .type glProgramLocalParameter4dARB, @function +glProgramLocalParameter4dARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5376(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 5376(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5376(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 5376(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramLocalParameter4dARB, .-glProgramLocalParameter4dARB + + .p2align 4,,15 + .globl glProgramLocalParameter4dvARB + .type glProgramLocalParameter4dvARB, @function +glProgramLocalParameter4dvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5384(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5384(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5384(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5384(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramLocalParameter4dvARB, .-glProgramLocalParameter4dvARB + + .p2align 4,,15 + .globl glProgramLocalParameter4fARB + .type glProgramLocalParameter4fARB, @function +glProgramLocalParameter4fARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5392(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 5392(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5392(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 5392(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramLocalParameter4fARB, .-glProgramLocalParameter4fARB + + .p2align 4,,15 + .globl glProgramLocalParameter4fvARB + .type glProgramLocalParameter4fvARB, @function +glProgramLocalParameter4fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5400(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5400(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5400(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramLocalParameter4fvARB, .-glProgramLocalParameter4fvARB + + .p2align 4,,15 + .globl glGetProgramEnvParameterdvARB + .type glGetProgramEnvParameterdvARB, @function +glGetProgramEnvParameterdvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5408(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetProgramEnvParameterdvARB, .-glGetProgramEnvParameterdvARB + + .p2align 4,,15 + .globl glGetProgramEnvParameterfvARB + .type glGetProgramEnvParameterfvARB, @function +glGetProgramEnvParameterfvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5416(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5416(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetProgramEnvParameterfvARB, .-glGetProgramEnvParameterfvARB + + .p2align 4,,15 + .globl glGetProgramLocalParameterdvARB + .type glGetProgramLocalParameterdvARB, @function +glGetProgramLocalParameterdvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5424(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5424(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5424(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5424(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetProgramLocalParameterdvARB, .-glGetProgramLocalParameterdvARB + + .p2align 4,,15 + .globl glGetProgramLocalParameterfvARB + .type glGetProgramLocalParameterfvARB, @function +glGetProgramLocalParameterfvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5432(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5432(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5432(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5432(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetProgramLocalParameterfvARB, .-glGetProgramLocalParameterfvARB + + .p2align 4,,15 + .globl glGetProgramivARB + .type glGetProgramivARB, @function +glGetProgramivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5440(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5440(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5440(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5440(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetProgramivARB, .-glGetProgramivARB + + .p2align 4,,15 + .globl glGetProgramStringARB + .type glGetProgramStringARB, @function +glGetProgramStringARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5448(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5448(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5448(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5448(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetProgramStringARB, .-glGetProgramStringARB + + .p2align 4,,15 + .globl glProgramNamedParameter4fNV + .type glProgramNamedParameter4fNV, @function +glProgramNamedParameter4fNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5456(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %rdx, 16(%rsp) + movq %xmm0, 24(%rsp) + movq %xmm1, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + call _x86_64_get_dispatch@PLT + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %xmm1 + movq 24(%rsp), %xmm0 + movq 16(%rsp), %rdx + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 5456(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5456(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %rdx, 16(%rsp) + movq %xmm0, 24(%rsp) + movq %xmm1, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + call _glapi_get_dispatch + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %xmm1 + movq 24(%rsp), %xmm0 + movq 16(%rsp), %rdx + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 5456(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramNamedParameter4fNV, .-glProgramNamedParameter4fNV + + .p2align 4,,15 + .globl glProgramNamedParameter4dNV + .type glProgramNamedParameter4dNV, @function +glProgramNamedParameter4dNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5464(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %rdx, 16(%rsp) + movq %xmm0, 24(%rsp) + movq %xmm1, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + call _x86_64_get_dispatch@PLT + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %xmm1 + movq 24(%rsp), %xmm0 + movq 16(%rsp), %rdx + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 5464(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5464(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %rdx, 16(%rsp) + movq %xmm0, 24(%rsp) + movq %xmm1, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + call _glapi_get_dispatch + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %xmm1 + movq 24(%rsp), %xmm0 + movq 16(%rsp), %rdx + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 5464(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramNamedParameter4dNV, .-glProgramNamedParameter4dNV + + .p2align 4,,15 + .globl glProgramNamedParameter4fvNV + .type glProgramNamedParameter4fvNV, @function +glProgramNamedParameter4fvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5472(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5472(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5472(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5472(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramNamedParameter4fvNV, .-glProgramNamedParameter4fvNV + + .p2align 4,,15 + .globl glProgramNamedParameter4dvNV + .type glProgramNamedParameter4dvNV, @function +glProgramNamedParameter4dvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5480(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5480(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5480(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5480(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glProgramNamedParameter4dvNV, .-glProgramNamedParameter4dvNV + + .p2align 4,,15 + .globl glGetProgramNamedParameterfvNV + .type glGetProgramNamedParameterfvNV, @function +glGetProgramNamedParameterfvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5488(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5488(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5488(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5488(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetProgramNamedParameterfvNV, .-glGetProgramNamedParameterfvNV + + .p2align 4,,15 + .globl glGetProgramNamedParameterdvNV + .type glGetProgramNamedParameterdvNV, @function +glGetProgramNamedParameterdvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5496(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetProgramNamedParameterdvNV, .-glGetProgramNamedParameterdvNV + + .p2align 4,,15 + .globl glBindBufferARB + .type glBindBufferARB, @function +glBindBufferARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5504(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBindBufferARB, .-glBindBufferARB + + .p2align 4,,15 + .globl glBufferDataARB + .type glBufferDataARB, @function +glBufferDataARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5512(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBufferDataARB, .-glBufferDataARB + + .p2align 4,,15 + .globl glBufferSubDataARB + .type glBufferSubDataARB, @function +glBufferSubDataARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5520(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBufferSubDataARB, .-glBufferSubDataARB + + .p2align 4,,15 + .globl glDeleteBuffersARB + .type glDeleteBuffersARB, @function +glDeleteBuffersARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5528(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5528(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5528(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5528(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDeleteBuffersARB, .-glDeleteBuffersARB + + .p2align 4,,15 + .globl glGenBuffersARB + .type glGenBuffersARB, @function +glGenBuffersARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5536(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5536(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5536(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5536(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGenBuffersARB, .-glGenBuffersARB + + .p2align 4,,15 + .globl glGetBufferParameterivARB + .type glGetBufferParameterivARB, @function +glGetBufferParameterivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5544(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5544(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5544(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5544(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetBufferParameterivARB, .-glGetBufferParameterivARB + + .p2align 4,,15 + .globl glGetBufferPointervARB + .type glGetBufferPointervARB, @function +glGetBufferPointervARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5552(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5552(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5552(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5552(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetBufferPointervARB, .-glGetBufferPointervARB + + .p2align 4,,15 + .globl glGetBufferSubDataARB + .type glGetBufferSubDataARB, @function +glGetBufferSubDataARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5560(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5560(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5560(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5560(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetBufferSubDataARB, .-glGetBufferSubDataARB + + .p2align 4,,15 + .globl glIsBufferARB + .type glIsBufferARB, @function +glIsBufferARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5568(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5568(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5568(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5568(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIsBufferARB, .-glIsBufferARB + + .p2align 4,,15 + .globl glMapBufferARB + .type glMapBufferARB, @function +glMapBufferARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5576(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5576(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5576(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5576(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMapBufferARB, .-glMapBufferARB + + .p2align 4,,15 + .globl glUnmapBufferARB + .type glUnmapBufferARB, @function +glUnmapBufferARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5584(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5584(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5584(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5584(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUnmapBufferARB, .-glUnmapBufferARB + + .p2align 4,,15 + .globl glDepthBoundsEXT + .type glDepthBoundsEXT, @function +glDepthBoundsEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5592(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5592(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5592(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5592(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDepthBoundsEXT, .-glDepthBoundsEXT + + .p2align 4,,15 + .globl glGenQueriesARB + .type glGenQueriesARB, @function +glGenQueriesARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5600(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5600(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5600(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5600(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGenQueriesARB, .-glGenQueriesARB + + .p2align 4,,15 + .globl glDeleteQueriesARB + .type glDeleteQueriesARB, @function +glDeleteQueriesARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5608(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5608(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5608(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5608(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDeleteQueriesARB, .-glDeleteQueriesARB + + .p2align 4,,15 + .globl glIsQueryARB + .type glIsQueryARB, @function +glIsQueryARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5616(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5616(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5616(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5616(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIsQueryARB, .-glIsQueryARB + + .p2align 4,,15 + .globl glBeginQueryARB + .type glBeginQueryARB, @function +glBeginQueryARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5624(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5624(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5624(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5624(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBeginQueryARB, .-glBeginQueryARB + + .p2align 4,,15 + .globl glEndQueryARB + .type glEndQueryARB, @function +glEndQueryARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5632(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5632(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5632(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5632(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEndQueryARB, .-glEndQueryARB + + .p2align 4,,15 + .globl glGetQueryivARB + .type glGetQueryivARB, @function +glGetQueryivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5640(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5640(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5640(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5640(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetQueryivARB, .-glGetQueryivARB + + .p2align 4,,15 + .globl glGetQueryObjectivARB + .type glGetQueryObjectivARB, @function +glGetQueryObjectivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5648(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5648(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5648(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5648(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetQueryObjectivARB, .-glGetQueryObjectivARB + + .p2align 4,,15 + .globl glGetQueryObjectuivARB + .type glGetQueryObjectuivARB, @function +glGetQueryObjectuivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5656(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5656(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5656(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5656(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetQueryObjectuivARB, .-glGetQueryObjectuivARB + + .p2align 4,,15 + .globl glMultiModeDrawArraysIBM + .type glMultiModeDrawArraysIBM, @function +glMultiModeDrawArraysIBM: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5664(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5664(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5664(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5664(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiModeDrawArraysIBM, .-glMultiModeDrawArraysIBM + + .p2align 4,,15 + .globl glMultiModeDrawElementsIBM + .type glMultiModeDrawElementsIBM, @function +glMultiModeDrawElementsIBM: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5672(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5672(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5672(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5672(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glMultiModeDrawElementsIBM, .-glMultiModeDrawElementsIBM + + .p2align 4,,15 + .globl glBlendEquationSeparateEXT + .type glBlendEquationSeparateEXT, @function +glBlendEquationSeparateEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5680(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5680(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5680(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5680(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBlendEquationSeparateEXT, .-glBlendEquationSeparateEXT + + .p2align 4,,15 + .globl glDeleteObjectARB + .type glDeleteObjectARB, @function +glDeleteObjectARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5688(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5688(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5688(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5688(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDeleteObjectARB, .-glDeleteObjectARB + + .p2align 4,,15 + .globl glGetHandleARB + .type glGetHandleARB, @function +glGetHandleARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5696(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5696(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5696(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5696(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetHandleARB, .-glGetHandleARB + + .p2align 4,,15 + .globl glDetachObjectARB + .type glDetachObjectARB, @function +glDetachObjectARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5704(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5704(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5704(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5704(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDetachObjectARB, .-glDetachObjectARB + + .p2align 4,,15 + .globl glCreateShaderObjectARB + .type glCreateShaderObjectARB, @function +glCreateShaderObjectARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5712(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5712(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5712(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5712(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCreateShaderObjectARB, .-glCreateShaderObjectARB + + .p2align 4,,15 + .globl glShaderSourceARB + .type glShaderSourceARB, @function +glShaderSourceARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5720(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5720(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5720(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5720(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glShaderSourceARB, .-glShaderSourceARB + + .p2align 4,,15 + .globl glCompileShaderARB + .type glCompileShaderARB, @function +glCompileShaderARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5728(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5728(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5728(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5728(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCompileShaderARB, .-glCompileShaderARB + + .p2align 4,,15 + .globl glCreateProgramObjectARB + .type glCreateProgramObjectARB, @function +glCreateProgramObjectARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5736(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 5736(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5736(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 5736(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCreateProgramObjectARB, .-glCreateProgramObjectARB + + .p2align 4,,15 + .globl glAttachObjectARB + .type glAttachObjectARB, @function +glAttachObjectARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5744(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5744(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5744(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5744(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glAttachObjectARB, .-glAttachObjectARB + + .p2align 4,,15 + .globl glLinkProgramARB + .type glLinkProgramARB, @function +glLinkProgramARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5752(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5752(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5752(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5752(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glLinkProgramARB, .-glLinkProgramARB + + .p2align 4,,15 + .globl glUseProgramObjectARB + .type glUseProgramObjectARB, @function +glUseProgramObjectARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5760(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5760(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5760(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5760(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUseProgramObjectARB, .-glUseProgramObjectARB + + .p2align 4,,15 + .globl glValidateProgramARB + .type glValidateProgramARB, @function +glValidateProgramARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5768(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5768(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5768(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5768(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glValidateProgramARB, .-glValidateProgramARB + + .p2align 4,,15 + .globl glUniform1fARB + .type glUniform1fARB, @function +glUniform1fARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5776(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 5776(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5776(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 5776(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform1fARB, .-glUniform1fARB + + .p2align 4,,15 + .globl glUniform2fARB + .type glUniform2fARB, @function +glUniform2fARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5784(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 5784(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5784(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 5784(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform2fARB, .-glUniform2fARB + + .p2align 4,,15 + .globl glUniform3fARB + .type glUniform3fARB, @function +glUniform3fARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5792(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 5792(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5792(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 5792(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform3fARB, .-glUniform3fARB + + .p2align 4,,15 + .globl glUniform4fARB + .type glUniform4fARB, @function +glUniform4fARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5800(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _x86_64_get_dispatch@PLT + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 5800(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5800(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _glapi_get_dispatch + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 5800(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform4fARB, .-glUniform4fARB + + .p2align 4,,15 + .globl glUniform1iARB + .type glUniform1iARB, @function +glUniform1iARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5808(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5808(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5808(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5808(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform1iARB, .-glUniform1iARB + + .p2align 4,,15 + .globl glUniform2iARB + .type glUniform2iARB, @function +glUniform2iARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5816(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5816(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5816(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5816(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform2iARB, .-glUniform2iARB + + .p2align 4,,15 + .globl glUniform3iARB + .type glUniform3iARB, @function +glUniform3iARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5824(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5824(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5824(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5824(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform3iARB, .-glUniform3iARB + + .p2align 4,,15 + .globl glUniform4iARB + .type glUniform4iARB, @function +glUniform4iARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5832(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5832(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5832(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5832(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform4iARB, .-glUniform4iARB + + .p2align 4,,15 + .globl glUniform1fvARB + .type glUniform1fvARB, @function +glUniform1fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5840(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5840(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5840(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5840(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform1fvARB, .-glUniform1fvARB + + .p2align 4,,15 + .globl glUniform2fvARB + .type glUniform2fvARB, @function +glUniform2fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5848(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5848(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5848(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5848(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform2fvARB, .-glUniform2fvARB + + .p2align 4,,15 + .globl glUniform3fvARB + .type glUniform3fvARB, @function +glUniform3fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5856(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5856(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5856(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5856(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform3fvARB, .-glUniform3fvARB + + .p2align 4,,15 + .globl glUniform4fvARB + .type glUniform4fvARB, @function +glUniform4fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5864(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5864(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5864(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5864(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform4fvARB, .-glUniform4fvARB + + .p2align 4,,15 + .globl glUniform1ivARB + .type glUniform1ivARB, @function +glUniform1ivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5872(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5872(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5872(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5872(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform1ivARB, .-glUniform1ivARB + + .p2align 4,,15 + .globl glUniform2ivARB + .type glUniform2ivARB, @function +glUniform2ivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5880(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5880(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5880(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5880(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform2ivARB, .-glUniform2ivARB + + .p2align 4,,15 + .globl glUniform3ivARB + .type glUniform3ivARB, @function +glUniform3ivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5888(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5888(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5888(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5888(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform3ivARB, .-glUniform3ivARB + + .p2align 4,,15 + .globl glUniform4ivARB + .type glUniform4ivARB, @function +glUniform4ivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5896(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5896(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5896(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5896(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniform4ivARB, .-glUniform4ivARB + + .p2align 4,,15 + .globl glUniformMatrix2fvARB + .type glUniformMatrix2fvARB, @function +glUniformMatrix2fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5904(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5904(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5904(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5904(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniformMatrix2fvARB, .-glUniformMatrix2fvARB + + .p2align 4,,15 + .globl glUniformMatrix3fvARB + .type glUniformMatrix3fvARB, @function +glUniformMatrix3fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5912(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5912(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5912(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5912(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniformMatrix3fvARB, .-glUniformMatrix3fvARB + + .p2align 4,,15 + .globl glUniformMatrix4fvARB + .type glUniformMatrix4fvARB, @function +glUniformMatrix4fvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5920(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5920(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5920(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5920(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glUniformMatrix4fvARB, .-glUniformMatrix4fvARB + + .p2align 4,,15 + .globl glGetObjectParameterfvARB + .type glGetObjectParameterfvARB, @function +glGetObjectParameterfvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5928(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5928(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5928(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5928(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetObjectParameterfvARB, .-glGetObjectParameterfvARB + + .p2align 4,,15 + .globl glGetObjectParameterivARB + .type glGetObjectParameterivARB, @function +glGetObjectParameterivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5936(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5936(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5936(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5936(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetObjectParameterivARB, .-glGetObjectParameterivARB + + .p2align 4,,15 + .globl glGetInfoLogARB + .type glGetInfoLogARB, @function +glGetInfoLogARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5944(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5944(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5944(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5944(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetInfoLogARB, .-glGetInfoLogARB + + .p2align 4,,15 + .globl glGetAttachedObjectsARB + .type glGetAttachedObjectsARB, @function +glGetAttachedObjectsARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5952(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5952(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5952(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5952(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetAttachedObjectsARB, .-glGetAttachedObjectsARB + + .p2align 4,,15 + .globl glGetUniformLocationARB + .type glGetUniformLocationARB, @function +glGetUniformLocationARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5960(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5960(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5960(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5960(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetUniformLocationARB, .-glGetUniformLocationARB + + .p2align 4,,15 + .globl glGetActiveUniformARB + .type glGetActiveUniformARB, @function +glGetActiveUniformARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5968(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5968(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5968(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5968(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetActiveUniformARB, .-glGetActiveUniformARB + + .p2align 4,,15 + .globl glGetUniformfvARB + .type glGetUniformfvARB, @function +glGetUniformfvARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5976(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5976(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5976(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5976(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetUniformfvARB, .-glGetUniformfvARB + + .p2align 4,,15 + .globl glGetUniformivARB + .type glGetUniformivARB, @function +glGetUniformivARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5984(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5984(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5984(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5984(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetUniformivARB, .-glGetUniformivARB + + .p2align 4,,15 + .globl glGetShaderSourceARB + .type glGetShaderSourceARB, @function +glGetShaderSourceARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5992(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5992(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5992(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5992(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetShaderSourceARB, .-glGetShaderSourceARB + + .p2align 4,,15 + .globl glBindAttribLocationARB + .type glBindAttribLocationARB, @function +glBindAttribLocationARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6000(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6000(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6000(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6000(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBindAttribLocationARB, .-glBindAttribLocationARB + + .p2align 4,,15 + .globl glGetActiveAttribARB + .type glGetActiveAttribARB, @function +glGetActiveAttribARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6008(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6008(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6008(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6008(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetActiveAttribARB, .-glGetActiveAttribARB + + .p2align 4,,15 + .globl glGetAttribLocationARB + .type glGetAttribLocationARB, @function +glGetAttribLocationARB: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6016(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6016(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6016(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6016(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetAttribLocationARB, .-glGetAttribLocationARB + + .p2align 4,,15 + .globl glGetVertexAttribdvNV + .type glGetVertexAttribdvNV, @function +glGetVertexAttribdvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6024(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6024(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6024(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6024(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetVertexAttribdvNV, .-glGetVertexAttribdvNV + + .p2align 4,,15 + .globl glGetVertexAttribfvNV + .type glGetVertexAttribfvNV, @function +glGetVertexAttribfvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6032(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6032(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6032(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6032(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetVertexAttribfvNV, .-glGetVertexAttribfvNV + + .p2align 4,,15 + .globl glGetVertexAttribivNV + .type glGetVertexAttribivNV, @function +glGetVertexAttribivNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6040(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6040(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6040(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6040(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetVertexAttribivNV, .-glGetVertexAttribivNV + + .p2align 4,,15 + .globl glVertexAttrib1dNV + .type glVertexAttrib1dNV, @function +glVertexAttrib1dNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6048(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 6048(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6048(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 6048(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib1dNV, .-glVertexAttrib1dNV + + .p2align 4,,15 + .globl glVertexAttrib1dvNV + .type glVertexAttrib1dvNV, @function +glVertexAttrib1dvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6056(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6056(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6056(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6056(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib1dvNV, .-glVertexAttrib1dvNV + + .p2align 4,,15 + .globl glVertexAttrib1fNV + .type glVertexAttrib1fNV, @function +glVertexAttrib1fNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6064(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 6064(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6064(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 6064(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib1fNV, .-glVertexAttrib1fNV + + .p2align 4,,15 + .globl glVertexAttrib1fvNV + .type glVertexAttrib1fvNV, @function +glVertexAttrib1fvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6072(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6072(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6072(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6072(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib1fvNV, .-glVertexAttrib1fvNV + + .p2align 4,,15 + .globl glVertexAttrib1sNV + .type glVertexAttrib1sNV, @function +glVertexAttrib1sNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6080(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6080(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6080(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6080(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib1sNV, .-glVertexAttrib1sNV + + .p2align 4,,15 + .globl glVertexAttrib1svNV + .type glVertexAttrib1svNV, @function +glVertexAttrib1svNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6088(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6088(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6088(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6088(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib1svNV, .-glVertexAttrib1svNV + + .p2align 4,,15 + .globl glVertexAttrib2dNV + .type glVertexAttrib2dNV, @function +glVertexAttrib2dNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6096(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 6096(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6096(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 6096(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib2dNV, .-glVertexAttrib2dNV + + .p2align 4,,15 + .globl glVertexAttrib2dvNV + .type glVertexAttrib2dvNV, @function +glVertexAttrib2dvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6104(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6104(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6104(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6104(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib2dvNV, .-glVertexAttrib2dvNV + + .p2align 4,,15 + .globl glVertexAttrib2fNV + .type glVertexAttrib2fNV, @function +glVertexAttrib2fNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6112(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 6112(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6112(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 6112(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib2fNV, .-glVertexAttrib2fNV + + .p2align 4,,15 + .globl glVertexAttrib2fvNV + .type glVertexAttrib2fvNV, @function +glVertexAttrib2fvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6120(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6120(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6120(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6120(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib2fvNV, .-glVertexAttrib2fvNV + + .p2align 4,,15 + .globl glVertexAttrib2sNV + .type glVertexAttrib2sNV, @function +glVertexAttrib2sNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6128(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6128(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6128(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6128(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib2sNV, .-glVertexAttrib2sNV + + .p2align 4,,15 + .globl glVertexAttrib2svNV + .type glVertexAttrib2svNV, @function +glVertexAttrib2svNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6136(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6136(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6136(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6136(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib2svNV, .-glVertexAttrib2svNV + + .p2align 4,,15 + .globl glVertexAttrib3dNV + .type glVertexAttrib3dNV, @function +glVertexAttrib3dNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6144(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 6144(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6144(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 6144(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib3dNV, .-glVertexAttrib3dNV + + .p2align 4,,15 + .globl glVertexAttrib3dvNV + .type glVertexAttrib3dvNV, @function +glVertexAttrib3dvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6152(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6152(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6152(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6152(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib3dvNV, .-glVertexAttrib3dvNV + + .p2align 4,,15 + .globl glVertexAttrib3fNV + .type glVertexAttrib3fNV, @function +glVertexAttrib3fNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6160(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 6160(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6160(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 6160(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib3fNV, .-glVertexAttrib3fNV + + .p2align 4,,15 + .globl glVertexAttrib3fvNV + .type glVertexAttrib3fvNV, @function +glVertexAttrib3fvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6168(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6168(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6168(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6168(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib3fvNV, .-glVertexAttrib3fvNV + + .p2align 4,,15 + .globl glVertexAttrib3sNV + .type glVertexAttrib3sNV, @function +glVertexAttrib3sNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6176(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6176(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6176(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6176(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib3sNV, .-glVertexAttrib3sNV + + .p2align 4,,15 + .globl glVertexAttrib3svNV + .type glVertexAttrib3svNV, @function +glVertexAttrib3svNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib3svNV, .-glVertexAttrib3svNV + + .p2align 4,,15 + .globl glVertexAttrib4dNV + .type glVertexAttrib4dNV, @function +glVertexAttrib4dNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _x86_64_get_dispatch@PLT + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 6192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6192(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _glapi_get_dispatch + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 6192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4dNV, .-glVertexAttrib4dNV + + .p2align 4,,15 + .globl glVertexAttrib4dvNV + .type glVertexAttrib4dvNV, @function +glVertexAttrib4dvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6200(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4dvNV, .-glVertexAttrib4dvNV + + .p2align 4,,15 + .globl glVertexAttrib4fNV + .type glVertexAttrib4fNV, @function +glVertexAttrib4fNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6208(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _x86_64_get_dispatch@PLT + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 6208(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6208(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _glapi_get_dispatch + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 6208(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4fNV, .-glVertexAttrib4fNV + + .p2align 4,,15 + .globl glVertexAttrib4fvNV + .type glVertexAttrib4fvNV, @function +glVertexAttrib4fvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6216(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6216(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6216(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6216(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4fvNV, .-glVertexAttrib4fvNV + + .p2align 4,,15 + .globl glVertexAttrib4sNV + .type glVertexAttrib4sNV, @function +glVertexAttrib4sNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6224(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6224(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6224(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6224(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4sNV, .-glVertexAttrib4sNV + + .p2align 4,,15 + .globl glVertexAttrib4svNV + .type glVertexAttrib4svNV, @function +glVertexAttrib4svNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6232(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6232(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6232(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6232(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4svNV, .-glVertexAttrib4svNV + + .p2align 4,,15 + .globl glVertexAttrib4ubNV + .type glVertexAttrib4ubNV, @function +glVertexAttrib4ubNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6240(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6240(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6240(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6240(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4ubNV, .-glVertexAttrib4ubNV + + .p2align 4,,15 + .globl glVertexAttrib4ubvNV + .type glVertexAttrib4ubvNV, @function +glVertexAttrib4ubvNV: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6248(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6248(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glVertexAttrib4ubvNV, .-glVertexAttrib4ubvNV + + .p2align 4,,15 + .globl glGenFragmentShadersATI + .type glGenFragmentShadersATI, @function +glGenFragmentShadersATI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6256(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6256(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6256(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6256(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGenFragmentShadersATI, .-glGenFragmentShadersATI + + .p2align 4,,15 + .globl glBindFragmentShaderATI + .type glBindFragmentShaderATI, @function +glBindFragmentShaderATI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6264(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6264(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6264(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6264(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBindFragmentShaderATI, .-glBindFragmentShaderATI + + .p2align 4,,15 + .globl glDeleteFragmentShaderATI + .type glDeleteFragmentShaderATI, @function +glDeleteFragmentShaderATI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6272(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6272(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6272(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6272(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDeleteFragmentShaderATI, .-glDeleteFragmentShaderATI + + .p2align 4,,15 + .globl glBeginFragmentShaderATI + .type glBeginFragmentShaderATI, @function +glBeginFragmentShaderATI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6280(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 6280(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6280(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 6280(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBeginFragmentShaderATI, .-glBeginFragmentShaderATI + + .p2align 4,,15 + .globl glEndFragmentShaderATI + .type glEndFragmentShaderATI, @function +glEndFragmentShaderATI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6288(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 6288(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6288(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 6288(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glEndFragmentShaderATI, .-glEndFragmentShaderATI + + .p2align 4,,15 + .globl glPassTexCoordATI + .type glPassTexCoordATI, @function +glPassTexCoordATI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6296(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6296(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6296(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6296(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glPassTexCoordATI, .-glPassTexCoordATI + + .p2align 4,,15 + .globl glSampleMapATI + .type glSampleMapATI, @function +glSampleMapATI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6304(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6304(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6304(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6304(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSampleMapATI, .-glSampleMapATI + + .p2align 4,,15 + .globl glColorFragmentOp1ATI + .type glColorFragmentOp1ATI, @function +glColorFragmentOp1ATI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6312(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6312(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6312(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6312(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColorFragmentOp1ATI, .-glColorFragmentOp1ATI + + .p2align 4,,15 + .globl glColorFragmentOp2ATI + .type glColorFragmentOp2ATI, @function +glColorFragmentOp2ATI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6320(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6320(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6320(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6320(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColorFragmentOp2ATI, .-glColorFragmentOp2ATI + + .p2align 4,,15 + .globl glColorFragmentOp3ATI + .type glColorFragmentOp3ATI, @function +glColorFragmentOp3ATI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6328(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6328(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6328(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6328(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glColorFragmentOp3ATI, .-glColorFragmentOp3ATI + + .p2align 4,,15 + .globl glAlphaFragmentOp1ATI + .type glAlphaFragmentOp1ATI, @function +glAlphaFragmentOp1ATI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6336(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6336(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6336(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6336(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glAlphaFragmentOp1ATI, .-glAlphaFragmentOp1ATI + + .p2align 4,,15 + .globl glAlphaFragmentOp2ATI + .type glAlphaFragmentOp2ATI, @function +glAlphaFragmentOp2ATI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6344(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6344(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6344(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6344(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glAlphaFragmentOp2ATI, .-glAlphaFragmentOp2ATI + + .p2align 4,,15 + .globl glAlphaFragmentOp3ATI + .type glAlphaFragmentOp3ATI, @function +glAlphaFragmentOp3ATI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6352(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6352(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6352(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6352(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glAlphaFragmentOp3ATI, .-glAlphaFragmentOp3ATI + + .p2align 4,,15 + .globl glSetFragmentShaderConstantATI + .type glSetFragmentShaderConstantATI, @function +glSetFragmentShaderConstantATI: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6360(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6360(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6360(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6360(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glSetFragmentShaderConstantATI, .-glSetFragmentShaderConstantATI + + .p2align 4,,15 + .globl glIsRenderbufferEXT + .type glIsRenderbufferEXT, @function +glIsRenderbufferEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6368(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6368(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6368(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6368(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIsRenderbufferEXT, .-glIsRenderbufferEXT + + .p2align 4,,15 + .globl glBindRenderbufferEXT + .type glBindRenderbufferEXT, @function +glBindRenderbufferEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6376(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6376(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6376(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6376(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBindRenderbufferEXT, .-glBindRenderbufferEXT + + .p2align 4,,15 + .globl glDeleteRenderbuffersEXT + .type glDeleteRenderbuffersEXT, @function +glDeleteRenderbuffersEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6384(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6384(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6384(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6384(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDeleteRenderbuffersEXT, .-glDeleteRenderbuffersEXT + + .p2align 4,,15 + .globl glGenRenderbuffersEXT + .type glGenRenderbuffersEXT, @function +glGenRenderbuffersEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6392(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6392(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6392(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6392(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGenRenderbuffersEXT, .-glGenRenderbuffersEXT + + .p2align 4,,15 + .globl glRenderbufferStorageEXT + .type glRenderbufferStorageEXT, @function +glRenderbufferStorageEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6400(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6400(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6400(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glRenderbufferStorageEXT, .-glRenderbufferStorageEXT + + .p2align 4,,15 + .globl glGetRenderbufferParameterivEXT + .type glGetRenderbufferParameterivEXT, @function +glGetRenderbufferParameterivEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6408(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetRenderbufferParameterivEXT, .-glGetRenderbufferParameterivEXT + + .p2align 4,,15 + .globl glIsFramebufferEXT + .type glIsFramebufferEXT, @function +glIsFramebufferEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6416(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6416(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glIsFramebufferEXT, .-glIsFramebufferEXT + + .p2align 4,,15 + .globl glBindFramebufferEXT + .type glBindFramebufferEXT, @function +glBindFramebufferEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6424(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6424(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6424(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6424(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glBindFramebufferEXT, .-glBindFramebufferEXT + + .p2align 4,,15 + .globl glDeleteFramebuffersEXT + .type glDeleteFramebuffersEXT, @function +glDeleteFramebuffersEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6432(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6432(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6432(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6432(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glDeleteFramebuffersEXT, .-glDeleteFramebuffersEXT + + .p2align 4,,15 + .globl glGenFramebuffersEXT + .type glGenFramebuffersEXT, @function +glGenFramebuffersEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6440(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6440(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6440(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6440(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGenFramebuffersEXT, .-glGenFramebuffersEXT + + .p2align 4,,15 + .globl glCheckFramebufferStatusEXT + .type glCheckFramebufferStatusEXT, @function +glCheckFramebufferStatusEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6448(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6448(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6448(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6448(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glCheckFramebufferStatusEXT, .-glCheckFramebufferStatusEXT + + .p2align 4,,15 + .globl glFramebufferTexture1DEXT + .type glFramebufferTexture1DEXT, @function +glFramebufferTexture1DEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6456(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6456(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6456(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6456(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFramebufferTexture1DEXT, .-glFramebufferTexture1DEXT + + .p2align 4,,15 + .globl glFramebufferTexture2DEXT + .type glFramebufferTexture2DEXT, @function +glFramebufferTexture2DEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6464(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6464(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6464(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6464(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFramebufferTexture2DEXT, .-glFramebufferTexture2DEXT + + .p2align 4,,15 + .globl glFramebufferTexture3DEXT + .type glFramebufferTexture3DEXT, @function +glFramebufferTexture3DEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6472(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6472(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6472(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6472(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFramebufferTexture3DEXT, .-glFramebufferTexture3DEXT + + .p2align 4,,15 + .globl glFramebufferRenderbufferEXT + .type glFramebufferRenderbufferEXT, @function +glFramebufferRenderbufferEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6480(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6480(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6480(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6480(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glFramebufferRenderbufferEXT, .-glFramebufferRenderbufferEXT + + .p2align 4,,15 + .globl glGetFramebufferAttachmentParameterivEXT + .type glGetFramebufferAttachmentParameterivEXT, @function +glGetFramebufferAttachmentParameterivEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6488(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6488(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6488(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6488(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGetFramebufferAttachmentParameterivEXT, .-glGetFramebufferAttachmentParameterivEXT + + .p2align 4,,15 + .globl glGenerateMipmapEXT + .type glGenerateMipmapEXT, @function +glGenerateMipmapEXT: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6496(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glGenerateMipmapEXT, .-glGenerateMipmapEXT + + .p2align 4,,15 + .globl glStencilFuncSeparate + .type glStencilFuncSeparate, @function +glStencilFuncSeparate: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6504(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glStencilFuncSeparate, .-glStencilFuncSeparate + + .p2align 4,,15 + .globl glStencilOpSeparate + .type glStencilOpSeparate, @function +glStencilOpSeparate: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6512(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glStencilOpSeparate, .-glStencilOpSeparate + + .p2align 4,,15 + .globl glStencilMaskSeparate + .type glStencilMaskSeparate, @function +glStencilMaskSeparate: +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6520(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size glStencilMaskSeparate, .-glStencilMaskSeparate + + .globl glArrayElementEXT ; .set glArrayElementEXT, glArrayElement + .globl glBindTextureEXT ; .set glBindTextureEXT, glBindTexture + .globl glDrawArraysEXT ; .set glDrawArraysEXT, glDrawArrays + .globl glCopyTexImage1DEXT ; .set glCopyTexImage1DEXT, glCopyTexImage1D + .globl glCopyTexImage2DEXT ; .set glCopyTexImage2DEXT, glCopyTexImage2D + .globl glCopyTexSubImage1DEXT ; .set glCopyTexSubImage1DEXT, glCopyTexSubImage1D + .globl glCopyTexSubImage2DEXT ; .set glCopyTexSubImage2DEXT, glCopyTexSubImage2D + .globl glDeleteTexturesEXT ; .set glDeleteTexturesEXT, glDeleteTextures + .globl glGetPointervEXT ; .set glGetPointervEXT, glGetPointerv + .globl glPrioritizeTexturesEXT ; .set glPrioritizeTexturesEXT, glPrioritizeTextures + .globl glTexSubImage1DEXT ; .set glTexSubImage1DEXT, glTexSubImage1D + .globl glTexSubImage2DEXT ; .set glTexSubImage2DEXT, glTexSubImage2D + .globl glBlendColorEXT ; .set glBlendColorEXT, glBlendColor + .globl glBlendEquationEXT ; .set glBlendEquationEXT, glBlendEquation + .globl glDrawRangeElementsEXT ; .set glDrawRangeElementsEXT, glDrawRangeElements + .globl glColorTableSGI ; .set glColorTableSGI, glColorTable + .globl glColorTableEXT ; .set glColorTableEXT, glColorTable + .globl glColorTableParameterfvSGI ; .set glColorTableParameterfvSGI, glColorTableParameterfv + .globl glColorTableParameterivSGI ; .set glColorTableParameterivSGI, glColorTableParameteriv + .globl glCopyColorTableSGI ; .set glCopyColorTableSGI, glCopyColorTable + .globl glColorSubTableEXT ; .set glColorSubTableEXT, glColorSubTable + .globl glCopyColorSubTableEXT ; .set glCopyColorSubTableEXT, glCopyColorSubTable + .globl glConvolutionFilter1DEXT ; .set glConvolutionFilter1DEXT, glConvolutionFilter1D + .globl glConvolutionFilter2DEXT ; .set glConvolutionFilter2DEXT, glConvolutionFilter2D + .globl glConvolutionParameterfEXT ; .set glConvolutionParameterfEXT, glConvolutionParameterf + .globl glConvolutionParameterfvEXT ; .set glConvolutionParameterfvEXT, glConvolutionParameterfv + .globl glConvolutionParameteriEXT ; .set glConvolutionParameteriEXT, glConvolutionParameteri + .globl glConvolutionParameterivEXT ; .set glConvolutionParameterivEXT, glConvolutionParameteriv + .globl glCopyConvolutionFilter1DEXT ; .set glCopyConvolutionFilter1DEXT, glCopyConvolutionFilter1D + .globl glCopyConvolutionFilter2DEXT ; .set glCopyConvolutionFilter2DEXT, glCopyConvolutionFilter2D + .globl glSeparableFilter2DEXT ; .set glSeparableFilter2DEXT, glSeparableFilter2D + .globl glHistogramEXT ; .set glHistogramEXT, glHistogram + .globl glMinmaxEXT ; .set glMinmaxEXT, glMinmax + .globl glResetHistogramEXT ; .set glResetHistogramEXT, glResetHistogram + .globl glResetMinmaxEXT ; .set glResetMinmaxEXT, glResetMinmax + .globl glTexImage3DEXT ; .set glTexImage3DEXT, glTexImage3D + .globl glTexSubImage3DEXT ; .set glTexSubImage3DEXT, glTexSubImage3D + .globl glCopyTexSubImage3DEXT ; .set glCopyTexSubImage3DEXT, glCopyTexSubImage3D + .globl glActiveTexture ; .set glActiveTexture, glActiveTextureARB + .globl glClientActiveTexture ; .set glClientActiveTexture, glClientActiveTextureARB + .globl glMultiTexCoord1d ; .set glMultiTexCoord1d, glMultiTexCoord1dARB + .globl glMultiTexCoord1dv ; .set glMultiTexCoord1dv, glMultiTexCoord1dvARB + .globl glMultiTexCoord1f ; .set glMultiTexCoord1f, glMultiTexCoord1fARB + .globl glMultiTexCoord1fv ; .set glMultiTexCoord1fv, glMultiTexCoord1fvARB + .globl glMultiTexCoord1i ; .set glMultiTexCoord1i, glMultiTexCoord1iARB + .globl glMultiTexCoord1iv ; .set glMultiTexCoord1iv, glMultiTexCoord1ivARB + .globl glMultiTexCoord1s ; .set glMultiTexCoord1s, glMultiTexCoord1sARB + .globl glMultiTexCoord1sv ; .set glMultiTexCoord1sv, glMultiTexCoord1svARB + .globl glMultiTexCoord2d ; .set glMultiTexCoord2d, glMultiTexCoord2dARB + .globl glMultiTexCoord2dv ; .set glMultiTexCoord2dv, glMultiTexCoord2dvARB + .globl glMultiTexCoord2f ; .set glMultiTexCoord2f, glMultiTexCoord2fARB + .globl glMultiTexCoord2fv ; .set glMultiTexCoord2fv, glMultiTexCoord2fvARB + .globl glMultiTexCoord2i ; .set glMultiTexCoord2i, glMultiTexCoord2iARB + .globl glMultiTexCoord2iv ; .set glMultiTexCoord2iv, glMultiTexCoord2ivARB + .globl glMultiTexCoord2s ; .set glMultiTexCoord2s, glMultiTexCoord2sARB + .globl glMultiTexCoord2sv ; .set glMultiTexCoord2sv, glMultiTexCoord2svARB + .globl glMultiTexCoord3d ; .set glMultiTexCoord3d, glMultiTexCoord3dARB + .globl glMultiTexCoord3dv ; .set glMultiTexCoord3dv, glMultiTexCoord3dvARB + .globl glMultiTexCoord3f ; .set glMultiTexCoord3f, glMultiTexCoord3fARB + .globl glMultiTexCoord3fv ; .set glMultiTexCoord3fv, glMultiTexCoord3fvARB + .globl glMultiTexCoord3i ; .set glMultiTexCoord3i, glMultiTexCoord3iARB + .globl glMultiTexCoord3iv ; .set glMultiTexCoord3iv, glMultiTexCoord3ivARB + .globl glMultiTexCoord3s ; .set glMultiTexCoord3s, glMultiTexCoord3sARB + .globl glMultiTexCoord3sv ; .set glMultiTexCoord3sv, glMultiTexCoord3svARB + .globl glMultiTexCoord4d ; .set glMultiTexCoord4d, glMultiTexCoord4dARB + .globl glMultiTexCoord4dv ; .set glMultiTexCoord4dv, glMultiTexCoord4dvARB + .globl glMultiTexCoord4f ; .set glMultiTexCoord4f, glMultiTexCoord4fARB + .globl glMultiTexCoord4fv ; .set glMultiTexCoord4fv, glMultiTexCoord4fvARB + .globl glMultiTexCoord4i ; .set glMultiTexCoord4i, glMultiTexCoord4iARB + .globl glMultiTexCoord4iv ; .set glMultiTexCoord4iv, glMultiTexCoord4ivARB + .globl glMultiTexCoord4s ; .set glMultiTexCoord4s, glMultiTexCoord4sARB + .globl glMultiTexCoord4sv ; .set glMultiTexCoord4sv, glMultiTexCoord4svARB + .globl glLoadTransposeMatrixf ; .set glLoadTransposeMatrixf, glLoadTransposeMatrixfARB + .globl glLoadTransposeMatrixd ; .set glLoadTransposeMatrixd, glLoadTransposeMatrixdARB + .globl glMultTransposeMatrixf ; .set glMultTransposeMatrixf, glMultTransposeMatrixfARB + .globl glMultTransposeMatrixd ; .set glMultTransposeMatrixd, glMultTransposeMatrixdARB + .globl glSampleCoverage ; .set glSampleCoverage, glSampleCoverageARB + .globl glDrawBuffersATI ; .set glDrawBuffersATI, glDrawBuffersARB + .globl glSampleMaskEXT ; .set glSampleMaskEXT, glSampleMaskSGIS + .globl glSamplePatternEXT ; .set glSamplePatternEXT, glSamplePatternSGIS + .globl glPointParameterf ; .set glPointParameterf, glPointParameterfEXT + .globl glPointParameterfARB ; .set glPointParameterfARB, glPointParameterfEXT + .globl glPointParameterfSGIS ; .set glPointParameterfSGIS, glPointParameterfEXT + .globl glPointParameterfv ; .set glPointParameterfv, glPointParameterfvEXT + .globl glPointParameterfvARB ; .set glPointParameterfvARB, glPointParameterfvEXT + .globl glPointParameterfvSGIS ; .set glPointParameterfvSGIS, glPointParameterfvEXT + .globl glWindowPos2d ; .set glWindowPos2d, glWindowPos2dMESA + .globl glWindowPos2dARB ; .set glWindowPos2dARB, glWindowPos2dMESA + .globl glWindowPos2dv ; .set glWindowPos2dv, glWindowPos2dvMESA + .globl glWindowPos2dvARB ; .set glWindowPos2dvARB, glWindowPos2dvMESA + .globl glWindowPos2f ; .set glWindowPos2f, glWindowPos2fMESA + .globl glWindowPos2fARB ; .set glWindowPos2fARB, glWindowPos2fMESA + .globl glWindowPos2fv ; .set glWindowPos2fv, glWindowPos2fvMESA + .globl glWindowPos2fvARB ; .set glWindowPos2fvARB, glWindowPos2fvMESA + .globl glWindowPos2i ; .set glWindowPos2i, glWindowPos2iMESA + .globl glWindowPos2iARB ; .set glWindowPos2iARB, glWindowPos2iMESA + .globl glWindowPos2iv ; .set glWindowPos2iv, glWindowPos2ivMESA + .globl glWindowPos2ivARB ; .set glWindowPos2ivARB, glWindowPos2ivMESA + .globl glWindowPos2s ; .set glWindowPos2s, glWindowPos2sMESA + .globl glWindowPos2sARB ; .set glWindowPos2sARB, glWindowPos2sMESA + .globl glWindowPos2sv ; .set glWindowPos2sv, glWindowPos2svMESA + .globl glWindowPos2svARB ; .set glWindowPos2svARB, glWindowPos2svMESA + .globl glWindowPos3d ; .set glWindowPos3d, glWindowPos3dMESA + .globl glWindowPos3dARB ; .set glWindowPos3dARB, glWindowPos3dMESA + .globl glWindowPos3dv ; .set glWindowPos3dv, glWindowPos3dvMESA + .globl glWindowPos3dvARB ; .set glWindowPos3dvARB, glWindowPos3dvMESA + .globl glWindowPos3f ; .set glWindowPos3f, glWindowPos3fMESA + .globl glWindowPos3fARB ; .set glWindowPos3fARB, glWindowPos3fMESA + .globl glWindowPos3fv ; .set glWindowPos3fv, glWindowPos3fvMESA + .globl glWindowPos3fvARB ; .set glWindowPos3fvARB, glWindowPos3fvMESA + .globl glWindowPos3i ; .set glWindowPos3i, glWindowPos3iMESA + .globl glWindowPos3iARB ; .set glWindowPos3iARB, glWindowPos3iMESA + .globl glWindowPos3iv ; .set glWindowPos3iv, glWindowPos3ivMESA + .globl glWindowPos3ivARB ; .set glWindowPos3ivARB, glWindowPos3ivMESA + .globl glWindowPos3s ; .set glWindowPos3s, glWindowPos3sMESA + .globl glWindowPos3sARB ; .set glWindowPos3sARB, glWindowPos3sMESA + .globl glWindowPos3sv ; .set glWindowPos3sv, glWindowPos3svMESA + .globl glWindowPos3svARB ; .set glWindowPos3svARB, glWindowPos3svMESA + .globl glBlendFuncSeparate ; .set glBlendFuncSeparate, glBlendFuncSeparateEXT + .globl glBlendFuncSeparateINGR ; .set glBlendFuncSeparateINGR, glBlendFuncSeparateEXT + .globl glFogCoordf ; .set glFogCoordf, glFogCoordfEXT + .globl glFogCoordfv ; .set glFogCoordfv, glFogCoordfvEXT + .globl glFogCoordd ; .set glFogCoordd, glFogCoorddEXT + .globl glFogCoorddv ; .set glFogCoorddv, glFogCoorddvEXT + .globl glFogCoordPointer ; .set glFogCoordPointer, glFogCoordPointerEXT + .globl glCompressedTexImage3D ; .set glCompressedTexImage3D, glCompressedTexImage3DARB + .globl glCompressedTexImage2D ; .set glCompressedTexImage2D, glCompressedTexImage2DARB + .globl glCompressedTexImage1D ; .set glCompressedTexImage1D, glCompressedTexImage1DARB + .globl glCompressedTexSubImage3D ; .set glCompressedTexSubImage3D, glCompressedTexSubImage3DARB + .globl glCompressedTexSubImage2D ; .set glCompressedTexSubImage2D, glCompressedTexSubImage2DARB + .globl glCompressedTexSubImage1D ; .set glCompressedTexSubImage1D, glCompressedTexSubImage1DARB + .globl glGetCompressedTexImage ; .set glGetCompressedTexImage, glGetCompressedTexImageARB + .globl glSecondaryColor3b ; .set glSecondaryColor3b, glSecondaryColor3bEXT + .globl glSecondaryColor3bv ; .set glSecondaryColor3bv, glSecondaryColor3bvEXT + .globl glSecondaryColor3d ; .set glSecondaryColor3d, glSecondaryColor3dEXT + .globl glSecondaryColor3dv ; .set glSecondaryColor3dv, glSecondaryColor3dvEXT + .globl glSecondaryColor3f ; .set glSecondaryColor3f, glSecondaryColor3fEXT + .globl glSecondaryColor3fv ; .set glSecondaryColor3fv, glSecondaryColor3fvEXT + .globl glSecondaryColor3i ; .set glSecondaryColor3i, glSecondaryColor3iEXT + .globl glSecondaryColor3iv ; .set glSecondaryColor3iv, glSecondaryColor3ivEXT + .globl glSecondaryColor3s ; .set glSecondaryColor3s, glSecondaryColor3sEXT + .globl glSecondaryColor3sv ; .set glSecondaryColor3sv, glSecondaryColor3svEXT + .globl glSecondaryColor3ub ; .set glSecondaryColor3ub, glSecondaryColor3ubEXT + .globl glSecondaryColor3ubv ; .set glSecondaryColor3ubv, glSecondaryColor3ubvEXT + .globl glSecondaryColor3ui ; .set glSecondaryColor3ui, glSecondaryColor3uiEXT + .globl glSecondaryColor3uiv ; .set glSecondaryColor3uiv, glSecondaryColor3uivEXT + .globl glSecondaryColor3us ; .set glSecondaryColor3us, glSecondaryColor3usEXT + .globl glSecondaryColor3usv ; .set glSecondaryColor3usv, glSecondaryColor3usvEXT + .globl glSecondaryColorPointer ; .set glSecondaryColorPointer, glSecondaryColorPointerEXT + .globl glBindProgramARB ; .set glBindProgramARB, glBindProgramNV + .globl glDeleteProgramsARB ; .set glDeleteProgramsARB, glDeleteProgramsNV + .globl glGenProgramsARB ; .set glGenProgramsARB, glGenProgramsNV + .globl glGetVertexAttribPointervARB ; .set glGetVertexAttribPointervARB, glGetVertexAttribPointervNV + .globl glIsProgramARB ; .set glIsProgramARB, glIsProgramNV + .globl glPointParameteri ; .set glPointParameteri, glPointParameteriNV + .globl glPointParameteriv ; .set glPointParameteriv, glPointParameterivNV + .globl glMultiDrawArrays ; .set glMultiDrawArrays, glMultiDrawArraysEXT + .globl glMultiDrawElements ; .set glMultiDrawElements, glMultiDrawElementsEXT + .globl glBindBuffer ; .set glBindBuffer, glBindBufferARB + .globl glBufferData ; .set glBufferData, glBufferDataARB + .globl glBufferSubData ; .set glBufferSubData, glBufferSubDataARB + .globl glDeleteBuffers ; .set glDeleteBuffers, glDeleteBuffersARB + .globl glGenBuffers ; .set glGenBuffers, glGenBuffersARB + .globl glGetBufferParameteriv ; .set glGetBufferParameteriv, glGetBufferParameterivARB + .globl glGetBufferPointerv ; .set glGetBufferPointerv, glGetBufferPointervARB + .globl glGetBufferSubData ; .set glGetBufferSubData, glGetBufferSubDataARB + .globl glIsBuffer ; .set glIsBuffer, glIsBufferARB + .globl glMapBuffer ; .set glMapBuffer, glMapBufferARB + .globl glUnmapBuffer ; .set glUnmapBuffer, glUnmapBufferARB + .globl glGenQueries ; .set glGenQueries, glGenQueriesARB + .globl glDeleteQueries ; .set glDeleteQueries, glDeleteQueriesARB + .globl glIsQuery ; .set glIsQuery, glIsQueryARB + .globl glBeginQuery ; .set glBeginQuery, glBeginQueryARB + .globl glEndQuery ; .set glEndQuery, glEndQueryARB + .globl glGetQueryiv ; .set glGetQueryiv, glGetQueryivARB + .globl glGetQueryObjectiv ; .set glGetQueryObjectiv, glGetQueryObjectivARB + .globl glGetQueryObjectuiv ; .set glGetQueryObjectuiv, glGetQueryObjectuivARB + .globl glBlendEquationSeparateATI ; .set glBlendEquationSeparateATI, glBlendEquationSeparateEXT + +#if defined(GLX_USE_TLS) && defined(__linux__) + .section ".note.ABI-tag", "a" + .p2align 2 + .long 1f - 0f /* name length */ + .long 3f - 2f /* data length */ + .long 1 /* note length */ +0: .asciz "GNU" /* vendor name */ +1: .p2align 2 +2: .long 0 /* note data: the ABI tag */ + .long 2,4,20 /* Minimum kernel version w/TLS */ +3: .p2align 2 /* pad out section */ +#endif /* GLX_USE_TLS */ diff --git a/reactos/dll/mesa32/src/x86-64/matypes.h b/reactos/dll/mesa32/src/x86-64/matypes.h new file mode 100644 index 00000000000..b601d677cff --- /dev/null +++ b/reactos/dll/mesa32/src/x86-64/matypes.h @@ -0,0 +1,164 @@ +/* + * This file is automatically generated from the Mesa internal type + * definitions. Do not edit directly. + */ + +#ifndef __ASM_TYPES_H__ +#define __ASM_TYPES_H__ + + + +/* ============================================================= + * Offsets for GLcontext + */ + +#define CTX_DRIVER_CTX 908 + +#define CTX_LIGHT_ENABLED 38596 +#define CTX_LIGHT_SHADE_MODEL 38600 +#define CTX_LIGHT_COLOR_MAT_FACE 38604 +#define CTX_LIGHT_COLOR_MAT_MODE 38608 +#define CTX_LIGHT_COLOR_MAT_MASK 38612 +#define CTX_LIGHT_COLOR_MAT_ENABLED 38616 +#define CTX_LIGHT_ENABLED_LIST 38620 +#define CTX_LIGHT_NEED_VERTS 42977 +#define CTX_LIGHT_FLAGS 42980 +#define CTX_LIGHT_BASE_COLOR 42984 + + +/* ============================================================= + * Offsets for struct vertex_buffer + */ + +#define VB_SIZE 0 +#define VB_COUNT 4 + +#define VB_ELTS 8 +#define VB_OBJ_PTR 12 +#define VB_EYE_PTR 16 +#define VB_CLIP_PTR 20 +#define VB_PROJ_CLIP_PTR 24 +#define VB_CLIP_OR_MASK 28 +#define VB_CLIP_MASK 32 +#define VB_NORMAL_PTR 36 +#define VB_EDGE_FLAG 44 +#define VB_TEX0_COORD_PTR 48 +#define VB_TEX1_COORD_PTR 52 +#define VB_TEX2_COORD_PTR 56 +#define VB_TEX3_COORD_PTR 60 +#define VB_INDEX_PTR 80 +#define VB_COLOR_PTR 88 +#define VB_SECONDARY_COLOR_PTR 96 +#define VB_FOG_COORD_PTR 108 +#define VB_POINT_SIZE_PTR 104 +#define VB_PRIMITIVE 112 + +#define VB_LAST_CLIPPED 244 + +/* + * Flags for struct vertex_buffer + */ + +#define VERT_BIT_OBJ 0x1 +#define VERT_BIT_NORM 0x4 +#define VERT_BIT_RGBA 0x8 +#define VERT_BIT_SPEC_RGB 0x10 +#define VERT_BIT_FOG_COORD 0x20 +#define VERT_BIT_TEX0 0x100 +#define VERT_BIT_TEX1 0x200 +#define VERT_BIT_TEX2 0x400 +#define VERT_BIT_TEX3 0x800 + + +/* ============================================================= + * Offsets for GLvector4f + */ + +#define V4F_DATA 0 +#define V4F_START 4 +#define V4F_COUNT 8 +#define V4F_STRIDE 12 +#define V4F_SIZE 16 +#define V4F_FLAGS 20 + +/* + * Flags for GLvector4f + */ + +#define VEC_MALLOC 0x10 +#define VEC_NOT_WRITEABLE 0x40 +#define VEC_BAD_STRIDE 0x100 + +#define VEC_SIZE_1 0x1 +#define VEC_SIZE_2 0x3 +#define VEC_SIZE_3 0x7 +#define VEC_SIZE_4 0xf + + +/* ============================================================= + * Offsets for GLmatrix + */ + +#define MATRIX_DATA 0 +#define MATRIX_INV 4 +#define MATRIX_FLAGS 8 +#define MATRIX_TYPE 12 + + +/* ============================================================= + * Offsets for struct gl_light + */ + +#define LIGHT_NEXT 0 +#define LIGHT_PREV 4 + +#define LIGHT_AMBIENT 8 +#define LIGHT_DIFFUSE 24 +#define LIGHT_SPECULAR 40 +#define LIGHT_EYE_POSITION 56 +#define LIGHT_EYE_DIRECTION 72 +#define LIGHT_SPOT_EXPONENT 88 +#define LIGHT_SPOT_CUTOFF 92 +#define LIGHT_COS_CUTOFF 96 +#define LIGHT_CONST_ATTEN 100 +#define LIGHT_LINEAR_ATTEN 104 +#define LIGHT_QUADRATIC_ATTEN 108 +#define LIGHT_ENABLED 112 + +#define LIGHT_FLAGS 116 + +#define LIGHT_POSITION 120 +#define LIGHT_VP_INF_NORM 136 +#define LIGHT_H_INF_NORM 148 +#define LIGHT_NORM_DIRECTION 160 +#define LIGHT_VP_INF_SPOT_ATTEN 176 + +#define LIGHT_SPOT_EXP_TABLE 180 +#define LIGHT_MAT_AMBIENT 4276 +#define LIGHT_MAT_DIFFUSE 4300 +#define LIGHT_MAT_SPECULAR 4324 + +#define SIZEOF_GL_LIGHT 4356 + +/* + * Flags for struct gl_light + */ + +#define LIGHT_SPOT 0x1 +#define LIGHT_LOCAL_VIEWER 0x2 +#define LIGHT_POSITIONAL 0x4 + +#define LIGHT_NEED_VERTICES 0x6 + + +/* ============================================================= + * Offsets for struct gl_lightmodel + */ + +#define LIGHT_MODEL_AMBIENT 0 +#define LIGHT_MODEL_LOCAL_VIEWER 16 +#define LIGHT_MODEL_TWO_SIDE 17 +#define LIGHT_MODEL_COLOR_CONTROL 20 + + +#endif /* __ASM_TYPES_H__ */ diff --git a/reactos/dll/mesa32/src/x86-64/x86-64.c b/reactos/dll/mesa32/src/x86-64/x86-64.c new file mode 100644 index 00000000000..e70bc66274d --- /dev/null +++ b/reactos/dll/mesa32/src/x86-64/x86-64.c @@ -0,0 +1,115 @@ +/* $Id: x86-64.c,v 1.1 2005/05/07 16:59:59 brianp Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * 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. + */ + +/* + * x86-64 optimizations shamelessy converted from x86/sse/3dnow assembly by + * Mikko Tiihonen + */ + +#ifdef USE_X86_64_ASM + +#include "glheader.h" +#include "context.h" +#include "math/m_xform.h" +#include "tnl/t_context.h" +#include "x86-64.h" +#include "../x86/common_x86_macros.h" + +#ifdef DEBUG +#include "math/m_debug.h" +#endif + +DECLARE_XFORM_GROUP( x86_64, 4 ) + +#endif + +/* +extern void _mesa_x86_64_transform_points4_general( XFORM_ARGS ); +extern void _mesa_x86_64_transform_points4_identity( XFORM_ARGS ); +extern void _mesa_x86_64_transform_points4_perspective( XFORM_ARGS ); +extern void _mesa_x86_64_transform_points4_3d( XFORM_ARGS ); +extern void _mesa_x86_64_transform_points4_3d_no_rot( XFORM_ARGS ); +extern void _mesa_x86_64_transform_points4_2d_no_rot( XFORM_ARGS ); +extern void _mesa_x86_64_transform_points4_2d( XFORM_ARGS ); +*/ + +#ifdef USE_X86_64_ASM +static void message( const char *msg ) +{ + GLboolean debug; +#ifdef DEBUG + debug = GL_TRUE; +#else + if ( _mesa_getenv( "MESA_DEBUG" ) ) { + debug = GL_TRUE; + } else { + debug = GL_FALSE; + } +#endif + if ( debug ) { + fprintf( stderr, "%s", msg ); + } +} +#endif + + +void _mesa_init_all_x86_64_transform_asm(void) +{ +#ifdef USE_X86_64_ASM + + if ( _mesa_getenv( "MESA_NO_ASM" ) ) { + return; + } + + message("Initializing x86-64 optimizations\n"); + + ASSIGN_XFORM_GROUP( x86_64, 4 ); + + /* + _mesa_transform_tab[4][MATRIX_GENERAL] = + _mesa_x86_64_transform_points4_general; + _mesa_transform_tab[4][MATRIX_IDENTITY] = + _mesa_x86_64_transform_points4_identity; + _mesa_transform_tab[4][MATRIX_3D] = + _mesa_x86_64_transform_points4_3d; + _mesa_transform_tab[4][MATRIX_3D_NO_ROT] = + _mesa_x86_64_transform_points4_3d_no_rot; + _mesa_transform_tab[4][MATRIX_PERSPECTIVE] = + _mesa_x86_64_transform_points4_perspective; + _mesa_transform_tab[4][MATRIX_2D_NO_ROT] = + _mesa_x86_64_transform_points4_2d_no_rot; + _mesa_transform_tab[4][MATRIX_2D] = + _mesa_x86_64_transform_points4_2d; + */ + +#ifdef DEBUG + _math_test_all_transform_functions("x86_64"); + _math_test_all_cliptest_functions("x86_64"); + _math_test_all_normal_transform_functions("x86_64"); +#endif + +#endif +} diff --git a/reactos/dll/mesa32/src/x86-64/x86-64.h b/reactos/dll/mesa32/src/x86-64/x86-64.h new file mode 100644 index 00000000000..fdbd154d5d6 --- /dev/null +++ b/reactos/dll/mesa32/src/x86-64/x86-64.h @@ -0,0 +1,32 @@ +/* $Id: x86-64.h,v 1.1 2005/05/07 16:59:59 brianp Exp $ */ + +/* + * 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 __X86_64_ASM_H__ +#define __X86_64_ASM_H__ + +extern void _mesa_init_all_x86_64_transform_asm( void ); + +#endif diff --git a/reactos/dll/mesa32/src/x86-64/xform4.S b/reactos/dll/mesa32/src/x86-64/xform4.S new file mode 100644 index 00000000000..622c3f0c251 --- /dev/null +++ b/reactos/dll/mesa32/src/x86-64/xform4.S @@ -0,0 +1,458 @@ +/* $Id: xform4.S,v 1.1 2005/05/07 16:59:59 brianp Exp $ */ + +/* + * 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. + */ + +#ifdef USE_X86_64_ASM + +#include "matypes.h" + +.text + +.align 16 + +.globl _mesa_x86_64_transform_points4_general +_mesa_x86_64_transform_points4_general: +/* + * rdi = dest + * rsi = matrix + * rdx = source + */ + movl V4F_COUNT(%rdx), %ecx /* count */ + movzx V4F_STRIDE(%rdx), %eax /* stride */ + + movl %ecx, V4F_COUNT(%rdi) /* set dest count */ + movl $4, V4F_SIZE(%rdi) /* set dest size */ + .byte 0x66, 0x66, 0x66, 0x90 /* manual align += 3 */ + orl $VEC_SIZE_4, V4F_FLAGS(%rdi)/* set dest flags */ + + testl %ecx, %ecx /* verify non-zero count */ + prefetchnta 64(%rsi) + jz p4_general_done + + movq V4F_START(%rdx), %rdx /* ptr to first src vertex */ + movq V4F_START(%rdi), %rdi /* ptr to first dest vertex */ + + prefetch 16(%rdx) + + movaps 0(%rsi), %xmm4 /* m3 | m2 | m1 | m0 */ + movaps 16(%rsi), %xmm5 /* m7 | m6 | m5 | m4 */ + .byte 0x66, 0x66, 0x90 /* manual align += 3 */ + movaps 32(%rsi), %xmm6 /* m11 | m10 | m9 | m8 */ + movaps 48(%rsi), %xmm7 /* m15 | m14 | m13 | m12 */ + +p4_general_loop: + + movaps (%rdx), %xmm8 /* ox | oy | oz | ow */ + prefetchw 16(%rdi) + + pshufd $0x00, %xmm8, %xmm0 /* ox | ox | ox | ox */ + addq %rax, %rdx + pshufd $0x55, %xmm8, %xmm1 /* oy | oy | oy | oy */ + mulps %xmm4, %xmm0 /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ + pshufd $0xAA, %xmm8, %xmm2 /* oz | oz | oz | ox */ + mulps %xmm5, %xmm1 /* oy*m7 | oy*m6 | oy*m5 | oy*m4 */ + pshufd $0xFF, %xmm8, %xmm3 /* ow | ow | ow | ow */ + mulps %xmm6, %xmm2 /* oz*m11 | oz*m10 | oz*m9 | oz*m8 */ + addps %xmm1, %xmm0 /* ox*m3+oy*m7 | ... */ + mulps %xmm7, %xmm3 /* ow*m15 | ow*m14 | ow*m13 | ow*m12 */ + addps %xmm2, %xmm0 /* ox*m3+oy*m7+oz*m11 | ... */ + prefetch 16(%rdx) + addps %xmm3, %xmm0 /* ox*m3+oy*m7+oz*m11+ow*m15 | ... */ + + movaps %xmm0, (%rdi) /* ->D(3) | ->D(2) | ->D(1) | ->D(0) */ + addq $16, %rdi + + decl %ecx + jnz p4_general_loop + +p4_general_done: + .byte 0xf3 + ret + +.section .rodata + +.align 16 +p4_constants: +.byte 0xff, 0xff, 0xff, 0xff +.byte 0xff, 0xff, 0xff, 0xff +.byte 0xff, 0xff, 0xff, 0xff +.byte 0x00, 0x00, 0x00, 0x00 + +.byte 0x00, 0x00, 0x00, 0x00 +.byte 0x00, 0x00, 0x00, 0x00 +.byte 0x00, 0x00, 0x00, 0x00 +.float 0f+1.0 + +.text +.align 16 +.globl _mesa_x86_64_transform_points4_3d +/* + * this is slower than _mesa_x86_64_transform_points4_general + * because it ensures that the last matrix row (or is it column?) is 0,0,0,1 + */ +_mesa_x86_64_transform_points4_3d: + + leaq p4_constants(%rip), %rax + + prefetchnta 64(%rsi) + + movaps (%rax), %xmm9 + movaps 16(%rax), %xmm10 + + movl V4F_COUNT(%rdx), %ecx /* count */ + movzx V4F_STRIDE(%rdx), %eax /* stride */ + + movl %ecx, V4F_COUNT(%rdi) /* set dest count */ + movl $4, V4F_SIZE(%rdi) /* set dest size */ + orl $VEC_SIZE_4, V4F_FLAGS(%rdi)/* set dest flags */ + + testl %ecx, %ecx /* verify non-zero count */ + jz p4_3d_done + + movq V4F_START(%rdx), %rdx /* ptr to first src vertex */ + movq V4F_START(%rdi), %rdi /* ptr to first dest vertex */ + + prefetch 16(%rdx) + + movaps 0(%rsi), %xmm4 /* m3 | m2 | m1 | m0 */ + movaps 16(%rsi), %xmm5 /* m7 | m6 | m5 | m4 */ + andps %xmm9, %xmm4 /* 0.0 | m2 | m1 | m0 */ + movaps 32(%rsi), %xmm6 /* m11 | m10 | m9 | m8 */ + andps %xmm9, %xmm5 /* 0.0 | m6 | m5 | m4 */ + movaps 48(%rsi), %xmm7 /* m15 | m14 | m13 | m12 */ + andps %xmm9, %xmm6 /* 0.0 | m10 | m9 | m8 */ + andps %xmm9, %xmm7 /* 0.0 | m14 | m13 | m12 */ + .byte 0x66, 0x66, 0x90 /* manual align += 3 */ + orps %xmm10, %xmm7 /* 1.0 | m14 | m13 | m12 */ + +p4_3d_loop: + + movaps (%rdx), %xmm8 /* ox | oy | oz | ow */ + prefetchw 16(%rdi) + + pshufd $0x00, %xmm8, %xmm0 /* ox | ox | ox | ox */ + addq %rax, %rdx + pshufd $0x55, %xmm8, %xmm1 /* oy | oy | oy | oy */ + mulps %xmm4, %xmm0 /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ + pshufd $0xAA, %xmm8, %xmm2 /* oz | oz | oz | ox */ + mulps %xmm5, %xmm1 /* oy*m7 | oy*m6 | oy*m5 | oy*m4 */ + pshufd $0xFF, %xmm8, %xmm3 /* ow | ow | ow | ow */ + mulps %xmm6, %xmm2 /* oz*m11 | oz*m10 | oz*m9 | oz*m8 */ + addps %xmm1, %xmm0 /* ox*m3+oy*m7 | ... */ + mulps %xmm7, %xmm3 /* ow*m15 | ow*m14 | ow*m13 | ow*m12 */ + addps %xmm2, %xmm0 /* ox*m3+oy*m7+oz*m11 | ... */ + prefetch 16(%rdx) + addps %xmm3, %xmm0 /* ox*m3+oy*m7+oz*m11+ow*m15 | ... */ + + movaps %xmm0, (%rdi) /* ->D(3) | ->D(2) | ->D(1) | ->D(0) */ + addq $16, %rdi + + dec %ecx + jnz p4_3d_loop + +p4_3d_done: + .byte 0xf3 + ret + + +.align 16 +.globl _mesa_x86_64_transform_points4_identity +_mesa_x86_64_transform_points4_identity: + + movl V4F_COUNT(%rdx), %ecx /* count */ + movzx V4F_STRIDE(%rdx), %eax /* stride */ + + movl %ecx, V4F_COUNT(%rdi) /* set dest count */ + movl $4, V4F_SIZE(%rdi) /* set dest size */ + orl $VEC_SIZE_4, V4F_FLAGS(%rdi)/* set dest flags */ + + test %ecx, %ecx + jz p4_identity_done + + movq V4F_START(%rdx), %rsi /* ptr to first src vertex */ + movq V4F_START(%rdi), %rdi /* ptr to first dest vertex */ + prefetch 64(%rsi) + prefetchw 64(%rdi) + + add %ecx, %ecx + + rep movsq + +p4_identity_done: + .byte 0xf3 + ret + + +.align 16 +.globl _mesa_x86_64_transform_points4_3d_no_rot +_mesa_x86_64_transform_points4_3d_no_rot: + + movl V4F_COUNT(%rdx), %ecx /* count */ + movzx V4F_STRIDE(%rdx), %eax /* stride */ + + movl %ecx, V4F_COUNT(%rdi) /* set dest count */ + movl $4, V4F_SIZE(%rdi) /* set dest size */ + .byte 0x66, 0x66, 0x90 /* manual align += 3 */ + orl $VEC_SIZE_4, V4F_FLAGS(%rdi)/* set dest flags */ + + test %ecx, %ecx + .byte 0x66, 0x66, 0x90 /* manual align += 3 */ + jz p4_3d_no_rot_done + + movq V4F_START(%rdx), %rdx /* ptr to first src vertex */ + movq V4F_START(%rdi), %rdi /* ptr to first dest vertex */ + + prefetch (%rdx) + + movd (%rsi), %mm0 /* | m00 */ + .byte 0x66, 0x66, 0x90 /* manual align += 3 */ + punpckldq 20(%rsi), %mm0 /* m11 | m00 */ + + movd 40(%rsi), %mm2 /* | m22 */ + movq 48(%rsi), %mm1 /* m31 | m30 */ + + punpckldq 56(%rsi), %mm2 /* m11 | m00 */ + +p4_3d_no_rot_loop: + + prefetchw 32(%rdi) + + movq (%rdx), %mm4 /* x1 | x0 */ + movq 8(%rdx), %mm5 /* x3 | x2 */ + movd 12(%rdx), %mm7 /* | x3 */ + + movq %mm5, %mm6 /* x3 | x2 */ + pfmul %mm0, %mm4 /* x1*m11 | x0*m00 */ + + punpckhdq %mm6, %mm6 /* x3 | x3 */ + pfmul %mm2, %mm5 /* x3*m32 | x2*m22 */ + + pfmul %mm1, %mm6 /* x3*m31 | x3*m30 */ + pfacc %mm7, %mm5 /* x3 | x2*m22+x3*m32 */ + + pfadd %mm6, %mm4 /* x1*m11+x3*m31 | x0*m00+x3*m30 */ + + addq %rax, %rdx + movq %mm4, (%rdi) /* write r0, r1 */ + movq %mm5, 8(%rdi) /* write r2, r3 */ + + addq $16, %rdi + + decl %ecx + prefetch 32(%rdx) + jnz p4_3d_no_rot_loop + +p4_3d_no_rot_done: + femms + ret + + +.align 16 +.globl _mesa_x86_64_transform_points4_perspective +_mesa_x86_64_transform_points4_perspective: + + movl V4F_COUNT(%rdx), %ecx /* count */ + movzx V4F_STRIDE(%rdx), %eax /* stride */ + + movl %ecx, V4F_COUNT(%rdi) /* set dest count */ + movl $4, V4F_SIZE(%rdi) /* set dest size */ + orl $VEC_SIZE_4, V4F_FLAGS(%rdi)/* set dest flags */ + + test %ecx, %ecx + .byte 0x66, 0x66, 0x90 /* manual align += 3 */ + jz p4_perspective_done + + movq V4F_START(%rdx), %rdx /* ptr to first src vertex */ + movq V4F_START(%rdi), %rdi /* ptr to first dest vertex */ + + movd (%rsi), %mm0 /* | m00 */ + pxor %mm7, %mm7 /* 0 | 0 */ + punpckldq 20(%rsi), %mm0 /* m11 | m00 */ + + movq 32(%rsi), %mm2 /* m21 | m20 */ + prefetch (%rdx) + + movd 40(%rsi), %mm1 /* | m22 */ + + .byte 0x66, 0x66, 0x90 /* manual align += 3 */ + punpckldq 56(%rsi), %mm1 /* m32 | m22 */ + + +p4_perspective_loop: + + prefetchw 32(%rdi) /* prefetch 2 vertices ahead */ + + movq (%rdx), %mm4 /* x1 | x0 */ + movq 8(%rdx), %mm5 /* x3 | x2 */ + movd 8(%rdx), %mm3 /* | x2 */ + + movq %mm5, %mm6 /* x3 | x2 */ + pfmul %mm0, %mm4 /* x1*m11 | x0*m00 */ + + punpckldq %mm5, %mm5 /* x2 | x2 */ + + pfmul %mm2, %mm5 /* x2*m21 | x2*m20 */ + pfsubr %mm7, %mm3 /* | -x2 */ + + pfmul %mm1, %mm6 /* x3*m32 | x2*m22 */ + pfadd %mm4, %mm5 /* x1*m11+x2*m21 | x0*m00+x2*m20 */ + + pfacc %mm3, %mm6 /* -x2 | x2*m22+x3*m32 */ + + movq %mm5, (%rdi) /* write r0, r1 */ + addq %rax, %rdx + movq %mm6, 8(%rdi) /* write r2, r3 */ + + addq $16, %rdi + + decl %ecx + prefetch 32(%rdx) /* hopefully stride is zero */ + jnz p4_perspective_loop + +p4_perspective_done: + femms + ret + +.align 16 +.globl _mesa_x86_64_transform_points4_2d_no_rot +_mesa_x86_64_transform_points4_2d_no_rot: + + movl V4F_COUNT(%rdx), %ecx /* count */ + movzx V4F_STRIDE(%rdx), %eax /* stride */ + + movl %ecx, V4F_COUNT(%rdi) /* set dest count */ + movl $4, V4F_SIZE(%rdi) /* set dest size */ + orl $VEC_SIZE_4, V4F_FLAGS(%rdi)/* set dest flags */ + + test %ecx, %ecx + .byte 0x90 /* manual align += 1 */ + jz p4_2d_no_rot_done + + movq V4F_START(%rdx), %rdx /* ptr to first src vertex */ + movq V4F_START(%rdi), %rdi /* ptr to first dest vertex */ + + movd (%rsi), %mm0 /* | m00 */ + prefetch (%rdx) + punpckldq 20(%rsi), %mm0 /* m11 | m00 */ + + movq 48(%rsi), %mm1 /* m31 | m30 */ + +p4_2d_no_rot_loop: + + prefetchw 32(%rdi) /* prefetch 2 vertices ahead */ + + movq (%rdx), %mm4 /* x1 | x0 */ + movq 8(%rdx), %mm5 /* x3 | x2 */ + + pfmul %mm0, %mm4 /* x1*m11 | x0*m00 */ + movq %mm5, %mm6 /* x3 | x2 */ + + punpckhdq %mm6, %mm6 /* x3 | x3 */ + + addq %rax, %rdx + pfmul %mm1, %mm6 /* x3*m31 | x3*m30 */ + + prefetch 32(%rdx) /* hopefully stride is zero */ + pfadd %mm4, %mm6 /* x1*m11+x3*m31 | x0*m00+x3*m30 */ + + movq %mm6, (%rdi) /* write r0, r1 */ + movq %mm5, 8(%rdi) /* write r2, r3 */ + + addq $16, %rdi + + decl %ecx + jnz p4_2d_no_rot_loop + +p4_2d_no_rot_done: + femms + ret + + +.align 16 +.globl _mesa_x86_64_transform_points4_2d +_mesa_x86_64_transform_points4_2d: + + movl V4F_COUNT(%rdx), %ecx /* count */ + movzx V4F_STRIDE(%rdx), %eax /* stride */ + + movl %ecx, V4F_COUNT(%rdi) /* set dest count */ + movl $4, V4F_SIZE(%rdi) /* set dest size */ + .byte 0x66, 0x66, 0x90 /* manual align += 4 */ + orl $VEC_SIZE_4, V4F_FLAGS(%rdi)/* set dest flags */ + + test %ecx, %ecx + .byte 0x66, 0x66, 0x90 /* manual align += 4 */ + jz p4_2d_done + + movq V4F_START(%rdx), %rdx /* ptr to first src vertex */ + movq V4F_START(%rdi), %rdi /* ptr to first dest vertex */ + + movd (%rsi), %mm0 /* | m00 */ + movd 4(%rsi), %mm1 /* | m01 */ + + prefetch (%rdx) + + punpckldq 16(%rsi), %mm0 /* m10 | m00 */ + .byte 0x66, 0x66, 0x90 /* manual align += 4 */ + punpckldq 20(%rsi), %mm1 /* m11 | m01 */ + + movq 48(%rsi), %mm2 /* m31 | m30 */ + +p4_2d_loop: + + prefetchw 32(%rdi) /* prefetch 2 vertices ahead */ + + movq (%rdx), %mm3 /* x1 | x0 */ + movq 8(%rdx), %mm5 /* x3 | x2 */ + + movq %mm3, %mm4 /* x1 | x0 */ + movq %mm5, %mm6 /* x3 | x2 */ + + pfmul %mm1, %mm4 /* x1*m11 | x0*m01 */ + punpckhdq %mm6, %mm6 /* x3 | x3 */ + + pfmul %mm0, %mm3 /* x1*m10 | x0*m00 */ + + addq %rax, %rdx + pfacc %mm4, %mm3 /* x0*m01+x1*m11 | x0*m00+x1*m10 */ + + pfmul %mm2, %mm6 /* x3*m31 | x3*m30 */ + prefetch 32(%rdx) /* hopefully stride is zero */ + + pfadd %mm6, %mm3 /* r1 | r0 */ + + movq %mm3, (%rdi) /* write r0, r1 */ + movq %mm5, 8(%rdi) /* write r2, r3 */ + + addq $16, %rdi + + decl %ecx + jnz p4_2d_loop + +p4_2d_done: + femms + ret + +#endif diff --git a/reactos/dll/mesa32/src/x86/3dnow.c b/reactos/dll/mesa32/src/x86/3dnow.c new file mode 100644 index 00000000000..c0a4e7a1751 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/3dnow.c @@ -0,0 +1,92 @@ +/* $Id: 3dnow.c,v 1.23 2003/03/29 16:38:37 brianp Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 5.0.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. + */ + +/* + * 3DNow! optimizations contributed by + * Holger Waechtler + */ + +#include "glheader.h" +#include "context.h" +#include "math/m_xform.h" +#include "tnl/t_context.h" + +#include "3dnow.h" +#include "common_x86_macros.h" + +#ifdef DEBUG +#include "math/m_debug.h" +#endif + + +#ifdef USE_3DNOW_ASM +DECLARE_XFORM_GROUP( 3dnow, 2 ) +DECLARE_XFORM_GROUP( 3dnow, 3 ) +DECLARE_XFORM_GROUP( 3dnow, 4 ) + +DECLARE_NORM_GROUP( 3dnow ) + + +extern void _ASMAPI +_mesa_v16_3dnow_general_xform( GLfloat *first_vert, + const GLfloat *m, + const GLfloat *src, + GLuint src_stride, + GLuint count ); + +extern void _ASMAPI +_mesa_3dnow_project_vertices( GLfloat *first, + GLfloat *last, + const GLfloat *m, + GLuint stride ); + +extern void _ASMAPI +_mesa_3dnow_project_clipped_vertices( GLfloat *first, + GLfloat *last, + const GLfloat *m, + GLuint stride, + const GLubyte *clipmask ); +#endif + + +void _mesa_init_3dnow_transform_asm( void ) +{ +#ifdef USE_3DNOW_ASM + ASSIGN_XFORM_GROUP( 3dnow, 2 ); + ASSIGN_XFORM_GROUP( 3dnow, 3 ); + ASSIGN_XFORM_GROUP( 3dnow, 4 ); + + /* There's a bug somewhere in the 3dnow_normal.S file that causes + * bad shading. Disable for now. + ASSIGN_NORM_GROUP( 3dnow ); + */ + +#ifdef DEBUG + _math_test_all_transform_functions( "3DNow!" ); + _math_test_all_normal_transform_functions( "3DNow!" ); +#endif +#endif +} diff --git a/reactos/dll/mesa32/src/x86/3dnow.h b/reactos/dll/mesa32/src/x86/3dnow.h new file mode 100644 index 00000000000..1f2fd8e8b4c --- /dev/null +++ b/reactos/dll/mesa32/src/x86/3dnow.h @@ -0,0 +1,39 @@ +/* $Id: 3dnow.h,v 1.6 2002/04/09 14:58:03 keithw Exp $ */ + +/* + * 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. + */ + +/* + * 3DNow! optimizations contributed by + * Holger Waechtler + */ + +#ifndef __3DNOW_H__ +#define __3DNOW_H__ + +#include "math/m_xform.h" + +void _mesa_init_3dnow_transform_asm( void ); + +#endif diff --git a/reactos/dll/mesa32/src/x86/3dnow_normal.S b/reactos/dll/mesa32/src/x86/3dnow_normal.S new file mode 100644 index 00000000000..623849d80ce --- /dev/null +++ b/reactos/dll/mesa32/src/x86/3dnow_normal.S @@ -0,0 +1,848 @@ +/* $Id: 3dnow_normal.S,v 1.9 2005/01/04 14:33:47 brianp Exp $ */ + +/* + * 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. + */ + +/* + * 3Dnow assembly code by Holger Waechtler + */ + +#ifdef USE_3DNOW_ASM + +#include "matypes.h" +#include "norm_args.h" + + SEG_TEXT + +#define M(i) REGOFF(i * 4, ECX) +#define STRIDE REGOFF(12, ESI) + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_transform_normalize_normals) +HIDDEN(_mesa_3dnow_transform_normalize_normals) +GLNAME(_mesa_3dnow_transform_normalize_normals): + +#define FRAME_OFFSET 12 + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + PUSH_L ( EBP ) + + MOV_L ( ARG_LENGTHS, EDI ) + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_DEST, EAX ) + MOV_L ( REGOFF(V4F_COUNT, ESI), EBP ) /* dest->count = in->count */ + MOV_L ( EBP, REGOFF(V4F_COUNT, EAX) ) + MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ + MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ + MOV_L ( ARG_MAT, ECX ) + MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ + + CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ + JE ( LLBL (G3TN_end) ) + + MOV_L ( REGOFF (V4F_COUNT, ESI), EBP ) + FEMMS + + PUSH_L ( EBP ) + PUSH_L ( EAX ) + PUSH_L ( EDX ) /* save counter & pointer for */ + /* the normalize pass */ +#undef FRAME_OFFSET +#define FRAME_OFFSET 24 + + MOVQ ( M(0), MM3 ) /* m1 | m0 */ + MOVQ ( M(4), MM4 ) /* m5 | m4 */ + + MOVD ( M(2), MM5 ) /* | m2 */ + PUNPCKLDQ ( M(6), MM5 ) /* m6 | m2 */ + + MOVQ ( M(8), MM6 ) /* m9 | m8 */ + MOVQ ( M(10), MM7 ) /* | m10 */ + + CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ + JNE ( LLBL (G3TN_scale_end ) ) + + MOVD ( ARG_SCALE, MM0 ) /* | scale */ + PUNPCKLDQ ( MM0, MM0 ) /* scale | scale */ + + PFMUL ( MM0, MM3 ) /* scale * m1 | scale * m0 */ + PFMUL ( MM0, MM4 ) /* scale * m5 | scale * m4 */ + PFMUL ( MM0, MM5 ) /* scale * m6 | scale * m2 */ + PFMUL ( MM0, MM6 ) /* scale * m9 | scale * m8 */ + PFMUL ( MM0, MM7 ) /* | scale * m10 */ + +ALIGNTEXT32 +LLBL (G3TN_scale_end): +LLBL (G3TN_transform): + MOVQ ( REGIND (EDX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF (8, EDX), MM2 ) /* | x2 */ + + MOVQ ( MM0, MM1 ) /* x1 | x0 */ + PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ + + PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + PREFETCHW ( REGIND(EAX) ) + + PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ + PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ + + PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ + PFADD ( MM2, MM0 ) /* x0*m4+x1*m5+x2*m6| x0*m0+...+x2**/ + + MOVQ ( REGIND (EDX), MM1 ) /* x1 | x0 */ + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ + + PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ + MOVD ( REGOFF (8, EDX), MM2 ) /* | x2 */ + + PFMUL ( MM7, MM2 ) /* | x2*m10 */ + PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ + + PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m*/ + ADD_L ( STRIDE, EDX ) /* next normal */ + + PREFETCH ( REGIND(EDX) ) + + MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ + DEC_L ( EBP ) /* decrement normal counter */ + JA ( LLBL (G3TN_transform) ) + + + POP_L ( EDX ) /* end of transform --- */ + POP_L ( EAX ) /* now normalizing ... */ + POP_L ( EBP ) + + CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ + JE ( LLBL (G3TN_norm ) ) /* calculate lengths */ + + +ALIGNTEXT32 +LLBL (G3TN_norm_w_lengths): + + PREFETCHW ( REGOFF(12,EAX) ) + + MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ + + MOVD ( REGIND (EDI), MM3 ) /* | length (x) */ + PFMUL ( MM3, MM1 ) /* | x2 (normalize*/ + + PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ + PFMUL ( MM3, MM0 ) /* x1 (normalized) | x0 (normalize*/ + + ADD_L ( STRIDE, EDX ) /* next normal */ + ADD_L ( CONST(4), EDI ) /* next length */ + + PREFETCH ( REGIND(EDI) ) + + MOVQ ( MM0, REGIND(EAX) ) /* write new x0, x1 */ + MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */ + + ADD_L ( CONST(16), EAX ) /* next r */ + DEC_L ( EBP ) /* decrement normal counter */ + + JA ( LLBL (G3TN_norm_w_lengths) ) + JMP ( LLBL (G3TN_exit_3dnow) ) + +ALIGNTEXT32 +LLBL (G3TN_norm): + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND (EAX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ + + MOVQ ( MM0, MM3 ) /* x1 | x0 */ + MOVQ ( MM1, MM4 ) /* | x2 */ + + PFMUL ( MM0, MM3 ) /* x1*x1 | x0*x0 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + PFMUL ( MM1, MM4 ) /* | x2*x2 */ + PFADD ( MM4, MM3 ) /* | x0*x0+x2*x2 */ + + PFACC ( MM3, MM3 ) /* **not used** | x0*x0+x1*x1+x2**/ + PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ + + MOVQ ( MM5, MM4 ) + PUNPCKLDQ ( MM3, MM3 ) + + DEC_L ( EBP ) /* decrement normal counter */ + PFMUL ( MM5, MM5 ) + + PFRSQIT1 ( MM3, MM5 ) + PFRCPIT2 ( MM4, MM5 ) + + PFMUL ( MM5, MM0 ) /* x1 (normalized) | x0 (normalize*/ + + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write new x0, x1 */ + PFMUL ( MM5, MM1 ) /* | x2 (normalize*/ + + MOVD ( MM1, REGOFF(-8, EAX) ) /* write new x2 */ + JA ( LLBL (G3TN_norm) ) + +LLBL (G3TN_exit_3dnow): + FEMMS + +LLBL (G3TN_end): + POP_L ( EBP ) + POP_L ( ESI ) + POP_L ( EDI ) + RET + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_transform_normalize_normals_no_rot) +HIDDEN(_mesa_3dnow_transform_normalize_normals_no_rot) +GLNAME(_mesa_3dnow_transform_normalize_normals_no_rot): + +#undef FRAME_OFFSET +#define FRAME_OFFSET 12 + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + PUSH_L ( EBP ) + + MOV_L ( ARG_LENGTHS, EDI ) + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_DEST, EAX ) + MOV_L ( REGOFF(V4F_COUNT, ESI), EBP ) /* dest->count = in->count */ + MOV_L ( EBP, REGOFF(V4F_COUNT, EAX) ) + MOV_L ( ARG_MAT, ECX ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ + MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ + MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ + + CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ + JE ( LLBL (G3TNNR_end) ) + + FEMMS + + MOVD ( M(0), MM0 ) /* | m0 */ + PUNPCKLDQ ( M(5), MM0 ) /* m5 | m0 */ + + MOVD ( M(10), MM2 ) /* | m10 */ + PUNPCKLDQ ( MM2, MM2 ) /* m10 | m10 */ + + CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ + JNE ( LLBL (G3TNNR_scale_end ) ) + + MOVD ( ARG_SCALE, MM7 ) /* | scale */ + PUNPCKLDQ ( MM7, MM7 ) /* scale | scale */ + + PFMUL ( MM7, MM0 ) /* scale * m5 | scale * m0 */ + PFMUL ( MM7, MM2 ) /* scale * m10 | scale * m10 */ + +ALIGNTEXT32 +LLBL (G3TNNR_scale_end): + CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ + JE ( LLBL (G3TNNR_norm) ) /* need to calculate lengths */ + + MOVD ( REGIND(EDI), MM3 ) /* | length (x) */ + + +ALIGNTEXT32 +LLBL (G3TNNR_norm_w_lengths): /* use precalculated lengths */ + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND(EDX), MM6 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EDX), MM7 ) /* | x2 */ + + PFMUL ( MM0, MM6 ) /* x1*m5 | x0*m0 */ + ADD_L ( STRIDE, EDX ) /* next normal */ + + PREFETCH ( REGIND(EDX) ) + + PFMUL ( MM2, MM7 ) /* | x2*m10 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + PFMUL ( MM3, MM7 ) /* | x2 (normalized) */ + PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ + + ADD_L ( CONST(4), EDI ) /* next length */ + PFMUL ( MM3, MM6 ) /* x1 (normalized) | x0 (normalized) */ + + DEC_L ( EBP ) /* decrement normal counter */ + MOVQ ( MM6, REGOFF(-16, EAX) ) /* write r0, r1 */ + + MOVD ( MM7, REGOFF(-8, EAX) ) /* write r2 */ + MOVD ( REGIND(EDI), MM3 ) /* | length (x) */ + + JA ( LLBL (G3TNNR_norm_w_lengths) ) + JMP ( LLBL (G3TNNR_exit_3dnow) ) + +ALIGNTEXT32 +LLBL (G3TNNR_norm): /* need to calculate lengths */ + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND(EDX), MM6 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EDX), MM7 ) /* | x2 */ + + PFMUL ( MM0, MM6 ) /* x1*m5 | x0*m0 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + PFMUL ( MM2, MM7 ) /* | x2*m10 */ + MOVQ ( MM6, MM3 ) /* x1 (transformed)| x0 (transformed) */ + + MOVQ ( MM7, MM4 ) /* | x2 (transformed) */ + PFMUL ( MM6, MM3 ) /* x1*x1 | x0*x0 */ + + + PFMUL ( MM7, MM4 ) /* | x2*x2 */ + PFACC ( MM3, MM3 ) /* **not used** | x0*x0+x1*x1 */ + + PFADD ( MM4, MM3 ) /* | x0*x0+x1*x1+x2*x2*/ + ADD_L ( STRIDE, EDX ) /* next normal */ + + PREFETCH ( REGIND(EDX) ) + + PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ + MOVQ ( MM5, MM4 ) + + PUNPCKLDQ ( MM3, MM3 ) + PFMUL ( MM5, MM5 ) + + PFRSQIT1 ( MM3, MM5 ) + DEC_L ( EBP ) /* decrement normal counter */ + + PFRCPIT2 ( MM4, MM5 ) + PFMUL ( MM5, MM6 ) /* x1 (normalized) | x0 (normalized) */ + + MOVQ ( MM6, REGOFF(-16, EAX) ) /* write r0, r1 */ + PFMUL ( MM5, MM7 ) /* | x2 (normalized) */ + + MOVD ( MM7, REGOFF(-8, EAX) ) /* write r2 */ + JA ( LLBL (G3TNNR_norm) ) + + +LLBL (G3TNNR_exit_3dnow): + FEMMS + +LLBL (G3TNNR_end): + POP_L ( EBP ) + POP_L ( ESI ) + POP_L ( EDI ) + RET + + + + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_transform_rescale_normals_no_rot) +HIDDEN(_mesa_3dnow_transform_rescale_normals_no_rot) +GLNAME(_mesa_3dnow_transform_rescale_normals_no_rot): + +#undef FRAME_OFFSET +#define FRAME_OFFSET 12 + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + PUSH_L ( EBP ) + + MOV_L ( ARG_IN, EAX ) + MOV_L ( ARG_DEST, EDX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EBP ) /* dest->count = in->count */ + MOV_L ( EBP, REGOFF(V4F_COUNT, EDX) ) + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_MAT, ECX ) + MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ + MOV_L ( REGOFF(V4F_START, EDX), EAX ) /* dest->start */ + MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ + + CMP_L ( CONST(0), EBP ) + JE ( LLBL (G3TRNR_end) ) + + FEMMS + + MOVD ( ARG_SCALE, MM6 ) /* | scale */ + PUNPCKLDQ ( MM6, MM6 ) /* scale | scale */ + + MOVD ( REGIND(ECX), MM0 ) /* | m0 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m5 | m0 */ + + PFMUL ( MM6, MM0 ) /* scale*m5 | scale*m0 */ + MOVD ( REGOFF(40, ECX), MM2 ) /* | m10 */ + + PFMUL ( MM6, MM2 ) /* | scale*m10 */ + +ALIGNTEXT32 +LLBL (G3TRNR_rescale): + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND(EDX), MM4 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EDX), MM5 ) /* | x2 */ + + PFMUL ( MM0, MM4 ) /* x1*m5 | x0*m0 */ + ADD_L ( STRIDE, EDX ) /* next normal */ + + PREFETCH ( REGIND(EDX) ) + + PFMUL ( MM2, MM5 ) /* | x2*m10 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + DEC_L ( EBP ) /* decrement normal counter */ + MOVQ ( MM4, REGOFF(-16, EAX) ) /* write r0, r1 */ + + MOVD ( MM5, REGOFF(-8, EAX) ) /* write r2 */ + JA ( LLBL (G3TRNR_rescale) ) /* cnt > 0 ? -> process next normal */ + + FEMMS + +LLBL (G3TRNR_end): + POP_L ( EBP ) + POP_L ( ESI ) + POP_L ( EDI ) + RET + + + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_transform_rescale_normals) +HIDDEN(_mesa_3dnow_transform_rescale_normals) +GLNAME(_mesa_3dnow_transform_rescale_normals): + +#undef FRAME_OFFSET +#define FRAME_OFFSET 8 + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_DEST, EAX ) + MOV_L ( ARG_MAT, ECX ) + MOV_L ( REGOFF(V4F_COUNT, ESI), EDI ) /* dest->count = in->count */ + MOV_L ( EDI, REGOFF(V4F_COUNT, EAX) ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ + MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ + MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ + + CMP_L ( CONST(0), EDI ) + JE ( LLBL (G3TR_end) ) + + FEMMS + + MOVQ ( REGIND(ECX), MM3 ) /* m1 | m0 */ + + MOVQ ( REGOFF(16,ECX), MM4 ) /* m5 | m4 */ + MOVD ( ARG_SCALE, MM0 ) /* scale */ + + MOVD ( REGOFF(8,ECX), MM5 ) /* | m2 */ + PUNPCKLDQ ( MM0, MM0 ) /* scale | scale */ + + PUNPCKLDQ ( REGOFF(24, ECX), MM5 ) + PFMUL ( MM0, MM3 ) /* scale*m1 | scale*m0 */ + + MOVQ ( REGOFF(32, ECX), MM6 ) /* m9 | m8*/ + PFMUL ( MM0, MM4 ) /* scale*m5 | scale*m4 */ + + MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */ + PFMUL ( MM0, MM5 ) /* scale*m6 | scale*m2 */ + + PFMUL ( MM0, MM6 ) /* scale*m9 | scale*m8 */ + + PFMUL ( MM0, MM7 ) /* | scale*m10 */ + +ALIGNTEXT32 +LLBL (G3TR_rescale): + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ + + MOVQ ( MM0, MM1 ) /* x1 | x0 */ + PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ + + PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ + PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ + + MOVQ ( REGIND(EDX), MM1 ) /* x1 | x0 */ + + PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ + PFADD ( MM2, MM0 ) /* x0*m4...+x2*m6| x0*m0+x1*m1+x2*m2 */ + + MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ + ADD_L ( STRIDE, EDX ) /* next normal */ + + PREFETCH ( REGIND(EDX) ) + + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ + PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ + + PFMUL ( MM7, MM2 ) /* | x2*m10 */ + PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ + + PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */ + MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ + + DEC_L ( EDI ) /* decrement normal counter */ + JA ( LLBL (G3TR_rescale) ) + + FEMMS + +LLBL (G3TR_end): + POP_L ( ESI ) + POP_L ( EDI ) + RET + + + + + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_transform_normals_no_rot) +HIDDEN(_mesa_3dnow_transform_normals_no_rot) +GLNAME(_mesa_3dnow_transform_normals_no_rot): + +#undef FRAME_OFFSET +#define FRAME_OFFSET 8 + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_DEST, EAX ) + MOV_L ( ARG_MAT, ECX ) + MOV_L ( REGOFF(V4F_COUNT, ESI), EDI ) /* dest->count = in->count */ + MOV_L ( EDI, REGOFF(V4F_COUNT, EAX) ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ + MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ + MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ + + CMP_L ( CONST(0), EDI ) + JE ( LLBL (G3TNR_end) ) + + FEMMS + + MOVD ( REGIND(ECX), MM0 ) /* | m0 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m5 | m0 */ + + MOVD ( REGOFF(40, ECX), MM2 ) /* | m10 */ + PUNPCKLDQ ( MM2, MM2 ) /* m10 | m10 */ + +ALIGNTEXT32 +LLBL (G3TNR_transform): + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND(EDX), MM4 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EDX), MM5 ) /* | x2 */ + + PFMUL ( MM0, MM4 ) /* x1*m5 | x0*m0 */ + ADD_L ( STRIDE, EDX) /* next normal */ + + PREFETCH ( REGIND(EDX) ) + + PFMUL ( MM2, MM5 ) /* | x2*m10 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + DEC_L ( EDI ) /* decrement normal counter */ + MOVQ ( MM4, REGOFF(-16, EAX) ) /* write r0, r1 */ + + MOVD ( MM5, REGOFF(-8, EAX) ) /* write r2 */ + JA ( LLBL (G3TNR_transform) ) + + FEMMS + +LLBL (G3TNR_end): + POP_L ( ESI ) + POP_L ( EDI ) + RET + + + + + + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_transform_normals) +HIDDEN(_mesa_3dnow_transform_normals) +GLNAME(_mesa_3dnow_transform_normals): + +#undef FRAME_OFFSET +#define FRAME_OFFSET 8 + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_DEST, EAX ) + MOV_L ( ARG_MAT, ECX ) + MOV_L ( REGOFF(V4F_COUNT, ESI), EDI ) /* dest->count = in->count */ + MOV_L ( EDI, REGOFF(V4F_COUNT, EAX) ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ + MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ + MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ + + CMP_L ( CONST(0), EDI ) /* count > 0 ?? */ + JE ( LLBL (G3T_end) ) + + FEMMS + + MOVQ ( REGIND(ECX), MM3 ) /* m1 | m0 */ + MOVQ ( REGOFF(16, ECX), MM4 ) /* m5 | m4 */ + + MOVD ( REGOFF(8, ECX), MM5 ) /* | m2 */ + PUNPCKLDQ ( REGOFF(24, ECX), MM5 ) /* m6 | m2 */ + + MOVQ ( REGOFF(32, ECX), MM6 ) /* m9 | m8 */ + MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */ + +ALIGNTEXT32 +LLBL (G3T_transform): + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ + + MOVQ ( MM0, MM1 ) /* x1 | x0 */ + PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ + + PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ + PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ + + PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ + PFADD ( MM2, MM0 ) /* x0*m4...+x2*m6| x0*m0+x1*m1+x2*m2 */ + + MOVQ ( REGIND(EDX), MM1 ) /* x1 | x0 */ + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ + + PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ + MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ + + PFMUL ( MM7, MM2 ) /* | x2*m10 */ + ADD_L ( STRIDE, EDX ) /* next normal */ + + PREFETCH ( REGIND(EDX) ) + + PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ + PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */ + + MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ + DEC_L ( EDI ) /* decrement normal counter */ + + JA ( LLBL (G3T_transform) ) + + FEMMS + +LLBL (G3T_end): + POP_L ( ESI ) + POP_L ( EDI ) + RET + + + + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_normalize_normals) +HIDDEN(_mesa_3dnow_normalize_normals) +GLNAME(_mesa_3dnow_normalize_normals): + +#undef FRAME_OFFSET +#define FRAME_OFFSET 12 + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + PUSH_L ( EBP ) + + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_DEST, EAX ) + MOV_L ( REGOFF(V4F_COUNT, ESI), EBP ) /* dest->count = in->count */ + MOV_L ( EBP, REGOFF(V4F_COUNT, EAX) ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ + MOV_L ( REGOFF(V4F_START, ESI), ECX ) /* in->start */ + MOV_L ( ARG_LENGTHS, EDX ) + + CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ + JE ( LLBL (G3N_end) ) + + FEMMS + + CMP_L ( CONST(0), EDX ) /* lengths == 0 ? */ + JE ( LLBL (G3N_norm2) ) /* calculate lengths */ + +ALIGNTEXT32 +LLBL (G3N_norm1): /* use precalculated lengths */ + + PREFETCH ( REGIND(EAX) ) + + MOVQ ( REGIND(ECX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, ECX), MM1 ) /* | x2 */ + + MOVD ( REGIND(EDX), MM3 ) /* | length (x) */ + PFMUL ( MM3, MM1 ) /* | x2 (normalized) */ + + PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ + ADD_L ( STRIDE, ECX ) /* next normal */ + + PREFETCH ( REGIND(ECX) ) + + PFMUL ( MM3, MM0 ) /* x1 (normalized) | x0 (normalized) */ + MOVQ ( MM0, REGIND(EAX) ) /* write new x0, x1 */ + + MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + ADD_L ( CONST(4), EDX ) /* next length */ + DEC_L ( EBP ) /* decrement normal counter */ + + JA ( LLBL (G3N_norm1) ) + + JMP ( LLBL (G3N_end1) ) + +ALIGNTEXT32 +LLBL (G3N_norm2): /* need to calculate lengths */ + + PREFETCHW ( REGIND(EAX) ) + + PREFETCH ( REGIND(ECX) ) + + MOVQ ( REGIND(ECX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, ECX), MM1 ) /* | x2 */ + + MOVQ ( MM0, MM3 ) /* x1 | x0 */ + ADD_L ( STRIDE, ECX ) /* next normal */ + + PFMUL ( MM0, MM3 ) /* x1*x1 | x0*x0 */ + MOVQ ( MM1, MM4 ) /* | x2 */ + + ADD_L ( CONST(16), EAX ) /* next r */ + PFMUL ( MM1, MM4 ) /* | x2*x2 */ + + PFADD ( MM4, MM3 ) /* | x0*x0+x2*x2 */ + PFACC ( MM3, MM3 ) /* x0*x0+...+x2*x2 | x0*x0+x1*x1+x2*x2*/ + + PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ + MOVQ ( MM5, MM4 ) + + PUNPCKLDQ ( MM3, MM3 ) + PFMUL ( MM5, MM5 ) + + PFRSQIT1 ( MM3, MM5 ) + DEC_L ( EBP ) /* decrement normal counter */ + + PFRCPIT2 ( MM4, MM5 ) + + PFMUL ( MM5, MM0 ) /* x1 (normalized) | x0 (normalized) */ + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write new x0, x1 */ + + PFMUL ( MM5, MM1 ) /* | x2 (normalized) */ + MOVD ( MM1, REGOFF(-8, EAX) ) /* write new x2 */ + + JA ( LLBL (G3N_norm2) ) + +LLBL (G3N_end1): + FEMMS + +LLBL (G3N_end): + POP_L ( EBP ) + POP_L ( ESI ) + POP_L ( EDI ) + RET + + + + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_rescale_normals) +HIDDEN(_mesa_3dnow_rescale_normals) +GLNAME(_mesa_3dnow_rescale_normals): + +#undef FRAME_OFFSET +#define FRAME_OFFSET 8 + PUSH_L ( EDI ) + PUSH_L ( ESI ) + + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_DEST, EAX ) + MOV_L ( REGOFF(V4F_COUNT, ESI), EDX ) /* dest->count = in->count */ + MOV_L ( EDX, REGOFF(V4F_COUNT, EAX) ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ + MOV_L ( REGOFF(V4F_START, ESI), ECX ) /* in->start */ + + CMP_L ( CONST(0), EDX ) + JE ( LLBL (G3R_end) ) + + FEMMS + + MOVD ( ARG_SCALE, MM0 ) /* scale */ + PUNPCKLDQ ( MM0, MM0 ) + +ALIGNTEXT32 +LLBL (G3R_rescale): + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND(ECX), MM1 ) /* x1 | x0 */ + MOVD ( REGOFF(8, ECX), MM2 ) /* | x2 */ + + PFMUL ( MM0, MM1 ) /* x1*scale | x0*scale */ + ADD_L ( STRIDE, ECX ) /* next normal */ + + PREFETCH ( REGIND(ECX) ) + + PFMUL ( MM0, MM2 ) /* | x2*scale */ + ADD_L ( CONST(16), EAX ) /* next r */ + + MOVQ ( MM1, REGOFF(-16, EAX) ) /* write r0, r1 */ + MOVD ( MM2, REGOFF(-8, EAX) ) /* write r2 */ + + DEC_L ( EDX ) /* decrement normal counter */ + JA ( LLBL (G3R_rescale) ) + + FEMMS + +LLBL (G3R_end): + POP_L ( ESI ) + POP_L ( EDI ) + RET + +#endif diff --git a/reactos/dll/mesa32/src/x86/3dnow_xform1.S b/reactos/dll/mesa32/src/x86/3dnow_xform1.S new file mode 100644 index 00000000000..57e66e94ab4 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/3dnow_xform1.S @@ -0,0 +1,433 @@ +/* $Id: 3dnow_xform1.S,v 1.3 2005/01/04 14:33:47 brianp Exp $ */ + +/* + * 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. + */ + +#ifdef USE_3DNOW_ASM +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FRAME_OFFSET 4 + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points1_general ) +HIDDEN(_mesa_3dnow_transform_points1_general) +GLNAME( _mesa_3dnow_transform_points1_general ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(4, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPGR_3 ) ) + + MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ + MOVQ ( REGOFF(8, ECX), MM1 ) /* m03 | m02 */ + + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + MOVQ ( REGOFF(56, ECX), MM3 ) /* m33 | m32 */ + +ALIGNTEXT16 +LLBL( G3TPGR_2 ): + + MOVD ( REGIND(EAX), MM4 ) /* | x0 */ + PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ + + MOVQ ( MM4, MM5 ) /* x0 | x0 */ + PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ + + PFMUL ( MM1, MM5 ) /* x0*m03 | x0*m02 */ + PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */ + + PFADD ( MM3, MM5 ) /* x0*m03+m33 | x0*m02+m32 */ + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + + MOVQ ( MM5, REGOFF(8, EDX) ) /* write r3, r2 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TPGR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPGR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points1_identity ) +HIDDEN(_mesa_3dnow_transform_points1_identity) +GLNAME( _mesa_3dnow_transform_points1_identity ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(1), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_1), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(4, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPIR_4) ) + +ALIGNTEXT16 +LLBL( G3TPIR_3 ): + + MOVD ( REGIND(EAX), MM0 ) /* | x0 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + MOVD ( MM0, REGIND(EDX) ) /* | r0 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPIR_3 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPIR_4 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points1_3d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points1_3d_no_rot) +GLNAME( _mesa_3dnow_transform_points1_3d_no_rot ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(4, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3NRR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + + MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ + +ALIGNTEXT16 +LLBL( G3TP3NRR_2 ): + + MOVD ( REGIND(EAX), MM4 ) /* | x0 */ + PFMUL ( MM0, MM4 ) /* | x0*m00 */ + + PFADD ( MM2, MM4 ) /* m31 | x0*m00+m30 */ + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + + MOVD ( MM3, REGOFF(8, EDX) ) /* write r2 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TP3NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3NRR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points1_perspective ) +HIDDEN(_mesa_3dnow_transform_points1_perspective) +GLNAME( _mesa_3dnow_transform_points1_perspective ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(4, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPPR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ + +ALIGNTEXT16 +LLBL( G3TPPR_2 ): + + MOVD ( REGIND(EAX), MM4 ) /* 0 | x0 */ + PFMUL ( MM0, MM4 ) /* 0 | x0*m00 */ + + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + MOVQ ( MM3, REGOFF(8, EDX) ) /* write r2 (=m32), r3 (=0) */ + + ADD_L ( EDI, EAX ) /* next vertex */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPPR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPPR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points1_2d ) +HIDDEN(_mesa_3dnow_transform_points1_2d) +GLNAME( _mesa_3dnow_transform_points1_2d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(4, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2R_3 ) ) + + MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP2R_2 ): + + MOVD ( REGIND(EAX), MM4 ) /* | x0 */ + PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ + + PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ + PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */ + + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TP2R_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2R_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points1_2d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points1_2d_no_rot) +GLNAME( _mesa_3dnow_transform_points1_2d_no_rot ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(4, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2NRR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP2NRR_2 ): + + MOVD ( REGIND(EAX), MM4 ) /* | x0 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + PFMUL ( MM0, MM4 ) /* | x0*m00 */ + PFADD ( MM2, MM4 ) /* m31 | x0*m00+m30 */ + + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP2NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2NRR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points1_3d ) +HIDDEN(_mesa_3dnow_transform_points1_3d) +GLNAME( _mesa_3dnow_transform_points1_3d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(4, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3R_3 ) ) + + MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ + MOVD ( REGOFF(8, ECX), MM1 ) /* | m02 */ + + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ + +ALIGNTEXT16 +LLBL( G3TP3R_2 ): + + MOVD ( REGIND(EAX), MM4 ) /* | x0 */ + PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ + + MOVQ ( MM4, MM5 ) /* | x0 */ + PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ + + PFMUL ( MM1, MM5 ) /* | x0*m02 */ + PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */ + + PFADD ( MM3, MM5 ) /* | x0*m02+m32 */ + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + + MOVD ( MM5, REGOFF(8, EDX) ) /* write r2 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TP3R_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3R_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + +#endif diff --git a/reactos/dll/mesa32/src/x86/3dnow_xform2.S b/reactos/dll/mesa32/src/x86/3dnow_xform2.S new file mode 100644 index 00000000000..98c1522015d --- /dev/null +++ b/reactos/dll/mesa32/src/x86/3dnow_xform2.S @@ -0,0 +1,473 @@ +/* $Id: 3dnow_xform2.S,v 1.3 2005/01/04 14:33:47 brianp Exp $ */ + +/* + * 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. + */ + +#ifdef USE_3DNOW_ASM +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FRAME_OFFSET 4 + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points2_general ) +HIDDEN(_mesa_3dnow_transform_points2_general) +GLNAME( _mesa_3dnow_transform_points2_general ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPGR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ + + MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ + + MOVD ( REGOFF(8, ECX), MM2 ) /* | m02 */ + PUNPCKLDQ ( REGOFF(24, ECX), MM2 ) /* m12 | m02 */ + + MOVD ( REGOFF(12, ECX), MM3 ) /* | m03 */ + PUNPCKLDQ ( REGOFF(28, ECX), MM3 ) /* m13 | m03 */ + + MOVQ ( REGOFF(48, ECX), MM4 ) /* m31 | m30 */ + MOVQ ( REGOFF(56, ECX), MM5 ) /* m33 | m32 */ + +ALIGNTEXT16 +LLBL( G3TPGR_2 ): + + MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ + MOVQ ( MM6, MM7 ) /* x1 | x0 */ + + PFMUL ( MM0, MM6 ) /* x1*m10 | x0*m00 */ + PFMUL ( MM1, MM7 ) /* x1*m11 | x0*m01 */ + + PFACC ( MM7, MM6 ) /* x0*m01+x1*m11 | x0*x00+x1*m10 */ + PFADD ( MM4, MM6 ) /* x0*...*m11+m31 | x0*...*m10+m30 */ + + MOVQ ( MM6, REGIND(EDX) ) /* write r1, r0 */ + MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ + + MOVQ ( MM6, MM7 ) /* x1 | x0 */ + PFMUL ( MM2, MM6 ) /* x1*m12 | x0*m02 */ + + PFMUL ( MM3, MM7 ) /* x1*m13 | x0*m03 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + PFACC ( MM7, MM6 ) /* x0*m03+x1*m13 | x0*x02+x1*m12 */ + PFADD ( MM5, MM6 ) /* x0*...*m13+m33 | x0*...*m12+m32 */ + + MOVQ ( MM6, REGOFF(8, EDX) ) /* write r3, r2 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPGR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPGR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points2_perspective ) +HIDDEN(_mesa_3dnow_transform_points2_perspective) +GLNAME( _mesa_3dnow_transform_points2_perspective ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPPR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ + +ALIGNTEXT16 +LLBL( G3TPPR_2 ): + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + MOVQ ( MM3, REGOFF(8, EDX) ) /* write r2 (=m32), r3 (=0) */ + + ADD_L ( EDI, EAX ) /* next vertex */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPPR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPPR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points2_3d ) +HIDDEN(_mesa_3dnow_transform_points2_3d) +GLNAME( _mesa_3dnow_transform_points2_3d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3 ), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3R_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ + + MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ + + MOVD ( REGOFF(8, ECX), MM2 ) /* | m02 */ + PUNPCKLDQ ( REGOFF(24, ECX), MM2 ) /* m12 | m02 */ + + MOVQ ( REGOFF(48, ECX), MM4 ) /* m31 | m30 */ + MOVD ( REGOFF(56, ECX), MM5 ) /* | m32 */ + +ALIGNTEXT16 +LLBL( G3TP3R_2 ): + + MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ + MOVQ ( MM6, MM7 ) /* x1 | x0 */ + + PFMUL ( MM0, MM6 ) /* x1*m10 | x0*m00 */ + PFMUL ( MM1, MM7 ) /* x1*m11 | x0*m01 */ + + PFACC ( MM7, MM6 ) /* x0*m01+x1*m11 | x0*x00+x1*m10 */ + PFADD ( MM4, MM6 ) /* x0*...*m11+m31 | x0*...*m10+m30 */ + + MOVQ ( MM6, REGIND(EDX) ) /* write r1, r0 */ + MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ + + MOVQ ( MM6, MM7 ) /* x1 | x0 */ + PFMUL ( MM2, MM6 ) /* x1*m12 | x0*m02 */ + + PFACC ( MM7, MM6 ) /* ***trash*** | x0*x02+x1*m12 */ + PFADD ( MM5, MM6 ) /* ***trash*** | x0*...*m12+m32 */ + + MOVD ( MM6, REGOFF(8, EDX) ) /* write r2 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TP3R_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3R_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points2_3d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points2_3d_no_rot) +GLNAME( _mesa_3dnow_transform_points2_3d_no_rot ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3 ), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3NRR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ + +ALIGNTEXT16 +LLBL( G3TP3NRR_2 ): + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + + PFADD ( MM2, MM4 ) /* x1*m11+m31 | x0*m00+m30 */ + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + + MOVD ( MM3, REGOFF(8, EDX) ) /* write r2 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TP3NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3NRR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points2_2d ) +HIDDEN(_mesa_3dnow_transform_points2_2d) +GLNAME( _mesa_3dnow_transform_points2_2d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2R_3 ) ) + + MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ + MOVQ ( REGOFF(16, ECX), MM1 ) /* m11 | m10 */ + + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP2R_2 ): + + MOVD ( REGIND(EAX), MM4 ) /* | x0 */ + MOVD ( REGOFF(4, EAX), MM5 ) /* | x1 */ + + PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ + PUNPCKLDQ ( MM5, MM5 ) /* x1 | x1 */ + + PFMUL ( MM1, MM5 ) /* x1*m11 | x1*m10 */ + PFADD ( MM2, MM4 ) /* x...x1*m11+31 | x0*..*m10+m30 */ + + PFADD ( MM5, MM4 ) /* x0*m01+x1*m11 | x0*m00+x1*m10 */ + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TP2R_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2R_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points2_2d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points2_2d_no_rot) +GLNAME( _mesa_3dnow_transform_points2_2d_no_rot ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2NRR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP2NRR_2 ): + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + PFADD ( MM2, MM4 ) /* m31 | x0*m00+m30 */ + + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP2NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2NRR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points2_identity ) +HIDDEN(_mesa_3dnow_transform_points2_identity) +GLNAME( _mesa_3dnow_transform_points2_identity ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPIR_3 ) ) + +ALIGNTEXT16 +LLBL( G3TPIR_3 ): + + MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + MOVQ ( MM0, REGIND(EDX) ) /* r1 | r0 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPIR_3 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPIR_4 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET +#endif diff --git a/reactos/dll/mesa32/src/x86/3dnow_xform3.S b/reactos/dll/mesa32/src/x86/3dnow_xform3.S new file mode 100644 index 00000000000..bc6fd5a1c6d --- /dev/null +++ b/reactos/dll/mesa32/src/x86/3dnow_xform3.S @@ -0,0 +1,557 @@ +/* $Id: 3dnow_xform3.S,v 1.4 2005/01/04 14:33:47 brianp Exp $ */ + +/* + * 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. + */ + +#ifdef USE_3DNOW_ASM +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FRAME_OFFSET 4 + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points3_general ) +HIDDEN(_mesa_3dnow_transform_points3_general) +GLNAME( _mesa_3dnow_transform_points3_general ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPGR_2 ) ) + + PREFETCHW ( REGIND(EDX) ) + +ALIGNTEXT16 +LLBL( G3TPGR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM2 ) /* | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + MOVQ ( MM0, MM1 ) /* x1 | x0 */ + PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ + + PUNPCKLDQ ( MM0, MM0 ) /* x0 | x0 */ + MOVQ ( MM2, MM5 ) /* x2 | x2 */ + + PUNPCKHDQ ( MM1, MM1 ) /* x1 | x1 */ + PFMUL ( REGOFF(32, ECX), MM2 ) /* x2*m9 | x2*m8 */ + + MOVQ ( MM0, MM3 ) /* x0 | x0 */ + PFMUL ( REGOFF(40, ECX), MM5 ) /* x2*m11 | x2*m10 */ + + MOVQ ( MM1, MM4 ) /* x1 | x1 */ + PFMUL ( REGIND(ECX), MM0 ) /* x0*m1 | x0*m0 */ + + PFADD ( REGOFF(48, ECX), MM2 ) /* x2*m9+m13 | x2*m8+m12 */ + PFMUL ( REGOFF(16, ECX), MM1 ) /* x1*m5 | x1*m4 */ + + PFADD ( REGOFF(56, ECX), MM5 ) /* x2*m11+m15 | x2*m10+m14 */ + PFADD ( MM0, MM1 ) /* x0*m1+x1*m5 | x0*m0+x1*m4 */ + + PFMUL ( REGOFF(8, ECX), MM3 ) /* x0*m3 | x0*m2 */ + PFADD ( MM1, MM2 ) /* r1 | r0 */ + + PFMUL ( REGOFF(24, ECX), MM4 ) /* x1*m7 | x1*m6 */ + ADD_L ( CONST(16), EDX ) /* next output vertex */ + + PFADD ( MM3, MM4 ) /* x0*m3+x1*m7 | x0*m2+x1*m6 */ + MOVQ ( MM2, REGOFF(-16, EDX) ) /* write r0, r1 */ + + PFADD ( MM4, MM5 ) /* r3 | r2 */ + MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPGR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPGR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points3_perspective ) +HIDDEN(_mesa_3dnow_transform_points3_perspective) +GLNAME( _mesa_3dnow_transform_points3_perspective ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPPR_2 ) ) + + PREFETCH ( REGIND(EAX) ) + PREFETCHW ( REGIND(EDX) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVQ ( REGOFF(32, ECX), MM1 ) /* m21 | m20 */ + MOVD ( REGOFF(40, ECX), MM2 ) /* | m22 */ + + MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ + +ALIGNTEXT16 +LLBL( G3TPPR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + PXOR ( MM7, MM7 ) /* 0 | 0 */ + MOVQ ( MM5, MM6 ) /* | x2 */ + + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + PFSUB ( MM5, MM7 ) /* | -x2 */ + + PFMUL ( MM2, MM6 ) /* | x2*m22 */ + PUNPCKLDQ ( MM5, MM5 ) /* x2 | x2 */ + + ADD_L ( CONST(16), EDX ) /* next r */ + PFMUL ( MM1, MM5 ) /* x2*m21 | x2*m20 */ + + PFADD ( MM3, MM6 ) /* | x2*m22+m32 */ + PFADD ( MM4, MM5 ) /* x1*m11+x2*m21 | x0*m00+x2*m20 */ + + MOVQ ( MM5, REGOFF(-16, EDX) ) /* write r0, r1 */ + MOVD ( MM6, REGOFF(-8, EDX) ) /* write r2 */ + + MOVD ( MM7, REGOFF(-4, EDX) ) /* write r3 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPPR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPPR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points3_3d ) +HIDDEN(_mesa_3dnow_transform_points3_3d) +GLNAME( _mesa_3dnow_transform_points3_3d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3R_2 ) ) + + PREFETCH ( REGIND(EAX) ) + PREFETCH ( REGIND(EDX) ) + + MOVD ( REGOFF(8, ECX), MM7 ) /* | m2 */ + PUNPCKLDQ ( REGOFF(24, ECX), MM7 ) /* m6 | m2 */ + + +ALIGNTEXT16 +LLBL( G3TP3R_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + MOVQ ( MM0, MM2 ) /* x1 | x0 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + PUNPCKLDQ ( MM2, MM2 ) /* x0 | x0 */ + MOVQ ( MM0, MM3 ) /* x1 | x0 */ + + PFMUL ( REGIND(ECX), MM2 ) /* x0*m1 | x0*m0 */ + PUNPCKHDQ ( MM3, MM3 ) /* x1 | x1 */ + + MOVQ ( MM1, MM4 ) /* | x2 */ + PFMUL ( REGOFF(16, ECX), MM3 ) /* x1*m5 | x1*m4 */ + + PUNPCKLDQ ( MM4, MM4 ) /* x2 | x2 */ + PFADD ( MM2, MM3 ) /* x0*m1+x1*m5 | x0*m0+x1*m4 */ + + PFMUL ( REGOFF(32, ECX), MM4 ) /* x2*m9 | x2*m8 */ + PFADD ( REGOFF(48, ECX), MM3 ) /* x0*m1+...+m11 | x0*m0+x1*m4+m12 */ + + PFMUL ( MM7, MM0 ) /* x1*m6 | x0*m2 */ + PFADD ( MM4, MM3 ) /* r1 | r0 */ + + PFMUL ( REGOFF(40, ECX), MM1 ) /* | x2*m10 */ + PUNPCKLDQ ( REGOFF(56, ECX), MM1 ) /* m14 | x2*m10 */ + + PFACC ( MM0, MM1 ) + + MOVQ ( MM3, REGOFF(-16, EDX) ) /* write r0, r1 */ + PFACC ( MM1, MM1 ) /* | r2 */ + + MOVD ( MM1, REGOFF(-8, EDX) ) /* write r2 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP3R_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3R_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points3_3d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points3_3d_no_rot) +GLNAME( _mesa_3dnow_transform_points3_3d_no_rot ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3NRR_2 ) ) + + PREFETCH ( REGIND(EAX) ) + PREFETCHW ( REGIND(EDX) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVD ( REGOFF(40, ECX), MM2 ) /* | m22 */ + PUNPCKLDQ ( MM2, MM2 ) /* m22 | m22 */ + + MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ + MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ + + PUNPCKLDQ ( MM3, MM3 ) /* m32 | m32 */ + + +ALIGNTEXT16 +LLBL( G3TP3NRR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCHW ( REGIND(EAX) ) + + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + + PFADD ( MM1, MM4 ) /* x1*m11+m31 | x0*m00+m30 */ + PFMUL ( MM2, MM5 ) /* | x2*m22 */ + + PFADD ( MM3, MM5 ) /* | x2*m22+m32 */ + MOVQ ( MM4, REGIND(EDX) ) /* write r0, r1 */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + MOVD ( MM5, REGOFF(-8, EDX) ) /* write r2 */ + JNZ ( LLBL( G3TP3NRR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3NRR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points3_2d ) +HIDDEN(_mesa_3dnow_transform_points3_2d) +GLNAME( _mesa_3dnow_transform_points3_2d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2R_3) ) + + PREFETCH ( REGIND(EAX) ) + PREFETCHW ( REGIND(EDX) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ + + MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ + + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP2R_2 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM3 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + MOVQ ( MM3, MM4 ) /* x1 | x0 */ + PFMUL ( MM0, MM3 ) /* x1*m10 | x0*m00 */ + + ADD_L ( CONST(16), EDX ) /* next r */ + PFMUL ( MM1, MM4 ) /* x1*m11 | x0*m01 */ + + PFACC ( MM4, MM3 ) /* x0*m00+x1*m10 | x0*m01+x1*m11 */ + MOVD ( MM5, REGOFF(-8, EDX) ) /* write r2 (=x2) */ + + PFADD ( MM2, MM3 ) /* x0*...*m10+m30 | x0*...*m11+m31 */ + MOVQ ( MM3, REGOFF(-16, EDX) ) /* write r0, r1 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP2R_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2R_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points3_2d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points3_2d_no_rot) +GLNAME( _mesa_3dnow_transform_points3_2d_no_rot ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2NRR_2 ) ) + + PREFETCH ( REGIND(EAX) ) + PREFETCHW ( REGIND(EDX) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ + + +ALIGNTEXT16 +LLBL( G3TP2NRR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + PFADD ( MM1, MM4 ) /* x1*m11+m31 | x0*m00+m30 */ + + MOVQ ( MM4, REGOFF(-16, EDX) ) /* write r0, r1 */ + MOVD ( MM5, REGOFF(-8, EDX) ) /* write r2 (=x2) */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP2NRR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2NRR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points3_identity ) +HIDDEN(_mesa_3dnow_transform_points3_identity) +GLNAME( _mesa_3dnow_transform_points3_identity ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPIR_2 ) ) + + PREFETCHW ( REGIND(EDX) ) + +ALIGNTEXT16 +LLBL( G3TPIR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) + + MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + MOVQ ( MM0, REGOFF(-16, EDX) ) /* r1 | r0 */ + + MOVD ( MM1, REGOFF(-8, EDX) ) /* | r2 */ + JNZ ( LLBL( G3TPIR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPIR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET +#endif diff --git a/reactos/dll/mesa32/src/x86/3dnow_xform4.S b/reactos/dll/mesa32/src/x86/3dnow_xform4.S new file mode 100644 index 00000000000..b4336cd659a --- /dev/null +++ b/reactos/dll/mesa32/src/x86/3dnow_xform4.S @@ -0,0 +1,566 @@ +/* $Id: 3dnow_xform4.S,v 1.4 2005/01/04 14:33:47 brianp Exp $ */ + +/* + * 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. + */ + +#ifdef USE_3DNOW_ASM +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FRAME_OFFSET 4 + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points4_general ) +HIDDEN(_mesa_3dnow_transform_points4_general) +GLNAME( _mesa_3dnow_transform_points4_general ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPGR_2 ) ) + + PREFETCHW ( REGIND(EDX) ) + +ALIGNTEXT16 +LLBL( G3TPGR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ + MOVQ ( REGOFF(8, EAX), MM4 ) /* x3 | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + MOVQ ( MM0, MM2 ) /* x1 | x0 */ + MOVQ ( MM4, MM6 ) /* x3 | x2 */ + + PUNPCKLDQ ( MM0, MM0 ) /* x0 | x0 */ + PUNPCKHDQ ( MM2, MM2 ) /* x1 | x1 */ + + MOVQ ( MM0, MM1 ) /* x0 | x0 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + PFMUL ( REGIND(ECX), MM0 ) /* x0*m1 | x0*m0 */ + MOVQ ( MM2, MM3 ) /* x1 | x1 */ + + PFMUL ( REGOFF(8, ECX), MM1 ) /* x0*m3 | x0*m2 */ + PUNPCKLDQ ( MM4, MM4 ) /* x2 | x2 */ + + PFMUL ( REGOFF(16, ECX), MM2 ) /* x1*m5 | x1*m4 */ + MOVQ ( MM4, MM5 ) /* x2 | x2 */ + + PFMUL ( REGOFF(24, ECX), MM3 ) /* x1*m7 | x1*m6 */ + PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ + + PFMUL ( REGOFF(32, ECX), MM4 ) /* x2*m9 | x2*m8 */ + MOVQ ( MM6, MM7 ) /* x3 | x3 */ + + PFMUL ( REGOFF(40, ECX), MM5 ) /* x2*m11 | x2*m10 */ + PFADD ( MM0, MM2 ) + + PFMUL ( REGOFF(48, ECX), MM6 ) /* x3*m13 | x3*m12 */ + PFADD ( MM1, MM3 ) + + PFMUL ( REGOFF(56, ECX), MM7 ) /* x3*m15 | x3*m14 */ + PFADD ( MM4, MM6 ) + + PFADD ( MM5, MM7 ) + PFADD ( MM2, MM6 ) + + PFADD ( MM3, MM7 ) + MOVQ ( MM6, REGOFF(-16, EDX) ) + + MOVQ ( MM7, REGOFF(-8, EDX) ) + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPGR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPGR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points4_perspective ) +HIDDEN(_mesa_3dnow_transform_points4_perspective) +GLNAME( _mesa_3dnow_transform_points4_perspective ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPPR_2 ) ) + + PREFETCH ( REGIND(EAX) ) + PREFETCHW ( REGIND(EDX) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVD ( REGOFF(40, ECX), MM1 ) /* | m22 */ + PUNPCKLDQ ( REGOFF(56, ECX), MM1 ) /* m32 | m22 */ + + MOVQ ( REGOFF(32, ECX), MM2 ) /* m21 | m20 */ + PXOR ( MM7, MM7 ) /* 0 | 0 */ + +ALIGNTEXT16 +LLBL( G3TPPR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ + MOVD ( REGOFF(8, EAX), MM3 ) /* | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGOFF(32, EAX) ) /* hopefully stride is zero */ + + MOVQ ( MM5, MM6 ) /* x3 | x2 */ + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + + PUNPCKLDQ ( MM5, MM5 ) /* x2 | x2 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + PFMUL ( MM2, MM5 ) /* x2*m21 | x2*m20 */ + PFSUBR ( MM7, MM3 ) /* | -x2 */ + + PFMUL ( MM1, MM6 ) /* x3*m32 | x2*m22 */ + PFADD ( MM4, MM5 ) /* x1*m11+x2*m21 | x0*m00+x2*m20 */ + + PFACC ( MM3, MM6 ) /* -x2 | x2*m22+x3*m32 */ + MOVQ ( MM5, REGOFF(-16, EDX) ) /* write r0, r1 */ + + MOVQ ( MM6, REGOFF(-8, EDX) ) /* write r2, r3 */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TPPR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPPR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points4_3d ) +HIDDEN(_mesa_3dnow_transform_points4_3d) +GLNAME( _mesa_3dnow_transform_points4_3d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3R_2 ) ) + + MOVD ( REGOFF(8, ECX), MM6 ) /* | m2 */ + PUNPCKLDQ ( REGOFF(24, ECX), MM6 ) /* m6 | m2 */ + + MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */ + PUNPCKLDQ ( REGOFF(56, ECX), MM7 ) /* m14 | m10 */ + +ALIGNTEXT16 +LLBL( G3TP3R_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + PREFETCH ( REGOFF(32, EAX) ) /* hopefully array is tightly packed */ + + MOVQ ( REGIND(EAX), MM2 ) /* x1 | x0 */ + MOVQ ( REGOFF(8, EAX), MM3 ) /* x3 | x2 */ + + MOVQ ( MM2, MM0 ) /* x1 | x0 */ + MOVQ ( MM3, MM4 ) /* x3 | x2 */ + + MOVQ ( MM0, MM1 ) /* x1 | x0 */ + MOVQ ( MM4, MM5 ) /* x3 | x2 */ + + PUNPCKLDQ ( MM0, MM0 ) /* x0 | x0 */ + PUNPCKHDQ ( MM1, MM1 ) /* x1 | x1 */ + + PFMUL ( REGIND(ECX), MM0 ) /* x0*m1 | x0*m0 */ + PUNPCKLDQ ( MM3, MM3 ) /* x2 | x2 */ + + PFMUL ( REGOFF(16, ECX), MM1 ) /* x1*m5 | x1*m4 */ + PUNPCKHDQ ( MM4, MM4 ) /* x3 | x3 */ + + PFMUL ( MM6, MM2 ) /* x1*m6 | x0*m2 */ + PFADD ( MM0, MM1 ) /* x0*m1+x1*m5 | x0*m0+x1*m4 */ + + PFMUL ( REGOFF(32, ECX), MM3 ) /* x2*m9 | x2*m8 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + PFMUL ( REGOFF(48, ECX), MM4 ) /* x3*m13 | x3*m12 */ + PFADD ( MM1, MM3 ) /* x0*m1+..+x2*m9 | x0*m0+...+x2*m8 */ + + PFMUL ( MM7, MM5 ) /* x3*m14 | x2*m10 */ + PFADD ( MM3, MM4 ) /* r1 | r0 */ + + PFACC ( MM2, MM5 ) /* x0*m2+x1*m6 | x2*m10+x3*m14 */ + MOVD ( REGOFF(12, EAX), MM0 ) /* | x3 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PFACC ( MM0, MM5 ) /* r3 | r2 */ + + MOVQ ( MM4, REGOFF(-16, EDX) ) /* write r0, r1 */ + MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP3R_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3R_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points4_3d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points4_3d_no_rot) +GLNAME( _mesa_3dnow_transform_points4_3d_no_rot ): + + PUSH_L ( ESI ) + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3NRR_2 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVD ( REGOFF(40, ECX), MM2 ) /* | m22 */ + PUNPCKLDQ ( REGOFF(56, ECX), MM2 ) /* m32 | m22 */ + + MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP3NRR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ + MOVD ( REGOFF(12, EAX), MM7 ) /* | x3 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGOFF(32, EAX) ) /* hopefully stride is zero */ + + MOVQ ( MM5, MM6 ) /* x3 | x2 */ + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + + PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ + PFMUL ( MM2, MM5 ) /* x3*m32 | x2*m22 */ + + PFMUL ( MM1, MM6 ) /* x3*m31 | x3*m30 */ + PFACC ( MM7, MM5 ) /* x3 | x2*m22+x3*m32 */ + + PFADD ( MM6, MM4 ) /* x1*m11+x3*m31 | x0*m00+x3*m30 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + MOVQ ( MM4, REGOFF(-16, EDX) ) /* write r0, r1 */ + MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP3NRR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3NRR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points4_2d ) +HIDDEN(_mesa_3dnow_transform_points4_2d) +GLNAME( _mesa_3dnow_transform_points4_2d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2R_2 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ + + MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ + + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP2R_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM3 ) /* x1 | x0 */ + MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + MOVQ ( MM3, MM4 ) /* x1 | x0 */ + MOVQ ( MM5, MM6 ) /* x3 | x2 */ + + PFMUL ( MM1, MM4 ) /* x1*m11 | x0*m01 */ + PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ + + PFMUL ( MM0, MM3 ) /* x1*m10 | x0*m00 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + PFACC ( MM4, MM3 ) /* x0*m01+x1*m11 | x0*m00+x1*m10 */ + PFMUL ( MM2, MM6 ) /* x3*m31 | x3*m30 */ + + PFADD ( MM6, MM3 ) /* r1 | r0 */ + MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ + + MOVQ ( MM3, REGOFF(-16, EDX) ) /* write r0, r1 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP2R_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2R_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points4_2d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points4_2d_no_rot) +GLNAME( _mesa_3dnow_transform_points4_2d_no_rot ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2NRR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP2NRR_2 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + MOVQ ( MM5, MM6 ) /* x3 | x2 */ + + ADD_L ( CONST(16), EDX ) /* next r */ + PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ + + PFMUL ( MM1, MM6 ) /* x3*m31 | x3*m30 */ + PFADD ( MM4, MM6 ) /* x1*m11+x3*m31 | x0*m00+x3*m30 */ + + MOVQ ( MM6, REGOFF(-16, EDX) ) /* write r0, r1 */ + MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TP2NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2NRR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points4_identity ) +HIDDEN(_mesa_3dnow_transform_points4_identity) +GLNAME( _mesa_3dnow_transform_points4_identity ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPIR_2 ) ) + +ALIGNTEXT16 +LLBL( G3TPIR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ + MOVQ ( REGOFF(8, EAX), MM1 ) /* x3 | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + ADD_L ( CONST(16), EDX ) /* next r */ + MOVQ ( MM0, REGOFF(-16, EDX) ) /* r1 | r0 */ + + MOVQ ( MM1, REGOFF(-8, EDX) ) /* r3 | r2 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPIR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPIR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET +#endif diff --git a/reactos/dll/mesa32/src/x86/Makefile b/reactos/dll/mesa32/src/x86/Makefile new file mode 100644 index 00000000000..3c6a6b11c06 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/Makefile @@ -0,0 +1,46 @@ +# src/mesa/x86/Makefile + +TOP = ../../.. +include $(TOP)/configs/current + + +INCLUDE_DIRS = \ + -I$(TOP)/include/GL \ + -I$(TOP)/include \ + -I.. \ + -I../main \ + -I../math \ + -I../glapi \ + -I../tnl + + +default: gen_matypes matypes.h + +clean: + rm -f matypes.h gen_matypes + + +gen_matypes: gen_matypes.c + $(CC) $(INCLUDE_DIRS) $(CFLAGS) gen_matypes.c -o gen_matypes + +# need some special rules here, unfortunately +matypes.h: ../main/mtypes.h ../tnl/t_context.h gen_matypes + ./gen_matypes > matypes.h + +common_x86_asm.o: matypes.h +3dnow_normal.o: matypes.h +3dnow_xform1.o: matypes.h +3dnow_xform2.o: matypes.h +3dnow_xform3.o: matypes.h +3dnow_xform4.o: matypes.h +mmx_blend.o: matypes.h +sse_normal.o: matypes.h +sse_xform1.o: matypes.h +sse_xform2.o: matypes.h +sse_xform3.o: matypes.h +sse_xform4.o: matypes.h +x86_cliptest.o: matypes.h +x86_xform2.o: matypes.h +x86_xform3.o: matypes.h +x86_xform4.o: matypes.h + diff --git a/reactos/dll/mesa32/src/x86/assyntax.h b/reactos/dll/mesa32/src/x86/assyntax.h new file mode 100644 index 00000000000..9bceacebdb6 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/assyntax.h @@ -0,0 +1,1746 @@ + +#ifndef __ASSYNTAX_H__ +#define __ASSYNTAX_H__ + +/* + * Copyright 1992 Vrije Universiteit, The Netherlands + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the Vrije Universiteit not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The Vrije Universiteit makes no + * representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * The Vrije Universiteit DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, + * IN NO EVENT SHALL The Vrije Universiteit BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * assyntax.h + * + * Select the syntax appropriate to the 386 assembler being used + * To add support for more assemblers add more columns to the CHOICE + * macro. Note that register names must also have uppercase names + * to avoid macro recursion. e.g., #define ah %ah recurses! + * + * NB 1. Some of the macros for certain assemblers imply that the code is to + * run in protected mode!! Caveat emptor. + * + * NB 2. 486 specific instructions are not included. This is to discourage + * their accidental use in code that is intended to run on 386 and 486 + * systems. + * + * Supported assemblers: + * + * (a) AT&T SysVr4 as(1): define ATT_ASSEMBLER + * (b) GNU Assembler gas: define GNU_ASSEMBLER (default) + * (c) Amsterdam Compiler kit: define ACK_ASSEMBLER + * (d) The Netwide Assembler: define NASM_ASSEMBLER + * (e) Microsoft Assembler: define MASM_ASSEMBLER (UNTESTED!) + * + * The following naming conventions have been used to identify the various + * data types: + * _SR = segment register version + * Integer: + * _Q = quadword = 64 bits + * _L = long = 32 bits + * _W = short = 16 bits + * _B = byte = 8 bits + * Floating-point: + * _X = m80real = 80 bits + * _D = double = 64 bits + * _S = single = 32 bits + * + * Author: Gregory J. Sharp, Sept 1992 + * Vrije Universiteit, Amsterdam, The Netherlands + * + * [support for Intel syntax added by Josh Vanderhoof, 1999] + */ + +#if !(defined(NASM_ASSEMBLER) || defined(MASM_ASSEMBLER)) + +/* Default to ATT_ASSEMBLER when SVR4 or SYSV are defined */ +#if (defined(SVR4) || defined(SYSV)) && !defined(GNU_ASSEMBLER) +#define ATT_ASSEMBLER +#endif + +#if !defined(ATT_ASSEMBLER) && !defined(GNU_ASSEMBLER) && !defined(ACK_ASSEMBLER) +#define GNU_ASSEMBLER +#endif + +#if (defined(__STDC__) && !defined(UNIXCPP)) || (defined (sun) && defined (i386) && defined (SVR4) && defined (__STDC__) && !defined (__GNUC__)) +#define CONCAT(x, y) x ## y +#define CONCAT3(x, y, z) x ## y ## z +#else +#define CONCAT(x, y) x/**/y +#define CONCAT3(x, y, z) x/**/y/**/z +#endif + +#ifdef ACK_ASSEMBLER + +/* Assume we write code for 32-bit protected mode! */ + +/* Redefine register names for GAS & AT&T assemblers */ +#define AL al +#define AH ah +#define AX ax +#define EAX ax +#define BL bl +#define BH bh +#define BX bx +#define EBX bx +#define CL cl +#define CH ch +#define CX cx +#define ECX cx +#define DL dl +#define DH dh +#define DX dx +#define EDX dx +#define BP bp +#define EBP bp +#define SI si +#define ESI si +#define DI di +#define EDI di +#define SP sp +#define ESP sp +#define CS cs +#define SS ss +#define DS ds +#define ES es +#define FS fs +#define GS gs +/* Control Registers */ +#define CR0 cr0 +#define CR1 cr1 +#define CR2 cr2 +#define CR3 cr3 +/* Debug Registers */ +#define DR0 dr0 +#define DR1 dr1 +#define DR2 dr2 +#define DR3 dr3 +#define DR4 dr4 +#define DR5 dr5 +#define DR6 dr6 +#define DR7 dr7 +/* Floating-point Stack */ +#define ST st + +#define AS_BEGIN .sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text + + +#define _WTOG o16 /* word toggle for _W instructions */ +#define _LTOG /* long toggle for _L instructions */ +#define ADDR_TOGGLE a16 +#define OPSZ_TOGGLE o16 +#define USE16 .use16 +#define USE32 .use32 + +#define CHOICE(a,b,c) c + +#else /* AT&T or GAS */ + +/* Redefine register names for GAS & AT&T assemblers */ +#define AL %al +#define AH %ah +#define AX %ax +#define EAX %eax +#define BL %bl +#define BH %bh +#define BX %bx +#define EBX %ebx +#define CL %cl +#define CH %ch +#define CX %cx +#define ECX %ecx +#define DL %dl +#define DH %dh +#define DX %dx +#define EDX %edx +#define BP %bp +#define EBP %ebp +#define SI %si +#define ESI %esi +#define DI %di +#define EDI %edi +#define SP %sp +#define ESP %esp +#define CS %cs +#define SS %ss +#define DS %ds +#define ES %es +#define FS %fs +#define GS %gs +/* Control Registers */ +#define CR0 %cr0 +#define CR1 %cr1 +#define CR2 %cr2 +#define CR3 %cr3 +/* Debug Registers */ +#define DR0 %db0 +#define DR1 %db1 +#define DR2 %db2 +#define DR3 %db3 +#define DR4 %db4 +#define DR5 %db5 +#define DR6 %db6 +#define DR7 %db7 +/* Floating-point Stack */ +#define _STX0 %st(0) +#define _STX1 %st(1) +#define _STX2 %st(2) +#define _STX3 %st(3) +#define _STX4 %st(4) +#define _STX5 %st(5) +#define _STX6 %st(6) +#define _STX7 %st(7) +#define ST(x) CONCAT(_STX,x) +#ifdef GNU_ASSEMBLER +#define ST0 %st(0) +#else +#define ST0 %st +#endif +/* MMX Registers */ +#define MM0 %mm0 +#define MM1 %mm1 +#define MM2 %mm2 +#define MM3 %mm3 +#define MM4 %mm4 +#define MM5 %mm5 +#define MM6 %mm6 +#define MM7 %mm7 +/* SSE Registers */ +#define XMM0 %xmm0 +#define XMM1 %xmm1 +#define XMM2 %xmm2 +#define XMM3 %xmm3 +#define XMM4 %xmm4 +#define XMM5 %xmm5 +#define XMM6 %xmm6 +#define XMM7 %xmm7 + +#define AS_BEGIN +#define USE16 +#define USE32 + +#ifdef GNU_ASSEMBLER + +#define ADDR_TOGGLE aword +#define OPSZ_TOGGLE word + +#define CHOICE(a,b,c) b + +#else +/* + * AT&T ASSEMBLER SYNTAX + * ********************* + */ +#define CHOICE(a,b,c) a + +#define ADDR_TOGGLE addr16 +#define OPSZ_TOGGLE data16 + +#endif /* GNU_ASSEMBLER */ +#endif /* ACK_ASSEMBLER */ + + +#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) && !defined(__DJGPP__) && !defined(__MINGW32__) +#define GLNAME(a) a +#else +#define GLNAME(a) CONCAT(_,a) +#endif + + + /****************************************/ + /* */ + /* Select the various choices */ + /* */ + /****************************************/ + + +/* Redefine assembler directives */ +/*********************************/ +#define GLOBL CHOICE(.globl, .globl, .extern) +#define GLOBAL GLOBL +#define EXTERN GLOBL +#ifndef __AOUT__ +#define ALIGNTEXT32 CHOICE(.align 32, .balign 32, .align 32) +#define ALIGNTEXT16 CHOICE(.align 16, .balign 16, .align 16) +#define ALIGNTEXT8 CHOICE(.align 8, .balign 8, .align 8) +#define ALIGNTEXT4 CHOICE(.align 4, .balign 4, .align 4) +#define ALIGNTEXT2 CHOICE(.align 2, .balign 2, .align 2) +/* ALIGNTEXT4ifNOP is the same as ALIGNTEXT4, but only if the space is + * guaranteed to be filled with NOPs. Otherwise it does nothing. + */ +#define ALIGNTEXT32ifNOP CHOICE(.align 32, .balign ARG2(32,0x90), /*can't do it*/) +#define ALIGNTEXT16ifNOP CHOICE(.align 16, .balign ARG2(16,0x90), /*can't do it*/) +#define ALIGNTEXT8ifNOP CHOICE(.align 8, .balign ARG2(8,0x90), /*can't do it*/) +#define ALIGNTEXT4ifNOP CHOICE(.align 4, .balign ARG2(4,0x90), /*can't do it*/) +#define ALIGNDATA32 CHOICE(.align 32, .balign ARG2(32,0x0), .align 32) +#define ALIGNDATA16 CHOICE(.align 16, .balign ARG2(16,0x0), .align 16) +#define ALIGNDATA8 CHOICE(.align 8, .balign ARG2(8,0x0), .align 8) +#define ALIGNDATA4 CHOICE(.align 4, .balign ARG2(4,0x0), .align 4) +#define ALIGNDATA2 CHOICE(.align 2, .balign ARG2(2,0x0), .align 2) +#else +/* 'as -aout' on FreeBSD doesn't have .balign */ +#define ALIGNTEXT32 CHOICE(.align 32, .align ARG2(5,0x90), .align 32) +#define ALIGNTEXT16 CHOICE(.align 16, .align ARG2(4,0x90), .align 16) +#define ALIGNTEXT8 CHOICE(.align 8, .align ARG2(3,0x90), .align 8) +#define ALIGNTEXT4 CHOICE(.align 4, .align ARG2(2,0x90), .align 4) +#define ALIGNTEXT2 CHOICE(.align 2, .align ARG2(1,0x90), .align 2) +/* ALIGNTEXT4ifNOP is the same as ALIGNTEXT4, but only if the space is + * guaranteed to be filled with NOPs. Otherwise it does nothing. + */ +#define ALIGNTEXT32ifNOP CHOICE(.align 32, .align ARG2(5,0x90), /*can't do it*/) +#define ALIGNTEXT16ifNOP CHOICE(.align 16, .align ARG2(4,0x90), /*can't do it*/) +#define ALIGNTEXT8ifNOP CHOICE(.align 8, .align ARG2(3,0x90), /*can't do it*/) +#define ALIGNTEXT4ifNOP CHOICE(.align 4, .align ARG2(2,0x90), /*can't do it*/) +#define ALIGNDATA32 CHOICE(.align 32, .align ARG2(5,0x0), .align 32) +#define ALIGNDATA16 CHOICE(.align 16, .align ARG2(4,0x0), .align 16) +#define ALIGNDATA8 CHOICE(.align 8, .align ARG2(3,0x0), .align 8) +#define ALIGNDATA4 CHOICE(.align 4, .align ARG2(2,0x0), .align 4) +#define ALIGNDATA2 CHOICE(.align 2, .align ARG2(1,0x0), .align 2) +#endif /* __AOUT__ */ +#define FILE(s) CHOICE(.file s, .file s, .file s) +#define STRING(s) CHOICE(.string s, .asciz s, .asciz s) +#define D_LONG CHOICE(.long, .long, .data4) +#define D_WORD CHOICE(.value, .short, .data2) +#define D_BYTE CHOICE(.byte, .byte, .data1) +#define SPACE CHOICE(.comm, .space, .space) +#define COMM CHOICE(.comm, .comm, .comm) +#define SEG_DATA CHOICE(.data, .data, .sect .data) +#define SEG_TEXT CHOICE(.text, .text, .sect .text) +#define SEG_BSS CHOICE(.bss, .bss, .sect .bss) + +#ifdef GNU_ASSEMBLER +#define D_SPACE(n) . = . + n +#else +#define D_SPACE(n) .space n +#endif + +/* Addressing Modes */ +/* Immediate Mode */ +#define ADDR(a) CHOICE(CONCAT($,a), $a, a) +#define CONST(a) CHOICE(CONCAT($,a), $a, a) + +/* Indirect Mode */ +#define CONTENT(a) CHOICE(a, a, (a)) /* take contents of variable */ +#define REGIND(a) CHOICE((a), (a), (a)) /* Register a indirect */ +/* Register b indirect plus displacement a */ +#define REGOFF(a, b) CHOICE(a(b), a(b), a(b)) +/* Reg indirect Base + Index + Displacement - this is mainly for 16-bit mode + * which has no scaling + */ +#define REGBID(b,i,d) CHOICE(d(b,i), d(b,i), d(b)(i)) +/* Reg indirect Base + (Index * Scale) */ +#define REGBIS(b,i,s) CHOICE((b,i,s), (b,i,s), (b)(i*s)) +/* Reg indirect Base + (Index * Scale) + Displacement */ +#define REGBISD(b,i,s,d) CHOICE(d(b,i,s), d(b,i,s), d(b)(i*s)) +/* Displaced Scaled Index: */ +#define REGDIS(d,i,s) CHOICE(d(,i,s), d(,i,s), d(i * s)) +/* Indexed Base: */ +#define REGBI(b,i) CHOICE((b,i), (b,i), (b)(i)) +/* Displaced Base: */ +#define REGDB(d,b) CHOICE(d(b), d(b), d(b)) +/* Variable indirect: */ +#define VARINDIRECT(var) CHOICE(*var, *var, (var)) +/* Use register contents as jump/call target: */ +#define CODEPTR(reg) CHOICE(*reg, *reg, reg) + +/* For expressions requiring bracketing + * eg. (CRT0_PM | CRT_EM) + */ + +#define EXPR(a) CHOICE([a], (a), [a]) +#define ENOT(a) CHOICE(0!a, ~a, ~a) +#define EMUL(a,b) CHOICE(a\*b, a*b, a*b) +#define EDIV(a,b) CHOICE(a\/b, a/b, a/b) + +/* + * We have to beat the problem of commas within arguments to choice. + * eg. choice (add a,b, add b,a) will get argument mismatch. Luckily ANSI + * and other known cpp definitions evaluate arguments before substitution + * so the following works. + */ +#define ARG2(a, b) a,b +#define ARG3(a,b,c) a,b,c + +/* Redefine assembler commands */ +#define AAA CHOICE(aaa, aaa, aaa) +#define AAD CHOICE(aad, aad, aad) +#define AAM CHOICE(aam, aam, aam) +#define AAS CHOICE(aas, aas, aas) +#define ADC_L(a, b) CHOICE(adcl ARG2(a,b), adcl ARG2(a,b), _LTOG adc ARG2(b,a)) +#define ADC_W(a, b) CHOICE(adcw ARG2(a,b), adcw ARG2(a,b), _WTOG adc ARG2(b,a)) +#define ADC_B(a, b) CHOICE(adcb ARG2(a,b), adcb ARG2(a,b), adcb ARG2(b,a)) +#define ADD_L(a, b) CHOICE(addl ARG2(a,b), addl ARG2(a,b), _LTOG add ARG2(b,a)) +#define ADD_W(a, b) CHOICE(addw ARG2(a,b), addw ARG2(a,b), _WTOG add ARG2(b,a)) +#define ADD_B(a, b) CHOICE(addb ARG2(a,b), addb ARG2(a,b), addb ARG2(b,a)) +#define AND_L(a, b) CHOICE(andl ARG2(a,b), andl ARG2(a,b), _LTOG and ARG2(b,a)) +#define AND_W(a, b) CHOICE(andw ARG2(a,b), andw ARG2(a,b), _WTOG and ARG2(b,a)) +#define AND_B(a, b) CHOICE(andb ARG2(a,b), andb ARG2(a,b), andb ARG2(b,a)) +#define ARPL(a,b) CHOICE(arpl ARG2(a,b), arpl ARG2(a,b), arpl ARG2(b,a)) +#define BOUND_L(a, b) CHOICE(boundl ARG2(a,b), boundl ARG2(b,a), _LTOG bound ARG2(b,a)) +#define BOUND_W(a, b) CHOICE(boundw ARG2(a,b), boundw ARG2(b,a), _WTOG bound ARG2(b,a)) +#define BSF_L(a, b) CHOICE(bsfl ARG2(a,b), bsfl ARG2(a,b), _LTOG bsf ARG2(b,a)) +#define BSF_W(a, b) CHOICE(bsfw ARG2(a,b), bsfw ARG2(a,b), _WTOG bsf ARG2(b,a)) +#define BSR_L(a, b) CHOICE(bsrl ARG2(a,b), bsrl ARG2(a,b), _LTOG bsr ARG2(b,a)) +#define BSR_W(a, b) CHOICE(bsrw ARG2(a,b), bsrw ARG2(a,b), _WTOG bsr ARG2(b,a)) +#define BT_L(a, b) CHOICE(btl ARG2(a,b), btl ARG2(a,b), _LTOG bt ARG2(b,a)) +#define BT_W(a, b) CHOICE(btw ARG2(a,b), btw ARG2(a,b), _WTOG bt ARG2(b,a)) +#define BTC_L(a, b) CHOICE(btcl ARG2(a,b), btcl ARG2(a,b), _LTOG btc ARG2(b,a)) +#define BTC_W(a, b) CHOICE(btcw ARG2(a,b), btcw ARG2(a,b), _WTOG btc ARG2(b,a)) +#define BTR_L(a, b) CHOICE(btrl ARG2(a,b), btrl ARG2(a,b), _LTOG btr ARG2(b,a)) +#define BTR_W(a, b) CHOICE(btrw ARG2(a,b), btrw ARG2(a,b), _WTOG btr ARG2(b,a)) +#define BTS_L(a, b) CHOICE(btsl ARG2(a,b), btsl ARG2(a,b), _LTOG bts ARG2(b,a)) +#define BTS_W(a, b) CHOICE(btsw ARG2(a,b), btsw ARG2(a,b), _WTOG bts ARG2(b,a)) +#define CALL(a) CHOICE(call a, call a, call a) +#define CALLF(s,a) CHOICE(lcall ARG2(s,a), lcall ARG2(s,a), callf s:a) +#define CBW CHOICE(cbtw, cbw, cbw) +#define CWDE CHOICE(cwtd, cwde, cwde) +#define CLC CHOICE(clc, clc, clc) +#define CLD CHOICE(cld, cld, cld) +#define CLI CHOICE(cli, cli, cli) +#define CLTS CHOICE(clts, clts, clts) +#define CMC CHOICE(cmc, cmc, cmc) +#define CMP_L(a, b) CHOICE(cmpl ARG2(a,b), cmpl ARG2(a,b), _LTOG cmp ARG2(b,a)) +#define CMP_W(a, b) CHOICE(cmpw ARG2(a,b), cmpw ARG2(a,b), _WTOG cmp ARG2(b,a)) +#define CMP_B(a, b) CHOICE(cmpb ARG2(a,b), cmpb ARG2(a,b), cmpb ARG2(b,a)) +#define CMPS_L CHOICE(cmpsl, cmpsl, _LTOG cmps) +#define CMPS_W CHOICE(cmpsw, cmpsw, _WTOG cmps) +#define CMPS_B CHOICE(cmpsb, cmpsb, cmpsb) +#define CWD CHOICE(cwtl, cwd, cwd) +#define CDQ CHOICE(cltd, cdq, cdq) +#define DAA CHOICE(daa, daa, daa) +#define DAS CHOICE(das, das, das) +#define DEC_L(a) CHOICE(decl a, decl a, _LTOG dec a) +#define DEC_W(a) CHOICE(decw a, decw a, _WTOG dec a) +#define DEC_B(a) CHOICE(decb a, decb a, decb a) +#define DIV_L(a) CHOICE(divl a, divl a, div a) +#define DIV_W(a) CHOICE(divw a, divw a, div a) +#define DIV_B(a) CHOICE(divb a, divb a, divb a) +#define ENTER(a,b) CHOICE(enter ARG2(a,b), enter ARG2(a,b), enter ARG2(b,a)) +#define HLT CHOICE(hlt, hlt, hlt) +#define IDIV_L(a) CHOICE(idivl a, idivl a, _LTOG idiv a) +#define IDIV_W(a) CHOICE(idivw a, idivw a, _WTOG idiv a) +#define IDIV_B(a) CHOICE(idivb a, idivb a, idivb a) +/* More forms than this for imul!! */ +#define IMUL_L(a, b) CHOICE(imull ARG2(a,b), imull ARG2(a,b), _LTOG imul ARG2(b,a)) +#define IMUL_W(a, b) CHOICE(imulw ARG2(a,b), imulw ARG2(a,b), _WTOG imul ARG2(b,a)) +#define IMUL_B(a) CHOICE(imulb a, imulb a, imulb a) +#define IN_L CHOICE(inl (DX), inl ARG2(DX,EAX), _LTOG in DX) +#define IN_W CHOICE(inw (DX), inw ARG2(DX,AX), _WTOG in DX) +#define IN_B CHOICE(inb (DX), inb ARG2(DX,AL), inb DX) +/* Please AS code writer: use the following ONLY, if you refer to ports<256 + * directly, but not in IN1_W(DX), for instance, even if IN1_ looks nicer + */ +#if defined (sun) +#define IN1_L(a) CHOICE(inl (a), inl ARG2(a,EAX), _LTOG in a) +#define IN1_W(a) CHOICE(inw (a), inw ARG2(a,AX), _WTOG in a) +#define IN1_B(a) CHOICE(inb (a), inb ARG2(a,AL), inb a) +#else +#define IN1_L(a) CHOICE(inl a, inl ARG2(a,EAX), _LTOG in a) +#define IN1_W(a) CHOICE(inw a, inw ARG2(a,AX), _WTOG in a) +#define IN1_B(a) CHOICE(inb a, inb ARG2(a,AL), inb a) +#endif +#define INC_L(a) CHOICE(incl a, incl a, _LTOG inc a) +#define INC_W(a) CHOICE(incw a, incw a, _WTOG inc a) +#define INC_B(a) CHOICE(incb a, incb a, incb a) +#define INS_L CHOICE(insl, insl, _LTOG ins) +#define INS_W CHOICE(insw, insw, _WTOG ins) +#define INS_B CHOICE(insb, insb, insb) +#define INT(a) CHOICE(int a, int a, int a) +#define INT3 CHOICE(int CONST(3), int3, int CONST(3)) +#define INTO CHOICE(into, into, into) +#define IRET CHOICE(iret, iret, iret) +#define IRETD CHOICE(iret, iret, iretd) +#define JA(a) CHOICE(ja a, ja a, ja a) +#define JAE(a) CHOICE(jae a, jae a, jae a) +#define JB(a) CHOICE(jb a, jb a, jb a) +#define JBE(a) CHOICE(jbe a, jbe a, jbe a) +#define JC(a) CHOICE(jc a, jc a, jc a) +#define JE(a) CHOICE(je a, je a, je a) +#define JG(a) CHOICE(jg a, jg a, jg a) +#define JGE(a) CHOICE(jge a, jge a, jge a) +#define JL(a) CHOICE(jl a, jl a, jl a) +#define JLE(a) CHOICE(jle a, jle a, jle a) +#define JNA(a) CHOICE(jna a, jna a, jna a) +#define JNAE(a) CHOICE(jnae a, jnae a, jnae a) +#define JNB(a) CHOICE(jnb a, jnb a, jnb a) +#define JNBE(a) CHOICE(jnbe a, jnbe a, jnbe a) +#define JNC(a) CHOICE(jnc a, jnc a, jnc a) +#define JNE(a) CHOICE(jne a, jne a, jne a) +#define JNG(a) CHOICE(jng a, jng a, jng a) +#define JNGE(a) CHOICE(jnge a, jnge a, jnge a) +#define JNL(a) CHOICE(jnl a, jnl a, jnl a) +#define JNLE(a) CHOICE(jnle a, jnle a, jnle a) +#define JNO(a) CHOICE(jno a, jno a, jno a) +#define JNP(a) CHOICE(jnp a, jnp a, jnp a) +#define JNS(a) CHOICE(jns a, jns a, jns a) +#define JNZ(a) CHOICE(jnz a, jnz a, jnz a) +#define JO(a) CHOICE(jo a, jo a, jo a) +#define JP(a) CHOICE(jp a, jp a, jp a) +#define JPE(a) CHOICE(jpe a, jpe a, jpe a) +#define JPO(a) CHOICE(jpo a, jpo a, jpo a) +#define JS(a) CHOICE(js a, js a, js a) +#define JZ(a) CHOICE(jz a, jz a, jz a) +#define JMP(a) CHOICE(jmp a, jmp a, jmp a) +#define JMPF(s,a) CHOICE(ljmp ARG2(s,a), ljmp ARG2(s,a), jmpf s:a) +#define LAHF CHOICE(lahf, lahf, lahf) +#if !defined(_REAL_MODE) && !defined(_V86_MODE) +#define LAR(a, b) CHOICE(lar ARG2(a, b), lar ARG2(a, b), lar ARG2(b, a)) +#endif +#define LEA_L(a, b) CHOICE(leal ARG2(a,b), leal ARG2(a,b), _LTOG lea ARG2(b,a)) +#define LEA_W(a, b) CHOICE(leaw ARG2(a,b), leaw ARG2(a,b), _WTOG lea ARG2(b,a)) +#define LEAVE CHOICE(leave, leave, leave) +#define LGDT(a) CHOICE(lgdt a, lgdt a, lgdt a) +#define LIDT(a) CHOICE(lidt a, lidt a, lidt a) +#define LDS(a, b) CHOICE(ldsl ARG2(a,b), lds ARG2(a,b), lds ARG2(b,a)) +#define LES(a, b) CHOICE(lesl ARG2(a,b), les ARG2(a,b), les ARG2(b,a)) +#define LFS(a, b) CHOICE(lfsl ARG2(a,b), lfs ARG2(a,b), lfs ARG2(b,a)) +#define LGS(a, b) CHOICE(lgsl ARG2(a,b), lgs ARG2(a,b), lgs ARG2(b,a)) +#define LSS(a, b) CHOICE(lssl ARG2(a,b), lss ARG2(a,b), lss ARG2(b,a)) +#define LLDT(a) CHOICE(lldt a, lldt a, lldt a) +#define LMSW(a) CHOICE(lmsw a, lmsw a, lmsw a) +#define LOCK CHOICE(lock, lock, lock) +#define LODS_L CHOICE(lodsl, lodsl, _LTOG lods) +#define LODS_W CHOICE(lodsw, lodsw, _WTOG lods) +#define LODS_B CHOICE(lodsb, lodsb, lodsb) +#define LOOP(a) CHOICE(loop a, loop a, loop a) +#define LOOPE(a) CHOICE(loope a, loope a, loope a) +#define LOOPZ(a) CHOICE(loopz a, loopz a, loopz a) +#define LOOPNE(a) CHOICE(loopne a, loopne a, loopne a) +#define LOOPNZ(a) CHOICE(loopnz a, loopnz a, loopnz a) +#if !defined(_REAL_MODE) && !defined(_V86_MODE) +#define LSL(a, b) CHOICE(lsl ARG2(a,b), lsl ARG2(a,b), lsl ARG2(b,a)) +#endif +#define LTR(a) CHOICE(ltr a, ltr a, ltr a) +#define MOV_SR(a, b) CHOICE(movw ARG2(a,b), mov ARG2(a,b), mov ARG2(b,a)) +#define MOV_L(a, b) CHOICE(movl ARG2(a,b), movl ARG2(a,b), _LTOG mov ARG2(b,a)) +#define MOV_W(a, b) CHOICE(movw ARG2(a,b), movw ARG2(a,b), _WTOG mov ARG2(b,a)) +#define MOV_B(a, b) CHOICE(movb ARG2(a,b), movb ARG2(a,b), movb ARG2(b,a)) +#define MOVS_L CHOICE(movsl, movsl, _LTOG movs) +#define MOVS_W CHOICE(movsw, movsw, _WTOG movs) +#define MOVS_B CHOICE(movsb, movsb, movsb) +#define MOVSX_BL(a, b) CHOICE(movsbl ARG2(a,b), movsbl ARG2(a,b), movsx ARG2(b,a)) +#define MOVSX_BW(a, b) CHOICE(movsbw ARG2(a,b), movsbw ARG2(a,b), movsx ARG2(b,a)) +#define MOVSX_WL(a, b) CHOICE(movswl ARG2(a,b), movswl ARG2(a,b), movsx ARG2(b,a)) +#define MOVZX_BL(a, b) CHOICE(movzbl ARG2(a,b), movzbl ARG2(a,b), movzx ARG2(b,a)) +#define MOVZX_BW(a, b) CHOICE(movzbw ARG2(a,b), movzbw ARG2(a,b), movzx ARG2(b,a)) +#define MOVZX_WL(a, b) CHOICE(movzwl ARG2(a,b), movzwl ARG2(a,b), movzx ARG2(b,a)) +#define MUL_L(a) CHOICE(mull a, mull a, _LTOG mul a) +#define MUL_W(a) CHOICE(mulw a, mulw a, _WTOG mul a) +#define MUL_B(a) CHOICE(mulb a, mulb a, mulb a) +#define NEG_L(a) CHOICE(negl a, negl a, _LTOG neg a) +#define NEG_W(a) CHOICE(negw a, negw a, _WTOG neg a) +#define NEG_B(a) CHOICE(negb a, negb a, negb a) +#define NOP CHOICE(nop, nop, nop) +#define NOT_L(a) CHOICE(notl a, notl a, _LTOG not a) +#define NOT_W(a) CHOICE(notw a, notw a, _WTOG not a) +#define NOT_B(a) CHOICE(notb a, notb a, notb a) +#define OR_L(a,b) CHOICE(orl ARG2(a,b), orl ARG2(a,b), _LTOG or ARG2(b,a)) +#define OR_W(a,b) CHOICE(orw ARG2(a,b), orw ARG2(a,b), _WTOG or ARG2(b,a)) +#define OR_B(a,b) CHOICE(orb ARG2(a,b), orb ARG2(a,b), orb ARG2(b,a)) +#define OUT_L CHOICE(outl (DX), outl ARG2(EAX,DX), _LTOG out DX) +#define OUT_W CHOICE(outw (DX), outw ARG2(AX,DX), _WTOG out DX) +#define OUT_B CHOICE(outb (DX), outb ARG2(AL,DX), outb DX) +/* Please AS code writer: use the following ONLY, if you refer to ports<256 + * directly, but not in OUT1_W(DX), for instance, even if OUT1_ looks nicer + */ +#define OUT1_L(a) CHOICE(outl (a), outl ARG2(EAX,a), _LTOG out a) +#define OUT1_W(a) CHOICE(outw (a), outw ARG2(AX,a), _WTOG out a) +#define OUT1_B(a) CHOICE(outb (a), outb ARG2(AL,a), outb a) +#define OUTS_L CHOICE(outsl, outsl, _LTOG outs) +#define OUTS_W CHOICE(outsw, outsw, _WTOG outs) +#define OUTS_B CHOICE(outsb, outsb, outsb) +#define POP_SR(a) CHOICE(pop a, pop a, pop a) +#define POP_L(a) CHOICE(popl a, popl a, _LTOG pop a) +#define POP_W(a) CHOICE(popw a, popw a, _WTOG pop a) +#define POPA_L CHOICE(popal, popal, _LTOG popa) +#define POPA_W CHOICE(popaw, popaw, _WTOG popa) +#define POPF_L CHOICE(popfl, popfl, _LTOG popf) +#define POPF_W CHOICE(popfw, popfw, _WTOG popf) +#define PUSH_SR(a) CHOICE(push a, push a, push a) +#define PUSH_L(a) CHOICE(pushl a, pushl a, _LTOG push a) +#define PUSH_W(a) CHOICE(pushw a, pushw a, _WTOG push a) +#define PUSH_B(a) CHOICE(push a, pushb a, push a) +#define PUSHA_L CHOICE(pushal, pushal, _LTOG pusha) +#define PUSHA_W CHOICE(pushaw, pushaw, _WTOG pusha) +#define PUSHF_L CHOICE(pushfl, pushfl, _LTOG pushf) +#define PUSHF_W CHOICE(pushfw, pushfw, _WTOG pushf) +#define RCL_L(a, b) CHOICE(rcll ARG2(a,b), rcll ARG2(a,b), _LTOG rcl ARG2(b,a)) +#define RCL_W(a, b) CHOICE(rclw ARG2(a,b), rclw ARG2(a,b), _WTOG rcl ARG2(b,a)) +#define RCL_B(a, b) CHOICE(rclb ARG2(a,b), rclb ARG2(a,b), rclb ARG2(b,a)) +#define RCR_L(a, b) CHOICE(rcrl ARG2(a,b), rcrl ARG2(a,b), _LTOG rcr ARG2(b,a)) +#define RCR_W(a, b) CHOICE(rcrw ARG2(a,b), rcrw ARG2(a,b), _WTOG rcr ARG2(b,a)) +#define RCR_B(a, b) CHOICE(rcrb ARG2(a,b), rcrb ARG2(a,b), rcrb ARG2(b,a)) +#define ROL_L(a, b) CHOICE(roll ARG2(a,b), roll ARG2(a,b), _LTOG rol ARG2(b,a)) +#define ROL_W(a, b) CHOICE(rolw ARG2(a,b), rolw ARG2(a,b), _WTOG rol ARG2(b,a)) +#define ROL_B(a, b) CHOICE(rolb ARG2(a,b), rolb ARG2(a,b), rolb ARG2(b,a)) +#define ROR_L(a, b) CHOICE(rorl ARG2(a,b), rorl ARG2(a,b), _LTOG ror ARG2(b,a)) +#define ROR_W(a, b) CHOICE(rorw ARG2(a,b), rorw ARG2(a,b), _WTOG ror ARG2(b,a)) +#define ROR_B(a, b) CHOICE(rorb ARG2(a,b), rorb ARG2(a,b), rorb ARG2(b,a)) +#define REP CHOICE(rep ;, rep ;, repe) +#define REPE CHOICE(repz ;, repe ;, repe) +#define REPNE CHOICE(repnz ;, repne ;, repne) +#define REPNZ REPNE +#define REPZ REPE +#define RET CHOICE(ret, ret, ret) +#define SAHF CHOICE(sahf, sahf, sahf) +#define SAL_L(a, b) CHOICE(sall ARG2(a,b), sall ARG2(a,b), _LTOG sal ARG2(b,a)) +#define SAL_W(a, b) CHOICE(salw ARG2(a,b), salw ARG2(a,b), _WTOG sal ARG2(b,a)) +#define SAL_B(a, b) CHOICE(salb ARG2(a,b), salb ARG2(a,b), salb ARG2(b,a)) +#define SAR_L(a, b) CHOICE(sarl ARG2(a,b), sarl ARG2(a,b), _LTOG sar ARG2(b,a)) +#define SAR_W(a, b) CHOICE(sarw ARG2(a,b), sarw ARG2(a,b), _WTOG sar ARG2(b,a)) +#define SAR_B(a, b) CHOICE(sarb ARG2(a,b), sarb ARG2(a,b), sarb ARG2(b,a)) +#define SBB_L(a, b) CHOICE(sbbl ARG2(a,b), sbbl ARG2(a,b), _LTOG sbb ARG2(b,a)) +#define SBB_W(a, b) CHOICE(sbbw ARG2(a,b), sbbw ARG2(a,b), _WTOG sbb ARG2(b,a)) +#define SBB_B(a, b) CHOICE(sbbb ARG2(a,b), sbbb ARG2(a,b), sbbb ARG2(b,a)) +#define SCAS_L CHOICE(scasl, scasl, _LTOG scas) +#define SCAS_W CHOICE(scasw, scasw, _WTOG scas) +#define SCAS_B CHOICE(scasb, scasb, scasb) +#define SETA(a) CHOICE(seta a, seta a, seta a) +#define SETAE(a) CHOICE(setae a, setae a, setae a) +#define SETB(a) CHOICE(setb a, setb a, setb a) +#define SETBE(a) CHOICE(setbe a, setbe a, setbe a) +#define SETC(a) CHOICE(setc a, setb a, setb a) +#define SETE(a) CHOICE(sete a, sete a, sete a) +#define SETG(a) CHOICE(setg a, setg a, setg a) +#define SETGE(a) CHOICE(setge a, setge a, setge a) +#define SETL(a) CHOICE(setl a, setl a, setl a) +#define SETLE(a) CHOICE(setle a, setle a, setle a) +#define SETNA(a) CHOICE(setna a, setna a, setna a) +#define SETNAE(a) CHOICE(setnae a, setnae a, setnae a) +#define SETNB(a) CHOICE(setnb a, setnb a, setnb a) +#define SETNBE(a) CHOICE(setnbe a, setnbe a, setnbe a) +#define SETNC(a) CHOICE(setnc a, setnb a, setnb a) +#define SETNE(a) CHOICE(setne a, setne a, setne a) +#define SETNG(a) CHOICE(setng a, setng a, setng a) +#define SETNGE(a) CHOICE(setnge a, setnge a, setnge a) +#define SETNL(a) CHOICE(setnl a, setnl a, setnl a) +#define SETNLE(a) CHOICE(setnle a, setnle a, setnle a) +#define SETNO(a) CHOICE(setno a, setno a, setno a) +#define SETNP(a) CHOICE(setnp a, setnp a, setnp a) +#define SETNS(a) CHOICE(setns a, setns a, setna a) +#define SETNZ(a) CHOICE(setnz a, setnz a, setnz a) +#define SETO(a) CHOICE(seto a, seto a, seto a) +#define SETP(a) CHOICE(setp a, setp a, setp a) +#define SETPE(a) CHOICE(setpe a, setpe a, setpe a) +#define SETPO(a) CHOICE(setpo a, setpo a, setpo a) +#define SETS(a) CHOICE(sets a, sets a, seta a) +#define SETZ(a) CHOICE(setz a, setz a, setz a) +#define SGDT(a) CHOICE(sgdt a, sgdt a, sgdt a) +#define SIDT(a) CHOICE(sidt a, sidt a, sidt a) +#define SHL_L(a, b) CHOICE(shll ARG2(a,b), shll ARG2(a,b), _LTOG shl ARG2(b,a)) +#define SHL_W(a, b) CHOICE(shlw ARG2(a,b), shlw ARG2(a,b), _WTOG shl ARG2(b,a)) +#define SHL_B(a, b) CHOICE(shlb ARG2(a,b), shlb ARG2(a,b), shlb ARG2(b,a)) +#define SHLD_L(a,b,c) CHOICE(shldl ARG3(a,b,c), shldl ARG3(a,b,c), _LTOG shld ARG3(c,b,a)) +#define SHLD2_L(a,b) CHOICE(shldl ARG2(a,b), shldl ARG3(CL,a,b), _LTOG shld ARG3(b,a,CL)) +#define SHLD_W(a,b,c) CHOICE(shldw ARG3(a,b,c), shldw ARG3(a,b,c), _WTOG shld ARG3(c,b,a)) +#define SHLD2_W(a,b) CHOICE(shldw ARG2(a,b), shldw ARG3(CL,a,b), _WTOG shld ARG3(b,a,CL)) +#define SHR_L(a, b) CHOICE(shrl ARG2(a,b), shrl ARG2(a,b), _LTOG shr ARG2(b,a)) +#define SHR_W(a, b) CHOICE(shrw ARG2(a,b), shrw ARG2(a,b), _WTOG shr ARG2(b,a)) +#define SHR_B(a, b) CHOICE(shrb ARG2(a,b), shrb ARG2(a,b), shrb ARG2(b,a)) +#define SHRD_L(a,b,c) CHOICE(shrdl ARG3(a,b,c), shrdl ARG3(a,b,c), _LTOG shrd ARG3(c,b,a)) +#define SHRD2_L(a,b) CHOICE(shrdl ARG2(a,b), shrdl ARG3(CL,a,b), _LTOG shrd ARG3(b,a,CL)) +#define SHRD_W(a,b,c) CHOICE(shrdw ARG3(a,b,c), shrdw ARG3(a,b,c), _WTOG shrd ARG3(c,b,a)) +#define SHRD2_W(a,b) CHOICE(shrdw ARG2(a,b), shrdw ARG3(CL,a,b), _WTOG shrd ARG3(b,a,CL)) +#define SLDT(a) CHOICE(sldt a, sldt a, sldt a) +#define SMSW(a) CHOICE(smsw a, smsw a, smsw a) +#define STC CHOICE(stc, stc, stc) +#define STD CHOICE(std, std, std) +#define STI CHOICE(sti, sti, sti) +#define STOS_L CHOICE(stosl, stosl, _LTOG stos) +#define STOS_W CHOICE(stosw, stosw, _WTOG stos) +#define STOS_B CHOICE(stosb, stosb, stosb) +#define STR(a) CHOICE(str a, str a, str a) +#define SUB_L(a, b) CHOICE(subl ARG2(a,b), subl ARG2(a,b), _LTOG sub ARG2(b,a)) +#define SUB_W(a, b) CHOICE(subw ARG2(a,b), subw ARG2(a,b), _WTOG sub ARG2(b,a)) +#define SUB_B(a, b) CHOICE(subb ARG2(a,b), subb ARG2(a,b), subb ARG2(b,a)) +#define TEST_L(a, b) CHOICE(testl ARG2(a,b), testl ARG2(a,b), _LTOG test ARG2(b,a)) +#define TEST_W(a, b) CHOICE(testw ARG2(a,b), testw ARG2(a,b), _WTOG test ARG2(b,a)) +#define TEST_B(a, b) CHOICE(testb ARG2(a,b), testb ARG2(a,b), testb ARG2(b,a)) +#define VERR(a) CHOICE(verr a, verr a, verr a) +#define VERW(a) CHOICE(verw a, verw a, verw a) +#define WAIT CHOICE(wait, wait, wait) +#define XCHG_L(a, b) CHOICE(xchgl ARG2(a,b), xchgl ARG2(a,b), _LTOG xchg ARG2(b,a)) +#define XCHG_W(a, b) CHOICE(xchgw ARG2(a,b), xchgw ARG2(a,b), _WTOG xchg ARG2(b,a)) +#define XCHG_B(a, b) CHOICE(xchgb ARG2(a,b), xchgb ARG2(a,b), xchgb ARG2(b,a)) +#define XLAT CHOICE(xlat, xlat, xlat) +#define XOR_L(a, b) CHOICE(xorl ARG2(a,b), xorl ARG2(a,b), _LTOG xor ARG2(b,a)) +#define XOR_W(a, b) CHOICE(xorw ARG2(a,b), xorw ARG2(a,b), _WTOG xor ARG2(b,a)) +#define XOR_B(a, b) CHOICE(xorb ARG2(a,b), xorb ARG2(a,b), xorb ARG2(b,a)) + + +/* Floating Point Instructions */ +#define F2XM1 CHOICE(f2xm1, f2xm1, f2xm1) +#define FABS CHOICE(fabs, fabs, fabs) +#define FADD_D(a) CHOICE(faddl a, faddl a, faddd a) +#define FADD_S(a) CHOICE(fadds a, fadds a, fadds a) +#define FADD2(a, b) CHOICE(fadd ARG2(a,b), fadd ARG2(a,b), fadd ARG2(b,a)) +#define FADDP(a, b) CHOICE(faddp ARG2(a,b), faddp ARG2(a,b), faddp ARG2(b,a)) +#define FIADD_L(a) CHOICE(fiaddl a, fiaddl a, fiaddl a) +#define FIADD_W(a) CHOICE(fiadd a, fiadds a, fiadds a) +#define FBLD(a) CHOICE(fbld a, fbld a, fbld a) +#define FBSTP(a) CHOICE(fbstp a, fbstp a, fbstp a) +#define FCHS CHOICE(fchs, fchs, fchs) +#define FCLEX CHOICE(fclex, wait; fnclex, wait; fclex) +#define FNCLEX CHOICE(fnclex, fnclex, fclex) +#define FCOM(a) CHOICE(fcom a, fcom a, fcom a) +#define FCOM_D(a) CHOICE(fcoml a, fcoml a, fcomd a) +#define FCOM_S(a) CHOICE(fcoms a, fcoms a, fcoms a) +#define FCOMP(a) CHOICE(fcomp a, fcomp a, fcomp a) +#define FCOMP_D(a) CHOICE(fcompl a, fcompl a, fcompd a) +#define FCOMP_S(a) CHOICE(fcomps a, fcomps a, fcomps a) +#define FCOMPP CHOICE(fcompp, fcompp, fcompp) +#define FCOS CHOICE(fcos, fcos, fcos) +#define FDECSTP CHOICE(fdecstp, fdecstp, fdecstp) +#define FDIV_D(a) CHOICE(fdivl a, fdivl a, fdivd a) +#define FDIV_S(a) CHOICE(fdivs a, fdivs a, fdivs a) +#define FDIV2(a, b) CHOICE(fdiv ARG2(a,b), fdiv ARG2(a,b), fdiv ARG2(b,a)) +#define FDIVP(a, b) CHOICE(fdivp ARG2(a,b), fdivp ARG2(a,b), fdivp ARG2(b,a)) +#define FIDIV_L(a) CHOICE(fidivl a, fidivl a, fidivl a) +#define FIDIV_W(a) CHOICE(fidiv a, fidivs a, fidivs a) +#define FDIVR_D(a) CHOICE(fdivrl a, fdivrl a, fdivrd a) +#define FDIVR_S(a) CHOICE(fdivrs a, fdivrs a, fdivrs a) +#define FDIVR2(a, b) CHOICE(fdivr ARG2(a,b), fdivr ARG2(a,b), fdivr ARG2(b,a)) +#define FDIVRP(a, b) CHOICE(fdivrp ARG2(a,b), fdivrp ARG2(a,b), fdivrp ARG2(b,a)) +#define FIDIVR_L(a) CHOICE(fidivrl a, fidivrl a, fidivrl a) +#define FIDIVR_W(a) CHOICE(fidivr a, fidivrs a, fidivrs a) +#define FFREE(a) CHOICE(ffree a, ffree a, ffree a) +#define FICOM_L(a) CHOICE(ficoml a, ficoml a, ficoml a) +#define FICOM_W(a) CHOICE(ficom a, ficoms a, ficoms a) +#define FICOMP_L(a) CHOICE(ficompl a, ficompl a, ficompl a) +#define FICOMP_W(a) CHOICE(ficomp a, ficomps a, ficomps a) +#define FILD_Q(a) CHOICE(fildll a, fildq a, fildq a) +#define FILD_L(a) CHOICE(fildl a, fildl a, fildl a) +#define FILD_W(a) CHOICE(fild a, filds a, filds a) +#define FINCSTP CHOICE(fincstp, fincstp, fincstp) +#define FINIT CHOICE(finit, wait; fninit, wait; finit) +#define FNINIT CHOICE(fninit, fninit, finit) +#define FIST_L(a) CHOICE(fistl a, fistl a, fistl a) +#define FIST_W(a) CHOICE(fist a, fists a, fists a) +#define FISTP_Q(a) CHOICE(fistpll a, fistpq a, fistpq a) +#define FISTP_L(a) CHOICE(fistpl a, fistpl a, fistpl a) +#define FISTP_W(a) CHOICE(fistp a, fistps a, fistps a) +#define FLD_X(a) CHOICE(fldt a, fldt a, fldx a) /* 80 bit data type! */ +#define FLD_D(a) CHOICE(fldl a, fldl a, fldd a) +#define FLD_S(a) CHOICE(flds a, flds a, flds a) +#define FLD1 CHOICE(fld1, fld1, fld1) +#define FLDL2T CHOICE(fldl2t, fldl2t, fldl2t) +#define FLDL2E CHOICE(fldl2e, fldl2e, fldl2e) +#define FLDPI CHOICE(fldpi, fldpi, fldpi) +#define FLDLG2 CHOICE(fldlg2, fldlg2, fldlg2) +#define FLDLN2 CHOICE(fldln2, fldln2, fldln2) +#define FLDZ CHOICE(fldz, fldz, fldz) +#define FLDCW(a) CHOICE(fldcw a, fldcw a, fldcw a) +#define FLDENV(a) CHOICE(fldenv a, fldenv a, fldenv a) +#define FMUL_S(a) CHOICE(fmuls a, fmuls a, fmuls a) +#define FMUL_D(a) CHOICE(fmull a, fmull a, fmuld a) +#define FMUL2(a, b) CHOICE(fmul ARG2(a,b), fmul ARG2(a,b), fmul ARG2(b,a)) +#define FMULP(a, b) CHOICE(fmulp ARG2(a,b), fmulp ARG2(a,b), fmulp ARG2(b,a)) +#define FIMUL_L(a) CHOICE(fimull a, fimull a, fimull a) +#define FIMUL_W(a) CHOICE(fimul a, fimuls a, fimuls a) +#define FNOP CHOICE(fnop, fnop, fnop) +#define FPATAN CHOICE(fpatan, fpatan, fpatan) +#define FPREM CHOICE(fprem, fprem, fprem) +#define FPREM1 CHOICE(fprem1, fprem1, fprem1) +#define FPTAN CHOICE(fptan, fptan, fptan) +#define FRNDINT CHOICE(frndint, frndint, frndint) +#define FRSTOR(a) CHOICE(frstor a, frstor a, frstor a) +#define FSAVE(a) CHOICE(fsave a, wait; fnsave a, wait; fsave a) +#define FNSAVE(a) CHOICE(fnsave a, fnsave a, fsave a) +#define FSCALE CHOICE(fscale, fscale, fscale) +#define FSIN CHOICE(fsin, fsin, fsin) +#define FSINCOS CHOICE(fsincos, fsincos, fsincos) +#define FSQRT CHOICE(fsqrt, fsqrt, fsqrt) +#define FST_D(a) CHOICE(fstl a, fstl a, fstd a) +#define FST_S(a) CHOICE(fsts a, fsts a, fsts a) +#define FSTP_X(a) CHOICE(fstpt a, fstpt a, fstpx a) +#define FSTP_D(a) CHOICE(fstpl a, fstpl a, fstpd a) +#define FSTP_S(a) CHOICE(fstps a, fstps a, fstps a) +#define FSTP(a) CHOICE(fstp a, fstp a, fstp a) +#define FSTCW(a) CHOICE(fstcw a, wait; fnstcw a, wait; fstcw a) +#define FNSTCW(a) CHOICE(fnstcw a, fnstcw a, fstcw a) +#define FSTENV(a) CHOICE(fstenv a, wait; fnstenv a, fstenv a) +#define FNSTENV(a) CHOICE(fnstenv a, fnstenv a, fstenv a) +#define FSTSW(a) CHOICE(fstsw a, wait; fnstsw a, wait; fstsw a) +#define FNSTSW(a) CHOICE(fnstsw a, fnstsw a, fstsw a) +#define FSUB_S(a) CHOICE(fsubs a, fsubs a, fsubs a) +#define FSUB_D(a) CHOICE(fsubl a, fsubl a, fsubd a) +#define FSUB2(a, b) CHOICE(fsub ARG2(a,b), fsub ARG2(a,b), fsub ARG2(b,a)) +#define FSUBP(a, b) CHOICE(fsubp ARG2(a,b), fsubp ARG2(a,b), fsubp ARG2(b,a)) +#define FISUB_L(a) CHOICE(fisubl a, fisubl a, fisubl a) +#define FISUB_W(a) CHOICE(fisub a, fisubs a, fisubs a) +#define FSUBR_S(a) CHOICE(fsubrs a, fsubrs a, fsubrs a) +#define FSUBR_D(a) CHOICE(fsubrl a, fsubrl a, fsubrd a) +#define FSUBR2(a, b) CHOICE(fsubr ARG2(a,b), fsubr ARG2(a,b), fsubr ARG2(b,a)) +#define FSUBRP(a, b) CHOICE(fsubrp ARG2(a,b), fsubrp ARG2(a,b), fsubrp ARG2(b,a)) +#define FISUBR_L(a) CHOICE(fisubrl a, fisubrl a, fisubrl a) +#define FISUBR_W(a) CHOICE(fisubr a, fisubrs a, fisubrs a) +#define FTST CHOICE(ftst, ftst, ftst) +#define FUCOM(a) CHOICE(fucom a, fucom a, fucom a) +#define FUCOMP(a) CHOICE(fucomp a, fucomp a, fucomp a) +#define FUCOMPP CHOICE(fucompp, fucompp, fucompp) +#define FWAIT CHOICE(wait, wait, wait) +#define FXAM CHOICE(fxam, fxam, fxam) +#define FXCH(a) CHOICE(fxch a, fxch a, fxch a) +#define FXTRACT CHOICE(fxtract, fxtract, fxtract) +#define FYL2X CHOICE(fyl2x, fyl2x, fyl2x) +#define FYL2XP1 CHOICE(fyl2xp1, fyl2xp1, fyl2xp1) + +/* New instructions */ +#define CPUID CHOICE(D_BYTE ARG2(15, 162), cpuid, D_BYTE ARG2(15, 162)) +#define RDTSC CHOICE(D_BYTE ARG2(15, 49), rdtsc, D_BYTE ARG2(15, 49)) + +#else /* NASM_ASSEMBLER || MASM_ASSEMBLER is defined */ + + /****************************************/ + /* */ + /* Intel style assemblers. */ + /* (NASM and MASM) */ + /* */ + /****************************************/ + +#define P_EAX EAX +#define L_EAX EAX +#define W_AX AX +#define B_AH AH +#define B_AL AL + +#define P_EBX EBX +#define L_EBX EBX +#define W_BX BX +#define B_BH BH +#define B_BL BL + +#define P_ECX ECX +#define L_ECX ECX +#define W_CX CX +#define B_CH CH +#define B_CL CL + +#define P_EDX EDX +#define L_EDX EDX +#define W_DX DX +#define B_DH DH +#define B_DL DL + +#define P_EBP EBP +#define L_EBP EBP +#define W_BP BP + +#define P_ESI ESI +#define L_ESI ESI +#define W_SI SI + +#define P_EDI EDI +#define L_EDI EDI +#define W_DI DI + +#define P_ESP ESP +#define L_ESP ESP +#define W_SP SP + +#define W_CS CS +#define W_SS SS +#define W_DS DS +#define W_ES ES +#define W_FS FS +#define W_GS GS + +#define X_ST ST +#define D_ST ST +#define L_ST ST + +#define P_MM0 mm0 +#define P_MM1 mm1 +#define P_MM2 mm2 +#define P_MM3 mm3 +#define P_MM4 mm4 +#define P_MM5 mm5 +#define P_MM6 mm6 +#define P_MM7 mm7 + +#define P_XMM0 xmm0 +#define P_XMM1 xmm1 +#define P_XMM2 xmm2 +#define P_XMM3 xmm3 +#define P_XMM4 xmm4 +#define P_XMM5 xmm5 +#define P_XMM6 xmm6 +#define P_XMM7 xmm7 + +#define CONCAT(x, y) x ## y +#define CONCAT3(x, y, z) x ## y ## z + +#if defined(NASM_ASSEMBLER) + +#define ST(n) st ## n +#define ST0 st0 + +#define TBYTE_PTR tword +#define QWORD_PTR qword +#define DWORD_PTR dword +#define WORD_PTR word +#define BYTE_PTR byte + +#define OFFSET + +#define GLOBL GLOBAL +#define ALIGNTEXT32 ALIGN 32 +#define ALIGNTEXT16 ALIGN 16 +#define ALIGNTEXT8 ALIGN 8 +#define ALIGNTEXT4 ALIGN 4 +#define ALIGNTEXT2 ALIGN 2 +#define ALIGNTEXT32ifNOP ALIGN 32 +#define ALIGNTEXT16ifNOP ALIGN 16 +#define ALIGNTEXT8ifNOP ALIGN 8 +#define ALIGNTEXT4ifNOP ALIGN 4 +#define ALIGNDATA32 ALIGN 32 +#define ALIGNDATA16 ALIGN 16 +#define ALIGNDATA8 ALIGN 8 +#define ALIGNDATA4 ALIGN 4 +#define ALIGNDATA2 ALIGN 2 +#define FILE(s) +#define STRING(s) db s +#define D_LONG dd +#define D_WORD dw +#define D_BYTE db +/* #define SPACE */ +/* #define COMM */ +#if defined(__WATCOMC__) +SECTION _TEXT public align=16 class=CODE use32 flat +SECTION _DATA public align=16 class=DATA use32 flat +#define SEG_TEXT SECTION _TEXT +#define SEG_DATA SECTION _DATA +#define SEG_BSS SECTION .bss +#else +#define SEG_DATA SECTION .data +#define SEG_TEXT SECTION .text +#define SEG_BSS SECTION .bss +#endif + +#define D_SPACE(n) db n REP 0 + +#define AS_BEGIN + +/* Jcc's should be handled better than this... */ +#define NEAR near + +#else /* MASM */ + +#define TBYTE_PTR tbyte ptr +#define QWORD_PTR qword ptr +#define DWORD_PTR dword ptr +#define WORD_PTR word ptr +#define BYTE_PTR byte ptr + +#define OFFSET offset + +#define GLOBL GLOBAL +#define ALIGNTEXT32 ALIGN 32 +#define ALIGNTEXT16 ALIGN 16 +#define ALIGNTEXT8 ALIGN 8 +#define ALIGNTEXT4 ALIGN 4 +#define ALIGNTEXT2 ALIGN 2 +#define ALIGNTEXT32ifNOP ALIGN 32 +#define ALIGNTEXT16ifNOP ALIGN 16 +#define ALIGNTEXT8ifNOP ALIGN 8 +#define ALIGNTEXT4ifNOP ALIGN 4 +#define ALIGNDATA32 ALIGN 32 +#define ALIGNDATA16 ALIGN 16 +#define ALIGNDATA8 ALIGN 8 +#define ALIGNDATA4 ALIGN 4 +#define ALIGNDATA2 ALIGN 2 +#define FILE(s) +#define STRING(s) db s +#define D_LONG dd +#define D_WORD dw +#define D_BYTE db +/* #define SPACE */ +/* #define COMM */ +#define SEG_DATA .DATA +#define SEG_TEXT .CODE +#define SEG_BSS .DATA + +#define D_SPACE(n) db n REP 0 + +#define AS_BEGIN + +#define NEAR + +#endif + +#if defined(Lynx) || (defined(SYSV) || defined(SVR4)) \ + || (defined(__linux__) || defined(__OS2ELF__)) && defined(__ELF__) \ + || defined(__FreeBSD__) && __FreeBSD__ >= 3 +#define GLNAME(a) a +#else +#define GLNAME(a) CONCAT(_, a) +#endif + +/* + * Addressing Modes + */ + +/* Immediate Mode */ +#define P_ADDR(a) OFFSET a +#define X_ADDR(a) OFFSET a +#define D_ADDR(a) OFFSET a +#define L_ADDR(a) OFFSET a +#define W_ADDR(a) OFFSET a +#define B_ADDR(a) OFFSET a + +#define P_CONST(a) a +#define X_CONST(a) a +#define D_CONST(a) a +#define L_CONST(a) a +#define W_CONST(a) a +#define B_CONST(a) a + +/* Indirect Mode */ +#ifdef NASM_ASSEMBLER +#define P_CONTENT(a) [a] +#define X_CONTENT(a) TBYTE_PTR [a] +#define D_CONTENT(a) QWORD_PTR [a] +#define L_CONTENT(a) DWORD_PTR [a] +#define W_CONTENT(a) WORD_PTR [a] +#define B_CONTENT(a) BYTE_PTR [a] +#else +#define P_CONTENT(a) a +#define X_CONTENT(a) TBYTE_PTR a +#define D_CONTENT(a) QWORD_PTR a +#define L_CONTENT(a) DWORD_PTR a +#define W_CONTENT(a) WORD_PTR a +#define B_CONTENT(a) BYTE_PTR a +#endif + +/* Register a indirect */ +#define P_REGIND(a) [a] +#define X_REGIND(a) TBYTE_PTR [a] +#define D_REGIND(a) QWORD_PTR [a] +#define L_REGIND(a) DWORD_PTR [a] +#define W_REGIND(a) WORD_PTR [a] +#define B_REGIND(a) BYTE_PTR [a] + +/* Register b indirect plus displacement a */ +#define P_REGOFF(a, b) [b + a] +#define X_REGOFF(a, b) TBYTE_PTR [b + a] +#define D_REGOFF(a, b) QWORD_PTR [b + a] +#define L_REGOFF(a, b) DWORD_PTR [b + a] +#define W_REGOFF(a, b) WORD_PTR [b + a] +#define B_REGOFF(a, b) BYTE_PTR [b + a] + +/* Reg indirect Base + Index + Displacement - this is mainly for 16-bit mode + * which has no scaling + */ +#define P_REGBID(b, i, d) [b + i + d] +#define X_REGBID(b, i, d) TBYTE_PTR [b + i + d] +#define D_REGBID(b, i, d) QWORD_PTR [b + i + d] +#define L_REGBID(b, i, d) DWORD_PTR [b + i + d] +#define W_REGBID(b, i, d) WORD_PTR [b + i + d] +#define B_REGBID(b, i, d) BYTE_PTR [b + i + d] + +/* Reg indirect Base + (Index * Scale) */ +#define P_REGBIS(b, i, s) [b + i * s] +#define X_REGBIS(b, i, s) TBYTE_PTR [b + i * s] +#define D_REGBIS(b, i, s) QWORD_PTR [b + i * s] +#define L_REGBIS(b, i, s) DWORD_PTR [b + i * s] +#define W_REGBIS(b, i, s) WORD_PTR [b + i * s] +#define B_REGBIS(b, i, s) BYTE_PTR [b + i * s] + +/* Reg indirect Base + (Index * Scale) + Displacement */ +#define P_REGBISD(b, i, s, d) [b + i * s + d] +#define X_REGBISD(b, i, s, d) TBYTE_PTR [b + i * s + d] +#define D_REGBISD(b, i, s, d) QWORD_PTR [b + i * s + d] +#define L_REGBISD(b, i, s, d) DWORD_PTR [b + i * s + d] +#define W_REGBISD(b, i, s, d) WORD_PTR [b + i * s + d] +#define B_REGBISD(b, i, s, d) BYTE_PTR [b + i * s + d] + +/* Displaced Scaled Index: */ +#define P_REGDIS(d, i, s) [i * s + d] +#define X_REGDIS(d, i, s) TBYTE_PTR [i * s + d] +#define D_REGDIS(d, i, s) QWORD_PTR [i * s + d] +#define L_REGDIS(d, i, s) DWORD_PTR [i * s + d] +#define W_REGDIS(d, i, s) WORD_PTR [i * s + d] +#define B_REGDIS(d, i, s) BYTE_PTR [i * s + d] + +/* Indexed Base: */ +#define P_REGBI(b, i) [b + i] +#define X_REGBI(b, i) TBYTE_PTR [b + i] +#define D_REGBI(b, i) QWORD_PTR [b + i] +#define L_REGBI(b, i) DWORD_PTR [b + i] +#define W_REGBI(b, i) WORD_PTR [b + i] +#define B_REGBI(b, i) BYTE_PTR [b + i] + +/* Displaced Base: */ +#define P_REGDB(d, b) [b + d] +#define X_REGDB(d, b) TBYTE_PTR [b + d] +#define D_REGDB(d, b) QWORD_PTR [b + d] +#define L_REGDB(d, b) DWORD_PTR [b + d] +#define W_REGDB(d, b) WORD_PTR [b + d] +#define B_REGDB(d, b) BYTE_PTR [b + d] + +/* Variable indirect: */ +#define VARINDIRECT(var) [var] + +/* Use register contents as jump/call target: */ +#define CODEPTR(reg) P_(reg) + +/* + * Redefine assembler commands + */ + +#define P_(a) P_ ## a +#define X_(a) X_ ## a +#define D_(a) D_ ## a +#define SR_(a) W_ ## a +#define S_(a) L_ ## a +#define L_(a) L_ ## a +#define W_(a) W_ ## a +#define B_(a) B_ ## a + +#define AAA aaa +#define AAD aad +#define AAM aam +#define AAS aas +#define ADC_L(a, b) adc L_(b), L_(a) +#define ADC_W(a, b) adc W_(b), W_(a) +#define ADC_B(a, b) adc B_(b), B_(a) +#define ADD_L(a, b) add L_(b), L_(a) +#define ADD_W(a, b) add W_(b), W_(a) +#define ADD_B(a, b) add B_(b), B_(a) +#define AND_L(a, b) and L_(b), L_(a) +#define AND_W(a, b) and W_(b), W_(a) +#define AND_B(a, b) and B_(b), B_(a) +#define ARPL(a,b) arpl W_(b), a +#define BOUND_L(a, b) bound L_(b), L_(a) +#define BOUND_W(a, b) bound W_(b), W_(a) +#define BSF_L(a, b) bsf L_(b), L_(a) +#define BSF_W(a, b) bsf W_(b), W_(a) +#define BSR_L(a, b) bsr L_(b), L_(a) +#define BSR_W(a, b) bsr W_(b), W_(a) +#define BT_L(a, b) bt L_(b), L_(a) +#define BT_W(a, b) bt W_(b), W_(a) +#define BTC_L(a, b) btc L_(b), L_(a) +#define BTC_W(a, b) btc W_(b), W_(a) +#define BTR_L(a, b) btr L_(b), L_(a) +#define BTR_W(a, b) btr W_(b), W_(a) +#define BTS_L(a, b) bts L_(b), L_(a) +#define BTS_W(a, b) bts W_(b), W_(a) +#define CALL(a) call a +#define CALLF(s,a) call far s:a +#define CBW cbw +#define CWDE cwde +#define CLC clc +#define CLD cld +#define CLI cli +#define CLTS clts +#define CMC cmc +#define CMP_L(a, b) cmp L_(b), L_(a) +#define CMP_W(a, b) cmp W_(b), W_(a) +#define CMP_B(a, b) cmp B_(b), B_(a) +#define CMPS_L cmpsd +#define CMPS_W cmpsw +#define CMPS_B cmpsb +#define CPUID cpuid +#define CWD cwd +#define CDQ cdq +#define DAA daa +#define DAS das +#define DEC_L(a) dec L_(a) +#define DEC_W(a) dec W_(a) +#define DEC_B(a) dec B_(a) +#define DIV_L(a) div L_(a) +#define DIV_W(a) div W_(a) +#define DIV_B(a) div B_(a) +#define ENTER(a,b) enter b, a +#define HLT hlt +#define IDIV_L(a) idiv L_(a) +#define IDIV_W(a) idiv W_(a) +#define IDIV_B(a) idiv B_(a) +#define IMUL_L(a, b) imul L_(b), L_(a) +#define IMUL_W(a, b) imul W_(b), W_(a) +#define IMUL_B(a) imul B_(a) +#define IN_L in EAX, DX +#define IN_W in AX, DX +#define IN_B in AL, DX +#define IN1_L(a) in1 L_(a) +#define IN1_W(a) in1 W_(a) +#define IN1_B(a) in1 B_(a) +#define INC_L(a) inc L_(a) +#define INC_W(a) inc W_(a) +#define INC_B(a) inc B_(a) +#define INS_L ins +#define INS_W ins +#define INS_B ins +#define INT(a) int B_(a) +#define INT3 int3 +#define INTO into +#define IRET iret +#define IRETD iretd +#define JA(a) ja NEAR a +#define JAE(a) jae NEAR a +#define JB(a) jb NEAR a +#define JBE(a) jbe NEAR a +#define JC(a) jc NEAR a +#define JE(a) je NEAR a +#define JG(a) jg NEAR a +#define JGE(a) jge NEAR a +#define JL(a) jl NEAR a +#define JLE(a) jle NEAR a +#define JNA(a) jna NEAR a +#define JNAE(a) jnae NEAR a +#define JNB(a) jnb NEAR a +#define JNBE(a) jnbe NEAR a +#define JNC(a) jnc NEAR a +#define JNE(a) jne NEAR a +#define JNG(a) jng NEAR a +#define JNGE(a) jnge NEAR a +#define JNL(a) jnl NEAR a +#define JNLE(a) jnle NEAR a +#define JNO(a) jno NEAR a +#define JNP(a) jnp NEAR a +#define JNS(a) jns NEAR a +#define JNZ(a) jnz NEAR a +#define JO(a) jo NEAR a +#define JP(a) jp NEAR a +#define JPE(a) jpe NEAR a +#define JPO(a) jpo NEAR a +#define JS(a) js NEAR a +#define JZ(a) jz NEAR a +#define JMP(a) jmp a +#define JMPF(s,a) jmp far s:a +#define LAHF lahf +#define LAR(a, b) lar b, a +#define LEA_L(a, b) lea P_(b), P_(a) +#define LEA_W(a, b) lea P_(b), P_(a) +#define LEAVE leave +#define LGDT(a) lgdt a +#define LIDT(a) lidt a +#define LDS(a, b) lds b, P_(a) +#define LES(a, b) les b, P_(a) +#define LFS(a, b) lfs b, P_(a) +#define LGS(a, b) lgs b, P_(a) +#define LSS(a, b) lss b, P_(a) +#define LLDT(a) lldt a +#define LMSW(a) lmsw a +#define LOCK lock +#define LODS_L lodsd +#define LODS_W lodsw +#define LODS_B lodsb +#define LOOP(a) loop a +#define LOOPE(a) loope a +#define LOOPZ(a) loopz a +#define LOOPNE(a) loopne a +#define LOOPNZ(a) loopnz a +#define LSL(a, b) lsl b, a +#define LTR(a) ltr a +#define MOV_SR(a, b) mov SR_(b), SR_(a) +#define MOV_L(a, b) mov L_(b), L_(a) +#define MOV_W(a, b) mov W_(b), W_(a) +#define MOV_B(a, b) mov B_(b), B_(a) +#define MOVS_L movsd +#define MOVS_W movsw +#define MOVS_B movsb +#define MOVSX_BL(a, b) movsx B_(b), B_(a) +#define MOVSX_BW(a, b) movsx B_(b), B_(a) +#define MOVSX_WL(a, b) movsx W_(b), W_(a) +#define MOVZX_BL(a, b) movzx B_(b), B_(a) +#define MOVZX_BW(a, b) movzx B_(b), B_(a) +#define MOVZX_WL(a, b) movzx W_(b), W_(a) +#define MUL_L(a) mul L_(a) +#define MUL_W(a) mul W_(a) +#define MUL_B(a) mul B_(a) +#define NEG_L(a) neg L_(a) +#define NEG_W(a) neg W_(a) +#define NEG_B(a) neg B_(a) +#define NOP nop +#define NOT_L(a) not L_(a) +#define NOT_W(a) not W_(a) +#define NOT_B(a) not B_(a) +#define OR_L(a,b) or L_(b), L_(a) +#define OR_W(a,b) or W_(b), W_(a) +#define OR_B(a,b) or B_(b), B_(a) +#define OUT_L out DX, EAX +#define OUT_W out DX, AX +#define OUT_B out DX, AL +#define OUT1_L(a) out1 L_(a) +#define OUT1_W(a) out1 W_(a) +#define OUT1_B(a) out1 B_(a) +#define OUTS_L outsd +#define OUTS_W outsw +#define OUTS_B outsb +#define POP_SR(a) pop SR_(a) +#define POP_L(a) pop L_(a) +#define POP_W(a) pop W_(a) +#define POPA_L popad +#define POPA_W popa +#define POPF_L popfd +#define POPF_W popf +#define PUSH_SR(a) push SR_(a) +#define PUSH_L(a) push L_(a) +#define PUSH_W(a) push W_(a) +#define PUSH_B(a) push B_(a) +#define PUSHA_L pushad +#define PUSHA_W pusha +#define PUSHF_L pushfd +#define PUSHF_W pushf +#define RCL_L(a, b) rcl L_(b), L_(a) +#define RCL_W(a, b) rcl W_(b), W_(a) +#define RCL_B(a, b) rcl B_(b), B_(a) +#define RCR_L(a, b) rcr L_(b), L_(a) +#define RCR_W(a, b) rcr W_(b), W_(a) +#define RCR_B(a, b) rcr B_(b), B_(a) +#define RDTSC rdtsc +#define ROL_L(a, b) rol L_(b), L_(a) +#define ROL_W(a, b) rol W_(b), W_(a) +#define ROL_B(a, b) rol B_(b), B_(a) +#define ROR_L(a, b) ror L_(b), L_(a) +#define ROR_W(a, b) ror W_(b), W_(a) +#define ROR_B(a, b) ror B_(b), B_(a) +#define REP rep +#define REPE repe +#define REPNE repne +#define REPNZ REPNE +#define REPZ REPE +#define RET ret +#define SAHF sahf +#define SAL_L(a, b) sal L_(b), B_(a) +#define SAL_W(a, b) sal W_(b), B_(a) +#define SAL_B(a, b) sal B_(b), B_(a) +#define SAR_L(a, b) sar L_(b), B_(a) +#define SAR_W(a, b) sar W_(b), B_(a) +#define SAR_B(a, b) sar B_(b), B_(a) +#define SBB_L(a, b) sbb L_(b), L_(a) +#define SBB_W(a, b) sbb W_(b), W_(a) +#define SBB_B(a, b) sbb B_(b), B_(a) +#define SCAS_L scas +#define SCAS_W scas +#define SCAS_B scas +#define SETA(a) seta a +#define SETAE(a) setae a +#define SETB(a) setb a +#define SETBE(a) setbe a +#define SETC(a) setc a +#define SETE(a) sete a +#define SETG(a) setg a +#define SETGE(a) setge a +#define SETL(a) setl a +#define SETLE(a) setle a +#define SETNA(a) setna a +#define SETNAE(a) setnae a +#define SETNB(a) setnb a +#define SETNBE(a) setnbe a +#define SETNC(a) setnc a +#define SETNE(a) setne a +#define SETNG(a) setng a +#define SETNGE(a) setnge a +#define SETNL(a) setnl a +#define SETNLE(a) setnle a +#define SETNO(a) setno a +#define SETNP(a) setnp a +#define SETNS(a) setns a +#define SETNZ(a) setnz a +#define SETO(a) seto a +#define SETP(a) setp a +#define SETPE(a) setpe a +#define SETPO(a) setpo a +#define SETS(a) sets a +#define SETZ(a) setz a +#define SGDT(a) sgdt a +#define SIDT(a) sidt a +#define SHL_L(a, b) shl L_(b), B_(a) +#define SHL_W(a, b) shl W_(b), B_(a) +#define SHL_B(a, b) shl B_(b), B_(a) +#define SHLD_L(a,b,c) shld +#define SHLD2_L(a,b) shld L_(b), L_(a) +#define SHLD_W(a,b,c) shld +#define SHLD2_W(a,b) shld W_(b), W_(a) +#define SHR_L(a, b) shr L_(b), B_(a) +#define SHR_W(a, b) shr W_(b), B_(a) +#define SHR_B(a, b) shr B_(b), B_(a) +#define SHRD_L(a,b,c) shrd +#define SHRD2_L(a,b) shrd L_(b), L_(a) +#define SHRD_W(a,b,c) shrd +#define SHRD2_W(a,b) shrd W_(b), W_(a) +#define SLDT(a) sldt a +#define SMSW(a) smsw a +#define STC stc +#define STD std +#define STI sti +#define STOS_L stosd +#define STOS_W stosw +#define STOS_B stosb +#define STR(a) str a +#define SUB_L(a, b) sub L_(b), L_(a) +#define SUB_W(a, b) sub W_(b), W_(a) +#define SUB_B(a, b) sub B_(b), B_(a) +#define TEST_L(a, b) test L_(b), L_(a) +#define TEST_W(a, b) test W_(b), W_(a) +#define TEST_B(a, b) test B_(b), B_(a) +#define VERR(a) verr a +#define VERW(a) verw a +#define WAIT wait +#define XCHG_L(a, b) xchg L_(b), L_(a) +#define XCHG_W(a, b) xchg W_(b), W_(a) +#define XCHG_B(a, b) xchg B_(b), B_(a) +#define XLAT xlat +#define XOR_L(a, b) xor L_(b), L_(a) +#define XOR_W(a, b) xor W_(b), W_(a) +#define XOR_B(a, b) xor B_(b), B_(a) + + +/* Floating Point Instructions */ +#define F2XM1 f2xm1 +#define FABS fabs +#define FADD_D(a) fadd D_(a) +#define FADD_S(a) fadd S_(a) +#define FADD2(a, b) fadd b, a +#define FADDP(a, b) faddp b, a +#define FIADD_L(a) fiadd L_(a) +#define FIADD_W(a) fiadd W_(a) +#define FBLD(a) fbld a +#define FBSTP(a) fbstp a +#define FCHS fchs +#define FCLEX fclex +#define FNCLEX fnclex +#define FCOM(a) fcom a +#define FCOM_D(a) fcom D_(a) +#define FCOM_S(a) fcom S_(a) +#define FCOMP(a) fcomp a +#define FCOMP_D(a) fcomp D_(a) +#define FCOMP_S(a) fcomp S_(a) +#define FCOMPP fcompp +#define FCOS fcos +#define FDECSTP fdecstp +#define FDIV_D(a) fdiv D_(a) +#define FDIV_S(a) fdiv S_(a) +#define FDIV2(a, b) fdiv b, a +#define FDIVP(a, b) fdivp b, a +#define FIDIV_L(a) fidiv L_(a) +#define FIDIV_W(a) fidiv W_(a) +#define FDIVR_D(a) fdivr D_(a) +#define FDIVR_S(a) fdivr S_(a) +#define FDIVR2(a, b) fdivr b, a +#define FDIVRP(a, b) fdivrp b, a +#define FIDIVR_L(a) fidivr L_(a) +#define FIDIVR_W(a) fidivr W_(a) +#define FFREE(a) ffree a +#define FICOM_L(a) ficom L_(a) +#define FICOM_W(a) ficom W_(a) +#define FICOMP_L(a) ficomp L_(a) +#define FICOMP_W(a) ficomp W_(a) +#define FILD_Q(a) fild D_(a) +#define FILD_L(a) fild L_(a) +#define FILD_W(a) fild W_(a) +#define FINCSTP fincstp +#define FINIT finit +#define FNINIT fninit +#define FIST_L(a) fist L_(a) +#define FIST_W(a) fist W_(a) +#define FISTP_Q(a) fistp D_(a) +#define FISTP_L(a) fistp L_(a) +#define FISTP_W(a) fistp W_(a) +#define FLD_X(a) fld X_(a) +#define FLD_D(a) fld D_(a) +#define FLD_S(a) fld S_(a) +#define FLD1 fld1 +#define FLDL2T fldl2t +#define FLDL2E fldl2e +#define FLDPI fldpi +#define FLDLG2 fldlg2 +#define FLDLN2 fldln2 +#define FLDZ fldz +#define FLDCW(a) fldcw a +#define FLDENV(a) fldenv a +#define FMUL_S(a) fmul S_(a) +#define FMUL_D(a) fmul D_(a) +#define FMUL2(a, b) fmul b, a +#define FMULP(a, b) fmulp b, a +#define FIMUL_L(a) fimul L_(a) +#define FIMUL_W(a) fimul W_(a) +#define FNOP fnop +#define FPATAN fpatan +#define FPREM fprem +#define FPREM1 fprem1 +#define FPTAN fptan +#define FRNDINT frndint +#define FRSTOR(a) frstor a +#define FSAVE(a) fsave a +#define FNSAVE(a) fnsave a +#define FSCALE fscale +#define FSIN fsin +#define FSINCOS fsincos +#define FSQRT fsqrt +#define FST_D(a) fst D_(a) +#define FST_S(a) fst S_(a) +#define FSTP_X(a) fstp X_(a) +#define FSTP_D(a) fstp D_(a) +#define FSTP_S(a) fstp S_(a) +#define FSTP(a) fstp a +#define FSTCW(a) fstcw a +#define FNSTCW(a) fnstcw a +#define FSTENV(a) fstenv a +#define FNSTENV(a) fnstenv a +#define FSTSW(a) fstsw a +#define FNSTSW(a) fnstsw a +#define FSUB_S(a) fsub S_(a) +#define FSUB_D(a) fsub D_(a) +#define FSUB2(a, b) fsub b, a +#define FSUBP(a, b) fsubp b, a +#define FISUB_L(a) fisub L_(a) +#define FISUB_W(a) fisub W_(a) +#define FSUBR_S(a) fsubr S_(a) +#define FSUBR_D(a) fsubr D_(a) +#define FSUBR2(a, b) fsubr b, a +#define FSUBRP(a, b) fsubrp b, a +#define FISUBR_L(a) fisubr L_(a) +#define FISUBR_W(a) fisubr W_(a) +#define FTST ftst +#define FUCOM(a) fucom a +#define FUCOMP(a) fucomp a +#define FUCOMPP fucompp +#define FWAIT fwait +#define FXAM fxam +#define FXCH(a) fxch a +#define FXTRACT fxtract +#define FYL2X fyl2x +#define FYL2XP1 fyl2xp1 + +#endif /* NASM_ASSEMBLER, MASM_ASSEMBLER */ + + /****************************************/ + /* */ + /* Extensions to x86 insn set - */ + /* MMX, 3DNow! */ + /* */ + /****************************************/ + +#if defined(NASM_ASSEMBLER) || defined(MASM_ASSEMBLER) +#define P_ARG1(a) P_ ## a +#define P_ARG2(a, b) P_ ## b, P_ ## a +#define P_ARG3(a, b, c) P_ ## c, P_ ## b, P_ ## a +#else +#define P_ARG1(a) a +#define P_ARG2(a, b) a, b +#define P_ARG3(a, b, c) a, b, c +#endif + +/* MMX */ +#define MOVD(a, b) movd P_ARG2(a, b) +#define MOVQ(a, b) movq P_ARG2(a, b) + +#define PADDB(a, b) paddb P_ARG2(a, b) +#define PADDW(a, b) paddw P_ARG2(a, b) +#define PADDD(a, b) paddd P_ARG2(a, b) + +#define PADDSB(a, b) paddsb P_ARG2(a, b) +#define PADDSW(a, b) paddsw P_ARG2(a, b) + +#define PADDUSB(a, b) paddusb P_ARG2(a, b) +#define PADDUSW(a, b) paddusw P_ARG2(a, b) + +#define PSUBB(a, b) psubb P_ARG2(a, b) +#define PSUBW(a, b) psubw P_ARG2(a, b) +#define PSUBD(a, b) psubd P_ARG2(a, b) + +#define PSUBSB(a, b) psubsb P_ARG2(a, b) +#define PSUBSW(a, b) psubsw P_ARG2(a, b) + +#define PSUBUSB(a, b) psubusb P_ARG2(a, b) +#define PSUBUSW(a, b) psubusw P_ARG2(a, b) + +#define PCMPEQB(a, b) pcmpeqb P_ARG2(a, b) +#define PCMPEQW(a, b) pcmpeqw P_ARG2(a, b) +#define PCMPEQD(a, b) pcmpeqd P_ARG2(a, b) + +#define PCMPGTB(a, b) pcmpgtb P_ARG2(a, b) +#define PCMPGTW(a, b) pcmpgtw P_ARG2(a, b) +#define PCMPGTD(a, b) pcmpgtd P_ARG2(a, b) + +#define PMULHW(a, b) pmulhw P_ARG2(a, b) +#define PMULLW(a, b) pmullw P_ARG2(a, b) + +#define PMADDWD(a, b) pmaddwd P_ARG2(a, b) + +#define PAND(a, b) pand P_ARG2(a, b) + +#define PANDN(a, b) pandn P_ARG2(a, b) + +#define POR(a, b) por P_ARG2(a, b) + +#define PXOR(a, b) pxor P_ARG2(a, b) + +#define PSRAW(a, b) psraw P_ARG2(a, b) +#define PSRAD(a, b) psrad P_ARG2(a, b) + +#define PSRLW(a, b) psrlw P_ARG2(a, b) +#define PSRLD(a, b) psrld P_ARG2(a, b) +#define PSRLQ(a, b) psrlq P_ARG2(a, b) + +#define PSLLW(a, b) psllw P_ARG2(a, b) +#define PSLLD(a, b) pslld P_ARG2(a, b) +#define PSLLQ(a, b) psllq P_ARG2(a, b) + +#define PACKSSWB(a, b) packsswb P_ARG2(a, b) +#define PACKSSDW(a, b) packssdw P_ARG2(a, b) +#define PACKUSWB(a, b) packuswb P_ARG2(a, b) + +#define PUNPCKHBW(a, b) punpckhbw P_ARG2(a, b) +#define PUNPCKHWD(a, b) punpckhwd P_ARG2(a, b) +#define PUNPCKHDQ(a, b) punpckhdq P_ARG2(a, b) +#define PUNPCKLBW(a, b) punpcklbw P_ARG2(a, b) +#define PUNPCKLWD(a, b) punpcklwd P_ARG2(a, b) +#define PUNPCKLDQ(a, b) punpckldq P_ARG2(a, b) + +#define EMMS emms + +/* AMD 3DNow! */ +#define PAVGUSB(a, b) pavgusb P_ARG2(a, b) +#define PFADD(a, b) pfadd P_ARG2(a, b) +#define PFSUB(a, b) pfsub P_ARG2(a, b) +#define PFSUBR(a, b) pfsubr P_ARG2(a, b) +#define PFACC(a, b) pfacc P_ARG2(a, b) +#define PFCMPGE(a, b) pfcmpge P_ARG2(a, b) +#define PFCMPGT(a, b) pfcmpgt P_ARG2(a, b) +#define PFCMPEQ(a, b) pfcmpeq P_ARG2(a, b) +#define PFMIN(a, b) pfmin P_ARG2(a, b) +#define PFMAX(a, b) pfmax P_ARG2(a, b) +#define PI2FD(a, b) pi2fd P_ARG2(a, b) +#define PF2ID(a, b) pf2id P_ARG2(a, b) +#define PFRCP(a, b) pfrcp P_ARG2(a, b) +#define PFRSQRT(a, b) pfrsqrt P_ARG2(a, b) +#define PFMUL(a, b) pfmul P_ARG2(a, b) +#define PFRCPIT1(a, b) pfrcpit1 P_ARG2(a, b) +#define PFRSQIT1(a, b) pfrsqit1 P_ARG2(a, b) +#define PFRCPIT2(a, b) pfrcpit2 P_ARG2(a, b) +#define PMULHRW(a, b) pmulhrw P_ARG2(a, b) + +#define FEMMS femms +#define PREFETCH(a) prefetch P_ARG1(a) +#define PREFETCHW(a) prefetchw P_ARG1(a) + +/* Intel SSE */ +#define ADDPS(a, b) addps P_ARG2(a, b) +#define ADDSS(a, b) addss P_ARG2(a, b) +#define ANDNPS(a, b) andnps P_ARG2(a, b) +#define ANDPS(a, b) andps P_ARG2(a, b) +/* NASM only knows the pseudo ops for these. +#define CMPPS(a, b, c) cmpps P_ARG3(a, b, c) +#define CMPSS(a, b, c) cmpss P_ARG3(a, b, c) +*/ +#define CMPEQPS(a, b) cmpeqps P_ARG2(a, b) +#define CMPLTPS(a, b) cmpltps P_ARG2(a, b) +#define CMPLEPS(a, b) cmpleps P_ARG2(a, b) +#define CMPUNORDPS(a, b) cmpunordps P_ARG2(a, b) +#define CMPNEQPS(a, b) cmpneqps P_ARG2(a, b) +#define CMPNLTPS(a, b) cmpnltps P_ARG2(a, b) +#define CMPNLEPS(a, b) cmpnleps P_ARG2(a, b) +#define CMPORDPS(a, b) cmpordps P_ARG2(a, b) +#define CMPEQSS(a, b) cmpeqss P_ARG2(a, b) +#define CMPLTSS(a, b) cmpltss P_ARG2(a, b) +#define CMPLESS(a, b) cmpless P_ARG2(a, b) +#define CMPUNORDSS(a, b) cmpunordss P_ARG2(a, b) +#define CMPNEQSS(a, b) cmpneqss P_ARG2(a, b) +#define CMPNLTSS(a, b) cmpnltss P_ARG2(a, b) +#define CMPNLESS(a, b) cmpnless P_ARG2(a, b) +#define CMPORDSS(a, b) cmpordss P_ARG2(a, b) +#define COMISS(a, b) comiss P_ARG2(a, b) +#define CVTPI2PS(a, b) cvtpi2ps P_ARG2(a, b) +#define CVTPS2PI(a, b) cvtps2pi P_ARG2(a, b) +#define CVTSI2SS(a, b) cvtsi2ss P_ARG2(a, b) +#define CVTSS2SI(a, b) cvtss2si P_ARG2(a, b) +#define CVTTPS2PI(a, b) cvttps2pi P_ARG2(a, b) +#define CVTTSS2SI(a, b) cvttss2si P_ARG2(a, b) +#define DIVPS(a, b) divps P_ARG2(a, b) +#define DIVSS(a, b) divss P_ARG2(a, b) +#define FXRSTOR(a) fxrstor P_ARG1(a) +#define FXSAVE(a) fxsave P_ARG1(a) +#define LDMXCSR(a) ldmxcsr P_ARG1(a) +#define MAXPS(a, b) maxps P_ARG2(a, b) +#define MAXSS(a, b) maxss P_ARG2(a, b) +#define MINPS(a, b) minps P_ARG2(a, b) +#define MINSS(a, b) minss P_ARG2(a, b) +#define MOVAPS(a, b) movaps P_ARG2(a, b) +#define MOVHLPS(a, b) movhlps P_ARG2(a, b) +#define MOVHPS(a, b) movhps P_ARG2(a, b) +#define MOVLHPS(a, b) movlhps P_ARG2(a, b) +#define MOVLPS(a, b) movlps P_ARG2(a, b) +#define MOVMSKPS(a, b) movmskps P_ARG2(a, b) +#define MOVNTPS(a, b) movntps P_ARG2(a, b) +#define MOVNTQ(a, b) movntq P_ARG2(a, b) +#define MOVSS(a, b) movss P_ARG2(a, b) +#define MOVUPS(a, b) movups P_ARG2(a, b) +#define MULPS(a, b) mulps P_ARG2(a, b) +#define MULSS(a, b) mulss P_ARG2(a, b) +#define ORPS(a, b) orps P_ARG2(a, b) +#define RCPPS(a, b) rcpps P_ARG2(a, b) +#define RCPSS(a, b) rcpss P_ARG2(a, b) +#define RSQRTPS(a, b) rsqrtps P_ARG2(a, b) +#define RSQRTSS(a, b) rsqrtss P_ARG2(a, b) +#define SHUFPS(a, b, c) shufps P_ARG3(a, b, c) +#define SQRTPS(a, b) sqrtps P_ARG2(a, b) +#define SQRTSS(a, b) sqrtss P_ARG2(a, b) +#define STMXCSR(a) stmxcsr P_ARG1(a) +#define SUBPS(a, b) subps P_ARG2(a, b) +#define UCOMISS(a, b) ucomiss P_ARG2(a, b) +#define UNPCKHPS(a, b) unpckhps P_ARG2(a, b) +#define UNPCKLPS(a, b) unpcklps P_ARG2(a, b) +#define XORPS(a, b) xorps P_ARG2(a, b) + +#define PREFETCHNTA(a) prefetchnta P_ARG1(a) +#define PREFETCHT0(a) prefetcht0 P_ARG1(a) +#define PREFETCHT1(a) prefetcht1 P_ARG1(a) +#define PREFETCHT2(a) prefetcht2 P_ARG1(a) +#define SFENCE sfence + +/* Added by BrianP for FreeBSD (per David Dawes) */ +#if !defined(NASM_ASSEMBLER) && !defined(MASM_ASSEMBLER) && !defined(__bsdi__) +#define LLBL(a) CONCAT(.L,a) +#define LLBL2(a,b) CONCAT3(.L,a,b) +#else +#define LLBL(a) a +#define LLBL2(a,b) CONCAT(a,b) +#endif + +/* Segment overrides */ +#define SEGCS D_BYTE 46 +#define SEGDS D_BYTE 62 +#define SEGES D_BYTE 38 +#define SEGFS D_BYTE 100 +#define SEGGS D_BYTE 101 + +/* Temporary labels: valid until next non-local label */ +#ifdef NASM_ASSEMBLER +#define TLBL(a) CONCAT(.,a) +#else +#define TLBL(a) CONCAT(a,$) +#endif + +/* Hidden symbol visibility support. + * If we build with gcc's -fvisibility=hidden flag, we'll need to change + * the symbol visibility mode to 'default'. + */ +#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__) +# define HIDDEN(x) .hidden x +#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 && !defined(__MINGW32__) +# pragma GCC visibility push(default) +# define HIDDEN(x) .hidden x +#else +# define HIDDEN(x) +#endif + +#endif /* __ASSYNTAX_H__ */ diff --git a/reactos/dll/mesa32/src/x86/clip_args.h b/reactos/dll/mesa32/src/x86/clip_args.h new file mode 100644 index 00000000000..cccf8019812 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/clip_args.h @@ -0,0 +1,60 @@ +/* $Id: clip_args.h,v 1.5 2002/10/29 20:28:57 brianp Exp $ */ + +/* + * 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. + */ + +/* + * Clip test function interface for assembly code. Simply define + * FRAME_OFFSET to the number of bytes pushed onto the stack before + * using the ARG_* argument macros. + * + * Gareth Hughes + */ + +#ifndef __CLIP_ARGS_H__ +#define __CLIP_ARGS_H__ + +/* + * Offsets for clip_func arguments + * + * typedef GLvector4f *(*clip_func)( GLvector4f *clip_vec, + * GLvector4f *proj_vec, + * GLubyte clipMask[], + * GLubyte *orMask, + * GLubyte *andMask ); + */ + +#define OFFSET_SOURCE 4 +#define OFFSET_DEST 8 +#define OFFSET_CLIP 12 +#define OFFSET_OR 16 +#define OFFSET_AND 20 + +#define ARG_SOURCE REGOFF(FRAME_OFFSET+OFFSET_SOURCE, ESP) +#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) +#define ARG_CLIP REGOFF(FRAME_OFFSET+OFFSET_CLIP, ESP) +#define ARG_OR REGOFF(FRAME_OFFSET+OFFSET_OR, ESP) +#define ARG_AND REGOFF(FRAME_OFFSET+OFFSET_AND, ESP) + +#endif diff --git a/reactos/dll/mesa32/src/x86/common_x86.c b/reactos/dll/mesa32/src/x86/common_x86.c new file mode 100644 index 00000000000..0ff7fd51a6d --- /dev/null +++ b/reactos/dll/mesa32/src/x86/common_x86.c @@ -0,0 +1,448 @@ +/* + * Mesa 3-D graphics library + * Version: 6.0.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. + */ + +/** + * \file common_x86.c + * + * Check CPU capabilities & initialize optimized funtions for this particular + * processor. + * + * Changed by Andre Werthmann for using the new SSE functions. + * + * \author Holger Waechtler + * \author Andre Werthmann + */ + +/* XXX these includes should probably go into imports.h or glheader.h */ +#if defined(USE_SSE_ASM) && defined(__linux__) +#include +#endif +#if defined(USE_SSE_ASM) && defined(__FreeBSD__) +#include +#include +#endif + +#include "common_x86_asm.h" +#include "imports.h" + + +int _mesa_x86_cpu_features = 0; + +/* No reason for this to be public. + */ +extern GLuint _ASMAPI _mesa_x86_has_cpuid(void); +extern void _ASMAPI _mesa_x86_cpuid(GLuint op, GLuint *reg_eax, GLuint *reg_ebx, GLuint *reg_ecx, GLuint *reg_edx); +extern GLuint _ASMAPI _mesa_x86_cpuid_eax(GLuint op); +extern GLuint _ASMAPI _mesa_x86_cpuid_ebx(GLuint op); +extern GLuint _ASMAPI _mesa_x86_cpuid_ecx(GLuint op); +extern GLuint _ASMAPI _mesa_x86_cpuid_edx(GLuint op); + +static void message( const char *msg ) +{ + GLboolean debug; +#ifdef DEBUG + debug = GL_TRUE; +#else + if ( _mesa_getenv( "MESA_DEBUG" ) ) { + debug = GL_TRUE; + } else { + debug = GL_FALSE; + } +#endif + if ( debug ) { + fprintf( stderr, "%s", msg ); + } +} + +#if defined(USE_SSE_ASM) +/* + * We must verify that the Streaming SIMD Extensions are truly supported + * on this processor before we go ahead and hook out the optimized code. + * Unfortunately, the CPUID bit isn't enough, as the OS must set the + * OSFXSR bit in CR4 if it supports the extended FPU save and restore + * required to use SSE. Unfortunately, we can't just go ahead and read + * this register, as only the kernel can do that. Similarly, we must + * verify that the OSXMMEXCPT bit in CR4 has been set by the OS, + * signifying that it supports unmasked SIMD FPU exceptions. If we take + * an unmasked exception and the OS doesn't correctly support them, the + * best we'll get is a SIGILL and the worst we'll get is an infinite + * loop in the signal delivery from the kernel as we can't interact with + * the SIMD FPU state to clear the exception bits. Either way, this is + * not good. + * + * However, I have been told by Alan Cox that all 2.4 (and later) Linux + * kernels provide full SSE support on all processors that expose SSE via + * the CPUID mechanism. It just so happens that this is the exact set of + * kernels supported DRI. Therefore, when building for DRI the funky SSE + * exception test is omitted. + */ + +extern void _mesa_test_os_sse_support( void ); +extern void _mesa_test_os_sse_exception_support( void ); + +#if defined(__linux__) && defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC) \ + && !defined(IN_DRI_DRIVER) +static void sigill_handler( int signal, struct sigcontext sc ) +{ + message( "SIGILL, " ); + + /* Both the "xorps %%xmm0,%%xmm0" and "divps %xmm0,%%xmm1" + * instructions are 3 bytes long. We must increment the instruction + * pointer manually to avoid repeated execution of the offending + * instruction. + * + * If the SIGILL is caused by a divide-by-zero when unmasked + * exceptions aren't supported, the SIMD FPU status and control + * word will be restored at the end of the test, so we don't need + * to worry about doing it here. Besides, we may not be able to... + */ + sc.eip += 3; + + _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); +} + +static void sigfpe_handler( int signal, struct sigcontext sc ) +{ + message( "SIGFPE, " ); + + if ( sc.fpstate->magic != 0xffff ) { + /* Our signal context has the extended FPU state, so reset the + * divide-by-zero exception mask and clear the divide-by-zero + * exception bit. + */ + sc.fpstate->mxcsr |= 0x00000200; + sc.fpstate->mxcsr &= 0xfffffffb; + } else { + /* If we ever get here, we're completely hosed. + */ + message( "\n\n" ); + _mesa_problem( NULL, "SSE enabling test failed badly!" ); + } +} +#endif /* __linux__ && _POSIX_SOURCE && X86_FXSR_MAGIC */ + +#if defined(WIN32) +#ifndef STATUS_FLOAT_MULTIPLE_TRAPS +# define STATUS_FLOAT_MULTIPLE_TRAPS (0xC00002B5L) +#endif +static LONG WINAPI ExceptionFilter(LPEXCEPTION_POINTERS exp) +{ + PEXCEPTION_RECORD rec = exp->ExceptionRecord; + PCONTEXT ctx = exp->ContextRecord; + + if ( rec->ExceptionCode == EXCEPTION_ILLEGAL_INSTRUCTION ) { + message( "EXCEPTION_ILLEGAL_INSTRUCTION, " ); + _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); + } else if ( rec->ExceptionCode == STATUS_FLOAT_MULTIPLE_TRAPS ) { + message( "STATUS_FLOAT_MULTIPLE_TRAPS, " ); + /* Windows seems to clear the exception flag itself, we just have to increment Eip */ + } else { + message( "UNEXPECTED EXCEPTION (0x%08x), terminating!" ); + return EXCEPTION_EXECUTE_HANDLER; + } + + if ( (ctx->ContextFlags & CONTEXT_CONTROL) != CONTEXT_CONTROL ) { + message( "Context does not contain control registers, terminating!" ); + return EXCEPTION_EXECUTE_HANDLER; + } + ctx->Eip += 3; + + return EXCEPTION_CONTINUE_EXECUTION; +} +#endif /* WIN32 */ + + +/* If we're running on a processor that can do SSE, let's see if we + * are allowed to or not. This will catch 2.4.0 or later kernels that + * haven't been configured for a Pentium III but are running on one, + * and RedHat patched 2.2 kernels that have broken exception handling + * support for user space apps that do SSE. + * + * GH: Isn't this just awful? + */ +static void check_os_sse_support( void ) +{ +#if defined(__linux__) && !defined(IN_DRI_DRIVER) +#if defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC) + struct sigaction saved_sigill; + struct sigaction saved_sigfpe; + + /* Save the original signal handlers. + */ + sigaction( SIGILL, NULL, &saved_sigill ); + sigaction( SIGFPE, NULL, &saved_sigfpe ); + + signal( SIGILL, (void (*)(int))sigill_handler ); + signal( SIGFPE, (void (*)(int))sigfpe_handler ); + + /* Emulate test for OSFXSR in CR4. The OS will set this bit if it + * supports the extended FPU save and restore required for SSE. If + * we execute an SSE instruction on a PIII and get a SIGILL, the OS + * doesn't support Streaming SIMD Exceptions, even if the processor + * does. + */ + if ( cpu_has_xmm ) { + message( "Testing OS support for SSE... " ); + + _mesa_test_os_sse_support(); + + if ( cpu_has_xmm ) { + message( "yes.\n" ); + } else { + message( "no!\n" ); + } + } + + /* Emulate test for OSXMMEXCPT in CR4. The OS will set this bit if + * it supports unmasked SIMD FPU exceptions. If we unmask the + * exceptions, do a SIMD divide-by-zero and get a SIGILL, the OS + * doesn't support unmasked SIMD FPU exceptions. If we get a SIGFPE + * as expected, we're okay but we need to clean up after it. + * + * Are we being too stringent in our requirement that the OS support + * unmasked exceptions? Certain RedHat 2.2 kernels enable SSE by + * setting CR4.OSFXSR but don't support unmasked exceptions. Win98 + * doesn't even support them. We at least know the user-space SSE + * support is good in kernels that do support unmasked exceptions, + * and therefore to be safe I'm going to leave this test in here. + */ + if ( cpu_has_xmm ) { + message( "Testing OS support for SSE unmasked exceptions... " ); + + _mesa_test_os_sse_exception_support(); + + if ( cpu_has_xmm ) { + message( "yes.\n" ); + } else { + message( "no!\n" ); + } + } + + /* Restore the original signal handlers. + */ + sigaction( SIGILL, &saved_sigill, NULL ); + sigaction( SIGFPE, &saved_sigfpe, NULL ); + + /* If we've gotten to here and the XMM CPUID bit is still set, we're + * safe to go ahead and hook out the SSE code throughout Mesa. + */ + if ( cpu_has_xmm ) { + message( "Tests of OS support for SSE passed.\n" ); + } else { + message( "Tests of OS support for SSE failed!\n" ); + } +#else + /* We can't use POSIX signal handling to test the availability of + * SSE, so we disable it by default. + */ + message( "Cannot test OS support for SSE, disabling to be safe.\n" ); + _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); +#endif /* _POSIX_SOURCE && X86_FXSR_MAGIC */ +#elif defined(__FreeBSD__) + { + int ret, enabled; + unsigned int len; + len = sizeof(enabled); + ret = sysctlbyname("hw.instruction_sse", &enabled, &len, NULL, 0); + if (ret || !enabled) + _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); + } +#elif defined(WIN32) + LPTOP_LEVEL_EXCEPTION_FILTER oldFilter; + + /* Install our ExceptionFilter */ + oldFilter = SetUnhandledExceptionFilter( ExceptionFilter ); + + if ( cpu_has_xmm ) { + message( "Testing OS support for SSE... " ); + + _mesa_test_os_sse_support(); + + if ( cpu_has_xmm ) { + message( "yes.\n" ); + } else { + message( "no!\n" ); + } + } + + if ( cpu_has_xmm ) { + message( "Testing OS support for SSE unmasked exceptions... " ); + + _mesa_test_os_sse_exception_support(); + + if ( cpu_has_xmm ) { + message( "yes.\n" ); + } else { + message( "no!\n" ); + } + } + + /* Restore previous exception filter */ + SetUnhandledExceptionFilter( oldFilter ); + + if ( cpu_has_xmm ) { + message( "Tests of OS support for SSE passed.\n" ); + } else { + message( "Tests of OS support for SSE failed!\n" ); + } +#else + /* Do nothing on other platforms for now. + */ + message( "Not testing OS support for SSE, leaving enabled.\n" ); +#endif /* __linux__ */ +} + +#endif /* USE_SSE_ASM */ + + +void _mesa_init_all_x86_transform_asm( void ) +{ + (void) message; /* silence warning */ +#ifdef USE_X86_ASM + _mesa_x86_cpu_features = 0; + + if (!_mesa_x86_has_cpuid()) { + message("CPUID not detected"); + } + else { + GLuint cpu_features; + GLuint cpu_ext_features; + GLuint cpu_ext_info; + char cpu_vendor[13]; + GLuint result; + + /* get vendor name */ + _mesa_x86_cpuid(0, &result, (GLuint *)(cpu_vendor + 0), (GLuint *)(cpu_vendor + 8), (GLuint *)(cpu_vendor + 4)); + cpu_vendor[12] = '\0'; + + message("cpu vendor: "); + message(cpu_vendor); + message("\n"); + + /* get cpu features */ + cpu_features = _mesa_x86_cpuid_edx(1); + + if (cpu_features & X86_CPU_FPU) + _mesa_x86_cpu_features |= X86_FEATURE_FPU; + if (cpu_features & X86_CPU_CMOV) + _mesa_x86_cpu_features |= X86_FEATURE_CMOV; + +#ifdef USE_MMX_ASM + if (cpu_features & X86_CPU_MMX) + _mesa_x86_cpu_features |= X86_FEATURE_MMX; +#endif + +#ifdef USE_SSE_ASM + if (cpu_features & X86_CPU_XMM) + _mesa_x86_cpu_features |= X86_FEATURE_XMM; + if (cpu_features & X86_CPU_XMM2) + _mesa_x86_cpu_features |= X86_FEATURE_XMM2; +#endif + + /* query extended cpu features */ + if ((cpu_ext_info = _mesa_x86_cpuid_eax(0x80000000)) > 0x80000000) { + if (cpu_ext_info >= 0x80000001) { + + cpu_ext_features = _mesa_x86_cpuid_edx(0x80000001); + + if (cpu_features & X86_CPU_MMX) { + +#ifdef USE_3DNOW_ASM + if (cpu_ext_features & X86_CPUEXT_3DNOW) + _mesa_x86_cpu_features |= X86_FEATURE_3DNOW; + if (cpu_ext_features & X86_CPUEXT_3DNOW_EXT) + _mesa_x86_cpu_features |= X86_FEATURE_3DNOWEXT; +#endif + +#ifdef USE_MMX_ASM + if (cpu_ext_features & X86_CPUEXT_MMX_EXT) + _mesa_x86_cpu_features |= X86_FEATURE_MMXEXT; +#endif + } + } + + /* query cpu name */ + if (cpu_ext_info >= 0x80000002) { + GLuint ofs; + char cpu_name[49]; + for (ofs = 0; ofs < 3; ofs++) + _mesa_x86_cpuid(0x80000002+ofs, (GLuint *)(cpu_name + (16*ofs)+0), (GLuint *)(cpu_name + (16*ofs)+4), (GLuint *)(cpu_name + (16*ofs)+8), (GLuint *)(cpu_name + (16*ofs)+12)); + cpu_name[48] = '\0'; /* the name should be NULL terminated, but just to be sure */ + + message("cpu name: "); + message(cpu_name); + message("\n"); + } + } + + } + + if ( _mesa_getenv( "MESA_NO_ASM" ) ) { + _mesa_x86_cpu_features = 0; + } + + if ( _mesa_x86_cpu_features ) { + _mesa_init_x86_transform_asm(); + } + +#ifdef USE_MMX_ASM + if ( cpu_has_mmx ) { + if ( _mesa_getenv( "MESA_NO_MMX" ) == 0 ) { + message( "MMX cpu detected.\n" ); + } else { + _mesa_x86_cpu_features &= ~(X86_FEATURE_MMX); + } + } +#endif + +#ifdef USE_3DNOW_ASM + if ( cpu_has_3dnow ) { + if ( _mesa_getenv( "MESA_NO_3DNOW" ) == 0 ) { + message( "3DNow! cpu detected.\n" ); + _mesa_init_3dnow_transform_asm(); + } else { + _mesa_x86_cpu_features &= ~(X86_FEATURE_3DNOW); + } + } +#endif + +#ifdef USE_SSE_ASM + if ( cpu_has_xmm ) { + if ( _mesa_getenv( "MESA_NO_SSE" ) == 0 ) { + message( "SSE cpu detected.\n" ); + if ( _mesa_getenv( "MESA_FORCE_SSE" ) == 0 ) { + check_os_sse_support(); + } + if ( cpu_has_xmm ) { + _mesa_init_sse_transform_asm(); + } + } else { + message( "SSE cpu detected, but switched off by user.\n" ); + _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); + } + } +#endif +#endif +} + diff --git a/reactos/dll/mesa32/src/x86/common_x86_asm.S b/reactos/dll/mesa32/src/x86/common_x86_asm.S new file mode 100644 index 00000000000..654b3469d8a --- /dev/null +++ b/reactos/dll/mesa32/src/x86/common_x86_asm.S @@ -0,0 +1,215 @@ +/* + * 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. + */ + +/* + * Check extended CPU capabilities. Now justs returns the raw CPUID + * feature information, allowing the higher level code to interpret the + * results. + * + * Written by Holger Waechtler + * + * Cleaned up and simplified by Gareth Hughes + * + */ + +/* + * NOTE: Avoid using spaces in between '(' ')' and arguments, especially + * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces + * in there will break the build on some platforms. + */ + +#include "matypes.h" +#include "common_x86_features.h" + + SEG_TEXT + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_has_cpuid) +HIDDEN(_mesa_x86_has_cpuid) +GLNAME(_mesa_x86_has_cpuid): + + /* Test for the CPUID command. If the ID Flag bit in EFLAGS + * (bit 21) is writable, the CPUID command is present */ + PUSHF_L + POP_L (EAX) + MOV_L (EAX, ECX) + XOR_L (CONST(0x00200000), EAX) + PUSH_L (EAX) + POPF_L + PUSHF_L + POP_L (EAX) + + /* Verify the ID Flag bit has been written. */ + CMP_L (ECX, EAX) + SETNE (AL) + XOR_L (CONST(0xff), EAX) + + RET + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_cpuid) +HIDDEN(_mesa_x86_cpuid) +GLNAME(_mesa_x86_cpuid): + + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EDI) + PUSH_L (EBX) + + CPUID + + MOV_L (REGOFF(16, ESP), EDI) /* *eax */ + MOV_L (EAX, REGIND(EDI)) + MOV_L (REGOFF(20, ESP), EDI) /* *ebx */ + MOV_L (EBX, REGIND(EDI)) + MOV_L (REGOFF(24, ESP), EDI) /* *ecx */ + MOV_L (ECX, REGIND(EDI)) + MOV_L (REGOFF(28, ESP), EDI) /* *edx */ + MOV_L (EDX, REGIND(EDI)) + + POP_L (EBX) + POP_L (EDI) + RET + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_cpuid_eax) +HIDDEN(_mesa_x86_cpuid_eax) +GLNAME(_mesa_x86_cpuid_eax): + + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EBX) + + CPUID + + POP_L (EBX) + RET + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_cpuid_ebx) +HIDDEN(_mesa_x86_cpuid_ebx) +GLNAME(_mesa_x86_cpuid_ebx): + + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EBX) + + CPUID + MOV_L (EBX, EAX) /* return EBX */ + + POP_L (EBX) + RET + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_cpuid_ecx) +HIDDEN(_mesa_x86_cpuid_ecx) +GLNAME(_mesa_x86_cpuid_ecx): + + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EBX) + + CPUID + MOV_L (ECX, EAX) /* return ECX */ + + POP_L (EBX) + RET + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_cpuid_edx) +HIDDEN(_mesa_x86_cpuid_edx) +GLNAME(_mesa_x86_cpuid_edx): + + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EBX) + + CPUID + MOV_L (EDX, EAX) /* return EDX */ + + POP_L (EBX) + RET + +#ifdef USE_SSE_ASM +/* Execute an SSE instruction to see if the operating system correctly + * supports SSE. A signal handler for SIGILL should have been set + * before calling this function, otherwise this could kill the client + * application. + * + * -----> !!!! ATTENTION DEVELOPERS !!!! <----- + * + * If you're debugging with gdb and you get stopped in this function, + * just type 'continue'! Execution will proceed normally. + * See freedesktop.org bug #1709 for more info. + */ +ALIGNTEXT4 +GLOBL GLNAME( _mesa_test_os_sse_support ) +HIDDEN(_mesa_test_os_sse_support) +GLNAME( _mesa_test_os_sse_support ): + + XORPS ( XMM0, XMM0 ) + + RET + + +/* Perform an SSE divide-by-zero to see if the operating system + * correctly supports unmasked SIMD FPU exceptions. Signal handlers for + * SIGILL and SIGFPE should have been set before calling this function, + * otherwise this could kill the client application. + */ +ALIGNTEXT4 +GLOBL GLNAME( _mesa_test_os_sse_exception_support ) +HIDDEN(_mesa_test_os_sse_exception_support) +GLNAME( _mesa_test_os_sse_exception_support ): + + PUSH_L ( EBP ) + MOV_L ( ESP, EBP ) + SUB_L ( CONST( 8 ), ESP ) + + /* Save the original MXCSR register value. + */ + STMXCSR ( REGOFF( -4, EBP ) ) + + /* Unmask the divide-by-zero exception and perform one. + */ + STMXCSR ( REGOFF( -8, EBP ) ) + AND_L ( CONST( 0xfffffdff ), REGOFF( -8, EBP ) ) + LDMXCSR ( REGOFF( -8, EBP ) ) + + XORPS ( XMM0, XMM0 ) + + PUSH_L ( CONST( 0x3f800000 ) ) + PUSH_L ( CONST( 0x3f800000 ) ) + PUSH_L ( CONST( 0x3f800000 ) ) + PUSH_L ( CONST( 0x3f800000 ) ) + + MOVUPS ( REGIND( ESP ), XMM1 ) + + DIVPS ( XMM0, XMM1 ) + + /* Restore the original MXCSR register value. + */ + LDMXCSR ( REGOFF( -4, EBP ) ) + + LEAVE + RET + +#endif + diff --git a/reactos/dll/mesa32/src/x86/common_x86_asm.h b/reactos/dll/mesa32/src/x86/common_x86_asm.h new file mode 100644 index 00000000000..99772983289 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/common_x86_asm.h @@ -0,0 +1,60 @@ +/* $Id: common_x86_asm.h,v 1.12 2005/07/16 00:56:20 ajax Exp $ */ + +/* + * 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. + */ + +/* + * Check CPU capabilities & initialize optimized funtions for this particular + * processor. + * + * Written by Holger Waechtler + * Changed by Andre Werthmann for using the + * new SSE functions + * + * Reimplemented by Gareth Hughes in a more + * future-proof manner, based on code in the Linux kernel. + */ + +#ifndef __COMMON_X86_ASM_H__ +#define __COMMON_X86_ASM_H__ + +/* Do not reference mtypes.h from this file. + */ +#include "common_x86_features.h" + +#ifdef USE_X86_ASM +#include "x86.h" +#ifdef USE_3DNOW_ASM +#include "3dnow.h" +#endif +#ifdef USE_SSE_ASM +#include "sse.h" +#endif +#endif + +extern int _mesa_x86_cpu_features; + +extern void _mesa_init_all_x86_transform_asm( void ); + +#endif diff --git a/reactos/dll/mesa32/src/x86/common_x86_features.h b/reactos/dll/mesa32/src/x86/common_x86_features.h new file mode 100644 index 00000000000..90509775cfc --- /dev/null +++ b/reactos/dll/mesa32/src/x86/common_x86_features.h @@ -0,0 +1,68 @@ +/* $Id: common_x86_features.h,v 1.6 2003/01/21 16:14:00 brianp Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 5.1 + * + * 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. + */ + +/* + * x86 CPUID feature information. The raw data is returned by + * _mesa_identify_x86_cpu_features() and interpreted with the cpu_has_* + * helper macros. + * + * Gareth Hughes + */ + +#ifndef __COMMON_X86_FEATURES_H__ +#define __COMMON_X86_FEATURES_H__ + +#define X86_FEATURE_FPU (1<<0) +#define X86_FEATURE_CMOV (1<<1) +#define X86_FEATURE_MMXEXT (1<<2) +#define X86_FEATURE_MMX (1<<3) +#define X86_FEATURE_FXSR (1<<4) +#define X86_FEATURE_XMM (1<<5) +#define X86_FEATURE_XMM2 (1<<6) +#define X86_FEATURE_3DNOWEXT (1<<7) +#define X86_FEATURE_3DNOW (1<<8) + +/* standard X86 CPU features */ +#define X86_CPU_FPU (1<<0) +#define X86_CPU_CMOV (1<<15) +#define X86_CPU_MMX (1<<23) +#define X86_CPU_XMM (1<<25) +#define X86_CPU_XMM2 (1<<26) + +/* extended X86 CPU features */ +#define X86_CPUEXT_MMX_EXT (1<<22) +#define X86_CPUEXT_3DNOW_EXT (1<<30) +#define X86_CPUEXT_3DNOW (1<<31) + +#define cpu_has_mmx (_mesa_x86_cpu_features & X86_FEATURE_MMX) +#define cpu_has_mmxext (_mesa_x86_cpu_features & X86_FEATURE_MMXEXT) +#define cpu_has_xmm (_mesa_x86_cpu_features & X86_FEATURE_XMM) +#define cpu_has_xmm2 (_mesa_x86_cpu_features & X86_FEATURE_XMM2) +#define cpu_has_3dnow (_mesa_x86_cpu_features & X86_FEATURE_3DNOW) +#define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT) + +#endif + diff --git a/reactos/dll/mesa32/src/x86/common_x86_macros.h b/reactos/dll/mesa32/src/x86/common_x86_macros.h new file mode 100644 index 00000000000..ba155caae1d --- /dev/null +++ b/reactos/dll/mesa32/src/x86/common_x86_macros.h @@ -0,0 +1,107 @@ +/* $Id: common_x86_macros.h,v 1.3 2002/10/29 20:28:58 brianp Exp $ */ + +/* + * 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. + * + * Authors: + * Gareth Hughes + */ + +#ifndef __COMMON_X86_MACROS_H__ +#define __COMMON_X86_MACROS_H__ + + +/* ============================================================= + * Transformation function declarations: + */ + +#define XFORM_ARGS GLvector4f *to_vec, \ + const GLfloat m[16], \ + const GLvector4f *from_vec + +#define DECLARE_XFORM_GROUP( pfx, sz ) \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d( XFORM_ARGS ); + +#define ASSIGN_XFORM_GROUP( pfx, sz ) \ + _mesa_transform_tab[sz][MATRIX_GENERAL] = \ + _mesa_##pfx##_transform_points##sz##_general; \ + _mesa_transform_tab[sz][MATRIX_IDENTITY] = \ + _mesa_##pfx##_transform_points##sz##_identity; \ + _mesa_transform_tab[sz][MATRIX_3D_NO_ROT] = \ + _mesa_##pfx##_transform_points##sz##_3d_no_rot; \ + _mesa_transform_tab[sz][MATRIX_PERSPECTIVE] = \ + _mesa_##pfx##_transform_points##sz##_perspective; \ + _mesa_transform_tab[sz][MATRIX_2D] = \ + _mesa_##pfx##_transform_points##sz##_2d; \ + _mesa_transform_tab[sz][MATRIX_2D_NO_ROT] = \ + _mesa_##pfx##_transform_points##sz##_2d_no_rot; \ + _mesa_transform_tab[sz][MATRIX_3D] = \ + _mesa_##pfx##_transform_points##sz##_3d; + + +/* ============================================================= + * Normal transformation function declarations: + */ + +#define NORM_ARGS const GLmatrix *mat, \ + GLfloat scale, \ + const GLvector4f *in, \ + const GLfloat *lengths, \ + GLvector4f *dest + +#define DECLARE_NORM_GROUP( pfx ) \ +extern void _ASMAPI _mesa_##pfx##_rescale_normals( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_normalize_normals( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_normals( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_normals_no_rot( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_no_rot( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_no_rot( NORM_ARGS ); + +#define ASSIGN_NORM_GROUP( pfx ) \ + _mesa_normal_tab[NORM_RESCALE] = \ + _mesa_##pfx##_rescale_normals; \ + _mesa_normal_tab[NORM_NORMALIZE] = \ + _mesa_##pfx##_normalize_normals; \ + _mesa_normal_tab[NORM_TRANSFORM] = \ + _mesa_##pfx##_transform_normals; \ + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = \ + _mesa_##pfx##_transform_normals_no_rot; \ + _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = \ + _mesa_##pfx##_transform_rescale_normals; \ + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = \ + _mesa_##pfx##_transform_rescale_normals_no_rot; \ + _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] = \ + _mesa_##pfx##_transform_normalize_normals; \ + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] = \ + _mesa_##pfx##_transform_normalize_normals_no_rot; + + +#endif diff --git a/reactos/dll/mesa32/src/x86/gen_matypes.c b/reactos/dll/mesa32/src/x86/gen_matypes.c new file mode 100644 index 00000000000..d5cee5347ce --- /dev/null +++ b/reactos/dll/mesa32/src/x86/gen_matypes.c @@ -0,0 +1,251 @@ +/* + * 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: + * Gareth Hughes + */ + +/* + * This generates an asm version of mtypes.h (called matypes.h), so that + * Mesa's x86 assembly code can access the internal structures easily. + * This will be particularly useful when developing new x86 asm code for + * Mesa, including lighting, clipping, texture image conversion etc. + */ + +#include "main/glheader.h" +#include "main/mtypes.h" +#include "tnl/t_context.h" + + +#undef offsetof +#define offsetof( type, member ) ((size_t) &((type *)0)->member) + + +#define OFFSET_HEADER( x ) \ +do { \ + printf( "\n" ); \ + printf( "\n" ); \ + printf( "/* =====================================================" \ + "========\n" ); \ + printf( " * Offsets for %s\n", x ); \ + printf( " */\n" ); \ + printf( "\n" ); \ +} while (0) + +#define DEFINE_HEADER( x ) \ +do { \ + printf( "\n" ); \ + printf( "/*\n" ); \ + printf( " * Flags for %s\n", x ); \ + printf( " */\n" ); \ + printf( "\n" ); \ +} while (0) + +#if defined(__BEOS__) || defined(_LP64) +#define OFFSET( s, t, m ) \ + printf( "#define %s\t%ld\n", s, offsetof( t, m ) ); +#else +#define OFFSET( s, t, m ) \ + printf( "#define %s\t%d\n", s, offsetof( t, m ) ); +#endif + +#if defined(__BEOS__) || defined(_LP64) +#define SIZEOF( s, t ) \ + printf( "#define %s\t%ld\n", s, sizeof(t) ); +#else +#define SIZEOF( s, t ) \ + printf( "#define %s\t%d\n", s, sizeof(t) ); +#endif + +#define DEFINE( s, d ) \ + printf( "#define %s\t0x%x\n", s, d ); + + + +int main( int argc, char **argv ) +{ + printf( "/*\n" ); + printf( " * This file is automatically generated from the Mesa internal type\n" ); + printf( " * definitions. Do not edit directly.\n" ); + printf( " */\n" ); + printf( "\n" ); + printf( "#ifndef __ASM_TYPES_H__\n" ); + printf( "#define __ASM_TYPES_H__\n" ); + printf( "\n" ); + printf( "#include \"assyntax.h\"\n" ); + + + /* GLcontext offsets: + */ + OFFSET_HEADER( "GLcontext" ); + + OFFSET( "CTX_DRIVER_CTX ", GLcontext, DriverCtx ); + printf( "\n" ); + OFFSET( "CTX_LIGHT_ENABLED ", GLcontext, Light.Enabled ); + OFFSET( "CTX_LIGHT_SHADE_MODEL ", GLcontext, Light.ShadeModel ); + OFFSET( "CTX_LIGHT_COLOR_MAT_FACE ", GLcontext, Light.ColorMaterialFace ); + OFFSET( "CTX_LIGHT_COLOR_MAT_MODE ", GLcontext, Light.ColorMaterialMode ); + OFFSET( "CTX_LIGHT_COLOR_MAT_MASK ", GLcontext, Light.ColorMaterialBitmask ); + OFFSET( "CTX_LIGHT_COLOR_MAT_ENABLED ", GLcontext, Light.ColorMaterialEnabled ); + OFFSET( "CTX_LIGHT_ENABLED_LIST ", GLcontext, Light.EnabledList ); + OFFSET( "CTX_LIGHT_NEED_VERTS ", GLcontext, Light._NeedVertices ); + OFFSET( "CTX_LIGHT_FLAGS ", GLcontext, Light._Flags ); + OFFSET( "CTX_LIGHT_BASE_COLOR ", GLcontext, Light._BaseColor ); + + + /* struct vertex_buffer offsets: + */ + OFFSET_HEADER( "struct vertex_buffer" ); + + OFFSET( "VB_SIZE ", struct vertex_buffer, Size ); + OFFSET( "VB_COUNT ", struct vertex_buffer, Count ); + printf( "\n" ); + OFFSET( "VB_ELTS ", struct vertex_buffer, Elts ); + OFFSET( "VB_OBJ_PTR ", struct vertex_buffer, ObjPtr ); + OFFSET( "VB_EYE_PTR ", struct vertex_buffer, EyePtr ); + OFFSET( "VB_CLIP_PTR ", struct vertex_buffer, ClipPtr ); + OFFSET( "VB_PROJ_CLIP_PTR ", struct vertex_buffer, NdcPtr ); + OFFSET( "VB_CLIP_OR_MASK ", struct vertex_buffer, ClipOrMask ); + OFFSET( "VB_CLIP_MASK ", struct vertex_buffer, ClipMask ); + OFFSET( "VB_NORMAL_PTR ", struct vertex_buffer, NormalPtr ); + OFFSET( "VB_EDGE_FLAG ", struct vertex_buffer, EdgeFlag ); + OFFSET( "VB_TEX0_COORD_PTR ", struct vertex_buffer, TexCoordPtr[0] ); + OFFSET( "VB_TEX1_COORD_PTR ", struct vertex_buffer, TexCoordPtr[1] ); + OFFSET( "VB_TEX2_COORD_PTR ", struct vertex_buffer, TexCoordPtr[2] ); + OFFSET( "VB_TEX3_COORD_PTR ", struct vertex_buffer, TexCoordPtr[3] ); + OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, IndexPtr ); + OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, ColorPtr ); + OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, SecondaryColorPtr ); + OFFSET( "VB_FOG_COORD_PTR ", struct vertex_buffer, FogCoordPtr ); + OFFSET( "VB_POINT_SIZE_PTR ", struct vertex_buffer, PointSizePtr ); + OFFSET( "VB_PRIMITIVE ", struct vertex_buffer, Primitive ); + printf( "\n" ); + OFFSET( "VB_LAST_CLIPPED ", struct vertex_buffer, LastClipped ); + + DEFINE_HEADER( "struct vertex_buffer" ); + + /* XXX use new labels here someday after vertex proram is done */ + DEFINE( "VERT_BIT_OBJ ", VERT_BIT_POS ); + DEFINE( "VERT_BIT_NORM ", VERT_BIT_NORMAL ); + DEFINE( "VERT_BIT_RGBA ", VERT_BIT_COLOR0 ); + DEFINE( "VERT_BIT_SPEC_RGB ", VERT_BIT_COLOR1 ); + DEFINE( "VERT_BIT_FOG_COORD ", VERT_BIT_FOG ); + DEFINE( "VERT_BIT_TEX0 ", VERT_BIT_TEX0 ); + DEFINE( "VERT_BIT_TEX1 ", VERT_BIT_TEX1 ); + DEFINE( "VERT_BIT_TEX2 ", VERT_BIT_TEX2 ); + DEFINE( "VERT_BIT_TEX3 ", VERT_BIT_TEX3 ); + + + /* GLvector4f offsets: + */ + OFFSET_HEADER( "GLvector4f" ); + + OFFSET( "V4F_DATA ", GLvector4f, data ); + OFFSET( "V4F_START ", GLvector4f, start ); + OFFSET( "V4F_COUNT ", GLvector4f, count ); + OFFSET( "V4F_STRIDE ", GLvector4f, stride ); + OFFSET( "V4F_SIZE ", GLvector4f, size ); + OFFSET( "V4F_FLAGS ", GLvector4f, flags ); + + DEFINE_HEADER( "GLvector4f" ); + + DEFINE( "VEC_MALLOC ", VEC_MALLOC ); + DEFINE( "VEC_NOT_WRITEABLE ", VEC_NOT_WRITEABLE ); + DEFINE( "VEC_BAD_STRIDE ", VEC_BAD_STRIDE ); + printf( "\n" ); + DEFINE( "VEC_SIZE_1 ", VEC_SIZE_1 ); + DEFINE( "VEC_SIZE_2 ", VEC_SIZE_2 ); + DEFINE( "VEC_SIZE_3 ", VEC_SIZE_3 ); + DEFINE( "VEC_SIZE_4 ", VEC_SIZE_4 ); + + + /* GLmatrix offsets: + */ + OFFSET_HEADER( "GLmatrix" ); + + OFFSET( "MATRIX_DATA ", GLmatrix, m ); + OFFSET( "MATRIX_INV ", GLmatrix, inv ); + OFFSET( "MATRIX_FLAGS ", GLmatrix, flags ); + OFFSET( "MATRIX_TYPE ", GLmatrix, type ); + + + /* struct gl_light offsets: + */ + OFFSET_HEADER( "struct gl_light" ); + + OFFSET( "LIGHT_NEXT ", struct gl_light, next ); + OFFSET( "LIGHT_PREV ", struct gl_light, prev ); + printf( "\n" ); + OFFSET( "LIGHT_AMBIENT ", struct gl_light, Ambient ); + OFFSET( "LIGHT_DIFFUSE ", struct gl_light, Diffuse ); + OFFSET( "LIGHT_SPECULAR ", struct gl_light, Specular ); + OFFSET( "LIGHT_EYE_POSITION ", struct gl_light, EyePosition ); + OFFSET( "LIGHT_EYE_DIRECTION ", struct gl_light, EyeDirection ); + OFFSET( "LIGHT_SPOT_EXPONENT ", struct gl_light, SpotExponent ); + OFFSET( "LIGHT_SPOT_CUTOFF ", struct gl_light, SpotCutoff ); + OFFSET( "LIGHT_COS_CUTOFF ", struct gl_light, _CosCutoff ); + OFFSET( "LIGHT_CONST_ATTEN ", struct gl_light, ConstantAttenuation ); + OFFSET( "LIGHT_LINEAR_ATTEN ", struct gl_light, LinearAttenuation ); + OFFSET( "LIGHT_QUADRATIC_ATTEN ", struct gl_light, QuadraticAttenuation ); + OFFSET( "LIGHT_ENABLED ", struct gl_light, Enabled ); + printf( "\n" ); + OFFSET( "LIGHT_FLAGS ", struct gl_light, _Flags ); + printf( "\n" ); + OFFSET( "LIGHT_POSITION ", struct gl_light, _Position ); + OFFSET( "LIGHT_VP_INF_NORM ", struct gl_light, _VP_inf_norm ); + OFFSET( "LIGHT_H_INF_NORM ", struct gl_light, _h_inf_norm ); + OFFSET( "LIGHT_NORM_DIRECTION ", struct gl_light, _NormDirection ); + OFFSET( "LIGHT_VP_INF_SPOT_ATTEN ", struct gl_light, _VP_inf_spot_attenuation ); + printf( "\n" ); + OFFSET( "LIGHT_SPOT_EXP_TABLE ", struct gl_light, _SpotExpTable ); + OFFSET( "LIGHT_MAT_AMBIENT ", struct gl_light, _MatAmbient ); + OFFSET( "LIGHT_MAT_DIFFUSE ", struct gl_light, _MatDiffuse ); + OFFSET( "LIGHT_MAT_SPECULAR ", struct gl_light, _MatSpecular ); + printf( "\n" ); + SIZEOF( "SIZEOF_GL_LIGHT ", struct gl_light ); + + DEFINE_HEADER( "struct gl_light" ); + + DEFINE( "LIGHT_SPOT ", LIGHT_SPOT ); + DEFINE( "LIGHT_LOCAL_VIEWER ", LIGHT_LOCAL_VIEWER ); + DEFINE( "LIGHT_POSITIONAL ", LIGHT_POSITIONAL ); + printf( "\n" ); + DEFINE( "LIGHT_NEED_VERTICES ", LIGHT_NEED_VERTICES ); + + + /* struct gl_lightmodel offsets: + */ + OFFSET_HEADER( "struct gl_lightmodel" ); + + OFFSET( "LIGHT_MODEL_AMBIENT ", struct gl_lightmodel, Ambient ); + OFFSET( "LIGHT_MODEL_LOCAL_VIEWER ", struct gl_lightmodel, LocalViewer ); + OFFSET( "LIGHT_MODEL_TWO_SIDE ", struct gl_lightmodel, TwoSide ); + OFFSET( "LIGHT_MODEL_COLOR_CONTROL ", struct gl_lightmodel, ColorControl ); + + + printf( "\n" ); + printf( "\n" ); + printf( "#endif /* __ASM_TYPES_H__ */\n" ); + + return 0; +} diff --git a/reactos/dll/mesa32/src/x86/glapi_x86.S b/reactos/dll/mesa32/src/x86/glapi_x86.S new file mode 100644 index 00000000000..231027ed661 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/glapi_x86.S @@ -0,0 +1,1155 @@ +/* DO NOT EDIT - This file generated automatically by gl_x86_asm.py (from Mesa) script */ + +/* + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * (C) Copyright IBM Corporation 2004, 2005 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL, IBM, + * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "assyntax.h" +#include "glapioffsets.h" + +#if defined(STDCALL_API) +# if defined(USE_MGL_NAMESPACE) +# define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n2)) +# else +# define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n2)) +# endif +#else +# if defined(USE_MGL_NAMESPACE) +# define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n)) +# else +# define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n)) +# endif +#endif + +#define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX)) + +#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__) +#define GLOBL_FN(x) GLOBL x ; .type x, function +#else +#define GLOBL_FN(x) GLOBL x +#endif + +#if defined(PTHREADS) || defined(USE_XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS) +# define THREADS +#endif + +#ifdef GLX_USE_TLS + +# define GL_STUB(fn,off,fn_alt) \ +ALIGNTEXT16; \ +GLOBL_FN(GL_PREFIX(fn, fn_alt)); \ +GL_PREFIX(fn, fn_alt): \ + CALL(_x86_get_dispatch) ; \ + NOP ; \ + JMP(GL_OFFSET(off)) + +#elif defined(PTHREADS) +# define GL_STUB(fn,off,fn_alt) \ +ALIGNTEXT16; \ +GLOBL_FN(GL_PREFIX(fn, fn_alt)); \ +GL_PREFIX(fn, fn_alt): \ + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ; \ + TEST_L(EAX, EAX) ; \ + JE(1f) ; \ + JMP(GL_OFFSET(off)) ; \ +1: CALL(_x86_get_dispatch) ; \ + JMP(GL_OFFSET(off)) +#elif defined(THREADS) +# define GL_STUB(fn,off,fn_alt) \ +ALIGNTEXT16; \ +GLOBL_FN(GL_PREFIX(fn, fn_alt)); \ +GL_PREFIX(fn, fn_alt): \ + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ; \ + TEST_L(EAX, EAX) ; \ + JE(1f) ; \ + JMP(GL_OFFSET(off)) ; \ +1: CALL(_glapi_get_dispatch) ; \ + JMP(GL_OFFSET(off)) +#else /* Non-threaded version. */ +# define GL_STUB(fn,off,fn_alt) \ +ALIGNTEXT16; \ +GLOBL_FN(GL_PREFIX(fn, fn_alt)); \ +GL_PREFIX(fn, fn_alt): \ + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ; \ + JMP(GL_OFFSET(off)) +#endif + +#ifdef HAVE_ALIAS +# define GL_STUB_ALIAS(fn,off,fn_alt,alias,alias_alt) \ + .globl GL_PREFIX(fn, fn_alt) ; \ + .set GL_PREFIX(fn, fn_alt), GL_PREFIX(alias, alias_alt) +#else +# define GL_STUB_ALIAS(fn,off,fn_alt,alias,alias_alt) \ + GL_STUB(fn, off, fn_alt) +#endif + +SEG_TEXT + +#ifdef GLX_USE_TLS + + GLOBL GLNAME(_x86_get_dispatch) + HIDDEN(GLNAME(_x86_get_dispatch)) +ALIGNTEXT16 +GLNAME(_x86_get_dispatch): + movl %gs:_glapi_tls_Dispatch@NTPOFF, %eax + ret + +#elif defined(PTHREADS) +EXTERN GLNAME(_glapi_Dispatch) +EXTERN GLNAME(_gl_DispatchTSD) +EXTERN GLNAME(pthread_getspecific) + +ALIGNTEXT16 +GLNAME(_x86_get_dispatch): + SUB_L(CONST(24), ESP) + PUSH_L(GLNAME(_gl_DispatchTSD)) + CALL(GLNAME(pthread_getspecific)) + ADD_L(CONST(28), ESP) + RET +#elif defined(THREADS) +EXTERN GLNAME(_glapi_get_dispatch) +#endif + +#if defined( GLX_USE_TLS ) + .section wtext, "awx", @progbits +#endif /* defined( GLX_USE_TLS ) */ + + ALIGNTEXT16 + GLOBL GLNAME(gl_dispatch_functions_start) + HIDDEN(GLNAME(gl_dispatch_functions_start)) +GLNAME(gl_dispatch_functions_start): + + GL_STUB(NewList, _gloffset_NewList, NewList@8) + GL_STUB(EndList, _gloffset_EndList, EndList@0) + GL_STUB(CallList, _gloffset_CallList, CallList@4) + GL_STUB(CallLists, _gloffset_CallLists, CallLists@12) + GL_STUB(DeleteLists, _gloffset_DeleteLists, DeleteLists@8) + GL_STUB(GenLists, _gloffset_GenLists, GenLists@4) + GL_STUB(ListBase, _gloffset_ListBase, ListBase@4) + GL_STUB(Begin, _gloffset_Begin, Begin@4) + GL_STUB(Bitmap, _gloffset_Bitmap, Bitmap@28) + GL_STUB(Color3b, _gloffset_Color3b, Color3b@12) + GL_STUB(Color3bv, _gloffset_Color3bv, Color3bv@4) + GL_STUB(Color3d, _gloffset_Color3d, Color3d@24) + GL_STUB(Color3dv, _gloffset_Color3dv, Color3dv@4) + GL_STUB(Color3f, _gloffset_Color3f, Color3f@12) + GL_STUB(Color3fv, _gloffset_Color3fv, Color3fv@4) + GL_STUB(Color3i, _gloffset_Color3i, Color3i@12) + GL_STUB(Color3iv, _gloffset_Color3iv, Color3iv@4) + GL_STUB(Color3s, _gloffset_Color3s, Color3s@12) + GL_STUB(Color3sv, _gloffset_Color3sv, Color3sv@4) + GL_STUB(Color3ub, _gloffset_Color3ub, Color3ub@12) + GL_STUB(Color3ubv, _gloffset_Color3ubv, Color3ubv@4) + GL_STUB(Color3ui, _gloffset_Color3ui, Color3ui@12) + GL_STUB(Color3uiv, _gloffset_Color3uiv, Color3uiv@4) + GL_STUB(Color3us, _gloffset_Color3us, Color3us@12) + GL_STUB(Color3usv, _gloffset_Color3usv, Color3usv@4) + GL_STUB(Color4b, _gloffset_Color4b, Color4b@16) + GL_STUB(Color4bv, _gloffset_Color4bv, Color4bv@4) + GL_STUB(Color4d, _gloffset_Color4d, Color4d@32) + GL_STUB(Color4dv, _gloffset_Color4dv, Color4dv@4) + GL_STUB(Color4f, _gloffset_Color4f, Color4f@16) + GL_STUB(Color4fv, _gloffset_Color4fv, Color4fv@4) + GL_STUB(Color4i, _gloffset_Color4i, Color4i@16) + GL_STUB(Color4iv, _gloffset_Color4iv, Color4iv@4) + GL_STUB(Color4s, _gloffset_Color4s, Color4s@16) + GL_STUB(Color4sv, _gloffset_Color4sv, Color4sv@4) + GL_STUB(Color4ub, _gloffset_Color4ub, Color4ub@16) + GL_STUB(Color4ubv, _gloffset_Color4ubv, Color4ubv@4) + GL_STUB(Color4ui, _gloffset_Color4ui, Color4ui@16) + GL_STUB(Color4uiv, _gloffset_Color4uiv, Color4uiv@4) + GL_STUB(Color4us, _gloffset_Color4us, Color4us@16) + GL_STUB(Color4usv, _gloffset_Color4usv, Color4usv@4) + GL_STUB(EdgeFlag, _gloffset_EdgeFlag, EdgeFlag@4) + GL_STUB(EdgeFlagv, _gloffset_EdgeFlagv, EdgeFlagv@4) + GL_STUB(End, _gloffset_End, End@0) + GL_STUB(Indexd, _gloffset_Indexd, Indexd@8) + GL_STUB(Indexdv, _gloffset_Indexdv, Indexdv@4) + GL_STUB(Indexf, _gloffset_Indexf, Indexf@4) + GL_STUB(Indexfv, _gloffset_Indexfv, Indexfv@4) + GL_STUB(Indexi, _gloffset_Indexi, Indexi@4) + GL_STUB(Indexiv, _gloffset_Indexiv, Indexiv@4) + GL_STUB(Indexs, _gloffset_Indexs, Indexs@4) + GL_STUB(Indexsv, _gloffset_Indexsv, Indexsv@4) + GL_STUB(Normal3b, _gloffset_Normal3b, Normal3b@12) + GL_STUB(Normal3bv, _gloffset_Normal3bv, Normal3bv@4) + GL_STUB(Normal3d, _gloffset_Normal3d, Normal3d@24) + GL_STUB(Normal3dv, _gloffset_Normal3dv, Normal3dv@4) + GL_STUB(Normal3f, _gloffset_Normal3f, Normal3f@12) + GL_STUB(Normal3fv, _gloffset_Normal3fv, Normal3fv@4) + GL_STUB(Normal3i, _gloffset_Normal3i, Normal3i@12) + GL_STUB(Normal3iv, _gloffset_Normal3iv, Normal3iv@4) + GL_STUB(Normal3s, _gloffset_Normal3s, Normal3s@12) + GL_STUB(Normal3sv, _gloffset_Normal3sv, Normal3sv@4) + GL_STUB(RasterPos2d, _gloffset_RasterPos2d, RasterPos2d@16) + GL_STUB(RasterPos2dv, _gloffset_RasterPos2dv, RasterPos2dv@4) + GL_STUB(RasterPos2f, _gloffset_RasterPos2f, RasterPos2f@8) + GL_STUB(RasterPos2fv, _gloffset_RasterPos2fv, RasterPos2fv@4) + GL_STUB(RasterPos2i, _gloffset_RasterPos2i, RasterPos2i@8) + GL_STUB(RasterPos2iv, _gloffset_RasterPos2iv, RasterPos2iv@4) + GL_STUB(RasterPos2s, _gloffset_RasterPos2s, RasterPos2s@8) + GL_STUB(RasterPos2sv, _gloffset_RasterPos2sv, RasterPos2sv@4) + GL_STUB(RasterPos3d, _gloffset_RasterPos3d, RasterPos3d@24) + GL_STUB(RasterPos3dv, _gloffset_RasterPos3dv, RasterPos3dv@4) + GL_STUB(RasterPos3f, _gloffset_RasterPos3f, RasterPos3f@12) + GL_STUB(RasterPos3fv, _gloffset_RasterPos3fv, RasterPos3fv@4) + GL_STUB(RasterPos3i, _gloffset_RasterPos3i, RasterPos3i@12) + GL_STUB(RasterPos3iv, _gloffset_RasterPos3iv, RasterPos3iv@4) + GL_STUB(RasterPos3s, _gloffset_RasterPos3s, RasterPos3s@12) + GL_STUB(RasterPos3sv, _gloffset_RasterPos3sv, RasterPos3sv@4) + GL_STUB(RasterPos4d, _gloffset_RasterPos4d, RasterPos4d@32) + GL_STUB(RasterPos4dv, _gloffset_RasterPos4dv, RasterPos4dv@4) + GL_STUB(RasterPos4f, _gloffset_RasterPos4f, RasterPos4f@16) + GL_STUB(RasterPos4fv, _gloffset_RasterPos4fv, RasterPos4fv@4) + GL_STUB(RasterPos4i, _gloffset_RasterPos4i, RasterPos4i@16) + GL_STUB(RasterPos4iv, _gloffset_RasterPos4iv, RasterPos4iv@4) + GL_STUB(RasterPos4s, _gloffset_RasterPos4s, RasterPos4s@16) + GL_STUB(RasterPos4sv, _gloffset_RasterPos4sv, RasterPos4sv@4) + GL_STUB(Rectd, _gloffset_Rectd, Rectd@32) + GL_STUB(Rectdv, _gloffset_Rectdv, Rectdv@8) + GL_STUB(Rectf, _gloffset_Rectf, Rectf@16) + GL_STUB(Rectfv, _gloffset_Rectfv, Rectfv@8) + GL_STUB(Recti, _gloffset_Recti, Recti@16) + GL_STUB(Rectiv, _gloffset_Rectiv, Rectiv@8) + GL_STUB(Rects, _gloffset_Rects, Rects@16) + GL_STUB(Rectsv, _gloffset_Rectsv, Rectsv@8) + GL_STUB(TexCoord1d, _gloffset_TexCoord1d, TexCoord1d@8) + GL_STUB(TexCoord1dv, _gloffset_TexCoord1dv, TexCoord1dv@4) + GL_STUB(TexCoord1f, _gloffset_TexCoord1f, TexCoord1f@4) + GL_STUB(TexCoord1fv, _gloffset_TexCoord1fv, TexCoord1fv@4) + GL_STUB(TexCoord1i, _gloffset_TexCoord1i, TexCoord1i@4) + GL_STUB(TexCoord1iv, _gloffset_TexCoord1iv, TexCoord1iv@4) + GL_STUB(TexCoord1s, _gloffset_TexCoord1s, TexCoord1s@4) + GL_STUB(TexCoord1sv, _gloffset_TexCoord1sv, TexCoord1sv@4) + GL_STUB(TexCoord2d, _gloffset_TexCoord2d, TexCoord2d@16) + GL_STUB(TexCoord2dv, _gloffset_TexCoord2dv, TexCoord2dv@4) + GL_STUB(TexCoord2f, _gloffset_TexCoord2f, TexCoord2f@8) + GL_STUB(TexCoord2fv, _gloffset_TexCoord2fv, TexCoord2fv@4) + GL_STUB(TexCoord2i, _gloffset_TexCoord2i, TexCoord2i@8) + GL_STUB(TexCoord2iv, _gloffset_TexCoord2iv, TexCoord2iv@4) + GL_STUB(TexCoord2s, _gloffset_TexCoord2s, TexCoord2s@8) + GL_STUB(TexCoord2sv, _gloffset_TexCoord2sv, TexCoord2sv@4) + GL_STUB(TexCoord3d, _gloffset_TexCoord3d, TexCoord3d@24) + GL_STUB(TexCoord3dv, _gloffset_TexCoord3dv, TexCoord3dv@4) + GL_STUB(TexCoord3f, _gloffset_TexCoord3f, TexCoord3f@12) + GL_STUB(TexCoord3fv, _gloffset_TexCoord3fv, TexCoord3fv@4) + GL_STUB(TexCoord3i, _gloffset_TexCoord3i, TexCoord3i@12) + GL_STUB(TexCoord3iv, _gloffset_TexCoord3iv, TexCoord3iv@4) + GL_STUB(TexCoord3s, _gloffset_TexCoord3s, TexCoord3s@12) + GL_STUB(TexCoord3sv, _gloffset_TexCoord3sv, TexCoord3sv@4) + GL_STUB(TexCoord4d, _gloffset_TexCoord4d, TexCoord4d@32) + GL_STUB(TexCoord4dv, _gloffset_TexCoord4dv, TexCoord4dv@4) + GL_STUB(TexCoord4f, _gloffset_TexCoord4f, TexCoord4f@16) + GL_STUB(TexCoord4fv, _gloffset_TexCoord4fv, TexCoord4fv@4) + GL_STUB(TexCoord4i, _gloffset_TexCoord4i, TexCoord4i@16) + GL_STUB(TexCoord4iv, _gloffset_TexCoord4iv, TexCoord4iv@4) + GL_STUB(TexCoord4s, _gloffset_TexCoord4s, TexCoord4s@16) + GL_STUB(TexCoord4sv, _gloffset_TexCoord4sv, TexCoord4sv@4) + GL_STUB(Vertex2d, _gloffset_Vertex2d, Vertex2d@16) + GL_STUB(Vertex2dv, _gloffset_Vertex2dv, Vertex2dv@4) + GL_STUB(Vertex2f, _gloffset_Vertex2f, Vertex2f@8) + GL_STUB(Vertex2fv, _gloffset_Vertex2fv, Vertex2fv@4) + GL_STUB(Vertex2i, _gloffset_Vertex2i, Vertex2i@8) + GL_STUB(Vertex2iv, _gloffset_Vertex2iv, Vertex2iv@4) + GL_STUB(Vertex2s, _gloffset_Vertex2s, Vertex2s@8) + GL_STUB(Vertex2sv, _gloffset_Vertex2sv, Vertex2sv@4) + GL_STUB(Vertex3d, _gloffset_Vertex3d, Vertex3d@24) + GL_STUB(Vertex3dv, _gloffset_Vertex3dv, Vertex3dv@4) + GL_STUB(Vertex3f, _gloffset_Vertex3f, Vertex3f@12) + GL_STUB(Vertex3fv, _gloffset_Vertex3fv, Vertex3fv@4) + GL_STUB(Vertex3i, _gloffset_Vertex3i, Vertex3i@12) + GL_STUB(Vertex3iv, _gloffset_Vertex3iv, Vertex3iv@4) + GL_STUB(Vertex3s, _gloffset_Vertex3s, Vertex3s@12) + GL_STUB(Vertex3sv, _gloffset_Vertex3sv, Vertex3sv@4) + GL_STUB(Vertex4d, _gloffset_Vertex4d, Vertex4d@32) + GL_STUB(Vertex4dv, _gloffset_Vertex4dv, Vertex4dv@4) + GL_STUB(Vertex4f, _gloffset_Vertex4f, Vertex4f@16) + GL_STUB(Vertex4fv, _gloffset_Vertex4fv, Vertex4fv@4) + GL_STUB(Vertex4i, _gloffset_Vertex4i, Vertex4i@16) + GL_STUB(Vertex4iv, _gloffset_Vertex4iv, Vertex4iv@4) + GL_STUB(Vertex4s, _gloffset_Vertex4s, Vertex4s@16) + GL_STUB(Vertex4sv, _gloffset_Vertex4sv, Vertex4sv@4) + GL_STUB(ClipPlane, _gloffset_ClipPlane, ClipPlane@8) + GL_STUB(ColorMaterial, _gloffset_ColorMaterial, ColorMaterial@8) + GL_STUB(CullFace, _gloffset_CullFace, CullFace@4) + GL_STUB(Fogf, _gloffset_Fogf, Fogf@8) + GL_STUB(Fogfv, _gloffset_Fogfv, Fogfv@8) + GL_STUB(Fogi, _gloffset_Fogi, Fogi@8) + GL_STUB(Fogiv, _gloffset_Fogiv, Fogiv@8) + GL_STUB(FrontFace, _gloffset_FrontFace, FrontFace@4) + GL_STUB(Hint, _gloffset_Hint, Hint@8) + GL_STUB(Lightf, _gloffset_Lightf, Lightf@12) + GL_STUB(Lightfv, _gloffset_Lightfv, Lightfv@12) + GL_STUB(Lighti, _gloffset_Lighti, Lighti@12) + GL_STUB(Lightiv, _gloffset_Lightiv, Lightiv@12) + GL_STUB(LightModelf, _gloffset_LightModelf, LightModelf@8) + GL_STUB(LightModelfv, _gloffset_LightModelfv, LightModelfv@8) + GL_STUB(LightModeli, _gloffset_LightModeli, LightModeli@8) + GL_STUB(LightModeliv, _gloffset_LightModeliv, LightModeliv@8) + GL_STUB(LineStipple, _gloffset_LineStipple, LineStipple@8) + GL_STUB(LineWidth, _gloffset_LineWidth, LineWidth@4) + GL_STUB(Materialf, _gloffset_Materialf, Materialf@12) + GL_STUB(Materialfv, _gloffset_Materialfv, Materialfv@12) + GL_STUB(Materiali, _gloffset_Materiali, Materiali@12) + GL_STUB(Materialiv, _gloffset_Materialiv, Materialiv@12) + GL_STUB(PointSize, _gloffset_PointSize, PointSize@4) + GL_STUB(PolygonMode, _gloffset_PolygonMode, PolygonMode@8) + GL_STUB(PolygonStipple, _gloffset_PolygonStipple, PolygonStipple@4) + GL_STUB(Scissor, _gloffset_Scissor, Scissor@16) + GL_STUB(ShadeModel, _gloffset_ShadeModel, ShadeModel@4) + GL_STUB(TexParameterf, _gloffset_TexParameterf, TexParameterf@12) + GL_STUB(TexParameterfv, _gloffset_TexParameterfv, TexParameterfv@12) + GL_STUB(TexParameteri, _gloffset_TexParameteri, TexParameteri@12) + GL_STUB(TexParameteriv, _gloffset_TexParameteriv, TexParameteriv@12) + GL_STUB(TexImage1D, _gloffset_TexImage1D, TexImage1D@32) + GL_STUB(TexImage2D, _gloffset_TexImage2D, TexImage2D@36) + GL_STUB(TexEnvf, _gloffset_TexEnvf, TexEnvf@12) + GL_STUB(TexEnvfv, _gloffset_TexEnvfv, TexEnvfv@12) + GL_STUB(TexEnvi, _gloffset_TexEnvi, TexEnvi@12) + GL_STUB(TexEnviv, _gloffset_TexEnviv, TexEnviv@12) + GL_STUB(TexGend, _gloffset_TexGend, TexGend@16) + GL_STUB(TexGendv, _gloffset_TexGendv, TexGendv@12) + GL_STUB(TexGenf, _gloffset_TexGenf, TexGenf@12) + GL_STUB(TexGenfv, _gloffset_TexGenfv, TexGenfv@12) + GL_STUB(TexGeni, _gloffset_TexGeni, TexGeni@12) + GL_STUB(TexGeniv, _gloffset_TexGeniv, TexGeniv@12) + GL_STUB(FeedbackBuffer, _gloffset_FeedbackBuffer, FeedbackBuffer@12) + GL_STUB(SelectBuffer, _gloffset_SelectBuffer, SelectBuffer@8) + GL_STUB(RenderMode, _gloffset_RenderMode, RenderMode@4) + GL_STUB(InitNames, _gloffset_InitNames, InitNames@0) + GL_STUB(LoadName, _gloffset_LoadName, LoadName@4) + GL_STUB(PassThrough, _gloffset_PassThrough, PassThrough@4) + GL_STUB(PopName, _gloffset_PopName, PopName@0) + GL_STUB(PushName, _gloffset_PushName, PushName@4) + GL_STUB(DrawBuffer, _gloffset_DrawBuffer, DrawBuffer@4) + GL_STUB(Clear, _gloffset_Clear, Clear@4) + GL_STUB(ClearAccum, _gloffset_ClearAccum, ClearAccum@16) + GL_STUB(ClearIndex, _gloffset_ClearIndex, ClearIndex@4) + GL_STUB(ClearColor, _gloffset_ClearColor, ClearColor@16) + GL_STUB(ClearStencil, _gloffset_ClearStencil, ClearStencil@4) + GL_STUB(ClearDepth, _gloffset_ClearDepth, ClearDepth@8) + GL_STUB(StencilMask, _gloffset_StencilMask, StencilMask@4) + GL_STUB(ColorMask, _gloffset_ColorMask, ColorMask@16) + GL_STUB(DepthMask, _gloffset_DepthMask, DepthMask@4) + GL_STUB(IndexMask, _gloffset_IndexMask, IndexMask@4) + GL_STUB(Accum, _gloffset_Accum, Accum@8) + GL_STUB(Disable, _gloffset_Disable, Disable@4) + GL_STUB(Enable, _gloffset_Enable, Enable@4) + GL_STUB(Finish, _gloffset_Finish, Finish@0) + GL_STUB(Flush, _gloffset_Flush, Flush@0) + GL_STUB(PopAttrib, _gloffset_PopAttrib, PopAttrib@0) + GL_STUB(PushAttrib, _gloffset_PushAttrib, PushAttrib@4) + GL_STUB(Map1d, _gloffset_Map1d, Map1d@32) + GL_STUB(Map1f, _gloffset_Map1f, Map1f@24) + GL_STUB(Map2d, _gloffset_Map2d, Map2d@56) + GL_STUB(Map2f, _gloffset_Map2f, Map2f@40) + GL_STUB(MapGrid1d, _gloffset_MapGrid1d, MapGrid1d@20) + GL_STUB(MapGrid1f, _gloffset_MapGrid1f, MapGrid1f@12) + GL_STUB(MapGrid2d, _gloffset_MapGrid2d, MapGrid2d@40) + GL_STUB(MapGrid2f, _gloffset_MapGrid2f, MapGrid2f@24) + GL_STUB(EvalCoord1d, _gloffset_EvalCoord1d, EvalCoord1d@8) + GL_STUB(EvalCoord1dv, _gloffset_EvalCoord1dv, EvalCoord1dv@4) + GL_STUB(EvalCoord1f, _gloffset_EvalCoord1f, EvalCoord1f@4) + GL_STUB(EvalCoord1fv, _gloffset_EvalCoord1fv, EvalCoord1fv@4) + GL_STUB(EvalCoord2d, _gloffset_EvalCoord2d, EvalCoord2d@16) + GL_STUB(EvalCoord2dv, _gloffset_EvalCoord2dv, EvalCoord2dv@4) + GL_STUB(EvalCoord2f, _gloffset_EvalCoord2f, EvalCoord2f@8) + GL_STUB(EvalCoord2fv, _gloffset_EvalCoord2fv, EvalCoord2fv@4) + GL_STUB(EvalMesh1, _gloffset_EvalMesh1, EvalMesh1@12) + GL_STUB(EvalPoint1, _gloffset_EvalPoint1, EvalPoint1@4) + GL_STUB(EvalMesh2, _gloffset_EvalMesh2, EvalMesh2@20) + GL_STUB(EvalPoint2, _gloffset_EvalPoint2, EvalPoint2@8) + GL_STUB(AlphaFunc, _gloffset_AlphaFunc, AlphaFunc@8) + GL_STUB(BlendFunc, _gloffset_BlendFunc, BlendFunc@8) + GL_STUB(LogicOp, _gloffset_LogicOp, LogicOp@4) + GL_STUB(StencilFunc, _gloffset_StencilFunc, StencilFunc@12) + GL_STUB(StencilOp, _gloffset_StencilOp, StencilOp@12) + GL_STUB(DepthFunc, _gloffset_DepthFunc, DepthFunc@4) + GL_STUB(PixelZoom, _gloffset_PixelZoom, PixelZoom@8) + GL_STUB(PixelTransferf, _gloffset_PixelTransferf, PixelTransferf@8) + GL_STUB(PixelTransferi, _gloffset_PixelTransferi, PixelTransferi@8) + GL_STUB(PixelStoref, _gloffset_PixelStoref, PixelStoref@8) + GL_STUB(PixelStorei, _gloffset_PixelStorei, PixelStorei@8) + GL_STUB(PixelMapfv, _gloffset_PixelMapfv, PixelMapfv@12) + GL_STUB(PixelMapuiv, _gloffset_PixelMapuiv, PixelMapuiv@12) + GL_STUB(PixelMapusv, _gloffset_PixelMapusv, PixelMapusv@12) + GL_STUB(ReadBuffer, _gloffset_ReadBuffer, ReadBuffer@4) + GL_STUB(CopyPixels, _gloffset_CopyPixels, CopyPixels@20) + GL_STUB(ReadPixels, _gloffset_ReadPixels, ReadPixels@28) + GL_STUB(DrawPixels, _gloffset_DrawPixels, DrawPixels@20) + GL_STUB(GetBooleanv, _gloffset_GetBooleanv, GetBooleanv@8) + GL_STUB(GetClipPlane, _gloffset_GetClipPlane, GetClipPlane@8) + GL_STUB(GetDoublev, _gloffset_GetDoublev, GetDoublev@8) + GL_STUB(GetError, _gloffset_GetError, GetError@0) + GL_STUB(GetFloatv, _gloffset_GetFloatv, GetFloatv@8) + GL_STUB(GetIntegerv, _gloffset_GetIntegerv, GetIntegerv@8) + GL_STUB(GetLightfv, _gloffset_GetLightfv, GetLightfv@12) + GL_STUB(GetLightiv, _gloffset_GetLightiv, GetLightiv@12) + GL_STUB(GetMapdv, _gloffset_GetMapdv, GetMapdv@12) + GL_STUB(GetMapfv, _gloffset_GetMapfv, GetMapfv@12) + GL_STUB(GetMapiv, _gloffset_GetMapiv, GetMapiv@12) + GL_STUB(GetMaterialfv, _gloffset_GetMaterialfv, GetMaterialfv@12) + GL_STUB(GetMaterialiv, _gloffset_GetMaterialiv, GetMaterialiv@12) + GL_STUB(GetPixelMapfv, _gloffset_GetPixelMapfv, GetPixelMapfv@8) + GL_STUB(GetPixelMapuiv, _gloffset_GetPixelMapuiv, GetPixelMapuiv@8) + GL_STUB(GetPixelMapusv, _gloffset_GetPixelMapusv, GetPixelMapusv@8) + GL_STUB(GetPolygonStipple, _gloffset_GetPolygonStipple, GetPolygonStipple@4) + GL_STUB(GetString, _gloffset_GetString, GetString@4) + GL_STUB(GetTexEnvfv, _gloffset_GetTexEnvfv, GetTexEnvfv@12) + GL_STUB(GetTexEnviv, _gloffset_GetTexEnviv, GetTexEnviv@12) + GL_STUB(GetTexGendv, _gloffset_GetTexGendv, GetTexGendv@12) + GL_STUB(GetTexGenfv, _gloffset_GetTexGenfv, GetTexGenfv@12) + GL_STUB(GetTexGeniv, _gloffset_GetTexGeniv, GetTexGeniv@12) + GL_STUB(GetTexImage, _gloffset_GetTexImage, GetTexImage@20) + GL_STUB(GetTexParameterfv, _gloffset_GetTexParameterfv, GetTexParameterfv@12) + GL_STUB(GetTexParameteriv, _gloffset_GetTexParameteriv, GetTexParameteriv@12) + GL_STUB(GetTexLevelParameterfv, _gloffset_GetTexLevelParameterfv, GetTexLevelParameterfv@16) + GL_STUB(GetTexLevelParameteriv, _gloffset_GetTexLevelParameteriv, GetTexLevelParameteriv@16) + GL_STUB(IsEnabled, _gloffset_IsEnabled, IsEnabled@4) + GL_STUB(IsList, _gloffset_IsList, IsList@4) + GL_STUB(DepthRange, _gloffset_DepthRange, DepthRange@16) + GL_STUB(Frustum, _gloffset_Frustum, Frustum@48) + GL_STUB(LoadIdentity, _gloffset_LoadIdentity, LoadIdentity@0) + GL_STUB(LoadMatrixf, _gloffset_LoadMatrixf, LoadMatrixf@4) + GL_STUB(LoadMatrixd, _gloffset_LoadMatrixd, LoadMatrixd@4) + GL_STUB(MatrixMode, _gloffset_MatrixMode, MatrixMode@4) + GL_STUB(MultMatrixf, _gloffset_MultMatrixf, MultMatrixf@4) + GL_STUB(MultMatrixd, _gloffset_MultMatrixd, MultMatrixd@4) + GL_STUB(Ortho, _gloffset_Ortho, Ortho@48) + GL_STUB(PopMatrix, _gloffset_PopMatrix, PopMatrix@0) + GL_STUB(PushMatrix, _gloffset_PushMatrix, PushMatrix@0) + GL_STUB(Rotated, _gloffset_Rotated, Rotated@32) + GL_STUB(Rotatef, _gloffset_Rotatef, Rotatef@16) + GL_STUB(Scaled, _gloffset_Scaled, Scaled@24) + GL_STUB(Scalef, _gloffset_Scalef, Scalef@12) + GL_STUB(Translated, _gloffset_Translated, Translated@24) + GL_STUB(Translatef, _gloffset_Translatef, Translatef@12) + GL_STUB(Viewport, _gloffset_Viewport, Viewport@16) + GL_STUB(ArrayElement, _gloffset_ArrayElement, ArrayElement@4) + GL_STUB(BindTexture, _gloffset_BindTexture, BindTexture@8) + GL_STUB(ColorPointer, _gloffset_ColorPointer, ColorPointer@16) + GL_STUB(DisableClientState, _gloffset_DisableClientState, DisableClientState@4) + GL_STUB(DrawArrays, _gloffset_DrawArrays, DrawArrays@12) + GL_STUB(DrawElements, _gloffset_DrawElements, DrawElements@16) + GL_STUB(EdgeFlagPointer, _gloffset_EdgeFlagPointer, EdgeFlagPointer@8) + GL_STUB(EnableClientState, _gloffset_EnableClientState, EnableClientState@4) + GL_STUB(IndexPointer, _gloffset_IndexPointer, IndexPointer@12) + GL_STUB(Indexub, _gloffset_Indexub, Indexub@4) + GL_STUB(Indexubv, _gloffset_Indexubv, Indexubv@4) + GL_STUB(InterleavedArrays, _gloffset_InterleavedArrays, InterleavedArrays@12) + GL_STUB(NormalPointer, _gloffset_NormalPointer, NormalPointer@12) + GL_STUB(PolygonOffset, _gloffset_PolygonOffset, PolygonOffset@8) + GL_STUB(TexCoordPointer, _gloffset_TexCoordPointer, TexCoordPointer@16) + GL_STUB(VertexPointer, _gloffset_VertexPointer, VertexPointer@16) + GL_STUB(AreTexturesResident, _gloffset_AreTexturesResident, AreTexturesResident@12) + GL_STUB(CopyTexImage1D, _gloffset_CopyTexImage1D, CopyTexImage1D@28) + GL_STUB(CopyTexImage2D, _gloffset_CopyTexImage2D, CopyTexImage2D@32) + GL_STUB(CopyTexSubImage1D, _gloffset_CopyTexSubImage1D, CopyTexSubImage1D@24) + GL_STUB(CopyTexSubImage2D, _gloffset_CopyTexSubImage2D, CopyTexSubImage2D@32) + GL_STUB(DeleteTextures, _gloffset_DeleteTextures, DeleteTextures@8) + GL_STUB(GenTextures, _gloffset_GenTextures, GenTextures@8) + GL_STUB(GetPointerv, _gloffset_GetPointerv, GetPointerv@8) + GL_STUB(IsTexture, _gloffset_IsTexture, IsTexture@4) + GL_STUB(PrioritizeTextures, _gloffset_PrioritizeTextures, PrioritizeTextures@12) + GL_STUB(TexSubImage1D, _gloffset_TexSubImage1D, TexSubImage1D@28) + GL_STUB(TexSubImage2D, _gloffset_TexSubImage2D, TexSubImage2D@36) + GL_STUB(PopClientAttrib, _gloffset_PopClientAttrib, PopClientAttrib@0) + GL_STUB(PushClientAttrib, _gloffset_PushClientAttrib, PushClientAttrib@4) + GL_STUB(BlendColor, _gloffset_BlendColor, BlendColor@16) + GL_STUB(BlendEquation, _gloffset_BlendEquation, BlendEquation@4) + GL_STUB(DrawRangeElements, _gloffset_DrawRangeElements, DrawRangeElements@24) + GL_STUB(ColorTable, _gloffset_ColorTable, ColorTable@24) + GL_STUB(ColorTableParameterfv, _gloffset_ColorTableParameterfv, ColorTableParameterfv@12) + GL_STUB(ColorTableParameteriv, _gloffset_ColorTableParameteriv, ColorTableParameteriv@12) + GL_STUB(CopyColorTable, _gloffset_CopyColorTable, CopyColorTable@20) + GL_STUB(GetColorTable, _gloffset_GetColorTable, GetColorTable@16) + GL_STUB(GetColorTableParameterfv, _gloffset_GetColorTableParameterfv, GetColorTableParameterfv@12) + GL_STUB(GetColorTableParameteriv, _gloffset_GetColorTableParameteriv, GetColorTableParameteriv@12) + GL_STUB(ColorSubTable, _gloffset_ColorSubTable, ColorSubTable@24) + GL_STUB(CopyColorSubTable, _gloffset_CopyColorSubTable, CopyColorSubTable@20) + GL_STUB(ConvolutionFilter1D, _gloffset_ConvolutionFilter1D, ConvolutionFilter1D@24) + GL_STUB(ConvolutionFilter2D, _gloffset_ConvolutionFilter2D, ConvolutionFilter2D@28) + GL_STUB(ConvolutionParameterf, _gloffset_ConvolutionParameterf, ConvolutionParameterf@12) + GL_STUB(ConvolutionParameterfv, _gloffset_ConvolutionParameterfv, ConvolutionParameterfv@12) + GL_STUB(ConvolutionParameteri, _gloffset_ConvolutionParameteri, ConvolutionParameteri@12) + GL_STUB(ConvolutionParameteriv, _gloffset_ConvolutionParameteriv, ConvolutionParameteriv@12) + GL_STUB(CopyConvolutionFilter1D, _gloffset_CopyConvolutionFilter1D, CopyConvolutionFilter1D@20) + GL_STUB(CopyConvolutionFilter2D, _gloffset_CopyConvolutionFilter2D, CopyConvolutionFilter2D@24) + GL_STUB(GetConvolutionFilter, _gloffset_GetConvolutionFilter, GetConvolutionFilter@16) + GL_STUB(GetConvolutionParameterfv, _gloffset_GetConvolutionParameterfv, GetConvolutionParameterfv@12) + GL_STUB(GetConvolutionParameteriv, _gloffset_GetConvolutionParameteriv, GetConvolutionParameteriv@12) + GL_STUB(GetSeparableFilter, _gloffset_GetSeparableFilter, GetSeparableFilter@24) + GL_STUB(SeparableFilter2D, _gloffset_SeparableFilter2D, SeparableFilter2D@32) + GL_STUB(GetHistogram, _gloffset_GetHistogram, GetHistogram@20) + GL_STUB(GetHistogramParameterfv, _gloffset_GetHistogramParameterfv, GetHistogramParameterfv@12) + GL_STUB(GetHistogramParameteriv, _gloffset_GetHistogramParameteriv, GetHistogramParameteriv@12) + GL_STUB(GetMinmax, _gloffset_GetMinmax, GetMinmax@20) + GL_STUB(GetMinmaxParameterfv, _gloffset_GetMinmaxParameterfv, GetMinmaxParameterfv@12) + GL_STUB(GetMinmaxParameteriv, _gloffset_GetMinmaxParameteriv, GetMinmaxParameteriv@12) + GL_STUB(Histogram, _gloffset_Histogram, Histogram@16) + GL_STUB(Minmax, _gloffset_Minmax, Minmax@12) + GL_STUB(ResetHistogram, _gloffset_ResetHistogram, ResetHistogram@4) + GL_STUB(ResetMinmax, _gloffset_ResetMinmax, ResetMinmax@4) + GL_STUB(TexImage3D, _gloffset_TexImage3D, TexImage3D@40) + GL_STUB(TexSubImage3D, _gloffset_TexSubImage3D, TexSubImage3D@44) + GL_STUB(CopyTexSubImage3D, _gloffset_CopyTexSubImage3D, CopyTexSubImage3D@36) + GL_STUB(ActiveTextureARB, _gloffset_ActiveTextureARB, ActiveTextureARB@4) + GL_STUB(ClientActiveTextureARB, _gloffset_ClientActiveTextureARB, ClientActiveTextureARB@4) + GL_STUB(MultiTexCoord1dARB, _gloffset_MultiTexCoord1dARB, MultiTexCoord1dARB@12) + GL_STUB(MultiTexCoord1dvARB, _gloffset_MultiTexCoord1dvARB, MultiTexCoord1dvARB@8) + GL_STUB(MultiTexCoord1fARB, _gloffset_MultiTexCoord1fARB, MultiTexCoord1fARB@8) + GL_STUB(MultiTexCoord1fvARB, _gloffset_MultiTexCoord1fvARB, MultiTexCoord1fvARB@8) + GL_STUB(MultiTexCoord1iARB, _gloffset_MultiTexCoord1iARB, MultiTexCoord1iARB@8) + GL_STUB(MultiTexCoord1ivARB, _gloffset_MultiTexCoord1ivARB, MultiTexCoord1ivARB@8) + GL_STUB(MultiTexCoord1sARB, _gloffset_MultiTexCoord1sARB, MultiTexCoord1sARB@8) + GL_STUB(MultiTexCoord1svARB, _gloffset_MultiTexCoord1svARB, MultiTexCoord1svARB@8) + GL_STUB(MultiTexCoord2dARB, _gloffset_MultiTexCoord2dARB, MultiTexCoord2dARB@20) + GL_STUB(MultiTexCoord2dvARB, _gloffset_MultiTexCoord2dvARB, MultiTexCoord2dvARB@8) + GL_STUB(MultiTexCoord2fARB, _gloffset_MultiTexCoord2fARB, MultiTexCoord2fARB@12) + GL_STUB(MultiTexCoord2fvARB, _gloffset_MultiTexCoord2fvARB, MultiTexCoord2fvARB@8) + GL_STUB(MultiTexCoord2iARB, _gloffset_MultiTexCoord2iARB, MultiTexCoord2iARB@12) + GL_STUB(MultiTexCoord2ivARB, _gloffset_MultiTexCoord2ivARB, MultiTexCoord2ivARB@8) + GL_STUB(MultiTexCoord2sARB, _gloffset_MultiTexCoord2sARB, MultiTexCoord2sARB@12) + GL_STUB(MultiTexCoord2svARB, _gloffset_MultiTexCoord2svARB, MultiTexCoord2svARB@8) + GL_STUB(MultiTexCoord3dARB, _gloffset_MultiTexCoord3dARB, MultiTexCoord3dARB@28) + GL_STUB(MultiTexCoord3dvARB, _gloffset_MultiTexCoord3dvARB, MultiTexCoord3dvARB@8) + GL_STUB(MultiTexCoord3fARB, _gloffset_MultiTexCoord3fARB, MultiTexCoord3fARB@16) + GL_STUB(MultiTexCoord3fvARB, _gloffset_MultiTexCoord3fvARB, MultiTexCoord3fvARB@8) + GL_STUB(MultiTexCoord3iARB, _gloffset_MultiTexCoord3iARB, MultiTexCoord3iARB@16) + GL_STUB(MultiTexCoord3ivARB, _gloffset_MultiTexCoord3ivARB, MultiTexCoord3ivARB@8) + GL_STUB(MultiTexCoord3sARB, _gloffset_MultiTexCoord3sARB, MultiTexCoord3sARB@16) + GL_STUB(MultiTexCoord3svARB, _gloffset_MultiTexCoord3svARB, MultiTexCoord3svARB@8) + GL_STUB(MultiTexCoord4dARB, _gloffset_MultiTexCoord4dARB, MultiTexCoord4dARB@36) + GL_STUB(MultiTexCoord4dvARB, _gloffset_MultiTexCoord4dvARB, MultiTexCoord4dvARB@8) + GL_STUB(MultiTexCoord4fARB, _gloffset_MultiTexCoord4fARB, MultiTexCoord4fARB@20) + GL_STUB(MultiTexCoord4fvARB, _gloffset_MultiTexCoord4fvARB, MultiTexCoord4fvARB@8) + GL_STUB(MultiTexCoord4iARB, _gloffset_MultiTexCoord4iARB, MultiTexCoord4iARB@20) + GL_STUB(MultiTexCoord4ivARB, _gloffset_MultiTexCoord4ivARB, MultiTexCoord4ivARB@8) + GL_STUB(MultiTexCoord4sARB, _gloffset_MultiTexCoord4sARB, MultiTexCoord4sARB@20) + GL_STUB(MultiTexCoord4svARB, _gloffset_MultiTexCoord4svARB, MultiTexCoord4svARB@8) + GL_STUB(LoadTransposeMatrixfARB, _gloffset_LoadTransposeMatrixfARB, LoadTransposeMatrixfARB@4) + GL_STUB(LoadTransposeMatrixdARB, _gloffset_LoadTransposeMatrixdARB, LoadTransposeMatrixdARB@4) + GL_STUB(MultTransposeMatrixfARB, _gloffset_MultTransposeMatrixfARB, MultTransposeMatrixfARB@4) + GL_STUB(MultTransposeMatrixdARB, _gloffset_MultTransposeMatrixdARB, MultTransposeMatrixdARB@4) + GL_STUB(SampleCoverageARB, _gloffset_SampleCoverageARB, SampleCoverageARB@8) + GL_STUB(DrawBuffersARB, _gloffset_DrawBuffersARB, DrawBuffersARB@8) + GL_STUB(PolygonOffsetEXT, _gloffset_PolygonOffsetEXT, PolygonOffsetEXT@8) + GL_STUB(GetTexFilterFuncSGIS, _gloffset_GetTexFilterFuncSGIS, GetTexFilterFuncSGIS@12) + GL_STUB(TexFilterFuncSGIS, _gloffset_TexFilterFuncSGIS, TexFilterFuncSGIS@16) + GL_STUB(GetHistogramEXT, _gloffset_GetHistogramEXT, GetHistogramEXT@20) + GL_STUB(GetHistogramParameterfvEXT, _gloffset_GetHistogramParameterfvEXT, GetHistogramParameterfvEXT@12) + GL_STUB(GetHistogramParameterivEXT, _gloffset_GetHistogramParameterivEXT, GetHistogramParameterivEXT@12) + GL_STUB(GetMinmaxEXT, _gloffset_GetMinmaxEXT, GetMinmaxEXT@20) + GL_STUB(GetMinmaxParameterfvEXT, _gloffset_GetMinmaxParameterfvEXT, GetMinmaxParameterfvEXT@12) + GL_STUB(GetMinmaxParameterivEXT, _gloffset_GetMinmaxParameterivEXT, GetMinmaxParameterivEXT@12) + GL_STUB(GetConvolutionFilterEXT, _gloffset_GetConvolutionFilterEXT, GetConvolutionFilterEXT@16) + GL_STUB(GetConvolutionParameterfvEXT, _gloffset_GetConvolutionParameterfvEXT, GetConvolutionParameterfvEXT@12) + GL_STUB(GetConvolutionParameterivEXT, _gloffset_GetConvolutionParameterivEXT, GetConvolutionParameterivEXT@12) + GL_STUB(GetSeparableFilterEXT, _gloffset_GetSeparableFilterEXT, GetSeparableFilterEXT@24) + GL_STUB(GetColorTableSGI, _gloffset_GetColorTableSGI, GetColorTableSGI@16) + GL_STUB(GetColorTableParameterfvSGI, _gloffset_GetColorTableParameterfvSGI, GetColorTableParameterfvSGI@12) + GL_STUB(GetColorTableParameterivSGI, _gloffset_GetColorTableParameterivSGI, GetColorTableParameterivSGI@12) + GL_STUB(PixelTexGenSGIX, _gloffset_PixelTexGenSGIX, PixelTexGenSGIX@4) + GL_STUB(PixelTexGenParameteriSGIS, _gloffset_PixelTexGenParameteriSGIS, PixelTexGenParameteriSGIS@8) + GL_STUB(PixelTexGenParameterivSGIS, _gloffset_PixelTexGenParameterivSGIS, PixelTexGenParameterivSGIS@8) + GL_STUB(PixelTexGenParameterfSGIS, _gloffset_PixelTexGenParameterfSGIS, PixelTexGenParameterfSGIS@8) + GL_STUB(PixelTexGenParameterfvSGIS, _gloffset_PixelTexGenParameterfvSGIS, PixelTexGenParameterfvSGIS@8) + GL_STUB(GetPixelTexGenParameterivSGIS, _gloffset_GetPixelTexGenParameterivSGIS, GetPixelTexGenParameterivSGIS@8) + GL_STUB(GetPixelTexGenParameterfvSGIS, _gloffset_GetPixelTexGenParameterfvSGIS, GetPixelTexGenParameterfvSGIS@8) + GL_STUB(TexImage4DSGIS, _gloffset_TexImage4DSGIS, TexImage4DSGIS@44) + GL_STUB(TexSubImage4DSGIS, _gloffset_TexSubImage4DSGIS, TexSubImage4DSGIS@52) + GL_STUB(AreTexturesResidentEXT, _gloffset_AreTexturesResidentEXT, AreTexturesResidentEXT@12) + GL_STUB(GenTexturesEXT, _gloffset_GenTexturesEXT, GenTexturesEXT@8) + GL_STUB(IsTextureEXT, _gloffset_IsTextureEXT, IsTextureEXT@4) + GL_STUB(DetailTexFuncSGIS, _gloffset_DetailTexFuncSGIS, DetailTexFuncSGIS@12) + GL_STUB(GetDetailTexFuncSGIS, _gloffset_GetDetailTexFuncSGIS, GetDetailTexFuncSGIS@8) + GL_STUB(SharpenTexFuncSGIS, _gloffset_SharpenTexFuncSGIS, SharpenTexFuncSGIS@12) + GL_STUB(GetSharpenTexFuncSGIS, _gloffset_GetSharpenTexFuncSGIS, GetSharpenTexFuncSGIS@8) + GL_STUB(SampleMaskSGIS, _gloffset_SampleMaskSGIS, SampleMaskSGIS@8) + GL_STUB(SamplePatternSGIS, _gloffset_SamplePatternSGIS, SamplePatternSGIS@4) + GL_STUB(ColorPointerEXT, _gloffset_ColorPointerEXT, ColorPointerEXT@20) + GL_STUB(EdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT, EdgeFlagPointerEXT@12) + GL_STUB(IndexPointerEXT, _gloffset_IndexPointerEXT, IndexPointerEXT@16) + GL_STUB(NormalPointerEXT, _gloffset_NormalPointerEXT, NormalPointerEXT@16) + GL_STUB(TexCoordPointerEXT, _gloffset_TexCoordPointerEXT, TexCoordPointerEXT@20) + GL_STUB(VertexPointerEXT, _gloffset_VertexPointerEXT, VertexPointerEXT@20) + GL_STUB(SpriteParameterfSGIX, _gloffset_SpriteParameterfSGIX, SpriteParameterfSGIX@8) + GL_STUB(SpriteParameterfvSGIX, _gloffset_SpriteParameterfvSGIX, SpriteParameterfvSGIX@8) + GL_STUB(SpriteParameteriSGIX, _gloffset_SpriteParameteriSGIX, SpriteParameteriSGIX@8) + GL_STUB(SpriteParameterivSGIX, _gloffset_SpriteParameterivSGIX, SpriteParameterivSGIX@8) + GL_STUB(PointParameterfEXT, _gloffset_PointParameterfEXT, PointParameterfEXT@8) + GL_STUB(PointParameterfvEXT, _gloffset_PointParameterfvEXT, PointParameterfvEXT@8) + GL_STUB(GetInstrumentsSGIX, _gloffset_GetInstrumentsSGIX, GetInstrumentsSGIX@0) + GL_STUB(InstrumentsBufferSGIX, _gloffset_InstrumentsBufferSGIX, InstrumentsBufferSGIX@8) + GL_STUB(PollInstrumentsSGIX, _gloffset_PollInstrumentsSGIX, PollInstrumentsSGIX@4) + GL_STUB(ReadInstrumentsSGIX, _gloffset_ReadInstrumentsSGIX, ReadInstrumentsSGIX@4) + GL_STUB(StartInstrumentsSGIX, _gloffset_StartInstrumentsSGIX, StartInstrumentsSGIX@0) + GL_STUB(StopInstrumentsSGIX, _gloffset_StopInstrumentsSGIX, StopInstrumentsSGIX@4) + GL_STUB(FrameZoomSGIX, _gloffset_FrameZoomSGIX, FrameZoomSGIX@4) + GL_STUB(TagSampleBufferSGIX, _gloffset_TagSampleBufferSGIX, TagSampleBufferSGIX@0) + GL_STUB(ReferencePlaneSGIX, _gloffset_ReferencePlaneSGIX, ReferencePlaneSGIX@4) + GL_STUB(FlushRasterSGIX, _gloffset_FlushRasterSGIX, FlushRasterSGIX@0) + GL_STUB(GetListParameterfvSGIX, _gloffset_GetListParameterfvSGIX, GetListParameterfvSGIX@12) + GL_STUB(GetListParameterivSGIX, _gloffset_GetListParameterivSGIX, GetListParameterivSGIX@12) + GL_STUB(ListParameterfSGIX, _gloffset_ListParameterfSGIX, ListParameterfSGIX@12) + GL_STUB(ListParameterfvSGIX, _gloffset_ListParameterfvSGIX, ListParameterfvSGIX@12) + GL_STUB(ListParameteriSGIX, _gloffset_ListParameteriSGIX, ListParameteriSGIX@12) + GL_STUB(ListParameterivSGIX, _gloffset_ListParameterivSGIX, ListParameterivSGIX@12) + GL_STUB(FragmentColorMaterialSGIX, _gloffset_FragmentColorMaterialSGIX, FragmentColorMaterialSGIX@8) + GL_STUB(FragmentLightfSGIX, _gloffset_FragmentLightfSGIX, FragmentLightfSGIX@12) + GL_STUB(FragmentLightfvSGIX, _gloffset_FragmentLightfvSGIX, FragmentLightfvSGIX@12) + GL_STUB(FragmentLightiSGIX, _gloffset_FragmentLightiSGIX, FragmentLightiSGIX@12) + GL_STUB(FragmentLightivSGIX, _gloffset_FragmentLightivSGIX, FragmentLightivSGIX@12) + GL_STUB(FragmentLightModelfSGIX, _gloffset_FragmentLightModelfSGIX, FragmentLightModelfSGIX@8) + GL_STUB(FragmentLightModelfvSGIX, _gloffset_FragmentLightModelfvSGIX, FragmentLightModelfvSGIX@8) + GL_STUB(FragmentLightModeliSGIX, _gloffset_FragmentLightModeliSGIX, FragmentLightModeliSGIX@8) + GL_STUB(FragmentLightModelivSGIX, _gloffset_FragmentLightModelivSGIX, FragmentLightModelivSGIX@8) + GL_STUB(FragmentMaterialfSGIX, _gloffset_FragmentMaterialfSGIX, FragmentMaterialfSGIX@12) + GL_STUB(FragmentMaterialfvSGIX, _gloffset_FragmentMaterialfvSGIX, FragmentMaterialfvSGIX@12) + GL_STUB(FragmentMaterialiSGIX, _gloffset_FragmentMaterialiSGIX, FragmentMaterialiSGIX@12) + GL_STUB(FragmentMaterialivSGIX, _gloffset_FragmentMaterialivSGIX, FragmentMaterialivSGIX@12) + GL_STUB(GetFragmentLightfvSGIX, _gloffset_GetFragmentLightfvSGIX, GetFragmentLightfvSGIX@12) + GL_STUB(GetFragmentLightivSGIX, _gloffset_GetFragmentLightivSGIX, GetFragmentLightivSGIX@12) + GL_STUB(GetFragmentMaterialfvSGIX, _gloffset_GetFragmentMaterialfvSGIX, GetFragmentMaterialfvSGIX@12) + GL_STUB(GetFragmentMaterialivSGIX, _gloffset_GetFragmentMaterialivSGIX, GetFragmentMaterialivSGIX@12) + GL_STUB(LightEnviSGIX, _gloffset_LightEnviSGIX, LightEnviSGIX@8) + GL_STUB(VertexWeightfEXT, _gloffset_VertexWeightfEXT, VertexWeightfEXT@4) + GL_STUB(VertexWeightfvEXT, _gloffset_VertexWeightfvEXT, VertexWeightfvEXT@4) + GL_STUB(VertexWeightPointerEXT, _gloffset_VertexWeightPointerEXT, VertexWeightPointerEXT@16) + GL_STUB(FlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV, FlushVertexArrayRangeNV@0) + GL_STUB(VertexArrayRangeNV, _gloffset_VertexArrayRangeNV, VertexArrayRangeNV@8) + GL_STUB(CombinerParameterfvNV, _gloffset_CombinerParameterfvNV, CombinerParameterfvNV@8) + GL_STUB(CombinerParameterfNV, _gloffset_CombinerParameterfNV, CombinerParameterfNV@8) + GL_STUB(CombinerParameterivNV, _gloffset_CombinerParameterivNV, CombinerParameterivNV@8) + GL_STUB(CombinerParameteriNV, _gloffset_CombinerParameteriNV, CombinerParameteriNV@8) + GL_STUB(CombinerInputNV, _gloffset_CombinerInputNV, CombinerInputNV@24) + GL_STUB(CombinerOutputNV, _gloffset_CombinerOutputNV, CombinerOutputNV@40) + GL_STUB(FinalCombinerInputNV, _gloffset_FinalCombinerInputNV, FinalCombinerInputNV@16) + GL_STUB(GetCombinerInputParameterfvNV, _gloffset_GetCombinerInputParameterfvNV, GetCombinerInputParameterfvNV@20) + GL_STUB(GetCombinerInputParameterivNV, _gloffset_GetCombinerInputParameterivNV, GetCombinerInputParameterivNV@20) + GL_STUB(GetCombinerOutputParameterfvNV, _gloffset_GetCombinerOutputParameterfvNV, GetCombinerOutputParameterfvNV@16) + GL_STUB(GetCombinerOutputParameterivNV, _gloffset_GetCombinerOutputParameterivNV, GetCombinerOutputParameterivNV@16) + GL_STUB(GetFinalCombinerInputParameterfvNV, _gloffset_GetFinalCombinerInputParameterfvNV, GetFinalCombinerInputParameterfvNV@12) + GL_STUB(GetFinalCombinerInputParameterivNV, _gloffset_GetFinalCombinerInputParameterivNV, GetFinalCombinerInputParameterivNV@12) + GL_STUB(ResizeBuffersMESA, _gloffset_ResizeBuffersMESA, ResizeBuffersMESA@0) + GL_STUB(WindowPos2dMESA, _gloffset_WindowPos2dMESA, WindowPos2dMESA@16) + GL_STUB(WindowPos2dvMESA, _gloffset_WindowPos2dvMESA, WindowPos2dvMESA@4) + GL_STUB(WindowPos2fMESA, _gloffset_WindowPos2fMESA, WindowPos2fMESA@8) + GL_STUB(WindowPos2fvMESA, _gloffset_WindowPos2fvMESA, WindowPos2fvMESA@4) + GL_STUB(WindowPos2iMESA, _gloffset_WindowPos2iMESA, WindowPos2iMESA@8) + GL_STUB(WindowPos2ivMESA, _gloffset_WindowPos2ivMESA, WindowPos2ivMESA@4) + GL_STUB(WindowPos2sMESA, _gloffset_WindowPos2sMESA, WindowPos2sMESA@8) + GL_STUB(WindowPos2svMESA, _gloffset_WindowPos2svMESA, WindowPos2svMESA@4) + GL_STUB(WindowPos3dMESA, _gloffset_WindowPos3dMESA, WindowPos3dMESA@24) + GL_STUB(WindowPos3dvMESA, _gloffset_WindowPos3dvMESA, WindowPos3dvMESA@4) + GL_STUB(WindowPos3fMESA, _gloffset_WindowPos3fMESA, WindowPos3fMESA@12) + GL_STUB(WindowPos3fvMESA, _gloffset_WindowPos3fvMESA, WindowPos3fvMESA@4) + GL_STUB(WindowPos3iMESA, _gloffset_WindowPos3iMESA, WindowPos3iMESA@12) + GL_STUB(WindowPos3ivMESA, _gloffset_WindowPos3ivMESA, WindowPos3ivMESA@4) + GL_STUB(WindowPos3sMESA, _gloffset_WindowPos3sMESA, WindowPos3sMESA@12) + GL_STUB(WindowPos3svMESA, _gloffset_WindowPos3svMESA, WindowPos3svMESA@4) + GL_STUB(WindowPos4dMESA, _gloffset_WindowPos4dMESA, WindowPos4dMESA@32) + GL_STUB(WindowPos4dvMESA, _gloffset_WindowPos4dvMESA, WindowPos4dvMESA@4) + GL_STUB(WindowPos4fMESA, _gloffset_WindowPos4fMESA, WindowPos4fMESA@16) + GL_STUB(WindowPos4fvMESA, _gloffset_WindowPos4fvMESA, WindowPos4fvMESA@4) + GL_STUB(WindowPos4iMESA, _gloffset_WindowPos4iMESA, WindowPos4iMESA@16) + GL_STUB(WindowPos4ivMESA, _gloffset_WindowPos4ivMESA, WindowPos4ivMESA@4) + GL_STUB(WindowPos4sMESA, _gloffset_WindowPos4sMESA, WindowPos4sMESA@16) + GL_STUB(WindowPos4svMESA, _gloffset_WindowPos4svMESA, WindowPos4svMESA@4) + GL_STUB(BlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT, BlendFuncSeparateEXT@16) + GL_STUB(IndexMaterialEXT, _gloffset_IndexMaterialEXT, IndexMaterialEXT@8) + GL_STUB(IndexFuncEXT, _gloffset_IndexFuncEXT, IndexFuncEXT@8) + GL_STUB(LockArraysEXT, _gloffset_LockArraysEXT, LockArraysEXT@8) + GL_STUB(UnlockArraysEXT, _gloffset_UnlockArraysEXT, UnlockArraysEXT@0) + GL_STUB(CullParameterdvEXT, _gloffset_CullParameterdvEXT, CullParameterdvEXT@8) + GL_STUB(CullParameterfvEXT, _gloffset_CullParameterfvEXT, CullParameterfvEXT@8) + GL_STUB(HintPGI, _gloffset_HintPGI, HintPGI@8) + GL_STUB(FogCoordfEXT, _gloffset_FogCoordfEXT, FogCoordfEXT@4) + GL_STUB(FogCoordfvEXT, _gloffset_FogCoordfvEXT, FogCoordfvEXT@4) + GL_STUB(FogCoorddEXT, _gloffset_FogCoorddEXT, FogCoorddEXT@8) + GL_STUB(FogCoorddvEXT, _gloffset_FogCoorddvEXT, FogCoorddvEXT@4) + GL_STUB(FogCoordPointerEXT, _gloffset_FogCoordPointerEXT, FogCoordPointerEXT@12) + GL_STUB(GetColorTableEXT, _gloffset_GetColorTableEXT, GetColorTableEXT@16) + GL_STUB(GetColorTableParameterivEXT, _gloffset_GetColorTableParameterivEXT, GetColorTableParameterivEXT@12) + GL_STUB(GetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfvEXT, GetColorTableParameterfvEXT@12) + GL_STUB(TbufferMask3DFX, _gloffset_TbufferMask3DFX, TbufferMask3DFX@4) + GL_STUB(CompressedTexImage3DARB, _gloffset_CompressedTexImage3DARB, CompressedTexImage3DARB@36) + GL_STUB(CompressedTexImage2DARB, _gloffset_CompressedTexImage2DARB, CompressedTexImage2DARB@32) + GL_STUB(CompressedTexImage1DARB, _gloffset_CompressedTexImage1DARB, CompressedTexImage1DARB@28) + GL_STUB(CompressedTexSubImage3DARB, _gloffset_CompressedTexSubImage3DARB, CompressedTexSubImage3DARB@44) + GL_STUB(CompressedTexSubImage2DARB, _gloffset_CompressedTexSubImage2DARB, CompressedTexSubImage2DARB@36) + GL_STUB(CompressedTexSubImage1DARB, _gloffset_CompressedTexSubImage1DARB, CompressedTexSubImage1DARB@28) + GL_STUB(GetCompressedTexImageARB, _gloffset_GetCompressedTexImageARB, GetCompressedTexImageARB@12) + GL_STUB(SecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT, SecondaryColor3bEXT@12) + GL_STUB(SecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT, SecondaryColor3bvEXT@4) + GL_STUB(SecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT, SecondaryColor3dEXT@24) + GL_STUB(SecondaryColor3dvEXT, _gloffset_SecondaryColor3dvEXT, SecondaryColor3dvEXT@4) + GL_STUB(SecondaryColor3fEXT, _gloffset_SecondaryColor3fEXT, SecondaryColor3fEXT@12) + GL_STUB(SecondaryColor3fvEXT, _gloffset_SecondaryColor3fvEXT, SecondaryColor3fvEXT@4) + GL_STUB(SecondaryColor3iEXT, _gloffset_SecondaryColor3iEXT, SecondaryColor3iEXT@12) + GL_STUB(SecondaryColor3ivEXT, _gloffset_SecondaryColor3ivEXT, SecondaryColor3ivEXT@4) + GL_STUB(SecondaryColor3sEXT, _gloffset_SecondaryColor3sEXT, SecondaryColor3sEXT@12) + GL_STUB(SecondaryColor3svEXT, _gloffset_SecondaryColor3svEXT, SecondaryColor3svEXT@4) + GL_STUB(SecondaryColor3ubEXT, _gloffset_SecondaryColor3ubEXT, SecondaryColor3ubEXT@12) + GL_STUB(SecondaryColor3ubvEXT, _gloffset_SecondaryColor3ubvEXT, SecondaryColor3ubvEXT@4) + GL_STUB(SecondaryColor3uiEXT, _gloffset_SecondaryColor3uiEXT, SecondaryColor3uiEXT@12) + GL_STUB(SecondaryColor3uivEXT, _gloffset_SecondaryColor3uivEXT, SecondaryColor3uivEXT@4) + GL_STUB(SecondaryColor3usEXT, _gloffset_SecondaryColor3usEXT, SecondaryColor3usEXT@12) + GL_STUB(SecondaryColor3usvEXT, _gloffset_SecondaryColor3usvEXT, SecondaryColor3usvEXT@4) + GL_STUB(SecondaryColorPointerEXT, _gloffset_SecondaryColorPointerEXT, SecondaryColorPointerEXT@16) + GL_STUB(AreProgramsResidentNV, _gloffset_AreProgramsResidentNV, AreProgramsResidentNV@12) + GL_STUB(BindProgramNV, _gloffset_BindProgramNV, BindProgramNV@8) + GL_STUB(DeleteProgramsNV, _gloffset_DeleteProgramsNV, DeleteProgramsNV@8) + GL_STUB(ExecuteProgramNV, _gloffset_ExecuteProgramNV, ExecuteProgramNV@12) + GL_STUB(GenProgramsNV, _gloffset_GenProgramsNV, GenProgramsNV@8) + GL_STUB(GetProgramParameterdvNV, _gloffset_GetProgramParameterdvNV, GetProgramParameterdvNV@16) + GL_STUB(GetProgramParameterfvNV, _gloffset_GetProgramParameterfvNV, GetProgramParameterfvNV@16) + GL_STUB(GetProgramivNV, _gloffset_GetProgramivNV, GetProgramivNV@12) + GL_STUB(GetProgramStringNV, _gloffset_GetProgramStringNV, GetProgramStringNV@12) + GL_STUB(GetTrackMatrixivNV, _gloffset_GetTrackMatrixivNV, GetTrackMatrixivNV@16) + GL_STUB(GetVertexAttribdvARB, _gloffset_GetVertexAttribdvARB, GetVertexAttribdvARB@12) + GL_STUB(GetVertexAttribfvARB, _gloffset_GetVertexAttribfvARB, GetVertexAttribfvARB@12) + GL_STUB(GetVertexAttribivARB, _gloffset_GetVertexAttribivARB, GetVertexAttribivARB@12) + GL_STUB(GetVertexAttribPointervNV, _gloffset_GetVertexAttribPointervNV, GetVertexAttribPointervNV@12) + GL_STUB(IsProgramNV, _gloffset_IsProgramNV, IsProgramNV@4) + GL_STUB(LoadProgramNV, _gloffset_LoadProgramNV, LoadProgramNV@16) + GL_STUB(ProgramParameter4dNV, _gloffset_ProgramParameter4dNV, ProgramParameter4dNV@40) + GL_STUB(ProgramParameter4dvNV, _gloffset_ProgramParameter4dvNV, ProgramParameter4dvNV@12) + GL_STUB(ProgramParameter4fNV, _gloffset_ProgramParameter4fNV, ProgramParameter4fNV@24) + GL_STUB(ProgramParameter4fvNV, _gloffset_ProgramParameter4fvNV, ProgramParameter4fvNV@12) + GL_STUB(ProgramParameters4dvNV, _gloffset_ProgramParameters4dvNV, ProgramParameters4dvNV@16) + GL_STUB(ProgramParameters4fvNV, _gloffset_ProgramParameters4fvNV, ProgramParameters4fvNV@16) + GL_STUB(RequestResidentProgramsNV, _gloffset_RequestResidentProgramsNV, RequestResidentProgramsNV@8) + GL_STUB(TrackMatrixNV, _gloffset_TrackMatrixNV, TrackMatrixNV@16) + GL_STUB(VertexAttribPointerNV, _gloffset_VertexAttribPointerNV, VertexAttribPointerNV@20) + GL_STUB(VertexAttrib1dARB, _gloffset_VertexAttrib1dARB, VertexAttrib1dARB@12) + GL_STUB(VertexAttrib1dvARB, _gloffset_VertexAttrib1dvARB, VertexAttrib1dvARB@8) + GL_STUB(VertexAttrib1fARB, _gloffset_VertexAttrib1fARB, VertexAttrib1fARB@8) + GL_STUB(VertexAttrib1fvARB, _gloffset_VertexAttrib1fvARB, VertexAttrib1fvARB@8) + GL_STUB(VertexAttrib1sARB, _gloffset_VertexAttrib1sARB, VertexAttrib1sARB@8) + GL_STUB(VertexAttrib1svARB, _gloffset_VertexAttrib1svARB, VertexAttrib1svARB@8) + GL_STUB(VertexAttrib2dARB, _gloffset_VertexAttrib2dARB, VertexAttrib2dARB@20) + GL_STUB(VertexAttrib2dvARB, _gloffset_VertexAttrib2dvARB, VertexAttrib2dvARB@8) + GL_STUB(VertexAttrib2fARB, _gloffset_VertexAttrib2fARB, VertexAttrib2fARB@12) + GL_STUB(VertexAttrib2fvARB, _gloffset_VertexAttrib2fvARB, VertexAttrib2fvARB@8) + GL_STUB(VertexAttrib2sARB, _gloffset_VertexAttrib2sARB, VertexAttrib2sARB@12) + GL_STUB(VertexAttrib2svARB, _gloffset_VertexAttrib2svARB, VertexAttrib2svARB@8) + GL_STUB(VertexAttrib3dARB, _gloffset_VertexAttrib3dARB, VertexAttrib3dARB@28) + GL_STUB(VertexAttrib3dvARB, _gloffset_VertexAttrib3dvARB, VertexAttrib3dvARB@8) + GL_STUB(VertexAttrib3fARB, _gloffset_VertexAttrib3fARB, VertexAttrib3fARB@16) + GL_STUB(VertexAttrib3fvARB, _gloffset_VertexAttrib3fvARB, VertexAttrib3fvARB@8) + GL_STUB(VertexAttrib3sARB, _gloffset_VertexAttrib3sARB, VertexAttrib3sARB@16) + GL_STUB(VertexAttrib3svARB, _gloffset_VertexAttrib3svARB, VertexAttrib3svARB@8) + GL_STUB(VertexAttrib4dARB, _gloffset_VertexAttrib4dARB, VertexAttrib4dARB@36) + GL_STUB(VertexAttrib4dvARB, _gloffset_VertexAttrib4dvARB, VertexAttrib4dvARB@8) + GL_STUB(VertexAttrib4fARB, _gloffset_VertexAttrib4fARB, VertexAttrib4fARB@20) + GL_STUB(VertexAttrib4fvARB, _gloffset_VertexAttrib4fvARB, VertexAttrib4fvARB@8) + GL_STUB(VertexAttrib4sARB, _gloffset_VertexAttrib4sARB, VertexAttrib4sARB@20) + GL_STUB(VertexAttrib4svARB, _gloffset_VertexAttrib4svARB, VertexAttrib4svARB@8) + GL_STUB(VertexAttrib4NubARB, _gloffset_VertexAttrib4NubARB, VertexAttrib4NubARB@20) + GL_STUB(VertexAttrib4NubvARB, _gloffset_VertexAttrib4NubvARB, VertexAttrib4NubvARB@8) + GL_STUB(VertexAttribs1dvNV, _gloffset_VertexAttribs1dvNV, VertexAttribs1dvNV@12) + GL_STUB(VertexAttribs1fvNV, _gloffset_VertexAttribs1fvNV, VertexAttribs1fvNV@12) + GL_STUB(VertexAttribs1svNV, _gloffset_VertexAttribs1svNV, VertexAttribs1svNV@12) + GL_STUB(VertexAttribs2dvNV, _gloffset_VertexAttribs2dvNV, VertexAttribs2dvNV@12) + GL_STUB(VertexAttribs2fvNV, _gloffset_VertexAttribs2fvNV, VertexAttribs2fvNV@12) + GL_STUB(VertexAttribs2svNV, _gloffset_VertexAttribs2svNV, VertexAttribs2svNV@12) + GL_STUB(VertexAttribs3dvNV, _gloffset_VertexAttribs3dvNV, VertexAttribs3dvNV@12) + GL_STUB(VertexAttribs3fvNV, _gloffset_VertexAttribs3fvNV, VertexAttribs3fvNV@12) + GL_STUB(VertexAttribs3svNV, _gloffset_VertexAttribs3svNV, VertexAttribs3svNV@12) + GL_STUB(VertexAttribs4dvNV, _gloffset_VertexAttribs4dvNV, VertexAttribs4dvNV@12) + GL_STUB(VertexAttribs4fvNV, _gloffset_VertexAttribs4fvNV, VertexAttribs4fvNV@12) + GL_STUB(VertexAttribs4svNV, _gloffset_VertexAttribs4svNV, VertexAttribs4svNV@12) + GL_STUB(VertexAttribs4ubvNV, _gloffset_VertexAttribs4ubvNV, VertexAttribs4ubvNV@12) + GL_STUB(PointParameteriNV, _gloffset_PointParameteriNV, PointParameteriNV@8) + GL_STUB(PointParameterivNV, _gloffset_PointParameterivNV, PointParameterivNV@8) + GL_STUB(MultiDrawArraysEXT, _gloffset_MultiDrawArraysEXT, MultiDrawArraysEXT@16) + GL_STUB(MultiDrawElementsEXT, _gloffset_MultiDrawElementsEXT, MultiDrawElementsEXT@20) + GL_STUB(ActiveStencilFaceEXT, _gloffset_ActiveStencilFaceEXT, ActiveStencilFaceEXT@4) + GL_STUB(DeleteFencesNV, _gloffset_DeleteFencesNV, DeleteFencesNV@8) + GL_STUB(GenFencesNV, _gloffset_GenFencesNV, GenFencesNV@8) + GL_STUB(IsFenceNV, _gloffset_IsFenceNV, IsFenceNV@4) + GL_STUB(TestFenceNV, _gloffset_TestFenceNV, TestFenceNV@4) + GL_STUB(GetFenceivNV, _gloffset_GetFenceivNV, GetFenceivNV@12) + GL_STUB(FinishFenceNV, _gloffset_FinishFenceNV, FinishFenceNV@4) + GL_STUB(SetFenceNV, _gloffset_SetFenceNV, SetFenceNV@8) + GL_STUB(VertexAttrib4bvARB, _gloffset_VertexAttrib4bvARB, VertexAttrib4bvARB@8) + GL_STUB(VertexAttrib4ivARB, _gloffset_VertexAttrib4ivARB, VertexAttrib4ivARB@8) + GL_STUB(VertexAttrib4ubvARB, _gloffset_VertexAttrib4ubvARB, VertexAttrib4ubvARB@8) + GL_STUB(VertexAttrib4usvARB, _gloffset_VertexAttrib4usvARB, VertexAttrib4usvARB@8) + GL_STUB(VertexAttrib4uivARB, _gloffset_VertexAttrib4uivARB, VertexAttrib4uivARB@8) + GL_STUB(VertexAttrib4NbvARB, _gloffset_VertexAttrib4NbvARB, VertexAttrib4NbvARB@8) + GL_STUB(VertexAttrib4NsvARB, _gloffset_VertexAttrib4NsvARB, VertexAttrib4NsvARB@8) + GL_STUB(VertexAttrib4NivARB, _gloffset_VertexAttrib4NivARB, VertexAttrib4NivARB@8) + GL_STUB(VertexAttrib4NusvARB, _gloffset_VertexAttrib4NusvARB, VertexAttrib4NusvARB@8) + GL_STUB(VertexAttrib4NuivARB, _gloffset_VertexAttrib4NuivARB, VertexAttrib4NuivARB@8) + GL_STUB(VertexAttribPointerARB, _gloffset_VertexAttribPointerARB, VertexAttribPointerARB@24) + GL_STUB(EnableVertexAttribArrayARB, _gloffset_EnableVertexAttribArrayARB, EnableVertexAttribArrayARB@4) + GL_STUB(DisableVertexAttribArrayARB, _gloffset_DisableVertexAttribArrayARB, DisableVertexAttribArrayARB@4) + GL_STUB(ProgramStringARB, _gloffset_ProgramStringARB, ProgramStringARB@16) + GL_STUB(ProgramEnvParameter4dARB, _gloffset_ProgramEnvParameter4dARB, ProgramEnvParameter4dARB@40) + GL_STUB(ProgramEnvParameter4dvARB, _gloffset_ProgramEnvParameter4dvARB, ProgramEnvParameter4dvARB@12) + GL_STUB(ProgramEnvParameter4fARB, _gloffset_ProgramEnvParameter4fARB, ProgramEnvParameter4fARB@24) + GL_STUB(ProgramEnvParameter4fvARB, _gloffset_ProgramEnvParameter4fvARB, ProgramEnvParameter4fvARB@12) + GL_STUB(ProgramLocalParameter4dARB, _gloffset_ProgramLocalParameter4dARB, ProgramLocalParameter4dARB@40) + GL_STUB(ProgramLocalParameter4dvARB, _gloffset_ProgramLocalParameter4dvARB, ProgramLocalParameter4dvARB@12) + GL_STUB(ProgramLocalParameter4fARB, _gloffset_ProgramLocalParameter4fARB, ProgramLocalParameter4fARB@24) + GL_STUB(ProgramLocalParameter4fvARB, _gloffset_ProgramLocalParameter4fvARB, ProgramLocalParameter4fvARB@12) + GL_STUB(GetProgramEnvParameterdvARB, _gloffset_GetProgramEnvParameterdvARB, GetProgramEnvParameterdvARB@12) + GL_STUB(GetProgramEnvParameterfvARB, _gloffset_GetProgramEnvParameterfvARB, GetProgramEnvParameterfvARB@12) + GL_STUB(GetProgramLocalParameterdvARB, _gloffset_GetProgramLocalParameterdvARB, GetProgramLocalParameterdvARB@12) + GL_STUB(GetProgramLocalParameterfvARB, _gloffset_GetProgramLocalParameterfvARB, GetProgramLocalParameterfvARB@12) + GL_STUB(GetProgramivARB, _gloffset_GetProgramivARB, GetProgramivARB@12) + GL_STUB(GetProgramStringARB, _gloffset_GetProgramStringARB, GetProgramStringARB@12) + GL_STUB(ProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV, ProgramNamedParameter4fNV@28) + GL_STUB(ProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV, ProgramNamedParameter4dNV@44) + GL_STUB(ProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV, ProgramNamedParameter4fvNV@16) + GL_STUB(ProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV, ProgramNamedParameter4dvNV@16) + GL_STUB(GetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV, GetProgramNamedParameterfvNV@16) + GL_STUB(GetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV, GetProgramNamedParameterdvNV@16) + GL_STUB(BindBufferARB, _gloffset_BindBufferARB, BindBufferARB@8) + GL_STUB(BufferDataARB, _gloffset_BufferDataARB, BufferDataARB@16) + GL_STUB(BufferSubDataARB, _gloffset_BufferSubDataARB, BufferSubDataARB@16) + GL_STUB(DeleteBuffersARB, _gloffset_DeleteBuffersARB, DeleteBuffersARB@8) + GL_STUB(GenBuffersARB, _gloffset_GenBuffersARB, GenBuffersARB@8) + GL_STUB(GetBufferParameterivARB, _gloffset_GetBufferParameterivARB, GetBufferParameterivARB@12) + GL_STUB(GetBufferPointervARB, _gloffset_GetBufferPointervARB, GetBufferPointervARB@12) + GL_STUB(GetBufferSubDataARB, _gloffset_GetBufferSubDataARB, GetBufferSubDataARB@16) + GL_STUB(IsBufferARB, _gloffset_IsBufferARB, IsBufferARB@4) + GL_STUB(MapBufferARB, _gloffset_MapBufferARB, MapBufferARB@8) + GL_STUB(UnmapBufferARB, _gloffset_UnmapBufferARB, UnmapBufferARB@4) + GL_STUB(DepthBoundsEXT, _gloffset_DepthBoundsEXT, DepthBoundsEXT@16) + GL_STUB(GenQueriesARB, _gloffset_GenQueriesARB, GenQueriesARB@8) + GL_STUB(DeleteQueriesARB, _gloffset_DeleteQueriesARB, DeleteQueriesARB@8) + GL_STUB(IsQueryARB, _gloffset_IsQueryARB, IsQueryARB@4) + GL_STUB(BeginQueryARB, _gloffset_BeginQueryARB, BeginQueryARB@8) + GL_STUB(EndQueryARB, _gloffset_EndQueryARB, EndQueryARB@4) + GL_STUB(GetQueryivARB, _gloffset_GetQueryivARB, GetQueryivARB@12) + GL_STUB(GetQueryObjectivARB, _gloffset_GetQueryObjectivARB, GetQueryObjectivARB@12) + GL_STUB(GetQueryObjectuivARB, _gloffset_GetQueryObjectuivARB, GetQueryObjectuivARB@12) + GL_STUB(MultiModeDrawArraysIBM, _gloffset_MultiModeDrawArraysIBM, MultiModeDrawArraysIBM@20) + GL_STUB(MultiModeDrawElementsIBM, _gloffset_MultiModeDrawElementsIBM, MultiModeDrawElementsIBM@24) + GL_STUB(BlendEquationSeparateEXT, _gloffset_BlendEquationSeparateEXT, BlendEquationSeparateEXT@8) + GL_STUB(DeleteObjectARB, _gloffset_DeleteObjectARB, DeleteObjectARB@4) + GL_STUB(GetHandleARB, _gloffset_GetHandleARB, GetHandleARB@4) + GL_STUB(DetachObjectARB, _gloffset_DetachObjectARB, DetachObjectARB@8) + GL_STUB(CreateShaderObjectARB, _gloffset_CreateShaderObjectARB, CreateShaderObjectARB@4) + GL_STUB(ShaderSourceARB, _gloffset_ShaderSourceARB, ShaderSourceARB@16) + GL_STUB(CompileShaderARB, _gloffset_CompileShaderARB, CompileShaderARB@4) + GL_STUB(CreateProgramObjectARB, _gloffset_CreateProgramObjectARB, CreateProgramObjectARB@0) + GL_STUB(AttachObjectARB, _gloffset_AttachObjectARB, AttachObjectARB@8) + GL_STUB(LinkProgramARB, _gloffset_LinkProgramARB, LinkProgramARB@4) + GL_STUB(UseProgramObjectARB, _gloffset_UseProgramObjectARB, UseProgramObjectARB@4) + GL_STUB(ValidateProgramARB, _gloffset_ValidateProgramARB, ValidateProgramARB@4) + GL_STUB(Uniform1fARB, _gloffset_Uniform1fARB, Uniform1fARB@8) + GL_STUB(Uniform2fARB, _gloffset_Uniform2fARB, Uniform2fARB@12) + GL_STUB(Uniform3fARB, _gloffset_Uniform3fARB, Uniform3fARB@16) + GL_STUB(Uniform4fARB, _gloffset_Uniform4fARB, Uniform4fARB@20) + GL_STUB(Uniform1iARB, _gloffset_Uniform1iARB, Uniform1iARB@8) + GL_STUB(Uniform2iARB, _gloffset_Uniform2iARB, Uniform2iARB@12) + GL_STUB(Uniform3iARB, _gloffset_Uniform3iARB, Uniform3iARB@16) + GL_STUB(Uniform4iARB, _gloffset_Uniform4iARB, Uniform4iARB@20) + GL_STUB(Uniform1fvARB, _gloffset_Uniform1fvARB, Uniform1fvARB@12) + GL_STUB(Uniform2fvARB, _gloffset_Uniform2fvARB, Uniform2fvARB@12) + GL_STUB(Uniform3fvARB, _gloffset_Uniform3fvARB, Uniform3fvARB@12) + GL_STUB(Uniform4fvARB, _gloffset_Uniform4fvARB, Uniform4fvARB@12) + GL_STUB(Uniform1ivARB, _gloffset_Uniform1ivARB, Uniform1ivARB@12) + GL_STUB(Uniform2ivARB, _gloffset_Uniform2ivARB, Uniform2ivARB@12) + GL_STUB(Uniform3ivARB, _gloffset_Uniform3ivARB, Uniform3ivARB@12) + GL_STUB(Uniform4ivARB, _gloffset_Uniform4ivARB, Uniform4ivARB@12) + GL_STUB(UniformMatrix2fvARB, _gloffset_UniformMatrix2fvARB, UniformMatrix2fvARB@16) + GL_STUB(UniformMatrix3fvARB, _gloffset_UniformMatrix3fvARB, UniformMatrix3fvARB@16) + GL_STUB(UniformMatrix4fvARB, _gloffset_UniformMatrix4fvARB, UniformMatrix4fvARB@16) + GL_STUB(GetObjectParameterfvARB, _gloffset_GetObjectParameterfvARB, GetObjectParameterfvARB@12) + GL_STUB(GetObjectParameterivARB, _gloffset_GetObjectParameterivARB, GetObjectParameterivARB@12) + GL_STUB(GetInfoLogARB, _gloffset_GetInfoLogARB, GetInfoLogARB@16) + GL_STUB(GetAttachedObjectsARB, _gloffset_GetAttachedObjectsARB, GetAttachedObjectsARB@16) + GL_STUB(GetUniformLocationARB, _gloffset_GetUniformLocationARB, GetUniformLocationARB@8) + GL_STUB(GetActiveUniformARB, _gloffset_GetActiveUniformARB, GetActiveUniformARB@28) + GL_STUB(GetUniformfvARB, _gloffset_GetUniformfvARB, GetUniformfvARB@12) + GL_STUB(GetUniformivARB, _gloffset_GetUniformivARB, GetUniformivARB@12) + GL_STUB(GetShaderSourceARB, _gloffset_GetShaderSourceARB, GetShaderSourceARB@16) + GL_STUB(BindAttribLocationARB, _gloffset_BindAttribLocationARB, BindAttribLocationARB@12) + GL_STUB(GetActiveAttribARB, _gloffset_GetActiveAttribARB, GetActiveAttribARB@28) + GL_STUB(GetAttribLocationARB, _gloffset_GetAttribLocationARB, GetAttribLocationARB@8) + GL_STUB(GetVertexAttribdvNV, _gloffset_GetVertexAttribdvNV, GetVertexAttribdvNV@12) + GL_STUB(GetVertexAttribfvNV, _gloffset_GetVertexAttribfvNV, GetVertexAttribfvNV@12) + GL_STUB(GetVertexAttribivNV, _gloffset_GetVertexAttribivNV, GetVertexAttribivNV@12) + GL_STUB(VertexAttrib1dNV, _gloffset_VertexAttrib1dNV, VertexAttrib1dNV@12) + GL_STUB(VertexAttrib1dvNV, _gloffset_VertexAttrib1dvNV, VertexAttrib1dvNV@8) + GL_STUB(VertexAttrib1fNV, _gloffset_VertexAttrib1fNV, VertexAttrib1fNV@8) + GL_STUB(VertexAttrib1fvNV, _gloffset_VertexAttrib1fvNV, VertexAttrib1fvNV@8) + GL_STUB(VertexAttrib1sNV, _gloffset_VertexAttrib1sNV, VertexAttrib1sNV@8) + GL_STUB(VertexAttrib1svNV, _gloffset_VertexAttrib1svNV, VertexAttrib1svNV@8) + GL_STUB(VertexAttrib2dNV, _gloffset_VertexAttrib2dNV, VertexAttrib2dNV@20) + GL_STUB(VertexAttrib2dvNV, _gloffset_VertexAttrib2dvNV, VertexAttrib2dvNV@8) + GL_STUB(VertexAttrib2fNV, _gloffset_VertexAttrib2fNV, VertexAttrib2fNV@12) + GL_STUB(VertexAttrib2fvNV, _gloffset_VertexAttrib2fvNV, VertexAttrib2fvNV@8) + GL_STUB(VertexAttrib2sNV, _gloffset_VertexAttrib2sNV, VertexAttrib2sNV@12) + GL_STUB(VertexAttrib2svNV, _gloffset_VertexAttrib2svNV, VertexAttrib2svNV@8) + GL_STUB(VertexAttrib3dNV, _gloffset_VertexAttrib3dNV, VertexAttrib3dNV@28) + GL_STUB(VertexAttrib3dvNV, _gloffset_VertexAttrib3dvNV, VertexAttrib3dvNV@8) + GL_STUB(VertexAttrib3fNV, _gloffset_VertexAttrib3fNV, VertexAttrib3fNV@16) + GL_STUB(VertexAttrib3fvNV, _gloffset_VertexAttrib3fvNV, VertexAttrib3fvNV@8) + GL_STUB(VertexAttrib3sNV, _gloffset_VertexAttrib3sNV, VertexAttrib3sNV@16) + GL_STUB(VertexAttrib3svNV, _gloffset_VertexAttrib3svNV, VertexAttrib3svNV@8) + GL_STUB(VertexAttrib4dNV, _gloffset_VertexAttrib4dNV, VertexAttrib4dNV@36) + GL_STUB(VertexAttrib4dvNV, _gloffset_VertexAttrib4dvNV, VertexAttrib4dvNV@8) + GL_STUB(VertexAttrib4fNV, _gloffset_VertexAttrib4fNV, VertexAttrib4fNV@20) + GL_STUB(VertexAttrib4fvNV, _gloffset_VertexAttrib4fvNV, VertexAttrib4fvNV@8) + GL_STUB(VertexAttrib4sNV, _gloffset_VertexAttrib4sNV, VertexAttrib4sNV@20) + GL_STUB(VertexAttrib4svNV, _gloffset_VertexAttrib4svNV, VertexAttrib4svNV@8) + GL_STUB(VertexAttrib4ubNV, _gloffset_VertexAttrib4ubNV, VertexAttrib4ubNV@20) + GL_STUB(VertexAttrib4ubvNV, _gloffset_VertexAttrib4ubvNV, VertexAttrib4ubvNV@8) + GL_STUB(GenFragmentShadersATI, _gloffset_GenFragmentShadersATI, GenFragmentShadersATI@4) + GL_STUB(BindFragmentShaderATI, _gloffset_BindFragmentShaderATI, BindFragmentShaderATI@4) + GL_STUB(DeleteFragmentShaderATI, _gloffset_DeleteFragmentShaderATI, DeleteFragmentShaderATI@4) + GL_STUB(BeginFragmentShaderATI, _gloffset_BeginFragmentShaderATI, BeginFragmentShaderATI@0) + GL_STUB(EndFragmentShaderATI, _gloffset_EndFragmentShaderATI, EndFragmentShaderATI@0) + GL_STUB(PassTexCoordATI, _gloffset_PassTexCoordATI, PassTexCoordATI@12) + GL_STUB(SampleMapATI, _gloffset_SampleMapATI, SampleMapATI@12) + GL_STUB(ColorFragmentOp1ATI, _gloffset_ColorFragmentOp1ATI, ColorFragmentOp1ATI@28) + GL_STUB(ColorFragmentOp2ATI, _gloffset_ColorFragmentOp2ATI, ColorFragmentOp2ATI@40) + GL_STUB(ColorFragmentOp3ATI, _gloffset_ColorFragmentOp3ATI, ColorFragmentOp3ATI@52) + GL_STUB(AlphaFragmentOp1ATI, _gloffset_AlphaFragmentOp1ATI, AlphaFragmentOp1ATI@24) + GL_STUB(AlphaFragmentOp2ATI, _gloffset_AlphaFragmentOp2ATI, AlphaFragmentOp2ATI@36) + GL_STUB(AlphaFragmentOp3ATI, _gloffset_AlphaFragmentOp3ATI, AlphaFragmentOp3ATI@48) + GL_STUB(SetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI, SetFragmentShaderConstantATI@8) + GL_STUB(IsRenderbufferEXT, _gloffset_IsRenderbufferEXT, IsRenderbufferEXT@4) + GL_STUB(BindRenderbufferEXT, _gloffset_BindRenderbufferEXT, BindRenderbufferEXT@8) + GL_STUB(DeleteRenderbuffersEXT, _gloffset_DeleteRenderbuffersEXT, DeleteRenderbuffersEXT@8) + GL_STUB(GenRenderbuffersEXT, _gloffset_GenRenderbuffersEXT, GenRenderbuffersEXT@8) + GL_STUB(RenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT, RenderbufferStorageEXT@16) + GL_STUB(GetRenderbufferParameterivEXT, _gloffset_GetRenderbufferParameterivEXT, GetRenderbufferParameterivEXT@12) + GL_STUB(IsFramebufferEXT, _gloffset_IsFramebufferEXT, IsFramebufferEXT@4) + GL_STUB(BindFramebufferEXT, _gloffset_BindFramebufferEXT, BindFramebufferEXT@8) + GL_STUB(DeleteFramebuffersEXT, _gloffset_DeleteFramebuffersEXT, DeleteFramebuffersEXT@8) + GL_STUB(GenFramebuffersEXT, _gloffset_GenFramebuffersEXT, GenFramebuffersEXT@8) + GL_STUB(CheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT, CheckFramebufferStatusEXT@4) + GL_STUB(FramebufferTexture1DEXT, _gloffset_FramebufferTexture1DEXT, FramebufferTexture1DEXT@20) + GL_STUB(FramebufferTexture2DEXT, _gloffset_FramebufferTexture2DEXT, FramebufferTexture2DEXT@20) + GL_STUB(FramebufferTexture3DEXT, _gloffset_FramebufferTexture3DEXT, FramebufferTexture3DEXT@24) + GL_STUB(FramebufferRenderbufferEXT, _gloffset_FramebufferRenderbufferEXT, FramebufferRenderbufferEXT@16) + GL_STUB(GetFramebufferAttachmentParameterivEXT, _gloffset_GetFramebufferAttachmentParameterivEXT, GetFramebufferAttachmentParameterivEXT@16) + GL_STUB(GenerateMipmapEXT, _gloffset_GenerateMipmapEXT, GenerateMipmapEXT@4) + GL_STUB(StencilFuncSeparate, _gloffset_StencilFuncSeparate, StencilFuncSeparate@16) + GL_STUB(StencilOpSeparate, _gloffset_StencilOpSeparate, StencilOpSeparate@16) + GL_STUB(StencilMaskSeparate, _gloffset_StencilMaskSeparate, StencilMaskSeparate@8) + GL_STUB_ALIAS(ArrayElementEXT, _gloffset_ArrayElement, ArrayElementEXT@4, ArrayElement, ArrayElement@4) + GL_STUB_ALIAS(BindTextureEXT, _gloffset_BindTexture, BindTextureEXT@8, BindTexture, BindTexture@8) + GL_STUB_ALIAS(DrawArraysEXT, _gloffset_DrawArrays, DrawArraysEXT@12, DrawArrays, DrawArrays@12) + GL_STUB_ALIAS(CopyTexImage1DEXT, _gloffset_CopyTexImage1D, CopyTexImage1DEXT@28, CopyTexImage1D, CopyTexImage1D@28) + GL_STUB_ALIAS(CopyTexImage2DEXT, _gloffset_CopyTexImage2D, CopyTexImage2DEXT@32, CopyTexImage2D, CopyTexImage2D@32) + GL_STUB_ALIAS(CopyTexSubImage1DEXT, _gloffset_CopyTexSubImage1D, CopyTexSubImage1DEXT@24, CopyTexSubImage1D, CopyTexSubImage1D@24) + GL_STUB_ALIAS(CopyTexSubImage2DEXT, _gloffset_CopyTexSubImage2D, CopyTexSubImage2DEXT@32, CopyTexSubImage2D, CopyTexSubImage2D@32) + GL_STUB_ALIAS(DeleteTexturesEXT, _gloffset_DeleteTextures, DeleteTexturesEXT@8, DeleteTextures, DeleteTextures@8) + GL_STUB_ALIAS(GetPointervEXT, _gloffset_GetPointerv, GetPointervEXT@8, GetPointerv, GetPointerv@8) + GL_STUB_ALIAS(PrioritizeTexturesEXT, _gloffset_PrioritizeTextures, PrioritizeTexturesEXT@12, PrioritizeTextures, PrioritizeTextures@12) + GL_STUB_ALIAS(TexSubImage1DEXT, _gloffset_TexSubImage1D, TexSubImage1DEXT@28, TexSubImage1D, TexSubImage1D@28) + GL_STUB_ALIAS(TexSubImage2DEXT, _gloffset_TexSubImage2D, TexSubImage2DEXT@36, TexSubImage2D, TexSubImage2D@36) + GL_STUB_ALIAS(BlendColorEXT, _gloffset_BlendColor, BlendColorEXT@16, BlendColor, BlendColor@16) + GL_STUB_ALIAS(BlendEquationEXT, _gloffset_BlendEquation, BlendEquationEXT@4, BlendEquation, BlendEquation@4) + GL_STUB_ALIAS(DrawRangeElementsEXT, _gloffset_DrawRangeElements, DrawRangeElementsEXT@24, DrawRangeElements, DrawRangeElements@24) + GL_STUB_ALIAS(ColorTableSGI, _gloffset_ColorTable, ColorTableSGI@24, ColorTable, ColorTable@24) + GL_STUB_ALIAS(ColorTableEXT, _gloffset_ColorTable, ColorTableEXT@24, ColorTable, ColorTable@24) + GL_STUB_ALIAS(ColorTableParameterfvSGI, _gloffset_ColorTableParameterfv, ColorTableParameterfvSGI@12, ColorTableParameterfv, ColorTableParameterfv@12) + GL_STUB_ALIAS(ColorTableParameterivSGI, _gloffset_ColorTableParameteriv, ColorTableParameterivSGI@12, ColorTableParameteriv, ColorTableParameteriv@12) + GL_STUB_ALIAS(CopyColorTableSGI, _gloffset_CopyColorTable, CopyColorTableSGI@20, CopyColorTable, CopyColorTable@20) + GL_STUB_ALIAS(ColorSubTableEXT, _gloffset_ColorSubTable, ColorSubTableEXT@24, ColorSubTable, ColorSubTable@24) + GL_STUB_ALIAS(CopyColorSubTableEXT, _gloffset_CopyColorSubTable, CopyColorSubTableEXT@20, CopyColorSubTable, CopyColorSubTable@20) + GL_STUB_ALIAS(ConvolutionFilter1DEXT, _gloffset_ConvolutionFilter1D, ConvolutionFilter1DEXT@24, ConvolutionFilter1D, ConvolutionFilter1D@24) + GL_STUB_ALIAS(ConvolutionFilter2DEXT, _gloffset_ConvolutionFilter2D, ConvolutionFilter2DEXT@28, ConvolutionFilter2D, ConvolutionFilter2D@28) + GL_STUB_ALIAS(ConvolutionParameterfEXT, _gloffset_ConvolutionParameterf, ConvolutionParameterfEXT@12, ConvolutionParameterf, ConvolutionParameterf@12) + GL_STUB_ALIAS(ConvolutionParameterfvEXT, _gloffset_ConvolutionParameterfv, ConvolutionParameterfvEXT@12, ConvolutionParameterfv, ConvolutionParameterfv@12) + GL_STUB_ALIAS(ConvolutionParameteriEXT, _gloffset_ConvolutionParameteri, ConvolutionParameteriEXT@12, ConvolutionParameteri, ConvolutionParameteri@12) + GL_STUB_ALIAS(ConvolutionParameterivEXT, _gloffset_ConvolutionParameteriv, ConvolutionParameterivEXT@12, ConvolutionParameteriv, ConvolutionParameteriv@12) + GL_STUB_ALIAS(CopyConvolutionFilter1DEXT, _gloffset_CopyConvolutionFilter1D, CopyConvolutionFilter1DEXT@20, CopyConvolutionFilter1D, CopyConvolutionFilter1D@20) + GL_STUB_ALIAS(CopyConvolutionFilter2DEXT, _gloffset_CopyConvolutionFilter2D, CopyConvolutionFilter2DEXT@24, CopyConvolutionFilter2D, CopyConvolutionFilter2D@24) + GL_STUB_ALIAS(SeparableFilter2DEXT, _gloffset_SeparableFilter2D, SeparableFilter2DEXT@32, SeparableFilter2D, SeparableFilter2D@32) + GL_STUB_ALIAS(HistogramEXT, _gloffset_Histogram, HistogramEXT@16, Histogram, Histogram@16) + GL_STUB_ALIAS(MinmaxEXT, _gloffset_Minmax, MinmaxEXT@12, Minmax, Minmax@12) + GL_STUB_ALIAS(ResetHistogramEXT, _gloffset_ResetHistogram, ResetHistogramEXT@4, ResetHistogram, ResetHistogram@4) + GL_STUB_ALIAS(ResetMinmaxEXT, _gloffset_ResetMinmax, ResetMinmaxEXT@4, ResetMinmax, ResetMinmax@4) + GL_STUB_ALIAS(TexImage3DEXT, _gloffset_TexImage3D, TexImage3DEXT@40, TexImage3D, TexImage3D@40) + GL_STUB_ALIAS(TexSubImage3DEXT, _gloffset_TexSubImage3D, TexSubImage3DEXT@44, TexSubImage3D, TexSubImage3D@44) + GL_STUB_ALIAS(CopyTexSubImage3DEXT, _gloffset_CopyTexSubImage3D, CopyTexSubImage3DEXT@36, CopyTexSubImage3D, CopyTexSubImage3D@36) + GL_STUB_ALIAS(ActiveTexture, _gloffset_ActiveTextureARB, ActiveTexture@4, ActiveTextureARB, ActiveTextureARB@4) + GL_STUB_ALIAS(ClientActiveTexture, _gloffset_ClientActiveTextureARB, ClientActiveTexture@4, ClientActiveTextureARB, ClientActiveTextureARB@4) + GL_STUB_ALIAS(MultiTexCoord1d, _gloffset_MultiTexCoord1dARB, MultiTexCoord1d@12, MultiTexCoord1dARB, MultiTexCoord1dARB@12) + GL_STUB_ALIAS(MultiTexCoord1dv, _gloffset_MultiTexCoord1dvARB, MultiTexCoord1dv@8, MultiTexCoord1dvARB, MultiTexCoord1dvARB@8) + GL_STUB_ALIAS(MultiTexCoord1f, _gloffset_MultiTexCoord1fARB, MultiTexCoord1f@8, MultiTexCoord1fARB, MultiTexCoord1fARB@8) + GL_STUB_ALIAS(MultiTexCoord1fv, _gloffset_MultiTexCoord1fvARB, MultiTexCoord1fv@8, MultiTexCoord1fvARB, MultiTexCoord1fvARB@8) + GL_STUB_ALIAS(MultiTexCoord1i, _gloffset_MultiTexCoord1iARB, MultiTexCoord1i@8, MultiTexCoord1iARB, MultiTexCoord1iARB@8) + GL_STUB_ALIAS(MultiTexCoord1iv, _gloffset_MultiTexCoord1ivARB, MultiTexCoord1iv@8, MultiTexCoord1ivARB, MultiTexCoord1ivARB@8) + GL_STUB_ALIAS(MultiTexCoord1s, _gloffset_MultiTexCoord1sARB, MultiTexCoord1s@8, MultiTexCoord1sARB, MultiTexCoord1sARB@8) + GL_STUB_ALIAS(MultiTexCoord1sv, _gloffset_MultiTexCoord1svARB, MultiTexCoord1sv@8, MultiTexCoord1svARB, MultiTexCoord1svARB@8) + GL_STUB_ALIAS(MultiTexCoord2d, _gloffset_MultiTexCoord2dARB, MultiTexCoord2d@20, MultiTexCoord2dARB, MultiTexCoord2dARB@20) + GL_STUB_ALIAS(MultiTexCoord2dv, _gloffset_MultiTexCoord2dvARB, MultiTexCoord2dv@8, MultiTexCoord2dvARB, MultiTexCoord2dvARB@8) + GL_STUB_ALIAS(MultiTexCoord2f, _gloffset_MultiTexCoord2fARB, MultiTexCoord2f@12, MultiTexCoord2fARB, MultiTexCoord2fARB@12) + GL_STUB_ALIAS(MultiTexCoord2fv, _gloffset_MultiTexCoord2fvARB, MultiTexCoord2fv@8, MultiTexCoord2fvARB, MultiTexCoord2fvARB@8) + GL_STUB_ALIAS(MultiTexCoord2i, _gloffset_MultiTexCoord2iARB, MultiTexCoord2i@12, MultiTexCoord2iARB, MultiTexCoord2iARB@12) + GL_STUB_ALIAS(MultiTexCoord2iv, _gloffset_MultiTexCoord2ivARB, MultiTexCoord2iv@8, MultiTexCoord2ivARB, MultiTexCoord2ivARB@8) + GL_STUB_ALIAS(MultiTexCoord2s, _gloffset_MultiTexCoord2sARB, MultiTexCoord2s@12, MultiTexCoord2sARB, MultiTexCoord2sARB@12) + GL_STUB_ALIAS(MultiTexCoord2sv, _gloffset_MultiTexCoord2svARB, MultiTexCoord2sv@8, MultiTexCoord2svARB, MultiTexCoord2svARB@8) + GL_STUB_ALIAS(MultiTexCoord3d, _gloffset_MultiTexCoord3dARB, MultiTexCoord3d@28, MultiTexCoord3dARB, MultiTexCoord3dARB@28) + GL_STUB_ALIAS(MultiTexCoord3dv, _gloffset_MultiTexCoord3dvARB, MultiTexCoord3dv@8, MultiTexCoord3dvARB, MultiTexCoord3dvARB@8) + GL_STUB_ALIAS(MultiTexCoord3f, _gloffset_MultiTexCoord3fARB, MultiTexCoord3f@16, MultiTexCoord3fARB, MultiTexCoord3fARB@16) + GL_STUB_ALIAS(MultiTexCoord3fv, _gloffset_MultiTexCoord3fvARB, MultiTexCoord3fv@8, MultiTexCoord3fvARB, MultiTexCoord3fvARB@8) + GL_STUB_ALIAS(MultiTexCoord3i, _gloffset_MultiTexCoord3iARB, MultiTexCoord3i@16, MultiTexCoord3iARB, MultiTexCoord3iARB@16) + GL_STUB_ALIAS(MultiTexCoord3iv, _gloffset_MultiTexCoord3ivARB, MultiTexCoord3iv@8, MultiTexCoord3ivARB, MultiTexCoord3ivARB@8) + GL_STUB_ALIAS(MultiTexCoord3s, _gloffset_MultiTexCoord3sARB, MultiTexCoord3s@16, MultiTexCoord3sARB, MultiTexCoord3sARB@16) + GL_STUB_ALIAS(MultiTexCoord3sv, _gloffset_MultiTexCoord3svARB, MultiTexCoord3sv@8, MultiTexCoord3svARB, MultiTexCoord3svARB@8) + GL_STUB_ALIAS(MultiTexCoord4d, _gloffset_MultiTexCoord4dARB, MultiTexCoord4d@36, MultiTexCoord4dARB, MultiTexCoord4dARB@36) + GL_STUB_ALIAS(MultiTexCoord4dv, _gloffset_MultiTexCoord4dvARB, MultiTexCoord4dv@8, MultiTexCoord4dvARB, MultiTexCoord4dvARB@8) + GL_STUB_ALIAS(MultiTexCoord4f, _gloffset_MultiTexCoord4fARB, MultiTexCoord4f@20, MultiTexCoord4fARB, MultiTexCoord4fARB@20) + GL_STUB_ALIAS(MultiTexCoord4fv, _gloffset_MultiTexCoord4fvARB, MultiTexCoord4fv@8, MultiTexCoord4fvARB, MultiTexCoord4fvARB@8) + GL_STUB_ALIAS(MultiTexCoord4i, _gloffset_MultiTexCoord4iARB, MultiTexCoord4i@20, MultiTexCoord4iARB, MultiTexCoord4iARB@20) + GL_STUB_ALIAS(MultiTexCoord4iv, _gloffset_MultiTexCoord4ivARB, MultiTexCoord4iv@8, MultiTexCoord4ivARB, MultiTexCoord4ivARB@8) + GL_STUB_ALIAS(MultiTexCoord4s, _gloffset_MultiTexCoord4sARB, MultiTexCoord4s@20, MultiTexCoord4sARB, MultiTexCoord4sARB@20) + GL_STUB_ALIAS(MultiTexCoord4sv, _gloffset_MultiTexCoord4svARB, MultiTexCoord4sv@8, MultiTexCoord4svARB, MultiTexCoord4svARB@8) + GL_STUB_ALIAS(LoadTransposeMatrixf, _gloffset_LoadTransposeMatrixfARB, LoadTransposeMatrixf@4, LoadTransposeMatrixfARB, LoadTransposeMatrixfARB@4) + GL_STUB_ALIAS(LoadTransposeMatrixd, _gloffset_LoadTransposeMatrixdARB, LoadTransposeMatrixd@4, LoadTransposeMatrixdARB, LoadTransposeMatrixdARB@4) + GL_STUB_ALIAS(MultTransposeMatrixf, _gloffset_MultTransposeMatrixfARB, MultTransposeMatrixf@4, MultTransposeMatrixfARB, MultTransposeMatrixfARB@4) + GL_STUB_ALIAS(MultTransposeMatrixd, _gloffset_MultTransposeMatrixdARB, MultTransposeMatrixd@4, MultTransposeMatrixdARB, MultTransposeMatrixdARB@4) + GL_STUB_ALIAS(SampleCoverage, _gloffset_SampleCoverageARB, SampleCoverage@8, SampleCoverageARB, SampleCoverageARB@8) + GL_STUB_ALIAS(DrawBuffersATI, _gloffset_DrawBuffersARB, DrawBuffersATI@8, DrawBuffersARB, DrawBuffersARB@8) + GL_STUB_ALIAS(SampleMaskEXT, _gloffset_SampleMaskSGIS, SampleMaskEXT@8, SampleMaskSGIS, SampleMaskSGIS@8) + GL_STUB_ALIAS(SamplePatternEXT, _gloffset_SamplePatternSGIS, SamplePatternEXT@4, SamplePatternSGIS, SamplePatternSGIS@4) + GL_STUB_ALIAS(PointParameterf, _gloffset_PointParameterfEXT, PointParameterf@8, PointParameterfEXT, PointParameterfEXT@8) + GL_STUB_ALIAS(PointParameterfARB, _gloffset_PointParameterfEXT, PointParameterfARB@8, PointParameterfEXT, PointParameterfEXT@8) + GL_STUB_ALIAS(PointParameterfSGIS, _gloffset_PointParameterfEXT, PointParameterfSGIS@8, PointParameterfEXT, PointParameterfEXT@8) + GL_STUB_ALIAS(PointParameterfv, _gloffset_PointParameterfvEXT, PointParameterfv@8, PointParameterfvEXT, PointParameterfvEXT@8) + GL_STUB_ALIAS(PointParameterfvARB, _gloffset_PointParameterfvEXT, PointParameterfvARB@8, PointParameterfvEXT, PointParameterfvEXT@8) + GL_STUB_ALIAS(PointParameterfvSGIS, _gloffset_PointParameterfvEXT, PointParameterfvSGIS@8, PointParameterfvEXT, PointParameterfvEXT@8) + GL_STUB_ALIAS(WindowPos2d, _gloffset_WindowPos2dMESA, WindowPos2d@16, WindowPos2dMESA, WindowPos2dMESA@16) + GL_STUB_ALIAS(WindowPos2dARB, _gloffset_WindowPos2dMESA, WindowPos2dARB@16, WindowPos2dMESA, WindowPos2dMESA@16) + GL_STUB_ALIAS(WindowPos2dv, _gloffset_WindowPos2dvMESA, WindowPos2dv@4, WindowPos2dvMESA, WindowPos2dvMESA@4) + GL_STUB_ALIAS(WindowPos2dvARB, _gloffset_WindowPos2dvMESA, WindowPos2dvARB@4, WindowPos2dvMESA, WindowPos2dvMESA@4) + GL_STUB_ALIAS(WindowPos2f, _gloffset_WindowPos2fMESA, WindowPos2f@8, WindowPos2fMESA, WindowPos2fMESA@8) + GL_STUB_ALIAS(WindowPos2fARB, _gloffset_WindowPos2fMESA, WindowPos2fARB@8, WindowPos2fMESA, WindowPos2fMESA@8) + GL_STUB_ALIAS(WindowPos2fv, _gloffset_WindowPos2fvMESA, WindowPos2fv@4, WindowPos2fvMESA, WindowPos2fvMESA@4) + GL_STUB_ALIAS(WindowPos2fvARB, _gloffset_WindowPos2fvMESA, WindowPos2fvARB@4, WindowPos2fvMESA, WindowPos2fvMESA@4) + GL_STUB_ALIAS(WindowPos2i, _gloffset_WindowPos2iMESA, WindowPos2i@8, WindowPos2iMESA, WindowPos2iMESA@8) + GL_STUB_ALIAS(WindowPos2iARB, _gloffset_WindowPos2iMESA, WindowPos2iARB@8, WindowPos2iMESA, WindowPos2iMESA@8) + GL_STUB_ALIAS(WindowPos2iv, _gloffset_WindowPos2ivMESA, WindowPos2iv@4, WindowPos2ivMESA, WindowPos2ivMESA@4) + GL_STUB_ALIAS(WindowPos2ivARB, _gloffset_WindowPos2ivMESA, WindowPos2ivARB@4, WindowPos2ivMESA, WindowPos2ivMESA@4) + GL_STUB_ALIAS(WindowPos2s, _gloffset_WindowPos2sMESA, WindowPos2s@8, WindowPos2sMESA, WindowPos2sMESA@8) + GL_STUB_ALIAS(WindowPos2sARB, _gloffset_WindowPos2sMESA, WindowPos2sARB@8, WindowPos2sMESA, WindowPos2sMESA@8) + GL_STUB_ALIAS(WindowPos2sv, _gloffset_WindowPos2svMESA, WindowPos2sv@4, WindowPos2svMESA, WindowPos2svMESA@4) + GL_STUB_ALIAS(WindowPos2svARB, _gloffset_WindowPos2svMESA, WindowPos2svARB@4, WindowPos2svMESA, WindowPos2svMESA@4) + GL_STUB_ALIAS(WindowPos3d, _gloffset_WindowPos3dMESA, WindowPos3d@24, WindowPos3dMESA, WindowPos3dMESA@24) + GL_STUB_ALIAS(WindowPos3dARB, _gloffset_WindowPos3dMESA, WindowPos3dARB@24, WindowPos3dMESA, WindowPos3dMESA@24) + GL_STUB_ALIAS(WindowPos3dv, _gloffset_WindowPos3dvMESA, WindowPos3dv@4, WindowPos3dvMESA, WindowPos3dvMESA@4) + GL_STUB_ALIAS(WindowPos3dvARB, _gloffset_WindowPos3dvMESA, WindowPos3dvARB@4, WindowPos3dvMESA, WindowPos3dvMESA@4) + GL_STUB_ALIAS(WindowPos3f, _gloffset_WindowPos3fMESA, WindowPos3f@12, WindowPos3fMESA, WindowPos3fMESA@12) + GL_STUB_ALIAS(WindowPos3fARB, _gloffset_WindowPos3fMESA, WindowPos3fARB@12, WindowPos3fMESA, WindowPos3fMESA@12) + GL_STUB_ALIAS(WindowPos3fv, _gloffset_WindowPos3fvMESA, WindowPos3fv@4, WindowPos3fvMESA, WindowPos3fvMESA@4) + GL_STUB_ALIAS(WindowPos3fvARB, _gloffset_WindowPos3fvMESA, WindowPos3fvARB@4, WindowPos3fvMESA, WindowPos3fvMESA@4) + GL_STUB_ALIAS(WindowPos3i, _gloffset_WindowPos3iMESA, WindowPos3i@12, WindowPos3iMESA, WindowPos3iMESA@12) + GL_STUB_ALIAS(WindowPos3iARB, _gloffset_WindowPos3iMESA, WindowPos3iARB@12, WindowPos3iMESA, WindowPos3iMESA@12) + GL_STUB_ALIAS(WindowPos3iv, _gloffset_WindowPos3ivMESA, WindowPos3iv@4, WindowPos3ivMESA, WindowPos3ivMESA@4) + GL_STUB_ALIAS(WindowPos3ivARB, _gloffset_WindowPos3ivMESA, WindowPos3ivARB@4, WindowPos3ivMESA, WindowPos3ivMESA@4) + GL_STUB_ALIAS(WindowPos3s, _gloffset_WindowPos3sMESA, WindowPos3s@12, WindowPos3sMESA, WindowPos3sMESA@12) + GL_STUB_ALIAS(WindowPos3sARB, _gloffset_WindowPos3sMESA, WindowPos3sARB@12, WindowPos3sMESA, WindowPos3sMESA@12) + GL_STUB_ALIAS(WindowPos3sv, _gloffset_WindowPos3svMESA, WindowPos3sv@4, WindowPos3svMESA, WindowPos3svMESA@4) + GL_STUB_ALIAS(WindowPos3svARB, _gloffset_WindowPos3svMESA, WindowPos3svARB@4, WindowPos3svMESA, WindowPos3svMESA@4) + GL_STUB_ALIAS(BlendFuncSeparate, _gloffset_BlendFuncSeparateEXT, BlendFuncSeparate@16, BlendFuncSeparateEXT, BlendFuncSeparateEXT@16) + GL_STUB_ALIAS(BlendFuncSeparateINGR, _gloffset_BlendFuncSeparateEXT, BlendFuncSeparateINGR@16, BlendFuncSeparateEXT, BlendFuncSeparateEXT@16) + GL_STUB_ALIAS(FogCoordf, _gloffset_FogCoordfEXT, FogCoordf@4, FogCoordfEXT, FogCoordfEXT@4) + GL_STUB_ALIAS(FogCoordfv, _gloffset_FogCoordfvEXT, FogCoordfv@4, FogCoordfvEXT, FogCoordfvEXT@4) + GL_STUB_ALIAS(FogCoordd, _gloffset_FogCoorddEXT, FogCoordd@8, FogCoorddEXT, FogCoorddEXT@8) + GL_STUB_ALIAS(FogCoorddv, _gloffset_FogCoorddvEXT, FogCoorddv@4, FogCoorddvEXT, FogCoorddvEXT@4) + GL_STUB_ALIAS(FogCoordPointer, _gloffset_FogCoordPointerEXT, FogCoordPointer@12, FogCoordPointerEXT, FogCoordPointerEXT@12) + GL_STUB_ALIAS(CompressedTexImage3D, _gloffset_CompressedTexImage3DARB, CompressedTexImage3D@36, CompressedTexImage3DARB, CompressedTexImage3DARB@36) + GL_STUB_ALIAS(CompressedTexImage2D, _gloffset_CompressedTexImage2DARB, CompressedTexImage2D@32, CompressedTexImage2DARB, CompressedTexImage2DARB@32) + GL_STUB_ALIAS(CompressedTexImage1D, _gloffset_CompressedTexImage1DARB, CompressedTexImage1D@28, CompressedTexImage1DARB, CompressedTexImage1DARB@28) + GL_STUB_ALIAS(CompressedTexSubImage3D, _gloffset_CompressedTexSubImage3DARB, CompressedTexSubImage3D@44, CompressedTexSubImage3DARB, CompressedTexSubImage3DARB@44) + GL_STUB_ALIAS(CompressedTexSubImage2D, _gloffset_CompressedTexSubImage2DARB, CompressedTexSubImage2D@36, CompressedTexSubImage2DARB, CompressedTexSubImage2DARB@36) + GL_STUB_ALIAS(CompressedTexSubImage1D, _gloffset_CompressedTexSubImage1DARB, CompressedTexSubImage1D@28, CompressedTexSubImage1DARB, CompressedTexSubImage1DARB@28) + GL_STUB_ALIAS(GetCompressedTexImage, _gloffset_GetCompressedTexImageARB, GetCompressedTexImage@12, GetCompressedTexImageARB, GetCompressedTexImageARB@12) + GL_STUB_ALIAS(SecondaryColor3b, _gloffset_SecondaryColor3bEXT, SecondaryColor3b@12, SecondaryColor3bEXT, SecondaryColor3bEXT@12) + GL_STUB_ALIAS(SecondaryColor3bv, _gloffset_SecondaryColor3bvEXT, SecondaryColor3bv@4, SecondaryColor3bvEXT, SecondaryColor3bvEXT@4) + GL_STUB_ALIAS(SecondaryColor3d, _gloffset_SecondaryColor3dEXT, SecondaryColor3d@24, SecondaryColor3dEXT, SecondaryColor3dEXT@24) + GL_STUB_ALIAS(SecondaryColor3dv, _gloffset_SecondaryColor3dvEXT, SecondaryColor3dv@4, SecondaryColor3dvEXT, SecondaryColor3dvEXT@4) + GL_STUB_ALIAS(SecondaryColor3f, _gloffset_SecondaryColor3fEXT, SecondaryColor3f@12, SecondaryColor3fEXT, SecondaryColor3fEXT@12) + GL_STUB_ALIAS(SecondaryColor3fv, _gloffset_SecondaryColor3fvEXT, SecondaryColor3fv@4, SecondaryColor3fvEXT, SecondaryColor3fvEXT@4) + GL_STUB_ALIAS(SecondaryColor3i, _gloffset_SecondaryColor3iEXT, SecondaryColor3i@12, SecondaryColor3iEXT, SecondaryColor3iEXT@12) + GL_STUB_ALIAS(SecondaryColor3iv, _gloffset_SecondaryColor3ivEXT, SecondaryColor3iv@4, SecondaryColor3ivEXT, SecondaryColor3ivEXT@4) + GL_STUB_ALIAS(SecondaryColor3s, _gloffset_SecondaryColor3sEXT, SecondaryColor3s@12, SecondaryColor3sEXT, SecondaryColor3sEXT@12) + GL_STUB_ALIAS(SecondaryColor3sv, _gloffset_SecondaryColor3svEXT, SecondaryColor3sv@4, SecondaryColor3svEXT, SecondaryColor3svEXT@4) + GL_STUB_ALIAS(SecondaryColor3ub, _gloffset_SecondaryColor3ubEXT, SecondaryColor3ub@12, SecondaryColor3ubEXT, SecondaryColor3ubEXT@12) + GL_STUB_ALIAS(SecondaryColor3ubv, _gloffset_SecondaryColor3ubvEXT, SecondaryColor3ubv@4, SecondaryColor3ubvEXT, SecondaryColor3ubvEXT@4) + GL_STUB_ALIAS(SecondaryColor3ui, _gloffset_SecondaryColor3uiEXT, SecondaryColor3ui@12, SecondaryColor3uiEXT, SecondaryColor3uiEXT@12) + GL_STUB_ALIAS(SecondaryColor3uiv, _gloffset_SecondaryColor3uivEXT, SecondaryColor3uiv@4, SecondaryColor3uivEXT, SecondaryColor3uivEXT@4) + GL_STUB_ALIAS(SecondaryColor3us, _gloffset_SecondaryColor3usEXT, SecondaryColor3us@12, SecondaryColor3usEXT, SecondaryColor3usEXT@12) + GL_STUB_ALIAS(SecondaryColor3usv, _gloffset_SecondaryColor3usvEXT, SecondaryColor3usv@4, SecondaryColor3usvEXT, SecondaryColor3usvEXT@4) + GL_STUB_ALIAS(SecondaryColorPointer, _gloffset_SecondaryColorPointerEXT, SecondaryColorPointer@16, SecondaryColorPointerEXT, SecondaryColorPointerEXT@16) + GL_STUB_ALIAS(BindProgramARB, _gloffset_BindProgramNV, BindProgramARB@8, BindProgramNV, BindProgramNV@8) + GL_STUB_ALIAS(DeleteProgramsARB, _gloffset_DeleteProgramsNV, DeleteProgramsARB@8, DeleteProgramsNV, DeleteProgramsNV@8) + GL_STUB_ALIAS(GenProgramsARB, _gloffset_GenProgramsNV, GenProgramsARB@8, GenProgramsNV, GenProgramsNV@8) + GL_STUB_ALIAS(GetVertexAttribPointervARB, _gloffset_GetVertexAttribPointervNV, GetVertexAttribPointervARB@12, GetVertexAttribPointervNV, GetVertexAttribPointervNV@12) + GL_STUB_ALIAS(IsProgramARB, _gloffset_IsProgramNV, IsProgramARB@4, IsProgramNV, IsProgramNV@4) + GL_STUB_ALIAS(PointParameteri, _gloffset_PointParameteriNV, PointParameteri@8, PointParameteriNV, PointParameteriNV@8) + GL_STUB_ALIAS(PointParameteriv, _gloffset_PointParameterivNV, PointParameteriv@8, PointParameterivNV, PointParameterivNV@8) + GL_STUB_ALIAS(MultiDrawArrays, _gloffset_MultiDrawArraysEXT, MultiDrawArrays@16, MultiDrawArraysEXT, MultiDrawArraysEXT@16) + GL_STUB_ALIAS(MultiDrawElements, _gloffset_MultiDrawElementsEXT, MultiDrawElements@20, MultiDrawElementsEXT, MultiDrawElementsEXT@20) + GL_STUB_ALIAS(BindBuffer, _gloffset_BindBufferARB, BindBuffer@8, BindBufferARB, BindBufferARB@8) + GL_STUB_ALIAS(BufferData, _gloffset_BufferDataARB, BufferData@16, BufferDataARB, BufferDataARB@16) + GL_STUB_ALIAS(BufferSubData, _gloffset_BufferSubDataARB, BufferSubData@16, BufferSubDataARB, BufferSubDataARB@16) + GL_STUB_ALIAS(DeleteBuffers, _gloffset_DeleteBuffersARB, DeleteBuffers@8, DeleteBuffersARB, DeleteBuffersARB@8) + GL_STUB_ALIAS(GenBuffers, _gloffset_GenBuffersARB, GenBuffers@8, GenBuffersARB, GenBuffersARB@8) + GL_STUB_ALIAS(GetBufferParameteriv, _gloffset_GetBufferParameterivARB, GetBufferParameteriv@12, GetBufferParameterivARB, GetBufferParameterivARB@12) + GL_STUB_ALIAS(GetBufferPointerv, _gloffset_GetBufferPointervARB, GetBufferPointerv@12, GetBufferPointervARB, GetBufferPointervARB@12) + GL_STUB_ALIAS(GetBufferSubData, _gloffset_GetBufferSubDataARB, GetBufferSubData@16, GetBufferSubDataARB, GetBufferSubDataARB@16) + GL_STUB_ALIAS(IsBuffer, _gloffset_IsBufferARB, IsBuffer@4, IsBufferARB, IsBufferARB@4) + GL_STUB_ALIAS(MapBuffer, _gloffset_MapBufferARB, MapBuffer@8, MapBufferARB, MapBufferARB@8) + GL_STUB_ALIAS(UnmapBuffer, _gloffset_UnmapBufferARB, UnmapBuffer@4, UnmapBufferARB, UnmapBufferARB@4) + GL_STUB_ALIAS(GenQueries, _gloffset_GenQueriesARB, GenQueries@8, GenQueriesARB, GenQueriesARB@8) + GL_STUB_ALIAS(DeleteQueries, _gloffset_DeleteQueriesARB, DeleteQueries@8, DeleteQueriesARB, DeleteQueriesARB@8) + GL_STUB_ALIAS(IsQuery, _gloffset_IsQueryARB, IsQuery@4, IsQueryARB, IsQueryARB@4) + GL_STUB_ALIAS(BeginQuery, _gloffset_BeginQueryARB, BeginQuery@8, BeginQueryARB, BeginQueryARB@8) + GL_STUB_ALIAS(EndQuery, _gloffset_EndQueryARB, EndQuery@4, EndQueryARB, EndQueryARB@4) + GL_STUB_ALIAS(GetQueryiv, _gloffset_GetQueryivARB, GetQueryiv@12, GetQueryivARB, GetQueryivARB@12) + GL_STUB_ALIAS(GetQueryObjectiv, _gloffset_GetQueryObjectivARB, GetQueryObjectiv@12, GetQueryObjectivARB, GetQueryObjectivARB@12) + GL_STUB_ALIAS(GetQueryObjectuiv, _gloffset_GetQueryObjectuivARB, GetQueryObjectuiv@12, GetQueryObjectuivARB, GetQueryObjectuivARB@12) + GL_STUB_ALIAS(BlendEquationSeparateATI, _gloffset_BlendEquationSeparateEXT, BlendEquationSeparateATI@8, BlendEquationSeparateEXT, BlendEquationSeparateEXT@8) + + GLOBL GLNAME(gl_dispatch_functions_end) + HIDDEN(GLNAME(gl_dispatch_functions_end)) + ALIGNTEXT16 +GLNAME(gl_dispatch_functions_end): + +#if defined(GLX_USE_TLS) && defined(__linux__) + .section ".note.ABI-tag", "a" + .p2align 2 + .long 1f - 0f /* name length */ + .long 3f - 2f /* data length */ + .long 1 /* note length */ +0: .asciz "GNU" /* vendor name */ +1: .p2align 2 +2: .long 0 /* note data: the ABI tag */ + .long 2,4,20 /* Minimum kernel version w/TLS */ +3: .p2align 2 /* pad out section */ +#endif /* GLX_USE_TLS */ diff --git a/reactos/dll/mesa32/src/x86/matypes.h b/reactos/dll/mesa32/src/x86/matypes.h new file mode 100644 index 00000000000..5042b6aee51 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/matypes.h @@ -0,0 +1,165 @@ +/* + * This file is automatically generated from the Mesa internal type + * definitions. Do not edit directly. + */ + +#ifndef __ASM_TYPES_H__ +#define __ASM_TYPES_H__ + +#include "assyntax.h" + + +/* ============================================================= + * Offsets for GLcontext + */ + +#define CTX_DRIVER_CTX 908 + +#define CTX_LIGHT_ENABLED 38596 +#define CTX_LIGHT_SHADE_MODEL 38600 +#define CTX_LIGHT_COLOR_MAT_FACE 38604 +#define CTX_LIGHT_COLOR_MAT_MODE 38608 +#define CTX_LIGHT_COLOR_MAT_MASK 38612 +#define CTX_LIGHT_COLOR_MAT_ENABLED 38616 +#define CTX_LIGHT_ENABLED_LIST 38620 +#define CTX_LIGHT_NEED_VERTS 42977 +#define CTX_LIGHT_FLAGS 42980 +#define CTX_LIGHT_BASE_COLOR 42984 + + +/* ============================================================= + * Offsets for struct vertex_buffer + */ + +#define VB_SIZE 0 +#define VB_COUNT 4 + +#define VB_ELTS 8 +#define VB_OBJ_PTR 12 +#define VB_EYE_PTR 16 +#define VB_CLIP_PTR 20 +#define VB_PROJ_CLIP_PTR 24 +#define VB_CLIP_OR_MASK 28 +#define VB_CLIP_MASK 32 +#define VB_NORMAL_PTR 36 +#define VB_EDGE_FLAG 44 +#define VB_TEX0_COORD_PTR 48 +#define VB_TEX1_COORD_PTR 52 +#define VB_TEX2_COORD_PTR 56 +#define VB_TEX3_COORD_PTR 60 +#define VB_INDEX_PTR 80 +#define VB_COLOR_PTR 88 +#define VB_SECONDARY_COLOR_PTR 96 +#define VB_FOG_COORD_PTR 108 +#define VB_POINT_SIZE_PTR 104 +#define VB_PRIMITIVE 112 + +#define VB_LAST_CLIPPED 244 + +/* + * Flags for struct vertex_buffer + */ + +#define VERT_BIT_OBJ 0x1 +#define VERT_BIT_NORM 0x4 +#define VERT_BIT_RGBA 0x8 +#define VERT_BIT_SPEC_RGB 0x10 +#define VERT_BIT_FOG_COORD 0x20 +#define VERT_BIT_TEX0 0x100 +#define VERT_BIT_TEX1 0x200 +#define VERT_BIT_TEX2 0x400 +#define VERT_BIT_TEX3 0x800 + + +/* ============================================================= + * Offsets for GLvector4f + */ + +#define V4F_DATA 0 +#define V4F_START 4 +#define V4F_COUNT 8 +#define V4F_STRIDE 12 +#define V4F_SIZE 16 +#define V4F_FLAGS 20 + +/* + * Flags for GLvector4f + */ + +#define VEC_MALLOC 0x10 +#define VEC_NOT_WRITEABLE 0x40 +#define VEC_BAD_STRIDE 0x100 + +#define VEC_SIZE_1 0x1 +#define VEC_SIZE_2 0x3 +#define VEC_SIZE_3 0x7 +#define VEC_SIZE_4 0xf + + +/* ============================================================= + * Offsets for GLmatrix + */ + +#define MATRIX_DATA 0 +#define MATRIX_INV 4 +#define MATRIX_FLAGS 8 +#define MATRIX_TYPE 12 + + +/* ============================================================= + * Offsets for struct gl_light + */ + +#define LIGHT_NEXT 0 +#define LIGHT_PREV 4 + +#define LIGHT_AMBIENT 8 +#define LIGHT_DIFFUSE 24 +#define LIGHT_SPECULAR 40 +#define LIGHT_EYE_POSITION 56 +#define LIGHT_EYE_DIRECTION 72 +#define LIGHT_SPOT_EXPONENT 88 +#define LIGHT_SPOT_CUTOFF 92 +#define LIGHT_COS_CUTOFF 96 +#define LIGHT_CONST_ATTEN 100 +#define LIGHT_LINEAR_ATTEN 104 +#define LIGHT_QUADRATIC_ATTEN 108 +#define LIGHT_ENABLED 112 + +#define LIGHT_FLAGS 116 + +#define LIGHT_POSITION 120 +#define LIGHT_VP_INF_NORM 136 +#define LIGHT_H_INF_NORM 148 +#define LIGHT_NORM_DIRECTION 160 +#define LIGHT_VP_INF_SPOT_ATTEN 176 + +#define LIGHT_SPOT_EXP_TABLE 180 +#define LIGHT_MAT_AMBIENT 4276 +#define LIGHT_MAT_DIFFUSE 4300 +#define LIGHT_MAT_SPECULAR 4324 + +#define SIZEOF_GL_LIGHT 4356 + +/* + * Flags for struct gl_light + */ + +#define LIGHT_SPOT 0x1 +#define LIGHT_LOCAL_VIEWER 0x2 +#define LIGHT_POSITIONAL 0x4 + +#define LIGHT_NEED_VERTICES 0x6 + + +/* ============================================================= + * Offsets for struct gl_lightmodel + */ + +#define LIGHT_MODEL_AMBIENT 0 +#define LIGHT_MODEL_LOCAL_VIEWER 16 +#define LIGHT_MODEL_TWO_SIDE 17 +#define LIGHT_MODEL_COLOR_CONTROL 20 + + +#endif /* __ASM_TYPES_H__ */ diff --git a/reactos/dll/mesa32/src/x86/mmx.h b/reactos/dll/mesa32/src/x86/mmx.h new file mode 100644 index 00000000000..11f78635ae9 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/mmx.h @@ -0,0 +1,51 @@ +/* $Id: mmx.h,v 1.9 2002/04/19 20:12:30 jrfonseca Exp $ */ + +/* + * 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 ASM_MMX_H +#define ASM_MMX_H + +extern void _ASMAPI +_mesa_mmx_blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[], + GLubyte rgba[][4], const GLubyte dest[][4] ); + +extern void _ASMAPI +_mesa_mmx_blend_add( GLcontext *ctx, GLuint n, const GLubyte mask[], + GLubyte rgba[][4], const GLubyte dest[][4] ); + +extern void _ASMAPI +_mesa_mmx_blend_min( GLcontext *ctx, GLuint n, const GLubyte mask[], + GLubyte rgba[][4], const GLubyte dest[][4] ); + +extern void _ASMAPI +_mesa_mmx_blend_max( GLcontext *ctx, GLuint n, const GLubyte mask[], + GLubyte rgba[][4], const GLubyte dest[][4] ); + +extern void _ASMAPI +_mesa_mmx_blend_modulate( GLcontext *ctx, GLuint n, const GLubyte mask[], + GLubyte rgba[][4], const GLubyte dest[][4] ); + +#endif diff --git a/reactos/dll/mesa32/src/x86/mmx_blend.S b/reactos/dll/mesa32/src/x86/mmx_blend.S new file mode 100644 index 00000000000..f7326cdbe6b --- /dev/null +++ b/reactos/dll/mesa32/src/x86/mmx_blend.S @@ -0,0 +1,366 @@ + +/* + * Written by José Fonseca + */ + + +#ifdef USE_MMX_ASM +#include "matypes.h" + +/* integer multiplication - alpha plus one + * + * makes the following approximation to the division (Sree) + * + * rgb*a/255 ~= (rgb*(a+1)) >> 256 + * + * which is the fastest method that satisfies the following OpenGL criteria + * + * 0*0 = 0 and 255*255 = 255 + * + * note that MX1 is a register with 0xffffffffffffffff constant which can be easily obtained making + * + * PCMPEQW ( MX1, MX1 ) + */ +#define GMB_MULT_AP1( MP1, MA1, MP2, MA2, MX1 ) \ + PSUBW ( MX1, MA1 ) /* a1 + 1 | a1 + 1 | a1 + 1 | a1 + 1 */ ;\ + PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ + ;\ +TWO(PSUBW ( MX1, MA2 )) /* a2 + 1 | a2 + 1 | a2 + 1 | a2 + 1 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ + ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 ~= t1/255 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 ~= t2/255 */ + + +/* integer multiplication - geometric series + * + * takes the geometric series approximation to the division + * + * t/255 = (t >> 8) + (t >> 16) + (t >> 24) .. + * + * in this case just the first two terms to fit in 16bit arithmetic + * + * t/255 ~= (t + (t >> 8)) >> 8 + * + * note that just by itself it doesn't satisfies the OpenGL criteria, as 255*255 = 254, + * so the special case a = 255 must be accounted or roundoff must be used + */ +#define GMB_MULT_GS( MP1, MA1, MP2, MA2 ) \ + PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ + ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* integer multiplication - geometric series plus rounding + * + * when using a geometric series division instead of truncating the result + * use roundoff in the approximation (Jim Blinn) + * + * t = rgb*a + 0x80 + * + * achieving the exact results + * + * note that M80 is register with the 0x0080008000800080 constant + */ +#define GMB_MULT_GSR( MP1, MA1, MP2, MA2, M80 ) \ + PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ + PADDW ( M80, MA1 ) /* t1 += 0x80 */ ;\ + ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ +TWO(PADDW ( M80, MA2 )) /* t2 += 0x80 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ + ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* linear interpolation - geometric series + */ +#define GMB_LERP_GS( MP1, MQ1, MA1, MP2, MQ2, MA2) \ + PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ + PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ + PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ + ;\ +TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ +TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ + ;\ + PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ +TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ + ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* linear interpolation - geometric series with roundoff + * + * this is a generalization of Blinn's formula to signed arithmetic + * + * note that M80 is a register with the 0x0080008000800080 constant + */ +#define GMB_LERP_GSR( MP1, MQ1, MA1, MP2, MQ2, MA2, M80) \ + PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ + PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ + PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ + ;\ +TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ +TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ + ;\ + PSRLW ( CONST(15), MP1 ) /* q1 > p1 ? 1 : 0 */ ;\ +TWO(PSRLW ( CONST(15), MP2 )) /* q2 > q2 ? 1 : 0 */ ;\ + ;\ + PSLLW ( CONST(8), MP1 ) /* q1 > p1 ? 0x100 : 0 */ ;\ +TWO(PSLLW ( CONST(8), MP2 )) /* q2 > q2 ? 0x100 : 0 */ ;\ + ;\ + PSUBW ( MP1, MA1 ) /* t1 -=? 0x100 */ ;\ +TWO(PSUBW ( MP2, MA2 )) /* t2 -=? 0x100 */ ;\ + ;\ + PADDW ( M80, MA1 ) /* t1 += 0x80 */ ;\ +TWO(PADDW ( M80, MA2 )) /* t2 += 0x80 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ + ;\ + PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ +TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ + ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* linear interpolation - geometric series with correction + * + * instead of the roundoff this adds a small correction to satisfy the OpenGL criteria + * + * t/255 ~= (t + (t >> 8) + (t >> 15)) >> 8 + * + * note that although is faster than rounding off it doesn't give always the exact results + */ +#define GMB_LERP_GSC( MP1, MQ1, MA1, MP2, MQ2, MA2) \ + PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ + PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ + PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ + ;\ +TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ +TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MA1, MP1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ + PSRLW ( CONST(7), MA1 ) /* t1 >> 15 */ ;\ + ;\ +TWO(PADDW ( MA2, MP2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ +TWO(PSRLW ( CONST(7), MA2 )) /* t2 >> 15 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) + (t1 >>15) ~= (t1/255) << 8 */ ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) + (t2 >>15) ~= (t2/255) << 8 */ ;\ + ;\ + PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ +TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ + ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* common blending setup code + * + * note that M00 is a register with 0x0000000000000000 constant which can be easily obtained making + * + * PXOR ( M00, M00 ) + */ +#define GMB_LOAD(rgba, dest, MPP, MQQ) \ +ONE(MOVD ( REGIND(rgba), MPP )) /* | | | | qa1 | qb1 | qg1 | qr1 */ ;\ +ONE(MOVD ( REGIND(dest), MQQ )) /* | | | | pa1 | pb1 | pg1 | pr1 */ ;\ + ;\ +TWO(MOVQ ( REGIND(rgba), MPP )) /* qa2 | qb2 | qg2 | qr2 | qa1 | qb1 | qg1 | qr1 */ ;\ +TWO(MOVQ ( REGIND(dest), MQQ )) /* pa2 | pb2 | pg2 | pr2 | pa1 | pb1 | pg1 | pr1 */ + +#define GMB_UNPACK(MP1, MQ1, MP2, MQ2, M00) \ +TWO(MOVQ ( MP1, MP2 )) ;\ +TWO(MOVQ ( MQ1, MQ2 )) ;\ + ;\ + PUNPCKLBW ( M00, MQ1 ) /* qa1 | qb1 | qg1 | qr1 */ ;\ +TWO(PUNPCKHBW ( M00, MQ2 )) /* qa2 | qb2 | qg2 | qr2 */ ;\ + PUNPCKLBW ( M00, MP1 ) /* pa1 | pb1 | pg1 | pr1 */ ;\ +TWO(PUNPCKHBW ( M00, MP2 )) /* pa2 | pb2 | pg2 | pr2 */ + +#define GMB_ALPHA(MP1, MA1, MP2, MA2) \ + MOVQ ( MP1, MA1 ) ;\ +TWO(MOVQ ( MP2, MA2 )) ;\ + ;\ + PUNPCKHWD ( MA1, MA1 ) /* pa1 | pa1 | | */ ;\ +TWO(PUNPCKHWD ( MA2, MA2 )) /* pa2 | pa2 | | */ ;\ + PUNPCKHDQ ( MA1, MA1 ) /* pa1 | pa1 | pa1 | pa1 */ ;\ +TWO(PUNPCKHDQ ( MA2, MA2 )) /* pa2 | pa2 | pa2 | pa2 */ + +#define GMB_PACK( MS1, MS2 ) \ + PACKUSWB ( MS2, MS1 ) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ ;\ + +#define GMB_STORE(rgba, MSS ) \ +ONE(MOVD ( MSS, REGIND(rgba) )) /* | | | | sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(MOVQ ( MSS, REGIND(rgba) )) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ + + + SEG_DATA + +ALIGNDATA8 +const_0080: + D_LONG 0x00800080, 0x00800080 + +const_80: + D_LONG 0x80808080, 0x80808080 + + SEG_TEXT + + +/* Blend transparency function + */ + +#define TAG(x) CONCAT(x,_transparency) +#define LLTAG(x) LLBL2(x,_transparency) + +#define INIT \ + PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ + +#define MAIN( rgba, dest ) \ + GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ + GMB_UNPACK( MM1, MM2, MM4, MM5, MM0 ) ;\ + GMB_ALPHA( MM1, MM3, MM4, MM6 ) ;\ + GMB_LERP_GSC( MM1, MM2, MM3, MM4, MM5, MM6 ) ;\ + GMB_PACK( MM3, MM6 ) ;\ + GMB_STORE( rgba, MM3 ) + +#include "mmx_blendtmp.h" + + +/* Blend add function + * + * FIXME: Add some loop unrolling here... + */ + +#define TAG(x) CONCAT(x,_add) +#define LLTAG(x) LLBL2(x,_add) + +#define INIT + +#define MAIN( rgba, dest ) \ +ONE(MOVD ( REGIND(rgba), MM1 )) /* | | | | qa1 | qb1 | qg1 | qr1 */ ;\ +ONE(MOVD ( REGIND(dest), MM2 )) /* | | | | pa1 | pb1 | pg1 | pr1 */ ;\ +ONE(PADDUSB ( MM2, MM1 )) ;\ +ONE(MOVD ( MM1, REGIND(rgba) )) /* | | | | sa1 | sb1 | sg1 | sr1 */ ;\ + ;\ +TWO(MOVQ ( REGIND(rgba), MM1 )) /* qa2 | qb2 | qg2 | qr2 | qa1 | qb1 | qg1 | qr1 */ ;\ +TWO(PADDUSB ( REGIND(dest), MM1 )) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(MOVQ ( MM1, REGIND(rgba) )) + +#include "mmx_blendtmp.h" + + +/* Blend min function + */ + +#define TAG(x) CONCAT(x,_min) +#define LLTAG(x) LLBL2(x,_min) + +#define INIT \ + MOVQ ( CONTENT(const_80), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/ + +#define MAIN( rgba, dest ) \ + GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ + MOVQ ( MM1, MM3 ) ;\ + MOVQ ( MM2, MM4 ) ;\ + PXOR ( MM7, MM3 ) /* unsigned -> signed */ ;\ + PXOR ( MM7, MM4 ) /* unsigned -> signed */ ;\ + PCMPGTB ( MM3, MM4 ) /* q > p ? 0xff : 0x00 */ ;\ + PAND ( MM4, MM1 ) /* q > p ? p : 0 */ ;\ + PANDN ( MM2, MM4 ) /* q > p ? 0 : q */ ;\ + POR ( MM1, MM4 ) /* q > p ? p : q */ ;\ + GMB_STORE( rgba, MM4 ) + +#include "mmx_blendtmp.h" + + +/* Blend max function + */ + +#define TAG(x) CONCAT(x,_max) +#define LLTAG(x) LLBL2(x,_max) + +#define INIT \ + MOVQ ( CONTENT(const_80), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/ + +#define MAIN( rgba, dest ) \ + GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ + MOVQ ( MM1, MM3 ) ;\ + MOVQ ( MM2, MM4 ) ;\ + PXOR ( MM7, MM3 ) /* unsigned -> signed */ ;\ + PXOR ( MM7, MM4 ) /* unsigned -> signed */ ;\ + PCMPGTB ( MM3, MM4 ) /* q > p ? 0xff : 0x00 */ ;\ + PAND ( MM4, MM2 ) /* q > p ? q : 0 */ ;\ + PANDN ( MM1, MM4 ) /* q > p ? 0 : p */ ;\ + POR ( MM2, MM4 ) /* q > p ? p : q */ ;\ + GMB_STORE( rgba, MM4 ) + +#include "mmx_blendtmp.h" + + +/* Blend modulate function + */ + +#define TAG(x) CONCAT(x,_modulate) +#define LLTAG(x) LLBL2(x,_modulate) + +#define INIT \ + PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ ;\ + MOVQ ( CONTENT(const_0080), MM7 ) /* 0x0080 | 0x0080 | 0x0080 | 0x0080 */ + +#define MAIN( rgba, dest ) \ + GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ + GMB_UNPACK( MM1, MM2, MM4, MM5, MM0 ) ;\ + GMB_MULT_GSR( MM1, MM2, MM4, MM5, MM7 ) ;\ + GMB_PACK( MM2, MM5 ) ;\ + GMB_STORE( rgba, MM2 ) + +#include "mmx_blendtmp.h" + +#endif diff --git a/reactos/dll/mesa32/src/x86/mmx_blendtmp.h b/reactos/dll/mesa32/src/x86/mmx_blendtmp.h new file mode 100644 index 00000000000..c2fdeb62b3b --- /dev/null +++ b/reactos/dll/mesa32/src/x86/mmx_blendtmp.h @@ -0,0 +1,114 @@ +/* + * Written by José Fonseca + */ + + +/* + * void _mesa_mmx_blend( GLcontext *ctx, + * GLuint n, + * const GLubyte mask[], + * GLchan rgba[][4], + * CONST GLchan dest[][4] ) + * + */ +ALIGNTEXT16 +GLOBL GLNAME( TAG(_mesa_mmx_blend) ) +HIDDEN( TAG(_mesa_mmx_blend) ) +GLNAME( TAG(_mesa_mmx_blend) ): + + PUSH_L ( EBP ) + MOV_L ( ESP, EBP ) + PUSH_L ( ESI ) + PUSH_L ( EDI ) + PUSH_L ( EBX ) + + MOV_L ( REGOFF(12, EBP), ECX ) /* n */ + CMP_L ( CONST(0), ECX) + JE ( LLTAG(GMB_return) ) + + MOV_L ( REGOFF(16, EBP), EBX ) /* mask */ + MOV_L ( REGOFF(20, EBP), EDI ) /* rgba */ + MOV_L ( REGOFF(24, EBP), ESI ) /* dest */ + + INIT + + TEST_L ( CONST(4), EDI ) /* align rgba on an 8-byte boundary */ + JZ ( LLTAG(GMB_align_end) ) + + CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */ + JE ( LLTAG(GMB_align_continue) ) + + /* runin */ +#define ONE(x) x +#define TWO(x) + MAIN ( EDI, ESI ) +#undef ONE +#undef TWO + +LLTAG(GMB_align_continue): + + DEC_L ( ECX ) /* n -= 1 */ + INC_L ( EBX ) /* mask += 1 */ + ADD_L ( CONST(4), EDI ) /* rgba += 1 */ + ADD_L ( CONST(4), ESI ) /* dest += 1 */ + +LLTAG(GMB_align_end): + + CMP_L ( CONST(2), ECX) + JB ( LLTAG(GMB_loop_end) ) + +ALIGNTEXT16 +LLTAG(GMB_loop_begin): + + CMP_W ( CONST(0), REGIND(EBX) ) /* *mask == 0 && *(mask + 1) == 0 */ + JE ( LLTAG(GMB_loop_continue) ) + + /* main loop */ +#define ONE(x) +#define TWO(x) x + MAIN ( EDI, ESI ) +#undef ONE +#undef TWO + +LLTAG(GMB_loop_continue): + + DEC_L ( ECX ) + DEC_L ( ECX ) /* n -= 2 */ + ADD_L ( CONST(2), EBX ) /* mask += 2 */ + ADD_L ( CONST(8), EDI ) /* rgba += 2 */ + ADD_L ( CONST(8), ESI ) /* dest += 2 */ + CMP_L ( CONST(2), ECX ) + JAE ( LLTAG(GMB_loop_begin) ) + +LLTAG(GMB_loop_end): + + CMP_L ( CONST(1), ECX ) + JB ( LLTAG(GMB_done) ) + + CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */ + JE ( LLTAG(GMB_done) ) + + /* runout */ +#define ONE(x) x +#define TWO(x) + MAIN ( EDI, ESI ) +#undef ONE +#undef TWO + +LLTAG(GMB_done): + + EMMS + +LLTAG(GMB_return): + + POP_L ( EBX ) + POP_L ( EDI ) + POP_L ( ESI ) + MOV_L ( EBP, ESP ) + POP_L ( EBP ) + RET + +#undef TAG +#undef LLTAG +#undef INIT +#undef MAIN diff --git a/reactos/dll/mesa32/src/x86/norm_args.h b/reactos/dll/mesa32/src/x86/norm_args.h new file mode 100644 index 00000000000..1b43d57a202 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/norm_args.h @@ -0,0 +1,58 @@ +/* $Id: norm_args.h,v 1.4 2003/11/26 08:32:36 dborca Exp $ */ + +/* + * 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. + */ + +/* + * Normal transform function interface for assembly code. Simply define + * FRAME_OFFSET to the number of bytes pushed onto the stack before + * using the ARG_* argument macros. + * + * Gareth Hughes + */ + +#ifndef __NORM_ARGS_H__ +#define __NORM_ARGS_H__ + +/* Offsets for normal_func arguments + * + * typedef void (*normal_func)( CONST GLmatrix *mat, + * GLfloat scale, + * CONST GLvector4f *in, + * CONST GLfloat lengths[], + * GLvector4f *dest ); + */ +#define OFFSET_MAT 4 +#define OFFSET_SCALE 8 +#define OFFSET_IN 12 +#define OFFSET_LENGTHS 16 +#define OFFSET_DEST 20 + +#define ARG_MAT REGOFF(FRAME_OFFSET+OFFSET_MAT, ESP) +#define ARG_SCALE REGOFF(FRAME_OFFSET+OFFSET_SCALE, ESP) +#define ARG_IN REGOFF(FRAME_OFFSET+OFFSET_IN, ESP) +#define ARG_LENGTHS REGOFF(FRAME_OFFSET+OFFSET_LENGTHS, ESP) +#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) + +#endif diff --git a/reactos/dll/mesa32/src/x86/read_rgba_span_x86.S b/reactos/dll/mesa32/src/x86/read_rgba_span_x86.S new file mode 100644 index 00000000000..6b8036e5b8d --- /dev/null +++ b/reactos/dll/mesa32/src/x86/read_rgba_span_x86.S @@ -0,0 +1,689 @@ +/* + * (C) Copyright IBM Corporation 2004 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * 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 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. + */ + +/** + * \file read_rgba_span_x86.S + * Optimized routines to transfer pixel data from the framebuffer to a + * buffer in main memory. + * + * \author Ian Romanick + */ + + .file "read_rgba_span_x86.S" +#if !defined(__DJGPP__) && !defined(__MINGW32__) /* this one cries for assyntax.h */ + .section .rodata + .align 16 + .type mask, @object + .size mask, 32 +mask: + .long 0xff00ff00 + .long 0xff00ff00 + .long 0xff00ff00 + .long 0xff00ff00 + .long 0x00ff0000 + .long 0x00ff0000 + .long 0x00ff0000 + .long 0x00ff0000 + + +/* I implemented these as macros because the appear in quite a few places, + * and I've tweaked them a number of times. I got tired of changing every + * place they appear. :) + */ + +#define DO_ONE_PIXEL() \ + movl (%ebx), %eax ; \ + addl $4, %ebx ; \ + bswap %eax /* ARGB -> BGRA */ ; \ + rorl $8, %eax /* BGRA -> ABGR */ ; \ + movl %eax, (%ecx) /* ABGR -> R, G, B, A */ ; \ + addl $4, %ecx + +#define DO_ONE_LAST_PIXEL() \ + movl (%ebx), %eax ; \ + bswap %eax /* ARGB -> BGRA */ ; \ + rorl $8, %eax /* BGRA -> ABGR */ ; \ + movl %eax, (%ecx) /* ABGR -> R, G, B, A */ ; \ + + +/** + * MMX optimized version of the BGRA8888_REV to RGBA copy routine. + * + * \warning + * This function assumes that the caller will issue the EMMS instruction + * at the correct places. + */ + +.globl _generic_read_RGBA_span_BGRA8888_REV_MMX +.hidden _generic_read_RGBA_span_BGRA8888_REV_MMX + .type _generic_read_RGBA_span_BGRA8888_REV_MMX, @function +_generic_read_RGBA_span_BGRA8888_REV_MMX: + pushl %ebx + +#ifdef USE_INNER_EMMS + emms +#endif + movq mask, %mm1 + movq mask+16, %mm2 + + movl 8(%esp), %ebx /* source pointer */ + movl 16(%esp), %edx /* number of pixels to copy */ + movl 12(%esp), %ecx /* destination pointer */ + + testl %edx, %edx + jle .L20 /* Bail if there's nothing to do. */ + + movl %ebx, %eax + + negl %eax + sarl $2, %eax + andl $1, %eax + je .L17 + + subl %eax, %edx + DO_ONE_PIXEL() +.L17: + + /* Would it be faster to unroll this loop once and process 4 pixels + * per pass, instead of just two? + */ + + movl %edx, %eax + shrl %eax + jmp .L18 +.L19: + movq (%ebx), %mm0 + addl $8, %ebx + + /* These 9 instructions do what PSHUFB (if there were such an + * instruction) could do in 1. :( + */ + + movq %mm0, %mm3 + movq %mm0, %mm4 + + pand %mm2, %mm3 + psllq $16, %mm4 + psrlq $16, %mm3 + pand %mm2, %mm4 + + pand %mm1, %mm0 + por %mm4, %mm3 + por %mm3, %mm0 + + movq %mm0, (%ecx) + addl $8, %ecx + subl $1, %eax +.L18: + jne .L19 + +#ifdef USE_INNER_EMMS + emms +#endif + + /* At this point there are either 1 or 0 pixels remaining to be + * converted. Convert the last pixel, if needed. + */ + + testl $1, %edx + je .L20 + + DO_ONE_LAST_PIXEL() + +.L20: + popl %ebx + ret + .size _generic_read_RGBA_span_BGRA8888_REV_MMX, .-_generic_read_RGBA_span_BGRA8888_REV_MMX + + +/** + * SSE optimized version of the BGRA8888_REV to RGBA copy routine. SSE + * instructions are only actually used to read data from the framebuffer. + * In practice, the speed-up is pretty small. + * + * \todo + * Do some more testing and determine if there's any reason to have this + * function in addition to the MMX version. + * + * \warning + * This function assumes that the caller will issue the EMMS instruction + * at the correct places. + */ + +.globl _generic_read_RGBA_span_BGRA8888_REV_SSE +.hidden _generic_read_RGBA_span_BGRA8888_REV_SSE + .type _generic_read_RGBA_span_BGRA8888_REV_SSE, @function +_generic_read_RGBA_span_BGRA8888_REV_SSE: + pushl %esi + pushl %ebx + pushl %ebp + +#ifdef USE_INNER_EMMS + emms +#endif + movq mask, %mm1 + movq mask+16, %mm2 + + movl 16(%esp), %ebx /* source pointer */ + movl 24(%esp), %edx /* number of pixels to copy */ + movl 20(%esp), %ecx /* destination pointer */ + + testl %edx, %edx + jle .L35 /* Bail if there's nothing to do. */ + + movl %esp, %ebp + subl $16, %esp + andl $0xfffffff0, %esp + + movl %ebx, %eax + movl %edx, %esi + + negl %eax + andl $15, %eax + sarl $2, %eax + cmpl %edx, %eax + cmovle %eax, %esi + + subl %esi, %edx + + testl $1, %esi + je .L32 + + DO_ONE_PIXEL() +.L32: + + testl $2, %esi + je .L31 + + movq (%ebx), %mm0 + addl $8, %ebx + + movq %mm0, %mm3 + movq %mm0, %mm4 + + pand %mm2, %mm3 + psllq $16, %mm4 + psrlq $16, %mm3 + pand %mm2, %mm4 + + pand %mm1, %mm0 + por %mm4, %mm3 + por %mm3, %mm0 + + movq %mm0, (%ecx) + addl $8, %ecx +.L31: + + movl %edx, %eax + shrl $2, %eax + jmp .L33 +.L34: + movaps (%ebx), %xmm0 + addl $16, %ebx + + /* This would be so much better if we could just move directly from + * an SSE register to an MMX register. Unfortunately, that + * functionality wasn't introduced until SSE2 with the MOVDQ2Q + * instruction. + */ + + movaps %xmm0, (%esp) + movq (%esp), %mm0 + movq 8(%esp), %mm5 + + movq %mm0, %mm3 + movq %mm0, %mm4 + movq %mm5, %mm6 + movq %mm5, %mm7 + + pand %mm2, %mm3 + pand %mm2, %mm6 + + psllq $16, %mm4 + psllq $16, %mm7 + + psrlq $16, %mm3 + psrlq $16, %mm6 + + pand %mm2, %mm4 + pand %mm2, %mm7 + + pand %mm1, %mm0 + pand %mm1, %mm5 + + por %mm4, %mm3 + por %mm7, %mm6 + + por %mm3, %mm0 + por %mm6, %mm5 + + movq %mm0, (%ecx) + movq %mm5, 8(%ecx) + addl $16, %ecx + + subl $1, %eax +.L33: + jne .L34 + +#ifdef USE_INNER_EMMS + emms +#endif + movl %ebp, %esp + + /* At this point there are either [0, 3] pixels remaining to be + * converted. + */ + + testl $2, %edx + je .L36 + + movq (%ebx), %mm0 + addl $8, %ebx + + movq %mm0, %mm3 + movq %mm0, %mm4 + + pand %mm2, %mm3 + psllq $16, %mm4 + psrlq $16, %mm3 + pand %mm2, %mm4 + + pand %mm1, %mm0 + por %mm4, %mm3 + por %mm3, %mm0 + + movq %mm0, (%ecx) + addl $8, %ecx +.L36: + + testl $1, %edx + je .L35 + + DO_ONE_LAST_PIXEL() +.L35: + popl %ebp + popl %ebx + popl %esi + ret + .size _generic_read_RGBA_span_BGRA8888_REV_SSE, .-_generic_read_RGBA_span_BGRA8888_REV_SSE + + +/** + * SSE2 optimized version of the BGRA8888_REV to RGBA copy routine. + */ + + .text +.globl _generic_read_RGBA_span_BGRA8888_REV_SSE2 +.hidden _generic_read_RGBA_span_BGRA8888_REV_SSE2 + .type _generic_read_RGBA_span_BGRA8888_REV_SSE2, @function +_generic_read_RGBA_span_BGRA8888_REV_SSE2: + pushl %esi + pushl %ebx + + movdqa mask, %xmm1 + movdqa mask+16, %xmm2 + + movl 12(%esp), %ebx /* source pointer */ + movl 20(%esp), %edx /* number of pixels to copy */ + movl 16(%esp), %ecx /* destination pointer */ + + movl %ebx, %eax + movl %edx, %esi + + testl %edx, %edx + jle .L46 /* Bail if there's nothing to do. */ + + /* If the source pointer isn't a multiple of 16 we have to process + * a few pixels the "slow" way to get the address aligned for + * the SSE fetch intsructions. + */ + + negl %eax + andl $15, %eax + sarl $2, %eax + + cmpl %edx, %eax + cmovbe %eax, %esi + subl %esi, %edx + + testl $1, %esi + je .L41 + + DO_ONE_PIXEL() +.L41: + testl $2, %esi + je .L40 + + movq (%ebx), %xmm0 + addl $8, %ebx + + movdqa %xmm0, %xmm3 + movdqa %xmm0, %xmm4 + andps %xmm1, %xmm0 + + andps %xmm2, %xmm3 + pslldq $2, %xmm4 + psrldq $2, %xmm3 + andps %xmm2, %xmm4 + + orps %xmm4, %xmm3 + orps %xmm3, %xmm0 + + movq %xmm0, (%ecx) + addl $8, %ecx +.L40: + + /* Would it be worth having a specialized version of this loop for + * the case where the destination is 16-byte aligned? That version + * would be identical except that it could use movedqa instead of + * movdqu. + */ + + movl %edx, %eax + shrl $2, %eax + jmp .L42 +.L43: + movdqa (%ebx), %xmm0 + addl $16, %ebx + + movdqa %xmm0, %xmm3 + movdqa %xmm0, %xmm4 + andps %xmm1, %xmm0 + + andps %xmm2, %xmm3 + pslldq $2, %xmm4 + psrldq $2, %xmm3 + andps %xmm2, %xmm4 + + orps %xmm4, %xmm3 + orps %xmm3, %xmm0 + + movdqu %xmm0, (%ecx) + addl $16, %ecx + subl $1, %eax +.L42: + jne .L43 + + + /* There may be upto 3 pixels remaining to be copied. Take care + * of them now. We do the 2 pixel case first because the data + * will be aligned. + */ + + testl $2, %edx + je .L47 + + movq (%ebx), %xmm0 + + movdqa %xmm0, %xmm3 + movdqa %xmm0, %xmm4 + andps %xmm1, %xmm0 + + andps %xmm2, %xmm3 + pslldq $2, %xmm4 + psrldq $2, %xmm3 + andps %xmm2, %xmm4 + + orps %xmm4, %xmm3 + orps %xmm3, %xmm0 + + movq %xmm0, (%ecx) +.L47: + + testl $1, %edx + je .L46 + + DO_ONE_LAST_PIXEL() +.L46: + + popl %ebx + popl %esi + ret + .size _generic_read_RGBA_span_BGRA8888_REV_SSE2, .-_generic_read_RGBA_span_BGRA8888_REV_SSE2 + + + + .section .rodata + + .align 16 +mask_565: + .word 0xf800 + .word 0x07e0 + .word 0x001f + .word 0x0000 + +/* Setting SCALE_ADJUST to 5 gives a perfect match with the classic C + * implementation in Mesa. Setting SCALE_ADJUST to 0 is slightly faster but + * at a small cost to accuracy. + */ + +#define SCALE_ADJUST 5 +#if SCALE_ADJUST == 5 +prescale: + .word 0x0001 + .word 0x0010 + .word 0x0200 + .word 0x0000 + +scale: + .word 0x20e8 /* (0x00ff0000 / 0x000007c0) + 1 */ + .word 0x40c5 /* (0x00ff0000 / 0x000003f0) + 1 */ + .word 0x839d /* (0x00ff0000 / 0x000001f0) + 1 */ + .word 0x0000 +#elif SCALE_ADJUST == 0 +prescale: + .word 0x0001 + .word 0x0020 + .word 0x0800 + .word 0x0000 + +scale: + .word 0x0108 /* (0x00ff0000 / 0x0000f800) + 1 */ + .word 0x0104 /* (0x00ff0000 / 0x0000fc00) + 1 */ + .word 0x0108 /* (0x00ff0000 / 0x0000f800) + 1 */ + .word 0x0000 +#else +#error SCALE_ADJUST must either be 5 or 0. +#endif + + +alpha: .long 0x00000000 + .long 0x00ff0000 + +/** + * MMX optimized version of the RGB565 to RGBA copy routine. + */ + + .text + .globl _generic_read_RGBA_span_RGB565_MMX + .hidden _generic_read_RGBA_span_RGB565_MMX + .type _generic_read_RGBA_span_RGB565_MMX, @function + +_generic_read_RGBA_span_RGB565_MMX: + +#ifdef USE_INNER_EMMS + emms +#endif + + movl 4(%esp), %eax /* source pointer */ + movl 8(%esp), %edx /* destination pointer */ + movl 12(%esp), %ecx /* number of pixels to copy */ + + movq mask_565, %mm5 + movq prescale, %mm6 + movq scale, %mm7 + + sarl $2, %ecx + jle .L01 /* Bail early if the count is negative. */ + jmp .L02 + +.L03: + /* Fetch 4 RGB565 pixels into %mm4. Distribute the first and + * second pixels into the four words of %mm0 and %mm2. + */ + + movq (%eax), %mm4 + addl $8, %eax + + pshufw $0x00, %mm4, %mm0 + pshufw $0x55, %mm4, %mm2 + + + /* Mask the pixels so that each word of each register contains only + * one color component. + */ + + pand %mm5, %mm0 + pand %mm5, %mm2 + + + /* Adjust the component values so that they are as small as possible, + * but large enough so that we can multiply them by an unsigned 16-bit + * number and get a value as large as 0x00ff0000. + */ + + pmullw %mm6, %mm0 + pmullw %mm6, %mm2 +#if SCALE_ADJUST > 0 + psrlw $SCALE_ADJUST, %mm0 + psrlw $SCALE_ADJUST, %mm2 +#endif + + /* Scale the input component values to be on the range + * [0, 0x00ff0000]. This it the real magic of the whole routine. + */ + + pmulhuw %mm7, %mm0 + pmulhuw %mm7, %mm2 + + + /* Always set the alpha value to 0xff. + */ + + por alpha, %mm0 + por alpha, %mm2 + + + /* Pack the 16-bit values to 8-bit values and store the converted + * pixel data. + */ + + packuswb %mm2, %mm0 + movq %mm0, (%edx) + addl $8, %edx + + + + pshufw $0xaa, %mm4, %mm0 + pshufw $0xff, %mm4, %mm2 + + pand %mm5, %mm0 + pand %mm5, %mm2 + pmullw %mm6, %mm0 + pmullw %mm6, %mm2 +#if SCALE_ADJUST > 0 + psrlw $SCALE_ADJUST, %mm0 + psrlw $SCALE_ADJUST, %mm2 +#endif + pmulhuw %mm7, %mm0 + pmulhuw %mm7, %mm2 + + por alpha, %mm0 + por alpha, %mm2 + + packuswb %mm2, %mm0 + + movq %mm0, (%edx) + addl $8, %edx + + subl $1, %ecx +.L02: + jne .L03 + + + /* At this point there can be at most 3 pixels left to process. If + * there is either 2 or 3 left, process 2. + */ + + movl 12(%esp), %ecx + testl $0x02, %ecx + je .L04 + + movd (%eax), %mm4 + addl $4, %eax + + pshufw $0x00, %mm4, %mm0 + pshufw $0x55, %mm4, %mm2 + + pand %mm5, %mm0 + pand %mm5, %mm2 + pmullw %mm6, %mm0 + pmullw %mm6, %mm2 +#if SCALE_ADJUST > 0 + psrlw $SCALE_ADJUST, %mm0 + psrlw $SCALE_ADJUST, %mm2 +#endif + pmulhuw %mm7, %mm0 + pmulhuw %mm7, %mm2 + + por alpha, %mm0 + por alpha, %mm2 + + packuswb %mm2, %mm0 + + movq %mm0, (%edx) + addl $8, %edx + +.L04: + /* At this point there can be at most 1 pixel left to process. + * Process it if needed. + */ + + testl $0x01, %ecx + je .L01 + + movzxw (%eax), %ecx + movd %ecx, %mm4 + + pshufw $0x00, %mm4, %mm0 + + pand %mm5, %mm0 + pmullw %mm6, %mm0 +#if SCALE_ADJUST > 0 + psrlw $SCALE_ADJUST, %mm0 +#endif + pmulhuw %mm7, %mm0 + + por alpha, %mm0 + + packuswb %mm0, %mm0 + + movd %mm0, (%edx) + +.L01: +#ifdef USE_INNER_EMMS + emms +#endif + ret +#endif /* !defined(__DJGPP__) && !defined(__MINGW32__) */ diff --git a/reactos/dll/mesa32/src/x86/read_rgba_span_x86.h b/reactos/dll/mesa32/src/x86/read_rgba_span_x86.h new file mode 100644 index 00000000000..564b1bb0f9e --- /dev/null +++ b/reactos/dll/mesa32/src/x86/read_rgba_span_x86.h @@ -0,0 +1,56 @@ +/* + * (C) Copyright IBM Corporation 2004 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * 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 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. + */ + +/** + * \file read_rgba_span_x86.h + * + * \author Ian Romanick + */ + +#ifndef READ_RGBA_SPAN_X86_H +#define READ_RGBA_SPAN_X86_H + +#if defined(USE_SSE_ASM) || defined(USE_MMX_ASM) +#include "x86/common_x86_asm.h" +#endif + +#if defined(USE_SSE_ASM) +extern void _generic_read_RGBA_span_BGRA8888_REV_SSE2( const unsigned char *, + unsigned char *, unsigned ); +#endif + +#if defined(USE_SSE_ASM) +extern void _generic_read_RGBA_span_BGRA8888_REV_SSE( const unsigned char *, + unsigned char *, unsigned ); +#endif + +#if defined(USE_MMX_ASM) +extern void _generic_read_RGBA_span_BGRA8888_REV_MMX( const unsigned char *, + unsigned char *, unsigned ); + +extern void _generic_read_RGBA_span_RGB565_MMX( const unsigned char *, + unsigned char *, unsigned ); +#endif + +#endif /* READ_RGBA_SPAN_X86_H */ diff --git a/reactos/dll/mesa32/src/x86/rtasm/x86sse.c b/reactos/dll/mesa32/src/x86/rtasm/x86sse.c new file mode 100644 index 00000000000..0c9ffe25fa2 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/rtasm/x86sse.c @@ -0,0 +1,997 @@ +#if defined(USE_X86_ASM) + +#include "imports.h" +#include "x86sse.h" + +#define DISASSEM 0 +#define X86_TWOB 0x0f + +/* Emit bytes to the instruction stream: + */ +static void emit_1b( struct x86_function *p, GLbyte b0 ) +{ + *(GLbyte *)(p->csr++) = b0; +} + +static void emit_1i( struct x86_function *p, GLint i0 ) +{ + *(GLint *)(p->csr) = i0; + p->csr += 4; +} + +static void disassem( struct x86_function *p, const char *fn ) +{ +#if DISASSEM && 0 + if (fn && fn != p->fn) { + _mesa_printf("0x%x: %s\n", p->csr, fn); + p->fn = fn; + } +#endif +} + +static void emit_1ub_fn( struct x86_function *p, GLubyte b0, const char *fn ) +{ + disassem(p, fn); + *(p->csr++) = b0; +} + +static void emit_2ub_fn( struct x86_function *p, GLubyte b0, GLubyte b1, const char *fn ) +{ + disassem(p, fn); + *(p->csr++) = b0; + *(p->csr++) = b1; +} + +static void emit_3ub_fn( struct x86_function *p, GLubyte b0, GLubyte b1, GLubyte b2, const char *fn ) +{ + disassem(p, fn); + *(p->csr++) = b0; + *(p->csr++) = b1; + *(p->csr++) = b2; +} + +#define emit_1ub(p, b0) emit_1ub_fn(p, b0, __FUNCTION__) +#define emit_2ub(p, b0, b1) emit_2ub_fn(p, b0, b1, __FUNCTION__) +#define emit_3ub(p, b0, b1, b2) emit_3ub_fn(p, b0, b1, b2, __FUNCTION__) + + + +/* Build a modRM byte + possible displacement. No treatment of SIB + * indexing. BZZT - no way to encode an absolute address. + */ +static void emit_modrm( struct x86_function *p, + struct x86_reg reg, + struct x86_reg regmem ) +{ + GLubyte val = 0; + + assert(reg.mod == mod_REG); + + val |= regmem.mod << 6; /* mod field */ + val |= reg.idx << 3; /* reg field */ + val |= regmem.idx; /* r/m field */ + + emit_1ub_fn(p, val, 0); + + /* Oh-oh we've stumbled into the SIB thing. + */ + if (regmem.file == file_REG32 && + regmem.idx == reg_SP) { + emit_1ub_fn(p, 0x24, 0); /* simplistic! */ + } + + switch (regmem.mod) { + case mod_REG: + case mod_INDIRECT: + break; + case mod_DISP8: + emit_1b(p, regmem.disp); + break; + case mod_DISP32: + emit_1i(p, regmem.disp); + break; + default: + assert(0); + break; + } +} + + +static void emit_modrm_noreg( struct x86_function *p, + GLuint op, + struct x86_reg regmem ) +{ + struct x86_reg dummy = x86_make_reg(file_REG32, op); + emit_modrm(p, dummy, regmem); +} + +/* Many x86 instructions have two opcodes to cope with the situations + * where the destination is a register or memory reference + * respectively. This function selects the correct opcode based on + * the arguments presented. + */ +static void emit_op_modrm( struct x86_function *p, + GLubyte op_dst_is_reg, + GLubyte op_dst_is_mem, + struct x86_reg dst, + struct x86_reg src ) +{ + switch (dst.mod) { + case mod_REG: + emit_1ub_fn(p, op_dst_is_reg, 0); + emit_modrm(p, dst, src); + break; + case mod_INDIRECT: + case mod_DISP32: + case mod_DISP8: + assert(src.mod == mod_REG); + emit_1ub_fn(p, op_dst_is_mem, 0); + emit_modrm(p, src, dst); + break; + default: + assert(0); + break; + } +} + + + + + + + +/* Create and manipulate registers and regmem values: + */ +struct x86_reg x86_make_reg( GLuint file, + GLuint idx ) +{ + struct x86_reg reg; + + reg.file = file; + reg.idx = idx; + reg.mod = mod_REG; + reg.disp = 0; + + return reg; +} + +struct x86_reg x86_make_disp( struct x86_reg reg, + GLint disp ) +{ + assert(reg.file == file_REG32); + + if (reg.mod == mod_REG) + reg.disp = disp; + else + reg.disp += disp; + + if (reg.disp == 0) + reg.mod = mod_INDIRECT; + else if (reg.disp <= 127 && reg.disp >= -128) + reg.mod = mod_DISP8; + else + reg.mod = mod_DISP32; + + return reg; +} + +struct x86_reg x86_deref( struct x86_reg reg ) +{ + return x86_make_disp(reg, 0); +} + +struct x86_reg x86_get_base_reg( struct x86_reg reg ) +{ + return x86_make_reg( reg.file, reg.idx ); +} + +GLubyte *x86_get_label( struct x86_function *p ) +{ + return p->csr; +} + + + +/*********************************************************************** + * x86 instructions + */ + + +void x86_jcc( struct x86_function *p, + GLuint cc, + GLubyte *label ) +{ + GLint offset = label - (x86_get_label(p) + 2); + + if (offset <= 127 && offset >= -128) { + emit_1ub(p, 0x70 + cc); + emit_1b(p, (GLbyte) offset); + } + else { + offset = label - (x86_get_label(p) + 6); + emit_2ub(p, 0x0f, 0x80 + cc); + emit_1i(p, offset); + } +} + +/* Always use a 32bit offset for forward jumps: + */ +GLubyte *x86_jcc_forward( struct x86_function *p, + GLuint cc ) +{ + emit_2ub(p, 0x0f, 0x80 + cc); + emit_1i(p, 0); + return x86_get_label(p); +} + +/* Fixup offset from forward jump: + */ +void x86_fixup_fwd_jump( struct x86_function *p, + GLubyte *fixup ) +{ + *(int *)(fixup - 4) = x86_get_label(p) - fixup; +} + +void x86_push( struct x86_function *p, + struct x86_reg reg ) +{ + assert(reg.mod == mod_REG); + emit_1ub(p, 0x50 + reg.idx); + p->stack_offset += 4; +} + +void x86_pop( struct x86_function *p, + struct x86_reg reg ) +{ + assert(reg.mod == mod_REG); + emit_1ub(p, 0x58 + reg.idx); + p->stack_offset -= 4; +} + +void x86_inc( struct x86_function *p, + struct x86_reg reg ) +{ + assert(reg.mod == mod_REG); + emit_1ub(p, 0x40 + reg.idx); +} + +void x86_dec( struct x86_function *p, + struct x86_reg reg ) +{ + assert(reg.mod == mod_REG); + emit_1ub(p, 0x48 + reg.idx); +} + +void x86_ret( struct x86_function *p ) +{ + emit_1ub(p, 0xc3); +} + +void x86_sahf( struct x86_function *p ) +{ + emit_1ub(p, 0x9e); +} + +void x86_mov( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_op_modrm( p, 0x8b, 0x89, dst, src ); +} + +void x86_xor( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_op_modrm( p, 0x33, 0x31, dst, src ); +} + +void x86_cmp( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_op_modrm( p, 0x3b, 0x39, dst, src ); +} + +void x86_lea( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_1ub(p, 0x8d); + emit_modrm( p, dst, src ); +} + +void x86_test( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_1ub(p, 0x85); + emit_modrm( p, dst, src ); +} + + + +/*********************************************************************** + * SSE instructions + */ + + +void sse_movss( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, 0xF3, X86_TWOB); + emit_op_modrm( p, 0x10, 0x11, dst, src ); +} + +void sse_movaps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_1ub(p, X86_TWOB); + emit_op_modrm( p, 0x28, 0x29, dst, src ); +} + +void sse_movups( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_1ub(p, X86_TWOB); + emit_op_modrm( p, 0x10, 0x11, dst, src ); +} + +void sse_movhps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + assert(dst.mod != mod_REG || src.mod != mod_REG); + emit_1ub(p, X86_TWOB); + emit_op_modrm( p, 0x16, 0x17, dst, src ); /* cf movlhps */ +} + +void sse_movlps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + assert(dst.mod != mod_REG || src.mod != mod_REG); + emit_1ub(p, X86_TWOB); + emit_op_modrm( p, 0x12, 0x13, dst, src ); /* cf movhlps */ +} + +void sse_maxps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x5F); + emit_modrm( p, dst, src ); +} + +void sse_divss( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0xF3, X86_TWOB, 0x5E); + emit_modrm( p, dst, src ); +} + +void sse_minps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x5D); + emit_modrm( p, dst, src ); +} + +void sse_subps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x5C); + emit_modrm( p, dst, src ); +} + +void sse_mulps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x59); + emit_modrm( p, dst, src ); +} + +void sse_addps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x58); + emit_modrm( p, dst, src ); +} + +void sse_addss( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0xF3, X86_TWOB, 0x58); + emit_modrm( p, dst, src ); +} + +void sse_andps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x54); + emit_modrm( p, dst, src ); +} + + +void sse_rsqrtss( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0xF3, X86_TWOB, 0x52); + emit_modrm( p, dst, src ); + +} + +void sse_movhlps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + assert(dst.mod == mod_REG && src.mod == mod_REG); + emit_2ub(p, X86_TWOB, 0x12); + emit_modrm( p, dst, src ); +} + +void sse_movlhps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + assert(dst.mod == mod_REG && src.mod == mod_REG); + emit_2ub(p, X86_TWOB, 0x16); + emit_modrm( p, dst, src ); +} + + +void sse_cvtps2pi( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + assert(dst.file == file_MMX && + (src.file == file_XMM || src.mod != mod_REG)); + + p->need_emms = 1; + + emit_2ub(p, X86_TWOB, 0x2d); + emit_modrm( p, dst, src ); +} + + +/* Shufps can also be used to implement a reduced swizzle when dest == + * arg0. + */ +void sse_shufps( struct x86_function *p, + struct x86_reg dest, + struct x86_reg arg0, + GLubyte shuf) +{ + emit_2ub(p, X86_TWOB, 0xC6); + emit_modrm(p, dest, arg0); + emit_1ub(p, shuf); +} + +void sse_cmpps( struct x86_function *p, + struct x86_reg dest, + struct x86_reg arg0, + GLubyte cc) +{ + emit_2ub(p, X86_TWOB, 0xC2); + emit_modrm(p, dest, arg0); + emit_1ub(p, cc); +} + +/*********************************************************************** + * SSE2 instructions + */ + +/** + * Perform a reduced swizzle: + */ +void sse2_pshufd( struct x86_function *p, + struct x86_reg dest, + struct x86_reg arg0, + GLubyte shuf) +{ + emit_3ub(p, 0x66, X86_TWOB, 0x70); + emit_modrm(p, dest, arg0); + emit_1ub(p, shuf); +} + +void sse2_cvtps2dq( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0x66, X86_TWOB, 0x5B); + emit_modrm( p, dst, src ); +} + +void sse2_packssdw( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0x66, X86_TWOB, 0x6B); + emit_modrm( p, dst, src ); +} + +void sse2_packsswb( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0x66, X86_TWOB, 0x63); + emit_modrm( p, dst, src ); +} + +void sse2_packuswb( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0x66, X86_TWOB, 0x67); + emit_modrm( p, dst, src ); +} + +void sse2_rcpss( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0xF3, X86_TWOB, 0x53); + emit_modrm( p, dst, src ); +} + +void sse2_movd( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, 0x66, X86_TWOB); + emit_op_modrm( p, 0x6e, 0x7e, dst, src ); +} + + + + +/*********************************************************************** + * x87 instructions + */ +void x87_fist( struct x86_function *p, struct x86_reg dst ) +{ + emit_1ub(p, 0xdb); + emit_modrm_noreg(p, 2, dst); +} + +void x87_fistp( struct x86_function *p, struct x86_reg dst ) +{ + emit_1ub(p, 0xdb); + emit_modrm_noreg(p, 3, dst); +} + +void x87_fldz( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xee); +} + + +void x87_fldcw( struct x86_function *p, struct x86_reg arg ) +{ + assert(arg.file == file_REG32); + assert(arg.mod != mod_REG); + emit_1ub(p, 0xd9); + emit_modrm_noreg(p, 5, arg); +} + +void x87_fld1( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xe8); +} + +void x87_fldl2e( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xea); +} + +void x87_fldln2( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xed); +} + +void x87_fwait( struct x86_function *p ) +{ + emit_1ub(p, 0x9b); +} + +void x87_fnclex( struct x86_function *p ) +{ + emit_2ub(p, 0xdb, 0xe2); +} + +void x87_fclex( struct x86_function *p ) +{ + x87_fwait(p); + x87_fnclex(p); +} + + +static void x87_arith_op( struct x86_function *p, struct x86_reg dst, struct x86_reg arg, + GLubyte dst0ub0, + GLubyte dst0ub1, + GLubyte arg0ub0, + GLubyte arg0ub1, + GLubyte argmem_noreg) +{ + assert(dst.file == file_x87); + + if (arg.file == file_x87) { + if (dst.idx == 0) + emit_2ub(p, dst0ub0, dst0ub1+arg.idx); + else if (arg.idx == 0) + emit_2ub(p, arg0ub0, arg0ub1+arg.idx); + else + assert(0); + } + else if (dst.idx == 0) { + assert(arg.file = file_REG32); + emit_1ub(p, 0xd8); + emit_modrm_noreg(p, argmem_noreg, arg); + } + else + assert(0); +} + +void x87_fmul( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) +{ + x87_arith_op(p, dst, arg, + 0xd8, 0xc8, + 0xdc, 0xc8, + 4); +} + +void x87_fsub( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) +{ + x87_arith_op(p, dst, arg, + 0xd8, 0xe0, + 0xdc, 0xe8, + 4); +} + +void x87_fsubr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) +{ + x87_arith_op(p, dst, arg, + 0xd8, 0xe8, + 0xdc, 0xe0, + 5); +} + +void x87_fadd( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) +{ + x87_arith_op(p, dst, arg, + 0xd8, 0xc0, + 0xdc, 0xc0, + 0); +} + +void x87_fdiv( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) +{ + x87_arith_op(p, dst, arg, + 0xd8, 0xf0, + 0xdc, 0xf8, + 6); +} + +void x87_fdivr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) +{ + x87_arith_op(p, dst, arg, + 0xd8, 0xf8, + 0xdc, 0xf0, + 7); +} + +void x87_fmulp( struct x86_function *p, struct x86_reg dst ) +{ + assert(dst.file == file_x87); + assert(dst.idx >= 1); + emit_2ub(p, 0xde, 0xc8+dst.idx); +} + +void x87_fsubp( struct x86_function *p, struct x86_reg dst ) +{ + assert(dst.file == file_x87); + assert(dst.idx >= 1); + emit_2ub(p, 0xde, 0xe8+dst.idx); +} + +void x87_fsubrp( struct x86_function *p, struct x86_reg dst ) +{ + assert(dst.file == file_x87); + assert(dst.idx >= 1); + emit_2ub(p, 0xde, 0xe0+dst.idx); +} + +void x87_faddp( struct x86_function *p, struct x86_reg dst ) +{ + assert(dst.file == file_x87); + assert(dst.idx >= 1); + emit_2ub(p, 0xde, 0xc0+dst.idx); +} + +void x87_fdivp( struct x86_function *p, struct x86_reg dst ) +{ + assert(dst.file == file_x87); + assert(dst.idx >= 1); + emit_2ub(p, 0xde, 0xf8+dst.idx); +} + +void x87_fdivrp( struct x86_function *p, struct x86_reg dst ) +{ + assert(dst.file == file_x87); + assert(dst.idx >= 1); + emit_2ub(p, 0xde, 0xf0+dst.idx); +} + +void x87_fucom( struct x86_function *p, struct x86_reg arg ) +{ + assert(arg.file == file_x87); + emit_2ub(p, 0xdd, 0xe0+arg.idx); +} + +void x87_fucomp( struct x86_function *p, struct x86_reg arg ) +{ + assert(arg.file == file_x87); + emit_2ub(p, 0xdd, 0xe8+arg.idx); +} + +void x87_fucompp( struct x86_function *p ) +{ + emit_2ub(p, 0xda, 0xe9); +} + +void x87_fxch( struct x86_function *p, struct x86_reg arg ) +{ + assert(arg.file == file_x87); + emit_2ub(p, 0xd9, 0xc8+arg.idx); +} + +void x87_fabs( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xe1); +} + +void x87_fchs( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xe0); +} + +void x87_fcos( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xff); +} + + +void x87_fprndint( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xfc); +} + +void x87_fscale( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xfd); +} + +void x87_fsin( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xfe); +} + +void x87_fsincos( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xfb); +} + +void x87_fsqrt( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xfa); +} + +void x87_fxtract( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xf4); +} + +/* st0 = (2^st0)-1 + * + * Restrictions: -1.0 <= st0 <= 1.0 + */ +void x87_f2xm1( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xf0); +} + +/* st1 = st1 * log2(st0); + * pop_stack; + */ +void x87_fyl2x( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xf1); +} + +/* st1 = st1 * log2(st0 + 1.0); + * pop_stack; + * + * A fast operation, with restrictions: -.29 < st0 < .29 + */ +void x87_fyl2xp1( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xf9); +} + + +void x87_fld( struct x86_function *p, struct x86_reg arg ) +{ + if (arg.file == file_x87) + emit_2ub(p, 0xd9, 0xc0 + arg.idx); + else { + emit_1ub(p, 0xd9); + emit_modrm_noreg(p, 0, arg); + } +} + +void x87_fst( struct x86_function *p, struct x86_reg dst ) +{ + if (dst.file == file_x87) + emit_2ub(p, 0xdd, 0xd0 + dst.idx); + else { + emit_1ub(p, 0xd9); + emit_modrm_noreg(p, 2, dst); + } +} + +void x87_fstp( struct x86_function *p, struct x86_reg dst ) +{ + if (dst.file == file_x87) + emit_2ub(p, 0xdd, 0xd8 + dst.idx); + else { + emit_1ub(p, 0xd9); + emit_modrm_noreg(p, 3, dst); + } +} + +void x87_fcom( struct x86_function *p, struct x86_reg dst ) +{ + if (dst.file == file_x87) + emit_2ub(p, 0xd8, 0xd0 + dst.idx); + else { + emit_1ub(p, 0xd8); + emit_modrm_noreg(p, 2, dst); + } +} + +void x87_fcomp( struct x86_function *p, struct x86_reg dst ) +{ + if (dst.file == file_x87) + emit_2ub(p, 0xd8, 0xd8 + dst.idx); + else { + emit_1ub(p, 0xd8); + emit_modrm_noreg(p, 3, dst); + } +} + + +void x87_fnstsw( struct x86_function *p, struct x86_reg dst ) +{ + assert(dst.file == file_REG32); + + if (dst.idx == reg_AX && + dst.mod == mod_REG) + emit_2ub(p, 0xdf, 0xe0); + else { + emit_1ub(p, 0xdd); + emit_modrm_noreg(p, 7, dst); + } +} + + + + +/*********************************************************************** + * MMX instructions + */ + +void mmx_emms( struct x86_function *p ) +{ + assert(p->need_emms); + emit_2ub(p, 0x0f, 0x77); + p->need_emms = 0; +} + +void mmx_packssdw( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + assert(dst.file == file_MMX && + (src.file == file_MMX || src.mod != mod_REG)); + + p->need_emms = 1; + + emit_2ub(p, X86_TWOB, 0x6b); + emit_modrm( p, dst, src ); +} + +void mmx_packuswb( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + assert(dst.file == file_MMX && + (src.file == file_MMX || src.mod != mod_REG)); + + p->need_emms = 1; + + emit_2ub(p, X86_TWOB, 0x67); + emit_modrm( p, dst, src ); +} + +void mmx_movd( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + p->need_emms = 1; + emit_1ub(p, X86_TWOB); + emit_op_modrm( p, 0x6e, 0x7e, dst, src ); +} + +void mmx_movq( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + p->need_emms = 1; + emit_1ub(p, X86_TWOB); + emit_op_modrm( p, 0x6f, 0x7f, dst, src ); +} + + +/*********************************************************************** + * Helper functions + */ + + +/* Retreive a reference to one of the function arguments, taking into + * account any push/pop activity: + */ +struct x86_reg x86_fn_arg( struct x86_function *p, + GLuint arg ) +{ + return x86_make_disp(x86_make_reg(file_REG32, reg_SP), + p->stack_offset + arg * 4); /* ??? */ +} + + +void x86_init_func( struct x86_function *p ) +{ + p->store = _mesa_exec_malloc(1024); + p->csr = p->store; +} + +void x86_release_func( struct x86_function *p ) +{ + _mesa_exec_free(p->store); +} + + +void (*x86_get_func( struct x86_function *p ))(void) +{ + if (DISASSEM) + _mesa_printf("disassemble %p %p\n", p->store, p->csr); + return (void (*)())p->store; +} + +#else + +void x86sse_dummy( void ) +{ +} + +#endif diff --git a/reactos/dll/mesa32/src/x86/rtasm/x86sse.h b/reactos/dll/mesa32/src/x86/rtasm/x86sse.h new file mode 100644 index 00000000000..611d01e1cb3 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/rtasm/x86sse.h @@ -0,0 +1,223 @@ + +#ifndef _X86SSE_H_ +#define _X86SSE_H_ + +#if defined(USE_X86_ASM) + +#include "glheader.h" + +/* It is up to the caller to ensure that instructions issued are + * suitable for the host cpu. There are no checks made in this module + * for mmx/sse/sse2 support on the cpu. + */ +struct x86_reg { + GLuint file:3; + GLuint idx:3; + GLuint mod:2; /* mod_REG if this is just a register */ + GLint disp:24; /* only +/- 23bits of offset - should be enough... */ +}; + +struct x86_function { + GLubyte *store; + GLubyte *csr; + GLuint stack_offset; + GLint need_emms; + const char *fn; +}; + +enum x86_reg_file { + file_REG32, + file_MMX, + file_XMM, + file_x87 +}; + +/* Values for mod field of modr/m byte + */ +enum x86_reg_mod { + mod_INDIRECT, + mod_DISP8, + mod_DISP32, + mod_REG +}; + +enum x86_reg_name { + reg_AX, + reg_CX, + reg_DX, + reg_BX, + reg_SP, + reg_BP, + reg_SI, + reg_DI +}; + + +enum x86_cc { + cc_O, /* overflow */ + cc_NO, /* not overflow */ + cc_NAE, /* not above or equal / carry */ + cc_AE, /* above or equal / not carry */ + cc_E, /* equal / zero */ + cc_NE /* not equal / not zero */ +}; + +enum sse_cc { + cc_Equal, + cc_LessThan, + cc_LessThanEqual, + cc_Unordered, + cc_NotEqual, + cc_NotLessThan, + cc_NotLessThanEqual, + cc_Ordered +}; + +#define cc_Z cc_E +#define cc_NZ cc_NE + +/* Begin/end/retreive function creation: + */ + + +void x86_init_func( struct x86_function *p ); +void x86_release_func( struct x86_function *p ); +void (*x86_get_func( struct x86_function *p ))( void ); + + + +/* Create and manipulate registers and regmem values: + */ +struct x86_reg x86_make_reg( enum x86_reg_file file, + enum x86_reg_name idx ); + +struct x86_reg x86_make_disp( struct x86_reg reg, + GLint disp ); + +struct x86_reg x86_deref( struct x86_reg reg ); + +struct x86_reg x86_get_base_reg( struct x86_reg reg ); + + +/* Labels, jumps and fixup: + */ +GLubyte *x86_get_label( struct x86_function *p ); + +void x86_jcc( struct x86_function *p, + enum x86_cc cc, + GLubyte *label ); + +GLubyte *x86_jcc_forward( struct x86_function *p, + enum x86_cc cc ); + +void x86_fixup_fwd_jump( struct x86_function *p, + GLubyte *fixup ); + + +/* Macro for sse_shufps() and sse2_pshufd(): + */ +#define SHUF(_x,_y,_z,_w) (((_x)<<0) | ((_y)<<2) | ((_z)<<4) | ((_w)<<6)) +#define SHUF_NOOP RSW(0,1,2,3) +#define GET_SHUF(swz, idx) (((swz) >> ((idx)*2)) & 0x3) + +void mmx_emms( struct x86_function *p ); +void mmx_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void mmx_movq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void mmx_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void mmx_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); + +void sse2_cvtps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_packsswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, GLubyte shuf ); +void sse2_rcpss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); + +void sse_addps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_addss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_cvtps2pi( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_divss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_andps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_cmpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src, GLubyte cc ); +void sse_maxps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_minps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_movaps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_movhlps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_movhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_movlhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_movlps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_movss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_movups( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_mulps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_subps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_rsqrtss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, GLubyte shuf ); + +void x86_cmp( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_dec( struct x86_function *p, struct x86_reg reg ); +void x86_inc( struct x86_function *p, struct x86_reg reg ); +void x86_lea( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_mov( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_pop( struct x86_function *p, struct x86_reg reg ); +void x86_push( struct x86_function *p, struct x86_reg reg ); +void x86_ret( struct x86_function *p ); +void x86_test( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_xor( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_sahf( struct x86_function *p ); + +void x87_f2xm1( struct x86_function *p ); +void x87_fabs( struct x86_function *p ); +void x87_fadd( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); +void x87_faddp( struct x86_function *p, struct x86_reg dst ); +void x87_fchs( struct x86_function *p ); +void x87_fclex( struct x86_function *p ); +void x87_fcom( struct x86_function *p, struct x86_reg dst ); +void x87_fcomp( struct x86_function *p, struct x86_reg dst ); +void x87_fcos( struct x86_function *p ); +void x87_fdiv( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); +void x87_fdivp( struct x86_function *p, struct x86_reg dst ); +void x87_fdivr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); +void x87_fdivrp( struct x86_function *p, struct x86_reg dst ); +void x87_fist( struct x86_function *p, struct x86_reg dst ); +void x87_fistp( struct x86_function *p, struct x86_reg dst ); +void x87_fld( struct x86_function *p, struct x86_reg arg ); +void x87_fld1( struct x86_function *p ); +void x87_fldcw( struct x86_function *p, struct x86_reg arg ); +void x87_fldl2e( struct x86_function *p ); +void x87_fldln2( struct x86_function *p ); +void x87_fldz( struct x86_function *p ); +void x87_fmul( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); +void x87_fmulp( struct x86_function *p, struct x86_reg dst ); +void x87_fnclex( struct x86_function *p ); +void x87_fprndint( struct x86_function *p ); +void x87_fscale( struct x86_function *p ); +void x87_fsin( struct x86_function *p ); +void x87_fsincos( struct x86_function *p ); +void x87_fsqrt( struct x86_function *p ); +void x87_fst( struct x86_function *p, struct x86_reg dst ); +void x87_fstp( struct x86_function *p, struct x86_reg dst ); +void x87_fsub( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); +void x87_fsubp( struct x86_function *p, struct x86_reg dst ); +void x87_fsubr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); +void x87_fsubrp( struct x86_function *p, struct x86_reg dst ); +void x87_fxch( struct x86_function *p, struct x86_reg dst ); +void x87_fxtract( struct x86_function *p ); +void x87_fyl2x( struct x86_function *p ); +void x87_fyl2xp1( struct x86_function *p ); +void x87_fwait( struct x86_function *p ); +void x87_fnstsw( struct x86_function *p, struct x86_reg dst ); +void x87_fucompp( struct x86_function *p ); +void x87_fucomp( struct x86_function *p, struct x86_reg arg ); +void x87_fucom( struct x86_function *p, struct x86_reg arg ); + + + +/* Retreive a reference to one of the function arguments, taking into + * account any push/pop activity. Note - doesn't track explict + * manipulation of ESP by other instructions. + */ +struct x86_reg x86_fn_arg( struct x86_function *p, GLuint arg ); + +#endif +#endif diff --git a/reactos/dll/mesa32/src/x86/sse.c b/reactos/dll/mesa32/src/x86/sse.c new file mode 100644 index 00000000000..45852c4e1c0 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/sse.c @@ -0,0 +1,123 @@ +/* + * Mesa 3-D graphics library + * Version: 6.0 + * + * 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. + */ + +/* + * PentiumIII-SIMD (SSE) optimizations contributed by + * Andre Werthmann + */ + +#include "glheader.h" +#include "context.h" +#include "math/m_xform.h" +#include "tnl/t_context.h" + +#include "sse.h" +#include "common_x86_macros.h" + +#ifdef DEBUG +#include "math/m_debug.h" +#endif + + +#ifdef USE_SSE_ASM +DECLARE_XFORM_GROUP( sse, 2 ) +DECLARE_XFORM_GROUP( sse, 3 ) + +#if 1 +/* Some functions are not written in SSE-assembly, because the fpu ones are faster */ +extern void _ASMAPI _mesa_sse_transform_normals_no_rot( NORM_ARGS ); +extern void _ASMAPI _mesa_sse_transform_rescale_normals( NORM_ARGS ); +extern void _ASMAPI _mesa_sse_transform_rescale_normals_no_rot( NORM_ARGS ); + +extern void _ASMAPI _mesa_sse_transform_points4_general( XFORM_ARGS ); +extern void _ASMAPI _mesa_sse_transform_points4_3d( XFORM_ARGS ); +/* XXX this function segfaults, see below */ +extern void _ASMAPI _mesa_sse_transform_points4_identity( XFORM_ARGS ); +/* XXX this one works, see below */ +extern void _ASMAPI _mesa_x86_transform_points4_identity( XFORM_ARGS ); +#else +DECLARE_NORM_GROUP( sse ) +#endif + + +extern void _ASMAPI +_mesa_v16_sse_general_xform( GLfloat *first_vert, + const GLfloat *m, + const GLfloat *src, + GLuint src_stride, + GLuint count ); + +extern void _ASMAPI +_mesa_sse_project_vertices( GLfloat *first, + GLfloat *last, + const GLfloat *m, + GLuint stride ); + +extern void _ASMAPI +_mesa_sse_project_clipped_vertices( GLfloat *first, + GLfloat *last, + const GLfloat *m, + GLuint stride, + const GLubyte *clipmask ); +#endif + + +void _mesa_init_sse_transform_asm( void ) +{ +#ifdef USE_SSE_ASM + ASSIGN_XFORM_GROUP( sse, 2 ); + ASSIGN_XFORM_GROUP( sse, 3 ); + +#if 1 + /* TODO: Finish these off. + */ + _mesa_transform_tab[4][MATRIX_GENERAL] = + _mesa_sse_transform_points4_general; + _mesa_transform_tab[4][MATRIX_3D] = + _mesa_sse_transform_points4_3d; + /* XXX NOTE: _mesa_sse_transform_points4_identity segfaults with the + conformance tests, so use the x86 version. + */ + _mesa_transform_tab[4][MATRIX_IDENTITY] = + _mesa_x86_transform_points4_identity;/*_mesa_sse_transform_points4_identity;*/ + + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = + _mesa_sse_transform_normals_no_rot; + _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = + _mesa_sse_transform_rescale_normals; + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = + _mesa_sse_transform_rescale_normals_no_rot; +#else + ASSIGN_XFORM_GROUP( sse, 4 ); + + ASSIGN_NORM_GROUP( sse ); +#endif + +#ifdef DEBUG + _math_test_all_transform_functions( "SSE" ); + _math_test_all_normal_transform_functions( "SSE" ); +#endif +#endif +} + diff --git a/reactos/dll/mesa32/src/x86/sse.h b/reactos/dll/mesa32/src/x86/sse.h new file mode 100644 index 00000000000..98146a90478 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/sse.h @@ -0,0 +1,39 @@ +/* $Id: sse.h,v 1.2 2002/04/09 14:58:03 keithw Exp $ */ + +/* + * 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. + */ + +/* + * PentiumIII-SIMD (SSE) optimizations contributed by + * Andre Werthmann + */ + +#ifndef __SSE_H__ +#define __SSE_H__ + +#include "math/m_xform.h" + +void _mesa_init_sse_transform_asm( void ); + +#endif diff --git a/reactos/dll/mesa32/src/x86/sse_normal.S b/reactos/dll/mesa32/src/x86/sse_normal.S new file mode 100644 index 00000000000..07d831b8b69 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/sse_normal.S @@ -0,0 +1,257 @@ +/* $Id: sse_normal.S,v 1.5 2005/01/04 14:33:47 brianp Exp $ */ + +/* + * 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. + */ + +/** TODO: + * - insert PREFETCH instructions to avoid cache-misses ! + * - some more optimizations are possible... + * - for 40-50% more performance in the SSE-functions, the + * data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! + */ + +#ifdef USE_SSE_ASM +#include "matypes.h" +#include "norm_args.h" + + SEG_TEXT + +#define M(i) REGOFF(i * 4, EDX) +#define S(i) REGOFF(i * 4, ESI) +#define D(i) REGOFF(i * 4, EDI) +#define STRIDE REGOFF(12, ESI) + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_sse_transform_rescale_normals_no_rot) +HIDDEN(_mesa_sse_transform_rescale_normals_no_rot) +GLNAME(_mesa_sse_transform_rescale_normals_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L ( ARG_IN, ESI ) /* ptr to source GLvector3f */ + MOV_L ( ARG_DEST, EDI ) /* ptr to dest GLvector3f */ + + MOV_L ( ARG_MAT, EDX ) /* ptr to matrix */ + MOV_L ( REGOFF(MATRIX_INV, EDX), EDX) /* matrix->inv */ + + MOV_L ( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L ( ECX, ECX ) + JZ( LLBL(K_G3TRNNRR_finish) ) /* count was zero; go to finish */ + + MOV_L ( STRIDE, EAX ) /* stride */ + MOV_L ( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest-count */ + + IMUL_L( CONST(16), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS ( M(0), XMM1 ) /* m0 */ + MOVSS ( M(5), XMM2 ) /* m5 */ + UNPCKLPS( XMM2, XMM1 ) /* m5 | m0 */ + MOVSS ( ARG_SCALE, XMM0 ) /* scale */ + SHUFPS ( CONST(0x0), XMM0, XMM0 ) /* scale | scale */ + MULPS ( XMM0, XMM1 ) /* m5*scale | m0*scale */ + MULSS ( M(10), XMM0 ) /* m10*scale */ + +ALIGNTEXT32 +LLBL(K_G3TRNNRR_top): + MOVLPS ( S(0), XMM2 ) /* uy | ux */ + MULPS ( XMM1, XMM2 ) /* uy*m5*scale | ux*m0*scale */ + MOVLPS ( XMM2, D(0) ) /* ->D(1) | D(0) */ + + MOVSS ( S(2), XMM2 ) /* uz */ + MULSS ( XMM0, XMM2 ) /* uz*m10*scale */ + MOVSS ( XMM2, D(2) ) /* ->D(2) */ + +LLBL(K_G3TRNNRR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_G3TRNNRR_top) ) + +LLBL(K_G3TRNNRR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_sse_transform_rescale_normals) +HIDDEN(_mesa_sse_transform_rescale_normals) +GLNAME(_mesa_sse_transform_rescale_normals): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L ( ARG_IN, ESI ) /* ptr to source GLvector3f */ + MOV_L ( ARG_DEST, EDI ) /* ptr to dest GLvector3f */ + + MOV_L ( ARG_MAT, EDX ) /* ptr to matrix */ + MOV_L ( REGOFF(MATRIX_INV, EDX), EDX) /* matrix->inv */ + + MOV_L ( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L ( ECX, ECX ) + JZ( LLBL(K_G3TRNR_finish) ) /* count was zero; go to finish */ + + MOV_L ( STRIDE, EAX ) /* stride */ + MOV_L ( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest-count */ + + IMUL_L( CONST(16), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS ( M(0), XMM0 ) /* m0 */ + MOVSS ( M(4), XMM1 ) /* m4 */ + UNPCKLPS( XMM1, XMM0 ) /* m4 | m0 */ + + MOVSS ( ARG_SCALE, XMM4 ) /* scale */ + SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* scale | scale */ + + MULPS ( XMM4, XMM0 ) /* m4*scale | m0*scale */ + MOVSS ( M(1), XMM1 ) /* m1 */ + MOVSS ( M(5), XMM2 ) /* m5 */ + UNPCKLPS( XMM2, XMM1 ) /* m5 | m1 */ + MULPS ( XMM4, XMM1 ) /* m5*scale | m1*scale */ + MOVSS ( M(2), XMM2 ) /* m2 */ + MOVSS ( M(6), XMM3 ) /* m6 */ + UNPCKLPS( XMM3, XMM2 ) /* m6 | m2 */ + MULPS ( XMM4, XMM2 ) /* m6*scale | m2*scale */ + + MOVSS ( M(8), XMM6 ) /* m8 */ + MULSS ( ARG_SCALE, XMM6 ) /* m8*scale */ + MOVSS ( M(9), XMM7 ) /* m9 */ + MULSS ( ARG_SCALE, XMM7 ) /* m9*scale */ + +ALIGNTEXT32 +LLBL(K_G3TRNR_top): + MOVSS ( S(0), XMM3 ) /* ux */ + SHUFPS ( CONST(0x0), XMM3, XMM3 ) /* ux | ux */ + MULPS ( XMM0, XMM3 ) /* ux*m4 | ux*m0 */ + MOVSS ( S(1), XMM4 ) /* uy */ + SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* uy | uy */ + MULPS ( XMM1, XMM4 ) /* uy*m5 | uy*m1 */ + MOVSS ( S(2), XMM5 ) /* uz */ + SHUFPS ( CONST(0x0), XMM5, XMM5 ) /* uz | uz */ + MULPS ( XMM2, XMM5 ) /* uz*m6 | uz*m2 */ + + ADDPS ( XMM4, XMM3 ) + ADDPS ( XMM5, XMM3 ) + MOVLPS ( XMM3, D(0) ) + + MOVSS ( M(10), XMM3 ) /* m10 */ + MULSS ( ARG_SCALE, XMM3 ) /* m10*scale */ + MULSS ( S(2), XMM3 ) /* m10*scale*uz */ + MOVSS ( S(1), XMM4 ) /* uy */ + MULSS ( XMM7, XMM4 ) /* uy*m9*scale */ + MOVSS ( S(0), XMM5 ) /* ux */ + MULSS ( XMM6, XMM5 ) /* ux*m8*scale */ + + ADDSS ( XMM4, XMM3 ) + ADDSS ( XMM5, XMM3 ) + MOVSS ( XMM3, D(2) ) + +LLBL(K_G3TRNR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_G3TRNR_top) ) + +LLBL(K_G3TRNR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_sse_transform_normals_no_rot) +HIDDEN(_mesa_sse_transform_normals_no_rot) +GLNAME(_mesa_sse_transform_normals_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L ( ARG_IN, ESI ) /* ptr to source GLvector3f */ + MOV_L ( ARG_DEST, EDI ) /* ptr to dest GLvector3f */ + + MOV_L ( ARG_MAT, EDX ) /* ptr to matrix */ + MOV_L ( REGOFF(MATRIX_INV, EDX), EDX) /* matrix->inv */ + + MOV_L ( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L ( ECX, ECX ) + JZ( LLBL(K_G3TNNRR_finish) ) /* count was zero; go to finish */ + + MOV_L ( STRIDE, EAX ) /* stride */ + MOV_L ( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest-count */ + + IMUL_L( CONST(16), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS( M(0), XMM0 ) /* m0 */ + MOVSS( M(5), XMM1 ) /* m5 */ + UNPCKLPS( XMM1, XMM0 ) /* m5 | m0 */ + MOVSS( M(10), XMM1 ) /* m10 */ + +ALIGNTEXT32 +LLBL(K_G3TNNRR_top): + MOVLPS( S(0), XMM2 ) /* uy | ux */ + MULPS( XMM0, XMM2 ) /* uy*m5 | ux*m0 */ + MOVLPS( XMM2, D(0) ) + + MOVSS( S(2), XMM2 ) /* uz */ + MULSS( XMM1, XMM2 ) /* uz*m10 */ + MOVSS( XMM2, D(2) ) + +LLBL(K_G3TNNRR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_G3TNNRR_top) ) + +LLBL(K_G3TNNRR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET +#endif diff --git a/reactos/dll/mesa32/src/x86/sse_xform1.S b/reactos/dll/mesa32/src/x86/sse_xform1.S new file mode 100644 index 00000000000..1795c4cf86b --- /dev/null +++ b/reactos/dll/mesa32/src/x86/sse_xform1.S @@ -0,0 +1,442 @@ +/* $Id: sse_xform1.S,v 1.3 2005/01/04 14:33:47 brianp Exp $ */ + +/* + * 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. + */ + +/** TODO: + * - insert PREFETCH instructions to avoid cache-misses ! + * - some more optimizations are possible... + * - for 40-50% more performance in the SSE-functions, the + * data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! + */ + +#ifdef USE_SSE_ASM +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define S(i) REGOFF(i * 4, ESI) +#define D(i) REGOFF(i * 4, EDI) +#define M(i) REGOFF(i * 4, EDX) + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points1_general) +HIDDEN( _mesa_sse_transform_points1_general ) +GLNAME( _mesa_sse_transform_points1_general ): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + CMP_L( CONST(0), ECX ) /* count == 0 ? */ + JE( LLBL(K_GTP1GR_finish) ) /* yes -> nothing to do. */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + +ALIGNTEXT32 + MOVAPS( M(0), XMM0 ) /* m3 | m2 | m1 | m0 */ + MOVAPS( M(12), XMM1 ) /* m15 | m14 | m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP1GR_top): + MOVSS( S(0), XMM2 ) /* ox */ + SHUFPS( CONST(0x0), XMM2, XMM2 ) /* ox | ox | ox | ox */ + MULPS( XMM0, XMM2 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ + ADDPS( XMM1, XMM2 ) /* + | + | + | + */ + MOVUPS( XMM2, D(0) ) + +LLBL(K_GTP1GR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP1GR_top) ) + +LLBL(K_GTP1GR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points1_identity) +HIDDEN(_mesa_sse_transform_points1_identity) +GLNAME( _mesa_sse_transform_points1_identity ): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP1IR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_1), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(1), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + CMP_L( ESI, EDI ) + JE( LLBL(K_GTP1IR_finish) ) + + +ALIGNTEXT32 +LLBL(K_GTP1IR_top): + MOV_L( S(0), EDX ) + MOV_L( EDX, D(0) ) + +LLBL(K_GTP1IR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP1IR_top) ) + +LLBL(K_GTP1IR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points1_3d_no_rot) +HIDDEN(_mesa_sse_transform_points1_3d_no_rot) +GLNAME(_mesa_sse_transform_points1_3d_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP13DNRR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + +ALIGNTEXT32 + MOVSS( M(0), XMM0 ) /* m0 */ + MOVSS( M(12), XMM1 ) /* m12 */ + MOVSS( M(13), XMM2 ) /* m13 */ + MOVSS( M(14), XMM3 ) /* m14 */ + +ALIGNTEXT32 +LLBL(K_GTP13DNRR_top): + MOVSS( S(0), XMM4 ) /* ox */ + MULSS( XMM0, XMM4 ) /* ox*m0 */ + ADDSS( XMM1, XMM4 ) /* ox*m0+m12 */ + MOVSS( XMM4, D(0) ) + + MOVSS( XMM2, D(1) ) + MOVSS( XMM3, D(2) ) + +LLBL(K_GTP13DNRR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP13DNRR_top) ) + +LLBL(K_GTP13DNRR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points1_perspective) +HIDDEN(_mesa_sse_transform_points1_perspective) +GLNAME(_mesa_sse_transform_points1_perspective): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP13PR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + +ALIGNTEXT32 + XORPS( XMM0, XMM0 ) /* 0 | 0 | 0 | 0 */ + MOVSS( M(0), XMM1 ) /* m0 */ + MOVSS( M(14), XMM2 ) /* m14 */ + +ALIGNTEXT32 +LLBL(K_GTP13PR_top): + MOVSS( S(0), XMM3 ) /* ox */ + MULSS( XMM1, XMM3 ) /* ox*m0 */ + MOVSS( XMM3, D(0) ) /* ox*m0->D(0) */ + MOVSS( XMM2, D(2) ) /* m14->D(2) */ + + MOVSS( XMM0, D(1) ) + MOVSS( XMM0, D(3) ) + +LLBL(K_GTP13PR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP13PR_top) ) + +LLBL(K_GTP13PR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points1_2d) +HIDDEN(_mesa_sse_transform_points1_2d) +GLNAME(_mesa_sse_transform_points1_2d): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP13P2DR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVLPS( M(0), XMM0 ) /* m1 | m0 */ + MOVLPS( M(12), XMM1 ) /* m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP13P2DR_top): + MOVSS( S(0), XMM2 ) /* ox */ + SHUFPS( CONST(0x0), XMM2, XMM2 ) /* ox | ox | ox | ox */ + MULPS( XMM0, XMM2 ) /* - | - | ox*m1 | ox*m0 */ + ADDPS( XMM1, XMM2 ) /* - | - | ox*m1+m13 | ox*m0+m12 */ + MOVLPS( XMM2, D(0) ) + +LLBL(K_GTP13P2DR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP13P2DR_top) ) + +LLBL(K_GTP13P2DR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points1_2d_no_rot) +HIDDEN(_mesa_sse_transform_points1_2d_no_rot) +GLNAME(_mesa_sse_transform_points1_2d_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP13P2DNRR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS( M(0), XMM0 ) /* m0 */ + MOVSS( M(12), XMM1 ) /* m12 */ + MOVSS( M(13), XMM2 ) /* m13 */ + +ALIGNTEXT32 +LLBL(K_GTP13P2DNRR_top): + MOVSS( S(0), XMM3 ) /* ox */ + MULSS( XMM0, XMM3 ) /* ox*m0 */ + ADDSS( XMM1, XMM3 ) /* ox*m0+m12 */ + MOVSS( XMM3, D(0) ) + MOVSS( XMM2, D(1) ) + +LLBL(K_GTP13P2DNRR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP13P2DNRR_top) ) + +LLBL(K_GTP13P2DNRR_finish): + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points1_3d) +HIDDEN(_mesa_sse_transform_points1_3d) +GLNAME(_mesa_sse_transform_points1_3d): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP13P3DR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + +ALIGNTEXT32 + MOVAPS( M(0), XMM0 ) /* m3 | m2 | m1 | m0 */ + MOVAPS( M(12), XMM1 ) /* m15 | m14 | m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP13P3DR_top): + MOVSS( S(0), XMM2 ) /* ox */ + SHUFPS( CONST(0x0), XMM2, XMM2 ) /* ox | ox | ox | ox */ + MULPS( XMM0, XMM2 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ + ADDPS( XMM1, XMM2 ) /* +m15 | +m14 | +m13 | +m12 */ + MOVLPS( XMM2, D(0) ) /* - | - | ->D(1)| ->D(0)*/ + UNPCKHPS( XMM2, XMM2 ) /* ox*m3+m15 | ox*m3+m15 | ox*m2+m14 | ox*m2+m14 */ + MOVSS( XMM2, D(2) ) + +LLBL(K_GTP13P3DR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP13P3DR_top) ) + +LLBL(K_GTP13P3DR_finish): + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET +#endif diff --git a/reactos/dll/mesa32/src/x86/sse_xform2.S b/reactos/dll/mesa32/src/x86/sse_xform2.S new file mode 100644 index 00000000000..9393668df02 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/sse_xform2.S @@ -0,0 +1,461 @@ +/* $Id: sse_xform2.S,v 1.3 2005/01/04 14:33:47 brianp Exp $ */ + +/* + * 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. + */ + +/** TODO: + * - insert PREFETCH instructions to avoid cache-misses ! + * - some more optimizations are possible... + * - for 40-50% more performance in the SSE-functions, the + * data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! + */ + +#ifdef USE_SSE_ASM +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define S(i) REGOFF(i * 4, ESI) +#define D(i) REGOFF(i * 4, EDI) +#define M(i) REGOFF(i * 4, EDX) + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points2_general) +HIDDEN (_mesa_sse_transform_points2_general) +GLNAME( _mesa_sse_transform_points2_general ): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX ) + JZ( LLBL(K_GTP2GR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVAPS( M(0), XMM0 ) /* m3 | m2 | m1 | m0 */ + MOVAPS( M(4), XMM1 ) /* m7 | m6 | m5 | m4 */ + MOVAPS( M(12), XMM2 ) /* m15 | m14 | m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP2GR_top): + MOVSS( S(0), XMM3 ) /* ox */ + SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ox | ox | ox | ox */ + MULPS( XMM0, XMM3 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ + MOVSS( S(1), XMM4 ) /* oy */ + SHUFPS( CONST(0x0), XMM4, XMM4 ) /* oy | oy | oy | oy */ + MULPS( XMM1, XMM4 ) /* oy*m7 | oy*m6 | oy*m5 | oy*m4 */ + + ADDPS( XMM4, XMM3 ) + ADDPS( XMM2, XMM3 ) + MOVAPS( XMM3, D(0) ) + +LLBL(K_GTP2GR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP2GR_top) ) + +LLBL(K_GTP2GR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points2_identity) +HIDDEN(_mesa_sse_transform_points2_identity) +GLNAME( _mesa_sse_transform_points2_identity ): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP2IR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + CMP_L( ESI, EDI ) + JE( LLBL(K_GTP2IR_finish) ) + + +ALIGNTEXT32 +LLBL(K_GTP2IR_top): + MOV_L ( S(0), EDX ) + MOV_L ( EDX, D(0) ) + MOV_L ( S(1), EDX ) + MOV_L ( EDX, D(1) ) + +LLBL(K_GTP2IR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP2IR_top) ) + +LLBL(K_GTP2IR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points2_3d_no_rot) +HIDDEN(_mesa_sse_transform_points2_3d_no_rot) +GLNAME(_mesa_sse_transform_points2_3d_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP23DNRR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + +ALIGNTEXT32 + MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ + MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ + UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ + MOVLPS ( M(12), XMM2 ) /* - | - | m13 | m12 */ + MOVSS ( M(14), XMM3 ) /* - | - | - | m14 */ + +ALIGNTEXT32 +LLBL(K_GTP23DNRR_top): + MOVLPS ( S(0), XMM0 ) /* - | - | oy | ox */ + MULPS ( XMM1, XMM0 ) /* - | - | oy*m5 | ox*m0 */ + ADDPS ( XMM2, XMM0 ) /* - | - | +m13 | +m12 */ + MOVLPS ( XMM0, D(0) ) /* -> D(1) | -> D(0) */ + + MOVSS ( XMM3, D(2) ) /* -> D(2) */ + +LLBL(K_GTP23DNRR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP23DNRR_top) ) + +LLBL(K_GTP23DNRR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points2_perspective) +HIDDEN(_mesa_sse_transform_points2_perspective) +GLNAME(_mesa_sse_transform_points2_perspective): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP23PR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ + MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ + UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ + MOVSS ( M(14), XMM3 ) /* m14 */ + XORPS ( XMM0, XMM0 ) /* 0 | 0 | 0 | 0 */ + +ALIGNTEXT32 +LLBL(K_GTP23PR_top): + MOVLPS( S(0), XMM4 ) /* oy | ox */ + MULPS( XMM1, XMM4 ) /* oy*m5 | ox*m0 */ + MOVLPS( XMM4, D(0) ) /* ->D(1) | ->D(0) */ + MOVSS( XMM3, D(2) ) /* ->D(2) */ + MOVSS( XMM0, D(3) ) /* ->D(3) */ + +LLBL(K_GTP23PR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP23PR_top) ) + +LLBL(K_GTP23PR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points2_2d) +HIDDEN(_mesa_sse_transform_points2_2d) +GLNAME(_mesa_sse_transform_points2_2d): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP23P2DR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVLPS( M(0), XMM0 ) /* m1 | m0 */ + MOVLPS( M(4), XMM1 ) /* m5 | m4 */ + MOVLPS( M(12), XMM2 ) /* m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP23P2DR_top): + MOVSS( S(0), XMM3 ) /* ox */ + SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ox | ox */ + MULPS( XMM0, XMM3 ) /* ox*m1 | ox*m0 */ + + MOVSS( S(1), XMM4 ) /* oy */ + SHUFPS( CONST(0x0), XMM4, XMM4 ) /* oy | oy */ + MULPS( XMM1, XMM4 ) /* oy*m5 | oy*m4 */ + + ADDPS( XMM4, XMM3 ) + ADDPS( XMM2, XMM3 ) + MOVLPS( XMM3, D(0) ) /* ->D(1) | ->D(0) */ + +LLBL(K_GTP23P2DR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP23P2DR_top) ) + +LLBL(K_GTP23P2DR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points2_2d_no_rot) +HIDDEN(_mesa_sse_transform_points2_2d_no_rot) +GLNAME(_mesa_sse_transform_points2_2d_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP23P2DNRR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS ( M(0), XMM1 ) /* m0 */ + MOVSS ( M(5), XMM2 ) /* m5 */ + UNPCKLPS ( XMM2, XMM1 ) /* m5 | m0 */ + MOVLPS ( M(12), XMM2 ) /* m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP23P2DNRR_top): + MOVLPS( S(0), XMM0 ) /* oy | ox */ + MULPS( XMM1, XMM0 ) /* oy*m5 | ox*m0 */ + ADDPS( XMM2, XMM0 ) /* +m13 | +m12 */ + MOVLPS( XMM0, D(0) ) /* ->D(1) | ->D(0) */ + +LLBL(K_GTP23P2DNRR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP23P2DNRR_top) ) + +LLBL(K_GTP23P2DNRR_finish): + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points2_3d) +HIDDEN(_mesa_sse_transform_points2_3d) +GLNAME(_mesa_sse_transform_points2_3d): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP23P3DR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVAPS( M(0), XMM0 ) /* m2 | m1 | m0 */ + MOVAPS( M(4), XMM1 ) /* m6 | m5 | m4 */ + MOVAPS( M(12), XMM2 ) /* m14 | m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP23P3DR_top): + MOVSS( S(0), XMM3 ) /* ox */ + SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ox | ox | ox */ + MULPS( XMM0, XMM3 ) /* ox*m2 | ox*m1 | ox*m0 */ + + MOVSS( S(1), XMM4 ) /* oy */ + SHUFPS( CONST(0x0), XMM4, XMM4 ) /* oy | oy | oy */ + MULPS( XMM1, XMM4 ) /* oy*m6 | oy*m5 | oy*m4 */ + + ADDPS( XMM4, XMM3 ) + ADDPS( XMM2, XMM3 ) + + MOVLPS( XMM3, D(0) ) /* ->D(1) | ->D(0) */ + UNPCKHPS( XMM3, XMM3 ) + MOVSS( XMM3, D(2) ) /* ->D(2) */ + +LLBL(K_GTP23P3DR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP23P3DR_top) ) + +LLBL(K_GTP23P3DR_finish): + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET +#endif diff --git a/reactos/dll/mesa32/src/x86/sse_xform3.S b/reactos/dll/mesa32/src/x86/sse_xform3.S new file mode 100644 index 00000000000..db0b3cbfc5b --- /dev/null +++ b/reactos/dll/mesa32/src/x86/sse_xform3.S @@ -0,0 +1,507 @@ +/* $Id: sse_xform3.S,v 1.3 2005/01/04 14:33:47 brianp Exp $ */ + +/* + * 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. + */ + +/** TODO: + * - insert PREFETCH instructions to avoid cache-misses ! + * - some more optimizations are possible... + * - for 40-50% more performance in the SSE-functions, the + * data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! + */ + +#ifdef USE_SSE_ASM +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define S(i) REGOFF(i * 4, ESI) +#define D(i) REGOFF(i * 4, EDI) +#define M(i) REGOFF(i * 4, EDX) + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points3_general) +HIDDEN(_mesa_sse_transform_points3_general) +GLNAME( _mesa_sse_transform_points3_general ): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + CMP_L ( CONST(0), ECX ) /* count == 0 ? */ + JE ( LLBL(K_GTPGR_finish) ) /* yes -> nothing to do. */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + +ALIGNTEXT32 + MOVAPS ( REGOFF(0, EDX), XMM0 ) /* m0 | m1 | m2 | m3 */ + MOVAPS ( REGOFF(16, EDX), XMM1 ) /* m4 | m5 | m6 | m7 */ + MOVAPS ( REGOFF(32, EDX), XMM2 ) /* m8 | m9 | m10 | m11 */ + MOVAPS ( REGOFF(48, EDX), XMM3 ) /* m12 | m13 | m14 | m15 */ + + +ALIGNTEXT32 +LLBL(K_GTPGR_top): + MOVSS ( REGOFF(0, ESI), XMM4 ) /* | | | ox */ + SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* ox | ox | ox | ox */ + MOVSS ( REGOFF(4, ESI), XMM5 ) /* | | | oy */ + SHUFPS ( CONST(0x0), XMM5, XMM5 ) /* oy | oy | oy | oy */ + MOVSS ( REGOFF(8, ESI), XMM6 ) /* | | | oz */ + SHUFPS ( CONST(0x0), XMM6, XMM6 ) /* oz | oz | oz | oz */ + + MULPS ( XMM0, XMM4 ) /* m3*ox | m2*ox | m1*ox | m0*ox */ + MULPS ( XMM1, XMM5 ) /* m7*oy | m6*oy | m5*oy | m4*oy */ + MULPS ( XMM2, XMM6 ) /* m11*oz | m10*oz | m9*oz | m8*oz */ + + ADDPS ( XMM5, XMM4 ) + ADDPS ( XMM6, XMM4 ) + ADDPS ( XMM3, XMM4 ) + + MOVAPS ( XMM4, REGOFF(0, EDI) ) + +LLBL(K_GTPGR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTPGR_top) ) + +LLBL(K_GTPGR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points3_identity) +HIDDEN(_mesa_sse_transform_points3_identity) +GLNAME( _mesa_sse_transform_points3_identity ): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTPIR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + CMP_L( ESI, EDI ) + JE( LLBL(K_GTPIR_finish) ) + + +ALIGNTEXT32 +LLBL(K_GTPIR_top): + MOVLPS ( S(0), XMM0 ) + MOVLPS ( XMM0, D(0) ) + MOVSS ( S(2), XMM0 ) + MOVSS ( XMM0, D(2) ) + +LLBL(K_GTPIR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTPIR_top) ) + +LLBL(K_GTPIR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points3_3d_no_rot) +HIDDEN(_mesa_sse_transform_points3_3d_no_rot) +GLNAME(_mesa_sse_transform_points3_3d_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP3DNRR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + +ALIGNTEXT32 + MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ + MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ + UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ + MOVLPS ( M(12), XMM2 ) /* - | - | m13 | m12 */ + MOVSS ( M(10), XMM3 ) /* - | - | - | m10 */ + MOVSS ( M(14), XMM4 ) /* - | - | - | m14 */ + +ALIGNTEXT32 +LLBL(K_GTP3DNRR_top): + + MOVLPS ( S(0), XMM0 ) /* - | - | s1 | s0 */ + MULPS ( XMM1, XMM0 ) /* - | - | s1*m5 | s0*m0 */ + ADDPS ( XMM2, XMM0 ) /* - | - | +m13 | +m12 */ + MOVLPS ( XMM0, D(0) ) /* -> D(1) | -> D(0) */ + + MOVSS ( S(2), XMM0 ) /* sz */ + MULSS ( XMM3, XMM0 ) /* sz*m10 */ + ADDSS ( XMM4, XMM0 ) /* +m14 */ + MOVSS ( XMM0, D(2) ) /* -> D(2) */ + +LLBL(K_GTP3DNRR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP3DNRR_top) ) + +LLBL(K_GTP3DNRR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points3_perspective) +HIDDEN(_mesa_sse_transform_points3_perspective) +GLNAME(_mesa_sse_transform_points3_perspective): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP3PR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ + MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ + UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ + MOVLPS ( M(8), XMM2 ) /* - | - | m9 | m8 */ + MOVSS ( M(10), XMM3 ) /* m10 */ + MOVSS ( M(14), XMM4 ) /* m14 */ + XORPS ( XMM6, XMM6 ) /* 0 */ + +ALIGNTEXT32 +LLBL(K_GTP3PR_top): + MOVLPS ( S(0), XMM0 ) /* oy | ox */ + MULPS ( XMM1, XMM0 ) /* oy*m5 | ox*m0 */ + MOVSS ( S(2), XMM5 ) /* oz */ + SHUFPS ( CONST(0x0), XMM5, XMM5 ) /* oz | oz */ + MULPS ( XMM2, XMM5 ) /* oz*m9 | oz*m8 */ + ADDPS ( XMM5, XMM0 ) /* +oy*m5 | +ox*m0 */ + MOVLPS ( XMM0, D(0) ) /* ->D(1) | ->D(0) */ + + MOVSS ( S(2), XMM0 ) /* oz */ + MULSS ( XMM3, XMM0 ) /* oz*m10 */ + ADDSS ( XMM4, XMM0 ) /* +m14 */ + MOVSS ( XMM0, D(2) ) /* ->D(2) */ + + MOVSS ( S(2), XMM0 ) /* oz */ + MOVSS ( XMM6, XMM5 ) /* 0 */ + SUBPS ( XMM0, XMM5 ) /* -oz */ + MOVSS ( XMM5, D(3) ) /* ->D(3) */ + +LLBL(K_GTP3PR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP3PR_top) ) + +LLBL(K_GTP3PR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points3_2d) +HIDDEN(_mesa_sse_transform_points3_2d) +GLNAME(_mesa_sse_transform_points3_2d): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP3P2DR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVLPS( M(0), XMM0 ) /* m1 | m0 */ + MOVLPS( M(4), XMM1 ) /* m5 | m4 */ + MOVLPS( M(12), XMM2 ) /* m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP3P2DR_top): + MOVSS ( S(0), XMM3 ) /* ox */ + SHUFPS ( CONST(0x0), XMM3, XMM3 ) /* ox | ox */ + MULPS ( XMM0, XMM3 ) /* ox*m1 | ox*m0 */ + MOVSS ( S(1), XMM4 ) /* oy */ + SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* oy | oy */ + MULPS ( XMM1, XMM4 ) /* oy*m5 | oy*m4 */ + + ADDPS ( XMM4, XMM3 ) + ADDPS ( XMM2, XMM3 ) + MOVLPS ( XMM3, D(0) ) + + MOVSS ( S(2), XMM3 ) + MOVSS ( XMM3, D(2) ) + +LLBL(K_GTP3P2DR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP3P2DR_top) ) + +LLBL(K_GTP3P2DR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points3_2d_no_rot) +HIDDEN(_mesa_sse_transform_points3_2d_no_rot) +GLNAME(_mesa_sse_transform_points3_2d_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP3P2DNRR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS ( M(0), XMM1 ) /* m0 */ + MOVSS ( M(5), XMM2 ) /* m5 */ + UNPCKLPS ( XMM2, XMM1 ) /* m5 | m0 */ + MOVLPS ( M(12), XMM2 ) /* m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP3P2DNRR_top): + MOVLPS( S(0), XMM0 ) /* oy | ox */ + MULPS( XMM1, XMM0 ) /* oy*m5 | ox*m0 */ + ADDPS( XMM2, XMM0 ) /* +m13 | +m12 */ + MOVLPS( XMM0, D(0) ) /* ->D(1) | ->D(0) */ + + MOVSS( S(2), XMM0 ) + MOVSS( XMM0, D(2) ) + +LLBL(K_GTP3P2DNRR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP3P2DNRR_top) ) + +LLBL(K_GTP3P2DNRR_finish): + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points3_3d) +HIDDEN(_mesa_sse_transform_points3_3d) +GLNAME(_mesa_sse_transform_points3_3d): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP3P3DR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + +ALIGNTEXT32 + MOVAPS( M(0), XMM0 ) /* m2 | m1 | m0 */ + MOVAPS( M(4), XMM1 ) /* m6 | m5 | m4 */ + MOVAPS( M(8), XMM2 ) /* m10 | m9 | m8 */ + MOVAPS( M(12), XMM3 ) /* m14 | m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP3P3DR_top): + MOVSS( S(0), XMM4 ) + SHUFPS( CONST(0x0), XMM4, XMM4 ) /* ox | ox | ox */ + MULPS( XMM0, XMM4 ) /* ox*m2 | ox*m1 | ox*m0 */ + + MOVSS( S(1), XMM5 ) + SHUFPS( CONST(0x0), XMM5, XMM5 ) /* oy | oy | oy */ + MULPS( XMM1, XMM5 ) /* oy*m6 | oy*m5 | oy*m4 */ + + MOVSS( S(2), XMM6 ) + SHUFPS( CONST(0x0), XMM6, XMM6 ) /* oz | oz | oz */ + MULPS( XMM2, XMM6 ) /* oz*m10 | oz*m9 | oz*m8 */ + + ADDPS( XMM5, XMM4 ) /* + | + | + */ + ADDPS( XMM6, XMM4 ) /* + | + | + */ + ADDPS( XMM3, XMM4 ) /* + | + | + */ + + MOVLPS( XMM4, D(0) ) /* => D(1) | => D(0) */ + UNPCKHPS( XMM4, XMM4 ) + MOVSS( XMM4, D(2) ) + +LLBL(K_GTP3P3DR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP3P3DR_top) ) + +LLBL(K_GTP3P3DR_finish): + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET +#endif diff --git a/reactos/dll/mesa32/src/x86/sse_xform4.S b/reactos/dll/mesa32/src/x86/sse_xform4.S new file mode 100644 index 00000000000..aef62b00aa8 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/sse_xform4.S @@ -0,0 +1,231 @@ +/* $Id: sse_xform4.S,v 1.3 2005/01/04 14:33:47 brianp Exp $ */ + +/* + * 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. + */ + +#ifdef USE_SSE_ASM +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FRAME_OFFSET 8 + +#define SRC(i) REGOFF(i * 4, ESI) +#define DST(i) REGOFF(i * 4, EDI) +#define MAT(i) REGOFF(i * 4, EDX) + +#define SELECT(r0, r1, r2, r3) CONST( r0 * 64 + r1 * 16 + r2 * 4 + r3 ) + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_sse_transform_points4_general ) +HIDDEN(_mesa_sse_transform_points4_general) +GLNAME( _mesa_sse_transform_points4_general ): + + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) /* verify non-zero count */ + JE( LLBL( sse_general_done ) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) )/* set dest size */ + + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + + PREFETCHT0( REGIND(ESI) ) + + MOVAPS( MAT(0), XMM4 ) /* m3 | m2 | m1 | m0 */ + MOVAPS( MAT(4), XMM5 ) /* m7 | m6 | m5 | m4 */ + MOVAPS( MAT(8), XMM6 ) /* m11 | m10 | m9 | m8 */ + MOVAPS( MAT(12), XMM7 ) /* m15 | m14 | m13 | m12 */ + +ALIGNTEXT16 +LLBL( sse_general_loop ): + + MOVSS( SRC(0), XMM0 ) /* ox */ + SHUFPS( CONST(0x0), XMM0, XMM0 ) /* ox | ox | ox | ox */ + MULPS( XMM4, XMM0 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ + + MOVSS( SRC(1), XMM1 ) /* oy */ + SHUFPS( CONST(0x0), XMM1, XMM1 ) /* oy | oy | oy | oy */ + MULPS( XMM5, XMM1 ) /* oy*m7 | oy*m6 | oy*m5 | oy*m4 */ + + MOVSS( SRC(2), XMM2 ) /* oz */ + SHUFPS( CONST(0x0), XMM2, XMM2 ) /* oz | oz | oz | oz */ + MULPS( XMM6, XMM2 ) /* oz*m11 | oz*m10 | oz*m9 | oz*m8 */ + + MOVSS( SRC(3), XMM3 ) /* ow */ + SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ow | ow | ow | ow */ + MULPS( XMM7, XMM3 ) /* ow*m15 | ow*m14 | ow*m13 | ow*m12 */ + + ADDPS( XMM1, XMM0 ) /* ox*m3+oy*m7 | ... */ + ADDPS( XMM2, XMM0 ) /* ox*m3+oy*m7+oz*m11 | ... */ + ADDPS( XMM3, XMM0 ) /* ox*m3+oy*m7+oz*m11+ow*m15 | ... */ + MOVAPS( XMM0, DST(0) ) /* ->D(3) | ->D(2) | ->D(1) | ->D(0) */ + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + + DEC_L( ECX ) + JNZ( LLBL( sse_general_loop ) ) + +LLBL( sse_general_done ): + + POP_L( EDI ) + POP_L( ESI ) + RET + + + + +ALIGNTEXT4 +GLOBL GLNAME( _mesa_sse_transform_points4_3d ) +HIDDEN(_mesa_sse_transform_points4_3d) +GLNAME( _mesa_sse_transform_points4_3d ): + + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) /* ptr to source GLvector4f */ + MOV_L( ARG_DEST, EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP43P3DR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) )/* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + MOVAPS( MAT(0), XMM0 ) /* m3 | m2 | m1 | m0 */ + MOVAPS( MAT(4), XMM1 ) /* m7 | m6 | m5 | m4 */ + MOVAPS( MAT(8), XMM2 ) /* m11 | m10 | m9 | m8 */ + MOVAPS( MAT(12), XMM3 ) /* m15 | m14 | m13 | m12 */ + +ALIGNTEXT32 +LLBL( K_GTP43P3DR_top ): + MOVSS( SRC(0), XMM4 ) /* ox */ + SHUFPS( CONST(0x0), XMM4, XMM4 ) /* ox | ox | ox | ox */ + MULPS( XMM0, XMM4 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ + + MOVSS( SRC(1), XMM5 ) /* oy */ + SHUFPS( CONST(0x0), XMM5, XMM5 ) /* oy | oy | oy | oy */ + MULPS( XMM1, XMM5 ) /* oy*m7 | oy*m6 | oy*m5 | oy*m4 */ + + MOVSS( SRC(2), XMM6 ) /* oz */ + SHUFPS( CONST(0x0), XMM6, XMM6 ) /* oz | oz | oz | oz */ + MULPS( XMM2, XMM6 ) /* oz*m11 | oz*m10 | oz*m9 | oz*m8 */ + + MOVSS( SRC(3), XMM7 ) /* ow */ + SHUFPS( CONST(0x0), XMM7, XMM7 ) /* ow | ow | ow | ow */ + MULPS( XMM3, XMM7 ) /* ow*m15 | ow*m14 | ow*m13 | ow*m12 */ + + ADDPS( XMM5, XMM4 ) /* ox*m3+oy*m7 | ... */ + ADDPS( XMM6, XMM4 ) /* ox*m3+oy*m7+oz*m11 | ... */ + ADDPS( XMM7, XMM4 ) /* ox*m3+oy*m7+oz*m11+ow*m15 | ... */ + MOVAPS( XMM4, DST(0) ) /* ->D(3) | ->D(2) | ->D(1) | ->D(0) */ + + MOVSS( SRC(3), XMM4 ) /* ow */ + MOVSS( XMM4, DST(3) ) /* ->D(3) */ + +LLBL( K_GTP43P3DR_skip ): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP43P3DR_top) ) + +LLBL( K_GTP43P3DR_finish ): + POP_L( EDI ) + POP_L( ESI ) + RET + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_sse_transform_points4_identity ) +HIDDEN(_mesa_sse_transform_points4_identity) +GLNAME( _mesa_sse_transform_points4_identity ): + + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) /* verify non-zero count */ + JE( LLBL( sse_identity_done ) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) )/* set dest size */ + + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + +ALIGNTEXT16 +LLBL( sse_identity_loop ): + + PREFETCHNTA( REGOFF(32, ESI) ) + + MOVAPS( REGIND(ESI), XMM0 ) + ADD_L( EAX, ESI ) + + MOVAPS( XMM0, REGIND(EDI) ) + ADD_L( CONST(16), EDI ) + + DEC_L( ECX ) + JNZ( LLBL( sse_identity_loop ) ) + +LLBL( sse_identity_done ): + + POP_L( EDI ) + POP_L( ESI ) + RET +#endif diff --git a/reactos/dll/mesa32/src/x86/x86.c b/reactos/dll/mesa32/src/x86/x86.c new file mode 100644 index 00000000000..16586b9727d --- /dev/null +++ b/reactos/dll/mesa32/src/x86/x86.c @@ -0,0 +1,96 @@ +/* $Id: x86.c,v 1.25 2002/04/09 14:58:03 keithw Exp $ */ + +/* + * 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. + */ + +/* + * Intel x86 assembly code by Josh Vanderhoof + */ + +#include "glheader.h" +#include "context.h" +#include "math/m_xform.h" +#include "tnl/t_context.h" + +#include "x86.h" +#include "common_x86_macros.h" + +#ifdef DEBUG +#include "math/m_debug.h" +#endif + + +#ifdef USE_X86_ASM +DECLARE_XFORM_GROUP( x86, 2 ) +DECLARE_XFORM_GROUP( x86, 3 ) +DECLARE_XFORM_GROUP( x86, 4 ) + + +extern GLvector4f * _ASMAPI +_mesa_x86_cliptest_points4( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ); + +extern GLvector4f * _ASMAPI +_mesa_x86_cliptest_points4_np( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ); + +extern void _ASMAPI +_mesa_v16_x86_cliptest_points4( GLfloat *first_vert, + GLfloat *last_vert, + GLubyte *or_mask, + GLubyte *and_mask, + GLubyte *clip_mask ); + +extern void _ASMAPI +_mesa_v16_x86_general_xform( GLfloat *dest, + const GLfloat *m, + const GLfloat *src, + GLuint src_stride, + GLuint count ); +#endif + + +void _mesa_init_x86_transform_asm( void ) +{ +#ifdef USE_X86_ASM + ASSIGN_XFORM_GROUP( x86, 2 ); + ASSIGN_XFORM_GROUP( x86, 3 ); + ASSIGN_XFORM_GROUP( x86, 4 ); + + _mesa_clip_tab[4] = _mesa_x86_cliptest_points4; + _mesa_clip_np_tab[4] = _mesa_x86_cliptest_points4_np; + +#ifdef DEBUG + _math_test_all_transform_functions( "x86" ); + _math_test_all_cliptest_functions( "x86" ); +#endif +#endif +} + diff --git a/reactos/dll/mesa32/src/x86/x86.h b/reactos/dll/mesa32/src/x86/x86.h new file mode 100644 index 00000000000..a646aff46b6 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/x86.h @@ -0,0 +1,36 @@ +/* $Id: x86.h,v 1.5 2002/04/09 14:58:03 keithw Exp $ */ + +/* + * 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. + */ + +/* + * Intel x86 assembly code by Josh Vanderhoof + */ + +#ifndef __X86_H__ +#define __X86_H__ + +extern void _mesa_init_x86_transform_asm( void ); + +#endif diff --git a/reactos/dll/mesa32/src/x86/x86_cliptest.S b/reactos/dll/mesa32/src/x86/x86_cliptest.S new file mode 100644 index 00000000000..f4038a583ae --- /dev/null +++ b/reactos/dll/mesa32/src/x86/x86_cliptest.S @@ -0,0 +1,403 @@ +/* $Id: x86_cliptest.S,v 1.11 2005/01/04 14:33:47 brianp Exp $ */ + +/* + * 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. + */ + +/* + * NOTE: Avoid using spaces in between '(' ')' and arguments, especially + * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces + * in there will break the build on some platforms. + */ + +#include "matypes.h" +#include "clip_args.h" + +#define SRC0 REGOFF(0, ESI) +#define SRC1 REGOFF(4, ESI) +#define SRC2 REGOFF(8, ESI) +#define SRC3 REGOFF(12, ESI) +#define DST0 REGOFF(0, EDI) +#define DST1 REGOFF(4, EDI) +#define DST2 REGOFF(8, EDI) +#define DST3 REGOFF(12, EDI) +#define MAT0 REGOFF(0, EDX) +#define MAT1 REGOFF(4, EDX) +#define MAT2 REGOFF(8, EDX) +#define MAT3 REGOFF(12, EDX) + + +/* + * Table for clip test. + * + * bit6 = SRC3 < 0 + * bit5 = SRC2 < 0 + * bit4 = abs(S(2)) > abs(S(3)) + * bit3 = SRC1 < 0 + * bit2 = abs(S(1)) > abs(S(3)) + * bit1 = SRC0 < 0 + * bit0 = abs(S(0)) > abs(S(3)) + */ + + SEG_DATA + +clip_table: + D_BYTE 0x00, 0x01, 0x00, 0x02, 0x04, 0x05, 0x04, 0x06 + D_BYTE 0x00, 0x01, 0x00, 0x02, 0x08, 0x09, 0x08, 0x0a + D_BYTE 0x20, 0x21, 0x20, 0x22, 0x24, 0x25, 0x24, 0x26 + D_BYTE 0x20, 0x21, 0x20, 0x22, 0x28, 0x29, 0x28, 0x2a + D_BYTE 0x00, 0x01, 0x00, 0x02, 0x04, 0x05, 0x04, 0x06 + D_BYTE 0x00, 0x01, 0x00, 0x02, 0x08, 0x09, 0x08, 0x0a + D_BYTE 0x10, 0x11, 0x10, 0x12, 0x14, 0x15, 0x14, 0x16 + D_BYTE 0x10, 0x11, 0x10, 0x12, 0x18, 0x19, 0x18, 0x1a + D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x37, 0x35, 0x37, 0x36 + D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x3b, 0x39, 0x3b, 0x3a + D_BYTE 0x2f, 0x2d, 0x2f, 0x2e, 0x27, 0x25, 0x27, 0x26 + D_BYTE 0x2f, 0x2d, 0x2f, 0x2e, 0x2b, 0x29, 0x2b, 0x2a + D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x37, 0x35, 0x37, 0x36 + D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x3b, 0x39, 0x3b, 0x3a + D_BYTE 0x1f, 0x1d, 0x1f, 0x1e, 0x17, 0x15, 0x17, 0x16 + D_BYTE 0x1f, 0x1d, 0x1f, 0x1e, 0x1b, 0x19, 0x1b, 0x1a + + + SEG_TEXT + +/* + * _mesa_x86_cliptest_points4 + * + * AL: ormask + * AH: andmask + * EBX: temp0 + * ECX: temp1 + * EDX: clipmask[] + * ESI: clip[] + * EDI: proj[] + * EBP: temp2 + */ + +#if defined(__ELF__) && defined(__PIC__) && defined(GNU_ASSEMBLER) && !defined(ELFPIC) +#define ELFPIC +#endif + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_cliptest_points4 ) +HIDDEN(_mesa_x86_cliptest_points4) +GLNAME( _mesa_x86_cliptest_points4 ): + +#ifdef ELFPIC +#define FRAME_OFFSET 20 +#else +#define FRAME_OFFSET 16 +#endif + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBP ) + PUSH_L( EBX ) + +#ifdef ELFPIC + /* store pointer to clip_table on stack */ + CALL( LLBL(ctp4_get_eip) ) + ADD_L( CONST(_GLOBAL_OFFSET_TABLE_), EBX ) + MOV_L( REGOFF(clip_table@GOT, EBX), EBX ) + PUSH_L( EBX ) + JMP( LLBL(ctp4_clip_table_ready) ) + +LLBL(ctp4_get_eip): + /* store eip in ebx */ + MOV_L( REGIND(ESP), EBX ) + RET + +LLBL(ctp4_clip_table_ready): +#endif + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_CLIP, EDX ) + MOV_L( ARG_OR, EBX ) + + MOV_L( ARG_AND, EBP ) + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + MOV_L( EAX, ARG_SOURCE ) /* put stride in ARG_SOURCE */ + + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDX, ECX ) + + MOV_L( ECX, ARG_CLIP ) /* put clipmask + count in ARG_CLIP */ + CMP_L( ECX, EDX ) + + MOV_B( REGIND(EBX), AL ) + MOV_B( REGIND(EBP), AH ) + + JZ( LLBL(ctp4_finish) ) + +ALIGNTEXT16 +LLBL(ctp4_top): + + FLD1 /* F3 */ + FDIV_S( SRC3 ) /* GH: don't care about div-by-zero */ + + MOV_L( SRC3, EBP ) + MOV_L( SRC2, EBX ) + + XOR_L( ECX, ECX ) + ADD_L( EBP, EBP ) /* ebp = abs(S(3))*2 ; carry = sign of S(3) */ + + ADC_L( ECX, ECX ) + ADD_L( EBX, EBX ) /* ebx = abs(S(2))*2 ; carry = sign of S(2) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(2))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + MOV_L( SRC1, EBX ) + + ADD_L( EBX, EBX ) /* ebx = abs(S(1))*2 ; carry = sign of S(1) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(1))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + MOV_L( SRC0, EBX ) + + ADD_L( EBX, EBX ) /* ebx = abs(S(0))*2 ; carry = sign of S(0) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(0))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + +#ifdef ELFPIC + MOV_L( REGIND(ESP), EBP ) /* clip_table */ + + MOV_B( REGBI(EBP, ECX), CL ) +#else + MOV_B( REGOFF(clip_table,ECX), CL ) +#endif + + OR_B( CL, AL ) + AND_B( CL, AH ) + + TEST_B( CL, CL ) + MOV_B( CL, REGIND(EDX) ) + + JZ( LLBL(ctp4_proj) ) + +LLBL(ctp4_noproj): + + FSTP( ST(0) ) /* */ + + MOV_L( CONST(0), DST0 ) + MOV_L( CONST(0), DST1 ) + MOV_L( CONST(0), DST2 ) + MOV_L( CONST(0x3f800000), DST3 ) + + JMP( LLBL(ctp4_next) ) + +LLBL(ctp4_proj): + + FLD_S( SRC0 ) /* F0 F3 */ + FMUL2( ST(1), ST0 ) + + FLD_S( SRC1 ) /* F1 F0 F3 */ + FMUL2( ST(2), ST0 ) + + FLD_S( SRC2 ) /* F2 F1 F0 F3 */ + FMUL2( ST(3), ST0 ) + + FXCH( ST(2) ) /* F0 F1 F2 F3 */ + FSTP_S( DST0 ) /* F1 F2 F3 */ + FSTP_S( DST1 ) /* F2 F3 */ + FSTP_S( DST2 ) /* F3 */ + FSTP_S( DST3 ) /* */ + +LLBL(ctp4_next): + + INC_L( EDX ) + ADD_L( CONST(16), EDI ) + + ADD_L( ARG_SOURCE, ESI ) + CMP_L( EDX, ARG_CLIP ) + + JNZ( LLBL(ctp4_top) ) + + MOV_L( ARG_OR, ECX ) + MOV_L( ARG_AND, EDX ) + + MOV_B( AL, REGIND(ECX) ) + MOV_B( AH, REGIND(EDX) ) + +LLBL(ctp4_finish): + + MOV_L( ARG_DEST, EAX ) +#ifdef ELFPIC + POP_L( ESI ) /* discard ptr to clip_table */ +#endif + POP_L( EBX ) + POP_L( EBP ) + POP_L( EDI ) + POP_L( ESI ) + + RET + + + + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_cliptest_points4_np ) +HIDDEN(_mesa_x86_cliptest_points4_np) +GLNAME( _mesa_x86_cliptest_points4_np ): + +#ifdef ELFPIC +#define FRAME_OFFSET 20 +#else +#define FRAME_OFFSET 16 +#endif + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBP ) + PUSH_L( EBX ) + +#ifdef ELFPIC + /* store pointer to clip_table on stack */ + CALL( LLBL(ctp4_np_get_eip) ) + ADD_L( CONST(_GLOBAL_OFFSET_TABLE_), EBX ) + MOV_L( REGOFF(clip_table@GOT, EBX), EBX ) + PUSH_L( EBX ) + JMP( LLBL(ctp4_np_clip_table_ready) ) + +LLBL(ctp4_np_get_eip): + /* store eip in ebx */ + MOV_L( REGIND(ESP), EBX ) + RET + +LLBL(ctp4_np_clip_table_ready): +#endif + + MOV_L( ARG_SOURCE, ESI ) + /* slot */ + + MOV_L( ARG_CLIP, EDX ) + MOV_L( ARG_OR, EBX ) + + MOV_L( ARG_AND, EBP ) + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( EAX, ARG_DEST ) /* put stride in ARG_DEST */ + ADD_L( EDX, ECX ) + + MOV_L( ECX, EDI ) /* put clipmask + count in EDI */ + CMP_L( ECX, EDX ) + + MOV_B( REGIND(EBX), AL ) + MOV_B( REGIND(EBP), AH ) + + JZ( LLBL(ctp4_np_finish) ) + +ALIGNTEXT16 +LLBL(ctp4_np_top): + + MOV_L( SRC3, EBP ) + MOV_L( SRC2, EBX ) + + XOR_L( ECX, ECX ) + ADD_L( EBP, EBP ) /* ebp = abs(S(3))*2 ; carry = sign of S(3) */ + + ADC_L( ECX, ECX ) + ADD_L( EBX, EBX ) /* ebx = abs(S(2))*2 ; carry = sign of S(2) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(2))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + MOV_L( SRC1, EBX ) + + ADD_L( EBX, EBX ) /* ebx = abs(S(1))*2 ; carry = sign of S(1) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(1))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + MOV_L( SRC0, EBX ) + + ADD_L( EBX, EBX ) /* ebx = abs(S(0))*2 ; carry = sign of S(0) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(0))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + +#ifdef ELFPIC + MOV_L( REGIND(ESP), EBP ) /* clip_table */ + + MOV_B( REGBI(EBP, ECX), CL ) +#else + MOV_B( REGOFF(clip_table,ECX), CL ) +#endif + + OR_B( CL, AL ) + AND_B( CL, AH ) + + TEST_B( CL, CL ) + MOV_B( CL, REGIND(EDX) ) + + INC_L( EDX ) + /* slot */ + + ADD_L( ARG_DEST, ESI ) + CMP_L( EDX, EDI ) + + JNZ( LLBL(ctp4_np_top) ) + + MOV_L( ARG_OR, ECX ) + MOV_L( ARG_AND, EDX ) + + MOV_B( AL, REGIND(ECX) ) + MOV_B( AH, REGIND(EDX) ) + +LLBL(ctp4_np_finish): + + MOV_L( ARG_SOURCE, EAX ) +#ifdef ELFPIC + POP_L( ESI ) /* discard ptr to clip_table */ +#endif + POP_L( EBX ) + POP_L( EBP ) + POP_L( EDI ) + POP_L( ESI ) + + RET diff --git a/reactos/dll/mesa32/src/x86/x86_xform2.S b/reactos/dll/mesa32/src/x86/x86_xform2.S new file mode 100644 index 00000000000..bb255b48550 --- /dev/null +++ b/reactos/dll/mesa32/src/x86/x86_xform2.S @@ -0,0 +1,570 @@ +/* $Id: x86_xform2.S,v 1.3 2005/01/04 14:33:47 brianp Exp $ */ + +/* + * 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. + */ + +/* + * NOTE: Avoid using spaces in between '(' ')' and arguments, especially + * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces + * in there will break the build on some platforms. + */ + +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FP_ONE 1065353216 +#define FP_ZERO 0 + +#define SRC0 REGOFF(0, ESI) +#define SRC1 REGOFF(4, ESI) +#define SRC2 REGOFF(8, ESI) +#define SRC3 REGOFF(12, ESI) +#define DST0 REGOFF(0, EDI) +#define DST1 REGOFF(4, EDI) +#define DST2 REGOFF(8, EDI) +#define DST3 REGOFF(12, EDI) +#define MAT0 REGOFF(0, EDX) +#define MAT1 REGOFF(4, EDX) +#define MAT2 REGOFF(8, EDX) +#define MAT3 REGOFF(12, EDX) +#define MAT4 REGOFF(16, EDX) +#define MAT5 REGOFF(20, EDX) +#define MAT6 REGOFF(24, EDX) +#define MAT7 REGOFF(28, EDX) +#define MAT8 REGOFF(32, EDX) +#define MAT9 REGOFF(36, EDX) +#define MAT10 REGOFF(40, EDX) +#define MAT11 REGOFF(44, EDX) +#define MAT12 REGOFF(48, EDX) +#define MAT13 REGOFF(52, EDX) +#define MAT14 REGOFF(56, EDX) +#define MAT15 REGOFF(60, EDX) + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points2_general ) +HIDDEN(_mesa_x86_transform_points2_general) +GLNAME( _mesa_x86_transform_points2_general ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p2_gr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p2_gr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + FLD_S( SRC0 ) /* F6 F5 F4 */ + FMUL_S( MAT2 ) + FLD_S( SRC0 ) /* F7 F6 F5 F4 */ + FMUL_S( MAT3 ) + + FLD_S( SRC1 ) /* F0 F7 F6 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT5 ) + FLD_S( SRC1 ) /* F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT6 ) + FLD_S( SRC1 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT7 ) + + FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ + FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ + + FXCH( ST(3) ) /* F4 F6 F5 F7 */ + FADD_S( MAT12 ) + FXCH( ST(2) ) /* F5 F6 F4 F7 */ + FADD_S( MAT13 ) + FXCH( ST(1) ) /* F6 F5 F4 F7 */ + FADD_S( MAT14 ) + FXCH( ST(3) ) /* F7 F5 F4 F6 */ + FADD_S( MAT15 ) + + FXCH( ST(2) ) /* F4 F5 F7 F6 */ + FSTP_S( DST0 ) /* F5 F7 F6 */ + FSTP_S( DST1 ) /* F7 F6 */ + FXCH( ST(1) ) /* F6 F7 */ + FSTP_S( DST2 ) /* F7 */ + FSTP_S( DST3 ) /* */ + +LLBL(x86_p2_gr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p2_gr_loop) ) + +LLBL(x86_p2_gr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points2_perspective ) +HIDDEN(_mesa_x86_transform_points2_perspective) +GLNAME( _mesa_x86_transform_points2_perspective ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p2_pr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + + MOV_L( MAT14, EBX ) + +ALIGNTEXT16 +LLBL(x86_p2_pr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F1 F4 */ + FMUL_S( MAT5 ) + + FXCH( ST(1) ) /* F4 F1 */ + FSTP_S( DST0 ) /* F1 */ + FSTP_S( DST1 ) /* */ + MOV_L( EBX, DST2 ) + MOV_L( CONST(FP_ZERO), DST3 ) + +LLBL(x86_p2_pr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p2_pr_loop) ) + +LLBL(x86_p2_pr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points2_3d ) +HIDDEN(_mesa_x86_transform_points2_3d) +GLNAME( _mesa_x86_transform_points2_3d ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p2_3dr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p2_3dr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + FLD_S( SRC0 ) /* F6 F5 F4 */ + FMUL_S( MAT2 ) + + FLD_S( SRC1 ) /* F0 F6 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F6 F5 F4 */ + FMUL_S( MAT5 ) + FLD_S( SRC1 ) /* F2 F1 F0 F6 F5 F4 */ + FMUL_S( MAT6 ) + + FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + FXCH( ST(2) ) /* F4 F5 F6 */ + FADD_S( MAT12 ) + FXCH( ST(1) ) /* F5 F4 F6 */ + FADD_S( MAT13 ) + FXCH( ST(2) ) /* F6 F4 F5 */ + FADD_S( MAT14 ) + + FXCH( ST(1) ) /* F4 F6 F5 */ + FSTP_S( DST0 ) /* F6 F5 */ + FXCH( ST(1) ) /* F5 F6 */ + FSTP_S( DST1 ) /* F6 */ + FSTP_S( DST2 ) /* */ + +LLBL(x86_p2_3dr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p2_3dr_loop) ) + +LLBL(x86_p2_3dr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points2_3d_no_rot ) +HIDDEN(_mesa_x86_transform_points2_3d_no_rot) +GLNAME( _mesa_x86_transform_points2_3d_no_rot ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p2_3dnrr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + + MOV_L( MAT14, EBX ) + +ALIGNTEXT16 +LLBL(x86_p2_3dnrr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F1 F4 */ + FMUL_S( MAT5 ) + + FXCH( ST(1) ) /* F4 F1 */ + FADD_S( MAT12 ) + FLD_S( MAT13 ) /* F5 F4 F1 */ + FXCH( ST(2) ) /* F1 F4 F5 */ + FADDP( ST0, ST(2) ) /* F4 F5 */ + + FSTP_S( DST0 ) /* F5 */ + FSTP_S( DST1 ) /* */ + MOV_L( EBX, DST2 ) + +LLBL(x86_p2_3dnrr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p2_3dnrr_loop) ) + +LLBL(x86_p2_3dnrr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points2_2d ) +HIDDEN(_mesa_x86_transform_points2_2d) +GLNAME( _mesa_x86_transform_points2_2d ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p2_2dr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p2_2dr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + + FLD_S( SRC1 ) /* F0 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F5 F4 */ + FMUL_S( MAT5 ) + + FXCH( ST(1) ) /* F0 F1 F5 F4 */ + FADDP( ST0, ST(3) ) /* F1 F5 F4 */ + FADDP( ST0, ST(1) ) /* F5 F4 */ + + FXCH( ST(1) ) /* F4 F5 */ + FADD_S( MAT12 ) + FXCH( ST(1) ) /* F5 F4 */ + FADD_S( MAT13 ) + + FXCH( ST(1) ) /* F4 F5 */ + FSTP_S( DST0 ) /* F5 */ + FSTP_S( DST1 ) /* */ + +LLBL(x86_p2_2dr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p2_2dr_loop) ) + +LLBL(x86_p2_2dr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT4 +GLOBL GLNAME( _mesa_x86_transform_points2_2d_no_rot ) +HIDDEN(_mesa_x86_transform_points2_2d_no_rot) +GLNAME( _mesa_x86_transform_points2_2d_no_rot ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p2_2dnrr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p2_2dnrr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F1 F4 */ + FMUL_S( MAT5 ) + + FXCH( ST(1) ) /* F4 F1 */ + FADD_S( MAT12 ) + FLD_S( MAT13 ) /* F5 F4 F1 */ + FXCH( ST(2) ) /* F1 F4 F5 */ + FADDP( ST0, ST(2) ) /* F4 F5 */ + + FSTP_S( DST0 ) /* F5 */ + FSTP_S( DST1 ) /* */ + +LLBL(x86_p2_2dnrr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p2_2dnrr_loop) ) + +LLBL(x86_p2_2dnrr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points2_identity ) +HIDDEN(_mesa_x86_transform_points2_identity) +GLNAME( _mesa_x86_transform_points2_identity ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p2_ir_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + + CMP_L( ESI, EDI ) + JE( LLBL(x86_p2_ir_done) ) + +ALIGNTEXT16 +LLBL(x86_p2_ir_loop): + + MOV_L( SRC0, EBX ) + MOV_L( SRC1, EDX ) + + MOV_L( EBX, DST0 ) + MOV_L( EDX, DST1 ) + +LLBL(x86_p2_ir_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p2_ir_loop) ) + +LLBL(x86_p2_ir_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET diff --git a/reactos/dll/mesa32/src/x86/x86_xform3.S b/reactos/dll/mesa32/src/x86/x86_xform3.S new file mode 100644 index 00000000000..6bdec6aa74f --- /dev/null +++ b/reactos/dll/mesa32/src/x86/x86_xform3.S @@ -0,0 +1,640 @@ +/* $Id: x86_xform3.S,v 1.3 2005/01/04 14:33:47 brianp Exp $ */ + +/* + * 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. + */ + +/* + * NOTE: Avoid using spaces in between '(' ')' and arguments, especially + * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces + * in there will break the build on some platforms. + */ + +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FP_ONE 1065353216 +#define FP_ZERO 0 + +#define SRC0 REGOFF(0, ESI) +#define SRC1 REGOFF(4, ESI) +#define SRC2 REGOFF(8, ESI) +#define SRC3 REGOFF(12, ESI) +#define DST0 REGOFF(0, EDI) +#define DST1 REGOFF(4, EDI) +#define DST2 REGOFF(8, EDI) +#define DST3 REGOFF(12, EDI) +#define MAT0 REGOFF(0, EDX) +#define MAT1 REGOFF(4, EDX) +#define MAT2 REGOFF(8, EDX) +#define MAT3 REGOFF(12, EDX) +#define MAT4 REGOFF(16, EDX) +#define MAT5 REGOFF(20, EDX) +#define MAT6 REGOFF(24, EDX) +#define MAT7 REGOFF(28, EDX) +#define MAT8 REGOFF(32, EDX) +#define MAT9 REGOFF(36, EDX) +#define MAT10 REGOFF(40, EDX) +#define MAT11 REGOFF(44, EDX) +#define MAT12 REGOFF(48, EDX) +#define MAT13 REGOFF(52, EDX) +#define MAT14 REGOFF(56, EDX) +#define MAT15 REGOFF(60, EDX) + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points3_general ) +HIDDEN(_mesa_x86_transform_points3_general) +GLNAME( _mesa_x86_transform_points3_general ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p3_gr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p3_gr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + FLD_S( SRC0 ) /* F6 F5 F4 */ + FMUL_S( MAT2 ) + FLD_S( SRC0 ) /* F7 F6 F5 F4 */ + FMUL_S( MAT3 ) + + FLD_S( SRC1 ) /* F0 F7 F6 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT5 ) + FLD_S( SRC1 ) /* F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT6 ) + FLD_S( SRC1 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT7 ) + + FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ + FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ + + FLD_S( SRC2 ) /* F0 F7 F6 F5 F4 */ + FMUL_S( MAT8 ) + FLD_S( SRC2 ) /* F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT9 ) + FLD_S( SRC2 ) /* F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT10 ) + FLD_S( SRC2 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT11 ) + + FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ + FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ + + FXCH( ST(3) ) /* F4 F6 F5 F7 */ + FADD_S( MAT12 ) + FXCH( ST(2) ) /* F5 F6 F4 F7 */ + FADD_S( MAT13 ) + FXCH( ST(1) ) /* F6 F5 F4 F7 */ + FADD_S( MAT14 ) + FXCH( ST(3) ) /* F7 F5 F4 F6 */ + FADD_S( MAT15 ) + + FXCH( ST(2) ) /* F4 F5 F7 F6 */ + FSTP_S( DST0 ) /* F5 F7 F6 */ + FSTP_S( DST1 ) /* F7 F6 */ + FXCH( ST(1) ) /* F6 F7 */ + FSTP_S( DST2 ) /* F7 */ + FSTP_S( DST3 ) /* */ + +LLBL(x86_p3_gr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p3_gr_loop) ) + +LLBL(x86_p3_gr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points3_perspective ) +HIDDEN(_mesa_x86_transform_points3_perspective) +GLNAME( _mesa_x86_transform_points3_perspective ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p3_pr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p3_pr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F5 F4 */ + FMUL_S( MAT5 ) + + FLD_S( SRC2 ) /* F0 F5 F4 */ + FMUL_S( MAT8 ) + FLD_S( SRC2 ) /* F1 F0 F5 F4 */ + FMUL_S( MAT9 ) + FLD_S( SRC2 ) /* F2 F1 F0 F5 F4 */ + FMUL_S( MAT10 ) + + FXCH( ST(2) ) /* F0 F1 F2 F5 F4 */ + FADDP( ST0, ST(4) ) /* F1 F2 F5 F4 */ + FADDP( ST0, ST(2) ) /* F2 F5 F4 */ + FLD_S( MAT14 ) /* F6 F2 F5 F4 */ + FXCH( ST(1) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + MOV_L( SRC2, EBX ) + XOR_L( CONST(-2147483648), EBX )/* change sign */ + + FXCH( ST(2) ) /* F4 F5 F6 */ + FSTP_S( DST0 ) /* F5 F6 */ + FSTP_S( DST1 ) /* F6 */ + FSTP_S( DST2 ) /* */ + MOV_L( EBX, DST3 ) + +LLBL(x86_p3_pr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p3_pr_loop) ) + +LLBL(x86_p3_pr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points3_3d ) +HIDDEN(_mesa_x86_transform_points3_3d) +GLNAME( _mesa_x86_transform_points3_3d ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p3_3dr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p3_3dr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + FLD_S( SRC0 ) /* F6 F5 F4 */ + FMUL_S( MAT2 ) + + FLD_S( SRC1 ) /* F0 F6 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F6 F5 F4 */ + FMUL_S( MAT5 ) + FLD_S( SRC1 ) /* F2 F1 F0 F6 F5 F4 */ + FMUL_S( MAT6 ) + + FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + FLD_S( SRC2 ) /* F0 F6 F5 F4 */ + FMUL_S( MAT8 ) + FLD_S( SRC2 ) /* F1 F0 F6 F5 F4 */ + FMUL_S( MAT9 ) + FLD_S( SRC2 ) /* F2 F1 F0 F6 F5 F4 */ + FMUL_S( MAT10 ) + + FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + FXCH( ST(2) ) /* F4 F5 F6 */ + FADD_S( MAT12 ) + FXCH( ST(1) ) /* F5 F4 F6 */ + FADD_S( MAT13 ) + FXCH( ST(2) ) /* F6 F4 F5 */ + FADD_S( MAT14 ) + + FXCH( ST(1) ) /* F4 F6 F5 */ + FSTP_S( DST0 ) /* F6 F5 */ + FXCH( ST(1) ) /* F5 F6 */ + FSTP_S( DST1 ) /* F6 */ + FSTP_S( DST2 ) /* */ + +LLBL(x86_p3_3dr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p3_3dr_loop) ) + +LLBL(x86_p3_3dr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points3_3d_no_rot ) +HIDDEN(_mesa_x86_transform_points3_3d_no_rot) +GLNAME( _mesa_x86_transform_points3_3d_no_rot ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p3_3dnrr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p3_3dnrr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F1 F4 */ + FMUL_S( MAT5 ) + + FLD_S( SRC2 ) /* F2 F1 F4 */ + FMUL_S( MAT10 ) + + FXCH( ST(2) ) /* F4 F1 F2 */ + FADD_S( MAT12 ) + FLD_S( MAT13 ) /* F5 F4 F1 F2 */ + FXCH( ST(2) ) /* F1 F4 F5 F2 */ + FADDP( ST0, ST(2) ) /* F4 F5 F2 */ + FLD_S( MAT14 ) /* F6 F4 F5 F2 */ + FXCH( ST(3) ) /* F2 F4 F5 F6 */ + FADDP( ST0, ST(3) ) /* F4 F5 F6 */ + + FSTP_S( DST0 ) /* F5 F6 */ + FSTP_S( DST1 ) /* F6 */ + FSTP_S( DST2 ) /* */ + +LLBL(x86_p3_3dnrr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p3_3dnrr_loop) ) + +LLBL(x86_p3_3dnrr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points3_2d ) +HIDDEN(_mesa_x86_transform_points3_2d) +GLNAME( _mesa_x86_transform_points3_2d ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p3_2dr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p3_2dr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + + FLD_S( SRC1 ) /* F0 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F5 F4 */ + FMUL_S( MAT5 ) + + FXCH( ST(1) ) /* F0 F1 F5 F4 */ + FADDP( ST0, ST(3) ) /* F1 F5 F4 */ + FADDP( ST0, ST(1) ) /* F5 F4 */ + + FXCH( ST(1) ) /* F4 F5 */ + FADD_S( MAT12 ) + FXCH( ST(1) ) /* F5 F4 */ + FADD_S( MAT13 ) + + MOV_L( SRC2, EBX ) + + FXCH( ST(1) ) /* F4 F5 */ + FSTP_S( DST0 ) /* F5 */ + FSTP_S( DST1 ) /* */ + MOV_L( EBX, DST2 ) + +LLBL(x86_p3_2dr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p3_2dr_loop) ) + +LLBL(x86_p3_2dr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points3_2d_no_rot ) +HIDDEN(_mesa_x86_transform_points3_2d_no_rot) +GLNAME( _mesa_x86_transform_points3_2d_no_rot ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p3_2dnrr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p3_2dnrr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F1 F4 */ + FMUL_S( MAT5 ) + + FXCH( ST(1) ) /* F4 F1 */ + FADD_S( MAT12 ) + FLD_S( MAT13 ) /* F5 F4 F1 */ + + FXCH( ST(2) ) /* F1 F4 F5 */ + FADDP( ST0, ST(2) ) /* F4 F5 */ + + MOV_L( SRC2, EBX ) + + FSTP_S( DST0 ) /* F5 */ + FSTP_S( DST1 ) /* */ + MOV_L( EBX, DST2 ) + +LLBL(x86_p3_2dnrr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p3_2dnrr_loop) ) + +LLBL(x86_p3_2dnrr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points3_identity ) +HIDDEN(_mesa_x86_transform_points3_identity) +GLNAME(_mesa_x86_transform_points3_identity ): + +#define FRAME_OFFSET 16 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + PUSH_L( EBP ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p3_ir_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + + CMP_L( ESI, EDI ) + JE( LLBL(x86_p3_ir_done) ) + +ALIGNTEXT16 +LLBL(x86_p3_ir_loop): + +#if 1 + MOV_L( SRC0, EBX ) + MOV_L( SRC1, EBP ) + MOV_L( SRC2, EDX ) + + MOV_L( EBX, DST0 ) + MOV_L( EBP, DST1 ) + MOV_L( EDX, DST2 ) +#else + FLD_S( SRC0 ) + FLD_S( SRC1 ) + FLD_S( SRC2 ) + + FSTP_S( DST2 ) + FSTP_S( DST1 ) + FSTP_S( DST0 ) +#endif + +LLBL(x86_p3_ir_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p3_ir_loop) ) + +LLBL(x86_p3_ir_done): + + POP_L( EBP ) + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET diff --git a/reactos/dll/mesa32/src/x86/x86_xform4.S b/reactos/dll/mesa32/src/x86/x86_xform4.S new file mode 100644 index 00000000000..61b303ad31b --- /dev/null +++ b/reactos/dll/mesa32/src/x86/x86_xform4.S @@ -0,0 +1,673 @@ +/* $Id: x86_xform4.S,v 1.3 2005/01/04 14:33:47 brianp Exp $ */ + +/* + * 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. + */ + +/* + * NOTE: Avoid using spaces in between '(' ')' and arguments, especially + * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces + * in there will break the build on some platforms. + */ + +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FP_ONE 1065353216 +#define FP_ZERO 0 + +#define SRC0 REGOFF(0, ESI) +#define SRC1 REGOFF(4, ESI) +#define SRC2 REGOFF(8, ESI) +#define SRC3 REGOFF(12, ESI) +#define DST0 REGOFF(0, EDI) +#define DST1 REGOFF(4, EDI) +#define DST2 REGOFF(8, EDI) +#define DST3 REGOFF(12, EDI) +#define MAT0 REGOFF(0, EDX) +#define MAT1 REGOFF(4, EDX) +#define MAT2 REGOFF(8, EDX) +#define MAT3 REGOFF(12, EDX) +#define MAT4 REGOFF(16, EDX) +#define MAT5 REGOFF(20, EDX) +#define MAT6 REGOFF(24, EDX) +#define MAT7 REGOFF(28, EDX) +#define MAT8 REGOFF(32, EDX) +#define MAT9 REGOFF(36, EDX) +#define MAT10 REGOFF(40, EDX) +#define MAT11 REGOFF(44, EDX) +#define MAT12 REGOFF(48, EDX) +#define MAT13 REGOFF(52, EDX) +#define MAT14 REGOFF(56, EDX) +#define MAT15 REGOFF(60, EDX) + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points4_general ) +HIDDEN(_mesa_x86_transform_points4_general) +GLNAME( _mesa_x86_transform_points4_general ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p4_gr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p4_gr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + FLD_S( SRC0 ) /* F6 F5 F4 */ + FMUL_S( MAT2 ) + FLD_S( SRC0 ) /* F7 F6 F5 F4 */ + FMUL_S( MAT3 ) + + FLD_S( SRC1 ) /* F0 F7 F6 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT5 ) + FLD_S( SRC1 ) /* F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT6 ) + FLD_S( SRC1 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT7 ) + + FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ + FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ + + FLD_S( SRC2 ) /* F0 F7 F6 F5 F4 */ + FMUL_S( MAT8 ) + FLD_S( SRC2 ) /* F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT9 ) + FLD_S( SRC2 ) /* F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT10 ) + FLD_S( SRC2 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT11 ) + + FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ + FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ + + FLD_S( SRC3 ) /* F0 F7 F6 F5 F4 */ + FMUL_S( MAT12 ) + FLD_S( SRC3 ) /* F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT13 ) + FLD_S( SRC3 ) /* F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT14 ) + FLD_S( SRC3 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT15 ) + + FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ + FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ + + FXCH( ST(3) ) /* F4 F6 F5 F7 */ + FSTP_S( DST0 ) /* F6 F5 F7 */ + FXCH( ST(1) ) /* F5 F6 F7 */ + FSTP_S( DST1 ) /* F6 F7 */ + FSTP_S( DST2 ) /* F7 */ + FSTP_S( DST3 ) /* */ + +LLBL(x86_p4_gr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p4_gr_loop) ) + +LLBL(x86_p4_gr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points4_perspective ) +HIDDEN(_mesa_x86_transform_points4_perspective) +GLNAME( _mesa_x86_transform_points4_perspective ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p4_pr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p4_pr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F5 F4 */ + FMUL_S( MAT5 ) + + FLD_S( SRC2 ) /* F0 F5 F4 */ + FMUL_S( MAT8 ) + FLD_S( SRC2 ) /* F1 F0 F5 F4 */ + FMUL_S( MAT9 ) + FLD_S( SRC2 ) /* F6 F1 F0 F5 F4 */ + FMUL_S( MAT10 ) + + FXCH( ST(2) ) /* F0 F1 F6 F5 F4 */ + FADDP( ST0, ST(4) ) /* F1 F6 F5 F4 */ + FADDP( ST0, ST(2) ) /* F6 F5 F4 */ + + FLD_S( SRC3 ) /* F2 F6 F5 F4 */ + FMUL_S( MAT14 ) + + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + MOV_L( SRC2, EBX ) + XOR_L( CONST(-2147483648), EBX )/* change sign */ + + FXCH( ST(2) ) /* F4 F5 F6 */ + FSTP_S( DST0 ) /* F5 F6 */ + FSTP_S( DST1 ) /* F6 */ + FSTP_S( DST2 ) /* */ + MOV_L( EBX, DST3 ) + +LLBL(x86_p4_pr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p4_pr_loop) ) + +LLBL(x86_p4_pr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points4_3d ) +HIDDEN(_mesa_x86_transform_points4_3d) +GLNAME( _mesa_x86_transform_points4_3d ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p4_3dr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p4_3dr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + FLD_S( SRC0 ) /* F6 F5 F4 */ + FMUL_S( MAT2 ) + + FLD_S( SRC1 ) /* F0 F6 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F6 F5 F4 */ + FMUL_S( MAT5 ) + FLD_S( SRC1 ) /* F2 F1 F0 F6 F5 F4 */ + FMUL_S( MAT6 ) + + FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + FLD_S( SRC2 ) /* F0 F6 F5 F4 */ + FMUL_S( MAT8 ) + FLD_S( SRC2 ) /* F1 F0 F6 F5 F4 */ + FMUL_S( MAT9 ) + FLD_S( SRC2 ) /* F2 F1 F0 F6 F5 F4 */ + FMUL_S( MAT10 ) + + FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + FLD_S( SRC3 ) /* F0 F6 F5 F4 */ + FMUL_S( MAT12 ) + FLD_S( SRC3 ) /* F1 F0 F6 F5 F4 */ + FMUL_S( MAT13 ) + FLD_S( SRC3 ) /* F2 F1 F0 F6 F5 F4 */ + FMUL_S( MAT14 ) + + FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + MOV_L( SRC3, EBX ) + + FXCH( ST(2) ) /* F4 F5 F6 */ + FSTP_S( DST0 ) /* F5 F6 */ + FSTP_S( DST1 ) /* F6 */ + FSTP_S( DST2 ) /* */ + MOV_L( EBX, DST3 ) + +LLBL(x86_p4_3dr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p4_3dr_loop) ) + +LLBL(x86_p4_3dr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_x86_transform_points4_3d_no_rot) +HIDDEN(_mesa_x86_transform_points4_3d_no_rot) +GLNAME(_mesa_x86_transform_points4_3d_no_rot): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p4_3dnrr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p4_3dnrr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F5 F4 */ + FMUL_S( MAT5 ) + + FLD_S( SRC2 ) /* F6 F5 F4 */ + FMUL_S( MAT10 ) + + FLD_S( SRC3 ) /* F0 F6 F5 F4 */ + FMUL_S( MAT12 ) + FLD_S( SRC3 ) /* F1 F0 F6 F5 F4 */ + FMUL_S( MAT13 ) + FLD_S( SRC3 ) /* F2 F1 F0 F6 F5 F4 */ + FMUL_S( MAT14 ) + + FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + MOV_L( SRC3, EBX ) + + FXCH( ST(2) ) /* F4 F5 F6 */ + FSTP_S( DST0 ) /* F5 F6 */ + FSTP_S( DST1 ) /* F6 */ + FSTP_S( DST2 ) /* */ + MOV_L( EBX, DST3 ) + +LLBL(x86_p4_3dnrr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p4_3dnrr_loop) ) + +LLBL(x86_p4_3dnrr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points4_2d ) +HIDDEN(_mesa_x86_transform_points4_2d) +GLNAME( _mesa_x86_transform_points4_2d ): + +#define FRAME_OFFSET 16 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + PUSH_L( EBP ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p4_2dr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p4_2dr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + + FLD_S( SRC1 ) /* F0 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F5 F4 */ + FMUL_S( MAT5 ) + + FXCH( ST(1) ) /* F0 F1 F5 F4 */ + FADDP( ST0, ST(3) ) /* F1 F5 F4 */ + FADDP( ST0, ST(1) ) /* F5 F4 */ + + FLD_S( SRC3 ) /* F0 F5 F4 */ + FMUL_S( MAT12 ) + FLD_S( SRC3 ) /* F1 F0 F5 F4 */ + FMUL_S( MAT13 ) + + FXCH( ST(1) ) /* F0 F1 F5 F4 */ + FADDP( ST0, ST(3) ) /* F1 F5 F4 */ + FADDP( ST0, ST(1) ) /* F5 F4 */ + + MOV_L( SRC2, EBX ) + MOV_L( SRC3, EBP ) + + FXCH( ST(1) ) /* F4 F5 */ + FSTP_S( DST0 ) /* F5 */ + FSTP_S( DST1 ) /* */ + MOV_L( EBX, DST2 ) + MOV_L( EBP, DST3 ) + +LLBL(x86_p4_2dr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p4_2dr_loop) ) + +LLBL(x86_p4_2dr_done): + + POP_L( EBP ) + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points4_2d_no_rot ) +HIDDEN(_mesa_x86_transform_points4_2d_no_rot) +GLNAME( _mesa_x86_transform_points4_2d_no_rot ): + +#define FRAME_OFFSET 16 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + PUSH_L( EBP ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p4_2dnrr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p4_2dnrr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F5 F4 */ + FMUL_S( MAT5 ) + + FLD_S( SRC3 ) /* F0 F5 F4 */ + FMUL_S( MAT12 ) + FLD_S( SRC3 ) /* F1 F0 F5 F4 */ + FMUL_S( MAT13 ) + + FXCH( ST(1) ) /* F0 F1 F5 F4 */ + FADDP( ST0, ST(3) ) /* F1 F5 F4 */ + FADDP( ST0, ST(1) ) /* F5 F4 */ + + MOV_L( SRC2, EBX ) + MOV_L( SRC3, EBP ) + + FXCH( ST(1) ) /* F4 F5 */ + FSTP_S( DST0 ) /* F5 */ + FSTP_S( DST1 ) /* */ + MOV_L( EBX, DST2 ) + MOV_L( EBP, DST3 ) + +LLBL(x86_p4_2dnrr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p4_2dnrr_loop) ) + +LLBL(x86_p4_2dnrr_done): + + POP_L( EBP ) + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points4_identity ) +HIDDEN(_mesa_x86_transform_points4_identity) +GLNAME( _mesa_x86_transform_points4_identity ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p4_ir_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + + CMP_L( ESI, EDI ) + JE( LLBL(x86_p4_ir_done) ) + +ALIGNTEXT16 +LLBL(x86_p4_ir_loop): + + MOV_L( SRC0, EBX ) + MOV_L( SRC1, EDX ) + + MOV_L( EBX, DST0 ) + MOV_L( EDX, DST1 ) + + MOV_L( SRC2, EBX ) + MOV_L( SRC3, EDX ) + + MOV_L( EBX, DST2 ) + MOV_L( EDX, DST3 ) + +LLBL(x86_p4_ir_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p4_ir_loop) ) + +LLBL(x86_p4_ir_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET diff --git a/reactos/dll/mesa32/src/x86/xform_args.h b/reactos/dll/mesa32/src/x86/xform_args.h new file mode 100644 index 00000000000..89a04205c1f --- /dev/null +++ b/reactos/dll/mesa32/src/x86/xform_args.h @@ -0,0 +1,52 @@ +/* $Id: xform_args.h,v 1.5 2002/10/29 20:28:58 brianp Exp $ */ + +/* + * 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. + */ + +/* + * Transform function interface for assembly code. Simply define + * FRAME_OFFSET to the number of bytes pushed onto the stack before + * using the ARG_* argument macros. + * + * Gareth Hughes + */ + +#ifndef __XFORM_ARGS_H__ +#define __XFORM_ARGS_H__ + +/* Offsets for transform_func arguments + * + * typedef void (*transform_func)( GLvector4f *to_vec, + * const GLfloat m[16], + * const GLvector4f *from_vec ); + */ +#define OFFSET_DEST 4 +#define OFFSET_MATRIX 8 +#define OFFSET_SOURCE 12 + +#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) +#define ARG_MATRIX REGOFF(FRAME_OFFSET+OFFSET_MATRIX, ESP) +#define ARG_SOURCE REGOFF(FRAME_OFFSET+OFFSET_SOURCE, ESP) + +#endif