| 1 | /* $Id: pointers.c,v 1.2 2000-03-01 18:49:34 jeroen Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * Mesa 3-D graphics library
|
|---|
| 5 | * Version: 3.1
|
|---|
| 6 | *
|
|---|
| 7 | * Copyright (C) 1999 Brian Paul All Rights Reserved.
|
|---|
| 8 | *
|
|---|
| 9 | * Permission is hereby granted, free of charge, to any person obtaining a
|
|---|
| 10 | * copy of this software and associated documentation files (the "Software"),
|
|---|
| 11 | * to deal in the Software without restriction, including without limitation
|
|---|
| 12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|---|
| 13 | * and/or sell copies of the Software, and to permit persons to whom the
|
|---|
| 14 | * Software is furnished to do so, subject to the following conditions:
|
|---|
| 15 | *
|
|---|
| 16 | * The above copyright notice and this permission notice shall be included
|
|---|
| 17 | * in all copies or substantial portions of the Software.
|
|---|
| 18 | *
|
|---|
| 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|---|
| 20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|---|
| 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|---|
| 22 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|---|
| 23 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|---|
| 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 | #ifdef PC_HEADER
|
|---|
| 32 | #include "all.h"
|
|---|
| 33 | #else
|
|---|
| 34 | #ifndef XFree86Server
|
|---|
| 35 | #include <stdio.h>
|
|---|
| 36 | #include <stdlib.h>
|
|---|
| 37 | #include <string.h>
|
|---|
| 38 | #else
|
|---|
| 39 | #include "GL/xf86glx.h"
|
|---|
| 40 | #endif
|
|---|
| 41 | #include "accum.h"
|
|---|
| 42 | #include "alpha.h"
|
|---|
| 43 | #include "attrib.h"
|
|---|
| 44 | #include "bitmap.h"
|
|---|
| 45 | #include "blend.h"
|
|---|
| 46 | #include "clip.h"
|
|---|
| 47 | #include "types.h"
|
|---|
| 48 | #include "context.h"
|
|---|
| 49 | #include "colortab.h"
|
|---|
| 50 | #include "copypix.h"
|
|---|
| 51 | #include "depth.h"
|
|---|
| 52 | #include "dlist.h"
|
|---|
| 53 | #include "drawpix.h"
|
|---|
| 54 | #include "enable.h"
|
|---|
| 55 | #include "eval.h"
|
|---|
| 56 | #include "feedback.h"
|
|---|
| 57 | #include "fog.h"
|
|---|
| 58 | #include "get.h"
|
|---|
| 59 | #include "glmisc.h"
|
|---|
| 60 | #include "extensions.h"
|
|---|
| 61 | #include "light.h"
|
|---|
| 62 | #include "lines.h"
|
|---|
| 63 | #include "logic.h"
|
|---|
| 64 | #include "macros.h"
|
|---|
| 65 | #include "masking.h"
|
|---|
| 66 | #include "matrix.h"
|
|---|
| 67 | #include "pixel.h"
|
|---|
| 68 | #include "points.h"
|
|---|
| 69 | #include "polygon.h"
|
|---|
| 70 | #include "pointers.h"
|
|---|
| 71 | #include "rastpos.h"
|
|---|
| 72 | #include "readpix.h"
|
|---|
| 73 | #include "rect.h"
|
|---|
| 74 | #include "scissor.h"
|
|---|
| 75 | #include "stencil.h"
|
|---|
| 76 | #include "teximage.h"
|
|---|
| 77 | #include "texobj.h"
|
|---|
| 78 | #include "texstate.h"
|
|---|
| 79 | #include "varray.h"
|
|---|
| 80 | #include "vbfill.h"
|
|---|
| 81 | #include "winpos.h"
|
|---|
| 82 | #endif
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 | #ifdef DEBUG
|
|---|
| 86 | /*
|
|---|
| 87 | * For debugging
|
|---|
| 88 | */
|
|---|
| 89 | static void check_pointers( struct gl_api_table *table )
|
|---|
| 90 | {
|
|---|
| 91 | void **entry;
|
|---|
| 92 | int numentries = sizeof( struct gl_api_table ) / sizeof(void*);
|
|---|
| 93 | int i;
|
|---|
| 94 |
|
|---|
| 95 | entry = (void **) table;
|
|---|
| 96 |
|
|---|
| 97 | for (i=0;i<numentries;i++) {
|
|---|
| 98 | if (!entry[i]) {
|
|---|
| 99 | printf("found uninitialized function pointer at %d\n", i );
|
|---|
| 100 | gl_problem(NULL, "Missing pointer in pointers.c");
|
|---|
| 101 | /*abort()*/
|
|---|
| 102 | }
|
|---|
| 103 | }
|
|---|
| 104 | }
|
|---|
| 105 | #endif
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 | /*
|
|---|
| 109 | * Assign all the pointers in 'table' to point to Mesa's immediate-mode
|
|---|
| 110 | * execution functions.
|
|---|
| 111 | */
|
|---|
| 112 | static void init_execution_pointers( struct gl_api_table *table )
|
|---|
| 113 | {
|
|---|
| 114 | table->Accum = gl_Accum;
|
|---|
| 115 | table->AlphaFunc = gl_AlphaFunc;
|
|---|
| 116 | table->AreTexturesResident = gl_AreTexturesResident;
|
|---|
| 117 | table->BindTexture = gl_BindTexture;
|
|---|
| 118 | table->Bitmap = gl_Bitmap;
|
|---|
| 119 | table->BlendColor = gl_BlendColor;
|
|---|
| 120 | table->BlendEquation = gl_BlendEquation;
|
|---|
| 121 | table->BlendFunc = gl_BlendFunc;
|
|---|
| 122 | table->BlendFuncSeparate = gl_BlendFuncSeparate;
|
|---|
| 123 | table->CallList = gl_CallList;
|
|---|
| 124 | table->CallLists = gl_CallLists;
|
|---|
| 125 | table->Clear = gl_Clear;
|
|---|
| 126 | table->ClearAccum = gl_ClearAccum;
|
|---|
| 127 | table->ClearColor = gl_ClearColor;
|
|---|
| 128 | table->ClearDepth = gl_ClearDepth;
|
|---|
| 129 | table->ClearIndex = gl_ClearIndex;
|
|---|
| 130 | table->ClearStencil = gl_ClearStencil;
|
|---|
| 131 | table->ClipPlane = gl_ClipPlane;
|
|---|
| 132 | table->ColorMask = gl_ColorMask;
|
|---|
| 133 | table->ColorMaterial = gl_ColorMaterial;
|
|---|
| 134 | table->ColorTable = gl_ColorTable;
|
|---|
| 135 | table->ColorSubTable = gl_ColorSubTable;
|
|---|
| 136 | table->CopyPixels = gl_CopyPixels;
|
|---|
| 137 | table->CopyTexImage1D = gl_CopyTexImage1D;
|
|---|
| 138 | table->CopyTexImage2D = gl_CopyTexImage2D;
|
|---|
| 139 | table->CopyTexSubImage1D = gl_CopyTexSubImage1D;
|
|---|
| 140 | table->CopyTexSubImage2D = gl_CopyTexSubImage2D;
|
|---|
| 141 | table->CopyTexSubImage3D = gl_CopyTexSubImage3D;
|
|---|
| 142 | table->CullFace = gl_CullFace;
|
|---|
| 143 | table->DeleteLists = gl_DeleteLists;
|
|---|
| 144 | table->DeleteTextures = gl_DeleteTextures;
|
|---|
| 145 | table->DepthFunc = gl_DepthFunc;
|
|---|
| 146 | table->DepthMask = gl_DepthMask;
|
|---|
| 147 | table->DepthRange = gl_DepthRange;
|
|---|
| 148 | table->Disable = gl_Disable;
|
|---|
| 149 | table->DisableClientState = gl_DisableClientState;
|
|---|
| 150 | table->DrawBuffer = gl_DrawBuffer;
|
|---|
| 151 | table->DrawPixels = gl_DrawPixels;
|
|---|
| 152 | table->Enable = gl_Enable;
|
|---|
| 153 | table->Error = gl_error;
|
|---|
| 154 | table->EnableClientState = gl_EnableClientState;
|
|---|
| 155 | table->EndList = gl_EndList;
|
|---|
| 156 | table->EvalMesh1 = gl_EvalMesh1;
|
|---|
| 157 | table->EvalMesh2 = gl_EvalMesh2;
|
|---|
| 158 | table->FeedbackBuffer = gl_FeedbackBuffer;
|
|---|
| 159 | table->Finish = gl_Finish;
|
|---|
| 160 | table->Flush = gl_Flush;
|
|---|
| 161 | table->Fogfv = gl_Fogfv;
|
|---|
| 162 | table->FrontFace = gl_FrontFace;
|
|---|
| 163 | table->Frustum = gl_Frustum;
|
|---|
| 164 | table->GenLists = gl_GenLists;
|
|---|
| 165 | table->GenTextures = gl_GenTextures;
|
|---|
| 166 | table->GetBooleanv = gl_GetBooleanv;
|
|---|
| 167 | table->GetClipPlane = gl_GetClipPlane;
|
|---|
| 168 | table->GetColorTable = gl_GetColorTable;
|
|---|
| 169 | table->GetColorTableParameteriv = gl_GetColorTableParameteriv;
|
|---|
| 170 | table->GetDoublev = gl_GetDoublev;
|
|---|
| 171 | table->GetError = gl_GetError;
|
|---|
| 172 | table->GetFloatv = gl_GetFloatv;
|
|---|
| 173 | table->GetIntegerv = gl_GetIntegerv;
|
|---|
| 174 | table->GetPointerv = gl_GetPointerv;
|
|---|
| 175 | table->GetLightfv = gl_GetLightfv;
|
|---|
| 176 | table->GetLightiv = gl_GetLightiv;
|
|---|
| 177 | table->GetMapdv = gl_GetMapdv;
|
|---|
| 178 | table->GetMapfv = gl_GetMapfv;
|
|---|
| 179 | table->GetMapiv = gl_GetMapiv;
|
|---|
| 180 | table->GetMaterialfv = gl_GetMaterialfv;
|
|---|
| 181 | table->GetMaterialiv = gl_GetMaterialiv;
|
|---|
| 182 | table->GetPixelMapfv = gl_GetPixelMapfv;
|
|---|
| 183 | table->GetPixelMapuiv = gl_GetPixelMapuiv;
|
|---|
| 184 | table->GetPixelMapusv = gl_GetPixelMapusv;
|
|---|
| 185 | table->GetPolygonStipple = gl_GetPolygonStipple;
|
|---|
| 186 | table->GetString = gl_GetString;
|
|---|
| 187 | table->GetTexEnvfv = gl_GetTexEnvfv;
|
|---|
| 188 | table->GetTexEnviv = gl_GetTexEnviv;
|
|---|
| 189 | table->GetTexGendv = gl_GetTexGendv;
|
|---|
| 190 | table->GetTexGenfv = gl_GetTexGenfv;
|
|---|
| 191 | table->GetTexGeniv = gl_GetTexGeniv;
|
|---|
| 192 | table->GetTexImage = gl_GetTexImage;
|
|---|
| 193 | table->GetTexLevelParameterfv = gl_GetTexLevelParameterfv;
|
|---|
| 194 | table->GetTexLevelParameteriv = gl_GetTexLevelParameteriv;
|
|---|
| 195 | table->GetTexParameterfv = gl_GetTexParameterfv;
|
|---|
| 196 | table->GetTexParameteriv = gl_GetTexParameteriv;
|
|---|
| 197 | table->Hint = gl_Hint;
|
|---|
| 198 | table->IndexMask = gl_IndexMask;
|
|---|
| 199 | table->InitNames = gl_InitNames;
|
|---|
| 200 | table->IsEnabled = gl_IsEnabled;
|
|---|
| 201 | table->IsList = gl_IsList;
|
|---|
| 202 | table->IsTexture = gl_IsTexture;
|
|---|
| 203 | table->LightModelfv = gl_LightModelfv;
|
|---|
| 204 | table->Lightfv = gl_Lightfv;
|
|---|
| 205 | table->LineStipple = gl_LineStipple;
|
|---|
| 206 | table->LineWidth = gl_LineWidth;
|
|---|
| 207 | table->ListBase = gl_ListBase;
|
|---|
| 208 | table->LoadIdentity = gl_LoadIdentity;
|
|---|
| 209 | table->LoadMatrixf = gl_LoadMatrixf;
|
|---|
| 210 | table->LoadName = gl_LoadName;
|
|---|
| 211 | table->LogicOp = gl_LogicOp;
|
|---|
| 212 | table->Map1f = gl_Map1f;
|
|---|
| 213 | table->Map2f = gl_Map2f;
|
|---|
| 214 | table->MapGrid1f = gl_MapGrid1f;
|
|---|
| 215 | table->MapGrid2f = gl_MapGrid2f;
|
|---|
| 216 | table->MatrixMode = gl_MatrixMode;
|
|---|
| 217 | table->MultMatrixf = gl_MultMatrixf;
|
|---|
| 218 | table->NewList = gl_NewList;
|
|---|
| 219 | table->Ortho = gl_Ortho;
|
|---|
| 220 | table->PassThrough = gl_PassThrough;
|
|---|
| 221 | table->PixelMapfv = gl_PixelMapfv;
|
|---|
| 222 | table->PixelStorei = gl_PixelStorei;
|
|---|
| 223 | table->PixelTransferf = gl_PixelTransferf;
|
|---|
| 224 | table->PixelZoom = gl_PixelZoom;
|
|---|
| 225 | table->PointSize = gl_PointSize;
|
|---|
| 226 | table->PolygonMode = gl_PolygonMode;
|
|---|
| 227 | table->PolygonOffset = gl_PolygonOffset;
|
|---|
| 228 | table->PolygonStipple = gl_PolygonStipple;
|
|---|
| 229 | table->PopAttrib = gl_PopAttrib;
|
|---|
| 230 | table->PopClientAttrib = gl_PopClientAttrib;
|
|---|
| 231 | table->PopMatrix = gl_PopMatrix;
|
|---|
| 232 | table->PopName = gl_PopName;
|
|---|
| 233 | table->PrioritizeTextures = gl_PrioritizeTextures;
|
|---|
| 234 | table->PushAttrib = gl_PushAttrib;
|
|---|
| 235 | table->PushClientAttrib = gl_PushClientAttrib;
|
|---|
| 236 | table->PushMatrix = gl_PushMatrix;
|
|---|
| 237 | table->PushName = gl_PushName;
|
|---|
| 238 | table->RasterPos4f = gl_RasterPos4f;
|
|---|
| 239 | table->ReadBuffer = gl_ReadBuffer;
|
|---|
| 240 | table->ReadPixels = gl_ReadPixels;
|
|---|
| 241 | table->Rectf = gl_Rectf;
|
|---|
| 242 | table->RenderMode = gl_RenderMode;
|
|---|
| 243 | table->Rotatef = gl_Rotatef;
|
|---|
| 244 | table->Scalef = gl_Scalef;
|
|---|
| 245 | table->Scissor = gl_Scissor;
|
|---|
| 246 | table->SelectBuffer = gl_SelectBuffer;
|
|---|
| 247 | table->ShadeModel = gl_ShadeModel;
|
|---|
| 248 | table->StencilFunc = gl_StencilFunc;
|
|---|
| 249 | table->StencilMask = gl_StencilMask;
|
|---|
| 250 | table->StencilOp = gl_StencilOp;
|
|---|
| 251 | table->TexEnvfv = gl_TexEnvfv;
|
|---|
| 252 | table->TexGenfv = gl_TexGenfv;
|
|---|
| 253 | table->TexImage1D = gl_TexImage1D;
|
|---|
| 254 | table->TexImage2D = gl_TexImage2D;
|
|---|
| 255 | table->TexImage3D = gl_TexImage3D;
|
|---|
| 256 | table->TexSubImage1D = gl_TexSubImage1D;
|
|---|
| 257 | table->TexSubImage2D = gl_TexSubImage2D;
|
|---|
| 258 | table->TexSubImage3D = gl_TexSubImage3D;
|
|---|
| 259 | table->PointParameterfvEXT = gl_PointParameterfvEXT;
|
|---|
| 260 | table->TexParameterfv = gl_TexParameterfv;
|
|---|
| 261 | table->Translatef = gl_Translatef;
|
|---|
| 262 | table->Viewport = gl_Viewport;
|
|---|
| 263 |
|
|---|
| 264 | /* GL_MESA_window_pos extension */
|
|---|
| 265 | table->WindowPos4fMESA = gl_WindowPos4fMESA;
|
|---|
| 266 |
|
|---|
| 267 | /* GL_MESA_resize_buffers extension */
|
|---|
| 268 | table->ResizeBuffersMESA = gl_ResizeBuffersMESA;
|
|---|
| 269 |
|
|---|
| 270 | /* GL_ARB_multitexture */
|
|---|
| 271 | table->ActiveTexture = gl_ActiveTexture;
|
|---|
| 272 | table->ClientActiveTexture = gl_ClientActiveTexture;
|
|---|
| 273 | }
|
|---|
| 274 |
|
|---|
| 275 |
|
|---|
| 276 |
|
|---|
| 277 |
|
|---|
| 278 | void gl_init_api_function_pointers( GLcontext *ctx )
|
|---|
| 279 | {
|
|---|
| 280 | init_execution_pointers( &ctx->Exec );
|
|---|
| 281 |
|
|---|
| 282 | gl_init_dlist_pointers( &ctx->Save );
|
|---|
| 283 |
|
|---|
| 284 | #ifdef DEBUG
|
|---|
| 285 | /* make sure there's no NULL pointers */
|
|---|
| 286 | check_pointers( &ctx->Exec );
|
|---|
| 287 | check_pointers( &ctx->Save );
|
|---|
| 288 | #endif
|
|---|
| 289 | }
|
|---|
| 290 |
|
|---|