From a0c4815433ccd57322f4f7703ca35e9ccfa59250 Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 8 Oct 2009 13:15:52 +0000 Subject: Added MesaLib-7.6 --- mesalib/src/mesa/drivers/Makefile | 29 + mesalib/src/mesa/drivers/common/descrip.mms | 42 + mesalib/src/mesa/drivers/common/driverfuncs.c | 353 ++ mesalib/src/mesa/drivers/common/driverfuncs.h | 37 + mesalib/src/mesa/drivers/common/meta.c | 1638 +++++ mesalib/src/mesa/drivers/common/meta.h | 81 + mesalib/src/mesa/drivers/dri/Makefile | 55 + mesalib/src/mesa/drivers/dri/Makefile.template | 99 + mesalib/src/mesa/drivers/dri/common/depthtmp.h | 270 + mesalib/src/mesa/drivers/dri/common/dri_metaops.c | 298 + mesalib/src/mesa/drivers/dri/common/dri_metaops.h | 81 + mesalib/src/mesa/drivers/dri/common/dri_util.c | 957 +++ mesalib/src/mesa/drivers/dri/common/dri_util.h | 555 ++ .../src/mesa/drivers/dri/common/drirenderbuffer.c | 217 + .../src/mesa/drivers/dri/common/drirenderbuffer.h | 78 + .../src/mesa/drivers/dri/common/extension_helper.h | 6609 ++++++++++++++++++++ mesalib/src/mesa/drivers/dri/common/memops.h | 17 + mesalib/src/mesa/drivers/dri/common/mmio.h | 62 + mesalib/src/mesa/drivers/dri/common/mmx.h | 560 ++ mesalib/src/mesa/drivers/dri/common/spantmp.h | 338 + mesalib/src/mesa/drivers/dri/common/spantmp2.h | 686 ++ .../src/mesa/drivers/dri/common/spantmp_common.h | 81 + mesalib/src/mesa/drivers/dri/common/stenciltmp.h | 245 + mesalib/src/mesa/drivers/dri/common/texmem.c | 1347 ++++ mesalib/src/mesa/drivers/dri/common/texmem.h | 333 + mesalib/src/mesa/drivers/dri/common/utils.c | 839 +++ mesalib/src/mesa/drivers/dri/common/utils.h | 147 + mesalib/src/mesa/drivers/dri/common/vblank.c | 434 ++ mesalib/src/mesa/drivers/dri/common/vblank.h | 75 + mesalib/src/mesa/drivers/dri/common/xmlconfig.c | 1008 +++ mesalib/src/mesa/drivers/dri/common/xmlconfig.h | 124 + mesalib/src/mesa/drivers/dri/common/xmlpool.h | 98 + .../src/mesa/drivers/dri/common/xmlpool/Makefile | 96 + mesalib/src/mesa/drivers/dri/common/xmlpool/de.po | 240 + mesalib/src/mesa/drivers/dri/common/xmlpool/es.po | 219 + mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po | 225 + mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po | 230 + .../src/mesa/drivers/dri/common/xmlpool/options.h | 568 ++ mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po | 226 + .../mesa/drivers/dri/common/xmlpool/t_options.h | 249 + mesalib/src/mesa/drivers/dri/dri.pc.in | 11 + mesalib/src/mesa/drivers/dri/swrast/Makefile | 24 + mesalib/src/mesa/drivers/dri/swrast/swrast.c | 754 +++ mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h | 144 + mesalib/src/mesa/drivers/dri/swrast/swrast_span.c | 439 ++ .../src/mesa/drivers/dri/swrast/swrast_spantemp.h | 328 + mesalib/src/mesa/drivers/windows/fx/fxopengl.def | 955 +++ mesalib/src/mesa/drivers/windows/fx/fxwgl.c | 1307 ++++ mesalib/src/mesa/drivers/windows/gdi/colors.h | 29 + mesalib/src/mesa/drivers/windows/gdi/mesa.def | 979 +++ mesalib/src/mesa/drivers/windows/gdi/wgl.c | 707 +++ mesalib/src/mesa/drivers/windows/gdi/wmesa.c | 1681 +++++ mesalib/src/mesa/drivers/windows/gdi/wmesadef.h | 43 + mesalib/src/mesa/drivers/windows/gldirect/ddlog.c | 192 + mesalib/src/mesa/drivers/windows/gldirect/ddlog.h | 109 + .../src/mesa/drivers/windows/gldirect/dglcontext.c | 2214 +++++++ .../src/mesa/drivers/windows/gldirect/dglcontext.h | 281 + .../src/mesa/drivers/windows/gldirect/dglglobals.c | 149 + .../src/mesa/drivers/windows/gldirect/dglglobals.h | 198 + .../src/mesa/drivers/windows/gldirect/dglmacros.h | 91 + mesalib/src/mesa/drivers/windows/gldirect/dglpf.c | 620 ++ mesalib/src/mesa/drivers/windows/gldirect/dglpf.h | 77 + mesalib/src/mesa/drivers/windows/gldirect/dglwgl.c | 2964 +++++++++ mesalib/src/mesa/drivers/windows/gldirect/dglwgl.h | 127 + .../src/mesa/drivers/windows/gldirect/dll_main.c | 817 +++ .../src/mesa/drivers/windows/gldirect/dllmain.h | 64 + .../mesa/drivers/windows/gldirect/gld_debug_clip.c | 39 + .../mesa/drivers/windows/gldirect/gld_debug_norm.c | 39 + .../drivers/windows/gldirect/gld_debug_xform.c | 41 + .../mesa/drivers/windows/gldirect/gld_dispatch.c | 73 + .../src/mesa/drivers/windows/gldirect/gld_driver.c | 279 + .../src/mesa/drivers/windows/gldirect/gld_driver.h | 90 + .../src/mesa/drivers/windows/gldirect/gldlame8.c | 181 + .../src/mesa/drivers/windows/gldirect/opengl32.def | 488 ++ .../src/mesa/drivers/windows/gldirect/pixpack.h | 108 + mesalib/src/mesa/drivers/windows/icd/icd.c | 347 + mesalib/src/mesa/drivers/windows/icd/icdlist.h | 336 + mesalib/src/mesa/drivers/windows/icd/mesa.def | 108 + 78 files changed, 37279 insertions(+) create mode 100644 mesalib/src/mesa/drivers/Makefile create mode 100644 mesalib/src/mesa/drivers/common/descrip.mms create mode 100644 mesalib/src/mesa/drivers/common/driverfuncs.c create mode 100644 mesalib/src/mesa/drivers/common/driverfuncs.h create mode 100644 mesalib/src/mesa/drivers/common/meta.c create mode 100644 mesalib/src/mesa/drivers/common/meta.h create mode 100644 mesalib/src/mesa/drivers/dri/Makefile create mode 100644 mesalib/src/mesa/drivers/dri/Makefile.template create mode 100644 mesalib/src/mesa/drivers/dri/common/depthtmp.h create mode 100644 mesalib/src/mesa/drivers/dri/common/dri_metaops.c create mode 100644 mesalib/src/mesa/drivers/dri/common/dri_metaops.h create mode 100644 mesalib/src/mesa/drivers/dri/common/dri_util.c create mode 100644 mesalib/src/mesa/drivers/dri/common/dri_util.h create mode 100644 mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c create mode 100644 mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h create mode 100644 mesalib/src/mesa/drivers/dri/common/extension_helper.h create mode 100644 mesalib/src/mesa/drivers/dri/common/memops.h create mode 100644 mesalib/src/mesa/drivers/dri/common/mmio.h create mode 100644 mesalib/src/mesa/drivers/dri/common/mmx.h create mode 100644 mesalib/src/mesa/drivers/dri/common/spantmp.h create mode 100644 mesalib/src/mesa/drivers/dri/common/spantmp2.h create mode 100644 mesalib/src/mesa/drivers/dri/common/spantmp_common.h create mode 100644 mesalib/src/mesa/drivers/dri/common/stenciltmp.h create mode 100644 mesalib/src/mesa/drivers/dri/common/texmem.c create mode 100644 mesalib/src/mesa/drivers/dri/common/texmem.h create mode 100644 mesalib/src/mesa/drivers/dri/common/utils.c create mode 100644 mesalib/src/mesa/drivers/dri/common/utils.h create mode 100644 mesalib/src/mesa/drivers/dri/common/vblank.c create mode 100644 mesalib/src/mesa/drivers/dri/common/vblank.h create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlconfig.c create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlconfig.h create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool.h create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/de.po create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/es.po create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/options.h create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h create mode 100644 mesalib/src/mesa/drivers/dri/dri.pc.in create mode 100644 mesalib/src/mesa/drivers/dri/swrast/Makefile create mode 100644 mesalib/src/mesa/drivers/dri/swrast/swrast.c create mode 100644 mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h create mode 100644 mesalib/src/mesa/drivers/dri/swrast/swrast_span.c create mode 100644 mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h create mode 100644 mesalib/src/mesa/drivers/windows/fx/fxopengl.def create mode 100644 mesalib/src/mesa/drivers/windows/fx/fxwgl.c create mode 100644 mesalib/src/mesa/drivers/windows/gdi/colors.h create mode 100644 mesalib/src/mesa/drivers/windows/gdi/mesa.def create mode 100644 mesalib/src/mesa/drivers/windows/gdi/wgl.c create mode 100644 mesalib/src/mesa/drivers/windows/gdi/wmesa.c create mode 100644 mesalib/src/mesa/drivers/windows/gdi/wmesadef.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/ddlog.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/ddlog.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglcontext.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglcontext.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglglobals.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglglobals.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglmacros.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglpf.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglpf.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglwgl.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglwgl.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dll_main.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dllmain.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/gld_debug_clip.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/gld_debug_norm.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/gld_debug_xform.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/gld_dispatch.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/gld_driver.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/gld_driver.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/gldlame8.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/opengl32.def create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/pixpack.h create mode 100644 mesalib/src/mesa/drivers/windows/icd/icd.c create mode 100644 mesalib/src/mesa/drivers/windows/icd/icdlist.h create mode 100644 mesalib/src/mesa/drivers/windows/icd/mesa.def (limited to 'mesalib/src/mesa/drivers') diff --git a/mesalib/src/mesa/drivers/Makefile b/mesalib/src/mesa/drivers/Makefile new file mode 100644 index 000000000..c5998413e --- /dev/null +++ b/mesalib/src/mesa/drivers/Makefile @@ -0,0 +1,29 @@ +# src/mesa/drivers/Makefile + +TOP = ../../.. +include $(TOP)/configs/current + + +default: + @for dir in $(DRIVER_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE)) || exit 1; \ + fi \ + done + + +clean: + @for dir in $(DRIVER_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) clean) || exit 1; \ + fi \ + done + + +install: + @for dir in $(DRIVER_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) install) || exit 1; \ + fi \ + done + diff --git a/mesalib/src/mesa/drivers/common/descrip.mms b/mesalib/src/mesa/drivers/common/descrip.mms new file mode 100644 index 000000000..d5bbc69df --- /dev/null +++ b/mesalib/src/mesa/drivers/common/descrip.mms @@ -0,0 +1,42 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl +# Last revision : 29 September 2008 + +.first + define gl [----.include.gl] + define math [--.math] + define tnl [--.tnl] + define swrast [--.swrast] + define glapi [--.glapi] + define shader [--.shader] + define main [--.main] + +.include [----]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [----.include],[--.main],[--.glapi],[--.shader] +LIBDIR = [----.lib] +CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)\ + /float=ieee/ieee=denorm/warn=disable=(PTRMISMATCH) + +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/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c new file mode 100644 index 000000000..a9f3c8e72 --- /dev/null +++ b/mesalib/src/mesa/drivers/common/driverfuncs.c @@ -0,0 +1,353 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include "main/glheader.h" +#include "main/imports.h" +#include "main/arrayobj.h" +#include "main/buffers.h" +#include "main/context.h" +#include "main/framebuffer.h" +#include "main/mipmap.h" +#include "main/queryobj.h" +#include "main/renderbuffer.h" +#include "main/texcompress.h" +#include "main/texformat.h" +#include "main/texgetimage.h" +#include "main/teximage.h" +#include "main/texobj.h" +#include "main/texstore.h" +#if FEATURE_ARB_vertex_buffer_object +#include "main/bufferobj.h" +#endif +#if FEATURE_EXT_framebuffer_object +#include "main/fbobject.h" +#include "main/texrender.h" +#endif +#if FEATURE_ARB_sync +#include "main/syncobj.h" +#endif + +#include "shader/program.h" +#include "shader/prog_execute.h" +#include "shader/shader_api.h" +#include "tnl/tnl.h" +#include "swrast/swrast.h" + +#include "driverfuncs.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->RasterPos = _tnl_RasterPos; + 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->GenerateMipmap = _mesa_generate_mipmap; + 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->MapTexture = NULL; + driver->UnmapTexture = NULL; + 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 = NULL; + driver->DrawBuffers = NULL; + 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->StencilFuncSeparate = NULL; + driver->StencilOpSeparate = NULL; + driver->StencilMaskSeparate = 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->GetInteger64v = NULL; + driver->GetPointerv = NULL; + + /* buffer objects */ + _mesa_init_buffer_object_functions(driver); + + /* query objects */ + _mesa_init_query_object_functions(driver); + +#if FEATURE_ARB_sync + _mesa_init_sync_object_functions(driver); +#endif + +#if FEATURE_EXT_framebuffer_object + driver->NewFramebuffer = _mesa_new_framebuffer; + driver->NewRenderbuffer = _mesa_new_soft_renderbuffer; + driver->RenderTexture = _mesa_render_texture; + driver->FinishRenderTexture = _mesa_finish_render_texture; + driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer; +#endif + +#if FEATURE_EXT_framebuffer_blit + driver->BlitFramebuffer = _swrast_BlitFramebuffer; +#endif + + /* APPLE_vertex_array_object */ + driver->NewArrayObject = _mesa_new_array_object; + driver->DeleteArrayObject = _mesa_delete_array_object; + driver->BindArrayObject = NULL; + + /* T&L stuff */ + driver->NeedValidate = GL_FALSE; + driver->ValidateTnlModule = NULL; + driver->CurrentExecPrimitive = 0; + driver->CurrentSavePrimitive = 0; + driver->NeedFlush = 0; + driver->SaveNeedFlush = 0; + + driver->ProgramStringNotify = _tnl_program_string; + driver->FlushVertices = NULL; + driver->SaveFlushVertices = NULL; + driver->NotifySaveBegin = NULL; + driver->LightingSpaceChange = NULL; + + /* display list */ + driver->NewList = NULL; + driver->EndList = NULL; + driver->BeginCallList = NULL; + driver->EndCallList = NULL; + + + /* XXX temporary here */ + _mesa_init_glsl_driver_functions(driver); +} + + +/** + * Call the ctx->Driver.* state functions with current values to initialize + * driver state. + * Only the Intel drivers use this so far. + */ +void +_mesa_init_driver_state(GLcontext *ctx) +{ + ctx->Driver.AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef); + + ctx->Driver.BlendColor(ctx, ctx->Color.BlendColor); + + ctx->Driver.BlendEquationSeparate(ctx, + ctx->Color.BlendEquationRGB, + ctx->Color.BlendEquationA); + + ctx->Driver.BlendFuncSeparate(ctx, + ctx->Color.BlendSrcRGB, + ctx->Color.BlendDstRGB, + ctx->Color.BlendSrcA, ctx->Color.BlendDstA); + + ctx->Driver.ColorMask(ctx, + ctx->Color.ColorMask[RCOMP], + ctx->Color.ColorMask[GCOMP], + ctx->Color.ColorMask[BCOMP], + ctx->Color.ColorMask[ACOMP]); + + ctx->Driver.CullFace(ctx, ctx->Polygon.CullFaceMode); + ctx->Driver.DepthFunc(ctx, ctx->Depth.Func); + ctx->Driver.DepthMask(ctx, ctx->Depth.Mask); + + ctx->Driver.Enable(ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled); + ctx->Driver.Enable(ctx, GL_BLEND, ctx->Color.BlendEnabled); + ctx->Driver.Enable(ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled); + ctx->Driver.Enable(ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled); + ctx->Driver.Enable(ctx, GL_CULL_FACE, ctx->Polygon.CullFlag); + ctx->Driver.Enable(ctx, GL_DEPTH_TEST, ctx->Depth.Test); + ctx->Driver.Enable(ctx, GL_DITHER, ctx->Color.DitherFlag); + ctx->Driver.Enable(ctx, GL_FOG, ctx->Fog.Enabled); + ctx->Driver.Enable(ctx, GL_LIGHTING, ctx->Light.Enabled); + ctx->Driver.Enable(ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag); + ctx->Driver.Enable(ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag); + ctx->Driver.Enable(ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled); + ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled); + ctx->Driver.Enable(ctx, GL_TEXTURE_1D, GL_FALSE); + ctx->Driver.Enable(ctx, GL_TEXTURE_2D, GL_FALSE); + ctx->Driver.Enable(ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE); + ctx->Driver.Enable(ctx, GL_TEXTURE_3D, GL_FALSE); + ctx->Driver.Enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE); + + ctx->Driver.Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color); + ctx->Driver.Fogfv(ctx, GL_FOG_MODE, 0); + ctx->Driver.Fogfv(ctx, GL_FOG_DENSITY, &ctx->Fog.Density); + ctx->Driver.Fogfv(ctx, GL_FOG_START, &ctx->Fog.Start); + ctx->Driver.Fogfv(ctx, GL_FOG_END, &ctx->Fog.End); + + ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace); + + { + GLfloat f = (GLfloat) ctx->Light.Model.ColorControl; + ctx->Driver.LightModelfv(ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f); + } + + ctx->Driver.LineWidth(ctx, ctx->Line.Width); + ctx->Driver.LogicOpcode(ctx, ctx->Color.LogicOp); + ctx->Driver.PointSize(ctx, ctx->Point.Size); + ctx->Driver.PolygonStipple(ctx, (const GLubyte *) ctx->PolygonStipple); + ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y, + ctx->Scissor.Width, ctx->Scissor.Height); + ctx->Driver.ShadeModel(ctx, ctx->Light.ShadeModel); + ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT, + ctx->Stencil.Function[0], + ctx->Stencil.Ref[0], + ctx->Stencil.ValueMask[0]); + ctx->Driver.StencilFuncSeparate(ctx, GL_BACK, + ctx->Stencil.Function[1], + ctx->Stencil.Ref[1], + ctx->Stencil.ValueMask[1]); + ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT, ctx->Stencil.WriteMask[0]); + ctx->Driver.StencilMaskSeparate(ctx, GL_BACK, ctx->Stencil.WriteMask[1]); + ctx->Driver.StencilOpSeparate(ctx, GL_FRONT, + ctx->Stencil.FailFunc[0], + ctx->Stencil.ZFailFunc[0], + ctx->Stencil.ZPassFunc[0]); + ctx->Driver.StencilOpSeparate(ctx, GL_BACK, + ctx->Stencil.FailFunc[1], + ctx->Stencil.ZFailFunc[1], + ctx->Stencil.ZPassFunc[1]); + + + ctx->Driver.DrawBuffer(ctx, ctx->Color.DrawBuffer[0]); +} diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.h b/mesalib/src/mesa/drivers/common/driverfuncs.h new file mode 100644 index 000000000..4c90ed12f --- /dev/null +++ b/mesalib/src/mesa/drivers/common/driverfuncs.h @@ -0,0 +1,37 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef DRIVERFUNCS_H +#define DRIVERFUNCS_H + +extern void +_mesa_init_driver_functions(struct dd_function_table *driver); + + +extern void +_mesa_init_driver_state(GLcontext *ctx); + + +#endif diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c new file mode 100644 index 000000000..2741a41bf --- /dev/null +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -0,0 +1,1638 @@ +/* + * Mesa 3-D graphics library + * Version: 7.6 + * + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * Meta operations. Some GL operations can be expressed in terms of + * other GL operations. For example, glBlitFramebuffer() can be done + * with texture mapping and glClear() can be done with polygon rendering. + * + * \author Brian Paul + */ + + +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/arrayobj.h" +#include "main/blend.h" +#include "main/bufferobj.h" +#include "main/depth.h" +#include "main/enable.h" +#include "main/image.h" +#include "main/macros.h" +#include "main/matrix.h" +#include "main/polygon.h" +#include "main/readpix.h" +#include "main/scissor.h" +#include "main/shaders.h" +#include "main/stencil.h" +#include "main/texobj.h" +#include "main/texenv.h" +#include "main/teximage.h" +#include "main/texparam.h" +#include "main/texstate.h" +#include "main/varray.h" +#include "main/viewport.h" +#include "shader/program.h" +#include "shader/arbprogram.h" +#include "swrast/swrast.h" +#include "drivers/common/meta.h" + + +/** + * State which we may save/restore across meta ops. + * XXX this may be incomplete... + */ +struct save_state +{ + GLbitfield SavedState; /**< bitmask of META_* flags */ + + /** META_ALPHA_TEST */ + GLboolean AlphaEnabled; + + /** META_BLEND */ + GLboolean BlendEnabled; + GLboolean ColorLogicOpEnabled; + + /** META_COLOR_MASK */ + GLubyte ColorMask[4]; + + /** META_DEPTH_TEST */ + struct gl_depthbuffer_attrib Depth; + + /** META_FOG */ + GLboolean Fog; + + /** META_PIXEL_STORE */ + struct gl_pixelstore_attrib Pack, Unpack; + + /** META_RASTERIZATION */ + GLenum FrontPolygonMode, BackPolygonMode; + GLboolean PolygonOffset; + GLboolean PolygonSmooth; + GLboolean PolygonStipple; + GLboolean PolygonCull; + + /** META_SCISSOR */ + struct gl_scissor_attrib Scissor; + + /** META_SHADER */ + GLboolean VertexProgramEnabled; + struct gl_vertex_program *VertexProgram; + GLboolean FragmentProgramEnabled; + struct gl_fragment_program *FragmentProgram; + GLuint Shader; + + /** META_STENCIL_TEST */ + struct gl_stencil_attrib Stencil; + + /** META_TRANSFORM */ + GLenum MatrixMode; + GLfloat ModelviewMatrix[16]; + GLfloat ProjectionMatrix[16]; + GLfloat TextureMatrix[16]; + GLbitfield ClipPlanesEnabled; + + /** META_TEXTURE */ + GLuint ActiveUnit; + GLuint ClientActiveUnit; + /** for unit[0] only */ + struct gl_texture_object *CurrentTexture[NUM_TEXTURE_TARGETS]; + /** mask of TEXTURE_2D_BIT, etc */ + GLbitfield TexEnabled[MAX_TEXTURE_UNITS]; + GLbitfield TexGenEnabled[MAX_TEXTURE_UNITS]; + GLuint EnvMode; /* unit[0] only */ + + /** META_VERTEX */ + struct gl_array_object *ArrayObj; + struct gl_buffer_object *ArrayBufferObj; + + /** META_VIEWPORT */ + GLint ViewportX, ViewportY, ViewportW, ViewportH; + GLclampd DepthNear, DepthFar; + + /** Miscellaneous (always disabled) */ + GLboolean Lighting; +}; + + +/** + * State for glBlitFramebufer() + */ +struct blit_state +{ + GLuint ArrayObj; + GLuint VBO; + GLuint DepthFP; +}; + + +/** + * State for glClear() + */ +struct clear_state +{ + GLuint ArrayObj; + GLuint VBO; +}; + + +/** + * State for glCopyPixels() + */ +struct copypix_state +{ + GLuint ArrayObj; + GLuint VBO; +}; + + +/** + * State for glDrawPixels() + */ +struct drawpix_state +{ + GLuint ArrayObj; + + GLuint StencilFP; /**< Fragment program for drawing stencil images */ + GLuint DepthFP; /**< Fragment program for drawing depth images */ +}; + + +/** + * Temporary texture used for glBlitFramebuffer, glDrawPixels, etc. + * This is currently shared by all the meta ops. But we could create a + * separate one for each of glDrawPixel, glBlitFramebuffer, glCopyPixels, etc. + */ +struct temp_texture +{ + GLuint TexObj; + GLenum Target; /**< GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE */ + GLsizei MaxSize; /**< Max possible texture size */ + GLboolean NPOT; /**< Non-power of two size OK? */ + GLsizei Width, Height; /**< Current texture size */ + GLenum IntFormat; + GLfloat Sright, Ttop; /**< right, top texcoords */ +}; + + +/** + * All per-context meta state. + */ +struct gl_meta_state +{ + struct save_state Save; /**< state saved during meta-ops */ + + struct temp_texture TempTex; + + struct blit_state Blit; /**< For _mesa_meta_blit_framebuffer() */ + struct clear_state Clear; /**< For _mesa_meta_clear() */ + struct copypix_state CopyPix; /**< For _mesa_meta_copy_pixels() */ + struct drawpix_state DrawPix; /**< For _mesa_meta_draw_pixels() */ + + /* other possible meta-ops: + * glBitmap() + * glGenerateMipmap() + */ +}; + + +/** + * Initialize meta-ops for a context. + * To be called once during context creation. + */ +void +_mesa_meta_init(GLcontext *ctx) +{ + ASSERT(!ctx->Meta); + + ctx->Meta = CALLOC_STRUCT(gl_meta_state); +} + + +/** + * Free context meta-op state. + * To be called once during context destruction. + */ +void +_mesa_meta_free(GLcontext *ctx) +{ + struct gl_meta_state *meta = ctx->Meta; + + if (_mesa_get_current_context()) { + /* if there's no current context, these textures, buffers, etc should + * still get freed by _mesa_free_context_data(). + */ + + _mesa_DeleteTextures(1, &meta->TempTex.TexObj); + + /* glBlitFramebuffer */ + _mesa_DeleteBuffersARB(1, & meta->Blit.VBO); + _mesa_DeleteVertexArraysAPPLE(1, &meta->Blit.ArrayObj); + _mesa_DeletePrograms(1, &meta->Blit.DepthFP); + + /* glClear */ + _mesa_DeleteBuffersARB(1, & meta->Clear.VBO); + _mesa_DeleteVertexArraysAPPLE(1, &meta->Clear.ArrayObj); + + /* glCopyPixels */ + _mesa_DeleteBuffersARB(1, & meta->CopyPix.VBO); + _mesa_DeleteVertexArraysAPPLE(1, &meta->CopyPix.ArrayObj); + + /* glDrawPixels */ + _mesa_DeleteVertexArraysAPPLE(1, &meta->DrawPix.ArrayObj); + _mesa_DeletePrograms(1, &meta->DrawPix.DepthFP); + _mesa_DeletePrograms(1, &meta->DrawPix.StencilFP); + } + + _mesa_free(ctx->Meta); + ctx->Meta = NULL; +} + + +/** + * Enter meta state. This is like a light-weight version of glPushAttrib + * but it also resets most GL state back to default values. + * + * \param state bitmask of META_* flags indicating which attribute groups + * to save and reset to their defaults + */ +static void +_mesa_meta_begin(GLcontext *ctx, GLbitfield state) +{ + struct save_state *save = &ctx->Meta->Save; + + save->SavedState = state; + + if (state & META_ALPHA_TEST) { + save->AlphaEnabled = ctx->Color.AlphaEnabled; + if (ctx->Color.AlphaEnabled) + _mesa_Disable(GL_ALPHA_TEST); + } + + if (state & META_BLEND) { + save->BlendEnabled = ctx->Color.BlendEnabled; + if (ctx->Color.BlendEnabled) + _mesa_Disable(GL_BLEND); + save->ColorLogicOpEnabled = ctx->Color.ColorLogicOpEnabled; + if (ctx->Color.ColorLogicOpEnabled) + _mesa_Disable(GL_COLOR_LOGIC_OP); + } + + if (state & META_COLOR_MASK) { + COPY_4V(save->ColorMask, ctx->Color.ColorMask); + if (!ctx->Color.ColorMask[0] || + !ctx->Color.ColorMask[1] || + !ctx->Color.ColorMask[2] || + !ctx->Color.ColorMask[3]) + _mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + } + + if (state & META_DEPTH_TEST) { + save->Depth = ctx->Depth; /* struct copy */ + if (ctx->Depth.Test) + _mesa_Disable(GL_DEPTH_TEST); + } + + if (state & META_FOG) { + save->Fog = ctx->Fog.Enabled; + if (ctx->Fog.Enabled) + _mesa_set_enable(ctx, GL_FOG, GL_FALSE); + } + + if (state & META_PIXEL_STORE) { + save->Pack = ctx->Pack; + save->Unpack = ctx->Unpack; + ctx->Pack = ctx->DefaultPacking; + ctx->Unpack = ctx->DefaultPacking; + } + + if (state & META_RASTERIZATION) { + save->FrontPolygonMode = ctx->Polygon.FrontMode; + save->BackPolygonMode = ctx->Polygon.BackMode; + save->PolygonOffset = ctx->Polygon.OffsetFill; + save->PolygonSmooth = ctx->Polygon.SmoothFlag; + save->PolygonStipple = ctx->Polygon.StippleFlag; + save->PolygonCull = ctx->Polygon.CullFlag; + _mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL); + _mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL, GL_FALSE); + _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, GL_FALSE); + _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, GL_FALSE); + _mesa_set_enable(ctx, GL_CULL_FACE, GL_FALSE); + } + + if (state & META_SCISSOR) { + save->Scissor = ctx->Scissor; /* struct copy */ + } + + if (state & META_SHADER) { + if (ctx->Extensions.ARB_vertex_program) { + save->VertexProgramEnabled = ctx->VertexProgram.Enabled; + save->VertexProgram = ctx->VertexProgram.Current; + _mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB, GL_FALSE); + } + + if (ctx->Extensions.ARB_fragment_program) { + save->FragmentProgramEnabled = ctx->FragmentProgram.Enabled; + save->FragmentProgram = ctx->FragmentProgram.Current; + _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_FALSE); + } + + if (ctx->Extensions.ARB_shader_objects) { + save->Shader = ctx->Shader.CurrentProgram ? + ctx->Shader.CurrentProgram->Name : 0; + _mesa_UseProgramObjectARB(0); + } + } + + if (state & META_STENCIL_TEST) { + save->Stencil = ctx->Stencil; /* struct copy */ + if (ctx->Stencil.Enabled) + _mesa_Disable(GL_STENCIL_TEST); + /* NOTE: other stencil state not reset */ + } + + if (state & META_TEXTURE) { + GLuint u, tgt; + + save->ActiveUnit = ctx->Texture.CurrentUnit; + save->ClientActiveUnit = ctx->Array.ActiveTexture; + save->EnvMode = ctx->Texture.Unit[0].EnvMode; + + /* Disable all texture units */ + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + save->TexEnabled[u] = ctx->Texture.Unit[u].Enabled; + save->TexGenEnabled[u] = ctx->Texture.Unit[u].TexGenEnabled; + if (ctx->Texture.Unit[u].Enabled || + ctx->Texture.Unit[u].TexGenEnabled) { + _mesa_ActiveTextureARB(GL_TEXTURE0 + u); + _mesa_set_enable(ctx, GL_TEXTURE_1D, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_2D, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_3D, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, GL_FALSE); + } + } + + /* save current texture objects for unit[0] only */ + for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { + _mesa_reference_texobj(&save->CurrentTexture[tgt], + ctx->Texture.Unit[0].CurrentTex[tgt]); + } + + /* set defaults for unit[0] */ + _mesa_ActiveTextureARB(GL_TEXTURE0); + _mesa_ClientActiveTextureARB(GL_TEXTURE0); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + } + + if (state & META_TRANSFORM) { + GLuint activeTexture = ctx->Texture.CurrentUnit; + _mesa_memcpy(save->ModelviewMatrix, ctx->ModelviewMatrixStack.Top->m, + 16 * sizeof(GLfloat)); + _mesa_memcpy(save->ProjectionMatrix, ctx->ProjectionMatrixStack.Top->m, + 16 * sizeof(GLfloat)); + _mesa_memcpy(save->TextureMatrix, ctx->TextureMatrixStack[0].Top->m, + 16 * sizeof(GLfloat)); + save->MatrixMode = ctx->Transform.MatrixMode; + /* set 1:1 vertex:pixel coordinate transform */ + _mesa_ActiveTextureARB(GL_TEXTURE0); + _mesa_MatrixMode(GL_TEXTURE); + _mesa_LoadIdentity(); + _mesa_ActiveTextureARB(GL_TEXTURE0 + activeTexture); + _mesa_MatrixMode(GL_MODELVIEW); + _mesa_LoadIdentity(); + _mesa_MatrixMode(GL_PROJECTION); + _mesa_LoadIdentity(); + _mesa_Ortho(0.0F, ctx->DrawBuffer->Width, + 0.0F, ctx->DrawBuffer->Height, + -1.0F, 1.0F); + save->ClipPlanesEnabled = ctx->Transform.ClipPlanesEnabled; + if (ctx->Transform.ClipPlanesEnabled) { + GLuint i; + for (i = 0; i < ctx->Const.MaxClipPlanes; i++) { + _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_FALSE); + } + } + } + + if (state & META_VERTEX) { + /* save vertex array object state */ + _mesa_reference_array_object(ctx, &save->ArrayObj, + ctx->Array.ArrayObj); + _mesa_reference_buffer_object(ctx, &save->ArrayBufferObj, + ctx->Array.ArrayBufferObj); + /* set some default state? */ + } + + if (state & META_VIEWPORT) { + /* save viewport state */ + save->ViewportX = ctx->Viewport.X; + save->ViewportY = ctx->Viewport.Y; + save->ViewportW = ctx->Viewport.Width; + save->ViewportH = ctx->Viewport.Height; + /* set viewport to match window size */ + if (ctx->Viewport.X != 0 || + ctx->Viewport.Y != 0 || + ctx->Viewport.Width != ctx->DrawBuffer->Width || + ctx->Viewport.Height != ctx->DrawBuffer->Height) { + _mesa_set_viewport(ctx, 0, 0, + ctx->DrawBuffer->Width, ctx->DrawBuffer->Height); + } + /* save depth range state */ + save->DepthNear = ctx->Viewport.Near; + save->DepthFar = ctx->Viewport.Far; + /* set depth range to default */ + _mesa_DepthRange(0.0, 1.0); + } + + /* misc */ + { + save->Lighting = ctx->Light.Enabled; + if (ctx->Light.Enabled) + _mesa_set_enable(ctx, GL_LIGHTING, GL_FALSE); + } +} + + +/** + * Leave meta state. This is like a light-weight version of glPopAttrib(). + */ +static void +_mesa_meta_end(GLcontext *ctx) +{ + struct save_state *save = &ctx->Meta->Save; + const GLbitfield state = save->SavedState; + + if (state & META_ALPHA_TEST) { + if (ctx->Color.AlphaEnabled != save->AlphaEnabled) + _mesa_set_enable(ctx, GL_ALPHA_TEST, save->AlphaEnabled); + } + + if (state & META_BLEND) { + if (ctx->Color.BlendEnabled != save->BlendEnabled) + _mesa_set_enable(ctx, GL_BLEND, save->BlendEnabled); + if (ctx->Color.ColorLogicOpEnabled != save->ColorLogicOpEnabled) + _mesa_set_enable(ctx, GL_COLOR_LOGIC_OP, save->ColorLogicOpEnabled); + } + + if (state & META_COLOR_MASK) { + if (!TEST_EQ_4V(ctx->Color.ColorMask, save->ColorMask)) + _mesa_ColorMask(save->ColorMask[0], save->ColorMask[1], + save->ColorMask[2], save->ColorMask[3]); + } + + if (state & META_DEPTH_TEST) { + if (ctx->Depth.Test != save->Depth.Test) + _mesa_set_enable(ctx, GL_DEPTH_TEST, save->Depth.Test); + _mesa_DepthFunc(save->Depth.Func); + _mesa_DepthMask(save->Depth.Mask); + } + + if (state & META_FOG) { + _mesa_set_enable(ctx, GL_FOG, save->Fog); + } + + if (state & META_PIXEL_STORE) { + ctx->Pack = save->Pack; + ctx->Unpack = save->Unpack; + } + + if (state & META_RASTERIZATION) { + _mesa_PolygonMode(GL_FRONT, save->FrontPolygonMode); + _mesa_PolygonMode(GL_BACK, save->BackPolygonMode); + _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, save->PolygonStipple); + _mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL, save->PolygonOffset); + _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, save->PolygonSmooth); + _mesa_set_enable(ctx, GL_CULL_FACE, save->PolygonCull); + } + + if (state & META_SCISSOR) { + _mesa_set_enable(ctx, GL_SCISSOR_TEST, save->Scissor.Enabled); + _mesa_Scissor(save->Scissor.X, save->Scissor.Y, + save->Scissor.Width, save->Scissor.Height); + } + + if (state & META_SHADER) { + if (ctx->Extensions.ARB_vertex_program) { + _mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB, + save->VertexProgramEnabled); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + save->VertexProgram); + } + + if (ctx->Extensions.ARB_fragment_program) { + _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, + save->FragmentProgramEnabled); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, + save->FragmentProgram); + } + + if (ctx->Extensions.ARB_shader_objects) { + _mesa_UseProgramObjectARB(save->Shader); + } + } + + if (state & META_STENCIL_TEST) { + const struct gl_stencil_attrib *stencil = &save->Stencil; + + _mesa_set_enable(ctx, GL_STENCIL_TEST, stencil->Enabled); + _mesa_ClearStencil(stencil->Clear); + if (ctx->Extensions.EXT_stencil_two_side) { + _mesa_set_enable(ctx, GL_STENCIL_TEST_TWO_SIDE_EXT, + stencil->TestTwoSide); + _mesa_ActiveStencilFaceEXT(stencil->ActiveFace + ? GL_BACK : GL_FRONT); + } + /* front state */ + _mesa_StencilFuncSeparate(GL_FRONT, + stencil->Function[0], + stencil->Ref[0], + stencil->ValueMask[0]); + _mesa_StencilMaskSeparate(GL_FRONT, stencil->WriteMask[0]); + _mesa_StencilOpSeparate(GL_FRONT, stencil->FailFunc[0], + stencil->ZFailFunc[0], + stencil->ZPassFunc[0]); + /* back state */ + _mesa_StencilFuncSeparate(GL_BACK, + stencil->Function[1], + stencil->Ref[1], + stencil->ValueMask[1]); + _mesa_StencilMaskSeparate(GL_BACK, stencil->WriteMask[1]); + _mesa_StencilOpSeparate(GL_BACK, stencil->FailFunc[1], + stencil->ZFailFunc[1], + stencil->ZPassFunc[1]); + } + + if (state & META_TEXTURE) { + GLuint u, tgt; + + ASSERT(ctx->Texture.CurrentUnit == 0); + + /* restore texenv for unit[0] */ + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, save->EnvMode); + + /* restore texture objects for unit[0] only */ + for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { + _mesa_reference_texobj(&ctx->Texture.Unit[0].CurrentTex[tgt], + save->CurrentTexture[tgt]); + } + + /* Re-enable textures, texgen */ + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (save->TexEnabled[u]) { + _mesa_ActiveTextureARB(GL_TEXTURE0 + u); + + if (save->TexEnabled[u] & TEXTURE_1D_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_1D, GL_TRUE); + if (save->TexEnabled[u] & TEXTURE_2D_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_2D, GL_TRUE); + if (save->TexEnabled[u] & TEXTURE_3D_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_3D, GL_TRUE); + if (save->TexEnabled[u] & TEXTURE_CUBE_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_TRUE); + if (save->TexEnabled[u] & TEXTURE_RECT_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_TRUE); + } + + if (save->TexGenEnabled[u]) { + _mesa_ActiveTextureARB(GL_TEXTURE0 + u); + + if (save->TexGenEnabled[u] & S_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_TRUE); + if (save->TexGenEnabled[u] & T_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_TRUE); + if (save->TexGenEnabled[u] & R_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_TRUE); + if (save->TexGenEnabled[u] & Q_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, GL_TRUE); + } + } + + /* restore current unit state */ + _mesa_ActiveTextureARB(GL_TEXTURE0 + save->ActiveUnit); + _mesa_ClientActiveTextureARB(GL_TEXTURE0 + save->ClientActiveUnit); + } + + if (state & META_TRANSFORM) { + GLuint activeTexture = ctx->Texture.CurrentUnit; + _mesa_ActiveTextureARB(GL_TEXTURE0); + _mesa_MatrixMode(GL_TEXTURE); + _mesa_LoadMatrixf(save->TextureMatrix); + _mesa_ActiveTextureARB(GL_TEXTURE0 + activeTexture); + + _mesa_MatrixMode(GL_MODELVIEW); + _mesa_LoadMatrixf(save->ModelviewMatrix); + + _mesa_MatrixMode(GL_PROJECTION); + _mesa_LoadMatrixf(save->ProjectionMatrix); + + _mesa_MatrixMode(save->MatrixMode); + + if (save->ClipPlanesEnabled) { + GLuint i; + for (i = 0; i < ctx->Const.MaxClipPlanes; i++) { + if (save->ClipPlanesEnabled & (1 << i)) { + _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_TRUE); + } + } + } + } + + if (state & META_VERTEX) { + /* restore vertex buffer object */ + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, save->ArrayBufferObj->Name); + _mesa_reference_buffer_object(ctx, &save->ArrayBufferObj, NULL); + + /* restore vertex array object */ + _mesa_BindVertexArray(save->ArrayObj->Name); + _mesa_reference_array_object(ctx, &save->ArrayObj, NULL); + } + + if (state & META_VIEWPORT) { + if (save->ViewportX != ctx->Viewport.X || + save->ViewportY != ctx->Viewport.Y || + save->ViewportW != ctx->Viewport.Width || + save->ViewportH != ctx->Viewport.Height) { + _mesa_set_viewport(ctx, save->ViewportX, save->ViewportY, + save->ViewportW, save->ViewportH); + } + _mesa_DepthRange(save->DepthNear, save->DepthFar); + } + + /* misc */ + if (save->Lighting) { + _mesa_set_enable(ctx, GL_LIGHTING, GL_TRUE); + } +} + + +/** + * Return pointer to temp_texture info. This does some one-time init + * if needed. + */ +static struct temp_texture * +get_temp_texture(GLcontext *ctx) +{ + struct temp_texture *tex = &ctx->Meta->TempTex; + + if (!tex->TexObj) { + /* do one-time init */ + + /* prefer texture rectangle */ + if (ctx->Extensions.NV_texture_rectangle) { + tex->Target = GL_TEXTURE_RECTANGLE; + tex->MaxSize = ctx->Const.MaxTextureRectSize; + tex->NPOT = GL_TRUE; + } + else { + /* use 2D texture, NPOT if possible */ + tex->Target = GL_TEXTURE_2D; + tex->MaxSize = 1 << (ctx->Const.MaxTextureLevels - 1); + tex->NPOT = ctx->Extensions.ARB_texture_non_power_of_two; + } + assert(tex->MaxSize > 0); + + _mesa_GenTextures(1, &tex->TexObj); + _mesa_BindTexture(tex->Target, tex->TexObj); + } + + return tex; +} + + +/** + * Compute the width/height of texture needed to draw an image of the + * given size. Return a flag indicating whether the current texture + * can be re-used (glTexSubImage2D) or if a new texture needs to be + * allocated (glTexImage2D). + * Also, compute s/t texcoords for drawing. + * + * \return GL_TRUE if new texture is needed, GL_FALSE otherwise + */ +static GLboolean +alloc_texture(struct temp_texture *tex, + GLsizei width, GLsizei height, GLenum intFormat) +{ + GLboolean newTex = GL_FALSE; + + if (width > tex->Width || + height > tex->Height || + intFormat != tex->IntFormat) { + /* alloc new texture (larger or different format) */ + + if (tex->NPOT) { + /* use non-power of two size */ + tex->Width = width; + tex->Height = height; + } + else { + /* find power of two size */ + GLsizei w, h; + w = h = 16; + while (w < width) + w *= 2; + while (h < height) + h *= 2; + tex->Width = w; + tex->Height = h; + } + + tex->IntFormat = intFormat; + + newTex = GL_TRUE; + } + + /* compute texcoords */ + if (tex->Target == GL_TEXTURE_RECTANGLE) { + tex->Sright = (GLfloat) width; + tex->Ttop = (GLfloat) height; + } + else { + tex->Sright = (GLfloat) width / tex->Width; + tex->Ttop = (GLfloat) height / tex->Height; + } + + return newTex; +} + + +/** + * Setup/load texture for glCopyPixels or glBlitFramebuffer. + */ +static void +setup_copypix_texture(struct temp_texture *tex, + GLboolean newTex, + GLint srcX, GLint srcY, + GLsizei width, GLsizei height, GLenum intFormat, + GLenum filter) +{ + _mesa_BindTexture(tex->Target, tex->TexObj); + _mesa_TexParameteri(tex->Target, GL_TEXTURE_MIN_FILTER, filter); + _mesa_TexParameteri(tex->Target, GL_TEXTURE_MAG_FILTER, filter); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + /* copy framebuffer image to texture */ + if (newTex) { + /* create new tex image */ + if (tex->Width == width && tex->Height == height) { + /* create new tex with framebuffer data */ + _mesa_CopyTexImage2D(tex->Target, 0, tex->IntFormat, + srcX, srcY, width, height, 0); + } + else { + /* create empty texture */ + _mesa_TexImage2D(tex->Target, 0, tex->IntFormat, + tex->Width, tex->Height, 0, + intFormat, GL_UNSIGNED_BYTE, NULL); + /* load image */ + _mesa_CopyTexSubImage2D(tex->Target, 0, + 0, 0, srcX, srcY, width, height); + } + } + else { + /* replace existing tex image */ + _mesa_CopyTexSubImage2D(tex->Target, 0, + 0, 0, srcX, srcY, width, height); + } +} + + +/** + * Setup/load texture for glDrawPixels. + */ +static void +setup_drawpix_texture(struct temp_texture *tex, + GLboolean newTex, + GLenum texIntFormat, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels) +{ + _mesa_BindTexture(tex->Target, tex->TexObj); + _mesa_TexParameteri(tex->Target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + _mesa_TexParameteri(tex->Target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + /* copy pixel data to texture */ + if (newTex) { + /* create new tex image */ + if (tex->Width == width && tex->Height == height) { + /* create new tex and load image data */ + _mesa_TexImage2D(tex->Target, 0, tex->IntFormat, + tex->Width, tex->Height, 0, format, type, pixels); + } + else { + /* create empty texture */ + _mesa_TexImage2D(tex->Target, 0, tex->IntFormat, + tex->Width, tex->Height, 0, format, type, NULL); + /* load image */ + _mesa_TexSubImage2D(tex->Target, 0, + 0, 0, width, height, format, type, pixels); + } + } + else { + /* replace existing tex image */ + _mesa_TexSubImage2D(tex->Target, 0, + 0, 0, width, height, format, type, pixels); + } +} + + + +/** + * One-time init for drawing depth pixels. + */ +static void +init_blit_depth_pixels(GLcontext *ctx) +{ + static const char *program = + "!!ARBfp1.0\n" + "TEX result.depth, fragment.texcoord[0], texture[0], %s; \n" + "END \n"; + char program2[200]; + struct blit_state *blit = &ctx->Meta->Blit; + struct temp_texture *tex = get_temp_texture(ctx); + const char *texTarget; + + assert(blit->DepthFP == 0); + + /* replace %s with "RECT" or "2D" */ + assert(strlen(program) + 4 < sizeof(program2)); + if (tex->Target == GL_TEXTURE_RECTANGLE) + texTarget = "RECT"; + else + texTarget = "2D"; + _mesa_snprintf(program2, sizeof(program2), program, texTarget); + + _mesa_GenPrograms(1, &blit->DepthFP); + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, blit->DepthFP); + _mesa_ProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(program2), (const GLubyte *) program2); +} + + +/** + * Meta implementation of ctx->Driver.BlitFramebuffer() in terms + * of texture mapping and polygon rendering. + */ +void +_mesa_meta_blit_framebuffer(GLcontext *ctx, + GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter) +{ + struct blit_state *blit = &ctx->Meta->Blit; + struct temp_texture *tex = get_temp_texture(ctx); + const GLsizei maxTexSize = tex->MaxSize; + const GLint srcX = MIN2(srcX0, srcX1); + const GLint srcY = MIN2(srcY0, srcY1); + const GLint srcW = abs(srcX1 - srcX0); + const GLint srcH = abs(srcY1 - srcY0); + const GLboolean srcFlipX = srcX1 < srcX0; + const GLboolean srcFlipY = srcY1 < srcY0; + GLfloat verts[4][4]; /* four verts of X,Y,S,T */ + GLboolean newTex; + + if (srcW > maxTexSize || srcH > maxTexSize) { + /* XXX avoid this fallback */ + _swrast_BlitFramebuffer(ctx, srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, mask, filter); + return; + } + + if (srcFlipX) { + GLint tmp = dstX0; + dstX0 = dstX1; + dstX1 = tmp; + } + + if (srcFlipY) { + GLint tmp = dstY0; + dstY0 = dstY1; + dstY1 = tmp; + } + + /* only scissor effects blit so save/clear all other relevant state */ + _mesa_meta_begin(ctx, ~META_SCISSOR); + + if (blit->ArrayObj == 0) { + /* one-time setup */ + + /* create vertex array object */ + _mesa_GenVertexArrays(1, &blit->ArrayObj); + _mesa_BindVertexArray(blit->ArrayObj); + + /* create vertex array buffer */ + _mesa_GenBuffersARB(1, &blit->VBO); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, blit->VBO); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), + NULL, GL_DYNAMIC_DRAW_ARB); + + /* setup vertex arrays */ + _mesa_VertexPointer(2, GL_FLOAT, sizeof(verts[0]), + (void *) (0 * sizeof(GLfloat))); + _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(verts[0]), + (void *) (2 * sizeof(GLfloat))); + _mesa_EnableClientState(GL_VERTEX_ARRAY); + _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); + } + else { + _mesa_BindVertexArray(blit->ArrayObj); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, blit->VBO); + } + + newTex = alloc_texture(tex, srcW, srcH, GL_RGBA); + + /* vertex positions/texcoords (after texture allocation!) */ + { + verts[0][0] = (GLfloat) dstX0; + verts[0][1] = (GLfloat) dstY0; + verts[1][0] = (GLfloat) dstX1; + verts[1][1] = (GLfloat) dstY0; + verts[2][0] = (GLfloat) dstX1; + verts[2][1] = (GLfloat) dstY1; + verts[3][0] = (GLfloat) dstX0; + verts[3][1] = (GLfloat) dstY1; + + verts[0][2] = 0.0F; + verts[0][3] = 0.0F; + verts[1][2] = tex->Sright; + verts[1][3] = 0.0F; + verts[2][2] = tex->Sright; + verts[2][3] = tex->Ttop; + verts[3][2] = 0.0F; + verts[3][3] = tex->Ttop; + + /* upload new vertex data */ + _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); + } + + _mesa_Enable(tex->Target); + + if (mask & GL_COLOR_BUFFER_BIT) { + setup_copypix_texture(tex, newTex, srcX, srcY, srcW, srcH, + GL_RGBA, filter); + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + mask &= ~GL_COLOR_BUFFER_BIT; + } + + if (mask & GL_DEPTH_BUFFER_BIT) { + GLuint *tmp = (GLuint *) _mesa_malloc(srcW * srcH * sizeof(GLuint)); + if (tmp) { + if (!blit->DepthFP) + init_blit_depth_pixels(ctx); + + /* maybe change tex format here */ + newTex = alloc_texture(tex, srcW, srcH, GL_DEPTH_COMPONENT); + + _mesa_ReadPixels(srcX, srcY, srcW, srcH, + GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, tmp); + + setup_drawpix_texture(tex, newTex, GL_DEPTH_COMPONENT, srcW, srcH, + GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, tmp); + + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, blit->DepthFP); + _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_TRUE); + _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + _mesa_set_enable(ctx, GL_DEPTH_TEST, GL_TRUE); + _mesa_DepthFunc(GL_ALWAYS); + _mesa_DepthMask(GL_TRUE); + + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + mask &= ~GL_DEPTH_BUFFER_BIT; + + _mesa_free(tmp); + } + } + + if (mask & GL_STENCIL_BUFFER_BIT) { + /* XXX can't easily do stencil */ + } + + _mesa_Disable(tex->Target); + + _mesa_meta_end(ctx); + + if (mask) { + _swrast_BlitFramebuffer(ctx, srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, mask, filter); + } +} + + +/** + * Meta implementation of ctx->Driver.Clear() in terms of polygon rendering. + */ +void +_mesa_meta_clear(GLcontext *ctx, GLbitfield buffers) +{ + struct clear_state *clear = &ctx->Meta->Clear; + GLfloat verts[4][7]; /* four verts of X,Y,Z,R,G,B,A */ + /* save all state but scissor, pixel pack/unpack */ + GLbitfield metaSave = META_ALL - META_SCISSOR - META_PIXEL_STORE; + + if (buffers & BUFFER_BITS_COLOR) { + /* if clearing color buffers, don't save/restore colormask */ + metaSave -= META_COLOR_MASK; + } + + _mesa_meta_begin(ctx, metaSave); + + if (clear->ArrayObj == 0) { + /* one-time setup */ + + /* create vertex array object */ + _mesa_GenVertexArrays(1, &clear->ArrayObj); + _mesa_BindVertexArray(clear->ArrayObj); + + /* create vertex array buffer */ + _mesa_GenBuffersARB(1, &clear->VBO); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, clear->VBO); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), + NULL, GL_DYNAMIC_DRAW_ARB); + + /* setup vertex arrays */ + _mesa_VertexPointer(3, GL_FLOAT, sizeof(verts[0]), + (void *) (0 * sizeof(GLfloat))); + _mesa_ColorPointer(4, GL_FLOAT, sizeof(verts[0]), + (void *) (3 * sizeof(GLfloat))); + _mesa_EnableClientState(GL_VERTEX_ARRAY); + _mesa_EnableClientState(GL_COLOR_ARRAY); + } + else { + _mesa_BindVertexArray(clear->ArrayObj); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, clear->VBO); + } + + /* GL_COLOR_BUFFER_BIT */ + if (buffers & BUFFER_BITS_COLOR) { + /* leave colormask, glDrawBuffer state as-is */ + } + else { + ASSERT(metaSave & META_COLOR_MASK); + _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + } + + /* GL_DEPTH_BUFFER_BIT */ + if (buffers & BUFFER_BIT_DEPTH) { + _mesa_set_enable(ctx, GL_DEPTH_TEST, GL_TRUE); + _mesa_DepthFunc(GL_ALWAYS); + _mesa_DepthMask(GL_TRUE); + } + else { + assert(!ctx->Depth.Test); + } + + /* GL_STENCIL_BUFFER_BIT */ + if (buffers & BUFFER_BIT_STENCIL) { + _mesa_set_enable(ctx, GL_STENCIL_TEST, GL_TRUE); + _mesa_StencilOpSeparate(GL_FRONT_AND_BACK, + GL_REPLACE, GL_REPLACE, GL_REPLACE); + _mesa_StencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS, + ctx->Stencil.Clear & 0x7fffffff, + ctx->Stencil.WriteMask[0]); + } + else { + assert(!ctx->Stencil.Enabled); + } + + /* vertex positions/colors */ + { + const GLfloat x0 = (GLfloat) ctx->DrawBuffer->_Xmin; + const GLfloat y0 = (GLfloat) ctx->DrawBuffer->_Ymin; + const GLfloat x1 = (GLfloat) ctx->DrawBuffer->_Xmax; + const GLfloat y1 = (GLfloat) ctx->DrawBuffer->_Ymax; + const GLfloat z = 1.0 - 2.0 * ctx->Depth.Clear; + GLuint i; + + verts[0][0] = x0; + verts[0][1] = y0; + verts[0][2] = z; + verts[1][0] = x1; + verts[1][1] = y0; + verts[1][2] = z; + verts[2][0] = x1; + verts[2][1] = y1; + verts[2][2] = z; + verts[3][0] = x0; + verts[3][1] = y1; + verts[3][2] = z; + + /* vertex colors */ + for (i = 0; i < 4; i++) { + COPY_4FV(&verts[i][3], ctx->Color.ClearColor); + } + + /* upload new vertex data */ + _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); + } + + /* draw quad */ + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + + _mesa_meta_end(ctx); +} + + +/** + * Meta implementation of ctx->Driver.CopyPixels() in terms + * of texture mapping and polygon rendering. + */ +void +_mesa_meta_copy_pixels(GLcontext *ctx, GLint srcX, GLint srcY, + GLsizei width, GLsizei height, + GLint dstX, GLint dstY, GLenum type) +{ + struct copypix_state *copypix = &ctx->Meta->CopyPix; + struct temp_texture *tex = get_temp_texture(ctx); + GLfloat verts[4][5]; /* four verts of X,Y,Z,S,T */ + GLboolean newTex; + GLenum intFormat = GL_RGBA; + + if (type != GL_COLOR || + ctx->_ImageTransferState || + ctx->Fog.Enabled || + width > tex->MaxSize || + height > tex->MaxSize) { + /* XXX avoid this fallback */ + _swrast_CopyPixels(ctx, srcX, srcY, width, height, dstX, dstY, type); + return; + } + + /* Most GL state applies to glCopyPixels, but a there's a few things + * we need to override: + */ + _mesa_meta_begin(ctx, (META_RASTERIZATION | + META_SHADER | + META_TEXTURE | + META_TRANSFORM | + META_VERTEX | + META_VIEWPORT)); + + if (copypix->ArrayObj == 0) { + /* one-time setup */ + + /* create vertex array object */ + _mesa_GenVertexArrays(1, ©pix->ArrayObj); + _mesa_BindVertexArray(copypix->ArrayObj); + + /* create vertex array buffer */ + _mesa_GenBuffersARB(1, ©pix->VBO); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, copypix->VBO); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), + NULL, GL_DYNAMIC_DRAW_ARB); + + /* setup vertex arrays */ + _mesa_VertexPointer(3, GL_FLOAT, sizeof(verts[0]), + (void *) (0 * sizeof(GLfloat))); + _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(verts[0]), + (void *) (3 * sizeof(GLfloat))); + _mesa_EnableClientState(GL_VERTEX_ARRAY); + _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); + } + else { + _mesa_BindVertexArray(copypix->ArrayObj); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, copypix->VBO); + } + + newTex = alloc_texture(tex, width, height, intFormat); + + /* vertex positions, texcoords (after texture allocation!) */ + { + const GLfloat dstX0 = (GLfloat) dstX; + const GLfloat dstY0 = (GLfloat) dstY; + const GLfloat dstX1 = dstX + width * ctx->Pixel.ZoomX; + const GLfloat dstY1 = dstY + height * ctx->Pixel.ZoomY; + const GLfloat z = ctx->Current.RasterPos[2]; + + verts[0][0] = dstX0; + verts[0][1] = dstY0; + verts[0][2] = z; + verts[0][3] = 0.0F; + verts[0][4] = 0.0F; + verts[1][0] = dstX1; + verts[1][1] = dstY0; + verts[1][2] = z; + verts[1][3] = tex->Sright; + verts[1][4] = 0.0F; + verts[2][0] = dstX1; + verts[2][1] = dstY1; + verts[2][2] = z; + verts[2][3] = tex->Sright; + verts[2][4] = tex->Ttop; + verts[3][0] = dstX0; + verts[3][1] = dstY1; + verts[3][2] = z; + verts[3][3] = 0.0F; + verts[3][4] = tex->Ttop; + + /* upload new vertex data */ + _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); + } + + /* Alloc/setup texture */ + setup_copypix_texture(tex, newTex, srcX, srcY, width, height, + GL_RGBA, GL_NEAREST); + + _mesa_Enable(tex->Target); + + /* draw textured quad */ + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + + _mesa_Disable(tex->Target); + + _mesa_meta_end(ctx); +} + + + +/** + * When the glDrawPixels() image size is greater than the max rectangle + * texture size we use this function to break the glDrawPixels() image + * into tiles which fit into the max texture size. + */ +static void +tiled_draw_pixels(GLcontext *ctx, + GLint tileSize, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels) +{ + struct gl_pixelstore_attrib tileUnpack = *unpack; + GLint i, j; + + if (tileUnpack.RowLength == 0) + tileUnpack.RowLength = width; + + for (i = 0; i < width; i += tileSize) { + const GLint tileWidth = MIN2(tileSize, width - i); + const GLint tileX = (GLint) (x + i * ctx->Pixel.ZoomX); + + tileUnpack.SkipPixels = unpack->SkipPixels + i; + + for (j = 0; j < height; j += tileSize) { + const GLint tileHeight = MIN2(tileSize, height - j); + const GLint tileY = (GLint) (y + j * ctx->Pixel.ZoomY); + + tileUnpack.SkipRows = unpack->SkipRows + j; + + _mesa_meta_draw_pixels(ctx, tileX, tileY, + tileWidth, tileHeight, + format, type, &tileUnpack, pixels); + } + } +} + + +/** + * One-time init for drawing stencil pixels. + */ +static void +init_draw_stencil_pixels(GLcontext *ctx) +{ + /* This program is run eight times, once for each stencil bit. + * The stencil values to draw are found in an 8-bit alpha texture. + * We read the texture/stencil value and test if bit 'b' is set. + * If the bit is not set, use KIL to kill the fragment. + * Finally, we use the stencil test to update the stencil buffer. + * + * The basic algorithm for checking if a bit is set is: + * if (is_odd(value / (1 << bit))) + * result is one (or non-zero). + * else + * result is zero. + * The program parameter contains three values: + * parm.x = 255 / (1 << bit) + * parm.y = 0.5 + * parm.z = 0.0 + */ + static const char *program = + "!!ARBfp1.0\n" + "PARAM parm = program.local[0]; \n" + "TEMP t; \n" + "TEX t, fragment.texcoord[0], texture[0], %s; \n" /* NOTE %s here! */ + "# t = t * 255 / bit \n" + "MUL t.x, t.a, parm.x; \n" + "# t = (int) t \n" + "FRC t.y, t.x; \n" + "SUB t.x, t.x, t.y; \n" + "# t = t * 0.5 \n" + "MUL t.x, t.x, parm.y; \n" + "# t = fract(t.x) \n" + "FRC t.x, t.x; # if t.x != 0, then the bit is set \n" + "# t.x = (t.x == 0 ? 1 : 0) \n" + "SGE t.x, -t.x, parm.z; \n" + "KIL -t.x; \n" + "# for debug only \n" + "#MOV result.color, t.x; \n" + "END \n"; + char program2[1000]; + struct drawpix_state *drawpix = &ctx->Meta->DrawPix; + struct temp_texture *tex = get_temp_texture(ctx); + const char *texTarget; + + assert(drawpix->StencilFP == 0); + + /* replace %s with "RECT" or "2D" */ + assert(strlen(program) + 4 < sizeof(program2)); + if (tex->Target == GL_TEXTURE_RECTANGLE) + texTarget = "RECT"; + else + texTarget = "2D"; + _mesa_snprintf(program2, sizeof(program2), program, texTarget); + + _mesa_GenPrograms(1, &drawpix->StencilFP); + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->StencilFP); + _mesa_ProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(program2), (const GLubyte *) program2); +} + + +/** + * One-time init for drawing depth pixels. + */ +static void +init_draw_depth_pixels(GLcontext *ctx) +{ + static const char *program = + "!!ARBfp1.0\n" + "PARAM color = program.local[0]; \n" + "TEX result.depth, fragment.texcoord[0], texture[0], %s; \n" + "MOV result.color, color; \n" + "END \n"; + char program2[200]; + struct drawpix_state *drawpix = &ctx->Meta->DrawPix; + struct temp_texture *tex = get_temp_texture(ctx); + const char *texTarget; + + assert(drawpix->DepthFP == 0); + + /* replace %s with "RECT" or "2D" */ + assert(strlen(program) + 4 < sizeof(program2)); + if (tex->Target == GL_TEXTURE_RECTANGLE) + texTarget = "RECT"; + else + texTarget = "2D"; + _mesa_snprintf(program2, sizeof(program2), program, texTarget); + + _mesa_GenPrograms(1, &drawpix->DepthFP); + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->DepthFP); + _mesa_ProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(program2), (const GLubyte *) program2); +} + + +/** + * Meta implementation of ctx->Driver.DrawPixels() in terms + * of texture mapping and polygon rendering. + */ +void +_mesa_meta_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 drawpix_state *drawpix = &ctx->Meta->DrawPix; + struct temp_texture *tex = get_temp_texture(ctx); + const struct gl_pixelstore_attrib unpackSave = ctx->Unpack; + const GLuint origStencilMask = ctx->Stencil.WriteMask[0]; + GLfloat verts[4][5]; /* four verts of X,Y,Z,S,T */ + GLenum texIntFormat; + GLboolean fallback, newTex; + GLbitfield metaExtraSave = 0x0; + GLuint vbo; + + /* + * Determine if we can do the glDrawPixels with texture mapping. + */ + fallback = GL_FALSE; + if (ctx->_ImageTransferState || + ctx->Fog.Enabled) { + fallback = GL_TRUE; + } + + if (_mesa_is_color_format(format)) { + /* use more compact format when possible */ + /* XXX disable special case for GL_LUMINANCE for now to work around + * apparent i965 driver bug (see bug #23670). + */ + if (/*format == GL_LUMINANCE ||*/ format == GL_LUMINANCE_ALPHA) + texIntFormat = format; + else + texIntFormat = GL_RGBA; + } + else if (_mesa_is_stencil_format(format)) { + if (ctx->Extensions.ARB_fragment_program && + ctx->Pixel.IndexShift == 0 && + ctx->Pixel.IndexOffset == 0 && + type == GL_UNSIGNED_BYTE) { + /* We'll store stencil as alpha. This only works for GLubyte + * image data because of how incoming values are mapped to alpha + * in [0,1]. + */ + texIntFormat = GL_ALPHA; + metaExtraSave = (META_COLOR_MASK | + META_DEPTH_TEST | + META_SHADER | + META_STENCIL_TEST); + } + else { + fallback = GL_TRUE; + } + } + else if (_mesa_is_depth_format(format)) { + if (ctx->Extensions.ARB_depth_texture && + ctx->Extensions.ARB_fragment_program) { + texIntFormat = GL_DEPTH_COMPONENT; + metaExtraSave = (META_SHADER); + } + else { + fallback = GL_TRUE; + } + } + else { + fallback = GL_TRUE; + } + + if (fallback) { + _swrast_DrawPixels(ctx, x, y, width, height, + format, type, unpack, pixels); + return; + } + + /* + * Check image size against max texture size, draw as tiles if needed. + */ + if (width > tex->MaxSize || height > tex->MaxSize) { + tiled_draw_pixels(ctx, tex->MaxSize, x, y, width, height, + format, type, unpack, pixels); + return; + } + + /* Most GL state applies to glDrawPixels (like blending, stencil, etc), + * but a there's a few things we need to override: + */ + _mesa_meta_begin(ctx, (META_RASTERIZATION | + META_SHADER | + META_TEXTURE | + META_TRANSFORM | + META_VERTEX | + META_VIEWPORT | + metaExtraSave)); + + newTex = alloc_texture(tex, width, height, texIntFormat); + + /* vertex positions, texcoords (after texture allocation!) */ + { + const GLfloat x0 = (GLfloat) x; + const GLfloat y0 = (GLfloat) y; + const GLfloat x1 = x + width * ctx->Pixel.ZoomX; + const GLfloat y1 = y + height * ctx->Pixel.ZoomY; + const GLfloat z = ctx->Current.RasterPos[2]; + + verts[0][0] = x0; + verts[0][1] = y0; + verts[0][2] = z; + verts[0][3] = 0.0F; + verts[0][4] = 0.0F; + verts[1][0] = x1; + verts[1][1] = y0; + verts[1][2] = z; + verts[1][3] = tex->Sright; + verts[1][4] = 0.0F; + verts[2][0] = x1; + verts[2][1] = y1; + verts[2][2] = z; + verts[2][3] = tex->Sright; + verts[2][4] = tex->Ttop; + verts[3][0] = x0; + verts[3][1] = y1; + verts[3][2] = z; + verts[3][3] = 0.0F; + verts[3][4] = tex->Ttop; + } + + if (drawpix->ArrayObj == 0) { + /* one-time setup: create vertex array object */ + _mesa_GenVertexArrays(1, &drawpix->ArrayObj); + } + _mesa_BindVertexArray(drawpix->ArrayObj); + + /* create vertex array buffer */ + _mesa_GenBuffersARB(1, &vbo); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, vbo); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), + verts, GL_DYNAMIC_DRAW_ARB); + + /* setup vertex arrays */ + _mesa_VertexPointer(3, GL_FLOAT, sizeof(verts[0]), + (void *) (0 * sizeof(GLfloat))); + _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(verts[0]), + (void *) (3 * sizeof(GLfloat))); + _mesa_EnableClientState(GL_VERTEX_ARRAY); + _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); + + /* set given unpack params */ + ctx->Unpack = *unpack; + + _mesa_Enable(tex->Target); + + if (_mesa_is_stencil_format(format)) { + /* Drawing stencil */ + GLint bit; + + if (!drawpix->StencilFP) + init_draw_stencil_pixels(ctx); + + setup_drawpix_texture(tex, newTex, texIntFormat, width, height, + GL_ALPHA, type, pixels); + + _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + + _mesa_set_enable(ctx, GL_STENCIL_TEST, GL_TRUE); + + /* set all stencil bits to 0 */ + _mesa_StencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); + _mesa_StencilFunc(GL_ALWAYS, 0, 255); + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + + /* set stencil bits to 1 where needed */ + _mesa_StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); + + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->StencilFP); + _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_TRUE); + + for (bit = 0; bit < ctx->Visual.stencilBits; bit++) { + const GLuint mask = 1 << bit; + if (mask & origStencilMask) { + _mesa_StencilFunc(GL_ALWAYS, mask, mask); + _mesa_StencilMask(mask); + + _mesa_ProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, + 255.0 / mask, 0.5, 0.0, 0.0); + + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + } + } + } + else if (_mesa_is_depth_format(format)) { + /* Drawing depth */ + if (!drawpix->DepthFP) + init_draw_depth_pixels(ctx); + + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->DepthFP); + _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_TRUE); + + /* polygon color = current raster color */ + _mesa_ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0, + ctx->Current.RasterColor); + + setup_drawpix_texture(tex, newTex, texIntFormat, width, height, + format, type, pixels); + + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + } + else { + /* Drawing RGBA */ + setup_drawpix_texture(tex, newTex, texIntFormat, width, height, + format, type, pixels); + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + } + + _mesa_Disable(tex->Target); + + _mesa_DeleteBuffersARB(1, &vbo); + + /* restore unpack params */ + ctx->Unpack = unpackSave; + + _mesa_meta_end(ctx); +} diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h new file mode 100644 index 000000000..b03b64c48 --- /dev/null +++ b/mesalib/src/mesa/drivers/common/meta.h @@ -0,0 +1,81 @@ +/* + * Mesa 3-D graphics library + * Version: 7.6 + * + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef META_H +#define META_H + + +/** + * Flags passed to _mesa_meta_begin(). + * XXX these flags may evolve... + */ +/*@{*/ +#define META_ALPHA_TEST 0x1 +#define META_BLEND 0x2 /**< includes logicop */ +#define META_COLOR_MASK 0x4 +#define META_DEPTH_TEST 0x8 +#define META_FOG 0x10 +#define META_RASTERIZATION 0x20 +#define META_SCISSOR 0x40 +#define META_SHADER 0x80 +#define META_STENCIL_TEST 0x100 +#define META_TRANSFORM 0x200 /**< modelview, projection */ +#define META_TEXTURE 0x400 +#define META_VERTEX 0x800 +#define META_VIEWPORT 0x1000 +#define META_PIXEL_STORE 0x2000 +#define META_ALL ~0x0 +/*@}*/ + + +extern void +_mesa_meta_init(GLcontext *ctx); + +extern void +_mesa_meta_free(GLcontext *ctx); + +extern void +_mesa_meta_blit_framebuffer(GLcontext *ctx, + GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter); + +extern void +_mesa_meta_clear(GLcontext *ctx, GLbitfield buffers); + +extern void +_mesa_meta_copy_pixels(GLcontext *ctx, GLint srcx, GLint srcy, + GLsizei width, GLsizei height, + GLint dstx, GLint dsty, GLenum type); + +extern void +_mesa_meta_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); + + +#endif /* META_H */ diff --git a/mesalib/src/mesa/drivers/dri/Makefile b/mesalib/src/mesa/drivers/dri/Makefile new file mode 100644 index 000000000..32db09786 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/Makefile @@ -0,0 +1,55 @@ +# src/mesa/drivers/dri/Makefile + +TOP = ../../../.. + +include $(TOP)/configs/current + + + +default: $(TOP)/$(LIB_DIR) subdirs dri.pc + + +$(TOP)/$(LIB_DIR): + -mkdir $(TOP)/$(LIB_DIR) + + +subdirs: + @for dir in $(DRI_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE)) || exit 1 ; \ + fi \ + done + +pcedit = sed \ + -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ + -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ + -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ + -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ + -e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_SEARCH_DIR),' \ + -e 's,@DRI_PC_REQ_PRIV@,$(DRI_PC_REQ_PRIV),' + +dri.pc: dri.pc.in + $(pcedit) $< > $@ + + +install: dri.pc + @for dir in $(DRI_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) install) || exit 1 ; \ + fi \ + done + $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL/internal + $(INSTALL) -m 0644 $(TOP)/include/GL/internal/dri_interface.h \ + $(DESTDIR)$(INSTALL_INC_DIR)/GL/internal + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + $(INSTALL) -m 0644 dri.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + + +clean: + -@for dir in $(DRI_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) clean) ; \ + fi \ + done + -rm -f common/*.o + -rm -f *.pc diff --git a/mesalib/src/mesa/drivers/dri/Makefile.template b/mesalib/src/mesa/drivers/dri/Makefile.template new file mode 100644 index 000000000..18dbeba24 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/Makefile.template @@ -0,0 +1,99 @@ +# -*-makefile-*- + +MESA_MODULES = $(TOP)/src/mesa/libmesa.a + +COMMON_GALLIUM_SOURCES = \ + ../common/utils.c \ + ../common/vblank.c \ + ../common/dri_util.c \ + ../common/xmlconfig.c + +COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \ + ../../common/driverfuncs.c \ + ../common/texmem.c \ + ../common/drirenderbuffer.c \ + ../common/dri_metaops.c + +ifeq ($(WINDOW_SYSTEM),dri) +WINOBJ= +WINLIB= +INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES) + +OBJECTS = $(C_SOURCES:.c=.o) \ + $(ASM_SOURCES:.S=.o) + +else +# miniglx +WINOBJ= +WINLIB=-L$(MESA)/src/glx/mini +MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini +INCLUDES = $(MINIGLX_INCLUDES) \ + $(SHARED_INCLUDES) \ + $(PCIACCESS_CFLAGS) + +OBJECTS = $(C_SOURCES:.c=.o) \ + $(MINIGLX_SOURCES:.c=.o) \ + $(ASM_SOURCES:.S=.o) +endif + + +### Include directories +SHARED_INCLUDES = \ + -I. \ + -I$(TOP)/src/mesa/drivers/dri/common \ + -Iserver \ + -I$(TOP)/include \ + -I$(TOP)/src/mesa \ + -I$(TOP)/src/egl/main \ + -I$(TOP)/src/egl/drivers/dri \ + $(LIBDRM_CFLAGS) + + +##### RULES ##### + +.c.o: + $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@ + +.S.o: + $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@ + + +##### TARGETS ##### + +default: symlinks depend $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME) + + +$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template + $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + $(OBJECTS) $(PIPE_DRIVERS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS) + + +$(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME) + $(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR) + + +depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS) + @ echo "running $(MKDEP)" + @ rm -f depend + @ touch depend + @ $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \ + $(ASM_SOURCES) > /dev/null 2>/dev/null + + +# Emacs tags +tags: + etags `find . -name \*.[ch]` `find ../include` + + +# Remove .o and backup files +clean: + -rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS) + -rm -f depend depend.bak + + +install: $(LIBNAME) + $(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) + $(MINSTALL) -m 755 $(LIBNAME) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) + + +-include depend diff --git a/mesalib/src/mesa/drivers/dri/common/depthtmp.h b/mesalib/src/mesa/drivers/dri/common/depthtmp.h new file mode 100644 index 000000000..fd2dab3b4 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/depthtmp.h @@ -0,0 +1,270 @@ + +/* + * Notes: + * 1. These functions plug into the gl_renderbuffer structure. + * 2. The 'values' parameter always points to GLuint values, regardless of + * the actual Z buffer depth. + */ + + +#include "spantmp_common.h" + +#ifndef DBG +#define DBG 0 +#endif + +#ifndef HAVE_HW_DEPTH_SPANS +#define HAVE_HW_DEPTH_SPANS 0 +#endif + +#ifndef HAVE_HW_DEPTH_PIXELS +#define HAVE_HW_DEPTH_PIXELS 0 +#endif + +static void TAG(WriteDepthSpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *values, + const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const VALUE_TYPE *depth = (const VALUE_TYPE *) values; + GLint x1; + GLint n1; + LOCAL_DEPTH_VARS; + + y = Y_FLIP( y ); + +#if HAVE_HW_DEPTH_SPANS + (void) x1; (void) n1; + + if ( DBG ) fprintf( stderr, "WriteDepthSpan 0..%d (x1 %d)\n", + (int)n, (int)x ); + + WRITE_DEPTH_SPAN(); +#else + HW_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN( x, y, n, x1, n1, i ); + + if ( DBG ) fprintf( stderr, "WriteDepthSpan %d..%d (x1 %d) (mask %p)\n", + (int)i, (int)n1, (int)x1, mask ); + + if ( mask ) { + for ( ; n1>0 ; i++, x1++, n1-- ) { + if ( mask[i] ) WRITE_DEPTH( x1, y, depth[i] ); + } + } else { + for ( ; n1>0 ; i++, x1++, n1-- ) { + WRITE_DEPTH( x1, y, depth[i] ); + } + } + } + HW_ENDCLIPLOOP(); +#endif + } + HW_WRITE_UNLOCK(); +} + + +#if HAVE_HW_DEPTH_SPANS +/* implement MonoWriteDepthSpan() in terms of WriteDepthSpan() */ +static void +TAG(WriteMonoDepthSpan)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *value, const GLubyte mask[] ) +{ + const GLuint depthVal = *((GLuint *) value); + GLuint depths[MAX_WIDTH]; + GLuint i; + for (i = 0; i < n; i++) + depths[i] = depthVal; + TAG(WriteDepthSpan)(ctx, rb, n, x, y, depths, mask); +} +#else +static void TAG(WriteMonoDepthSpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *value, + const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLuint depth = *((GLuint *) value); + GLint x1; + GLint n1; + LOCAL_DEPTH_VARS; + + y = Y_FLIP( y ); + + HW_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN( x, y, n, x1, n1, i ); + + if ( DBG ) fprintf( stderr, "%s %d..%d (x1 %d) = %u\n", + __FUNCTION__, (int)i, (int)n1, (int)x1, (GLuint)depth ); + + if ( mask ) { + for ( ; n1>0 ; i++, x1++, n1-- ) { + if ( mask[i] ) WRITE_DEPTH( x1, y, depth ); + } + } else { + for ( ; n1>0 ; x1++, n1-- ) { + WRITE_DEPTH( x1, y, depth ); + } + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} +#endif + + +static void TAG(WriteDepthPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, + const GLint x[], + const GLint y[], + const void *values, + const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const VALUE_TYPE *depth = (const VALUE_TYPE *) values; + GLuint i; + LOCAL_DEPTH_VARS; + + if ( DBG ) fprintf( stderr, "WriteDepthPixels\n" ); + +#if HAVE_HW_DEPTH_PIXELS + (void) i; + + WRITE_DEPTH_PIXELS(); +#else + HW_CLIPLOOP() + { + if ( mask ) { + for ( i = 0 ; i < n ; i++ ) { + if ( mask[i] ) { + const int fy = Y_FLIP( y[i] ); + if ( CLIPPIXEL( x[i], fy ) ) + WRITE_DEPTH( x[i], fy, depth[i] ); + } + } + } + else { + for ( i = 0 ; i < n ; i++ ) { + const int fy = Y_FLIP( y[i] ); + if ( CLIPPIXEL( x[i], fy ) ) + WRITE_DEPTH( x[i], fy, depth[i] ); + } + } + } + HW_ENDCLIPLOOP(); +#endif + } + HW_WRITE_UNLOCK(); +} + + +/* Read depth spans and pixels + */ +static void TAG(ReadDepthSpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + void *values ) +{ + HW_READ_LOCK() + { + VALUE_TYPE *depth = (VALUE_TYPE *) values; + GLint x1, n1; + LOCAL_DEPTH_VARS; + + y = Y_FLIP( y ); + + if ( DBG ) fprintf( stderr, "ReadDepthSpan\n" ); + +#if HAVE_HW_DEPTH_SPANS + (void) x1; (void) n1; + + READ_DEPTH_SPAN(); +#else + HW_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN( x, y, n, x1, n1, i ); + for ( ; n1>0 ; i++, n1-- ) { + READ_DEPTH( depth[i], x+i, y ); + } + } + HW_ENDCLIPLOOP(); +#endif + } + HW_READ_UNLOCK(); +} + +static void TAG(ReadDepthPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, + const GLint x[], const GLint y[], + void *values ) +{ + HW_READ_LOCK() + { + VALUE_TYPE *depth = (VALUE_TYPE *) values; + GLuint i; + LOCAL_DEPTH_VARS; + + if ( DBG ) fprintf( stderr, "ReadDepthPixels\n" ); + +#if HAVE_HW_DEPTH_PIXELS + (void) i; + + READ_DEPTH_PIXELS(); +#else + HW_CLIPLOOP() + { + for ( i = 0 ; i < n ;i++ ) { + int fy = Y_FLIP( y[i] ); + if ( CLIPPIXEL( x[i], fy ) ) + READ_DEPTH( depth[i], x[i], fy ); + } + } + HW_ENDCLIPLOOP(); +#endif + } + HW_READ_UNLOCK(); +} + + +/** + * Initialize the given renderbuffer's span routines to point to + * the depth/z functions we generated above. + */ +static void TAG(InitDepthPointers)(struct gl_renderbuffer *rb) +{ + rb->GetRow = TAG(ReadDepthSpan); + rb->GetValues = TAG(ReadDepthPixels); + rb->PutRow = TAG(WriteDepthSpan); + rb->PutRowRGB = NULL; + rb->PutMonoRow = TAG(WriteMonoDepthSpan); + rb->PutValues = TAG(WriteDepthPixels); + rb->PutMonoValues = NULL; +} + + +#if HAVE_HW_DEPTH_SPANS +#undef WRITE_DEPTH_SPAN +#undef WRITE_DEPTH_PIXELS +#undef READ_DEPTH_SPAN +#undef READ_DEPTH_PIXELS +#else +#undef WRITE_DEPTH +#undef READ_DEPTH +#endif +#undef TAG +#undef VALUE_TYPE diff --git a/mesalib/src/mesa/drivers/dri/common/dri_metaops.c b/mesalib/src/mesa/drivers/dri/common/dri_metaops.c new file mode 100644 index 000000000..c7bea07dc --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/dri_metaops.c @@ -0,0 +1,298 @@ +/************************************************************************** + * + * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2009 Intel Corporation. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include "main/arrayobj.h" +#include "main/attrib.h" +#include "main/blend.h" +#include "main/bufferobj.h" +#include "main/buffers.h" +#include "main/depth.h" +#include "main/enable.h" +#include "main/matrix.h" +#include "main/macros.h" +#include "main/polygon.h" +#include "main/shaders.h" +#include "main/stencil.h" +#include "main/texstate.h" +#include "main/varray.h" +#include "main/viewport.h" +#include "shader/arbprogram.h" +#include "shader/program.h" +#include "dri_metaops.h" + +void +meta_set_passthrough_transform(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + + meta->saved_vp_x = ctx->Viewport.X; + meta->saved_vp_y = ctx->Viewport.Y; + meta->saved_vp_width = ctx->Viewport.Width; + meta->saved_vp_height = ctx->Viewport.Height; + meta->saved_matrix_mode = ctx->Transform.MatrixMode; + + meta->internal_viewport_call = GL_TRUE; + _mesa_Viewport(0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height); + meta->internal_viewport_call = GL_FALSE; + + _mesa_MatrixMode(GL_PROJECTION); + _mesa_PushMatrix(); + _mesa_LoadIdentity(); + _mesa_Ortho(0, ctx->DrawBuffer->Width, 0, ctx->DrawBuffer->Height, 1, -1); + + _mesa_MatrixMode(GL_MODELVIEW); + _mesa_PushMatrix(); + _mesa_LoadIdentity(); +} + +void +meta_restore_transform(struct dri_metaops *meta) +{ + _mesa_MatrixMode(GL_PROJECTION); + _mesa_PopMatrix(); + _mesa_MatrixMode(GL_MODELVIEW); + _mesa_PopMatrix(); + + _mesa_MatrixMode(meta->saved_matrix_mode); + + meta->internal_viewport_call = GL_TRUE; + _mesa_Viewport(meta->saved_vp_x, meta->saved_vp_y, + meta->saved_vp_width, meta->saved_vp_height); + meta->internal_viewport_call = GL_FALSE; +} + + +/** + * Set up a vertex program to pass through the position and first texcoord + * for pixel path. + */ +void +meta_set_passthrough_vertex_program(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + static const char *vp = + "!!ARBvp1.0\n" + "TEMP vertexClip;\n" + "DP4 vertexClip.x, state.matrix.mvp.row[0], vertex.position;\n" + "DP4 vertexClip.y, state.matrix.mvp.row[1], vertex.position;\n" + "DP4 vertexClip.z, state.matrix.mvp.row[2], vertex.position;\n" + "DP4 vertexClip.w, state.matrix.mvp.row[3], vertex.position;\n" + "MOV result.position, vertexClip;\n" + "MOV result.texcoord[0], vertex.texcoord[0];\n" + "MOV result.color, vertex.color;\n" + "END\n"; + + assert(meta->saved_vp == NULL); + + _mesa_reference_vertprog(ctx, &meta->saved_vp, + ctx->VertexProgram.Current); + if (meta->passthrough_vp == NULL) { + GLuint prog_name; + _mesa_GenPrograms(1, &prog_name); + _mesa_BindProgram(GL_VERTEX_PROGRAM_ARB, prog_name); + _mesa_ProgramStringARB(GL_VERTEX_PROGRAM_ARB, + GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(vp), (const GLubyte *)vp); + _mesa_reference_vertprog(ctx, &meta->passthrough_vp, + ctx->VertexProgram.Current); + _mesa_DeletePrograms(1, &prog_name); + } + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + meta->passthrough_vp); + ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB, + &meta->passthrough_vp->Base); + + meta->saved_vp_enable = ctx->VertexProgram.Enabled; + _mesa_Enable(GL_VERTEX_PROGRAM_ARB); +} + +/** + * Restores the previous vertex program after + * meta_set_passthrough_vertex_program() + */ +void +meta_restore_vertex_program(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + meta->saved_vp); + _mesa_reference_vertprog(ctx, &meta->saved_vp, NULL); + ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB, + &ctx->VertexProgram.Current->Base); + + if (!meta->saved_vp_enable) + _mesa_Disable(GL_VERTEX_PROGRAM_ARB); +} + +/** + * Binds the given program string to GL_FRAGMENT_PROGRAM_ARB, caching the + * program object. + */ +void +meta_set_fragment_program(struct dri_metaops *meta, + struct gl_fragment_program **prog, + const char *prog_string) +{ + GLcontext *ctx = meta->ctx; + assert(meta->saved_fp == NULL); + + _mesa_reference_fragprog(ctx, &meta->saved_fp, + ctx->FragmentProgram.Current); + if (*prog == NULL) { + GLuint prog_name; + _mesa_GenPrograms(1, &prog_name); + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, prog_name); + _mesa_ProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, + GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(prog_string), (const GLubyte *)prog_string); + _mesa_reference_fragprog(ctx, prog, ctx->FragmentProgram.Current); + /* Note that DeletePrograms unbinds the program on us */ + _mesa_DeletePrograms(1, &prog_name); + } + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, *prog); + ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, &((*prog)->Base)); + + meta->saved_fp_enable = ctx->FragmentProgram.Enabled; + _mesa_Enable(GL_FRAGMENT_PROGRAM_ARB); +} + +/** + * Restores the previous fragment program after + * meta_set_fragment_program() + */ +void +meta_restore_fragment_program(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, + meta->saved_fp); + _mesa_reference_fragprog(ctx, &meta->saved_fp, NULL); + ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, + &ctx->FragmentProgram.Current->Base); + + if (!meta->saved_fp_enable) + _mesa_Disable(GL_FRAGMENT_PROGRAM_ARB); +} + +static const float default_texcoords[4][2] = { { 0.0, 0.0 }, + { 1.0, 0.0 }, + { 1.0, 1.0 }, + { 0.0, 1.0 } }; + +void +meta_set_default_texrect(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + struct gl_client_array *old_texcoord_array; + + meta->saved_active_texture = ctx->Texture.CurrentUnit; + if (meta->saved_array_vbo == NULL) { + _mesa_reference_buffer_object(ctx, &meta->saved_array_vbo, + ctx->Array.ArrayBufferObj); + } + + old_texcoord_array = &ctx->Array.ArrayObj->TexCoord[0]; + meta->saved_texcoord_type = old_texcoord_array->Type; + meta->saved_texcoord_size = old_texcoord_array->Size; + meta->saved_texcoord_stride = old_texcoord_array->Stride; + meta->saved_texcoord_enable = old_texcoord_array->Enabled; + meta->saved_texcoord_ptr = old_texcoord_array->Ptr; + _mesa_reference_buffer_object(ctx, &meta->saved_texcoord_vbo, + old_texcoord_array->BufferObj); + + _mesa_ClientActiveTextureARB(GL_TEXTURE0); + + if (meta->texcoord_vbo == NULL) { + GLuint vbo_name; + + _mesa_GenBuffersARB(1, &vbo_name); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, vbo_name); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(default_texcoords), + default_texcoords, GL_STATIC_DRAW_ARB); + _mesa_reference_buffer_object(ctx, &meta->texcoord_vbo, + ctx->Array.ArrayBufferObj); + } else { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, + meta->texcoord_vbo->Name); + } + _mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), NULL); + + _mesa_Enable(GL_TEXTURE_COORD_ARRAY); +} + +void +meta_restore_texcoords(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + + /* Restore the old TexCoordPointer */ + if (meta->saved_texcoord_vbo) { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, + meta->saved_texcoord_vbo->Name); + _mesa_reference_buffer_object(ctx, &meta->saved_texcoord_vbo, NULL); + } else { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } + + _mesa_TexCoordPointer(meta->saved_texcoord_size, + meta->saved_texcoord_type, + meta->saved_texcoord_stride, + meta->saved_texcoord_ptr); + if (!meta->saved_texcoord_enable) + _mesa_Disable(GL_TEXTURE_COORD_ARRAY); + + _mesa_ClientActiveTextureARB(GL_TEXTURE0 + + meta->saved_active_texture); + + if (meta->saved_array_vbo) { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, + meta->saved_array_vbo->Name); + _mesa_reference_buffer_object(ctx, &meta->saved_array_vbo, NULL); + } else { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } +} + + +void meta_init_metaops(GLcontext *ctx, struct dri_metaops *meta) +{ + meta->ctx = ctx; +} + +void meta_destroy_metaops(struct dri_metaops *meta) +{ + +} diff --git a/mesalib/src/mesa/drivers/dri/common/dri_metaops.h b/mesalib/src/mesa/drivers/dri/common/dri_metaops.h new file mode 100644 index 000000000..248714532 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/dri_metaops.h @@ -0,0 +1,81 @@ +/************************************************************************** + * + * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2009 Intel Corporation. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef DRI_METAOPS_H +#define DRI_METAOPS_H + + +struct dri_metaops { + GLcontext *ctx; + GLboolean internal_viewport_call; + struct gl_fragment_program *bitmap_fp; + struct gl_vertex_program *passthrough_vp; + struct gl_buffer_object *texcoord_vbo; + + struct gl_fragment_program *saved_fp; + GLboolean saved_fp_enable; + struct gl_vertex_program *saved_vp; + GLboolean saved_vp_enable; + + struct gl_fragment_program *tex2d_fp; + + GLboolean saved_texcoord_enable; + struct gl_buffer_object *saved_array_vbo, *saved_texcoord_vbo; + GLenum saved_texcoord_type; + GLsizei saved_texcoord_size, saved_texcoord_stride; + const void *saved_texcoord_ptr; + int saved_active_texture; + + GLint saved_vp_x, saved_vp_y; + GLsizei saved_vp_width, saved_vp_height; + GLenum saved_matrix_mode; +}; + + +void meta_set_passthrough_transform(struct dri_metaops *meta); + +void meta_restore_transform(struct dri_metaops *meta); + +void meta_set_passthrough_vertex_program(struct dri_metaops *meta); + +void meta_restore_vertex_program(struct dri_metaops *meta); + +void meta_set_fragment_program(struct dri_metaops *meta, + struct gl_fragment_program **prog, + const char *prog_string); + +void meta_restore_fragment_program(struct dri_metaops *meta); + +void meta_set_default_texrect(struct dri_metaops *meta); + +void meta_restore_texcoords(struct dri_metaops *meta); + +void meta_init_metaops(GLcontext *ctx, struct dri_metaops *meta); +void meta_destroy_metaops(struct dri_metaops *meta); + +#endif diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c new file mode 100644 index 000000000..e48e10d7c --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c @@ -0,0 +1,957 @@ +/** + * \file dri_util.c + * DRI utility functions. + * + * This module acts as glue between GLX and the actual hardware driver. A DRI + * driver doesn't really \e have to use any of this - it's optional. But, some + * useful stuff is done here that otherwise would have to be duplicated in most + * drivers. + * + * Basically, these utility functions take care of some of the dirty details of + * screen initialization, context creation, context binding, DRM setup, etc. + * + * These functions are compiled into each DRI driver so libGL.so knows nothing + * about them. + */ + + +#include +#include +#include +#include +#include + +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + +#include "main/imports.h" +#define None 0 + +#include "dri_util.h" +#include "drm_sarea.h" +#include "utils.h" + +#ifndef GLX_OML_sync_control +typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRIdrawable *drawable, int32_t *numerator, int32_t *denominator); +#endif + +static void dri_get_drawable(__DRIdrawable *pdp); +static void dri_put_drawable(__DRIdrawable *pdp); + +/** + * This is just a token extension used to signal that the driver + * supports setting a read drawable. + */ +const __DRIextension driReadDrawableExtension = { + __DRI_READ_DRAWABLE, __DRI_READ_DRAWABLE_VERSION +}; + +/** + * Print message to \c stderr if the \c LIBGL_DEBUG environment variable + * is set. + * + * Is called from the drivers. + * + * \param f \c printf like format string. + */ +void +__driUtilMessage(const char *f, ...) +{ + va_list args; + + if (getenv("LIBGL_DEBUG")) { + fprintf(stderr, "libGL: "); + va_start(args, f); + vfprintf(stderr, f, args); + va_end(args); + fprintf(stderr, "\n"); + } +} + +GLint +driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 ) +{ + if (rect2.x1 > rect1.x1) rect1.x1 = rect2.x1; + if (rect2.x2 < rect1.x2) rect1.x2 = rect2.x2; + if (rect2.y1 > rect1.y1) rect1.y1 = rect2.y1; + if (rect2.y2 < rect1.y2) rect1.y2 = rect2.y2; + + if (rect1.x1 > rect1.x2 || rect1.y1 > rect1.y2) return 0; + + return (rect1.x2 - rect1.x1) * (rect1.y2 - rect1.y1); +} + +/*****************************************************************/ +/** \name Context (un)binding functions */ +/*****************************************************************/ +/*@{*/ + +/** + * Unbind context. + * + * \param scrn the screen. + * \param gc context. + * + * \return \c GL_TRUE on success, or \c GL_FALSE on failure. + * + * \internal + * This function calls __DriverAPIRec::UnbindContext, and then decrements + * __DRIdrawablePrivateRec::refcount which must be non-zero for a successful + * return. + * + * While casting the opaque private pointers associated with the parameters + * into their respective real types it also assures they are not \c NULL. + */ +static int driUnbindContext(__DRIcontext *pcp) +{ + __DRIscreen *psp; + __DRIdrawable *pdp; + __DRIdrawable *prp; + + /* + ** Assume error checking is done properly in glXMakeCurrent before + ** calling driUnbindContext. + */ + + if (pcp == NULL) + return GL_FALSE; + + psp = pcp->driScreenPriv; + pdp = pcp->driDrawablePriv; + prp = pcp->driReadablePriv; + + /* already unbound */ + if (!pdp && !prp) + return GL_TRUE; + /* Let driver unbind drawable from context */ + (*psp->DriverAPI.UnbindContext)(pcp); + + if (pdp->refcount == 0) { + /* ERROR!!! */ + return GL_FALSE; + } + + dri_put_drawable(pdp); + + if (prp != pdp) { + if (prp->refcount == 0) { + /* ERROR!!! */ + return GL_FALSE; + } + + dri_put_drawable(prp); + } + + + /* XXX this is disabled so that if we call SwapBuffers on an unbound + * window we can determine the last context bound to the window and + * use that context's lock. (BrianP, 2-Dec-2000) + */ + pcp->driDrawablePriv = pcp->driReadablePriv = NULL; + +#if 0 + /* Unbind the drawable */ + pdp->driContextPriv = &psp->dummyContextPriv; +#endif + + return GL_TRUE; +} + +/** + * This function takes both a read buffer and a draw buffer. This is needed + * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent + * function. + */ +static int driBindContext(__DRIcontext *pcp, + __DRIdrawable *pdp, + __DRIdrawable *prp) +{ + __DRIscreenPrivate *psp = pcp->driScreenPriv; + + /* Bind the drawable to the context */ + + if (pcp) { + pcp->driDrawablePriv = pdp; + pcp->driReadablePriv = prp; + if (pdp) { + pdp->driContextPriv = pcp; + dri_get_drawable(pdp); + } + if ( prp && pdp != prp ) { + dri_get_drawable(prp); + } + } + + /* + ** Now that we have a context associated with this drawable, we can + ** initialize the drawable information if has not been done before. + */ + + if (!psp->dri2.enabled) { + if (pdp && !pdp->pStamp) { + DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); + __driUtilUpdateDrawableInfo(pdp); + DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); + } + if (prp && pdp != prp && !prp->pStamp) { + DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); + __driUtilUpdateDrawableInfo(prp); + DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); + } + } + + /* Call device-specific MakeCurrent */ + + return (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp); +} + +/*@}*/ + + +/*****************************************************************/ +/** \name Drawable handling functions */ +/*****************************************************************/ +/*@{*/ + +/** + * Update private drawable information. + * + * \param pdp pointer to the private drawable information to update. + * + * This function basically updates the __DRIdrawablePrivate struct's + * cliprect information by calling \c __DRIinterfaceMethods::getDrawableInfo. + * This is usually called by the DRI_VALIDATE_DRAWABLE_INFO macro which + * compares the __DRIdrwablePrivate pStamp and lastStamp values. If + * the values are different that means we have to update the clipping + * info. + */ +void +__driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) +{ + __DRIscreenPrivate *psp = pdp->driScreenPriv; + __DRIcontextPrivate *pcp = pdp->driContextPriv; + + if (!pcp + || ((pdp != pcp->driDrawablePriv) && (pdp != pcp->driReadablePriv))) { + /* ERROR!!! + * ...but we must ignore it. There can be many contexts bound to a + * drawable. + */ + } + + if (pdp->pClipRects) { + _mesa_free(pdp->pClipRects); + pdp->pClipRects = NULL; + } + + if (pdp->pBackClipRects) { + _mesa_free(pdp->pBackClipRects); + pdp->pBackClipRects = NULL; + } + + DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); + + if (! (*psp->getDrawableInfo->getDrawableInfo)(pdp, + &pdp->index, &pdp->lastStamp, + &pdp->x, &pdp->y, &pdp->w, &pdp->h, + &pdp->numClipRects, &pdp->pClipRects, + &pdp->backX, + &pdp->backY, + &pdp->numBackClipRects, + &pdp->pBackClipRects, + pdp->loaderPrivate)) { + /* Error -- eg the window may have been destroyed. Keep going + * with no cliprects. + */ + pdp->pStamp = &pdp->lastStamp; /* prevent endless loop */ + pdp->numClipRects = 0; + pdp->pClipRects = NULL; + pdp->numBackClipRects = 0; + pdp->pBackClipRects = NULL; + } + else + pdp->pStamp = &(psp->pSAREA->drawableTable[pdp->index].stamp); + + DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); +} + +/*@}*/ + +/*****************************************************************/ +/** \name GLX callbacks */ +/*****************************************************************/ +/*@{*/ + +static void driReportDamage(__DRIdrawable *pdp, + struct drm_clip_rect *pClipRects, int numClipRects) +{ + __DRIscreen *psp = pdp->driScreenPriv; + + /* Check that we actually have the new damage report method */ + if (psp->damage) { + /* Report the damage. Currently, all our drivers draw + * directly to the front buffer, so we report the damage there + * rather than to the backing storein (if any). + */ + (*psp->damage->reportDamage)(pdp, + pdp->x, pdp->y, + pClipRects, numClipRects, + GL_TRUE, pdp->loaderPrivate); + } +} + + +/** + * Swap buffers. + * + * \param drawablePrivate opaque pointer to the per-drawable private info. + * + * \internal + * This function calls __DRIdrawablePrivate::swapBuffers. + * + * Is called directly from glXSwapBuffers(). + */ +static void driSwapBuffers(__DRIdrawable *dPriv) +{ + __DRIscreen *psp = dPriv->driScreenPriv; + drm_clip_rect_t *rects; + int i; + + psp->DriverAPI.SwapBuffers(dPriv); + + if (!dPriv->numClipRects) + return; + + rects = _mesa_malloc(sizeof(*rects) * dPriv->numClipRects); + + if (!rects) + return; + + for (i = 0; i < dPriv->numClipRects; i++) { + rects[i].x1 = dPriv->pClipRects[i].x1 - dPriv->x; + rects[i].y1 = dPriv->pClipRects[i].y1 - dPriv->y; + rects[i].x2 = dPriv->pClipRects[i].x2 - dPriv->x; + rects[i].y2 = dPriv->pClipRects[i].y2 - dPriv->y; + } + + driReportDamage(dPriv, rects, dPriv->numClipRects); + _mesa_free(rects); +} + +static int driDrawableGetMSC( __DRIscreen *sPriv, __DRIdrawable *dPriv, + int64_t *msc ) +{ + return sPriv->DriverAPI.GetDrawableMSC(sPriv, dPriv, msc); +} + + +static int driWaitForMSC(__DRIdrawable *dPriv, int64_t target_msc, + int64_t divisor, int64_t remainder, + int64_t * msc, int64_t * sbc) +{ + __DRIswapInfo sInfo; + int status; + + status = dPriv->driScreenPriv->DriverAPI.WaitForMSC( dPriv, target_msc, + divisor, remainder, + msc ); + + /* GetSwapInfo() may not be provided by the driver if GLX_SGI_video_sync + * is supported but GLX_OML_sync_control is not. Therefore, don't return + * an error value if GetSwapInfo() is not implemented. + */ + if ( status == 0 + && dPriv->driScreenPriv->DriverAPI.GetSwapInfo ) { + status = dPriv->driScreenPriv->DriverAPI.GetSwapInfo( dPriv, & sInfo ); + *sbc = sInfo.swap_count; + } + + return status; +} + + +const __DRImediaStreamCounterExtension driMediaStreamCounterExtension = { + { __DRI_MEDIA_STREAM_COUNTER, __DRI_MEDIA_STREAM_COUNTER_VERSION }, + driWaitForMSC, + driDrawableGetMSC, +}; + + +static void driCopySubBuffer(__DRIdrawable *dPriv, + int x, int y, int w, int h) +{ + drm_clip_rect_t rect; + + rect.x1 = x; + rect.y1 = dPriv->h - y - h; + rect.x2 = x + w; + rect.y2 = rect.y1 + h; + driReportDamage(dPriv, &rect, 1); + + dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h); +} + +const __DRIcopySubBufferExtension driCopySubBufferExtension = { + { __DRI_COPY_SUB_BUFFER, __DRI_COPY_SUB_BUFFER_VERSION }, + driCopySubBuffer +}; + +static void driSetSwapInterval(__DRIdrawable *dPriv, unsigned int interval) +{ + dPriv->swap_interval = interval; +} + +static unsigned int driGetSwapInterval(__DRIdrawable *dPriv) +{ + return dPriv->swap_interval; +} + +const __DRIswapControlExtension driSwapControlExtension = { + { __DRI_SWAP_CONTROL, __DRI_SWAP_CONTROL_VERSION }, + driSetSwapInterval, + driGetSwapInterval +}; + + +/** + * This is called via __DRIscreenRec's createNewDrawable pointer. + */ +static __DRIdrawable * +driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config, + drm_drawable_t hwDrawable, int renderType, + const int *attrs, void *data) +{ + __DRIdrawable *pdp; + + /* Since pbuffers are not yet supported, no drawable attributes are + * supported either. + */ + (void) attrs; + + pdp = _mesa_malloc(sizeof *pdp); + if (!pdp) { + return NULL; + } + + pdp->loaderPrivate = data; + pdp->hHWDrawable = hwDrawable; + pdp->refcount = 1; + pdp->pStamp = NULL; + pdp->lastStamp = 0; + pdp->index = 0; + pdp->x = 0; + pdp->y = 0; + pdp->w = 0; + pdp->h = 0; + pdp->numClipRects = 0; + pdp->numBackClipRects = 0; + pdp->pClipRects = NULL; + pdp->pBackClipRects = NULL; + pdp->vblSeq = 0; + pdp->vblFlags = 0; + + pdp->driScreenPriv = psp; + pdp->driContextPriv = &psp->dummyContextPriv; + + if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes, + renderType == GLX_PIXMAP_BIT)) { + _mesa_free(pdp); + return NULL; + } + + pdp->msc_base = 0; + + /* This special default value is replaced with the configured + * default value when the drawable is first bound to a direct + * rendering context. + */ + pdp->swap_interval = (unsigned)-1; + + return pdp; +} + + +static __DRIdrawable * +dri2CreateNewDrawable(__DRIscreen *screen, + const __DRIconfig *config, + void *loaderPrivate) +{ + __DRIdrawable *pdraw; + + pdraw = driCreateNewDrawable(screen, config, 0, 0, NULL, loaderPrivate); + if (!pdraw) + return NULL; + + pdraw->pClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects); + pdraw->pBackClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects); + + return pdraw; +} + +static void dri_get_drawable(__DRIdrawable *pdp) +{ + pdp->refcount++; +} + +static void dri_put_drawable(__DRIdrawable *pdp) +{ + __DRIscreenPrivate *psp; + + pdp->refcount--; + if (pdp->refcount) + return; + + if (pdp) { + psp = pdp->driScreenPriv; + (*psp->DriverAPI.DestroyBuffer)(pdp); + if (pdp->pClipRects) { + _mesa_free(pdp->pClipRects); + pdp->pClipRects = NULL; + } + if (pdp->pBackClipRects) { + _mesa_free(pdp->pBackClipRects); + pdp->pBackClipRects = NULL; + } + _mesa_free(pdp); + } +} + +static void +driDestroyDrawable(__DRIdrawable *pdp) +{ + dri_put_drawable(pdp); +} + +/*@}*/ + + +/*****************************************************************/ +/** \name Context handling functions */ +/*****************************************************************/ +/*@{*/ + +/** + * Destroy the per-context private information. + * + * \internal + * This function calls __DriverAPIRec::DestroyContext on \p contextPrivate, calls + * drmDestroyContext(), and finally frees \p contextPrivate. + */ +static void +driDestroyContext(__DRIcontext *pcp) +{ + if (pcp) { + (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); + _mesa_free(pcp); + } +} + + +/** + * Create the per-drawable private driver information. + * + * \param render_type Type of rendering target. \c GLX_RGBA is the only + * type likely to ever be supported for direct-rendering. + * \param shared Context with which to share textures, etc. or NULL + * + * \returns An opaque pointer to the per-context private information on + * success, or \c NULL on failure. + * + * \internal + * This function allocates and fills a __DRIcontextPrivateRec structure. It + * performs some device independent initialization and passes all the + * relevent information to __DriverAPIRec::CreateContext to create the + * context. + * + */ +static __DRIcontext * +driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config, + int render_type, __DRIcontext *shared, + drm_context_t hwContext, void *data) +{ + __DRIcontext *pcp; + void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL; + + pcp = _mesa_malloc(sizeof *pcp); + if (!pcp) + return NULL; + + pcp->driScreenPriv = psp; + pcp->driDrawablePriv = NULL; + + /* When the first context is created for a screen, initialize a "dummy" + * context. + */ + + if (!psp->dri2.enabled && !psp->dummyContextPriv.driScreenPriv) { + psp->dummyContextPriv.hHWContext = psp->pSAREA->dummy_context; + psp->dummyContextPriv.driScreenPriv = psp; + psp->dummyContextPriv.driDrawablePriv = NULL; + psp->dummyContextPriv.driverPrivate = NULL; + /* No other fields should be used! */ + } + + pcp->hHWContext = hwContext; + + if ( !(*psp->DriverAPI.CreateContext)(&config->modes, pcp, shareCtx) ) { + _mesa_free(pcp); + return NULL; + } + + return pcp; +} + + +static __DRIcontext * +dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config, + __DRIcontext *shared, void *data) +{ + return driCreateNewContext(screen, config, 0, shared, 0, data); +} + + +static int +driCopyContext(__DRIcontext *dest, __DRIcontext *src, unsigned long mask) +{ + return GL_FALSE; +} + +/*@}*/ + + +/*****************************************************************/ +/** \name Screen handling functions */ +/*****************************************************************/ +/*@{*/ + +/** + * Destroy the per-screen private information. + * + * \internal + * This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls + * drmClose(), and finally frees \p screenPrivate. + */ +static void driDestroyScreen(__DRIscreen *psp) +{ + if (psp) { + /* No interaction with the X-server is possible at this point. This + * routine is called after XCloseDisplay, so there is no protocol + * stream open to the X-server anymore. + */ + + if (psp->DriverAPI.DestroyScreen) + (*psp->DriverAPI.DestroyScreen)(psp); + + if (!psp->dri2.enabled) { + (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX); + (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); + (void)drmCloseOnce(psp->fd); + } + + _mesa_free(psp); + } +} + +static void +setupLoaderExtensions(__DRIscreen *psp, + const __DRIextension **extensions) +{ + int i; + + for (i = 0; extensions[i]; i++) { + if (strcmp(extensions[i]->name, __DRI_GET_DRAWABLE_INFO) == 0) + psp->getDrawableInfo = (__DRIgetDrawableInfoExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_DAMAGE) == 0) + psp->damage = (__DRIdamageExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_SYSTEM_TIME) == 0) + psp->systemTime = (__DRIsystemTimeExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_DRI2_LOADER) == 0) + psp->dri2.loader = (__DRIdri2LoaderExtension *) extensions[i]; + } +} + +/** + * This is the bootstrap function for the driver. libGL supplies all of the + * requisite information about the system, and the driver initializes itself. + * This routine also fills in the linked list pointed to by \c driver_modes + * with the \c __GLcontextModes that the driver can support for windows or + * pbuffers. + * + * For legacy DRI. + * + * \param scrn Index of the screen + * \param ddx_version Version of the 2D DDX. This may not be meaningful for + * all drivers. + * \param dri_version Version of the "server-side" DRI. + * \param drm_version Version of the kernel DRM. + * \param frame_buffer Data describing the location and layout of the + * framebuffer. + * \param pSAREA Pointer the the SAREA. + * \param fd Device handle for the DRM. + * \param extensions ?? + * \param driver_modes Returns modes suppoted by the driver + * \param loaderPrivate ?? + * + * \note There is no need to check the minimum API version in this + * function. Since the name of this function is versioned, it is + * impossible for a loader that is too old to even load this driver. + */ +static __DRIscreen * +driCreateNewScreen(int scrn, + const __DRIversion *ddx_version, + const __DRIversion *dri_version, + const __DRIversion *drm_version, + const __DRIframebuffer *frame_buffer, + drmAddress pSAREA, int fd, + const __DRIextension **extensions, + const __DRIconfig ***driver_modes, + void *loaderPrivate) +{ + static const __DRIextension *emptyExtensionList[] = { NULL }; + __DRIscreen *psp; + + psp = _mesa_calloc(sizeof *psp); + if (!psp) + return NULL; + + setupLoaderExtensions(psp, extensions); + + /* + ** NOT_DONE: This is used by the X server to detect when the client + ** has died while holding the drawable lock. The client sets the + ** drawable lock to this value. + */ + psp->drawLockID = 1; + + psp->drm_version = *drm_version; + psp->ddx_version = *ddx_version; + psp->dri_version = *dri_version; + + psp->pSAREA = pSAREA; + psp->lock = (drmLock *) &psp->pSAREA->lock; + + psp->pFB = frame_buffer->base; + psp->fbSize = frame_buffer->size; + psp->fbStride = frame_buffer->stride; + psp->fbWidth = frame_buffer->width; + psp->fbHeight = frame_buffer->height; + psp->devPrivSize = frame_buffer->dev_priv_size; + psp->pDevPriv = frame_buffer->dev_priv; + psp->fbBPP = psp->fbStride * 8 / frame_buffer->width; + + psp->extensions = emptyExtensionList; + psp->fd = fd; + psp->myNum = scrn; + psp->dri2.enabled = GL_FALSE; + + /* + ** Do not init dummy context here; actual initialization will be + ** done when the first DRI context is created. Init screen priv ptr + ** to NULL to let CreateContext routine that it needs to be inited. + */ + psp->dummyContextPriv.driScreenPriv = NULL; + + psp->DriverAPI = driDriverAPI; + + *driver_modes = driDriverAPI.InitScreen(psp); + if (*driver_modes == NULL) { + _mesa_free(psp); + return NULL; + } + + return psp; +} + +/** + * DRI2 + */ +static __DRIscreen * +dri2CreateNewScreen(int scrn, int fd, + const __DRIextension **extensions, + const __DRIconfig ***driver_configs, void *data) +{ + static const __DRIextension *emptyExtensionList[] = { NULL }; + __DRIscreen *psp; + drmVersionPtr version; + + if (driDriverAPI.InitScreen2 == NULL) + return NULL; + + psp = _mesa_calloc(sizeof(*psp)); + if (!psp) + return NULL; + + setupLoaderExtensions(psp, extensions); + + version = drmGetVersion(fd); + if (version) { + psp->drm_version.major = version->version_major; + psp->drm_version.minor = version->version_minor; + psp->drm_version.patch = version->version_patchlevel; + drmFreeVersion(version); + } + + psp->extensions = emptyExtensionList; + psp->fd = fd; + psp->myNum = scrn; + psp->dri2.enabled = GL_TRUE; + + psp->DriverAPI = driDriverAPI; + *driver_configs = driDriverAPI.InitScreen2(psp); + if (*driver_configs == NULL) { + _mesa_free(psp); + return NULL; + } + + psp->DriverAPI = driDriverAPI; + + return psp; +} + +static const __DRIextension **driGetExtensions(__DRIscreen *psp) +{ + return psp->extensions; +} + +/** Core interface */ +const __DRIcoreExtension driCoreExtension = { + { __DRI_CORE, __DRI_CORE_VERSION }, + NULL, + driDestroyScreen, + driGetExtensions, + driGetConfigAttrib, + driIndexConfigAttrib, + NULL, + driDestroyDrawable, + driSwapBuffers, + NULL, + driCopyContext, + driDestroyContext, + driBindContext, + driUnbindContext +}; + +/** Legacy DRI interface */ +const __DRIlegacyExtension driLegacyExtension = { + { __DRI_LEGACY, __DRI_LEGACY_VERSION }, + driCreateNewScreen, + driCreateNewDrawable, + driCreateNewContext, +}; + +/** Legacy DRI interface */ +const __DRIdri2Extension driDRI2Extension = { + { __DRI_DRI2, __DRI_DRI2_VERSION }, + dri2CreateNewScreen, + dri2CreateNewDrawable, + dri2CreateNewContext, +}; + +/* This is the table of extensions that the loader will dlsym() for. */ +PUBLIC const __DRIextension *__driDriverExtensions[] = { + &driCoreExtension.base, + &driLegacyExtension.base, + &driDRI2Extension.base, + NULL +}; + +static int +driFrameTracking(__DRIdrawable *drawable, GLboolean enable) +{ + return GLX_BAD_CONTEXT; +} + +static int +driQueryFrameTracking(__DRIdrawable *dpriv, + int64_t * sbc, int64_t * missedFrames, + float * lastMissedUsage, float * usage) +{ + __DRIswapInfo sInfo; + int status; + int64_t ust; + __DRIscreenPrivate *psp = dpriv->driScreenPriv; + + status = dpriv->driScreenPriv->DriverAPI.GetSwapInfo( dpriv, & sInfo ); + if ( status == 0 ) { + *sbc = sInfo.swap_count; + *missedFrames = sInfo.swap_missed_count; + *lastMissedUsage = sInfo.swap_missed_usage; + + (*psp->systemTime->getUST)( & ust ); + *usage = driCalculateSwapUsage( dpriv, sInfo.swap_ust, ust ); + } + + return status; +} + +const __DRIframeTrackingExtension driFrameTrackingExtension = { + { __DRI_FRAME_TRACKING, __DRI_FRAME_TRACKING_VERSION }, + driFrameTracking, + driQueryFrameTracking +}; + +/** + * Calculate amount of swap interval used between GLX buffer swaps. + * + * The usage value, on the range [0,max], is the fraction of total swap + * interval time used between GLX buffer swaps is calculated. + * + * \f$p = t_d / (i * t_r)\f$ + * + * Where \f$t_d\f$ is the time since the last GLX buffer swap, \f$i\f$ is the + * swap interval (as set by \c glXSwapIntervalSGI), and \f$t_r\f$ time + * required for a single vertical refresh period (as returned by \c + * glXGetMscRateOML). + * + * See the documentation for the GLX_MESA_swap_frame_usage extension for more + * details. + * + * \param dPriv Pointer to the private drawable structure. + * \return If less than a single swap interval time period was required + * between GLX buffer swaps, a number greater than 0 and less than + * 1.0 is returned. If exactly one swap interval time period is + * required, 1.0 is returned, and if more than one is required then + * a number greater than 1.0 will be returned. + * + * \sa glXSwapIntervalSGI glXGetMscRateOML + * + * \todo Instead of caching the \c glXGetMscRateOML function pointer, would it + * be possible to cache the sync rate? + */ +float +driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust, + int64_t current_ust ) +{ + int32_t n; + int32_t d; + int interval; + float usage = 1.0; + __DRIscreenPrivate *psp = dPriv->driScreenPriv; + + if ( (*psp->systemTime->getMSCRate)(dPriv, &n, &d, dPriv->loaderPrivate) ) { + interval = (dPriv->swap_interval != 0) ? dPriv->swap_interval : 1; + + + /* We want to calculate + * (current_UST - last_swap_UST) / (interval * us_per_refresh). We get + * current_UST by calling __glXGetUST. last_swap_UST is stored in + * dPriv->swap_ust. interval has already been calculated. + * + * The only tricky part is us_per_refresh. us_per_refresh is + * 1000000 / MSC_rate. We know the MSC_rate is n / d. We can flip it + * around and say us_per_refresh = 1000000 * d / n. Since this goes in + * the denominator of the final calculation, we calculate + * (interval * 1000000 * d) and move n into the numerator. + */ + + usage = (current_ust - last_swap_ust); + usage *= n; + usage /= (interval * d); + usage /= 1000000.0; + } + + return usage; +} + +/*@}*/ diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.h b/mesalib/src/mesa/drivers/dri/common/dri_util.h new file mode 100644 index 000000000..c95a5c829 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/dri_util.h @@ -0,0 +1,555 @@ +/* + * 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. + */ + +/** + * \file dri_util.h + * DRI utility functions definitions. + * + * This module acts as glue between GLX and the actual hardware driver. A DRI + * driver doesn't really \e have to use any of this - it's optional. But, some + * useful stuff is done here that otherwise would have to be duplicated in most + * drivers. + * + * Basically, these utility functions take care of some of the dirty details of + * screen initialization, context creation, context binding, DRM setup, etc. + * + * These functions are compiled into each DRI driver so libGL.so knows nothing + * about them. + * + * \sa dri_util.c. + * + * \author Kevin E. Martin + * \author Brian Paul + */ + +#ifndef _DRI_UTIL_H_ +#define _DRI_UTIL_H_ + +#include +#include +#include +#include +#include "main/glheader.h" +#include "GL/internal/glcore.h" +#include "GL/internal/dri_interface.h" + +#define GLX_BAD_CONTEXT 5 + +typedef struct __DRIswapInfoRec __DRIswapInfo; + +/* Typedefs to avoid rewriting the world. */ +typedef struct __DRIscreenRec __DRIscreenPrivate; +typedef struct __DRIdrawableRec __DRIdrawablePrivate; +typedef struct __DRIcontextRec __DRIcontextPrivate; + +/** + * Extensions. + */ +extern const __DRIlegacyExtension driLegacyExtension; +extern const __DRIcoreExtension driCoreExtension; +extern const __DRIextension driReadDrawableExtension; +extern const __DRIcopySubBufferExtension driCopySubBufferExtension; +extern const __DRIswapControlExtension driSwapControlExtension; +extern const __DRIframeTrackingExtension driFrameTrackingExtension; +extern const __DRImediaStreamCounterExtension driMediaStreamCounterExtension; + +/** + * Used by DRI_VALIDATE_DRAWABLE_INFO + */ +#define DRI_VALIDATE_DRAWABLE_INFO_ONCE(pDrawPriv) \ + do { \ + if (*(pDrawPriv->pStamp) != pDrawPriv->lastStamp) { \ + __driUtilUpdateDrawableInfo(pDrawPriv); \ + } \ + } while (0) + + +/** + * Utility macro to validate the drawable information. + * + * See __DRIdrawable::pStamp and __DRIdrawable::lastStamp. + */ +#define DRI_VALIDATE_DRAWABLE_INFO(psp, pdp) \ +do { \ + while (*(pdp->pStamp) != pdp->lastStamp) { \ + register unsigned int hwContext = psp->pSAREA->lock.lock & \ + ~(DRM_LOCK_HELD | DRM_LOCK_CONT); \ + DRM_UNLOCK(psp->fd, &psp->pSAREA->lock, hwContext); \ + \ + DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \ + DRI_VALIDATE_DRAWABLE_INFO_ONCE(pdp); \ + DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \ + \ + DRM_LIGHT_LOCK(psp->fd, &psp->pSAREA->lock, hwContext); \ + } \ +} while (0) + +/** + * Same as above, but for two drawables simultaneously. + * + */ + +#define DRI_VALIDATE_TWO_DRAWABLES_INFO(psp, pdp, prp) \ +do { \ + while (*((pdp)->pStamp) != (pdp)->lastStamp || \ + *((prp)->pStamp) != (prp)->lastStamp) { \ + register unsigned int hwContext = (psp)->pSAREA->lock.lock & \ + ~(DRM_LOCK_HELD | DRM_LOCK_CONT); \ + DRM_UNLOCK((psp)->fd, &(psp)->pSAREA->lock, hwContext); \ + \ + DRM_SPINLOCK(&(psp)->pSAREA->drawable_lock, (psp)->drawLockID); \ + DRI_VALIDATE_DRAWABLE_INFO_ONCE(pdp); \ + DRI_VALIDATE_DRAWABLE_INFO_ONCE(prp); \ + DRM_SPINUNLOCK(&(psp)->pSAREA->drawable_lock, (psp)->drawLockID); \ + \ + DRM_LIGHT_LOCK((psp)->fd, &(psp)->pSAREA->lock, hwContext); \ + } \ +} while (0) + + +/** + * Driver callback functions. + * + * Each DRI driver must have one of these structures with all the pointers set + * to appropriate functions within the driver. + * + * When glXCreateContext() is called, for example, it'll call a helper function + * dri_util.c which in turn will jump through the \a CreateContext pointer in + * this structure. + */ +struct __DriverAPIRec { + const __DRIconfig **(*InitScreen) (__DRIscreen * priv); + + /** + * Screen destruction callback + */ + void (*DestroyScreen)(__DRIscreen *driScrnPriv); + + /** + * Context creation callback + */ + GLboolean (*CreateContext)(const __GLcontextModes *glVis, + __DRIcontext *driContextPriv, + void *sharedContextPrivate); + + /** + * Context destruction callback + */ + void (*DestroyContext)(__DRIcontext *driContextPriv); + + /** + * Buffer (drawable) creation callback + */ + GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, + __DRIdrawable *driDrawPriv, + const __GLcontextModes *glVis, + GLboolean pixmapBuffer); + + /** + * Buffer (drawable) destruction callback + */ + void (*DestroyBuffer)(__DRIdrawable *driDrawPriv); + + /** + * Buffer swapping callback + */ + void (*SwapBuffers)(__DRIdrawable *driDrawPriv); + + /** + * Context activation callback + */ + GLboolean (*MakeCurrent)(__DRIcontext *driContextPriv, + __DRIdrawable *driDrawPriv, + __DRIdrawable *driReadPriv); + + /** + * Context unbinding callback + */ + GLboolean (*UnbindContext)(__DRIcontext *driContextPriv); + + /** + * Retrieves statistics about buffer swap operations. Required if + * GLX_OML_sync_control or GLX_MESA_swap_frame_usage is supported. + */ + int (*GetSwapInfo)( __DRIdrawable *dPriv, __DRIswapInfo * sInfo ); + + + /** + * These are required if GLX_OML_sync_control is supported. + */ + /*@{*/ + int (*WaitForMSC)( __DRIdrawable *priv, int64_t target_msc, + int64_t divisor, int64_t remainder, + int64_t * msc ); + int (*WaitForSBC)( __DRIdrawable *priv, int64_t target_sbc, + int64_t * msc, int64_t * sbc ); + + int64_t (*SwapBuffersMSC)( __DRIdrawable *priv, int64_t target_msc, + int64_t divisor, int64_t remainder ); + /*@}*/ + void (*CopySubBuffer)(__DRIdrawable *driDrawPriv, + int x, int y, int w, int h); + + /** + * New version of GetMSC so we can pass drawable data to the low + * level DRM driver (e.g. pipe info). Required if + * GLX_SGI_video_sync or GLX_OML_sync_control is supported. + */ + int (*GetDrawableMSC) ( __DRIscreen * priv, + __DRIdrawable *drawablePrivate, + int64_t *count); + + + + /* DRI2 Entry point */ + const __DRIconfig **(*InitScreen2) (__DRIscreen * priv); +}; + +extern const struct __DriverAPIRec driDriverAPI; + + +struct __DRIswapInfoRec { + /** + * Number of swapBuffers operations that have been *completed*. + */ + uint64_t swap_count; + + /** + * Unadjusted system time of the last buffer swap. This is the time + * when the swap completed, not the time when swapBuffers was called. + */ + int64_t swap_ust; + + /** + * Number of swap operations that occurred after the swap deadline. That + * is if a swap happens more than swap_interval frames after the previous + * swap, it has missed its deadline. If swap_interval is 0, then the + * swap deadline is 1 frame after the previous swap. + */ + uint64_t swap_missed_count; + + /** + * Amount of time used by the last swap that missed its deadline. This + * is calculated as (__glXGetUST() - swap_ust) / (swap_interval * + * time_for_single_vrefresh)). If the actual value of swap_interval is + * 0, then 1 is used instead. If swap_missed_count is non-zero, this + * should be greater-than 1.0. + */ + float swap_missed_usage; +}; + + +/** + * Per-drawable private DRI driver information. + */ +struct __DRIdrawableRec { + /** + * Kernel drawable handle + */ + drm_drawable_t hHWDrawable; + + /** + * Driver's private drawable information. + * + * This structure is opaque. + */ + void *driverPrivate; + + /** + * Private data from the loader. We just hold on to it and pass + * it back when calling into loader provided functions. + */ + void *loaderPrivate; + + /** + * Reference count for number of context's currently bound to this + * drawable. + * + * Once it reaches zero, the drawable can be destroyed. + * + * \note This behavior will change with GLX 1.3. + */ + int refcount; + + /** + * Index of this drawable information in the SAREA. + */ + unsigned int index; + + /** + * Pointer to the "drawable has changed ID" stamp in the SAREA. + */ + unsigned int *pStamp; + + /** + * Last value of the stamp. + * + * If this differs from the value stored at __DRIdrawable::pStamp, + * then the drawable information has been modified by the X server, and the + * drawable information (below) should be retrieved from the X server. + */ + unsigned int lastStamp; + + /** + * \name Drawable + * + * Drawable information used in software fallbacks. + */ + /*@{*/ + int x; + int y; + int w; + int h; + int numClipRects; + drm_clip_rect_t *pClipRects; + /*@}*/ + + /** + * \name Back and depthbuffer + * + * Information about the back and depthbuffer where different from above. + */ + /*@{*/ + int backX; + int backY; + int backClipRectType; + int numBackClipRects; + drm_clip_rect_t *pBackClipRects; + /*@}*/ + + /** + * \name Vertical blank tracking information + * Used for waiting on vertical blank events. + */ + /*@{*/ + unsigned int vblSeq; + unsigned int vblFlags; + /*@}*/ + + /** + * \name Monotonic MSC tracking + * + * Low level driver is responsible for updating msc_base and + * vblSeq values so that higher level code can calculate + * a new msc value or msc target for a WaitMSC call. The new value + * will be: + * msc = msc_base + get_vblank_count() - vblank_base; + * + * And for waiting on a value, core code will use: + * actual_target = target_msc - msc_base + vblank_base; + */ + /*@{*/ + int64_t vblank_base; + int64_t msc_base; + /*@}*/ + + /** + * Pointer to context to which this drawable is currently bound. + */ + __DRIcontext *driContextPriv; + + /** + * Pointer to screen on which this drawable was created. + */ + __DRIscreen *driScreenPriv; + + /** + * Controls swap interval as used by GLX_SGI_swap_control and + * GLX_MESA_swap_control. + */ + unsigned int swap_interval; +}; + +/** + * Per-context private driver information. + */ +struct __DRIcontextRec { + /** + * Kernel context handle used to access the device lock. + */ + drm_context_t hHWContext; + + /** + * Device driver's private context data. This structure is opaque. + */ + void *driverPrivate; + + /** + * Pointer back to the \c __DRIcontext that contains this structure. + */ + __DRIcontext *pctx; + + /** + * Pointer to drawable currently bound to this context for drawing. + */ + __DRIdrawable *driDrawablePriv; + + /** + * Pointer to drawable currently bound to this context for reading. + */ + __DRIdrawable *driReadablePriv; + + /** + * Pointer to screen on which this context was created. + */ + __DRIscreen *driScreenPriv; +}; + +/** + * Per-screen private driver information. + */ +struct __DRIscreenRec { + /** + * Current screen's number + */ + int myNum; + + /** + * Callback functions into the hardware-specific DRI driver code. + */ + struct __DriverAPIRec DriverAPI; + + const __DRIextension **extensions; + /** + * DDX / 2D driver version information. + */ + __DRIversion ddx_version; + + /** + * DRI X extension version information. + */ + __DRIversion dri_version; + + /** + * DRM (kernel module) version information. + */ + __DRIversion drm_version; + + /** + * ID used when the client sets the drawable lock. + * + * The X server uses this value to detect if the client has died while + * holding the drawable lock. + */ + int drawLockID; + + /** + * File descriptor returned when the kernel device driver is opened. + * + * Used to: + * - authenticate client to kernel + * - map the frame buffer, SAREA, etc. + * - close the kernel device driver + */ + int fd; + + /** + * SAREA pointer + * + * Used to access: + * - the device lock + * - the device-independent per-drawable and per-context(?) information + */ + drm_sarea_t *pSAREA; + + /** + * \name Direct frame buffer access information + * Used for software fallbacks. + */ + /*@{*/ + unsigned char *pFB; + int fbSize; + int fbOrigin; + int fbStride; + int fbWidth; + int fbHeight; + int fbBPP; + /*@}*/ + + /** + * \name Device-dependent private information (stored in the SAREA). + * + * This data is accessed by the client driver only. + */ + /*@{*/ + void *pDevPriv; + int devPrivSize; + /*@}*/ + + /** + * Dummy context to which drawables are bound when not bound to any + * other context. + * + * A dummy hHWContext is created for this context, and is used by the GL + * core when a hardware lock is required but the drawable is not currently + * bound (e.g., potentially during a SwapBuffers request). The dummy + * context is created when the first "real" context is created on this + * screen. + */ + __DRIcontext dummyContextPriv; + + /** + * Device-dependent private information (not stored in the SAREA). + * + * This pointer is never touched by the DRI layer. + */ + void *private; + + /** + * Pointer back to the \c __DRIscreen that contains this structure. + */ + __DRIscreen *psc; + + /* Extensions provided by the loader. */ + const __DRIgetDrawableInfoExtension *getDrawableInfo; + const __DRIsystemTimeExtension *systemTime; + const __DRIdamageExtension *damage; + + struct { + /* Flag to indicate that this is a DRI2 screen. Many of the above + * fields will not be valid or initializaed in that case. */ + int enabled; + __DRIdri2LoaderExtension *loader; + } dri2; + + /* The lock actually in use, old sarea or DRI2 */ + drmLock *lock; +}; + +extern void +__driUtilMessage(const char *f, ...); + + +extern void +__driUtilUpdateDrawableInfo(__DRIdrawable *pdp); + +extern float +driCalculateSwapUsage( __DRIdrawable *dPriv, + int64_t last_swap_ust, int64_t current_ust ); + +extern GLint +driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 ); + +#endif /* _DRI_UTIL_H_ */ diff --git a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c new file mode 100644 index 000000000..15af99136 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c @@ -0,0 +1,217 @@ + +#include "main/mtypes.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" +#include "main/imports.h" +#include "drirenderbuffer.h" + + +/** + * This will get called when a window (gl_framebuffer) is resized (probably + * via driUpdateFramebufferSize(), below). + * Just update width, height and internal format fields for now. + * There's usually no memory allocation above because the present + * DRI drivers use statically-allocated full-screen buffers. If that's not + * the case for a DRI driver, a different AllocStorage method should + * be used. + */ +static GLboolean +driRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb, + GLenum internalFormat, GLuint width, GLuint height) +{ + rb->Width = width; + rb->Height = height; + rb->InternalFormat = internalFormat; + return GL_TRUE; +} + + +static void +driDeleteRenderbuffer(struct gl_renderbuffer *rb) +{ + /* don't free rb->Data Chances are it's a memory mapped region for + * the dri drivers. + */ + _mesa_free(rb); +} + + +/** + * Allocate a new driRenderbuffer object. + * Individual drivers are free to implement different versions of + * this function. + * + * At this time, this function can only be used for window-system + * renderbuffers, not user-created RBOs. + * + * \param format Either GL_RGBA, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, + * GL_DEPTH_COMPONENT32, or GL_STENCIL_INDEX8_EXT (for now). + * \param addr address in main memory of the buffer. Probably a memory + * mapped region. + * \param cpp chars or bytes per pixel + * \param offset start of renderbuffer with respect to start of framebuffer + * \param pitch pixels per row + */ +driRenderbuffer * +driNewRenderbuffer(GLenum format, GLvoid *addr, + GLint cpp, GLint offset, GLint pitch, + __DRIdrawablePrivate *dPriv) +{ + driRenderbuffer *drb; + + assert(format == GL_RGBA || + format == GL_RGB5 || + format == GL_RGBA8 || + format == GL_DEPTH_COMPONENT16 || + format == GL_DEPTH_COMPONENT24 || + format == GL_DEPTH_COMPONENT32 || + format == GL_STENCIL_INDEX8_EXT); + + assert(cpp > 0); + assert(pitch > 0); + + drb = _mesa_calloc(sizeof(driRenderbuffer)); + if (drb) { + const GLuint name = 0; + + _mesa_init_renderbuffer(&drb->Base, name); + + /* Make sure we're using a null-valued GetPointer routine */ + assert(drb->Base.GetPointer(NULL, &drb->Base, 0, 0) == NULL); + + drb->Base.InternalFormat = format; + + if (format == GL_RGBA || format == GL_RGB5 || format == GL_RGBA8) { + /* Color */ + drb->Base._BaseFormat = GL_RGBA; + drb->Base.DataType = GL_UNSIGNED_BYTE; + if (format == GL_RGB5) { + drb->Base.RedBits = 5; + drb->Base.GreenBits = 6; + drb->Base.BlueBits = 5; + } + else { + drb->Base.RedBits = + drb->Base.GreenBits = + drb->Base.BlueBits = + drb->Base.AlphaBits = 8; + } + } + else if (format == GL_DEPTH_COMPONENT16) { + /* Depth */ + drb->Base._BaseFormat = GL_DEPTH_COMPONENT; + /* we always Get/Put 32-bit Z values */ + drb->Base.DataType = GL_UNSIGNED_INT; + drb->Base.DepthBits = 16; + } + else if (format == GL_DEPTH_COMPONENT24) { + /* Depth */ + drb->Base._BaseFormat = GL_DEPTH_COMPONENT; + /* we always Get/Put 32-bit Z values */ + drb->Base.DataType = GL_UNSIGNED_INT; + drb->Base.DepthBits = 24; + } + else if (format == GL_DEPTH_COMPONENT32) { + /* Depth */ + drb->Base._BaseFormat = GL_DEPTH_COMPONENT; + /* we always Get/Put 32-bit Z values */ + drb->Base.DataType = GL_UNSIGNED_INT; + drb->Base.DepthBits = 32; + } + else { + /* Stencil */ + ASSERT(format == GL_STENCIL_INDEX8_EXT); + drb->Base._BaseFormat = GL_STENCIL_INDEX; + drb->Base.DataType = GL_UNSIGNED_BYTE; + drb->Base.StencilBits = 8; + } + + /* XXX if we were allocating a user-created renderbuffer, we'd have + * to fill in the Red/Green/Blue/.../Bits values too. + */ + + drb->Base.AllocStorage = driRenderbufferStorage; + drb->Base.Delete = driDeleteRenderbuffer; + + drb->Base.Data = addr; + + /* DRI renderbuffer-specific fields: */ + drb->dPriv = dPriv; + drb->offset = offset; + drb->pitch = pitch; + drb->cpp = cpp; + + /* may be changed if page flipping is active: */ + drb->flippedOffset = offset; + drb->flippedPitch = pitch; + drb->flippedData = addr; + } + return drb; +} + + +/** + * Update the front and back renderbuffers' flippedPitch/Offset/Data fields. + * If stereo, flip both the left and right pairs. + * This is used when we do double buffering via page flipping. + * \param fb the framebuffer we're page flipping + * \param flipped if true, set flipped values, else set non-flipped values + */ +void +driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped) +{ + const GLuint count = fb->Visual.stereoMode ? 2 : 1; + GLuint lr; /* left or right */ + + /* we shouldn't really call this function if single-buffered, but + * play it safe. + */ + if (!fb->Visual.doubleBufferMode) + return; + + for (lr = 0; lr < count; lr++) { + GLuint frontBuf = (lr == 0) ? BUFFER_FRONT_LEFT : BUFFER_FRONT_RIGHT; + GLuint backBuf = (lr == 0) ? BUFFER_BACK_LEFT : BUFFER_BACK_RIGHT; + driRenderbuffer *front_drb + = (driRenderbuffer *) fb->Attachment[frontBuf].Renderbuffer; + driRenderbuffer *back_drb + = (driRenderbuffer *) fb->Attachment[backBuf].Renderbuffer; + + if (flipped) { + front_drb->flippedOffset = back_drb->offset; + front_drb->flippedPitch = back_drb->pitch; + front_drb->flippedData = back_drb->Base.Data; + back_drb->flippedOffset = front_drb->offset; + back_drb->flippedPitch = front_drb->pitch; + back_drb->flippedData = front_drb->Base.Data; + } + else { + front_drb->flippedOffset = front_drb->offset; + front_drb->flippedPitch = front_drb->pitch; + front_drb->flippedData = front_drb->Base.Data; + back_drb->flippedOffset = back_drb->offset; + back_drb->flippedPitch = back_drb->pitch; + back_drb->flippedData = back_drb->Base.Data; + } + } +} + + +/** + * Check that the gl_framebuffer associated with dPriv is the right size. + * Resize the gl_framebuffer if needed. + * It's expected that the dPriv->driverPrivate member points to a + * gl_framebuffer object. + */ +void +driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv) +{ + struct gl_framebuffer *fb = (struct gl_framebuffer *) dPriv->driverPrivate; + if (fb && (dPriv->w != fb->Width || dPriv->h != fb->Height)) { + ctx->Driver.ResizeBuffers(ctx, fb, dPriv->w, dPriv->h); + /* if the driver needs the hw lock for ResizeBuffers, the drawable + might have changed again by now */ + assert(fb->Width == dPriv->w); + assert(fb->Height == dPriv->h); + } +} diff --git a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h new file mode 100644 index 000000000..cf55286b3 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h @@ -0,0 +1,78 @@ + +/** + * A driRenderbuffer is dervied from gl_renderbuffer. + * It describes a color buffer (front or back), a depth buffer, or stencil + * buffer etc. + * Specific to DRI drivers are the offset and pitch fields. + */ + + +#ifndef DRIRENDERBUFFER_H +#define DRIRENDERBUFFER_H + +#include "main/mtypes.h" +#include "dri_util.h" + + +typedef struct { + struct gl_renderbuffer Base; + + /* Chars or bytes per pixel. If Z and Stencil are stored together this + * will typically be 32 whether this a depth or stencil renderbuffer. + */ + GLint cpp; + + /* Buffer position and pitch (row stride). Recall that for today's DRI + * drivers, we have statically allocated color/depth/stencil buffers. + * So this information describes the whole screen, not just a window. + * To address pixels in a window, we need to know the window's position + * and size with respect to the screen. + */ + GLint offset; /* in bytes */ + GLint pitch; /* in pixels */ + + /* If the driver can do page flipping (full-screen double buffering) + * the current front/back buffers may get swapped. + * If page flipping is disabled, these fields will be identical to + * the offset/pitch/Data above. + * If page flipping is enabled, and this is the front(back) renderbuffer, + * flippedOffset/Pitch/Data will have the back(front) renderbuffer's values. + */ + GLint flippedOffset; + GLint flippedPitch; + GLvoid *flippedData; /* mmap'd address of buffer memory, if used */ + + /* Pointer to corresponding __DRIdrawablePrivate. This is used to compute + * the window's position within the framebuffer. + */ + __DRIdrawablePrivate *dPriv; + + /* XXX this is for radeon/r200 only. We should really create a new + * r200Renderbuffer class, derived from this class... not a huge deal. + */ + GLboolean depthHasSurface; + + /** + * A handy flag to know if this is the back color buffer. + * + * \note + * This is currently only used by s3v and tdfx. + */ + GLboolean backBuffer; +} driRenderbuffer; + + +extern driRenderbuffer * +driNewRenderbuffer(GLenum format, GLvoid *addr, + GLint cpp, GLint offset, GLint pitch, + __DRIdrawablePrivate *dPriv); + +extern void +driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped); + + +extern void +driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv); + + +#endif /* DRIRENDERBUFFER_H */ diff --git a/mesalib/src/mesa/drivers/dri/common/extension_helper.h b/mesalib/src/mesa/drivers/dri/common/extension_helper.h new file mode 100644 index 000000000..40a030ce0 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/extension_helper.h @@ -0,0 +1,6609 @@ +/* DO NOT EDIT - This file generated automatically by extension_helper.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. + */ + +#include "utils.h" +#include "glapi/dispatch.h" + +#ifndef NULL +# define NULL 0 +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char UniformMatrix3fvARB_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix3fv\0" + "glUniformMatrix3fvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_multisample) +static const char SampleCoverageARB_names[] = + "fi\0" /* Parameter signature */ + "glSampleCoverage\0" + "glSampleCoverageARB\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char ConvolutionFilter1D_names[] = + "iiiiip\0" /* Parameter signature */ + "glConvolutionFilter1D\0" + "glConvolutionFilter1DEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char BeginQueryARB_names[] = + "ii\0" /* Parameter signature */ + "glBeginQuery\0" + "glBeginQueryARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_NV_point_sprite) +static const char PointParameteriNV_names[] = + "ii\0" /* Parameter signature */ + "glPointParameteri\0" + "glPointParameteriNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char GetProgramiv_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramiv\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3sARB_names[] = + "iiii\0" /* Parameter signature */ + "glMultiTexCoord3s\0" + "glMultiTexCoord3sARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3iEXT_names[] = + "iii\0" /* Parameter signature */ + "glSecondaryColor3i\0" + "glSecondaryColor3iEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3fMESA_names[] = + "fff\0" /* Parameter signature */ + "glWindowPos3f\0" + "glWindowPos3fARB\0" + "glWindowPos3fMESA\0" + ""; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +static const char PixelTexGenParameterfvSGIS_names[] = + "ip\0" /* Parameter signature */ + "glPixelTexGenParameterfvSGIS\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char ActiveTextureARB_names[] = + "i\0" /* Parameter signature */ + "glActiveTexture\0" + "glActiveTextureARB\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_blit) +static const char BlitFramebufferEXT_names[] = + "iiiiiiiiii\0" /* Parameter signature */ + "glBlitFramebuffer\0" + "glBlitFramebufferEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4ubvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4ubvNV\0" + ""; +#endif + +#if defined(need_GL_NV_fragment_program) +static const char GetProgramNamedParameterdvNV_names[] = + "iipp\0" /* Parameter signature */ + "glGetProgramNamedParameterdvNV\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char Histogram_names[] = + "iiii\0" /* Parameter signature */ + "glHistogram\0" + "glHistogramEXT\0" + ""; +#endif + +#if defined(need_GL_SGIS_texture4D) +static const char TexImage4DSGIS_names[] = + "iiiiiiiiiip\0" /* Parameter signature */ + "glTexImage4DSGIS\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2dvMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos2dv\0" + "glWindowPos2dvARB\0" + "glWindowPos2dvMESA\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiColor3fVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glReplacementCodeuiColor3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_EXT_blend_equation_separate) || defined(need_GL_ATI_blend_equation_separate) +static const char BlendEquationSeparateEXT_names[] = + "ii\0" /* Parameter signature */ + "glBlendEquationSeparate\0" + "glBlendEquationSeparateEXT\0" + "glBlendEquationSeparateATI\0" + ""; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const char ListParameterfSGIX_names[] = + "iif\0" /* Parameter signature */ + "glListParameterfSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3bEXT_names[] = + "iii\0" /* Parameter signature */ + "glSecondaryColor3b\0" + "glSecondaryColor3bEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord4fColor4fNormal3fVertex4fvSUN_names[] = + "pppp\0" /* Parameter signature */ + "glTexCoord4fColor4fNormal3fVertex4fvSUN\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4svNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4svNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char GetBufferSubDataARB_names[] = + "iiip\0" /* Parameter signature */ + "glGetBufferSubData\0" + "glGetBufferSubDataARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char BufferSubDataARB_names[] = + "iiip\0" /* Parameter signature */ + "glBufferSubData\0" + "glBufferSubDataARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fColor4ubVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glTexCoord2fColor4ubVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char AttachShader_names[] = + "ii\0" /* Parameter signature */ + "glAttachShader\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib2fARB_names[] = + "iff\0" /* Parameter signature */ + "glVertexAttrib2f\0" + "glVertexAttrib2fARB\0" + ""; +#endif + +#if defined(need_GL_MESA_shader_debug) +static const char GetDebugLogLengthMESA_names[] = + "iii\0" /* Parameter signature */ + "glGetDebugLogLengthMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib3fARB_names[] = + "ifff\0" /* Parameter signature */ + "glVertexAttrib3f\0" + "glVertexAttrib3fARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char GetQueryivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetQueryiv\0" + "glGetQueryivARB\0" + ""; +#endif + +#if defined(need_GL_EXT_texture3D) +static const char TexImage3D_names[] = + "iiiiiiiiip\0" /* Parameter signature */ + "glTexImage3D\0" + "glTexImage3DEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiVertex3fvSUN_names[] = + "pp\0" /* Parameter signature */ + "glReplacementCodeuiVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char GetQueryObjectivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetQueryObjectiv\0" + "glGetQueryObjectivARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiTexCoord2fVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glReplacementCodeuiTexCoord2fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) +static const char CompressedTexSubImage2DARB_names[] = + "iiiiiiiip\0" /* Parameter signature */ + "glCompressedTexSubImage2D\0" + "glCompressedTexSubImage2DARB\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char CombinerOutputNV_names[] = + "iiiiiiiiii\0" /* Parameter signature */ + "glCombinerOutputNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform2fARB_names[] = + "iff\0" /* Parameter signature */ + "glUniform2f\0" + "glUniform2fARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib1svARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib1sv\0" + "glVertexAttrib1svARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs1dvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs1dvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform2ivARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform2iv\0" + "glUniform2ivARB\0" + ""; +#endif + +#if defined(need_GL_HP_image_transform) +static const char GetImageTransformParameterfvHP_names[] = + "iip\0" /* Parameter signature */ + "glGetImageTransformParameterfvHP\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightubvARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightubvARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib1fvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib1fvNV\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char CopyConvolutionFilter1D_names[] = + "iiiii\0" /* Parameter signature */ + "glCopyConvolutionFilter1D\0" + "glCopyConvolutionFilter1DEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiNormal3fVertex3fSUN_names[] = + "iffffff\0" /* Parameter signature */ + "glReplacementCodeuiNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_sync) +static const char DeleteSync_names[] = + "i\0" /* Parameter signature */ + "glDeleteSync\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentMaterialfvSGIX_names[] = + "iip\0" /* Parameter signature */ + "glFragmentMaterialfvSGIX\0" + ""; +#endif + +#if defined(need_GL_EXT_blend_color) +static const char BlendColor_names[] = + "ffff\0" /* Parameter signature */ + "glBlendColor\0" + "glBlendColorEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char UniformMatrix4fvARB_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix4fv\0" + "glUniformMatrix4fvARB\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_array_object) || defined(need_GL_APPLE_vertex_array_object) +static const char DeleteVertexArraysAPPLE_names[] = + "ip\0" /* Parameter signature */ + "glDeleteVertexArrays\0" + "glDeleteVertexArraysAPPLE\0" + ""; +#endif + +#if defined(need_GL_SGIX_instruments) +static const char ReadInstrumentsSGIX_names[] = + "i\0" /* Parameter signature */ + "glReadInstrumentsSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_1) +static const char UniformMatrix2x4fv_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix2x4fv\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color4ubVertex3fvSUN_names[] = + "pp\0" /* Parameter signature */ + "glColor4ubVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_texture_array) +static const char FramebufferTextureLayerEXT_names[] = + "iiiii\0" /* Parameter signature */ + "glFramebufferTextureLayer\0" + "glFramebufferTextureLayerEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const char GetListParameterfvSGIX_names[] = + "iip\0" /* Parameter signature */ + "glGetListParameterfvSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4NusvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4Nusv\0" + "glVertexAttrib4NusvARB\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4svMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos4svMESA\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char CreateProgramObjectARB_names[] = + "\0" /* Parameter signature */ + "glCreateProgramObjectARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightModelivSGIX_names[] = + "ip\0" /* Parameter signature */ + "glFragmentLightModelivSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_1) +static const char UniformMatrix4x3fv_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix4x3fv\0" + ""; +#endif + +#if defined(need_GL_EXT_texture_object) +static const char PrioritizeTextures_names[] = + "ipp\0" /* Parameter signature */ + "glPrioritizeTextures\0" + "glPrioritizeTexturesEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_async) +static const char AsyncMarkerSGIX_names[] = + "i\0" /* Parameter signature */ + "glAsyncMarkerSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactorubSUN_names[] = + "i\0" /* Parameter signature */ + "glGlobalAlphaFactorubSUN\0" + ""; +#endif + +#if defined(need_GL_MESA_shader_debug) +static const char ClearDebugLogMESA_names[] = + "iii\0" /* Parameter signature */ + "glClearDebugLogMESA\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char ResetHistogram_names[] = + "i\0" /* Parameter signature */ + "glResetHistogram\0" + "glResetHistogramEXT\0" + ""; +#endif + +#if defined(need_GL_NV_fragment_program) +static const char GetProgramNamedParameterfvNV_names[] = + "iipp\0" /* Parameter signature */ + "glGetProgramNamedParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_point_parameters) || defined(need_GL_EXT_point_parameters) || defined(need_GL_SGIS_point_parameters) +static const char PointParameterfEXT_names[] = + "if\0" /* Parameter signature */ + "glPointParameterf\0" + "glPointParameterfARB\0" + "glPointParameterfEXT\0" + "glPointParameterfSGIS\0" + ""; +#endif + +#if defined(need_GL_SGIX_polynomial_ffd) +static const char LoadIdentityDeformationMapSGIX_names[] = + "i\0" /* Parameter signature */ + "glLoadIdentityDeformationMapSGIX\0" + ""; +#endif + +#if defined(need_GL_NV_fence) +static const char GenFencesNV_names[] = + "ip\0" /* Parameter signature */ + "glGenFencesNV\0" + ""; +#endif + +#if defined(need_GL_HP_image_transform) +static const char ImageTransformParameterfHP_names[] = + "iif\0" /* Parameter signature */ + "glImageTransformParameterfHP\0" + ""; +#endif + +#if defined(need_GL_ARB_matrix_palette) +static const char MatrixIndexusvARB_names[] = + "ip\0" /* Parameter signature */ + "glMatrixIndexusvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char DisableVertexAttribArrayARB_names[] = + "i\0" /* Parameter signature */ + "glDisableVertexAttribArray\0" + "glDisableVertexAttribArrayARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char StencilMaskSeparate_names[] = + "ii\0" /* Parameter signature */ + "glStencilMaskSeparate\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char ProgramLocalParameter4dARB_names[] = + "iidddd\0" /* Parameter signature */ + "glProgramLocalParameter4dARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) +static const char CompressedTexImage3DARB_names[] = + "iiiiiiiip\0" /* Parameter signature */ + "glCompressedTexImage3D\0" + "glCompressedTexImage3DARB\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char GetConvolutionParameteriv_names[] = + "iip\0" /* Parameter signature */ + "glGetConvolutionParameteriv\0" + "glGetConvolutionParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib1fARB_names[] = + "if\0" /* Parameter signature */ + "glVertexAttrib1f\0" + "glVertexAttrib1fARB\0" + ""; +#endif + +#if defined(need_GL_NV_fence) +static const char TestFenceNV_names[] = + "i\0" /* Parameter signature */ + "glTestFenceNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1fvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord1fv\0" + "glMultiTexCoord1fvARB\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char ColorFragmentOp2ATI_names[] = + "iiiiiiiiii\0" /* Parameter signature */ + "glColorFragmentOp2ATI\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char SecondaryColorPointerListIBM_names[] = + "iiipi\0" /* Parameter signature */ + "glSecondaryColorPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +static const char GetPixelTexGenParameterivSGIS_names[] = + "ip\0" /* Parameter signature */ + "glGetPixelTexGenParameterivSGIS\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4fNV_names[] = + "iffff\0" /* Parameter signature */ + "glVertexAttrib4fNV\0" + ""; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const char ReplacementCodeubSUN_names[] = + "i\0" /* Parameter signature */ + "glReplacementCodeubSUN\0" + ""; +#endif + +#if defined(need_GL_SGIX_async) +static const char FinishAsyncSGIX_names[] = + "p\0" /* Parameter signature */ + "glFinishAsyncSGIX\0" + ""; +#endif + +#if defined(need_GL_MESA_shader_debug) +static const char GetDebugLogMESA_names[] = + "iiiipp\0" /* Parameter signature */ + "glGetDebugLogMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) +static const char FogCoorddEXT_names[] = + "d\0" /* Parameter signature */ + "glFogCoordd\0" + "glFogCoorddEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color4ubVertex3fSUN_names[] = + "iiiifff\0" /* Parameter signature */ + "glColor4ubVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) +static const char FogCoordfEXT_names[] = + "f\0" /* Parameter signature */ + "glFogCoordf\0" + "glFogCoordfEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fVertex3fSUN_names[] = + "fffff\0" /* Parameter signature */ + "glTexCoord2fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactoriSUN_names[] = + "i\0" /* Parameter signature */ + "glGlobalAlphaFactoriSUN\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib2dNV_names[] = + "idd\0" /* Parameter signature */ + "glVertexAttrib2dNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char GetProgramInfoLog_names[] = + "iipp\0" /* Parameter signature */ + "glGetProgramInfoLog\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4NbvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4Nbv\0" + "glVertexAttrib4NbvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_shader) +static const char GetActiveAttribARB_names[] = + "iiipppp\0" /* Parameter signature */ + "glGetActiveAttrib\0" + "glGetActiveAttribARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4ubNV_names[] = + "iiiii\0" /* Parameter signature */ + "glVertexAttrib4ubNV\0" + ""; +#endif + +#if defined(need_GL_APPLE_texture_range) +static const char TextureRangeAPPLE_names[] = + "iip\0" /* Parameter signature */ + "glTextureRangeAPPLE\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fColor4fNormal3fVertex3fSUN_names[] = + "ffffffffffff\0" /* Parameter signature */ + "glTexCoord2fColor4fNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char CombinerParameterfvNV_names[] = + "ip\0" /* Parameter signature */ + "glCombinerParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs3dvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs3dvNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs4fvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs4fvNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_array_range) +static const char VertexArrayRangeNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexArrayRangeNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightiSGIX_names[] = + "iii\0" /* Parameter signature */ + "glFragmentLightiSGIX\0" + ""; +#endif + +#if defined(need_GL_EXT_polygon_offset) +static const char PolygonOffsetEXT_names[] = + "ff\0" /* Parameter signature */ + "glPolygonOffsetEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_async) +static const char PollAsyncSGIX_names[] = + "p\0" /* Parameter signature */ + "glPollAsyncSGIX\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char DeleteFragmentShaderATI_names[] = + "i\0" /* Parameter signature */ + "glDeleteFragmentShaderATI\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fNormal3fVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glTexCoord2fNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix) +static const char MultTransposeMatrixdARB_names[] = + "p\0" /* Parameter signature */ + "glMultTransposeMatrixd\0" + "glMultTransposeMatrixdARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2svMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos2sv\0" + "glWindowPos2svARB\0" + "glWindowPos2svMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) +static const char CompressedTexImage1DARB_names[] = + "iiiiiip\0" /* Parameter signature */ + "glCompressedTexImage1D\0" + "glCompressedTexImage1DARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib2sNV_names[] = + "iii\0" /* Parameter signature */ + "glVertexAttrib2sNV\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char NormalPointerListIBM_names[] = + "iipi\0" /* Parameter signature */ + "glNormalPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char IndexPointerEXT_names[] = + "iiip\0" /* Parameter signature */ + "glIndexPointerEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char NormalPointerEXT_names[] = + "iiip\0" /* Parameter signature */ + "glNormalPointerEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3dARB_names[] = + "iddd\0" /* Parameter signature */ + "glMultiTexCoord3d\0" + "glMultiTexCoord3dARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2iARB_names[] = + "iii\0" /* Parameter signature */ + "glMultiTexCoord2i\0" + "glMultiTexCoord2iARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_names[] = + "iffffffff\0" /* Parameter signature */ + "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2svARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord2sv\0" + "glMultiTexCoord2svARB\0" + ""; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const char ReplacementCodeubvSUN_names[] = + "p\0" /* Parameter signature */ + "glReplacementCodeubvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform3iARB_names[] = + "iiii\0" /* Parameter signature */ + "glUniform3i\0" + "glUniform3iARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char GetFragmentMaterialfvSGIX_names[] = + "iip\0" /* Parameter signature */ + "glGetFragmentMaterialfvSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char GetShaderInfoLog_names[] = + "iipp\0" /* Parameter signature */ + "glGetShaderInfoLog\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightivARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightivARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_instruments) +static const char PollInstrumentsSGIX_names[] = + "p\0" /* Parameter signature */ + "glPollInstrumentsSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactordSUN_names[] = + "d\0" /* Parameter signature */ + "glGlobalAlphaFactordSUN\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs3fvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs3fvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char GenerateMipmapEXT_names[] = + "i\0" /* Parameter signature */ + "glGenerateMipmap\0" + "glGenerateMipmapEXT\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char SetFragmentShaderConstantATI_names[] = + "ip\0" /* Parameter signature */ + "glSetFragmentShaderConstantATI\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char GetMapAttribParameterivNV_names[] = + "iiip\0" /* Parameter signature */ + "glGetMapAttribParameterivNV\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char CreateShaderObjectARB_names[] = + "i\0" /* Parameter signature */ + "glCreateShaderObjectARB\0" + ""; +#endif + +#if defined(need_GL_SGIS_sharpen_texture) +static const char GetSharpenTexFuncSGIS_names[] = + "ip\0" /* Parameter signature */ + "glGetSharpenTexFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char BufferDataARB_names[] = + "iipi\0" /* Parameter signature */ + "glBufferData\0" + "glBufferDataARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_array_range) +static const char FlushVertexArrayRangeNV_names[] = + "\0" /* Parameter signature */ + "glFlushVertexArrayRangeNV\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char SampleMapATI_names[] = + "iii\0" /* Parameter signature */ + "glSampleMapATI\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char VertexPointerEXT_names[] = + "iiiip\0" /* Parameter signature */ + "glVertexPointerEXT\0" + ""; +#endif + +#if defined(need_GL_SGIS_texture_filter4) +static const char GetTexFilterFuncSGIS_names[] = + "iip\0" /* Parameter signature */ + "glGetTexFilterFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char GetCombinerOutputParameterfvNV_names[] = + "iiip\0" /* Parameter signature */ + "glGetCombinerOutputParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_EXT_subtexture) +static const char TexSubImage1D_names[] = + "iiiiiip\0" /* Parameter signature */ + "glTexSubImage1D\0" + "glTexSubImage1DEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib1sARB_names[] = + "ii\0" /* Parameter signature */ + "glVertexAttrib1s\0" + "glVertexAttrib1sARB\0" + ""; +#endif + +#if defined(need_GL_ARB_sync) +static const char FenceSync_names[] = + "ii\0" /* Parameter signature */ + "glFenceSync\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char FinalCombinerInputNV_names[] = + "iiii\0" /* Parameter signature */ + "glFinalCombinerInputNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_flush_raster) +static const char FlushRasterSGIX_names[] = + "\0" /* Parameter signature */ + "glFlushRasterSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiTexCoord2fVertex3fSUN_names[] = + "ifffff\0" /* Parameter signature */ + "glReplacementCodeuiTexCoord2fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform1fARB_names[] = + "if\0" /* Parameter signature */ + "glUniform1f\0" + "glUniform1fARB\0" + ""; +#endif + +#if defined(need_GL_EXT_texture_object) +static const char AreTexturesResident_names[] = + "ipp\0" /* Parameter signature */ + "glAreTexturesResident\0" + "glAreTexturesResidentEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ATI_separate_stencil) +static const char StencilOpSeparate_names[] = + "iiii\0" /* Parameter signature */ + "glStencilOpSeparate\0" + "glStencilOpSeparateATI\0" + ""; +#endif + +#if defined(need_GL_SGI_color_table) +static const char ColorTableParameteriv_names[] = + "iip\0" /* Parameter signature */ + "glColorTableParameteriv\0" + "glColorTableParameterivSGI\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char FogCoordPointerListIBM_names[] = + "iipi\0" /* Parameter signature */ + "glFogCoordPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3dMESA_names[] = + "ddd\0" /* Parameter signature */ + "glWindowPos3d\0" + "glWindowPos3dARB\0" + "glWindowPos3dMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_point_parameters) || defined(need_GL_EXT_point_parameters) || defined(need_GL_SGIS_point_parameters) +static const char PointParameterfvEXT_names[] = + "ip\0" /* Parameter signature */ + "glPointParameterfv\0" + "glPointParameterfvARB\0" + "glPointParameterfvEXT\0" + "glPointParameterfvSGIS\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2fvMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos2fv\0" + "glWindowPos2fvARB\0" + "glWindowPos2fvMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3bvEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3bv\0" + "glSecondaryColor3bvEXT\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char VertexPointerListIBM_names[] = + "iiipi\0" /* Parameter signature */ + "glVertexPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char GetProgramLocalParameterfvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramLocalParameterfvARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentMaterialfSGIX_names[] = + "iif\0" /* Parameter signature */ + "glFragmentMaterialfSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fNormal3fVertex3fSUN_names[] = + "ffffffff\0" /* Parameter signature */ + "glTexCoord2fNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char RenderbufferStorageEXT_names[] = + "iiii\0" /* Parameter signature */ + "glRenderbufferStorage\0" + "glRenderbufferStorageEXT\0" + ""; +#endif + +#if defined(need_GL_NV_fence) +static const char IsFenceNV_names[] = + "i\0" /* Parameter signature */ + "glIsFenceNV\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char AttachObjectARB_names[] = + "ii\0" /* Parameter signature */ + "glAttachObjectARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char GetFragmentLightivSGIX_names[] = + "iip\0" /* Parameter signature */ + "glGetFragmentLightivSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char UniformMatrix2fvARB_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix2fv\0" + "glUniformMatrix2fvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2fARB_names[] = + "iff\0" /* Parameter signature */ + "glMultiTexCoord2f\0" + "glMultiTexCoord2fARB\0" + ""; +#endif + +#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture) +static const char ColorTable_names[] = + "iiiiip\0" /* Parameter signature */ + "glColorTable\0" + "glColorTableSGI\0" + "glColorTableEXT\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char MapControlPointsNV_names[] = + "iiiiiiiip\0" /* Parameter signature */ + "glMapControlPointsNV\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char ConvolutionFilter2D_names[] = + "iiiiiip\0" /* Parameter signature */ + "glConvolutionFilter2D\0" + "glConvolutionFilter2DEXT\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char MapParameterfvNV_names[] = + "iip\0" /* Parameter signature */ + "glMapParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib3dvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib3dv\0" + "glVertexAttrib3dvARB\0" + ""; +#endif + +#if defined(need_GL_PGI_misc_hints) +static const char HintPGI_names[] = + "ii\0" /* Parameter signature */ + "glHintPGI\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char ConvolutionParameteriv_names[] = + "iip\0" /* Parameter signature */ + "glConvolutionParameteriv\0" + "glConvolutionParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_cull_vertex) +static const char CullParameterdvEXT_names[] = + "ip\0" /* Parameter signature */ + "glCullParameterdvEXT\0" + ""; +#endif + +#if defined(need_GL_NV_fragment_program) +static const char ProgramNamedParameter4fNV_names[] = + "iipffff\0" /* Parameter signature */ + "glProgramNamedParameter4fNV\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color3fVertex3fSUN_names[] = + "ffffff\0" /* Parameter signature */ + "glColor3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char ProgramEnvParameter4fvARB_names[] = + "iip\0" /* Parameter signature */ + "glProgramEnvParameter4fvARB\0" + "glProgramParameter4fvNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightModeliSGIX_names[] = + "ii\0" /* Parameter signature */ + "glFragmentLightModeliSGIX\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char ConvolutionParameterfv_names[] = + "iip\0" /* Parameter signature */ + "glConvolutionParameterfv\0" + "glConvolutionParameterfvEXT\0" + ""; +#endif + +#if defined(need_GL_3DFX_tbuffer) +static const char TbufferMask3DFX_names[] = + "i\0" /* Parameter signature */ + "glTbufferMask3DFX\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char LoadProgramNV_names[] = + "iiip\0" /* Parameter signature */ + "glLoadProgramNV\0" + ""; +#endif + +#if defined(need_GL_ARB_sync) +static const char WaitSync_names[] = + "iii\0" /* Parameter signature */ + "glWaitSync\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4fvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4fvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char GetAttachedObjectsARB_names[] = + "iipp\0" /* Parameter signature */ + "glGetAttachedObjectsARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform3fvARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform3fv\0" + "glUniform3fvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_draw_range_elements) +static const char DrawRangeElements_names[] = + "iiiiip\0" /* Parameter signature */ + "glDrawRangeElements\0" + "glDrawRangeElementsEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_sprite) +static const char SpriteParameterfvSGIX_names[] = + "ip\0" /* Parameter signature */ + "glSpriteParameterfvSGIX\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char CheckFramebufferStatusEXT_names[] = + "i\0" /* Parameter signature */ + "glCheckFramebufferStatus\0" + "glCheckFramebufferStatusEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactoruiSUN_names[] = + "i\0" /* Parameter signature */ + "glGlobalAlphaFactoruiSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char GetHandleARB_names[] = + "i\0" /* Parameter signature */ + "glGetHandleARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char GetVertexAttribivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetVertexAttribiv\0" + "glGetVertexAttribivARB\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char GetCombinerInputParameterfvNV_names[] = + "iiiip\0" /* Parameter signature */ + "glGetCombinerInputParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char CreateProgram_names[] = + "\0" /* Parameter signature */ + "glCreateProgram\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix) +static const char LoadTransposeMatrixdARB_names[] = + "p\0" /* Parameter signature */ + "glLoadTransposeMatrixd\0" + "glLoadTransposeMatrixdARB\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char GetMinmax_names[] = + "iiiip\0" /* Parameter signature */ + "glGetMinmax\0" + "glGetMinmaxEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char StencilFuncSeparate_names[] = + "iiii\0" /* Parameter signature */ + "glStencilFuncSeparate\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3sEXT_names[] = + "iii\0" /* Parameter signature */ + "glSecondaryColor3s\0" + "glSecondaryColor3sEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color3fVertex3fvSUN_names[] = + "pp\0" /* Parameter signature */ + "glColor3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactorbSUN_names[] = + "i\0" /* Parameter signature */ + "glGlobalAlphaFactorbSUN\0" + ""; +#endif + +#if defined(need_GL_HP_image_transform) +static const char ImageTransformParameterfvHP_names[] = + "iip\0" /* Parameter signature */ + "glImageTransformParameterfvHP\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4ivARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4iv\0" + "glVertexAttrib4ivARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib3fNV_names[] = + "ifff\0" /* Parameter signature */ + "glVertexAttrib3fNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs2dvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs2dvNV\0" + ""; +#endif + +#if defined(need_GL_EXT_timer_query) +static const char GetQueryObjectui64vEXT_names[] = + "iip\0" /* Parameter signature */ + "glGetQueryObjectui64vEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3fvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord3fv\0" + "glMultiTexCoord3fvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3dEXT_names[] = + "ddd\0" /* Parameter signature */ + "glSecondaryColor3d\0" + "glSecondaryColor3dEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetProgramParameterfvNV_names[] = + "iiip\0" /* Parameter signature */ + "glGetProgramParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char TangentPointerEXT_names[] = + "iip\0" /* Parameter signature */ + "glTangentPointerEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color4fNormal3fVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glColor4fNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_SGIX_instruments) +static const char GetInstrumentsSGIX_names[] = + "\0" /* Parameter signature */ + "glGetInstrumentsSGIX\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char EvalMapsNV_names[] = + "ii\0" /* Parameter signature */ + "glEvalMapsNV\0" + ""; +#endif + +#if defined(need_GL_EXT_subtexture) +static const char TexSubImage2D_names[] = + "iiiiiiiip\0" /* Parameter signature */ + "glTexSubImage2D\0" + "glTexSubImage2DEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightivSGIX_names[] = + "iip\0" /* Parameter signature */ + "glFragmentLightivSGIX\0" + ""; +#endif + +#if defined(need_GL_APPLE_texture_range) +static const char GetTexParameterPointervAPPLE_names[] = + "iip\0" /* Parameter signature */ + "glGetTexParameterPointervAPPLE\0" + ""; +#endif + +#if defined(need_GL_EXT_pixel_transform) +static const char PixelTransformParameterfvEXT_names[] = + "iip\0" /* Parameter signature */ + "glPixelTransformParameterfvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4bvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4bv\0" + "glVertexAttrib4bvARB\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char AlphaFragmentOp2ATI_names[] = + "iiiiiiiii\0" /* Parameter signature */ + "glAlphaFragmentOp2ATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4sARB_names[] = + "iiiii\0" /* Parameter signature */ + "glMultiTexCoord4s\0" + "glMultiTexCoord4sARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char GetFragmentMaterialivSGIX_names[] = + "iip\0" /* Parameter signature */ + "glGetFragmentMaterialivSGIX\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4dMESA_names[] = + "dddd\0" /* Parameter signature */ + "glWindowPos4dMESA\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightPointerARB_names[] = + "iiip\0" /* Parameter signature */ + "glWeightPointerARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2dMESA_names[] = + "dd\0" /* Parameter signature */ + "glWindowPos2d\0" + "glWindowPos2dARB\0" + "glWindowPos2dMESA\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char FramebufferTexture3DEXT_names[] = + "iiiiii\0" /* Parameter signature */ + "glFramebufferTexture3D\0" + "glFramebufferTexture3DEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_blend_minmax) +static const char BlendEquation_names[] = + "i\0" /* Parameter signature */ + "glBlendEquation\0" + "glBlendEquationEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib3dNV_names[] = + "iddd\0" /* Parameter signature */ + "glVertexAttrib3dNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib3dARB_names[] = + "iddd\0" /* Parameter signature */ + "glVertexAttrib3d\0" + "glVertexAttrib3dARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_names[] = + "ppppp\0" /* Parameter signature */ + "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4fARB_names[] = + "iffff\0" /* Parameter signature */ + "glVertexAttrib4f\0" + "glVertexAttrib4fARB\0" + ""; +#endif + +#if defined(need_GL_EXT_index_func) +static const char IndexFuncEXT_names[] = + "if\0" /* Parameter signature */ + "glIndexFuncEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char FramebufferTexture2DEXT_names[] = + "iiiii\0" /* Parameter signature */ + "glFramebufferTexture2D\0" + "glFramebufferTexture2DEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2dvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord2dv\0" + "glMultiTexCoord2dvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_cull_vertex) +static const char CullParameterfvEXT_names[] = + "ip\0" /* Parameter signature */ + "glCullParameterfvEXT\0" + ""; +#endif + +#if defined(need_GL_NV_fragment_program) +static const char ProgramNamedParameter4fvNV_names[] = + "iipp\0" /* Parameter signature */ + "glProgramNamedParameter4fvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColorPointerEXT_names[] = + "iiip\0" /* Parameter signature */ + "glSecondaryColorPointer\0" + "glSecondaryColorPointerEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4fvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4fv\0" + "glVertexAttrib4fvARB\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char ColorPointerListIBM_names[] = + "iiipi\0" /* Parameter signature */ + "glColorPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char GetActiveUniformARB_names[] = + "iiipppp\0" /* Parameter signature */ + "glGetActiveUniform\0" + "glGetActiveUniformARB\0" + ""; +#endif + +#if defined(need_GL_HP_image_transform) +static const char ImageTransformParameteriHP_names[] = + "iii\0" /* Parameter signature */ + "glImageTransformParameteriHP\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1svARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord1sv\0" + "glMultiTexCoord1svARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char EndQueryARB_names[] = + "i\0" /* Parameter signature */ + "glEndQuery\0" + "glEndQueryARB\0" + ""; +#endif + +#if defined(need_GL_NV_fence) +static const char DeleteFencesNV_names[] = + "ip\0" /* Parameter signature */ + "glDeleteFencesNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_polynomial_ffd) +static const char DeformationMap3dSGIX_names[] = + "iddiiddiiddiip\0" /* Parameter signature */ + "glDeformationMap3dSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char IsShader_names[] = + "i\0" /* Parameter signature */ + "glIsShader\0" + ""; +#endif + +#if defined(need_GL_HP_image_transform) +static const char GetImageTransformParameterivHP_names[] = + "iip\0" /* Parameter signature */ + "glGetImageTransformParameterivHP\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4ivMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos4ivMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3svARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord3sv\0" + "glMultiTexCoord3svARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4iARB_names[] = + "iiiii\0" /* Parameter signature */ + "glMultiTexCoord4i\0" + "glMultiTexCoord4iARB\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3ivEXT_names[] = + "p\0" /* Parameter signature */ + "glBinormal3ivEXT\0" + ""; +#endif + +#if defined(need_GL_MESA_resize_buffers) +static const char ResizeBuffersMESA_names[] = + "\0" /* Parameter signature */ + "glResizeBuffersMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char GetUniformivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetUniformiv\0" + "glGetUniformivARB\0" + ""; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +static const char PixelTexGenParameteriSGIS_names[] = + "ii\0" /* Parameter signature */ + "glPixelTexGenParameteriSGIS\0" + ""; +#endif + +#if defined(need_GL_INTEL_parallel_arrays) +static const char VertexPointervINTEL_names[] = + "iip\0" /* Parameter signature */ + "glVertexPointervINTEL\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiColor4fNormal3fVertex3fvSUN_names[] = + "pppp\0" /* Parameter signature */ + "glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3uiEXT_names[] = + "iii\0" /* Parameter signature */ + "glSecondaryColor3ui\0" + "glSecondaryColor3uiEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_instruments) +static const char StartInstrumentsSGIX_names[] = + "\0" /* Parameter signature */ + "glStartInstrumentsSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3usvEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3usv\0" + "glSecondaryColor3usvEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib2fvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib2fvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char ProgramLocalParameter4dvARB_names[] = + "iip\0" /* Parameter signature */ + "glProgramLocalParameter4dvARB\0" + ""; +#endif + +#if defined(need_GL_ARB_matrix_palette) +static const char MatrixIndexuivARB_names[] = + "ip\0" /* Parameter signature */ + "glMatrixIndexuivARB\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) +static const char RenderbufferStorageMultisample_names[] = + "iiiii\0" /* Parameter signature */ + "glRenderbufferStorageMultisample\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3sEXT_names[] = + "iii\0" /* Parameter signature */ + "glTangent3sEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactorfSUN_names[] = + "f\0" /* Parameter signature */ + "glGlobalAlphaFactorfSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3iARB_names[] = + "iiii\0" /* Parameter signature */ + "glMultiTexCoord3i\0" + "glMultiTexCoord3iARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char IsProgram_names[] = + "i\0" /* Parameter signature */ + "glIsProgram\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char TexCoordPointerListIBM_names[] = + "iiipi\0" /* Parameter signature */ + "glTexCoordPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactorusSUN_names[] = + "i\0" /* Parameter signature */ + "glGlobalAlphaFactorusSUN\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib2dvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib2dvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char FramebufferRenderbufferEXT_names[] = + "iiii\0" /* Parameter signature */ + "glFramebufferRenderbuffer\0" + "glFramebufferRenderbufferEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib1dvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib1dvNV\0" + ""; +#endif + +#if defined(need_GL_EXT_texture_object) +static const char GenTextures_names[] = + "ip\0" /* Parameter signature */ + "glGenTextures\0" + "glGenTexturesEXT\0" + ""; +#endif + +#if defined(need_GL_NV_fence) +static const char SetFenceNV_names[] = + "ii\0" /* Parameter signature */ + "glSetFenceNV\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char FramebufferTexture1DEXT_names[] = + "iiiii\0" /* Parameter signature */ + "glFramebufferTexture1D\0" + "glFramebufferTexture1DEXT\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char GetCombinerOutputParameterivNV_names[] = + "iiip\0" /* Parameter signature */ + "glGetCombinerOutputParameterivNV\0" + ""; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +static const char PixelTexGenParameterivSGIS_names[] = + "ip\0" /* Parameter signature */ + "glPixelTexGenParameterivSGIS\0" + ""; +#endif + +#if defined(need_GL_EXT_texture_perturb_normal) +static const char TextureNormalEXT_names[] = + "i\0" /* Parameter signature */ + "glTextureNormalEXT\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char IndexPointerListIBM_names[] = + "iipi\0" /* Parameter signature */ + "glIndexPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightfvARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightfvARB\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4fMESA_names[] = + "ffff\0" /* Parameter signature */ + "glWindowPos4fMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3dvMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos3dv\0" + "glWindowPos3dvARB\0" + "glWindowPos3dvMESA\0" + ""; +#endif + +#if defined(need_GL_EXT_timer_query) +static const char GetQueryObjecti64vEXT_names[] = + "iip\0" /* Parameter signature */ + "glGetQueryObjecti64vEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1dARB_names[] = + "id\0" /* Parameter signature */ + "glMultiTexCoord1d\0" + "glMultiTexCoord1dARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_NV_point_sprite) +static const char PointParameterivNV_names[] = + "ip\0" /* Parameter signature */ + "glPointParameteriv\0" + "glPointParameterivNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform2fvARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform2fv\0" + "glUniform2fvARB\0" + ""; +#endif + +#if defined(need_GL_APPLE_flush_buffer_range) +static const char BufferParameteriAPPLE_names[] = + "iii\0" /* Parameter signature */ + "glBufferParameteriAPPLE\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3dvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord3dv\0" + "glMultiTexCoord3dvARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_names[] = + "pppp\0" /* Parameter signature */ + "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char DeleteObjectARB_names[] = + "i\0" /* Parameter signature */ + "glDeleteObjectARB\0" + ""; +#endif + +#if defined(need_GL_ARB_matrix_palette) +static const char MatrixIndexPointerARB_names[] = + "iiip\0" /* Parameter signature */ + "glMatrixIndexPointerARB\0" + ""; +#endif + +#if defined(need_GL_NV_fragment_program) +static const char ProgramNamedParameter4dvNV_names[] = + "iipp\0" /* Parameter signature */ + "glProgramNamedParameter4dvNV\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3fvEXT_names[] = + "p\0" /* Parameter signature */ + "glTangent3fvEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_array_object) +static const char GenVertexArrays_names[] = + "ip\0" /* Parameter signature */ + "glGenVertexArrays\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char BindFramebufferEXT_names[] = + "ii\0" /* Parameter signature */ + "glBindFramebuffer\0" + "glBindFramebufferEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_reference_plane) +static const char ReferencePlaneSGIX_names[] = + "p\0" /* Parameter signature */ + "glReferencePlaneSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char ValidateProgramARB_names[] = + "i\0" /* Parameter signature */ + "glValidateProgram\0" + "glValidateProgramARB\0" + ""; +#endif + +#if defined(need_GL_EXT_compiled_vertex_array) +static const char UnlockArraysEXT_names[] = + "\0" /* Parameter signature */ + "glUnlockArraysEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fColor3fVertex3fSUN_names[] = + "ffffffff\0" /* Parameter signature */ + "glTexCoord2fColor3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3fvMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos3fv\0" + "glWindowPos3fvARB\0" + "glWindowPos3fvMESA\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib1svNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib1svNV\0" + ""; +#endif + +#if defined(need_GL_EXT_copy_texture) +static const char CopyTexSubImage3D_names[] = + "iiiiiiiii\0" /* Parameter signature */ + "glCopyTexSubImage3D\0" + "glCopyTexSubImage3DEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib2dARB_names[] = + "idd\0" /* Parameter signature */ + "glVertexAttrib2d\0" + "glVertexAttrib2dARB\0" + ""; +#endif + +#if defined(need_GL_ARB_sync) +static const char GetInteger64v_names[] = + "ip\0" /* Parameter signature */ + "glGetInteger64v\0" + ""; +#endif + +#if defined(need_GL_SGIS_texture_color_mask) +static const char TextureColorMaskSGIS_names[] = + "iiii\0" /* Parameter signature */ + "glTextureColorMaskSGIS\0" + ""; +#endif + +#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture) +static const char GetColorTable_names[] = + "iiip\0" /* Parameter signature */ + "glGetColorTable\0" + "glGetColorTableSGI\0" + "glGetColorTableEXT\0" + ""; +#endif + +#if defined(need_GL_SGI_color_table) +static const char CopyColorTable_names[] = + "iiiii\0" /* Parameter signature */ + "glCopyColorTable\0" + "glCopyColorTableSGI\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char GetHistogramParameterfv_names[] = + "iip\0" /* Parameter signature */ + "glGetHistogramParameterfv\0" + "glGetHistogramParameterfvEXT\0" + ""; +#endif + +#if defined(need_GL_INTEL_parallel_arrays) +static const char ColorPointervINTEL_names[] = + "iip\0" /* Parameter signature */ + "glColorPointervINTEL\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char AlphaFragmentOp1ATI_names[] = + "iiiiii\0" /* Parameter signature */ + "glAlphaFragmentOp1ATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3ivARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord3iv\0" + "glMultiTexCoord3ivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2sARB_names[] = + "iii\0" /* Parameter signature */ + "glMultiTexCoord2s\0" + "glMultiTexCoord2sARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib1dvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib1dv\0" + "glVertexAttrib1dvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_texture_object) +static const char DeleteTextures_names[] = + "ip\0" /* Parameter signature */ + "glDeleteTextures\0" + "glDeleteTexturesEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char TexCoordPointerEXT_names[] = + "iiiip\0" /* Parameter signature */ + "glTexCoordPointerEXT\0" + ""; +#endif + +#if defined(need_GL_SGIS_texture4D) +static const char TexSubImage4DSGIS_names[] = + "iiiiiiiiiiiip\0" /* Parameter signature */ + "glTexSubImage4DSGIS\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners2) +static const char CombinerStageParameterfvNV_names[] = + "iip\0" /* Parameter signature */ + "glCombinerStageParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_instruments) +static const char StopInstrumentsSGIX_names[] = + "i\0" /* Parameter signature */ + "glStopInstrumentsSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord4fColor4fNormal3fVertex4fSUN_names[] = + "fffffffffffffff\0" /* Parameter signature */ + "glTexCoord4fColor4fNormal3fVertex4fSUN\0" + ""; +#endif + +#if defined(need_GL_SGIX_polynomial_ffd) +static const char DeformSGIX_names[] = + "i\0" /* Parameter signature */ + "glDeformSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char GetVertexAttribfvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetVertexAttribfv\0" + "glGetVertexAttribfvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3ivEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3iv\0" + "glSecondaryColor3ivEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_1) +static const char UniformMatrix4x2fv_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix4x2fv\0" + ""; +#endif + +#if defined(need_GL_SGIS_detail_texture) +static const char GetDetailTexFuncSGIS_names[] = + "ip\0" /* Parameter signature */ + "glGetDetailTexFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners2) +static const char GetCombinerStageParameterfvNV_names[] = + "iip\0" /* Parameter signature */ + "glGetCombinerStageParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_array_object) +static const char BindVertexArray_names[] = + "i\0" /* Parameter signature */ + "glBindVertexArray\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color4ubVertex2fvSUN_names[] = + "pp\0" /* Parameter signature */ + "glColor4ubVertex2fvSUN\0" + ""; +#endif + +#if defined(need_GL_SGIS_texture_filter4) +static const char TexFilterFuncSGIS_names[] = + "iiip\0" /* Parameter signature */ + "glTexFilterFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_SGIS_multisample) || defined(need_GL_EXT_multisample) +static const char SampleMaskSGIS_names[] = + "fi\0" /* Parameter signature */ + "glSampleMaskSGIS\0" + "glSampleMaskEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_shader) +static const char GetAttribLocationARB_names[] = + "ip\0" /* Parameter signature */ + "glGetAttribLocation\0" + "glGetAttribLocationARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4ubvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4ubv\0" + "glVertexAttrib4ubvARB\0" + ""; +#endif + +#if defined(need_GL_SGIS_detail_texture) +static const char DetailTexFuncSGIS_names[] = + "iip\0" /* Parameter signature */ + "glDetailTexFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Normal3fVertex3fSUN_names[] = + "ffffff\0" /* Parameter signature */ + "glNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_EXT_copy_texture) +static const char CopyTexImage2D_names[] = + "iiiiiiii\0" /* Parameter signature */ + "glCopyTexImage2D\0" + "glCopyTexImage2DEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char GetBufferPointervARB_names[] = + "iip\0" /* Parameter signature */ + "glGetBufferPointerv\0" + "glGetBufferPointervARB\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char ProgramEnvParameter4fARB_names[] = + "iiffff\0" /* Parameter signature */ + "glProgramEnvParameter4fARB\0" + "glProgramParameter4fNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform3ivARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform3iv\0" + "glUniform3ivARB\0" + ""; +#endif + +#if defined(need_GL_NV_fence) +static const char GetFenceivNV_names[] = + "iip\0" /* Parameter signature */ + "glGetFenceivNV\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4dvMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos4dvMESA\0" + ""; +#endif + +#if defined(need_GL_EXT_color_subtable) +static const char ColorSubTable_names[] = + "iiiiip\0" /* Parameter signature */ + "glColorSubTable\0" + "glColorSubTableEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4ivARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord4iv\0" + "glMultiTexCoord4ivARB\0" + ""; +#endif + +#if defined(need_GL_EXT_gpu_program_parameters) +static const char ProgramLocalParameters4fvEXT_names[] = + "iiip\0" /* Parameter signature */ + "glProgramLocalParameters4fvEXT\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char GetMapAttribParameterfvNV_names[] = + "iiip\0" /* Parameter signature */ + "glGetMapAttribParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4sARB_names[] = + "iiiii\0" /* Parameter signature */ + "glVertexAttrib4s\0" + "glVertexAttrib4sARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char GetQueryObjectuivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetQueryObjectuiv\0" + "glGetQueryObjectuivARB\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char MapParameterivNV_names[] = + "iip\0" /* Parameter signature */ + "glMapParameterivNV\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char GenRenderbuffersEXT_names[] = + "ip\0" /* Parameter signature */ + "glGenRenderbuffers\0" + "glGenRenderbuffersEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib2dvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib2dv\0" + "glVertexAttrib2dvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char EdgeFlagPointerEXT_names[] = + "iip\0" /* Parameter signature */ + "glEdgeFlagPointerEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs2svNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs2svNV\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightbvARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightbvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib2fvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib2fv\0" + "glVertexAttrib2fvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char GetBufferParameterivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetBufferParameteriv\0" + "glGetBufferParameterivARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const char ListParameteriSGIX_names[] = + "iii\0" /* Parameter signature */ + "glListParameteriSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiColor4fNormal3fVertex3fSUN_names[] = + "iffffffffff\0" /* Parameter signature */ + "glReplacementCodeuiColor4fNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_SGIX_instruments) +static const char InstrumentsBufferSGIX_names[] = + "ip\0" /* Parameter signature */ + "glInstrumentsBufferSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4NivARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4Niv\0" + "glVertexAttrib4NivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char GetAttachedShaders_names[] = + "iipp\0" /* Parameter signature */ + "glGetAttachedShaders\0" + ""; +#endif + +#if defined(need_GL_APPLE_vertex_array_object) +static const char GenVertexArraysAPPLE_names[] = + "ip\0" /* Parameter signature */ + "glGenVertexArraysAPPLE\0" + ""; +#endif + +#if defined(need_GL_EXT_gpu_program_parameters) +static const char ProgramEnvParameters4fvEXT_names[] = + "iiip\0" /* Parameter signature */ + "glProgramEnvParameters4fvEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fColor4fNormal3fVertex3fvSUN_names[] = + "pppp\0" /* Parameter signature */ + "glTexCoord2fColor4fNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2iMESA_names[] = + "ii\0" /* Parameter signature */ + "glWindowPos2i\0" + "glWindowPos2iARB\0" + "glWindowPos2iMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3fvEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3fv\0" + "glSecondaryColor3fvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) +static const char CompressedTexSubImage1DARB_names[] = + "iiiiiip\0" /* Parameter signature */ + "glCompressedTexSubImage1D\0" + "glCompressedTexSubImage1DARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetVertexAttribivNV_names[] = + "iip\0" /* Parameter signature */ + "glGetVertexAttribivNV\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char GetProgramStringARB_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramStringARB\0" + ""; +#endif + +#if defined(need_GL_ATI_envmap_bumpmap) +static const char TexBumpParameterfvATI_names[] = + "ip\0" /* Parameter signature */ + "glTexBumpParameterfvATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char CompileShaderARB_names[] = + "i\0" /* Parameter signature */ + "glCompileShader\0" + "glCompileShaderARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char DeleteShader_names[] = + "i\0" /* Parameter signature */ + "glDeleteShader\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform3fARB_names[] = + "ifff\0" /* Parameter signature */ + "glUniform3f\0" + "glUniform3fARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const char ListParameterfvSGIX_names[] = + "iip\0" /* Parameter signature */ + "glListParameterfvSGIX\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3dvEXT_names[] = + "p\0" /* Parameter signature */ + "glTangent3dvEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetVertexAttribfvNV_names[] = + "iip\0" /* Parameter signature */ + "glGetVertexAttribfvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3sMESA_names[] = + "iii\0" /* Parameter signature */ + "glWindowPos3s\0" + "glWindowPos3sARB\0" + "glWindowPos3sMESA\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib2svNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib2svNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs1fvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs1fvNV\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fVertex3fvSUN_names[] = + "pp\0" /* Parameter signature */ + "glTexCoord2fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4sMESA_names[] = + "iiii\0" /* Parameter signature */ + "glWindowPos4sMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4NuivARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4Nuiv\0" + "glVertexAttrib4NuivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char ClientActiveTextureARB_names[] = + "i\0" /* Parameter signature */ + "glClientActiveTexture\0" + "glClientActiveTextureARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_pixel_texture) +static const char PixelTexGenSGIX_names[] = + "i\0" /* Parameter signature */ + "glPixelTexGenSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const char ReplacementCodeusvSUN_names[] = + "p\0" /* Parameter signature */ + "glReplacementCodeusvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform4fARB_names[] = + "iffff\0" /* Parameter signature */ + "glUniform4f\0" + "glUniform4fARB\0" + ""; +#endif + +#if defined(need_GL_ARB_map_buffer_range) +static const char FlushMappedBufferRange_names[] = + "iii\0" /* Parameter signature */ + "glFlushMappedBufferRange\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char IsProgramNV_names[] = + "i\0" /* Parameter signature */ + "glIsProgramARB\0" + "glIsProgramNV\0" + ""; +#endif + +#if defined(need_GL_APPLE_flush_buffer_range) +static const char FlushMappedBufferRangeAPPLE_names[] = + "iii\0" /* Parameter signature */ + "glFlushMappedBufferRangeAPPLE\0" + ""; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const char ReplacementCodePointerSUN_names[] = + "iip\0" /* Parameter signature */ + "glReplacementCodePointerSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char ProgramEnvParameter4dARB_names[] = + "iidddd\0" /* Parameter signature */ + "glProgramEnvParameter4dARB\0" + "glProgramParameter4dNV\0" + ""; +#endif + +#if defined(need_GL_SGI_color_table) +static const char ColorTableParameterfv_names[] = + "iip\0" /* Parameter signature */ + "glColorTableParameterfv\0" + "glColorTableParameterfvSGI\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightModelfSGIX_names[] = + "if\0" /* Parameter signature */ + "glFragmentLightModelfSGIX\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3bvEXT_names[] = + "p\0" /* Parameter signature */ + "glBinormal3bvEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_texture_object) +static const char IsTexture_names[] = + "i\0" /* Parameter signature */ + "glIsTexture\0" + "glIsTextureEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_weighting) +static const char VertexWeightfvEXT_names[] = + "p\0" /* Parameter signature */ + "glVertexWeightfvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib1dARB_names[] = + "id\0" /* Parameter signature */ + "glVertexAttrib1d\0" + "glVertexAttrib1dARB\0" + ""; +#endif + +#if defined(need_GL_HP_image_transform) +static const char ImageTransformParameterivHP_names[] = + "iip\0" /* Parameter signature */ + "glImageTransformParameterivHP\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char DeleteQueriesARB_names[] = + "ip\0" /* Parameter signature */ + "glDeleteQueries\0" + "glDeleteQueriesARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color4ubVertex2fSUN_names[] = + "iiiiff\0" /* Parameter signature */ + "glColor4ubVertex2fSUN\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentColorMaterialSGIX_names[] = + "ii\0" /* Parameter signature */ + "glFragmentColorMaterialSGIX\0" + ""; +#endif + +#if defined(need_GL_ARB_matrix_palette) +static const char CurrentPaletteMatrixARB_names[] = + "i\0" /* Parameter signature */ + "glCurrentPaletteMatrixARB\0" + ""; +#endif + +#if defined(need_GL_SGIS_multisample) || defined(need_GL_EXT_multisample) +static const char SamplePatternSGIS_names[] = + "i\0" /* Parameter signature */ + "glSamplePatternSGIS\0" + "glSamplePatternEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char IsQueryARB_names[] = + "i\0" /* Parameter signature */ + "glIsQuery\0" + "glIsQueryARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiColor4ubVertex3fSUN_names[] = + "iiiiifff\0" /* Parameter signature */ + "glReplacementCodeuiColor4ubVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4usvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4usv\0" + "glVertexAttrib4usvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char LinkProgramARB_names[] = + "i\0" /* Parameter signature */ + "glLinkProgram\0" + "glLinkProgramARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib2fNV_names[] = + "iff\0" /* Parameter signature */ + "glVertexAttrib2fNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char ShaderSourceARB_names[] = + "iipp\0" /* Parameter signature */ + "glShaderSource\0" + "glShaderSourceARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentMaterialiSGIX_names[] = + "iii\0" /* Parameter signature */ + "glFragmentMaterialiSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib3svARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib3sv\0" + "glVertexAttrib3svARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) +static const char CompressedTexSubImage3DARB_names[] = + "iiiiiiiiiip\0" /* Parameter signature */ + "glCompressedTexSubImage3D\0" + "glCompressedTexSubImage3DARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2ivMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos2iv\0" + "glWindowPos2ivARB\0" + "glWindowPos2ivMESA\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char IsFramebufferEXT_names[] = + "i\0" /* Parameter signature */ + "glIsFramebuffer\0" + "glIsFramebufferEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform4ivARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform4iv\0" + "glUniform4ivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char GetVertexAttribdvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetVertexAttribdv\0" + "glGetVertexAttribdvARB\0" + ""; +#endif + +#if defined(need_GL_ATI_envmap_bumpmap) +static const char TexBumpParameterivATI_names[] = + "ip\0" /* Parameter signature */ + "glTexBumpParameterivATI\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char GetSeparableFilter_names[] = + "iiippp\0" /* Parameter signature */ + "glGetSeparableFilter\0" + "glGetSeparableFilterEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3dEXT_names[] = + "ddd\0" /* Parameter signature */ + "glBinormal3dEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_sprite) +static const char SpriteParameteriSGIX_names[] = + "ii\0" /* Parameter signature */ + "glSpriteParameteriSGIX\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char RequestResidentProgramsNV_names[] = + "ip\0" /* Parameter signature */ + "glRequestResidentProgramsNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_tag_sample_buffer) +static const char TagSampleBufferSGIX_names[] = + "\0" /* Parameter signature */ + "glTagSampleBufferSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const char ReplacementCodeusSUN_names[] = + "i\0" /* Parameter signature */ + "glReplacementCodeusSUN\0" + ""; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const char ListParameterivSGIX_names[] = + "iip\0" /* Parameter signature */ + "glListParameterivSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_multi_draw_arrays) +static const char MultiDrawElementsEXT_names[] = + "ipipi\0" /* Parameter signature */ + "glMultiDrawElements\0" + "glMultiDrawElementsEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform1ivARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform1iv\0" + "glUniform1ivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2sMESA_names[] = + "ii\0" /* Parameter signature */ + "glWindowPos2s\0" + "glWindowPos2sARB\0" + "glWindowPos2sMESA\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightusvARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightusvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) +static const char FogCoordPointerEXT_names[] = + "iip\0" /* Parameter signature */ + "glFogCoordPointer\0" + "glFogCoordPointerEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_index_material) +static const char IndexMaterialEXT_names[] = + "ii\0" /* Parameter signature */ + "glIndexMaterialEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3ubvEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3ubv\0" + "glSecondaryColor3ubvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4dvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4dv\0" + "glVertexAttrib4dvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_shader) +static const char BindAttribLocationARB_names[] = + "iip\0" /* Parameter signature */ + "glBindAttribLocation\0" + "glBindAttribLocationARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2dARB_names[] = + "idd\0" /* Parameter signature */ + "glMultiTexCoord2d\0" + "glMultiTexCoord2dARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char ExecuteProgramNV_names[] = + "iip\0" /* Parameter signature */ + "glExecuteProgramNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char LightEnviSGIX_names[] = + "ii\0" /* Parameter signature */ + "glLightEnviSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const char ReplacementCodeuiSUN_names[] = + "i\0" /* Parameter signature */ + "glReplacementCodeuiSUN\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribPointerNV_names[] = + "iiiip\0" /* Parameter signature */ + "glVertexAttribPointerNV\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char GetFramebufferAttachmentParameterivEXT_names[] = + "iiip\0" /* Parameter signature */ + "glGetFramebufferAttachmentParameteriv\0" + "glGetFramebufferAttachmentParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_pixel_transform) +static const char PixelTransformParameterfEXT_names[] = + "iif\0" /* Parameter signature */ + "glPixelTransformParameterfEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4dvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord4dv\0" + "glMultiTexCoord4dvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_pixel_transform) +static const char PixelTransformParameteriEXT_names[] = + "iii\0" /* Parameter signature */ + "glPixelTransformParameteriEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fColor4ubVertex3fSUN_names[] = + "ffiiiifff\0" /* Parameter signature */ + "glTexCoord2fColor4ubVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform1iARB_names[] = + "ii\0" /* Parameter signature */ + "glUniform1i\0" + "glUniform1iARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttribPointerARB_names[] = + "iiiiip\0" /* Parameter signature */ + "glVertexAttribPointer\0" + "glVertexAttribPointerARB\0" + ""; +#endif + +#if defined(need_GL_SGIS_sharpen_texture) +static const char SharpenTexFuncSGIS_names[] = + "iip\0" /* Parameter signature */ + "glSharpenTexFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4fvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord4fv\0" + "glMultiTexCoord4fvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_1) +static const char UniformMatrix2x3fv_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix2x3fv\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char TrackMatrixNV_names[] = + "iiii\0" /* Parameter signature */ + "glTrackMatrixNV\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char CombinerParameteriNV_names[] = + "ii\0" /* Parameter signature */ + "glCombinerParameteriNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_async) +static const char DeleteAsyncMarkersSGIX_names[] = + "ii\0" /* Parameter signature */ + "glDeleteAsyncMarkersSGIX\0" + ""; +#endif + +#if defined(need_GL_SGIX_async) +static const char IsAsyncMarkerSGIX_names[] = + "i\0" /* Parameter signature */ + "glIsAsyncMarkerSGIX\0" + ""; +#endif + +#if defined(need_GL_SGIX_framezoom) +static const char FrameZoomSGIX_names[] = + "i\0" /* Parameter signature */ + "glFrameZoomSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Normal3fVertex3fvSUN_names[] = + "pp\0" /* Parameter signature */ + "glNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4NsvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4Nsv\0" + "glVertexAttrib4NsvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib3fvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib3fv\0" + "glVertexAttrib3fvARB\0" + ""; +#endif + +#if defined(need_GL_ARB_sync) +static const char GetSynciv_names[] = + "iiipp\0" /* Parameter signature */ + "glGetSynciv\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char DeleteFramebuffersEXT_names[] = + "ip\0" /* Parameter signature */ + "glDeleteFramebuffers\0" + "glDeleteFramebuffersEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactorsSUN_names[] = + "i\0" /* Parameter signature */ + "glGlobalAlphaFactorsSUN\0" + ""; +#endif + +#if defined(need_GL_EXT_texture3D) +static const char TexSubImage3D_names[] = + "iiiiiiiiiip\0" /* Parameter signature */ + "glTexSubImage3D\0" + "glTexSubImage3DEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3fEXT_names[] = + "fff\0" /* Parameter signature */ + "glTangent3fEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3uivEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3uiv\0" + "glSecondaryColor3uivEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_matrix_palette) +static const char MatrixIndexubvARB_names[] = + "ip\0" /* Parameter signature */ + "glMatrixIndexubvARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color4fNormal3fVertex3fSUN_names[] = + "ffffffffff\0" /* Parameter signature */ + "glColor4fNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +static const char PixelTexGenParameterfSGIS_names[] = + "if\0" /* Parameter signature */ + "glPixelTexGenParameterfSGIS\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char CreateShader_names[] = + "i\0" /* Parameter signature */ + "glCreateShader\0" + ""; +#endif + +#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture) +static const char GetColorTableParameterfv_names[] = + "iip\0" /* Parameter signature */ + "glGetColorTableParameterfv\0" + "glGetColorTableParameterfvSGI\0" + "glGetColorTableParameterfvEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightModelfvSGIX_names[] = + "ip\0" /* Parameter signature */ + "glFragmentLightModelfvSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3fARB_names[] = + "ifff\0" /* Parameter signature */ + "glMultiTexCoord3f\0" + "glMultiTexCoord3fARB\0" + ""; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +static const char GetPixelTexGenParameterfvSGIS_names[] = + "ip\0" /* Parameter signature */ + "glGetPixelTexGenParameterfvSGIS\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char GenFramebuffersEXT_names[] = + "ip\0" /* Parameter signature */ + "glGenFramebuffers\0" + "glGenFramebuffersEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetProgramParameterdvNV_names[] = + "iiip\0" /* Parameter signature */ + "glGetProgramParameterdvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_array_object) || defined(need_GL_APPLE_vertex_array_object) +static const char IsVertexArrayAPPLE_names[] = + "i\0" /* Parameter signature */ + "glIsVertexArray\0" + "glIsVertexArrayAPPLE\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightfvSGIX_names[] = + "iip\0" /* Parameter signature */ + "glFragmentLightfvSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char DetachShader_names[] = + "ii\0" /* Parameter signature */ + "glDetachShader\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4NubARB_names[] = + "iiiii\0" /* Parameter signature */ + "glVertexAttrib4Nub\0" + "glVertexAttrib4NubARB\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char GetProgramEnvParameterfvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramEnvParameterfvARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetTrackMatrixivNV_names[] = + "iiip\0" /* Parameter signature */ + "glGetTrackMatrixivNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib3svNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib3svNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform4fvARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform4fv\0" + "glUniform4fvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix) +static const char MultTransposeMatrixfARB_names[] = + "p\0" /* Parameter signature */ + "glMultTransposeMatrixf\0" + "glMultTransposeMatrixfARB\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char ColorFragmentOp1ATI_names[] = + "iiiiiii\0" /* Parameter signature */ + "glColorFragmentOp1ATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char GetUniformfvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetUniformfv\0" + "glGetUniformfvARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_names[] = + "iffffffffffff\0" /* Parameter signature */ + "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char DetachObjectARB_names[] = + "ii\0" /* Parameter signature */ + "glDetachObjectARB\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char VertexBlendARB_names[] = + "i\0" /* Parameter signature */ + "glVertexBlendARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3iMESA_names[] = + "iii\0" /* Parameter signature */ + "glWindowPos3i\0" + "glWindowPos3iARB\0" + "glWindowPos3iMESA\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char SeparableFilter2D_names[] = + "iiiiiipp\0" /* Parameter signature */ + "glSeparableFilter2D\0" + "glSeparableFilter2DEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiColor4ubVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glReplacementCodeuiColor4ubVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) +static const char CompressedTexImage2DARB_names[] = + "iiiiiiip\0" /* Parameter signature */ + "glCompressedTexImage2D\0" + "glCompressedTexImage2DARB\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char ArrayElement_names[] = + "i\0" /* Parameter signature */ + "glArrayElement\0" + "glArrayElementEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_depth_bounds_test) +static const char DepthBoundsEXT_names[] = + "dd\0" /* Parameter signature */ + "glDepthBoundsEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char ProgramParameters4fvNV_names[] = + "iiip\0" /* Parameter signature */ + "glProgramParameters4fvNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_polynomial_ffd) +static const char DeformationMap3fSGIX_names[] = + "iffiiffiiffiip\0" /* Parameter signature */ + "glDeformationMap3fSGIX\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetProgramivNV_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramivNV\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char GetMinmaxParameteriv_names[] = + "iip\0" /* Parameter signature */ + "glGetMinmaxParameteriv\0" + "glGetMinmaxParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_copy_texture) +static const char CopyTexImage1D_names[] = + "iiiiiii\0" /* Parameter signature */ + "glCopyTexImage1D\0" + "glCopyTexImage1DEXT\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char AlphaFragmentOp3ATI_names[] = + "iiiiiiiiiiii\0" /* Parameter signature */ + "glAlphaFragmentOp3ATI\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetVertexAttribdvNV_names[] = + "iip\0" /* Parameter signature */ + "glGetVertexAttribdvNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib3fvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib3fvNV\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char GetFinalCombinerInputParameterivNV_names[] = + "iip\0" /* Parameter signature */ + "glGetFinalCombinerInputParameterivNV\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char GetMapParameterivNV_names[] = + "iip\0" /* Parameter signature */ + "glGetMapParameterivNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform4iARB_names[] = + "iiiii\0" /* Parameter signature */ + "glUniform4i\0" + "glUniform4iARB\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char ConvolutionParameteri_names[] = + "iii\0" /* Parameter signature */ + "glConvolutionParameteri\0" + "glConvolutionParameteriEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3sEXT_names[] = + "iii\0" /* Parameter signature */ + "glBinormal3sEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char ConvolutionParameterf_names[] = + "iif\0" /* Parameter signature */ + "glConvolutionParameterf\0" + "glConvolutionParameterfEXT\0" + ""; +#endif + +#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture) +static const char GetColorTableParameteriv_names[] = + "iip\0" /* Parameter signature */ + "glGetColorTableParameteriv\0" + "glGetColorTableParameterivSGI\0" + "glGetColorTableParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char ProgramEnvParameter4dvARB_names[] = + "iip\0" /* Parameter signature */ + "glProgramEnvParameter4dvARB\0" + "glProgramParameter4dvNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs2fvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs2fvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char UseProgramObjectARB_names[] = + "i\0" /* Parameter signature */ + "glUseProgram\0" + "glUseProgramObjectARB\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char GetMapParameterfvNV_names[] = + "iip\0" /* Parameter signature */ + "glGetMapParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char PassTexCoordATI_names[] = + "iii\0" /* Parameter signature */ + "glPassTexCoordATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char DeleteProgram_names[] = + "i\0" /* Parameter signature */ + "glDeleteProgram\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3ivEXT_names[] = + "p\0" /* Parameter signature */ + "glTangent3ivEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3dEXT_names[] = + "ddd\0" /* Parameter signature */ + "glTangent3dEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3dvEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3dv\0" + "glSecondaryColor3dvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_multi_draw_arrays) +static const char MultiDrawArraysEXT_names[] = + "ippi\0" /* Parameter signature */ + "glMultiDrawArrays\0" + "glMultiDrawArraysEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char BindRenderbufferEXT_names[] = + "ii\0" /* Parameter signature */ + "glBindRenderbuffer\0" + "glBindRenderbufferEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4dARB_names[] = + "idddd\0" /* Parameter signature */ + "glMultiTexCoord4d\0" + "glMultiTexCoord4dARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3usEXT_names[] = + "iii\0" /* Parameter signature */ + "glSecondaryColor3us\0" + "glSecondaryColor3usEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char ProgramLocalParameter4fvARB_names[] = + "iip\0" /* Parameter signature */ + "glProgramLocalParameter4fvARB\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char DeleteProgramsNV_names[] = + "ip\0" /* Parameter signature */ + "glDeleteProgramsARB\0" + "glDeleteProgramsNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1sARB_names[] = + "ii\0" /* Parameter signature */ + "glMultiTexCoord1s\0" + "glMultiTexCoord1sARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiColor3fVertex3fSUN_names[] = + "iffffff\0" /* Parameter signature */ + "glReplacementCodeuiColor3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char GetVertexAttribPointervNV_names[] = + "iip\0" /* Parameter signature */ + "glGetVertexAttribPointerv\0" + "glGetVertexAttribPointervARB\0" + "glGetVertexAttribPointervNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1dvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord1dv\0" + "glMultiTexCoord1dvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform2iARB_names[] = + "iii\0" /* Parameter signature */ + "glUniform2i\0" + "glUniform2iARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetProgramStringNV_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramStringNV\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char ColorPointerEXT_names[] = + "iiiip\0" /* Parameter signature */ + "glColorPointerEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char MapBufferARB_names[] = + "ii\0" /* Parameter signature */ + "glMapBuffer\0" + "glMapBufferARB\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3svEXT_names[] = + "p\0" /* Parameter signature */ + "glBinormal3svEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_light_texture) +static const char ApplyTextureEXT_names[] = + "i\0" /* Parameter signature */ + "glApplyTextureEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_light_texture) +static const char TextureMaterialEXT_names[] = + "ii\0" /* Parameter signature */ + "glTextureMaterialEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_light_texture) +static const char TextureLightEXT_names[] = + "i\0" /* Parameter signature */ + "glTextureLightEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char ResetMinmax_names[] = + "i\0" /* Parameter signature */ + "glResetMinmax\0" + "glResetMinmaxEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_sprite) +static const char SpriteParameterfSGIX_names[] = + "if\0" /* Parameter signature */ + "glSpriteParameterfSGIX\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4sNV_names[] = + "iiiii\0" /* Parameter signature */ + "glVertexAttrib4sNV\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char GetConvolutionParameterfv_names[] = + "iip\0" /* Parameter signature */ + "glGetConvolutionParameterfv\0" + "glGetConvolutionParameterfvEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs4dvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs4dvNV\0" + ""; +#endif + +#if defined(need_GL_IBM_multimode_draw_arrays) +static const char MultiModeDrawArraysIBM_names[] = + "pppii\0" /* Parameter signature */ + "glMultiModeDrawArraysIBM\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4dARB_names[] = + "idddd\0" /* Parameter signature */ + "glVertexAttrib4d\0" + "glVertexAttrib4dARB\0" + ""; +#endif + +#if defined(need_GL_ATI_envmap_bumpmap) +static const char GetTexBumpParameterfvATI_names[] = + "ip\0" /* Parameter signature */ + "glGetTexBumpParameterfvATI\0" + ""; +#endif + +#if defined(need_GL_NV_fragment_program) +static const char ProgramNamedParameter4dNV_names[] = + "iipdddd\0" /* Parameter signature */ + "glProgramNamedParameter4dNV\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_weighting) +static const char VertexWeightfEXT_names[] = + "f\0" /* Parameter signature */ + "glVertexWeightfEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3fEXT_names[] = + "fff\0" /* Parameter signature */ + "glBinormal3fEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) +static const char FogCoordfvEXT_names[] = + "p\0" /* Parameter signature */ + "glFogCoordfv\0" + "glFogCoordfvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1ivARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord1iv\0" + "glMultiTexCoord1ivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3ubEXT_names[] = + "iii\0" /* Parameter signature */ + "glSecondaryColor3ub\0" + "glSecondaryColor3ubEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2ivARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord2iv\0" + "glMultiTexCoord2ivARB\0" + ""; +#endif + +#if defined(need_GL_SGIS_fog_function) +static const char FogFuncSGIS_names[] = + "ip\0" /* Parameter signature */ + "glFogFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_EXT_copy_texture) +static const char CopyTexSubImage2D_names[] = + "iiiiiiii\0" /* Parameter signature */ + "glCopyTexSubImage2D\0" + "glCopyTexSubImage2DEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char GetObjectParameterivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetObjectParameterivARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord4fVertex4fSUN_names[] = + "ffffffff\0" /* Parameter signature */ + "glTexCoord4fVertex4fSUN\0" + ""; +#endif + +#if defined(need_GL_APPLE_vertex_array_object) +static const char BindVertexArrayAPPLE_names[] = + "i\0" /* Parameter signature */ + "glBindVertexArrayAPPLE\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char GetProgramLocalParameterdvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramLocalParameterdvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char GetHistogramParameteriv_names[] = + "iip\0" /* Parameter signature */ + "glGetHistogramParameteriv\0" + "glGetHistogramParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1iARB_names[] = + "ii\0" /* Parameter signature */ + "glMultiTexCoord1i\0" + "glMultiTexCoord1iARB\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char GetConvolutionFilter_names[] = + "iiip\0" /* Parameter signature */ + "glGetConvolutionFilter\0" + "glGetConvolutionFilterEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char GetProgramivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_blend_func_separate) || defined(need_GL_INGR_blend_func_separate) +static const char BlendFuncSeparateEXT_names[] = + "iiii\0" /* Parameter signature */ + "glBlendFuncSeparate\0" + "glBlendFuncSeparateEXT\0" + "glBlendFuncSeparateINGR\0" + ""; +#endif + +#if defined(need_GL_ARB_map_buffer_range) +static const char MapBufferRange_names[] = + "iiii\0" /* Parameter signature */ + "glMapBufferRange\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char ProgramParameters4dvNV_names[] = + "iiip\0" /* Parameter signature */ + "glProgramParameters4dvNV\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fColor3fVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glTexCoord2fColor3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3dvEXT_names[] = + "p\0" /* Parameter signature */ + "glBinormal3dvEXT\0" + ""; +#endif + +#if defined(need_GL_NV_fence) +static const char FinishFenceNV_names[] = + "i\0" /* Parameter signature */ + "glFinishFenceNV\0" + ""; +#endif + +#if defined(need_GL_SGIS_fog_function) +static const char GetFogFuncSGIS_names[] = + "p\0" /* Parameter signature */ + "glGetFogFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char GetUniformLocationARB_names[] = + "ip\0" /* Parameter signature */ + "glGetUniformLocation\0" + "glGetUniformLocationARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3fEXT_names[] = + "fff\0" /* Parameter signature */ + "glSecondaryColor3f\0" + "glSecondaryColor3fEXT\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char CombinerInputNV_names[] = + "iiiiii\0" /* Parameter signature */ + "glCombinerInputNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib3sARB_names[] = + "iiii\0" /* Parameter signature */ + "glVertexAttrib3s\0" + "glVertexAttrib3sARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiNormal3fVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glReplacementCodeuiNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char ProgramStringARB_names[] = + "iiip\0" /* Parameter signature */ + "glProgramStringARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord4fVertex4fvSUN_names[] = + "pp\0" /* Parameter signature */ + "glTexCoord4fVertex4fvSUN\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib3sNV_names[] = + "iiii\0" /* Parameter signature */ + "glVertexAttrib3sNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib1fNV_names[] = + "if\0" /* Parameter signature */ + "glVertexAttrib1fNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightfSGIX_names[] = + "iif\0" /* Parameter signature */ + "glFragmentLightfSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) +static const char GetCompressedTexImageARB_names[] = + "iip\0" /* Parameter signature */ + "glGetCompressedTexImage\0" + "glGetCompressedTexImageARB\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_weighting) +static const char VertexWeightPointerEXT_names[] = + "iiip\0" /* Parameter signature */ + "glVertexWeightPointerEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char GetHistogram_names[] = + "iiiip\0" /* Parameter signature */ + "glGetHistogram\0" + "glGetHistogramEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_stencil_two_side) +static const char ActiveStencilFaceEXT_names[] = + "i\0" /* Parameter signature */ + "glActiveStencilFaceEXT\0" + ""; +#endif + +#if defined(need_GL_ATI_separate_stencil) +static const char StencilFuncSeparateATI_names[] = + "iiii\0" /* Parameter signature */ + "glStencilFuncSeparateATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char GetShaderSourceARB_names[] = + "iipp\0" /* Parameter signature */ + "glGetShaderSource\0" + "glGetShaderSourceARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_igloo_interface) +static const char IglooInterfaceSGIX_names[] = + "ip\0" /* Parameter signature */ + "glIglooInterfaceSGIX\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4dNV_names[] = + "idddd\0" /* Parameter signature */ + "glVertexAttrib4dNV\0" + ""; +#endif + +#if defined(need_GL_IBM_multimode_draw_arrays) +static const char MultiModeDrawElementsIBM_names[] = + "ppipii\0" /* Parameter signature */ + "glMultiModeDrawElementsIBM\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4svARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord4sv\0" + "glMultiTexCoord4svARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char GenQueriesARB_names[] = + "ip\0" /* Parameter signature */ + "glGenQueries\0" + "glGenQueriesARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiVertex3fSUN_names[] = + "ifff\0" /* Parameter signature */ + "glReplacementCodeuiVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3iEXT_names[] = + "iii\0" /* Parameter signature */ + "glTangent3iEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_mesh_array) +static const char DrawMeshArraysSUN_names[] = + "iiii\0" /* Parameter signature */ + "glDrawMeshArraysSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_sync) +static const char IsSync_names[] = + "i\0" /* Parameter signature */ + "glIsSync\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char GetMapControlPointsNV_names[] = + "iiiiiip\0" /* Parameter signature */ + "glGetMapControlPointsNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_draw_buffers) || defined(need_GL_ATI_draw_buffers) +static const char DrawBuffersARB_names[] = + "ip\0" /* Parameter signature */ + "glDrawBuffers\0" + "glDrawBuffersARB\0" + "glDrawBuffersATI\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char ProgramLocalParameter4fARB_names[] = + "iiffff\0" /* Parameter signature */ + "glProgramLocalParameter4fARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_sprite) +static const char SpriteParameterivSGIX_names[] = + "ip\0" /* Parameter signature */ + "glSpriteParameterivSGIX\0" + ""; +#endif + +#if defined(need_GL_EXT_provoking_vertex) +static const char ProvokingVertexEXT_names[] = + "i\0" /* Parameter signature */ + "glProvokingVertexEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1fARB_names[] = + "if\0" /* Parameter signature */ + "glMultiTexCoord1f\0" + "glMultiTexCoord1fARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs4ubvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs4ubvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightsvARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightsvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform1fvARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform1fv\0" + "glUniform1fvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_copy_texture) +static const char CopyTexSubImage1D_names[] = + "iiiiii\0" /* Parameter signature */ + "glCopyTexSubImage1D\0" + "glCopyTexSubImage1DEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_texture_object) +static const char BindTexture_names[] = + "ii\0" /* Parameter signature */ + "glBindTexture\0" + "glBindTextureEXT\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char BeginFragmentShaderATI_names[] = + "\0" /* Parameter signature */ + "glBeginFragmentShaderATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4fARB_names[] = + "iffff\0" /* Parameter signature */ + "glMultiTexCoord4f\0" + "glMultiTexCoord4fARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs3svNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs3svNV\0" + ""; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const char ReplacementCodeuivSUN_names[] = + "p\0" /* Parameter signature */ + "glReplacementCodeuivSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char EnableVertexAttribArrayARB_names[] = + "i\0" /* Parameter signature */ + "glEnableVertexAttribArray\0" + "glEnableVertexAttribArrayARB\0" + ""; +#endif + +#if defined(need_GL_INTEL_parallel_arrays) +static const char NormalPointervINTEL_names[] = + "ip\0" /* Parameter signature */ + "glNormalPointervINTEL\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char CopyConvolutionFilter2D_names[] = + "iiiiii\0" /* Parameter signature */ + "glCopyConvolutionFilter2D\0" + "glCopyConvolutionFilter2DEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3ivMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos3iv\0" + "glWindowPos3ivARB\0" + "glWindowPos3ivMESA\0" + ""; +#endif + +#if defined(need_GL_ARB_copy_buffer) +static const char CopyBufferSubData_names[] = + "iiiii\0" /* Parameter signature */ + "glCopyBufferSubData\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char IsBufferARB_names[] = + "i\0" /* Parameter signature */ + "glIsBuffer\0" + "glIsBufferARB\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4iMESA_names[] = + "iiii\0" /* Parameter signature */ + "glWindowPos4iMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4uivARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4uiv\0" + "glVertexAttrib4uivARB\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3bvEXT_names[] = + "p\0" /* Parameter signature */ + "glTangent3bvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_1) +static const char UniformMatrix3x4fv_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix3x4fv\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3fvEXT_names[] = + "p\0" /* Parameter signature */ + "glBinormal3fvEXT\0" + ""; +#endif + +#if defined(need_GL_INTEL_parallel_arrays) +static const char TexCoordPointervINTEL_names[] = + "iip\0" /* Parameter signature */ + "glTexCoordPointervINTEL\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char DeleteBuffersARB_names[] = + "ip\0" /* Parameter signature */ + "glDeleteBuffers\0" + "glDeleteBuffersARB\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4fvMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos4fvMESA\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib1sNV_names[] = + "ii\0" /* Parameter signature */ + "glVertexAttrib1sNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3svEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3sv\0" + "glSecondaryColor3svEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix) +static const char LoadTransposeMatrixfARB_names[] = + "p\0" /* Parameter signature */ + "glLoadTransposeMatrixf\0" + "glLoadTransposeMatrixfARB\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char GetPointerv_names[] = + "ip\0" /* Parameter signature */ + "glGetPointerv\0" + "glGetPointervEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3bEXT_names[] = + "iii\0" /* Parameter signature */ + "glTangent3bEXT\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char CombinerParameterfNV_names[] = + "if\0" /* Parameter signature */ + "glCombinerParameterfNV\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char BindProgramNV_names[] = + "ii\0" /* Parameter signature */ + "glBindProgramARB\0" + "glBindProgramNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4svARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4sv\0" + "glVertexAttrib4svARB\0" + ""; +#endif + +#if defined(need_GL_MESA_shader_debug) +static const char CreateDebugObjectMESA_names[] = + "\0" /* Parameter signature */ + "glCreateDebugObjectMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char GetShaderiv_names[] = + "iip\0" /* Parameter signature */ + "glGetShaderiv\0" + ""; +#endif + +#if defined(need_GL_ARB_sync) +static const char ClientWaitSync_names[] = + "iii\0" /* Parameter signature */ + "glClientWaitSync\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char BindFragmentShaderATI_names[] = + "i\0" /* Parameter signature */ + "glBindFragmentShaderATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char UnmapBufferARB_names[] = + "i\0" /* Parameter signature */ + "glUnmapBuffer\0" + "glUnmapBufferARB\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char Minmax_names[] = + "iii\0" /* Parameter signature */ + "glMinmax\0" + "glMinmaxEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) +static const char FogCoorddvEXT_names[] = + "p\0" /* Parameter signature */ + "glFogCoorddv\0" + "glFogCoorddvEXT\0" + ""; +#endif + +#if defined(need_GL_SUNX_constant_data) +static const char FinishTextureSUNX_names[] = + "\0" /* Parameter signature */ + "glFinishTextureSUNX\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char GetFragmentLightfvSGIX_names[] = + "iip\0" /* Parameter signature */ + "glGetFragmentLightfvSGIX\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char GetFinalCombinerInputParameterfvNV_names[] = + "iip\0" /* Parameter signature */ + "glGetFinalCombinerInputParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char ColorFragmentOp3ATI_names[] = + "iiiiiiiiiiiii\0" /* Parameter signature */ + "glColorFragmentOp3ATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib2svARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib2sv\0" + "glVertexAttrib2svARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char AreProgramsResidentNV_names[] = + "ipp\0" /* Parameter signature */ + "glAreProgramsResidentNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3svMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos3sv\0" + "glWindowPos3svARB\0" + "glWindowPos3svMESA\0" + ""; +#endif + +#if defined(need_GL_EXT_color_subtable) +static const char CopyColorSubTable_names[] = + "iiiii\0" /* Parameter signature */ + "glCopyColorSubTable\0" + "glCopyColorSubTableEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightdvARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightdvARB\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char DeleteRenderbuffersEXT_names[] = + "ip\0" /* Parameter signature */ + "glDeleteRenderbuffers\0" + "glDeleteRenderbuffersEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4NubvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4Nubv\0" + "glVertexAttrib4NubvARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib3dvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib3dvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char GetObjectParameterfvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetObjectParameterfvARB\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char GetProgramEnvParameterdvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramEnvParameterdvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_compiled_vertex_array) +static const char LockArraysEXT_names[] = + "ii\0" /* Parameter signature */ + "glLockArraysEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_pixel_transform) +static const char PixelTransformParameterivEXT_names[] = + "iip\0" /* Parameter signature */ + "glPixelTransformParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char BinormalPointerEXT_names[] = + "iip\0" /* Parameter signature */ + "glBinormalPointerEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib1dNV_names[] = + "id\0" /* Parameter signature */ + "glVertexAttrib1dNV\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char GetCombinerInputParameterivNV_names[] = + "iiiip\0" /* Parameter signature */ + "glGetCombinerInputParameterivNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2fvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord2fv\0" + "glMultiTexCoord2fvARB\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char GetRenderbufferParameterivEXT_names[] = + "iip\0" /* Parameter signature */ + "glGetRenderbufferParameteriv\0" + "glGetRenderbufferParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char CombinerParameterivNV_names[] = + "ip\0" /* Parameter signature */ + "glCombinerParameterivNV\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char GenFragmentShadersATI_names[] = + "i\0" /* Parameter signature */ + "glGenFragmentShadersATI\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char DrawArrays_names[] = + "iii\0" /* Parameter signature */ + "glDrawArrays\0" + "glDrawArraysEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightuivARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightuivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib2sARB_names[] = + "iii\0" /* Parameter signature */ + "glVertexAttrib2s\0" + "glVertexAttrib2sARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_async) +static const char GenAsyncMarkersSGIX_names[] = + "i\0" /* Parameter signature */ + "glGenAsyncMarkersSGIX\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3svEXT_names[] = + "p\0" /* Parameter signature */ + "glTangent3svEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const char GetListParameterivSGIX_names[] = + "iip\0" /* Parameter signature */ + "glGetListParameterivSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char BindBufferARB_names[] = + "ii\0" /* Parameter signature */ + "glBindBuffer\0" + "glBindBufferARB\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char GetInfoLogARB_names[] = + "iipp\0" /* Parameter signature */ + "glGetInfoLogARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs4svNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs4svNV\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char EdgeFlagPointerListIBM_names[] = + "ipi\0" /* Parameter signature */ + "glEdgeFlagPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_1) +static const char UniformMatrix3x2fv_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix3x2fv\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char GetMinmaxParameterfv_names[] = + "iip\0" /* Parameter signature */ + "glGetMinmaxParameterfv\0" + "glGetMinmaxParameterfvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib1fvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib1fv\0" + "glVertexAttrib1fvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char GenBuffersARB_names[] = + "ip\0" /* Parameter signature */ + "glGenBuffers\0" + "glGenBuffersARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs1svNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs1svNV\0" + ""; +#endif + +#if defined(need_GL_ATI_envmap_bumpmap) +static const char GetTexBumpParameterivATI_names[] = + "ip\0" /* Parameter signature */ + "glGetTexBumpParameterivATI\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3bEXT_names[] = + "iii\0" /* Parameter signature */ + "glBinormal3bEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentMaterialivSGIX_names[] = + "iip\0" /* Parameter signature */ + "glFragmentMaterialivSGIX\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char IsRenderbufferEXT_names[] = + "i\0" /* Parameter signature */ + "glIsRenderbuffer\0" + "glIsRenderbufferEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char GenProgramsNV_names[] = + "ip\0" /* Parameter signature */ + "glGenProgramsARB\0" + "glGenProgramsNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4dvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4dvNV\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char EndFragmentShaderATI_names[] = + "\0" /* Parameter signature */ + "glEndFragmentShaderATI\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3iEXT_names[] = + "iii\0" /* Parameter signature */ + "glBinormal3iEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2fMESA_names[] = + "ff\0" /* Parameter signature */ + "glWindowPos2f\0" + "glWindowPos2fARB\0" + "glWindowPos2fMESA\0" + ""; +#endif + +#if defined(need_GL_3DFX_tbuffer) +static const struct dri_extension_function GL_3DFX_tbuffer_functions[] = { + { TbufferMask3DFX_names, TbufferMask3DFX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_APPLE_flush_buffer_range) +static const struct dri_extension_function GL_APPLE_flush_buffer_range_functions[] = { + { BufferParameteriAPPLE_names, BufferParameteriAPPLE_remap_index, -1 }, + { FlushMappedBufferRangeAPPLE_names, FlushMappedBufferRangeAPPLE_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_APPLE_texture_range) +static const struct dri_extension_function GL_APPLE_texture_range_functions[] = { + { TextureRangeAPPLE_names, TextureRangeAPPLE_remap_index, -1 }, + { GetTexParameterPointervAPPLE_names, GetTexParameterPointervAPPLE_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_APPLE_vertex_array_object) +static const struct dri_extension_function GL_APPLE_vertex_array_object_functions[] = { + { DeleteVertexArraysAPPLE_names, DeleteVertexArraysAPPLE_remap_index, -1 }, + { GenVertexArraysAPPLE_names, GenVertexArraysAPPLE_remap_index, -1 }, + { IsVertexArrayAPPLE_names, IsVertexArrayAPPLE_remap_index, -1 }, + { BindVertexArrayAPPLE_names, BindVertexArrayAPPLE_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_copy_buffer) +static const struct dri_extension_function GL_ARB_copy_buffer_functions[] = { + { CopyBufferSubData_names, CopyBufferSubData_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_draw_buffers) +static const struct dri_extension_function GL_ARB_draw_buffers_functions[] = { + { DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_framebuffer_object) +static const struct dri_extension_function GL_ARB_framebuffer_object_functions[] = { + { BlitFramebufferEXT_names, BlitFramebufferEXT_remap_index, -1 }, + { FramebufferTextureLayerEXT_names, FramebufferTextureLayerEXT_remap_index, -1 }, + { GenerateMipmapEXT_names, GenerateMipmapEXT_remap_index, -1 }, + { RenderbufferStorageEXT_names, RenderbufferStorageEXT_remap_index, -1 }, + { CheckFramebufferStatusEXT_names, CheckFramebufferStatusEXT_remap_index, -1 }, + { FramebufferTexture3DEXT_names, FramebufferTexture3DEXT_remap_index, -1 }, + { FramebufferTexture2DEXT_names, FramebufferTexture2DEXT_remap_index, -1 }, + { RenderbufferStorageMultisample_names, RenderbufferStorageMultisample_remap_index, -1 }, + { FramebufferRenderbufferEXT_names, FramebufferRenderbufferEXT_remap_index, -1 }, + { FramebufferTexture1DEXT_names, FramebufferTexture1DEXT_remap_index, -1 }, + { BindFramebufferEXT_names, BindFramebufferEXT_remap_index, -1 }, + { GenRenderbuffersEXT_names, GenRenderbuffersEXT_remap_index, -1 }, + { IsFramebufferEXT_names, IsFramebufferEXT_remap_index, -1 }, + { GetFramebufferAttachmentParameterivEXT_names, GetFramebufferAttachmentParameterivEXT_remap_index, -1 }, + { DeleteFramebuffersEXT_names, DeleteFramebuffersEXT_remap_index, -1 }, + { GenFramebuffersEXT_names, GenFramebuffersEXT_remap_index, -1 }, + { BindRenderbufferEXT_names, BindRenderbufferEXT_remap_index, -1 }, + { DeleteRenderbuffersEXT_names, DeleteRenderbuffersEXT_remap_index, -1 }, + { GetRenderbufferParameterivEXT_names, GetRenderbufferParameterivEXT_remap_index, -1 }, + { IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_map_buffer_range) +static const struct dri_extension_function GL_ARB_map_buffer_range_functions[] = { + { FlushMappedBufferRange_names, FlushMappedBufferRange_remap_index, -1 }, + { MapBufferRange_names, MapBufferRange_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_matrix_palette) +static const struct dri_extension_function GL_ARB_matrix_palette_functions[] = { + { MatrixIndexusvARB_names, MatrixIndexusvARB_remap_index, -1 }, + { MatrixIndexuivARB_names, MatrixIndexuivARB_remap_index, -1 }, + { MatrixIndexPointerARB_names, MatrixIndexPointerARB_remap_index, -1 }, + { CurrentPaletteMatrixARB_names, CurrentPaletteMatrixARB_remap_index, -1 }, + { MatrixIndexubvARB_names, MatrixIndexubvARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_multisample) +static const struct dri_extension_function GL_ARB_multisample_functions[] = { + { SampleCoverageARB_names, SampleCoverageARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_occlusion_query) +static const struct dri_extension_function GL_ARB_occlusion_query_functions[] = { + { BeginQueryARB_names, BeginQueryARB_remap_index, -1 }, + { GetQueryivARB_names, GetQueryivARB_remap_index, -1 }, + { GetQueryObjectivARB_names, GetQueryObjectivARB_remap_index, -1 }, + { EndQueryARB_names, EndQueryARB_remap_index, -1 }, + { GetQueryObjectuivARB_names, GetQueryObjectuivARB_remap_index, -1 }, + { DeleteQueriesARB_names, DeleteQueriesARB_remap_index, -1 }, + { IsQueryARB_names, IsQueryARB_remap_index, -1 }, + { GenQueriesARB_names, GenQueriesARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_point_parameters) +static const struct dri_extension_function GL_ARB_point_parameters_functions[] = { + { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 }, + { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const struct dri_extension_function GL_ARB_shader_objects_functions[] = { + { UniformMatrix3fvARB_names, UniformMatrix3fvARB_remap_index, -1 }, + { Uniform2fARB_names, Uniform2fARB_remap_index, -1 }, + { Uniform2ivARB_names, Uniform2ivARB_remap_index, -1 }, + { UniformMatrix4fvARB_names, UniformMatrix4fvARB_remap_index, -1 }, + { CreateProgramObjectARB_names, CreateProgramObjectARB_remap_index, -1 }, + { Uniform3iARB_names, Uniform3iARB_remap_index, -1 }, + { CreateShaderObjectARB_names, CreateShaderObjectARB_remap_index, -1 }, + { Uniform1fARB_names, Uniform1fARB_remap_index, -1 }, + { AttachObjectARB_names, AttachObjectARB_remap_index, -1 }, + { UniformMatrix2fvARB_names, UniformMatrix2fvARB_remap_index, -1 }, + { GetAttachedObjectsARB_names, GetAttachedObjectsARB_remap_index, -1 }, + { Uniform3fvARB_names, Uniform3fvARB_remap_index, -1 }, + { GetHandleARB_names, GetHandleARB_remap_index, -1 }, + { GetActiveUniformARB_names, GetActiveUniformARB_remap_index, -1 }, + { GetUniformivARB_names, GetUniformivARB_remap_index, -1 }, + { Uniform2fvARB_names, Uniform2fvARB_remap_index, -1 }, + { DeleteObjectARB_names, DeleteObjectARB_remap_index, -1 }, + { ValidateProgramARB_names, ValidateProgramARB_remap_index, -1 }, + { Uniform3ivARB_names, Uniform3ivARB_remap_index, -1 }, + { CompileShaderARB_names, CompileShaderARB_remap_index, -1 }, + { Uniform3fARB_names, Uniform3fARB_remap_index, -1 }, + { Uniform4fARB_names, Uniform4fARB_remap_index, -1 }, + { LinkProgramARB_names, LinkProgramARB_remap_index, -1 }, + { ShaderSourceARB_names, ShaderSourceARB_remap_index, -1 }, + { Uniform4ivARB_names, Uniform4ivARB_remap_index, -1 }, + { Uniform1ivARB_names, Uniform1ivARB_remap_index, -1 }, + { Uniform1iARB_names, Uniform1iARB_remap_index, -1 }, + { Uniform4fvARB_names, Uniform4fvARB_remap_index, -1 }, + { GetUniformfvARB_names, GetUniformfvARB_remap_index, -1 }, + { DetachObjectARB_names, DetachObjectARB_remap_index, -1 }, + { Uniform4iARB_names, Uniform4iARB_remap_index, -1 }, + { UseProgramObjectARB_names, UseProgramObjectARB_remap_index, -1 }, + { Uniform2iARB_names, Uniform2iARB_remap_index, -1 }, + { GetObjectParameterivARB_names, GetObjectParameterivARB_remap_index, -1 }, + { GetUniformLocationARB_names, GetUniformLocationARB_remap_index, -1 }, + { GetShaderSourceARB_names, GetShaderSourceARB_remap_index, -1 }, + { Uniform1fvARB_names, Uniform1fvARB_remap_index, -1 }, + { GetObjectParameterfvARB_names, GetObjectParameterfvARB_remap_index, -1 }, + { GetInfoLogARB_names, GetInfoLogARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_sync) +static const struct dri_extension_function GL_ARB_sync_functions[] = { + { DeleteSync_names, DeleteSync_remap_index, -1 }, + { FenceSync_names, FenceSync_remap_index, -1 }, + { WaitSync_names, WaitSync_remap_index, -1 }, + { GetInteger64v_names, GetInteger64v_remap_index, -1 }, + { GetSynciv_names, GetSynciv_remap_index, -1 }, + { IsSync_names, IsSync_remap_index, -1 }, + { ClientWaitSync_names, ClientWaitSync_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_texture_compression) +static const struct dri_extension_function GL_ARB_texture_compression_functions[] = { + { CompressedTexSubImage2DARB_names, CompressedTexSubImage2DARB_remap_index, -1 }, + { CompressedTexImage3DARB_names, CompressedTexImage3DARB_remap_index, -1 }, + { CompressedTexImage1DARB_names, CompressedTexImage1DARB_remap_index, -1 }, + { CompressedTexSubImage1DARB_names, CompressedTexSubImage1DARB_remap_index, -1 }, + { CompressedTexSubImage3DARB_names, CompressedTexSubImage3DARB_remap_index, -1 }, + { CompressedTexImage2DARB_names, CompressedTexImage2DARB_remap_index, -1 }, + { GetCompressedTexImageARB_names, GetCompressedTexImageARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_transpose_matrix) +static const struct dri_extension_function GL_ARB_transpose_matrix_functions[] = { + { MultTransposeMatrixdARB_names, MultTransposeMatrixdARB_remap_index, -1 }, + { LoadTransposeMatrixdARB_names, LoadTransposeMatrixdARB_remap_index, -1 }, + { MultTransposeMatrixfARB_names, MultTransposeMatrixfARB_remap_index, -1 }, + { LoadTransposeMatrixfARB_names, LoadTransposeMatrixfARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_vertex_array_object) +static const struct dri_extension_function GL_ARB_vertex_array_object_functions[] = { + { DeleteVertexArraysAPPLE_names, DeleteVertexArraysAPPLE_remap_index, -1 }, + { GenVertexArrays_names, GenVertexArrays_remap_index, -1 }, + { BindVertexArray_names, BindVertexArray_remap_index, -1 }, + { IsVertexArrayAPPLE_names, IsVertexArrayAPPLE_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const struct dri_extension_function GL_ARB_vertex_blend_functions[] = { + { WeightubvARB_names, WeightubvARB_remap_index, -1 }, + { WeightivARB_names, WeightivARB_remap_index, -1 }, + { WeightPointerARB_names, WeightPointerARB_remap_index, -1 }, + { WeightfvARB_names, WeightfvARB_remap_index, -1 }, + { WeightbvARB_names, WeightbvARB_remap_index, -1 }, + { WeightusvARB_names, WeightusvARB_remap_index, -1 }, + { VertexBlendARB_names, VertexBlendARB_remap_index, -1 }, + { WeightsvARB_names, WeightsvARB_remap_index, -1 }, + { WeightdvARB_names, WeightdvARB_remap_index, -1 }, + { WeightuivARB_names, WeightuivARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_vertex_buffer_object) +static const struct dri_extension_function GL_ARB_vertex_buffer_object_functions[] = { + { GetBufferSubDataARB_names, GetBufferSubDataARB_remap_index, -1 }, + { BufferSubDataARB_names, BufferSubDataARB_remap_index, -1 }, + { BufferDataARB_names, BufferDataARB_remap_index, -1 }, + { GetBufferPointervARB_names, GetBufferPointervARB_remap_index, -1 }, + { GetBufferParameterivARB_names, GetBufferParameterivARB_remap_index, -1 }, + { MapBufferARB_names, MapBufferARB_remap_index, -1 }, + { IsBufferARB_names, IsBufferARB_remap_index, -1 }, + { DeleteBuffersARB_names, DeleteBuffersARB_remap_index, -1 }, + { UnmapBufferARB_names, UnmapBufferARB_remap_index, -1 }, + { BindBufferARB_names, BindBufferARB_remap_index, -1 }, + { GenBuffersARB_names, GenBuffersARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const struct dri_extension_function GL_ARB_vertex_program_functions[] = { + { VertexAttrib2fARB_names, VertexAttrib2fARB_remap_index, -1 }, + { VertexAttrib3fARB_names, VertexAttrib3fARB_remap_index, -1 }, + { VertexAttrib1svARB_names, VertexAttrib1svARB_remap_index, -1 }, + { VertexAttrib4NusvARB_names, VertexAttrib4NusvARB_remap_index, -1 }, + { DisableVertexAttribArrayARB_names, DisableVertexAttribArrayARB_remap_index, -1 }, + { ProgramLocalParameter4dARB_names, ProgramLocalParameter4dARB_remap_index, -1 }, + { VertexAttrib1fARB_names, VertexAttrib1fARB_remap_index, -1 }, + { VertexAttrib4NbvARB_names, VertexAttrib4NbvARB_remap_index, -1 }, + { VertexAttrib1sARB_names, VertexAttrib1sARB_remap_index, -1 }, + { GetProgramLocalParameterfvARB_names, GetProgramLocalParameterfvARB_remap_index, -1 }, + { VertexAttrib3dvARB_names, VertexAttrib3dvARB_remap_index, -1 }, + { ProgramEnvParameter4fvARB_names, ProgramEnvParameter4fvARB_remap_index, -1 }, + { GetVertexAttribivARB_names, GetVertexAttribivARB_remap_index, -1 }, + { VertexAttrib4ivARB_names, VertexAttrib4ivARB_remap_index, -1 }, + { VertexAttrib4bvARB_names, VertexAttrib4bvARB_remap_index, -1 }, + { VertexAttrib3dARB_names, VertexAttrib3dARB_remap_index, -1 }, + { VertexAttrib4fARB_names, VertexAttrib4fARB_remap_index, -1 }, + { VertexAttrib4fvARB_names, VertexAttrib4fvARB_remap_index, -1 }, + { ProgramLocalParameter4dvARB_names, ProgramLocalParameter4dvARB_remap_index, -1 }, + { VertexAttrib2dARB_names, VertexAttrib2dARB_remap_index, -1 }, + { VertexAttrib1dvARB_names, VertexAttrib1dvARB_remap_index, -1 }, + { GetVertexAttribfvARB_names, GetVertexAttribfvARB_remap_index, -1 }, + { VertexAttrib4ubvARB_names, VertexAttrib4ubvARB_remap_index, -1 }, + { ProgramEnvParameter4fARB_names, ProgramEnvParameter4fARB_remap_index, -1 }, + { VertexAttrib4sARB_names, VertexAttrib4sARB_remap_index, -1 }, + { VertexAttrib2dvARB_names, VertexAttrib2dvARB_remap_index, -1 }, + { VertexAttrib2fvARB_names, VertexAttrib2fvARB_remap_index, -1 }, + { VertexAttrib4NivARB_names, VertexAttrib4NivARB_remap_index, -1 }, + { GetProgramStringARB_names, GetProgramStringARB_remap_index, -1 }, + { VertexAttrib4NuivARB_names, VertexAttrib4NuivARB_remap_index, -1 }, + { IsProgramNV_names, IsProgramNV_remap_index, -1 }, + { ProgramEnvParameter4dARB_names, ProgramEnvParameter4dARB_remap_index, -1 }, + { VertexAttrib1dARB_names, VertexAttrib1dARB_remap_index, -1 }, + { VertexAttrib4usvARB_names, VertexAttrib4usvARB_remap_index, -1 }, + { VertexAttrib3svARB_names, VertexAttrib3svARB_remap_index, -1 }, + { GetVertexAttribdvARB_names, GetVertexAttribdvARB_remap_index, -1 }, + { VertexAttrib4dvARB_names, VertexAttrib4dvARB_remap_index, -1 }, + { VertexAttribPointerARB_names, VertexAttribPointerARB_remap_index, -1 }, + { VertexAttrib4NsvARB_names, VertexAttrib4NsvARB_remap_index, -1 }, + { VertexAttrib3fvARB_names, VertexAttrib3fvARB_remap_index, -1 }, + { VertexAttrib4NubARB_names, VertexAttrib4NubARB_remap_index, -1 }, + { GetProgramEnvParameterfvARB_names, GetProgramEnvParameterfvARB_remap_index, -1 }, + { ProgramEnvParameter4dvARB_names, ProgramEnvParameter4dvARB_remap_index, -1 }, + { ProgramLocalParameter4fvARB_names, ProgramLocalParameter4fvARB_remap_index, -1 }, + { DeleteProgramsNV_names, DeleteProgramsNV_remap_index, -1 }, + { GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, -1 }, + { VertexAttrib4dARB_names, VertexAttrib4dARB_remap_index, -1 }, + { GetProgramLocalParameterdvARB_names, GetProgramLocalParameterdvARB_remap_index, -1 }, + { GetProgramivARB_names, GetProgramivARB_remap_index, -1 }, + { VertexAttrib3sARB_names, VertexAttrib3sARB_remap_index, -1 }, + { ProgramStringARB_names, ProgramStringARB_remap_index, -1 }, + { ProgramLocalParameter4fARB_names, ProgramLocalParameter4fARB_remap_index, -1 }, + { EnableVertexAttribArrayARB_names, EnableVertexAttribArrayARB_remap_index, -1 }, + { VertexAttrib4uivARB_names, VertexAttrib4uivARB_remap_index, -1 }, + { BindProgramNV_names, BindProgramNV_remap_index, -1 }, + { VertexAttrib4svARB_names, VertexAttrib4svARB_remap_index, -1 }, + { VertexAttrib2svARB_names, VertexAttrib2svARB_remap_index, -1 }, + { VertexAttrib4NubvARB_names, VertexAttrib4NubvARB_remap_index, -1 }, + { GetProgramEnvParameterdvARB_names, GetProgramEnvParameterdvARB_remap_index, -1 }, + { VertexAttrib2sARB_names, VertexAttrib2sARB_remap_index, -1 }, + { VertexAttrib1fvARB_names, VertexAttrib1fvARB_remap_index, -1 }, + { GenProgramsNV_names, GenProgramsNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_vertex_shader) +static const struct dri_extension_function GL_ARB_vertex_shader_functions[] = { + { GetActiveAttribARB_names, GetActiveAttribARB_remap_index, -1 }, + { GetAttribLocationARB_names, GetAttribLocationARB_remap_index, -1 }, + { BindAttribLocationARB_names, BindAttribLocationARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_window_pos) +static const struct dri_extension_function GL_ARB_window_pos_functions[] = { + { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, -1 }, + { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, -1 }, + { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, -1 }, + { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, -1 }, + { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, -1 }, + { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, -1 }, + { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, -1 }, + { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, -1 }, + { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, -1 }, + { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, -1 }, + { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, -1 }, + { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, -1 }, + { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, -1 }, + { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, -1 }, + { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, -1 }, + { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ATI_blend_equation_separate) +static const struct dri_extension_function GL_ATI_blend_equation_separate_functions[] = { + { BlendEquationSeparateEXT_names, BlendEquationSeparateEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ATI_draw_buffers) +static const struct dri_extension_function GL_ATI_draw_buffers_functions[] = { + { DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ATI_envmap_bumpmap) +static const struct dri_extension_function GL_ATI_envmap_bumpmap_functions[] = { + { TexBumpParameterfvATI_names, TexBumpParameterfvATI_remap_index, -1 }, + { TexBumpParameterivATI_names, TexBumpParameterivATI_remap_index, -1 }, + { GetTexBumpParameterfvATI_names, GetTexBumpParameterfvATI_remap_index, -1 }, + { GetTexBumpParameterivATI_names, GetTexBumpParameterivATI_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const struct dri_extension_function GL_ATI_fragment_shader_functions[] = { + { ColorFragmentOp2ATI_names, ColorFragmentOp2ATI_remap_index, -1 }, + { DeleteFragmentShaderATI_names, DeleteFragmentShaderATI_remap_index, -1 }, + { SetFragmentShaderConstantATI_names, SetFragmentShaderConstantATI_remap_index, -1 }, + { SampleMapATI_names, SampleMapATI_remap_index, -1 }, + { AlphaFragmentOp2ATI_names, AlphaFragmentOp2ATI_remap_index, -1 }, + { AlphaFragmentOp1ATI_names, AlphaFragmentOp1ATI_remap_index, -1 }, + { ColorFragmentOp1ATI_names, ColorFragmentOp1ATI_remap_index, -1 }, + { AlphaFragmentOp3ATI_names, AlphaFragmentOp3ATI_remap_index, -1 }, + { PassTexCoordATI_names, PassTexCoordATI_remap_index, -1 }, + { BeginFragmentShaderATI_names, BeginFragmentShaderATI_remap_index, -1 }, + { BindFragmentShaderATI_names, BindFragmentShaderATI_remap_index, -1 }, + { ColorFragmentOp3ATI_names, ColorFragmentOp3ATI_remap_index, -1 }, + { GenFragmentShadersATI_names, GenFragmentShadersATI_remap_index, -1 }, + { EndFragmentShaderATI_names, EndFragmentShaderATI_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ATI_separate_stencil) +static const struct dri_extension_function GL_ATI_separate_stencil_functions[] = { + { StencilOpSeparate_names, StencilOpSeparate_remap_index, -1 }, + { StencilFuncSeparateATI_names, StencilFuncSeparateATI_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_blend_color) +static const struct dri_extension_function GL_EXT_blend_color_functions[] = { + { BlendColor_names, -1, 336 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_blend_equation_separate) +static const struct dri_extension_function GL_EXT_blend_equation_separate_functions[] = { + { BlendEquationSeparateEXT_names, BlendEquationSeparateEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_blend_func_separate) +static const struct dri_extension_function GL_EXT_blend_func_separate_functions[] = { + { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_blend_minmax) +static const struct dri_extension_function GL_EXT_blend_minmax_functions[] = { + { BlendEquation_names, -1, 337 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_color_subtable) +static const struct dri_extension_function GL_EXT_color_subtable_functions[] = { + { ColorSubTable_names, -1, 346 }, + { CopyColorSubTable_names, -1, 347 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_compiled_vertex_array) +static const struct dri_extension_function GL_EXT_compiled_vertex_array_functions[] = { + { UnlockArraysEXT_names, UnlockArraysEXT_remap_index, -1 }, + { LockArraysEXT_names, LockArraysEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_convolution) +static const struct dri_extension_function GL_EXT_convolution_functions[] = { + { ConvolutionFilter1D_names, -1, 348 }, + { CopyConvolutionFilter1D_names, -1, 354 }, + { GetConvolutionParameteriv_names, -1, 358 }, + { ConvolutionFilter2D_names, -1, 349 }, + { ConvolutionParameteriv_names, -1, 353 }, + { ConvolutionParameterfv_names, -1, 351 }, + { GetSeparableFilter_names, -1, 359 }, + { SeparableFilter2D_names, -1, 360 }, + { ConvolutionParameteri_names, -1, 352 }, + { ConvolutionParameterf_names, -1, 350 }, + { GetConvolutionParameterfv_names, -1, 357 }, + { GetConvolutionFilter_names, -1, 356 }, + { CopyConvolutionFilter2D_names, -1, 355 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const struct dri_extension_function GL_EXT_coordinate_frame_functions[] = { + { TangentPointerEXT_names, TangentPointerEXT_remap_index, -1 }, + { Binormal3ivEXT_names, Binormal3ivEXT_remap_index, -1 }, + { Tangent3sEXT_names, Tangent3sEXT_remap_index, -1 }, + { Tangent3fvEXT_names, Tangent3fvEXT_remap_index, -1 }, + { Tangent3dvEXT_names, Tangent3dvEXT_remap_index, -1 }, + { Binormal3bvEXT_names, Binormal3bvEXT_remap_index, -1 }, + { Binormal3dEXT_names, Binormal3dEXT_remap_index, -1 }, + { Tangent3fEXT_names, Tangent3fEXT_remap_index, -1 }, + { Binormal3sEXT_names, Binormal3sEXT_remap_index, -1 }, + { Tangent3ivEXT_names, Tangent3ivEXT_remap_index, -1 }, + { Tangent3dEXT_names, Tangent3dEXT_remap_index, -1 }, + { Binormal3svEXT_names, Binormal3svEXT_remap_index, -1 }, + { Binormal3fEXT_names, Binormal3fEXT_remap_index, -1 }, + { Binormal3dvEXT_names, Binormal3dvEXT_remap_index, -1 }, + { Tangent3iEXT_names, Tangent3iEXT_remap_index, -1 }, + { Tangent3bvEXT_names, Tangent3bvEXT_remap_index, -1 }, + { Binormal3fvEXT_names, Binormal3fvEXT_remap_index, -1 }, + { Tangent3bEXT_names, Tangent3bEXT_remap_index, -1 }, + { BinormalPointerEXT_names, BinormalPointerEXT_remap_index, -1 }, + { Tangent3svEXT_names, Tangent3svEXT_remap_index, -1 }, + { Binormal3bEXT_names, Binormal3bEXT_remap_index, -1 }, + { Binormal3iEXT_names, Binormal3iEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_copy_texture) +static const struct dri_extension_function GL_EXT_copy_texture_functions[] = { + { CopyTexSubImage3D_names, -1, 373 }, + { CopyTexImage2D_names, -1, 324 }, + { CopyTexImage1D_names, -1, 323 }, + { CopyTexSubImage2D_names, -1, 326 }, + { CopyTexSubImage1D_names, -1, 325 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_cull_vertex) +static const struct dri_extension_function GL_EXT_cull_vertex_functions[] = { + { CullParameterdvEXT_names, CullParameterdvEXT_remap_index, -1 }, + { CullParameterfvEXT_names, CullParameterfvEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_depth_bounds_test) +static const struct dri_extension_function GL_EXT_depth_bounds_test_functions[] = { + { DepthBoundsEXT_names, DepthBoundsEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_draw_range_elements) +static const struct dri_extension_function GL_EXT_draw_range_elements_functions[] = { + { DrawRangeElements_names, -1, 338 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_fog_coord) +static const struct dri_extension_function GL_EXT_fog_coord_functions[] = { + { FogCoorddEXT_names, FogCoorddEXT_remap_index, -1 }, + { FogCoordfEXT_names, FogCoordfEXT_remap_index, -1 }, + { FogCoordPointerEXT_names, FogCoordPointerEXT_remap_index, -1 }, + { FogCoordfvEXT_names, FogCoordfvEXT_remap_index, -1 }, + { FogCoorddvEXT_names, FogCoorddvEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_framebuffer_blit) +static const struct dri_extension_function GL_EXT_framebuffer_blit_functions[] = { + { BlitFramebufferEXT_names, BlitFramebufferEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_framebuffer_object) +static const struct dri_extension_function GL_EXT_framebuffer_object_functions[] = { + { GenerateMipmapEXT_names, GenerateMipmapEXT_remap_index, -1 }, + { RenderbufferStorageEXT_names, RenderbufferStorageEXT_remap_index, -1 }, + { CheckFramebufferStatusEXT_names, CheckFramebufferStatusEXT_remap_index, -1 }, + { FramebufferTexture3DEXT_names, FramebufferTexture3DEXT_remap_index, -1 }, + { FramebufferTexture2DEXT_names, FramebufferTexture2DEXT_remap_index, -1 }, + { FramebufferRenderbufferEXT_names, FramebufferRenderbufferEXT_remap_index, -1 }, + { FramebufferTexture1DEXT_names, FramebufferTexture1DEXT_remap_index, -1 }, + { BindFramebufferEXT_names, BindFramebufferEXT_remap_index, -1 }, + { GenRenderbuffersEXT_names, GenRenderbuffersEXT_remap_index, -1 }, + { IsFramebufferEXT_names, IsFramebufferEXT_remap_index, -1 }, + { GetFramebufferAttachmentParameterivEXT_names, GetFramebufferAttachmentParameterivEXT_remap_index, -1 }, + { DeleteFramebuffersEXT_names, DeleteFramebuffersEXT_remap_index, -1 }, + { GenFramebuffersEXT_names, GenFramebuffersEXT_remap_index, -1 }, + { BindRenderbufferEXT_names, BindRenderbufferEXT_remap_index, -1 }, + { DeleteRenderbuffersEXT_names, DeleteRenderbuffersEXT_remap_index, -1 }, + { GetRenderbufferParameterivEXT_names, GetRenderbufferParameterivEXT_remap_index, -1 }, + { IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_gpu_program_parameters) +static const struct dri_extension_function GL_EXT_gpu_program_parameters_functions[] = { + { ProgramLocalParameters4fvEXT_names, ProgramLocalParameters4fvEXT_remap_index, -1 }, + { ProgramEnvParameters4fvEXT_names, ProgramEnvParameters4fvEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_histogram) +static const struct dri_extension_function GL_EXT_histogram_functions[] = { + { Histogram_names, -1, 367 }, + { ResetHistogram_names, -1, 369 }, + { GetMinmax_names, -1, 364 }, + { GetHistogramParameterfv_names, -1, 362 }, + { GetMinmaxParameteriv_names, -1, 366 }, + { ResetMinmax_names, -1, 370 }, + { GetHistogramParameteriv_names, -1, 363 }, + { GetHistogram_names, -1, 361 }, + { Minmax_names, -1, 368 }, + { GetMinmaxParameterfv_names, -1, 365 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_index_func) +static const struct dri_extension_function GL_EXT_index_func_functions[] = { + { IndexFuncEXT_names, IndexFuncEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_index_material) +static const struct dri_extension_function GL_EXT_index_material_functions[] = { + { IndexMaterialEXT_names, IndexMaterialEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_light_texture) +static const struct dri_extension_function GL_EXT_light_texture_functions[] = { + { ApplyTextureEXT_names, ApplyTextureEXT_remap_index, -1 }, + { TextureMaterialEXT_names, TextureMaterialEXT_remap_index, -1 }, + { TextureLightEXT_names, TextureLightEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_multi_draw_arrays) +static const struct dri_extension_function GL_EXT_multi_draw_arrays_functions[] = { + { MultiDrawElementsEXT_names, MultiDrawElementsEXT_remap_index, -1 }, + { MultiDrawArraysEXT_names, MultiDrawArraysEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_multisample) +static const struct dri_extension_function GL_EXT_multisample_functions[] = { + { SampleMaskSGIS_names, SampleMaskSGIS_remap_index, -1 }, + { SamplePatternSGIS_names, SamplePatternSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_paletted_texture) +static const struct dri_extension_function GL_EXT_paletted_texture_functions[] = { + { ColorTable_names, -1, 339 }, + { GetColorTable_names, -1, 343 }, + { GetColorTableParameterfv_names, -1, 344 }, + { GetColorTableParameteriv_names, -1, 345 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_pixel_transform) +static const struct dri_extension_function GL_EXT_pixel_transform_functions[] = { + { PixelTransformParameterfvEXT_names, PixelTransformParameterfvEXT_remap_index, -1 }, + { PixelTransformParameterfEXT_names, PixelTransformParameterfEXT_remap_index, -1 }, + { PixelTransformParameteriEXT_names, PixelTransformParameteriEXT_remap_index, -1 }, + { PixelTransformParameterivEXT_names, PixelTransformParameterivEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_point_parameters) +static const struct dri_extension_function GL_EXT_point_parameters_functions[] = { + { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 }, + { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_polygon_offset) +static const struct dri_extension_function GL_EXT_polygon_offset_functions[] = { + { PolygonOffsetEXT_names, PolygonOffsetEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_provoking_vertex) +static const struct dri_extension_function GL_EXT_provoking_vertex_functions[] = { + { ProvokingVertexEXT_names, ProvokingVertexEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_secondary_color) +static const struct dri_extension_function GL_EXT_secondary_color_functions[] = { + { SecondaryColor3iEXT_names, SecondaryColor3iEXT_remap_index, -1 }, + { SecondaryColor3bEXT_names, SecondaryColor3bEXT_remap_index, -1 }, + { SecondaryColor3bvEXT_names, SecondaryColor3bvEXT_remap_index, -1 }, + { SecondaryColor3sEXT_names, SecondaryColor3sEXT_remap_index, -1 }, + { SecondaryColor3dEXT_names, SecondaryColor3dEXT_remap_index, -1 }, + { SecondaryColorPointerEXT_names, SecondaryColorPointerEXT_remap_index, -1 }, + { SecondaryColor3uiEXT_names, SecondaryColor3uiEXT_remap_index, -1 }, + { SecondaryColor3usvEXT_names, SecondaryColor3usvEXT_remap_index, -1 }, + { SecondaryColor3ivEXT_names, SecondaryColor3ivEXT_remap_index, -1 }, + { SecondaryColor3fvEXT_names, SecondaryColor3fvEXT_remap_index, -1 }, + { SecondaryColor3ubvEXT_names, SecondaryColor3ubvEXT_remap_index, -1 }, + { SecondaryColor3uivEXT_names, SecondaryColor3uivEXT_remap_index, -1 }, + { SecondaryColor3dvEXT_names, SecondaryColor3dvEXT_remap_index, -1 }, + { SecondaryColor3usEXT_names, SecondaryColor3usEXT_remap_index, -1 }, + { SecondaryColor3ubEXT_names, SecondaryColor3ubEXT_remap_index, -1 }, + { SecondaryColor3fEXT_names, SecondaryColor3fEXT_remap_index, -1 }, + { SecondaryColor3svEXT_names, SecondaryColor3svEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_stencil_two_side) +static const struct dri_extension_function GL_EXT_stencil_two_side_functions[] = { + { ActiveStencilFaceEXT_names, ActiveStencilFaceEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_subtexture) +static const struct dri_extension_function GL_EXT_subtexture_functions[] = { + { TexSubImage1D_names, -1, 332 }, + { TexSubImage2D_names, -1, 333 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_texture3D) +static const struct dri_extension_function GL_EXT_texture3D_functions[] = { + { TexImage3D_names, -1, 371 }, + { TexSubImage3D_names, -1, 372 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_texture_array) +static const struct dri_extension_function GL_EXT_texture_array_functions[] = { + { FramebufferTextureLayerEXT_names, FramebufferTextureLayerEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_texture_object) +static const struct dri_extension_function GL_EXT_texture_object_functions[] = { + { PrioritizeTextures_names, -1, 331 }, + { AreTexturesResident_names, -1, 322 }, + { GenTextures_names, -1, 328 }, + { DeleteTextures_names, -1, 327 }, + { IsTexture_names, -1, 330 }, + { BindTexture_names, -1, 307 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_texture_perturb_normal) +static const struct dri_extension_function GL_EXT_texture_perturb_normal_functions[] = { + { TextureNormalEXT_names, TextureNormalEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_timer_query) +static const struct dri_extension_function GL_EXT_timer_query_functions[] = { + { GetQueryObjectui64vEXT_names, GetQueryObjectui64vEXT_remap_index, -1 }, + { GetQueryObjecti64vEXT_names, GetQueryObjecti64vEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const struct dri_extension_function GL_EXT_vertex_array_functions[] = { + { IndexPointerEXT_names, IndexPointerEXT_remap_index, -1 }, + { NormalPointerEXT_names, NormalPointerEXT_remap_index, -1 }, + { VertexPointerEXT_names, VertexPointerEXT_remap_index, -1 }, + { TexCoordPointerEXT_names, TexCoordPointerEXT_remap_index, -1 }, + { EdgeFlagPointerEXT_names, EdgeFlagPointerEXT_remap_index, -1 }, + { ArrayElement_names, -1, 306 }, + { ColorPointerEXT_names, ColorPointerEXT_remap_index, -1 }, + { GetPointerv_names, -1, 329 }, + { DrawArrays_names, -1, 310 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_vertex_weighting) +static const struct dri_extension_function GL_EXT_vertex_weighting_functions[] = { + { VertexWeightfvEXT_names, VertexWeightfvEXT_remap_index, -1 }, + { VertexWeightfEXT_names, VertexWeightfEXT_remap_index, -1 }, + { VertexWeightPointerEXT_names, VertexWeightPointerEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_HP_image_transform) +static const struct dri_extension_function GL_HP_image_transform_functions[] = { + { GetImageTransformParameterfvHP_names, GetImageTransformParameterfvHP_remap_index, -1 }, + { ImageTransformParameterfHP_names, ImageTransformParameterfHP_remap_index, -1 }, + { ImageTransformParameterfvHP_names, ImageTransformParameterfvHP_remap_index, -1 }, + { ImageTransformParameteriHP_names, ImageTransformParameteriHP_remap_index, -1 }, + { GetImageTransformParameterivHP_names, GetImageTransformParameterivHP_remap_index, -1 }, + { ImageTransformParameterivHP_names, ImageTransformParameterivHP_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_IBM_multimode_draw_arrays) +static const struct dri_extension_function GL_IBM_multimode_draw_arrays_functions[] = { + { MultiModeDrawArraysIBM_names, MultiModeDrawArraysIBM_remap_index, -1 }, + { MultiModeDrawElementsIBM_names, MultiModeDrawElementsIBM_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const struct dri_extension_function GL_IBM_vertex_array_lists_functions[] = { + { SecondaryColorPointerListIBM_names, SecondaryColorPointerListIBM_remap_index, -1 }, + { NormalPointerListIBM_names, NormalPointerListIBM_remap_index, -1 }, + { FogCoordPointerListIBM_names, FogCoordPointerListIBM_remap_index, -1 }, + { VertexPointerListIBM_names, VertexPointerListIBM_remap_index, -1 }, + { ColorPointerListIBM_names, ColorPointerListIBM_remap_index, -1 }, + { TexCoordPointerListIBM_names, TexCoordPointerListIBM_remap_index, -1 }, + { IndexPointerListIBM_names, IndexPointerListIBM_remap_index, -1 }, + { EdgeFlagPointerListIBM_names, EdgeFlagPointerListIBM_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_INGR_blend_func_separate) +static const struct dri_extension_function GL_INGR_blend_func_separate_functions[] = { + { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_INTEL_parallel_arrays) +static const struct dri_extension_function GL_INTEL_parallel_arrays_functions[] = { + { VertexPointervINTEL_names, VertexPointervINTEL_remap_index, -1 }, + { ColorPointervINTEL_names, ColorPointervINTEL_remap_index, -1 }, + { NormalPointervINTEL_names, NormalPointervINTEL_remap_index, -1 }, + { TexCoordPointervINTEL_names, TexCoordPointervINTEL_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_MESA_resize_buffers) +static const struct dri_extension_function GL_MESA_resize_buffers_functions[] = { + { ResizeBuffersMESA_names, ResizeBuffersMESA_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_MESA_shader_debug) +static const struct dri_extension_function GL_MESA_shader_debug_functions[] = { + { GetDebugLogLengthMESA_names, GetDebugLogLengthMESA_remap_index, -1 }, + { ClearDebugLogMESA_names, ClearDebugLogMESA_remap_index, -1 }, + { GetDebugLogMESA_names, GetDebugLogMESA_remap_index, -1 }, + { CreateDebugObjectMESA_names, CreateDebugObjectMESA_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_MESA_window_pos) +static const struct dri_extension_function GL_MESA_window_pos_functions[] = { + { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, -1 }, + { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, -1 }, + { WindowPos4svMESA_names, WindowPos4svMESA_remap_index, -1 }, + { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, -1 }, + { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, -1 }, + { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, -1 }, + { WindowPos4dMESA_names, WindowPos4dMESA_remap_index, -1 }, + { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, -1 }, + { WindowPos4ivMESA_names, WindowPos4ivMESA_remap_index, -1 }, + { WindowPos4fMESA_names, WindowPos4fMESA_remap_index, -1 }, + { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, -1 }, + { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, -1 }, + { WindowPos4dvMESA_names, WindowPos4dvMESA_remap_index, -1 }, + { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, -1 }, + { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, -1 }, + { WindowPos4sMESA_names, WindowPos4sMESA_remap_index, -1 }, + { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, -1 }, + { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, -1 }, + { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, -1 }, + { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, -1 }, + { WindowPos4iMESA_names, WindowPos4iMESA_remap_index, -1 }, + { WindowPos4fvMESA_names, WindowPos4fvMESA_remap_index, -1 }, + { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, -1 }, + { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_evaluators) +static const struct dri_extension_function GL_NV_evaluators_functions[] = { + { GetMapAttribParameterivNV_names, GetMapAttribParameterivNV_remap_index, -1 }, + { MapControlPointsNV_names, MapControlPointsNV_remap_index, -1 }, + { MapParameterfvNV_names, MapParameterfvNV_remap_index, -1 }, + { EvalMapsNV_names, EvalMapsNV_remap_index, -1 }, + { GetMapAttribParameterfvNV_names, GetMapAttribParameterfvNV_remap_index, -1 }, + { MapParameterivNV_names, MapParameterivNV_remap_index, -1 }, + { GetMapParameterivNV_names, GetMapParameterivNV_remap_index, -1 }, + { GetMapParameterfvNV_names, GetMapParameterfvNV_remap_index, -1 }, + { GetMapControlPointsNV_names, GetMapControlPointsNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_fence) +static const struct dri_extension_function GL_NV_fence_functions[] = { + { GenFencesNV_names, GenFencesNV_remap_index, -1 }, + { TestFenceNV_names, TestFenceNV_remap_index, -1 }, + { IsFenceNV_names, IsFenceNV_remap_index, -1 }, + { DeleteFencesNV_names, DeleteFencesNV_remap_index, -1 }, + { SetFenceNV_names, SetFenceNV_remap_index, -1 }, + { GetFenceivNV_names, GetFenceivNV_remap_index, -1 }, + { FinishFenceNV_names, FinishFenceNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_fragment_program) +static const struct dri_extension_function GL_NV_fragment_program_functions[] = { + { GetProgramNamedParameterdvNV_names, GetProgramNamedParameterdvNV_remap_index, -1 }, + { GetProgramNamedParameterfvNV_names, GetProgramNamedParameterfvNV_remap_index, -1 }, + { ProgramNamedParameter4fNV_names, ProgramNamedParameter4fNV_remap_index, -1 }, + { ProgramNamedParameter4fvNV_names, ProgramNamedParameter4fvNV_remap_index, -1 }, + { ProgramNamedParameter4dvNV_names, ProgramNamedParameter4dvNV_remap_index, -1 }, + { ProgramNamedParameter4dNV_names, ProgramNamedParameter4dNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_point_sprite) +static const struct dri_extension_function GL_NV_point_sprite_functions[] = { + { PointParameteriNV_names, PointParameteriNV_remap_index, -1 }, + { PointParameterivNV_names, PointParameterivNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_register_combiners) +static const struct dri_extension_function GL_NV_register_combiners_functions[] = { + { CombinerOutputNV_names, CombinerOutputNV_remap_index, -1 }, + { CombinerParameterfvNV_names, CombinerParameterfvNV_remap_index, -1 }, + { GetCombinerOutputParameterfvNV_names, GetCombinerOutputParameterfvNV_remap_index, -1 }, + { FinalCombinerInputNV_names, FinalCombinerInputNV_remap_index, -1 }, + { GetCombinerInputParameterfvNV_names, GetCombinerInputParameterfvNV_remap_index, -1 }, + { GetCombinerOutputParameterivNV_names, GetCombinerOutputParameterivNV_remap_index, -1 }, + { CombinerParameteriNV_names, CombinerParameteriNV_remap_index, -1 }, + { GetFinalCombinerInputParameterivNV_names, GetFinalCombinerInputParameterivNV_remap_index, -1 }, + { CombinerInputNV_names, CombinerInputNV_remap_index, -1 }, + { CombinerParameterfNV_names, CombinerParameterfNV_remap_index, -1 }, + { GetFinalCombinerInputParameterfvNV_names, GetFinalCombinerInputParameterfvNV_remap_index, -1 }, + { GetCombinerInputParameterivNV_names, GetCombinerInputParameterivNV_remap_index, -1 }, + { CombinerParameterivNV_names, CombinerParameterivNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_register_combiners2) +static const struct dri_extension_function GL_NV_register_combiners2_functions[] = { + { CombinerStageParameterfvNV_names, CombinerStageParameterfvNV_remap_index, -1 }, + { GetCombinerStageParameterfvNV_names, GetCombinerStageParameterfvNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_vertex_array_range) +static const struct dri_extension_function GL_NV_vertex_array_range_functions[] = { + { VertexArrayRangeNV_names, VertexArrayRangeNV_remap_index, -1 }, + { FlushVertexArrayRangeNV_names, FlushVertexArrayRangeNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_vertex_program) +static const struct dri_extension_function GL_NV_vertex_program_functions[] = { + { VertexAttrib4ubvNV_names, VertexAttrib4ubvNV_remap_index, -1 }, + { VertexAttrib4svNV_names, VertexAttrib4svNV_remap_index, -1 }, + { VertexAttribs1dvNV_names, VertexAttribs1dvNV_remap_index, -1 }, + { VertexAttrib1fvNV_names, VertexAttrib1fvNV_remap_index, -1 }, + { VertexAttrib4fNV_names, VertexAttrib4fNV_remap_index, -1 }, + { VertexAttrib2dNV_names, VertexAttrib2dNV_remap_index, -1 }, + { VertexAttrib4ubNV_names, VertexAttrib4ubNV_remap_index, -1 }, + { VertexAttribs3dvNV_names, VertexAttribs3dvNV_remap_index, -1 }, + { VertexAttribs4fvNV_names, VertexAttribs4fvNV_remap_index, -1 }, + { VertexAttrib2sNV_names, VertexAttrib2sNV_remap_index, -1 }, + { VertexAttribs3fvNV_names, VertexAttribs3fvNV_remap_index, -1 }, + { ProgramEnvParameter4fvARB_names, ProgramEnvParameter4fvARB_remap_index, -1 }, + { LoadProgramNV_names, LoadProgramNV_remap_index, -1 }, + { VertexAttrib4fvNV_names, VertexAttrib4fvNV_remap_index, -1 }, + { VertexAttrib3fNV_names, VertexAttrib3fNV_remap_index, -1 }, + { VertexAttribs2dvNV_names, VertexAttribs2dvNV_remap_index, -1 }, + { GetProgramParameterfvNV_names, GetProgramParameterfvNV_remap_index, -1 }, + { VertexAttrib3dNV_names, VertexAttrib3dNV_remap_index, -1 }, + { VertexAttrib2fvNV_names, VertexAttrib2fvNV_remap_index, -1 }, + { VertexAttrib2dvNV_names, VertexAttrib2dvNV_remap_index, -1 }, + { VertexAttrib1dvNV_names, VertexAttrib1dvNV_remap_index, -1 }, + { VertexAttrib1svNV_names, VertexAttrib1svNV_remap_index, -1 }, + { ProgramEnvParameter4fARB_names, ProgramEnvParameter4fARB_remap_index, -1 }, + { VertexAttribs2svNV_names, VertexAttribs2svNV_remap_index, -1 }, + { GetVertexAttribivNV_names, GetVertexAttribivNV_remap_index, -1 }, + { GetVertexAttribfvNV_names, GetVertexAttribfvNV_remap_index, -1 }, + { VertexAttrib2svNV_names, VertexAttrib2svNV_remap_index, -1 }, + { VertexAttribs1fvNV_names, VertexAttribs1fvNV_remap_index, -1 }, + { IsProgramNV_names, IsProgramNV_remap_index, -1 }, + { ProgramEnvParameter4dARB_names, ProgramEnvParameter4dARB_remap_index, -1 }, + { VertexAttrib2fNV_names, VertexAttrib2fNV_remap_index, -1 }, + { RequestResidentProgramsNV_names, RequestResidentProgramsNV_remap_index, -1 }, + { ExecuteProgramNV_names, ExecuteProgramNV_remap_index, -1 }, + { VertexAttribPointerNV_names, VertexAttribPointerNV_remap_index, -1 }, + { TrackMatrixNV_names, TrackMatrixNV_remap_index, -1 }, + { GetProgramParameterdvNV_names, GetProgramParameterdvNV_remap_index, -1 }, + { GetTrackMatrixivNV_names, GetTrackMatrixivNV_remap_index, -1 }, + { VertexAttrib3svNV_names, VertexAttrib3svNV_remap_index, -1 }, + { ProgramParameters4fvNV_names, ProgramParameters4fvNV_remap_index, -1 }, + { GetProgramivNV_names, GetProgramivNV_remap_index, -1 }, + { GetVertexAttribdvNV_names, GetVertexAttribdvNV_remap_index, -1 }, + { VertexAttrib3fvNV_names, VertexAttrib3fvNV_remap_index, -1 }, + { ProgramEnvParameter4dvARB_names, ProgramEnvParameter4dvARB_remap_index, -1 }, + { VertexAttribs2fvNV_names, VertexAttribs2fvNV_remap_index, -1 }, + { DeleteProgramsNV_names, DeleteProgramsNV_remap_index, -1 }, + { GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, -1 }, + { GetProgramStringNV_names, GetProgramStringNV_remap_index, -1 }, + { VertexAttrib4sNV_names, VertexAttrib4sNV_remap_index, -1 }, + { VertexAttribs4dvNV_names, VertexAttribs4dvNV_remap_index, -1 }, + { ProgramParameters4dvNV_names, ProgramParameters4dvNV_remap_index, -1 }, + { VertexAttrib3sNV_names, VertexAttrib3sNV_remap_index, -1 }, + { VertexAttrib1fNV_names, VertexAttrib1fNV_remap_index, -1 }, + { VertexAttrib4dNV_names, VertexAttrib4dNV_remap_index, -1 }, + { VertexAttribs4ubvNV_names, VertexAttribs4ubvNV_remap_index, -1 }, + { VertexAttribs3svNV_names, VertexAttribs3svNV_remap_index, -1 }, + { VertexAttrib1sNV_names, VertexAttrib1sNV_remap_index, -1 }, + { BindProgramNV_names, BindProgramNV_remap_index, -1 }, + { AreProgramsResidentNV_names, AreProgramsResidentNV_remap_index, -1 }, + { VertexAttrib3dvNV_names, VertexAttrib3dvNV_remap_index, -1 }, + { VertexAttrib1dNV_names, VertexAttrib1dNV_remap_index, -1 }, + { VertexAttribs4svNV_names, VertexAttribs4svNV_remap_index, -1 }, + { VertexAttribs1svNV_names, VertexAttribs1svNV_remap_index, -1 }, + { GenProgramsNV_names, GenProgramsNV_remap_index, -1 }, + { VertexAttrib4dvNV_names, VertexAttrib4dvNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_PGI_misc_hints) +static const struct dri_extension_function GL_PGI_misc_hints_functions[] = { + { HintPGI_names, HintPGI_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_detail_texture) +static const struct dri_extension_function GL_SGIS_detail_texture_functions[] = { + { GetDetailTexFuncSGIS_names, GetDetailTexFuncSGIS_remap_index, -1 }, + { DetailTexFuncSGIS_names, DetailTexFuncSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_fog_function) +static const struct dri_extension_function GL_SGIS_fog_function_functions[] = { + { FogFuncSGIS_names, FogFuncSGIS_remap_index, -1 }, + { GetFogFuncSGIS_names, GetFogFuncSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_multisample) +static const struct dri_extension_function GL_SGIS_multisample_functions[] = { + { SampleMaskSGIS_names, SampleMaskSGIS_remap_index, -1 }, + { SamplePatternSGIS_names, SamplePatternSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +static const struct dri_extension_function GL_SGIS_pixel_texture_functions[] = { + { PixelTexGenParameterfvSGIS_names, PixelTexGenParameterfvSGIS_remap_index, -1 }, + { GetPixelTexGenParameterivSGIS_names, GetPixelTexGenParameterivSGIS_remap_index, -1 }, + { PixelTexGenParameteriSGIS_names, PixelTexGenParameteriSGIS_remap_index, -1 }, + { PixelTexGenParameterivSGIS_names, PixelTexGenParameterivSGIS_remap_index, -1 }, + { PixelTexGenParameterfSGIS_names, PixelTexGenParameterfSGIS_remap_index, -1 }, + { GetPixelTexGenParameterfvSGIS_names, GetPixelTexGenParameterfvSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_point_parameters) +static const struct dri_extension_function GL_SGIS_point_parameters_functions[] = { + { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 }, + { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_sharpen_texture) +static const struct dri_extension_function GL_SGIS_sharpen_texture_functions[] = { + { GetSharpenTexFuncSGIS_names, GetSharpenTexFuncSGIS_remap_index, -1 }, + { SharpenTexFuncSGIS_names, SharpenTexFuncSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_texture4D) +static const struct dri_extension_function GL_SGIS_texture4D_functions[] = { + { TexImage4DSGIS_names, TexImage4DSGIS_remap_index, -1 }, + { TexSubImage4DSGIS_names, TexSubImage4DSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_texture_color_mask) +static const struct dri_extension_function GL_SGIS_texture_color_mask_functions[] = { + { TextureColorMaskSGIS_names, TextureColorMaskSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_texture_filter4) +static const struct dri_extension_function GL_SGIS_texture_filter4_functions[] = { + { GetTexFilterFuncSGIS_names, GetTexFilterFuncSGIS_remap_index, -1 }, + { TexFilterFuncSGIS_names, TexFilterFuncSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_async) +static const struct dri_extension_function GL_SGIX_async_functions[] = { + { AsyncMarkerSGIX_names, AsyncMarkerSGIX_remap_index, -1 }, + { FinishAsyncSGIX_names, FinishAsyncSGIX_remap_index, -1 }, + { PollAsyncSGIX_names, PollAsyncSGIX_remap_index, -1 }, + { DeleteAsyncMarkersSGIX_names, DeleteAsyncMarkersSGIX_remap_index, -1 }, + { IsAsyncMarkerSGIX_names, IsAsyncMarkerSGIX_remap_index, -1 }, + { GenAsyncMarkersSGIX_names, GenAsyncMarkersSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_flush_raster) +static const struct dri_extension_function GL_SGIX_flush_raster_functions[] = { + { FlushRasterSGIX_names, FlushRasterSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const struct dri_extension_function GL_SGIX_fragment_lighting_functions[] = { + { FragmentMaterialfvSGIX_names, FragmentMaterialfvSGIX_remap_index, -1 }, + { FragmentLightModelivSGIX_names, FragmentLightModelivSGIX_remap_index, -1 }, + { FragmentLightiSGIX_names, FragmentLightiSGIX_remap_index, -1 }, + { GetFragmentMaterialfvSGIX_names, GetFragmentMaterialfvSGIX_remap_index, -1 }, + { FragmentMaterialfSGIX_names, FragmentMaterialfSGIX_remap_index, -1 }, + { GetFragmentLightivSGIX_names, GetFragmentLightivSGIX_remap_index, -1 }, + { FragmentLightModeliSGIX_names, FragmentLightModeliSGIX_remap_index, -1 }, + { FragmentLightivSGIX_names, FragmentLightivSGIX_remap_index, -1 }, + { GetFragmentMaterialivSGIX_names, GetFragmentMaterialivSGIX_remap_index, -1 }, + { FragmentLightModelfSGIX_names, FragmentLightModelfSGIX_remap_index, -1 }, + { FragmentColorMaterialSGIX_names, FragmentColorMaterialSGIX_remap_index, -1 }, + { FragmentMaterialiSGIX_names, FragmentMaterialiSGIX_remap_index, -1 }, + { LightEnviSGIX_names, LightEnviSGIX_remap_index, -1 }, + { FragmentLightModelfvSGIX_names, FragmentLightModelfvSGIX_remap_index, -1 }, + { FragmentLightfvSGIX_names, FragmentLightfvSGIX_remap_index, -1 }, + { FragmentLightfSGIX_names, FragmentLightfSGIX_remap_index, -1 }, + { GetFragmentLightfvSGIX_names, GetFragmentLightfvSGIX_remap_index, -1 }, + { FragmentMaterialivSGIX_names, FragmentMaterialivSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_framezoom) +static const struct dri_extension_function GL_SGIX_framezoom_functions[] = { + { FrameZoomSGIX_names, FrameZoomSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_igloo_interface) +static const struct dri_extension_function GL_SGIX_igloo_interface_functions[] = { + { IglooInterfaceSGIX_names, IglooInterfaceSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_instruments) +static const struct dri_extension_function GL_SGIX_instruments_functions[] = { + { ReadInstrumentsSGIX_names, ReadInstrumentsSGIX_remap_index, -1 }, + { PollInstrumentsSGIX_names, PollInstrumentsSGIX_remap_index, -1 }, + { GetInstrumentsSGIX_names, GetInstrumentsSGIX_remap_index, -1 }, + { StartInstrumentsSGIX_names, StartInstrumentsSGIX_remap_index, -1 }, + { StopInstrumentsSGIX_names, StopInstrumentsSGIX_remap_index, -1 }, + { InstrumentsBufferSGIX_names, InstrumentsBufferSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const struct dri_extension_function GL_SGIX_list_priority_functions[] = { + { ListParameterfSGIX_names, ListParameterfSGIX_remap_index, -1 }, + { GetListParameterfvSGIX_names, GetListParameterfvSGIX_remap_index, -1 }, + { ListParameteriSGIX_names, ListParameteriSGIX_remap_index, -1 }, + { ListParameterfvSGIX_names, ListParameterfvSGIX_remap_index, -1 }, + { ListParameterivSGIX_names, ListParameterivSGIX_remap_index, -1 }, + { GetListParameterivSGIX_names, GetListParameterivSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_pixel_texture) +static const struct dri_extension_function GL_SGIX_pixel_texture_functions[] = { + { PixelTexGenSGIX_names, PixelTexGenSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_polynomial_ffd) +static const struct dri_extension_function GL_SGIX_polynomial_ffd_functions[] = { + { LoadIdentityDeformationMapSGIX_names, LoadIdentityDeformationMapSGIX_remap_index, -1 }, + { DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 }, + { DeformSGIX_names, DeformSGIX_remap_index, -1 }, + { DeformationMap3fSGIX_names, DeformationMap3fSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_reference_plane) +static const struct dri_extension_function GL_SGIX_reference_plane_functions[] = { + { ReferencePlaneSGIX_names, ReferencePlaneSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_sprite) +static const struct dri_extension_function GL_SGIX_sprite_functions[] = { + { SpriteParameterfvSGIX_names, SpriteParameterfvSGIX_remap_index, -1 }, + { SpriteParameteriSGIX_names, SpriteParameteriSGIX_remap_index, -1 }, + { SpriteParameterfSGIX_names, SpriteParameterfSGIX_remap_index, -1 }, + { SpriteParameterivSGIX_names, SpriteParameterivSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_tag_sample_buffer) +static const struct dri_extension_function GL_SGIX_tag_sample_buffer_functions[] = { + { TagSampleBufferSGIX_names, TagSampleBufferSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGI_color_table) +static const struct dri_extension_function GL_SGI_color_table_functions[] = { + { ColorTableParameteriv_names, -1, 341 }, + { ColorTable_names, -1, 339 }, + { GetColorTable_names, -1, 343 }, + { CopyColorTable_names, -1, 342 }, + { ColorTableParameterfv_names, -1, 340 }, + { GetColorTableParameterfv_names, -1, 344 }, + { GetColorTableParameteriv_names, -1, 345 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SUNX_constant_data) +static const struct dri_extension_function GL_SUNX_constant_data_functions[] = { + { FinishTextureSUNX_names, FinishTextureSUNX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const struct dri_extension_function GL_SUN_global_alpha_functions[] = { + { GlobalAlphaFactorubSUN_names, GlobalAlphaFactorubSUN_remap_index, -1 }, + { GlobalAlphaFactoriSUN_names, GlobalAlphaFactoriSUN_remap_index, -1 }, + { GlobalAlphaFactordSUN_names, GlobalAlphaFactordSUN_remap_index, -1 }, + { GlobalAlphaFactoruiSUN_names, GlobalAlphaFactoruiSUN_remap_index, -1 }, + { GlobalAlphaFactorbSUN_names, GlobalAlphaFactorbSUN_remap_index, -1 }, + { GlobalAlphaFactorfSUN_names, GlobalAlphaFactorfSUN_remap_index, -1 }, + { GlobalAlphaFactorusSUN_names, GlobalAlphaFactorusSUN_remap_index, -1 }, + { GlobalAlphaFactorsSUN_names, GlobalAlphaFactorsSUN_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SUN_mesh_array) +static const struct dri_extension_function GL_SUN_mesh_array_functions[] = { + { DrawMeshArraysSUN_names, DrawMeshArraysSUN_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const struct dri_extension_function GL_SUN_triangle_list_functions[] = { + { ReplacementCodeubSUN_names, ReplacementCodeubSUN_remap_index, -1 }, + { ReplacementCodeubvSUN_names, ReplacementCodeubvSUN_remap_index, -1 }, + { ReplacementCodeusvSUN_names, ReplacementCodeusvSUN_remap_index, -1 }, + { ReplacementCodePointerSUN_names, ReplacementCodePointerSUN_remap_index, -1 }, + { ReplacementCodeusSUN_names, ReplacementCodeusSUN_remap_index, -1 }, + { ReplacementCodeuiSUN_names, ReplacementCodeuiSUN_remap_index, -1 }, + { ReplacementCodeuivSUN_names, ReplacementCodeuivSUN_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SUN_vertex) +static const struct dri_extension_function GL_SUN_vertex_functions[] = { + { ReplacementCodeuiColor3fVertex3fvSUN_names, ReplacementCodeuiColor3fVertex3fvSUN_remap_index, -1 }, + { TexCoord4fColor4fNormal3fVertex4fvSUN_names, TexCoord4fColor4fNormal3fVertex4fvSUN_remap_index, -1 }, + { TexCoord2fColor4ubVertex3fvSUN_names, TexCoord2fColor4ubVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiVertex3fvSUN_names, ReplacementCodeuiVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiTexCoord2fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiNormal3fVertex3fSUN_names, ReplacementCodeuiNormal3fVertex3fSUN_remap_index, -1 }, + { Color4ubVertex3fvSUN_names, Color4ubVertex3fvSUN_remap_index, -1 }, + { Color4ubVertex3fSUN_names, Color4ubVertex3fSUN_remap_index, -1 }, + { TexCoord2fVertex3fSUN_names, TexCoord2fVertex3fSUN_remap_index, -1 }, + { TexCoord2fColor4fNormal3fVertex3fSUN_names, TexCoord2fColor4fNormal3fVertex3fSUN_remap_index, -1 }, + { TexCoord2fNormal3fVertex3fvSUN_names, TexCoord2fNormal3fVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_names, ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_remap_index, -1 }, + { ReplacementCodeuiTexCoord2fVertex3fSUN_names, ReplacementCodeuiTexCoord2fVertex3fSUN_remap_index, -1 }, + { TexCoord2fNormal3fVertex3fSUN_names, TexCoord2fNormal3fVertex3fSUN_remap_index, -1 }, + { Color3fVertex3fSUN_names, Color3fVertex3fSUN_remap_index, -1 }, + { Color3fVertex3fvSUN_names, Color3fVertex3fvSUN_remap_index, -1 }, + { Color4fNormal3fVertex3fvSUN_names, Color4fNormal3fVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiColor4fNormal3fVertex3fvSUN_names, ReplacementCodeuiColor4fNormal3fVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_remap_index, -1 }, + { TexCoord2fColor3fVertex3fSUN_names, TexCoord2fColor3fVertex3fSUN_remap_index, -1 }, + { TexCoord4fColor4fNormal3fVertex4fSUN_names, TexCoord4fColor4fNormal3fVertex4fSUN_remap_index, -1 }, + { Color4ubVertex2fvSUN_names, Color4ubVertex2fvSUN_remap_index, -1 }, + { Normal3fVertex3fSUN_names, Normal3fVertex3fSUN_remap_index, -1 }, + { ReplacementCodeuiColor4fNormal3fVertex3fSUN_names, ReplacementCodeuiColor4fNormal3fVertex3fSUN_remap_index, -1 }, + { TexCoord2fColor4fNormal3fVertex3fvSUN_names, TexCoord2fColor4fNormal3fVertex3fvSUN_remap_index, -1 }, + { TexCoord2fVertex3fvSUN_names, TexCoord2fVertex3fvSUN_remap_index, -1 }, + { Color4ubVertex2fSUN_names, Color4ubVertex2fSUN_remap_index, -1 }, + { ReplacementCodeuiColor4ubVertex3fSUN_names, ReplacementCodeuiColor4ubVertex3fSUN_remap_index, -1 }, + { TexCoord2fColor4ubVertex3fSUN_names, TexCoord2fColor4ubVertex3fSUN_remap_index, -1 }, + { Normal3fVertex3fvSUN_names, Normal3fVertex3fvSUN_remap_index, -1 }, + { Color4fNormal3fVertex3fSUN_names, Color4fNormal3fVertex3fSUN_remap_index, -1 }, + { ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_names, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_remap_index, -1 }, + { ReplacementCodeuiColor4ubVertex3fvSUN_names, ReplacementCodeuiColor4ubVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiColor3fVertex3fSUN_names, ReplacementCodeuiColor3fVertex3fSUN_remap_index, -1 }, + { TexCoord4fVertex4fSUN_names, TexCoord4fVertex4fSUN_remap_index, -1 }, + { TexCoord2fColor3fVertex3fvSUN_names, TexCoord2fColor3fVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiNormal3fVertex3fvSUN_names, ReplacementCodeuiNormal3fVertex3fvSUN_remap_index, -1 }, + { TexCoord4fVertex4fvSUN_names, TexCoord4fVertex4fvSUN_remap_index, -1 }, + { ReplacementCodeuiVertex3fSUN_names, ReplacementCodeuiVertex3fSUN_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_VERSION_1_3) +static const struct dri_extension_function GL_VERSION_1_3_functions[] = { + { SampleCoverageARB_names, SampleCoverageARB_remap_index, -1 }, + { MultiTexCoord3sARB_names, -1, 398 }, + { ActiveTextureARB_names, -1, 374 }, + { CompressedTexSubImage2DARB_names, CompressedTexSubImage2DARB_remap_index, -1 }, + { CompressedTexImage3DARB_names, CompressedTexImage3DARB_remap_index, -1 }, + { MultiTexCoord1fvARB_names, -1, 379 }, + { MultTransposeMatrixdARB_names, MultTransposeMatrixdARB_remap_index, -1 }, + { CompressedTexImage1DARB_names, CompressedTexImage1DARB_remap_index, -1 }, + { MultiTexCoord3dARB_names, -1, 392 }, + { MultiTexCoord2iARB_names, -1, 388 }, + { MultiTexCoord2svARB_names, -1, 391 }, + { MultiTexCoord2fARB_names, -1, 386 }, + { LoadTransposeMatrixdARB_names, LoadTransposeMatrixdARB_remap_index, -1 }, + { MultiTexCoord3fvARB_names, -1, 395 }, + { MultiTexCoord4sARB_names, -1, 406 }, + { MultiTexCoord2dvARB_names, -1, 385 }, + { MultiTexCoord1svARB_names, -1, 383 }, + { MultiTexCoord3svARB_names, -1, 399 }, + { MultiTexCoord4iARB_names, -1, 404 }, + { MultiTexCoord3iARB_names, -1, 396 }, + { MultiTexCoord1dARB_names, -1, 376 }, + { MultiTexCoord3dvARB_names, -1, 393 }, + { MultiTexCoord3ivARB_names, -1, 397 }, + { MultiTexCoord2sARB_names, -1, 390 }, + { MultiTexCoord4ivARB_names, -1, 405 }, + { CompressedTexSubImage1DARB_names, CompressedTexSubImage1DARB_remap_index, -1 }, + { ClientActiveTextureARB_names, -1, 375 }, + { CompressedTexSubImage3DARB_names, CompressedTexSubImage3DARB_remap_index, -1 }, + { MultiTexCoord2dARB_names, -1, 384 }, + { MultiTexCoord4dvARB_names, -1, 401 }, + { MultiTexCoord4fvARB_names, -1, 403 }, + { MultiTexCoord3fARB_names, -1, 394 }, + { MultTransposeMatrixfARB_names, MultTransposeMatrixfARB_remap_index, -1 }, + { CompressedTexImage2DARB_names, CompressedTexImage2DARB_remap_index, -1 }, + { MultiTexCoord4dARB_names, -1, 400 }, + { MultiTexCoord1sARB_names, -1, 382 }, + { MultiTexCoord1dvARB_names, -1, 377 }, + { MultiTexCoord1ivARB_names, -1, 381 }, + { MultiTexCoord2ivARB_names, -1, 389 }, + { MultiTexCoord1iARB_names, -1, 380 }, + { GetCompressedTexImageARB_names, GetCompressedTexImageARB_remap_index, -1 }, + { MultiTexCoord4svARB_names, -1, 407 }, + { MultiTexCoord1fARB_names, -1, 378 }, + { MultiTexCoord4fARB_names, -1, 402 }, + { LoadTransposeMatrixfARB_names, LoadTransposeMatrixfARB_remap_index, -1 }, + { MultiTexCoord2fvARB_names, -1, 387 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_VERSION_1_4) +static const struct dri_extension_function GL_VERSION_1_4_functions[] = { + { PointParameteriNV_names, PointParameteriNV_remap_index, -1 }, + { SecondaryColor3iEXT_names, SecondaryColor3iEXT_remap_index, -1 }, + { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, -1 }, + { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, -1 }, + { SecondaryColor3bEXT_names, SecondaryColor3bEXT_remap_index, -1 }, + { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 }, + { FogCoorddEXT_names, FogCoorddEXT_remap_index, -1 }, + { FogCoordfEXT_names, FogCoordfEXT_remap_index, -1 }, + { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, -1 }, + { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, -1 }, + { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 }, + { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, -1 }, + { SecondaryColor3bvEXT_names, SecondaryColor3bvEXT_remap_index, -1 }, + { SecondaryColor3sEXT_names, SecondaryColor3sEXT_remap_index, -1 }, + { SecondaryColor3dEXT_names, SecondaryColor3dEXT_remap_index, -1 }, + { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, -1 }, + { SecondaryColorPointerEXT_names, SecondaryColorPointerEXT_remap_index, -1 }, + { SecondaryColor3uiEXT_names, SecondaryColor3uiEXT_remap_index, -1 }, + { SecondaryColor3usvEXT_names, SecondaryColor3usvEXT_remap_index, -1 }, + { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, -1 }, + { PointParameterivNV_names, PointParameterivNV_remap_index, -1 }, + { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, -1 }, + { SecondaryColor3ivEXT_names, SecondaryColor3ivEXT_remap_index, -1 }, + { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, -1 }, + { SecondaryColor3fvEXT_names, SecondaryColor3fvEXT_remap_index, -1 }, + { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, -1 }, + { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, -1 }, + { MultiDrawElementsEXT_names, MultiDrawElementsEXT_remap_index, -1 }, + { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, -1 }, + { FogCoordPointerEXT_names, FogCoordPointerEXT_remap_index, -1 }, + { SecondaryColor3ubvEXT_names, SecondaryColor3ubvEXT_remap_index, -1 }, + { SecondaryColor3uivEXT_names, SecondaryColor3uivEXT_remap_index, -1 }, + { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, -1 }, + { SecondaryColor3dvEXT_names, SecondaryColor3dvEXT_remap_index, -1 }, + { MultiDrawArraysEXT_names, MultiDrawArraysEXT_remap_index, -1 }, + { SecondaryColor3usEXT_names, SecondaryColor3usEXT_remap_index, -1 }, + { FogCoordfvEXT_names, FogCoordfvEXT_remap_index, -1 }, + { SecondaryColor3ubEXT_names, SecondaryColor3ubEXT_remap_index, -1 }, + { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, -1 }, + { SecondaryColor3fEXT_names, SecondaryColor3fEXT_remap_index, -1 }, + { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, -1 }, + { SecondaryColor3svEXT_names, SecondaryColor3svEXT_remap_index, -1 }, + { FogCoorddvEXT_names, FogCoorddvEXT_remap_index, -1 }, + { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, -1 }, + { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_VERSION_1_5) +static const struct dri_extension_function GL_VERSION_1_5_functions[] = { + { BeginQueryARB_names, BeginQueryARB_remap_index, -1 }, + { GetBufferSubDataARB_names, GetBufferSubDataARB_remap_index, -1 }, + { BufferSubDataARB_names, BufferSubDataARB_remap_index, -1 }, + { GetQueryivARB_names, GetQueryivARB_remap_index, -1 }, + { GetQueryObjectivARB_names, GetQueryObjectivARB_remap_index, -1 }, + { BufferDataARB_names, BufferDataARB_remap_index, -1 }, + { EndQueryARB_names, EndQueryARB_remap_index, -1 }, + { GetBufferPointervARB_names, GetBufferPointervARB_remap_index, -1 }, + { GetQueryObjectuivARB_names, GetQueryObjectuivARB_remap_index, -1 }, + { GetBufferParameterivARB_names, GetBufferParameterivARB_remap_index, -1 }, + { DeleteQueriesARB_names, DeleteQueriesARB_remap_index, -1 }, + { IsQueryARB_names, IsQueryARB_remap_index, -1 }, + { MapBufferARB_names, MapBufferARB_remap_index, -1 }, + { GenQueriesARB_names, GenQueriesARB_remap_index, -1 }, + { IsBufferARB_names, IsBufferARB_remap_index, -1 }, + { DeleteBuffersARB_names, DeleteBuffersARB_remap_index, -1 }, + { UnmapBufferARB_names, UnmapBufferARB_remap_index, -1 }, + { BindBufferARB_names, BindBufferARB_remap_index, -1 }, + { GenBuffersARB_names, GenBuffersARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_VERSION_2_0) +static const struct dri_extension_function GL_VERSION_2_0_functions[] = { + { UniformMatrix3fvARB_names, UniformMatrix3fvARB_remap_index, -1 }, + { GetProgramiv_names, GetProgramiv_remap_index, -1 }, + { BlendEquationSeparateEXT_names, BlendEquationSeparateEXT_remap_index, -1 }, + { AttachShader_names, AttachShader_remap_index, -1 }, + { VertexAttrib2fARB_names, VertexAttrib2fARB_remap_index, -1 }, + { VertexAttrib3fARB_names, VertexAttrib3fARB_remap_index, -1 }, + { Uniform2fARB_names, Uniform2fARB_remap_index, -1 }, + { VertexAttrib1svARB_names, VertexAttrib1svARB_remap_index, -1 }, + { Uniform2ivARB_names, Uniform2ivARB_remap_index, -1 }, + { UniformMatrix4fvARB_names, UniformMatrix4fvARB_remap_index, -1 }, + { VertexAttrib4NusvARB_names, VertexAttrib4NusvARB_remap_index, -1 }, + { DisableVertexAttribArrayARB_names, DisableVertexAttribArrayARB_remap_index, -1 }, + { StencilMaskSeparate_names, StencilMaskSeparate_remap_index, -1 }, + { VertexAttrib1fARB_names, VertexAttrib1fARB_remap_index, -1 }, + { GetProgramInfoLog_names, GetProgramInfoLog_remap_index, -1 }, + { VertexAttrib4NbvARB_names, VertexAttrib4NbvARB_remap_index, -1 }, + { GetActiveAttribARB_names, GetActiveAttribARB_remap_index, -1 }, + { Uniform3iARB_names, Uniform3iARB_remap_index, -1 }, + { GetShaderInfoLog_names, GetShaderInfoLog_remap_index, -1 }, + { VertexAttrib1sARB_names, VertexAttrib1sARB_remap_index, -1 }, + { Uniform1fARB_names, Uniform1fARB_remap_index, -1 }, + { StencilOpSeparate_names, StencilOpSeparate_remap_index, -1 }, + { UniformMatrix2fvARB_names, UniformMatrix2fvARB_remap_index, -1 }, + { VertexAttrib3dvARB_names, VertexAttrib3dvARB_remap_index, -1 }, + { Uniform3fvARB_names, Uniform3fvARB_remap_index, -1 }, + { GetVertexAttribivARB_names, GetVertexAttribivARB_remap_index, -1 }, + { CreateProgram_names, CreateProgram_remap_index, -1 }, + { StencilFuncSeparate_names, StencilFuncSeparate_remap_index, -1 }, + { VertexAttrib4ivARB_names, VertexAttrib4ivARB_remap_index, -1 }, + { VertexAttrib4bvARB_names, VertexAttrib4bvARB_remap_index, -1 }, + { VertexAttrib3dARB_names, VertexAttrib3dARB_remap_index, -1 }, + { VertexAttrib4fARB_names, VertexAttrib4fARB_remap_index, -1 }, + { VertexAttrib4fvARB_names, VertexAttrib4fvARB_remap_index, -1 }, + { GetActiveUniformARB_names, GetActiveUniformARB_remap_index, -1 }, + { IsShader_names, IsShader_remap_index, -1 }, + { GetUniformivARB_names, GetUniformivARB_remap_index, -1 }, + { IsProgram_names, IsProgram_remap_index, -1 }, + { Uniform2fvARB_names, Uniform2fvARB_remap_index, -1 }, + { ValidateProgramARB_names, ValidateProgramARB_remap_index, -1 }, + { VertexAttrib2dARB_names, VertexAttrib2dARB_remap_index, -1 }, + { VertexAttrib1dvARB_names, VertexAttrib1dvARB_remap_index, -1 }, + { GetVertexAttribfvARB_names, GetVertexAttribfvARB_remap_index, -1 }, + { GetAttribLocationARB_names, GetAttribLocationARB_remap_index, -1 }, + { VertexAttrib4ubvARB_names, VertexAttrib4ubvARB_remap_index, -1 }, + { Uniform3ivARB_names, Uniform3ivARB_remap_index, -1 }, + { VertexAttrib4sARB_names, VertexAttrib4sARB_remap_index, -1 }, + { VertexAttrib2dvARB_names, VertexAttrib2dvARB_remap_index, -1 }, + { VertexAttrib2fvARB_names, VertexAttrib2fvARB_remap_index, -1 }, + { VertexAttrib4NivARB_names, VertexAttrib4NivARB_remap_index, -1 }, + { GetAttachedShaders_names, GetAttachedShaders_remap_index, -1 }, + { CompileShaderARB_names, CompileShaderARB_remap_index, -1 }, + { DeleteShader_names, DeleteShader_remap_index, -1 }, + { Uniform3fARB_names, Uniform3fARB_remap_index, -1 }, + { VertexAttrib4NuivARB_names, VertexAttrib4NuivARB_remap_index, -1 }, + { Uniform4fARB_names, Uniform4fARB_remap_index, -1 }, + { VertexAttrib1dARB_names, VertexAttrib1dARB_remap_index, -1 }, + { VertexAttrib4usvARB_names, VertexAttrib4usvARB_remap_index, -1 }, + { LinkProgramARB_names, LinkProgramARB_remap_index, -1 }, + { ShaderSourceARB_names, ShaderSourceARB_remap_index, -1 }, + { VertexAttrib3svARB_names, VertexAttrib3svARB_remap_index, -1 }, + { Uniform4ivARB_names, Uniform4ivARB_remap_index, -1 }, + { GetVertexAttribdvARB_names, GetVertexAttribdvARB_remap_index, -1 }, + { Uniform1ivARB_names, Uniform1ivARB_remap_index, -1 }, + { VertexAttrib4dvARB_names, VertexAttrib4dvARB_remap_index, -1 }, + { BindAttribLocationARB_names, BindAttribLocationARB_remap_index, -1 }, + { Uniform1iARB_names, Uniform1iARB_remap_index, -1 }, + { VertexAttribPointerARB_names, VertexAttribPointerARB_remap_index, -1 }, + { VertexAttrib4NsvARB_names, VertexAttrib4NsvARB_remap_index, -1 }, + { VertexAttrib3fvARB_names, VertexAttrib3fvARB_remap_index, -1 }, + { CreateShader_names, CreateShader_remap_index, -1 }, + { DetachShader_names, DetachShader_remap_index, -1 }, + { VertexAttrib4NubARB_names, VertexAttrib4NubARB_remap_index, -1 }, + { Uniform4fvARB_names, Uniform4fvARB_remap_index, -1 }, + { GetUniformfvARB_names, GetUniformfvARB_remap_index, -1 }, + { Uniform4iARB_names, Uniform4iARB_remap_index, -1 }, + { UseProgramObjectARB_names, UseProgramObjectARB_remap_index, -1 }, + { DeleteProgram_names, DeleteProgram_remap_index, -1 }, + { GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, -1 }, + { Uniform2iARB_names, Uniform2iARB_remap_index, -1 }, + { VertexAttrib4dARB_names, VertexAttrib4dARB_remap_index, -1 }, + { GetUniformLocationARB_names, GetUniformLocationARB_remap_index, -1 }, + { VertexAttrib3sARB_names, VertexAttrib3sARB_remap_index, -1 }, + { GetShaderSourceARB_names, GetShaderSourceARB_remap_index, -1 }, + { DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 }, + { Uniform1fvARB_names, Uniform1fvARB_remap_index, -1 }, + { EnableVertexAttribArrayARB_names, EnableVertexAttribArrayARB_remap_index, -1 }, + { VertexAttrib4uivARB_names, VertexAttrib4uivARB_remap_index, -1 }, + { VertexAttrib4svARB_names, VertexAttrib4svARB_remap_index, -1 }, + { GetShaderiv_names, GetShaderiv_remap_index, -1 }, + { VertexAttrib2svARB_names, VertexAttrib2svARB_remap_index, -1 }, + { VertexAttrib4NubvARB_names, VertexAttrib4NubvARB_remap_index, -1 }, + { VertexAttrib2sARB_names, VertexAttrib2sARB_remap_index, -1 }, + { VertexAttrib1fvARB_names, VertexAttrib1fvARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_VERSION_2_1) +static const struct dri_extension_function GL_VERSION_2_1_functions[] = { + { UniformMatrix2x4fv_names, UniformMatrix2x4fv_remap_index, -1 }, + { UniformMatrix4x3fv_names, UniformMatrix4x3fv_remap_index, -1 }, + { UniformMatrix4x2fv_names, UniformMatrix4x2fv_remap_index, -1 }, + { UniformMatrix2x3fv_names, UniformMatrix2x3fv_remap_index, -1 }, + { UniformMatrix3x4fv_names, UniformMatrix3x4fv_remap_index, -1 }, + { UniformMatrix3x2fv_names, UniformMatrix3x2fv_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + diff --git a/mesalib/src/mesa/drivers/dri/common/memops.h b/mesalib/src/mesa/drivers/dri/common/memops.h new file mode 100644 index 000000000..9cd1d8ec3 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/memops.h @@ -0,0 +1,17 @@ +#ifndef DRIMEMSETIO_H +#define DRIMEMSETIO_H +/* +* memset an area in I/O space +* We need to be careful about this on some archs +*/ +static INLINE void drimemsetio(void* address, int c, int size) +{ +#if defined(__powerpc__) || defined(__ia64__) + int i; + for(i=0;i + */ + + +#ifndef MMIO_H +#define MMIO_H + +#include "main/glheader.h" + +#if defined( __powerpc__ ) + +static INLINE uint32_t +read_MMIO_LE32( volatile void * base, unsigned long offset ) +{ + uint32_t val; + + __asm__ __volatile__( "lwbrx %0, %1, %2 ; eieio" + : "=r" (val) + : "b" (base), "r" (offset) ); + return val; +} + +#else + +static INLINE uint32_t +read_MMIO_LE32( volatile void * base, unsigned long offset ) +{ + volatile uint32_t * p = (volatile uint32_t *) (((volatile char *) base) + offset); + return LE32_TO_CPU( p[0] ); +} + +#endif + +#endif /* MMIO_H */ diff --git a/mesalib/src/mesa/drivers/dri/common/mmx.h b/mesalib/src/mesa/drivers/dri/common/mmx.h new file mode 100644 index 000000000..49ce7e3e3 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/mmx.h @@ -0,0 +1,560 @@ +/* mmx.h + + MultiMedia eXtensions GCC interface library for IA32. + + To use this library, simply include this header file + and compile with GCC. You MUST have inlining enabled + in order for mmx_ok() to work; this can be done by + simply using -O on the GCC command line. + + Compiling with -DMMX_TRACE will cause detailed trace + output to be sent to stderr for each mmx operation. + This adds lots of code, and obviously slows execution to + a crawl, but can be very useful for debugging. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT + LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR ANY PARTICULAR PURPOSE. + + 1997-98 by H. Dietz and R. Fisher + + History: + 97-98* R.Fisher Early versions + 980501 R.Fisher Original Release + 980611* H.Dietz Rewrite, correctly implementing inlines, and + R.Fisher including direct register accesses. + 980616 R.Fisher Release of 980611 as 980616. + 980714 R.Fisher Minor corrections to Makefile, etc. + 980715 R.Fisher mmx_ok() now prevents optimizer from using + clobbered values. + mmx_ok() now checks if cpuid instruction is + available before trying to use it. + 980726* R.Fisher mm_support() searches for AMD 3DNow, Cyrix + Extended MMX, and standard MMX. It returns a + value which is positive if any of these are + supported, and can be masked with constants to + see which. mmx_ok() is now a call to this + 980726* R.Fisher Added i2r support for shift functions + 980919 R.Fisher Fixed AMD extended feature recognition bug. + 980921 R.Fisher Added definition/check for _MMX_H. + Added "float s[2]" to mmx_t for use with + 3DNow and EMMX. So same mmx_t can be used. + 981013 R.Fisher Fixed cpuid function 1 bug (looked at wrong reg) + Fixed psllq_i2r error in mmxtest.c + + * Unreleased (internal or interim) versions + + Notes: + It appears that the latest gas has the pand problem fixed, therefore + I'll undefine BROKEN_PAND by default. + String compares may be quicker than the multiple test/jumps in vendor + test sequence in mmx_ok(), but I'm not concerned with that right now. + + Acknowledgments: + Jussi Laako for pointing out the errors ultimately found to be + connected to the failure to notify the optimizer of clobbered values. + Roger Hardiman for reminding us that CPUID isn't everywhere, and that + someone may actually try to use this on a machine without CPUID. + Also for suggesting code for checking this. + Robert Dale for pointing out the AMD recognition bug. + Jimmy Mayfield and Carl Witty for pointing out the Intel recognition + bug. + Carl Witty for pointing out the psllq_i2r test bug. +*/ + +#ifndef _MMX_H +#define _MMX_H + +//#define MMX_TRACE + +/* Warning: at this writing, the version of GAS packaged + with most Linux distributions does not handle the + parallel AND operation mnemonic correctly. If the + symbol BROKEN_PAND is defined, a slower alternative + coding will be used. If execution of mmxtest results + in an illegal instruction fault, define this symbol. +*/ +#undef BROKEN_PAND + + +/* The type of an value that fits in an MMX register + (note that long long constant values MUST be suffixed + by LL and unsigned long long values by ULL, lest + they be truncated by the compiler) +*/ +typedef union { + long long q; /* Quadword (64-bit) value */ + unsigned long long uq; /* Unsigned Quadword */ + int d[2]; /* 2 Doubleword (32-bit) values */ + unsigned int ud[2]; /* 2 Unsigned Doubleword */ + short w[4]; /* 4 Word (16-bit) values */ + unsigned short uw[4]; /* 4 Unsigned Word */ + char b[8]; /* 8 Byte (8-bit) values */ + unsigned char ub[8]; /* 8 Unsigned Byte */ + float s[2]; /* Single-precision (32-bit) value */ +} mmx_t; + +/* Helper functions for the instruction macros that follow... + (note that memory-to-register, m2r, instructions are nearly + as efficient as register-to-register, r2r, instructions; + however, memory-to-memory instructions are really simulated + as a convenience, and are only 1/3 as efficient) +*/ +#ifdef MMX_TRACE + +/* Include the stuff for printing a trace to stderr... +*/ + +#include + +#define mmx_i2r(op, imm, reg) \ + { \ + mmx_t mmx_trace; \ + mmx_trace = (imm); \ + fprintf(stderr, #op "_i2r(" #imm "=0x%016llx, ", mmx_trace.q); \ + __asm__ __volatile__ ("movq %%" #reg ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #reg "=0x%016llx) => ", mmx_trace.q); \ + __asm__ __volatile__ (#op " %0, %%" #reg \ + : /* nothing */ \ + : "X" (imm)); \ + __asm__ __volatile__ ("movq %%" #reg ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #reg "=0x%016llx\n", mmx_trace.q); \ + } + +#define mmx_m2r(op, mem, reg) \ + { \ + mmx_t mmx_trace; \ + mmx_trace = (mem); \ + fprintf(stderr, #op "_m2r(" #mem "=0x%016llx, ", mmx_trace.q); \ + __asm__ __volatile__ ("movq %%" #reg ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #reg "=0x%016llx) => ", mmx_trace.q); \ + __asm__ __volatile__ (#op " %0, %%" #reg \ + : /* nothing */ \ + : "X" (mem)); \ + __asm__ __volatile__ ("movq %%" #reg ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #reg "=0x%016llx\n", mmx_trace.q); \ + } + +#define mmx_r2m(op, reg, mem) \ + { \ + mmx_t mmx_trace; \ + __asm__ __volatile__ ("movq %%" #reg ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #op "_r2m(" #reg "=0x%016llx, ", mmx_trace.q); \ + mmx_trace = (mem); \ + fprintf(stderr, #mem "=0x%016llx) => ", mmx_trace.q); \ + __asm__ __volatile__ (#op " %%" #reg ", %0" \ + : "=X" (mem) \ + : /* nothing */ ); \ + mmx_trace = (mem); \ + fprintf(stderr, #mem "=0x%016llx\n", mmx_trace.q); \ + } + +#define mmx_r2r(op, regs, regd) \ + { \ + mmx_t mmx_trace; \ + __asm__ __volatile__ ("movq %%" #regs ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #op "_r2r(" #regs "=0x%016llx, ", mmx_trace.q); \ + __asm__ __volatile__ ("movq %%" #regd ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #regd "=0x%016llx) => ", mmx_trace.q); \ + __asm__ __volatile__ (#op " %" #regs ", %" #regd); \ + __asm__ __volatile__ ("movq %%" #regd ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #regd "=0x%016llx\n", mmx_trace.q); \ + } + +#define mmx_m2m(op, mems, memd) \ + { \ + mmx_t mmx_trace; \ + mmx_trace = (mems); \ + fprintf(stderr, #op "_m2m(" #mems "=0x%016llx, ", mmx_trace.q); \ + mmx_trace = (memd); \ + fprintf(stderr, #memd "=0x%016llx) => ", mmx_trace.q); \ + __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ + #op " %1, %%mm0\n\t" \ + "movq %%mm0, %0" \ + : "=X" (memd) \ + : "X" (mems)); \ + mmx_trace = (memd); \ + fprintf(stderr, #memd "=0x%016llx\n", mmx_trace.q); \ + } + +#else + +/* These macros are a lot simpler without the tracing... +*/ + +#define mmx_i2r(op, imm, reg) \ + __asm__ __volatile__ (#op " $" #imm ", %%" #reg \ + : /* nothing */ \ + : /* nothing */); + +#define mmx_m2r(op, mem, reg) \ + __asm__ __volatile__ (#op " %0, %%" #reg \ + : /* nothing */ \ + : "X" (mem)) + +#define mmx_r2m(op, reg, mem) \ + __asm__ __volatile__ (#op " %%" #reg ", %0" \ + : "=X" (mem) \ + : /* nothing */ ) + +#define mmx_r2r(op, regs, regd) \ + __asm__ __volatile__ (#op " %" #regs ", %" #regd) + +#define mmx_m2m(op, mems, memd) \ + __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ + #op " %1, %%mm0\n\t" \ + "movq %%mm0, %0" \ + : "=X" (memd) \ + : "X" (mems)) + +#endif + + +/* 1x64 MOVe Quadword + (this is both a load and a store... + in fact, it is the only way to store) +*/ +#define movq_m2r(var, reg) mmx_m2r(movq, var, reg) +#define movq_r2m(reg, var) mmx_r2m(movq, reg, var) +#define movq_r2r(regs, regd) mmx_r2r(movq, regs, regd) +#define movq(vars, vard) \ + __asm__ __volatile__ ("movq %1, %%mm0\n\t" \ + "movq %%mm0, %0" \ + : "=X" (vard) \ + : "X" (vars)) + + +/* 1x32 MOVe Doubleword + (like movq, this is both load and store... + but is most useful for moving things between + mmx registers and ordinary registers) +*/ +#define movd_m2r(var, reg) mmx_m2r(movd, var, reg) +#define movd_r2m(reg, var) mmx_r2m(movd, reg, var) +#define movd_r2r(regs, regd) mmx_r2r(movd, regs, regd) +#define movd(vars, vard) \ + __asm__ __volatile__ ("movd %1, %%mm0\n\t" \ + "movd %%mm0, %0" \ + : "=X" (vard) \ + : "X" (vars)) + + +/* 2x32, 4x16, and 8x8 Parallel ADDs +*/ +#define paddd_m2r(var, reg) mmx_m2r(paddd, var, reg) +#define paddd_r2r(regs, regd) mmx_r2r(paddd, regs, regd) +#define paddd(vars, vard) mmx_m2m(paddd, vars, vard) + +#define paddw_m2r(var, reg) mmx_m2r(paddw, var, reg) +#define paddw_r2r(regs, regd) mmx_r2r(paddw, regs, regd) +#define paddw(vars, vard) mmx_m2m(paddw, vars, vard) + +#define paddb_m2r(var, reg) mmx_m2r(paddb, var, reg) +#define paddb_r2r(regs, regd) mmx_r2r(paddb, regs, regd) +#define paddb(vars, vard) mmx_m2m(paddb, vars, vard) + + +/* 4x16 and 8x8 Parallel ADDs using Saturation arithmetic +*/ +#define paddsw_m2r(var, reg) mmx_m2r(paddsw, var, reg) +#define paddsw_r2r(regs, regd) mmx_r2r(paddsw, regs, regd) +#define paddsw(vars, vard) mmx_m2m(paddsw, vars, vard) + +#define paddsb_m2r(var, reg) mmx_m2r(paddsb, var, reg) +#define paddsb_r2r(regs, regd) mmx_r2r(paddsb, regs, regd) +#define paddsb(vars, vard) mmx_m2m(paddsb, vars, vard) + + +/* 4x16 and 8x8 Parallel ADDs using Unsigned Saturation arithmetic +*/ +#define paddusw_m2r(var, reg) mmx_m2r(paddusw, var, reg) +#define paddusw_r2r(regs, regd) mmx_r2r(paddusw, regs, regd) +#define paddusw(vars, vard) mmx_m2m(paddusw, vars, vard) + +#define paddusb_m2r(var, reg) mmx_m2r(paddusb, var, reg) +#define paddusb_r2r(regs, regd) mmx_r2r(paddusb, regs, regd) +#define paddusb(vars, vard) mmx_m2m(paddusb, vars, vard) + + +/* 2x32, 4x16, and 8x8 Parallel SUBs +*/ +#define psubd_m2r(var, reg) mmx_m2r(psubd, var, reg) +#define psubd_r2r(regs, regd) mmx_r2r(psubd, regs, regd) +#define psubd(vars, vard) mmx_m2m(psubd, vars, vard) + +#define psubw_m2r(var, reg) mmx_m2r(psubw, var, reg) +#define psubw_r2r(regs, regd) mmx_r2r(psubw, regs, regd) +#define psubw(vars, vard) mmx_m2m(psubw, vars, vard) + +#define psubb_m2r(var, reg) mmx_m2r(psubb, var, reg) +#define psubb_r2r(regs, regd) mmx_r2r(psubb, regs, regd) +#define psubb(vars, vard) mmx_m2m(psubb, vars, vard) + + +/* 4x16 and 8x8 Parallel SUBs using Saturation arithmetic +*/ +#define psubsw_m2r(var, reg) mmx_m2r(psubsw, var, reg) +#define psubsw_r2r(regs, regd) mmx_r2r(psubsw, regs, regd) +#define psubsw(vars, vard) mmx_m2m(psubsw, vars, vard) + +#define psubsb_m2r(var, reg) mmx_m2r(psubsb, var, reg) +#define psubsb_r2r(regs, regd) mmx_r2r(psubsb, regs, regd) +#define psubsb(vars, vard) mmx_m2m(psubsb, vars, vard) + + +/* 4x16 and 8x8 Parallel SUBs using Unsigned Saturation arithmetic +*/ +#define psubusw_m2r(var, reg) mmx_m2r(psubusw, var, reg) +#define psubusw_r2r(regs, regd) mmx_r2r(psubusw, regs, regd) +#define psubusw(vars, vard) mmx_m2m(psubusw, vars, vard) + +#define psubusb_m2r(var, reg) mmx_m2r(psubusb, var, reg) +#define psubusb_r2r(regs, regd) mmx_r2r(psubusb, regs, regd) +#define psubusb(vars, vard) mmx_m2m(psubusb, vars, vard) + + +/* 4x16 Parallel MULs giving Low 4x16 portions of results +*/ +#define pmullw_m2r(var, reg) mmx_m2r(pmullw, var, reg) +#define pmullw_r2r(regs, regd) mmx_r2r(pmullw, regs, regd) +#define pmullw(vars, vard) mmx_m2m(pmullw, vars, vard) + + +/* 4x16 Parallel MULs giving High 4x16 portions of results +*/ +#define pmulhw_m2r(var, reg) mmx_m2r(pmulhw, var, reg) +#define pmulhw_r2r(regs, regd) mmx_r2r(pmulhw, regs, regd) +#define pmulhw(vars, vard) mmx_m2m(pmulhw, vars, vard) + + +/* 4x16->2x32 Parallel Mul-ADD + (muls like pmullw, then adds adjacent 16-bit fields + in the multiply result to make the final 2x32 result) +*/ +#define pmaddwd_m2r(var, reg) mmx_m2r(pmaddwd, var, reg) +#define pmaddwd_r2r(regs, regd) mmx_r2r(pmaddwd, regs, regd) +#define pmaddwd(vars, vard) mmx_m2m(pmaddwd, vars, vard) + + +/* 1x64 bitwise AND +*/ +#ifdef BROKEN_PAND +#define pand_m2r(var, reg) \ + { \ + mmx_m2r(pandn, (mmx_t) -1LL, reg); \ + mmx_m2r(pandn, var, reg); \ + } +#define pand_r2r(regs, regd) \ + { \ + mmx_m2r(pandn, (mmx_t) -1LL, regd); \ + mmx_r2r(pandn, regs, regd) \ + } +#define pand(vars, vard) \ + { \ + movq_m2r(vard, mm0); \ + mmx_m2r(pandn, (mmx_t) -1LL, mm0); \ + mmx_m2r(pandn, vars, mm0); \ + movq_r2m(mm0, vard); \ + } +#else +#define pand_m2r(var, reg) mmx_m2r(pand, var, reg) +#define pand_r2r(regs, regd) mmx_r2r(pand, regs, regd) +#define pand(vars, vard) mmx_m2m(pand, vars, vard) +#endif + + +/* 1x64 bitwise AND with Not the destination +*/ +#define pandn_m2r(var, reg) mmx_m2r(pandn, var, reg) +#define pandn_r2r(regs, regd) mmx_r2r(pandn, regs, regd) +#define pandn(vars, vard) mmx_m2m(pandn, vars, vard) + + +/* 1x64 bitwise OR +*/ +#define por_m2r(var, reg) mmx_m2r(por, var, reg) +#define por_r2r(regs, regd) mmx_r2r(por, regs, regd) +#define por(vars, vard) mmx_m2m(por, vars, vard) + + +/* 1x64 bitwise eXclusive OR +*/ +#define pxor_m2r(var, reg) mmx_m2r(pxor, var, reg) +#define pxor_r2r(regs, regd) mmx_r2r(pxor, regs, regd) +#define pxor(vars, vard) mmx_m2m(pxor, vars, vard) + + +/* 2x32, 4x16, and 8x8 Parallel CoMPare for EQuality + (resulting fields are either 0 or -1) +*/ +#define pcmpeqd_m2r(var, reg) mmx_m2r(pcmpeqd, var, reg) +#define pcmpeqd_r2r(regs, regd) mmx_r2r(pcmpeqd, regs, regd) +#define pcmpeqd(vars, vard) mmx_m2m(pcmpeqd, vars, vard) + +#define pcmpeqw_m2r(var, reg) mmx_m2r(pcmpeqw, var, reg) +#define pcmpeqw_r2r(regs, regd) mmx_r2r(pcmpeqw, regs, regd) +#define pcmpeqw(vars, vard) mmx_m2m(pcmpeqw, vars, vard) + +#define pcmpeqb_m2r(var, reg) mmx_m2r(pcmpeqb, var, reg) +#define pcmpeqb_r2r(regs, regd) mmx_r2r(pcmpeqb, regs, regd) +#define pcmpeqb(vars, vard) mmx_m2m(pcmpeqb, vars, vard) + + +/* 2x32, 4x16, and 8x8 Parallel CoMPare for Greater Than + (resulting fields are either 0 or -1) +*/ +#define pcmpgtd_m2r(var, reg) mmx_m2r(pcmpgtd, var, reg) +#define pcmpgtd_r2r(regs, regd) mmx_r2r(pcmpgtd, regs, regd) +#define pcmpgtd(vars, vard) mmx_m2m(pcmpgtd, vars, vard) + +#define pcmpgtw_m2r(var, reg) mmx_m2r(pcmpgtw, var, reg) +#define pcmpgtw_r2r(regs, regd) mmx_r2r(pcmpgtw, regs, regd) +#define pcmpgtw(vars, vard) mmx_m2m(pcmpgtw, vars, vard) + +#define pcmpgtb_m2r(var, reg) mmx_m2r(pcmpgtb, var, reg) +#define pcmpgtb_r2r(regs, regd) mmx_r2r(pcmpgtb, regs, regd) +#define pcmpgtb(vars, vard) mmx_m2m(pcmpgtb, vars, vard) + + +/* 1x64, 2x32, and 4x16 Parallel Shift Left Logical +*/ +#define psllq_i2r(imm, reg) mmx_i2r(psllq, imm, reg) +#define psllq_m2r(var, reg) mmx_m2r(psllq, var, reg) +#define psllq_r2r(regs, regd) mmx_r2r(psllq, regs, regd) +#define psllq(vars, vard) mmx_m2m(psllq, vars, vard) + +#define pslld_i2r(imm, reg) mmx_i2r(pslld, imm, reg) +#define pslld_m2r(var, reg) mmx_m2r(pslld, var, reg) +#define pslld_r2r(regs, regd) mmx_r2r(pslld, regs, regd) +#define pslld(vars, vard) mmx_m2m(pslld, vars, vard) + +#define psllw_i2r(imm, reg) mmx_i2r(psllw, imm, reg) +#define psllw_m2r(var, reg) mmx_m2r(psllw, var, reg) +#define psllw_r2r(regs, regd) mmx_r2r(psllw, regs, regd) +#define psllw(vars, vard) mmx_m2m(psllw, vars, vard) + + +/* 1x64, 2x32, and 4x16 Parallel Shift Right Logical +*/ +#define psrlq_i2r(imm, reg) mmx_i2r(psrlq, imm, reg) +#define psrlq_m2r(var, reg) mmx_m2r(psrlq, var, reg) +#define psrlq_r2r(regs, regd) mmx_r2r(psrlq, regs, regd) +#define psrlq(vars, vard) mmx_m2m(psrlq, vars, vard) + +#define psrld_i2r(imm, reg) mmx_i2r(psrld, imm, reg) +#define psrld_m2r(var, reg) mmx_m2r(psrld, var, reg) +#define psrld_r2r(regs, regd) mmx_r2r(psrld, regs, regd) +#define psrld(vars, vard) mmx_m2m(psrld, vars, vard) + +#define psrlw_i2r(imm, reg) mmx_i2r(psrlw, imm, reg) +#define psrlw_m2r(var, reg) mmx_m2r(psrlw, var, reg) +#define psrlw_r2r(regs, regd) mmx_r2r(psrlw, regs, regd) +#define psrlw(vars, vard) mmx_m2m(psrlw, vars, vard) + + +/* 2x32 and 4x16 Parallel Shift Right Arithmetic +*/ +#define psrad_i2r(imm, reg) mmx_i2r(psrad, imm, reg) +#define psrad_m2r(var, reg) mmx_m2r(psrad, var, reg) +#define psrad_r2r(regs, regd) mmx_r2r(psrad, regs, regd) +#define psrad(vars, vard) mmx_m2m(psrad, vars, vard) + +#define psraw_i2r(imm, reg) mmx_i2r(psraw, imm, reg) +#define psraw_m2r(var, reg) mmx_m2r(psraw, var, reg) +#define psraw_r2r(regs, regd) mmx_r2r(psraw, regs, regd) +#define psraw(vars, vard) mmx_m2m(psraw, vars, vard) + + +/* 2x32->4x16 and 4x16->8x8 PACK and Signed Saturate + (packs source and dest fields into dest in that order) +*/ +#define packssdw_m2r(var, reg) mmx_m2r(packssdw, var, reg) +#define packssdw_r2r(regs, regd) mmx_r2r(packssdw, regs, regd) +#define packssdw(vars, vard) mmx_m2m(packssdw, vars, vard) + +#define packsswb_m2r(var, reg) mmx_m2r(packsswb, var, reg) +#define packsswb_r2r(regs, regd) mmx_r2r(packsswb, regs, regd) +#define packsswb(vars, vard) mmx_m2m(packsswb, vars, vard) + + +/* 4x16->8x8 PACK and Unsigned Saturate + (packs source and dest fields into dest in that order) +*/ +#define packuswb_m2r(var, reg) mmx_m2r(packuswb, var, reg) +#define packuswb_r2r(regs, regd) mmx_r2r(packuswb, regs, regd) +#define packuswb(vars, vard) mmx_m2m(packuswb, vars, vard) + + +/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK Low + (interleaves low half of dest with low half of source + as padding in each result field) +*/ +#define punpckldq_m2r(var, reg) mmx_m2r(punpckldq, var, reg) +#define punpckldq_r2r(regs, regd) mmx_r2r(punpckldq, regs, regd) +#define punpckldq(vars, vard) mmx_m2m(punpckldq, vars, vard) + +#define punpcklwd_m2r(var, reg) mmx_m2r(punpcklwd, var, reg) +#define punpcklwd_r2r(regs, regd) mmx_r2r(punpcklwd, regs, regd) +#define punpcklwd(vars, vard) mmx_m2m(punpcklwd, vars, vard) + +#define punpcklbw_m2r(var, reg) mmx_m2r(punpcklbw, var, reg) +#define punpcklbw_r2r(regs, regd) mmx_r2r(punpcklbw, regs, regd) +#define punpcklbw(vars, vard) mmx_m2m(punpcklbw, vars, vard) + + +/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK High + (interleaves high half of dest with high half of source + as padding in each result field) +*/ +#define punpckhdq_m2r(var, reg) mmx_m2r(punpckhdq, var, reg) +#define punpckhdq_r2r(regs, regd) mmx_r2r(punpckhdq, regs, regd) +#define punpckhdq(vars, vard) mmx_m2m(punpckhdq, vars, vard) + +#define punpckhwd_m2r(var, reg) mmx_m2r(punpckhwd, var, reg) +#define punpckhwd_r2r(regs, regd) mmx_r2r(punpckhwd, regs, regd) +#define punpckhwd(vars, vard) mmx_m2m(punpckhwd, vars, vard) + +#define punpckhbw_m2r(var, reg) mmx_m2r(punpckhbw, var, reg) +#define punpckhbw_r2r(regs, regd) mmx_r2r(punpckhbw, regs, regd) +#define punpckhbw(vars, vard) mmx_m2m(punpckhbw, vars, vard) + + +/* Empty MMx State + (used to clean-up when going from mmx to float use + of the registers that are shared by both; note that + there is no float-to-mmx operation needed, because + only the float tag word info is corruptible) +*/ +#ifdef MMX_TRACE + +#define emms() \ + { \ + fprintf(stderr, "emms()\n"); \ + __asm__ __volatile__ ("emms"); \ + } + +#else + +#define emms() __asm__ __volatile__ ("emms") + +#endif + +#endif + diff --git a/mesalib/src/mesa/drivers/dri/common/spantmp.h b/mesalib/src/mesa/drivers/dri/common/spantmp.h new file mode 100644 index 000000000..d5608b880 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/spantmp.h @@ -0,0 +1,338 @@ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * (C) Copyright IBM Corporation 2002, 2003 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to 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 + * VA LINUX SYSTEM, 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. + * + * Authors: + * Keith Whitwell + * Gareth Hughes + */ + +#include "spantmp_common.h" + +#ifndef DBG +#define DBG 0 +#endif + +#ifndef HW_READ_CLIPLOOP +#define HW_READ_CLIPLOOP() HW_CLIPLOOP() +#endif + +#ifndef HW_WRITE_CLIPLOOP +#define HW_WRITE_CLIPLOOP() HW_CLIPLOOP() +#endif + + +static void TAG(WriteRGBASpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; + GLint x1; + GLint n1; + LOCAL_VARS; + + y = Y_FLIP(y); + + HW_WRITE_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + if (DBG) fprintf(stderr, "WriteRGBASpan %d..%d (x1 %d)\n", + (int)i, (int)n1, (int)x1); + + if (mask) + { + for (;n1>0;i++,x1++,n1--) + if (mask[i]) + WRITE_RGBA( x1, y, + rgba[i][0], rgba[i][1], + rgba[i][2], rgba[i][3] ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_RGBA( x1, y, + rgba[i][0], rgba[i][1], + rgba[i][2], rgba[i][3] ); + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} + +static void TAG(WriteRGBSpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; + GLint x1; + GLint n1; + LOCAL_VARS; + + y = Y_FLIP(y); + + HW_WRITE_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + if (DBG) fprintf(stderr, "WriteRGBSpan %d..%d (x1 %d)\n", + (int)i, (int)n1, (int)x1); + + if (mask) + { + for (;n1>0;i++,x1++,n1--) + if (mask[i]) + WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} + +static void TAG(WriteRGBAPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; + GLuint i; + LOCAL_VARS; + + if (DBG) fprintf(stderr, "WriteRGBAPixels\n"); + + HW_WRITE_CLIPLOOP() + { + if (mask) + { + for (i=0;i0;i++,x1++,n1--) + if (mask[i]) + WRITE_PIXEL( x1, y, p ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_PIXEL( x1, y, p ); + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} + + +static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, + const GLint x[], const GLint y[], + const void *value, + const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte *color = (const GLubyte *) value; + GLuint i; + LOCAL_VARS; + INIT_MONO_PIXEL(p, color); + + if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n"); + + HW_WRITE_CLIPLOOP() + { + if (mask) + { + for (i=0;i0;i++,x1++,n1--) + READ_RGBA( rgba[i], x1, y ); + } + HW_ENDCLIPLOOP(); + } + HW_READ_UNLOCK(); +} + + +static void TAG(ReadRGBAPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + void *values ) +{ + HW_READ_LOCK() + { + GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; + const GLubyte *mask = NULL; /* remove someday */ + GLuint i; + LOCAL_VARS; + + if (DBG) fprintf(stderr, "ReadRGBAPixels\n"); + + HW_READ_CLIPLOOP() + { + if (mask) + { + for (i=0;iPutRow = TAG(WriteRGBASpan); + rb->PutRowRGB = TAG(WriteRGBSpan); + rb->PutMonoRow = TAG(WriteMonoRGBASpan); + rb->PutValues = TAG(WriteRGBAPixels); + rb->PutMonoValues = TAG(WriteMonoRGBAPixels); + rb->GetValues = TAG(ReadRGBAPixels); + rb->GetRow = TAG(ReadRGBASpan); +} + + +#undef WRITE_PIXEL +#undef WRITE_RGBA +#undef READ_RGBA +#undef TAG diff --git a/mesalib/src/mesa/drivers/dri/common/spantmp2.h b/mesalib/src/mesa/drivers/dri/common/spantmp2.h new file mode 100644 index 000000000..89c815722 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/spantmp2.h @@ -0,0 +1,686 @@ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * (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 + * VA LINUX SYSTEM, 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 spantmp2.h + * + * Template file of span read / write functions. + * + * \author Keith Whitwell + * \author Gareth Hughes + * \author Ian Romanick + */ + +#include "main/colormac.h" +#include "spantmp_common.h" + +#ifndef DBG +#define DBG 0 +#endif + +#ifndef HW_READ_CLIPLOOP +#define HW_READ_CLIPLOOP() HW_CLIPLOOP() +#endif + +#ifndef HW_WRITE_CLIPLOOP +#define HW_WRITE_CLIPLOOP() HW_CLIPLOOP() +#endif + +#if (SPANTMP_PIXEL_FMT == GL_RGB) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5) + +/** + ** GL_RGB, GL_UNSIGNED_SHORT_5_6_5 + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +#define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_565( color[0], color[1], color[2] ) + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + PUT_VALUE(_x, _y, ((((int)r & 0xf8) << 8) | \ + (((int)g & 0xfc) << 3) | \ + (((int)b & 0xf8) >> 3))) \ + +#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = GET_VALUE(_x, _y); \ + rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \ + rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \ + rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \ + rgba[3] = 0xff; \ + } while (0) + +#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_4_4_4_4_REV) + +/** + ** GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +#define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_4444(color[3], color[0], color[1], color[2]) + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + PUT_VALUE(_x, _y, PACK_COLOR_4444(a, r, g, b)) \ + +#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = GET_VALUE(_x, _y); \ + rgba[0] = ((p >> 8) & 0xf) * 0x11; \ + rgba[1] = ((p >> 4) & 0xf) * 0x11; \ + rgba[2] = ((p >> 0) & 0xf) * 0x11; \ + rgba[3] = ((p >> 12) & 0xf) * 0x11; \ + } while (0) + + +#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_1_5_5_5_REV) + +/** + ** GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +#define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_1555(color[3], color[0], color[1], color[2]) + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + PUT_VALUE(_x, _y, PACK_COLOR_1555(a, r, g, b)) \ + +#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = GET_VALUE(_x, _y); \ + rgba[0] = ((p >> 7) & 0xf8) * 255 / 0xf8; \ + rgba[1] = ((p >> 2) & 0xf8) * 255 / 0xf8; \ + rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \ + rgba[3] = ((p >> 15) & 0x1) * 0xff; \ + } while (0) + +#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) + +/** + ** GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) ( buf + (_x) * 4 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +# define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_8888(color[3], color[0], color[1], color[2]) + +# define WRITE_RGBA(_x, _y, r, g, b, a) \ + PUT_VALUE(_x, _y, ((r << 16) | \ + (g << 8) | \ + (b << 0) | \ + (a << 24))) + +#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p) + +# if defined( USE_X86_ASM ) +# define READ_RGBA(rgba, _x, _y) \ + do { \ + GLuint p = GET_VALUE(_x, _y); \ + __asm__ __volatile__( "bswap %0; rorl $8, %0" \ + : "=r" (p) : "0" (p) ); \ + ((GLuint *)rgba)[0] = p; \ + } while (0) +# elif defined( MESA_BIG_ENDIAN ) + /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single + * rotlwi instruction. It also produces good code on SPARC. + */ +# define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLuint p = GET_VALUE(_x, _y); \ + GLuint t = p; \ + *((uint32_t *) rgba) = (t >> 24) | (p << 8); \ + } while (0) +# else +# define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLuint p = GET_VALUE(_x, _y); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = (p >> 24) & 0xff; \ + } while (0) +# endif + +#else +#error SPANTMP_PIXEL_FMT must be set to a valid value! +#endif + + + +/** + ** Assembly routines. + **/ + +#if defined( USE_MMX_ASM ) || defined( USE_SSE_ASM ) +#include "x86/read_rgba_span_x86.h" +#include "x86/common_x86_asm.h" +#endif + +static void TAG(WriteRGBASpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; + GLint x1; + GLint n1; + LOCAL_VARS; + + y = Y_FLIP(y); + + HW_WRITE_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + if (DBG) fprintf(stderr, "WriteRGBASpan %d..%d (x1 %d)\n", + (int)i, (int)n1, (int)x1); + + if (mask) + { + for (;n1>0;i++,x1++,n1--) + if (mask[i]) + WRITE_RGBA( x1, y, + rgba[i][0], rgba[i][1], + rgba[i][2], rgba[i][3] ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_RGBA( x1, y, + rgba[i][0], rgba[i][1], + rgba[i][2], rgba[i][3] ); + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} + +static void TAG(WriteRGBSpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; + GLint x1; + GLint n1; + LOCAL_VARS; + + y = Y_FLIP(y); + + HW_WRITE_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + if (DBG) fprintf(stderr, "WriteRGBSpan %d..%d (x1 %d)\n", + (int)i, (int)n1, (int)x1); + + if (mask) + { + for (;n1>0;i++,x1++,n1--) + if (mask[i]) + WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} + +static void TAG(WriteRGBAPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; + GLint i; + LOCAL_VARS; + + if (DBG) fprintf(stderr, "WriteRGBAPixels\n"); + + HW_WRITE_CLIPLOOP() + { + if (mask) + { + for (i=0;i0;i++,x1++,n1--) + if (mask[i]) + WRITE_PIXEL( x1, y, p ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_PIXEL( x1, y, p ); + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} + + +static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, + const GLint x[], const GLint y[], + const void *value, + const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte *color = (const GLubyte *) value; + GLint i; + LOCAL_VARS; + INIT_MONO_PIXEL(p, color); + + if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n"); + + HW_WRITE_CLIPLOOP() + { + if (mask) + { + for (i=0;i0;i++,x1++,n1--) + READ_RGBA( rgba[i], x1, y ); + } + HW_ENDCLIPLOOP(); + } + HW_READ_UNLOCK(); +} + + +#if defined(GET_PTR) && \ + defined(USE_MMX_ASM) && \ + (((SPANTMP_PIXEL_FMT == GL_BGRA) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \ + ((SPANTMP_PIXEL_FMT == GL_RGB) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5))) +static void TAG2(ReadRGBASpan,_MMX)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, void *values) +{ +#ifndef USE_INNER_EMMS + /* The EMMS instruction is directly in-lined here because using GCC's + * built-in _mm_empty function was found to utterly destroy performance. + */ + __asm__ __volatile__( "emms" ); +#endif + + HW_READ_LOCK() + { + GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; + GLint x1,n1; + LOCAL_VARS; + + y = Y_FLIP(y); + + if (DBG) fprintf(stderr, "ReadRGBASpan\n"); + + HW_READ_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + { + const void * src = GET_PTR( x1, y ); +#if (SPANTMP_PIXEL_FMT == GL_RGB) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5) + _generic_read_RGBA_span_RGB565_MMX( src, rgba[i], n1 ); +#else + _generic_read_RGBA_span_BGRA8888_REV_MMX( src, rgba[i], n1 ); +#endif + } + } + HW_ENDCLIPLOOP(); + } + HW_READ_UNLOCK(); +#ifndef USE_INNER_EMMS + __asm__ __volatile__( "emms" ); +#endif +} +#endif + + +#if defined(GET_PTR) && \ + defined(USE_SSE_ASM) && \ + (SPANTMP_PIXEL_FMT == GL_BGRA) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) +static void TAG2(ReadRGBASpan,_SSE2)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + void *values) +{ + HW_READ_LOCK() + { + GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; + GLint x1,n1; + LOCAL_VARS; + + y = Y_FLIP(y); + + if (DBG) fprintf(stderr, "ReadRGBASpan\n"); + + HW_READ_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + { + const void * src = GET_PTR( x1, y ); + _generic_read_RGBA_span_BGRA8888_REV_SSE2( src, rgba[i], n1 ); + } + } + HW_ENDCLIPLOOP(); + } + HW_READ_UNLOCK(); +} +#endif + +#if defined(GET_PTR) && \ + defined(USE_SSE_ASM) && \ + (SPANTMP_PIXEL_FMT == GL_BGRA) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) +static void TAG2(ReadRGBASpan,_SSE)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + void *values) +{ +#ifndef USE_INNER_EMMS + /* The EMMS instruction is directly in-lined here because using GCC's + * built-in _mm_empty function was found to utterly destroy performance. + */ + __asm__ __volatile__( "emms" ); +#endif + + HW_READ_LOCK() + { + GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; + GLint x1,n1; + LOCAL_VARS; + + y = Y_FLIP(y); + + if (DBG) fprintf(stderr, "ReadRGBASpan\n"); + + HW_READ_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + { + const void * src = GET_PTR( x1, y ); + _generic_read_RGBA_span_BGRA8888_REV_SSE( src, rgba[i], n1 ); + } + } + HW_ENDCLIPLOOP(); + } + HW_READ_UNLOCK(); +#ifndef USE_INNER_EMMS + __asm__ __volatile__( "emms" ); +#endif +} +#endif + + +static void TAG(ReadRGBAPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + void *values ) +{ + HW_READ_LOCK() + { + GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; + GLubyte *mask = NULL; /* remove someday */ + GLint i; + LOCAL_VARS; + + if (DBG) fprintf(stderr, "ReadRGBAPixels\n"); + + HW_READ_CLIPLOOP() + { + if (mask) + { + for (i=0;iPutRow = TAG(WriteRGBASpan); + rb->PutRowRGB = TAG(WriteRGBSpan); + rb->PutMonoRow = TAG(WriteMonoRGBASpan); + rb->PutValues = TAG(WriteRGBAPixels); + rb->PutMonoValues = TAG(WriteMonoRGBAPixels); + rb->GetValues = TAG(ReadRGBAPixels); + +#if defined(GET_PTR) +#if defined(USE_SSE_ASM) && \ + (SPANTMP_PIXEL_FMT == GL_BGRA) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) + if ( cpu_has_xmm2 ) { + if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE2" ); + rb->GetRow = TAG2(ReadRGBASpan, _SSE2); + } + else +#endif +#if defined(USE_SSE_ASM) && \ + (SPANTMP_PIXEL_FMT == GL_BGRA) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) + if ( cpu_has_xmm ) { + if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE" ); + rb->GetRow = TAG2(ReadRGBASpan, _SSE); + } + else +#endif +#if defined(USE_MMX_ASM) && \ + (((SPANTMP_PIXEL_FMT == GL_BGRA) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \ + ((SPANTMP_PIXEL_FMT == GL_RGB) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5))) + if ( cpu_has_mmx ) { + if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "MMX" ); + rb->GetRow = TAG2(ReadRGBASpan, _MMX); + } + else +#endif +#endif /* GET_PTR */ + { + if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "C" ); + rb->GetRow = TAG(ReadRGBASpan); + } + +} + + +#undef INIT_MONO_PIXEL +#undef WRITE_PIXEL +#undef WRITE_RGBA +#undef READ_RGBA +#undef TAG +#undef TAG2 +#undef GET_VALUE +#undef PUT_VALUE +#undef GET_PTR +#undef SPANTMP_PIXEL_FMT +#undef SPANTMP_PIXEL_TYPE diff --git a/mesalib/src/mesa/drivers/dri/common/spantmp_common.h b/mesalib/src/mesa/drivers/dri/common/spantmp_common.h new file mode 100644 index 000000000..a4509a569 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/spantmp_common.h @@ -0,0 +1,81 @@ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * (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 + * VA LINUX SYSTEM, 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 spantmp_common.h + * + * common macros for span read / write functions to be used in the depth, + * stencil and pixel span templates. + */ + +#ifndef HW_WRITE_LOCK +#define HW_WRITE_LOCK() HW_LOCK() +#endif + +#ifndef HW_WRITE_UNLOCK +#define HW_WRITE_UNLOCK() HW_UNLOCK() +#endif + +#ifndef HW_READ_LOCK +#define HW_READ_LOCK() HW_LOCK() +#endif + +#ifndef HW_READ_UNLOCK +#define HW_READ_UNLOCK() HW_UNLOCK() +#endif + +#ifndef HW_CLIPLOOP +#define HW_CLIPLOOP() \ + do { \ + int _nc = dPriv->numClipRects; \ + while ( _nc-- ) { \ + int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \ + int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \ + int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \ + int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y; +#endif + +#ifndef HW_ENDCLIPLOOP +#define HW_ENDCLIPLOOP() \ + } \ + } while (0) +#endif + +#ifndef CLIPPIXEL +#define CLIPPIXEL( _x, _y ) \ + ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy)) +#endif + +#ifndef CLIPSPAN +#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ + if ( _y < miny || _y >= maxy /*|| _x + n < minx || _x >=maxx*/ ) { \ + _n1 = 0, _x1 = x; \ + } else { \ + _n1 = _n; \ + _x1 = _x; \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ + } +#endif diff --git a/mesalib/src/mesa/drivers/dri/common/stenciltmp.h b/mesalib/src/mesa/drivers/dri/common/stenciltmp.h new file mode 100644 index 000000000..2b10b9ecf --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/stenciltmp.h @@ -0,0 +1,245 @@ + +#include "spantmp_common.h" + +#ifndef DBG +#define DBG 0 +#endif + +#ifndef HAVE_HW_STENCIL_SPANS +#define HAVE_HW_STENCIL_SPANS 0 +#endif + +#ifndef HAVE_HW_STENCIL_PIXELS +#define HAVE_HW_STENCIL_PIXELS 0 +#endif + +static void TAG(WriteStencilSpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte *stencil = (const GLubyte *) values; + GLint x1; + GLint n1; + LOCAL_STENCIL_VARS; + + y = Y_FLIP(y); + +#if HAVE_HW_STENCIL_SPANS + (void) x1; (void) n1; + + if (DBG) fprintf(stderr, "WriteStencilSpan 0..%d (x1 %d)\n", + (int)n1, (int)x1); + + WRITE_STENCIL_SPAN(); +#else /* HAVE_HW_STENCIL_SPANS */ + HW_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + if (DBG) fprintf(stderr, "WriteStencilSpan %d..%d (x1 %d)\n", + (int)i, (int)n1, (int)x1); + + if (mask) + { + for (;n1>0;i++,x1++,n1--) + if (mask[i]) + WRITE_STENCIL( x1, y, stencil[i] ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_STENCIL( x1, y, stencil[i] ); + } + } + HW_ENDCLIPLOOP(); +#endif /* !HAVE_HW_STENCIL_SPANS */ + } + HW_WRITE_UNLOCK(); +} + +#if HAVE_HW_STENCIL_SPANS +/* implement MonoWriteDepthSpan() in terms of WriteDepthSpan() */ +static void +TAG(WriteMonoStencilSpan)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *value, const GLubyte mask[] ) +{ + const GLuint stenVal = *((GLuint *) value); + GLuint stens[MAX_WIDTH]; + GLuint i; + for (i = 0; i < n; i++) + stens[i] = stenVal; + TAG(WriteStencilSpan)(ctx, rb, n, x, y, stens, mask); +} +#else /* HAVE_HW_STENCIL_SPANS */ +static void TAG(WriteMonoStencilSpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *value, + const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte stencil = *((const GLubyte *) value); + GLint x1; + GLint n1; + LOCAL_STENCIL_VARS; + + y = Y_FLIP(y); + + HW_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + if (DBG) fprintf(stderr, "WriteStencilSpan %d..%d (x1 %d)\n", + (int)i, (int)n1, (int)x1); + + if (mask) + { + for (;n1>0;i++,x1++,n1--) + if (mask[i]) + WRITE_STENCIL( x1, y, stencil ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_STENCIL( x1, y, stencil ); + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} +#endif /* !HAVE_HW_STENCIL_SPANS */ + + +static void TAG(WriteStencilPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, + const GLint x[], const GLint y[], + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte *stencil = (const GLubyte *) values; + GLuint i; + LOCAL_STENCIL_VARS; + + if (DBG) fprintf(stderr, "WriteStencilPixels\n"); + +#if HAVE_HW_STENCIL_PIXELS + (void) i; + + WRITE_STENCIL_PIXELS(); +#else /* HAVE_HW_STENCIL_PIXELS */ + HW_CLIPLOOP() + { + for (i=0;i0;i++,n1--) + READ_STENCIL( stencil[i], (x+i), y ); + } + HW_ENDCLIPLOOP(); +#endif /* !HAVE_HW_STENCIL_SPANS */ + } + HW_READ_UNLOCK(); +} + +static void TAG(ReadStencilPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + void *values ) +{ + HW_READ_LOCK() + { + GLubyte *stencil = (GLubyte *) values; + GLuint i; + LOCAL_STENCIL_VARS; + + if (DBG) fprintf(stderr, "ReadStencilPixels\n"); + +#if HAVE_HW_STENCIL_PIXELS + (void) i; + + READ_STENCIL_PIXELS(); +#else /* HAVE_HW_STENCIL_PIXELS */ + HW_CLIPLOOP() + { + for (i=0;iGetRow = TAG(ReadStencilSpan); + rb->GetValues = TAG(ReadStencilPixels); + rb->PutRow = TAG(WriteStencilSpan); + rb->PutRowRGB = NULL; + rb->PutMonoRow = TAG(WriteMonoStencilSpan); + rb->PutValues = TAG(WriteStencilPixels); + rb->PutMonoValues = NULL; +} + + +#undef WRITE_STENCIL +#undef READ_STENCIL +#undef TAG diff --git a/mesalib/src/mesa/drivers/dri/common/texmem.c b/mesalib/src/mesa/drivers/dri/common/texmem.c new file mode 100644 index 000000000..b64618a03 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/texmem.c @@ -0,0 +1,1347 @@ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * (C) Copyright IBM Corporation 2002, 2003 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to 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 + * VA LINUX SYSTEM, 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. + * + * Authors: + * Ian Romanick + * Keith Whitwell + * Kevin E. Martin + * Gareth Hughes + */ + +/** \file texmem.c + * Implements all of the device-independent texture memory management. + * + * Currently, only a simple LRU texture memory management policy is + * implemented. In the (hopefully very near) future, better policies will be + * implemented. The idea is that the DRI should be able to run in one of two + * modes. In the default mode the DRI will dynamically attempt to discover + * the best texture management policy for the running application. In the + * other mode, the user (via some sort of as yet TBD mechanism) will select + * a texture management policy that is known to work well with the + * application. + */ + +#include "texmem.h" +#include "main/simple_list.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/texformat.h" + +#include + + + +static unsigned dummy_swap_counter; + + +/** + * Calculate \f$\log_2\f$ of a value. This is a particularly poor + * implementation of this function. However, since system performance is in + * no way dependent on this function, the slowness of the implementation is + * irrelevent. + * + * \param n Value whose \f$\log_2\f$ is to be calculated + */ + +static GLuint +driLog2( GLuint n ) +{ + GLuint log2; + + for ( log2 = 1 ; n > 1 ; log2++ ) { + n >>= 1; + } + + return log2; +} + + + + +/** + * Determine if a texture is resident in textureable memory. Depending on + * the driver, this may or may not be on-card memory. It could be AGP memory + * or anyother type of memory from which the hardware can directly read + * texels. + * + * This function is intended to be used as the \c IsTextureResident function + * in the device's \c dd_function_table. + * + * \param ctx GL context pointer (currently unused) + * \param texObj Texture object to be tested + */ + +GLboolean +driIsTextureResident( GLcontext * ctx, + struct gl_texture_object * texObj ) +{ + driTextureObject * t; + + + t = (driTextureObject *) texObj->DriverData; + return( (t != NULL) && (t->memBlock != NULL) ); +} + + + + +/** + * (Re)initialize the global circular LRU list. The last element + * in the array (\a heap->nrRegions) is the sentinal. Keeping it + * at the end of the array allows the other elements of the array + * to be addressed rationally when looking up objects at a particular + * location in texture memory. + * + * \param heap Texture heap to be reset + */ + +static void resetGlobalLRU( driTexHeap * heap ) +{ + drmTextureRegionPtr list = heap->global_regions; + unsigned sz = 1U << heap->logGranularity; + unsigned i; + + for (i = 0 ; (i+1) * sz <= heap->size ; i++) { + list[i].prev = i-1; + list[i].next = i+1; + list[i].age = 0; + } + + i--; + list[0].prev = heap->nrRegions; + list[i].prev = i-1; + list[i].next = heap->nrRegions; + list[heap->nrRegions].prev = i; + list[heap->nrRegions].next = 0; + heap->global_age[0] = 0; +} + +/** + * Print out debugging information about the local texture LRU. + * + * \param heap Texture heap to be printed + * \param callername Name of calling function + */ +static void printLocalLRU( driTexHeap * heap, const char *callername ) +{ + driTextureObject *t; + unsigned sz = 1U << heap->logGranularity; + + fprintf( stderr, "%s in %s:\nLocal LRU, heap %d:\n", + __FUNCTION__, callername, heap->heapId ); + + foreach ( t, &heap->texture_objects ) { + if (!t->memBlock) + continue; + if (!t->tObj) { + fprintf( stderr, "Placeholder (%p) %d at 0x%x sz 0x%x\n", + (void *)t, + t->memBlock->ofs / sz, + t->memBlock->ofs, + t->memBlock->size ); + } else { + fprintf( stderr, "Texture (%p) at 0x%x sz 0x%x\n", + (void *)t, + t->memBlock->ofs, + t->memBlock->size ); + } + } + foreach ( t, heap->swapped_objects ) { + if (!t->tObj) { + fprintf( stderr, "Swapped Placeholder (%p)\n", (void *)t ); + } else { + fprintf( stderr, "Swapped Texture (%p)\n", (void *)t ); + } + } + + fprintf( stderr, "\n" ); +} + +/** + * Print out debugging information about the global texture LRU. + * + * \param heap Texture heap to be printed + * \param callername Name of calling function + */ +static void printGlobalLRU( driTexHeap * heap, const char *callername ) +{ + drmTextureRegionPtr list = heap->global_regions; + unsigned int i, j; + + fprintf( stderr, "%s in %s:\nGlobal LRU, heap %d list %p:\n", + __FUNCTION__, callername, heap->heapId, (void *)list ); + + for ( i = 0, j = heap->nrRegions ; i < heap->nrRegions ; i++ ) { + fprintf( stderr, "list[%d] age %d next %d prev %d in_use %d\n", + j, list[j].age, list[j].next, list[j].prev, list[j].in_use ); + j = list[j].next; + if ( j == heap->nrRegions ) break; + } + + if ( j != heap->nrRegions ) { + fprintf( stderr, "Loop detected in global LRU\n" ); + for ( i = 0 ; i < heap->nrRegions ; i++ ) { + fprintf( stderr, "list[%d] age %d next %d prev %d in_use %d\n", + i, list[i].age, list[i].next, list[i].prev, list[i].in_use ); + } + } + + fprintf( stderr, "\n" ); +} + + +/** + * Called by the client whenever it touches a local texture. + * + * \param t Texture object that the client has accessed + */ + +void driUpdateTextureLRU( driTextureObject * t ) +{ + driTexHeap * heap; + drmTextureRegionPtr list; + unsigned shift; + unsigned start; + unsigned end; + unsigned i; + + + heap = t->heap; + if ( heap != NULL ) { + shift = heap->logGranularity; + start = t->memBlock->ofs >> shift; + end = (t->memBlock->ofs + t->memBlock->size - 1) >> shift; + + + heap->local_age = ++heap->global_age[0]; + list = heap->global_regions; + + + /* Update the context's local LRU + */ + + move_to_head( & heap->texture_objects, t ); + + + for (i = start ; i <= end ; i++) { + list[i].age = heap->local_age; + + /* remove_from_list(i) + */ + list[(unsigned)list[i].next].prev = list[i].prev; + list[(unsigned)list[i].prev].next = list[i].next; + + /* insert_at_head(list, i) + */ + list[i].prev = heap->nrRegions; + list[i].next = list[heap->nrRegions].next; + list[(unsigned)list[heap->nrRegions].next].prev = i; + list[heap->nrRegions].next = i; + } + + if ( 0 ) { + printGlobalLRU( heap, __FUNCTION__ ); + printLocalLRU( heap, __FUNCTION__ ); + } + } +} + + + + +/** + * Keep track of swapped out texture objects. + * + * \param t Texture object to be "swapped" out of its texture heap + */ + +void driSwapOutTextureObject( driTextureObject * t ) +{ + unsigned face; + + + if ( t->memBlock != NULL ) { + assert( t->heap != NULL ); + mmFreeMem( t->memBlock ); + t->memBlock = NULL; + + if (t->timestamp > t->heap->timestamp) + t->heap->timestamp = t->timestamp; + + t->heap->texture_swaps[0]++; + move_to_tail( t->heap->swapped_objects, t ); + t->heap = NULL; + } + else { + assert( t->heap == NULL ); + } + + + for ( face = 0 ; face < 6 ; face++ ) { + t->dirty_images[face] = ~0; + } +} + + + + +/** + * Destroy hardware state associated with texture \a t. Calls the + * \a destroy_texture_object method associated with the heap from which + * \a t was allocated. + * + * \param t Texture object to be destroyed + */ + +void driDestroyTextureObject( driTextureObject * t ) +{ + driTexHeap * heap; + + + if ( 0 ) { + fprintf( stderr, "[%s:%d] freeing %p (tObj = %p, DriverData = %p)\n", + __FILE__, __LINE__, + (void *)t, + (void *)((t != NULL) ? t->tObj : NULL), + (void *)((t != NULL && t->tObj != NULL) ? t->tObj->DriverData : NULL )); + } + + if ( t != NULL ) { + if ( t->memBlock ) { + heap = t->heap; + assert( heap != NULL ); + + heap->texture_swaps[0]++; + + mmFreeMem( t->memBlock ); + t->memBlock = NULL; + + if (t->timestamp > t->heap->timestamp) + t->heap->timestamp = t->timestamp; + + heap->destroy_texture_object( heap->driverContext, t ); + t->heap = NULL; + } + + if ( t->tObj != NULL ) { + assert( t->tObj->DriverData == t ); + t->tObj->DriverData = NULL; + } + + remove_from_list( t ); + FREE( t ); + } + + if ( 0 ) { + fprintf( stderr, "[%s:%d] done freeing %p\n", __FILE__, __LINE__, (void *)t ); + } +} + + + + +/** + * Update the local heap's representation of texture memory based on + * data in the SAREA. This is done each time it is detected that some other + * direct rendering client has held the lock. This pertains to both our local + * textures and the textures belonging to other clients. Keep track of other + * client's textures by pushing a placeholder texture onto the LRU list -- + * these are denoted by \a tObj being \a NULL. + * + * \param heap Heap whose state is to be updated + * \param offset Byte offset in the heap that has been stolen + * \param size Size, in bytes, of the stolen block + * \param in_use Non-zero if the block is pinned/reserved by the kernel + */ + +static void driTexturesGone( driTexHeap * heap, int offset, int size, + int in_use ) +{ + driTextureObject * t; + driTextureObject * tmp; + + + foreach_s ( t, tmp, & heap->texture_objects ) { + if ( (t->memBlock->ofs < (offset + size)) + && ((t->memBlock->ofs + t->memBlock->size) > offset) ) { + /* It overlaps - kick it out. If the texture object is just a + * place holder, then destroy it all together. Otherwise, mark + * it as being swapped out. + */ + + if ( t->tObj != NULL ) { + driSwapOutTextureObject( t ); + } + else { + driDestroyTextureObject( t ); + } + } + } + + + { + t = (driTextureObject *) CALLOC( heap->texture_object_size ); + if ( t == NULL ) return; + + t->memBlock = mmAllocMem( heap->memory_heap, size, 0, offset ); + if ( t->memBlock == NULL ) { + fprintf( stderr, "Couldn't alloc placeholder: heap %u sz %x ofs %x\n", heap->heapId, + (int)size, (int)offset ); + mmDumpMemInfo( heap->memory_heap ); + FREE(t); + return; + } + t->heap = heap; + if (in_use) + t->reserved = 1; + insert_at_head( & heap->texture_objects, t ); + } +} + + + + +/** + * Called by the client on lock contention to determine whether textures have + * been stolen. If another client has modified a region in which we have + * textures, then we need to figure out which of our textures have been + * removed and update our global LRU. + * + * \param heap Texture heap to be updated + */ + +void driAgeTextures( driTexHeap * heap ) +{ + drmTextureRegionPtr list = heap->global_regions; + unsigned sz = 1U << (heap->logGranularity); + unsigned i, nr = 0; + + + /* Have to go right round from the back to ensure stuff ends up + * LRU in the local list... Fix with a cursor pointer. + */ + + for (i = list[heap->nrRegions].prev ; + i != heap->nrRegions && nr < heap->nrRegions ; + i = list[i].prev, nr++) { + /* If switching texturing schemes, then the SAREA might not have been + * properly cleared, so we need to reset the global texture LRU. + */ + + if ( (i * sz) > heap->size ) { + nr = heap->nrRegions; + break; + } + + if (list[i].age > heap->local_age) + driTexturesGone( heap, i * sz, sz, list[i].in_use); + } + + /* Loop or uninitialized heap detected. Reset. + */ + + if (nr == heap->nrRegions) { + driTexturesGone( heap, 0, heap->size, 0); + resetGlobalLRU( heap ); + } + + if ( 0 ) { + printGlobalLRU( heap, __FUNCTION__ ); + printLocalLRU( heap, __FUNCTION__ ); + } + + heap->local_age = heap->global_age[0]; +} + + + + +#define INDEX_ARRAY_SIZE 6 /* I'm not aware of driver with more than 2 heaps */ + +/** + * Allocate memory from a texture heap to hold a texture object. This + * routine will attempt to allocate memory for the texture from the heaps + * specified by \c heap_array in order. That is, first it will try to + * allocate from \c heap_array[0], then \c heap_array[1], and so on. + * + * \param heap_array Array of pointers to texture heaps to use + * \param nr_heaps Number of heap pointer in \a heap_array + * \param t Texture object for which space is needed + * \return The ID of the heap from which memory was allocated, or -1 if + * memory could not be allocated. + * + * \bug The replacement policy implemented by this function is horrible. + */ + + +int +driAllocateTexture( driTexHeap * const * heap_array, unsigned nr_heaps, + driTextureObject * t ) +{ + driTexHeap * heap; + driTextureObject * temp; + driTextureObject * cursor; + unsigned id; + + + /* In case it already has texture space, initialize heap. This also + * prevents GCC from issuing a warning that heap might be used + * uninitialized. + */ + + heap = t->heap; + + + /* Run through each of the existing heaps and try to allocate a buffer + * to hold the texture. + */ + + for ( id = 0 ; (t->memBlock == NULL) && (id < nr_heaps) ; id++ ) { + heap = heap_array[ id ]; + if ( heap != NULL ) { + t->memBlock = mmAllocMem( heap->memory_heap, t->totalSize, + heap->alignmentShift, 0 ); + } + } + + + /* Kick textures out until the requested texture fits. + */ + + if ( t->memBlock == NULL ) { + unsigned index[INDEX_ARRAY_SIZE]; + unsigned nrGoodHeaps = 0; + + /* Trying to avoid dynamic memory allocation. If you have more + * heaps, increase INDEX_ARRAY_SIZE. I'm not aware of any + * drivers with more than 2 tex heaps. */ + assert( nr_heaps < INDEX_ARRAY_SIZE ); + + /* Sort large enough heaps by duty. Insertion sort should be + * fast enough for such a short array. */ + for ( id = 0 ; id < nr_heaps ; id++ ) { + heap = heap_array[ id ]; + + if ( heap != NULL && t->totalSize <= heap->size ) { + unsigned j; + + for ( j = 0 ; j < nrGoodHeaps; j++ ) { + if ( heap->duty > heap_array[ index[ j ] ]->duty ) + break; + } + + if ( j < nrGoodHeaps ) { + memmove( &index[ j+1 ], &index[ j ], + sizeof(index[ 0 ]) * (nrGoodHeaps - j) ); + } + + index[ j ] = id; + + nrGoodHeaps++; + } + } + + for ( id = 0 ; (t->memBlock == NULL) && (id < nrGoodHeaps) ; id++ ) { + heap = heap_array[ index[ id ] ]; + + for ( cursor = heap->texture_objects.prev, temp = cursor->prev; + cursor != &heap->texture_objects ; + cursor = temp, temp = cursor->prev ) { + + /* The the LRU element. If the texture is bound to one of + * the texture units, then we cannot kick it out. + */ + if ( cursor->bound || cursor->reserved ) { + continue; + } + + if ( cursor->memBlock ) + heap->duty -= cursor->memBlock->size; + + /* If this is a placeholder, there's no need to keep it */ + if (cursor->tObj) + driSwapOutTextureObject( cursor ); + else + driDestroyTextureObject( cursor ); + + t->memBlock = mmAllocMem( heap->memory_heap, t->totalSize, + heap->alignmentShift, 0 ); + + if (t->memBlock) + break; + } + } + + /* Rebalance duties. If a heap kicked more data than its duty, + * then all other heaps get that amount multiplied with their + * relative weight added to their duty. The negative duty is + * reset to 0. In the end all heaps have a duty >= 0. + * + * CAUTION: we must not change the heap pointer here, because it + * is used below to update the texture object. + */ + for ( id = 0 ; id < nr_heaps ; id++ ) + if ( heap_array[ id ] != NULL && heap_array[ id ]->duty < 0) { + int duty = -heap_array[ id ]->duty; + double weight = heap_array[ id ]->weight; + unsigned j; + + for ( j = 0 ; j < nr_heaps ; j++ ) + if ( j != id && heap_array[ j ] != NULL ) { + heap_array[ j ]->duty += (double) duty * + heap_array[ j ]->weight / weight; + } + + heap_array[ id ]->duty = 0; + } + } + + + if ( t->memBlock != NULL ) { + /* id and heap->heapId may or may not be the same value here. + */ + + assert( heap != NULL ); + assert( (t->heap == NULL) || (t->heap == heap) ); + + t->heap = heap; + return heap->heapId; + } + else { + assert( t->heap == NULL ); + + fprintf( stderr, "[%s:%d] unable to allocate texture\n", + __FUNCTION__, __LINE__ ); + return -1; + } +} + + + + + + +/** + * Set the location where the texture-swap counter is stored. + */ + +void +driSetTextureSwapCounterLocation( driTexHeap * heap, unsigned * counter ) +{ + heap->texture_swaps = (counter == NULL) ? & dummy_swap_counter : counter; +} + + + + +/** + * Create a new heap for texture data. + * + * \param heap_id Device-dependent heap identifier. This value + * will returned by driAllocateTexture when memory + * is allocated from this heap. + * \param context Device-dependent driver context. This is + * supplied as the first parameter to the + * \c destroy_tex_obj function. + * \param size Size, in bytes, of the texture region + * \param alignmentShift Alignment requirement for textures. If textures + * must be allocated on a 4096 byte boundry, this + * would be 12. + * \param nr_regions Number of regions into which this texture space + * should be partitioned + * \param global_regions Array of \c drmTextureRegion structures in the SAREA + * \param global_age Pointer to the global texture age in the SAREA + * \param swapped_objects Pointer to the list of texture objects that are + * not in texture memory (i.e., have been swapped + * out). + * \param texture_object_size Size, in bytes, of a device-dependent texture + * object + * \param destroy_tex_obj Function used to destroy a device-dependent + * texture object + * + * \sa driDestroyTextureHeap + */ + +driTexHeap * +driCreateTextureHeap( unsigned heap_id, void * context, unsigned size, + unsigned alignmentShift, unsigned nr_regions, + drmTextureRegionPtr global_regions, unsigned * global_age, + driTextureObject * swapped_objects, + unsigned texture_object_size, + destroy_texture_object_t * destroy_tex_obj + ) +{ + driTexHeap * heap; + unsigned l; + + + if ( 0 ) + fprintf( stderr, "%s( %u, %p, %u, %u, %u )\n", + __FUNCTION__, + heap_id, (void *)context, size, alignmentShift, nr_regions ); + + heap = (driTexHeap *) CALLOC( sizeof( driTexHeap ) ); + if ( heap != NULL ) { + l = driLog2( (size - 1) / nr_regions ); + if ( l < alignmentShift ) + { + l = alignmentShift; + } + + heap->logGranularity = l; + heap->size = size & ~((1L << l) - 1); + + heap->memory_heap = mmInit( 0, heap->size ); + if ( heap->memory_heap != NULL ) { + heap->heapId = heap_id; + heap->driverContext = context; + + heap->alignmentShift = alignmentShift; + heap->nrRegions = nr_regions; + heap->global_regions = global_regions; + heap->global_age = global_age; + heap->swapped_objects = swapped_objects; + heap->texture_object_size = texture_object_size; + heap->destroy_texture_object = destroy_tex_obj; + + /* Force global heap init */ + if (heap->global_age[0] == 0) + heap->local_age = ~0; + else + heap->local_age = 0; + + make_empty_list( & heap->texture_objects ); + driSetTextureSwapCounterLocation( heap, NULL ); + + heap->weight = heap->size; + heap->duty = 0; + } + else { + FREE( heap ); + heap = NULL; + } + } + + + if ( 0 ) + fprintf( stderr, "%s returning %p\n", __FUNCTION__, (void *)heap ); + + return heap; +} + + + + +/** Destroys a texture heap + * + * \param heap Texture heap to be destroyed + */ + +void +driDestroyTextureHeap( driTexHeap * heap ) +{ + driTextureObject * t; + driTextureObject * temp; + + + if ( heap != NULL ) { + foreach_s( t, temp, & heap->texture_objects ) { + driDestroyTextureObject( t ); + } + foreach_s( t, temp, heap->swapped_objects ) { + driDestroyTextureObject( t ); + } + + mmDestroy( heap->memory_heap ); + FREE( heap ); + } +} + + + + +/****************************************************************************/ +/** + * Determine how many texels (including all mipmap levels) would be required + * for a texture map of size \f$2^^\c base_size_log2\f$ would require. + * + * \param base_size_log2 \f$log_2\f$ of the size of a side of the texture + * \param dimensions Number of dimensions of the texture. Either 2 or 3. + * \param faces Number of faces of the texture. Either 1 or 6 (for cube maps). + * \return Number of texels + */ + +static unsigned +texels_this_map_size( int base_size_log2, unsigned dimensions, unsigned faces ) +{ + unsigned texels; + + + assert( (faces == 1) || (faces == 6) ); + assert( (dimensions == 2) || (dimensions == 3) ); + + texels = 0; + if ( base_size_log2 >= 0 ) { + texels = (1U << (dimensions * base_size_log2)); + + /* See http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg03636.html + * for the complete explaination of why this formulation is used. + * Basically, the smaller mipmap levels sum to 0.333 the size of the + * level 0 map. The total size is therefore the size of the map + * multipled by 1.333. The +2 is there to round up. + */ + + texels = (texels * 4 * faces + 2) / 3; + } + + return texels; +} + + + + +struct maps_per_heap { + unsigned c[32]; +}; + +static void +fill_in_maximums( driTexHeap * const * heaps, unsigned nr_heaps, + unsigned max_bytes_per_texel, unsigned max_size, + unsigned mipmaps_at_once, unsigned dimensions, + unsigned faces, struct maps_per_heap * max_textures ) +{ + unsigned heap; + unsigned log2_size; + unsigned mask; + + + /* Determine how many textures of each size can be stored in each + * texture heap. + */ + + for ( heap = 0 ; heap < nr_heaps ; heap++ ) { + if ( heaps[ heap ] == NULL ) { + (void) memset( max_textures[ heap ].c, 0, + sizeof( max_textures[ heap ].c ) ); + continue; + } + + mask = (1U << heaps[ heap ]->logGranularity) - 1; + + if ( 0 ) { + fprintf( stderr, "[%s:%d] heap[%u] = %u bytes, mask = 0x%08x\n", + __FILE__, __LINE__, + heap, heaps[ heap ]->size, mask ); + } + + for ( log2_size = max_size ; log2_size > 0 ; log2_size-- ) { + unsigned total; + + + /* Determine the total number of bytes required by a texture of + * size log2_size. + */ + + total = texels_this_map_size( log2_size, dimensions, faces ) + - texels_this_map_size( log2_size - mipmaps_at_once, + dimensions, faces ); + total *= max_bytes_per_texel; + total = (total + mask) & ~mask; + + /* The number of textures of a given size that will fit in a heap + * is equal to the size of the heap divided by the size of the + * texture. + */ + + max_textures[ heap ].c[ log2_size ] = heaps[ heap ]->size / total; + + if ( 0 ) { + fprintf( stderr, "[%s:%d] max_textures[%u].c[%02u] " + "= 0x%08x / 0x%08x " + "= %u (%u)\n", + __FILE__, __LINE__, + heap, log2_size, + heaps[ heap ]->size, total, + heaps[ heap ]->size / total, + max_textures[ heap ].c[ log2_size ] ); + } + } + } +} + + +static unsigned +get_max_size( unsigned nr_heaps, + unsigned texture_units, + unsigned max_size, + int all_textures_one_heap, + struct maps_per_heap * max_textures ) +{ + unsigned heap; + unsigned log2_size; + + + /* Determine the largest texture size such that a texture of that size + * can be bound to each texture unit at the same time. Some hardware + * may require that all textures be in the same texture heap for + * multitexturing. + */ + + for ( log2_size = max_size ; log2_size > 0 ; log2_size-- ) { + unsigned total = 0; + + for ( heap = 0 ; heap < nr_heaps ; heap++ ) + { + total += max_textures[ heap ].c[ log2_size ]; + + if ( 0 ) { + fprintf( stderr, "[%s:%d] max_textures[%u].c[%02u] = %u, " + "total = %u\n", __FILE__, __LINE__, heap, log2_size, + max_textures[ heap ].c[ log2_size ], total ); + } + + if ( (max_textures[ heap ].c[ log2_size ] >= texture_units) + || (!all_textures_one_heap && (total >= texture_units)) ) { + /* The number of mipmap levels is the log-base-2 of the + * maximum texture size plus 1. If the maximum texture size + * is 1x1, the log-base-2 is 0 and 1 mipmap level (the base + * level) is available. + */ + + return log2_size + 1; + } + } + } + + /* This should NEVER happen. It should always be possible to have at + * *least* a 1x1 texture in memory! + */ + assert( log2_size != 0 ); + return 0; +} + +#define SET_MAX(f,v) \ + do { if ( max_sizes[v] != 0 ) { limits-> f = max_sizes[v]; } } while( 0 ) + +#define SET_MAX_RECT(f,v) \ + do { if ( max_sizes[v] != 0 ) { limits-> f = 1 << (max_sizes[v] - 1); } } while( 0 ) + + +/** + * Given the amount of texture memory, the number of texture units, and the + * maximum size of a texel, calculate the maximum texture size the driver can + * advertise. + * + * \param heaps Texture heaps for this card + * \param nr_heap Number of texture heaps + * \param limits OpenGL contants. MaxTextureUnits must be set. + * \param max_bytes_per_texel Maximum size of a single texel, in bytes + * \param max_2D_size \f$\log_2\f$ of the maximum 2D texture size (i.e., + * 1024x1024 textures, this would be 10) + * \param max_3D_size \f$\log_2\f$ of the maximum 3D texture size (i.e., + * 1024x1024x1024 textures, this would be 10) + * \param max_cube_size \f$\log_2\f$ of the maximum cube texture size (i.e., + * 1024x1024 textures, this would be 10) + * \param max_rect_size \f$\log_2\f$ of the maximum texture rectangle size + * (i.e., 1024x1024 textures, this would be 10). This is a power-of-2 + * even though texture rectangles need not be a power-of-2. + * \param mipmaps_at_once Total number of mipmaps that can be used + * at one time. For most hardware this will be \f$\c max_size + 1\f$. + * For hardware that does not support mipmapping, this will be 1. + * \param all_textures_one_heap True if the hardware requires that all + * textures be in a single texture heap for multitexturing. + * \param allow_larger_textures 0 conservative, 1 calculate limits + * so at least one worst-case texture can fit, 2 just use hw limits. + */ + +void +driCalculateMaxTextureLevels( driTexHeap * const * heaps, + unsigned nr_heaps, + struct gl_constants * limits, + unsigned max_bytes_per_texel, + unsigned max_2D_size, + unsigned max_3D_size, + unsigned max_cube_size, + unsigned max_rect_size, + unsigned mipmaps_at_once, + int all_textures_one_heap, + int allow_larger_textures ) +{ + struct maps_per_heap max_textures[8]; + unsigned i; + const unsigned dimensions[4] = { 2, 3, 2, 2 }; + const unsigned faces[4] = { 1, 1, 6, 1 }; + unsigned max_sizes[4]; + unsigned mipmaps[4]; + + + max_sizes[0] = max_2D_size; + max_sizes[1] = max_3D_size; + max_sizes[2] = max_cube_size; + max_sizes[3] = max_rect_size; + + mipmaps[0] = mipmaps_at_once; + mipmaps[1] = mipmaps_at_once; + mipmaps[2] = mipmaps_at_once; + mipmaps[3] = 1; + + + /* Calculate the maximum number of texture levels in two passes. The + * first pass determines how many textures of each power-of-two size + * (including all mipmap levels for that size) can fit in each texture + * heap. The second pass finds the largest texture size that allows + * a texture of that size to be bound to every texture unit. + */ + + for ( i = 0 ; i < 4 ; i++ ) { + if ( (allow_larger_textures != 2) && (max_sizes[ i ] != 0) ) { + fill_in_maximums( heaps, nr_heaps, max_bytes_per_texel, + max_sizes[ i ], mipmaps[ i ], + dimensions[ i ], faces[ i ], + max_textures ); + + max_sizes[ i ] = get_max_size( nr_heaps, + allow_larger_textures == 1 ? + 1 : limits->MaxTextureUnits, + max_sizes[ i ], + all_textures_one_heap, + max_textures ); + } + else if (max_sizes[ i ] != 0) { + max_sizes[ i ] += 1; + } + } + + SET_MAX( MaxTextureLevels, 0 ); + SET_MAX( Max3DTextureLevels, 1 ); + SET_MAX( MaxCubeTextureLevels, 2 ); + SET_MAX_RECT( MaxTextureRectSize, 3 ); +} + + + + +/** + * Perform initial binding of default textures objects on a per unit, per + * texture target basis. + * + * \param ctx Current OpenGL context + * \param swapped List of swapped-out textures + * \param targets Bit-mask of value texture targets + */ + +void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped, + GLuint targets ) +{ + struct gl_texture_object *texObj; + GLuint tmp = ctx->Texture.CurrentUnit; + unsigned i; + + + for ( i = 0 ; i < ctx->Const.MaxTextureUnits ; i++ ) { + ctx->Texture.CurrentUnit = i; + + if ( (targets & DRI_TEXMGR_DO_TEXTURE_1D) != 0 ) { + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_1D_INDEX]; + ctx->Driver.BindTexture( ctx, GL_TEXTURE_1D, texObj ); + move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); + } + + if ( (targets & DRI_TEXMGR_DO_TEXTURE_2D) != 0 ) { + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_2D_INDEX]; + ctx->Driver.BindTexture( ctx, GL_TEXTURE_2D, texObj ); + move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); + } + + if ( (targets & DRI_TEXMGR_DO_TEXTURE_3D) != 0 ) { + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_3D_INDEX]; + ctx->Driver.BindTexture( ctx, GL_TEXTURE_3D, texObj ); + move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); + } + + if ( (targets & DRI_TEXMGR_DO_TEXTURE_CUBE) != 0 ) { + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_CUBE_INDEX]; + ctx->Driver.BindTexture( ctx, GL_TEXTURE_CUBE_MAP_ARB, texObj ); + move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); + } + + if ( (targets & DRI_TEXMGR_DO_TEXTURE_RECT) != 0 ) { + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_RECT_INDEX]; + ctx->Driver.BindTexture( ctx, GL_TEXTURE_RECTANGLE_NV, texObj ); + move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); + } + } + + ctx->Texture.CurrentUnit = tmp; +} + + + + +/** + * Verify that the specified texture is in the specificed heap. + * + * \param tex Texture to be tested. + * \param heap Texture memory heap to be tested. + * \return True if the texture is in the heap, false otherwise. + */ + +static GLboolean +check_in_heap( const driTextureObject * tex, const driTexHeap * heap ) +{ +#if 1 + return tex->heap == heap; +#else + driTextureObject * curr; + + foreach( curr, & heap->texture_objects ) { + if ( curr == tex ) { + break; + } + } + + return curr == tex; +#endif +} + + + +/****************************************************************************/ +/** + * Validate the consistency of a set of texture heaps. + * Original version by Keith Whitwell in r200/r200_sanity.c. + */ + +GLboolean +driValidateTextureHeaps( driTexHeap * const * texture_heaps, + unsigned nr_heaps, const driTextureObject * swapped ) +{ + driTextureObject *t; + unsigned i; + + for ( i = 0 ; i < nr_heaps ; i++ ) { + int last_end = 0; + unsigned textures_in_heap = 0; + unsigned blocks_in_mempool = 0; + const driTexHeap * heap = texture_heaps[i]; + const struct mem_block *p = heap->memory_heap; + + /* Check each texture object has a MemBlock, and is linked into + * the correct heap. + * + * Check the texobj base address corresponds to the MemBlock + * range. Check the texobj size (recalculate?) fits within + * the MemBlock. + * + * Count the number of texobj's using this heap. + */ + + foreach ( t, &heap->texture_objects ) { + if ( !check_in_heap( t, heap ) ) { + fprintf( stderr, "%s memory block for texture object @ %p not " + "found in heap #%d\n", + __FUNCTION__, (void *)t, i ); + return GL_FALSE; + } + + + if ( t->totalSize > t->memBlock->size ) { + fprintf( stderr, "%s: Memory block for texture object @ %p is " + "only %u bytes, but %u are required\n", + __FUNCTION__, (void *)t, t->totalSize, t->memBlock->size ); + return GL_FALSE; + } + + textures_in_heap++; + } + + /* Validate the contents of the heap: + * - Ordering + * - Overlaps + * - Bounds + */ + + while ( p != NULL ) { + if (p->reserved) { + fprintf( stderr, "%s: Block (%08x,%x), is reserved?!\n", + __FUNCTION__, p->ofs, p->size ); + return GL_FALSE; + } + + if (p->ofs != last_end) { + fprintf( stderr, "%s: blocks_in_mempool = %d, last_end = %d, p->ofs = %d\n", + __FUNCTION__, blocks_in_mempool, last_end, p->ofs ); + return GL_FALSE; + } + + if (!p->reserved && !p->free) { + blocks_in_mempool++; + } + + last_end = p->ofs + p->size; + p = p->next; + } + + if (textures_in_heap != blocks_in_mempool) { + fprintf( stderr, "%s: Different number of textures objects (%u) and " + "inuse memory blocks (%u)\n", + __FUNCTION__, textures_in_heap, blocks_in_mempool ); + return GL_FALSE; + } + +#if 0 + fprintf( stderr, "%s: textures_in_heap = %u\n", + __FUNCTION__, textures_in_heap ); +#endif + } + + + /* Check swapped texobj's have zero memblocks + */ + i = 0; + foreach ( t, swapped ) { + if ( t->memBlock != NULL ) { + fprintf( stderr, "%s: Swapped texobj %p has non-NULL memblock %p\n", + __FUNCTION__, (void *)t, (void *)t->memBlock ); + return GL_FALSE; + } + i++; + } + +#if 0 + fprintf( stderr, "%s: swapped texture count = %u\n", __FUNCTION__, i ); +#endif + + return GL_TRUE; +} + + + + +/****************************************************************************/ +/** + * Compute which mipmap levels that really need to be sent to the hardware. + * This depends on the base image size, GL_TEXTURE_MIN_LOD, + * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL. + */ + +void +driCalculateTextureFirstLastLevel( driTextureObject * t ) +{ + struct gl_texture_object * const tObj = t->tObj; + const struct gl_texture_image * const baseImage = + tObj->Image[0][tObj->BaseLevel]; + + /* These must be signed values. MinLod and MaxLod can be negative numbers, + * and having firstLevel and lastLevel as signed prevents the need for + * extra sign checks. + */ + int firstLevel; + int lastLevel; + + /* Yes, this looks overly complicated, but it's all needed. + */ + + switch (tObj->Target) { + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + case GL_TEXTURE_CUBE_MAP: + if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) { + /* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL. + */ + + firstLevel = lastLevel = tObj->BaseLevel; + } + else { + firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5); + firstLevel = MAX2(firstLevel, tObj->BaseLevel); + firstLevel = MIN2(firstLevel, tObj->BaseLevel + baseImage->MaxLog2); + lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5); + lastLevel = MAX2(lastLevel, t->tObj->BaseLevel); + lastLevel = MIN2(lastLevel, t->tObj->BaseLevel + baseImage->MaxLog2); + lastLevel = MIN2(lastLevel, t->tObj->MaxLevel); + lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ + } + break; + case GL_TEXTURE_RECTANGLE_NV: + case GL_TEXTURE_4D_SGIS: + firstLevel = lastLevel = 0; + break; + default: + return; + } + + /* save these values */ + t->firstLevel = firstLevel; + t->lastLevel = lastLevel; +} + + + + +/** + * \name DRI texture formats. Pointers initialized to either the big- or + * little-endian Mesa formats. + */ +/*@{*/ +const struct gl_texture_format *_dri_texformat_rgba8888 = NULL; +const struct gl_texture_format *_dri_texformat_argb8888 = NULL; +const struct gl_texture_format *_dri_texformat_rgb565 = NULL; +const struct gl_texture_format *_dri_texformat_argb4444 = NULL; +const struct gl_texture_format *_dri_texformat_argb1555 = NULL; +const struct gl_texture_format *_dri_texformat_al88 = NULL; +const struct gl_texture_format *_dri_texformat_a8 = &_mesa_texformat_a8; +const struct gl_texture_format *_dri_texformat_ci8 = &_mesa_texformat_ci8; +const struct gl_texture_format *_dri_texformat_i8 = &_mesa_texformat_i8; +const struct gl_texture_format *_dri_texformat_l8 = &_mesa_texformat_l8; +/*@}*/ + + +/** + * Initialize little endian target, host byte order independent texture formats + */ +void +driInitTextureFormats(void) +{ + const GLuint ui = 1; + const GLubyte littleEndian = *((const GLubyte *) &ui); + + if (littleEndian) { + _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888; + _dri_texformat_argb8888 = &_mesa_texformat_argb8888; + _dri_texformat_rgb565 = &_mesa_texformat_rgb565; + _dri_texformat_argb4444 = &_mesa_texformat_argb4444; + _dri_texformat_argb1555 = &_mesa_texformat_argb1555; + _dri_texformat_al88 = &_mesa_texformat_al88; + } + else { + _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888_rev; + _dri_texformat_argb8888 = &_mesa_texformat_argb8888_rev; + _dri_texformat_rgb565 = &_mesa_texformat_rgb565_rev; + _dri_texformat_argb4444 = &_mesa_texformat_argb4444_rev; + _dri_texformat_argb1555 = &_mesa_texformat_argb1555_rev; + _dri_texformat_al88 = &_mesa_texformat_al88_rev; + } +} diff --git a/mesalib/src/mesa/drivers/dri/common/texmem.h b/mesalib/src/mesa/drivers/dri/common/texmem.h new file mode 100644 index 000000000..9c065da8b --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/texmem.h @@ -0,0 +1,333 @@ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * (c) Copyright IBM Corporation 2002 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to 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 + * VA LINUX SYSTEM, 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. + * + * Authors: + * Ian Romanick + * Keith Whitwell + * Kevin E. Martin + * Gareth Hughes + */ + +/** \file texmem.h + * Public interface to the DRI texture memory management routines. + * + * \sa texmem.c + */ + +#ifndef DRI_TEXMEM_H +#define DRI_TEXMEM_H + +#include "main/mtypes.h" +#include "main/mm.h" +#include "xf86drm.h" + +struct dri_tex_heap; +typedef struct dri_tex_heap driTexHeap; + +struct dri_texture_object; +typedef struct dri_texture_object driTextureObject; + + +/** + * Base texture object type. Each driver will extend this type with its own + * private data members. + */ + +struct dri_texture_object { + struct dri_texture_object * next; + struct dri_texture_object * prev; + + driTexHeap * heap; /**< Texture heap currently stored in */ + struct gl_texture_object * tObj;/**< Pointer to Mesa texture object + * If NULL, this texture object is a + * "placeholder" object representing + * texture memory in use by another context. + * A placeholder should have a heap and a memBlock. + */ + struct mem_block *memBlock; /**< Memory block containing texture */ + + unsigned reserved; /**< Cannot be swapped out by user contexts. */ + + unsigned bound; /**< Bitmask indicating which tex units + * this texture object is bound to. + * Bit 0 = unit 0, Bit 1 = unit 1, etc + */ + + unsigned totalSize; /**< Total size of the texture, + * including all mipmap levels + */ + + unsigned dirty_images[6]; /**< Flags for whether or not images + * need to be uploaded to local or + * AGP texture space. One flag set + * for each cube face for cubic + * textures. Bit zero corresponds to + * the base-level, which may or may + * not be the level zero mipmap. + */ + + unsigned timestamp; /**< Timestamp used to + * synchronize with 3d engine + * in hardware where textures + * are uploaded directly to + * the framebuffer. + */ + + unsigned firstLevel; /**< Image in \c tObj->Image[0] that + * corresponds to the base-level of + * this texture object. + */ + + unsigned lastLevel; /**< Last image in \c tObj->Image[0] + * used by the + * current LOD settings of + * this texture object. This + * value must be greater than + * or equal to \c firstLevel. + */ +}; + + +typedef void (destroy_texture_object_t)( void * driverContext, + driTextureObject * t ); + +/** + * Client-private representation of texture memory state. + * + * Clients will place one or more of these structs in their driver + * context struct to manage one or more global texture heaps. + */ + +struct dri_tex_heap { + + /** Client-supplied heap identifier + */ + unsigned heapId; + + /** Pointer to the client's private context + */ + void *driverContext; + + /** Total size of the heap, in bytes + */ + unsigned size; + + /** \brief \f$log_2\f$ of size of single heap region + * + * Each context takes memory from the global texture heap in + * \f$2^{logGranularity}\f$ byte blocks. The value of + * \a logGranularity is based on the amount of memory represented + * by the heap and the maximum number of regions in the SAREA. Given + * \a b bytes of texture memory an \a n regions in the SAREA, + * \a logGranularity will be \f$\lfloor\log_2( b / n )\rfloor\f$. + */ + unsigned logGranularity; + + /** \brief Required alignment of allocations in this heap + * + * The alignment shift is supplied to \a mmAllocMem when memory is + * allocated from this heap. The value of \a alignmentShift will + * typically reflect some require of the hardware. This value has + * \b no \b relation to \a logGranularity. \a alignmentShift is a + * per-context value. + * + * \sa mmAllocMem + */ + unsigned alignmentShift; + + /** Number of elements in global list (the SAREA). + */ + unsigned nrRegions; + + /** Pointer to SAREA \a driTexRegion array + */ + drmTextureRegionPtr global_regions; + + /** Pointer to the texture state age (generation number) in the SAREA + */ + unsigned * global_age; + + /** Local age (generation number) of texture state + */ + unsigned local_age; + + /** Memory heap used to manage texture memory represented by + * this texture heap. + */ + struct mem_block * memory_heap; + + /** List of objects that we currently believe to be in texture + * memory. + */ + driTextureObject texture_objects; + + /** Pointer to the list of texture objects that are not in + * texture memory. + */ + driTextureObject * swapped_objects; + + /** Size of the driver-speicific texture object. + */ + unsigned texture_object_size; + + + /** + * \brief Function to destroy driver-specific texture object data. + * + * This function is supplied by the driver so that the texture manager + * can release all resources associated with a texture object. This + * function should only release driver-specific data. That is, + * \a driDestroyTextureObject will release the texture memory + * associated with the texture object, it will release the memory + * for the texture object itself, and it will unlink the texture + * object from the texture object lists. + * + * \param driverContext Pointer to the driver supplied context + * \param t Texture object that is to be destroyed + * \sa driDestroyTextureObject + */ + + destroy_texture_object_t * destroy_texture_object; + + + /** + */ + unsigned * texture_swaps; + + /** + * Timestamp used to synchronize with 3d engine in hardware + * where textures are uploaded directly to the + * framebuffer. + */ + unsigned timestamp; + + /** \brief Kick/upload weight + * + * When not enough free space is available this weight + * influences the choice of the heap from which textures are + * kicked. By default the weight is equal to the heap size. + */ + double weight; + + /** \brief Kick/upload duty + * + * The heap with the highest duty will be chosen for kicking + * textures if not enough free space is available. The duty is + * reduced by the amount of data kicked. Rebalancing of + * negative duties takes the weights into account. + */ + int duty; +}; + + + + +/** + * Called by the client on lock contention to determine whether textures have + * been stolen. If another client has modified a region in which we have + * textures, then we need to figure out which of our textures have been + * removed and update our global LRU. + * + * \param heap Texture heap to be updated + * \hideinitializer + */ + +#define DRI_AGE_TEXTURES( heap ) \ + do { \ + if ( ((heap) != NULL) \ + && ((heap)->local_age != (heap)->global_age[0]) ) \ + driAgeTextures( heap ); \ + } while( 0 ) + + + + +/* This should be called whenever there has been contention on the hardware + * lock. driAgeTextures should not be called directly. Instead, clients + * should use DRI_AGE_TEXTURES, above. + */ + +void driAgeTextures( driTexHeap * heap ); + +void driUpdateTextureLRU( driTextureObject * t ); +void driSwapOutTextureObject( driTextureObject * t ); +void driDestroyTextureObject( driTextureObject * t ); +int driAllocateTexture( driTexHeap * const * heap_array, unsigned nr_heaps, + driTextureObject * t ); + +GLboolean driIsTextureResident( GLcontext * ctx, + struct gl_texture_object * texObj ); + +driTexHeap * driCreateTextureHeap( unsigned heap_id, void * context, + unsigned size, unsigned alignmentShift, unsigned nr_regions, + drmTextureRegionPtr global_regions, unsigned * global_age, + driTextureObject * swapped_objects, unsigned texture_object_size, + destroy_texture_object_t * destroy_tex_obj ); +void driDestroyTextureHeap( driTexHeap * heap ); + +void +driCalculateMaxTextureLevels( driTexHeap * const * heaps, + unsigned nr_heaps, + struct gl_constants * limits, + unsigned max_bytes_per_texel, + unsigned max_2D_size, + unsigned max_3D_size, + unsigned max_cube_size, + unsigned max_rect_size, + unsigned mipmaps_at_once, + int all_textures_one_heap, + int allow_larger_textures ); + +void +driSetTextureSwapCounterLocation( driTexHeap * heap, unsigned * counter ); + +#define DRI_TEXMGR_DO_TEXTURE_1D 0x0001 +#define DRI_TEXMGR_DO_TEXTURE_2D 0x0002 +#define DRI_TEXMGR_DO_TEXTURE_3D 0x0004 +#define DRI_TEXMGR_DO_TEXTURE_CUBE 0x0008 +#define DRI_TEXMGR_DO_TEXTURE_RECT 0x0010 + +void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped, + GLuint targets ); + +GLboolean driValidateTextureHeaps( driTexHeap * const * texture_heaps, + unsigned nr_heaps, const driTextureObject * swapped ); + +extern void driCalculateTextureFirstLastLevel( driTextureObject * t ); + + +extern const struct gl_texture_format *_dri_texformat_rgba8888; +extern const struct gl_texture_format *_dri_texformat_argb8888; +extern const struct gl_texture_format *_dri_texformat_rgb565; +extern const struct gl_texture_format *_dri_texformat_argb4444; +extern const struct gl_texture_format *_dri_texformat_argb1555; +extern const struct gl_texture_format *_dri_texformat_al88; +extern const struct gl_texture_format *_dri_texformat_a8; +extern const struct gl_texture_format *_dri_texformat_ci8; +extern const struct gl_texture_format *_dri_texformat_i8; +extern const struct gl_texture_format *_dri_texformat_l8; + +extern void driInitTextureFormats( void ); + +#endif /* DRI_TEXMEM_H */ diff --git a/mesalib/src/mesa/drivers/dri/common/utils.c b/mesalib/src/mesa/drivers/dri/common/utils.c new file mode 100644 index 000000000..66f277c10 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/utils.c @@ -0,0 +1,839 @@ +/* + * (C) Copyright IBM Corporation 2002, 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 + * VA LINUX SYSTEM, 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 utils.c + * Utility functions for DRI drivers. + * + * \author Ian Romanick + */ + +#include +#include +#include "main/mtypes.h" +#include "main/cpuinfo.h" +#include "main/extensions.h" +#include "glapi/dispatch.h" +#include "utils.h" + + +int driDispatchRemapTable[ driDispatchRemapTable_size ]; + + +unsigned +driParseDebugString( const char * debug, + const struct dri_debug_control * control ) +{ + unsigned flag; + + + flag = 0; + if ( debug != NULL ) { + while( control->string != NULL ) { + if ( !strcmp( debug, "all" ) || + strstr( debug, control->string ) != NULL ) { + flag |= control->flag; + } + + control++; + } + } + + return flag; +} + + + +/** + * Create the \c GL_RENDERER string for DRI drivers. + * + * Almost all DRI drivers use a \c GL_RENDERER string of the form: + * + * "Mesa DRI " + * + * Using the supplied chip name, driver data, and AGP speed, this function + * creates the string. + * + * \param buffer Buffer to hold the \c GL_RENDERER string. + * \param hardware_name Name of the hardware. + * \param driver_date Driver date. + * \param agp_mode AGP mode (speed). + * + * \returns + * The length of the string stored in \c buffer. This does \b not include + * the terminating \c NUL character. + */ +unsigned +driGetRendererString( char * buffer, const char * hardware_name, + const char * driver_date, GLuint agp_mode ) +{ + unsigned offset; + char *cpu; + + offset = sprintf( buffer, "Mesa DRI %s %s", hardware_name, driver_date ); + + /* Append any AGP-specific information. + */ + switch ( agp_mode ) { + case 1: + case 2: + case 4: + case 8: + offset += sprintf( & buffer[ offset ], " AGP %ux", agp_mode ); + break; + + default: + break; + } + + /* Append any CPU-specific information. + */ + cpu = _mesa_get_cpu_string(); + if (cpu) { + offset += sprintf(buffer + offset, " %s", cpu); + _mesa_free(cpu); + } + + return offset; +} + + + + +#define need_GL_ARB_draw_buffers +#define need_GL_ARB_multisample +#define need_GL_ARB_texture_compression +#define need_GL_ARB_transpose_matrix +#define need_GL_ARB_vertex_buffer_object +#define need_GL_ARB_window_pos +#define need_GL_EXT_compiled_vertex_array +#define need_GL_EXT_multi_draw_arrays +#define need_GL_EXT_polygon_offset +#define need_GL_EXT_texture_object +#define need_GL_EXT_vertex_array +#define need_GL_IBM_multimode_draw_arrays +#define need_GL_MESA_window_pos + +/* These are needed in *all* drivers because Mesa internally implements + * certain functionality in terms of functions provided by these extensions. + * For example, glBlendFunc is implemented by calling glBlendFuncSeparateEXT. + */ +#define need_GL_EXT_blend_func_separate +#define need_GL_NV_vertex_program + +#include "extension_helper.h" + +static const struct dri_extension all_mesa_extensions[] = { + { "GL_ARB_draw_buffers", GL_ARB_draw_buffers_functions }, + { "GL_ARB_multisample", GL_ARB_multisample_functions }, + { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions }, + { "GL_ARB_transpose_matrix", GL_ARB_transpose_matrix_functions }, + { "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions}, + { "GL_ARB_window_pos", GL_ARB_window_pos_functions }, + { "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions }, + { "GL_EXT_compiled_vertex_array", GL_EXT_compiled_vertex_array_functions }, + { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions }, + { "GL_EXT_polygon_offset", GL_EXT_polygon_offset_functions }, + { "GL_EXT_texture_object", GL_EXT_texture_object_functions }, + { "GL_EXT_vertex_array", GL_EXT_vertex_array_functions }, + { "GL_IBM_multimode_draw_arrays", GL_IBM_multimode_draw_arrays_functions }, + { "GL_MESA_window_pos", GL_MESA_window_pos_functions }, + { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, + { NULL, NULL } +}; + + +/** + * Enable extensions supported by the driver. + * + * \bug + * ARB_imaging isn't handled properly. In Mesa, enabling ARB_imaging also + * enables all the sub-extensions that are folded into it. This means that + * we need to add entry-points (via \c driInitSingleExtension) for those + * new functions here. + */ +void driInitExtensions( GLcontext * ctx, + const struct dri_extension * extensions_to_enable, + GLboolean enable_imaging ) +{ + static int first_time = 1; + unsigned i; + + if ( first_time ) { + for ( i = 0 ; i < driDispatchRemapTable_size ; i++ ) { + driDispatchRemapTable[i] = -1; + } + + first_time = 0; + driInitExtensions( ctx, all_mesa_extensions, GL_FALSE ); + } + + if ( (ctx != NULL) && enable_imaging ) { + _mesa_enable_imaging_extensions( ctx ); + } + + for ( i = 0 ; extensions_to_enable[i].name != NULL ; i++ ) { + driInitSingleExtension( ctx, & extensions_to_enable[i] ); + } +} + + + + +/** + * Enable and add dispatch functions for a single extension + * + * \param ctx Context where extension is to be enabled. + * \param ext Extension that is to be enabled. + * + * \sa driInitExtensions, _mesa_enable_extension, _glapi_add_entrypoint + * + * \todo + * Determine if it would be better to use \c strlen instead of the hardcoded + * for-loops. + */ +void driInitSingleExtension( GLcontext * ctx, + const struct dri_extension * ext ) +{ + unsigned i; + + + if ( ext->functions != NULL ) { + for ( i = 0 ; ext->functions[i].strings != NULL ; i++ ) { + const char * functions[16]; + const char * parameter_signature; + const char * str = ext->functions[i].strings; + unsigned j; + unsigned offset; + + + /* Separate the parameter signature from the rest of the string. + * If the parameter signature is empty (i.e., the string starts + * with a NUL character), then the function has a void parameter + * list. + */ + parameter_signature = str; + while ( str[0] != '\0' ) { + str++; + } + str++; + + + /* Divide the string into the substrings that name each + * entry-point for the function. + */ + for ( j = 0 ; j < 16 ; j++ ) { + if ( str[0] == '\0' ) { + functions[j] = NULL; + break; + } + + functions[j] = str; + + while ( str[0] != '\0' ) { + str++; + } + str++; + } + + + /* Add each entry-point to the dispatch table. + */ + offset = _glapi_add_dispatch( functions, parameter_signature ); + if (offset == -1) { +#if 0 /* this causes noise with egl */ + fprintf(stderr, "DISPATCH ERROR! _glapi_add_dispatch failed " + "to add %s!\n", functions[0]); +#endif + } + else if (ext->functions[i].remap_index != -1) { + driDispatchRemapTable[ ext->functions[i].remap_index ] = + offset; + } + else if (ext->functions[i].offset != offset) { + fprintf(stderr, "DISPATCH ERROR! %s -> %u != %u\n", + functions[0], offset, ext->functions[i].offset); + } + } + } + + if ( ctx != NULL ) { + _mesa_enable_extension( ctx, ext->name ); + } +} + + +/** + * Utility function used by drivers to test the verions of other components. + * + * If one of the version requirements is not met, a message is logged using + * \c __driUtilMessage. + * + * \param driver_name Name of the driver. Used in error messages. + * \param driActual Actual DRI version supplied __driCreateNewScreen. + * \param driExpected Minimum DRI version required by the driver. + * \param ddxActual Actual DDX version supplied __driCreateNewScreen. + * \param ddxExpected Minimum DDX minor and range of DDX major version required by the driver. + * \param drmActual Actual DRM version supplied __driCreateNewScreen. + * \param drmExpected Minimum DRM version required by the driver. + * + * \returns \c GL_TRUE if all version requirements are met. Otherwise, + * \c GL_FALSE is returned. + * + * \sa __driCreateNewScreen, driCheckDriDdxDrmVersions2, __driUtilMessage + * + * \todo + * Now that the old \c driCheckDriDdxDrmVersions function is gone, this + * function and \c driCheckDriDdxDrmVersions2 should be renamed. + */ +GLboolean +driCheckDriDdxDrmVersions3(const char * driver_name, + const __DRIversion * driActual, + const __DRIversion * driExpected, + const __DRIversion * ddxActual, + const __DRIutilversion2 * ddxExpected, + const __DRIversion * drmActual, + const __DRIversion * drmExpected) +{ + static const char format[] = "%s DRI driver expected %s version %d.%d.x " + "but got version %d.%d.%d\n"; + static const char format2[] = "%s DRI driver expected %s version %d-%d.%d.x " + "but got version %d.%d.%d\n"; + + + /* Check the DRI version */ + if ( (driActual->major != driExpected->major) + || (driActual->minor < driExpected->minor) ) { + fprintf(stderr, format, driver_name, "DRI", + driExpected->major, driExpected->minor, + driActual->major, driActual->minor, driActual->patch); + return GL_FALSE; + } + + /* Check that the DDX driver version is compatible */ + /* for miniglx we pass in -1 so we can ignore the DDX version */ + if ( (ddxActual->major != -1) && ((ddxActual->major < ddxExpected->major_min) + || (ddxActual->major > ddxExpected->major_max) + || (ddxActual->minor < ddxExpected->minor)) ) { + fprintf(stderr, format2, driver_name, "DDX", + ddxExpected->major_min, ddxExpected->major_max, ddxExpected->minor, + ddxActual->major, ddxActual->minor, ddxActual->patch); + return GL_FALSE; + } + + /* Check that the DRM driver version is compatible */ + if ( (drmActual->major != drmExpected->major) + || (drmActual->minor < drmExpected->minor) ) { + fprintf(stderr, format, driver_name, "DRM", + drmExpected->major, drmExpected->minor, + drmActual->major, drmActual->minor, drmActual->patch); + return GL_FALSE; + } + + return GL_TRUE; +} + +GLboolean +driCheckDriDdxDrmVersions2(const char * driver_name, + const __DRIversion * driActual, + const __DRIversion * driExpected, + const __DRIversion * ddxActual, + const __DRIversion * ddxExpected, + const __DRIversion * drmActual, + const __DRIversion * drmExpected) +{ + __DRIutilversion2 ddx_expected; + ddx_expected.major_min = ddxExpected->major; + ddx_expected.major_max = ddxExpected->major; + ddx_expected.minor = ddxExpected->minor; + ddx_expected.patch = ddxExpected->patch; + return driCheckDriDdxDrmVersions3(driver_name, driActual, + driExpected, ddxActual, & ddx_expected, + drmActual, drmExpected); +} + +GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, + GLint *x, GLint *y, + GLsizei *width, GLsizei *height ) +{ + /* left clipping */ + if (*x < buffer->_Xmin) { + *width -= (buffer->_Xmin - *x); + *x = buffer->_Xmin; + } + + /* right clipping */ + if (*x + *width > buffer->_Xmax) + *width -= (*x + *width - buffer->_Xmax - 1); + + if (*width <= 0) + return GL_FALSE; + + /* bottom clipping */ + if (*y < buffer->_Ymin) { + *height -= (buffer->_Ymin - *y); + *y = buffer->_Ymin; + } + + /* top clipping */ + if (*y + *height > buffer->_Ymax) + *height -= (*y + *height - buffer->_Ymax - 1); + + if (*height <= 0) + return GL_FALSE; + + return GL_TRUE; +} + +/** + * Creates a set of \c __GLcontextModes that a driver will expose. + * + * A set of \c __GLcontextModes will be created based on the supplied + * parameters. The number of modes processed will be 2 * + * \c num_depth_stencil_bits * \c num_db_modes. + * + * For the most part, data is just copied from \c depth_bits, \c stencil_bits, + * \c db_modes, and \c visType into each \c __GLcontextModes element. + * However, the meanings of \c fb_format and \c fb_type require further + * explanation. The \c fb_format specifies which color components are in + * each pixel and what the default order is. For example, \c GL_RGB specifies + * that red, green, blue are available and red is in the "most significant" + * position and blue is in the "least significant". The \c fb_type specifies + * the bit sizes of each component and the actual ordering. For example, if + * \c GL_UNSIGNED_SHORT_5_6_5_REV is specified with \c GL_RGB, bits [15:11] + * are the blue value, bits [10:5] are the green value, and bits [4:0] are + * the red value. + * + * One sublte issue is the combination of \c GL_RGB or \c GL_BGR and either + * of the \c GL_UNSIGNED_INT_8_8_8_8 modes. The resulting mask values in the + * \c __GLcontextModes structure is \b identical to the \c GL_RGBA or + * \c GL_BGRA case, except the \c alphaMask is zero. This means that, as + * far as this routine is concerned, \c GL_RGB with \c GL_UNSIGNED_INT_8_8_8_8 + * still uses 32-bits. + * + * If in doubt, look at the tables used in the function. + * + * \param ptr_to_modes Pointer to a pointer to a linked list of + * \c __GLcontextModes. Upon completion, a pointer to + * the next element to be process will be stored here. + * If the function fails and returns \c GL_FALSE, this + * value will be unmodified, but some elements in the + * linked list may be modified. + * \param fb_format Format of the framebuffer. Currently only \c GL_RGB, + * \c GL_RGBA, \c GL_BGR, and \c GL_BGRA are supported. + * \param fb_type Type of the pixels in the framebuffer. Currently only + * \c GL_UNSIGNED_SHORT_5_6_5, + * \c GL_UNSIGNED_SHORT_5_6_5_REV, + * \c GL_UNSIGNED_INT_8_8_8_8, and + * \c GL_UNSIGNED_INT_8_8_8_8_REV are supported. + * \param depth_bits Array of depth buffer sizes to be exposed. + * \param stencil_bits Array of stencil buffer sizes to be exposed. + * \param num_depth_stencil_bits Number of entries in both \c depth_bits and + * \c stencil_bits. + * \param db_modes Array of buffer swap modes. If an element has a + * value of \c GLX_NONE, then it represents a + * single-buffered mode. Other valid values are + * \c GLX_SWAP_EXCHANGE_OML, \c GLX_SWAP_COPY_OML, and + * \c GLX_SWAP_UNDEFINED_OML. See the + * GLX_OML_swap_method extension spec for more details. + * \param num_db_modes Number of entries in \c db_modes. + * \param msaa_samples Array of msaa sample count. 0 represents a visual + * without a multisample buffer. + * \param num_msaa_modes Number of entries in \c msaa_samples. + * \param visType GLX visual type. Usually either \c GLX_TRUE_COLOR or + * \c GLX_DIRECT_COLOR. + * + * \returns + * \c GL_TRUE on success or \c GL_FALSE on failure. Currently the only + * cause of failure is a bad parameter (i.e., unsupported \c fb_format or + * \c fb_type). + * + * \todo + * There is currently no way to support packed RGB modes (i.e., modes with + * exactly 3 bytes per pixel) or floating-point modes. This could probably + * be done by creating some new, private enums with clever names likes + * \c GL_UNSIGNED_3BYTE_8_8_8, \c GL_4FLOAT_32_32_32_32, + * \c GL_4HALF_16_16_16_16, etc. We can cross that bridge when we come to it. + */ +__DRIconfig ** +driCreateConfigs(GLenum fb_format, GLenum fb_type, + const uint8_t * depth_bits, const uint8_t * stencil_bits, + unsigned num_depth_stencil_bits, + const GLenum * db_modes, unsigned num_db_modes, + const uint8_t * msaa_samples, unsigned num_msaa_modes) +{ + static const uint8_t bits_table[4][4] = { + /* R G B A */ + { 3, 3, 2, 0 }, /* Any GL_UNSIGNED_BYTE_3_3_2 */ + { 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */ + { 8, 8, 8, 0 }, /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */ + { 8, 8, 8, 8 } /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */ + }; + + static const uint32_t masks_table_rgb[6][4] = { + { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 3_3_2 */ + { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 2_3_3_REV */ + { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5 */ + { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5_REV */ + { 0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000 }, /* 8_8_8_8 */ + { 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 } /* 8_8_8_8_REV */ + }; + + static const uint32_t masks_table_rgba[6][4] = { + { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 3_3_2 */ + { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 2_3_3_REV */ + { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5 */ + { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5_REV */ + { 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF }, /* 8_8_8_8 */ + { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 }, /* 8_8_8_8_REV */ + }; + + static const uint32_t masks_table_bgr[6][4] = { + { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 3_3_2 */ + { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 2_3_3_REV */ + { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5 */ + { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5_REV */ + { 0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000 }, /* 8_8_8_8 */ + { 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 }, /* 8_8_8_8_REV */ + }; + + static const uint32_t masks_table_bgra[6][4] = { + { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 3_3_2 */ + { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 2_3_3_REV */ + { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5 */ + { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5_REV */ + { 0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF }, /* 8_8_8_8 */ + { 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 }, /* 8_8_8_8_REV */ + }; + + static const uint8_t bytes_per_pixel[6] = { + 1, /* 3_3_2 */ + 1, /* 2_3_3_REV */ + 2, /* 5_6_5 */ + 2, /* 5_6_5_REV */ + 4, /* 8_8_8_8 */ + 4 /* 8_8_8_8_REV */ + }; + + const uint8_t * bits; + const uint32_t * masks; + int index; + __DRIconfig **configs, **c; + __GLcontextModes *modes; + unsigned i, j, k, h; + unsigned num_modes; + unsigned num_accum_bits = 2; + + switch ( fb_type ) { + case GL_UNSIGNED_BYTE_3_3_2: + index = 0; + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + index = 1; + break; + case GL_UNSIGNED_SHORT_5_6_5: + index = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + index = 3; + break; + case GL_UNSIGNED_INT_8_8_8_8: + index = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + index = 5; + break; + default: + fprintf( stderr, "[%s:%u] Unknown framebuffer type 0x%04x.\n", + __FUNCTION__, __LINE__, fb_type ); + return NULL; + } + + + /* Valid types are GL_UNSIGNED_SHORT_5_6_5 and GL_UNSIGNED_INT_8_8_8_8 and + * the _REV versions. + * + * Valid formats are GL_RGBA, GL_RGB, and GL_BGRA. + */ + + switch ( fb_format ) { + case GL_RGB: + masks = masks_table_rgb[ index ]; + break; + + case GL_RGBA: + masks = masks_table_rgba[ index ]; + break; + + case GL_BGR: + masks = masks_table_bgr[ index ]; + break; + + case GL_BGRA: + masks = masks_table_bgra[ index ]; + break; + + default: + fprintf( stderr, "[%s:%u] Unknown framebuffer format 0x%04x.\n", + __FUNCTION__, __LINE__, fb_format ); + return NULL; + } + + switch ( bytes_per_pixel[ index ] ) { + case 1: + bits = bits_table[0]; + break; + case 2: + bits = bits_table[1]; + break; + default: + bits = ((fb_format == GL_RGB) || (fb_format == GL_BGR)) + ? bits_table[2] + : bits_table[3]; + break; + } + + num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits * num_msaa_modes; + configs = _mesa_calloc((num_modes + 1) * sizeof *configs); + if (configs == NULL) + return NULL; + + c = configs; + for ( k = 0 ; k < num_depth_stencil_bits ; k++ ) { + for ( i = 0 ; i < num_db_modes ; i++ ) { + for ( h = 0 ; h < num_msaa_modes; h++ ) { + for ( j = 0 ; j < num_accum_bits ; j++ ) { + *c = _mesa_malloc (sizeof **c); + modes = &(*c)->modes; + c++; + + memset(modes, 0, sizeof *modes); + modes->redBits = bits[0]; + modes->greenBits = bits[1]; + modes->blueBits = bits[2]; + modes->alphaBits = bits[3]; + modes->redMask = masks[0]; + modes->greenMask = masks[1]; + modes->blueMask = masks[2]; + modes->alphaMask = masks[3]; + modes->rgbBits = modes->redBits + modes->greenBits + + modes->blueBits + modes->alphaBits; + + modes->accumRedBits = 16 * j; + modes->accumGreenBits = 16 * j; + modes->accumBlueBits = 16 * j; + modes->accumAlphaBits = (masks[3] != 0) ? 16 * j : 0; + modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG; + + modes->stencilBits = stencil_bits[k]; + modes->depthBits = depth_bits[k]; + + modes->transparentPixel = GLX_NONE; + modes->transparentRed = GLX_DONT_CARE; + modes->transparentGreen = GLX_DONT_CARE; + modes->transparentBlue = GLX_DONT_CARE; + modes->transparentAlpha = GLX_DONT_CARE; + modes->transparentIndex = GLX_DONT_CARE; + modes->visualType = GLX_DONT_CARE; + modes->renderType = GLX_RGBA_BIT; + modes->drawableType = GLX_WINDOW_BIT; + modes->rgbMode = GL_TRUE; + + if ( db_modes[i] == GLX_NONE ) { + modes->doubleBufferMode = GL_FALSE; + } + else { + modes->doubleBufferMode = GL_TRUE; + modes->swapMethod = db_modes[i]; + } + + modes->samples = msaa_samples[h]; + modes->sampleBuffers = modes->samples ? 1 : 0; + + + modes->haveAccumBuffer = ((modes->accumRedBits + + modes->accumGreenBits + + modes->accumBlueBits + + modes->accumAlphaBits) > 0); + modes->haveDepthBuffer = (modes->depthBits > 0); + modes->haveStencilBuffer = (modes->stencilBits > 0); + + modes->bindToTextureRgb = GL_TRUE; + modes->bindToTextureRgba = GL_TRUE; + modes->bindToMipmapTexture = GL_FALSE; + modes->bindToTextureTargets = modes->rgbMode ? + __DRI_ATTRIB_TEXTURE_1D_BIT | + __DRI_ATTRIB_TEXTURE_2D_BIT | + __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT : + 0; + } + } + } + } + *c = NULL; + + return configs; +} + +__DRIconfig **driConcatConfigs(__DRIconfig **a, + __DRIconfig **b) +{ + __DRIconfig **all; + int i, j, index; + + i = 0; + while (a[i] != NULL) + i++; + j = 0; + while (b[j] != NULL) + j++; + + all = _mesa_malloc((i + j + 1) * sizeof *all); + index = 0; + for (i = 0; a[i] != NULL; i++) + all[index++] = a[i]; + for (j = 0; b[j] != NULL; j++) + all[index++] = b[j]; + all[index++] = NULL; + + _mesa_free(a); + _mesa_free(b); + + return all; +} + +#define __ATTRIB(attrib, field) \ + { attrib, offsetof(__GLcontextModes, field) } + +static const struct { unsigned int attrib, offset; } attribMap[] = { + __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits), + __ATTRIB(__DRI_ATTRIB_LEVEL, level), + __ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits), + __ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits), + __ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits), + __ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits), + __ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits), + __ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits), + __ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers), + __ATTRIB(__DRI_ATTRIB_SAMPLES, samples), + __ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode), + __ATTRIB(__DRI_ATTRIB_STEREO, stereoMode), + __ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentPixel), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha), + __ATTRIB(__DRI_ATTRIB_FLOAT_MODE, floatMode), + __ATTRIB(__DRI_ATTRIB_RED_MASK, redMask), + __ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask), + __ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask), + __ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels), + __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth), + __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight), + __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba), + __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS, bindToTextureTargets), + __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted), + + /* The struct field doesn't matter here, these are handled by the + * switch in driGetConfigAttribIndex. We need them in the array + * so the iterator includes them though.*/ + __ATTRIB(__DRI_ATTRIB_RENDER_TYPE, level), + __ATTRIB(__DRI_ATTRIB_CONFIG_CAVEAT, level), + __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, level) +}; + +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) + +static int +driGetConfigAttribIndex(const __DRIconfig *config, + unsigned int index, unsigned int *value) +{ + switch (attribMap[index].attrib) { + case __DRI_ATTRIB_RENDER_TYPE: + if (config->modes.rgbMode) + *value = __DRI_ATTRIB_RGBA_BIT; + else + *value = __DRI_ATTRIB_COLOR_INDEX_BIT; + break; + case __DRI_ATTRIB_CONFIG_CAVEAT: + if (config->modes.visualRating == GLX_NON_CONFORMANT_CONFIG) + *value = __DRI_ATTRIB_NON_CONFORMANT_CONFIG; + else if (config->modes.visualRating == GLX_SLOW_CONFIG) + *value = __DRI_ATTRIB_SLOW_BIT; + else + *value = 0; + break; + case __DRI_ATTRIB_SWAP_METHOD: + break; + + case __DRI_ATTRIB_FLOAT_MODE: + *value = config->modes.floatMode; + break; + + default: + *value = *(unsigned int *) + ((char *) &config->modes + attribMap[index].offset); + + break; + } + + return GL_TRUE; +} + +int +driGetConfigAttrib(const __DRIconfig *config, + unsigned int attrib, unsigned int *value) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(attribMap); i++) + if (attribMap[i].attrib == attrib) + return driGetConfigAttribIndex(config, i, value); + + return GL_FALSE; +} + +int +driIndexConfigAttrib(const __DRIconfig *config, int index, + unsigned int *attrib, unsigned int *value) +{ + if (index >= 0 && index < ARRAY_SIZE(attribMap)) { + *attrib = attribMap[index].attrib; + return driGetConfigAttribIndex(config, index, value); + } + + return GL_FALSE; +} diff --git a/mesalib/src/mesa/drivers/dri/common/utils.h b/mesalib/src/mesa/drivers/dri/common/utils.h new file mode 100644 index 000000000..9e9e5bc22 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/utils.h @@ -0,0 +1,147 @@ +/* + * (C) Copyright IBM Corporation 2002, 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 + * VA LINUX SYSTEM, 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. + * + * Authors: + * Ian Romanick + */ + +#ifndef DRI_DEBUG_H +#define DRI_DEBUG_H + +#include +#include +#include "main/context.h" + +typedef struct __DRIutilversionRec2 __DRIutilversion2; + +struct dri_debug_control { + const char * string; + unsigned flag; +}; + +/** + * Description of the entry-points and parameters for an OpenGL function. + */ +struct dri_extension_function { + /** + * \brief + * Packed string describing the parameter signature and the entry-point + * names. + * + * The parameter signature and the names of the entry-points for this + * function are packed into a single string. The substrings are + * separated by NUL characters. The whole string is terminated by + * two consecutive NUL characters. + */ + const char * strings; + + + /** + * Location in the remap table where the dispatch offset should be + * stored. + */ + int remap_index; + + /** + * Offset of the function in the dispatch table. + */ + int offset; +}; + +/** + * Description of the API for an extension to OpenGL. + */ +struct dri_extension { + /** + * Name of the extension. + */ + const char * name; + + + /** + * Pointer to a list of \c dri_extension_function structures. The list + * is terminated by a structure with a \c NULL + * \c dri_extension_function::strings pointer. + */ + const struct dri_extension_function * functions; +}; + +/** + * Used to store a version which includes a major range instead of a single + * major version number. + */ +struct __DRIutilversionRec2 { + int major_min; /** min allowed Major version number. */ + int major_max; /** max allowed Major version number. */ + int minor; /**< Minor version number. */ + int patch; /**< Patch-level. */ +}; + +extern unsigned driParseDebugString( const char * debug, + const struct dri_debug_control * control ); + +extern unsigned driGetRendererString( char * buffer, + const char * hardware_name, const char * driver_date, GLuint agp_mode ); + +extern void driInitExtensions( GLcontext * ctx, + const struct dri_extension * card_extensions, GLboolean enable_imaging ); + +extern void driInitSingleExtension( GLcontext * ctx, + const struct dri_extension * ext ); + +extern GLboolean driCheckDriDdxDrmVersions2(const char * driver_name, + const __DRIversion * driActual, const __DRIversion * driExpected, + const __DRIversion * ddxActual, const __DRIversion * ddxExpected, + const __DRIversion * drmActual, const __DRIversion * drmExpected); + +extern GLboolean driCheckDriDdxDrmVersions3(const char * driver_name, + const __DRIversion * driActual, const __DRIversion * driExpected, + const __DRIversion * ddxActual, const __DRIutilversion2 * ddxExpected, + const __DRIversion * drmActual, const __DRIversion * drmExpected); + +extern GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, + GLint *x, GLint *y, + GLsizei *width, GLsizei *height ); + +struct __DRIconfigRec { + __GLcontextModes modes; +}; + +extern __DRIconfig ** +driCreateConfigs(GLenum fb_format, GLenum fb_type, + const uint8_t * depth_bits, const uint8_t * stencil_bits, + unsigned num_depth_stencil_bits, + const GLenum * db_modes, unsigned num_db_modes, + const uint8_t * msaa_samples, unsigned num_msaa_modes); + +__DRIconfig **driConcatConfigs(__DRIconfig **a, + __DRIconfig **b); + +int +driGetConfigAttrib(const __DRIconfig *config, + unsigned int attrib, unsigned int *value); +int +driIndexConfigAttrib(const __DRIconfig *config, int index, + unsigned int *attrib, unsigned int *value); + +#endif /* DRI_DEBUG_H */ diff --git a/mesalib/src/mesa/drivers/dri/common/vblank.c b/mesalib/src/mesa/drivers/dri/common/vblank.c new file mode 100644 index 000000000..12aeaa108 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/vblank.c @@ -0,0 +1,434 @@ +/* -*- mode: c; c-basic-offset: 3 -*- */ +/* + * (c) Copyright IBM Corporation 2002 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to 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 + * VA LINUX SYSTEM, 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. + * + * Authors: + * Ian Romanick + */ + +#include "main/glheader.h" +#include "xf86drm.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/dd.h" +#include "vblank.h" +#include "xmlpool.h" + +static unsigned int msc_to_vblank(__DRIdrawablePrivate * dPriv, int64_t msc) +{ + return (unsigned int)(msc - dPriv->msc_base + dPriv->vblank_base); +} + +static int64_t vblank_to_msc(__DRIdrawablePrivate * dPriv, unsigned int vblank) +{ + return (int64_t)(vblank - dPriv->vblank_base + dPriv->msc_base); +} + + +/****************************************************************************/ +/** + * Get the current MSC refresh counter. + * + * Stores the 64-bit count of vertical refreshes since some (arbitrary) + * point in time in \c count. Unless the value wraps around, which it + * may, it will never decrease for a given drawable. + * + * \warning This function is called from \c glXGetVideoSyncSGI, which expects + * a \c count of type \c unsigned (32-bit), and \c glXGetSyncValuesOML, which + * expects a \c count of type \c int64_t (signed 64-bit). The kernel ioctl + * currently always returns a \c sequence of type \c unsigned. + * + * \param priv Pointer to the DRI screen private struct. + * \param dPriv Pointer to the DRI drawable private struct + * \param count Storage to hold MSC counter. + * \return Zero is returned on success. A negative errno value + * is returned on failure. + */ +int driDrawableGetMSC32( __DRIscreenPrivate * priv, + __DRIdrawablePrivate * dPriv, + int64_t * count) +{ + drmVBlank vbl; + int ret; + + /* Don't wait for anything. Just get the current refresh count. */ + + vbl.request.type = DRM_VBLANK_RELATIVE; + vbl.request.sequence = 0; + if ( dPriv && dPriv->vblFlags & VBLANK_FLAG_SECONDARY ) + vbl.request.type |= DRM_VBLANK_SECONDARY; + + ret = drmWaitVBlank( priv->fd, &vbl ); + + if (dPriv) { + *count = vblank_to_msc(dPriv, vbl.reply.sequence); + } else { + /* Old driver (no knowledge of drawable MSC callback) */ + *count = vbl.reply.sequence; + } + + return ret; +} + +/****************************************************************************/ +/** + * Wait for a specified refresh count. This implements most of the + * functionality of \c glXWaitForMscOML from the GLX_OML_sync_control spec. + * Waits for the \c target_msc refresh. If that has already passed, it + * waits until \f$(MSC \bmod divisor)\f$ is equal to \c remainder. If + * \c target_msc is 0, use the behavior of glXWaitVideoSyncSGI(), which + * omits the initial check against a target MSC value. + * + * This function is actually something of a hack. The problem is that, at + * the time of this writing, none of the existing DRM modules support an + * ioctl that returns a 64-bit count (at least not on 32-bit platforms). + * However, this function exists to support a GLX function that requires + * the use of 64-bit counts. As such, there is a little bit of ugly + * hackery at the end of this function to make the 32-bit count act like + * a 64-bit count. There are still some cases where this will break, but + * I believe it catches the most common cases. + * + * The real solution is to provide an ioctl that uses a 64-bit count. + * + * \param dpy Pointer to the \c Display. + * \param priv Pointer to the DRI drawable private. + * \param target_msc Desired refresh count to wait for. A value of 0 + * means to use the glXWaitVideoSyncSGI() behavior. + * \param divisor MSC divisor if \c target_msc is already reached. + * \param remainder Desired MSC remainder if \c target_msc is already + * reached. + * \param msc Buffer to hold MSC when done waiting. + * + * \return Zero on success or \c GLX_BAD_CONTEXT on failure. + */ + +int driWaitForMSC32( __DRIdrawablePrivate *priv, + int64_t target_msc, int64_t divisor, int64_t remainder, + int64_t * msc ) +{ + drmVBlank vbl; + + + if ( divisor != 0 ) { + int64_t next = target_msc; + int64_t r; + int dont_wait = (target_msc == 0); + + do { + /* dont_wait means we're using the glXWaitVideoSyncSGI() behavior. + * The first time around, just get the current count and proceed + * to the test for (MSC % divisor) == remainder. + */ + vbl.request.type = dont_wait ? DRM_VBLANK_RELATIVE : + DRM_VBLANK_ABSOLUTE; + vbl.request.sequence = next ? msc_to_vblank(priv, next) : 0; + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) + vbl.request.type |= DRM_VBLANK_SECONDARY; + + if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) { + /* FIXME: This doesn't seem like the right thing to return here. + */ + return GLX_BAD_CONTEXT; + } + + *msc = vblank_to_msc(priv, vbl.reply.sequence); + + if (!dont_wait && *msc == next) + break; + dont_wait = 0; + + /* Assuming the wait-done test fails, the next refresh to wait for + * will be one that satisfies (MSC % divisor) == remainder. The + * value (MSC - (MSC % divisor) + remainder) is the refresh value + * closest to the current value that would satisfy the equation. + * If this refresh has already happened, we add divisor to obtain + * the next refresh after the current one that will satisfy it. + */ + r = ((uint64_t)*msc % divisor); + next = (*msc - r + remainder); + if (next <= *msc) + next += divisor; + + } while (r != remainder); + } + else { + /* If the \c divisor is zero, just wait until the MSC is greater + * than or equal to \c target_msc. + */ + + vbl.request.type = DRM_VBLANK_ABSOLUTE; + vbl.request.sequence = target_msc ? msc_to_vblank(priv, target_msc) : 0; + + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) + vbl.request.type |= DRM_VBLANK_SECONDARY; + + if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) { + /* FIXME: This doesn't seem like the right thing to return here. + */ + return GLX_BAD_CONTEXT; + } + } + + *msc = vblank_to_msc(priv, vbl.reply.sequence); + + if ( *msc < target_msc ) { + *msc += 0x0000000100000000LL; + } + + return 0; +} + + +/****************************************************************************/ +/** + * Gets a set of default vertical-blank-wait flags based on the internal GLX + * API version and several configuration options. + */ + +GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache ) +{ + GLuint flags = VBLANK_FLAG_INTERVAL; + int vblank_mode; + + + if ( driCheckOption( optionCache, "vblank_mode", DRI_ENUM ) ) + vblank_mode = driQueryOptioni( optionCache, "vblank_mode" ); + else + vblank_mode = DRI_CONF_VBLANK_DEF_INTERVAL_1; + + switch (vblank_mode) { + case DRI_CONF_VBLANK_NEVER: + flags = 0; + break; + case DRI_CONF_VBLANK_DEF_INTERVAL_0: + break; + case DRI_CONF_VBLANK_DEF_INTERVAL_1: + flags |= VBLANK_FLAG_THROTTLE; + break; + case DRI_CONF_VBLANK_ALWAYS_SYNC: + flags |= VBLANK_FLAG_SYNC; + break; + } + + return flags; +} + + +/****************************************************************************/ +/** + * Wrapper to call \c drmWaitVBlank. The main purpose of this function is to + * wrap the error message logging. The error message should only be logged + * the first time the \c drmWaitVBlank fails. If \c drmWaitVBlank is + * successful, \c vbl_seq will be set the sequence value in the reply. + * + * \param vbl Pointer to drmVBlank packet desribing how to wait. + * \param vbl_seq Location to store the current refresh counter. + * \param fd File descriptor use to call into the DRM. + * \return Zero on success or -1 on failure. + */ + +static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd ) +{ + int ret; + + + ret = drmWaitVBlank( fd, vbl ); + if ( ret != 0 ) { + static GLboolean first_time = GL_TRUE; + + if ( first_time ) { + fprintf(stderr, + "%s: drmWaitVBlank returned %d, IRQs don't seem to be" + " working correctly.\nTry adjusting the vblank_mode" + " configuration parameter.\n", __FUNCTION__, ret); + first_time = GL_FALSE; + } + + return -1; + } + + *vbl_seq = vbl->reply.sequence; + return 0; +} + + +/****************************************************************************/ +/** + * Returns the default swap interval of the given drawable. + */ + +static unsigned +driGetDefaultVBlankInterval( const __DRIdrawablePrivate *priv ) +{ + if ( (priv->vblFlags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) { + return 1; + } + else { + return 0; + } +} + + +/****************************************************************************/ +/** + * Sets the default swap interval when the drawable is first bound to a + * direct rendering context. + */ + +void driDrawableInitVBlank( __DRIdrawablePrivate *priv ) +{ + if ( priv->swap_interval == (unsigned)-1 && + !( priv->vblFlags & VBLANK_FLAG_NO_IRQ ) ) { + /* Get current vertical blank sequence */ + drmVBlank vbl; + + vbl.request.type = DRM_VBLANK_RELATIVE; + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) + vbl.request.type |= DRM_VBLANK_SECONDARY; + vbl.request.sequence = 0; + do_wait( &vbl, &priv->vblSeq, priv->driScreenPriv->fd ); + priv->vblank_base = priv->vblSeq; + + priv->swap_interval = driGetDefaultVBlankInterval( priv ); + } +} + + +/****************************************************************************/ +/** + * Returns the current swap interval of the given drawable. + */ + +unsigned +driGetVBlankInterval( const __DRIdrawablePrivate *priv ) +{ + if ( (priv->vblFlags & VBLANK_FLAG_INTERVAL) != 0 ) { + /* this must have been initialized when the drawable was first bound + * to a direct rendering context. */ + assert ( priv->swap_interval != (unsigned)-1 ); + + return priv->swap_interval; + } + else + return driGetDefaultVBlankInterval( priv ); +} + + +/****************************************************************************/ +/** + * Returns the current vertical blank sequence number of the given drawable. + */ + +void +driGetCurrentVBlank( __DRIdrawablePrivate *priv ) +{ + drmVBlank vbl; + + vbl.request.type = DRM_VBLANK_RELATIVE; + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) { + vbl.request.type |= DRM_VBLANK_SECONDARY; + } + vbl.request.sequence = 0; + + (void) do_wait( &vbl, &priv->vblSeq, priv->driScreenPriv->fd ); +} + + +/****************************************************************************/ +/** + * Waits for the vertical blank for use with glXSwapBuffers. + * + * \param missed_deadline Set to \c GL_TRUE if the MSC after waiting is later + * than the "target" based on \c priv->vblFlags. The idea is + * that if \c missed_deadline is set, then the application is + * not achieving its desired framerate. + * \return Zero on success, -1 on error. + */ + +int +driWaitForVBlank( __DRIdrawablePrivate *priv, GLboolean * missed_deadline ) +{ + drmVBlank vbl; + unsigned original_seq; + unsigned deadline; + unsigned interval; + unsigned diff; + + *missed_deadline = GL_FALSE; + if ( (priv->vblFlags & (VBLANK_FLAG_INTERVAL | + VBLANK_FLAG_THROTTLE | + VBLANK_FLAG_SYNC)) == 0 || + (priv->vblFlags & VBLANK_FLAG_NO_IRQ) != 0 ) { + return 0; + } + + + /* VBLANK_FLAG_SYNC means to wait for at least one vertical blank. If + * that flag is not set, do a fake wait for zero vertical blanking + * periods so that we can get the current MSC. + * + * VBLANK_FLAG_INTERVAL and VBLANK_FLAG_THROTTLE mean to wait for at + * least one vertical blank since the last wait. Since do_wait modifies + * priv->vblSeq, we have to save the original value of priv->vblSeq for the + * VBLANK_FLAG_INTERVAL / VBLANK_FLAG_THROTTLE calculation later. + */ + + original_seq = priv->vblSeq; + interval = driGetVBlankInterval(priv); + deadline = original_seq + interval; + + vbl.request.type = DRM_VBLANK_RELATIVE; + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) { + vbl.request.type |= DRM_VBLANK_SECONDARY; + } + vbl.request.sequence = ((priv->vblFlags & VBLANK_FLAG_SYNC) != 0) ? 1 : 0; + + if ( do_wait( & vbl, &priv->vblSeq, priv->driScreenPriv->fd ) != 0 ) { + return -1; + } + + diff = priv->vblSeq - deadline; + + /* No need to wait again if we've already reached the target */ + if (diff <= (1 << 23)) { + *missed_deadline = (priv->vblFlags & VBLANK_FLAG_SYNC) ? (diff > 0) : + GL_TRUE; + return 0; + } + + /* Wait until the target vertical blank. */ + vbl.request.type = DRM_VBLANK_ABSOLUTE; + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) { + vbl.request.type |= DRM_VBLANK_SECONDARY; + } + vbl.request.sequence = deadline; + + if ( do_wait( & vbl, &priv->vblSeq, priv->driScreenPriv->fd ) != 0 ) { + return -1; + } + + diff = priv->vblSeq - deadline; + *missed_deadline = diff > 0 && diff <= (1 << 23); + + return 0; +} diff --git a/mesalib/src/mesa/drivers/dri/common/vblank.h b/mesalib/src/mesa/drivers/dri/common/vblank.h new file mode 100644 index 000000000..8b2c761a1 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/vblank.h @@ -0,0 +1,75 @@ +/* -*- mode: c; c-basic-offset: 3 -*- */ +/* + * (c) Copyright IBM Corporation 2002 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to 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 + * VA LINUX SYSTEM, 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. + * + * Authors: + * Ian Romanick + */ + +#ifndef DRI_VBLANK_H +#define DRI_VBLANK_H + +#include "main/context.h" +#include "dri_util.h" +#include "xmlconfig.h" + +#define VBLANK_FLAG_INTERVAL (1U << 0) /* Respect the swap_interval setting + */ +#define VBLANK_FLAG_THROTTLE (1U << 1) /* Wait 1 refresh since last call. + */ +#define VBLANK_FLAG_SYNC (1U << 2) /* Sync to the next refresh. + */ +#define VBLANK_FLAG_NO_IRQ (1U << 7) /* DRM has no IRQ to wait on. + */ +#define VBLANK_FLAG_SECONDARY (1U << 8) /* Wait for secondary vblank. + */ + +extern int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count ); +extern int driDrawableGetMSC32( __DRIscreenPrivate * priv, + __DRIdrawablePrivate * drawablePrivate, + int64_t * count); +extern int driWaitForMSC32( __DRIdrawablePrivate *priv, + int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc ); +extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache ); +extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv ); +extern unsigned driGetVBlankInterval( const __DRIdrawablePrivate *priv ); +extern void driGetCurrentVBlank( __DRIdrawablePrivate *priv ); +extern int driWaitForVBlank( __DRIdrawablePrivate *priv, + GLboolean * missed_deadline ); + +#undef usleep +#include /* for usleep() */ +#include /* for sched_yield() */ + +#ifdef linux +#include /* for sched_yield() */ +#endif + +#define DO_USLEEP(nr) \ + do { \ + if (0) fprintf(stderr, "%s: usleep for %u\n", __FUNCTION__, nr ); \ + if (1) usleep( nr ); \ + sched_yield(); \ + } while( 0 ) + +#endif /* DRI_VBLANK_H */ diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c new file mode 100644 index 000000000..46ba2ffbf --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c @@ -0,0 +1,1008 @@ +/* + * XML DRI client-side driver configuration + * Copyright (C) 2003 Felix Kuehling + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * FELIX KUEHLING, 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. + * + */ +/** + * \file xmlconfig.c + * \brief Driver-independent client-side part of the XML configuration + * \author Felix Kuehling + */ + +#include "main/glheader.h" + +#include +#include +#include +#include +#include +#include +#include "main/imports.h" +#include "dri_util.h" +#include "xmlconfig.h" + +/* + * OS dependent ways of getting the name of the running program + */ +#if (defined(__unix__) || defined(unix)) && !defined(USG) +#include +#endif + +#undef GET_PROGRAM_NAME + +#if (defined(__GNU_LIBRARY__) || defined(__GLIBC__)) && !defined(__UCLIBC__) +# if !defined(__GLIBC__) || (__GLIBC__ < 2) +/* These aren't declared in any libc5 header */ +extern char *program_invocation_name, *program_invocation_short_name; +# endif +# define GET_PROGRAM_NAME() program_invocation_short_name +#elif defined(__FreeBSD__) && (__FreeBSD__ >= 2) +# include +# if (__FreeBSD_version >= 440000) +# include +# define GET_PROGRAM_NAME() getprogname() +# endif +#elif defined(__NetBSD__) && defined(__NetBSD_Version) && (__NetBSD_Version >= 106000100) +# include +# define GET_PROGRAM_NAME() getprogname() +#elif defined(__sun) +/* Solaris has getexecname() which returns the full path - return just + the basename to match BSD getprogname() */ +# include +# include +# define GET_PROGRAM_NAME() basename(getexecname()) +#endif + +#if !defined(GET_PROGRAM_NAME) +# if defined(OpenBSD) || defined(NetBSD) || defined(__UCLIBC__) +/* This is a hack. It's said to work on OpenBSD, NetBSD and GNU. + * Rogelio M.Serrano Jr. reported it's also working with UCLIBC. It's + * used as a last resort, if there is no documented facility available. */ +static const char *__getProgramName () { + extern const char *__progname; + char * arg = strrchr(__progname, '/'); + if (arg) + return arg+1; + else + return __progname; +} +# define GET_PROGRAM_NAME() __getProgramName() +# else +# define GET_PROGRAM_NAME() "" +# warning "Per application configuration won't work with your OS version." +# endif +#endif + +/** \brief Find an option in an option cache with the name as key */ +static GLuint findOption (const driOptionCache *cache, const char *name) { + GLuint len = strlen (name); + GLuint size = 1 << cache->tableSize, mask = size - 1; + GLuint hash = 0; + GLuint i, shift; + + /* compute a hash from the variable length name */ + for (i = 0, shift = 0; i < len; ++i, shift = (shift+8) & 31) + hash += (GLuint)name[i] << shift; + hash *= hash; + hash = (hash >> (16-cache->tableSize/2)) & mask; + + /* this is just the starting point of the linear search for the option */ + for (i = 0; i < size; ++i, hash = (hash+1) & mask) { + /* if we hit an empty entry then the option is not defined (yet) */ + if (cache->info[hash].name == 0) + break; + else if (!strcmp (name, cache->info[hash].name)) + break; + } + /* this assertion fails if the hash table is full */ + assert (i < size); + + return hash; +} + +/** \brief Count the real number of options in an option cache */ +static GLuint countOptions (const driOptionCache *cache) { + GLuint size = 1 << cache->tableSize; + GLuint i, count = 0; + for (i = 0; i < size; ++i) + if (cache->info[i].name) + count++; + return count; +} + +/** \brief Like strdup but using MALLOC and with error checking. */ +#define XSTRDUP(dest,source) do { \ + GLuint len = strlen (source); \ + if (!(dest = MALLOC (len+1))) { \ + fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__); \ + abort(); \ + } \ + memcpy (dest, source, len+1); \ +} while (0) + +static int compare (const void *a, const void *b) { + return strcmp (*(char *const*)a, *(char *const*)b); +} +/** \brief Binary search in a string array. */ +static GLuint bsearchStr (const XML_Char *name, + const XML_Char *elems[], GLuint count) { + const XML_Char **found; + found = bsearch (&name, elems, count, sizeof (XML_Char *), compare); + if (found) + return found - elems; + else + return count; +} + +/** \brief Locale-independent integer parser. + * + * Works similar to strtol. Leading space is NOT skipped. The input + * number may have an optional sign. Radix is specified by base. If + * base is 0 then decimal is assumed unless the input number is + * prefixed by 0x or 0X for hexadecimal or 0 for octal. After + * returning tail points to the first character that is not part of + * the integer number. If no number was found then tail points to the + * start of the input string. */ +static GLint strToI (const XML_Char *string, const XML_Char **tail, int base) { + GLint radix = base == 0 ? 10 : base; + GLint result = 0; + GLint sign = 1; + GLboolean numberFound = GL_FALSE; + const XML_Char *start = string; + + assert (radix >= 2 && radix <= 36); + + if (*string == '-') { + sign = -1; + string++; + } else if (*string == '+') + string++; + if (base == 0 && *string == '0') { + numberFound = GL_TRUE; + if (*(string+1) == 'x' || *(string+1) == 'X') { + radix = 16; + string += 2; + } else { + radix = 8; + string++; + } + } + do { + GLint digit = -1; + if (radix <= 10) { + if (*string >= '0' && *string < '0' + radix) + digit = *string - '0'; + } else { + if (*string >= '0' && *string <= '9') + digit = *string - '0'; + else if (*string >= 'a' && *string < 'a' + radix - 10) + digit = *string - 'a' + 10; + else if (*string >= 'A' && *string < 'A' + radix - 10) + digit = *string - 'A' + 10; + } + if (digit != -1) { + numberFound = GL_TRUE; + result = radix*result + digit; + string++; + } else + break; + } while (GL_TRUE); + *tail = numberFound ? string : start; + return sign * result; +} + +/** \brief Locale-independent floating-point parser. + * + * Works similar to strtod. Leading space is NOT skipped. The input + * number may have an optional sign. '.' is interpreted as decimal + * point and may occor at most once. Optionally the number may end in + * [eE], where is an integer as recognized by + * strToI. In that case the result is number * 10^exponent. After + * returning tail points to the first character that is not part of + * the floating point number. If no number was found then tail points + * to the start of the input string. + * + * Uses two passes for maximum accuracy. */ +static GLfloat strToF (const XML_Char *string, const XML_Char **tail) { + GLint nDigits = 0, pointPos, exponent; + GLfloat sign = 1.0f, result = 0.0f, scale; + const XML_Char *start = string, *numStart; + + /* sign */ + if (*string == '-') { + sign = -1.0f; + string++; + } else if (*string == '+') + string++; + + /* first pass: determine position of decimal point, number of + * digits, exponent and the end of the number. */ + numStart = string; + while (*string >= '0' && *string <= '9') { + string++; + nDigits++; + } + pointPos = nDigits; + if (*string == '.') { + string++; + while (*string >= '0' && *string <= '9') { + string++; + nDigits++; + } + } + if (nDigits == 0) { + /* no digits, no number */ + *tail = start; + return 0.0f; + } + *tail = string; + if (*string == 'e' || *string == 'E') { + const XML_Char *expTail; + exponent = strToI (string+1, &expTail, 10); + if (expTail == string+1) + exponent = 0; + else + *tail = expTail; + } else + exponent = 0; + string = numStart; + + /* scale of the first digit */ + scale = sign * (GLfloat)pow (10.0, (GLdouble)(pointPos-1 + exponent)); + + /* second pass: parse digits */ + do { + if (*string != '.') { + assert (*string >= '0' && *string <= '9'); + result += scale * (GLfloat)(*string - '0'); + scale *= 0.1f; + nDigits--; + } + string++; + } while (nDigits > 0); + + return result; +} + +/** \brief Parse a value of a given type. */ +static GLboolean parseValue (driOptionValue *v, driOptionType type, + const XML_Char *string) { + const XML_Char *tail = NULL; + /* skip leading white-space */ + string += strspn (string, " \f\n\r\t\v"); + switch (type) { + case DRI_BOOL: + if (!strcmp (string, "false")) { + v->_bool = GL_FALSE; + tail = string + 5; + } else if (!strcmp (string, "true")) { + v->_bool = GL_TRUE; + tail = string + 4; + } + else + return GL_FALSE; + break; + case DRI_ENUM: /* enum is just a special integer */ + case DRI_INT: + v->_int = strToI (string, &tail, 0); + break; + case DRI_FLOAT: + v->_float = strToF (string, &tail); + break; + } + + if (tail == string) + return GL_FALSE; /* empty string (or containing only white-space) */ + /* skip trailing white space */ + if (*tail) + tail += strspn (tail, " \f\n\r\t\v"); + if (*tail) + return GL_FALSE; /* something left over that is not part of value */ + + return GL_TRUE; +} + +/** \brief Parse a list of ranges of type info->type. */ +static GLboolean parseRanges (driOptionInfo *info, const XML_Char *string) { + XML_Char *cp, *range; + GLuint nRanges, i; + driOptionRange *ranges; + + XSTRDUP (cp, string); + /* pass 1: determine the number of ranges (number of commas + 1) */ + range = cp; + for (nRanges = 1; *range; ++range) + if (*range == ',') + ++nRanges; + + if ((ranges = MALLOC (nRanges*sizeof(driOptionRange))) == NULL) { + fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__); + abort(); + } + + /* pass 2: parse all ranges into preallocated array */ + range = cp; + for (i = 0; i < nRanges; ++i) { + XML_Char *end, *sep; + assert (range); + end = strchr (range, ','); + if (end) + *end = '\0'; + sep = strchr (range, ':'); + if (sep) { /* non-empty interval */ + *sep = '\0'; + if (!parseValue (&ranges[i].start, info->type, range) || + !parseValue (&ranges[i].end, info->type, sep+1)) + break; + if (info->type == DRI_INT && + ranges[i].start._int > ranges[i].end._int) + break; + if (info->type == DRI_FLOAT && + ranges[i].start._float > ranges[i].end._float) + break; + } else { /* empty interval */ + if (!parseValue (&ranges[i].start, info->type, range)) + break; + ranges[i].end = ranges[i].start; + } + if (end) + range = end+1; + else + range = NULL; + } + FREE (cp); + if (i < nRanges) { + FREE (ranges); + return GL_FALSE; + } else + assert (range == NULL); + + info->nRanges = nRanges; + info->ranges = ranges; + return GL_TRUE; +} + +/** \brief Check if a value is in one of info->ranges. */ +static GLboolean checkValue (const driOptionValue *v, const driOptionInfo *info) { + GLuint i; + assert (info->type != DRI_BOOL); /* should be caught by the parser */ + if (info->nRanges == 0) + return GL_TRUE; + switch (info->type) { + case DRI_ENUM: /* enum is just a special integer */ + case DRI_INT: + for (i = 0; i < info->nRanges; ++i) + if (v->_int >= info->ranges[i].start._int && + v->_int <= info->ranges[i].end._int) + return GL_TRUE; + break; + case DRI_FLOAT: + for (i = 0; i < info->nRanges; ++i) + if (v->_float >= info->ranges[i].start._float && + v->_float <= info->ranges[i].end._float) + return GL_TRUE; + break; + default: + assert (0); /* should never happen */ + } + return GL_FALSE; +} + +/** \brief Output a warning message. */ +#define XML_WARNING1(msg) do {\ + __driUtilMessage ("Warning in %s line %d, column %d: "msg, data->name, \ + (int) XML_GetCurrentLineNumber(data->parser), \ + (int) XML_GetCurrentColumnNumber(data->parser)); \ +} while (0) +#define XML_WARNING(msg,args...) do { \ + __driUtilMessage ("Warning in %s line %d, column %d: "msg, data->name, \ + (int) XML_GetCurrentLineNumber(data->parser), \ + (int) XML_GetCurrentColumnNumber(data->parser), \ + args); \ +} while (0) +/** \brief Output an error message. */ +#define XML_ERROR1(msg) do { \ + __driUtilMessage ("Error in %s line %d, column %d: "msg, data->name, \ + (int) XML_GetCurrentLineNumber(data->parser), \ + (int) XML_GetCurrentColumnNumber(data->parser)); \ +} while (0) +#define XML_ERROR(msg,args...) do { \ + __driUtilMessage ("Error in %s line %d, column %d: "msg, data->name, \ + (int) XML_GetCurrentLineNumber(data->parser), \ + (int) XML_GetCurrentColumnNumber(data->parser), \ + args); \ +} while (0) +/** \brief Output a fatal error message and abort. */ +#define XML_FATAL1(msg) do { \ + fprintf (stderr, "Fatal error in %s line %d, column %d: "msg"\n", \ + data->name, \ + (int) XML_GetCurrentLineNumber(data->parser), \ + (int) XML_GetCurrentColumnNumber(data->parser)); \ + abort();\ +} while (0) +#define XML_FATAL(msg,args...) do { \ + fprintf (stderr, "Fatal error in %s line %d, column %d: "msg"\n", \ + data->name, \ + (int) XML_GetCurrentLineNumber(data->parser), \ + (int) XML_GetCurrentColumnNumber(data->parser), \ + args); \ + abort();\ +} while (0) + +/** \brief Parser context for __driConfigOptions. */ +struct OptInfoData { + const char *name; + XML_Parser parser; + driOptionCache *cache; + GLboolean inDriInfo; + GLboolean inSection; + GLboolean inDesc; + GLboolean inOption; + GLboolean inEnum; + int curOption; +}; + +/** \brief Elements in __driConfigOptions. */ +enum OptInfoElem { + OI_DESCRIPTION = 0, OI_DRIINFO, OI_ENUM, OI_OPTION, OI_SECTION, OI_COUNT +}; +static const XML_Char *OptInfoElems[] = { + "description", "driinfo", "enum", "option", "section" +}; + +/** \brief Parse attributes of an enum element. + * + * We're not actually interested in the data. Just make sure this is ok + * for external configuration tools. + */ +static void parseEnumAttr (struct OptInfoData *data, const XML_Char **attr) { + GLuint i; + const XML_Char *value = NULL, *text = NULL; + driOptionValue v; + GLuint opt = data->curOption; + for (i = 0; attr[i]; i += 2) { + if (!strcmp (attr[i], "value")) value = attr[i+1]; + else if (!strcmp (attr[i], "text")) text = attr[i+1]; + else XML_FATAL("illegal enum attribute: %s.", attr[i]); + } + if (!value) XML_FATAL1 ("value attribute missing in enum."); + if (!text) XML_FATAL1 ("text attribute missing in enum."); + if (!parseValue (&v, data->cache->info[opt].type, value)) + XML_FATAL ("illegal enum value: %s.", value); + if (!checkValue (&v, &data->cache->info[opt])) + XML_FATAL ("enum value out of valid range: %s.", value); +} + +/** \brief Parse attributes of a description element. + * + * We're not actually interested in the data. Just make sure this is ok + * for external configuration tools. + */ +static void parseDescAttr (struct OptInfoData *data, const XML_Char **attr) { + GLuint i; + const XML_Char *lang = NULL, *text = NULL; + for (i = 0; attr[i]; i += 2) { + if (!strcmp (attr[i], "lang")) lang = attr[i+1]; + else if (!strcmp (attr[i], "text")) text = attr[i+1]; + else XML_FATAL("illegal description attribute: %s.", attr[i]); + } + if (!lang) XML_FATAL1 ("lang attribute missing in description."); + if (!text) XML_FATAL1 ("text attribute missing in description."); +} + +/** \brief Parse attributes of an option element. */ +static void parseOptInfoAttr (struct OptInfoData *data, const XML_Char **attr) { + enum OptAttr {OA_DEFAULT = 0, OA_NAME, OA_TYPE, OA_VALID, OA_COUNT}; + static const XML_Char *optAttr[] = {"default", "name", "type", "valid"}; + const XML_Char *attrVal[OA_COUNT] = {NULL, NULL, NULL, NULL}; + const char *defaultVal; + driOptionCache *cache = data->cache; + GLuint opt, i; + for (i = 0; attr[i]; i += 2) { + GLuint attrName = bsearchStr (attr[i], optAttr, OA_COUNT); + if (attrName >= OA_COUNT) + XML_FATAL ("illegal option attribute: %s", attr[i]); + attrVal[attrName] = attr[i+1]; + } + if (!attrVal[OA_NAME]) XML_FATAL1 ("name attribute missing in option."); + if (!attrVal[OA_TYPE]) XML_FATAL1 ("type attribute missing in option."); + if (!attrVal[OA_DEFAULT]) XML_FATAL1 ("default attribute missing in option."); + + opt = findOption (cache, attrVal[OA_NAME]); + if (cache->info[opt].name) + XML_FATAL ("option %s redefined.", attrVal[OA_NAME]); + data->curOption = opt; + + XSTRDUP (cache->info[opt].name, attrVal[OA_NAME]); + + if (!strcmp (attrVal[OA_TYPE], "bool")) + cache->info[opt].type = DRI_BOOL; + else if (!strcmp (attrVal[OA_TYPE], "enum")) + cache->info[opt].type = DRI_ENUM; + else if (!strcmp (attrVal[OA_TYPE], "int")) + cache->info[opt].type = DRI_INT; + else if (!strcmp (attrVal[OA_TYPE], "float")) + cache->info[opt].type = DRI_FLOAT; + else + XML_FATAL ("illegal type in option: %s.", attrVal[OA_TYPE]); + + defaultVal = getenv (cache->info[opt].name); + if (defaultVal != NULL) { + /* don't use XML_WARNING, we want the user to see this! */ + fprintf (stderr, + "ATTENTION: default value of option %s overridden by environment.\n", + cache->info[opt].name); + } else + defaultVal = attrVal[OA_DEFAULT]; + if (!parseValue (&cache->values[opt], cache->info[opt].type, defaultVal)) + XML_FATAL ("illegal default value: %s.", defaultVal); + + if (attrVal[OA_VALID]) { + if (cache->info[opt].type == DRI_BOOL) + XML_FATAL1 ("boolean option with valid attribute."); + if (!parseRanges (&cache->info[opt], attrVal[OA_VALID])) + XML_FATAL ("illegal valid attribute: %s.", attrVal[OA_VALID]); + if (!checkValue (&cache->values[opt], &cache->info[opt])) + XML_FATAL ("default value out of valid range '%s': %s.", + attrVal[OA_VALID], defaultVal); + } else if (cache->info[opt].type == DRI_ENUM) { + XML_FATAL1 ("valid attribute missing in option (mandatory for enums)."); + } else { + cache->info[opt].nRanges = 0; + cache->info[opt].ranges = NULL; + } +} + +/** \brief Handler for start element events. */ +static void optInfoStartElem (void *userData, const XML_Char *name, + const XML_Char **attr) { + struct OptInfoData *data = (struct OptInfoData *)userData; + enum OptInfoElem elem = bsearchStr (name, OptInfoElems, OI_COUNT); + switch (elem) { + case OI_DRIINFO: + if (data->inDriInfo) + XML_FATAL1 ("nested elements."); + if (attr[0]) + XML_FATAL1 ("attributes specified on element."); + data->inDriInfo = GL_TRUE; + break; + case OI_SECTION: + if (!data->inDriInfo) + XML_FATAL1 ("
must be inside ."); + if (data->inSection) + XML_FATAL1 ("nested
elements."); + if (attr[0]) + XML_FATAL1 ("attributes specified on
element."); + data->inSection = GL_TRUE; + break; + case OI_DESCRIPTION: + if (!data->inSection && !data->inOption) + XML_FATAL1 (" must be inside or inDesc) + XML_FATAL1 ("nested elements."); + data->inDesc = GL_TRUE; + parseDescAttr (data, attr); + break; + case OI_OPTION: + if (!data->inSection) + XML_FATAL1 ("